Browse Source

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

 Conflicts:
	epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java
	epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java
dev_shibei_match
wangxianzhang 4 years ago
parent
commit
c1531d3e06
  1. 5
      epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/ConsomerGroupConstants.java
  2. 5
      epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/TopicConstants.java
  3. 20
      epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/messages/IcWarnStatsMQMsg.java
  4. 26
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/IcResiDetailFormDTO.java
  5. 38
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/IcResiUserPageFormDTO.java
  6. 20
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/ResiUserQueryValueDTO.java
  7. 173
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/IcResiUserPageResultDTO.java
  8. 61
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/result/HouseInfoDTO.java
  9. 72
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/IcResiUserController.java
  10. 45
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/IcResiUserDao.java
  11. 1
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerAgencyDao.java
  12. 5
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/opercustomize/CustomerFootBarDao.java
  13. 32
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/IcResiUserService.java
  14. 255
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/IcResiUserServiceImpl.java
  15. 2
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/GovOrgService.java
  16. 7
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java
  17. 9
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/opercustomize/CustomerFootBarService.java
  18. 15
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/opercustomize/impl/CustomerFootBarServiceImpl.java
  19. 129
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/IcResiUserDao.xml
  20. 22
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerAgencyDao.xml
  21. 50
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/opercustomize/CustomerFootBarDao.xml
  22. 10
      epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/constant/SystemMessageType.java
  23. 4
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/SystemMessageServiceImpl.java
  24. 2
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcPropertyManagementFormDTO.java
  25. 7
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/PropertyManagementController.java
  26. 7
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/PropertyManagementService.java
  27. 3
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/PropertyManagementServiceImpl.java
  28. 12
      epmet-user/epmet-user-server/pom.xml
  29. 320
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java
  30. 31
      epmet-user/epmet-user-server/src/main/java/com/epmet/mq/RocketMQWarnStatsRegister.java
  31. 104
      epmet-user/epmet-user-server/src/main/java/com/epmet/mq/listener/ICWarnStatsEventListener.java
  32. 39
      epmet-user/epmet-user-server/src/main/java/com/epmet/mq/listener/InitCustomerRolesListener.java
  33. 47
      epmet-user/epmet-user-server/src/main/java/com/epmet/redis/IcResiUserRedis.java
  34. 60
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java
  35. 111
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java
  36. 4
      epmet-user/epmet-user-server/src/main/resources/bootstrap.yml
  37. BIN
      epmet-user/epmet-user-server/src/main/resources/excel/ic_resi_info_cid.xls
  38. 16
      epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml
  39. 183
      epmet-user/epmet-user-server/src/test/java/com/epmet/epmetuser/test/IcResiUserControllerTest.java

5
epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/ConsomerGroupConstants.java

@ -65,4 +65,9 @@ public interface ConsomerGroupConstants {
*/
String OPEN_DATA_PROJECT_CHANGE_EVENT_LISTENER_GROUP = "open_data_project_change_event_listener_group";
/**
* 开放的人员信息变更预警统计
*/
String IC_WARN_STATS_EVENT_LISTENER_GROUP = "ic_warn_stats_event_listener_group";
}

5
epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/TopicConstants.java

@ -48,4 +48,9 @@ public interface TopicConstants {
* 项目
*/
String PROJECT = "project";
/**
* 项目
*/
String IC_RESI_USER = "ic_resi_user";
}

20
epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/messages/IcWarnStatsMQMsg.java

@ -0,0 +1,20 @@
package com.epmet.commons.rocketmq.messages;
import lombok.Data;
import java.io.Serializable;
/**
* 居民信息新增修改推送MQ
* @author sun
*/
@Data
public class IcWarnStatsMQMsg implements Serializable {
//客户Id
private String customerId;
//居民ID
private String icResiUser;
}

26
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/IcResiDetailFormDTO.java

@ -1,26 +0,0 @@
package com.epmet.dataaggre.dto.epmetuser.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @Description 查看详情回显表单
* @Author yinzuomei
* @Date 2021/10/27 10:22 下午
*/
@Data
public class IcResiDetailFormDTO implements Serializable {
public interface AddUserInternalGroup {
}
@NotBlank(message = "icResiUserId不能为空",groups = AddUserInternalGroup.class)
private String icResiUserId;
@NotBlank(message = "formCode不能为空", groups = AddUserInternalGroup.class)
private String formCode;
@NotBlank(message = "customerId不能为空", groups = AddUserInternalGroup.class)
private String customerId;
}

38
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/IcResiUserPageFormDTO.java

@ -1,38 +0,0 @@
package com.epmet.dataaggre.dto.epmetuser.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.List;
/**
* @Description 居民信息分页查询入参
* @Author yinzuomei
* @Date 2021/10/27 2:06 下午
*/
@Data
public class IcResiUserPageFormDTO implements Serializable {
public interface AddUserInternalGroup {
}
@NotNull(message = "pageNo不能为空", groups = AddUserInternalGroup.class)
private Integer pageNo;
@NotNull(message = "pageSize不能为空", groups = AddUserInternalGroup.class)
private Integer pageSize;
@NotBlank(message = "formCode不能为空", groups = AddUserInternalGroup.class)
private String formCode;
@NotBlank(message = "customerId不能为空", groups = AddUserInternalGroup.class)
private String customerId;
/**
* 表对应的字段及值
*/
private List<ResiUserQueryValueDTO> conditions;
private Boolean pageFlag;
}

20
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/ResiUserQueryValueDTO.java

@ -1,20 +0,0 @@
package com.epmet.dataaggre.dto.epmetuser.form;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @Description TODO
* @Author yinzuomei
* @Date 2021/10/27 6:02 下午
*/
@Data
public class ResiUserQueryValueDTO implements Serializable {
private String queryType;
private List<String> columnValue;
private String columnName;
private String tableName;
}

173
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/IcResiUserPageResultDTO.java

@ -1,173 +0,0 @@
package com.epmet.dataaggre.dto.epmetuser.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Description 居民信息分页查询表单返参
* @Author yinzuomei
* @Date 2021/10/27 2:07 下午
*/
@Data
public class IcResiUserPageResultDTO implements Serializable {
private String icResiUserId;
private String gridId;
private String gridName;
/**
* 所属小区ID
*/
private String villageId;
private String vallageName;
/**
* 所属楼宇Id
*/
private String buildId;
private String buildName;
/**
* 单元id
*/
private String unitId;
private String unitName;
/**
* 所属家庭Id
*/
private String homeId;
private String homeName;
/**
* 姓名
*/
private String name;
/**
* 手机号
*/
private String mobile;
/**
* 性别
*/
private String gender;
/**
* 身份证号
*/
private String idCard;
/**
* 出生日期
*/
private String birthday;
/**
* 备注
*/
private String remarks;
/**
* 是否党员
*/
private Boolean isParty;
/**
* 是否低保户
*/
private Boolean isDbh;
/**
* 是否保障房
*/
private Boolean isEnsureHouse;
/**
* 是否失业
*/
private Boolean isUnemployed;
/**
* 是否育龄妇女
*/
private Boolean isYlfn;
/**
* 是否退役军人
*/
private Boolean isVeterans;
/**
* 是否统战人员
*/
private Boolean isUnitedFront;
/**
* 是否信访人员
*/
private Boolean isXfry;
/**
* 是否志愿者
*/
private Boolean isVolunteer;
/**
* 是否老年人
*/
private Boolean isOldPeople;
/**
* 是否空巢
*/
private Boolean isKc;
/**
* 是否失独
*/
private Boolean isSd;
/**
* 是否失能
*/
private Boolean isSn;
/**
* 是否失智
*/
private Boolean isSz;
/**
* 是否残疾
*/
private Boolean isCj;
/**
* 是否大病
*/
private Boolean isDb;
/**
* 是否慢病
*/
private Boolean isMb;
/**
* 是否特殊人群
*/
private Boolean isSpecial;
// 以下属性都需要单独处理,不是直接取数据库的字段
private String demandCategoryIds;
private String demandName;
/**
* 房屋类型1楼房2平房3别墅
*/
private String houseType;
}

61
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/result/HouseInfoDTO.java

@ -1,61 +0,0 @@
package com.epmet.dataaggre.dto.govorg.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Description TODO
* @Author yinzuomei
* @Date 2021/10/28 2:05 下午
*/
@Data
public class HouseInfoDTO implements Serializable {
private static final long serialVersionUID = -5204197079709062825L;
/**
* 所属家庭Id
*/
private String homeId;
/**
* 小区id
*/
private String neighborHoodId;
/**
* 小区名称
*/
private String neighborHoodName;
/**
* 所属楼栋id
*/
private String buildingId;
/**
* 楼栋名称
*/
private String buildingName;
/**
* 所属单元id
*/
private String buildingUnitId;
/**
* 单元名
*/
private String unitName;
/**
* 门牌号
*/
private String doorName;
/**
* 房屋类型1楼房2平房3别墅
*/
private String houseType;
}

72
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/IcResiUserController.java

@ -1,72 +0,0 @@
package com.epmet.dataaggre.controller;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dataaggre.dto.epmetuser.form.IcResiDetailFormDTO;
import com.epmet.dataaggre.dto.epmetuser.form.IcResiUserPageFormDTO;
import com.epmet.dataaggre.dto.epmetuser.result.IcResiUserPageResultDTO;
import com.epmet.dataaggre.service.epmetuser.IcResiUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
/**
* @Description TODO
* @Author yinzuomei
* @Date 2021/10/27 2:03 下午
*/
@RestController
@RequestMapping("icresiuser")
public class IcResiUserController {
@Autowired
private IcResiUserService icResiUserService;
/**
* 分页查询居民信息列表
*
* @param tokenDto
* @param pageFormDTO
* @return com.epmet.commons.tools.utils.Result<com.epmet.commons.tools.page.PageData<com.epmet.dataaggre.dto.epmetuser.result.IcResiUserPageResultDTO>>
* @author yinzuomei
* @date 2021/10/28 10:29 上午
*/
//@PostMapping("listresi1")
public Result<PageData<IcResiUserPageResultDTO>> queryListResi(@LoginUser TokenDto tokenDto, @RequestBody IcResiUserPageFormDTO pageFormDTO){
//pageFormDTO.setCustomerId("45687aa479955f9d06204d415238f7cc");
pageFormDTO.setCustomerId(tokenDto.getCustomerId());
ValidatorUtils.validateEntity(pageFormDTO,IcResiUserPageFormDTO.AddUserInternalGroup.class);
return new Result<PageData<IcResiUserPageResultDTO>>().ok(icResiUserService.pageResi(pageFormDTO));
}
//@PostMapping("listresi")
public Result<PageData<Map<String,Object>>> queryListResi1(@LoginUser TokenDto tokenDto, @RequestBody IcResiUserPageFormDTO pageFormDTO){
//pageFormDTO.setCustomerId("45687aa479955f9d06204d415238f7cc");
pageFormDTO.setCustomerId(tokenDto.getCustomerId());
ValidatorUtils.validateEntity(pageFormDTO,IcResiUserPageFormDTO.AddUserInternalGroup.class);
return new Result<PageData<Map<String,Object>>>().ok(icResiUserService.pageResiMap(pageFormDTO));
}
/**
* 编辑页面显示居民信息详情
*
* @param pageFormDTO
* @return com.epmet.commons.tools.utils.Result
* @author yinzuomei
* @date 2021/10/28 10:29 上午
*/
//@PostMapping("detail")
public Result queryIcResiDetail(@LoginUser TokenDto tokenDto,@RequestBody IcResiDetailFormDTO pageFormDTO){
//pageFormDTO.setCustomerId("45687aa479955f9d06204d415238f7cc");
pageFormDTO.setCustomerId(tokenDto.getCustomerId());
ValidatorUtils.validateEntity(pageFormDTO,IcResiDetailFormDTO.AddUserInternalGroup.class);
return new Result().ok(icResiUserService.queryIcResiDetail(pageFormDTO));
}
}

45
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/IcResiUserDao.java

