Browse Source

Merge branch 'develop' of http://git.elinkit.com.cn:7070/r/epmet-cloud into release_temp

dev
jianjun 4 years ago
parent
commit
5d7b749e55
  1. 7
      epmet-auth-client/pom.xml
  2. 25
      epmet-auth-client/src/main/java/com/epmet/auth/dto/result/BlockChainStaffAuthResultDTO.java
  3. 21
      epmet-auth/src/main/java/com/epmet/controller/GovLoginController.java
  4. 20
      epmet-auth/src/main/java/com/epmet/controller/GovWebController.java
  5. 8
      epmet-auth/src/main/java/com/epmet/service/GovLoginService.java
  6. 9
      epmet-auth/src/main/java/com/epmet/service/GovWebService.java
  7. 25
      epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java
  8. 41
      epmet-auth/src/main/java/com/epmet/service/impl/GovWebServiceImpl.java
  9. 46
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/IcFormCodeEnum.java
  10. 2
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/UserDao.xml
  11. 5
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/ActConstant.java
  12. 14
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcServiceItemDictController.java
  13. 10
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcServiceItemDictService.java
  14. 19
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActInfoServiceImpl.java
  15. 29
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyActivityServiceImpl.java
  16. 26
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyUnitServiceImpl.java
  17. 25
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcServiceItemDictServiceImpl.java
  18. 13
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActDraftServiceImpl.java
  19. 40
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java
  20. 49
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/V0.0.10__update_service_item.sql
  21. 26
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java
  22. 3
      epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/CustomerFormQueryDTO.java
  23. 43
      epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/IndividualCategoryAllListResultDTO.java
  24. 5
      epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/IndividualCategoryListResultDTO.java
  25. 17
      epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/ResiCategoryItemResultDTO.java
  26. 7
      epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/OperCustomizeOpenFeignClient.java
  27. 5
      epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/fallback/OperCustomizeOpenFeignClientFallback.java
  28. 17
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcFormItemController.java
  29. 12
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcIndividualCategoryManageController.java
  30. 2
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/IcFormQueryBuilderEntity.java
  31. 12
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcFormItemService.java
  32. 9
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcIndividualCategoryManageService.java
  33. 32
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcFormItemServiceImpl.java
  34. 64
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcIndividualCategoryManageServiceImpl.java
  35. 3
      epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcIndividualCategoryManageDao.xml
  36. 3
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/DelIcResiUserFormDTO.java
  37. 3
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/DynamicQueryFormDTO.java
  38. 20
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcUserChangeRecordInitFormDTO.java
  39. 2
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StatsResiListFormDTO.java
  40. 8
      epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java
  41. 4
      epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java
  42. 51
      epmet-user/epmet-user-server/src/main/java/com/epmet/bean/ResiImportCategoryData.java
  43. 20
      epmet-user/epmet-user-server/src/main/java/com/epmet/bean/ResiImportChangedData.java
  44. 30
      epmet-user/epmet-user-server/src/main/java/com/epmet/bean/ResiImportResiCategoryChangedCache.java
  45. 16
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java
  46. 13
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcUserChangeRecordController.java
  47. 15
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StatsResiWarnController.java
  48. 6
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java
  49. 8
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcUserChangeDetailedDao.java
  50. 6
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcUserChangeRecordDao.java
  51. 5
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcUserChangeDetailedService.java
  52. 9
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcUserChangeRecordService.java
  53. 3
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/StatsResiWarnService.java
  54. 239
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserImportServiceImpl.java
  55. 2
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java
  56. 9
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcUserChangeDetailedServiceImpl.java
  57. 142
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcUserChangeRecordServiceImpl.java
  58. 6
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StatsResiWarnServiceImpl.java
  59. 6
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/VolunteerServiceImpl.java
  60. 2
      epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.24__alter_change_detailed.sql
  61. 58
      epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml
  62. 8
      epmet-user/epmet-user-server/src/main/resources/mapper/IcUserChangeDetailedDao.xml
  63. 13
      epmet-user/epmet-user-server/src/main/resources/mapper/IcUserChangeRecordDao.xml
  64. 3
      epmet-user/epmet-user-server/src/test/java/com/epmet/epmetuser/test/IcResiUserControllerTest.java

7
epmet-auth-client/pom.xml

@ -11,4 +11,11 @@
<artifactId>epmet-auth-client</artifactId>
<dependencies>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>epmet-commons-tools</artifactId>
<version>2.0.0</version>
</dependency>
</dependencies>
</project>

25
epmet-auth-client/src/main/java/com/epmet/auth/dto/result/BlockChainStaffAuthResultDTO.java

@ -0,0 +1,25 @@
package com.epmet.auth.dto.result;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @ClassName BlockChainStaffAuthResultDTO
* @Description 区块链用户认证结果
* @Author wangxianzhang
* @Date 2022/1/20 10:41 上午
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class BlockChainStaffAuthResultDTO {
private String userId;
private String realName;
private String phone;
private String headUrl;
private String agencyId;
private String agencyName;
}

21
epmet-auth/src/main/java/com/epmet/controller/GovLoginController.java

@ -122,26 +122,5 @@ public class GovLoginController {
List<StaffOrgsResultDTO> staffOrgs = govLoginService.getMyOrgByPassword(formDTO);
return new Result<List<StaffOrgsResultDTO>>().ok(staffOrgs);
}
/**
* 区块链web 系统身份认证
* @param input
* @return
*/
@PostMapping("/blockchain/authentication")
public Result blockChainGetStaffInfoByPwd(@RequestBody BcStaffAuthenticationFormDTO input) {
ValidatorUtils.validateEntity(input);
String customerId = input.getCustomerId();
String mobile = input.getMobile();
String password = input.getPassword();
String userId = govLoginService.blockChainStaffAuthenticationByPwd(customerId, mobile, password);
HashMap<String, String> m = new HashMap<>();
m.put("userId", userId);
return new Result().ok(m);
}
}

20
epmet-auth/src/main/java/com/epmet/controller/GovWebController.java

@ -1,8 +1,10 @@
package com.epmet.controller;
import com.epmet.auth.dto.result.BlockChainStaffAuthResultDTO;
import com.epmet.commons.tools.utils.RSASignature;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dto.form.BcStaffAuthenticationFormDTO;
import com.epmet.dto.form.GovWebLoginFormDTO;
import com.epmet.dto.result.UserTokenResultDTO;
import com.epmet.service.GovWebService;
@ -13,6 +15,8 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
/**
* @author sun
@ -63,5 +67,21 @@ public class GovWebController {
return new Result().ok(publicKey);
}
/**
* 区块链web 系统身份认证
* @param input
* @return
*/
@PostMapping("/blockchain/authentication")
public Result blockChainGetStaffInfoByPwd(@RequestBody BcStaffAuthenticationFormDTO input) {
ValidatorUtils.validateEntity(input);
String customerId = input.getCustomerId();
String mobile = input.getMobile();
String password = input.getPassword();
BlockChainStaffAuthResultDTO r = govWebService.blockChainStaffAuthenticationByPwd(customerId, mobile, password);
return new Result().ok(r);
}
}

8
epmet-auth/src/main/java/com/epmet/service/GovLoginService.java

@ -76,12 +76,4 @@ public interface GovLoginService {
* @Date 2020/6/30 22:43
**/
List<StaffOrgsResultDTO> getMyOrgByPassword(StaffOrgsFormDTO formDTO);
/**
* 区块链系统通过用户密码认证身份
* @param mobile
* @param password
* @return
*/
String blockChainStaffAuthenticationByPwd(String customerId, String mobile, String password);
}

9
epmet-auth/src/main/java/com/epmet/service/GovWebService.java

@ -1,5 +1,6 @@
package com.epmet.service;
import com.epmet.auth.dto.result.BlockChainStaffAuthResultDTO;
import com.epmet.dto.form.GovWebLoginFormDTO;
import com.epmet.dto.result.UserTokenResultDTO;
@ -16,4 +17,12 @@ public interface GovWebService {
* @Description PC工作端-工作人员登录
**/
UserTokenResultDTO login(GovWebLoginFormDTO formDTO);
/**
* 区块链系统通过用户密码认证身份
* @param mobile
* @param password
* @return
*/
BlockChainStaffAuthResultDTO blockChainStaffAuthenticationByPwd(String customerId, String mobile, String password);
}

25
epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java

@ -492,30 +492,5 @@ public class GovLoginServiceImpl implements GovLoginService, ResultDataResolver
}
return result.getData();
}
@Override
public String blockChainStaffAuthenticationByPwd(String customerId, String mobile, String password) {
GovWebOperLoginFormDTO form = new GovWebOperLoginFormDTO();
form.setCustomerId(customerId);
form.setMobile(mobile);
GovWebOperLoginResultDTO staff = getResultDataOrThrowsException(epmetUserFeignClient.getStaffIdAndPwd(form), ServiceConstant.EPMET_USER_SERVER,
EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),
String.format("【区块链获取用户信息】根据手机号%s和指定客户ID:%s查找用户信息失败", mobile, customerId),
"查询用户失败");
if (staff == null) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),
String.format("【区块链获取用户信息】根据手机号%s和指定客户ID:%s查找用户信息失败", mobile, customerId));
}
if (!PasswordUtils.matches(password, staff.getPassWord())) {
// 密码不匹配
throw new EpmetException(EpmetErrorCode.ERR10004.getCode(), String.format("【区块链获取用户信息】密码不匹配,手机号:%s", mobile));
}
return staff.getUserId();
}
}

41
epmet-auth/src/main/java/com/epmet/service/impl/GovWebServiceImpl.java

@ -1,13 +1,21 @@
package com.epmet.service.impl;
import com.epmet.auth.dto.result.BlockChainStaffAuthResultDTO;
import com.epmet.common.token.constant.LoginConstant;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.feign.ResultDataResolver;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.security.dto.GovTokenDto;
import com.epmet.commons.tools.security.password.PasswordUtils;
import com.epmet.commons.tools.utils.CpUserDetailRedis;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.CustomerStaffDTO;
import com.epmet.dto.form.CustomerStaffFormDTO;
import com.epmet.dto.form.GovWebLoginFormDTO;
import com.epmet.dto.form.GovWebOperLoginFormDTO;
import com.epmet.dto.result.GovWebOperLoginResultDTO;
@ -32,7 +40,7 @@ import java.util.Map;
*/
@Slf4j
@Service
public class GovWebServiceImpl implements GovWebService {
public class GovWebServiceImpl implements GovWebService, ResultDataResolver {
private static final Logger logger = LoggerFactory.getLogger(GovWebServiceImpl.class);
@Autowired
@ -131,5 +139,36 @@ public class GovWebServiceImpl implements GovWebService {
return token;
}
@Override
public BlockChainStaffAuthResultDTO blockChainStaffAuthenticationByPwd(String customerId, String mobile, String password) {
GovWebOperLoginFormDTO form = new GovWebOperLoginFormDTO();
form.setCustomerId(customerId);
form.setMobile(mobile);
// 用户认证
GovWebOperLoginResultDTO staff = getResultDataOrThrowsException(epmetUserFeignClient.getStaffIdAndPwd(form), ServiceConstant.EPMET_USER_SERVER,
EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),
String.format("【区块链用户认证】根据手机号%s和指定客户ID:%s认证用户失败", mobile, customerId),
"认证失败");
if (staff == null) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),
String.format("【区块链用户认证】根据手机号%s和指定客户ID:%s认证用户失败", mobile, customerId));
}
if (!PasswordUtils.matches(password, staff.getPassWord())) {
// 密码不匹配
throw new EpmetException(EpmetErrorCode.ERR10004.getCode(), String.format("【区块链用户认证】密码不匹配,手机号:%s", mobile));
}
// 用户基础信息
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(customerId, staff.getUserId());
BlockChainStaffAuthResultDTO r = new BlockChainStaffAuthResultDTO(staff.getUserId(), staffInfo.getRealName(),
staffInfo.getMobile(), staffInfo.getHeadPhoto(), staffInfo.getAgencyId(), staffInfo.getAgencyName());
return r;
}
}

46
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/IcFormCodeEnum.java

@ -0,0 +1,46 @@
package com.epmet.commons.tools.enums;
/**
* desc数字社区平台-表单配置枚举类
*
* @author jianjun liu
* @date 2020-07-03 11:14
**/
public enum IcFormCodeEnum {
/**
* 表单code枚举
*/
RESI_BASE_INFO("resi_base_info", "居民信息"),
;
private String code;
private String name;
IcFormCodeEnum(String code, String name) {
this.code = code;
this.name = name;
}
public static IcFormCodeEnum getEnum(String code) {
IcFormCodeEnum[] values = IcFormCodeEnum.values();
for (IcFormCodeEnum value : values) {
if (value.getCode().equals(code)) {
return value;
}
}
return null;
}
public String getCode() {
return code;
}
public String getName() {
return name;
}
}

