Browse Source

Merge remote-tracking branch 'origin/dev_ic_diaodong' into dev_ic_diaodong

dev
sunyuchao 4 years ago
parent
commit
f05dc19456
  1. 2
      epmet-commons/epmet-commons-mybatis/pom.xml
  2. 10
      epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/config/MybatisPlusConfig.java
  3. 2
      epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/entity/BaseEpmetEntity.java
  4. 14
      epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/service/impl/BaseServiceImpl.java
  5. 1
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java
  6. 5
      epmet-module/data-aggregator/data-aggregator-client/pom.xml
  7. 18
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/GovOrgController.java
  8. 4
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/CustomerStaffDao.java
  9. 2
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/UserBaseInfoDao.java
  10. 2
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/EpmetUserService.java
  11. 15
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java
  12. 2
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/GovOrgService.java
  13. 35
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java
  14. 15
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/UserBaseInfoDao.xml
  15. 1
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govproject/ProjectDao.xml
  16. 34
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/OrgRankDataShibeiResultDTO.java
  17. 13
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/IndexController.java
  18. 42
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenOrgRankDataShibeiDao.java
  19. 10
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/IndexService.java
  20. 20
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/IndexServiceImpl.java
  21. 29
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenOrgRankDataShibeiDao.xml
  22. 12
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java
  23. 5
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java
  24. 106
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ShiBeiICJobController.java
  25. 10
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/crm/CustomerEntity.java
  26. 3
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenPartyUserRankDataServiceImpl.java
  27. 11
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsGroupServiceImpl.java
  28. 15
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsProjectServiceImpl.java
  29. 1
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerGridServiceImpl.java
  30. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactGroupAgencyDailyService.java
  31. 13
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactGroupAgencyDailyServiceImpl.java
  32. 2
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcServiceItemDictDao.java
  33. 5
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcResiDemandDictServiceImpl.java
  34. 7
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcServiceItemDictServiceImpl.java
  35. 4
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcResiDemandDictDao.xml
  36. 13
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcServiceItemDictDao.xml
  37. 33
      epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/ic/IcPrivateDeploySupportProjectTask.java
  38. 33
      epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/ic/IcPrivateDeploySupportUserPointTask.java
  39. 1
      epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/DailyStatisticalVoteJobResultDTO.java
  40. 2
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueVoteStatisticalDailyServiceImpl.java
  41. 1
      epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueVoteDetailDao.xml
  42. 4
      epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueVoteStatisticalDailyDao.xml
  43. 8
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java
  44. 4
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java
  45. 1
      epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ResiEventDao.xml
  46. 5
      epmet-module/open-data-worker/open-data-worker-server/src/main/resources/bootstrap.yml
  47. 11
      epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/entity/CustomerEntity.java
  48. 4
      epmet-module/resi-hall/resi-hall-server/src/main/resources/bootstrap.yml
  49. 4
      epmet-module/resi-home/resi-home-server/src/main/resources/bootstrap.yml
  50. 2
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java
  51. 610
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserImportServiceImpl.java
  52. 2
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcUserTransferRecordServiceImpl.java

2
epmet-commons/epmet-commons-mybatis/pom.xml

@ -13,7 +13,7 @@
<packaging>jar</packaging>
<properties>
<mybatisplus.version>3.2.0</mybatisplus.version>
<mybatisplus.version>3.4.2</mybatisplus.version>
<druid.version>1.1.14</druid.version>
<sqlserver.version>4.0</sqlserver.version>
<oracle.version>11.2.0.3</oracle.version>

10
epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/config/MybatisPlusConfig.java

@ -8,7 +8,9 @@
package com.epmet.commons.mybatis.config;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import com.epmet.commons.mybatis.interceptor.DataFilterInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@ -37,8 +39,10 @@ public class MybatisPlusConfig {
*/
@Bean
@Order(0)
public PaginationInterceptor paginationInterceptor() {
return new PaginationInterceptor();
public MybatisPlusInterceptor mybatisPlusInterceptor() {
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
return interceptor;
}
}

2
epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/entity/BaseEpmetEntity.java

@ -26,7 +26,7 @@ public abstract class BaseEpmetEntity implements Serializable {
/**
* id
*/
@TableId(type = IdType.UUID)
@TableId(type = IdType.ASSIGN_ID)
private String id;
/**

14
epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/service/impl/BaseServiceImpl.java

@ -57,7 +57,7 @@ public abstract class BaseServiceImpl<M extends BaseMapper<T>, T> implements Bas
Page<T> page = initPage(params);
//默认排序
if (StringUtils.isNotEmpty(defaultOrderField)) {
if (StringUtils.isNotBlank(defaultOrderField)) {
if (isAsc) {
page.addOrder(OrderItem.asc(defaultOrderField));
} else {
@ -111,7 +111,7 @@ public abstract class BaseServiceImpl<M extends BaseMapper<T>, T> implements Bas
String order = (String) params.get(Constant.ORDER);
//前端字段排序
if (StringUtils.isNotEmpty(orderField) && StringUtils.isNotEmpty(order)) {
if (StringUtils.isNotBlank(orderField) && StringUtils.isNotBlank(order)) {
if (Constant.ASC.equalsIgnoreCase(order)) {
return page.addOrder(OrderItem.asc(orderField));
} else {
@ -135,7 +135,7 @@ public abstract class BaseServiceImpl<M extends BaseMapper<T>, T> implements Bas
protected Map<String, Object> paramsToLike(Map<String, Object> params, String... likes) {
for (String like : likes) {
String val = (String) params.get(like);
if (StringUtils.isNotEmpty(val)) {
if (StringUtils.isNotBlank(val)) {
params.put(like, "%" + val + "%");
} else {
params.put(like, null);
@ -294,12 +294,12 @@ public abstract class BaseServiceImpl<M extends BaseMapper<T>, T> implements Bas
@Override
public boolean deleteById(Serializable id) {
return SqlHelper.delBool(baseDao.deleteById(id));
return SqlHelper.retBool(baseDao.deleteById(id));
}
@Override
public boolean deleteBatchIds(Collection<? extends Serializable> idList) {
return SqlHelper.delBool(baseDao.deleteBatchIds(idList));
return SqlHelper.retBool(baseDao.deleteBatchIds(idList));
}
@Transactional(rollbackFor = Exception.class)
@ -311,7 +311,7 @@ public abstract class BaseServiceImpl<M extends BaseMapper<T>, T> implements Bas
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());
Object idVal = ReflectionKit.getFieldValue( entity, tableInfo.getKeyProperty());
return StringUtils.checkValNull(idVal) || Objects.isNull(selectById((Serializable) idVal)) ? insert(entity) : updateById(entity);
}
return false;
@ -335,7 +335,7 @@ public abstract class BaseServiceImpl<M extends BaseMapper<T>, T> implements Bas
try (SqlSession batchSqlSession = sqlSessionBatch()) {
int i = 0;
for (T entity : entityList) {
Object idVal = ReflectionKit.getMethodValue(cls, entity, keyProperty);
Object idVal = ReflectionKit.getFieldValue(entity, keyProperty);
if (StringUtils.checkValNull(idVal) || Objects.isNull(selectById((Serializable) idVal))) {
batchSqlSession.insert(sqlStatement(SqlMethod.INSERT_ONE), entity);
} else {

1
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java

@ -47,6 +47,7 @@ public interface NumConstant {
BigDecimal ONE_HUNDRED_DECIMAL = new BigDecimal(100);
BigDecimal ZERO_DECIMAL = new BigDecimal(0);
int ONE_THOUSAND = 1000;
int TEN_THOUSAND = 10000;
int MAX = 99999999;
int EIGHTY_EIGHT = 88;
int EIGHTY = 80;

5
epmet-module/data-aggregator/data-aggregator-client/pom.xml

@ -20,9 +20,8 @@
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-annotation</artifactId>
<version>3.2.0</version>
<scope>compile</scope>
<version>3.4.2</version>
</dependency>
</dependencies>
</project>
</project>

18
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/GovOrgController.java

@ -177,6 +177,24 @@ public class GovOrgController {
return new Result<OrgStaffListResultDTO>().ok(govOrgService.staffList(formDTO));
}
/**
* @Param formDTO
* @Description 获取当前组织下的组织添加的工作人员 组织/部门/网格下人员列表
* @author sun
*/
@PostMapping("currentOrgStafflist")
public Result<OrgStaffListResultDTO> getCurrentOrgStafflist(@LoginUser TokenDto tokenDto, @RequestBody OrgStaffListFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, OrgStaffListFormDTO.OrgStaff.class);
if(!"agency".equals(formDTO.getOrgType())&&!"dept".equals(formDTO.getOrgType())&&!"grid".equals(formDTO.getOrgType())){
throw new RenException("参数类型错误");
}
//formDTO.setCustomerId("45687aa479955f9d06204d415238f7cc");
//formDTO.setStaffId("73ae6280e46a6653a5605d51d5462725");
formDTO.setCustomerId(tokenDto.getCustomerId());
formDTO.setStaffId(tokenDto.getUserId());
return new Result<OrgStaffListResultDTO>().ok(govOrgService.getCurrentOrgStafflist(formDTO));
}
/**
* @Param formDTO
* @Description 通讯录人员详情v2

4
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/CustomerStaffDao.java

@ -64,11 +64,11 @@ public interface CustomerStaffDao extends BaseDao<CustomerStaffEntity> {
* @Description 分页查询工作人员基础信息角色信息组织人员单位领导角色人员在前部门人员部门领导角色人员在前网格人员网格长角色人员在前
* @author sun
*/
List<ListStaffResultDTO> selectStaffList(@Param("staffIds") LinkedList<String> staffIds);
List<ListStaffResultDTO> selectStaffList(@Param("staffIds") List<String> staffIds);
/**
* @Description 查询工作人员基础信息
* @author sun
*/
CustomerStaffDTO selectByStaffId(@Param("staffId") String staffId);
}
}

2
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/UserBaseInfoDao.java

