diff --git a/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/ConsomerGroupConstants.java b/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/ConsomerGroupConstants.java index a1c61abf6b..fb5ae07412 100644 --- a/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/ConsomerGroupConstants.java +++ b/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/ConsomerGroupConstants.java @@ -60,4 +60,9 @@ public interface ConsomerGroupConstants { */ String OPEN_DATA_PATROL_CHANGE_EVENT_LISTENER_GROUP = "open_data_patrol_change_event_listener_group"; + /** + * 开放的对接数据(中间库) 项目变更事件监听器分组 + */ + String OPEN_DATA_PROJECT_CHANGE_EVENT_LISTENER_GROUP = "open_data_project_change_event_listener_group"; + } diff --git a/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/TopicConstants.java b/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/TopicConstants.java index 4dfeaa3500..3f0c3066ec 100644 --- a/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/TopicConstants.java +++ b/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/TopicConstants.java @@ -43,4 +43,9 @@ public interface TopicConstants { * 巡查记录 */ String PATROL = "patrol"; + + /** + * 项目 + */ + String PROJECT = "project"; } diff --git a/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/messages/DisputeProcessMQMsg.java b/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/messages/DisputeProcessMQMsg.java new file mode 100644 index 0000000000..30a1700054 --- /dev/null +++ b/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/messages/DisputeProcessMQMsg.java @@ -0,0 +1,22 @@ +package com.epmet.commons.rocketmq.messages; + +import lombok.AllArgsConstructor; +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description + * @Author zhaoqifeng + * @Date 2021/10/18 16:24 + */ +@Data +@AllArgsConstructor +public class DisputeProcessMQMsg implements Serializable { + private String customerId; + private String projectId; + /** + * 操作类型【新增:add 修改删除:edit】 + */ + private String type; +} diff --git a/epmet-gateway/pom.xml b/epmet-gateway/pom.xml index 7f72219805..1424d40c1c 100644 --- a/epmet-gateway/pom.xml +++ b/epmet-gateway/pom.xml @@ -365,8 +365,8 @@ - - http://127.0.0.1:8117 + lb://open-data-worker-server + lb://epmet-openapi-adv-server diff --git a/epmet-gateway/src/main/resources/bootstrap.yml b/epmet-gateway/src/main/resources/bootstrap.yml index 69423d078f..6db9fa47bb 100644 --- a/epmet-gateway/src/main/resources/bootstrap.yml +++ b/epmet-gateway/src/main/resources/bootstrap.yml @@ -352,7 +352,7 @@ spring: - CpAuth=true #政府工作端议题管理 - id: open-data-worker-server - uri: @gateway.routes.gov-issue-server.uri@ + uri: @gateway.routes.open-data-worker-server.url@ order: 38 predicates: - Path=${server.servlet.context-path}/opendata/** diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/EventInfoFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/EventInfoFormDTO.java index dbbbe4bbf0..ee5830567a 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/EventInfoFormDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/EventInfoFormDTO.java @@ -1,5 +1,6 @@ package com.epmet.dto.basereport.form; +import com.epmet.commons.tools.dto.form.PageFormDTO; import lombok.Data; import java.io.Serializable; @@ -10,7 +11,7 @@ import java.io.Serializable; * @Date 2021/10/15 10:55 */ @Data -public class EventInfoFormDTO implements Serializable { +public class EventInfoFormDTO extends PageFormDTO implements Serializable { private static final long serialVersionUID = 8479649048108914555L; private String customerId; private String projectId; diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/org/result/CustomerAgencyDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/org/result/CustomerAgencyDTO.java index c78138e9bf..658a3e9c2d 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/org/result/CustomerAgencyDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/org/result/CustomerAgencyDTO.java @@ -78,6 +78,11 @@ public class CustomerAgencyDTO implements Serializable { */ private String areaCode; + /** + * 省组织编码 + */ + private String code; + /** * 删除标识 */ diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/org/result/CustomerGridDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/org/result/CustomerGridDTO.java index bcff1ea7b0..752bb721cd 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/org/result/CustomerGridDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/org/result/CustomerGridDTO.java @@ -67,6 +67,11 @@ public class CustomerGridDTO implements Serializable { */ private String areaCode; + /** + * 省网格编码 + */ + private String code; + /** * 删除标识:0.未删除 1.已删除 */ diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenProjectDataDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenProjectDataDTO.java index 180ac24fe5..dfd88c7e96 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenProjectDataDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenProjectDataDTO.java @@ -132,6 +132,8 @@ public class ScreenProjectDataDTO implements Serializable { */ private BigDecimal latitude; + private String projectCreator; + /** * 删除标识 0未删除;1已删除 */ @@ -197,4 +199,11 @@ public class ScreenProjectDataDTO implements Serializable { */ private String tempGridName; + private String finishOrg; + + private String finishOrgLevel; + + private String orgIdPath; + + private String finishOrgType; } diff --git a/epmet-module/data-statistical/data-statistical-server/pom.xml b/epmet-module/data-statistical/data-statistical-server/pom.xml index 2640d9f97d..ae4c1556eb 100644 --- a/epmet-module/data-statistical/data-statistical-server/pom.xml +++ b/epmet-module/data-statistical/data-statistical-server/pom.xml @@ -122,6 +122,12 @@ 2.0.0 compile + + com.epmet + epmet-message-client + 2.0.0 + compile + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/OrgTypeConstant.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/OrgTypeConstant.java index 7c88be956c..3fa6ac0fdc 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/OrgTypeConstant.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/OrgTypeConstant.java @@ -46,4 +46,14 @@ public interface OrgTypeConstant { */ String COMMUNITY = "community"; + /** + * 省级 + */ + String PROVINCE = "province"; + + /** + * 市级 + */ + String CITY = "city"; + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/ProjectConstant.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/ProjectConstant.java index e099b5f89d..6b9966b154 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/ProjectConstant.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/ProjectConstant.java @@ -82,4 +82,12 @@ public interface ProjectConstant { */ String PROJECT_ORIGIN_AGENCY="agency"; String PROJECT_ORIGIN_EVENT="resi_event"; + /** + * 自办 + */ + String PROJECT_SELF_CLOSED="01"; + /** + * 上报 + */ + String PROJECT_REPORT="02"; } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectDataDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectDataDao.java index 4083242997..97c85d1bc0 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectDataDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectDataDao.java @@ -66,4 +66,6 @@ public interface ScreenProjectDataDao extends BaseDao { void deleteByProjectIds(@Param("customerId") String customerId, @Param("list") List list); int updateProjectSatisfactionScore(@Param("projectId")String projectId, @Param("score")BigDecimal score); + + List selectProjectList(@Param("customerId") String customerId, @Param("projectId") String projectId); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenCustomerAgencyEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenCustomerAgencyEntity.java index 4fc6f6bee8..475e9907bd 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenCustomerAgencyEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenCustomerAgencyEntity.java @@ -94,7 +94,6 @@ public class ScreenCustomerAgencyEntity extends BaseEpmetEntity { * 行政地区编码 */ private String areaCode; - private String code; private String sourceType; /** diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenCustomerGridEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenCustomerGridEntity.java index 5a2b97896a..9de3701b58 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenCustomerGridEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenCustomerGridEntity.java @@ -93,6 +93,4 @@ public class ScreenCustomerGridEntity extends BaseEpmetEntity { * desc: 是否参与上级计算yes:参与;no:不参与 add 01.14 */ private String upToCal; - - private String code; } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenProjectDataEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenProjectDataEntity.java index b53feaf6f6..85b81560e2 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenProjectDataEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenProjectDataEntity.java @@ -160,4 +160,6 @@ public class ScreenProjectDataEntity extends BaseEpmetEntity { */ private BigDecimal satisfactionScore; + private String projectCreator; + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/mq/ProjectChangedCustomListener.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/mq/ProjectChangedCustomListener.java index 1792654765..72e12ff5dc 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/mq/ProjectChangedCustomListener.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/mq/ProjectChangedCustomListener.java @@ -2,6 +2,7 @@ package com.epmet.mq; import com.alibaba.fastjson.JSON; import com.epmet.commons.rocketmq.constants.MQUserPropertys; +import com.epmet.commons.rocketmq.messages.DisputeProcessMQMsg; import com.epmet.commons.rocketmq.messages.ProjectChangedMQMsg; import com.epmet.commons.tools.distributedlock.DistributedLock; import com.epmet.commons.tools.exception.ExceptionUtils; @@ -9,9 +10,11 @@ import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.redis.RedisKeys; import com.epmet.commons.tools.redis.RedisUtils; import com.epmet.commons.tools.utils.SpringContextUtils; +import com.epmet.constant.SystemMessageType; import com.epmet.dto.extract.form.ExtractOriginFormDTO; import com.epmet.service.evaluationindex.extract.todata.FactOriginExtractService; import com.epmet.service.evaluationindex.extract.toscreen.ScreenExtractService; +import com.epmet.service.evaluationindex.screen.ScreenProjectDataService; import com.epmet.util.DimIdGenerator; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; @@ -29,7 +32,6 @@ import java.util.List; import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; -import java.util.stream.Collectors; /** * @Description 项目变动-监听器 @@ -45,6 +47,7 @@ public class ProjectChangedCustomListener implements MessageListenerConcurrently private RedisUtils redisUtils; + @Override public ConsumeConcurrentlyStatus consumeMessage(List msgs, ConsumeConcurrentlyContext context) { @@ -149,6 +152,16 @@ public class ProjectChangedCustomListener implements MessageListenerConcurrently SpringContextUtils.getBean(ScreenExtractService.class).extractPartData(customerId,dateId); } logger.info("consumer projectChanged msg success,{}",aBoolean); + + //发送项目数据上报的mq消息 + String type; + if ("issue_shift_project".equals(msgObj.getOperation()) || "created".equals(msgObj.getOperation())) { + type = SystemMessageType.PROJECT_ADD; + } else { + type = SystemMessageType.PROJECT_EDIT; + } + DisputeProcessMQMsg msg = new DisputeProcessMQMsg(customerId, msgObj.getProjectId(), type); + SpringContextUtils.getBean(ScreenProjectDataService.class).sendProjectChangeMq(msg); } catch (RenException e) { // 如果是我们手动抛出的异常,说明在业务可控范围内。目前不需要MQ重试 logger.error("【RocketMQ】消费项目变动消息失败:",e); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenProjectSettleServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenProjectSettleServiceImpl.java index ffff48bc3f..6ad38758e4 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenProjectSettleServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenProjectSettleServiceImpl.java @@ -85,6 +85,7 @@ public class ScreenProjectSettleServiceImpl implements ScreenProjectSettleServic meta.setProjectCreateTime(projectInfo.getCreatedTime()); meta.setProjectTitle(projectInfo.getTitle()); meta.setOrigin(projectInfo.getOrigin()); + meta.setProjectCreator(projectInfo.getCreatedBy()); if (ProjectConstant.PROJECT_ORIGIN_ISSUE.equals(projectInfo.getOrigin())) { //来源于议题的,上面的initNewScreenProjectData,已经赋值orgType=grid, orgId:gridId diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectDataService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectDataService.java index 2cf68852db..a29640a75b 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectDataService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectDataService.java @@ -18,6 +18,7 @@ package com.epmet.service.evaluationindex.screen; import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.rocketmq.messages.DisputeProcessMQMsg; import com.epmet.commons.tools.page.PageData; import com.epmet.dto.screen.ScreenProjectDataDTO; import com.epmet.dto.screen.form.ScreenProjectDataInfoFormDTO; @@ -136,6 +137,15 @@ public interface ScreenProjectDataService extends BaseService getProjectList(String customerId, String projectId); + List getProjectList(String customerId, String projectId, Integer pageNo, Integer pageSize); + + /** + * 项目变更MQ + * @Param msg + * @Return + * @Author zhaoqifeng + * @Date 2021/10/18 15:55 + */ + void sendProjectChangeMq(DisputeProcessMQMsg msg); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerAgencyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerAgencyServiceImpl.java index 51f0c3348a..5e0be26034 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerAgencyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerAgencyServiceImpl.java @@ -334,7 +334,7 @@ public class ScreenCustomerAgencyServiceImpl extends BaseServiceImpl getAgencyList(String customerId) { LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(StringUtils.isNotBlank(customerId), ScreenCustomerAgencyEntity::getAgencyId, customerId); + wrapper.eq(StringUtils.isNotBlank(customerId), ScreenCustomerAgencyEntity::getCustomerId, customerId); List list = baseDao.selectList(wrapper); if (CollectionUtils.isEmpty(list)) { return Collections.emptyMap(); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerGridServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerGridServiceImpl.java index 39275963ba..33fffebc37 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerGridServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerGridServiceImpl.java @@ -246,7 +246,7 @@ public class ScreenCustomerGridServiceImpl extends BaseServiceImpl getGridList(String customerId) { LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(StringUtils.isNotBlank(customerId), ScreenCustomerGridEntity::getGridId, customerId); + wrapper.eq(StringUtils.isNotBlank(customerId), ScreenCustomerGridEntity::getCustomerId, customerId); List list = baseDao.selectList(wrapper); return ConvertUtils.sourceToTarget(list, ScreenCustomerGridDTO.class).stream().collect(Collectors.toMap(ScreenCustomerGridDTO::getGridId, Function.identity())); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectDataServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectDataServiceImpl.java index 10678a2fbc..f04234049e 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectDataServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectDataServiceImpl.java @@ -17,11 +17,11 @@ package com.epmet.service.evaluationindex.screen.impl; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.rocketmq.messages.DisputeProcessMQMsg; import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.page.PageData; @@ -34,7 +34,10 @@ import com.epmet.dto.screen.form.ScreenProjectDataInfoFormDTO; import com.epmet.dto.screencoll.ScreenCollFormDTO; import com.epmet.entity.evaluationindex.screen.ScreenProjectDataEntity; import com.epmet.entity.evaluationindex.screen.ScreenProjectImgDataEntity; +import com.epmet.feign.EpmetMessageOpenFeignClient; +import com.epmet.send.SendMqMsgUtil; import com.epmet.service.evaluationindex.screen.ScreenProjectDataService; +import com.github.pagehelper.PageHelper; import org.apache.commons.collections4.ListUtils; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.StringUtils; @@ -62,6 +65,8 @@ public class ScreenProjectDataServiceImpl extends BaseServiceImpl page(Map params) { @@ -284,14 +289,21 @@ public class ScreenProjectDataServiceImpl extends BaseServiceImpl getProjectList(String customerId, String projectId) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(StringUtils.isNotBlank(customerId), ScreenProjectDataEntity::getCustomerId, customerId); - wrapper.eq(StringUtils.isNotBlank(projectId), ScreenProjectDataEntity::getProjectId, projectId); - wrapper.ne(ScreenProjectDataEntity::getCategoryCode, null); - wrapper.ne(ScreenProjectDataEntity::getCategoryCode, ""); - List list = baseDao.selectList(wrapper); - return ConvertUtils.sourceToTarget(list, ScreenProjectDataDTO.class); + public List getProjectList(String customerId, String projectId, Integer pageNo, Integer pageSize) { + PageHelper.startPage(pageNo, pageSize); + return baseDao.selectProjectList(customerId, projectId); + } + + /** + * @Description 项目变更MQ + * @Param msg + * @Return + * @Author zhaoqifeng + * @Date 2021/10/18 14:00 + */ + @Override + public void sendProjectChangeMq(DisputeProcessMQMsg msg) { + SendMqMsgUtil.build().openFeignClient(epmetMessageOpenFeignClient).sendProjectMqMsg(msg); } } 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 26b125af39..a0b1931b29 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 @@ -148,7 +148,7 @@ public class DataReportingServiceImpl implements DataReportingService { public List getEventInfo(EventInfoFormDTO formDTO) { List list; //根据入参,获取项目 - List projectList = screenProjectDataService.getProjectList(formDTO.getCustomerId(), formDTO.getProjectId()); + List projectList = screenProjectDataService.getProjectList(formDTO.getCustomerId(), formDTO.getProjectId(), formDTO.getPageNo(), formDTO.getPageSize()); //项目列表为空,返回空数组 if(CollectionUtils.isEmpty(projectList)) { return Collections.emptyList(); @@ -194,6 +194,7 @@ public class DataReportingServiceImpl implements DataReportingService { dto.setId(project.getProjectId()); dto.setCustomerId(project.getCustomerId()); dto.setEventName(project.getProjectTitle()); + dto.setReporterId(project.getProjectCreator()); String categoryCode = project.getCategoryCode().split(StrConstant.COMMA)[0]; //如果是孔村、榆山、锦水的项目需要关联分类字典表 if("2fe0065f70ca0e23ce4c26fca5f1d933".equals(project.getCustomerId()) || @@ -206,21 +207,66 @@ public class DataReportingServiceImpl implements DataReportingService { categoryCode = null; } } + dto.setEventCategory(categoryCode); dto.setReportTime(project.getProjectCreateTime()); dto.setHappenDate(DateUtils.parseDate(DateUtils.format(project.getProjectCreateTime()), DateUtils.DATE_PATTERN)); + dto.setHappenPlace(project.getProjectAddress()); dto.setEventDescription(project.getProjectContent()); - //TODO 办结方式 - dto.setWaysOfResolving("01"); dto.setSuccessfulOrNo(ProjectConstant.CLOSED_CASE.equals(project.getProjectStatusCode())?"Y":"N"); - //TODO 办结层级 - dto.setCompleteLevel("01"); + if (ProjectConstant.CLOSED_CASE.equals(project.getProjectStatusCode())) { + dto.setWaysOfResolving(project.getOrgId().equals(project.getFinishOrg())?ProjectConstant.PROJECT_SELF_CLOSED:ProjectConstant.PROJECT_REPORT); + //办结组织是机关时,办结层级为机关的层级 + if (OrgTypeConstant.AGENCY.equals(project.getFinishOrgType())) { + //如果是孔村的项目办结层级需要降一级 + if("2fe0065f70ca0e23ce4c26fca5f1d933".equals(project.getCustomerId())) { + switch (project.getFinishOrgLevel()) { + case OrgTypeConstant.DISTRICT: + dto.setCompleteLevel("04"); + break; + case OrgTypeConstant.STREET: + case OrgTypeConstant.COMMUNITY: + dto.setCompleteLevel("06"); + break; + default: + break; + } + } else { + dto.setCompleteLevel(getCompleteLevel(project.getFinishOrgLevel())); + } + } else if (OrgTypeConstant.DEPARTMENT.equals(project.getFinishOrgType())) { + //办结组织是部门时,办结层级为部门所在组织的曾经 + String[] orgIds = project.getOrgIdPath().split(StrConstant.COLON); + int size = orgIds.length; + ScreenCustomerAgencyEntity agency = screenCustomerAgencyService.getAgencyById(orgIds[size - 1]); + dto.setCompleteLevel(getCompleteLevel(agency.getLevel())); + } else { + //办结组织是网格时,办结层级为网格 + dto.setCompleteLevel("07"); + } + } + dto.setCompleteTime(project.getCloseCaseTime()); dto.setLat(project.getLatitude()); dto.setLng(project.getLongitude()); return dto; } - + private String getCompleteLevel(String level) { + switch (level) { + case OrgTypeConstant.PROVINCE: + return "01"; + case OrgTypeConstant.CITY: + return "02"; + case OrgTypeConstant.DISTRICT: + return "03"; + case OrgTypeConstant.STREET: + return "04"; + case OrgTypeConstant.COMMUNITY: + return "06"; + default: + return null; + } + } @Override public List getPatrolRecordList(MidPatrolFormDTO formDTO) { diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectDataDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectDataDao.xml index db38763cb5..5930ae87c9 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectDataDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectDataDao.xml @@ -191,4 +191,82 @@ update screen_project_data set SATISFACTION_SCORE=#{score} where PROJECT_ID=#{projectId} + + + 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 3006619147..e906015ad2 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 @@ -132,10 +132,7 @@ * FROM customer_grid - WHERE 1=1 - - AND del_flag = '0' - + WHERE del_flag = '0' AND customer_id = #{customerId} 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 6c035cb0df..b43eea7bb1 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 @@ -210,10 +210,7 @@ * FROM customer_agency - WHERE 1=1 - - AND del_flag = '0' - + WHERE del_flag = '0' AND customer_id = #{customerId} diff --git a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/constant/SystemMessageType.java b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/constant/SystemMessageType.java index 9e502bd6ca..84580a3b4a 100644 --- a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/constant/SystemMessageType.java +++ b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/constant/SystemMessageType.java @@ -75,4 +75,14 @@ public interface SystemMessageType { */ String USER_PATROL_STOP = "user_patrol_stop"; + /** + * 项目变动 + */ + String PROJECT_ADD = "project_add"; + + /** + * 项目变动 + */ + String PROJECT_EDIT = "project_edit"; + } diff --git a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/send/SendMqMsgUtil.java b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/send/SendMqMsgUtil.java index 551bb9d4ec..e232f5f635 100644 --- a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/send/SendMqMsgUtil.java +++ b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/send/SendMqMsgUtil.java @@ -182,4 +182,35 @@ public class SendMqMsgUtil { } + /** + * desc: 发送项目变动事件消息 + * + * @param msgContent + * @return boolean + * @author LiuJanJun + * @date 2021/4/23 3:01 下午 + * @remark 失败重试1次,调用端自行判断如果失败是否要继续执行 + */ + public boolean sendProjectMqMsg(DisputeProcessMQMsg msgContent) { + try { + SystemMsgFormDTO systemMsgFormDTO = new SystemMsgFormDTO(); + systemMsgFormDTO.setMessageType(msgContent.getType()); + systemMsgFormDTO.setContent(msgContent); + Result sendMsgResult; + log.info("sendProjectMqMsg param:{}",msgContent); + int retryTime = 0; + do { + sendMsgResult = epmetMessageOpenFeignClient.sendSystemMsgByMQ(systemMsgFormDTO); + } while ((sendMsgResult == null || !sendMsgResult.success()) && retryTime++ < NumConstant.TWO); + + if (sendMsgResult != null && sendMsgResult.success()) { + return true; + } + log.error("发送(项目变动)系统消息到message服务失败:{},msg:{}", JSON.toJSONString(sendMsgResult), JSON.toJSONString(systemMsgFormDTO)); + } catch (Exception e) { + log.error("sendMqMsg exception", e); + } + return false; + } + } diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/SystemMessageServiceImpl.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/SystemMessageServiceImpl.java index dfd6737b57..61373708df 100644 --- a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/SystemMessageServiceImpl.java +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/SystemMessageServiceImpl.java @@ -183,6 +183,10 @@ public class SystemMessageServiceImpl implements SystemMessageService { case SystemMessageType.USER_PATROL_STOP: topic = TopicConstants.PATROL; break; + case SystemMessageType.PROJECT_ADD: + case SystemMessageType.PROJECT_EDIT: + topic = TopicConstants.PROJECT; + break; } return topic; } @@ -208,6 +212,7 @@ public class SystemMessageServiceImpl implements SystemMessageService { case TopicConstants.PATROL: case TopicConstants.POINT: case TopicConstants.STAFF: + case TopicConstants.PROJECT: // 耗时较短。一个小时最多发送一次告警 if (l1LastAlertTime == null || ( diff --git a/epmet-module/open-data-worker/open-data-worker-client/src/main/java/com/epmet/opendata/dto/BaseDisputeProcessDTO.java b/epmet-module/open-data-worker/open-data-worker-client/src/main/java/com/epmet/opendata/dto/BaseDisputeProcessDTO.java index 38ab49fc12..2f377e9ac9 100644 --- a/epmet-module/open-data-worker/open-data-worker-client/src/main/java/com/epmet/opendata/dto/BaseDisputeProcessDTO.java +++ b/epmet-module/open-data-worker/open-data-worker-client/src/main/java/com/epmet/opendata/dto/BaseDisputeProcessDTO.java @@ -44,6 +44,10 @@ public class BaseDisputeProcessDTO implements Serializable { */ private String customerId; + private Integer detpId; + + private String reporterId; + /** * 网格编码 */ diff --git a/epmet-module/open-data-worker/open-data-worker-client/src/main/java/com/epmet/opendata/dto/ExDeptDTO.java b/epmet-module/open-data-worker/open-data-worker-client/src/main/java/com/epmet/opendata/dto/ExDeptDTO.java new file mode 100644 index 0000000000..cd092d52ba --- /dev/null +++ b/epmet-module/open-data-worker/open-data-worker-client/src/main/java/com/epmet/opendata/dto/ExDeptDTO.java @@ -0,0 +1,81 @@ +/** + * 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.dto; + +import lombok.Data; + +import java.io.Serializable; + + +/** + * 部门(网格)中间表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-10-19 + */ +@Data +public class ExDeptDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * (市平台)部门id + */ + private Integer deptId; + + /** + * (市平台)父部门id + */ + private Integer parentId; + + /** + * 祖级列表 + */ + private String ancestors; + + /** + * (市平台)部门/网格名称 + */ + private String fullName; + + /** + * (市平台)部门/网格简称 + */ + private String deptName; + + /** + * (市平台)部门/网格编码 + */ + private String deptCode; + + /** + * + */ + private String gridCode; + + /** + * (区县平台)部门id + */ + private String deptIdQx; + + /** + * (区县平台)部门/网格名称 + */ + private String deptNameQx; + +} \ No newline at end of file diff --git a/epmet-module/open-data-worker/open-data-worker-client/src/main/java/com/epmet/opendata/dto/form/GridBaseInfoFormDTO.java b/epmet-module/open-data-worker/open-data-worker-client/src/main/java/com/epmet/opendata/dto/form/GridBaseInfoFormDTO.java index c1952d1bcf..0b1910a2ea 100644 --- a/epmet-module/open-data-worker/open-data-worker-client/src/main/java/com/epmet/opendata/dto/form/GridBaseInfoFormDTO.java +++ b/epmet-module/open-data-worker/open-data-worker-client/src/main/java/com/epmet/opendata/dto/form/GridBaseInfoFormDTO.java @@ -25,7 +25,7 @@ public class GridBaseInfoFormDTO implements Serializable { */ private List orgIdList; /** - * 操作类型【新增:add 修改删除:edit】 + * 操作类型【新增:add 修改删除:edit 初始化所有数据:all】 */ private String type; diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/ExDeptDao.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/ExDeptDao.java new file mode 100644 index 0000000000..fa088c958f --- /dev/null +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/ExDeptDao.java @@ -0,0 +1,55 @@ +/** + * 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.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.opendata.entity.BaseGridInfoEntity; +import com.epmet.opendata.entity.ExDeptEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 网格基础信息表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-10-15 + */ +@Mapper +public interface ExDeptDao extends BaseDao { + + /** + * @Author sun + * @Description 网格基础信息批量更新部分字段 + **/ + int updateBatch(@Param("list") List entityList); + + /** + * @Author sun + * @Description 网格基础信息批量更新部分字段 + **/ + int insertBatch(@Param("list") List entityList); + + /** + * @Author sun + * @Description 网格基础信息批量更新部分字段 + **/ + int updateBatchGrid(@Param("list") List entityList); + +} \ No newline at end of file diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/entity/BaseDisputeProcessEntity.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/entity/BaseDisputeProcessEntity.java index c7266558ed..3f458a026a 100644 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/entity/BaseDisputeProcessEntity.java +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/entity/BaseDisputeProcessEntity.java @@ -44,6 +44,10 @@ public class BaseDisputeProcessEntity extends BaseEpmetEntity { */ private String customerId; + private Integer detpId; + + private String reporterId; + /** * 网格编码 */ diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/entity/ExDeptEntity.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/entity/ExDeptEntity.java new file mode 100644 index 0000000000..7a2d2e3ff8 --- /dev/null +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/entity/ExDeptEntity.java @@ -0,0 +1,82 @@ +/** + * 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.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 部门(网格)中间表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-10-19 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("ex_dept") +public class ExDeptEntity { + + private static final long serialVersionUID = 1L; + + /** + * (市平台)部门id + */ + private Integer deptId; + + /** + * (市平台)父部门id + */ + private Integer parentId; + + /** + * 祖级列表 + */ + private String ancestors; + + /** + * (市平台)部门/网格名称 + */ + private String fullName; + + /** + * (市平台)部门/网格简称 + */ + private String deptName; + + /** + * (市平台)部门/网格编码 + */ + private String deptCode; + + /** + * + */ + private String gridCode; + + /** + * (区县平台)部门id + */ + private String deptIdQx; + + /** + * (区县平台)部门/网格名称 + */ + private String deptNameQx; + +} diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/mq/RocketMQConsumerRegister.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/mq/RocketMQConsumerRegister.java index 2ffed8c3dd..3fa339bc0b 100644 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/mq/RocketMQConsumerRegister.java +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/mq/RocketMQConsumerRegister.java @@ -43,9 +43,9 @@ public class RocketMQConsumerRegister extends MQAbstractRegister { "*", new OpenDataPatrolChangeEventListener()); register(consumerProperties, - ConsomerGroupConstants.PROJECT_CHANGED_COMPONENTS_GROUP, + ConsomerGroupConstants.OPEN_DATA_PROJECT_CHANGE_EVENT_LISTENER_GROUP, MessageModel.CLUSTERING, - TopicConstants.PROJECT_CHANGED, + TopicConstants.PROJECT, "*", new OpenDataProjectChangeEventListener()); diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/mq/listener/OpenDataProjectChangeEventListener.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/mq/listener/OpenDataProjectChangeEventListener.java index e82e2cd8c9..c2af1cffe7 100644 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/mq/listener/OpenDataProjectChangeEventListener.java +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/mq/listener/OpenDataProjectChangeEventListener.java @@ -2,11 +2,13 @@ package com.epmet.opendata.mq.listener; import com.alibaba.fastjson.JSON; import com.epmet.commons.rocketmq.constants.MQUserPropertys; +import com.epmet.commons.rocketmq.messages.DisputeProcessMQMsg; import com.epmet.commons.tools.distributedlock.DistributedLock; import com.epmet.commons.tools.exception.ExceptionUtils; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.redis.RedisKeys; import com.epmet.commons.tools.redis.RedisUtils; +import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.SpringContextUtils; import com.epmet.dto.basereport.form.EventInfoFormDTO; import com.epmet.feign.EpmetMessageOpenFeignClient; @@ -63,7 +65,8 @@ public class OpenDataProjectChangeEventListener implements MessageListenerConcur //messageExt.propert logger.info("【开放数据事件监听器】-项目信息变更-收到消息内容:{}, 操作:{}, pendingMsgLabel:{}", msg, tags, pendingMsgLabel); - EventInfoFormDTO obj = JSON.parseObject(msg, EventInfoFormDTO.class); + DisputeProcessMQMsg obj = JSON.parseObject(msg, DisputeProcessMQMsg.class); + EventInfoFormDTO formDTO = ConvertUtils.sourceToTarget(obj, EventInfoFormDTO.class); DistributedLock distributedLock = null; RLock lock = null; @@ -71,7 +74,7 @@ public class OpenDataProjectChangeEventListener implements MessageListenerConcur distributedLock = SpringContextUtils.getBean(DistributedLock.class); lock = distributedLock.getLock(String.format("lock:open_data_project:%s", obj.getProjectId()), 30L, 30L, TimeUnit.SECONDS); - SpringContextUtils.getBean(BaseDisputeProcessService.class).getEventinfo(obj); + SpringContextUtils.getBean(BaseDisputeProcessService.class).getEventinfo(formDTO); } 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/ExDeptService.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/ExDeptService.java new file mode 100644 index 0000000000..644c06c673 --- /dev/null +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/ExDeptService.java @@ -0,0 +1,97 @@ +/** + * 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; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.opendata.dto.ExDeptDTO; +import com.epmet.opendata.entity.ExDeptEntity; + +import java.util.List; +import java.util.Map; + +/** + * 部门(网格)中间表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-10-19 + */ +public interface ExDeptService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2021-10-19 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2021-10-19 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return ExDeptDTO + * @author generator + * @date 2021-10-19 + */ + ExDeptDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2021-10-19 + */ + void save(ExDeptDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2021-10-19 + */ + void update(ExDeptDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2021-10-19 + */ + void delete(String[] ids); + + Map getDeptMap(); +} \ 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/BaseDisputeProcessServiceImpl.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/BaseDisputeProcessServiceImpl.java index 0a0d18a9f0..8068eda5cc 100644 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/BaseDisputeProcessServiceImpl.java +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/BaseDisputeProcessServiceImpl.java @@ -18,20 +18,24 @@ package com.epmet.opendata.service.impl; 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.ConvertUtils; import com.epmet.commons.tools.utils.Result; +import com.epmet.constant.SystemMessageType; import com.epmet.dto.basereport.form.EventInfoFormDTO; import com.epmet.feign.DataStatisticalOpenFeignClient; import com.epmet.opendata.dao.BaseDisputeProcessDao; import com.epmet.opendata.dto.BaseDisputeProcessDTO; import com.epmet.opendata.entity.BaseDisputeProcessEntity; import com.epmet.opendata.service.BaseDisputeProcessService; +import com.epmet.opendata.service.ExDeptService; import org.apache.commons.collections4.CollectionUtils; import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.util.List; +import java.util.Map; /** * 事件信息表 @@ -43,6 +47,8 @@ import java.util.List; public class BaseDisputeProcessServiceImpl extends BaseServiceImpl implements BaseDisputeProcessService { @Resource private DataStatisticalOpenFeignClient dataStatisticalOpenFeignClient; + @Resource + private ExDeptService exDeptService; /** * 获取上报事件 @@ -59,15 +65,37 @@ public class BaseDisputeProcessServiceImpl extends BaseServiceImpl deptMap = exDeptService.getDeptMap(); List list = result.getData(); if (CollectionUtils.isNotEmpty(list)) { List entityList = ConvertUtils.sourceToTarget(list, BaseDisputeProcessEntity.class); - if("add".equals(formDTO.getType())){ + entityList.forEach(item -> { + item.setDetpId(deptMap.get(item.getOrgCode())); + }); + if(SystemMessageType.PROJECT_ADD.equals(formDTO.getType())){ insertBatch(entityList); }else { updateBatchById(entityList); } } + //分批次循环 + while (CollectionUtils.isNotEmpty(list)) { + formDTO.setPageNo(formDTO.getPageNo() + NumConstant.ONE); + result = dataStatisticalOpenFeignClient.getEventInfo(formDTO); + list = result.getData(); + if (CollectionUtils.isNotEmpty(list)) { + List entityList = ConvertUtils.sourceToTarget(list, BaseDisputeProcessEntity.class); + entityList.forEach(item -> { + item.setDetpId(deptMap.get(item.getOrgCode())); + }); + if("add".equals(formDTO.getType())){ + insertBatch(entityList); + }else { + updateBatchById(entityList); + } + } + } + } diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/BaseGridInfoServiceImpl.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/BaseGridInfoServiceImpl.java index 1d4f4a1e17..7802dfc707 100644 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/BaseGridInfoServiceImpl.java +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/BaseGridInfoServiceImpl.java @@ -18,14 +18,17 @@ package com.epmet.opendata.service.impl; 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.dto.org.result.CustomerAgencyDTO; import com.epmet.dto.org.result.CustomerGridDTO; import com.epmet.feign.DataStatisticalOpenFeignClient; import com.epmet.opendata.dao.BaseGridInfoDao; +import com.epmet.opendata.dao.ExDeptDao; import com.epmet.opendata.dto.form.GridBaseInfoFormDTO; import com.epmet.opendata.entity.BaseGridInfoEntity; +import com.epmet.opendata.entity.ExDeptEntity; import com.epmet.opendata.service.BaseGridInfoService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -44,6 +47,8 @@ import java.util.List; public class BaseGridInfoServiceImpl extends BaseServiceImpl implements BaseGridInfoService { @Autowired private DataStatisticalOpenFeignClient dataStatisticalOpenFeignClient; + @Autowired + private ExDeptDao exDeptDao; /** * @Author sun @@ -52,13 +57,16 @@ public class BaseGridInfoServiceImpl extends BaseServiceImpl> result = dataStatisticalOpenFeignClient.getAgencyBaseInfo(formDTO); if (!result.success()) { throw new RenException(result.getInternalMsg()); } + if (null == result.getData() || result.getData().size() < NumConstant.ONE) { + return; + } //2.中间库新增/修改数据 - List entityList = new ArrayList<>(); + /*List entityList = new ArrayList<>(); result.getData().forEach(ag->{ BaseGridInfoEntity entity = new BaseGridInfoEntity(); entity.setCustomerId(ag.getCustomerId()); @@ -76,13 +84,22 @@ public class BaseGridInfoServiceImpl extends BaseServiceImpl ExList = new ArrayList<>(); + result.getData().forEach(ag->{ + ExDeptEntity entity = new ExDeptEntity(); + entity.setDeptIdQx(ag.getId()); + entity.setDeptNameQx(ag.getOrganizationName()); + entity.setGridCode(ag.getCode()); + ExList.add(entity); }); - if("add".equals(formDTO.getType())){ - insertBatch(entityList); + if(null!=formDTO.getType()&& "all".equals(formDTO.getType())){ + exDeptDao.updateBatch(ExList); }else { - baseDao.updateBatch(entityList); + exDeptDao.insertBatch(ExList); } + } /** @@ -97,8 +114,11 @@ public class BaseGridInfoServiceImpl extends BaseServiceImpl entityList = new ArrayList<>(); + /*List entityList = new ArrayList<>(); result.getData().forEach(ag->{ BaseGridInfoEntity entity = new BaseGridInfoEntity(); entity.setCustomerId(ag.getCustomerId()); @@ -111,11 +131,19 @@ public class BaseGridInfoServiceImpl extends BaseServiceImpl ExList = new ArrayList<>(); + result.getData().forEach(ag -> { + ExDeptEntity entity = new ExDeptEntity(); + entity.setDeptIdQx(ag.getId()); + entity.setDeptNameQx(ag.getGridName()); + entity.setGridCode(ag.getCode()); + ExList.add(entity); }); - if("add".equals(formDTO.getType())){ - insertBatch(entityList); - }else { - baseDao.updateBatch(entityList); + if (null != formDTO.getType() && "all".equals(formDTO.getType())) { + exDeptDao.updateBatchGrid(ExList); + } else { + exDeptDao.insertBatch(ExList); } } diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/ExDeptServiceImpl.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/ExDeptServiceImpl.java new file mode 100644 index 0000000000..44b519e95b --- /dev/null +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/ExDeptServiceImpl.java @@ -0,0 +1,115 @@ +/** + * 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.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.opendata.dao.ExDeptDao; +import com.epmet.opendata.dto.ExDeptDTO; +import com.epmet.opendata.entity.ExDeptEntity; +import com.epmet.opendata.service.ExDeptService; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * 部门(网格)中间表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-10-19 + */ +@Service +public class ExDeptServiceImpl extends BaseServiceImpl implements ExDeptService { + + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, ExDeptDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, ExDeptDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public ExDeptDTO get(String id) { + ExDeptEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, ExDeptDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(ExDeptDTO dto) { + ExDeptEntity entity = ConvertUtils.sourceToTarget(dto, ExDeptEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(ExDeptDTO dto) { + ExDeptEntity entity = ConvertUtils.sourceToTarget(dto, ExDeptEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + @Override + public Map getDeptMap() { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.ne(ExDeptEntity::getGridCode, null); + List entityList = baseDao.selectList(wrapper); + if (CollectionUtils.isEmpty(entityList)) { + return Collections.emptyMap(); + } + return entityList.stream().collect(Collectors.toMap(ExDeptEntity::getGridCode, ExDeptEntity::getDeptId, (key1, key2) -> key2)); + } + +} \ No newline at end of file diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/ExDeptDao.xml b/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/ExDeptDao.xml new file mode 100644 index 0000000000..ba20d99170 --- /dev/null +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/ExDeptDao.xml @@ -0,0 +1,95 @@ + + + + + + + + + + + + + + + + + + UPDATE ex_dept + + + + + + when grid_code = #{item.gridCode} then #{item.deptIdQx} + + + + + + + + when grid_code = #{item.gridCode} then #{item.deptNameQx} + + + + + + WHERE + 1=1 + + grid_code = #{item.gridCode} + + + + + INSERT INTO ex_dept + ( + dept_id_qx, + dept_name_qx, + grid_code + ) + VALUES + + ( + #{i.deptIdQx}, + #{i.deptNameQx}, + #{i.gridCode} + ) + + ON DUPLICATE KEY + UPDATE + dept_id_qx = values(dept_id_qx), + dept_name_qx = values(dept_name_qx) + + + + UPDATE ex_dept + + + + + + when dept_name LIKE CONCAT(left(#{item.deptNameQx},2),'%',right(#{item.deptNameQx},2),if(LOCATE('第二', #{item.deptNameQx})>0,'%2','%1')) then #{item.deptIdQx} + + + + + + + + when dept_name LIKE CONCAT(left(#{item.deptNameQx},2),'%',right(#{item.deptNameQx},2),if(LOCATE('第二', #{item.deptNameQx})>0,'%2','%1')) then #{item.deptNameQx} + + + + + + WHERE + 1=1 + + dept_name LIKE CONCAT(left(#{item.deptNameQx},2),'%',right(#{item.deptNameQx},2),if(LOCATE('第二', #{item.deptNameQx})>0,'%2','%1')) + + + + + \ No newline at end of file