2
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/UserDao.xml

@ -1152,7 +1152,7 @@
and temp.result=1
</if>
<if test="type != null and type == 'qc'">
and temp.result !=1
and temp.result = -1
</if>
group by temp.orgId,temp.FIELD_NAME
</select>

5
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/ActConstant.java

@ -169,9 +169,4 @@ public interface ActConstant {
* 活动类型-联建活动
*/
String PARTY = "party";
/**
* 服务事项code
*/
String SERVICE_MATTER_CODE = "1010";
}

14
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcServiceItemDictController.java

@ -9,6 +9,7 @@ import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dto.form.demand.ServiceItemAddFormDTO;
import com.epmet.dto.form.demand.ServiceItemPageFormDTO;
import com.epmet.dto.form.demand.StatusFormDTO;
import com.epmet.dto.result.demand.OptionDTO;
import com.epmet.dto.result.demand.ServiceItemResultDTO;
import com.epmet.service.IcServiceItemDictService;
import org.springframework.beans.factory.annotation.Autowired;
@ -17,6 +18,8 @@ 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;
/**
* 服务事项分类字典表
*
@ -68,4 +71,15 @@ public class IcServiceItemDictController {
icServiceItemDictService.updateStatus(formDTO);
return new Result();
}
/**
* 新增联建单位查询服务事项列表
*
* @param tokenDto
* @return
*/
@PostMapping("dict-list")
public Result<List<OptionDTO>> queryDictList(@LoginUser TokenDto tokenDto){
return new Result<List<OptionDTO>>().ok(icServiceItemDictService.queryDictList(tokenDto.getCustomerId()));
}
}

10
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcServiceItemDictService.java

@ -22,9 +22,12 @@ import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.form.demand.ServiceItemAddFormDTO;
import com.epmet.dto.form.demand.ServiceItemPageFormDTO;
import com.epmet.dto.form.demand.StatusFormDTO;
import com.epmet.dto.result.demand.OptionDTO;
import com.epmet.dto.result.demand.ServiceItemResultDTO;
import com.epmet.entity.IcServiceItemDictEntity;
import java.util.List;
/**
* 服务事项分类字典表
*
@ -52,4 +55,11 @@ public interface IcServiceItemDictService extends BaseService<IcServiceItemDictE
* @return
*/
void updateStatus(StatusFormDTO formDTO);
/**
* 新增联建单位查询服务事项列表
* @param customerId
* @return
*/
List<OptionDTO> queryDictList(String customerId);
}

19
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActInfoServiceImpl.java