@ -55,5 +55,5 @@ public interface UserBaseInfoDao extends BaseDao<UserBaseInfoEntity> {
* @Description 查询userId的身份证号在小程序用户中存在的多个userId值
* @author sun
*/
List<UserBaseInfoDTO> getUserBaseList(@Param("userId") String userId, @Param("customerId") String customerId);
List<UserBaseInfoDTO> getUserBaseList(@Param("customerId") String customerId, @Param("userId") String userId, @Param("idCard") String idCard);
}

2
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/EpmetUserService.java

@ -176,6 +176,8 @@ public interface EpmetUserService {
*/
List<CustomerStaffEntity> listStaffsByIds(List<String> userIdsPart);
List<ListStaffResultDTO> selectStaffList(List<String> staffIds);
/**
* 人员类别分析-各类别人数
* @param formDTO

15
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java

@ -35,6 +35,8 @@ import com.epmet.dataaggre.entity.epmetuser.ResiUserBadgeEntity;
import com.epmet.dataaggre.entity.epmetuser.StaffRoleEntity;
import com.epmet.dataaggre.entity.govorg.CustomerAgencyEntity;
import com.epmet.dataaggre.service.datastats.DataStatsService;
import com.epmet.dataaggre.entity.epmetuser.*;
import com.epmet.dataaggre.service.datastats.DataStatsService;
import com.epmet.dataaggre.service.epmetuser.EpmetUserService;
import com.epmet.dataaggre.service.epmetuser.StaffPatrolDetailService;
import com.epmet.dataaggre.service.epmetuser.StaffPatrolRecordService;
@ -721,7 +723,13 @@ public class EpmetUserServiceImpl implements EpmetUserService {
*/
@Override
public List<UserBaseInfoDTO> getUserBaseList(String userId, String customerId) {
return userBaseInfoDao.getUserBaseList(userId, customerId);
List<UserBaseInfoDTO> resultList = new ArrayList<>();
List<UserBaseInfoDTO> list = userBaseInfoDao.getUserBaseList(customerId, userId, null);
if (!CollectionUtils.isEmpty(list) && StringUtils.isNotBlank(list.get(0).getIdNum())) {
return userBaseInfoDao.getUserBaseList(customerId, null, list.get(0).getIdNum());
}
resultList.addAll(list);
return resultList;
}
/**
@ -750,6 +758,11 @@ public class EpmetUserServiceImpl implements EpmetUserService {
return customerStaffDao.selectList(query);
}
@Override
public List<ListStaffResultDTO> selectStaffList(List<String> staffIds) {
return customerStaffDao.selectStaffList(staffIds);
}
/**
* 人员类别分析-各类别人数
*

2
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/GovOrgService.java

@ -11,7 +11,6 @@ import com.epmet.dataaggre.dto.govorg.form.SubOrgFormDTO;
import com.epmet.dataaggre.dto.govorg.result.*;
import com.epmet.dataaggre.dto.resigroup.result.OrgInfoCommonDTO;
import com.epmet.dataaggre.entity.govorg.CustomerAgencyEntity;
import com.epmet.dataaggre.entity.govorg.CustomerGridEntity;
import java.util.List;
@ -93,6 +92,7 @@ public interface GovOrgService {
* @author sun
*/
OrgStaffListResultDTO staffList(OrgStaffListFormDTO formDTO);
OrgStaffListResultDTO getCurrentOrgStafflist(OrgStaffListFormDTO formDTO);
/**
* @Param formDTO

35
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java

@ -416,6 +416,41 @@ public class GovOrgServiceImpl implements GovOrgService {
return resultDTO;
}
/**
* @Param formDTO
* @Description 通讯录组织/部门/网格下人员列表
* @author sun
*/
@Override
public OrgStaffListResultDTO getCurrentOrgStafflist(OrgStaffListFormDTO formDTO) {
OrgStaffListResultDTO resultDTO = new OrgStaffListResultDTO();
//1.按类型查询组织、部门、网格下所有工作人员Id列表[需要按角色排序 所以这里不能分页]
List<String> staffIds = customerStaffAgencyDao.selectStaffList(formDTO.getOrgId(), formDTO.getOrgType());
if (org.springframework.util.CollectionUtils.isEmpty(staffIds)) {
return resultDTO;
}
formDTO.setStaffIds(staffIds);
//是否包含自己
if("0".equals(formDTO.getIncludeMe())){
staffIds.removeIf(s->s.equals(formDTO.getStaffId()));
}
//2.分页查询工作人员基础信息、角色信息【组织人员单位领导角色人员在前;部门人员部门领导角色人员在前;网格人员网格长角色人员在前】
List<ListStaffResultDTO> staffList = epmetUserService.selectStaffList(staffIds);
//3.查询工作人员注册组织关系信息
List<String> staffIdList = staffList.stream().map(ListStaffResultDTO::getStaffId).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(staffIdList)){
List<StaffOrgNameResultDTO> list = customerAgencyDao.selelctStaffOrg(staffIdList);
staffList.forEach(re -> list.stream().filter(l -> re.getStaffId().equals(l.getStaffId())).forEach(s -> re.setOrgType(s.getOrgType())));
}
//3.封装数据并返回
resultDTO.setStaffCount(staffIds.size());
resultDTO.setStaffList((null == staffList ? new ArrayList<>() : staffList));
return resultDTO;
}
/**
* @Param formDTO
* @Description 通讯录人员详情v2

15
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/UserBaseInfoDao.xml

@ -41,13 +41,24 @@
<select id="getUserBaseList" resultType="com.epmet.dto.UserBaseInfoDTO">
SELECT
*
customer_id,
user_id,
mobile,
real_name,
id_num,
gender,
head_img_url
FROM
user_base_info
WHERE
del_flag = '0'
AND id_num = ( SELECT id_num FROM user_base_info WHERE user_id = #{userId})
AND customer_id = #{customerId}
<if test='userId != "" and userId != null'>
AND user_id = #{userId}
</if>
<if test='idCard != "" and idCard != null'>
AND id_num = #{idCard}
</if>
</select>
</mapper>

1
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govproject/ProjectDao.xml

@ -29,7 +29,6 @@
WHERE
p.DEL_FLAG = '0'
AND p.CUSTOMER_ID = #{customerId}
AND p.ORG_ID_PATH LIKE concat('%', #{agencyId}, '%')
<if test="projectStatus != null and projectStatus != ''">
AND p.`STATUS` = #{projectStatus}
</if>

34
epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/OrgRankDataShibeiResultDTO.java

@ -0,0 +1,34 @@
package com.epmet.evaluationindex.screen.dto.result;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* @Description 市北数字社区-组织先进排行榜 查询结果dto
* @ClassName OrgRankDataResultDTO
* @Auth wangc
* @Date 2020-08-21 11:16
*/
@Data
public class OrgRankDataShibeiResultDTO implements Serializable {
private static final long serialVersionUID = -7874641768141936572L;
private String orgId;
/**
* 名称 XXXX社区党委
* */
private String name;
/**
* 党员数
* */
private BigDecimal score;
/**
* 数据所属月份
*/
private String monthId;
}

13
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/IndexController.java

@ -154,6 +154,19 @@ public class IndexController {
return new Result<List<IndexAdvanceBranchRankResultDTO>>().ok(indexService.advancedBranchRank(formDTO));
}
/**
* @param formDTO
* @Description 数字社区数据分析-动力网格
* @author sun
*/
@PostMapping("advancedbranchrank-shibei")
Result<List<OrgRankDataShibeiResultDTO>> advancedBranchRankShibei(@RequestBody AdvancedBranchRankFormDTO formDTO, @LoginUser TokenDto loginUser){
ValidatorUtils.validateEntity(formDTO, AdvancedBranchRankFormDTO.AddUserInternalGroup.class);
formDTO.setCustomerId(loginUser.getCustomerId());
//formDTO.setCustomerId("45687aa479955f9d06204d415238f7cc");
return new Result<List<OrgRankDataShibeiResultDTO>>().ok(indexService.advancedBranchRankShibei(formDTO));
}
/**
* @param formDTO
* @author yinzuomei

42
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenOrgRankDataShibeiDao.java

@ -0,0 +1,42 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.datareport.dao.evaluationindex.screen;
import com.epmet.evaluationindex.screen.dto.form.AdvancedBranchRankFormDTO;
import com.epmet.evaluationindex.screen.dto.result.OrgRankDataShibeiResultDTO;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 党建引领-组织排行榜
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-08-18
*/
@Mapper
public interface ScreenOrgRankDataShibeiDao {
/**
* @return
* @Description 查询指定机关的所有直属网格月度数据
* @author wangc
* @date 2020.08.21 13:58
**/
List<OrgRankDataShibeiResultDTO> selectGridRankList(AdvancedBranchRankFormDTO formDTO);
}

10
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/IndexService.java

@ -94,4 +94,14 @@ public interface IndexService {
* @Date 2021/2/28 14:33
**/
List<SubAgencyIndexRankResultDTO> subAgencyIndexRankPy(SubAgencyIndexRankPyFormDTO formDTO);
/**
* desc: 市北数字社区特供接口 网格排行
*
* @param formDTO
* @return java.util.List<com.epmet.evaluationindex.screen.dto.result.IndexAdvanceBranchRankResultDTO>
* @author LiuJanJun
* @date 2022/1/14 4:57 下午
*/
List<OrgRankDataShibeiResultDTO> advancedBranchRankShibei(AdvancedBranchRankFormDTO formDTO);
}

20
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/IndexServiceImpl.java