@ -1,45 +0,0 @@
package com.epmet.dataaggre.dao.epmetuser;
import com.epmet.dataaggre.dto.epmetuser.IcFormResColumnDTO;
import com.epmet.dataaggre.dto.epmetuser.form.ResiUserQueryValueDTO;
import com.epmet.dataaggre.dto.epmetuser.result.IcResiUserPageResultDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
@Mapper
public interface IcResiUserDao {
List<IcResiUserPageResultDTO> selectListResi(@Param("customerId") String customerId,
@Param("formCode") String formCode,
@Param("conditions") List<ResiUserQueryValueDTO> conditions,
@Param("resultColumns") List<IcFormResColumnDTO> resultColumns,
@Param("subTables") List<String> subTables);
List<Map<String,Object>> selectListResiMap(@Param("customerId") String customerId,
@Param("formCode") String formCode,
@Param("conditions") List<ResiUserQueryValueDTO> conditions,
@Param("resultColumns") List<IcFormResColumnDTO> resultColumns,
@Param("subTables") List<String> subTables);
/**
* 查询主表
*
* @param icResiUserId
* @return java.util.List<java.util.Map<java.lang.String,java.lang.Object>>
* @author yinzuomei
* @date 2021/10/28 11:20 上午
*/
List<Map<String, Object>> selectById(String icResiUserId);
/**
* 根据ic_resi_user.id去查询各个子表记录动态传入表名
*
* @param icResiUserId
* @param tableName
* @return java.util.List<java.util.Map<java.lang.String,java.lang.Object>>
* @author yinzuomei
* @date 2021/10/28 11:19 上午
*/
List<Map<String, Object>> selectSubTableRecords(@Param("icResiUserId") String icResiUserId,@Param("tableName") String tableName);
}

1
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerAgencyDao.java

@ -100,5 +100,4 @@ public interface CustomerAgencyDao extends BaseDao<CustomerAgencyEntity> {
*/
List<String> getOrgList(@Param("staffId") String staffId);
List<HouseInfoDTO> queryHouseInfo(@Param("houseIdList") Set<String> houseIdList);
}

5
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/opercustomize/CustomerFootBarDao.java

@ -59,9 +59,4 @@ public interface CustomerFootBarDao extends BaseDao<CustomerFootBarEntity> {
*/
CustomerFootBarEntity selectDefaultIcon(@Param("customerId") String customerId, @Param("appType")String appType, @Param("barKey")String barKey);
List<IcFormResColumnDTO> queryConditions(@Param("customerId") String customerId, @Param("formCode")String formCode);
List<String> querySubTables(@Param("customerId") String customerId, @Param("formCode")String formCode);
Set<String> queryIcResiSubTables(@Param("customerId") String customerId, @Param("formCode")String formCode);
}

32
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/IcResiUserService.java

@ -1,32 +0,0 @@
package com.epmet.dataaggre.service.epmetuser;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dataaggre.dto.epmetuser.form.IcResiDetailFormDTO;
import com.epmet.dataaggre.dto.epmetuser.form.IcResiUserPageFormDTO;
import com.epmet.dataaggre.dto.epmetuser.result.IcResiUserPageResultDTO;
import java.util.Map;
public interface IcResiUserService {
/**
* 分页查询居民信息列表
*
* @param pageFormDTO
* @return com.epmet.commons.tools.page.PageData<com.epmet.dataaggre.dto.epmetuser.result.IcResiUserPageResultDTO>
* @author yinzuomei
* @date 2021/10/28 10:30 上午
*/
@Deprecated
PageData<IcResiUserPageResultDTO> pageResi(IcResiUserPageFormDTO pageFormDTO);
PageData<Map<String,Object>> pageResiMap(IcResiUserPageFormDTO formDTO);
/**
* 编辑页面显示居民信息详情
*
* @param pageFormDTO
* @return java.util.Map
* @author yinzuomei
* @date 2021/10/28 10:29 上午
*/
Map queryIcResiDetail(IcResiDetailFormDTO pageFormDTO);
}

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

@ -1,255 +0,0 @@
package com.epmet.dataaggre.service.epmetuser.impl;
import com.alibaba.fastjson.JSON;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.enums.GenderEnum;
import com.epmet.commons.tools.enums.HouseTypeEnum;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dataaggre.constant.DataSourceConstant;
import com.epmet.dataaggre.constant.OrgConstant;
import com.epmet.dataaggre.dao.epmetuser.IcResiUserDao;
import com.epmet.dataaggre.dto.epmetuser.IcFormResColumnDTO;
import com.epmet.dataaggre.dto.epmetuser.form.IcResiDetailFormDTO;
import com.epmet.dataaggre.dto.epmetuser.form.IcResiUserPageFormDTO;
import com.epmet.dataaggre.dto.epmetuser.result.IcResiUserPageResultDTO;
import com.epmet.dataaggre.dto.govorg.result.GridsInfoListResultDTO;
import com.epmet.dataaggre.dto.govorg.result.HouseInfoDTO;
import com.epmet.dataaggre.service.epmetuser.IcResiUserService;
import com.epmet.dataaggre.service.govorg.GovOrgService;
import com.epmet.dataaggre.service.opercustomize.CustomerFootBarService;
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.util.CollectionUtils;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* @Description TODO
* @Author yinzuomei
* @Date 2021/10/27 2:04 下午
*/
@Service
@DataSource(DataSourceConstant.EPMET_USER)
@Slf4j
public class IcResiUserServiceImpl implements IcResiUserService {
@Autowired
private IcResiUserDao icResiUserDao;
@Autowired
private CustomerFootBarService customerFootBarService;
@Autowired
private GovOrgService govOrgService;
/**
* 分页查询居民信息列表
*
* @param formDTO
* @return com.epmet.commons.tools.page.PageData<com.epmet.dataaggre.dto.epmetuser.result.IcResiUserPageResultDTO>
* @author yinzuomei
* @date 2021/10/28 10:30 上午
*/
@Override
public PageData<IcResiUserPageResultDTO> pageResi(IcResiUserPageFormDTO formDTO) {
// 查询列表展示项,如果没有,直接返回
List<IcFormResColumnDTO> resultColumns = customerFootBarService.queryConditions(formDTO.getCustomerId(), formDTO.getFormCode());
if (CollectionUtils.isEmpty(resultColumns)) {
log.warn("没有配置列表展示列");
return new PageData(new ArrayList(), NumConstant.ZERO);
}
log.warn("列表展示项:" + JSON.toJSONString(resultColumns));
// 查询列表展示项需要用到哪些子表
// 拼接好的left join table_name on (ic_resi_user.ID=table_name.IC_RESI_USER AND table_name.del_flag='0')
List<String> subTables = customerFootBarService.querySubTables(formDTO.getCustomerId(), formDTO.getFormCode());
log.warn("子表:" + JSON.toJSONString(subTables));
/* Set<String> subTableList=resultColumns.stream().filter(item->!item.getTableName().equals("ic_resi_user")
&& StringUtils.isNotBlank(item.getLink()))
.map(IcFormResColumnDTO :: getTableName).collect(Collectors.toSet());
List<String> subTables=new ArrayList<>();
subTableList.forEach(tableName->{
//'left join ',temp.TABLE_NAME, ' on ( ic_resi_user.ID=',temp.TABLE_NAME,'.IC_RESI_USER and ',temp.TABLE_NAME,'.del_flag="0" )'
String joinSql=String.format("% join %s on ( ic_resi_user.ID=%s.IC_RESI_USER and %s.del_flag=\"0\" ");
subTables.add(joinSql);
});*/
PageInfo<IcResiUserPageResultDTO> pageInfo = PageHelper.startPage(formDTO.getPageNo(),
formDTO.getPageSize()).doSelectPageInfo(() -> icResiUserDao.selectListResi(formDTO.getCustomerId(),
formDTO.getFormCode(),
formDTO.getConditions(),
resultColumns,
subTables));
List<IcResiUserPageResultDTO> list = pageInfo.getList();
//查询网格名称
List<String> gridIds = list.stream().map(IcResiUserPageResultDTO::getGridId).collect(Collectors.toList());
log.warn("gridIds:" + JSON.toJSONString(gridIds));
List<GridsInfoListResultDTO> gridInfoList = govOrgService.gridListByIds(gridIds);
log.warn(JSON.toJSONString(gridInfoList));
Map<String, GridsInfoListResultDTO> gridInfoMap = gridInfoList.stream().collect(Collectors.toMap(GridsInfoListResultDTO::getGridId, Function.identity()));
//查询房子名称
Set<String> houseIds = list.stream().map(IcResiUserPageResultDTO::getHomeId).collect(Collectors.toSet());
List<HouseInfoDTO> houseInfoDTOList = govOrgService.queryHouseInfo(houseIds);
Map<String, HouseInfoDTO> houseInfoMap = houseInfoDTOList.stream().collect(Collectors.toMap(HouseInfoDTO::getHomeId, Function.identity()));
for (IcResiUserPageResultDTO resultDTO : list) {
if (null != gridInfoMap && gridInfoMap.containsKey(resultDTO.getGridId())) {
resultDTO.setGridName(gridInfoMap.get(resultDTO.getGridId()).getGridName());
}
if (null != houseInfoMap && houseInfoMap.containsKey(resultDTO.getHomeId())) {
resultDTO.setBuildName(houseInfoMap.get(resultDTO.getHomeId()).getBuildingName());
resultDTO.setVallageName(houseInfoMap.get(resultDTO.getHomeId()).getNeighborHoodName());
resultDTO.setUnitName(houseInfoMap.get(resultDTO.getHomeId()).getUnitName());
resultDTO.setHomeName(houseInfoMap.get(resultDTO.getHomeId()).getDoorName());
resultDTO.setHouseType(houseInfoMap.get(resultDTO.getHomeId()).getHouseType());
}
}
pageInfo.setList(list);
return new PageData<>(pageInfo.getList(), pageInfo.getTotal());
}
public PageData<Map<String, Object>> pageResiMap(IcResiUserPageFormDTO formDTO) {
// 查询列表展示项,如果没有,直接返回
List<IcFormResColumnDTO> resultColumns = customerFootBarService.queryConditions(formDTO.getCustomerId(), formDTO.getFormCode());
if (CollectionUtils.isEmpty(resultColumns)) {
log.warn("没有配置列表展示列");
return new PageData(new ArrayList(), NumConstant.ZERO);
}
// 查询列表展示项需要用到哪些子表
// 拼接好的left join table_name on (ic_resi_user.ID=table_name.IC_RESI_USER AND table_name.del_flag='0')
List<String> subTables = customerFootBarService.querySubTables(formDTO.getCustomerId(), formDTO.getFormCode());
PageInfo<Map<String, Object>> pageInfo=new PageInfo<>();
if (null == formDTO.getPageFlag()||formDTO.getPageFlag()) {
//分页
pageInfo= PageHelper.startPage(formDTO.getPageNo(),
formDTO.getPageSize()).doSelectPageInfo(() -> icResiUserDao.selectListResiMap(formDTO.getCustomerId(),
formDTO.getFormCode(),
formDTO.getConditions(),
resultColumns,
subTables));
}else{
List<Map<String,Object>> list=icResiUserDao.selectListResiMap(formDTO.getCustomerId(),
formDTO.getFormCode(),
formDTO.getConditions(),
resultColumns,
subTables);
pageInfo.setTotal(CollectionUtils.isEmpty(list)?NumConstant.ZERO:list.size());
pageInfo.setList(list);
}
List<Map<String, Object>> list = pageInfo.getList();
//查询网格名称
List<String> gridIds = new ArrayList<>();
Set<String> houseIds = new HashSet<>();
for (Map<String, Object> map : list) {
log.warn(JSON.toJSONString(map));
if (map.containsKey(OrgConstant.GRID_ID) && null != map.get(OrgConstant.GRID_ID) && StringUtils.isNotBlank(map.get(OrgConstant.GRID_ID).toString())) {
gridIds.add(map.get(OrgConstant.GRID_ID).toString());
}
if (map.containsKey("HOME_ID") && null != map.get("HOME_ID") && StringUtils.isNotBlank(map.get("HOME_ID").toString())) {
houseIds.add(map.get("HOME_ID").toString());
}
}
List<GridsInfoListResultDTO> gridInfoList = govOrgService.gridListByIds(gridIds);
Map<String, GridsInfoListResultDTO> gridInfoMap = gridInfoList.stream().collect(Collectors.toMap(GridsInfoListResultDTO::getGridId, Function.identity()));
//查询房子名称
List<HouseInfoDTO> houseInfoDTOList = govOrgService.queryHouseInfo(houseIds);
Map<String, HouseInfoDTO> houseInfoMap = houseInfoDTOList.stream().collect(Collectors.toMap(HouseInfoDTO::getHomeId, Function.identity()));
for (Map<String, Object> resultMap : list) {
String gridIdValue = null != resultMap.get(OrgConstant.GRID_ID) ? resultMap.get(OrgConstant.GRID_ID).toString() : StrConstant.EPMETY_STR;
resultMap.put("GRID_ID_VALUE", gridIdValue);
if (null != gridInfoMap && gridInfoMap.containsKey(gridIdValue) && null != gridInfoMap.get(gridIdValue)) {
//GRID_NAME
resultMap.put(OrgConstant.GRID_ID, gridInfoMap.get(gridIdValue).getGridName());
}
String homeId = null != resultMap.get("HOME_ID") ? resultMap.get("HOME_ID").toString() : StrConstant.EPMETY_STR;
resultMap.put("HOME_ID_VALUE", homeId);
if (null != houseInfoMap && houseInfoMap.containsKey(homeId) && null != houseInfoMap.get(homeId)) {
HouseInfoDTO houseInfoDTO = houseInfoMap.get(homeId);
String buildName = StringUtils.isNotBlank(houseInfoDTO.getBuildingName()) ? houseInfoDTO.getBuildingName() : StrConstant.EPMETY_STR;
resultMap.put("BUILD_NAME", buildName);
String neighBorName = StringUtils.isNotBlank(houseInfoDTO.getNeighborHoodName()) ? houseInfoDTO.getNeighborHoodName() : StrConstant.EPMETY_STR;
resultMap.put("VILLAGE_NAME", neighBorName);
String unitName = StringUtils.isNotBlank(houseInfoDTO.getUnitName()) ? houseInfoDTO.getUnitName() : StrConstant.EPMETY_STR;
resultMap.put("UNIT_NAME", unitName);
String doorName = StringUtils.isNotBlank(houseInfoDTO.getDoorName()) ? houseInfoDTO.getDoorName() : StrConstant.EPMETY_STR;
resultMap.put("DOOR_NAME", doorName);
String houseType = StringUtils.isNotBlank(houseInfoDTO.getHouseType()) ? houseInfoDTO.getHouseType() : StrConstant.EPMETY_STR;
//房屋类型,1楼房,2平房,3别墅
resultMap.put(OrgConstant.HOUSE_TYPE_KEY, "");
if (HouseTypeEnum.LOUFANG.getCode().equals(houseType)) {
resultMap.put(OrgConstant.HOUSE_TYPE_KEY, HouseTypeEnum.LOUFANG.getName());
} else if (HouseTypeEnum.PINGFANG.getCode().equals(houseType)) {
resultMap.put(OrgConstant.HOUSE_TYPE_KEY, HouseTypeEnum.PINGFANG.getName());
} else if (HouseTypeEnum.BIESHU.getCode().equals(houseType)) {
resultMap.put(OrgConstant.HOUSE_TYPE_KEY, HouseTypeEnum.BIESHU.getName());
}
resultMap.put("HOME_ID", neighBorName.concat(buildName).concat(unitName).concat(doorName));
}
if (resultMap.containsKey(OrgConstant.GENDER)) {
String genderValue = null != resultMap.get(OrgConstant.GENDER) ? resultMap.get(OrgConstant.GENDER).toString() : StrConstant.EPMETY_STR;
if (GenderEnum.MAN.getCode().equals(genderValue)) {
resultMap.put(OrgConstant.GENDER, GenderEnum.MAN.getName());
} else if (GenderEnum.WOMAN.getCode().equals(genderValue)) {
resultMap.put(OrgConstant.GENDER, GenderEnum.WOMAN.getName());
} else if (GenderEnum.UN_KNOWN.getCode().equals(genderValue)) {
resultMap.put(OrgConstant.GENDER, GenderEnum.UN_KNOWN.getName());
}
}
}
pageInfo.setList(list);
return new PageData<>(pageInfo.getList(), pageInfo.getTotal());
}
/**
* 编辑页面显示居民信息详情
*
* @param pageFormDTO
* @return java.util.Map
* @author yinzuomei
* @date 2021/10/28 10:29 上午
*/
@Override
public Map queryIcResiDetail(IcResiDetailFormDTO pageFormDTO) {
Map resultMap = new HashMap();
// 先查询主表,主表没有记录,直接返回空
List<Map<String, Object>> icResiUserMapList = icResiUserDao.selectById(pageFormDTO.getIcResiUserId());
if (CollectionUtils.isEmpty(icResiUserMapList)) {
return new HashMap();
}
resultMap.put("ic_resi_user", icResiUserMapList);
//循环查询每个子表的记录
Set<String> subTableList = customerFootBarService.queryIcResiSubTables(pageFormDTO.getCustomerId(), pageFormDTO.getFormCode());
for (String subTalbeName : subTableList) {
List<Map<String, Object>> list = icResiUserDao.selectSubTableRecords(pageFormDTO.getIcResiUserId(), subTalbeName);
if (!CollectionUtils.isEmpty(list)) {
resultMap.put(subTalbeName, list);
}
//else{
// resultMap.put(subTalbeName,new ArrayList<>());
//}
}
return resultMap;
}
}

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