@ -35,17 +35,14 @@ import com.epmet.dao.ActUserRelationDao;
import com.epmet.dao.HeartUserInfoDao;
import com.epmet.dto.ActInfoDTO;
import com.epmet.dto.IcPartyUnitDTO;
import com.epmet.dto.form.demand.SubCodeFormDTO;
import com.epmet.dto.form.resi.*;
import com.epmet.dto.result.demand.OptionDTO;
import com.epmet.dto.result.resi.*;
import com.epmet.entity.ActInfoEntity;
import com.epmet.entity.ActUserRelationEntity;
import com.epmet.service.ActInfoService;
import com.epmet.service.ActUserRelationService;
import com.epmet.service.IcPartyUnitService;
import com.epmet.service.IcResiDemandDictService;
import com.epmet.service.*;
import com.epmet.utils.CaculateDistance;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@ -77,9 +74,9 @@ public class ActInfoServiceImpl extends BaseServiceImpl<ActInfoDao, ActInfoEntit
@Autowired
private HeartUserInfoDao heartUserInfoDao;
@Resource
private IcResiDemandDictService icResiDemandDictService;
@Resource
private IcPartyUnitService icPartyUnitService;
@Resource
private IcServiceItemDictService icServiceItemDictService;
@Override
public PageData<ActInfoDTO> page(Map<String, Object> params) {
@ -260,11 +257,9 @@ public class ActInfoServiceImpl extends BaseServiceImpl<ActInfoDao, ActInfoEntit
if (StringUtils.isNotBlank(detailResultDTO.getServiceMatter())) {
//获取服务事项
SubCodeFormDTO codeFormDTO = new SubCodeFormDTO();
codeFormDTO.setCustomerId(tokenDto.getCustomerId());
codeFormDTO.setParentCategoryCode(ActConstant.SERVICE_MATTER_CODE);
Map<String, String> categoryMap = icResiDemandDictService.querySubCodeList(codeFormDTO).stream().collect(Collectors.toMap(OptionDTO::getValue, OptionDTO::getLabel));
detailResultDTO.setServiceMatterName(categoryMap.get(detailResultDTO.getServiceMatter()));
List<OptionDTO> serviceItemList=icServiceItemDictService.queryDictList(tokenDto.getCustomerId());
Map<String, String> categoryMap=serviceItemList.stream().collect(Collectors.toMap(OptionDTO::getValue, OptionDTO::getLabel));
detailResultDTO.setServiceMatterName(MapUtils.isNotEmpty(categoryMap) && categoryMap.containsKey(detailResultDTO.getServiceMatter()) ? categoryMap.get(detailResultDTO.getServiceMatter()) : StrConstant.EPMETY_STR);
}
if (StringUtils.isNotBlank(detailResultDTO.getUnitId())) {
//获取单位名称

29
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyActivityServiceImpl.java

@ -35,14 +35,13 @@ import com.epmet.dao.IcPartyActivityDao;
import com.epmet.dto.IcPartyActivityDTO;
import com.epmet.dto.IcPartyUnitDTO;
import com.epmet.dto.form.PartyActivityFormDTO;
import com.epmet.dto.form.demand.SubCodeFormDTO;
import com.epmet.dto.result.ActivityStatisticsDTO;
import com.epmet.dto.result.demand.OptionDTO;
import com.epmet.entity.IcPartyActivityEntity;
import com.epmet.excel.IcPartyActivityImportExcel;
import com.epmet.service.IcPartyActivityService;
import com.epmet.service.IcPartyUnitService;
import com.epmet.service.IcResiDemandDictService;
import com.epmet.service.IcServiceItemDictService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
@ -71,11 +70,8 @@ public class IcPartyActivityServiceImpl extends BaseServiceImpl<IcPartyActivityD
@Resource
private IcPartyUnitService icPartyUnitService;
@Resource
private IcResiDemandDictService icResiDemandDictService;
/**
* 服务事项code
*/
private static final String SERVICE_MATTER_CODE = "1010";
private IcServiceItemDictService icServiceItemDictService;
@Override
public PageData<IcPartyActivityDTO> search(PartyActivityFormDTO formDTO) {
@ -159,10 +155,9 @@ public class IcPartyActivityServiceImpl extends BaseServiceImpl<IcPartyActivityD
return null;
}
//获取服务事项名称
SubCodeFormDTO codeFormDTO = new SubCodeFormDTO();
codeFormDTO.setCustomerId(entity.getCustomerId());
codeFormDTO.setParentCategoryCode(SERVICE_MATTER_CODE);
Map<String, String> categoryMap = icResiDemandDictService.querySubCodeList(codeFormDTO).stream().collect(Collectors.toMap(OptionDTO::getValue, OptionDTO::getLabel));
List<OptionDTO> serviceItemList=icServiceItemDictService.queryDictList(entity.getCustomerId());
Map<String, String> categoryMap=serviceItemList.stream().collect(Collectors.toMap(OptionDTO::getValue, OptionDTO::getLabel));
IcPartyActivityDTO dto = ConvertUtils.sourceToTarget(entity, IcPartyActivityDTO.class);
dto.setServiceMatterName(categoryMap.get(dto.getServiceMatter()));
//获取单位名称
@ -225,10 +220,8 @@ public class IcPartyActivityServiceImpl extends BaseServiceImpl<IcPartyActivityD
CustomerStaffInfoCacheResult staffInfoCache = CustomerStaffRedis.getStaffInfo(tokenDto.getCustomerId(), tokenDto.getUserId());
//获取服务事项
SubCodeFormDTO codeFormDTO = new SubCodeFormDTO();
codeFormDTO.setCustomerId(tokenDto.getCustomerId());
codeFormDTO.setParentCategoryCode(SERVICE_MATTER_CODE);
Map<String, String> categoryMap = icResiDemandDictService.querySubCodeList(codeFormDTO).stream().collect(Collectors.toMap(OptionDTO::getLabel, OptionDTO::getValue));
List<OptionDTO> serviceItemList=icServiceItemDictService.queryDictList(tokenDto.getCustomerId());
Map<String, String> categoryMap=serviceItemList.stream().collect(Collectors.toMap(OptionDTO::getValue, OptionDTO::getLabel));
//获取联建单位
IcPartyUnitDTO unitDTO = new IcPartyUnitDTO();
unitDTO.setAgencyId(staffInfoCache.getAgencyId());
@ -369,10 +362,8 @@ public class IcPartyActivityServiceImpl extends BaseServiceImpl<IcPartyActivityD
//获取联建单位
Map<String, String> option = icPartyUnitService.options(unitDTO).stream().collect(Collectors.toMap(OptionDTO::getValue, OptionDTO::getLabel));
//获取服务事项字典
SubCodeFormDTO codeFormDTO = new SubCodeFormDTO();
codeFormDTO.setCustomerId(tokenDto.getCustomerId());
codeFormDTO.setParentCategoryCode(SERVICE_MATTER_CODE);
Map<String, String> categoryMap = icResiDemandDictService.querySubCodeList(codeFormDTO).stream().collect(Collectors.toMap(OptionDTO::getValue, OptionDTO::getLabel));
List<OptionDTO> serviceItemList=icServiceItemDictService.queryDictList(tokenDto.getCustomerId());
Map<String, String> categoryMap=serviceItemList.stream().collect(Collectors.toMap(OptionDTO::getValue, OptionDTO::getLabel));
//数据组装
dtoList.forEach(dto -> {
dto.setServiceMatterName(categoryMap.get(dto.getServiceMatter()));

26
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyUnitServiceImpl.java

@ -45,7 +45,6 @@ import com.epmet.dto.IcPartyUnitDTO;
import com.epmet.dto.form.PartyActivityFormDTO;
import com.epmet.dto.form.PartyUnitFormDTO;
import com.epmet.dto.form.demand.ServiceQueryFormDTO;
import com.epmet.dto.form.demand.SubCodeFormDTO;
import com.epmet.dto.result.PartyUnitDistributionResultDTO;
import com.epmet.dto.result.demand.OptionDTO;
import com.epmet.dto.result.demand.ServiceStatDTO;
@ -54,6 +53,7 @@ import com.epmet.excel.IcPartyUnitImportExcel;
import com.epmet.feign.EpmetAdminOpenFeignClient;
import com.epmet.service.IcPartyUnitService;
import com.epmet.service.IcResiDemandDictService;
import com.epmet.service.IcServiceItemDictService;
import com.epmet.service.IcUserDemandRecService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
@ -87,7 +87,8 @@ public class IcPartyUnitServiceImpl extends BaseServiceImpl<IcPartyUnitDao, IcPa
private IcUserDemandRecService icUserDemandRecService;
@Resource
private IcResiDemandDictService icResiDemandDictService;
@Resource
private IcServiceItemDictService icServiceItemDictService;
@Override
public PageData<IcPartyUnitDTO> search(PartyUnitFormDTO formDTO) {
@ -104,10 +105,10 @@ public class IcPartyUnitServiceImpl extends BaseServiceImpl<IcPartyUnitDao, IcPa
PageInfo<IcPartyUnitEntity> pageInfo = new PageInfo<>(list);
List<IcPartyUnitDTO> dtoList = ConvertUtils.sourceToTarget(list, IcPartyUnitDTO.class);
Result<Map<String, String>> unitTypeMap = epmetAdminOpenFeignClient.dictMap(DictTypeEnum.PARTY_UNIT_TYPE.getCode());
SubCodeFormDTO codeFormDTO = new SubCodeFormDTO();
codeFormDTO.setCustomerId(formDTO.getCustomerId());
codeFormDTO.setParentCategoryCode("1010");
Map<String, String> categoryMap = icResiDemandDictService.querySubCodeList(codeFormDTO).stream().collect(Collectors.toMap(OptionDTO::getValue, OptionDTO::getLabel));
//服务事项列表从需求分类中抽离出来,改为查询ic_service_item_dict表
List<OptionDTO> serviceItemList=icServiceItemDictService.queryDictList(formDTO.getCustomerId());
Map<String, String> categoryMap=serviceItemList.stream().collect(Collectors.toMap(OptionDTO::getValue, OptionDTO::getLabel));
dtoList.forEach(item -> {
item.setType(unitTypeMap.getData().get(item.getType()));
if (StringUtils.isNotBlank(item.getServiceMatter())) {
@ -138,10 +139,9 @@ public class IcPartyUnitServiceImpl extends BaseServiceImpl<IcPartyUnitDao, IcPa
List<IcPartyUnitEntity> list = baseDao.selectList(wrapper);
List<IcPartyUnitDTO> dtoList = ConvertUtils.sourceToTarget(list, IcPartyUnitDTO.class);
Result<Map<String, String>> unitTypeMap = epmetAdminOpenFeignClient.dictMap(DictTypeEnum.PARTY_UNIT_TYPE.getCode());
SubCodeFormDTO codeFormDTO = new SubCodeFormDTO();
codeFormDTO.setCustomerId(formDTO.getCustomerId());
codeFormDTO.setParentCategoryCode("1010");
Map<String, String> categoryMap = icResiDemandDictService.querySubCodeList(codeFormDTO).stream().collect(Collectors.toMap(OptionDTO::getValue, OptionDTO::getLabel));
//服务事项列表从需求分类中抽离出来,改为查询ic_service_item_dict表
List<OptionDTO> serviceItemList=icServiceItemDictService.queryDictList(formDTO.getCustomerId());
Map<String, String> categoryMap=serviceItemList.stream().collect(Collectors.toMap(OptionDTO::getValue, OptionDTO::getLabel));
dtoList.forEach(item -> {
item.setType(unitTypeMap.getData().get(item.getType()));
if (StringUtils.isNotBlank(item.getServiceMatter())) {
@ -312,10 +312,8 @@ public class IcPartyUnitServiceImpl extends BaseServiceImpl<IcPartyUnitDao, IcPa
if (null == staffInfoCache) {
throw new EpmetException(8000, "获取用户缓存失败");
}
SubCodeFormDTO codeFormDTO = new SubCodeFormDTO();
codeFormDTO.setCustomerId(tokenDto.getCustomerId());
codeFormDTO.setParentCategoryCode("1010");
Map<String, String> categoryMap = icResiDemandDictService.querySubCodeList(codeFormDTO).stream().collect(Collectors.toMap(OptionDTO::getLabel, OptionDTO::getValue));
List<OptionDTO> serviceItemList=icServiceItemDictService.queryDictList(tokenDto.getCustomerId());
Map<String, String> categoryMap=serviceItemList.stream().collect(Collectors.toMap(OptionDTO::getValue, OptionDTO::getLabel));
//1.数据校验
Iterator<IcPartyUnitImportExcel> iterator = result.iterator();
while (iterator.hasNext()) {

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

@ -28,6 +28,7 @@ import com.epmet.dao.IcServiceItemDictDao;
import com.epmet.dto.form.demand.ServiceItemAddFormDTO;
import com.epmet.dto.form.demand.ServiceItemPageFormDTO;
import com.epmet.dto.form.demand.StatusFormDTO;
import com.epmet.dto.result.demand.OptionDTO;
import com.epmet.dto.result.demand.ServiceItemResultDTO;
import com.epmet.entity.IcServiceItemDictEntity;
import com.epmet.service.IcServiceItemDictService;
@ -37,6 +38,7 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@ -122,5 +124,28 @@ public class IcServiceItemDictServiceImpl extends BaseServiceImpl<IcServiceItemD
baseDao.update(null, update);
}
/**
* 新增联建单位查询服务事项列表
*
* @param customerId
* @return
*/
@Override
public List<OptionDTO> queryDictList(String customerId) {
List<OptionDTO> resultList=new ArrayList<>();
LambdaQueryWrapper<IcServiceItemDictEntity> query = new LambdaQueryWrapper<>();
query.eq(IcServiceItemDictEntity::getCustomerId, customerId)
.orderByAsc(IcServiceItemDictEntity::getSort);
List<IcServiceItemDictEntity> list=baseDao.selectList(query);
for(IcServiceItemDictEntity entity:list){
OptionDTO optionDTO=new OptionDTO();
optionDTO.setLabel(entity.getCategoryName());
optionDTO.setValue(entity.getCategoryCode());
optionDTO.setAwardPoint(entity.getAwardPoint());
resultList.add(optionDTO);
}
return resultList;
}
}

13
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActDraftServiceImpl.java

@ -6,7 +6,6 @@ import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.dto.IcPartyUnitDTO;
import com.epmet.dto.LatestActContentDTO;
import com.epmet.dto.LatestActInfoDTO;
import com.epmet.dto.form.demand.SubCodeFormDTO;
import com.epmet.dto.form.work.ActPreviewFormDTO;
import com.epmet.dto.form.work.DraftActContentFormDTO;
import com.epmet.dto.form.work.DraftActInfoFormDTO;
@ -43,14 +42,10 @@ public class WorkActDraftServiceImpl implements WorkActDraftService {
@Autowired
private LatestActContentService latestActContentService;
@Resource
private IcResiDemandDictService icResiDemandDictService;
private IcServiceItemDictService icServiceItemDictService;
@Resource
private IcPartyUnitService icPartyUnitService;
/**
* 服务事项code
*/
private static final String SERVICE_MATTER_CODE = "1010";
/**
* @return com.epmet.dto.form.work.PublishActInitResultDTO
@ -142,10 +137,8 @@ public class WorkActDraftServiceImpl implements WorkActDraftService {
if (StringUtils.isNotBlank(actPreviewResultDTO.getServiceMatter())) {
//获取服务事项
SubCodeFormDTO codeFormDTO = new SubCodeFormDTO();
codeFormDTO.setCustomerId(formDTO.getCustomerId());
codeFormDTO.setParentCategoryCode(SERVICE_MATTER_CODE);
Map<String, String> categoryMap = icResiDemandDictService.querySubCodeList(codeFormDTO).stream().collect(Collectors.toMap(OptionDTO::getValue, OptionDTO::getLabel));
List<OptionDTO> serviceItemList=icServiceItemDictService.queryDictList(formDTO.getCustomerId());
Map<String, String> categoryMap=serviceItemList.stream().collect(Collectors.toMap(OptionDTO::getValue, OptionDTO::getLabel));
actPreviewResultDTO.setServiceMatterName(categoryMap.get(actPreviewResultDTO.getServiceMatter()));
}
if (StringUtils.isNotBlank(actPreviewResultDTO.getUnitId())) {

40
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java

@ -25,7 +25,6 @@ import com.epmet.dto.*;
import com.epmet.dto.form.SystemMsgFormDTO;
import com.epmet.dto.form.UserMessageFormDTO;
import com.epmet.dto.form.WxSubscribeMessageFormDTO;
import com.epmet.dto.form.demand.SubCodeFormDTO;
import com.epmet.dto.form.work.*;
import com.epmet.dto.result.ActSponsorResultDTO;
import com.epmet.dto.result.demand.OptionDTO;
@ -34,6 +33,7 @@ import com.epmet.entity.*;
import com.epmet.feign.EpmetMessageOpenFeignClient;
import com.epmet.feign.GovOrgOpenFeignClient;
import com.epmet.service.*;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@ -99,10 +99,9 @@ public class WorkActServiceImpl implements WorkActService {
@Resource
private IcPartyActivityService icPartyActivityService;
@Resource
private IcResiDemandDictService icResiDemandDictService;
@Resource
private IcPartyUnitService icPartyUnitService;
@Resource
private IcServiceItemDictService icServiceItemDictService;
/**
@ -782,11 +781,10 @@ public class WorkActServiceImpl implements WorkActService {
if (StringUtils.isNotBlank(canceledActDetailResultDTO.getServiceMatter())) {
//获取服务事项
SubCodeFormDTO codeFormDTO = new SubCodeFormDTO();
codeFormDTO.setCustomerId(customerId);
codeFormDTO.setParentCategoryCode(ActConstant.SERVICE_MATTER_CODE);
Map<String, String> categoryMap = icResiDemandDictService.querySubCodeList(codeFormDTO).stream().collect(Collectors.toMap(OptionDTO::getValue, OptionDTO::getLabel));
canceledActDetailResultDTO.setServiceMatterName(categoryMap.get(canceledActDetailResultDTO.getServiceMatter()));
List<OptionDTO> serviceItemList = icServiceItemDictService.queryDictList(customerId);
Map<String, String> categoryMap = serviceItemList.stream().collect(Collectors.toMap(OptionDTO::getValue, OptionDTO::getLabel));
canceledActDetailResultDTO.setServiceMatterName(MapUtils.isNotEmpty(categoryMap) && categoryMap.containsKey(canceledActDetailResultDTO.getServiceMatter()) ?
categoryMap.get(canceledActDetailResultDTO.getServiceMatter()) : StrConstant.EPMETY_STR);
}
if (StringUtils.isNotBlank(canceledActDetailResultDTO.getUnitId())) {
//获取单位名称
@ -840,11 +838,9 @@ public class WorkActServiceImpl implements WorkActService {
if (StringUtils.isNotBlank(resultDTO.getServiceMatter())) {
//获取服务事项
SubCodeFormDTO codeFormDTO = new SubCodeFormDTO();
codeFormDTO.setCustomerId(formDTO.getCustomerId());
codeFormDTO.setParentCategoryCode(ActConstant.SERVICE_MATTER_CODE);
Map<String, String> categoryMap = icResiDemandDictService.querySubCodeList(codeFormDTO).stream().collect(Collectors.toMap(OptionDTO::getValue, OptionDTO::getLabel));
resultDTO.setServiceMatterName(categoryMap.get(resultDTO.getServiceMatter()));
List<OptionDTO> serviceItemList = icServiceItemDictService.queryDictList(formDTO.getCustomerId());
Map<String, String> categoryMap = serviceItemList.stream().collect(Collectors.toMap(OptionDTO::getValue, OptionDTO::getLabel));
resultDTO.setServiceMatterName(MapUtils.isNotEmpty(categoryMap) && categoryMap.containsKey(resultDTO.getServiceMatter()) ? categoryMap.get(resultDTO.getServiceMatter()) : StrConstant.EPMETY_STR);
}
if (StringUtils.isNotBlank(resultDTO.getUnitId())) {
//获取单位名称
@ -921,11 +917,9 @@ public class WorkActServiceImpl implements WorkActService {
}
if (StringUtils.isNotBlank(resultDTO.getServiceMatter())) {
//获取服务事项
SubCodeFormDTO codeFormDTO = new SubCodeFormDTO();
codeFormDTO.setCustomerId(customerId);
codeFormDTO.setParentCategoryCode(ActConstant.SERVICE_MATTER_CODE);
Map<String, String> categoryMap = icResiDemandDictService.querySubCodeList(codeFormDTO).stream().collect(Collectors.toMap(OptionDTO::getValue, OptionDTO::getLabel));
resultDTO.setServiceMatterName(categoryMap.get(resultDTO.getServiceMatter()));
List<OptionDTO> serviceItemList=icServiceItemDictService.queryDictList(customerId);
Map<String, String> categoryMap=serviceItemList.stream().collect(Collectors.toMap(OptionDTO::getValue, OptionDTO::getLabel));
resultDTO.setServiceMatterName(MapUtils.isNotEmpty(categoryMap) && categoryMap.containsKey(resultDTO.getServiceMatter()) ? categoryMap.get(resultDTO.getServiceMatter()) : StrConstant.EPMETY_STR);
}
if (StringUtils.isNotBlank(resultDTO.getUnitId())) {
//获取单位名称
@ -1317,11 +1311,9 @@ public class WorkActServiceImpl implements WorkActService {
if (StringUtils.isNotBlank(resultDTO.getServiceMatter())) {
//获取服务事项
SubCodeFormDTO codeFormDTO = new SubCodeFormDTO();
codeFormDTO.setCustomerId(customerId);
codeFormDTO.setParentCategoryCode(ActConstant.SERVICE_MATTER_CODE);
Map<String, String> categoryMap = icResiDemandDictService.querySubCodeList(codeFormDTO).stream().collect(Collectors.toMap(OptionDTO::getValue, OptionDTO::getLabel));
resultDTO.setServiceMatterName(categoryMap.get(resultDTO.getServiceMatter()));
List<OptionDTO> serviceItemList=icServiceItemDictService.queryDictList(customerId);
Map<String, String> categoryMap=serviceItemList.stream().collect(Collectors.toMap(OptionDTO::getValue, OptionDTO::getLabel));
resultDTO.setServiceMatterName(MapUtils.isNotEmpty(categoryMap) && categoryMap.containsKey(resultDTO.getServiceMatter()) ? categoryMap.get(resultDTO.getServiceMatter()) : StrConstant.EPMETY_STR);
}
if (StringUtils.isNotBlank(resultDTO.getUnitId())) {
//获取单位名称

49
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/V0.0.10__update_service_item.sql

@ -0,0 +1,49 @@
-- 服务事项从需求分类字典表中抽离出来了,对应历史数据修改如下
-- 1、联建单位的服务事项置空
update ic_party_unit set SERVICE_MATTER ='';
-- 2、联建活动的服务事项修改为新的编码
update ic_party_activity set SERVICE_MATTER='1006' where SERVICE_MATTER = '10100006';
update ic_party_activity set SERVICE_MATTER='1008' where SERVICE_MATTER = '10100008';
update ic_party_activity set SERVICE_MATTER='1002' where SERVICE_MATTER = '10100002';
update ic_party_activity set SERVICE_MATTER='1009' where SERVICE_MATTER = '10100009';
update ic_party_activity set SERVICE_MATTER='1017' where SERVICE_MATTER = '10100017';
update ic_party_activity set SERVICE_MATTER='1021' where SERVICE_MATTER = '10100021';
update ic_party_activity set SERVICE_MATTER='1015' where SERVICE_MATTER = '10100015';
update ic_party_activity set SERVICE_MATTER='1011' where SERVICE_MATTER = '10100011';
update ic_party_activity set SERVICE_MATTER='1018' where SERVICE_MATTER = '10100018';
update ic_party_activity set SERVICE_MATTER='1005' where SERVICE_MATTER = '10100005';
update ic_party_activity set SERVICE_MATTER='1010' where SERVICE_MATTER = '10100010';
update ic_party_activity set SERVICE_MATTER='1003' where SERVICE_MATTER = '10100003';
update ic_party_activity set SERVICE_MATTER='1020' where SERVICE_MATTER = '10100020';
update ic_party_activity set SERVICE_MATTER='1022' where SERVICE_MATTER = '10100022';
update ic_party_activity set SERVICE_MATTER='1014' where SERVICE_MATTER = '10100014';
update ic_party_activity set SERVICE_MATTER='1007' where SERVICE_MATTER = '10100007';
update ic_party_activity set SERVICE_MATTER='1001' where SERVICE_MATTER = '10100001';
update ic_party_activity set SERVICE_MATTER='1004' where SERVICE_MATTER = '10100004';
update ic_party_activity set SERVICE_MATTER='1016' where SERVICE_MATTER = '10100016';
update ic_party_activity set SERVICE_MATTER='1013' where SERVICE_MATTER = '10100013';
update ic_party_activity set SERVICE_MATTER='1012' where SERVICE_MATTER = '10100012';
update ic_party_activity set SERVICE_MATTER='1019' where SERVICE_MATTER = '10100019';
-- 3、爱心互助-活动类型为联建活动,对应的服务事项编码改为新的
update act_info set SERVICE_MATTER='1006' where ACT_TYPE='party' and SERVICE_MATTER='10100006' ;
update act_info set SERVICE_MATTER='1008' where ACT_TYPE='party' and SERVICE_MATTER='10100008' ;
update act_info set SERVICE_MATTER='1002' where ACT_TYPE='party' and SERVICE_MATTER='10100002' ;
update act_info set SERVICE_MATTER='1009' where ACT_TYPE='party' and SERVICE_MATTER='10100009' ;
update act_info set SERVICE_MATTER='1017' where ACT_TYPE='party' and SERVICE_MATTER='10100017' ;
update act_info set SERVICE_MATTER='1021' where ACT_TYPE='party' and SERVICE_MATTER='10100021' ;
update act_info set SERVICE_MATTER='1015' where ACT_TYPE='party' and SERVICE_MATTER='10100015' ;
update act_info set SERVICE_MATTER='1011' where ACT_TYPE='party' and SERVICE_MATTER='10100011' ;
update act_info set SERVICE_MATTER='1018' where ACT_TYPE='party' and SERVICE_MATTER='10100018' ;
update act_info set SERVICE_MATTER='1005' where ACT_TYPE='party' and SERVICE_MATTER='10100005' ;
update act_info set SERVICE_MATTER='1010' where ACT_TYPE='party' and SERVICE_MATTER='10100010' ;
update act_info set SERVICE_MATTER='1003' where ACT_TYPE='party' and SERVICE_MATTER='10100003' ;
update act_info set SERVICE_MATTER='1020' where ACT_TYPE='party' and SERVICE_MATTER='10100020' ;
update act_info set SERVICE_MATTER='1022' where ACT_TYPE='party' and SERVICE_MATTER='10100022' ;
update act_info set SERVICE_MATTER='1014' where ACT_TYPE='party' and SERVICE_MATTER='10100014' ;
update act_info set SERVICE_MATTER='1007' where ACT_TYPE='party' and SERVICE_MATTER='10100007' ;
update act_info set SERVICE_MATTER='1001' where ACT_TYPE='party' and SERVICE_MATTER='10100001' ;
update act_info set SERVICE_MATTER='1004' where ACT_TYPE='party' and SERVICE_MATTER='10100004' ;
update act_info set SERVICE_MATTER='1016' where ACT_TYPE='party' and SERVICE_MATTER='10100016' ;
update act_info set SERVICE_MATTER='1013' where ACT_TYPE='party' and SERVICE_MATTER='10100013' ;
update act_info set SERVICE_MATTER='1012' where ACT_TYPE='party' and SERVICE_MATTER='10100012' ;
update act_info set SERVICE_MATTER='1019' where ACT_TYPE='party' and SERVICE_MATTER='10100019' ;

26
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java

@ -37,8 +37,10 @@ import com.epmet.service.HouseService;
import com.epmet.service.IcBuildingService;
import com.epmet.service.IcBuildingUnitService;
import com.epmet.service.IcHouseService;
import com.epmet.service.*;
import com.epmet.util.ExcelPoiUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -73,6 +75,9 @@ public class HouseServiceImpl implements HouseService, ResultDataResolver {
private GovOrgOpenFeignClient govOrgOpenFeignClient;
@Autowired
private IcHouseRedis icHouseRedis;
@Autowired
private AgencyService agencyservice;
@Override
@Transactional(rollbackFor = Exception.class)
@ -234,19 +239,20 @@ public class HouseServiceImpl implements HouseService, ResultDataResolver {
//IPage<Map<String, Object>> resultMap = searchHouse(buildingId, ownerName, ownerPhone, neighborHoodName, buildingName, pageNo, pageSize);
// 查询pids
CustomerAgencyDTO agency = getResultDataOrThrowsException(govOrgOpenFeignClient.getAgencyById(ancestorAgencyId), ServiceConstant.GOV_ORG_SERVER,
EpmetErrorCode.SERVER_ERROR.getCode(), "【社区查询-查询需求列表】查询当前staff所属组织信息失败", null);
String pids = null;
if (StringUtils.isNotBlank(ancestorAgencyId)) {
CustomerAgencyDTO agency = agencyservice.getAgencyById(ancestorAgencyId);
if (agency == null) {
throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), "【社区查询-查询需求列表】查询当前staff所属组织信息失败");
}
if (agency == null) {
throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), "【社区查询-查询房屋列表】查询当前staff所属组织信息失败");
}
String pids;
if(NumConstant.ZERO_STR.equals(agency.getPid())){
pids = ancestorAgencyId;
}else{
pids = agency.getPids().concat(StrConstant.COLON).concat(ancestorAgencyId);
if (NumConstant.ZERO_STR.equals(agency.getPid())) {
pids = ancestorAgencyId;
} else {
pids = agency.getPids().concat(StrConstant.COLON).concat(ancestorAgencyId);
}
}
IPage<IcHouseEntity> page = new Page<IcHouseEntity>(pageNo,pageSize);

3
epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/CustomerFormQueryDTO.java

@ -16,6 +16,9 @@ public class CustomerFormQueryDTO implements Serializable {
// 获取表单相关信息
public interface GetFormInfoGroup {}
/**
* @see com.epmet.commons.tools.enums.IcFormCodeEnum
*/
@NotBlank(message = "formCode不能为空,居民信息默认传:resi_base_info",groups = { AddUserInternalGroup.class, GetFormInfoGroup.class} )
private String formCode;

43
epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/IndividualCategoryAllListResultDTO.java

@ -0,0 +1,43 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2022/1/17 10:52 上午
* @DESC
*/
@Data
public class IndividualCategoryAllListResultDTO implements Serializable {
private static final long serialVersionUID = -3294223041221531203L;
/**
* 标签
*/
private String label;
/**
* 图片
*/
private String managementIcon;
/**
* 字段名
*/
private String columnName;
/**
* 排序
*/
private Integer sort;
private String id;
/**
* 是否选中 truefalse
*/
private boolean isSelected = false;
}

5
epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/IndividualCategoryListResultDTO.java

@ -1,5 +1,6 @@
package com.epmet.dto.result;
import com.epmet.commons.tools.constant.NumConstant;
import lombok.Data;
import java.io.Serializable;
@ -33,4 +34,8 @@ public class IndividualCategoryListResultDTO implements Serializable {
* 排序
*/
private Integer sort;
private String id;
private Integer count = NumConstant.ZERO;
}

17
epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/ResiCategoryItemResultDTO.java

@ -0,0 +1,17 @@
package com.epmet.dto.result;
import lombok.Data;
/**
* @ClassName ResiCategoryItemResultDTO
* @Description 居民类别item查询结果
* @Author wangxianzhang
* @Date 2022/1/18 4:43 下午
*/
@Data
public class ResiCategoryItemResultDTO {
private String columnName;
private String label;
}

7
epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/OperCustomizeOpenFeignClient.java

@ -145,4 +145,11 @@ public interface OperCustomizeOpenFeignClient {
@PostMapping("/oper/customize/icresicategorywarnconfig/categorywarnconfiglist/{customerId}")
Result<List<IcResiCategoryWarnConfigDTO>> categoryWarnConfigList(@PathVariable String customerId);
/**
* 查询客户下的居民类别item列表
* @param customerId
* @return
*/
@PostMapping("/oper/customize/icformitem/resi-category-items/list")
Result<List<ResiCategoryItemResultDTO>> listResiCategoryItems(@RequestParam("customer-id") String customerId);
}

5
epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/fallback/OperCustomizeOpenFeignClientFallback.java

@ -119,4 +119,9 @@ public class OperCustomizeOpenFeignClientFallback implements OperCustomizeOpenFe
public Result<List<IcResiCategoryWarnConfigDTO>> categoryWarnConfigList(String customerId) {
return ModuleUtils.feignConError(ServiceConstant.OPER_CUSTOMIZE_SERVER, "categoryWarnConfigList", customerId);
}
@Override
public Result<List<ResiCategoryItemResultDTO>> listResiCategoryItems(String customerId) {
return ModuleUtils.feignConError(ServiceConstant.OPER_CUSTOMIZE_SERVER, "listResiCategoryItems", customerId);
}
}

17
epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcFormItemController.java

@ -19,12 +19,10 @@ package com.epmet.controller;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.result.ColumnTableNameResultDTO;
import com.epmet.dto.result.ResiCategoryItemResultDTO;
import com.epmet.service.IcFormItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@ -51,4 +49,15 @@ public class IcFormItemController {
return new Result<List<ColumnTableNameResultDTO>>().ok(icFormItemService.getMustColumn(customerId));
}
/**
* 查询客户下的居民类别item列表
* @param customerId
* @return
*/
@PostMapping("resi-category-items/list")
public Result<List<ResiCategoryItemResultDTO>> listResiCategoryItems(@RequestParam("customer-id") String customerId) {
List<ResiCategoryItemResultDTO> r = icFormItemService.listResiCategoryItems(customerId);
return new Result().ok(r);
}
}

12
epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcIndividualCategoryManageController.java

@ -10,6 +10,7 @@ import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.dto.IcIndividualCategoryManageDTO;
import com.epmet.dto.form.EditIndividualCategoryFormDTO;
import com.epmet.dto.form.PackageEditIndividualCategoryFormDTO;
import com.epmet.dto.result.IndividualCategoryAllListResultDTO;
import com.epmet.dto.result.IndividualCategoryListResultDTO;
import com.epmet.service.IcIndividualCategoryManageService;
import org.springframework.beans.factory.annotation.Autowired;
@ -56,4 +57,15 @@ public class IcIndividualCategoryManageController {
return new Result();
}
/**
* @Description 查询客户下人员分类并且赋值本人选中的
* @param tokenDto
* @author zxc
* @date 2022/1/20 10:44 上午
*/
@PostMapping("individualcategoryalllist")
public Result<List<IndividualCategoryAllListResultDTO>> individualCategoryAllList(@LoginUser TokenDto tokenDto){
return new Result<List<IndividualCategoryAllListResultDTO>>().ok(icIndividualCategoryManageService.individualCategoryAllList(tokenDto));
}
}

2
epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/IcFormQueryBuilderEntity.java

@ -47,6 +47,8 @@ public class IcFormQueryBuilderEntity extends BaseEpmetEntity {
/**
* ic_form.form_code举例resi_base_info
* @see com.epmet.commons.tools.enums.IcFormCodeEnum
*
*/
private String formCode;

12
epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcFormItemService.java

@ -19,10 +19,7 @@ package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.dto.form.CustomerFormQueryDTO;
import com.epmet.dto.result.ColumnTableNameResultDTO;
import com.epmet.dto.result.ConditionResultDTO;
import com.epmet.dto.result.IcFormResColumnDTO;
import com.epmet.dto.result.TableHeaderResultDTO;
import com.epmet.dto.result.*;
import com.epmet.entity.IcFormItemEntity;
import java.util.List;
@ -58,4 +55,11 @@ public interface IcFormItemService extends BaseService<IcFormItemEntity> {
* @Description 居民信息新增查询各表必填字段
**/
List<ColumnTableNameResultDTO> getMustColumn(String customerId);
/**
* 查询
* @param customerId
* @return
*/
List<ResiCategoryItemResultDTO> listResiCategoryItems(String customerId);
}

9
epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcIndividualCategoryManageService.java

@ -5,6 +5,7 @@ import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.dto.IcIndividualCategoryManageDTO;
import com.epmet.dto.form.EditIndividualCategoryFormDTO;
import com.epmet.dto.result.IndividualCategoryAllListResultDTO;
import com.epmet.dto.result.IndividualCategoryListResultDTO;
import com.epmet.entity.IcIndividualCategoryManageEntity;
@ -36,4 +37,12 @@ public interface IcIndividualCategoryManageService extends BaseService<IcIndivid
*/
void editIndividualCategory(List<EditIndividualCategoryFormDTO> formDTOS, TokenDto tokenDto);
/**
* @Description 查询客户下人员分类并且赋值本人选中的
* @param tokenDto
* @author zxc
* @date 2022/1/20 10:44 上午
*/
List<IndividualCategoryAllListResultDTO> individualCategoryAllList(TokenDto tokenDto);
}

32
epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcFormItemServiceImpl.java

@ -17,6 +17,7 @@
package com.epmet.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;
@ -27,10 +28,7 @@ import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.dao.IcFormItemDao;
import com.epmet.dto.IcFormItemDTO;
import com.epmet.dto.form.CustomerFormQueryDTO;
import com.epmet.dto.result.ColumnTableNameResultDTO;
import com.epmet.dto.result.ConditionResultDTO;
import com.epmet.dto.result.IcFormResColumnDTO;
import com.epmet.dto.result.TableHeaderResultDTO;
import com.epmet.dto.result.*;
import com.epmet.entity.IcFormItemEntity;
import com.epmet.service.IcFormItemService;
import org.apache.commons.lang3.StringUtils;
@ -39,6 +37,8 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* 表单项
@ -118,4 +118,28 @@ public class IcFormItemServiceImpl extends BaseServiceImpl<IcFormItemDao, IcForm
return baseDao.getMustColumn(customerId);
}
@Override
public List<ResiCategoryItemResultDTO> listResiCategoryItems(String customerId) {
LambdaQueryWrapper<IcFormItemEntity> query = new LambdaQueryWrapper<>();
query.eq(IcFormItemEntity::getCustomerId, customerId);
query.eq(IcFormItemEntity::getDataAnalyse, 1);
List<IcFormItemEntity> categoryItems = baseDao.selectList(query);
// 如果该客户没配置,那么使用默认配置
if (CollectionUtils.isEmpty(categoryItems)) {
LambdaQueryWrapper<IcFormItemEntity> query1 = new LambdaQueryWrapper<>();
query1.eq(IcFormItemEntity::getDataAnalyse, 1);
query1.eq(IcFormItemEntity::getCustomerId, "default");
categoryItems = baseDao.selectList(query1);
}
return categoryItems.stream().map((e) -> {
ResiCategoryItemResultDTO d = new ResiCategoryItemResultDTO();
d.setColumnName(e.getColumnName());
d.setLabel(e.getLabel());
return d;
}).collect(Collectors.toList());
}
}

64
epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcIndividualCategoryManageServiceImpl.java

@ -1,14 +1,27 @@
package com.epmet.service.impl;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dao.IcIndividualCategoryManageDao;
import com.epmet.dto.IcResiCategoryStatsConfigDTO;
import com.epmet.dto.form.EditIndividualCategoryFormDTO;
import com.epmet.dto.form.IcResiCategoryStatsConfigFormDTO;
import com.epmet.dto.form.StatsResiListFormDTO;
import com.epmet.dto.result.IcStatsResiResultDTO;
import com.epmet.dto.result.IcStatsResiWarnBuildingResultDTO;
import com.epmet.dto.result.IndividualCategoryAllListResultDTO;
import com.epmet.dto.result.IndividualCategoryListResultDTO;
import com.epmet.entity.IcIndividualCategoryManageEntity;
import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.feign.OperCustomizeOpenFeignClient;
import com.epmet.service.IcIndividualCategoryManageService;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -24,6 +37,11 @@ import java.util.List;
@Service
public class IcIndividualCategoryManageServiceImpl extends BaseServiceImpl<IcIndividualCategoryManageDao, IcIndividualCategoryManageEntity> implements IcIndividualCategoryManageService {
@Autowired
private OperCustomizeOpenFeignClient operCustomizeOpenFeignClient;
@Autowired
private EpmetUserOpenFeignClient userOpenFeignClient;
/**
* @Description 人员分类管理查询个人分类列表
* @param tokenDto
@ -32,10 +50,30 @@ public class IcIndividualCategoryManageServiceImpl extends BaseServiceImpl<IcInd
*/
@Override
public List<IndividualCategoryListResultDTO> individualCategoryList(TokenDto tokenDto) {
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(tokenDto.getCustomerId(), tokenDto.getUserId());
if (null == staffInfo){
throw new EpmetException(String.format("查询工作人员%s信息失败...",tokenDto.getUserId()));
}
StatsResiListFormDTO formDTO = new StatsResiListFormDTO();
formDTO.setId(staffInfo.getAgencyId());
formDTO.setLevel("agency");
formDTO.setCustomerId(tokenDto.getCustomerId());
Result<List<IcStatsResiResultDTO>> list = userOpenFeignClient.getPersonCategoryList(formDTO);
if (!list.success()){
throw new EpmetException("查询人员分类下人数失败...");
}
List<IcStatsResiResultDTO> datas = list.getData();
List<IndividualCategoryListResultDTO> result = baseDao.individualCategoryList(tokenDto.getUserId());
if (CollectionUtils.isNotEmpty(result)){
if (CollectionUtils.isNotEmpty(datas) && CollectionUtils.isNotEmpty(result)){
result.forEach( r -> datas.stream().filter( d -> d.getId().equals(r.getId())).forEach(d -> r.setCount(d.getCount())));
return result;
}
if (CollectionUtils.isEmpty(datas) && CollectionUtils.isNotEmpty(result)){
return result;
}
if (CollectionUtils.isEmpty(result)){
return new ArrayList<>();
}
return new ArrayList<>();
}
@ -59,4 +97,28 @@ public class IcIndividualCategoryManageServiceImpl extends BaseServiceImpl<IcInd
insertBatch(entities);
}
}
/**
* @Description 查询客户下人员分类并且赋值本人选中的
* @param tokenDto
* @author zxc
* @date 2022/1/20 10:44 上午
*/
@Override
public List<IndividualCategoryAllListResultDTO> individualCategoryAllList(TokenDto tokenDto) {
IcResiCategoryStatsConfigFormDTO formDTO = new IcResiCategoryStatsConfigFormDTO();
Result<List<IcResiCategoryStatsConfigDTO>> listResult = operCustomizeOpenFeignClient.resiCategoryStatsListShowd(formDTO);
if (!listResult.success()){
throw new EpmetException("查询客户下的人员类别失败...");
}
if (CollectionUtils.isEmpty(listResult.getData())){
return new ArrayList<>();
}
List<IndividualCategoryAllListResultDTO> result = ConvertUtils.sourceToTarget(listResult.getData(), IndividualCategoryAllListResultDTO.class);
List<IndividualCategoryListResultDTO> configs = baseDao.individualCategoryList(tokenDto.getUserId());
if (CollectionUtils.isNotEmpty(configs)){
result.forEach(r -> configs.stream().filter(c -> c.getColumnName().equals(r.getColumnName())).forEach(c -> r.setSelected(true)));
}
return result;
}
}

3
epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcIndividualCategoryManageDao.xml

@ -14,7 +14,8 @@
cm.SORT,
sc.LABEL,
sc.MANAGEMENT_ICON,
sc.COLUMN_NAME
sc.COLUMN_NAME,
sc.id AS id
FROM ic_individual_category_manage cm
INNER JOIN ic_resi_category_stats_config sc ON (sc.ID = cm.COLUMN_ID AND sc.DEL_FLAG = '0' AND `STATUS` = 'show')
WHERE cm.DEL_FLAG = 0

3
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/DelIcResiUserFormDTO.java

@ -1,5 +1,6 @@
package com.epmet.dto.form;
import com.epmet.commons.tools.enums.IcFormCodeEnum;
import lombok.Data;
import javax.validation.constraints.NotBlank;
@ -21,6 +22,6 @@ public class DelIcResiUserFormDTO implements Serializable {
private String icResiUserId;
@NotBlank(message = "token获取的customerId不能为空", groups = IdGroup.class)
private String customerId;
private String formCode="resi_base_info";
private String formCode= IcFormCodeEnum.RESI_BASE_INFO.getCode();
}

3
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/DynamicQueryFormDTO.java

@ -1,5 +1,6 @@
package com.epmet.dto.form;
import com.epmet.commons.tools.enums.IcFormCodeEnum;
import lombok.Data;
import javax.validation.constraints.NotBlank;
@ -14,7 +15,7 @@ import java.util.List;
@Data
public class DynamicQueryFormDTO implements Serializable {
private String customerId;
private String formCode="resi_base_info";
private String formCode= IcFormCodeEnum.RESI_BASE_INFO.getCode();
@NotBlank(message = "resultTableName不能为空")
private String resultTableName;
private List<ResiUserQueryValueDTO> conditions;

20
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcUserChangeRecordInitFormDTO.java

@ -0,0 +1,20 @@
package com.epmet.dto.form;
import lombok.Data;
import java.io.Serializable;
/**
* @Description 基础信息变更记录
* @Author sun
*/
@Data
public class IcUserChangeRecordInitFormDTO implements Serializable {
private static final long serialVersionUID = 9156247659994638103L;
/**
* 客户Id
*/
private String customerId;
}

2
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StatsResiListFormDTO.java

@ -43,4 +43,6 @@ public class StatsResiListFormDTO implements Serializable {
@NotBlank(message = "level不能为空")
private String level;
private String customerId;
}

8
epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java

@ -1,6 +1,7 @@
package com.epmet.feign;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.dto.result.OptionResultDTO;
import com.epmet.commons.tools.security.dto.TokenDto;
@ -24,8 +25,8 @@ import java.util.Set;
* @author yinzuomei@elink-cn.com
* @date 2020/6/4 13:09
*/
// @FeignClient(name = ServiceConstant.EPMET_USER_SERVER, fallbackFactory = EpmetUserOpenFeignClientFallbackFactory.class, url = "localhost:8087")
@FeignClient(name = ServiceConstant.EPMET_USER_SERVER, fallbackFactory = EpmetUserOpenFeignClientFallbackFactory.class)
@FeignClient(name = ServiceConstant.EPMET_USER_SERVER, fallbackFactory = EpmetUserOpenFeignClientFallbackFactory.class, url = "localhost:8087")
//@FeignClient(name = ServiceConstant.EPMET_USER_SERVER, fallbackFactory = EpmetUserOpenFeignClientFallbackFactory.class)
public interface EpmetUserOpenFeignClient {
/**
@ -708,4 +709,7 @@ public interface EpmetUserOpenFeignClient {
@PostMapping("/epmetuser/userbaseinfo/resirelationinfo")
Result<RegisterRelationDTO> resiRelationInfo(@RequestParam("userId")String userId);
@PostMapping("/epmetuser/statsresiwarn/list2")
Result<List<IcStatsResiResultDTO>> getPersonCategoryList(@RequestBody StatsResiListFormDTO formDTO);
}

4
epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java

@ -523,4 +523,8 @@ public class EpmetUserOpenFeignClientFallback implements EpmetUserOpenFeignClien
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "resiRelationInfo", userId);
}
@Override
public Result<List<IcStatsResiResultDTO>> getPersonCategoryList(StatsResiListFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getPersonCategoryList", formDTO);
}
}

51
epmet-user/epmet-user-server/src/main/java/com/epmet/bean/ResiImportCategoryData.java

@ -0,0 +1,51 @@
package com.epmet.bean;
import lombok.Data;
import java.util.HashMap;
import java.util.Map;
/**
* @ClassName ResiImportTransferOldDim
* @Description TODO
* @Author wangxianzhang
* @Date 2022/1/18 5:53 下午
*/
@Data
public class ResiImportCategoryData {
private String agencyId;
private String gridId;
private String villageId;
private String buildId;
private String unitId;
private String homeId;
/**
* key:居民类别在ic_resi_user表中的列名
* value:居民类别的值01
*/
private Map<String, String> categories = new HashMap<>();
public ResiImportCategoryData() {
}
public ResiImportCategoryData(String agencyId, String gridId, String villageId, String buildId, String unitId, String homeId, Map<String, String> categories) {
this.agencyId = agencyId;
this.gridId = gridId;
this.villageId = villageId;
this.buildId = buildId;
this.unitId = unitId;
this.homeId = homeId;
this.categories = categories;
}
public ResiImportCategoryData(String agencyId, String gridId, String villageId, String buildId, String unitId, String homeId) {
this.agencyId = agencyId;
this.gridId = gridId;
this.villageId = villageId;
this.buildId = buildId;
this.unitId = unitId;
this.homeId = homeId;
}
}

20
epmet-user/epmet-user-server/src/main/java/com/epmet/bean/ResiImportChangedData.java

@ -0,0 +1,20 @@
package com.epmet.bean;
import lombok.Data;
/**
* @ClassName ResiImportTransferCache
* @Description TODO
* @Author wangxianzhang
* @Date 2022/1/18 5:51 下午
*/
@Data
public class ResiImportChangedData {
private ResiImportCategoryData oldData = new ResiImportCategoryData();
private ResiImportCategoryData newData = new ResiImportCategoryData();
public ResiImportChangedData(ResiImportCategoryData oldData, ResiImportCategoryData newData) {
this.oldData = oldData;
this.newData = newData;
}
}

30
epmet-user/epmet-user-server/src/main/java/com/epmet/bean/ResiImportResiCategoryChangedCache.java

@ -0,0 +1,30 @@
package com.epmet.bean;
import lombok.Data;
import java.util.HashMap;
import java.util.Map;
/**
* 导入操作中居民信息操作的分类bean
*/
@Data
public class ResiImportResiCategoryChangedCache {
/**
* 新增居民
* Map<resiId:<ResiImportCategoryData>>
*/
private Map<String, ResiImportCategoryData> newResis = new HashMap<>();
/**
* 调动的居民
*/
private Map<String, ResiImportChangedData> transferedResis = new HashMap<>();
/**
* 类别变更的居民
*/
private Map<String, ResiImportChangedData> categoryChangedResis = new HashMap<>();
}

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

@ -28,6 +28,7 @@ import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.dto.result.OptionDataResultDTO;
import com.epmet.commons.tools.enums.IcFormCodeEnum;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.exception.ExceptionUtils;
@ -91,9 +92,6 @@ import java.util.stream.Collectors;
@RequestMapping("icresiuser")
public class IcResiUserController {
//todo 枚举吧
private static final String IC_RESI_FORM_CODE = "resi_base_info";
/**
* 居民上传临时目录
*/
@ -312,7 +310,7 @@ public class IcResiUserController {
Set<String> stopSearchSet = new HashSet<>();
//获取表单项
List<FormItemResult> resiFormAllItems = icResiUserService.listFormItems(customerId, IC_RESI_FORM_CODE);
List<FormItemResult> resiFormAllItems = icResiUserService.listFormItems(customerId, IcFormCodeEnum.RESI_BASE_INFO.getCode());
Map<String, FormItemResult> allItemMap = resiFormAllItems.stream().collect(Collectors.toMap(FormItemResult::getItemId, o -> o));
Map<String, ExportResiUserItemDTO> map = new HashMap<>();
allItemMap.values().forEach(item->{
@ -436,7 +434,7 @@ public class IcResiUserController {
savePath = IC_RESI_UPLOAD_DIR.resolve(fileName);
IOUtils.copy(file.getInputStream(), new FileOutputStream(savePath.toString()));
List<FormItemResult> formItemList = icResiUserService.listFormItems(customerId,IC_RESI_FORM_CODE);
List<FormItemResult> formItemList = icResiUserService.listFormItems(customerId,IcFormCodeEnum.RESI_BASE_INFO.getCode());
icResiUserImportService.importIcResiInfoFromExcel(formItemList, savePath.toString(), response);
} catch (IOException e) {
String errorMsg = ExceptionUtils.getErrorStackTrace(e);
@ -444,7 +442,9 @@ public class IcResiUserController {
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode());
} finally {
try {
Files.delete(savePath);
if (savePath != null){
Files.delete(savePath);
}
} catch (IOException e) {
log.error("【导入居民信息失败】清理上传的文件失败:{}", ExceptionUtils.getErrorStackTrace(e));
}
@ -491,7 +491,7 @@ public class IcResiUserController {
@NotNull
private CustomerFormResultDTO getResiFormAddItems(String customerId) {
CustomerFormQueryDTO queryDTO = new CustomerFormQueryDTO();
queryDTO.setFormCode("resi_base_info");
queryDTO.setFormCode(IcFormCodeEnum.RESI_BASE_INFO.getCode());
queryDTO.setCustomerId(customerId);
Result<CustomerFormResultDTO> resultForm = operCustomizeOpenFeignClient.getCustomerForm(queryDTO);
if (resultForm == null || !resultForm.success() || resultForm.getData() == null) {
@ -656,7 +656,7 @@ public class IcResiUserController {
input.setKeyword(input.getKeyword().trim());
input.setCustomerId(loginUser.getCustomerId());
input.setStaffId(loginUser.getUserId());
input.setFormCode("resi_base_info");
input.setFormCode(IcFormCodeEnum.RESI_BASE_INFO.getCode());
if (input.getPageNo() == null) {
input.setPageNo(1);
}

13
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcUserChangeRecordController.java

@ -22,6 +22,7 @@ import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dto.form.IcResiUserChangeRecordFormDTO;
import com.epmet.dto.form.IcResiUserTransferFormDTO;
import com.epmet.dto.form.IcUserChangeRecordInitFormDTO;
import com.epmet.dto.form.IcUsercategoryAnalysisFormDTO;
import com.epmet.dto.result.IcUserChangeRecordResultDTO;
import com.epmet.dto.result.IcUsercategoryAnalysisResultDTO;
@ -32,6 +33,8 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.text.ParseException;
/**
* 居民变更记录表
@ -67,4 +70,14 @@ public class IcUserChangeRecordController {
ValidatorUtils.validateEntity(formDTO,IcUsercategoryAnalysisFormDTO.AddUserShowGroup.class,IcUsercategoryAnalysisFormDTO.AddUserInternalGroup.class);
return new Result<PageData<IcUsercategoryAnalysisResultDTO>>().ok(icUserChangeRecordService.categoryAnalysisList(formDTO));
}
/**
* @Author sun
* @Description 历史居民数据生成变更记录和变更明细数据
**/
@PostMapping("icuserchangerecordinit")
public Result icUserChangeRecordInit(@RequestBody IcUserChangeRecordInitFormDTO formDTO) throws ParseException {
icUserChangeRecordService.icUserChangeRecordInit(formDTO);
return new Result();
}
}

15
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StatsResiWarnController.java

@ -60,12 +60,23 @@ public class StatsResiWarnController {
private StatsResiWarnService statsResiWarnService;
@PostMapping("list")
public Result list(@LoginUser TokenDto tokenDto,@RequestBody StatsResiListFormDTO formDTO){
public Result<List<IcStatsResiResultDTO>> list(@LoginUser TokenDto tokenDto,@RequestBody StatsResiListFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO);
String customerId = tokenDto.getCustomerId();
List<IcStatsResiResultDTO> icStatsResiResultDTOList = statsResiWarnService.list(customerId,formDTO.getId(),formDTO.getLevel());
return new Result().ok(icStatsResiResultDTOList);
return new Result<List<IcStatsResiResultDTO>>().ok(icStatsResiResultDTOList);
}
/**
* @Description 内部调了list
* @param formDTO
* @author zxc
* @date 2022/1/20 2:11 下午
*/
@PostMapping("list2")
public Result<List<IcStatsResiResultDTO>> list2(@RequestBody StatsResiListFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO);
return new Result<List<IcStatsResiResultDTO>>().ok(statsResiWarnService.list2(formDTO));
}
@PostMapping("buildingwarnlist")

6
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java

@ -232,5 +232,11 @@ public interface IcResiUserDao extends BaseDao<IcResiUserEntity> {
Map<String, String> getCategoryListMap(@Param("icUserId") String icUserId);
Map<String, String> selectResiInfoMap(@Param("idCard") String idCard);
List<Map<String,Object>> selectResiUsers(@Param("types")List<String> types,@Param("orgId")String orgId);
List<String> icUserCustomerIds();
List<Map<String, String>> getIcUserList(@Param("customerId") String customerId);
}

8
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcUserChangeDetailedDao.java

@ -20,6 +20,7 @@ package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.IcUserChangeDetailedEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* 变更明细表
@ -30,5 +31,10 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface IcUserChangeDetailedDao extends BaseDao<IcUserChangeDetailedEntity> {
/**
* @Author sun
* @Description 删除客户是新增类型的变更明细历史数据
**/
void delByCustomerId(@Param("customerId") String customerId, @Param("type") String type);
}

6
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcUserChangeRecordDao.java

@ -43,4 +43,10 @@ public interface IcUserChangeRecordDao extends BaseDao<IcUserChangeRecordEntity>
List<IcUserChangeRecordDTO> getList(@Param("icUserId") String icUserId);
List<IcUsercategoryAnalysisResultDTO> categoryAnalysisList(IcUsercategoryAnalysisFormDTO formDTO);
/**
* @Author sun
* @Description 删除客户是新增类型的变更历史数据
**/
void delByCustomerId(@Param("customerId") String customerId, @Param("type") String type);
}

5
epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcUserChangeDetailedService.java

@ -29,4 +29,9 @@ import com.epmet.entity.IcUserChangeDetailedEntity;
*/
public interface IcUserChangeDetailedService extends BaseService<IcUserChangeDetailedEntity> {
/**
* @Author sun
* @Description 删除客户是新增类型的变更明细历史数据
**/
void delByCustomerId(String customerId, String type);
}

9
epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcUserChangeRecordService.java

@ -20,11 +20,14 @@ package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.form.IcResiUserChangeRecordFormDTO;
import com.epmet.dto.form.IcUserChangeRecordInitFormDTO;
import com.epmet.dto.form.IcUsercategoryAnalysisFormDTO;
import com.epmet.dto.result.IcUserChangeRecordResultDTO;
import com.epmet.dto.result.IcUsercategoryAnalysisResultDTO;
import com.epmet.entity.IcUserChangeRecordEntity;
import java.text.ParseException;
/**
* 居民变更记录表
*
@ -45,4 +48,10 @@ public interface IcUserChangeRecordService extends BaseService<IcUserChangeRecor
* @return
*/
PageData<IcUsercategoryAnalysisResultDTO> categoryAnalysisList(IcUsercategoryAnalysisFormDTO formDTO);
/**
* @Author sun
* @Description 历史居民数据生成变更记录和变更明细数据
**/
void icUserChangeRecordInit(IcUserChangeRecordInitFormDTO formDTO) throws ParseException;
}

3
epmet-user/epmet-user-server/src/main/java/com/epmet/service/StatsResiWarnService.java

@ -17,6 +17,7 @@
package com.epmet.service;
import com.epmet.dto.form.StatsResiListFormDTO;
import com.epmet.dto.result.IcStatsResiResultDTO;
import com.epmet.dto.result.IcStatsResiWarnBuildingResultDTO;
import com.epmet.dto.result.IcStatsResiWarnUserResultDTO;
@ -38,6 +39,8 @@ public interface StatsResiWarnService{
List<IcStatsResiResultDTO> list(String customerId,String id, String level);
List<IcStatsResiResultDTO> list2(StatsResiListFormDTO formDTO);
void resiWarn(String customerId);
void resiWarnByOne(String customerId,String userId);

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

@ -6,6 +6,9 @@ import cn.afterturn.easypoi.excel.entity.ExportParams;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.EasyExcelFactory;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.epmet.bean.ResiImportCategoryData;
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.OptionResultDTO;
@ -22,12 +25,14 @@ 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.entity.IcResiUserEntity;
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.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
@ -61,6 +66,16 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
public static final ThreadLocal<Map<String, List<ErrorRow>>> errorRows = new ThreadLocal<>();
public static final ThreadLocal<Map<String, List<SkipedRow>>> skipedRows = new ThreadLocal<>();
/**
* 类别发生变更的居民
*/
public static final ThreadLocal<ResiImportResiCategoryChangedCache> categoryChangedResi = new ThreadLocal<>();
/**
* 居民类别items列表
*/
public static final ThreadLocal<List<String>> resiCategoryItemsCache = new ThreadLocal<>();
/**
* key: itemId
* value:
@ -85,6 +100,9 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
@Autowired
private IcResiUserDao icResiUserDao;
@Autowired
private OperCustomizeOpenFeignClient operCustomizeOpenFeignClient;
/**
* @description 列信息封装
*
@ -168,6 +186,7 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
*/
@Override
public void importIcResiInfoFromExcel(List<FormItemResult> formItemList, String excelPathName, HttpServletResponse response) {
String loginUserId = loginUserUtil.getLoginUserId();
String loginUserApp = loginUserUtil.getLoginUserApp();
String loginUserClient = loginUserUtil.getLoginUserClient();
@ -185,7 +204,7 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
String customerId = agencyInfo.getCustomerId();
try {
initThreadLocalRowsStorage();
initImportThreadLocal(customerId);
// 上传主表信息
importIcResiBaseInfoFromExcel(formItemList,excelPathName, IcResiUserTableEnum.IC_RESI_USER.getSheetNo(), IcResiUserTableEnum.IC_RESI_USER.getHeadRowNo(),
@ -209,11 +228,10 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
}
}
//String errors = JSON.toJSONString(errorRows.get());
//String skipeds = JSON.toJSONString(skipedRows.get());
//log.error(errors);
//log.error(skipeds);
// 执行人员类别变更记录
Map<String, ResiImportCategoryData> newResis = categoryChangedResi.get().getNewResis();
Map<String, ResiImportChangedData> categoryChangedResis = categoryChangedResi.get().getCategoryChangedResis();
Map<String, ResiImportChangedData> transferedResis = categoryChangedResi.get().getTransferedResis();
try {
downLoadResults(response);
@ -223,25 +241,42 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
} finally {
skipedRows.remove();
errorRows.remove();
categoryChangedResi.remove();
resiCategoryItemsCache.remove();
itemIdAndOptionsCache.invalidateAll();
}
}
/**
* 暂存rows信息初始化
* threadLocal初始化
*/
private void initThreadLocalRowsStorage() {
private void initImportThreadLocal(String customerId) {
// 跳过的,不导入的行
Map<String, List<SkipedRow>> skipedRowsMap = new LinkedHashMap<>();
for (IcResiUserTableEnum e : IcResiUserTableEnum.values()) {
skipedRowsMap.put(e.getTableName(), new LinkedList<>());
}
skipedRows.set(skipedRowsMap);
// 错误信息
Map<String, List<ErrorRow>> errorRowsMap = new LinkedHashMap<>();
for (IcResiUserTableEnum e : IcResiUserTableEnum.values()) {
errorRowsMap.put(e.getTableName(), new LinkedList<>());
}
errorRows.set(errorRowsMap);
// 居民类别信息
ResiImportResiCategoryChangedCache c = new ResiImportResiCategoryChangedCache();
categoryChangedResi.set(c);
List<ResiCategoryItemResultDTO> resiCategoryItems = getResultDataOrThrowsException(operCustomizeOpenFeignClient.listResiCategoryItems(customerId),
ServiceConstant.OPER_CUSTOMIZE_SERVER,
EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),
String.format("【居民信息导入】查询居民类别items失败,customerId:%s", customerId),
"居民信息导入失败");
List<String> l = resiCategoryItems.stream().map(ResiCategoryItemResultDTO::getColumnName).collect(Collectors.toList());
resiCategoryItemsCache.set(l);
}
/**
@ -374,26 +409,45 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
String idCard = columnAndValues.get("ID_CARD");
LambdaQueryWrapper<IcResiUserEntity> idCardQuery = new LambdaQueryWrapper<>();
idCardQuery.eq(IcResiUserEntity::getIdCard, idCard);
IcResiUserEntity resiBaseInfo = icResiUserDao.selectOne(idCardQuery);
//IcResiUserEntity resiBaseInfo = icResiUserDao.selectOne(idCardQuery);
Map<String, String> existingResiMap = icResiUserDao.selectResiInfoMap(idCard);
if (existingResiMap != null) {
// 修改居民信息
icResiUserDao.upTable(tableName, existingResiMap.get("ID"), columnAndValues);
if (resiBaseInfo != null) {
icResiUserDao.upTable(tableName, resiBaseInfo.getId(), columnAndValues);
// 任意组织维度一个发生变化,则放到调动居民缓存中
ResiImportChangedData transferData;
if ((transferData = this.getResiImportTrasferData(existingResiMap, columnAndValues)) != null) {
categoryChangedResi.get().getTransferedResis().put(existingResiMap.get("ID"), transferData);
} else {
// 组织维度没有发生变化,看是否有居民类型变更
ResiImportChangedData d = getResiImportCategoryChangedData(existingResiMap, columnAndValues);
if (d != null) {
categoryChangedResi.get().getCategoryChangedResis().put(existingResiMap.get("ID"), d);
}
}
} else {
// 新增居民
columnAndValues.put("CREATED_BY", currentUserId);
columnAndValues.put("ID", UUID.randomUUID().toString().replace("-", ""));
icResiUserDao.add(tableName, columnAndValues);
}
//if (icResiUserDao.selectCount(idCardQuery) > 0) {
// //log.info("身份证号为【{}】的居民信息已存在,跳过导入", idCard);
// SkipedRow skipedRow = new SkipedRow();
// skipedRow.setName(columnAndValues.get("NAME"));
// skipedRow.setIdCard(idCard);
// skipedRow.setInfo("身份证号已存在,跳过导入");
// skipedRow.setTableName(tableName);
// skipedRows.get().get(IcResiUserTableEnums.IC_RESI_USER.getTableName()).add(skipedRow);
// continue;
//}
Map<String, String> categories = resiCategoryItemsCache.get()
.stream()
.filter((categoryColumnName) -> "1".equals(columnAndValues.get(categoryColumnName)))
.collect(Collectors.toMap((k) -> k, (k) -> columnAndValues.get(k)));
categoryChangedResi.get().getNewResis().put(columnAndValues.get("ID"),
new ResiImportCategoryData(columnAndValues.get("AGENCY_ID"),
columnAndValues.get("GRID_ID"),
columnAndValues.get("VILLAGE_ID"),
columnAndValues.get("BUILD_ID"),
columnAndValues.get("UNIT_ID"),
columnAndValues.get("HOME_ID"),
categories));
}
} catch (Exception e) {
String errorMsg;
@ -950,4 +1004,145 @@ 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"))
//}
/**
* 生成导入调动数据
* @param existingResiMap
* @param newResiMap
* @return
*/
private ResiImportChangedData getResiImportTrasferData(Map<String, String> existingResiMap, Map<String, String> newResiMap) {
// 维度未变化,则返回null
if (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"))) {
return null;
}
HashMap<String, String> existingResiCategories = new HashMap<>();
HashMap<String, String> newResiCategories = new HashMap<>();
for (String categoryColumnName : resiCategoryItemsCache.get()) {
String oldCategoryValue = existingResiMap.get(categoryColumnName);
String newCategoryValue = newResiMap.get(categoryColumnName);
if (StringUtils.isNotBlank(oldCategoryValue) && "1".equals(oldCategoryValue)) {
existingResiCategories.put(categoryColumnName, oldCategoryValue);
}
if (StringUtils.isNotBlank(newCategoryValue) && "1".equals(newCategoryValue)) {
newResiCategories.put(categoryColumnName, newResiMap.get(categoryColumnName));
}
}
ResiImportCategoryData oldOne = new ResiImportCategoryData(
existingResiMap.get("AGENCY_ID"),
existingResiMap.get("GRID_ID"),
existingResiMap.get("VILLAGE_ID"),
existingResiMap.get("BUILD_ID"),
existingResiMap.get("UNIT_ID"),
existingResiMap.get("HOME_ID"),
existingResiCategories);
ResiImportCategoryData newOne = new ResiImportCategoryData(existingResiMap.get("AGENCY_ID"),
newResiMap.get("GRID_ID"),
newResiMap.get("VILLAGE_ID"),
newResiMap.get("BUILD_ID"),
newResiMap.get("UNIT_ID"),
newResiMap.get("HOME_ID"),
newResiCategories);
return new ResiImportChangedData(oldOne, newOne);
}
/**
* 类别变更的居民信息封装
* @param existingResiMap
* @param newResiMap
* @return
*/
private ResiImportChangedData getResiImportCategoryChangedData(Map<String, String> existingResiMap, Map<String, String> newResiMap) {
// 发生变化的类别列明
HashMap<String, String> oldCategories = new HashMap<>();
HashMap<String, String> newCategories = new HashMap<>();
List<String> categoryColumnNames = resiCategoryItemsCache.get();
for (String categoryColumnName : categoryColumnNames) {
String existingColumnValue = existingResiMap.get(categoryColumnName);
String newColumnValue = newResiMap.get(categoryColumnName);
if (StringUtils.isAllBlank(existingColumnValue, newColumnValue)) {
// 都为空,则没发生变化
continue;
} else if (StringUtils.isNoneBlank(existingColumnValue, newColumnValue)) {
// 都不为空,则执行比较
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) {
return null;
}
ResiImportCategoryData oldOne = new ResiImportCategoryData(
existingResiMap.get("AGENCY_ID"),
existingResiMap.get("GRID_ID"),
existingResiMap.get("VILLAGE_ID"),
existingResiMap.get("BUILD_ID"),
existingResiMap.get("UNIT_ID"),
existingResiMap.get("HOME_ID"),
oldCategories);
ResiImportCategoryData newOne = new ResiImportCategoryData(existingResiMap.get("AGENCY_ID"),
newResiMap.get("GRID_ID"),
newResiMap.get("VILLAGE_ID"),
newResiMap.get("BUILD_ID"),
newResiMap.get("UNIT_ID"),
newResiMap.get("HOME_ID"),
newCategories);
return new ResiImportChangedData(oldOne, newOne);
}
}

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

@ -1181,7 +1181,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
private Map<String, String> getVolunteerCategoryOptions(String customerId) {
IcFormOptionsQueryFormDTO optionsQuery = new IcFormOptionsQueryFormDTO();
optionsQuery.setCustomerId(customerId);
optionsQuery.setFormCode("resi_base_info");
optionsQuery.setFormCode(IcFormCodeEnum.RESI_BASE_INFO.getCode());
optionsQuery.setLabel("志愿者类别");
List<IcFormItemOptionsDTO> categorieDtos = getResultDataOrThrowsException(operCustomizeOpenFeignClient.listOptionsByItemConditions(optionsQuery),
ServiceConstant.OPER_CUSTOMIZE_SERVER,

9
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcUserChangeDetailedServiceImpl.java

@ -33,5 +33,12 @@ import org.springframework.stereotype.Service;
@Service
public class IcUserChangeDetailedServiceImpl extends BaseServiceImpl<IcUserChangeDetailedDao, IcUserChangeDetailedEntity> implements IcUserChangeDetailedService {
/**
* @Author sun
* @Description 删除客户是新增类型的变更明细历史数据
**/
@Override
public void delByCustomerId(String customerId, String type) {
baseDao.delByCustomerId(customerId, type);
}
}

142
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcUserChangeRecordServiceImpl.java

@ -20,29 +20,39 @@ package com.epmet.service.impl;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dao.IcResiUserDao;
import com.epmet.dao.IcUserChangeRecordDao;
import com.epmet.dto.IcResiCategoryWarnConfigDTO;
import com.epmet.dto.IcUserChangeRecordDTO;
import com.epmet.dto.form.IcResiUserChangeRecordFormDTO;
import com.epmet.dto.form.IcUserChangeRecordInitFormDTO;
import com.epmet.dto.form.IcUsercategoryAnalysisFormDTO;
import com.epmet.dto.result.AllGridsByUserIdResultDTO;
import com.epmet.dto.result.BuildingResultDTO;
import com.epmet.dto.result.IcUserChangeRecordResultDTO;
import com.epmet.dto.result.IcUsercategoryAnalysisResultDTO;
import com.epmet.entity.IcUserChangeDetailedEntity;
import com.epmet.entity.IcUserChangeRecordEntity;
import com.epmet.feign.GovOrgOpenFeignClient;
import com.epmet.feign.OperCustomizeOpenFeignClient;
import com.epmet.service.IcUserChangeDetailedService;
import com.epmet.service.IcUserChangeRecordService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
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 org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
@ -53,9 +63,18 @@ import java.util.stream.Collectors;
* @since v1.0.0 2022-01-14
*/
@Service
@Slf4j
public class IcUserChangeRecordServiceImpl extends BaseServiceImpl<IcUserChangeRecordDao, IcUserChangeRecordEntity> implements IcUserChangeRecordService {
@Autowired
private GovOrgOpenFeignClient govOrgOpenFeignClient;
@Autowired
private IcResiUserDao icResiUserDao;
@Autowired
private OperCustomizeOpenFeignClient operCustomizeOpenFeignClient;
@Autowired
private IcUserChangeRecordService icUserChangeRecordService;
@Autowired
private IcUserChangeDetailedService icUserChangeDetailedService;
/**
@ -118,4 +137,119 @@ public class IcUserChangeRecordServiceImpl extends BaseServiceImpl<IcUserChangeR
return new PageData<>(list, pageInfo.getTotal());
}
/**
* @Author sun
* @Description 历史居民数据生成变更记录和变更明细数据
**/
@Override
public void icUserChangeRecordInit(IcUserChangeRecordInitFormDTO formDTO) throws ParseException {
//1.有客户id按客户执行,没有的按ic_resi_user表有效客户执行
//入参有客户Id的则按客户Id执行,没有的则全部客户都执行
if (null != formDTO && StringUtils.isNotBlank(formDTO.getCustomerId())) {
initIcUserChange(formDTO.getCustomerId());
} else {
List<String> customerIdList = icResiUserDao.icUserCustomerIds();
for (String customerId : customerIdList) {
try {
//遍历统计每一个客户数据
initIcUserChange(customerId);
} catch (Exception e) {
log.error("初始客户居民变更记录数据失败,对应客户Id:" + customerId, e);
log.error("Error creating model JSON", e);
}
}
}
}
/**
* @Author sun
* @Description 按客户初始化客户下居民的变更记录变更明细数据
**/
@Transactional(rollbackFor = Exception.class)
public void initIcUserChange(String customerId) throws ParseException {
log.info("开始初始客户下居民的变更记录和变更明细数据,客户Id->"+customerId);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//1.获取客户居民类别预警配置表数据
Result<List<IcResiCategoryWarnConfigDTO>> resultList = operCustomizeOpenFeignClient.categoryWarnConfigList(customerId);
if (!resultList.success()) {
throw new RuntimeException("居民信息修改,获取客户居民类别预警配置表数据失败");
}
List<IcUserChangeRecordEntity> changeList = new ArrayList<>();
IcUserChangeRecordEntity change = null;
List<IcUserChangeDetailedEntity> detailedList = new ArrayList<>();
IcUserChangeDetailedEntity detailed = null;
//存放工作人员姓名
Map<String, String> hash = new HashMap<>();
//2.分批处理客户下居民数据【只查询在变更记录表不存在新增节点的居民】
int pageNo = NumConstant.ONE;
List<Map<String, String>> icUserList = new ArrayList<>();
do {
//一千条一循环查询客户下居民数据
PageHelper.startPage(pageNo, NumConstant.ONE_THOUSAND);
icUserList = icResiUserDao.getIcUserList(customerId);
pageNo++;
//3.遍历封装数据
for (Map<String,String> map : icUserList){
//存放一个人的类别为是的变更明细数据
List<IcUserChangeDetailedEntity> subList = new ArrayList<>();
String changeId = UUID.randomUUID().toString().replaceAll("-", "");
for (IcResiCategoryWarnConfigDTO dto : resultList.getData()){
if(map.containsKey(dto.getColumnName())&&"1".equals(map.get(dto.getColumnName()))){
detailed = new IcUserChangeDetailedEntity();
detailed.setCustomerId(customerId);
detailed.setIcUserChangeRecordId(changeId);
detailed.setPids(map.get("PIDS"));
detailed.setAgencyId(map.get("AGENCY_ID"));
detailed.setGridId(map.get("GRID_ID"));
detailed.setNeighborHoodId(map.get("VILLAGE_ID"));
detailed.setBuildingId(map.get("BUILD_ID"));
detailed.setBuildingUnitId(map.get("UNIT_ID"));
detailed.setHouseId(map.get("HOME_ID"));
detailed.setIcUserId(map.get("HOME_ID"));
detailed.setType("add");
detailed.setTypeName("新增");
detailed.setFieldName(dto.getColumnName());
detailed.setValue(1);
detailed.setCreatedBy(map.get("CREATED_BY"));
detailed.setCreatedTime(sdf.parse(map.get("CREATED_TIME")));
detailed.setUpdatedBy("APP_USER");
detailed.setUpdatedTime(new Date());
subList.add(detailed);
}
}
if (subList.size() > NumConstant.ZERO) {
detailedList.addAll(subList);
if (!hash.containsKey(map.get("CREATED_BY"))) {
CustomerStaffInfoCacheResult staffInfoCache = CustomerStaffRedis.getStaffInfo(customerId, map.get("CREATED_BY"));
//被删除或被移除的工作人员,名字为空
hash.put(map.get("CREATED_BY"), null != staffInfoCache ? staffInfoCache.getRealName() : "");
}
change = new IcUserChangeRecordEntity();
change.setId(changeId);
change.setCustomerId(customerId);
change.setOperatorId(map.get("CREATED_BY"));
change.setIcUserId(map.get("ID"));
change.setOperatorName(hash.get(map.get("CREATED_BY")));
change.setIcUserName(map.get("NAME"));
change.setType("add");
change.setTypeName("新增");
change.setBeforeChangeName("-");
change.setAfterChangeName("-");
change.setChangeTime(sdf.parse(map.get("CREATED_TIME")));
change.setCreatedBy(map.get("CREATED_BY"));
change.setCreatedTime(sdf.parse(map.get("CREATED_TIME")));
change.setUpdatedBy("APP_USER");
change.setUpdatedTime(new Date());
changeList.add(change);
}
}
} while (icUserList.size() == NumConstant.ONE_THOUSAND);
//4.批量新增数据,先删后增【只删除新增节点的历史数据】
baseDao.delByCustomerId(customerId, "add");
icUserChangeDetailedService.delByCustomerId(customerId, "add");
icUserChangeRecordService.insertBatch(changeList);
icUserChangeDetailedService.insertBatch(detailedList);
}
}

6
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StatsResiWarnServiceImpl.java

@ -10,6 +10,7 @@ import com.epmet.dao.IcStatsResiWarnDao;
import com.epmet.dto.IcResiCategoryStatsConfigDTO;
import com.epmet.dto.IcResiCategoryWarnConfigDTO;
import com.epmet.dto.form.IcResiCategoryStatsConfigFormDTO;
import com.epmet.dto.form.StatsResiListFormDTO;
import com.epmet.dto.result.*;
import com.epmet.entity.IcResiUserEntity;
import com.epmet.entity.IcStatsResiWarnEntity;
@ -193,6 +194,11 @@ public class StatsResiWarnServiceImpl implements StatsResiWarnService {
return result;
}
@Override
public List<IcStatsResiResultDTO> list2(StatsResiListFormDTO formDTO) {
return this.list(formDTO.getCustomerId(), formDTO.getId(), formDTO.getLevel());
}
/**
* 统计
*/

6
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/VolunteerServiceImpl.java

@ -1,6 +1,7 @@
package com.epmet.service.impl;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.enums.IcFormCodeEnum;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.ExceptionUtils;
import com.epmet.commons.tools.feign.ResultDataResolver;
@ -16,13 +17,12 @@ import com.epmet.feign.EpmetHeartOpenFeignClient;
import com.epmet.feign.GovOrgOpenFeignClient;
import com.epmet.feign.OperCustomizeOpenFeignClient;
import com.epmet.service.VolunteerService;
import com.google.common.collect.Lists;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.google.common.collect.Lists;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
@ -68,7 +68,7 @@ public class VolunteerServiceImpl implements VolunteerService, ResultDataResolve
// 2.补充图例
IcFormOptionsQueryFormDTO optionsForm = new IcFormOptionsQueryFormDTO();
optionsForm.setCustomerId(customerId);
optionsForm.setFormCode("resi_base_info");
optionsForm.setFormCode(IcFormCodeEnum.RESI_BASE_INFO.getCode());
optionsForm.setLabel("志愿者类别");
String errorMsg = "【志愿者分布】查询志愿者图例失败";

2
epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.24__alter_change_detailed.sql

@ -1,3 +1,3 @@
ALTER TABLE `ic_user_change_detailed`
ADD COLUMN `PIDS` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT ''Id'' AFTER `IC_USER_CHANGE_RECORD_ID`;
ADD COLUMN `PIDS` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '组织的所有上级Id' AFTER `IC_USER_CHANGE_RECORD_ID`;

58
epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml

@ -560,4 +560,62 @@
ORDER BY CREATED_TIME DESC
</select>
<!--查询居民信息(map格式)-->
<select id="selectResiInfoMap" resultType="java.util.Map">
select * from ic_resi_user
<where>
<if test="idCard != null and idCard != ''">
ID_CARD=#{idCard}
</if>
</where>
</select>
<select id="icUserCustomerIds" resultType="java.lang.String">
SELECT customer_id FROM ic_resi_user GROUP BY customer_id
</select>
<select id="getIcUserList" resultType="java.util.Map">
SELECT
iru.id ID,
iru.customer_id CUSTOMER_ID,
iru.agency_id AGENCY_ID,
iru.pids PIDS,
iru.grid_id GRID_ID,
iru.village_id VILLAGE_ID,
iru.build_id BUILD_ID,
iru.unit_id UNIT_ID,
iru.home_id HOME_ID,
iru.name NAME,
iru.created_by CREATED_BY,
date_format(iru.created_time, '%Y-%m-%d %h:%i:%s') CREATED_TIME,
IFNULL(iru.is_kc,'0') IS_KC,
IFNULL(iru.is_cj,'0') IS_CJ,
IFNULL(iru.is_ylfn,'0') IS_YLFN,
IFNULL(iru.is_sn,'0') IS_SN,
IFNULL(iru.is_special,'0') IS_SPECIAL,
IFNULL(iru.is_volunteer,'0') IS_VOLUNTEER,
IFNULL(iru.is_unemployed,'0') IS_UNEMPLOYED,
IFNULL(iru.is_mb,'0') IS_MB,
IFNULL(iru.is_sz,'0') IS_SZ,
IFNULL(iru.is_sd,'0') IS_SD,
IFNULL(iru.is_veterans,'0') IS_VETERANS,
IFNULL(iru.is_ensure_house,'0') IS_ENSURE_HOUSE,
IFNULL(iru.is_party,'0') IS_PARTY,
IFNULL(iru.is_old_people,'0') IS_OLD_PEOPLE,
IFNULL(iru.is_xfry,'0')IS_XFRY,
IFNULL(iru.is_united_front,'0') IS_UNITED_FRONT,
IFNULL(iru.is_db,'0') IS_DB,
IFNULL(iru.is_dbh,'0') IS_DBH
FROM
ic_resi_user iru
<!-- 只查询在变更记录表不存在新增节点的居民 -->
LEFT JOIN ic_user_change_record iucr ON iru.id = iucr.ic_user_id AND iucr.type = 'add'
WHERE
iucr.ic_user_id IS NULL
AND iru.del_flag = '0'
AND iru.`status` = '0'
AND iru.customer_id = #{customerId}
ORDER BY iru.created_time ASC
</select>
</mapper>

8
epmet-user/epmet-user-server/src/main/resources/mapper/IcUserChangeDetailedDao.xml

@ -3,5 +3,13 @@
<mapper namespace="com.epmet.dao.IcUserChangeDetailedDao">
<delete id="delByCustomerId">
DELETE
FROM
ic_user_change_detailed
WHERE
CUSTOMER_ID = #{customerId}
AND type = #{type}
</delete>
</mapper>

13
epmet-user/epmet-user-server/src/main/resources/mapper/IcUserChangeRecordDao.xml

@ -43,6 +43,9 @@
on(d.IC_USER_CHANGE_RECORD_ID=r.id and r.DEL_FLAG='0')
where d.DEL_FLAG='0'
and d.FIELD_NAME=#{categoryKey}
<if test="type != null and type !=''">
and d.type=#{type}
</if>
<if test="orgType != null and orgType !=''">
<if test="orgType == 'agency'">
and (d.AGENCY_ID=#{orgId} or d.pids like concat('%',#{orgId},'%'))
@ -55,4 +58,14 @@
<![CDATA[ AND DATE_FORMAT( d.CREATED_TIME, '%Y%m%d' ) <= #{endDate} ]]>
order by d.CREATED_TIME asc,d.id asc
</select>
<delete id="delByCustomerId">
DELETE
FROM
ic_user_change_record
WHERE
CUSTOMER_ID = #{customerId}
AND type = #{type}
</delete>
</mapper>

3
epmet-user/epmet-user-server/src/test/java/com/epmet/epmetuser/test/IcResiUserControllerTest.java

@ -5,6 +5,7 @@ import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
import cn.afterturn.easypoi.excel.export.ExcelExportService;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.epmet.commons.tools.enums.IcFormCodeEnum;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.utils.Result;
@ -61,7 +62,7 @@ public class IcResiUserControllerTest {
@NotNull
private CustomerFormResultDTO getResiFormItems(String customerId) {
CustomerFormQueryDTO queryDTO = new CustomerFormQueryDTO();
queryDTO.setFormCode("resi_base_info");
queryDTO.setFormCode(IcFormCodeEnum.RESI_BASE_INFO.getCode());
queryDTO.setCustomerId(customerId);
Result<CustomerFormResultDTO> resultForm = operCustomizeOpenFeignClient.getCustomerForm(queryDTO);
if (resultForm == null || !resultForm.success() ||resultForm.getData() == null){

Loading…
Cancel
Save