@ -9,6 +9,7 @@ import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.constant.DataSourceConstant;
import com.epmet.datareport.dao.evaluationindex.screen.ScreenIndexDataMonthlyDao;
import com.epmet.datareport.dao.evaluationindex.screen.ScreenIndexDataYearlyDao;
import com.epmet.datareport.dao.evaluationindex.screen.ScreenOrgRankDataShibeiDao;
import com.epmet.datareport.service.evaluationindex.screen.IndexService;
import com.epmet.evaluationindex.screen.constant.ScreenConstant;
import com.epmet.evaluationindex.screen.dto.form.*;
@ -43,6 +44,8 @@ public class IndexServiceImpl implements IndexService {
@Autowired
private ScreenIndexDataMonthlyDao screenIndexDataMonthlyDao;
@Autowired
private ScreenOrgRankDataShibeiDao screenOrgRankDataShibeiDao;
@Autowired
private PartyMemberLeadServiceImpl partyMemberLeadServiceImpl;
@Autowired
private com.epmet.datareport.utils.DateUtils dateUtils;
@ -412,6 +415,23 @@ public class IndexServiceImpl implements IndexService {
return list;
}
/**
* @param formDTO
* @Description 先进排行-先进支部排行
* @author sun
* @return
*/
@Override
@DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true)
public List<OrgRankDataShibeiResultDTO> advancedBranchRankShibei(AdvancedBranchRankFormDTO formDTO) {
//根据当前所选组织,查询screen_index_data_monthly中类型为网格的按照总指数倒序,关联screen_org_rank_data表取其他数据
//1.级联查询组织下所有网格的先进支部排行数据,按总指数降序
if (StringUtils.isBlank(formDTO.getMonthId())) {
formDTO.setMonthId(DateUtils.getBeforeNMonth(1));
}
return screenOrgRankDataShibeiDao.selectGridRankList(formDTO);
}
@Override
@DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true)
public List<PeerComparisonResultDTO> getSubSingleIndexRank(SubSingleIndexRankFormDTO formDTO) {

29
epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenOrgRankDataShibeiDao.xml

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.datareport.dao.evaluationindex.screen.ScreenOrgRankDataShibeiDao">
<!-- 查询指定机关的直属网格月度数据 -->
<select id="selectGridRankList" resultType="com.epmet.evaluationindex.screen.dto.result.OrgRankDataShibeiResultDTO">
SELECT
rankData.ORG_NAME AS NAME,
round(rankData.SCORE,1) score,
rankData.ORG_ID as orgId,
rankData.MONTH_ID
FROM
screen_org_rank_data_shibei rankData
LEFT JOIN screen_customer_agency agency
ON rankData.PARENT_ID = agency.AGENCY_ID AND agency.DEL_FLAG = 0
WHERE
rankData.DEL_FLAG = '0'
AND rankData.ORG_TYPE = 'grid'
AND rankData.ALL_PARENT_IDS LIKE CONCAT('%',#{agencyId},'%')
AND rankData.MONTH_ID = #{monthId}
AND rankData.CUSTOMER_ID = #{customerId}
ORDER BY
rankData.SCORE DESC
LIMIT #{topNum}
</select>
</mapper>

12
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java

@ -20,6 +20,7 @@ import com.epmet.dto.user.result.MidPatrolDetailResult;
import com.epmet.dto.user.result.MidPatrolRecordResult;
import com.epmet.feign.impl.DataStatisticalOpenFeignClientFallBackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
@ -351,6 +352,17 @@ public interface DataStatisticalOpenFeignClient {
@PostMapping("/data/stats/demand/volunteer/daily")
Result statsVolunteerDemandServicesDaily(@RequestParam(value = "customer-id", required = false) String customerId);
/**
* desc: 市北私有化部署需要 支持的任务之一
*
* @param formDTO
* @return com.epmet.commons.tools.utils.Result
* @author LiuJanJun
* @date 2022/1/18 4:37 下午
*/
@PostMapping("/data/stats/shibeiICJob/userPointAndProjectStatus/{bizType}")
Result userPointAndProjectStatus(@PathVariable("bizType") String biztype,@RequestBody ExtractOriginFormDTO formDTO);
@PostMapping("/data/stats/ic/user/category-analysis-daily")
Result statUserCategoryDaily(@RequestBody IcUserCategoryAnalysisDailyFormDTO formDTO);
}

5
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java

@ -337,6 +337,11 @@ public class DataStatisticalOpenFeignClientFallBack implements DataStatisticalOp
return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "statsVolunteerDemandServicesDaily", customerId);
}
@Override
public Result userPointAndProjectStatus(String biztype,ExtractOriginFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "userPointAndProjectStatus", biztype,formDTO);
}
@Override
public Result statUserCategoryDaily(IcUserCategoryAnalysisDailyFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "statUserCategoryDaily", formDTO);

106
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ShiBeiICJobController.java

@ -0,0 +1,106 @@
package com.epmet.controller;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.enums.BizTypeEnum;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.redis.RedisKeys;
import com.epmet.commons.tools.redis.RedisUtils;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.StatsFormDTO;
import com.epmet.dto.extract.form.ExtractOriginFormDTO;
import com.epmet.dto.screen.form.ScreenCentralZoneDataFormDTO;
import com.epmet.service.StatsProjectService;
import com.epmet.service.evaluationindex.extract.toscreen.ScreenGrassrootsGovernDataAbsorptionService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
/**
* desc市北数字社区 单独部署 job入口 用户积分排名及项目状态数据
*/
@RequestMapping("shibeiICJob")
@RestController
@Slf4j
public class ShiBeiICJobController {
@Autowired
private ScreenGrassrootsGovernDataAbsorptionService screenGrassrootsGovernDataAbsorptionService;
@Autowired
private StatsProjectService statsProjectService;
@Autowired
private RedisUtils redisUtils;
@PostMapping("userPointAndProjectStatus/{bizType}")
public Result<String> userPointAndProjectStatus(@PathVariable("bizType") String bizType, @RequestBody ExtractOriginFormDTO formDTO) {
if (StringUtils.isBlank(formDTO.getCustomerId())){
return new Result<String>().error(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"参数错误cid不能为空");
}
long start = System.currentTimeMillis();
Set<String> result = new LinkedHashSet<>();
if (StringUtils.isNotBlank(formDTO.getStartDate()) && StringUtils.isNotBlank(formDTO.getEndDate())) {
List<String> daysBetween = DateUtils.getDaysBetween(formDTO.getStartDate(), formDTO.getEndDate());
daysBetween.forEach(d -> {
executeMethod(bizType, formDTO.getCustomerId(), d);
result.add(d);
redisUtils.hSet(RedisKeys.getBackDoorbizExcuteResult("userPointAndProjectStatus-"+bizType), formDTO.getCustomerId(), result, 3 * 24 * 60 * 60L);
});
} else {
if (StringUtils.isBlank(formDTO.getDateId())){
formDTO.setDateId(DateUtils.getBeforeNDay(NumConstant.ONE));
}
executeMethod(bizType, formDTO.getCustomerId(), formDTO.getDateId());
result.add(formDTO.getDateId());
redisUtils.hSet(RedisKeys.getBackDoorbizExcuteResult("userPointAndProjectStatus-"+bizType), formDTO.getCustomerId(), result, 3 * 24 * 60 * 60L);
}
long end = System.currentTimeMillis();
long l = (end - start) / 1000;
return new Result<String>().ok("userPointAndProjectStatus耗时-"+bizType + l + "s");
}
private void executeMethod(String bizType, String customerId, String d) {
if (bizType.equals(BizTypeEnum.USER.getType())){
this.extractUserPointData(customerId, d);
}
if (bizType.equals(BizTypeEnum.PROJECT.getType())) {
this.agencyProjectStats(customerId, d);
}
}
/**
* @Author sun
* @Description 数据-项目-机关日()统计
**/
private void agencyProjectStats(String customerId, String dateId) {
try {
if (StringUtils.isNotBlank(dateId)) {
dateId = DateUtils.format(DateUtils.parseDate(dateId, DateUtils.DATE_PATTERN_YYYYMMDD));
}
StatsFormDTO formDTO = new StatsFormDTO();
formDTO.setCustomerId(customerId);
formDTO.setDate(dateId);
statsProjectService.agencyProjectStats(formDTO);
} catch (Exception e) {
log.error("市北-项目状态数据写入失败,参数为:{}" + customerId + StrConstant.HYPHEN + dateId, e);
}
new Result();
}
private void extractUserPointData(String customerId, String dateId) {
try {
//基层治理 - 热心市民 screen_party_user_rank_data
ScreenCentralZoneDataFormDTO param = new ScreenCentralZoneDataFormDTO();
param.setCustomerId(customerId);
param.setDateId(dateId);
screenGrassrootsGovernDataAbsorptionService.userScoreDataHub(param);
} catch (Exception e) {
log.error("市北-热心市民/党员得分数据写入失败,参数为:{}" + customerId + StrConstant.HYPHEN + dateId, e);
}
}
}

10
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/crm/CustomerEntity.java

@ -17,9 +17,10 @@
package com.epmet.entity.crm;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
@ -27,7 +28,7 @@ import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 客户表
* 客户表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-03-11
@ -39,6 +40,11 @@ public class CustomerEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* id
*/
@TableId(type = IdType.ASSIGN_UUID)
private String id;
/**
* 客户名称
*/

3
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenPartyUserRankDataServiceImpl.java

@ -25,6 +25,7 @@ import com.epmet.constant.DataSourceConstant;
import com.epmet.dao.evaluationindex.screen.ScreenPartyUserRankDataDao;
import com.epmet.entity.evaluationindex.screen.ScreenPartyUserRankDataEntity;
import com.epmet.service.evaluationindex.screen.ScreenPartyUserRankDataService;
import org.apache.commons.collections4.ListUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -61,7 +62,7 @@ public class ScreenPartyUserRankDataServiceImpl extends BaseServiceImpl<ScreenPa
do {
affectedRows = baseDao.deletePartyUserRankData(customerId);
} while (affectedRows > NumConstant.ZERO);
baseDao.insertBatch(dataList);
ListUtils.partition(dataList,NumConstant.ONE_THOUSAND).forEach(part->baseDao.insertBatch(part));
}
}
}

11
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsGroupServiceImpl.java