@ -12,7 +12,6 @@ import com.epmet.dataaggre.dto.govorg.result.*;
import com.epmet.dataaggre.dto.resigroup.result.OrgInfoCommonDTO;
import java.util.List;
import java.util.Set;
/**
* @Author zxc
@ -156,5 +155,4 @@ public interface GovOrgService {
*/
List<String> getStaffOrgList(String staffId);
List<HouseInfoDTO> queryHouseInfo(Set<String> houseIdList);
}

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

@ -532,12 +532,5 @@ public class GovOrgServiceImpl implements GovOrgService {
return customerAgencyDao.getOrgList(staffId);
}
@Override
public List<HouseInfoDTO> queryHouseInfo(Set<String> houseIdList) {
if(CollectionUtils.isEmpty(houseIdList)){
return new ArrayList<>();
}
return customerAgencyDao.queryHouseInfo(houseIdList);
}
}

9
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/opercustomize/CustomerFootBarService.java

@ -20,12 +20,8 @@ package com.epmet.dataaggre.service.opercustomize;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.dataaggre.dto.app.form.AppFootBarFormDTO;
import com.epmet.dataaggre.dto.app.result.AppFootBarResultDTO;
import com.epmet.dataaggre.dto.epmetuser.IcFormResColumnDTO;
import com.epmet.dataaggre.entity.opercustomize.CustomerFootBarEntity;
import java.util.List;
import java.util.Set;
/**
* APP底部菜单栏信息
*
@ -44,9 +40,4 @@ public interface CustomerFootBarService extends BaseService<CustomerFootBarEntit
*/
AppFootBarResultDTO queryAppFootBars(AppFootBarFormDTO footBarFormDTO);
List<IcFormResColumnDTO> queryConditions(String customerId, String formCode);
List<String> querySubTables(String customerId, String formCode);
Set<String> queryIcResiSubTables(String customerId, String formCode);
}

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

@ -114,19 +114,4 @@ public class CustomerFootBarServiceImpl extends BaseServiceImpl<CustomerFootBarD
return resultDTO;
}
@Override
public List<IcFormResColumnDTO> queryConditions(String customerId, String formCode) {
return baseDao.queryConditions(customerId,formCode);
}
@Override
public List<String> querySubTables(String customerId, String formCode) {
return baseDao.querySubTables(customerId,formCode);
}
@Override
public Set<String> queryIcResiSubTables(String customerId, String formCode) {
return baseDao.queryIcResiSubTables(customerId,formCode);
}
}

129
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/IcResiUserDao.xml

