From d1a24727d496e3d845204735175f5b81dcbaa5fb Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Thu, 17 Mar 2022 16:38:30 +0800 Subject: [PATCH 01/17] =?UTF-8?q?=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/service/impl/UserServiceImpl.java | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserServiceImpl.java index a6f88e5c0f..ee45a0afe7 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserServiceImpl.java @@ -467,18 +467,29 @@ public class UserServiceImpl extends BaseServiceImpl implem //2、修改历史徽章表 LambdaUpdateWrapper recUpdate=new LambdaUpdateWrapper<>(); - recUpdate.set(UserBadgeCertificateRecordEntity::getGridId,newGridInfo.getId()); + recUpdate.set(UserBadgeCertificateRecordEntity::getGridId,newGridInfo.getId()) + .set(UserBadgeCertificateRecordEntity::getUpdatedBy,formDTO.getUserId()) + .set(UserBadgeCertificateRecordEntity::getUpdatedTime,new Date()); recUpdate.eq(UserBadgeCertificateRecordEntity::getCustomerId,formDTO.getCustomerId()) .eq(UserBadgeCertificateRecordEntity::getUserId,formDTO.getUserId()); userBadgeCertificateRecordDao.update(null,recUpdate); LambdaUpdateWrapper badgeUpdate=new LambdaUpdateWrapper<>(); - badgeUpdate.set(ResiUserBadgeEntity::getGridId,newGridInfo.getId()); + badgeUpdate.set(ResiUserBadgeEntity::getGridId,newGridInfo.getId()) + .set(ResiUserBadgeEntity::getUpdatedBy,formDTO.getUserId()) + .set(ResiUserBadgeEntity::getUpdatedTime,new Date());; badgeUpdate.eq(ResiUserBadgeEntity::getCustomerId,formDTO.getCustomerId()) .eq(ResiUserBadgeEntity::getUserId,formDTO.getUserId()); resiUserBadgeDao.update(null,badgeUpdate); //3、修改支援者信息表 + modifyVolunteerGrid(formDTO,newGridInfo); + + //4、删除用户缓存信息 + userBaseInfoRedis.clearUserCache(Arrays.asList(formDTO.getUserId())); + } + + private void modifyVolunteerGrid(ModifyRegGridFormDTO formDTO, GridInfoCache newGridInfo) { VolunteerInfoDTO volunteerInfoDTO=new VolunteerInfoDTO(); volunteerInfoDTO.setCustomerId(formDTO.getCustomerId()); volunteerInfoDTO.setUserId(formDTO.getUserId()); @@ -490,8 +501,6 @@ public class UserServiceImpl extends BaseServiceImpl implem if (!volunteerRes.success()) { throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "居民端_修改注册网格:修改用户志愿者信息异常", "服务器开小差了..."); } - //4、删除用户缓存信息 - userBaseInfoRedis.clearUserCache(Arrays.asList(formDTO.getUserId())); } } From 90c1207acc8c0dc0e43a155701f993543c2e0568 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Thu, 17 Mar 2022 16:52:22 +0800 Subject: [PATCH 02/17] =?UTF-8?q?=E6=A0=B9=E6=8D=AEuserId=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E6=B3=A8=E5=86=8C=E7=BD=91=E6=A0=BCID=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E7=AD=9B=E9=80=89=E6=9D=A1=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/mapper/RegisterRelationDao.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/RegisterRelationDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/RegisterRelationDao.xml index 74c1691615..3ce51f018a 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/RegisterRelationDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/RegisterRelationDao.xml @@ -79,7 +79,7 @@ From c540404bf6ca70a67a6764ebc23e347ca84e3412 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Thu, 17 Mar 2022 18:15:50 +0800 Subject: [PATCH 03/17] =?UTF-8?q?commonFeign=E5=88=A0=E9=99=A4=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E7=BD=91=E6=A0=BC=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/commons/tools/feign/CommonAggFeignClient.java | 8 -------- .../feign/fallback/CommonAggFeignClientFallback.java | 4 ---- 2 files changed, 12 deletions(-) diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/CommonAggFeignClient.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/CommonAggFeignClient.java index 5a03583011..5ec2ed2e44 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/CommonAggFeignClient.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/CommonAggFeignClient.java @@ -37,12 +37,4 @@ public interface CommonAggFeignClient { @PostMapping("/data/aggregator/org/agency") Result getAgencyInfo(@RequestParam("agencyId")String agencyId); - /** - * @Description 查询网格信息 - * @param gridId - * @author zxc - * @date 2021/11/5 2:54 下午 - */ - @PostMapping("/data/aggregator/org/grid") - Result getGridInfo(@RequestParam("gridId")String gridId); } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/fallback/CommonAggFeignClientFallback.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/fallback/CommonAggFeignClientFallback.java index 02f209f4f2..317e7bb131 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/fallback/CommonAggFeignClientFallback.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/fallback/CommonAggFeignClientFallback.java @@ -28,8 +28,4 @@ public class CommonAggFeignClientFallback implements CommonAggFeignClient { return ModuleUtils.feignConError(ServiceConstant.DATA_AGGREGATOR_SERVER, "getAgencyInfo", agencyId); } - @Override - public Result getGridInfo(String gridId) { - return ModuleUtils.feignConError(ServiceConstant.DATA_AGGREGATOR_SERVER, "getGridInfo", gridId); - } } From e20910681e61006541930e434e2d49f9eb122dc7 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Thu, 17 Mar 2022 19:05:04 +0800 Subject: [PATCH 04/17] user_reg_grid_change_rec --- .../epmet/dao/UserRegGridChangeRecDao.java | 16 ++++++++ .../entity/UserRegGridChangeRecEntity.java | 41 +++++++++++++++++++ .../epmet/service/impl/UserServiceImpl.java | 15 ++++++- .../V0.0.25__create_user_reg_grid_rec.sql | 14 +++++++ .../mapper/UserRegGridChangeRecDao.xml | 8 ++++ 5 files changed, 92 insertions(+), 2 deletions(-) create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserRegGridChangeRecDao.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/entity/UserRegGridChangeRecEntity.java create mode 100644 epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.25__create_user_reg_grid_rec.sql create mode 100644 epmet-user/epmet-user-server/src/main/resources/mapper/UserRegGridChangeRecDao.xml diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserRegGridChangeRecDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserRegGridChangeRecDao.java new file mode 100644 index 0000000000..c14ace1ab7 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserRegGridChangeRecDao.java @@ -0,0 +1,16 @@ +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.UserRegGridChangeRecEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 用户注册网格变更记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-03-17 + */ +@Mapper +public interface UserRegGridChangeRecDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/UserRegGridChangeRecEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/UserRegGridChangeRecEntity.java new file mode 100644 index 0000000000..262c79e608 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/UserRegGridChangeRecEntity.java @@ -0,0 +1,41 @@ +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 用户注册网格变更记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-03-17 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("user_reg_grid_change_rec") +public class UserRegGridChangeRecEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户id + */ + private String customerId; + + /** + * 居民端用户id + */ + private String userId; + + /** + * 原始网格id + */ + private String originGridId; + + /** + * 当前所选择的注册网格 + */ + private String gridId; + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserServiceImpl.java index ee45a0afe7..12380e64c2 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserServiceImpl.java @@ -75,6 +75,9 @@ public class UserServiceImpl extends BaseServiceImpl implem private UserBadgeCertificateRecordDao userBadgeCertificateRecordDao; @Autowired private UserBaseInfoRedis userBaseInfoRedis; + @Autowired + private UserRegGridChangeRecDao UserRegGridChangeRecDao; + private static final Logger log = LoggerFactory.getLogger(UserServiceImpl.class); @@ -438,8 +441,9 @@ public class UserServiceImpl extends BaseServiceImpl implem @Override public void modifyRegGrid(ModifyRegGridFormDTO formDTO) { GridInfoCache newGridInfo= CustomerOrgRedis.getGridInfo(formDTO.getGridId()); - if (null == newGridInfo) { - throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "居民端_修改注册网格:查询当前网格信息异常", "服务器开小差了..."); + RegisterRelationEntity originReg=registerRelationDao.selectRegisteredGridIdByUserIdAndCustomerId(formDTO.getUserId(),formDTO.getCustomerId()); + if (null == newGridInfo || null == originReg) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "居民端_修改注册网格:查询网格信息异常", "服务器开小差了..."); } //修改register_relation表 LambdaQueryWrapper originWrapper=new LambdaQueryWrapper(); @@ -487,6 +491,13 @@ public class UserServiceImpl extends BaseServiceImpl implem //4、删除用户缓存信息 userBaseInfoRedis.clearUserCache(Arrays.asList(formDTO.getUserId())); + //5、插入用户注册网格变更记录 + UserRegGridChangeRecEntity log=new UserRegGridChangeRecEntity(); + log.setCustomerId(formDTO.getCustomerId()); + log.setUserId(formDTO.getUserId()); + log.setOriginGridId(originReg.getGridId()); + log.setGridId(formDTO.getGridId()); + UserRegGridChangeRecDao.insert(log); } private void modifyVolunteerGrid(ModifyRegGridFormDTO formDTO, GridInfoCache newGridInfo) { diff --git a/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.25__create_user_reg_grid_rec.sql b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.25__create_user_reg_grid_rec.sql new file mode 100644 index 0000000000..85a0db8e18 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.25__create_user_reg_grid_rec.sql @@ -0,0 +1,14 @@ +CREATE TABLE `user_reg_grid_change_rec` ( + `ID` varchar(64) NOT NULL COMMENT '主键', + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户id', + `USER_ID` varchar(64) NOT NULL COMMENT '居民端用户id', + `ORIGIN_GRID_ID` varchar(64) NOT NULL COMMENT '原始网格id', + `GRID_ID` varchar(64) NOT NULL COMMENT '当前所选择的注册网格', + `DEL_FLAG` varchar(1) NOT NULL DEFAULT '0' COMMENT '删除标识 1删除;0未删除', + `REVISION` int(11) NOT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户注册网格变更记录表'; \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/UserRegGridChangeRecDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/UserRegGridChangeRecDao.xml new file mode 100644 index 0000000000..4fcd5c664e --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/UserRegGridChangeRecDao.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file From 9b0d2eb78cdf253ecb1e9fd23186ef1449efc316 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Thu, 17 Mar 2022 19:09:21 +0800 Subject: [PATCH 05/17] user_reg_grid_change_rec --- .../commons/tools/feign/CommonAggFeignClient.java | 10 ---------- .../feign/fallback/CommonAggFeignClientFallback.java | 6 ------ 2 files changed, 16 deletions(-) diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/CommonAggFeignClient.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/CommonAggFeignClient.java index cb7146138d..abcc6fc90b 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/CommonAggFeignClient.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/CommonAggFeignClient.java @@ -5,7 +5,6 @@ import com.epmet.commons.tools.feign.fallback.CommonAggFeignClientFallBackFactor import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache; import com.epmet.commons.tools.redis.common.bean.BuildingInfoCache; import com.epmet.commons.tools.redis.common.bean.CustomerStaffInfoCache; -import com.epmet.commons.tools.redis.common.bean.GridInfoCache; import com.epmet.commons.tools.utils.Result; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.PathVariable; @@ -39,15 +38,6 @@ public interface CommonAggFeignClient { @PostMapping("/data/aggregator/org/agency") Result getAgencyInfo(@RequestParam("agencyId")String agencyId); - /** - * @Description 查询网格信息 - * @param gridId - * @author zxc - * @date 2021/11/5 2:54 下午 - */ - @PostMapping("/data/aggregator/org/grid") - Result getGridInfo(@RequestParam("gridId")String gridId); - /** * 查询楼栋信息 * @param buildingId diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/fallback/CommonAggFeignClientFallback.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/fallback/CommonAggFeignClientFallback.java index 8d6f5f1260..4aff62f235 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/fallback/CommonAggFeignClientFallback.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/fallback/CommonAggFeignClientFallback.java @@ -5,7 +5,6 @@ import com.epmet.commons.tools.feign.CommonAggFeignClient; import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache; import com.epmet.commons.tools.redis.common.bean.BuildingInfoCache; import com.epmet.commons.tools.redis.common.bean.CustomerStaffInfoCache; -import com.epmet.commons.tools.redis.common.bean.GridInfoCache; import com.epmet.commons.tools.utils.ModuleUtils; import com.epmet.commons.tools.utils.Result; import org.springframework.stereotype.Component; @@ -29,11 +28,6 @@ public class CommonAggFeignClientFallback implements CommonAggFeignClient { return ModuleUtils.feignConError(ServiceConstant.DATA_AGGREGATOR_SERVER, "getAgencyInfo", agencyId); } - @Override - public Result getGridInfo(String gridId) { - return ModuleUtils.feignConError(ServiceConstant.DATA_AGGREGATOR_SERVER, "getGridInfo", gridId); - } - /** * 查询楼栋信息 * From 0dc2f58ea0e8d8b25091fcf643dd4ad78c283029 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Thu, 17 Mar 2022 19:28:44 +0800 Subject: [PATCH 06/17] =?UTF-8?q?=E5=85=88=E6=94=BE=E5=BC=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gov-org-server/src/main/resources/mapper/CustomerGridDao.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml index 426b4fbb0a..c3390d9cc9 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml @@ -342,7 +342,6 @@ WHERE cg.del_flag = '0' AND ca.del_flag = '0' AND cg.SYNC_FLAG='1' - and cg.ABANDON_FLAG='0' AND cg.id IN #{id} From 7cec5ec2e2aaac3b3ebf1b90a6e585f9c27838b3 Mon Sep 17 00:00:00 2001 From: jianjun Date: Thu, 17 Mar 2022 19:46:40 +0800 Subject: [PATCH 07/17] =?UTF-8?q?=E5=88=A0=E9=99=A4=E7=BD=91=E6=A0=BC?= =?UTF-8?q?=E8=AE=BF=E9=97=AE=E8=AE=B0=E5=BD=95-=E5=BA=9F=E5=BC=83?= =?UTF-8?q?=E7=BD=91=E6=A0=BC=E6=97=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/feign/EpmetUserFeignClient.java | 11 ++++++++++- .../feign/fallback/EpmetUserFeignClientFallBack.java | 5 +++++ .../epmet/service/impl/CustomerGridServiceImpl.java | 6 +++++- .../java/com/epmet/controller/BadgeController.java | 9 ++++++--- .../com/epmet/controller/GridLatestController.java | 11 +++++++++++ .../java/com/epmet/service/GridLatestService.java | 8 ++++++++ .../com/epmet/service/impl/GridLatestServiceImpl.java | 11 ++++++++++- 7 files changed, 55 insertions(+), 6 deletions(-) diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java index b29dfbcdac..8190c9418d 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java @@ -157,11 +157,20 @@ public interface EpmetUserFeignClient { Result getCustomerStaffList(List staffIdList); /** - * desc:删除审核中的徽章认证记录 + * desc:删除审核中的徽章认证记录-弃用网格是调用 * @param customerId * @param gridId * @return */ @PostMapping("/epmetuser/badge/deleteBadgeCertificateAuditing") Result deleteBadgeCertificateAuditing(@RequestParam("customerId") String customerId, @RequestParam("gridId") String gridId); + + /** + * desc:删除弃用网格的访问记录-弃用网格是调用 + * @param customerId + * @param gridId + * @return + */ + @PostMapping("/epmetuser/gridlatest/deleteGridLatestData") + Result deleteGridLatestData(@RequestParam("customerId") String customerId, @RequestParam("gridId") String gridId); } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java index 70bc8b7892..4594d36a60 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java @@ -96,4 +96,9 @@ public class EpmetUserFeignClientFallBack implements EpmetUserFeignClient { public Result deleteBadgeCertificateAuditing(String customerId, String gridId) { return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "deleteBadgeCertificateAuditing", customerId, gridId); } + + @Override + public Result deleteGridLatestData(String customerId, String gridId) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "deleteGridLatestData", customerId, gridId); + } } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java index c337f989e3..70945c6fe1 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java @@ -1046,7 +1046,11 @@ public class CustomerGridServiceImpl extends BaseServiceImpl gridLatestResult = epmetUserFeignClient.deleteGridLatestData(customerId,gridId); + if (gridLatestResult == null || !gridLatestResult.success()){ + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"删除网格访问记录失败,请稍后重试"); + } //处理成功,隐藏网格 LambdaUpdateWrapper updateGrid=new LambdaUpdateWrapper<>(); updateGrid.set(CustomerGridEntity::getAbandonFlag,NumConstant.ONE); diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/BadgeController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/BadgeController.java index 37c56eeac9..eace8b90b0 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/BadgeController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/BadgeController.java @@ -1,7 +1,9 @@ package com.epmet.controller; import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.annotation.RequirePermission; import com.epmet.commons.tools.aop.NoRepeatSubmit; +import com.epmet.commons.tools.enums.RequirePermissionEnum; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; @@ -218,11 +220,12 @@ public class BadgeController { } /** - * Desc: 查询网格下是否存在未审核的徽章,true:是,false:否 + * desc:删除审核中的徽章认证记录-弃用网格是调用 + * @param customerId * @param gridId - * @author zxc - * @date 2022/3/16 9:42 上午 + * @return */ + @RequirePermission(requirePermission = RequirePermissionEnum.ORG_GRID_DELETE) @PostMapping("deleteBadgeCertificateAuditing") public Result deleteBadgeCertificateAuditing(@RequestParam("customerId") String customerId,@RequestParam("gridId")String gridId){ return new Result().ok(badgeService.deleteBadgeCertificateAuditing(customerId,gridId)); diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/GridLatestController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/GridLatestController.java index c470d793a9..b1b07c4e9e 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/GridLatestController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/GridLatestController.java @@ -143,4 +143,15 @@ public class GridLatestController { return new Result().ok(gridLatestService.latestGridInfo(formDTO)); } + /** + * desc:删除弃用网格的访问记录-弃用网格是调用 + * @param customerId + * @param gridId + * @return + */ + @PostMapping("deleteGridLatestData") + public Result deleteGridLatestData(@RequestParam("customerId") String customerId,@RequestParam("gridId")String gridId){ + return new Result().ok(gridLatestService.deleteGridLatestData(customerId,gridId)); + } + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GridLatestService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GridLatestService.java index e9ff239d1e..2ba30ae954 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GridLatestService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GridLatestService.java @@ -140,4 +140,12 @@ public interface GridLatestService extends BaseService { * @Date 2020/8/3 **/ LatestGridInfoResultDTO latestGridInfo(LatestGridInfoFormDTO formDTO); + + /** + * desc:删除弃用网格的访问记录-弃用网格是调用 + * @param customerId + * @param gridId + * @return + */ + Integer deleteGridLatestData(String customerId, String gridId); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GridLatestServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GridLatestServiceImpl.java index 58f9383078..fabf993292 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GridLatestServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GridLatestServiceImpl.java @@ -19,6 +19,7 @@ package com.epmet.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.FieldConstant; @@ -36,7 +37,6 @@ import com.epmet.dto.result.CustomerUser4PointResultDTO; import com.epmet.dto.result.LatestGridInfoResultDTO; import com.epmet.dto.result.UserBaseInfoResultDTO; import com.epmet.entity.GridLatestEntity; -import com.epmet.feign.EpmetHeartOpenFeignClient; import com.epmet.redis.UserBaseInfoRedis; import com.epmet.service.GridLatestService; import com.epmet.util.ModuleConstant; @@ -210,4 +210,13 @@ public class GridLatestServiceImpl extends BaseServiceImpl wrapper = new LambdaUpdateWrapper(); + wrapper.eq(GridLatestEntity::getCustomerId,customerId) + .eq(GridLatestEntity::getGridId,gridId) + .set(GridLatestEntity::getUpdatedTime,System.currentTimeMillis()); + return baseDao.delete(wrapper); + } + } From 0b1040d6bae84e5422b3f331793bbaf254833c8e Mon Sep 17 00:00:00 2001 From: wangxianzhang Date: Thu, 17 Mar 2022 22:05:39 +0800 Subject: [PATCH 08/17] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E6=97=A0=E7=94=A8?= =?UTF-8?q?=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/IcResiUserImportServiceImpl.java | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserImportServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserImportServiceImpl.java index 182259a39f..c8c3438297 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserImportServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserImportServiceImpl.java @@ -363,8 +363,6 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res String loginUserId = EpmetRequestHolder.getHeader(AppClientConstant.USER_ID.toLowerCase()); String loginUserCustomerId = EpmetRequestHolder.getHeader(AppClientConstant.CUSTOMER_ID.toLowerCase()); - log.info("importIcResiBaseInfoFromExcel:: userId:{}, app:{}, client:{}, customerId:{}", loginUserId, loginUserApp, loginUserClient, loginUserCustomerId); - IcResiImportDynamicExcelListener readListener = new IcResiImportDynamicExcelListener(this, customerId, currentUserId, currUserAgencyId, currUserAgencyPids, true, tableName, formItemList, headRowNumber); EasyExcel.read(new File(excelPathName)).registerReadListener(readListener).headRowNumber(headRowNumber).sheet(sheetNo).doRead(); @@ -549,8 +547,6 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res String loginUserId = EpmetRequestHolder.getHeader(AppClientConstant.USER_ID.toLowerCase()); String loginUserCustomerId = EpmetRequestHolder.getHeader(AppClientConstant.CUSTOMER_ID.toLowerCase()); - log.info("persistIcResiExtraInfo:: userId:{}, app:{}, client:{}, customerId:{}", loginUserId, loginUserApp, loginUserClient, loginUserCustomerId); - // 遍历每一行,将行内容转化为 for (Map row : dataRows) { @@ -1001,7 +997,6 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res List options = null; - log.info("optionsUrl:{}, currUserAgencyId:{}", pureUri, currUserAgencyId); //this.printLog("listRemoteOptions"); switch (pureUri) { case "/epmetuser/icresidemanddict/demandoption": @@ -1043,9 +1038,6 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res } nform.setGridId(gridId); - //this.printLog("listRemoteOptions#neighborhoodoption"); - log.info("neighborhoodoption:{},{}", currUserAgencyId, gridId); - options = getResultDataOrThrowsException(govOrgOpenFeignClient.getNeighborHoodOptions(nform), ServiceConstant.GOV_ORG_SERVER, EpmetErrorCode.SERVER_ERROR.getCode(), null, null); break; case "/sys/dict/data/education": @@ -1834,15 +1826,6 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res } } - public void printLog(String positionPrefix) { - String app = EpmetRequestHolder.getHeader(AppClientConstant.APP); - String client = EpmetRequestHolder.getHeader(AppClientConstant.CLIENT); - String loginUserId = EpmetRequestHolder.getHeader(AppClientConstant.USER_ID.toLowerCase()); - String loginUserCustomerId = EpmetRequestHolder.getHeader(AppClientConstant.CUSTOMER_ID.toLowerCase()); - - log.info("{}:: userId:{}, app:{}, client:{}, customerId:{}", positionPrefix, loginUserId, app, client, loginUserCustomerId); - } - @Override public Object testAsync() { IcNeighborHoodDTO nform = new IcNeighborHoodDTO(); From 6ba5fd400907abdb7c0541b0abb8c67b0d1ac03a Mon Sep 17 00:00:00 2001 From: wangxianzhang Date: Fri, 18 Mar 2022 00:31:04 +0800 Subject: [PATCH 09/17] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=BC=96=E8=AF=91?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../handler/IcResiImportDynamicExcelListener.java | 11 ----------- .../service/impl/IcResiUserImportServiceImpl.java | 4 ---- 2 files changed, 15 deletions(-) diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/IcResiImportDynamicExcelListener.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/IcResiImportDynamicExcelListener.java index b390d10a39..427e70f0a3 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/IcResiImportDynamicExcelListener.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/IcResiImportDynamicExcelListener.java @@ -122,18 +122,12 @@ public class IcResiImportDynamicExcelListener extends AnalysisEventListener> headers = icResiUserImportService.mergeMultiLevelHeadLabels(headList); - icResiUserImportService.printLog("invokeHeadMap_1_" + isPrimary); - // 清洗表头数据,通过items剔除,并且得到options abandonedHeaders = icResiUserImportService.removeAndGetOptionsFromHeaders(headers, formItemList); - icResiUserImportService.printLog("invokeHeadMap_2_" + isPrimary); - // 交换表头信息,以label连起来的string作为key,列号的列表作为value HashMap> combinedHeaders = icResiUserImportService.exchangeKeyAndValueOfHeaders(headers); - icResiUserImportService.printLog("invokeHeadMap_3_" + isPrimary); - // 得到客户配置item数据。<"兴趣爱好:兴趣特长", item对象> Map customizedLabelCompbinedItemsMap = formItemList.stream().collect( Collectors.toMap(formItem -> { @@ -147,11 +141,7 @@ public class IcResiImportDynamicExcelListener extends AnalysisEventListener formItem) ); - icResiUserImportService.printLog("invokeHeadMap_4_" + isPrimary); - itemIdAndColumnWrapper = icResiUserImportService.convertExcelHeaders2DBColumnWrappers(customizedLabelCompbinedItemsMap, combinedHeaders); - - icResiUserImportService.printLog("invokeHeadMap_5_" + isPrimary); } /** @@ -182,7 +172,6 @@ public class IcResiImportDynamicExcelListener extends AnalysisEventListener checkBoxOptionColumnIdxAndLabel, String currUserAgencyPids, String currentUserId, String tableName) { - //this.printLog("persistIcResiBaseInfo"); - // 遍历每一行,将行内容转化为 for (Map row : dataRows) { @@ -996,8 +994,6 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res } List options = null; - - //this.printLog("listRemoteOptions"); switch (pureUri) { case "/epmetuser/icresidemanddict/demandoption": options = getResultDataOrThrowsException(epmetUserOpenFeignClient.getDemandOptions(), ServiceConstant.EPMET_USER_SERVER, From 2a144cd01ffa0a09ceb71820a1d3ecac41a95f10 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Fri, 18 Mar 2022 09:46:16 +0800 Subject: [PATCH 10/17] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../screen/impl/ScreenCustomerGridServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerGridServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerGridServiceImpl.java index 268330f03b..308a9113c9 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerGridServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerGridServiceImpl.java @@ -128,7 +128,7 @@ public class ScreenCustomerGridServiceImpl extends BaseServiceImpl w = new LambdaQueryWrapper<>(); w.eq(ScreenCustomerGridEntity::getGridId, grid.getId()); ScreenCustomerGridEntity e = new ScreenCustomerGridEntity(); - e.setDataEndTime(NumConstant.ONE_STR); + e.setDelFlag(NumConstant.ONE_STR); e.setUpdatedTime(new Date()); screenCustomerGridDao.update(e,w); // 此delete不更新 updatedTime From 97e726421a7f8001c4c613d6448f2d614f29bac9 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Fri, 18 Mar 2022 10:53:21 +0800 Subject: [PATCH 11/17] qrcode --- epmet-module/gov-org/gov-org-server/pom.xml | 13 +++++ .../epmet/controller/AgencyController.java | 54 +++++++++++++++++++ 2 files changed, 67 insertions(+) diff --git a/epmet-module/gov-org/gov-org-server/pom.xml b/epmet-module/gov-org/gov-org-server/pom.xml index 777645a3c1..793d33b424 100644 --- a/epmet-module/gov-org/gov-org-server/pom.xml +++ b/epmet-module/gov-org/gov-org-server/pom.xml @@ -13,6 +13,19 @@ jar + + + com.google.zxing + core + 3.3.2 + + + + com.google.zxing + javase + 3.3.2 + + com.epmet gov-org-client diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/AgencyController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/AgencyController.java index 363f7b7297..26db2c084f 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/AgencyController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/AgencyController.java @@ -17,6 +17,7 @@ package com.epmet.controller; +import com.alibaba.fastjson.JSONObject; import com.epmet.commons.rocketmq.messages.OrgOrStaffMQMsg; import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.annotation.RequirePermission; @@ -34,11 +35,20 @@ import com.epmet.feign.EpmetMessageOpenFeignClient; import com.epmet.send.SendMqMsgUtil; import com.epmet.service.AgencyService; import com.epmet.service.CustomerAgencyService; +import com.google.zxing.BarcodeFormat; +import com.google.zxing.EncodeHintType; +import com.google.zxing.MultiFormatWriter; +import com.google.zxing.WriterException; +import com.google.zxing.client.j2se.MatrixToImageWriter; +import com.google.zxing.common.BitMatrix; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import java.io.IOException; +import java.nio.file.FileSystems; +import java.nio.file.Path; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -360,4 +370,48 @@ public class AgencyController { return new Result>().ok(agencyService.getSonAgencyId(orgId,type)); } + @PostMapping("qr") + public void qr(){ + try { + write(); + } catch (IOException e) { + e.printStackTrace(); + } catch (WriterException e) { + e.printStackTrace(); + } + } + + public static void write() throws IOException, WriterException { + String filePath = "/Volumes/self"; + String fileName = "qr.png"; +//二维码内容场景一:json数据 + JSONObject json = new JSONObject(); + json.put("baidu","http://www.baidu.com");//二维码一般就是存储链接 +// json.put("author", "lzz");//还可存储值(员工工号,员工姓名,年会二维码门票) + String content = json.toJSONString();//json 内容 +//二维码内容场景二:直接某个超链接 +// content="http://www.baidu.com";//直接某个超链接 + int width = 200; // 图像宽度 + int height = 200; // 图像高度 + String format = "png";// 图像类型 + Map hints = new HashMap(); + + hints.put(EncodeHintType.CHARACTER_SET, "UTF-8"); + BitMatrix bitMatrix = new MultiFormatWriter().encode(content, + BarcodeFormat.QR_CODE, width, height, hints);// 生成矩阵 + Path path = FileSystems.getDefault().getPath(filePath, fileName); + MatrixToImageWriter.writeToPath(bitMatrix, format, path);// 输出图像 + System.out.println("输出成功."); + } + + public static void main(String[] args) { + try { + write(); + } catch (IOException e) { + e.printStackTrace(); + } catch (WriterException e) { + e.printStackTrace(); + } + } + } \ No newline at end of file From e5db510163058fb01bfc09ea412c736038c6b27a Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Fri, 18 Mar 2022 14:14:41 +0800 Subject: [PATCH 12/17] =?UTF-8?q?=E6=94=BE=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epmet-gateway/src/main/resources/bootstrap.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/epmet-gateway/src/main/resources/bootstrap.yml b/epmet-gateway/src/main/resources/bootstrap.yml index 598f8d7518..493796923f 100644 --- a/epmet-gateway/src/main/resources/bootstrap.yml +++ b/epmet-gateway/src/main/resources/bootstrap.yml @@ -526,12 +526,18 @@ epmet: - /data/stats/plugins/ofs/** - /data/stats/plugins/workrecord/** - /epmetuser/staffrole/getGridStaffList #py获取网格员 网格长 - + #查询楼栋,单元,房屋 + - /gov/org/icbuilding/buildingoption + - /gov/org/icbuildingunit/unitoption + - /gov/org/ichouse/houseoption # 对外开放接口认证白名单 externalAuthUrlsWhiteList: - /epmet/ext/open-api/get-access-token - + #查询楼栋,单元,房屋 + - /gov/org/icbuilding/buildingoption + - /gov/org/icbuildingunit/unitoption + - /gov/org/ichouse/houseoption swaggerUrls: jwt: From 3f4e8a95b0d24d0bee657eecf715cb96003a6645 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Fri, 18 Mar 2022 14:19:06 +0800 Subject: [PATCH 13/17] =?UTF-8?q?=E5=A4=9A=E4=BA=86=E5=90=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epmet-gateway/src/main/resources/bootstrap.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/epmet-gateway/src/main/resources/bootstrap.yml b/epmet-gateway/src/main/resources/bootstrap.yml index 493796923f..17168a52b0 100644 --- a/epmet-gateway/src/main/resources/bootstrap.yml +++ b/epmet-gateway/src/main/resources/bootstrap.yml @@ -526,10 +526,7 @@ epmet: - /data/stats/plugins/ofs/** - /data/stats/plugins/workrecord/** - /epmetuser/staffrole/getGridStaffList #py获取网格员 网格长 - #查询楼栋,单元,房屋 - - /gov/org/icbuilding/buildingoption - - /gov/org/icbuildingunit/unitoption - - /gov/org/ichouse/houseoption + # 对外开放接口认证白名单 externalAuthUrlsWhiteList: From 2cb82878fd01257c7b0ed93ba9ad5d837271dccf Mon Sep 17 00:00:00 2001 From: jianjun Date: Fri, 18 Mar 2022 14:20:10 +0800 Subject: [PATCH 14/17] =?UTF-8?q?=E5=B0=8F=E5=8C=BA=E4=BA=8C=E7=BB=B4?= =?UTF-8?q?=E7=A0=81=E7=94=9F=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epmet-commons/epmet-commons-tools/pom.xml | 11 ++ .../commons/tools/utils/BarcodeUtils.java | 177 ++++++++++++++++++ .../epmet/controller/AgencyController.java | 4 +- 3 files changed, 190 insertions(+), 2 deletions(-) create mode 100644 epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/BarcodeUtils.java diff --git a/epmet-commons/epmet-commons-tools/pom.xml b/epmet-commons/epmet-commons-tools/pom.xml index c551a68db1..7542899ad0 100644 --- a/epmet-commons/epmet-commons-tools/pom.xml +++ b/epmet-commons/epmet-commons-tools/pom.xml @@ -166,6 +166,17 @@ transmittable-thread-local 2.12.4 + + com.google.zxing + core + 3.3.2 + + + + com.google.zxing + javase + 3.3.2 + diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/BarcodeUtils.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/BarcodeUtils.java new file mode 100644 index 0000000000..555643e9e1 --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/BarcodeUtils.java @@ -0,0 +1,177 @@ +package com.epmet.commons.tools.utils; + +/** + * desc: + * + * @author: LiuJanJun + * @date: 2022/3/18 11:57 上午 + * @version: 1.0 + */ + + +import com.google.zxing.BarcodeFormat; +import com.google.zxing.EncodeHintType; +import com.google.zxing.MultiFormatWriter; +import com.google.zxing.WriterException; +import com.google.zxing.client.j2se.MatrixToImageConfig; +import com.google.zxing.client.j2se.MatrixToImageWriter; +import com.google.zxing.common.BitMatrix; +import com.google.zxing.common.CharacterSetECI; +import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel; + +import javax.imageio.ImageIO; +import java.awt.*; +import java.awt.image.BufferedImage; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.IOException; +import java.util.HashMap; + +/** + * Author 程鹏 + * Date: 2021/08/27 16:01 + * Description:二维码生成工具类 + */ +public class BarcodeUtils { + /** + * 二维码颜色 默认是黑色 + */ + private static final Color QRCOLOR = Color.black; + /** + * 背景颜色 + */ + private static final Color BGWHITE = Color.white; + public static final int WIDTH = 360; + public static final int HEIGHT = 512; + public static final int MARGIN = 2; + public static final int FONTSIZE = 20; + + + /** + * // 二维码生成 + * + * @param contents 说明 + * @return BufferedImage + * @throws Exception + */ + public static BufferedImage drawQRImage(String pressText, String contents) throws Exception { + BufferedImage qRImage = null; + if (contents == null || "".equals(contents)) { + throw new Exception("content说明不能为空"); + } + // 二维码参数设置 + HashMap hints = new HashMap<>(); + hints.put(EncodeHintType.CHARACTER_SET, CharacterSetECI.UTF8); // 编码设置 + hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.H); // 安全等级,最高h + hints.put(EncodeHintType.MARGIN, MARGIN); // 设置margin=0-10 + + // 二维码图片的生成 + BarcodeFormat format = BarcodeFormat.QR_CODE; + // 创建矩阵容器 + BitMatrix matrix = null; + try { + matrix = new MultiFormatWriter().encode(contents, format, WIDTH, HEIGHT, hints); + } catch (WriterException e) { + e.printStackTrace(); + } + + // 设置矩阵转为图片的参数 + MatrixToImageConfig toImageConfig = new MatrixToImageConfig(QRCOLOR.getRGB(), BGWHITE.getRGB()); + + // 矩阵转换图像 + qRImage = MatrixToImageWriter.toBufferedImage(matrix, toImageConfig); + return pressText(pressText, qRImage); + } + + /** + * @param pressText 二维码下方插入文字 + * @param image 需要添加文字的图片 + * @为图片添加文字 + */ + private static BufferedImage pressText(String pressText, BufferedImage image) throws Exception { + + BufferedImage outImage = new BufferedImage(WIDTH, HEIGHT, BufferedImage.TYPE_INT_RGB); + //计算文字开始的位置 + //x开始的位置:(图片宽度-字体大小*字的个数)/2 + int startX = (WIDTH - (FONTSIZE * pressText.length())) / 2; + //y开始的位置:图片高度-(图片高度-图片宽度)/2 + int startY = HEIGHT - (HEIGHT - WIDTH) / 2; + + int imageW = outImage.getWidth(); + int imageH = outImage.getHeight(); + Graphics2D g = outImage.createGraphics(); + g.drawImage(image, 0, 0, imageW, imageH, null); + g.setColor(QRCOLOR); + g.setFont(new Font("微软雅黑", Font.BOLD, FONTSIZE)); + g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); + g.setBackground(Color.white); +// 获取文字数量 按照字节展示 + int size = pressText.getBytes("GBK").length; +// 获取一行最多能容纳多少文字 按照文字字节展示 + int maxSize = (WIDTH / FONTSIZE - 2) * 2; + if (size > maxSize) { + int v = size % maxSize; + for (int a = 0; a < (size / maxSize); a++) { + String s = outStringByByte(pressText, maxSize); + g.drawString(s, (WIDTH - (FONTSIZE * (WIDTH / FONTSIZE - 2))) / 2, startY); + pressText = pressText.substring(s.length(), pressText.length()); + startY = startY + 30; + } + if (v != 0) { + g.drawString(pressText, (WIDTH - (FONTSIZE * v)) / 2, startY); + } + } else { + g.drawString(pressText, (WIDTH - ((pressText.getBytes("GBK").length) / 2) * FONTSIZE) / 2, startY); + } + + g.dispose(); + return outImage; + } + + + /** + * 保存二维码图片到本地 + * + * @param contents + * @throws Exception + */ + public static void createImg(String pressText, String contents, String filename, String filePath) throws Exception { + BufferedImage qRImageWithLogo = drawQRImage(pressText, contents); + // 写入返回 + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + ImageIO.write(qRImageWithLogo, "jpg", baos); + //图片类型 + String imageType = "jpg"; + //生成二维码存放文件 + File file = new File(filePath + filename + ".jpg"); + if (!file.exists()) { + file.mkdirs(); + } + ImageIO.write(qRImageWithLogo, imageType, file); + baos.close(); + } + + + private static String outStringByByte(String str, int len) throws IOException { + byte[] btf = str.getBytes("gbk"); + int count = 0; + + for (int j = len - 1; j >= 0; j--) { + if (btf[j] < 0) { + count++; + } else { + break; + } + } + + if (count % 2 == 0) { + return new String(btf, 0, len, "gbk"); + } else { + return new String(btf, 0, len - 1, "gbk"); + } + + } + + +} + diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/AgencyController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/AgencyController.java index 26db2c084f..a482511982 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/AgencyController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/AgencyController.java @@ -382,7 +382,7 @@ public class AgencyController { } public static void write() throws IOException, WriterException { - String filePath = "/Volumes/self"; + String filePath = "/Users/liujianjun/Downloads"; String fileName = "qr.png"; //二维码内容场景一:json数据 JSONObject json = new JSONObject(); @@ -414,4 +414,4 @@ public class AgencyController { } } -} \ No newline at end of file +} From 635d5a4c08589a53291d3df2e0e95c314f257700 Mon Sep 17 00:00:00 2001 From: jianjun Date: Fri, 18 Mar 2022 14:21:28 +0800 Subject: [PATCH 15/17] =?UTF-8?q?=E5=B0=8F=E5=8C=BA=E4=BA=8C=E7=BB=B4?= =?UTF-8?q?=E7=A0=81=E7=94=9F=E6=88=90=20con?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/IcNeighborHoodController.java | 58 ++++++++++++++++++- 1 file changed, 55 insertions(+), 3 deletions(-) diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcNeighborHoodController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcNeighborHoodController.java index dadab70ce5..0eb59ec477 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcNeighborHoodController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcNeighborHoodController.java @@ -19,18 +19,20 @@ package com.epmet.controller; import com.alibaba.fastjson.JSON; import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.dto.result.OptionResultDTO; +import com.epmet.commons.tools.enums.EnvEnum; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.BarcodeUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.AssertUtils; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.commons.tools.validator.group.AddGroup; import com.epmet.commons.tools.validator.group.DefaultGroup; import com.epmet.commons.tools.validator.group.UpdateGroup; -import com.epmet.constant.ImportErrorMsgConstants; import com.epmet.constants.ImportTaskConstants; import com.epmet.dto.IcNeighborHoodDTO; import com.epmet.dto.form.ImportInfoFormDTO; @@ -43,8 +45,12 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; -import java.io.IOException; -import java.io.InputStream; +import javax.imageio.ImageIO; +import javax.imageio.stream.ImageOutputStream; +import javax.servlet.http.HttpServletResponse; +import java.awt.image.BufferedImage; +import java.io.*; +import java.net.URLEncoder; import java.util.List; import java.util.Map; @@ -165,4 +171,50 @@ public class IcNeighborHoodController { return new Result(); } + /** + * Desc: 根据房屋IDs查询房屋下是否有存在居民的 + * @param id + * @author zxc + * @date 2022/3/2 10:32 上午 + */ + @PostMapping("createQrCode/{id}") + public void getExistUserByHouseIds(@LoginUser TokenDto tokenDto, @PathVariable("id") String id, HttpServletResponse response){ + try { + IcNeighborHoodDTO icNeighborHoodDTO = icNeighborHoodService.get(id); + if (icNeighborHoodDTO == null){ + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"小区信息不存在"); + } + String neighborhoodName = icNeighborHoodDTO.getNeighborHoodName(); + //String url = "https://demo.tduckapp.com/s/7314b64b3a26455ab793fb8c640856b6?id="+id; + String url = EnvEnum.getCurrentEnv().getUrl().replace("api/",StrConstant.EPMETY_STR) + .concat("epmet-oper-gov/#/") + .concat(id) + .concat(StrConstant.AND_MARK).concat("userId=").concat(tokenDto.getUserId()); + BufferedImage image = BarcodeUtils.drawQRImage(neighborhoodName, url); + //BufferedImage 转 InputStream + ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); + ImageOutputStream imageOutput = ImageIO.createImageOutputStream(byteArrayOutputStream); + ImageIO.write(image, "png", imageOutput); + InputStream inputStream = new ByteArrayInputStream(byteArrayOutputStream.toByteArray()); + long length = imageOutput.length(); + String fileName = neighborhoodName+".png"; + response.setContentType("application/octet-stream"); + response.setContentLength((int)length); + response.setHeader("Content-Disposition","attachment;filename="+ URLEncoder.encode(fileName, StrConstant.UTF_8)); + + //输出流 + byte[] bytes = new byte[1024]; + OutputStream outputStream = response.getOutputStream(); + long count = 0; + while(count < length){ + int len = inputStream.read(bytes, 0, 1024); + count +=len; + outputStream.write(bytes, 0, len); + } + outputStream.flush(); + } catch (Exception e) { + e.printStackTrace(); + } + } + } From 80efeaadf34766e55acd71865cb9ba11d7a4db0e Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Fri, 18 Mar 2022 14:21:38 +0800 Subject: [PATCH 16/17] =?UTF-8?q?=E5=86=85=E9=83=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epmet-gateway/src/main/resources/bootstrap.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/epmet-gateway/src/main/resources/bootstrap.yml b/epmet-gateway/src/main/resources/bootstrap.yml index 17168a52b0..a5a7127cdd 100644 --- a/epmet-gateway/src/main/resources/bootstrap.yml +++ b/epmet-gateway/src/main/resources/bootstrap.yml @@ -499,7 +499,10 @@ epmet: - /oper/customize/customerstartpage/homestartpage - /epmet/point/mqCallback/** - /tduck-api/** - + #查询楼栋,单元,房屋 + - /gov/org/icbuilding/buildingoption + - /gov/org/icbuildingunit/unitoption + - /gov/org/ichouse/houseoption # 外部应用认证,使用AccessToken等头进行认证 externalOpenUrls: - /data/report/** @@ -531,10 +534,6 @@ epmet: # 对外开放接口认证白名单 externalAuthUrlsWhiteList: - /epmet/ext/open-api/get-access-token - #查询楼栋,单元,房屋 - - /gov/org/icbuilding/buildingoption - - /gov/org/icbuildingunit/unitoption - - /gov/org/ichouse/houseoption swaggerUrls: jwt: From 97e577187bc3b06a583637b7d527f2fa9e9b6db7 Mon Sep 17 00:00:00 2001 From: jianjun Date: Fri, 18 Mar 2022 14:22:12 +0800 Subject: [PATCH 17/17] =?UTF-8?q?=E5=B0=8F=E5=8C=BA=E4=BA=8C=E7=BB=B4?= =?UTF-8?q?=E7=A0=81=E7=94=9F=E6=88=90=20pom?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epmet-module/gov-org/gov-org-server/pom.xml | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/epmet-module/gov-org/gov-org-server/pom.xml b/epmet-module/gov-org/gov-org-server/pom.xml index 793d33b424..777645a3c1 100644 --- a/epmet-module/gov-org/gov-org-server/pom.xml +++ b/epmet-module/gov-org/gov-org-server/pom.xml @@ -13,19 +13,6 @@ jar - - - com.google.zxing - core - 3.3.2 - - - - com.google.zxing - javase - 3.3.2 - - com.epmet gov-org-client