@ -135,15 +135,10 @@ public class StatsGroupServiceImpl implements StatsGroupService {
if (customerIds.size() != NumConstant.ZERO) {
DimIdGenerator.DimIdBean dimIdBean = this.getDimIdBean(formDTO);
customerIds.forEach(customerId -> {
Boolean status = true;
try {
List<DimAgencyDTO> customerAgencyInfos = dimAgencyService.getAgencyInfoByCustomerId(customerId);
List<List<DimAgencyDTO>> partition = ListUtils.partition(customerAgencyInfos, NumConstant.ONE_HUNDRED);
for (List<DimAgencyDTO> p : partition) {
List<AgencyGroupDailyResultDTO> agencyGroupDaily = this.getAgencyGroupDaily(p, dimIdBean, customerId);
factGroupAgencyDailyService.insertGroupAgencyDaily(agencyGroupDaily, customerId,status);
status = false;
}
List<AgencyGroupDailyResultDTO> agencyGroupDaily = this.getAgencyGroupDaily(customerAgencyInfos, dimIdBean, customerId);
factGroupAgencyDailyService.insertGroupAgencyDaily(agencyGroupDaily, customerId);
} catch (Exception e) {
log.error(String.format(GroupConstant.STATS_FAILED_AGENCY_DAILY, customerId, LocalDate.now(), e));
}
@ -180,7 +175,7 @@ public class StatsGroupServiceImpl implements StatsGroupService {
}
/**
* @param customerAgencyInfos
* @param agencyList
* @param timeDim
* @param customerId
* @Description 网格小组 机关- 数据统计处理

15
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsProjectServiceImpl.java

@ -1,6 +1,5 @@
package com.epmet.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.constant.ProjectConstant;
@ -80,8 +79,8 @@ public class StatsProjectServiceImpl implements StatsProjectService {
if (null != formDTO && StringUtils.isNotBlank(formDTO.getCustomerId())) {
customerAgencyStats(formDTO.getCustomerId(), date);
} else {
int pageNo = 1;
int pageSize = 100;
int pageNo = NumConstant.ONE;
int pageSize = NumConstant.ONE_HUNDRED;
List<String> customerIdList = null;
do {
customerIdList = dimCustomerService.selectCustomerIdPage(pageNo++, pageSize);
@ -185,10 +184,10 @@ public class StatsProjectServiceImpl implements StatsProjectService {
projectEntity.setCustomerId(customerId);
projectEntity.setCreatedTime(date);
projectEntity.setStatus(ProjectConstant.CLOSED);
projectEntity.setPageSize(NumConstant.ONE_THOUSAND);
projectEntity.setPageSize(NumConstant.TEN_THOUSAND);
int pageNo = NumConstant.ONE;
int size = NumConstant.ZERO;
List<ProjectProcessEntity> processList = new ArrayList<>();
int size;
List<ProjectProcessEntity> processList = null;
do {
//1.一千条一循环查询节点数据,封装每个组织对应数据
projectEntity.setPageNo(pageNo);
@ -278,7 +277,7 @@ public class StatsProjectServiceImpl implements StatsProjectService {
}
mapList.put(agency.getId(), entity);
}
} while (size == NumConstant.ONE_THOUSAND);
} while (size == projectEntity.getPageSize());
//二、再分页查询项目表数据,封装每个组织的已结案已解决总数、已结案未解决总数;日增量中已结案已解决总数、已结案未解决总数
int num = NumConstant.ONE;
@ -374,7 +373,7 @@ public class StatsProjectServiceImpl implements StatsProjectService {
}
mapList.put(agency.getId(), entity);
}
} while (size == NumConstant.ONE_THOUSAND);
} while (size == projectEntity.getPageSize());
List<FactAgencyProjectDailyEntity> projectDateEntityList = new ArrayList<>(mapList.values());
//三、批量保存数据,先删后增

1
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerGridServiceImpl.java

@ -81,6 +81,7 @@ public class CustomerGridServiceImpl extends BaseServiceImpl<CustomerGridDao, Cu
* @param gridId
* @return
*/
@Override
public GridInfoDTO queryGridInfoDTO(String gridId){
return baseDao.selectGridInfo(gridId);
}

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactGroupAgencyDailyService.java

@ -101,7 +101,7 @@ public interface FactGroupAgencyDailyService extends BaseService<FactGroupAgency
* @param agencyList
* @author zxc
*/
void insertGroupAgencyDaily(List<AgencyGroupDailyResultDTO> agencyList,String customerId,Boolean status);
void insertGroupAgencyDaily(List<AgencyGroupDailyResultDTO> agencyList,String customerId);
/**
* @param

13
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactGroupAgencyDailyServiceImpl.java

@ -113,15 +113,12 @@ public class FactGroupAgencyDailyServiceImpl extends BaseServiceImpl<FactGroupAg
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void insertGroupAgencyDaily(List<AgencyGroupDailyResultDTO> agencyList,String customerId,Boolean status) {
public void insertGroupAgencyDaily(List<AgencyGroupDailyResultDTO> agencyList,String customerId) {
if (!CollectionUtils.isEmpty(agencyList)){
// true 为当前客户第一回进入,需要删除历史数据
if (status){
Integer delNum;
do {
delNum = baseDao.deleteInsertAgencyDailyByDateId(agencyList.get(NumConstant.ZERO).getDateId(),customerId);
}while (delNum > NumConstant.ZERO && delNum == NumConstant.ONE_THOUSAND);
}
Integer delNum;
do {
delNum = baseDao.deleteInsertAgencyDailyByDateId(agencyList.get(NumConstant.ZERO).getDateId(),customerId);
}while (delNum > NumConstant.ZERO && delNum == NumConstant.ONE_THOUSAND);
List<List<AgencyGroupDailyResultDTO>> partition = ListUtils.partition(agencyList, NumConstant.ONE_HUNDRED);
partition.forEach(p -> {
baseDao.insertGroupAgencyDaily(p);

2
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcServiceItemDictDao.java

@ -34,4 +34,6 @@ import java.util.List;
public interface IcServiceItemDictDao extends BaseDao<IcServiceItemDictEntity> {
List<ServiceItemResultDTO> pageList(String customerId);
IcServiceItemDictEntity selectMax(String customerId);
}

5
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcResiDemandDictServiceImpl.java

@ -81,6 +81,7 @@ public class IcResiDemandDictServiceImpl extends BaseServiceImpl<IcResiDemandDic
@Override
@Transactional(rollbackFor = Exception.class)
public void addFirstCategory(AddFirstCategoryFormDTO formDTO) {
formDTO.setCategoryName(formDTO.getCategoryName().trim());
if (checkCategoryName(formDTO.getCustomerId(), formDTO.getCategoryName(), NumConstant.ONE, NumConstant.ZERO_STR,null) > NumConstant.ZERO) {
// 名称唯一
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), String.format("【%s】已存在", formDTO.getCategoryName()), "分类名称已存在");
@ -105,6 +106,7 @@ public class IcResiDemandDictServiceImpl extends BaseServiceImpl<IcResiDemandDic
@Transactional(rollbackFor = Exception.class)
@Override
public void addChild(AddCategoryFormDTO formDTO) {
formDTO.setCategoryName(formDTO.getCategoryName().trim());
if(NumConstant.ZERO_STR.equals(formDTO.getParentCategoryCode())){
throw new RenException("添加一级分类,调用接口/heart/icresidemanddict/addfirst");
}
@ -160,8 +162,9 @@ public class IcResiDemandDictServiceImpl extends BaseServiceImpl<IcResiDemandDic
@Override
@Transactional(rollbackFor = Exception.class)
public void update(UpdateFormDTO formDTO) {
formDTO.setCategoryName(formDTO.getCategoryName().trim());
IcResiDemandDictEntity origin = baseDao.selectById(formDTO.getCategoryId());
if (checkCategoryName(formDTO.getCustomerId(), formDTO.getCategoryName(), NumConstant.TWO, origin.getParentCode(), formDTO.getCategoryId()) > NumConstant.ZERO) {
if (checkCategoryName(formDTO.getCustomerId(), formDTO.getCategoryName(), formDTO.getLevel(), origin.getParentCode(), formDTO.getCategoryId()) > NumConstant.ZERO) {
// 名称唯一
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), String.format("【%s】已存在", formDTO.getCategoryName()), "分类名称已存在");
}

7
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcServiceItemDictServiceImpl.java

@ -74,6 +74,7 @@ public class IcServiceItemDictServiceImpl extends BaseServiceImpl<IcServiceItemD
@Transactional(rollbackFor = Exception.class)
@Override
public void addOrUpdate(ServiceItemAddFormDTO formDTO) {
formDTO.setCategoryName(formDTO.getCategoryName().trim());
//分类名称是否唯一
LambdaQueryWrapper<IcServiceItemDictEntity> nameQuery = new LambdaQueryWrapper<>();
nameQuery.eq(IcServiceItemDictEntity::getCustomerId, formDTO.getCustomerId())
@ -90,10 +91,8 @@ public class IcServiceItemDictServiceImpl extends BaseServiceImpl<IcServiceItemD
baseDao.update(null, update);
return;
}
LambdaQueryWrapper<IcServiceItemDictEntity> maxQuery = new LambdaQueryWrapper<>();
maxQuery.eq(IcServiceItemDictEntity::getCustomerId, formDTO.getCustomerId())
.orderByDesc(IcServiceItemDictEntity::getCategoryCode).last("limit 1");
IcServiceItemDictEntity max = baseDao.selectOne(maxQuery);
//如果说当前查询的编码是1022,但是库里面1023已经存在且del_flag='0'。这个时候新增的编码为1023就会报错。
IcServiceItemDictEntity max = baseDao.selectMax(formDTO.getCustomerId());
// 获取编码
IcServiceItemDictEntity insert = new IcServiceItemDictEntity();
insert.setCustomerId(formDTO.getCustomerId());

4
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcResiDemandDictDao.xml

@ -192,9 +192,7 @@
CONVERT ( m.CATEGORY_CODE, UNSIGNED )) AS maxFirstCategoryCode
FROM
ic_resi_demand_dict m
WHERE
m.DEL_FLAG = '0'
AND m.CUSTOMER_ID = #{customerId}
WHERE m.CUSTOMER_ID = #{customerId}
AND m.`LEVEL` = #{level}
and m.parent_code=#{parentCode}
</select>

13
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcServiceItemDictDao.xml

@ -18,4 +18,17 @@
d.SORT DESC
</select>
<select id="selectMax" parameterType="java.lang.String" resultType="com.epmet.entity.IcServiceItemDictEntity">
SELECT
d.ID,
d.CATEGORY_CODE,
d.SORT
FROM
ic_service_item_dict d
WHERE
d.DEL_FLAG = '0'
AND d.CUSTOMER_ID = #{customerId}
order by CATEGORY_CODE desc
limit 1
</select>
</mapper>

33
epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/ic/IcPrivateDeploySupportProjectTask.java

@ -0,0 +1,33 @@
package com.epmet.task.ic;
import com.alibaba.fastjson.JSON;
import com.epmet.commons.tools.enums.BizTypeEnum;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.extract.form.ExtractOriginFormDTO;
import com.epmet.feign.DataStatisticalOpenFeignClient;
import com.epmet.task.ITask;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* desc数字社区私有化部署 任务之一还有autoEvaluateDemandTaskstatsDemandTaskdailyStatisticalVoteTask,IcPrivateDeploySupportUserPointTask
*/
@Slf4j
@Component("icPrivateDeploySupportProjectTask")
public class IcPrivateDeploySupportProjectTask implements ITask {
@Autowired
private DataStatisticalOpenFeignClient dataStatisticalOpenFeignClient;
@Override
public void run(String params) {
ExtractOriginFormDTO formDTO = new ExtractOriginFormDTO();
if (StringUtils.isNotBlank(params)) {
formDTO = JSON.parseObject(params, ExtractOriginFormDTO.class);
}
Result result = dataStatisticalOpenFeignClient.userPointAndProjectStatus(BizTypeEnum.PROJECT.getType(), formDTO);
log.info("icPrivateDeploySupportProjectTask excute end,param:{},result:{}",params,result);
}
}

33
epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/ic/IcPrivateDeploySupportUserPointTask.java

@ -0,0 +1,33 @@
package com.epmet.task.ic;
import com.alibaba.fastjson.JSON;
import com.epmet.commons.tools.enums.BizTypeEnum;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.extract.form.ExtractOriginFormDTO;
import com.epmet.feign.DataStatisticalOpenFeignClient;
import com.epmet.task.ITask;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* desc数字社区私有化部署 任务之一还有autoEvaluateDemandTaskstatsDemandTaskdailyStatisticalVoteTask,icPrivateDeploySupportProjectTask
*/
@Slf4j
@Component("icPrivateDeploySupportUserPointTask")
public class IcPrivateDeploySupportUserPointTask implements ITask {
@Autowired
private DataStatisticalOpenFeignClient dataStatisticalOpenFeignClient;
@Override
public void run(String params) {
ExtractOriginFormDTO formDTO = new ExtractOriginFormDTO();
if (StringUtils.isNotBlank(params)) {
formDTO = JSON.parseObject(params, ExtractOriginFormDTO.class);
}
Result result = dataStatisticalOpenFeignClient.userPointAndProjectStatus(BizTypeEnum.USER.getType(), formDTO);
log.info("icPrivateDeploySupportUserPointTask excute end,param:{},result:{}",params,result);
}
}

1
epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/DailyStatisticalVoteJobResultDTO.java

@ -17,6 +17,7 @@ public class DailyStatisticalVoteJobResultDTO implements Serializable {
private static final long serialVersionUID = 5266996778036448163L;
private String issueId;
private String customerId;
/**
* 统计日期

2
epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueVoteStatisticalDailyServiceImpl.java

@ -390,7 +390,7 @@ public class IssueVoteStatisticalDailyServiceImpl extends BaseServiceImpl<IssueV
Integer delNum;
do {
delNum = baseDao.delHistoryData(customerId, dateId);
} while (delNum != null && delNum > NumConstant.ZERO);
} while (delNum > NumConstant.ZERO);
List<List<IssueVoteStatisticalDailyEntity>> partition = ListUtils.partition(needInsert, NumConstant.ONE_HUNDRED);
partition.forEach(p -> {
baseDao.insertBatch(p);

1
epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueVoteDetailDao.xml

@ -195,6 +195,7 @@
t.* FROM
(SELECT
vd.ISSUE_ID,
vd.CUSTOMER_ID AS customerId,
COUNT(CASE WHEN vd.ATTITUDE = 'opposition' THEN 1 END) AS oppositionCount,
COUNT(CASE WHEN vd.ATTITUDE = 'opposition' THEN 1 END) AS oppositionIncrement,
COUNT(CASE WHEN vd.ATTITUDE = 'support' THEN 1 END) AS supportCount,

4
epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueVoteStatisticalDailyDao.xml

@ -147,7 +147,7 @@
votable_count,
customer_id,
created_by,
@ -180,7 +180,7 @@
#{item.votableCount},
#{item.customerId},
#{item.createdBy},

8
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java

@ -583,4 +583,12 @@ public interface GovOrgOpenFeignClient {
**/
@PostMapping(value = "/gov/org/customeragency/icresiuserorgmsg")
Result<IcResiUserOrgMsgResultDTO> icResiUserOrgMsg(@RequestBody IcResiUserOrgMsgFormDTO formDTO);
/**
* 查询单元
* @param id
* @return
*/
@GetMapping("/gov/org/icbuildingunit/{id}")
Result<IcBuildingUnitDTO> getUnitById(@PathVariable("id") String id);
}

4
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java

@ -379,4 +379,8 @@ public class GovOrgOpenFeignClientFallback implements GovOrgOpenFeignClient {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "icResiUserOrgMsg", formDTO);
}
@Override
public Result<IcBuildingUnitDTO> getUnitById(String id) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getUnitById", id);
}
}

1
epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ResiEventDao.xml

@ -242,6 +242,7 @@
<foreach item="epmetUserId" collection="epmetUserIdList" open="AND (" separator="or" close=")" index="">
re.REPORT_USER_ID = #{epmetUserId}
</foreach>
order by re.CREATED_TIME desc
</select>
<resultMap id="resiEventListResultMap" type="com.epmet.dto.result.ResiEventListResultDTO">

5
epmet-module/open-data-worker/open-data-worker-server/src/main/resources/bootstrap.yml

@ -112,11 +112,6 @@ hystrix:
isolation:
thread:
timeoutInMilliseconds: 60000 #缺省为1000
threadpool:
default:
coreSize: 10
maxQueueSize: 500
queueSizeRejectionThreshold: 500
ribbon:
ReadTimeout: 300000

11
epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/entity/CustomerEntity.java

@ -17,8 +17,9 @@
package com.epmet.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
@ -26,7 +27,7 @@ import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 客户表
* 客户表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-03-11
@ -38,6 +39,12 @@ public class CustomerEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* id
*/
@TableId(type = IdType.ASSIGN_UUID)
private String id;
/**
* 客户名称
*/

4
epmet-module/resi-hall/resi-hall-server/src/main/resources/bootstrap.yml

@ -69,6 +69,10 @@ hystrix:
isolation:
thread:
timeoutInMilliseconds: 60000 #缺省为1000
threadpool:
default:
# hystric最大线程个数,默认10,改为20
maximumSize: 20
ribbon:
ReadTimeout: 300000

4
epmet-module/resi-home/resi-home-server/src/main/resources/bootstrap.yml

@ -68,6 +68,10 @@ hystrix:
isolation:
thread:
timeoutInMilliseconds: 60000 #缺省为1000
threadpool:
default:
# hystric最大线程个数,默认10,改为20
maximumSize: 20
ribbon:
ReadTimeout: 300000

2
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java

@ -343,7 +343,7 @@ public class IcResiUserController {
.collect(Collectors.toList());
List<Map<String, Object>> resiResultList = null;
pageFormDTO.setPageSize(NumConstant.FIVE_HUNDRED);
pageFormDTO.setPageSize(NumConstant.TEN_THOUSAND);
for (IcResiUserTableEnum tableEnum : resiTableList) {
String tableName = tableEnum.getTableName();
pageFormDTO.setPageNo(NumConstant.ONE);

610
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserImportServiceImpl.java

@ -11,29 +11,35 @@ import com.epmet.bean.ResiImportResiCategoryChangedCache;
import com.epmet.bean.ResiImportChangedData;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.dto.result.OptionResultDTO;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.ExceptionUtils;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.feign.ResultDataResolver;
import com.epmet.commons.tools.redis.common.CustomerOrgRedis;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.redis.common.bean.GridInfoCache;
import com.epmet.commons.tools.security.user.LoginUserUtil;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dao.IcResiUserDao;
import com.epmet.dao.IcUserChangeDetailedDao;
import com.epmet.dao.IcUserChangeRecordDao;
import com.epmet.dao.IcUserTransferRecordDao;
import com.epmet.dto.*;
import com.epmet.dto.form.GridOptionFormDTO;
import com.epmet.dto.form.HouseFormDTO;
import com.epmet.dto.form.LoginUserDetailsFormDTO;
import com.epmet.dto.result.FormItemResult;
import com.epmet.dto.result.LoginUserDetailsResultDTO;
import com.epmet.dto.result.OptionDTO;
import com.epmet.dto.result.ResiCategoryItemResultDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.*;
import com.epmet.entity.IcResiUserEntity;
import com.epmet.entity.IcUserChangeDetailedEntity;
import com.epmet.entity.IcUserChangeRecordEntity;
import com.epmet.entity.IcUserTransferRecordEntity;
import com.epmet.enums.IcResiUserTableEnum;
import com.epmet.excel.handler.DynamicEasyExcelListener;
import com.epmet.feign.EpmetAdminOpenFeignClient;
import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.feign.GovOrgOpenFeignClient;
import com.epmet.feign.OperCustomizeOpenFeignClient;
import com.epmet.service.IcResiUserImportService;
import com.epmet.service.*;
import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
import lombok.Data;
@ -74,7 +80,7 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
/**
* 居民类别items列表
*/
public static final ThreadLocal<List<String>> resiCategoryItemsCache = new ThreadLocal<>();
public static final ThreadLocal<Map<String, String>> resiCategoryItemsCache = new ThreadLocal<>();
/**
* key: itemId
@ -103,6 +109,19 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
@Autowired
private OperCustomizeOpenFeignClient operCustomizeOpenFeignClient;
@Autowired
private IcUserChangeRecordDao icUserChangeRecordDao;
@Autowired
private IcUserChangeDetailedDao icUserChangeDetailedDao;
@Autowired
private IcUserTransferRecordDao icUserTransferRecordDao;
@Autowired
private UserService userService;
/**
* @description 列信息封装
*
@ -196,10 +215,11 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
userForm.setClient(loginUserClient);
userForm.setUserId(loginUserId);
LoginUserDetailsResultDTO loginUserDetails = getResultDataOrThrowsException(epmetUserOpenFeignClient.getLoginUserDetails(userForm), ServiceConstant.EPMET_USER_SERVER, EpmetErrorCode.SERVER_ERROR.getCode(), null, null);
String currUserAgencyId = loginUserDetails.getAgencyId();
String currUserAgencyId = userService.getLoginUserDetails(
loginUserUtil.getLoginUserApp(),
loginUserUtil.getLoginUserClient(),
loginUserUtil.getLoginUserId()).getAgencyId();
//String excelPathName = "/opt/test/基础信息表/resi_info.xls";
CustomerAgencyDTO agencyInfo = getResultDataOrThrowsException(govOrgOpenFeignClient.getAgencyById(currUserAgencyId), ServiceConstant.GOV_ORG_SERVER, EpmetErrorCode.SERVER_ERROR.getCode(), null, null);
String customerId = agencyInfo.getCustomerId();
@ -230,9 +250,15 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
// 执行人员类别变更记录
Map<String, ResiImportCategoryData> newResis = categoryChangedResi.get().getNewResis();
// todo 此处没测试
Map<String, ResiImportChangedData> categoryChangedResis = categoryChangedResi.get().getCategoryChangedResis();
Map<String, ResiImportChangedData> transferedResis = categoryChangedResi.get().getTransferedResis();
//保存调动或者变更记录
saveNewResiCategoryRecord(newResis);
saveResiCategoryChangedRecord(categoryChangedResis);
saveTransferedResiRecord(transferedResis);
try {
downLoadResults(response);
} catch (IOException e) {
@ -275,8 +301,9 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
String.format("【居民信息导入】查询居民类别items失败,customerId:%s", customerId),
"居民信息导入失败");
List<String> l = resiCategoryItems.stream().map(ResiCategoryItemResultDTO::getColumnName).collect(Collectors.toList());
resiCategoryItemsCache.set(l);
Map<String, String> columnNameAndLabel = resiCategoryItems.stream().collect(Collectors.toMap((o) -> o.getColumnName(), (o) -> o.getLabel()));
resiCategoryItemsCache.set(columnNameAndLabel);
}
/**
@ -434,7 +461,7 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
columnAndValues.put("ID", UUID.randomUUID().toString().replace("-", ""));
icResiUserDao.add(tableName, columnAndValues);
Map<String, String> categories = resiCategoryItemsCache.get()
Map<String, String> categories = resiCategoryItemsCache.get().keySet()
.stream()
.filter((categoryColumnName) -> "1".equals(columnAndValues.get(categoryColumnName)))
.collect(Collectors.toMap((k) -> k, (k) -> columnAndValues.get(k)));
@ -507,19 +534,6 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
String icResiId = icResiUserBaseInfo.getId();
//if (CollectionUtils.isNotEmpty(icResiUserDao.selectSubTableRecords(customerId, icResiId, targetTableName))) {
// log.info("身份证号为【{}】的居民【{}】信息已存在,跳过导入", idCard, targetTableName);
//
// SkipedRow skipedRow = new SkipedRow();
// skipedRow.setName(columnAndValues.get("NAME"));
// skipedRow.setIdCard(columnAndValues.get("ID_CARD"));
// skipedRow.setInfo("信息已存在,跳过导入");
// skipedRow.setTableName(targetTableName);
// skipedRows.get().get(targetTableName).add(skipedRow);
//
// continue;
//}
columnAndValues.put("IC_RESI_USER", icResiId);
columnAndValues.put("CUSTOMER_ID", loginUserUtil.getLoginUserCustomerId());
columnAndValues.put("UPDATED_BY", currentUserId);
@ -543,6 +557,9 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
icResiUserDao.add(targetTableName, columnAndValues);
}
// 保存到类别变更缓存中
saveSubTableInfoToCategoryChangedResiCache(icResiId, Objects.requireNonNull(IcResiUserTableEnum.getObjectByTableName(targetTableName)).getMainTableFlagColumnName());
} catch (Exception e) {
String errorMsg;
if (e instanceof RenException) {
@ -1005,36 +1022,9 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
workbook.write(response.getOutputStream());
}
public ResiImportCategoryData generateResiImportChangeData(String agencyId, String gridId, String villageId, String buildId, String unitId,
String homeId , Map<String, String> categories) {
ResiImportCategoryData ricd = new ResiImportCategoryData();
ricd.setAgencyId(agencyId);
ricd.setBuildId(buildId);
ricd.setGridId(gridId);
ricd.setVillageId(villageId);
ricd.setUnitId(unitId);
ricd.setHomeId(homeId);
ricd.setCategories(categories);
return ricd;
}
///**
// * 判断是否有组织维度的变化
// * @param existingResiMap
// * @param newResiMap
// * @return
// */
//public boolean isOrgDimChanged(Map<String, String> existingResiMap, Map<String, String> newResiMap) {
// return !existingResiMap.get("AGENCY_ID").equals(newResiMap.get("AGENCY_ID"))
// || !existingResiMap.get("GRID_ID").equals(newResiMap.get("GRID_ID"))
// || !existingResiMap.get("VILLAGE_ID").equals(newResiMap.get("VILLAGE_ID"))
// || !existingResiMap.get("BUILD_ID").equals(newResiMap.get("BUILD_ID"))
// || !existingResiMap.get("UNIT_ID").equals(newResiMap.get("UNIT_ID"))
// || !existingResiMap.get("HOME_ID").equals(newResiMap.get("HOME_ID"))
//}
/**
* 生成导入调动数据
* 1.新老数据中只要状态是1的都放入缓存
* @param existingResiMap
* @param newResiMap
* @return
@ -1055,7 +1045,7 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
HashMap<String, String> existingResiCategories = new HashMap<>();
HashMap<String, String> newResiCategories = new HashMap<>();
for (String categoryColumnName : resiCategoryItemsCache.get()) {
for (String categoryColumnName : resiCategoryItemsCache.get().keySet()) {
String oldCategoryValue = existingResiMap.get(categoryColumnName);
String newCategoryValue = newResiMap.get(categoryColumnName);
@ -1077,7 +1067,8 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
existingResiMap.get("HOME_ID"),
existingResiCategories);
ResiImportCategoryData newOne = new ResiImportCategoryData(existingResiMap.get("AGENCY_ID"),
ResiImportCategoryData newOne = new ResiImportCategoryData(
existingResiMap.get("AGENCY_ID"),
newResiMap.get("GRID_ID"),
newResiMap.get("VILLAGE_ID"),
newResiMap.get("BUILD_ID"),
@ -1090,6 +1081,7 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
/**
* 类别变更的居民信息封装
* 1.
* @param existingResiMap
* @param newResiMap
* @return
@ -1099,7 +1091,7 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
HashMap<String, String> oldCategories = new HashMap<>();
HashMap<String, String> newCategories = new HashMap<>();
List<String> categoryColumnNames = resiCategoryItemsCache.get();
Set<String> categoryColumnNames = resiCategoryItemsCache.get().keySet();
for (String categoryColumnName : categoryColumnNames) {
String existingColumnValue = existingResiMap.get(categoryColumnName);
String newColumnValue = newResiMap.get(categoryColumnName);
@ -1107,19 +1099,16 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
if (StringUtils.isAllBlank(existingColumnValue, newColumnValue)) {
// 都为空,则没发生变化
continue;
} else if (StringUtils.isNoneBlank(existingColumnValue, newColumnValue)) {
// 都不为空,则执行比较
} else {
// 先转为0再对比
if (StringUtils.isBlank(existingColumnValue)) existingColumnValue = "0";
if (StringUtils.isBlank(newColumnValue)) newColumnValue = "0";
if (!existingColumnValue.equals(newColumnValue)) {
oldCategories.put(categoryColumnName, existingColumnValue);
newCategories.put(categoryColumnName, newColumnValue);
continue;
}
} else {
// 一个为空一个不为空,则发生变化
oldCategories.put(categoryColumnName, existingColumnValue);
newCategories.put(categoryColumnName, newColumnValue);
}
}
if (oldCategories.size() == 0) {
@ -1145,4 +1134,491 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
return new ResiImportChangedData(oldOne, newOne);
}
/**
*
* @param icResiId 居民id
* @param columnName 该项信息在主表的列名
*/
private void saveSubTableInfoToCategoryChangedResiCache(String icResiId, String columnName) {
ResiImportResiCategoryChangedCache cc = categoryChangedResi.get();
Map<String, ResiImportCategoryData> newResis = cc.getNewResis();
Map<String, ResiImportChangedData> categoryChangedResis = cc.getCategoryChangedResis();
Map<String, ResiImportChangedData> transferedResis = cc.getTransferedResis();
ResiImportCategoryData newResi = newResis.get(icResiId);
if (newResi != null) {
//说明是新增居民
newResi.getCategories().put(columnName, "1");
return;
}
ResiImportChangedData categoryChangedData = categoryChangedResis.get(icResiId);
if (categoryChangedData != null) {
// 说明是类别变更的居民
Map<String, String> oldCategories = categoryChangedData.getOldData().getCategories();
Map<String, String> newCategories = categoryChangedData.getNewData().getCategories();
if (!oldCategories.containsKey(columnName)) {
// 没有这个类别,说明旧数据中是0,新数据中也是0,新数据改成1
oldCategories.put(columnName, "0");
newCategories.put(columnName, "1");
} else {
// 有这个类别,说明旧数据中是1,新数据中是0,新数据改成1,最后保存的时候,需要判断,新旧都是1,那么不创建变更记录
newCategories.put(columnName, "1");
}
return;
}
ResiImportChangedData transferedData = transferedResis.get(icResiId);
if (transferedData != null) {
// 说明是发生调动的居民,旧数据不用管了,新数据改成1
Map<String, String> newCategories = transferedData.getNewData().getCategories();
newCategories.put(columnName, "1");
return;
}
// 非新增,非调动,那么就是居民类别变更的,只不过变更的数据不在主sheet中,而在附sheet中
ResiImportCategoryData oldOne = new ResiImportCategoryData();
ResiImportCategoryData newOne = new ResiImportCategoryData();
oldOne.getCategories().put(columnName, "0");
newOne.getCategories().put(columnName, "1");
ResiImportChangedData cd = new ResiImportChangedData(oldOne, newOne);
categoryChangedResis.put(icResiId, cd);
}
/**
* 居民类别变更record
*/
public void saveResiCategoryChangedRecord(Map<String, ResiImportChangedData> categoryChangedResis) {
Date now = new Date();
CustomerStaffInfoCacheResult operator = CustomerStaffRedis.getStaffInfo(loginUserUtil.getLoginUserCustomerId(), loginUserUtil.getLoginUserId());
// 循环当前居民的所有类别的map
for (Map.Entry<String, ResiImportChangedData> entry : categoryChangedResis.entrySet()) {
String resiId = entry.getKey();
ResiImportCategoryData oldData = entry.getValue().getOldData();
ResiImportCategoryData newData = entry.getValue().getNewData();
Map<String, String> oldCategories = oldData.getCategories();
Map<String, String> newCategories = newData.getCategories();
StringBuilder sbBefore = new StringBuilder("");
StringBuilder sbAfter = new StringBuilder("");
//主表的语言描述
for (Map.Entry<String, String> newEntry : newCategories.entrySet()) {
String columnName = newEntry.getKey();
String newColumnValue = newEntry.getValue();
String oldColumnValue = oldCategories.get(columnName);
if (newColumnValue.equals(oldColumnValue)) {
continue;
}
String beforeValueName = "0".equals(oldColumnValue) ? "否" : "是";
String newValueName = "0".equals(newColumnValue) ? "否" : "是";
String label = resiCategoryItemsCache.get().get(columnName);
sbBefore.append(label).append(":").append(beforeValueName).append("\n");
sbAfter.append(label).append(":").append(newValueName).append("\n");
}
// 生成changeRecord并存入
IcResiUserEntity resiInfo = icResiUserDao.selectById(resiId);
IcUserChangeRecordEntity changeRecord = fillChangeRecord(loginUserUtil.getLoginUserCustomerId(), resiId, resiInfo.getName(), null, loginUserUtil.getLoginUserId(),
operator.getRealName() , sbBefore.toString(), sbAfter.toString(), "category", "类别", "", now);
icUserChangeRecordDao.insert(changeRecord);
for (Map.Entry<String, String> columnEntry : newCategories.entrySet()) {
String newValue = columnEntry.getValue();
String oldValue = oldCategories.get(columnEntry.getKey());
oldValue = oldValue == null ? "0" : oldValue;
if (newValue.equals(oldValue)) {
// 新旧值相等,跳过
continue;
}
int value = newValue.equals("1") && oldValue.equals("0") ? 1 : -1;
IcUserChangeDetailedEntity newDetail = fillChangeDetail(loginUserUtil.getLoginUserCustomerId(), resiId, changeRecord.getId(), newData.getAgencyId(),
newData.getGridId(), newData.getVillageId(), newData.getBuildId(), newData.getUnitId(),
newData.getHomeId(), "category", "类别", columnEntry.getKey(), value, resiInfo.getPids());
icUserChangeDetailedDao.insert(newDetail);
}
}
}
/**
* 保存新增居民类别记录
* @param newResis
*/
public void saveNewResiCategoryRecord(Map<String, ResiImportCategoryData> newResis) {
Date now = new Date();
CustomerStaffInfoCacheResult operator = CustomerStaffRedis.getStaffInfo(loginUserUtil.getLoginUserCustomerId(), loginUserUtil.getLoginUserId());
for (Map.Entry<String, ResiImportCategoryData> resi : newResis.entrySet()) {
String resiId = resi.getKey();
ResiImportCategoryData data = resi.getValue();
IcResiUserEntity resiInfo = icResiUserDao.selectById(resiId);
// 插入changeRecord
IcUserChangeRecordEntity changeRecord = fillChangeRecord(loginUserUtil.getLoginUserCustomerId(), resiId, resiInfo.getName(), null,
loginUserUtil.getLoginUserId(), operator.getRealName(), "-", "-",
"add", "新增", "", now);
icUserChangeRecordDao.insert(changeRecord);
// 插入changeDetail
for (Map.Entry<String, String> column : data.getCategories().entrySet()) {
IcUserChangeDetailedEntity changedetail = fillChangeDetail(loginUserUtil.getLoginUserCustomerId(), resiId, changeRecord.getId(), data.getAgencyId(),
data.getGridId(), data.getVillageId(), data.getBuildId(), data.getUnitId(),
data.getHomeId(), "add", "新增", column.getKey(), 1, resiInfo.getPids());
icUserChangeDetailedDao.insert(changedetail);
}
}
}
/**
* 调动居民变更记录
* @param transferedResis
*/
public void saveTransferedResiRecord(Map<String, ResiImportChangedData> transferedResis) {
Date now = new Date();
for (Map.Entry<String, ResiImportChangedData> resi : transferedResis.entrySet()) {
String customerId = loginUserUtil.getLoginUserCustomerId();
String resiId = resi.getKey();
ResiImportCategoryData oldData = resi.getValue().getOldData();
ResiImportCategoryData newData = resi.getValue().getNewData();
StringBuilder sbBefore = new StringBuilder();
StringBuilder sbAfter = new StringBuilder();
String oldAgencyId = oldData.getAgencyId();
String oldGridId = oldData.getGridId();
String oldvillageId = oldData.getVillageId();
String oldBuildId = oldData.getBuildId();
String oldUnitId = oldData.getUnitId();
String oldHomeId = oldData.getHomeId();
//
String newAgencyId = newData.getAgencyId();
String newGridId = newData.getGridId();
String newvillageId = newData.getVillageId();
String newBuildId = newData.getBuildId();
String newUnitId = newData.getUnitId();
String newHomeId = newData.getHomeId();
IcResiUserOrgMsgFormDTO oldOrgFormDTO = new IcResiUserOrgMsgFormDTO();
oldOrgFormDTO.setCustomerId(customerId);
oldOrgFormDTO.setAgencyId(oldData.getAgencyId());
oldOrgFormDTO.setGridId(oldData.getGridId());
oldOrgFormDTO.setNeighborHoodId(oldData.getVillageId());
oldOrgFormDTO.setBuildingId(oldData.getBuildId());
oldOrgFormDTO.setBuildingUnitId(oldData.getUnitId());
oldOrgFormDTO.setHouseId(oldData.getHomeId());
Result<IcResiUserOrgMsgResultDTO> oldOrgInfoRst = govOrgOpenFeignClient.icResiUserOrgMsg(oldOrgFormDTO);
IcResiUserOrgMsgFormDTO newOrgInfo = new IcResiUserOrgMsgFormDTO();
newOrgInfo.setCustomerId(customerId);
newOrgInfo.setAgencyId(newData.getAgencyId());
newOrgInfo.setGridId(newData.getGridId());
newOrgInfo.setNeighborHoodId(newData.getVillageId());
newOrgInfo.setBuildingId(newData.getBuildId());
newOrgInfo.setBuildingUnitId(newData.getUnitId());
newOrgInfo.setHouseId(newData.getHomeId());
Result<IcResiUserOrgMsgResultDTO> newOrgInfoRst = govOrgOpenFeignClient.icResiUserOrgMsg(newOrgInfo);
IcResiUserOrgMsgResultDTO oldOrg = null;
IcResiUserOrgMsgResultDTO newOrg = null;
if (oldOrgInfoRst.success()) {
oldOrg = oldOrgInfoRst.getData();
}
if (newOrgInfoRst.success()) {
newOrg = newOrgInfoRst.getData();
}
// 生成中文描述
if (oldOrg != null) {
CustomerGridDTO gridDTO = oldOrg.getGridDTO();
IcNeighborHoodDTO neighborHoodDTO = oldOrg.getNeighborHoodDTO();
IcBuildingDTO buildingDTO = oldOrg.getBuildingDTO();
IcBuildingUnitDTO buildingUnitDTO = oldOrg.getBuildingUnitDTO();
IcHouseDTO houseDTO = oldOrg.getHouseDTO();
if (gridDTO != null) {
sbBefore.append(gridDTO.getGridName());
}
if (neighborHoodDTO != null) {
sbBefore.append("-").append(neighborHoodDTO.getNeighborHoodName());
}
if (buildingDTO != null) {
sbBefore.append("-").append(buildingDTO.getBuildingName());
}
if (buildingUnitDTO != null) {
sbBefore.append("-").append(buildingUnitDTO.getUnitName());
}
if (houseDTO != null) {
sbBefore.append("-").append(houseDTO.getHouseName());
}
}
if (newOrg != null) {
CustomerGridDTO gridDTO = newOrg.getGridDTO();
IcNeighborHoodDTO neighborHoodDTO = newOrg.getNeighborHoodDTO();
IcBuildingDTO buildingDTO = newOrg.getBuildingDTO();
IcBuildingUnitDTO buildingUnitDTO = newOrg.getBuildingUnitDTO();
IcHouseDTO houseDTO = newOrg.getHouseDTO();
if (gridDTO != null) {
sbAfter.append(gridDTO.getGridName());
}
if (neighborHoodDTO != null) {
sbAfter.append("-").append(neighborHoodDTO.getNeighborHoodName());
}
if (buildingDTO != null) {
sbAfter.append("-").append(buildingDTO.getBuildingName());
}
if (buildingUnitDTO != null) {
sbAfter.append("-").append(buildingUnitDTO.getUnitName());
}
if (houseDTO != null) {
sbAfter.append("-").append(houseDTO.getHouseName());
}
}
CustomerStaffInfoCacheResult operator = CustomerStaffRedis.getStaffInfo(customerId, loginUserUtil.getLoginUserId());
IcResiUserEntity resiInfo = icResiUserDao.selectById(resiId);
// 保存 transferRecord
IcUserTransferRecordEntity transferRecord = fillTransferRecord(resiInfo, operator, customerId, oldAgencyId, oldGridId,
oldvillageId, oldBuildId, oldUnitId, oldHomeId, customerId,
newAgencyId, newGridId, newvillageId, newBuildId, newUnitId, newHomeId, oldOrg, newOrg);
icUserTransferRecordDao.insert(transferRecord);
// 保存 changeRecord
IcUserChangeRecordEntity changeRecord = fillChangeRecord(customerId, resiId, resiInfo.getName(), transferRecord.getId(), operator.getStaffId(),
operator.getRealName(), sbBefore.toString(), sbAfter.toString(), "transfer", "调动", "", now);
icUserChangeRecordDao.insert(changeRecord);
// 保存 changeDetail
for (Map.Entry<String, String> oldCategories : oldData.getCategories().entrySet()) {
String key = oldCategories.getKey();
String value = oldCategories.getValue();
// 之前是这个类型,那这个类型需要-1
IcUserChangeDetailedEntity changeDetail = fillChangeDetail(customerId, resiId, changeRecord.getId(), oldData.getAgencyId(),
oldData.getGridId(), oldData.getVillageId(), oldData.getBuildId(), oldData.getUnitId(),
oldData.getHomeId(), "category", "调动", key, -1, resiInfo.getPids());
icUserChangeDetailedDao.insert(changeDetail);
}
for (Map.Entry<String, String> newCategories : newData.getCategories().entrySet()) {
String key = newCategories.getKey();
String value = newCategories.getValue();
// 现在是这个类型,这个类型要+1
IcUserChangeDetailedEntity changeDetail = fillChangeDetail(customerId, resiId, changeRecord.getId(), newData.getAgencyId(),
newData.getGridId(), newData.getVillageId(), newData.getBuildId(), newData.getUnitId(),
newData.getHomeId(), "category", "调动", key, 1, resiInfo.getPids());
icUserChangeDetailedDao.insert(changeDetail);
}
}
}
/**
* 填充变更明细
* @param customerId
* @param resiId
* @param changeRecordId
* @param agencyId
* @param gridId
* @param neighborhoodId
* @param buildingId
* @param initId
* @param houseId
* @param type
* @param typeName
* @param fieldName
* @param value
* @param pids
* @return
*/
private IcUserChangeDetailedEntity fillChangeDetail(String customerId, String resiId, String changeRecordId, String agencyId, String gridId,
String neighborhoodId, String buildingId, String initId, String houseId,
String type, String typeName, String fieldName, Integer value, String pids) {
IcUserChangeDetailedEntity detail = new IcUserChangeDetailedEntity();
detail.setCustomerId(customerId);
detail.setIcUserChangeRecordId(changeRecordId);
detail.setPids(pids);
detail.setAgencyId(agencyId);
detail.setGridId(gridId);
detail.setNeighborHoodId(neighborhoodId);
detail.setBuildingId(buildingId);
detail.setBuildingUnitId(initId);
detail.setHouseId(houseId);
detail.setIcUserId(resiId);
detail.setType(type);
detail.setTypeName(typeName);
detail.setFieldName(fieldName);
detail.setValue(value);
return detail;
}
/**
* 填充变更记录
* @param customerId
* @param resiId
* @param resiName
* @param transferRecordId
* @param operatorId
* @param operatorName
* @param beforeChangeName
* @param afterChangeName
* @param type
* @param typeName
* @param remark
* @param changeTime
* @return
*/
private IcUserChangeRecordEntity fillChangeRecord(String customerId, String resiId, String resiName, String transferRecordId,
String operatorId, String operatorName, String beforeChangeName, String afterChangeName,
String type, String typeName, String remark, Date changeTime) {
IcUserChangeRecordEntity changeRecord = new IcUserChangeRecordEntity();
changeRecord.setAfterChangeName(afterChangeName);
changeRecord.setBeforeChangeName(beforeChangeName);
changeRecord.setChangeTime(changeTime);
changeRecord.setCustomerId(customerId);
changeRecord.setIcUserId(resiId);
changeRecord.setIcUserName(resiName);
changeRecord.setIcUserTransferRecordId(transferRecordId);
changeRecord.setOperatorId(operatorId);
changeRecord.setOperatorName(operatorName);
changeRecord.setRemark(remark);
changeRecord.setType(type);
changeRecord.setTypeName(typeName);
return changeRecord;
}
/**
* 填充调动记录
* @param resiInfo
* @param operator
* @param oldCustomerId
* @param oldAgencyId
* @param oldGridId
* @param oldVillageId
* @param oldBuildId
* @param oldUnitId
* @param oldHomeId
* @param newCustomerId
* @param newAgencyId
* @param newGridId
* @param newVillageId
* @param newBuildId
* @param newUnitId
* @param newHomeId
* @return
*/
private IcUserTransferRecordEntity fillTransferRecord(IcResiUserEntity resiInfo, CustomerStaffInfoCacheResult operator, String oldCustomerId, String oldAgencyId, String oldGridId,
String oldVillageId, String oldBuildId, String oldUnitId, String oldHomeId, String newCustomerId,
String newAgencyId, String newGridId, String newVillageId, String newBuildId, String newUnitId,
String newHomeId, IcResiUserOrgMsgResultDTO oldOrg, IcResiUserOrgMsgResultDTO newOrg) {
IcUserTransferRecordEntity recordEntity = new IcUserTransferRecordEntity();
recordEntity.setIcUserId(resiInfo.getId());
recordEntity.setOperatorId(operator.getStaffId());
recordEntity.setIcUserName(resiInfo.getName());
recordEntity.setOperatorName(operator.getRealName());
recordEntity.setOldCustomerId(oldCustomerId);
recordEntity.setOldAgencyId(oldAgencyId);
recordEntity.setOldAgencyName(oldOrg != null ? oldOrg.getAgencyDTO().getOrganizationName() : "");
recordEntity.setOldGridId(oldGridId);
recordEntity.setOldGridName(oldOrg != null ? oldOrg.getGridDTO().getGridName() : "");
recordEntity.setOldNeighborHoodId(oldVillageId);
recordEntity.setOldNeighborHoodName(oldOrg != null ? oldOrg.getNeighborHoodDTO().getNeighborHoodName() : "");
recordEntity.setOldBuildingId(oldBuildId);
recordEntity.setOldBuildingName(oldOrg != null ? oldOrg.getBuildingDTO().getBuildingName() : "");
recordEntity.setOldBuildingUnitId(oldUnitId);
recordEntity.setOldBuildingUnitName(oldOrg != null ? oldOrg.getBuildingUnitDTO().getUnitName() : "");
recordEntity.setOldHouseId(oldHomeId);
recordEntity.setOldHouseName(oldOrg != null ? oldOrg.getHouseDTO().getHouseName() : "");
recordEntity.setTransferTime(new Date());
recordEntity.setRemark("");
recordEntity.setNewCustomerId(newCustomerId);
recordEntity.setNewAgencyId(newAgencyId);
recordEntity.setNewAgencyName(newOrg != null ? newOrg.getAgencyDTO().getOrganizationName(): "");
recordEntity.setNewGridId(newGridId);
recordEntity.setNewGridName(newOrg != null ? newOrg.getGridDTO().getGridName(): "");
recordEntity.setNewNeighborHoodId(newVillageId);
recordEntity.setNewNeighborHoodName(newOrg != null ? newOrg.getNeighborHoodDTO().getNeighborHoodName(): "");
recordEntity.setNewBuildingId(newBuildId);
recordEntity.setNewBuildingName(newOrg != null ? newOrg.getBuildingDTO().getBuildingName(): "");
recordEntity.setNewBuildingUnitId(newUnitId);
recordEntity.setNewBuildingUnitName(newOrg != null ? newOrg.getBuildingUnitDTO().getUnitName(): "");
recordEntity.setNewHouseId(newHomeId);
recordEntity.setNewHouseName(newOrg != null ? newOrg.getHouseDTO().getHouseName(): "");
return recordEntity;
}
//private IcUserTransferRecordEntity fillTransferRecord(String resiId, String resiName, String operatorId, String operatorName, String oldCustomerId,
// String oldAgencyId, String oldAgencyName, String oldGridId, String oldGridName, String neighborhoodId,
// String neighborhoodName, String oldBuildingId, String oldBuildingName, ) {
//IcUserTransferRecordEntity recordEntity = new IcUserTransferRecordEntity();
//recordEntity.setIcUserId();
//recordEntity.setOperatorId();
//recordEntity.setIcUserName();
//recordEntity.setOperatorName();
//recordEntity.setOldCustomerId();
//recordEntity.setOldAgencyId();
//recordEntity.setOldAgencyName();
//recordEntity.setOldGridId();
//recordEntity.setOldGridName();
//recordEntity.setOldNeighborHoodId();
//recordEntity.setOldNeighborHoodName();
//recordEntity.setOldBuildingId();
//recordEntity.setOldBuildingName();
//recordEntity.setOldBuildingUnitId();
//recordEntity.setOldBuildingUnitName();
//recordEntity.setOldHouseId();
//recordEntity.setOldHouseName();
//recordEntity.setTransferTime();
//recordEntity.setRemark();
//recordEntity.setNewCustomerId();
//recordEntity.setNewAgencyId();
//recordEntity.setNewAgencyName();
//recordEntity.setNewGridId();
//recordEntity.setNewGridName();
//recordEntity.setNewNeighborHoodId();
//recordEntity.setNewNeighborHoodName();
//recordEntity.setNewBuildingId();
//recordEntity.setNewBuildingName();
//recordEntity.setNewBuildingUnitId();
//recordEntity.setNewBuildingUnitName();
//recordEntity.setNewHouseId();
//recordEntity.setNewHouseName();
//}
}

2
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcUserTransferRecordServiceImpl.java

@ -186,7 +186,7 @@ public class IcUserTransferRecordServiceImpl extends BaseServiceImpl<IcUserTrans
* @Author sun
* @Description 调动记录
**/
private IcUserTransferRecordEntity saveTransferRecord(CustomerStaffInfoCacheResult staffInfoCache, IcResiUserTransferFormDTO formDTO, IcResiUserDTO resiUserDTO, IcResiUserOrgMsgResultDTO result1, IcResiUserOrgMsgResultDTO result2) {
public IcUserTransferRecordEntity saveTransferRecord(CustomerStaffInfoCacheResult staffInfoCache, IcResiUserTransferFormDTO formDTO, IcResiUserDTO resiUserDTO, IcResiUserOrgMsgResultDTO result1, IcResiUserOrgMsgResultDTO result2) {
IcUserTransferRecordEntity recordEntity = new IcUserTransferRecordEntity();
recordEntity.setIcUserId(formDTO.getIcUserId());
recordEntity.setOperatorId(formDTO.getStaffId());

Loading…
Cancel
Save