@ -1,129 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dataaggre.dao.epmetuser.IcResiUserDao">
<!-- <insert id="add">-->
<!-- insert into ${tableName}-->
<!-- (-->
<!-- <foreach collection="map.entrySet()" index="key" item="value" separator=",">-->
<!-- ${key}-->
<!-- </foreach>-->
<!-- ,DEL_FLAG-->
<!-- ,REVISION-->
<!-- ,CREATED_TIME-->
<!-- ,UPDATED_TIME-->
<!-- ) values-->
<!-- (-->
<!-- <foreach collection="map.entrySet()" index="key" item="value" separator=",">-->
<!-- #{value}-->
<!-- </foreach>-->
<!-- ,'0'-->
<!-- ,'0'-->
<!-- ,NOW()-->
<!-- ,NOW()-->
<!-- )-->
<!-- </insert>-->
<select id="selectListResi" parameterType="map" resultType="com.epmet.dataaggre.dto.epmetuser.result.IcResiUserPageResultDTO">
select
ic_resi_user.id as icResiUserId,
<foreach item="column" collection="resultColumns" open="" separator="," close="">
${column.columnName}
</foreach>
,
GROUP_CONCAT(ic_resi_demand.CATEGORY_CODE) as demandCategoryIds,
GROUP_CONCAT(ic_resi_demand_dict.CATEGORY_NAME) as demandName
FROM
ic_resi_user
<if test="null != subTables and subTables.size() > 0">
<foreach item="subTableName" collection="subTables" open="" separator="" close="">
${subTableName}
</foreach>
</if>
left join ic_resi_demand_dict
on(ic_resi_user.customer_id=ic_resi_demand_dict.CUSTOMER_ID
and ic_resi_demand.CATEGORY_CODE=ic_resi_demand_dict.CATEGORY_CODE )
WHERE
ic_resi_user.DEL_FLAG = '0'
and ic_resi_user.customer_id=#{customerId}
<if test="null != conditions and conditions.size() > 0">
<foreach item="subCondition" collection="conditions" open="" separator="" close="">
<if test="null != subCondition.columnValue and subCondition.columnValue.size() > 0">
<if test="subCondition.queryType!= null and subCondition.queryType == 'equal' ">
and ${subCondition.tableName}.${subCondition.columnName} = #{subCondition.columnValue[0]}
</if>
<if test="subCondition.queryType!= null and subCondition.queryType == 'like' ">
and ${subCondition.tableName}.${subCondition.columnName} like concat('%',#{subCondition.columnValue[0]},'%')
</if>
<if test="subCondition.queryType!= null and subCondition.queryType == 'daterange' ">
and ${subCondition.tableName}.${subCondition.columnName} between #{subCondition.columnValue[0]} and #{subCondition.columnValue[1]}
</if>
</if>
</foreach>
</if>
group by IC_RESI_USER.id
order by ic_resi_user.CREATED_TIME desc
</select>
<select id="selectById" parameterType="java.lang.String" resultType="map">
select * from ic_resi_user where del_flag='0' and id=#{icResiUserId}
</select>
<select id="selectSubTableRecords" parameterType="map" resultType="map">
select * from ${tableName} where del_flag='0' and IC_RESI_USER=#{icResiUserId}
</select>
<select id="selectListResiMap" parameterType="map" resultType="map">
select
ic_resi_user.id as icResiUserId,
<foreach item="column" collection="resultColumns" open="" separator="," close="">
${column.columnName}
</foreach>
,
GROUP_CONCAT(ic_resi_demand.CATEGORY_CODE) as DEMAND_CATEGORY_IDS,
GROUP_CONCAT(ic_resi_demand_dict.CATEGORY_NAME) as DEMAND_NAME
FROM
ic_resi_user
<if test="null != subTables and subTables.size() > 0">
<foreach item="subTableName" collection="subTables" open="" separator="" close="">
${subTableName}
</foreach>
</if>
left join ic_resi_demand_dict
on(ic_resi_user.customer_id=ic_resi_demand_dict.CUSTOMER_ID
and ic_resi_demand.CATEGORY_CODE=ic_resi_demand_dict.CATEGORY_CODE )
WHERE
ic_resi_user.DEL_FLAG = '0'
and ic_resi_user.customer_id=#{customerId}
<if test="null != conditions and conditions.size() > 0">
<foreach item="subCondition" collection="conditions" open="" separator="" close="">
<if test="null != subCondition.columnValue and subCondition.columnValue.size() > 0">
<if test="subCondition.queryType!= null and subCondition.queryType == 'equal' ">
and ${subCondition.tableName}.${subCondition.columnName} = #{subCondition.columnValue[0]}
</if>
<if test="subCondition.queryType!= null and subCondition.queryType == 'like' ">
and ${subCondition.tableName}.${subCondition.columnName} like concat('%',#{subCondition.columnValue[0]},'%')
</if>
<if test="subCondition.queryType!= null and subCondition.queryType == 'daterange' ">
and ${subCondition.tableName}.${subCondition.columnName} between #{subCondition.columnValue[0]} and #{subCondition.columnValue[1]}
</if>
</if>
</foreach>
</if>
group by IC_RESI_USER.id
order by ic_resi_user.CREATED_TIME desc
</select>
</mapper>

22
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerAgencyDao.xml

@ -286,26 +286,4 @@
AND USER_ID = #{staffId}
</select>
<select id="queryHouseInfo" parameterType="map" resultType="com.epmet.dataaggre.dto.govorg.result.HouseInfoDTO">
SELECT
ih.ID as homeId,
ih.NEIGHBOR_HOOD_ID as neighborHoodId,
n.NEIGHBOR_HOOD_NAME as neighborHoodName,
ih.BUILDING_ID as buildingId,
ib.BUILDING_NAME as buildingName,
ih.BUILDING_UNIT_ID as buildingUnitId,
u.UNIT_NAME as unitName,
ih.DOOR_NAME as doorName,
ih.house_type
FROM
ic_house ih
left JOIN ic_neighbor_hood n ON ( ih.NEIGHBOR_HOOD_ID = n.id )
left JOIN ic_building ib ON ( ih.BUILDING_ID = ib.id )
left JOIN ic_building_unit u ON ( ih.BUILDING_UNIT_ID = u.ID )
WHERE
ih.DEL_FLAG = '0'
<foreach collection="houseIdList" item="houseId" separator=" OR " open="AND (" close=")">
ih.ID = #{houseId}
</foreach>
</select>
</mapper>

50
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/opercustomize/CustomerFootBarDao.xml

@ -39,54 +39,4 @@
AND C.DISPLAY='1'
</select>
<select id="queryConditions" parameterType="map" resultType="com.epmet.dataaggre.dto.epmetuser.IcFormResColumnDTO">
select
temp.table_name,
concat(temp.table_name,'.',temp.columnName) as columnName,
temp.LABEL
from (
SELECT
( CASE WHEN M.ITEM_GROUP_ID = '0' THEN 'ic_resi_user' ELSE g.TABLE_NAME END ) AS table_name,
m.COLUMN_NAME AS columnName,
m.LABEL
FROM
ic_form_item m
LEFT JOIN ic_form_item_group g ON ( m.ITEM_GROUP_ID = g.id )
WHERE
m.DEL_FLAG = '0'
AND m.CUSTOMER_ID = #{customerId}
and m.FORM_CODE=#{formCode}
AND m.LIST_DISPLAY = '1'
)temp
</select>
<select id="querySubTables" parameterType="map" resultType="java.lang.String">
select
CONCAT('left join ',temp.TABLE_NAME, ' on ( ic_resi_user.ID=',temp.TABLE_NAME,'.IC_RESI_USER and ',temp.TABLE_NAME,'.del_flag="0" )') as subTables
from (
SELECT DISTINCT
m.TABLE_NAME
FROM
ic_form_item_group m
WHERE
m.DEL_FLAG = '0'
AND m.TABLE_NAME IS NOT NULL
AND m.TABLE_NAME != ''
AND m.CUSTOMER_ID = #{customerId}
AND m.FORM_CODE = #{formCode}
)temp
</select>
<select id="queryIcResiSubTables" parameterType="map" resultType="java.lang.String">
SELECT DISTINCT
m.TABLE_NAME
FROM
ic_form_item_group m
WHERE
m.DEL_FLAG = '0'
AND m.TABLE_NAME IS NOT NULL
AND m.TABLE_NAME != ''
AND m.CUSTOMER_ID = #{customerId}
AND m.FORM_CODE = #{formCode}
</select>
</mapper>

10
epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/constant/SystemMessageType.java

@ -85,4 +85,14 @@ public interface SystemMessageType {
*/
String PROJECT_EDIT = "project_edit";
/**
* 居民信息添加
*/
String IC_RESI_USER_ADD = "ic_resi_user_add";
/**
* 居民信息修改
*/
String IC_RESI_USER_EDIT = "ic_resi_user_edit";
}

4
epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/SystemMessageServiceImpl.java

@ -187,6 +187,10 @@ public class SystemMessageServiceImpl implements SystemMessageService {
case SystemMessageType.PROJECT_EDIT:
topic = TopicConstants.PROJECT;
break;
case SystemMessageType.IC_RESI_USER_ADD:
case SystemMessageType.IC_RESI_USER_EDIT:
topic = TopicConstants.IC_RESI_USER;
break;
}
return topic;
}

2
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcPropertyManagementFormDTO.java

@ -43,7 +43,7 @@ public class IcPropertyManagementFormDTO implements Serializable {
* 物业名称
*/
@NotBlank(message = "物业名称不能为空", groups = {AddGroup.class, UpdateGroup.class})
@Length(max=10,message = "物业名称不能超过100个字", groups = {AddGroup.class, UpdateGroup.class})
@Length(max=50,message = "物业名称不能超过50个字", groups = {AddGroup.class, UpdateGroup.class})
private String name;

7
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/PropertyManagementController.java

@ -33,7 +33,9 @@ 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;
import java.util.List;
import java.util.Map;
/**
@ -63,8 +65,9 @@ public class PropertyManagementController {
public Result add(@LoginUser TokenDto tokenDTO, @RequestBody IcPropertyManagementFormDTO formDTO){
//效验数据
ValidatorUtils.validateEntity(formDTO, AddGroup.class);
propertyManagementService.add(formDTO);
return new Result().ok("保存成功");
Map map=new HashMap<>();
map.put("propertyId",propertyManagementService.add(formDTO));
return new Result().ok(map);
}

7
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/PropertyManagementService.java

@ -17,15 +17,10 @@
package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.IcPropertyManagementDTO;
import com.epmet.dto.form.IcPropertyManagementFormDTO;
import com.epmet.dto.result.IcPropertyManagementResultDTO;
import com.epmet.entity.IcPropertyManagementEntity;
import java.util.List;
import java.util.Map;
/**
* 物业表
@ -37,7 +32,7 @@ public interface PropertyManagementService {
List<IcPropertyManagementResultDTO> getList();
void add(IcPropertyManagementFormDTO formDTO);
String add(IcPropertyManagementFormDTO formDTO);
void update(IcPropertyManagementFormDTO formDTO);
void delete(IcPropertyManagementFormDTO formDTO);

3
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/PropertyManagementServiceImpl.java

@ -43,9 +43,10 @@ public class PropertyManagementServiceImpl implements PropertyManagementService
@Override
@Transactional(rollbackFor = Exception.class)
public void add(IcPropertyManagementFormDTO formDTO) {
public String add(IcPropertyManagementFormDTO formDTO) {
IcPropertyManagementEntity icPropertyManagementEntity = ConvertUtils.sourceToTarget(formDTO, IcPropertyManagementEntity.class);
icPropertyManagementDao.insert(icPropertyManagementEntity);
return icPropertyManagementEntity.getId();
}
@Override

12
epmet-user/epmet-user-server/pom.xml

@ -222,6 +222,9 @@
</dingTalk.robot.webHook>
<dingTalk.robot.secret>SECfcc020bdc83bb17a2c00f39977b1fbc409ef4188c7beaea11c5caa90eeaf87fd
</dingTalk.robot.secret>
<!--rocketmq-->
<rocketmq.enable>true</rocketmq.enable>
<rocketmq.nameserver>192.168.1.140:9876;192.168.1.141:9876</rocketmq.nameserver>
</properties>
</profile>
<profile>
@ -264,6 +267,9 @@
<dingTalk.robot.secret>SECfcc020bdc83bb17a2c00f39977b1fbc409ef4188c7beaea11c5caa90eeaf87fd
</dingTalk.robot.secret>
<openapi.scan.server.url>https://epmet-dev.elinkservice.cn/api/epmetscan/api</openapi.scan.server.url>
<!--rocketmq-->
<rocketmq.enable>false</rocketmq.enable>
<rocketmq.nameserver>192.168.1.140:9876;192.168.1.141:9876</rocketmq.nameserver>
</properties>
</profile>
<profile>
@ -305,6 +311,9 @@
</dingTalk.robot.webHook>
<dingTalk.robot.secret>SECfcc020bdc83bb17a2c00f39977b1fbc409ef4188c7beaea11c5caa90eeaf87fd
</dingTalk.robot.secret>
<!--rocketmq-->
<rocketmq.enable>true</rocketmq.enable>
<rocketmq.nameserver>192.168.1.140:9876;192.168.1.141:9876</rocketmq.nameserver>
</properties>
</profile>
<profile>
@ -345,6 +354,9 @@
</dingTalk.robot.webHook>
<dingTalk.robot.secret>SEC95f4f40b533ad379ea6a6d1af6dd37029383cfe1b7cd96dfac2678be2c1c3ed1
</dingTalk.robot.secret>
<!--rocketmq-->
<rocketmq.enable>true</rocketmq.enable>
<rocketmq.nameserver>192.168.1.140:9876;192.168.1.141:9876</rocketmq.nameserver>
</properties>
</profile>
</profiles>

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

@ -18,44 +18,35 @@
package com.epmet.controller;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.TemplateExportParams;
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.annotation.LoginUser;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.ExcelUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.dto.IcResiUserDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.*;
import com.epmet.excel.IcResiUserExcel;
import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.feign.OperCustomizeOpenFeignClient;
import com.epmet.service.IcResiUserService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.jetbrains.annotations.NotNull;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.io.FileOutputStream;
import java.io.IOException;
import java.net.URLEncoder;
import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
@ -69,7 +60,7 @@ import java.util.concurrent.atomic.AtomicInteger;
@RestController
@RequestMapping("icresiuser")
public class IcResiUserController {
private static final String BASE_TABLE_NAME = "ic_resi_user";
private static final String BASE_TABLE_NAME = "ic_resi_user";
@Autowired
private OperCustomizeOpenFeignClient operCustomizeOpenFeignClient;
@ -78,48 +69,6 @@ public class IcResiUserController {
@Autowired
private EpmetUserOpenFeignClient epmetUserOpenFeignClient;
@GetMapping("page")
public Result<PageData<IcResiUserDTO>> page(@RequestParam Map<String, Object> params){
PageData<IcResiUserDTO> page = icResiUserService.page(params);
return new Result<PageData<IcResiUserDTO>>().ok(page);
}
@GetMapping("{id}")
public Result<IcResiUserDTO> get(@PathVariable("id") String id){
IcResiUserDTO data = icResiUserService.get(id);
return new Result<IcResiUserDTO>().ok(data);
}
@PostMapping
public Result save(@RequestBody IcResiUserDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
icResiUserService.save(dto);
return new Result();
}
@PutMapping
public Result update(@RequestBody IcResiUserDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
icResiUserService.update(dto);
return new Result();
}
@PostMapping("delete")
public Result delete(@LoginUser TokenDto tokenDto,@RequestBody DelIcResiUserFormDTO formDTO){
formDTO.setCustomerId(tokenDto.getCustomerId());
ValidatorUtils.validateEntity(formDTO,DelIcResiUserFormDTO.IdGroup.class);
icResiUserService.delete(formDTO);
return new Result();
}
@GetMapping("export")
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<IcResiUserDTO> list = icResiUserService.list(params);
ExcelUtils.exportExcelToTarget(response, null, list, IcResiUserExcel.class);
}
/**
* @Author sun
* @Description 党建互联平台--保存居民信息
@ -140,157 +89,6 @@ public class IcResiUserController {
return new Result();
}
@GetMapping("download/template")
public void downloadTemplate(@RequestParam String customerId) throws Exception {
CustomerFormResultDTO resultForm = getResiFormItems(customerId);
XSSFWorkbook workbook = new XSSFWorkbook();
Map<String, List<ExcelExportEntity>> sheetHeaderMap = buildHeaderByItem(resultForm);
//Workbook workbook = null;
for (Map.Entry<String, List<ExcelExportEntity>> entry : sheetHeaderMap.entrySet()) {
String sheetName = entry.getKey();
List<ExcelExportEntity> headers = entry.getValue();
System.out.println("headers:"+sheetName+JSON.toJSONString(headers));
ExportParams exportParams = new ExportParams(null,sheetName);
//exportParams.setAutoSize(true);
List<Map<String,String>> dataSet = new ArrayList<>();
HashMap<String, String> map = new HashMap<>();
map.put("1","2");
dataSet.add(map);
new ExcelExportService().createSheetForMap(workbook, exportParams, headers, dataSet);
}
FileOutputStream fos = new FileOutputStream("//Users/liujianjun/Downloads/基础信息表/Dow.tt.xls");
workbook.write(fos);
fos.close();
}
@NotNull
private CustomerFormResultDTO getResiFormItems(String customerId) {
CustomerFormQueryDTO queryDTO = new CustomerFormQueryDTO();
queryDTO.setFormCode("resi_base_info");
queryDTO.setCustomerId(customerId);
Result<CustomerFormResultDTO> resultForm = operCustomizeOpenFeignClient.getCustomerForm(queryDTO);
if (resultForm == null || !resultForm.success() ||resultForm.getData() == null){
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode());
}
System.out.println(JSON.toJSONString(resultForm.getData()));
return resultForm.getData();
}
@NotNull
private Map<String,List<ExcelExportEntity>> buildHeaderByItem(CustomerFormResultDTO resultForm) {
//form中的itemlist 为一级表头 但是要排除每个item中含有childGroup的
List<FormItem> itemList = resultForm.getItemList();
List<FormGroupDTO> groupList = resultForm.getGroupList();
Map<String,List<ExcelExportEntity>> everySheetHeaderMap = new LinkedHashMap<>();
List<ExcelExportEntity> firstSheetHeaderList = new ArrayList<>();
//Map<String, String> groupNameMap = groupList.stream().collect(Collectors.toMap(FormGroupDTO::getGroupId,FormGroupDTO::getLabel));
itemList.forEach(item->{
if (StringUtils.isBlank(item.getColumnName())){
return;
}
if (item.getChildGroup() == null){
ExcelExportEntity header = new ExcelExportEntity(item.getLabel(),item.getColumnName().concat(String.valueOf(item.getColumnNum())),30);
header.setNeedMerge(true);
firstSheetHeaderList.add(header);
return;
}
everySheetHeaderMap.putIfAbsent(resultForm.getFormName(),firstSheetHeaderList);
//这些是动态的 formGroup
if (item.getChildGroup() != null){
//baseTableName单独的一个sheet
System.out.println("childGroup:"+item.getLabel());
if (BASE_TABLE_NAME.equals(item.getTableName())){
// header = new ExcelExportEntity(item.getChildGroup().getLabel(),item.getChildGroup().getTableName());
//header.setNeedMerge(true);
List<ExcelExportEntity> otherSheetHeaderList = new ArrayList<>();
//这里是设置除基础信息之外的sheet的表头
item.getChildGroup().getItemList().forEach(item2->{
if (!BASE_TABLE_NAME.equals(item2.getTableName())){
everySheetHeaderMap.putIfAbsent(item.getLabel(),otherSheetHeaderList);
}
ExcelExportEntity secondHeader = new ExcelExportEntity(item2.getLabel(),item2.getColumnName().concat(String.valueOf(item2.getColumnNum())));
otherSheetHeaderList.add(secondHeader);
if (!"radio".equals(item2.getItemType()) && CollectionUtils.isNotEmpty(item2.getOptions())){
secondHeader.setNeedMerge(true);
List<ExcelExportEntity> thirdHeaderList = new ArrayList<>();
item2.getOptions().forEach(child->{
ExcelExportEntity thirdHeader = new ExcelExportEntity(child.getLabel());
thirdHeaderList.add(thirdHeader);
});
secondHeader.setList(thirdHeaderList);
}
});
//header.setList(secondHeaderList);
//otherSheetHeaderList.add(header);
}
}
});
groupList.forEach(item->{
/* if (!"兴趣爱好".equals(item.getLabel()) && !"宗教信仰".equals(item.getLabel())){
return;
}*/
if (!BASE_TABLE_NAME.equals(item.getTableName())){
return;
}
ExcelExportEntity header = new ExcelExportEntity(item.getLabel(),item.getTableName());
header.setNeedMerge(true);
List<ExcelExportEntity> secondHeaderList = new ArrayList<>();
item.getItemList().forEach(item2->{
ExcelExportEntity secondHeader = new ExcelExportEntity(item2.getLabel(),item2.getColumnName().concat(String.valueOf(item2.getColumnNum())));
secondHeader.setNeedMerge(true);
secondHeaderList.add(secondHeader);
if (com.baomidou.mybatisplus.core.toolkit.CollectionUtils.isNotEmpty(item2.getOptions())){
List<ExcelExportEntity> thirdHeaderList = new ArrayList<>();
item2.getOptions().forEach(child->{
ExcelExportEntity thirdHeader = new ExcelExportEntity(child.getLabel(),child.getValue()+ new Random(1).nextInt(2));
thirdHeader.setNeedMerge(true);
thirdHeaderList.add(thirdHeader);
});
secondHeader.setList(thirdHeaderList);
}
});
header.setList(secondHeaderList);
firstSheetHeaderList.add(header);
System.out.println(JSON.toJSONString(firstSheetHeaderList));
});
return everySheetHeaderMap;
}
private void buildHeader(Map<String, List<ExcelExportEntity>> everySheetHeaderMap, FormItem item, ExcelExportEntity header) {
List<ExcelExportEntity> firstSheetHeaderList = new ArrayList<>();
List<ExcelExportEntity> secondHeaderList = new ArrayList<>();
item.getChildGroup().getItemList().forEach(item2->{
if (!BASE_TABLE_NAME.equals(item2.getTableName())){
everySheetHeaderMap.putIfAbsent(item.getLabel(),firstSheetHeaderList);
}
ExcelExportEntity secondHeader = new ExcelExportEntity(item2.getLabel(),item2.getColumnName().concat(String.valueOf(item2.getColumnNum())));
secondHeader.setNeedMerge(true);
secondHeaderList.add(secondHeader);
if (CollectionUtils.isNotEmpty(item2.getOptions())){
List<ExcelExportEntity> thirdHeaderList = new ArrayList<>();
item2.getOptions().forEach(child->{
ExcelExportEntity thirdHeader = new ExcelExportEntity(child.getLabel());
thirdHeaderList.add(thirdHeader);
});
secondHeader.setList(thirdHeaderList);
}
});
header.setList(secondHeaderList);
firstSheetHeaderList.add(header);
everySheetHeaderMap.putIfAbsent(item.getLabel(),firstSheetHeaderList);
}
/**
* @Description 根据房间号查人
* @Param formDTO
@ -304,92 +102,104 @@ public class IcResiUserController {
}
@PostMapping("listresi")
public Result<PageData<Map<String,Object>>> queryListResi1(@LoginUser TokenDto tokenDto, @RequestBody IcResiUserPageFormDTO pageFormDTO){
public Result<PageData<Map<String, Object>>> queryListResi1(@LoginUser TokenDto tokenDto, @RequestBody IcResiUserPageFormDTO pageFormDTO) {
//pageFormDTO.setCustomerId("45687aa479955f9d06204d415238f7cc");
pageFormDTO.setCustomerId(tokenDto.getCustomerId());
pageFormDTO.setStaffId(tokenDto.getUserId());
ValidatorUtils.validateEntity(pageFormDTO,IcResiUserPageFormDTO.AddUserInternalGroup.class);
return new Result<PageData<Map<String,Object>>>().ok(icResiUserService.pageResiMap(pageFormDTO));
ValidatorUtils.validateEntity(pageFormDTO, IcResiUserPageFormDTO.AddUserInternalGroup.class);
return new Result<PageData<Map<String, Object>>>().ok(icResiUserService.pageResiMap(pageFormDTO));
}
/**
* 编辑页面显示居民信息详情
*
* @param pageFormDTO
* @return com.epmet.commons.tools.utils.Result
* @return com.epmet.commons.tools.utils.Result
* @author yinzuomei
* @date 2021/10/28 10:29 上午
*/
@PostMapping("detail")
public Result queryIcResiDetail(@LoginUser TokenDto tokenDto,@RequestBody IcResiDetailFormDTO pageFormDTO){
public Result queryIcResiDetail(@LoginUser TokenDto tokenDto, @RequestBody IcResiDetailFormDTO pageFormDTO) {
//pageFormDTO.setCustomerId("45687aa479955f9d06204d415238f7cc");
pageFormDTO.setCustomerId(tokenDto.getCustomerId());
ValidatorUtils.validateEntity(pageFormDTO,IcResiDetailFormDTO.AddUserInternalGroup.class);
ValidatorUtils.validateEntity(pageFormDTO, IcResiDetailFormDTO.AddUserInternalGroup.class);
return new Result().ok(icResiUserService.queryIcResiDetail(pageFormDTO));
}
@RequestMapping(value = "/exportExcel")
public void exportExcel(/*@LoginUser TokenDto tokenDto,*/ @RequestBody IcResiUserPageFormDTO pageFormDTO, HttpServletResponse response) throws IOException {
pageFormDTO.setCustomerId("45687aa479955f9d06204d415238f7cc");
public void exportExcel(@RequestHeader String customerId, @RequestBody IcResiUserPageFormDTO pageFormDTO, HttpServletResponse response) throws IOException {
pageFormDTO.setCustomerId(customerId);
pageFormDTO.setPageFlag(false);
CustomerFormResultDTO resiFormItems = getResiFormItems(pageFormDTO.getCustomerId());
Map<String, FormItem> itemMap = new HashMap<>();
Map<String, Map<String, FormItem>> otherSheetItems = new HashMap<>();
//主表的
for (FormItem formItem : resiFormItems.getItemList()) {
if (StringUtils.isBlank(formItem.getColumnName())){
if (StringUtils.isBlank(formItem.getColumnName())) {
continue;
}
if (formItem.getItemType().equals("checkbox") || formItem.getItemType().equals("select")){
Map<String, FormItem> itemMap = otherSheetItems.getOrDefault(formItem.getTableName(), new HashMap<>());
otherSheetItems.putIfAbsent(formItem.getTableName(), itemMap);
if (formItem.getItemType().equals("checkbox") || formItem.getItemType().equals("select") || formItem.getItemType().equals("radio")) {
itemMap.put(formItem.getColumnName().concat(formItem.getColumnNum() == 0 ? "" : formItem.getColumnNum().toString()), formItem);
}
if (formItem.getChildGroup() != null) {
itemMap = otherSheetItems.getOrDefault(formItem.getChildGroup().getTableName(), new HashMap<>());
otherSheetItems.putIfAbsent(formItem.getChildGroup().getTableName(), itemMap);
for (FormItem2 item2 : formItem.getChildGroup().getItemList()) {
if (StringUtils.isBlank(item2.getColumnName())){
if (StringUtils.isBlank(item2.getColumnName())) {
continue;
}
if (item2.getItemType().equals("checkbox") || item2.getItemType().equals("select")){
itemMap.put(item2.getColumnName().concat(item2.getColumnNum() == 0 ? "" : item2.getColumnNum().toString()), ConvertUtils.sourceToTarget(item2,FormItem.class));
if (item2.getItemType().equals("checkbox") || item2.getItemType().equals("select") || item2.getItemType().equals("radio")) {
itemMap.put(item2.getColumnName().concat(item2.getColumnNum() == 0 ? "" : item2.getColumnNum().toString()), ConvertUtils.sourceToTarget(item2, FormItem.class));
}
}
}
}
//其他sheet
for (FormGroupDTO groupItem : resiFormItems.getGroupList()) {
if (groupItem.getItemList() != null) {
for (FormItem2 item : groupItem.getItemList()) {
if (StringUtils.isBlank(item.getColumnName())){
continue;
}
if (item.getItemType().equals("checkbox") || item.getItemType().equals("select")){
itemMap.put(item.getColumnName().concat(item.getColumnNum() == 0 ? "" : item.getColumnNum().toString()), ConvertUtils.sourceToTarget(item, FormItem.class));
}
if (groupItem.getItemList() == null) {
continue;
}
Map<String, FormItem> itemMap = otherSheetItems.getOrDefault(groupItem.getTableName(), new HashMap<>());
otherSheetItems.putIfAbsent(groupItem.getTableName(), itemMap);
for (FormItem2 formItem2 : groupItem.getItemList()) {
if (StringUtils.isBlank(formItem2.getColumnName())) {
continue;
}
if (formItem2.getItemType().equals("checkbox") || formItem2.getItemType().equals("select") || formItem2.getItemType().equals("radio")) {
itemMap.put(formItem2.getColumnName().concat(formItem2.getColumnNum() == 0 ? "" : formItem2.getColumnNum().toString()), ConvertUtils.sourceToTarget(formItem2, FormItem.class));
}
}
}
System.out.println("checkbox:"+JSON.toJSONString(itemMap));
Map<String,Map<String, Object>> resiMainList = icResiUserService.getDataForExport(itemMap,pageFormDTO.getCustomerId(), pageFormDTO.getFormCode(), BASE_TABLE_NAME, pageFormDTO.getConditions());
Map<String, Map<String, Object>> resiMainList = icResiUserService.getDataForExport(otherSheetItems.get(BASE_TABLE_NAME), pageFormDTO.getCustomerId(), pageFormDTO.getFormCode(), BASE_TABLE_NAME, pageFormDTO.getConditions());
//resiMainList = (List<Map<String, Object>>)JSON.parse("[{\"IS_BDHJ\":\"1\",\"IS_SPECIAL\":\"1\",\"IS_XFRY\":\"0\",\"REMARKS\":\"beizhu\",\"IS_PARTY\":\"1\",\"icResiUserId\":\"yzmtest2\",\"HOME_ID\":\"中海国际社区一里城1号楼1单元101\",\"HOUSE_TYPE\":\"平房\",\"UNIT_NAME\":\"1单元\",\"GRID_ID\":\"市北区-市北区第三网格3\",\"IS_DB\":\"0\",\"GENDER\":\"男\",\"BIRTHDAY\":\"2021-10-04\",\"IS_VETERANS\":\"0\",\"IS_MB\":\"0\",\"IS_UNEMPLOYED\":\"0\",\"DEMAND_NAME\":null,\"IS_KC\":\"0\",\"IS_ENSURE_HOUSE\":\"0\",\"IS_SD\":\"0\",\"NAME\":\"尹作梅\",\"RDSJ\":null,\"IS_VOLUNTEER\":\"1\",\"GRID_ID_VALUE\":\"e74829ffc43d5470eba6b5e060c11e63\",\"IS_SZ\":\"0\",\"IS_CJ\":\"0\",\"HOME_ID_VALUE\":\"200\",\"DEMAND_CATEGORY_IDS\":null,\"VILLAGE_NAME\":\"中海国际社区一里城\",\"IS_DBH\":\"0\",\"IS_SN\":\"0\",\"BUILD_NAME\":\"1号楼\",\"IS_YLFN\":\"0\",\"IS_UNITED_FRONT\":\"0\",\"ID_CARD\":\"371325199310260529\",\"MOBILE\":\"15764229697\",\"IS_OLD_PEOPLE\":\"0\",\"DOOR_NAME\":\"101\"},{\"IS_SPECIAL\":\"1\",\"IS_XFRY\":\"0\",\"REMARKS\":\"beizhu\",\"IS_PARTY\":\"1\",\"icResiUserId\":\"yzmtest\",\"HOME_ID\":\"中海国际社区一里城1号楼1单元101\",\"HOUSE_TYPE\":\"平房\",\"UNIT_NAME\":\"1单元\",\"GRID_ID\":\"市北区-市北区第三网格3\",\"IS_DB\":\"0\",\"GENDER\":\"男\",\"BIRTHDAY\":\"2021-10-04\",\"IS_VETERANS\":\"0\",\"IS_MB\":\"0\",\"IS_UNEMPLOYED\":\"0\",\"DEMAND_NAME\":\"心理咨询\",\"IS_KC\":\"0\",\"IS_ENSURE_HOUSE\":\"0\",\"IS_SD\":\"0\",\"NAME\":\"尹作梅\",\"RDSJ\":\"2021-10-28 00:00:00\",\"IS_VOLUNTEER\":\"1\",\"GRID_ID_VALUE\":\"e74829ffc43d5470eba6b5e060c11e63\",\"IS_SZ\":\"0\",\"IS_CJ\":\"0\",\"HOME_ID_VALUE\":\"200\",\"DEMAND_CATEGORY_IDS\":\"10180002\",\"VILLAGE_NAME\":\"中海国际社区一里城\",\"IS_DBH\":\"0\",\"IS_SN\":\"0\",\"BUILD_NAME\":\"1号楼\",\"IS_YLFN\":\"0\",\"IS_UNITED_FRONT\":\"0\",\"ID_CARD\":\"371325199310260529\",\"MOBILE\":\"15764229697\",\"IS_OLD_PEOPLE\":\"0\",\"DOOR_NAME\":\"101\"}]");
log.info("resiMainList:{}", JSON.toJSONString(resiMainList));
String templatePath = "excel/ic_resi_info_cid.xls";
TemplateExportParams params = new TemplateExportParams(templatePath,true);
TemplateExportParams params = new TemplateExportParams(templatePath, true);
Map<Integer,Map<String,Object>> sheetMap = new HashMap<>();
Map<Integer, Map<String, Object>> sheetMap = new HashMap<>();
Map<String, Object> mapData = new HashMap<>();
mapData.put("list", resiMainList.values());
sheetMap.put(0,mapData);
sheetMap.put(0, mapData);
AtomicInteger n = new AtomicInteger();
for (FormItem item : resiFormItems.getItemList()) {
if (item.getChildGroup() != null) {
if (!item.getChildGroup().getTableName().equals(BASE_TABLE_NAME)) {
Map<String,Map<String, Object>> resiChildMap = icResiUserService.getDataForExport(itemMap, pageFormDTO.getCustomerId(), pageFormDTO.getFormCode(), item.getChildGroup().getTableName(), pageFormDTO.getConditions());
resiChildMap.forEach((key,value)->{
value.putAll(resiMainList.get(key));
});
Map<String, FormItem> itemMap1 = otherSheetItems.get(item.getChildGroup().getTableName());
Map<String, Map<String, Object>> resiChildMap = icResiUserService.getDataForExport(itemMap1, pageFormDTO.getCustomerId(), pageFormDTO.getFormCode(), item.getChildGroup().getTableName(), pageFormDTO.getConditions());
resiChildMap.forEach((key, value) -> value.putAll(resiMainList.get(key)));
Map<String, Object> mapData2 = new HashMap<>();
mapData2.put("list", resiChildMap.values());
sheetMap.put(n.incrementAndGet(),mapData2);
sheetMap.put(n.incrementAndGet(), mapData2);
}
}
}
@ -397,8 +207,7 @@ public class IcResiUserController {
Workbook workbook = ExcelExportUtil.exportExcel(sheetMap, params);
workbook.setActiveSheet(0);
//header
String fileName = "居民信息.xls";
String fileName = "居民基本信息.xls";
response.setHeader("content-Type", "application/vnd.ms-excel");
response.addHeader("Content-Disposition", "attachment;fileName=" + URLEncoder.encode(fileName, "UTF-8"));
workbook.write(response.getOutputStream());
@ -406,6 +215,8 @@ public class IcResiUserController {
/**
* excel导入居民基本信息
*
* @param loginUser
* @return
*/
@PostMapping("import/excel")
@ -415,37 +226,50 @@ public class IcResiUserController {
}
@PostMapping("test")
public Result<List<Map<String,Object>>> test(@RequestBody DynamicQueryFormDTO formDTO){
public Result<List<Map<String, Object>>> test(@RequestBody DynamicQueryFormDTO formDTO) {
formDTO.setCustomerId("45687aa479955f9d06204d415238f7cc");
//formDTO.setCustomerId(tokenDto.getCustomerId());
return new Result<List<Map<String,Object>>>().ok(icResiUserService.dynamicQuery(formDTO.getCustomerId(),
return new Result<List<Map<String, Object>>>().ok(icResiUserService.dynamicQuery(formDTO.getCustomerId(),
formDTO.getFormCode(),
formDTO.getResultTableName(),
formDTO.getConditions()));
}
/**
* @Description 查询个人数据
* @param formDTO
* @Description 查询个人数据
* @author zxc
* @date 2021/11/3 9:21 上午
*/
@PostMapping("persondata")
public Result<PersonDataResultDTO> personData(@RequestBody PersonDataFormDTO formDTO){
public Result<PersonDataResultDTO> personData(@RequestBody PersonDataFormDTO formDTO) {
return new Result<PersonDataResultDTO>().ok(icResiUserService.personData(formDTO));
}
/**
* @Description 根据名字搜索
* @param formDTO
* @param tokenDto
* @Description 根据名字搜索
* @author zxc
* @date 2021/11/3 1:42 下午
*/
@PostMapping("searchbyname")
public Result<List<SearchByNameResultDTO>> searchByName(@RequestBody SearchByNameFormDTO formDTO, @LoginUser TokenDto tokenDto){
public Result<List<SearchByNameResultDTO>> searchByName(@RequestBody SearchByNameFormDTO formDTO, @LoginUser TokenDto tokenDto) {
ValidatorUtils.validateEntity(formDTO, SearchByNameFormDTO.SearchByNameForm.class);
return new Result<List<SearchByNameResultDTO>>().ok(icResiUserService.searchByName(formDTO,tokenDto));
return new Result<List<SearchByNameResultDTO>>().ok(icResiUserService.searchByName(formDTO, tokenDto));
}
@NotNull
private CustomerFormResultDTO getResiFormItems(String customerId) {
CustomerFormQueryDTO queryDTO = new CustomerFormQueryDTO();
queryDTO.setFormCode("resi_base_info");
queryDTO.setCustomerId(customerId);
Result<CustomerFormResultDTO> resultForm = operCustomizeOpenFeignClient.getCustomerForm(queryDTO);
if (resultForm == null || !resultForm.success() || resultForm.getData() == null) {
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode());
}
System.out.println(JSON.toJSONString(resultForm.getData()));
return resultForm.getData();
}
}

31
epmet-user/epmet-user-server/src/main/java/com/epmet/mq/RocketMQWarnStatsRegister.java

@ -0,0 +1,31 @@
package com.epmet.mq;
import com.epmet.commons.rocketmq.constants.ConsomerGroupConstants;
import com.epmet.commons.rocketmq.constants.TopicConstants;
import com.epmet.commons.rocketmq.register.MQAbstractRegister;
import com.epmet.commons.rocketmq.register.MQConsumerProperties;
import com.epmet.mq.listener.ICWarnStatsEventListener;
import org.apache.rocketmq.common.protocol.heartbeat.MessageModel;
import org.springframework.stereotype.Component;
/**
* @Description 如果rocketmq.enable=true这里必须实现 实例化
* @author wxz
* @date 2021.07.14 17:13:41
*/
@Component
public class RocketMQWarnStatsRegister extends MQAbstractRegister {
@Override
public void registerAllListeners(String env, MQConsumerProperties consumerProperties) {
// 客户初始化监听器注册
register(consumerProperties,
ConsomerGroupConstants.IC_WARN_STATS_EVENT_LISTENER_GROUP,
MessageModel.CLUSTERING,
TopicConstants.IC_RESI_USER,
"*",
new ICWarnStatsEventListener());
// ...其他监听器类似
}
}

104
epmet-user/epmet-user-server/src/main/java/com/epmet/mq/listener/ICWarnStatsEventListener.java

@ -0,0 +1,104 @@
package com.epmet.mq.listener;
import com.alibaba.fastjson.JSON;
import com.epmet.commons.rocketmq.constants.MQUserPropertys;
import com.epmet.commons.rocketmq.messages.IcWarnStatsMQMsg;
import com.epmet.commons.tools.distributedlock.DistributedLock;
import com.epmet.commons.tools.exception.ExceptionUtils;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.redis.RedisKeys;
import com.epmet.commons.tools.redis.RedisUtils;
import com.epmet.commons.tools.utils.SpringContextUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyContext;
import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyStatus;
import org.apache.rocketmq.client.consumer.listener.MessageListenerConcurrently;
import org.apache.rocketmq.common.message.MessageExt;
import org.redisson.api.RLock;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.List;
import java.util.concurrent.TimeUnit;
/**
* @Description 负能平台-客户居民信息变动监听器
* @author wxz
* @date 2021.10.13 15:21:48
*/
public class ICWarnStatsEventListener implements MessageListenerConcurrently {
private Logger logger = LoggerFactory.getLogger(getClass());
private RedisUtils redisUtils;
@Override
public ConsumeConcurrentlyStatus consumeMessage(List<MessageExt> msgs, ConsumeConcurrentlyContext context) {
if (redisUtils == null) {
redisUtils = SpringContextUtils.getBean(RedisUtils.class);
}
try {
msgs.forEach(msg -> consumeMessage(msg));
} catch (Exception e) {
logger.error(ExceptionUtils.getErrorStackTrace(e));
return ConsumeConcurrentlyStatus.RECONSUME_LATER;
}
return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;
}
private void consumeMessage(MessageExt messageExt) {
// msg即为消息体
// tags为SystemMessageType.java中的项,为具体的操作,此处拿到tags,判断是创建还是变更,来做响应的后续操作即可
String msg = new String(messageExt.getBody());
String topic = messageExt.getTopic();
String tags = messageExt.getTags();
String pendingMsgLabel = messageExt.getUserProperty(MQUserPropertys.BLOCKED_MSG_LABEL);
logger.info("【开放数据事件监听器】-居民信息变动-收到消息内容:{},操作:{}", msg, tags);
IcWarnStatsMQMsg obj = JSON.parseObject(msg, IcWarnStatsMQMsg.class);
DistributedLock distributedLock = null;
RLock lock = null;
try {
distributedLock = SpringContextUtils.getBean(DistributedLock.class);
lock = distributedLock.getLock(String.format("lock:ic_warn_stats:%s", obj.getCustomerId()),
30L, 30L, TimeUnit.SECONDS);
System.out.println("嘻嘻哈哈哈乐乐呵呵-----------");
//待执行方法
//SpringContextUtils.getBean(BaseGridInfoService.class).getAgencyBaseInfo(obj);
} catch (RenException e) {
// 如果是我们手动抛出的异常,说明在业务可控范围内。目前不需要MQ重试
logger.error("【开放数据事件监听器】-客户居民信息变动MQ失败:".concat(ExceptionUtils.getErrorStackTrace(e)));
} catch (Exception e) {
// 不是我们自己抛出的异常,可以让MQ重试
logger.error("【开放数据事件监听器】-客户居民信息变动MQ失败:".concat(ExceptionUtils.getErrorStackTrace(e)));
throw e;
} finally {
distributedLock.unLock(lock);
}
if (StringUtils.isNotBlank(pendingMsgLabel)) {
try {
removePendingMqMsgCache(pendingMsgLabel);
} catch (Exception e) {
logger.error("【开放数据事件监听器】-删除mq阻塞消息缓存失败:{}", ExceptionUtils.getErrorStackTrace(e));
}
}
}
/**
* @description
*
* @param pendingMsgLabel
* @return
* @author wxz
* @date 2021.10.14 16:32:32
*/
private void removePendingMqMsgCache(String pendingMsgLabel) {
String key = RedisKeys.blockedMqMsgKey(pendingMsgLabel);
redisUtils.delete(key);
//logger.info("【开放数据事件监听器】删除mq阻塞消息缓存成功,blockedMsgLabel:{}", pendingMsgLabel);
}
}

39
epmet-user/epmet-user-server/src/main/java/com/epmet/mq/listener/InitCustomerRolesListener.java

@ -1,39 +0,0 @@
//package com.epmet.mq.listener;
//
//import com.alibaba.fastjson.JSON;
//import com.epmet.commons.rocketmq.constants.ConsomerGroupConstants;
//import com.epmet.commons.rocketmq.constants.TopicConstants;
//import com.epmet.commons.rocketmq.messages.InitCustomerMQMsg;
//import com.epmet.service.GovStaffRoleService;
//import org.apache.rocketmq.common.message.MessageExt;
//import org.apache.rocketmq.spring.annotation.MessageModel;
//import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
//import org.apache.rocketmq.spring.core.RocketMQListener;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Component;
//
///**
// * 监听初始化客户动作,为客户初始化角色列表
// */
//@RocketMQMessageListener(topic = TopicConstants.INIT_CUSTOMER,
// consumerGroup = ConsomerGroupConstants.INIT_CUSTOMER_ROLES_GROUP,
// messageModel = MessageModel.CLUSTERING,
// selectorExpression = "*")
//@Component
//public class InitCustomerRolesListener implements RocketMQListener<MessageExt> {
//
// private Logger logger = LoggerFactory.getLogger(getClass());
//
// @Autowired
// private GovStaffRoleService govStaffRoleService;
//
// @Override
// public void onMessage(MessageExt messageExt) {
// String msg = new String(messageExt.getBody());
// logger.info("初始化客户-初始化角色列表-收到消息内容:{}", msg);
// InitCustomerMQMsg msgObj = JSON.parseObject(msg, InitCustomerMQMsg.class);
// govStaffRoleService.initGovStaffRolesForCustomer(msgObj.getCustomerId());
// }
//}

47
epmet-user/epmet-user-server/src/main/java/com/epmet/redis/IcResiUserRedis.java

@ -1,47 +0,0 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.redis;
import com.epmet.commons.tools.redis.RedisUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* 用户基础信息
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-10-26
*/
@Component
public class IcResiUserRedis {
@Autowired
private RedisUtils redisUtils;
public void delete(Object[] ids) {
}
public void set(){
}
public String get(String id){
return null;
}
}

60
epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java

@ -20,7 +20,6 @@ package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.dto.IcResiUserDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.FormItem;
import com.epmet.dto.result.HomeUserResultDTO;
@ -39,65 +38,6 @@ import java.util.Map;
*/
public interface IcResiUserService extends BaseService<IcResiUserEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<IcResiUserDTO>
* @author generator
* @date 2021-10-26
*/
PageData<IcResiUserDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<IcResiUserDTO>
* @author generator
* @date 2021-10-26
*/
List<IcResiUserDTO> list(Map<String, Object> params);
/**
* 单条查询
*
* @param id
* @return IcResiUserDTO
* @author generator
* @date 2021-10-26
*/
IcResiUserDTO get(String id);
/**
* 默认保存
*
* @param dto
* @return void
* @author generator
* @date 2021-10-26
*/
void save(IcResiUserDTO dto);
/**
* 默认更新
*
* @param dto
* @return void
* @author generator
* @date 2021-10-26
*/
void update(IcResiUserDTO dto);
/**
* 单个删除
*
* @return void
* @author generator
* @date 2021-10-26
*/
void delete(DelIcResiUserFormDTO formDTO);
/**
* @Author sun
* @Description 党建互联平台--保存居民信息

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

@ -21,8 +21,8 @@ import com.alibaba.excel.EasyExcelFactory;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.rocketmq.messages.IcWarnStatsMQMsg;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.ServiceConstant;
@ -40,6 +40,7 @@ import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.security.user.LoginUserUtil;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.SystemMessageType;
import com.epmet.constant.UserConstant;
import com.epmet.dao.IcResiUserDao;
import com.epmet.dto.*;
@ -48,11 +49,7 @@ import com.epmet.dto.result.*;
import com.epmet.entity.IcPartyMemberEntity;
import com.epmet.entity.IcResiUserEntity;
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.redis.IcResiUserRedis;
import com.epmet.feign.*;
import com.epmet.service.IcResiUserService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
@ -60,8 +57,6 @@ import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -81,9 +76,6 @@ import java.util.stream.Stream;
@Slf4j
@Service
public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResiUserEntity> implements IcResiUserService, ResultDataResolver {
private final Logger logger = LogManager.getLogger(IcResiUserServiceImpl.class);
@Autowired
private IcResiUserRedis icResiUserRedis;
@Autowired
private GovOrgOpenFeignClient govOrgOpenFeignClient;
@Autowired
@ -97,22 +89,10 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
@Autowired
private LoginUserUtil loginUserUtil;
@Override
public PageData<IcResiUserDTO> page(Map<String, Object> params) {
IPage<IcResiUserEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, IcResiUserDTO.class);
}
@Autowired
private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient;
@Override
public List<IcResiUserDTO> list(Map<String, Object> params) {
List<IcResiUserEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, IcResiUserDTO.class);
}
private QueryWrapper<IcResiUserEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
@ -123,39 +103,6 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
return wrapper;
}
@Override
public IcResiUserDTO get(String id) {
IcResiUserEntity entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, IcResiUserDTO.class);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(IcResiUserDTO dto) {
IcResiUserEntity entity = ConvertUtils.sourceToTarget(dto, IcResiUserEntity.class);
insert(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(IcResiUserDTO dto) {
IcResiUserEntity entity = ConvertUtils.sourceToTarget(dto, IcResiUserEntity.class);
updateById(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(DelIcResiUserFormDTO formDTO) {
baseDao.updateToDel(formDTO.getIcResiUserId());
CustomerFormQueryDTO queryDTO = ConvertUtils.sourceToTarget(formDTO, CustomerFormQueryDTO.class);
Result<Set<String>> subTableRes = operCustomizeOpenFeignClient.queryIcResiSubTables(queryDTO);
if (subTableRes.success() && !CollectionUtils.isEmpty(subTableRes.getData())) {
for (String subTalbeName : subTableRes.getData()) {
baseDao.updateSubTableToDel(subTalbeName, formDTO.getIcResiUserId());
}
}
}
/**
* @Author sun
* @Description 党建互联平台--保存居民信息
@ -226,6 +173,15 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
}
});
//推送MQ事件
IcWarnStatsMQMsg mqMsg = new IcWarnStatsMQMsg();
mqMsg.setCustomerId(tokenDto.getCustomerId());
mqMsg.setIcResiUser(resiUserId);
SystemMsgFormDTO form = new SystemMsgFormDTO();
form.setMessageType(SystemMessageType.IC_RESI_USER_ADD);
form.setContent(mqMsg);
epmetMessageOpenFeignClient.sendSystemMsgByMQ(form);
}
/**
@ -281,6 +237,15 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
}
});
//推送MQ事件
IcWarnStatsMQMsg mqMsg = new IcWarnStatsMQMsg();
mqMsg.setCustomerId(tokenDto.getCustomerId());
mqMsg.setIcResiUser(resiUserId);
SystemMsgFormDTO form = new SystemMsgFormDTO();
form.setMessageType(SystemMessageType.IC_RESI_USER_ADD);
form.setContent(mqMsg);
epmetMessageOpenFeignClient.sendSystemMsgByMQ(form);
}
/**
@ -1005,7 +970,9 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
}
if (options == null) return null;
if (options == null) {
return null;
}
return options.stream().collect(Collectors.toMap(OptionResultDTO::getLabel, OptionResultDTO::getValue));
@ -1052,23 +1019,23 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
private Map<Integer, List<String>> mergeHead(List<Map<Integer, String>> headList) {
Map<Integer, String> lastNotNullHeads = new LinkedHashMap<>();
Map<Integer, List<String>> mergedHead = new LinkedHashMap<>();
int levelCount = headList.size();
Map<Integer, String> firstLevel = headList.get(0);
// 遍历所有列
for (Map.Entry<Integer, String> column : firstLevel.entrySet()) {
Integer columIndex = column.getKey();
List<String> labels = new ArrayList<>();
// 竖着遍历该列的所有行
for (int currentLevel = 0; currentLevel < levelCount; currentLevel ++) {
String label = headList.get(currentLevel).get(columIndex);
if (StringUtils.isNotBlank(label)) {
lastNotNullHeads.put(currentLevel, label);
} else {
@ -1076,7 +1043,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
label = lastNotNullHeads.get(currentLevel);
}
}
if (StringUtils.isNotBlank(label)) {
labels.add(label);
}
@ -1084,7 +1051,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
mergedHead.put(columIndex, labels);
}
return mergedHead;
}
@ -1207,7 +1174,6 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
@Override
public Map<String, Map<String, Object>> getDataForExport(Map<String, FormItem> formItemMap, String customerId, String formCode, String baseTableName, List<ResiUserQueryValueDTO> conditions) {
List<Map<String, Object>> mapList = this.dynamicQuery(customerId, formCode, baseTableName, conditions);
Map<String, Map<String, Object>> result = new LinkedHashMap<>();
mapList.stream().filter(Objects::nonNull).forEach(map -> {
String resiId = (String) map.getOrDefault(UserConstant.IC_RESI_USER, "");
@ -1220,11 +1186,9 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
try {
//todo 获取 options
Map<String, String> stringMap = listRemoteOptions(new HashMap<>(), v.getOptionSourceValue(), null);
System.out.println("======remote:"+v.getLabel()+" "+JSON.toJSONString(stringMap));
if ("checkbox".equals(v.getItemType())) {
stringMap.forEach((label, value) -> map.put(value, temp.toString().contains(value) ? "是" : "否"));
} else if ("select".equals(v.getItemType())) {
stringMap.forEach((label,value)->{
if (temp.toString().equals(value)){
map.put(k, label);
@ -1242,7 +1206,13 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
});
} else if ("select".equals(v.getItemType())) {
v.getOptions().forEach(optionDTO -> {
if (optionDTO.getLabel().equals(temp.toString())){
if (optionDTO.getValue().equals(temp.toString())){
map.put(k, optionDTO.getLabel());
}
});
} else if ("radio".equals(v.getItemType())) {
v.getOptions().forEach(optionDTO -> {
if (optionDTO.getValue().equals(temp.toString())){
map.put(k, optionDTO.getLabel());
}
});
@ -1283,7 +1253,6 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
map.put("UNIT_ID", houseInfoDTO.getUnitName());
}
}
});
return result;
}

4
epmet-user/epmet-user-server/src/main/resources/bootstrap.yml

@ -150,7 +150,9 @@ dingTalk:
secret: @dingTalk.robot.secret@
rocketmq:
name-server: 192.168.1.140:9876;192.168.1.141:9876
# 是否开启mq
enable: @rocketmq.enable@
name-server: @rocketmq.nameserver@
# 停机选项
shutdown:

BIN
epmet-user/epmet-user-server/src/main/resources/excel/ic_resi_info_cid.xls

Binary file not shown.

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

@ -54,11 +54,15 @@
<if test="null != subCondition.columnValue and subCondition.columnValue.size() > 0">
<if test="subCondition.queryType!= null and subCondition.queryType == 'equal' ">
and ${subCondition.tableName}.${subCondition.columnName} = #{subCondition.columnValue[0]}
<if test="null!=subCondition.columnValue[0] and ''!=subCondition.columnValue[0]">
and ${subCondition.tableName}.${subCondition.columnName} = #{subCondition.columnValue[0]}
</if>
</if>
<if test="subCondition.queryType!= null and subCondition.queryType == 'like' ">
and ${subCondition.tableName}.${subCondition.columnName} like concat('%',#{subCondition.columnValue[0]},'%')
<if test="null!=subCondition.columnValue[0] and ''!=subCondition.columnValue[0]">
and ${subCondition.tableName}.${subCondition.columnName} like concat('%',#{subCondition.columnValue[0]},'%')
</if>
</if>
<if test="subCondition.queryType!= null and subCondition.queryType == 'daterange' ">
@ -78,11 +82,15 @@
<if test="null != subCondition.columnValue and subCondition.columnValue.size() > 0">
<if test="subCondition.queryType!= null and subCondition.queryType == 'equal' ">
and ${subCondition.tableName}.${subCondition.columnName} = #{subCondition.columnValue[0]}
<if test="null!=subCondition.columnValue[0] and ''!=subCondition.columnValue[0]">
and ${subCondition.tableName}.${subCondition.columnName} = #{subCondition.columnValue[0]}
</if>
</if>
<if test="subCondition.queryType!= null and subCondition.queryType == 'like' ">
and ${subCondition.tableName}.${subCondition.columnName} like concat('%',#{subCondition.columnValue[0]},'%')
<if test="null!=subCondition.columnValue[0] and ''!=subCondition.columnValue[0]">
and ${subCondition.tableName}.${subCondition.columnName} like concat('%',#{subCondition.columnValue[0]},'%')
</if>
</if>
<if test="subCondition.queryType!= null and subCondition.queryType == 'daterange' ">

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

@ -0,0 +1,183 @@
package com.epmet.epmetuser.test;
import cn.afterturn.easypoi.excel.entity.ExportParams;
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.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.CustomerFormQueryDTO;
import com.epmet.dto.result.CustomerFormResultDTO;
import com.epmet.dto.result.FormGroupDTO;
import com.epmet.dto.result.FormItem;
import com.epmet.feign.OperCustomizeOpenFeignClient;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.jetbrains.annotations.NotNull;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.web.bind.annotation.RequestParam;
import java.io.FileOutputStream;
import java.util.*;
@SpringBootTest
@RunWith(SpringRunner.class)
public class IcResiUserControllerTest {
private static final String BASE_TABLE_NAME = "BASE_TABLE_NAME";
@Autowired
private OperCustomizeOpenFeignClient operCustomizeOpenFeignClient;
@Test
public void downloadTemplate(@RequestParam String customerId) throws Exception {
CustomerFormResultDTO resultForm = getResiFormItems(customerId);
XSSFWorkbook workbook = new XSSFWorkbook();
Map<String, List<ExcelExportEntity>> sheetHeaderMap = buildHeaderByItem(resultForm);
//Workbook workbook = null;
for (Map.Entry<String, List<ExcelExportEntity>> entry : sheetHeaderMap.entrySet()) {
String sheetName = entry.getKey();
List<ExcelExportEntity> headers = entry.getValue();
System.out.println("headers:"+sheetName+JSON.toJSONString(headers));
ExportParams exportParams = new ExportParams(null,sheetName);
//exportParams.setAutoSize(true);
List<Map<String,String>> dataSet = new ArrayList<>();
HashMap<String, String> map = new HashMap<>();
map.put("1","2");
dataSet.add(map);
new ExcelExportService().createSheetForMap(workbook, exportParams, headers, dataSet);
}
FileOutputStream fos = new FileOutputStream("//Users/liujianjun/Downloads/基础信息表/Dow.tt.xls");
workbook.write(fos);
fos.close();
}
@NotNull
private CustomerFormResultDTO getResiFormItems(String customerId) {
CustomerFormQueryDTO queryDTO = new CustomerFormQueryDTO();
queryDTO.setFormCode("resi_base_info");
queryDTO.setCustomerId(customerId);
Result<CustomerFormResultDTO> resultForm = operCustomizeOpenFeignClient.getCustomerForm(queryDTO);
if (resultForm == null || !resultForm.success() ||resultForm.getData() == null){
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode());
}
System.out.println(JSON.toJSONString(resultForm.getData()));
return resultForm.getData();
}
@NotNull
private Map<String,List<ExcelExportEntity>> buildHeaderByItem(CustomerFormResultDTO resultForm) {
//form中的itemlist 为一级表头 但是要排除每个item中含有childGroup的
List<FormItem> itemList = resultForm.getItemList();
List<FormGroupDTO> groupList = resultForm.getGroupList();
Map<String,List<ExcelExportEntity>> everySheetHeaderMap = new LinkedHashMap<>();
List<ExcelExportEntity> firstSheetHeaderList = new ArrayList<>();
//Map<String, String> groupNameMap = groupList.stream().collect(Collectors.toMap(FormGroupDTO::getGroupId,FormGroupDTO::getLabel));
itemList.forEach(item->{
if (StringUtils.isBlank(item.getColumnName())){
return;
}
if (item.getChildGroup() == null){
ExcelExportEntity header = new ExcelExportEntity(item.getLabel(),item.getColumnName().concat(String.valueOf(item.getColumnNum())),30);
header.setNeedMerge(true);
firstSheetHeaderList.add(header);
return;
}
everySheetHeaderMap.putIfAbsent(resultForm.getFormName(),firstSheetHeaderList);
//这些是动态的 formGroup
if (item.getChildGroup() != null){
//baseTableName单独的一个sheet
System.out.println("childGroup:"+item.getLabel());
if (BASE_TABLE_NAME.equals(item.getTableName())){
List<ExcelExportEntity> otherSheetHeaderList = new ArrayList<>();
//这里是设置除基础信息之外的sheet的表头
item.getChildGroup().getItemList().forEach(item2->{
if (!BASE_TABLE_NAME.equals(item2.getTableName())){
everySheetHeaderMap.putIfAbsent(item.getLabel(),otherSheetHeaderList);
}
ExcelExportEntity secondHeader = new ExcelExportEntity(item2.getLabel(),item2.getColumnName().concat(String.valueOf(item2.getColumnNum())));
otherSheetHeaderList.add(secondHeader);
if (!"radio".equals(item2.getItemType()) && CollectionUtils.isNotEmpty(item2.getOptions())){
secondHeader.setNeedMerge(true);
List<ExcelExportEntity> thirdHeaderList = new ArrayList<>();
item2.getOptions().forEach(child->{
ExcelExportEntity thirdHeader = new ExcelExportEntity(child.getLabel());
thirdHeaderList.add(thirdHeader);
});
secondHeader.setList(thirdHeaderList);
}
});
}
}
});
groupList.forEach(item->{
/* if (!"兴趣爱好".equals(item.getLabel()) && !"宗教信仰".equals(item.getLabel())){
return;
}*/
if (!BASE_TABLE_NAME.equals(item.getTableName())){
return;
}
ExcelExportEntity header = new ExcelExportEntity(item.getLabel(),item.getTableName());
header.setNeedMerge(true);
List<ExcelExportEntity> secondHeaderList = new ArrayList<>();
item.getItemList().forEach(item2->{
ExcelExportEntity secondHeader = new ExcelExportEntity(item2.getLabel(),item2.getColumnName().concat(String.valueOf(item2.getColumnNum())));
secondHeader.setNeedMerge(true);
secondHeaderList.add(secondHeader);
if (com.baomidou.mybatisplus.core.toolkit.CollectionUtils.isNotEmpty(item2.getOptions())){
List<ExcelExportEntity> thirdHeaderList = new ArrayList<>();
item2.getOptions().forEach(child->{
ExcelExportEntity thirdHeader = new ExcelExportEntity(child.getLabel(),child.getValue()+ new Random(1).nextInt(2));
thirdHeader.setNeedMerge(true);
thirdHeaderList.add(thirdHeader);
});
secondHeader.setList(thirdHeaderList);
}
});
header.setList(secondHeaderList);
firstSheetHeaderList.add(header);
System.out.println(JSON.toJSONString(firstSheetHeaderList));
});
return everySheetHeaderMap;
}
private void buildHeader(Map<String, List<ExcelExportEntity>> everySheetHeaderMap, FormItem item, ExcelExportEntity header) {
List<ExcelExportEntity> firstSheetHeaderList = new ArrayList<>();
List<ExcelExportEntity> secondHeaderList = new ArrayList<>();
item.getChildGroup().getItemList().forEach(item2->{
if (!BASE_TABLE_NAME.equals(item2.getTableName())){
everySheetHeaderMap.putIfAbsent(item.getLabel(),firstSheetHeaderList);
}
ExcelExportEntity secondHeader = new ExcelExportEntity(item2.getLabel(),item2.getColumnName().concat(String.valueOf(item2.getColumnNum())));
secondHeader.setNeedMerge(true);
secondHeaderList.add(secondHeader);
if (CollectionUtils.isNotEmpty(item2.getOptions())){
List<ExcelExportEntity> thirdHeaderList = new ArrayList<>();
item2.getOptions().forEach(child->{
ExcelExportEntity thirdHeader = new ExcelExportEntity(child.getLabel());
thirdHeaderList.add(thirdHeader);
});
secondHeader.setList(thirdHeaderList);
}
});
header.setList(secondHeaderList);
firstSheetHeaderList.add(header);
everySheetHeaderMap.putIfAbsent(item.getLabel(),firstSheetHeaderList);
}
}
Loading…
Cancel
Save