From 1f787e4262a64d71cfa6c4fd3d05f43db71dd770 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Fri, 22 Jul 2022 17:44:24 +0800 Subject: [PATCH 01/28] =?UTF-8?q?=E7=BD=91=E6=A0=BC=E5=91=98=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E4=B8=8A=E6=8A=A5=20mq?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/user/result/GridUserInfoDTO.java | 7 ++++ .../impl/DataReportingServiceImpl.java | 1 + .../epmet/feign/GovOrgOpenFeignClient.java | 4 +- .../opendata/dao/GridstaffInfoPingyinDao.java | 2 + .../OpenDataStaffChangeEventListener.java | 4 +- .../service/GridstaffInfoPingyinService.java | 7 ++++ .../impl/GridstaffInfoPingyinServiceImpl.java | 41 +++++++++++++++++++ .../mapper/GridstaffInfoPingyinDao.xml | 12 ++++++ .../dto/result/GridStaffUploadResultDTO.java | 13 +++++- .../epmet/feign/EpmetUserOpenFeignClient.java | 4 +- .../resources/mapper/CustomerStaffDao.xml | 4 +- 11 files changed, 91 insertions(+), 8 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/user/result/GridUserInfoDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/user/result/GridUserInfoDTO.java index c70b0332e4..0cec8927b6 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/user/result/GridUserInfoDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/user/result/GridUserInfoDTO.java @@ -20,6 +20,7 @@ package com.epmet.dto.user.result; import lombok.Data; import java.io.Serializable; +import java.util.Date; /** @@ -78,6 +79,12 @@ public class GridUserInfoDTO implements Serializable { */ private String sex; + /** + * 网格员信息编辑插入、更新时间,,县市区填写 + */ + private Date updateTime; + + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/DataReportingServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/DataReportingServiceImpl.java index 22a853c0ed..6b75d8d8d7 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/DataReportingServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/DataReportingServiceImpl.java @@ -118,6 +118,7 @@ public class DataReportingServiceImpl implements DataReportingService { st.setUserType(dto.getWorkType().equals("fulltime") ? "01" : "02"); st.setPhonenumber(dto.getMobile()); st.setSex(0 == dto.getGender() ? "9" : dto.getGender().toString()); + st.setUpdateTime(dto.getUpdatedTime()); } }); diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java index 8967a44663..a1cd92ff01 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java @@ -21,8 +21,8 @@ import java.util.Set; * @author yinzuomei@elink-cn.com * @date 2020/6/4 13:37 */ -// @FeignClient(name = ServiceConstant.GOV_ORG_SERVER, fallbackFactory = GovOrgOpenFeignClientFallbackFactory.class, url = "localhost:8092") -@FeignClient(name = ServiceConstant.GOV_ORG_SERVER, fallbackFactory = GovOrgOpenFeignClientFallbackFactory.class) + @FeignClient(name = ServiceConstant.GOV_ORG_SERVER, fallbackFactory = GovOrgOpenFeignClientFallbackFactory.class, url = "localhost:8092") +//@FeignClient(name = ServiceConstant.GOV_ORG_SERVER, fallbackFactory = GovOrgOpenFeignClientFallbackFactory.class) public interface GovOrgOpenFeignClient { /** diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/GridstaffInfoPingyinDao.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/GridstaffInfoPingyinDao.java index d607093a12..ccbf1d6405 100755 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/GridstaffInfoPingyinDao.java +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/GridstaffInfoPingyinDao.java @@ -14,4 +14,6 @@ import org.apache.ibatis.annotations.Mapper; public interface GridstaffInfoPingyinDao extends BaseDao { void del(); + + void edit(GridstaffInfoPingyinEntity entity); } \ No newline at end of file diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/mq/listener/OpenDataStaffChangeEventListener.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/mq/listener/OpenDataStaffChangeEventListener.java index ad7bd79b62..0171205e28 100644 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/mq/listener/OpenDataStaffChangeEventListener.java +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/mq/listener/OpenDataStaffChangeEventListener.java @@ -12,6 +12,7 @@ import com.epmet.commons.tools.redis.RedisUtils; import com.epmet.commons.tools.utils.SpringContextUtils; import com.epmet.opendata.dto.form.StaffBaseInfoFormDTO; import com.epmet.opendata.service.ExUserService; +import com.epmet.opendata.service.GridstaffInfoPingyinService; import org.apache.commons.lang3.StringUtils; import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyContext; import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyStatus; @@ -86,7 +87,8 @@ public class OpenDataStaffChangeEventListener implements MessageListenerConcurre List staffIdList = new ArrayList<>(); staffIdList.add(obj.getOrgId()); dto.setStaffIdList(staffIdList); - SpringContextUtils.getBean(ExUserService.class).getStaffBaseInfo(dto); + //SpringContextUtils.getBean(ExUserService.class).getStaffBaseInfo(dto); + SpringContextUtils.getBean(GridstaffInfoPingyinService.class).getStaffBaseInfo(dto); } catch (RenException e) { // 如果是我们手动抛出的异常,说明在业务可控范围内。目前不需要MQ重试 logger.error("【开放数据事件监听器】-工作人员信息变更-初始化客户组织失败:".concat(ExceptionUtils.getErrorStackTrace(e))); diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/GridstaffInfoPingyinService.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/GridstaffInfoPingyinService.java index fc0ae09ed3..9164dad0ac 100755 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/GridstaffInfoPingyinService.java +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/GridstaffInfoPingyinService.java @@ -2,6 +2,7 @@ package com.epmet.opendata.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.opendata.dto.form.GridStaffInfoFormDTO; +import com.epmet.opendata.dto.form.StaffBaseInfoFormDTO; import com.epmet.opendata.entity.GridstaffInfoPingyinEntity; import java.util.Map; @@ -15,4 +16,10 @@ import java.util.Map; public interface GridstaffInfoPingyinService extends BaseService { void gridStaffInfo(GridStaffInfoFormDTO formDTO); + + /** + * @Author sun + * @Description 网格员信息中间库同步 + **/ + void getStaffBaseInfo(StaffBaseInfoFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/GridstaffInfoPingyinServiceImpl.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/GridstaffInfoPingyinServiceImpl.java index 9af3b733fa..eb4bf5adc0 100755 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/GridstaffInfoPingyinServiceImpl.java +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/GridstaffInfoPingyinServiceImpl.java @@ -8,10 +8,14 @@ import com.epmet.dto.form.CustomerGridStaffListFormDTO; import com.epmet.dto.form.GridStaffUploadtFormDTO; import com.epmet.dto.result.CustomerGridStaffListResultDTO; import com.epmet.dto.result.GridStaffUploadResultDTO; +import com.epmet.dto.user.result.GridUserInfoDTO; +import com.epmet.feign.DataStatisticalOpenFeignClient; import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.feign.GovOrgOpenFeignClient; import com.epmet.opendata.dao.GridstaffInfoPingyinDao; import com.epmet.opendata.dto.form.GridStaffInfoFormDTO; +import com.epmet.opendata.dto.form.StaffBaseInfoFormDTO; +import com.epmet.opendata.entity.ExUserEntity; import com.epmet.opendata.entity.GridstaffInfoPingyinEntity; import com.epmet.opendata.service.GridstaffInfoPingyinService; import lombok.extern.slf4j.Slf4j; @@ -39,6 +43,8 @@ public class GridstaffInfoPingyinServiceImpl extends BaseServiceImpl> result = dataStatisticalOpenFeignClient.getStaffBaseInfo(formDTO1); + if (!result.success()) { + throw new RenException(result.getInternalMsg()); + } + + //2.中间库新增/修改数据【基本一个人一条数据,程序按批量处理】 + result.getData().forEach(r -> { + GridstaffInfoPingyinEntity entity = ConvertUtils.sourceToTarget(r, GridstaffInfoPingyinEntity.class); + entity.setQxBm("370124"); + entity.setQxMc("平阴县"); + entity.setGridCode(r.getCode()); + entity.setGridName(r.getGridName()); + entity.setUserType("01"); + entity.setIsLeave("N"); + if (!"staff_create".equals(formDTO.getType())) { + baseDao.edit(entity); + }else { + insert(entity); + } + }); + + + } + + } \ No newline at end of file diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/GridstaffInfoPingyinDao.xml b/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/GridstaffInfoPingyinDao.xml index 50b086ad03..9929895e9e 100755 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/GridstaffInfoPingyinDao.xml +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/GridstaffInfoPingyinDao.xml @@ -3,6 +3,18 @@ + + UPDATE gridstaff_info_pingyin + SET grid_name = #{gridName}, + nick_name = #{nickName}, + card_num = #{cardNum}, + phonenumber = #{phonenumber}, + sex = #{sex} + WHERE + grid_user_id = #{gridUserId} + AND grid_code = #{gridCode} + + delete from gridstaff_info_pingyin diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/GridStaffUploadResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/GridStaffUploadResultDTO.java index bc1c086578..16d0d386f5 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/GridStaffUploadResultDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/GridStaffUploadResultDTO.java @@ -1,9 +1,8 @@ package com.epmet.dto.result; -import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.Data; -import java.util.List; +import java.util.Date; /** * @description: 网格工作人员数据上报-查询客户网格下有效工作人员信息数据 @@ -36,4 +35,14 @@ public class GridStaffUploadResultDTO { */ private String sex; + /** + * 网格员类型,符合《标准》10.3 + */ + private String userType; + + /** + * 网格员信息编辑插入、更新时间,,县市区填写 + */ + private Date updateTime; + } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java index ff820d789f..9469423a92 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java @@ -25,8 +25,8 @@ import java.util.Set; * @author yinzuomei@elink-cn.com * @date 2020/6/4 13:09 */ -//@FeignClient(name = ServiceConstant.EPMET_USER_SERVER, fallbackFactory = EpmetUserOpenFeignClientFallbackFactory.class, url = "localhost:8087") -@FeignClient(name = ServiceConstant.EPMET_USER_SERVER, fallbackFactory = EpmetUserOpenFeignClientFallbackFactory.class) +@FeignClient(name = ServiceConstant.EPMET_USER_SERVER, fallbackFactory = EpmetUserOpenFeignClientFallbackFactory.class, url = "localhost:8087") +//@FeignClient(name = ServiceConstant.EPMET_USER_SERVER, fallbackFactory = EpmetUserOpenFeignClientFallbackFactory.class) public interface EpmetUserOpenFeignClient { /** diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml index 4335ca3468..e5d2289e5b 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml @@ -462,7 +462,9 @@ real_name nickName, id_card cardNum, gender sex, - mobile phonenumber + mobile phonenumber, + IF(work_type = 'fulltime', '01', '02') userType, + updated_time updateTime FROM customer_staff WHERE From adcdda9cbf772352544aef5df0eafd164082909b Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Fri, 22 Jul 2022 17:50:02 +0800 Subject: [PATCH 02/28] =?UTF-8?q?=E9=94=99=E6=8F=90=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java | 4 ++-- .../main/java/com/epmet/feign/EpmetUserOpenFeignClient.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java index a1cd92ff01..de9a14c512 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java @@ -21,8 +21,8 @@ import java.util.Set; * @author yinzuomei@elink-cn.com * @date 2020/6/4 13:37 */ - @FeignClient(name = ServiceConstant.GOV_ORG_SERVER, fallbackFactory = GovOrgOpenFeignClientFallbackFactory.class, url = "localhost:8092") -//@FeignClient(name = ServiceConstant.GOV_ORG_SERVER, fallbackFactory = GovOrgOpenFeignClientFallbackFactory.class) + //@FeignClient(name = ServiceConstant.GOV_ORG_SERVER, fallbackFactory = GovOrgOpenFeignClientFallbackFactory.class, url = "localhost:8092") +@FeignClient(name = ServiceConstant.GOV_ORG_SERVER, fallbackFactory = GovOrgOpenFeignClientFallbackFactory.class) public interface GovOrgOpenFeignClient { /** diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java index 9469423a92..ff820d789f 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java @@ -25,8 +25,8 @@ import java.util.Set; * @author yinzuomei@elink-cn.com * @date 2020/6/4 13:09 */ -@FeignClient(name = ServiceConstant.EPMET_USER_SERVER, fallbackFactory = EpmetUserOpenFeignClientFallbackFactory.class, url = "localhost:8087") -//@FeignClient(name = ServiceConstant.EPMET_USER_SERVER, fallbackFactory = EpmetUserOpenFeignClientFallbackFactory.class) +//@FeignClient(name = ServiceConstant.EPMET_USER_SERVER, fallbackFactory = EpmetUserOpenFeignClientFallbackFactory.class, url = "localhost:8087") +@FeignClient(name = ServiceConstant.EPMET_USER_SERVER, fallbackFactory = EpmetUserOpenFeignClientFallbackFactory.class) public interface EpmetUserOpenFeignClient { /** From 2c4cdaf51ed260742c58b527a774d5861e458922 Mon Sep 17 00:00:00 2001 From: jianjun Date: Fri, 22 Jul 2022 17:55:33 +0800 Subject: [PATCH 03/28] flyway --- epmet-module/open-data-worker/open-data-worker-server/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/epmet-module/open-data-worker/open-data-worker-server/pom.xml b/epmet-module/open-data-worker/open-data-worker-server/pom.xml index 167bff9af5..9fb7b95d22 100644 --- a/epmet-module/open-data-worker/open-data-worker-server/pom.xml +++ b/epmet-module/open-data-worker/open-data-worker-server/pom.xml @@ -304,7 +304,7 @@ callerRunsPolicy - true + false https://oapi.dingtalk.com/robot/send?access_token=a5f66c3374b1642fe2142dbf56d5997e280172d4e8f2b546c9423a68c82ece6c From c34398b8febb465ac0a80ce395c783859a74e9d7 Mon Sep 17 00:00:00 2001 From: jianjun Date: Fri, 22 Jul 2022 18:17:24 +0800 Subject: [PATCH 04/28] =?UTF-8?q?=E4=BE=8B=E8=A1=8C=E5=B7=A5=E4=BD=9C?= =?UTF-8?q?=E5=8E=BB=E6=8E=89=20=E7=BD=91=E6=A0=BC=E7=A9=BA=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/BaseGridDailyworkServiceImpl.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/BaseGridDailyworkServiceImpl.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/BaseGridDailyworkServiceImpl.java index 9542670330..bcb4df6f14 100644 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/BaseGridDailyworkServiceImpl.java +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/BaseGridDailyworkServiceImpl.java @@ -281,7 +281,12 @@ public class BaseGridDailyworkServiceImpl extends BaseServiceImpl list){ List insertList = new ArrayList<>(); - list.forEach(o-> insertList.add(buildNewEntity(o))); + list.forEach(o-> { + if (StringUtils.isBlank(o.getGridCode())){ + return; + } + insertList.add(buildNewEntity(o)); + }); //insert if (CollectionUtils.isEmpty(insertList)){ log.error("新构建要插入的数据为空,param:{}", JSON.toJSONString(list)); From 09550bd81c877556ea6376b7022fae2700bfcc52 Mon Sep 17 00:00:00 2001 From: zhaoqifeng Date: Fri, 22 Jul 2022 18:20:05 +0800 Subject: [PATCH 05/28] =?UTF-8?q?=E6=96=B0=E7=89=88=E4=BA=8B=E4=BB=B6?= =?UTF-8?q?=E4=B8=8A=E6=8A=A5=E7=AC=AC=E4=B8=89=E6=96=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/EventreportPingyinServiceImpl.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/EventreportPingyinServiceImpl.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/EventreportPingyinServiceImpl.java index db470aacf0..d1a61e8de3 100755 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/EventreportPingyinServiceImpl.java +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/EventreportPingyinServiceImpl.java @@ -138,8 +138,15 @@ public class EventreportPingyinServiceImpl extends BaseServiceImpl StringUtils.isNotBlank(item.getGridUserCardid())).collect(Collectors.toList()); + //过滤掉必填字段为空的数据 + entityList = entityList.stream().filter(item -> + StringUtils.isNotBlank(item.getGridCode()) && StringUtils.isNotBlank(item.getGridName()) && + StringUtils.isNotBlank(item.getEventCategory()) && StringUtils.isNotBlank(item.getGridUserName()) && + StringUtils.isNotBlank(item.getGridUserCardid()) && null != item.getReportTime() && + null != item.getHappenTime() && StringUtils.isNotBlank(item.getHappenPlace()) && + StringUtils.isNotBlank(item.getGridUserCardid()) && StringUtils.isNotBlank(item.getEventDescription()) && + StringUtils.isNotBlank(item.getWaysOfResolving()) && null != item.getLng() && null != item.getLat() + ).collect(Collectors.toList()); if (NumConstant.ZERO_STR.equals(initFlag)) { entityList.forEach(entity -> { LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); From 4c95d193732ed4ba9976649472153f256b6695c0 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Fri, 22 Jul 2022 19:22:13 +0800 Subject: [PATCH 06/28] =?UTF-8?q?=E5=AE=9E=E6=97=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../opendata/dto/form/ExractGridInfoPingYinFormDTO.java | 4 +++- .../opendata/service/impl/GridInfoPingyinServiceImpl.java | 8 ++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/epmet-module/open-data-worker/open-data-worker-client/src/main/java/com/epmet/opendata/dto/form/ExractGridInfoPingYinFormDTO.java b/epmet-module/open-data-worker/open-data-worker-client/src/main/java/com/epmet/opendata/dto/form/ExractGridInfoPingYinFormDTO.java index d57c25a387..b4324bb2ee 100644 --- a/epmet-module/open-data-worker/open-data-worker-client/src/main/java/com/epmet/opendata/dto/form/ExractGridInfoPingYinFormDTO.java +++ b/epmet-module/open-data-worker/open-data-worker-client/src/main/java/com/epmet/opendata/dto/form/ExractGridInfoPingYinFormDTO.java @@ -30,9 +30,11 @@ public class ExractGridInfoPingYinFormDTO implements Serializable { private List orgIdList; /** - * 操作类型【新增:add 修改删除:edit 初始化所有数据:all】 + * 废弃:这个不对。操作类型【新增:add 修改删除:edit 初始化所有数据:all】 + * 操作类型【组织新增:agency_create 组织变更:agency_change 网格新增:grid_create 网格变更:grid_change 人员新增:staff_create 人员变更:staff_change】 */ @NotBlank(message = "操作类型【新增:add 修改删除:edit 初始化所有数据:all】不能为空", groups = {GridInfo.class}) + private String type; } diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/GridInfoPingyinServiceImpl.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/GridInfoPingyinServiceImpl.java index d9e505adef..b7a15afd09 100755 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/GridInfoPingyinServiceImpl.java +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/GridInfoPingyinServiceImpl.java @@ -80,11 +80,11 @@ public class GridInfoPingyinServiceImpl extends BaseServiceImpl { this.insertBatch(list); }); - } else if ("add".equals(formDTO.getType())) { + } else if (formDTO.getType().contains("create")) { // 单独新增组织 this.insertBatch(gridInfoList); - } else if ("edit".equals(formDTO.getType())) { + } else if (formDTO.getType().contains("change")) { // 修改组织时,先根据code查询,如果有数据,更新 for (GridInfoPingyinEntity entity : gridInfoList) { From 426ea1a2902158b478b4daea9931248b51276457 Mon Sep 17 00:00:00 2001 From: zhaoqifeng Date: Fri, 22 Jul 2022 19:31:44 +0800 Subject: [PATCH 07/28] =?UTF-8?q?=E6=96=B0=E7=89=88=E4=BA=8B=E4=BB=B6?= =?UTF-8?q?=E4=B8=8A=E6=8A=A5=E7=AC=AC=E4=B8=89=E6=96=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../opendata/service/impl/EventreportPingyinServiceImpl.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/EventreportPingyinServiceImpl.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/EventreportPingyinServiceImpl.java index d1a61e8de3..1924b99d49 100755 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/EventreportPingyinServiceImpl.java +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/EventreportPingyinServiceImpl.java @@ -76,6 +76,7 @@ public class EventreportPingyinServiceImpl extends BaseServiceImpl entityList = list.stream().map(item -> { EventreportPingyinEntity entity = new EventreportPingyinEntity(); entity.setQxBm("370124"); @@ -138,6 +139,7 @@ public class EventreportPingyinServiceImpl extends BaseServiceImpl StringUtils.isNotBlank(item.getGridCode()) && StringUtils.isNotBlank(item.getGridName()) && From 6e9b8ee5f5aae91a2e6d396216adcbca053d3d10 Mon Sep 17 00:00:00 2001 From: zhaoqifeng Date: Fri, 22 Jul 2022 19:38:23 +0800 Subject: [PATCH 08/28] =?UTF-8?q?log=E7=BA=A7=E5=88=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/logback-spring.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/logback-spring.xml b/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/logback-spring.xml index 36ddc6f222..151f385f11 100644 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/logback-spring.xml +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/logback-spring.xml @@ -188,12 +188,12 @@ - + - + From b8476c1add9fb36404a6cb646ab3d3cb67f9f033 Mon Sep 17 00:00:00 2001 From: zhaoqifeng Date: Fri, 22 Jul 2022 19:41:36 +0800 Subject: [PATCH 09/28] =?UTF-8?q?log=E7=BA=A7=E5=88=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../opendata/service/impl/EventreportPingyinServiceImpl.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/EventreportPingyinServiceImpl.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/EventreportPingyinServiceImpl.java index 1924b99d49..08d3ffccf7 100755 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/EventreportPingyinServiceImpl.java +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/EventreportPingyinServiceImpl.java @@ -76,7 +76,7 @@ public class EventreportPingyinServiceImpl extends BaseServiceImpl entityList = list.stream().map(item -> { EventreportPingyinEntity entity = new EventreportPingyinEntity(); entity.setQxBm("370124"); @@ -149,6 +149,7 @@ public class EventreportPingyinServiceImpl extends BaseServiceImpl { LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); From aed1d0a9c48bf282cee8e84101d8585ed02073da Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Fri, 22 Jul 2022 19:43:48 +0800 Subject: [PATCH 10/28] editgrid --- .../src/main/resources/mapper/CustomerGridDao.xml | 4 +++- .../opendata/mq/listener/OpenDataOrgChangeEventListener.java | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) 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 bd6f04bbc8..c3d15d75e0 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 @@ -240,7 +240,9 @@ set grid_name = #{gridName}, manage_district = #{manageDistrict}, - code = #{code}, + + code = #{code}, + grid_type = #{gridType}, contacts = #{contacts}, mobile = #{mobile}, diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/mq/listener/OpenDataOrgChangeEventListener.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/mq/listener/OpenDataOrgChangeEventListener.java index 02fc563a78..deb7384c61 100644 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/mq/listener/OpenDataOrgChangeEventListener.java +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/mq/listener/OpenDataOrgChangeEventListener.java @@ -95,7 +95,9 @@ public class OpenDataOrgChangeEventListener implements MessageListenerConcurrent extractFormDto.setCustomerId(obj.getCustomerId()); extractFormDto.setType(obj.getType()); List orgIdList = new ArrayList<>(); - orgIdList.add(obj.getOrgId()); + if(StringUtils.isNotBlank(obj.getOrgId())){ + orgIdList.add(obj.getOrgId()); + } extractFormDto.setOrgIdList(orgIdList); if ("agency".equals(obj.getOrgType())) { SpringContextUtils.getBean(GridInfoPingyinService.class).exractAgency(extractFormDto); From 77c215872805a7606b47f34302f342a869138603 Mon Sep 17 00:00:00 2001 From: zhaoqifeng Date: Fri, 22 Jul 2022 20:19:25 +0800 Subject: [PATCH 11/28] =?UTF-8?q?log=E7=BA=A7=E5=88=AB=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/EventreportPingyinServiceImpl.java | 6 ------ .../src/main/resources/logback-spring.xml | 4 ++-- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/EventreportPingyinServiceImpl.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/EventreportPingyinServiceImpl.java index 08d3ffccf7..85eda36cfb 100755 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/EventreportPingyinServiceImpl.java +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/EventreportPingyinServiceImpl.java @@ -76,7 +76,6 @@ public class EventreportPingyinServiceImpl extends BaseServiceImpl entityList = list.stream().map(item -> { EventreportPingyinEntity entity = new EventreportPingyinEntity(); entity.setQxBm("370124"); @@ -108,9 +107,6 @@ public class EventreportPingyinServiceImpl extends BaseServiceImpl StringUtils.isNotBlank(item.getGridCode()) && StringUtils.isNotBlank(item.getGridName()) && @@ -149,7 +144,6 @@ public class EventreportPingyinServiceImpl extends BaseServiceImpl { LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/logback-spring.xml b/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/logback-spring.xml index 151f385f11..36ddc6f222 100644 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/logback-spring.xml +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/logback-spring.xml @@ -188,12 +188,12 @@ - + - + From eb8f40088f0b4ee44da4f7f00674278ce1e21347 Mon Sep 17 00:00:00 2001 From: jianjun Date: Fri, 22 Jul 2022 20:23:18 +0800 Subject: [PATCH 12/28] =?UTF-8?q?=E5=8E=BB=E6=8E=89id?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../opendata/entity/EventreportPingyinEntity.java | 7 ------- .../epmet/opendata/entity/GridInfoPingyinEntity.java | 7 ------- .../opendata/entity/GridstaffInfoPingyinEntity.java | 11 ++--------- .../service/impl/BaseGridDailyworkServiceImpl.java | 2 ++ 4 files changed, 4 insertions(+), 23 deletions(-) diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/entity/EventreportPingyinEntity.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/entity/EventreportPingyinEntity.java index 84cddbe1d3..0dc15d325a 100755 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/entity/EventreportPingyinEntity.java +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/entity/EventreportPingyinEntity.java @@ -1,8 +1,6 @@ package com.epmet.opendata.entity; import com.baomidou.mybatisplus.annotation.TableName; - -import com.epmet.commons.mybatis.entity.BaseEpmetEntity; import lombok.Data; import lombok.EqualsAndHashCode; @@ -22,11 +20,6 @@ public class EventreportPingyinEntity { private static final long serialVersionUID = 1L; - /** - * 数据库主键自增字段,请勿指定 - */ - private Long id; - /** * 上报区县代码,参照6位行政区划代码 */ diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/entity/GridInfoPingyinEntity.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/entity/GridInfoPingyinEntity.java index 6051db5f01..9f64f9175d 100755 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/entity/GridInfoPingyinEntity.java +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/entity/GridInfoPingyinEntity.java @@ -1,8 +1,6 @@ package com.epmet.opendata.entity; import com.baomidou.mybatisplus.annotation.TableName; - -import com.epmet.commons.mybatis.entity.BaseEpmetEntity; import lombok.Data; import lombok.EqualsAndHashCode; @@ -22,11 +20,6 @@ public class GridInfoPingyinEntity { private static final long serialVersionUID = 1L; - /** - * 数据库主键自增字段,请勿指定 - */ - private Long id; - /** * 上报区县代码,参照6位行政区划代码 */ diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/entity/GridstaffInfoPingyinEntity.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/entity/GridstaffInfoPingyinEntity.java index 0a53873f89..ef5fc9d982 100755 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/entity/GridstaffInfoPingyinEntity.java +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/entity/GridstaffInfoPingyinEntity.java @@ -1,8 +1,6 @@ package com.epmet.opendata.entity; import com.baomidou.mybatisplus.annotation.TableName; - -import com.epmet.commons.mybatis.entity.BaseEpmetEntity; import lombok.Data; import lombok.EqualsAndHashCode; @@ -21,11 +19,6 @@ public class GridstaffInfoPingyinEntity { private static final long serialVersionUID = 1L; - /** - * 数据库主键自增字段,请勿指定 - */ - private Long id; - /** * 上报区县代码,参照6位行政区划代码 */ @@ -97,7 +90,7 @@ public class GridstaffInfoPingyinEntity { private String education; /** - * 入职时间,格式为“YYYY-MM-DD” + * 入职时间,格式为“YYYY-MM-DD” */ private Date entryDate; @@ -107,7 +100,7 @@ public class GridstaffInfoPingyinEntity { private String isLeave; /** - * 离职时间,格式为“YYYY-MM-DD” + * 离职时间,格式为“YYYY-MM-DD” */ private Date leaveDate; diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/BaseGridDailyworkServiceImpl.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/BaseGridDailyworkServiceImpl.java index bcb4df6f14..4cc15727fb 100644 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/BaseGridDailyworkServiceImpl.java +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/BaseGridDailyworkServiceImpl.java @@ -209,6 +209,7 @@ public class BaseGridDailyworkServiceImpl extends BaseServiceImpl data; do { Result> record = epmetUserOpenFeignClient.getPatrolRoutineWorkListV2(midPatrolFormDTO); + midPatrolFormDTO.setPageNo(midPatrolFormDTO.getPageNo() + 1); if (record == null || !record.success()) { log.error("获取例行工作记录V2失败,param:{}", JSON.toJSONString(midPatrolFormDTO)); throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode()); @@ -231,6 +232,7 @@ public class BaseGridDailyworkServiceImpl extends BaseServiceImpl Date: Fri, 22 Jul 2022 21:03:30 +0800 Subject: [PATCH 13/28] log --- .../opendata/service/impl/EventreportPingyinServiceImpl.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/EventreportPingyinServiceImpl.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/EventreportPingyinServiceImpl.java index 85eda36cfb..8a7a330b06 100755 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/EventreportPingyinServiceImpl.java +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/EventreportPingyinServiceImpl.java @@ -135,6 +135,7 @@ public class EventreportPingyinServiceImpl extends BaseServiceImpl StringUtils.isNotBlank(item.getGridCode()) && StringUtils.isNotBlank(item.getGridName()) && @@ -144,6 +145,7 @@ public class EventreportPingyinServiceImpl extends BaseServiceImpl { LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); From d6c25932dfbbe552c828e33ec95700fcc08e08a0 Mon Sep 17 00:00:00 2001 From: zhaoqifeng Date: Fri, 22 Jul 2022 21:07:45 +0800 Subject: [PATCH 14/28] log --- .../opendata/service/impl/EventreportPingyinServiceImpl.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/EventreportPingyinServiceImpl.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/EventreportPingyinServiceImpl.java index 8a7a330b06..3a695437ba 100755 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/EventreportPingyinServiceImpl.java +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/EventreportPingyinServiceImpl.java @@ -154,8 +154,7 @@ public class EventreportPingyinServiceImpl extends BaseServiceImpl Date: Fri, 22 Jul 2022 21:14:41 +0800 Subject: [PATCH 15/28] id --- .../service/impl/GridstaffInfoPingyinServiceImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/GridstaffInfoPingyinServiceImpl.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/GridstaffInfoPingyinServiceImpl.java index eb4bf5adc0..6c58d2565a 100755 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/GridstaffInfoPingyinServiceImpl.java +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/GridstaffInfoPingyinServiceImpl.java @@ -15,7 +15,6 @@ import com.epmet.feign.GovOrgOpenFeignClient; import com.epmet.opendata.dao.GridstaffInfoPingyinDao; import com.epmet.opendata.dto.form.GridStaffInfoFormDTO; import com.epmet.opendata.dto.form.StaffBaseInfoFormDTO; -import com.epmet.opendata.entity.ExUserEntity; import com.epmet.opendata.entity.GridstaffInfoPingyinEntity; import com.epmet.opendata.service.GridstaffInfoPingyinService; import lombok.extern.slf4j.Slf4j; @@ -118,6 +117,7 @@ public class GridstaffInfoPingyinServiceImpl extends BaseServiceImpl Date: Fri, 22 Jul 2022 21:21:18 +0800 Subject: [PATCH 16/28] id --- .../java/com/epmet/opendata/dao/GridInfoPingyinDao.java | 4 ++-- .../opendata/service/impl/GridInfoPingyinServiceImpl.java | 6 +++--- .../src/main/resources/mapper/GridInfoPingyinDao.xml | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/GridInfoPingyinDao.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/GridInfoPingyinDao.java index e070cc30ce..0ae3ac01e9 100755 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/GridInfoPingyinDao.java +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/GridInfoPingyinDao.java @@ -23,9 +23,9 @@ public interface GridInfoPingyinDao extends BaseDao { List selectByGridCode(String gridCode); - int updateSomeCol(@Param("id") Long id, + int updateSomeCol(@Param("gridCode") String gridCode, @Param("gridName")String gridName, @Param("gridLevel")Integer gridLevel, @Param("lng")BigDecimal lng, @Param("lat")BigDecimal lat); -} \ No newline at end of file +} diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/GridInfoPingyinServiceImpl.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/GridInfoPingyinServiceImpl.java index b7a15afd09..454ef351fc 100755 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/GridInfoPingyinServiceImpl.java +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/GridInfoPingyinServiceImpl.java @@ -94,7 +94,7 @@ public class GridInfoPingyinServiceImpl extends BaseServiceImpl select g.* from grid_info_pingyin g - where g.grid_code = #{gridCode} + where g.grid_code = #{gridCode} and is_del = 'N' @@ -42,6 +42,6 @@ grid_level = #{gridLevel}, lng = #{lng}, lat = #{lat} - where id = #{id} + where grid_code = #{gridCode} and is_del = 'N' - \ No newline at end of file + From e42b5c11e6ef9a47be72d2bcc627a88126bda9af Mon Sep 17 00:00:00 2001 From: jianjun Date: Fri, 22 Jul 2022 21:31:11 +0800 Subject: [PATCH 17/28] id --- .../opendata/service/impl/BaseGridDailyworkServiceImpl.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/BaseGridDailyworkServiceImpl.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/BaseGridDailyworkServiceImpl.java index 4cc15727fb..d23eddb40e 100644 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/BaseGridDailyworkServiceImpl.java +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/BaseGridDailyworkServiceImpl.java @@ -226,7 +226,8 @@ public class BaseGridDailyworkServiceImpl extends BaseServiceImpl { GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(d.getGridId()); if (null == gridInfo){ - throw new EpmetException("未查询到网格信息:"+ d.getGridId()); + log.warn("未查询到网格信息:"+ d.getGridId()); + return; } d.setGridCode(gridInfo.getCode()); d.setGridName(gridInfo.getGridName()); From 47dee44a4129625ba44efe00c29a0c697b705db9 Mon Sep 17 00:00:00 2001 From: jianjun Date: Fri, 22 Jul 2022 21:53:45 +0800 Subject: [PATCH 18/28] =?UTF-8?q?=E4=B8=8D=E7=9F=A5=E9=81=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../commons/tools/constant/NumConstant.java | 2 +- .../epmet/commons/tools/utils/StrUtil.java | 29 +++++++++++++++++++ .../impl/BaseGridDailyworkServiceImpl.java | 3 ++ .../impl/EventreportPingyinServiceImpl.java | 14 +++++---- 4 files changed, 42 insertions(+), 6 deletions(-) create mode 100644 epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/StrUtil.java diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java index 0d18e6f706..95158b2929 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java @@ -49,7 +49,7 @@ public interface NumConstant { BigDecimal ONE_HUNDRED_DECIMAL = new BigDecimal(100); BigDecimal ZERO_DECIMAL = new BigDecimal(0); int ONE_THOUSAND = 1000; - int TEN_THOUSAND = 10000; + int THREE_THOUSAND = 3000; int MAX = 99999999; int EIGHTY_EIGHT = 88; int EIGHTY = 80; diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/StrUtil.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/StrUtil.java new file mode 100644 index 0000000000..055b7a2ae2 --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/StrUtil.java @@ -0,0 +1,29 @@ +package com.epmet.commons.tools.utils; + +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * desc: + * + * @author: LiuJanJun + * @date: 2022/7/22 9:45 下午 + * @version: 1.0 + */ +public class StrUtil { + + private static final Pattern emoji = Pattern.compile("[\ud83c\udc00-\ud83c\udfff]|[\ud83d\udc00-\ud83d\udfff]|[\u2600-\u27ff]", Pattern.UNICODE_CASE | Pattern.CASE_INSENSITIVE); + + public static String filterEmoji(String source) { + + if (source != null) { + Matcher emojiMatcher = emoji.matcher(source); + if (emojiMatcher.find()) { + source = emojiMatcher.replaceAll(""); + return source; + } + return source; + } + return source; + } +} diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/BaseGridDailyworkServiceImpl.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/BaseGridDailyworkServiceImpl.java index d23eddb40e..c02ed2d50f 100644 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/BaseGridDailyworkServiceImpl.java +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/BaseGridDailyworkServiceImpl.java @@ -11,6 +11,7 @@ import com.epmet.commons.tools.redis.common.bean.GridInfoCache; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.DateUtils; import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.utils.StrUtil; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.commons.tools.validator.group.AddGroup; import com.epmet.dto.form.patrol.PatrolQueryFormDTO; @@ -229,6 +230,8 @@ public class BaseGridDailyworkServiceImpl extends BaseServiceImpl NumConstant.ONE_THOUSAND) { - eventDescription = eventDescription.substring(NumConstant.ZERO, NumConstant.ONE_THOUSAND); + //如果不为空 长度控制3000以内 + if (StringUtils.isNotBlank(eventDescription) && eventDescription.length() > NumConstant.THREE_THOUSAND) { + eventDescription = eventDescription.substring(NumConstant.ZERO, NumConstant.THREE_THOUSAND); } + eventDescription = StrUtil.filterEmoji(eventDescription); entity.setEventDescription(eventDescription); entity.setWaysOfResolving(item.getWaysOfResolving()); //业务不确定 @@ -163,4 +167,4 @@ public class EventreportPingyinServiceImpl extends BaseServiceImpl Date: Fri, 22 Jul 2022 22:21:47 +0800 Subject: [PATCH 19/28] =?UTF-8?q?=E5=88=A0=E9=99=A4=E7=BD=91=E6=A0=BC?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E7=BB=84=E7=BB=87=E5=8F=91=E9=80=81=E6=B6=88?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../rocketmq/messages/OrgOrStaffMQMsg.java | 1 + .../dto/org/form/GridBaseInfoFormDTO.java | 2 +- .../resources/mapper/org/CustomerGridDao.xml | 6 +- .../mapper/org/StatsCustomerAgencyDao.xml | 6 +- .../epmet/controller/AgencyController.java | 11 +++- .../com/epmet/controller/GridController.java | 13 +++- .../dto/constant/DataWorkerConstant.java | 8 +++ .../form/ExractGridInfoPingYinFormDTO.java | 2 +- .../impl/GridInfoPingyinServiceImpl.java | 59 ++++++++++++++++--- 9 files changed, 91 insertions(+), 17 deletions(-) create mode 100644 epmet-module/open-data-worker/open-data-worker-client/src/main/java/com/epmet/opendata/dto/constant/DataWorkerConstant.java diff --git a/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/messages/OrgOrStaffMQMsg.java b/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/messages/OrgOrStaffMQMsg.java index 14a5a24ff8..bda7f50a7a 100644 --- a/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/messages/OrgOrStaffMQMsg.java +++ b/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/messages/OrgOrStaffMQMsg.java @@ -18,6 +18,7 @@ public class OrgOrStaffMQMsg implements Serializable { //数据类型【组织:agency 网格:grid 人员:staff】 private String orgType; //操作类型【组织新增:agency_create 组织变更:agency_change 网格新增:grid_create 网格变更:grid_change 人员新增:staff_create 人员变更:staff_change】 + //删除网格:grid_delete;删除组织:agency_delete private String type; diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/org/form/GridBaseInfoFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/org/form/GridBaseInfoFormDTO.java index 9d39ef6b81..768fad2827 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/org/form/GridBaseInfoFormDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/org/form/GridBaseInfoFormDTO.java @@ -28,7 +28,7 @@ public class GridBaseInfoFormDTO implements Serializable { * 操作类型【新增:add 修改删除:edit 初始化所有数据:all】 */ private String type; - + private String delFlag; public interface Grid extends CustomerClientShowGroup {} } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml index 5d6dc4042c..edab6411d7 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml @@ -158,8 +158,10 @@ * FROM customer_grid - WHERE del_flag = '0' - AND customer_id = #{customerId} + WHERE customer_id = #{customerId} + + AND del_flag = #{delFlag} + and CODE is not null and CODE !='' and grid_name not like '%专属网格' diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/StatsCustomerAgencyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/StatsCustomerAgencyDao.xml index 105a4efcc7..fec3627bc0 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/StatsCustomerAgencyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/StatsCustomerAgencyDao.xml @@ -214,10 +214,12 @@ * FROM customer_agency - WHERE del_flag = '0' - AND customer_id = #{customerId} + WHERE customer_id = #{customerId} and CODE is not null and CODE !='' + + AND del_flag = #{delFlag} + #{agencyId} 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 ae07816fa2..893bc95cda 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 @@ -201,7 +201,16 @@ public class AgencyController { public Result removeAgency(@LoginUser TokenDto tokenDTO, @RequestBody RemoveAgencyFormDTO formDTO) { ValidatorUtils.validateEntity(formDTO); formDTO.setCustomerId(tokenDTO.getCustomerId()); - return agencyService.removeAgency(formDTO); + Result result= agencyService.removeAgency(formDTO); + //2021-11-30 推送mq,数据同步到中介库 start + OrgOrStaffMQMsg mq = new OrgOrStaffMQMsg(); + mq.setCustomerId(tokenDTO.getCustomerId()); + mq.setOrgId(formDTO.getAgencyId()); + mq.setOrgType("agency"); + mq.setType("agency_delete"); + SendMqMsgUtil.build().openFeignClient(epmetMessageOpenFeignClient).sendOrgStaffMqMsg(mq); + //2021-11-30 end + return result; } /** diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/GridController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/GridController.java index 8f026e9f44..171197d40e 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/GridController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/GridController.java @@ -100,7 +100,18 @@ public class GridController { @RequirePermission(requirePermission = RequirePermissionEnum.ORG_GRID_DELETE) public Result deleteGrid(@LoginUser TokenDto tokenDto, @RequestBody DeleteGridFormDTO deleteGridFormDTO){ deleteGridFormDTO.setCustomerId(tokenDto.getCustomerId()); - return customerGridService.deleteGrid(tokenDto,deleteGridFormDTO); + Result result =customerGridService.deleteGrid(tokenDto,deleteGridFormDTO); + //2021-10-18 推送mq,数据同步到中介库 start + if (result.success()) { + OrgOrStaffMQMsg mq = new OrgOrStaffMQMsg(); + mq.setCustomerId(tokenDto.getCustomerId()); + mq.setOrgId(deleteGridFormDTO.getGridId()); + mq.setOrgType("grid"); + mq.setType("grid_delete"); + SendMqMsgUtil.build().openFeignClient(epmetMessageOpenFeignClient).sendOrgStaffMqMsg(mq); + } + //2021-10-18 end + return result; } /** diff --git a/epmet-module/open-data-worker/open-data-worker-client/src/main/java/com/epmet/opendata/dto/constant/DataWorkerConstant.java b/epmet-module/open-data-worker/open-data-worker-client/src/main/java/com/epmet/opendata/dto/constant/DataWorkerConstant.java new file mode 100644 index 0000000000..df1781038f --- /dev/null +++ b/epmet-module/open-data-worker/open-data-worker-client/src/main/java/com/epmet/opendata/dto/constant/DataWorkerConstant.java @@ -0,0 +1,8 @@ +package com.epmet.opendata.dto.constant; + +public interface DataWorkerConstant { + String ALL = "all"; + String CREATE = "create"; + String CHANGE = "change"; + String DELETE = "delete"; +} diff --git a/epmet-module/open-data-worker/open-data-worker-client/src/main/java/com/epmet/opendata/dto/form/ExractGridInfoPingYinFormDTO.java b/epmet-module/open-data-worker/open-data-worker-client/src/main/java/com/epmet/opendata/dto/form/ExractGridInfoPingYinFormDTO.java index b4324bb2ee..970f98e1ab 100644 --- a/epmet-module/open-data-worker/open-data-worker-client/src/main/java/com/epmet/opendata/dto/form/ExractGridInfoPingYinFormDTO.java +++ b/epmet-module/open-data-worker/open-data-worker-client/src/main/java/com/epmet/opendata/dto/form/ExractGridInfoPingYinFormDTO.java @@ -32,9 +32,9 @@ public class ExractGridInfoPingYinFormDTO implements Serializable { /** * 废弃:这个不对。操作类型【新增:add 修改删除:edit 初始化所有数据:all】 * 操作类型【组织新增:agency_create 组织变更:agency_change 网格新增:grid_create 网格变更:grid_change 人员新增:staff_create 人员变更:staff_change】 + * 删除网格grid_delete,删除组织agency_delete */ @NotBlank(message = "操作类型【新增:add 修改删除:edit 初始化所有数据:all】不能为空", groups = {GridInfo.class}) - private String type; } diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/GridInfoPingyinServiceImpl.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/GridInfoPingyinServiceImpl.java index b7a15afd09..1056aa8361 100755 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/GridInfoPingyinServiceImpl.java +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/GridInfoPingyinServiceImpl.java @@ -1,6 +1,7 @@ package com.epmet.opendata.service.impl; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.Constant; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.utils.ConvertUtils; @@ -10,11 +11,13 @@ import com.epmet.dto.org.result.CustomerAgencyDTO; import com.epmet.dto.org.result.CustomerGridDTO; import com.epmet.feign.DataStatisticalOpenFeignClient; import com.epmet.opendata.dao.GridInfoPingyinDao; +import com.epmet.opendata.dto.constant.DataWorkerConstant; import com.epmet.opendata.dto.form.ExractGridInfoPingYinFormDTO; import com.epmet.opendata.entity.GridInfoPingyinEntity; import com.epmet.opendata.service.GridInfoPingyinService; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.ListUtils; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -44,6 +47,15 @@ public class GridInfoPingyinServiceImpl extends BaseServiceImpl> result = dataStatisticalOpenFeignClient.getAgencyBaseInfo(formDTO1); if (!result.success()) { throw new RenException(result.getInternalMsg()); @@ -59,11 +71,11 @@ public class GridInfoPingyinServiceImpl extends BaseServiceImpl orginList = baseDao.selectByGridCode(entity.getGridCode()); + if (CollectionUtils.isNotEmpty(orginList)) { + for (GridInfoPingyinEntity oigin : orginList) { + baseDao.deleteById(oigin.getId()); + } + } + } } } @@ -115,6 +137,15 @@ public class GridInfoPingyinServiceImpl extends BaseServiceImpl> result = dataStatisticalOpenFeignClient.getGridBaseInfo(formDTO1); if (!result.success()) { throw new RenException(result.getInternalMsg()); @@ -145,7 +176,7 @@ public class GridInfoPingyinServiceImpl extends BaseServiceImpl { this.insertBatch(list); }); - } else if (formDTO.getType().contains("create")) { + } else if (formDTO.getType().contains(DataWorkerConstant.CREATE)) { // 单独新增组织 this.insertBatch(gridInfoList); - } else if (formDTO.getType().contains("change")) { + } else if (formDTO.getType().contains(DataWorkerConstant.CHANGE)) { // 修改组织时,先根据code查询,如果有数据,更新 for (GridInfoPingyinEntity entity : gridInfoList) { @@ -175,6 +206,16 @@ public class GridInfoPingyinServiceImpl extends BaseServiceImpl orginList = baseDao.selectByGridCode(entity.getGridCode()); + if (CollectionUtils.isNotEmpty(orginList)) { + for (GridInfoPingyinEntity oigin : orginList) { + baseDao.deleteById(oigin.getId()); + } + } + } } } From 8cf2da63a313ae9ce75bb4bd6d589612367dc4e2 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Fri, 22 Jul 2022 22:26:52 +0800 Subject: [PATCH 20/28] =?UTF-8?q?=E6=A0=B9=E6=8D=AEcode=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/epmet/opendata/dao/GridInfoPingyinDao.java | 2 ++ .../opendata/service/impl/GridInfoPingyinServiceImpl.java | 4 ++-- .../src/main/resources/mapper/GridInfoPingyinDao.xml | 5 +++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/GridInfoPingyinDao.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/GridInfoPingyinDao.java index 0ae3ac01e9..986b8f2ff7 100755 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/GridInfoPingyinDao.java +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/GridInfoPingyinDao.java @@ -28,4 +28,6 @@ public interface GridInfoPingyinDao extends BaseDao { @Param("gridLevel")Integer gridLevel, @Param("lng")BigDecimal lng, @Param("lat")BigDecimal lat); + + int deleteByCode(String gridCode); } diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/GridInfoPingyinServiceImpl.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/GridInfoPingyinServiceImpl.java index 21886ce34f..2f54aecee6 100755 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/GridInfoPingyinServiceImpl.java +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/GridInfoPingyinServiceImpl.java @@ -120,7 +120,7 @@ public class GridInfoPingyinServiceImpl extends BaseServiceImpl orginList = baseDao.selectByGridCode(entity.getGridCode()); if (CollectionUtils.isNotEmpty(orginList)) { for (GridInfoPingyinEntity oigin : orginList) { - baseDao.deleteById(oigin.getId()); + baseDao.deleteByCode(oigin.getGridCode()); } } } @@ -212,7 +212,7 @@ public class GridInfoPingyinServiceImpl extends BaseServiceImpl orginList = baseDao.selectByGridCode(entity.getGridCode()); if (CollectionUtils.isNotEmpty(orginList)) { for (GridInfoPingyinEntity oigin : orginList) { - baseDao.deleteById(oigin.getId()); + baseDao.deleteByCode(oigin.getGridCode()); } } } diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/GridInfoPingyinDao.xml b/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/GridInfoPingyinDao.xml index a6f7c2ef5a..c79ef11f2a 100755 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/GridInfoPingyinDao.xml +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/GridInfoPingyinDao.xml @@ -44,4 +44,9 @@ lat = #{lat} where grid_code = #{gridCode} and is_del = 'N' + + + update grid_info_pingyin set is_del = 'Y' + where grid_code = #{gridCode} + From 90823cfdbb56b7985f0ff39c4a2d5fcd12db7b62 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Fri, 22 Jul 2022 22:44:18 +0800 Subject: [PATCH 21/28] int TEN_THOUSAND = 10000; --- .../main/java/com/epmet/commons/tools/constant/NumConstant.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java index 95158b2929..1f0d76e14f 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java @@ -49,6 +49,8 @@ public interface NumConstant { BigDecimal ONE_HUNDRED_DECIMAL = new BigDecimal(100); BigDecimal ZERO_DECIMAL = new BigDecimal(0); int ONE_THOUSAND = 1000; + int TEN_THOUSAND = 10000; + int THREE_THOUSAND = 3000; int MAX = 99999999; int EIGHTY_EIGHT = 88; From 6fc8b0b3836498a0ab59e3302cae1083d5e38762 Mon Sep 17 00:00:00 2001 From: jianjun Date: Fri, 22 Jul 2022 22:49:26 +0800 Subject: [PATCH 22/28] zhuanzhuanzhuan --- .../epmet/commons/tools/utils/StrUtil.java | 32 ++++++++++++------- 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/StrUtil.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/StrUtil.java index 055b7a2ae2..8a6b63230c 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/StrUtil.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/StrUtil.java @@ -1,10 +1,9 @@ package com.epmet.commons.tools.utils; -import java.util.regex.Matcher; -import java.util.regex.Pattern; +import org.apache.commons.lang3.StringUtils; /** - * desc: + * desc:utf8mb4转为utf8 * * @author: LiuJanJun * @date: 2022/7/22 9:45 下午 @@ -12,18 +11,27 @@ import java.util.regex.Pattern; */ public class StrUtil { - private static final Pattern emoji = Pattern.compile("[\ud83c\udc00-\ud83c\udfff]|[\ud83d\udc00-\ud83d\udfff]|[\u2600-\u27ff]", Pattern.UNICODE_CASE | Pattern.CASE_INSENSITIVE); + private static final int LAST_BMP = 0xFFFF; public static String filterEmoji(String source) { - - if (source != null) { - Matcher emojiMatcher = emoji.matcher(source); - if (emojiMatcher.find()) { - source = emojiMatcher.replaceAll(""); - return source; - } + if (StringUtils.isBlank(source)) { return source; } - return source; + StringBuilder sb = new StringBuilder(source.length()); + for (int i = 0; i < source.length(); i++) { + int codePoint = source.codePointAt(i); + if (codePoint < LAST_BMP) { + sb.appendCodePoint(codePoint); + } else { + i++; + } + } + return sb.toString(); + } + + + public static void main(String[] args) { + String x = StrUtil.filterEmoji("😀😁😆😅🥹🥹😇😗😀😂666"); + System.out.println(x); } } From cdfe9ddb74be6c86b8b3d9bdbc383834cbef1b32 Mon Sep 17 00:00:00 2001 From: jianjun Date: Fri, 22 Jul 2022 23:27:45 +0800 Subject: [PATCH 23/28] =?UTF-8?q?=E5=B9=B3=E9=98=B4=E7=94=9F=E4=BA=A7?= =?UTF-8?q?=E5=A4=9A=E6=95=B0=E6=8D=AE=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/constant/DataSourceConstant.java | 4 ++++ .../open-data-worker-server/pom.xml | 20 ++++++++++++++++--- .../impl/EventreportPingyinServiceImpl.java | 3 +++ .../impl/GridInfoPingyinServiceImpl.java | 3 +++ .../impl/GridstaffInfoPingyinServiceImpl.java | 3 +++ .../src/main/resources/bootstrap.yml | 7 +++++++ 6 files changed, 37 insertions(+), 3 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/DataSourceConstant.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/DataSourceConstant.java index 543b3865b3..b3a184947f 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/DataSourceConstant.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/DataSourceConstant.java @@ -17,4 +17,8 @@ public interface DataSourceConstant { String EPMET_HEART="epmetHeart"; String EPMET_POINT = "epmetPoint"; String OPER_CUSTOMIZE="operCustomize"; + /** + * 济南的中间数据库 + */ + String JI_NAN = "jinan"; } diff --git a/epmet-module/open-data-worker/open-data-worker-server/pom.xml b/epmet-module/open-data-worker/open-data-worker-server/pom.xml index 9fb7b95d22..8909b49154 100644 --- a/epmet-module/open-data-worker/open-data-worker-server/pom.xml +++ b/epmet-module/open-data-worker/open-data-worker-server/pom.xml @@ -85,6 +85,12 @@ 2.0.0 compile + + com.epmet + epmet-commons-dynamic-datasource + 2.0.0 + compile + @@ -273,10 +279,18 @@ - + - sync_gridinfo_pingyin - xvfuz2lz + epmet_open_data_user + EpmEtOpEndAtArw_)$ + + + + + + sync_gridinfo_pingyin + xvfuz2lz + 0 172.22.76.1:6379,172.22.76.20:6379,172.22.76.36:6379,172.22.76.1:6389,172.22.76.20:6389,172.22.76.36:6389 diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/EventreportPingyinServiceImpl.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/EventreportPingyinServiceImpl.java index df1d77eca2..d5a2e15b8a 100755 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/EventreportPingyinServiceImpl.java +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/EventreportPingyinServiceImpl.java @@ -1,11 +1,13 @@ package com.epmet.opendata.service.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.StrUtil; +import com.epmet.constant.DataSourceConstant; import com.epmet.dto.basereport.form.EventInfoFormDTO; import com.epmet.dto.basereport.result.EventInfoResultDTO; import com.epmet.feign.DataStatisticalOpenFeignClient; @@ -32,6 +34,7 @@ import java.util.stream.Collectors; */ @Slf4j @Service +@DataSource(DataSourceConstant.JI_NAN) public class EventreportPingyinServiceImpl extends BaseServiceImpl implements EventreportPingyinService { @Resource private DataStatisticalOpenFeignClient dataStatisticalOpenFeignClient; diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/GridInfoPingyinServiceImpl.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/GridInfoPingyinServiceImpl.java index 2f54aecee6..80409d4ac5 100755 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/GridInfoPingyinServiceImpl.java +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/GridInfoPingyinServiceImpl.java @@ -1,11 +1,13 @@ package com.epmet.opendata.service.impl; +import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.Constant; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; +import com.epmet.constant.DataSourceConstant; import com.epmet.constant.IndexCalConstant; import com.epmet.dto.org.result.CustomerAgencyDTO; import com.epmet.dto.org.result.CustomerGridDTO; @@ -33,6 +35,7 @@ import java.util.List; * @since v1.0.0 2022-07-22 */ @Service +@DataSource(DataSourceConstant.JI_NAN) public class GridInfoPingyinServiceImpl extends BaseServiceImpl implements GridInfoPingyinService { @Autowired private DataStatisticalOpenFeignClient dataStatisticalOpenFeignClient; diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/GridstaffInfoPingyinServiceImpl.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/GridstaffInfoPingyinServiceImpl.java index 6c58d2565a..2a4317feac 100755 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/GridstaffInfoPingyinServiceImpl.java +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/GridstaffInfoPingyinServiceImpl.java @@ -1,9 +1,11 @@ package com.epmet.opendata.service.impl; +import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; +import com.epmet.constant.DataSourceConstant; import com.epmet.dto.form.CustomerGridStaffListFormDTO; import com.epmet.dto.form.GridStaffUploadtFormDTO; import com.epmet.dto.result.CustomerGridStaffListResultDTO; @@ -36,6 +38,7 @@ import java.util.stream.Collectors; */ @Service @Slf4j +@DataSource(DataSourceConstant.JI_NAN) public class GridstaffInfoPingyinServiceImpl extends BaseServiceImpl implements GridstaffInfoPingyinService { @Autowired diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/bootstrap.yml b/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/bootstrap.yml index 0238d28963..814e472385 100644 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/bootstrap.yml +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/bootstrap.yml @@ -72,6 +72,13 @@ spring: baseline-on-migrate: true baseline-version: 0 +dynamic: + datasource: + jinan: + driver-class-name: com.mysql.cj.jdbc.Driver + url: @datasource.druid.org.url@ + username: @datasource.druid.org.username@ + password: @datasource.druid.org.password@ management: endpoints: From a87b60005041a36114125d001483d336f0f56792 Mon Sep 17 00:00:00 2001 From: jianjun Date: Fri, 22 Jul 2022 23:31:45 +0800 Subject: [PATCH 24/28] =?UTF-8?q?=E4=BE=8B=E8=A1=8C=E5=B7=A5=E4=BD=9C?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BD=8D=E7=BD=AE=20=E8=BF=98=E5=8E=9F?= =?UTF-8?q?=E5=8E=9F=E6=9C=89=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../OpenDataPatrolChangeEventListener.java | 4 +- .../service/BaseGridDailyworkService.java | 17 -- .../GridstaffWorkInfoPingyinService.java | 12 +- .../impl/BaseGridDailyworkServiceImpl.java | 166 +++--------------- .../GridstaffWorkInfoPingyinServiceImpl.java | 134 +++++++++++++- 5 files changed, 165 insertions(+), 168 deletions(-) diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/mq/listener/OpenDataPatrolChangeEventListener.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/mq/listener/OpenDataPatrolChangeEventListener.java index e5e7a1f577..5c3bbb4404 100644 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/mq/listener/OpenDataPatrolChangeEventListener.java +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/mq/listener/OpenDataPatrolChangeEventListener.java @@ -15,7 +15,7 @@ import com.epmet.commons.tools.redis.RedisUtils; import com.epmet.commons.tools.utils.SpringContextUtils; import com.epmet.constant.SystemMessageType; import com.epmet.opendata.dto.form.UpsertPatrolRecordForm; -import com.epmet.opendata.service.BaseGridDailyworkService; +import com.epmet.opendata.service.GridstaffWorkInfoPingyinService; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyContext; @@ -99,7 +99,7 @@ public class OpenDataPatrolChangeEventListener implements MessageListenerConcurr break; case SystemMessageType.PATROL_ROUTINE_WORK_ADD: // aBoolean = SpringContextUtils.getBean(BaseGridDailyworkService.class).insertBaseGridWorkRecord(patrolRecordForm); - aBoolean = SpringContextUtils.getBean(BaseGridDailyworkService.class).insertBaseGridWorkRecordV2(patrolRecordForm); + aBoolean = SpringContextUtils.getBean(GridstaffWorkInfoPingyinService.class).insertBaseGridWorkRecordV2(patrolRecordForm); break; default: log.error("错误的消息类型:{}", tags); diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/BaseGridDailyworkService.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/BaseGridDailyworkService.java index 6fccfe29e7..010b698d63 100644 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/BaseGridDailyworkService.java +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/BaseGridDailyworkService.java @@ -18,7 +18,6 @@ package com.epmet.opendata.service; import com.epmet.commons.mybatis.service.BaseService; -import com.epmet.opendata.dto.form.HistoryDataSyncFormDTO; import com.epmet.opendata.dto.form.UpsertPatrolRecordForm; import com.epmet.opendata.entity.BaseGridDailyworkEntity; @@ -37,14 +36,6 @@ public interface BaseGridDailyworkService extends BaseService { + /** + * Desc: 2022-07-22 新表 例行工作同步 + * @param formDTO + * @author zxc + * @date 2022/7/22 11:16 + */ + Boolean insertBaseGridWorkRecordV2(UpsertPatrolRecordForm formDTO); - Integer delAllGridStaffWorkInfoPY(); - -} \ No newline at end of file +} diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/BaseGridDailyworkServiceImpl.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/BaseGridDailyworkServiceImpl.java index c02ed2d50f..b8232b5ca1 100644 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/BaseGridDailyworkServiceImpl.java +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/BaseGridDailyworkServiceImpl.java @@ -1,3 +1,20 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package com.epmet.opendata.service.impl; import com.alibaba.fastjson.JSON; @@ -6,12 +23,7 @@ import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.EpmetException; -import com.epmet.commons.tools.redis.common.CustomerOrgRedis; -import com.epmet.commons.tools.redis.common.bean.GridInfoCache; -import com.epmet.commons.tools.utils.ConvertUtils; -import com.epmet.commons.tools.utils.DateUtils; import com.epmet.commons.tools.utils.Result; -import com.epmet.commons.tools.utils.StrUtil; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.commons.tools.validator.group.AddGroup; import com.epmet.dto.form.patrol.PatrolQueryFormDTO; @@ -20,18 +32,15 @@ import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.opendata.dao.BaseGridDailyworkDao; import com.epmet.opendata.dto.ExDeptDTO; import com.epmet.opendata.dto.ExUserDTO; -import com.epmet.opendata.dto.form.HistoryDataSyncFormDTO; import com.epmet.opendata.dto.form.UpsertPatrolRecordForm; import com.epmet.opendata.entity.BaseGridDailyworkEntity; -import com.epmet.opendata.entity.GridstaffWorkInfoPingyinEntity; -import com.epmet.opendata.service.*; +import com.epmet.opendata.service.BaseGridDailyworkService; +import com.epmet.opendata.service.ExDeptService; +import com.epmet.opendata.service.ExUserService; import lombok.extern.slf4j.Slf4j; -import org.apache.commons.collections4.ListUtils; -import org.apache.commons.lang3.StringUtils; import org.jetbrains.annotations.NotNull; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; import java.util.ArrayList; @@ -55,12 +64,6 @@ public class BaseGridDailyworkServiceImpl extends BaseServiceImpl list, Map deptMap, Map userMap){ List insertList = new ArrayList<>(); list.forEach(o-> insertList.add(buildEntity(o, deptMap, userMap))); @@ -128,6 +130,7 @@ public class BaseGridDailyworkServiceImpl extends BaseServiceImpl deptMap, Map userMap) { BaseGridDailyworkEntity entity = new BaseGridDailyworkEntity(); entity.setCustomerId(record.getCustomerId()); @@ -175,132 +178,9 @@ public class BaseGridDailyworkServiceImpl extends BaseServiceImpl data; - do { - Result> record = epmetUserOpenFeignClient.getPatrolRoutineWorkListV2(midPatrolFormDTO); - midPatrolFormDTO.setPageNo(midPatrolFormDTO.getPageNo() + 1); - if (record == null || !record.success()) { - log.error("获取例行工作记录V2失败,param:{}", JSON.toJSONString(midPatrolFormDTO)); - throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode()); - } - data = record.getData(); - if (CollectionUtils.isEmpty(data)) { - //数据已被删除了 - //暂时设置error 用于排错 - log.error("获取例行工作记录返回为空,param:{}", JSON.toJSONString(midPatrolFormDTO)); - int effectRow = baseDao.deleteById(patrolRecordForm.getId()); - log.warn("del effectRow:{}", effectRow); - throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode()); - } - data.forEach(d -> { - GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(d.getGridId()); - if (null == gridInfo){ - log.warn("未查询到网格信息:"+ d.getGridId()); - return; - } - String s = StrUtil.filterEmoji(d.getWorkContent()); - d.setWorkContent(s); - d.setGridCode(gridInfo.getCode()); - d.setGridName(gridInfo.getGridName()); - }); - insertNewRecordBatch(data); - - }while (data.size() == NumConstant.ONE_THOUSAND); - return true; - } - - /** - * Desc: 历史数据处理 - * @param formDTO - * @author zxc - * @date 2022/7/22 13:24 - */ - @Override - public void historyDataSync(HistoryDataSyncFormDTO formDTO) { - Integer pageSize = NumConstant.ONE_THOUSAND; - Integer pageNo = NumConstant.ONE; - List baseGridDailyWork; - do { - baseGridDailyWork = baseDao.getBaseGridDailyWork(formDTO.getCustomerId(),(pageNo - NumConstant.ONE) * pageSize); - List newEntities = ConvertUtils.sourceToTarget(baseGridDailyWork, GridstaffWorkInfoPingyinEntity.class); - newEntities.forEach(n -> { - GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(n.getGridId()); - if (null == gridInfo){ - throw new EpmetException("未查询到网格信息:"+ n.getGridId()); - } - n.setGridCode(gridInfo.getCode()); - n.setHappenTime(DateUtils.parseDate(n.getHappenTimeString(),DateUtils.DATE_PATTERN)); - n.setIsDel(NumConstant.ZERO_STR); - }); - insertGridStaffWorkInfoPY(newEntities); - pageNo++; - }while (baseGridDailyWork.size() == NumConstant.ONE_THOUSAND); - } - - /** - * Desc: 数据存入 - * @param newEntities - * @author zxc - * @date 2022/7/22 14:17 - */ - @Transactional(rollbackFor = Exception.class) - public void insertGridStaffWorkInfoPY(List newEntities){ - if (!CollectionUtils.isEmpty(newEntities)){ - List> partition = ListUtils.partition(newEntities, NumConstant.ONE_HUNDRED); - partition.forEach(p -> { - pingYinService.insertBatch(p); - }); - } - } - - private Boolean insertNewRecordBatch(List list){ - List insertList = new ArrayList<>(); - list.forEach(o-> { - if (StringUtils.isBlank(o.getGridCode())){ - return; - } - insertList.add(buildNewEntity(o)); - }); - //insert - if (CollectionUtils.isEmpty(insertList)){ - log.error("新构建要插入的数据为空,param:{}", JSON.toJSONString(list)); - return false; - } - insertGridStaffWorkInfoPY(insertList); -// pingYinService.saveOrUpdateBatch(insertList, NumConstant.ONE_HUNDRED); - return true; - } - } diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/GridstaffWorkInfoPingyinServiceImpl.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/GridstaffWorkInfoPingyinServiceImpl.java index db80164c1d..ffa08d0286 100755 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/GridstaffWorkInfoPingyinServiceImpl.java +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/GridstaffWorkInfoPingyinServiceImpl.java @@ -1,10 +1,36 @@ package com.epmet.opendata.service.impl; +import com.alibaba.fastjson.JSON; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.EpmetException; +import com.epmet.commons.tools.redis.common.CustomerOrgRedis; +import com.epmet.commons.tools.redis.common.bean.GridInfoCache; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.DateUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.utils.StrUtil; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.commons.tools.validator.group.AddGroup; +import com.epmet.dto.form.patrol.PatrolQueryFormDTO; +import com.epmet.dto.result.PatrolRoutineWorkResult; +import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.opendata.dao.GridstaffWorkInfoPingyinDao; +import com.epmet.opendata.dto.form.UpsertPatrolRecordForm; import com.epmet.opendata.entity.GridstaffWorkInfoPingyinEntity; import com.epmet.opendata.service.GridstaffWorkInfoPingyinService; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.ListUtils; +import org.apache.commons.lang3.StringUtils; +import org.jetbrains.annotations.NotNull; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; + +import java.util.ArrayList; +import java.util.List; /** * 平阴区网格员例行工作信息 @@ -12,12 +38,114 @@ import org.springframework.stereotype.Service; * @author generator generator@elink-cn.com * @since v1.0.0 2022-07-22 */ +@Slf4j @Service public class GridstaffWorkInfoPingyinServiceImpl extends BaseServiceImpl implements GridstaffWorkInfoPingyinService { + @Autowired + private EpmetUserOpenFeignClient epmetUserOpenFeignClient; @Override - public Integer delAllGridStaffWorkInfoPY() { - return baseDao.delAllGridStaffWorkInfoPY(); + public Boolean insertBaseGridWorkRecordV2(UpsertPatrolRecordForm patrolRecordForm) { + log.info("insertBaseGridWorkRecordV2 param:{}", JSON.toJSONString(patrolRecordForm)); + ValidatorUtils.validateEntity(patrolRecordForm, AddGroup.class); + // 构建传参 + PatrolQueryFormDTO midPatrolFormDTO = buildParam(patrolRecordForm); + if (StringUtils.isBlank(patrolRecordForm.getId())) { + Integer row; + do { + row = baseDao.delAllGridStaffWorkInfoPY(); + } while (row == NumConstant.ONE_THOUSAND); + } + List data; + do { + Result> record = epmetUserOpenFeignClient.getPatrolRoutineWorkListV2(midPatrolFormDTO); + midPatrolFormDTO.setPageNo(midPatrolFormDTO.getPageNo() + 1); + if (record == null || !record.success()) { + log.error("获取例行工作记录V2失败,param:{}", JSON.toJSONString(midPatrolFormDTO)); + throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode()); + } + data = record.getData(); + if (CollectionUtils.isEmpty(data)) { + //数据已被删除了 + //暂时设置error 用于排错 + log.error("获取例行工作记录返回为空,param:{}", JSON.toJSONString(midPatrolFormDTO)); + int effectRow = baseDao.deleteById(patrolRecordForm.getId()); + log.warn("del effectRow:{}", effectRow); + throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode()); + } + data.forEach(d -> { + GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(d.getGridId()); + if (null == gridInfo) { + log.warn("未查询到网格信息:" + d.getGridId()); + return; + } + String s = StrUtil.filterEmoji(d.getWorkContent()); + d.setWorkContent(s); + d.setGridCode(gridInfo.getCode()); + d.setGridName(gridInfo.getGridName()); + }); + insertNewRecordBatch(data); + + } while (data.size() == NumConstant.ONE_THOUSAND); + return true; + } + + /** + * Desc: 数据存入 + * + * @param newEntities + * @author zxc + * @date 2022/7/22 14:17 + */ + @Transactional(rollbackFor = Exception.class) + public void insertGridStaffWorkInfoPY(List newEntities) { + if (!CollectionUtils.isEmpty(newEntities)) { + List> partition = ListUtils.partition(newEntities, NumConstant.ONE_HUNDRED); + partition.forEach(p -> { + this.insertBatch(p); + }); + } + } + + private Boolean insertNewRecordBatch(List list) { + List insertList = new ArrayList<>(); + list.forEach(o -> { + if (StringUtils.isBlank(o.getGridCode())) { + return; + } + insertList.add(buildNewEntity(o)); + }); + //insert + if (CollectionUtils.isEmpty(insertList)) { + log.error("新构建要插入的数据为空,param:{}", JSON.toJSONString(list)); + return false; + } + insertGridStaffWorkInfoPY(insertList); + return true; + } + + private GridstaffWorkInfoPingyinEntity buildNewEntity(PatrolRoutineWorkResult record) { + GridstaffWorkInfoPingyinEntity entity = ConvertUtils.sourceToTarget(record, GridstaffWorkInfoPingyinEntity.class); + entity.setQxBm("370124"); + entity.setQxMc("平阴县"); + entity.setHappenTime(DateUtils.parseDate(record.getHappenTime().concat(" 00:00:00"), DateUtils.DATE_PATTERN)); + entity.setWorkResult(NumConstant.ONE == record.getIsNormal() ? "Y" : "N"); + entity.setWorkType(record.getWorkTypeSecondCode()); + entity.setRecoredInsertTime(record.getCreatedTime()); + entity.setUpdateTime(record.getUpdatedTime()); + entity.setId(null); + entity.setIsDel(NumConstant.ZERO_STR); + return entity; + } + + @NotNull + private PatrolQueryFormDTO buildParam(UpsertPatrolRecordForm patrolRecordForm) { + PatrolQueryFormDTO midPatrolFormDTO = new PatrolQueryFormDTO(); + midPatrolFormDTO.setCustomerId(patrolRecordForm.getCustomerId()); + midPatrolFormDTO.setId(StringUtils.isBlank(patrolRecordForm.getId()) ? "" : patrolRecordForm.getId()); + midPatrolFormDTO.setPageNo(patrolRecordForm.getPageNo()); + midPatrolFormDTO.setPageSize(NumConstant.ONE_THOUSAND); + return midPatrolFormDTO; } -} \ No newline at end of file +} From 25288bf4044e5a7e61a4693e7f0b684aa853f407 Mon Sep 17 00:00:00 2001 From: jianjun Date: Fri, 22 Jul 2022 23:32:50 +0800 Subject: [PATCH 25/28] =?UTF-8?q?=E4=BE=8B=E8=A1=8C=E5=B7=A5=E4=BD=9C?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BD=8D=E7=BD=AE=20=E8=BF=98=E5=8E=9F?= =?UTF-8?q?=E5=8E=9F=E6=9C=89=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/GridstaffWorkInfoPingyinServiceImpl.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/GridstaffWorkInfoPingyinServiceImpl.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/GridstaffWorkInfoPingyinServiceImpl.java index ffa08d0286..1670b6c453 100755 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/GridstaffWorkInfoPingyinServiceImpl.java +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/GridstaffWorkInfoPingyinServiceImpl.java @@ -1,6 +1,7 @@ package com.epmet.opendata.service.impl; import com.alibaba.fastjson.JSON; +import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.exception.EpmetErrorCode; @@ -13,6 +14,7 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.StrUtil; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.commons.tools.validator.group.AddGroup; +import com.epmet.constant.DataSourceConstant; import com.epmet.dto.form.patrol.PatrolQueryFormDTO; import com.epmet.dto.result.PatrolRoutineWorkResult; import com.epmet.feign.EpmetUserOpenFeignClient; @@ -40,6 +42,7 @@ import java.util.List; */ @Slf4j @Service +@DataSource(DataSourceConstant.JI_NAN) public class GridstaffWorkInfoPingyinServiceImpl extends BaseServiceImpl implements GridstaffWorkInfoPingyinService { @Autowired From 50a12a841aaf23bc07475d0cd9fcd19edc4595cf Mon Sep 17 00:00:00 2001 From: jianjun Date: Fri, 22 Jul 2022 23:37:10 +0800 Subject: [PATCH 26/28] =?UTF-8?q?=E5=8F=98=E5=BC=82=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/BaseGridDailyworkController.java | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/controller/BaseGridDailyworkController.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/controller/BaseGridDailyworkController.java index a57bd5c201..7bb809d167 100644 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/controller/BaseGridDailyworkController.java +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/controller/BaseGridDailyworkController.java @@ -21,9 +21,9 @@ package com.epmet.opendata.controller; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.commons.tools.validator.group.DefaultGroup; -import com.epmet.opendata.dto.form.HistoryDataSyncFormDTO; import com.epmet.opendata.dto.form.UpsertPatrolRecordForm; import com.epmet.opendata.service.BaseGridDailyworkService; +import com.epmet.opendata.service.GridstaffWorkInfoPingyinService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -43,6 +43,8 @@ public class BaseGridDailyworkController { @Autowired private BaseGridDailyworkService baseGridDailyworkService; + @Autowired + private GridstaffWorkInfoPingyinService gridstaffWorkInfoPingyinService; /** * @Author sun @@ -64,20 +66,9 @@ public class BaseGridDailyworkController { @PostMapping("syncV2") public Result getStaffBaseInfoV2(@RequestBody(required = false) UpsertPatrolRecordForm formDTO) { ValidatorUtils.validateEntity(formDTO, DefaultGroup.class); - baseGridDailyworkService.insertBaseGridWorkRecordV2(formDTO); + gridstaffWorkInfoPingyinService.insertBaseGridWorkRecordV2(formDTO); return new Result(); } - /** - * Desc: 历史数据处理 - * @param formDTO - * @author zxc - * @date 2022/7/22 13:24 - */ - @PostMapping("historyDataSync") - public Result historyDataSync(@RequestBody HistoryDataSyncFormDTO formDTO){ - baseGridDailyworkService.historyDataSync(formDTO); - return new Result(); - } } From e0e3bb9add5a1b967139cea1922629e2ef40ab81 Mon Sep 17 00:00:00 2001 From: jianjun Date: Sat, 23 Jul 2022 00:00:03 +0800 Subject: [PATCH 27/28] =?UTF-8?q?=E5=8F=98=E5=BC=82=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/bootstrap.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/bootstrap.yml b/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/bootstrap.yml index 814e472385..0143616653 100644 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/bootstrap.yml +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/bootstrap.yml @@ -76,9 +76,9 @@ dynamic: datasource: jinan: driver-class-name: com.mysql.cj.jdbc.Driver - url: @datasource.druid.org.url@ - username: @datasource.druid.org.username@ - password: @datasource.druid.org.password@ + url: @datasource.jinan.druid.org.url@ + username: @datasource.jinan.druid.org.username@ + password: @datasource.jinan.druid.org.password@ management: endpoints: From d20b25a702e5e89e901738dc346f07d7f9350bea Mon Sep 17 00:00:00 2001 From: jianjun Date: Sat, 23 Jul 2022 00:10:13 +0800 Subject: [PATCH 28/28] =?UTF-8?q?=E5=8F=98=E5=BC=82=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../open-data-worker/open-data-worker-server/pom.xml | 8 ++++---- .../src/main/resources/bootstrap.yml | 7 ++++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/epmet-module/open-data-worker/open-data-worker-server/pom.xml b/epmet-module/open-data-worker/open-data-worker-server/pom.xml index 8909b49154..194210540b 100644 --- a/epmet-module/open-data-worker/open-data-worker-server/pom.xml +++ b/epmet-module/open-data-worker/open-data-worker-server/pom.xml @@ -285,11 +285,11 @@ EpmEtOpEndAtArw_)$ - + - - sync_gridinfo_pingyin - xvfuz2lz + + sync_gridinfo_pingyin + xvfuz2lz 0 diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/bootstrap.yml b/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/bootstrap.yml index 0143616653..b8195e9611 100644 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/bootstrap.yml +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/bootstrap.yml @@ -76,9 +76,10 @@ dynamic: datasource: jinan: driver-class-name: com.mysql.cj.jdbc.Driver - url: @datasource.jinan.druid.org.url@ - username: @datasource.jinan.druid.org.username@ - password: @datasource.jinan.druid.org.password@ + url: @datasource.druid.jinan.url@ + username: @datasource.druid.jinan.username@ + password: @datasource.druid.jinan.password@ + management: endpoints: