diff --git a/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/service/BaseService.java b/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/service/BaseService.java index c82dce8253..9f5a388ab2 100644 --- a/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/service/BaseService.java +++ b/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/service/BaseService.java @@ -123,5 +123,31 @@ public interface BaseService { */ boolean deleteBatchIds(Collection idList); + /** + *

+ * 存在更新记录,否插入一条记录 + *

+ * + * @param entity 实体对象 + */ + boolean saveOrUpdate(T entity); + + /** + *

+ * 批量修改插入 + *

+ * + * @param entityList 实体对象集合 + */ + boolean saveOrUpdateBatch(Collection entityList); + /** + *

+ * 批量修改插入 + *

+ * + * @param entityList 实体对象集合 + * @param batchSize 更新批次数量 + */ + boolean saveOrUpdateBatch(Collection entityList, int batchSize); } diff --git a/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/service/impl/BaseServiceImpl.java b/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/service/impl/BaseServiceImpl.java index fc89437e03..445f5a6e40 100644 --- a/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/service/impl/BaseServiceImpl.java +++ b/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/service/impl/BaseServiceImpl.java @@ -13,6 +13,8 @@ import com.baomidou.mybatisplus.core.enums.SqlMethod; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.OrderItem; +import com.baomidou.mybatisplus.core.metadata.TableInfo; +import com.baomidou.mybatisplus.core.metadata.TableInfoHelper; import com.baomidou.mybatisplus.core.toolkit.*; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.toolkit.SqlHelper; @@ -31,6 +33,7 @@ import java.io.Serializable; import java.util.Collection; import java.util.List; import java.util.Map; +import java.util.Objects; /** * 基础服务类,所有Service都要继承 @@ -298,4 +301,56 @@ public abstract class BaseServiceImpl, T> implements Bas public boolean deleteBatchIds(Collection idList) { return SqlHelper.delBool(baseDao.deleteBatchIds(idList)); } + + @Transactional(rollbackFor = Exception.class) + @Override + public boolean saveOrUpdate(T entity) { + if (null != entity) { + Class cls = entity.getClass(); + TableInfo tableInfo = TableInfoHelper.getTableInfo(cls); + Assert.notNull(tableInfo, "error: can not execute. because can not find cache of TableInfo for entity!"); + String keyProperty = tableInfo.getKeyProperty(); + Assert.notEmpty(keyProperty, "error: can not execute. because can not find column for id from entity!"); + Object idVal = ReflectionKit.getMethodValue(cls, entity, tableInfo.getKeyProperty()); + return StringUtils.checkValNull(idVal) || Objects.isNull(selectById((Serializable) idVal)) ? insert(entity) : updateById(entity); + } + return false; + } + + @Transactional(rollbackFor = Exception.class) + @Override + public boolean saveOrUpdateBatch(Collection entityList) { + return saveOrUpdateBatch(entityList, 100); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public boolean saveOrUpdateBatch(Collection entityList, int batchSize) { + Assert.notEmpty(entityList, "error: entityList must not be empty"); + Class cls = currentModelClass(); + TableInfo tableInfo = TableInfoHelper.getTableInfo(cls); + Assert.notNull(tableInfo, "error: can not execute. because can not find cache of TableInfo for entity!"); + String keyProperty = tableInfo.getKeyProperty(); + Assert.notEmpty(keyProperty, "error: can not execute. because can not find column for id from entity!"); + try (SqlSession batchSqlSession = sqlSessionBatch()) { + int i = 0; + for (T entity : entityList) { + Object idVal = ReflectionKit.getMethodValue(cls, entity, keyProperty); + if (StringUtils.checkValNull(idVal) || Objects.isNull(selectById((Serializable) idVal))) { + batchSqlSession.insert(sqlStatement(SqlMethod.INSERT_ONE), entity); + } else { + MapperMethod.ParamMap param = new MapperMethod.ParamMap<>(); + param.put(Constants.ENTITY, entity); + batchSqlSession.update(sqlStatement(SqlMethod.UPDATE_BY_ID), param); + } + // 不知道以后会不会有人说更新失败了还要执行插入 😂😂😂 + if (i >= 1 && i % batchSize == 0) { + batchSqlSession.flushStatements(); + } + i++; + } + batchSqlSession.flushStatements(); + } + return true; + } } 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 index 30a1700054..bed6aa4bf5 100644 --- 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 @@ -4,6 +4,7 @@ import lombok.AllArgsConstructor; import lombok.Data; import java.io.Serializable; +import java.util.List; /** * @Description @@ -14,7 +15,7 @@ import java.io.Serializable; @AllArgsConstructor public class DisputeProcessMQMsg implements Serializable { private String customerId; - private String projectId; + private List projectId; /** * 操作类型【新增:add 修改删除:edit】 */ 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 ee5830567a..8e6c99d562 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 @@ -4,6 +4,7 @@ import com.epmet.commons.tools.dto.form.PageFormDTO; import lombok.Data; import java.io.Serializable; +import java.util.List; /** * @Description @@ -14,7 +15,7 @@ import java.io.Serializable; public class EventInfoFormDTO extends PageFormDTO implements Serializable { private static final long serialVersionUID = 8479649048108914555L; private String customerId; - private String projectId; + private List projectId; /** * 操作类型【新增:add 修改删除:edit】 */ diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/result/EventInfoResultDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/result/EventInfoResultDTO.java index cce7f1bb65..4b7aeea782 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/result/EventInfoResultDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/result/EventInfoResultDTO.java @@ -24,7 +24,7 @@ public class EventInfoResultDTO implements Serializable { */ private String customerId; - private Integer detpId; + private String orgId; private String reporterId; @@ -47,7 +47,7 @@ public class EventInfoResultDTO implements Serializable { * 事件类别 */ private String eventCategory; - + private String parentEventCategory; /** * 上报时间 YYYY-MM-DD HH:MM:SS */ @@ -78,6 +78,8 @@ public class EventInfoResultDTO implements Serializable { */ private String successfulOrNo; + private String status; + /** * 办结层级 01省、自治区、直辖市 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 2fde3c3566..f5f8d84596 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 @@ -79,104 +79,6 @@ public class GridUserInfoDTO implements Serializable { */ private String sex; - /** - * 民族[字典表主键] - */ - private String nation; - - /** - * 政治面貌[字典表主键] - */ - private String paerty; - - /** - * 出生日期[YYYY-MM-DD] - */ - private Date birthday; - /** - * 学历[字典表主键] - */ - private String education; - - /** - * 入职时间 - */ - private Date entryDate; - - /** - * 是否离职 - */ - private String isLeave; - - /** - * 离职时间 - */ - private Date leaveDate; - - /** - * 网格员年收入 - */ - private String income; - - /** - * 是否社区(村)两委委员[Y:是、N:否] - */ - private String isCommittee; - - /** - * 是否社区工作者[Y:是、N:否] - */ - private String isCommunityWorkers; - - /** - * 是否社会工作者[Y:是、N:否] - */ - private String isSocialWorker; - - /** - * 是否村(居)民小组长[Y:是、N:否 - */ - private String isVillageLeader; - - /** - * 是否警务助理[Y:是、N:否] - */ - private String isPoliceAssistant; - - /** - * 是否人民调解员[Y:是、N:否] - */ - private String isMediator; - - /** - * 删除标识 0.未删除 1.已删除 - */ - private Integer delFlag; - - /** - * 乐观锁 - */ - private Integer revision; - - /** - * 创建人 - */ - private String createdBy; - - /** - * 创建时间 - */ - private Date createdTime; - - /** - * 更新人 - */ - private String updatedBy; - - /** - * 更新时间 - */ - private Date updatedTime; } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/external/ScreenProjectDataCollController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/external/ScreenProjectDataCollController.java index 7d4c7e9c71..85dad1166f 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/external/ScreenProjectDataCollController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/external/ScreenProjectDataCollController.java @@ -1,7 +1,9 @@ package com.epmet.controller.external; +import com.epmet.commons.rocketmq.messages.DisputeProcessMQMsg; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.constant.SystemMessageType; import com.epmet.dto.screen.*; import com.epmet.dto.screen.form.CategoryDictFormDTO; import com.epmet.dto.screen.form.ScreenProjectDataInfoFormDTO; @@ -13,6 +15,9 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import java.util.ArrayList; +import java.util.List; + /** * @Description 事件/项目采集接口入口 * @ClassName ScreenProjectDataCollController @@ -135,6 +140,15 @@ public class ScreenProjectDataCollController { param.setCustomerId(customerId); ValidatorUtils.validateEntity(param, ScreenCollFormDTO.CustomerIdShowGroup.class, ScreenCollFormDTO.DateIdShowGroup.class, ScreenCollFormDTO.DataListShowGroup.class); projectDataService.collect(param); + + //发送MQ消息,上报事件 + param.getDataList().forEach(item -> { + List projectList = new ArrayList<>(); + projectList.add(item.getProjectId()); + DisputeProcessMQMsg msg = new DisputeProcessMQMsg(param.getCustomerId(), projectList, SystemMessageType.PROJECT_ADD); + projectDataService.sendProjectChangeMq(msg); + }); + return new Result(); } 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 26aa8892d9..701348e39a 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 @@ -68,7 +68,7 @@ public interface ScreenProjectDataDao extends BaseDao { int updateProjectSatisfactionScore(@Param("projectId")String projectId, @Param("score")BigDecimal score); - List selectProjectList(@Param("customerId") String customerId, @Param("projectId") String projectId); + List selectProjectList(@Param("customerId") String customerId, @Param("projectIds") List projectIds); /** * @Description 查询网格下的项目分类 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 72e12ff5dc..94a298d514 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 @@ -27,6 +27,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.annotation.PreDestroy; +import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.concurrent.ExecutionException; @@ -154,14 +155,20 @@ public class ProjectChangedCustomListener implements MessageListenerConcurrently 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; + if ("6f203e30de1a65aab7e69c058826cd80".equals(customerId)) { + if ("issue_shift_project".equals(msgObj.getOperation()) || "created".equals(msgObj.getOperation()) || "close".equals(msgObj.getOperation())) { + String type; + if ("issue_shift_project".equals(msgObj.getOperation()) || "created".equals(msgObj.getOperation())) { + type = SystemMessageType.PROJECT_ADD; + } else { + type = SystemMessageType.PROJECT_EDIT; + } + List projectList = new ArrayList<>(); + projectList.add(msgObj.getProjectId()); + DisputeProcessMQMsg msg = new DisputeProcessMQMsg(customerId, projectList, type); + SpringContextUtils.getBean(ScreenProjectDataService.class).sendProjectChangeMq(msg); + } } - 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/screen/ScreenProjectDataService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectDataService.java index 845a2fc844..cf5279027a 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 @@ -137,7 +137,7 @@ public interface ScreenProjectDataService extends BaseService getProjectList(String customerId, String projectId, Integer pageNo, Integer pageSize); + List getProjectList(String customerId, List projectId, Integer pageNo, Integer pageSize); /** * 项目变更MQ 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 e2597eae16..98bd3ff9cf 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 @@ -48,12 +48,12 @@ import com.epmet.service.evaluationindex.screen.ScreenProjectDataService; import com.epmet.service.stats.CustomerProjectCategoryDictService; import com.github.pagehelper.PageHelper; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.ListUtils; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import org.springframework.util.CollectionUtils; import javax.annotation.Resource; import java.math.BigDecimal; @@ -298,7 +298,7 @@ public class ScreenProjectDataServiceImpl extends BaseServiceImpl getProjectList(String customerId, String projectId, Integer pageNo, Integer pageSize) { + public List getProjectList(String customerId, List projectId, Integer pageNo, Integer pageSize) { PageHelper.startPage(pageNo, pageSize); return baseDao.selectProjectList(customerId, projectId); } 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 5c386342e9..e3057c2a8e 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 @@ -1,7 +1,9 @@ package com.epmet.service.impl; +import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.utils.DateUtils; +import com.epmet.commons.tools.utils.Result; import com.epmet.constant.OrgTypeConstant; import com.epmet.constant.ProjectConstant; import com.epmet.dto.basereport.form.EventInfoFormDTO; @@ -19,6 +21,7 @@ import com.epmet.dto.user.result.MidPatrolDetailResult; import com.epmet.dto.user.result.MidPatrolRecordResult; import com.epmet.entity.evaluationindex.screen.ScreenCustomerAgencyEntity; import com.epmet.entity.stats.CustomerProjectCategoryDictEntity; +import com.epmet.feign.OperCrmOpenFeignClient; import com.epmet.service.DataReportingService; import com.epmet.service.evaluationindex.screen.ScreenCustomerAgencyService; import com.epmet.service.evaluationindex.screen.ScreenCustomerGridService; @@ -38,6 +41,9 @@ import javax.annotation.Resource; import java.util.*; import java.util.stream.Collectors; +import static java.util.stream.Collectors.collectingAndThen; +import static java.util.stream.Collectors.toCollection; + /** * @dscription 省网格化平台数据上报--数据查询 * @author sun @@ -61,6 +67,8 @@ public class DataReportingServiceImpl implements DataReportingService { private StatsStaffPatrolService statsStaffPatrolService; @Resource private CustomerProjectCategoryDictService customerProjectCategoryDictService; + @Resource + private OperCrmOpenFeignClient operCrmOpenFeignClient; /** * @Author sun @@ -110,25 +118,6 @@ 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.setNation("01"); - st.setPaerty("13"); - st.setBirthday(new Date()); - st.setEducation("20"); - st.setEntryDate(new Date()); - st.setIsLeave("N"); - //st.setLeaveDate(); - st.setIncome("05"); - st.setIsCommittee("Y"); - st.setIsCommunityWorkers("Y"); - st.setIsSocialWorker("Y"); - st.setIsVillageLeader("Y"); - st.setIsPoliceAssistant("N"); - st.setIsMediator("Y"); - st.setDelFlag(dto.getDelFlag()); - st.setCreatedBy(dto.getCreatedBy()); - st.setCreatedTime(dto.getCreatedTime()); - st.setUpdatedBy(dto.getUpdatedBy()); - st.setUpdatedTime(dto.getUpdatedTime()); } }); @@ -153,18 +142,31 @@ public class DataReportingServiceImpl implements DataReportingService { if(CollectionUtils.isEmpty(projectList)) { return Collections.emptyList(); } + Map epmetCodeMap = new HashMap<>(); + Result parentCustomer = operCrmOpenFeignClient.getExternalAndParentCustomerId(formDTO.getCustomerId()); + if (StringUtils.isNotBlank(parentCustomer.getData())) { + epmetCodeMap = customerProjectCategoryDictService.getByCategoryCodeMap(parentCustomer.getData()); + } + Map codeMap = customerProjectCategoryDictService.getByCategoryCodeMap(formDTO.getCustomerId());; //项目ID不为空时,因为只有一条,可以直接处理 - if (StringUtils.isNotEmpty(formDTO.getProjectId())) { + Map finalEpmetCodeMap = epmetCodeMap; + if (CollectionUtils.isNotEmpty(formDTO.getProjectId())) { list = projectList.stream().map(project -> { - EventInfoResultDTO dto = getEventInfoResultDTO(project); + EventInfoResultDTO dto = getEventInfoResultDTO(project, finalEpmetCodeMap, codeMap); if (OrgTypeConstant.AGENCY.equals(project.getOrgType())) { ScreenCustomerAgencyEntity agency = screenCustomerAgencyService.getAgencyById(project.getOrgId()); - dto.setOrgCode(agency.getCode()); - dto.setOrgName(agency.getAgencyName()); + dto.setOrgId(project.getOrgId()); + if (null != agency) { + dto.setOrgCode(agency.getCode()); + dto.setOrgName(agency.getAgencyName()); + } } else { ScreenCustomerGridDTO grid = screenCustomerGridService.getGridById(project.getOrgId()); - dto.setOrgCode(grid.getCode()); - dto.setOrgName(grid.getGridName()); + dto.setOrgId(project.getOrgId()); + if (null != grid) { + dto.setOrgCode(grid.getCode()); + dto.setOrgName(grid.getGridName()); + } } return dto; }).collect(Collectors.toList()); @@ -173,41 +175,65 @@ public class DataReportingServiceImpl implements DataReportingService { Map agencyMap = screenCustomerAgencyService.getAgencyList(formDTO.getCustomerId()); Map gridMap = screenCustomerGridService.getGridList(formDTO.getCustomerId()); list = projectList.stream().map(project -> { - EventInfoResultDTO dto = getEventInfoResultDTO(project); + EventInfoResultDTO dto = getEventInfoResultDTO(project, finalEpmetCodeMap, codeMap); if (OrgTypeConstant.AGENCY.equals(project.getOrgType())) { ScreenCustomerAgencyEntity agency = agencyMap.get(project.getOrgId()); - dto.setOrgCode(agency.getCode()); - dto.setOrgName(agency.getAgencyName()); + dto.setOrgId(project.getOrgId()); + if (null != agency) { + dto.setOrgCode(agency.getCode()); + dto.setOrgName(agency.getAgencyName()); + } } else { ScreenCustomerGridDTO grid = gridMap.get(project.getOrgId()); - dto.setOrgCode(grid.getCode()); - dto.setOrgName(grid.getGridName()); + dto.setOrgId(project.getOrgId()); + if (null != grid) { + dto.setOrgCode(grid.getCode()); + dto.setOrgName(grid.getGridName()); + } } return dto; }).collect(Collectors.toList()); } - return list.stream().filter(item -> StringUtils.isNotBlank(item.getEventCategory())).collect(Collectors.toList()); + return list.stream().collect(collectingAndThen(toCollection(() -> new TreeSet<>(Comparator.comparing(EventInfoResultDTO::getId))), ArrayList::new)); } - private EventInfoResultDTO getEventInfoResultDTO(ScreenProjectDataDTO project) { + private EventInfoResultDTO getEventInfoResultDTO(ScreenProjectDataDTO project, Map epmetCodeMap, Map codeMap) { EventInfoResultDTO dto = new EventInfoResultDTO(); dto.setId(project.getProjectId()); dto.setCustomerId(project.getCustomerId()); dto.setEventName(project.getProjectTitle()); dto.setReporterId(project.getProjectCreator()); String categoryCode = project.getCategoryCode().split(StrConstant.COMMA)[0]; + String parentCode = null == codeMap.get(categoryCode)?null:codeMap.get(categoryCode).getParentCategoryCode(); //如果是孔村、榆山、锦水的项目需要关联分类字典表 if("2fe0065f70ca0e23ce4c26fca5f1d933".equals(project.getCustomerId()) || "44876154d10d7cb7affd92000f84f833".equals(project.getCustomerId()) || "46c55cb862d6d5e6d05d2ab61a1cc07e".equals(project.getCustomerId())) { - CustomerProjectCategoryDictEntity categoryEntity = customerProjectCategoryDictService.getByCategoryCode(project.getCustomerId(), categoryCode); + CustomerProjectCategoryDictEntity categoryEntity = codeMap.get(categoryCode); if (null != categoryEntity) { - categoryCode = categoryEntity.getEpmetCategoryCode(); + String code = categoryEntity.getEpmetCategoryCode(); + if (StringUtils.isBlank(code)) { + //没有对应平阴的分类code,那么一级分类和二级分类都为空 + categoryCode = null; + parentCode = null; + } else { + //如果是对应一级分类,则二级分类为空。如果对应平阴二级分类,则取对应的一级分类 + CustomerProjectCategoryDictEntity epmetCode = epmetCodeMap.get(code); + if (NumConstant.ONE == epmetCode.getLevel()) { + categoryCode = null; + parentCode = code; + } else { + categoryCode = code; + parentCode = epmetCode.getParentCategoryCode(); + } + } } else { categoryCode = null; + parentCode = null; } } dto.setEventCategory(categoryCode); + dto.setParentEventCategory(parentCode); dto.setReportTime(project.getProjectCreateTime()); dto.setHappenDate(DateUtils.parseDate(DateUtils.format(project.getProjectCreateTime()), DateUtils.DATE_PATTERN)); dto.setHappenPlace(project.getProjectAddress()); @@ -219,16 +245,18 @@ public class DataReportingServiceImpl implements DataReportingService { 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; + if (StringUtils.isNotBlank(project.getFinishOrgLevel())) { + switch (project.getFinishOrgLevel()) { + case OrgTypeConstant.DISTRICT: + dto.setCompleteLevel("3"); + break; + case OrgTypeConstant.STREET: + case OrgTypeConstant.COMMUNITY: + dto.setCompleteLevel("4"); + break; + default: + break; + } } } else { dto.setCompleteLevel(getCompleteLevel(project.getFinishOrgLevel())); @@ -238,13 +266,15 @@ public class DataReportingServiceImpl implements DataReportingService { String[] orgIds = project.getOrgIdPath().split(StrConstant.COLON); int size = orgIds.length; ScreenCustomerAgencyEntity agency = screenCustomerAgencyService.getAgencyById(orgIds[size - 1]); - dto.setCompleteLevel(getCompleteLevel(agency.getLevel())); + if (null != agency) { + dto.setCompleteLevel(getCompleteLevel(agency.getLevel())); + } } else { //办结组织是网格时,办结层级为网格 - dto.setCompleteLevel("07"); + dto.setCompleteLevel("5"); } } - + dto.setStatus(getProjectStatus(project.getProjectStatusCode())); dto.setCompleteTime(project.getCloseCaseTime()); dto.setLat(project.getLatitude()); dto.setLng(project.getLongitude()); @@ -254,15 +284,28 @@ public class DataReportingServiceImpl implements DataReportingService { private String getCompleteLevel(String level) { switch (level) { case OrgTypeConstant.PROVINCE: - return "01"; + return "0"; case OrgTypeConstant.CITY: - return "02"; + return "1"; case OrgTypeConstant.DISTRICT: - return "03"; + return "2"; case OrgTypeConstant.STREET: - return "04"; + return "3"; case OrgTypeConstant.COMMUNITY: - return "06"; + return "4"; + default: + return null; + } + } + + private String getProjectStatus(String status) { + switch (status) { + case ProjectConstant.PENDING: + return "01"; + case ProjectConstant.CLOSED: + return "02"; + case ProjectConstant.CLOSED_CASE: + return "03"; default: return null; } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/CustomerProjectCategoryDictService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/CustomerProjectCategoryDictService.java index cc8633b08f..02a859423a 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/CustomerProjectCategoryDictService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/CustomerProjectCategoryDictService.java @@ -24,6 +24,7 @@ import com.epmet.entity.issue.IssueProjectCategoryDictEntity; import com.epmet.entity.stats.CustomerProjectCategoryDictEntity; import java.util.List; +import java.util.Map; /** * 客户项目分类字典表 @@ -65,4 +66,6 @@ public interface CustomerProjectCategoryDictService extends BaseService getByCategoryCodeMap(String customerId); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/CustomerProjectCategoryDictServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/CustomerProjectCategoryDictServiceImpl.java index d7c81c93ad..592e2a33b6 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/CustomerProjectCategoryDictServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/CustomerProjectCategoryDictServiceImpl.java @@ -34,7 +34,11 @@ import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.util.Collections; import java.util.List; +import java.util.Map; +import java.util.function.Function; +import java.util.stream.Collectors; /** * 客户项目分类字典表 @@ -135,4 +139,15 @@ public class CustomerProjectCategoryDictServiceImpl extends BaseServiceImpl getByCategoryCodeMap(String customerId) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(CustomerProjectCategoryDictEntity::getCustomerId, customerId); + List list = baseDao.selectList(wrapper); + if (CollectionUtils.isEmpty(list)) { + return Collections.emptyMap(); + } + return list.stream().collect(Collectors.toMap(CustomerProjectCategoryDictEntity::getCategoryCode, Function.identity())); + } } 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 a15debd1c6..86980fbab1 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 @@ -218,6 +218,7 @@ a.CLOSE_CASE_TIME, a.DATA_END_TIME, a.ALL_PARENT_IDS, + a.PROJECT_CREATOR, a.ORIGIN, a.CATEGORY_CODE, b.HANDLER_ID AS finishOrg, @@ -253,8 +254,10 @@ AND b.CUSTOMER_ID = #{customerId} - - AND b.PROJECT_ID = #{projectId} + + + b.PROJECT_ID = #{projectId} + LEFT JOIN screen_customer_agency c ON b.HANDLER_ID = c.AGENCY_ID WHERE a.DEL_FLAG = '0' @@ -263,8 +266,10 @@ AND a.CUSTOMER_ID = #{customerId} - - AND a.PROJECT_ID = #{projectId} + + + a.PROJECT_ID = #{projectId} + ORDER BY a.CREATED_TIME ASC diff --git a/epmet-module/data-statistical/data-statistical-server/src/test/java/resources/评价指标体系算法需求-备注3.0版新权重.xlsx b/epmet-module/data-statistical/data-statistical-server/src/test/java/resources/评价指标体系算法需求-备注3.0版新权重.xlsx index cb442ccfe9..1b8299fbab 100644 Binary files a/epmet-module/data-statistical/data-statistical-server/src/test/java/resources/评价指标体系算法需求-备注3.0版新权重.xlsx and b/epmet-module/data-statistical/data-statistical-server/src/test/java/resources/评价指标体系算法需求-备注3.0版新权重.xlsx differ 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 112d6b8e35..9e69963062 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/AgencyController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/AgencyController.java @@ -17,6 +17,7 @@ package com.epmet.controller; +import com.epmet.commons.rocketmq.messages.OrgOrStaffMQMsg; import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.annotation.RequirePermission; import com.epmet.commons.tools.enums.RequirePermissionEnum; @@ -32,6 +33,8 @@ import com.epmet.dto.result.AgencyListResultDTO; import com.epmet.dto.result.AgencysResultDTO; import com.epmet.dto.result.SubAgencyResultDTO; import com.epmet.entity.CustomerAgencyEntity; +import com.epmet.feign.EpmetMessageOpenFeignClient; +import com.epmet.send.SendMqMsgUtil; import com.epmet.service.AgencyService; import com.epmet.service.CustomerAgencyService; import org.apache.commons.lang3.StringUtils; @@ -57,6 +60,8 @@ public class AgencyController { private AgencyService agencyService; @Autowired private CustomerAgencyService customerAgencyService; + @Autowired + private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient; /** * @param formDTO @@ -100,7 +105,18 @@ public class AgencyController { } //当前客户下,同级组织中,组织名称不允许重复 customerAgencyService.checkAgencyName(formDTO.getAgencyName(),tokenDTO.getCustomerId(),null,formDTO.getParentAgencyId()); - return new Result().ok(agencyService.addAgencyV2(formDTO)); + AddAgencyResultDTO resultDTO = agencyService.addAgencyV2(formDTO); + + //2021-11-30 推送mq,数据同步到中介库 start + OrgOrStaffMQMsg mq = new OrgOrStaffMQMsg(); + mq.setCustomerId(tokenDTO.getCustomerId()); + mq.setOrgId(resultDTO.getAgencyId()); + mq.setOrgType("agency"); + mq.setType("agency_create"); + SendMqMsgUtil.build().openFeignClient(epmetMessageOpenFeignClient).sendOrgStaffMqMsg(mq); + //2021-11-30 end + + return new Result().ok(resultDTO); } /** @@ -114,6 +130,16 @@ public class AgencyController { String agencyId = agencyService.addRootAgency(form); HashMap resultMap = new HashMap<>(); resultMap.put("agencyId", agencyId); + + //2021-10-18 推送mq,数据同步到中介库 start + OrgOrStaffMQMsg mq = new OrgOrStaffMQMsg(); + mq.setCustomerId(form.getCustomerId()); + mq.setOrgId(agencyId); + mq.setOrgType("agency"); + mq.setType("agency_create"); + SendMqMsgUtil.build().openFeignClient(epmetMessageOpenFeignClient).sendOrgStaffMqMsg(mq); + //2021-10-18 end + return new Result>().ok(resultMap); } @@ -128,7 +154,18 @@ public class AgencyController { public Result editAgency(@LoginUser TokenDto tokenDTO, @RequestBody EditAgencyFormDTO formDTO) { formDTO.setUserId(tokenDTO.getUserId()); ValidatorUtils.validateEntity(formDTO, EditAgencyFormDTO.DefaultUserShowGroup.class, EditAgencyFormDTO.AddUserInternalGroup.class); - return agencyService.editAgency(formDTO); + Result result = agencyService.editAgency(formDTO); + + //2021-10-18 推送mq,数据同步到中介库 start【中介库只放了组织的名称、级别,所以涉及批量修改pname的操作不涉及同步中间库】 + OrgOrStaffMQMsg mq = new OrgOrStaffMQMsg(); + mq.setCustomerId(tokenDTO.getCustomerId()); + mq.setOrgId(formDTO.getAgencyId()); + mq.setOrgType("agency"); + mq.setType("agency_change"); + SendMqMsgUtil.build().openFeignClient(epmetMessageOpenFeignClient).sendOrgStaffMqMsg(mq); + //2021-10-18 end + + return result; } /** @@ -251,7 +288,17 @@ public class AgencyController { **/ @PostMapping("saverootagency") public Result saveRootAgency(@RequestBody AddAgencyAndStaffFormDTO agencyAndStaff) { - agencyService.saveRootAgency(agencyAndStaff); + String agencyId = agencyService.saveRootAgency(agencyAndStaff); + + //2021-10-18 推送mq,数据同步到中介库 start + OrgOrStaffMQMsg mq = new OrgOrStaffMQMsg(); + mq.setCustomerId(agencyAndStaff.getAgencyDTO().getCustomerId()); + mq.setOrgId(agencyId); + mq.setOrgType("agency"); + mq.setType("agency_create"); + SendMqMsgUtil.build().openFeignClient(epmetMessageOpenFeignClient).sendOrgStaffMqMsg(mq); + //2021-10-18 end + return new 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 f9cc5c1b54..982882ac66 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 @@ -1,5 +1,6 @@ package com.epmet.controller; +import com.epmet.commons.rocketmq.messages.OrgOrStaffMQMsg; import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.annotation.RequirePermission; import com.epmet.commons.tools.enums.RequirePermissionEnum; @@ -9,6 +10,8 @@ import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.CustomerGridDTO; import com.epmet.dto.form.*; import com.epmet.dto.result.*; +import com.epmet.feign.EpmetMessageOpenFeignClient; +import com.epmet.send.SendMqMsgUtil; import com.epmet.service.CustomerGridService; import com.epmet.service.CustomerStaffAgencyService; import org.springframework.beans.factory.annotation.Autowired; @@ -28,6 +31,8 @@ public class GridController { private CustomerGridService customerGridService; @Autowired private CustomerStaffAgencyService customerStaffAgencyService; + @Autowired + private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient; /** * 获取网格详情 @@ -47,8 +52,18 @@ public class GridController { @RequirePermission(requirePermission = RequirePermissionEnum.ORG_GRID_CREATE) public Result addGrid(@LoginUser TokenDto tokenDto, @RequestBody AddGridFormDTO addGridFormDTO){ ValidatorUtils.validateEntity(addGridFormDTO, AddGridFormDTO.AddGrid.class); - return customerGridService.addGrid(tokenDto,addGridFormDTO); - + Result resultDTOResult = customerGridService.addGrid(tokenDto,addGridFormDTO); + + //2021-10-18 推送mq,数据同步到中介库 start + OrgOrStaffMQMsg mq = new OrgOrStaffMQMsg(); + mq.setCustomerId(tokenDto.getCustomerId()); + mq.setOrgId(resultDTOResult.getData().getGridId()); + mq.setOrgType("grid"); + mq.setType("grid_create"); + SendMqMsgUtil.build().openFeignClient(epmetMessageOpenFeignClient).sendOrgStaffMqMsg(mq); + //2021-10-18 end + + return resultDTOResult; } /** @@ -59,8 +74,18 @@ public class GridController { public Result editGrid(@LoginUser TokenDto tokenDto, @RequestBody EditGridFormDTO editGridFormDTO){ ValidatorUtils.validateEntity(editGridFormDTO, EditGridFormDTO.EditGrid.class); editGridFormDTO.setCustomerId(tokenDto.getCustomerId()); - return customerGridService.editGrid(tokenDto,editGridFormDTO); - + Result result = customerGridService.editGrid(tokenDto,editGridFormDTO); + + //2021-10-18 推送mq,数据同步到中介库 start + OrgOrStaffMQMsg mq = new OrgOrStaffMQMsg(); + mq.setCustomerId(tokenDto.getCustomerId()); + mq.setOrgId(editGridFormDTO.getGridId()); + mq.setOrgType("grid"); + mq.setType("grid_change"); + SendMqMsgUtil.build().openFeignClient(epmetMessageOpenFeignClient).sendOrgStaffMqMsg(mq); + //2021-10-18 end + + return result; } /** diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/AgencyService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/AgencyService.java index 381fb7256a..6a73e676d9 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/AgencyService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/AgencyService.java @@ -107,7 +107,7 @@ public interface AgencyService { * @Description 单客户-添加根组织及客户管理员信息 * @Date 2020/7/16 17:13 **/ - void saveRootAgency(AddAgencyAndStaffFormDTO agencyAndStaff); + String saveRootAgency(AddAgencyAndStaffFormDTO agencyAndStaff); /** * 添加组织V2 diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java index aa070f2d90..c192390708 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java @@ -182,15 +182,6 @@ public class AgencyServiceImpl implements AgencyService { //5.redis缓存 customerAgencyRedis.delete(formDTO.getAgencyId()); - //2021-10-18 推送mq,数据同步到中介库 start【中介库只放了组织的名称、级别,所以涉及批量修改pname的操作不涉及同步中间库】 - OrgOrStaffMQMsg mq = new OrgOrStaffMQMsg(); - mq.setCustomerId(originalEntity.getCustomerId()); - mq.setOrgId(formDTO.getAgencyId()); - mq.setOrgType("agency"); - mq.setType("agency_change"); - SendMqMsgUtil.build().openFeignClient(epmetMessageOpenFeignClient).sendOrgStaffMqMsg(mq); - //2021-10-18 end - return result; } @@ -231,15 +222,6 @@ public class AgencyServiceImpl implements AgencyService { throw new RenException(CustomerAgencyConstant.DEL_EXCEPTION); } - //2021-10-18 推送mq,数据同步到中介库 start - OrgOrStaffMQMsg mq = new OrgOrStaffMQMsg(); - mq.setCustomerId(formDTO.getCustomerId()); - mq.setOrgId(formDTO.getAgencyId()); - mq.setOrgType("agency"); - mq.setType("agency_change"); - SendMqMsgUtil.build().openFeignClient(epmetMessageOpenFeignClient).sendOrgStaffMqMsg(mq); - //2021-10-18 end - return result; } @@ -396,15 +378,6 @@ public class AgencyServiceImpl implements AgencyService { entity.setCustomerId(form.getCustomerId()); customerAgencyDao.insert(entity); - //2021-10-18 推送mq,数据同步到中介库 start - OrgOrStaffMQMsg mq = new OrgOrStaffMQMsg(); - mq.setCustomerId(form.getCustomerId()); - mq.setOrgId(entity.getId()); - mq.setOrgType("agency"); - mq.setType("agency_create"); - SendMqMsgUtil.build().openFeignClient(epmetMessageOpenFeignClient).sendOrgStaffMqMsg(mq); - //2021-10-18 end - return entity.getId(); } @@ -417,7 +390,8 @@ public class AgencyServiceImpl implements AgencyService { **/ @Override @Transactional(rollbackFor = Exception.class) - public void saveRootAgency(AddAgencyAndStaffFormDTO agencyAndStaff) { + public String saveRootAgency(AddAgencyAndStaffFormDTO agencyAndStaff) { + String agencyId = ""; CustomerAgencyDTO agencyDTO = agencyAndStaff.getAgencyDTO(); AdminStaffFromDTO staffDTO = agencyAndStaff.getStaffDTO(); @@ -465,15 +439,8 @@ public class AgencyServiceImpl implements AgencyService { throw new RenException(EpmetErrorCode.OPER_ADD_CUSTOMER_MANAGER_ERROR.getCode(), staffResult.getMsg()); } - //2021-10-18 推送mq,数据同步到中介库 start - OrgOrStaffMQMsg mq = new OrgOrStaffMQMsg(); - mq.setCustomerId(agencyDTO.getCustomerId()); - mq.setOrgId(entity.getId()); - mq.setOrgType("agency"); - mq.setType("agency_create"); - SendMqMsgUtil.build().openFeignClient(epmetMessageOpenFeignClient).sendOrgStaffMqMsg(mq); - //2021-10-18 end - + agencyId = entity.getId(); + return agencyId; } /** @@ -519,14 +486,6 @@ public class AgencyServiceImpl implements AgencyService { resultDTO.setAgencyId(insertEntity.getId()); resultDTO.setAreaCode(insertEntity.getAreaCode()); - //2021-10-18 推送mq,数据同步到中介库 start - OrgOrStaffMQMsg mq = new OrgOrStaffMQMsg(); - mq.setCustomerId(parent.getCustomerId()); - mq.setOrgId(insertEntity.getId()); - mq.setOrgType("agency"); - mq.setType("agency_create"); - SendMqMsgUtil.build().openFeignClient(epmetMessageOpenFeignClient).sendOrgStaffMqMsg(mq); - //2021-10-18 end return resultDTO; } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java index d5497b8a08..ab3641d1ef 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java @@ -275,15 +275,6 @@ public class CustomerGridServiceImpl extends BaseServiceImpl().ok(resultDTO); } @@ -306,15 +297,6 @@ public class CustomerGridServiceImpl extends BaseServiceImpl - * 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 java.io.Serializable; -import java.util.Date; -import lombok.Data; - - -/** - * 网格基础信息表 - * - * @author generator generator@elink-cn.com - * @since v1.0.0 2021-10-15 - */ -@Data -public class BaseGridInfoDTO implements Serializable { - - private static final long serialVersionUID = 1L; - - /** - * 主键 - */ - private String id; - - /** - * 客户Id - */ - private String customerId; - - /** - * 组织/网格Id - */ - private String orgId; - - /** - * 网格编码 - */ - private String code; - - /** - * 网格名称 - */ - private String gridName; - - /** - * 网格层级[07:网格] - */ - private String gridLevel; - - /** - * 专属网格类型[01:党政机关; 02:医院; 03:学校; 04:企业; 05:园区; 06:商圈; 07:市场; 08:景区; - */ - private String gridType; - - /** - * 网格内人口规模[01:500人以下(含500人); 02:500-1000人(含1000人); 03:1000-1500人(含1500人); 04:1500人以上] - */ - private String populationSize; - - /** - * 是否成立网格党支部或网格党小组[Y:是、N:否] - */ - private String isPartyBranch; - - /** - * 网格党组织类型[01:网格党支部; 02:网格党小组] - */ - private String partyBranchType; - - /** - * 中心点(质心)经度 - */ - private String lng; - - /** - * 中心点(质心)纬度 - */ - private String lat; - - /** - * 网格颜色 - */ - private String gridColor; - - /** - * 空间范围 - */ - private String shape; - - /** - * 删除标识 0.未删除 1.已删除 - */ - private Long delFlag; - - /** - * 乐观锁 - */ - private Integer revision; - - /** - * 创建人 - */ - private String createdBy; - - /** - * 创建时间 - */ - private Date createdTime; - - /** - * 更新人 - */ - private String updatedBy; - - /** - * 更新时间 - */ - private Date updatedTime; - -} \ 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/BaseGridUserDTO.java b/epmet-module/open-data-worker/open-data-worker-client/src/main/java/com/epmet/opendata/dto/BaseGridUserDTO.java deleted file mode 100644 index fb5218cdf8..0000000000 --- a/epmet-module/open-data-worker/open-data-worker-client/src/main/java/com/epmet/opendata/dto/BaseGridUserDTO.java +++ /dev/null @@ -1,191 +0,0 @@ -/** - * 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 java.io.Serializable; -import java.util.Date; -import lombok.Data; - - -/** - * 网格员基础信息表 - * - * @author generator generator@elink-cn.com - * @since v1.0.0 2021-10-15 - */ -@Data -public class BaseGridUserDTO implements Serializable { - - private static final long serialVersionUID = 1L; - - /** - * 主键 - */ - private String id; - - /** - * 客户Id - */ - private String customerId; - - /** - * 网格Id - */ - private String gridId; - - /** - * 人员Id - */ - private String staffId; - - /** - * 网格编码 - */ - private String code; - - /** - * 网格名称 - */ - private String gridName; - - /** - * 网格员姓名 - */ - private String nickName; - - /** - * 专属网格类型[01:党政机关; 02:医院; 03:学校; 04:企业; 05:园区; 06:商圈; 07:市场; 08:景区; - */ - private String cardNum; - - /** - * 网格员类型[01:专职网格员; 02:兼职网格员; 03:网格长; 04:综治机构人员; 05:职能部门人员] - */ - private String userType; - - /** - * 手机号码 - */ - private String phonenumber; - - /** - * 性别[1:男性; 2:女性; 9:未说明的性别] - */ - private String sex; - - /** - * 民族[字典表主键] - */ - private String nation; - - /** - * 政治面貌[字典表主键] - */ - private String paerty; - - /** - * 出生日期[YYYY-MM-DD] - */ - private Date birthday; - - /** - * 学历[字典表主键] - */ - private String education; - - /** - * 入职时间 - */ - private Date entryDate; - - /** - * 是否离职 - */ - private String isLeave; - - /** - * 离职时间 - */ - private Date leaveDate; - - /** - * 网格员年收入 - */ - private String income; - - /** - * 是否社区(村)两委委员[Y:是、N:否] - */ - private String isCommittee; - - /** - * 是否社区工作者[Y:是、N:否] - */ - private String isCommunityWorkers; - - /** - * 是否社会工作者[Y:是、N:否] - */ - private String isSocialWorker; - - /** - * 是否村(居)民小组长[Y:是、N:否 - */ - private String isVillageLeader; - - /** - * 是否警务助理[Y:是、N:否] - */ - private String isPoliceAssistant; - - /** - * 是否人民调解员[Y:是、N:否] - */ - private String isMediator; - - /** - * 删除标识 0.未删除 1.已删除 - */ - private Long delFlag; - - /** - * 乐观锁 - */ - private Integer revision; - - /** - * 创建人 - */ - private String createdBy; - - /** - * 创建时间 - */ - private Date createdTime; - - /** - * 更新人 - */ - private String updatedBy; - - /** - * 更新时间 - */ - private Date updatedTime; - -} \ 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/ExDeptDTO.java b/epmet-module/open-data-worker/open-data-worker-client/src/main/java/com/epmet/opendata/dto/ExDeptDTO.java index cd092d52ba..1a24eef647 100644 --- 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 @@ -36,46 +36,61 @@ public class ExDeptDTO implements Serializable { /** * (市平台)部门id */ - private Integer deptId; + private Integer deptId; /** * (市平台)父部门id */ - private Integer parentId; + private Integer parentId; /** * 祖级列表 */ - private String ancestors; + private String ancestors; /** * (市平台)部门/网格名称 */ - private String fullName; + private String fullName; /** * (市平台)部门/网格简称 */ - private String deptName; + private String deptName; /** * (市平台)部门/网格编码 */ - private String deptCode; + private String deptCode; /** - * + * (省标准)区划编码/网格编码 */ - private String gridCode; + private String gridCode; + + /** + * 组织类型 + */ + private String isCgorg; /** * (区县平台)部门id */ - private String deptIdQx; + private String qxDeptId; + + /** + * (区县平台)部门/网格名称 + */ + private String qxDeptCode; /** * (区县平台)部门/网格名称 */ - private String deptNameQx; + private String qxDeptName; + + /** + * (区县平台)客户Id + */ + private String qxCustomerId; } \ 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/ExUserDTO.java b/epmet-module/open-data-worker/open-data-worker-client/src/main/java/com/epmet/opendata/dto/ExUserDTO.java index d0f61777ca..d91adcd51e 100644 --- a/epmet-module/open-data-worker/open-data-worker-client/src/main/java/com/epmet/opendata/dto/ExUserDTO.java +++ b/epmet-module/open-data-worker/open-data-worker-client/src/main/java/com/epmet/opendata/dto/ExUserDTO.java @@ -36,41 +36,46 @@ public class ExUserDTO implements Serializable { /** * 市平台 用户ID */ - private String userId; + private Integer userId; /** * 市平台 用户名 */ - private String userName; + private String userName; /** - * 市平台 用户身份证号 + * 市平台 登录账号 */ - private String idCard; + private String loginName; /** - * 市平台 用户手机号 + * (市平台)所属区县、街道、村居或网格id */ - private String mobile; + private String gridId; /** - * 区县平台 用户ID + * (市平台)所属部门id */ - private String userIdQx; + private String deptId; /** - * 区县平台 用户名 + * (区县平台)用户id */ - private String userNameQx; + private String qxUserId; /** - * 区县平台 用户账号 + * (区县平台)姓名/用户名称 */ - private String userAccount; + private String qxUserName; /** - * 删除标识 + * (区县平台)手机号码 */ - private String delFlag; + private String qxMobile; + + /** + * (区县平台)客户Id + */ + private String qxCustomerId; } \ 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/ExDeptFormDTO.java similarity index 84% rename from epmet-module/open-data-worker/open-data-worker-client/src/main/java/com/epmet/opendata/dto/form/GridBaseInfoFormDTO.java rename to epmet-module/open-data-worker/open-data-worker-client/src/main/java/com/epmet/opendata/dto/form/ExDeptFormDTO.java index 0b1910a2ea..b605727fec 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/ExDeptFormDTO.java @@ -12,13 +12,13 @@ import java.util.List; * @author sun */ @Data -public class GridBaseInfoFormDTO implements Serializable { +public class ExDeptFormDTO implements Serializable { private static final long serialVersionUID = -3634745091993094743L; /** * 客户Id */ - @NotBlank(message = "事件标识不能为空", groups = {Grid.class}) + @NotBlank(message = "客户Id不能为空", groups = {Grid.class}) private String customerId = ""; /** * 网格Id diff --git a/epmet-module/open-data-worker/open-data-worker-client/src/main/java/com/epmet/opendata/dto/form/StaffBaseInfoFormDTO.java b/epmet-module/open-data-worker/open-data-worker-client/src/main/java/com/epmet/opendata/dto/form/StaffBaseInfoFormDTO.java index d486c7f67a..417ee92ad6 100644 --- a/epmet-module/open-data-worker/open-data-worker-client/src/main/java/com/epmet/opendata/dto/form/StaffBaseInfoFormDTO.java +++ b/epmet-module/open-data-worker/open-data-worker-client/src/main/java/com/epmet/opendata/dto/form/StaffBaseInfoFormDTO.java @@ -18,7 +18,7 @@ public class StaffBaseInfoFormDTO implements Serializable { /** * 客户Id */ - @NotBlank(message = "事件标识不能为空", groups = {Staff.class}) + @NotBlank(message = "客户Id不能为空", groups = {Staff.class}) private String customerId = ""; /** * 人员Id diff --git a/epmet-module/open-data-worker/open-data-worker-server/deploy/docker-compose-prod.yml b/epmet-module/open-data-worker/open-data-worker-server/deploy/docker-compose-prod.yml index feedbad307..74d27bd4c8 100644 --- a/epmet-module/open-data-worker/open-data-worker-server/deploy/docker-compose-prod.yml +++ b/epmet-module/open-data-worker/open-data-worker-server/deploy/docker-compose-prod.yml @@ -2,7 +2,7 @@ version: "3.7" services: gov-voice-server: container_name: open-data-worker-server-prod - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/open-data-worker-server:0.3.69 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/open-data-worker-server:0.3.1 ports: - "8107:8107" network_mode: host # 使用现有网络 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 6a40fad5b3..855babdf18 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 @@ -2,6 +2,7 @@ + 0.3.1 open-data-worker com.epmet diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/controller/BaseGridInfoController.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/controller/ExDeptController.java similarity index 75% rename from epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/controller/BaseGridInfoController.java rename to epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/controller/ExDeptController.java index 628c4802ca..46104d1c30 100644 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/controller/BaseGridInfoController.java +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/controller/ExDeptController.java @@ -19,8 +19,8 @@ package com.epmet.opendata.controller; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; -import com.epmet.opendata.dto.form.GridBaseInfoFormDTO; -import com.epmet.opendata.service.BaseGridInfoService; +import com.epmet.opendata.dto.form.ExDeptFormDTO; +import com.epmet.opendata.service.ExDeptService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -35,11 +35,11 @@ import org.springframework.web.bind.annotation.RestController; * @since v1.0.0 2021-10-15 */ @RestController -@RequestMapping("basegridinfo") -public class BaseGridInfoController { +@RequestMapping("exdept") +public class ExDeptController { @Autowired - private BaseGridInfoService baseGridInfoService; + private ExDeptService exDeptService; /** @@ -47,9 +47,9 @@ public class BaseGridInfoController { * @Description 组织基础信息中间库同步 **/ @PostMapping("agencybaseinfo") - public Result getAgencyBaseInfo(@RequestBody(required = false) GridBaseInfoFormDTO formDTO) { - ValidatorUtils.validateEntity(formDTO, GridBaseInfoFormDTO.Grid.class); - baseGridInfoService.getAgencyBaseInfo(formDTO); + public Result getAgencyBaseInfo(@RequestBody(required = false) ExDeptFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, ExDeptFormDTO.Grid.class); + exDeptService.getAgencyBaseInfo(formDTO); return new Result(); } @@ -58,9 +58,9 @@ public class BaseGridInfoController { * @Description 网格基础信息中间库同步 **/ @PostMapping("gridbaseinfo") - public Result getGridBaseInfo(@RequestBody(required = false) GridBaseInfoFormDTO formDTO) { - ValidatorUtils.validateEntity(formDTO, GridBaseInfoFormDTO.Grid.class); - baseGridInfoService.getGridBaseInfo(formDTO); + public Result getGridBaseInfo(@RequestBody(required = false) ExDeptFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, ExDeptFormDTO.Grid.class); + exDeptService.getGridBaseInfo(formDTO); return new Result(); } diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/controller/BaseGridUserController.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/controller/ExUserController.java similarity index 84% rename from epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/controller/BaseGridUserController.java rename to epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/controller/ExUserController.java index dcf3146724..08618448ab 100644 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/controller/BaseGridUserController.java +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/controller/ExUserController.java @@ -19,17 +19,14 @@ package com.epmet.opendata.controller; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; -import com.epmet.dto.user.result.GridUserInfoDTO; import com.epmet.opendata.dto.form.StaffBaseInfoFormDTO; -import com.epmet.opendata.service.BaseGridUserService; +import com.epmet.opendata.service.ExUserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; -import java.util.List; - /** * 网格员基础信息表 @@ -38,11 +35,11 @@ import java.util.List; * @since v1.0.0 2021-10-15 */ @RestController -@RequestMapping("basegriduser") -public class BaseGridUserController { - +@RequestMapping("exuser") +public class ExUserController { + @Autowired - private BaseGridUserService baseGridUserService; + private ExUserService exUserService; /** * @Author sun @@ -51,7 +48,7 @@ public class BaseGridUserController { @PostMapping("staffbaseinfo") public Result getStaffBaseInfo(@RequestBody(required = false) StaffBaseInfoFormDTO formDTO) { ValidatorUtils.validateEntity(formDTO, StaffBaseInfoFormDTO.Staff.class); - baseGridUserService.getStaffBaseInfo(formDTO); + exUserService.getStaffBaseInfo(formDTO); return new Result(); } diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/BaseGridInfoDao.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/BaseGridInfoDao.java deleted file mode 100644 index 40c5649d1b..0000000000 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/BaseGridInfoDao.java +++ /dev/null @@ -1,41 +0,0 @@ -/** - * 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 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 BaseGridInfoDao extends BaseDao { - - /** - * @Author sun - * @Description 网格基础信息批量更新部分字段 - **/ - void updateBatch(@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/dao/BaseGridUserDao.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/BaseGridUserDao.java deleted file mode 100644 index c53eb48e1f..0000000000 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/BaseGridUserDao.java +++ /dev/null @@ -1,41 +0,0 @@ -/** - * 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.BaseGridUserEntity; -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 BaseGridUserDao extends BaseDao { - - /** - * @Author sun - * @Description 网格员基础信息批量更新部分字段 - **/ - void updateBatch(@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/dao/ExDeptDao.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/ExDeptDao.java index fa088c958f..50bf35b537 100644 --- 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 @@ -18,7 +18,6 @@ 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; diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/ExUserDao.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/ExUserDao.java index 4a3c4ecc13..ad1c407eaf 100644 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/ExUserDao.java +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/ExUserDao.java @@ -20,6 +20,9 @@ package com.epmet.opendata.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.opendata.entity.ExUserEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * 系统用户中间表 @@ -29,5 +32,11 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface ExUserDao extends BaseDao { - + + /** + * @Author sun + * @Description 网格员基础信息批量更新部分字段 + **/ + void updateBatch(@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/BaseConflictsResolveEntity.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/entity/BaseConflictsResolveEntity.java index fe9a50a92a..d40e74bb70 100644 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/entity/BaseConflictsResolveEntity.java +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/entity/BaseConflictsResolveEntity.java @@ -18,31 +18,196 @@ package com.epmet.opendata.entity; import com.baomidou.mybatisplus.annotation.TableName; -import com.epmet.commons.mybatis.entity.BaseEpmetEntity; import lombok.Data; import lombok.EqualsAndHashCode; +import java.util.Date; + /** * 事件中间表 * * @author generator generator@elink-cn.com - * @since v1.0.0 2021-10-22 + * @since v1.0.0 2021-11-25 */ @Data @EqualsAndHashCode(callSuper=false) @TableName("base_conflicts_resolve") -public class BaseConflictsResolveEntity { +public class BaseConflictsResolveEntity{ private static final long serialVersionUID = 1L; - /** - * 事件信息 - */ - private String eventInfo; + /** + * 事件ID + */ + private String id; + private String customerId; + /** + * 事件所属网格ID + */ + private Integer gridId; + + /** + * 网格名称 + */ + private String gridName; + + /** + * 事件名称 + */ + private String eventName; + + /** + * 发生日期 + */ + private Date happenDate; + + /** + * 发生地点 + */ + private String happenPlace; + + /** + * 事件规模 + */ + private String eventScale; + + /** + * 涉及人数 + */ + private Integer numberInvolved; + + /** + * 事件简述 + */ + private String eventDescription; + + /** + * 涉及单位 + */ + private String relatedUnits; + + /** + * 主要当事人证件代码 + */ + private String identificationCode; + + /** + * 主要当事人证件号码 + */ + private String idCard; + + /** + * 主要当事人姓名 + */ + private String name; + + /** + * 主要当事人性别 + */ + private String sex; + + /** + * 主要当事人民族 + */ + private String nation; + + /** + * 主要当事人学历 + */ + private String education; + + /** + * 主要当事人人员类别(二级) + */ + private String personnelCategory; + + /** + * 主要当事人居住详址 + */ + private String detailAddress; + + /** + * 是否解决或化解(Y已解决N未解决) + */ + private String successfulOrNot; + + /** + * 经度 + */ + private String lng; + + /** + * 纬度 + */ + private String lat; + + /** + * 创建人 + */ + private String createBy; + + /** + * 创建时间 + */ + private Date createDate; + + /** + * 修改人 + */ + private String updateBy; + + /** + * 修改时间 + */ + private Date updateDate; + + /** + * 事件所属网格ID状态(01:待办理,02:待核实,03:办结) + */ + private String status; + + /** + * 事件编号(自定义编号,可以加前缀如:py) + */ + private String eventNo; + + /** + * 采集来源(01:App,02:Web) + */ + private String source; + + /** + * 事件类别(一级) + */ + private String firstEventCategory; + + /** + * 事件类别(二级) + */ + private String secondEventCategory; + + /** + * 主要当事人人员类别(一级) + */ + private String firstPersonnelCategory; + + /** + * 办结方式(状态是办结的时候,才填) + */ + private String resolveWay; + + /** + * 办结层级(状态是办结的时候,才填) + */ + private String resolveGridLevel; - /** - * 事件所属网格ID - */ - private String gridId; + /** + * 办结时间(状态是办结的时候,才填) + */ + private Date resolveTime; + /** + * 同步状态 0 未同步, 1 已同步 + */ + private String flag; } 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 3f458a026a..979919af85 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 @@ -97,7 +97,6 @@ public class BaseDisputeProcessEntity extends BaseEpmetEntity { * 是否办结 Y:是、N:否 */ private String successfulOrNo; - /** * 办结层级 01省、自治区、直辖市 diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/entity/BaseGridInfoEntity.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/entity/BaseGridInfoEntity.java deleted file mode 100644 index f74e8b2205..0000000000 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/entity/BaseGridInfoEntity.java +++ /dev/null @@ -1,106 +0,0 @@ -/** - * 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 com.epmet.commons.mybatis.entity.BaseEpmetEntity; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.util.Date; - -/** - * 网格基础信息表 - * - * @author generator generator@elink-cn.com - * @since v1.0.0 2021-10-15 - */ -@Data -@EqualsAndHashCode(callSuper=false) -@TableName("base_grid_info") -public class BaseGridInfoEntity extends BaseEpmetEntity { - - private static final long serialVersionUID = 1L; - - /** - * 客户Id - */ - private String customerId; - - /** - * 组织/网格Id - */ - private String orgId; - - /** - * 网格编码 - */ - private String code; - - /** - * 网格名称 - */ - private String gridName; - - /** - * 网格层级[07:网格] - */ - private String gridLevel; - - /** - * 专属网格类型[01:党政机关; 02:医院; 03:学校; 04:企业; 05:园区; 06:商圈; 07:市场; 08:景区; - */ - private String gridType; - - /** - * 网格内人口规模[01:500人以下(含500人); 02:500-1000人(含1000人); 03:1000-1500人(含1500人); 04:1500人以上] - */ - private String populationSize; - - /** - * 是否成立网格党支部或网格党小组[Y:是、N:否] - */ - private String isPartyBranch; - - /** - * 网格党组织类型[01:网格党支部; 02:网格党小组] - */ - private String partyBranchType; - - /** - * 中心点(质心)经度 - */ - private String lng; - - /** - * 中心点(质心)纬度 - */ - private String lat; - - /** - * 网格颜色 - */ - private String gridColor; - - /** - * 空间范围 - */ - private String shape; - -} diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/entity/BaseGridUserEntity.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/entity/BaseGridUserEntity.java deleted file mode 100644 index 5d0b2f1de6..0000000000 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/entity/BaseGridUserEntity.java +++ /dev/null @@ -1,161 +0,0 @@ -/** - * 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 com.epmet.commons.mybatis.entity.BaseEpmetEntity; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.util.Date; - -/** - * 网格员基础信息表 - * - * @author generator generator@elink-cn.com - * @since v1.0.0 2021-10-15 - */ -@Data -@EqualsAndHashCode(callSuper=false) -@TableName("base_grid_user") -public class BaseGridUserEntity extends BaseEpmetEntity { - - private static final long serialVersionUID = 1L; - - /** - * 客户Id - */ - private String customerId; - - /** - * 网格Id - */ - private String gridId; - - /** - * 人员Id - */ - private String staffId; - - /** - * 网格编码 - */ - private String code; - - /** - * 网格名称 - */ - private String gridName; - - /** - * 网格员姓名 - */ - private String nickName; - - /** - * 专属网格类型[01:党政机关; 02:医院; 03:学校; 04:企业; 05:园区; 06:商圈; 07:市场; 08:景区; - */ - private String cardNum; - - /** - * 网格员类型[01:专职网格员; 02:兼职网格员; 03:网格长; 04:综治机构人员; 05:职能部门人员] - */ - private String userType; - - /** - * 手机号码 - */ - private String phonenumber; - - /** - * 性别[1:男性; 2:女性; 9:未说明的性别] - */ - private String sex; - - /** - * 民族[字典表主键] - */ - private String nation; - - /** - * 政治面貌[字典表主键] - */ - private String paerty; - - /** - * 出生日期[YYYY-MM-DD] - */ - private Date birthday; - - /** - * 学历[字典表主键] - */ - private String education; - - /** - * 入职时间 - */ - private Date entryDate; - - /** - * 是否离职 - */ - private String isLeave; - - /** - * 离职时间 - */ - private Date leaveDate; - - /** - * 网格员年收入 - */ - private String income; - - /** - * 是否社区(村)两委委员[Y:是、N:否] - */ - private String isCommittee; - - /** - * 是否社区工作者[Y:是、N:否] - */ - private String isCommunityWorkers; - - /** - * 是否社会工作者[Y:是、N:否] - */ - private String isSocialWorker; - - /** - * 是否村(居)民小组长[Y:是、N:否 - */ - private String isVillageLeader; - - /** - * 是否警务助理[Y:是、N:否] - */ - private String isPoliceAssistant; - - /** - * 是否人民调解员[Y:是、N:否] - */ - private String isMediator; - -} 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 index 7a2d2e3ff8..d13b6d62fe 100644 --- 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 @@ -65,18 +65,33 @@ public class ExDeptEntity { private String deptCode; /** - * + * (省标准)区划编码/网格编码 */ private String gridCode; + /** + * 组织类型 + */ + private String isCgorg; + /** * (区县平台)部门id */ - private String deptIdQx; + private String qxDeptId; + + /** + * (区县平台)部门/网格名称 + */ + private String qxDeptCode; /** * (区县平台)部门/网格名称 */ - private String deptNameQx; + private String qxDeptName; + + /** + * (区县平台)客户Id + */ + private String qxCustomerId; } diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/entity/ExUserEntity.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/entity/ExUserEntity.java index f178336ab1..d5f2c3f968 100644 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/entity/ExUserEntity.java +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/entity/ExUserEntity.java @@ -37,7 +37,7 @@ public class ExUserEntity { /** * 市平台 用户ID */ - private String userId; + private Integer userId; /** * 市平台 用户名 @@ -45,28 +45,39 @@ public class ExUserEntity { private String userName; /** - * 市平台 用户身份证号 + * 市平台 登录账号 */ - private String idCard; + private String loginName; /** - * 市平台 用户手机号 + * (市平台)所属区县、街道、村居或网格id */ - private String mobile; + private String gridId; /** - * 区县平台 用户ID + * (市平台)所属部门id */ - private String userIdQx; + private String deptId; /** - * 区县平台 用户名 + * (区县平台)用户id */ - private String userNameQx; + private String qxUserId; /** - * 区县平台 用户账号 + * (区县平台)姓名/用户名称 */ - private String userAccount; + private String qxUserName; + + /** + * (区县平台)手机号码 + */ + private String qxMobile; + + /** + * (区县平台)客户Id + */ + private String qxCustomerId; + } 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 3fa339bc0b..dc02f0498a 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 @@ -4,11 +4,13 @@ import com.epmet.commons.rocketmq.constants.ConsomerGroupConstants; import com.epmet.commons.rocketmq.constants.TopicConstants; import com.epmet.commons.rocketmq.register.MQAbstractRegister; import com.epmet.commons.rocketmq.register.MQConsumerProperties; +import com.epmet.commons.tools.distributedlock.DistributedLock; import com.epmet.opendata.mq.listener.OpenDataOrgChangeEventListener; import com.epmet.opendata.mq.listener.OpenDataPatrolChangeEventListener; import com.epmet.opendata.mq.listener.OpenDataProjectChangeEventListener; import com.epmet.opendata.mq.listener.OpenDataStaffChangeEventListener; import org.apache.rocketmq.common.protocol.heartbeat.MessageModel; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; /** @@ -19,35 +21,39 @@ import org.springframework.stereotype.Component; @Component public class RocketMQConsumerRegister extends MQAbstractRegister { + @Autowired + private DistributedLock distributedLock; + @Override public void registerAllListeners(String env, MQConsumerProperties consumerProperties) { + // 客户初始化监听器注册 register(consumerProperties, ConsomerGroupConstants.OPEN_DATA_ORG_CHANGE_EVENT_LISTENER_GROUP, MessageModel.CLUSTERING, TopicConstants.ORG, "*", - new OpenDataOrgChangeEventListener()); + new OpenDataOrgChangeEventListener(distributedLock)); register(consumerProperties, ConsomerGroupConstants.OPEN_DATA_STAFF_CHANGE_EVENT_LISTENER_GROUP, MessageModel.CLUSTERING, TopicConstants.STAFF, "*", - new OpenDataStaffChangeEventListener()); + new OpenDataStaffChangeEventListener(distributedLock)); register(consumerProperties, ConsomerGroupConstants.OPEN_DATA_PATROL_CHANGE_EVENT_LISTENER_GROUP, MessageModel.CLUSTERING, TopicConstants.PATROL, "*", - new OpenDataPatrolChangeEventListener()); + new OpenDataPatrolChangeEventListener(distributedLock)); register(consumerProperties, ConsomerGroupConstants.OPEN_DATA_PROJECT_CHANGE_EVENT_LISTENER_GROUP, MessageModel.CLUSTERING, TopicConstants.PROJECT, "*", - new OpenDataProjectChangeEventListener()); + new OpenDataProjectChangeEventListener(distributedLock)); // ...其他监听器类似 } 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 04e95a893b..5549c4c892 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 @@ -9,8 +9,8 @@ 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.opendata.dto.form.GridBaseInfoFormDTO; -import com.epmet.opendata.service.BaseGridInfoService; +import com.epmet.opendata.dto.form.ExDeptFormDTO; +import com.epmet.opendata.service.ExDeptService; import org.apache.commons.lang.StringUtils; import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyContext; import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyStatus; @@ -35,6 +35,13 @@ public class OpenDataOrgChangeEventListener implements MessageListenerConcurrent private RedisUtils redisUtils; + private DistributedLock distributedLock; + + public OpenDataOrgChangeEventListener(DistributedLock distributedLock) { + this.distributedLock = distributedLock; + } + + @Override public ConsumeConcurrentlyStatus consumeMessage(List msgs, ConsumeConcurrentlyContext context) { @@ -62,22 +69,20 @@ public class OpenDataOrgChangeEventListener implements MessageListenerConcurrent logger.info("【开放数据事件监听器】-组织信息变更-收到消息内容:{},操作:{}", msg, tags); OrgOrStaffMQMsg obj = JSON.parseObject(msg, OrgOrStaffMQMsg.class); - DistributedLock distributedLock = null; RLock lock = null; try { - distributedLock = SpringContextUtils.getBean(DistributedLock.class); lock = distributedLock.getLock(String.format("lock:open_data_org:%s", obj.getOrgId()), 30L, 30L, TimeUnit.SECONDS); - GridBaseInfoFormDTO dto = new GridBaseInfoFormDTO(); + ExDeptFormDTO dto = new ExDeptFormDTO(); dto.setCustomerId(obj.getCustomerId()); dto.setType(obj.getType()); List orgIdList = new ArrayList<>(); orgIdList.add(obj.getOrgId()); if ("agency".equals(obj.getOrgType())) { - SpringContextUtils.getBean(BaseGridInfoService.class).getAgencyBaseInfo(dto); + SpringContextUtils.getBean(ExDeptService.class).getAgencyBaseInfo(dto); } else { - SpringContextUtils.getBean(BaseGridInfoService.class).getGridBaseInfo(dto); + SpringContextUtils.getBean(ExDeptService.class).getGridBaseInfo(dto); } } catch (RenException e) { // 如果是我们手动抛出的异常,说明在业务可控范围内。目前不需要MQ重试 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 6207c6fa74..45acb46283 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 @@ -37,6 +37,12 @@ public class OpenDataPatrolChangeEventListener implements MessageListenerConcurr private RedisUtils redisUtils; + private DistributedLock distributedLock; + + public OpenDataPatrolChangeEventListener(DistributedLock distributedLock) { + this.distributedLock = distributedLock; + } + @Override public ConsumeConcurrentlyStatus consumeMessage(List msgs, ConsumeConcurrentlyContext context) { @@ -67,10 +73,8 @@ public class OpenDataPatrolChangeEventListener implements MessageListenerConcurr log.warn("consumeMessage msg body is blank"); return; } - DistributedLock distributedLock = null; RLock lock = null; try { - distributedLock = SpringContextUtils.getBean(DistributedLock.class); lock = distributedLock.getLock(String.format("lock:open_data_patrol:%s", msgObj.getPatrolId()), 30L, 30L, TimeUnit.SECONDS); UpsertPatrolRecordForm patrolRecordForm = new UpsertPatrolRecordForm(); 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 c2af1cffe7..6c5f127cb9 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 @@ -38,6 +38,12 @@ public class OpenDataProjectChangeEventListener implements MessageListenerConcur private RedisUtils redisUtils; + private DistributedLock distributedLock; + + public OpenDataProjectChangeEventListener(DistributedLock distributedLock) { + this.distributedLock = distributedLock; + } + @Override public ConsumeConcurrentlyStatus consumeMessage(List msgs, ConsumeConcurrentlyContext context) { @@ -68,10 +74,8 @@ public class OpenDataProjectChangeEventListener implements MessageListenerConcur DisputeProcessMQMsg obj = JSON.parseObject(msg, DisputeProcessMQMsg.class); EventInfoFormDTO formDTO = ConvertUtils.sourceToTarget(obj, EventInfoFormDTO.class); - DistributedLock distributedLock = null; RLock lock = null; try { - 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(formDTO); 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 48d0ece671..09db1147bd 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 @@ -1,7 +1,7 @@ package com.epmet.opendata.mq.listener; -import com.epmet.commons.rocketmq.constants.MQUserPropertys; import com.alibaba.fastjson.JSON; +import com.epmet.commons.rocketmq.constants.MQUserPropertys; import com.epmet.commons.rocketmq.messages.OrgOrStaffMQMsg; import com.epmet.commons.tools.distributedlock.DistributedLock; import com.epmet.commons.tools.exception.ExceptionUtils; @@ -11,7 +11,7 @@ import com.epmet.commons.tools.redis.RedisUtils; import com.epmet.commons.tools.utils.SpringContextUtils; import com.epmet.feign.EpmetMessageOpenFeignClient; import com.epmet.opendata.dto.form.StaffBaseInfoFormDTO; -import com.epmet.opendata.service.BaseGridUserService; +import com.epmet.opendata.service.ExUserService; import org.apache.commons.lang3.StringUtils; import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyContext; import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyStatus; @@ -38,6 +38,12 @@ public class OpenDataStaffChangeEventListener implements MessageListenerConcurre private RedisUtils redisUtils; + private DistributedLock distributedLock; + + public OpenDataStaffChangeEventListener(DistributedLock distributedLock) { + this.distributedLock = distributedLock; + } + @Override public ConsumeConcurrentlyStatus consumeMessage(List msgs, ConsumeConcurrentlyContext context) { @@ -67,10 +73,8 @@ public class OpenDataStaffChangeEventListener implements MessageListenerConcurre logger.info("【开放数据事件监听器】-工作人员信息变更-收到消息内容:{}, 操作:{}, blockedMsgLabel:{}", msg, tags, pendingMsgLabel); OrgOrStaffMQMsg obj = JSON.parseObject(msg, OrgOrStaffMQMsg.class); - DistributedLock distributedLock = null; RLock lock = null; try { - distributedLock = SpringContextUtils.getBean(DistributedLock.class); lock = distributedLock.getLock(String.format("lock:open_data_staff:%s", obj.getOrgId()), 30L, 30L, TimeUnit.SECONDS); @@ -79,7 +83,7 @@ public class OpenDataStaffChangeEventListener implements MessageListenerConcurre dto.setType(obj.getType()); List staffIdList = new ArrayList<>(); staffIdList.add(obj.getOrgId()); - SpringContextUtils.getBean(BaseGridUserService.class).getStaffBaseInfo(dto); + SpringContextUtils.getBean(ExUserService.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/BaseGridInfoService.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/BaseGridInfoService.java deleted file mode 100644 index f0fe03c28a..0000000000 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/BaseGridInfoService.java +++ /dev/null @@ -1,44 +0,0 @@ -/** - * 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.opendata.dto.form.GridBaseInfoFormDTO; -import com.epmet.opendata.entity.BaseGridInfoEntity; - -/** - * 网格基础信息表 - * - * @author generator generator@elink-cn.com - * @since v1.0.0 2021-10-15 - */ -public interface BaseGridInfoService extends BaseService { - - /** - * @Author sun - * @Description 组织基础信息中介库同步 - **/ - void getAgencyBaseInfo(GridBaseInfoFormDTO formDTO); - - /** - * @Author sun - * @Description 网格基础信息中介库同步 - **/ - void getGridBaseInfo(GridBaseInfoFormDTO 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/BaseGridUserService.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/BaseGridUserService.java deleted file mode 100644 index 2cdda5d9c5..0000000000 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/BaseGridUserService.java +++ /dev/null @@ -1,38 +0,0 @@ -/** - * 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.opendata.dto.form.StaffBaseInfoFormDTO; -import com.epmet.opendata.entity.BaseGridUserEntity; - -/** - * 网格员基础信息表 - * - * @author generator generator@elink-cn.com - * @since v1.0.0 2021-10-15 - */ -public interface BaseGridUserService extends BaseService { - - /** - * @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/ExDeptService.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/ExDeptService.java index 644c06c673..2fa094af92 100644 --- 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 @@ -18,11 +18,9 @@ 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.dto.form.ExDeptFormDTO; import com.epmet.opendata.entity.ExDeptEntity; -import java.util.List; import java.util.Map; /** @@ -33,65 +31,19 @@ import java.util.Map; */ 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); + Map getDeptMap(); /** - * 默认更新 - * - * @param dto - * @return void - * @author generator - * @date 2021-10-19 - */ - void update(ExDeptDTO dto); + * @Author sun + * @Description 组织基础信息中介库同步 + **/ + void getAgencyBaseInfo(ExDeptFormDTO formDTO); /** - * 批量删除 - * - * @param ids - * @return void - * @author generator - * @date 2021-10-19 - */ - void delete(String[] ids); + * @Author sun + * @Description 网格基础信息中介库同步 + **/ + void getGridBaseInfo(ExDeptFormDTO formDTO); - 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/ExUserService.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/ExUserService.java index 9c76d86500..cdbe5cbaad 100644 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/ExUserService.java +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/ExUserService.java @@ -18,8 +18,11 @@ package com.epmet.opendata.service; import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.opendata.dto.form.StaffBaseInfoFormDTO; import com.epmet.opendata.entity.ExUserEntity; +import java.util.Map; + /** * 系统用户中间表 * @@ -28,4 +31,12 @@ import com.epmet.opendata.entity.ExUserEntity; */ public interface ExUserService extends BaseService { + Map getUserMap(String customerId); + + /** + * @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/BaseDisputeProcessServiceImpl.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/BaseDisputeProcessServiceImpl.java index 2a9e99acbf..63211e253f 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 @@ -20,22 +20,26 @@ 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.dto.basereport.result.EventInfoResultDTO; import com.epmet.feign.DataStatisticalOpenFeignClient; import com.epmet.opendata.dao.BaseDisputeProcessDao; +import com.epmet.opendata.entity.BaseConflictsResolveEntity; import com.epmet.opendata.entity.BaseDisputeProcessEntity; +import com.epmet.opendata.service.BaseConflictsResolveService; import com.epmet.opendata.service.BaseDisputeProcessService; import com.epmet.opendata.service.ExDeptService; +import com.epmet.opendata.service.ExUserService; import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import javax.annotation.Resource; +import java.util.Date; import java.util.List; import java.util.Map; +import java.util.stream.Collectors; /** * 事件信息表 @@ -49,6 +53,10 @@ public class BaseDisputeProcessServiceImpl extends BaseServiceImpl> result = dataStatisticalOpenFeignClient.getEventInfo(formDTO); if (!result.success()) { throw new RenException(result.getInternalMsg()); } Map deptMap = exDeptService.getDeptMap(); + Map userMap = exUserService.getUserMap(formDTO.getCustomerId()); List list = result.getData(); - if (CollectionUtils.isNotEmpty(list)) { - List entityList = ConvertUtils.sourceToTarget(list, BaseDisputeProcessEntity.class); - entityList.forEach(item -> { - item.setDetpId(deptMap.get(item.getOrgCode())); - }); - if(SystemMessageType.PROJECT_ADD.equals(formDTO.getType())){ - insertBatch(entityList); - }else { - updateBatchById(entityList); - } - } + saveEvent(formDTO, deptMap, userMap, list); //分批次循环 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); - } - } + saveEvent(formDTO, deptMap, userMap, list); } } -} \ No newline at end of file + private void saveEvent(EventInfoFormDTO formDTO, Map deptMap, Map userMap, List list) { + if (CollectionUtils.isNotEmpty(list)) { + + List resolveList = list.stream().map(item -> { + BaseConflictsResolveEntity entity = new BaseConflictsResolveEntity(); + entity.setId(item.getId().concat("_PY")); + entity.setCustomerId(item.getCustomerId()); + entity.setGridId(deptMap.get(item.getOrgId())); + entity.setGridName(item.getOrgName()); + entity.setEventName(item.getEventName()); + entity.setHappenDate(item.getHappenDate()); + entity.setHappenPlace(item.getHappenPlace()); + String eventDescription = item.getEventDescription(); + //如果不为空 长度控制1000以内 + if (StringUtils.isNotBlank(eventDescription) && eventDescription.length() > NumConstant.ONE_THOUSAND){ + eventDescription = eventDescription.substring(NumConstant.ZERO,NumConstant.ONE_THOUSAND); + } + entity.setEventDescription(eventDescription); + entity.setLng(null == item.getLng()?null:item.getLng().toPlainString()); + entity.setLat(null == item.getLat()?null:item.getLat().toPlainString()); + entity.setCreateBy(null == userMap.get(item.getReporterId())?null:String.valueOf(userMap.get(item.getReporterId()))); + entity.setCreateDate(item.getReportTime()); + entity.setUpdateDate(new Date()); + entity.setStatus(item.getStatus()); + //业务不确定 + if (("03").equals(item.getStatus())) { + entity.setSuccessfulOrNot("Y"); + } + entity.setEventNo(("py_").concat(item.getId())); + entity.setFirstEventCategory(item.getParentEventCategory()); + entity.setSource("01"); + entity.setSecondEventCategory(item.getEventCategory()); + entity.setResolveWay(item.getWaysOfResolving()); + entity.setResolveGridLevel(item.getCompleteLevel()); + entity.setResolveTime(item.getCompleteTime()); + return entity; + }).collect(Collectors.toList()); + + baseConflictsResolveService.saveOrUpdateBatch(resolveList, formDTO.getPageSize()); + } + } +} 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 deleted file mode 100644 index e50d9404e4..0000000000 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/BaseGridInfoServiceImpl.java +++ /dev/null @@ -1,155 +0,0 @@ -/** - * 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.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.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; -import org.springframework.transaction.annotation.Transactional; - -import java.util.ArrayList; -import java.util.List; - -/** - * 网格基础信息表 - * - * @author generator generator@elink-cn.com - * @since v1.0.0 2021-10-15 - */ -@Service -public class BaseGridInfoServiceImpl extends BaseServiceImpl implements BaseGridInfoService { - @Autowired - private DataStatisticalOpenFeignClient dataStatisticalOpenFeignClient; - @Autowired - private ExDeptDao exDeptDao; - - /** - * @Author sun - * @Description 组织基础信息中介库同步 - **/ - @Override - @Transactional(rollbackFor = Exception.class) - public void getAgencyBaseInfo(GridBaseInfoFormDTO formDTO) { - //1.查询组织基础信息 - com.epmet.dto.org.form.GridBaseInfoFormDTO formDTO1 = ConvertUtils.sourceToTarget(formDTO, com.epmet.dto.org.form.GridBaseInfoFormDTO.class); - Result> result = dataStatisticalOpenFeignClient.getAgencyBaseInfo(formDTO1); - if (!result.success()) { - throw new RenException(result.getInternalMsg()); - } - if (null == result.getData() || result.getData().size() < NumConstant.ONE) { - return; - } - //2.中间库新增/修改数据 - /*List entityList = new ArrayList<>(); - result.getData().forEach(ag->{ - BaseGridInfoEntity entity = new BaseGridInfoEntity(); - entity.setCustomerId(ag.getCustomerId()); - entity.setOrgId(ag.getId()); - entity.setCode(""); - entity.setGridName(ag.getOrganizationName()); - String level = "06"; - if("province".equals(ag.getLevel())){ level = "01"; } - else if("city".equals(ag.getLevel())){ level = "02"; } - else if("district".equals(ag.getLevel())){ level = "03"; } - else if("street".equals(ag.getLevel())){ level = "04"; } - entity.setGridLevel(level); - entity.setGridType("01"); - entity.setDelFlag(ag.getDelFlag().toString()); - entity.setUpdatedBy(ag.getUpdatedBy()); - entity.setUpdatedTime(ag.getUpdatedTime()); - entityList.add(entity); - });*/ - List 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(null!=formDTO.getType()&& "all".equals(formDTO.getType())){ - exDeptDao.updateBatch(ExList); - }else { - exDeptDao.insertBatch(ExList); - } - - - } - - /** - * @Author sun - * @Description 网格基础信息中介库同步 - **/ - @Override - @Transactional(rollbackFor = Exception.class) - public void getGridBaseInfo(GridBaseInfoFormDTO formDTO) { - //1.查询网格基础信息 - com.epmet.dto.org.form.GridBaseInfoFormDTO formDTO1 = ConvertUtils.sourceToTarget(formDTO, com.epmet.dto.org.form.GridBaseInfoFormDTO.class); - Result> result = dataStatisticalOpenFeignClient.getGridBaseInfo(formDTO1); - if (!result.success()) { - throw new RenException(result.getInternalMsg()); - } - if (null == result.getData() || result.getData().size() < NumConstant.ONE) { - return; - } - //2.中间库新增/修改数据 - /*List entityList = new ArrayList<>(); - result.getData().forEach(ag->{ - BaseGridInfoEntity entity = new BaseGridInfoEntity(); - entity.setCustomerId(ag.getCustomerId()); - entity.setOrgId(ag.getId()); - entity.setCode(""); - entity.setGridName(ag.getGridName()); - entity.setGridLevel("07"); - entity.setGridType("01"); - entity.setDelFlag(ag.getDelFlag().toString()); - entity.setUpdatedBy(ag.getUpdatedBy()); - entity.setUpdatedTime(ag.getUpdatedTime()); - entityList.add(entity); - });*/ - List 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 (null != formDTO.getType() && "all".equals(formDTO.getType())) { - exDeptDao.updateBatch(ExList); - //exDeptDao.updateBatchGrid(ExList); - } else { - exDeptDao.insertBatch(ExList); - } - - } - -} \ 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/BaseGridUserServiceImpl.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/BaseGridUserServiceImpl.java deleted file mode 100644 index 6a8902a38b..0000000000 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/BaseGridUserServiceImpl.java +++ /dev/null @@ -1,74 +0,0 @@ -/** - * 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.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.dto.org.result.CustomerAgencyDTO; -import com.epmet.dto.user.result.CustomerStaffDTO; -import com.epmet.dto.user.result.GridUserInfoDTO; -import com.epmet.feign.DataStatisticalOpenFeignClient; -import com.epmet.opendata.dao.BaseGridUserDao; -import com.epmet.opendata.dto.form.StaffBaseInfoFormDTO; -import com.epmet.opendata.entity.BaseGridInfoEntity; -import com.epmet.opendata.entity.BaseGridUserEntity; -import com.epmet.opendata.service.BaseGridUserService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.util.ArrayList; -import java.util.List; - -/** - * 网格员基础信息表 - * - * @author generator generator@elink-cn.com - * @since v1.0.0 2021-10-15 - */ -@Service -public class BaseGridUserServiceImpl extends BaseServiceImpl implements BaseGridUserService { - @Autowired - private DataStatisticalOpenFeignClient dataStatisticalOpenFeignClient; - - /** - * @Author sun - * @Description 网格员信息中间库同步 - **/ - @Override - @Transactional(rollbackFor = Exception.class) - public void getStaffBaseInfo(StaffBaseInfoFormDTO formDTO) { - //1.查询网格基础信息 - com.epmet.dto.user.form.StaffBaseInfoFormDTO formDTO1 = ConvertUtils.sourceToTarget(formDTO, com.epmet.dto.user.form.StaffBaseInfoFormDTO.class); - Result> result = dataStatisticalOpenFeignClient.getStaffBaseInfo(formDTO1); - if (!result.success()) { - throw new RenException(result.getInternalMsg()); - } - //2.中间库新增/修改数据 - List entityList = ConvertUtils.sourceToTarget(result.getData(), BaseGridUserEntity.class); - if("add".equals(formDTO.getType())){ - insertBatch(entityList); - }else { - baseDao.updateBatch(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/service/impl/ExDeptServiceImpl.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/ExDeptServiceImpl.java index 44b519e95b..4c95ca47b5 100644 --- 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 @@ -18,22 +18,24 @@ 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.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.dto.org.result.CustomerAgencyDTO; +import com.epmet.dto.org.result.CustomerGridDTO; +import com.epmet.feign.DataStatisticalOpenFeignClient; import com.epmet.opendata.dao.ExDeptDao; -import com.epmet.opendata.dto.ExDeptDTO; +import com.epmet.opendata.dto.form.ExDeptFormDTO; 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.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.util.Arrays; +import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Map; @@ -47,69 +49,90 @@ import java.util.stream.Collectors; */ @Service public class ExDeptServiceImpl extends BaseServiceImpl implements ExDeptService { + @Autowired + private DataStatisticalOpenFeignClient dataStatisticalOpenFeignClient; @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); + public Map getDeptMap() { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + List entityList = baseDao.selectList(wrapper); + if (CollectionUtils.isEmpty(entityList)) { + return Collections.emptyMap(); + } + return entityList.stream().collect(Collectors.toMap(ExDeptEntity::getQxDeptId, ExDeptEntity::getDeptId, (key1, key2) -> key2)); } + /** + * @Author sun + * @Description 组织基础信息中介库同步 + **/ @Override @Transactional(rollbackFor = Exception.class) - public void save(ExDeptDTO dto) { - ExDeptEntity entity = ConvertUtils.sourceToTarget(dto, ExDeptEntity.class); - insert(entity); - } + public void getAgencyBaseInfo(ExDeptFormDTO formDTO) { + //1.查询组织基础信息 + com.epmet.dto.org.form.GridBaseInfoFormDTO formDTO1 = ConvertUtils.sourceToTarget(formDTO, com.epmet.dto.org.form.GridBaseInfoFormDTO.class); + Result> result = dataStatisticalOpenFeignClient.getAgencyBaseInfo(formDTO1); + if (!result.success()) { + throw new RenException(result.getInternalMsg()); + } + if (null == result.getData() || result.getData().size() < NumConstant.ONE) { + return; + } + //2.封装数据 + List ExList = new ArrayList<>(); + result.getData().forEach(ag -> { + ExDeptEntity entity = new ExDeptEntity(); + entity.setQxDeptId(ag.getId()); + entity.setQxDeptName(ag.getOrganizationName()); + entity.setQxDeptCode(ag.getCode()); + entity.setQxCustomerId(formDTO.getCustomerId()); + ExList.add(entity); + }); + //3.全量数据则按组织名称更新数据,新增修改则是按组织Id(qx_dept_id)新增或修改 + if (null != formDTO.getType() && "all".equals(formDTO.getType())) { + baseDao.updateBatch(ExList); + } else { + baseDao.insertBatch(ExList); + } - @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)); } + /** + * @Author sun + * @Description 网格基础信息中介库同步 + **/ @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(); + @Transactional(rollbackFor = Exception.class) + public void getGridBaseInfo(ExDeptFormDTO formDTO) { + //1.查询网格基础信息 + com.epmet.dto.org.form.GridBaseInfoFormDTO formDTO1 = ConvertUtils.sourceToTarget(formDTO, com.epmet.dto.org.form.GridBaseInfoFormDTO.class); + Result> result = dataStatisticalOpenFeignClient.getGridBaseInfo(formDTO1); + if (!result.success()) { + throw new RenException(result.getInternalMsg()); + } + if (null == result.getData() || result.getData().size() < NumConstant.ONE) { + return; } - return entityList.stream().collect(Collectors.toMap(ExDeptEntity::getGridCode, ExDeptEntity::getDeptId, (key1, key2) -> key2)); + //2.封装数据 + List ExList = new ArrayList<>(); + result.getData().forEach(ag -> { + ExDeptEntity entity = new ExDeptEntity(); + entity.setQxDeptId(ag.getId()); + entity.setQxDeptName(ag.getGridName()); + entity.setQxDeptCode(ag.getCode()); + entity.setQxCustomerId(formDTO.getCustomerId()); + ExList.add(entity); + }); + //3.全量数据则按组织名称更新数据,新增修改则是按组织Id(qx_dept_id)新增或修改 + if (null != formDTO.getType() && "all".equals(formDTO.getType())) { + baseDao.updateBatch(ExList); + //exDeptDao.updateBatchGrid(ExList); + } else { + baseDao.insertBatch(ExList); + } + } -} \ 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/ExUserServiceImpl.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/ExUserServiceImpl.java index 4badca6794..a9eca96dac 100644 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/ExUserServiceImpl.java +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/ExUserServiceImpl.java @@ -17,23 +17,27 @@ package com.epmet.opendata.service.impl; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 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.exception.RenException; import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.user.result.GridUserInfoDTO; +import com.epmet.feign.DataStatisticalOpenFeignClient; import com.epmet.opendata.dao.ExUserDao; -import com.epmet.opendata.dto.ExUserDTO; +import com.epmet.opendata.dto.form.StaffBaseInfoFormDTO; import com.epmet.opendata.entity.ExUserEntity; import com.epmet.opendata.service.ExUserService; -import org.apache.commons.lang3.StringUtils; +import org.apache.commons.collections4.CollectionUtils; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.Collections; import java.util.List; import java.util.Map; +import java.util.stream.Collectors; /** * 系统用户中间表 @@ -43,6 +47,55 @@ import java.util.Map; */ @Service public class ExUserServiceImpl extends BaseServiceImpl implements ExUserService { + @Autowired + private DataStatisticalOpenFeignClient dataStatisticalOpenFeignClient; + @Override + public Map getUserMap(String customerId) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(ExUserEntity::getQxCustomerId, customerId); + List list = baseDao.selectList(wrapper); + if (CollectionUtils.isEmpty(list)) { + return Collections.emptyMap(); + } + return list.stream().collect(Collectors.toMap(ExUserEntity::getQxUserId, ExUserEntity::getUserId, (key1, key2) -> key2)); + } + + /** + * @Author sun + * @Description 网格员信息中间库同步 + **/ + @Override + @Transactional(rollbackFor = Exception.class) + public void getStaffBaseInfo(StaffBaseInfoFormDTO formDTO) { + //1.查询网格基础信息 + com.epmet.dto.user.form.StaffBaseInfoFormDTO formDTO1 = ConvertUtils.sourceToTarget(formDTO, com.epmet.dto.user.form.StaffBaseInfoFormDTO.class); + Result> result = dataStatisticalOpenFeignClient.getStaffBaseInfo(formDTO1); + if (!result.success()) { + throw new RenException(result.getInternalMsg()); + } + + //2.中间库新增/修改数据 + List entityList = new ArrayList<>(); + result.getData().forEach(r -> { + ExUserEntity entity = new ExUserEntity(); + entity.setQxUserId(r.getStaffId()); + entity.setQxUserName(r.getNickName()); + entity.setQxMobile(r.getPhonenumber()); + entity.setQxCustomerId(formDTO.getCustomerId()); + entityList.add(entity); + }); + + //3.更新数据,不能新增,市平台信息表中必填的 + if (!"staff_create".equals(formDTO.getType())) { + baseDao.updateBatch(entityList); + } + /*if ("staff_create".equals(formDTO.getType())) { + insertBatch(entityList); + } else { + baseDao.updateBatch(entityList); + }*/ + + } } \ No newline at end of file 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 49db95eb6d..b158975c86 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 @@ -112,6 +112,11 @@ hystrix: isolation: thread: timeoutInMilliseconds: 60000 #缺省为1000 + threadpool: + default: + coreSize: 10 + maxQueueSize: 500 + queueSizeRejectionThreshold: 500 ribbon: ReadTimeout: 300000 diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/init_db.sql b/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/db/migration/init_db.sql similarity index 100% rename from epmet-module/open-data-worker/open-data-worker-server/src/main/resources/init_db.sql rename to epmet-module/open-data-worker/open-data-worker-server/src/main/resources/db/migration/init_db.sql diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/BaseGridInfoDao.xml b/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/BaseGridInfoDao.xml deleted file mode 100644 index 4d823eac28..0000000000 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/BaseGridInfoDao.xml +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - - UPDATE base_grid_info - - - - - - when org_id = #{item.orgId} then #{item.gridName} - - - - - - - - when org_id = #{item.orgId} then #{item.delFlag} - - - - - - - - when org_id = #{item.orgId} then #{item.updatedBy} - - - - - - - - when org_id = #{item.orgId} then #{item.updatedTime} - - - - - - WHERE - 1=1 - - org_id = #{item.orgId} - - - - \ No newline at end of file diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/BaseGridUserDao.xml b/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/BaseGridUserDao.xml deleted file mode 100644 index f5a47aea3a..0000000000 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/BaseGridUserDao.xml +++ /dev/null @@ -1,58 +0,0 @@ - - - - - - - UPDATE base_grid_user - - - - - - when (grid_id = #{item.gridId} AND staff_id = #{item.staffId} ) then #{item.gridName} - - - - - - - - when (grid_id = #{item.gridId} AND staff_id = #{item.staffId} ) then #{item.nickName} - - - - - - - - when (grid_id = #{item.gridId} AND staff_id = #{item.staffId} ) then #{item.delFlag} - - - - - - - - when (grid_id = #{item.gridId} AND staff_id = #{item.staffId} ) then #{item.updatedBy} - - - - - - - - when (grid_id = #{item.gridId} AND staff_id = #{item.staffId} ) then #{item.updatedTime} - - - - - - WHERE - 1=1 - - (grid_id = #{item.gridId} AND staff_id = #{item.staffId} ) - - - - \ 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 index 6aed25bf51..0d7af2fa2b 100644 --- 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 @@ -3,35 +3,38 @@ - - - - - - - - - - - UPDATE ex_dept - + - - - when dept_name_qx = #{item.deptNameQx} then #{item.deptIdQx} + + when qx_dept_name = #{item.qxDeptName} then #{item.qxDeptId} - + - - when dept_name_qx = #{item.deptNameQx} then #{item.deptIdQx} - + + when qx_dept_name = #{item.qxDeptName} then #{item.qxDeptId} + + + + + + + + when qx_dept_name = #{item.qxDeptName} then #{item.qxDeptCode} + + + + + + + + when qx_dept_name = #{item.qxDeptName} then #{item.qxCustomerId} @@ -40,30 +43,32 @@ WHERE 1=1 - - dept_name_qx = #{item.deptNameQx} + qx_dept_name = #{item.qxDeptName} INSERT INTO ex_dept ( - dept_id_qx, - dept_name_qx, - grid_code + qx_dept_id, + qx_dept_name, + qx_dept_code, + qx_customer_id ) VALUES ( - #{i.deptIdQx}, - #{i.deptNameQx}, - #{i.gridCode} + #{i.qxDeptId}, + #{i.qxDeptName}, + #{i.qxDeptCode}, + #{i.qxCustomerId} ) ON DUPLICATE KEY UPDATE - dept_id_qx = values(dept_id_qx), - dept_name_qx = values(dept_name_qx) + qx_dept_name = values(qx_dept_name), + qx_dept_code = values(qx_dept_code), + qx_customer_id = values(qx_customer_id) diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/ExUserDao.xml b/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/ExUserDao.xml new file mode 100644 index 0000000000..3d904577fd --- /dev/null +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/ExUserDao.xml @@ -0,0 +1,41 @@ + + + + + + + UPDATE ex_user + + + + + + when (qx_user_id = #{item.qxUserId} ) then #{item.qxUserName} + + + + + + + + when (qx_user_id = #{item.qxUserId} ) then #{item.qxMobile} + + + + + + + + when (qx_user_id = #{item.qxUserId} ) then #{item.qxCustomerId} + + + + + + WHERE 1=1 + + (qx_user_id = #{item.qxUserId} ) + + + + diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java index f467d60712..0bcae218af 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java @@ -17,6 +17,7 @@ package com.epmet.controller; +import com.epmet.commons.rocketmq.messages.OrgOrStaffMQMsg; import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.annotation.RequirePermission; import com.epmet.commons.tools.enums.RequirePermissionEnum; @@ -36,6 +37,8 @@ import com.epmet.dto.*; import com.epmet.dto.form.*; import com.epmet.dto.result.*; import com.epmet.excel.CustomerStaffExcel; +import com.epmet.feign.EpmetMessageOpenFeignClient; +import com.epmet.send.SendMqMsgUtil; import com.epmet.service.CustomerStaffService; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -59,9 +62,10 @@ public class CustomerStaffController { @Autowired private CustomerStaffService customerStaffService; - @Autowired private LoginUserUtil loginUserUtil; + @Autowired + private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient; @GetMapping("page") public Result> page(@RequestParam Map params) { @@ -214,7 +218,18 @@ public class CustomerStaffController { */ @PostMapping("addstaff") public Result addStaff(@RequestBody StaffSubmitFromDTO fromDTO){ - return customerStaffService.addStaff(fromDTO); + Result result = customerStaffService.addStaff(fromDTO); + + //2021-10-18 推送mq,数据同步到中介库 start + OrgOrStaffMQMsg mq = new OrgOrStaffMQMsg(); + mq.setCustomerId(fromDTO.getCustomerId()); + mq.setOrgId(result.getData().getUserId()); + mq.setOrgType("staff"); + mq.setType("staff_create"); + SendMqMsgUtil.build().openFeignClient(epmetMessageOpenFeignClient).sendOrgStaffMqMsg(mq); + //2021-10-18 end + + return result; } /** @@ -225,7 +240,18 @@ public class CustomerStaffController { */ @PostMapping("editstaff") public Result editStaff(@RequestBody StaffSubmitFromDTO fromDTO){ - return customerStaffService.editStaff(fromDTO); + Result result = customerStaffService.editStaff(fromDTO); + + //2021-10-18 推送mq,数据同步到中介库 start + OrgOrStaffMQMsg mq = new OrgOrStaffMQMsg(); + mq.setCustomerId(fromDTO.getCustomerId()); + mq.setOrgId(fromDTO.getStaffId()); + mq.setOrgType("staff"); + mq.setType("staff_change"); + SendMqMsgUtil.build().openFeignClient(epmetMessageOpenFeignClient).sendOrgStaffMqMsg(mq); + //2021-10-18 end + + return result; } /** diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java index 6e0c14c1e4..039edc5e32 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java @@ -348,15 +348,6 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl().ok(ConvertUtils.sourceToTarget(staffEntity, CustomerStaffDTO.class)); } @@ -431,15 +422,6 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl