Browse Source

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

dev_shibei_match
jianjun 4 years ago
parent
commit
355e8488d2
  1. 10
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java
  2. 3
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenProjectDataDao.java
  3. 8
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenProjectServiceImpl.java
  4. 43
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectDataDao.xml
  5. 2
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/result/GridAndOrgCategoryCountResultDTO.java
  6. 14
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java
  7. 17
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectDataDao.java
  8. 41
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryGridAndOrgDailyServiceImpl.java
  9. 3
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectDataServiceImpl.java
  10. 44
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectDataDao.xml
  11. 24
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/GridOptionFormDTO.java
  12. 1
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/BuildingController.java
  13. 8
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerGridController.java
  14. 1
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/HouseController.java
  15. 6
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcNeighborHoodController.java
  16. 5
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/NeighborHoodController.java
  17. 3
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java
  18. 2
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java
  19. 2
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcNeighborHoodService.java
  20. 11
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/BuildingServiceImpl.java
  21. 16
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java
  22. 11
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java
  23. 17
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcNeighborHoodServiceImpl.java
  24. 12
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/NeighborHoodServiceImpl.java
  25. 15
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml
  26. 14
      epmet-module/open-data-worker/open-data-worker-client/src/main/java/com/epmet/opendata/dto/ExDeptDTO.java
  27. 16
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/entity/ExDeptEntity.java
  28. 8
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/BaseGridInfoServiceImpl.java
  29. 2
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/ExDeptServiceImpl.java
  30. 5
      epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/IcResiCategoryStatsConfigFormDTO.java
  31. 26
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/ResiCategoryStatsConfigController.java
  32. 26
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/ResiCategoryStatsConfigServiceImpl.java
  33. 13
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java
  34. 15
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StatsResiWarnController.java
  35. 18
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcStatsResiWarnDao.java
  36. 7
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java
  37. 6
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/StatsResiWarnService.java
  38. 36
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java
  39. 40
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StatsResiWarnServiceImpl.java
  40. BIN
      epmet-user/epmet-user-server/src/main/resources/excel/ic_resi_info_cid.xls
  41. BIN
      epmet-user/epmet-user-server/src/main/resources/excel/ic_resi_info_cid_for_easy_excel.xls
  42. BIN
      epmet-user/epmet-user-server/src/main/resources/excel/ic_resi_info_cid_for_easy_excel.xlsx
  43. 2
      epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml
  44. 16
      epmet-user/epmet-user-server/src/main/resources/mapper/IcStatsResiWarnDao.xml

10
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java

@ -12,6 +12,7 @@ import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.utils.DateUtils; import com.epmet.commons.tools.utils.DateUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.formula.functions.T;
/** /**
* @author Mark sunlightcs@gmail.com * @author Mark sunlightcs@gmail.com
@ -568,6 +569,15 @@ public class RedisKeys {
return rootPrefix.concat("message:mq:blocked:").concat(blockedMsgLabel); return rootPrefix.concat("message:mq:blocked:").concat(blockedMsgLabel);
} }
/**
* desc:获取执行完毕的 业务 参数结果key
* @param bizMethod
* @return
*/
public static String getBackDoorbizExcuteResult(String bizMethod) {
return rootPrefix.concat("backdoor:").concat(bizMethod);
}
/** /**
* @description 登录票据目前只有IC基层治理平台用到 * @description 登录票据目前只有IC基层治理平台用到
* *

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

@ -55,6 +55,7 @@ public interface ScreenProjectDataDao {
* @date 2021/11/5 1:40 下午 * @date 2021/11/5 1:40 下午
*/ */
List<CategoryProjectListResultDTO> selectCategoryProjectList(@Param("customerId") String customerId,@Param("orgId") String orgId, List<CategoryProjectListResultDTO> selectCategoryProjectList(@Param("customerId") String customerId,@Param("orgId") String orgId,
@Param("categoryCode")String categoryCode,@Param("status")String status); @Param("categoryCode")String categoryCode,@Param("status")String status,
@Param("startTime")String startTime,@Param("endTime")String endTime);
} }

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

@ -245,6 +245,7 @@ public class ScreenProjectServiceImpl implements ScreenProjectService {
/** /**
* @Description 项目分类查询项目分类 * @Description 项目分类查询项目分类
* 二级分类总数占比改为 二级分类总数/一级分类总数
* @param formDTO * @param formDTO
* @param tokenDto * @param tokenDto
* @author zxc * @author zxc
@ -325,6 +326,11 @@ public class ScreenProjectServiceImpl implements ScreenProjectService {
collect.forEach(c -> { collect.forEach(c -> {
c.setChildren(c.getChildren().stream().sorted(Comparator.comparing(ProjectCategoryResultDTO::getProjectTotal).reversed()).collect(Collectors.toList())); c.setChildren(c.getChildren().stream().sorted(Comparator.comparing(ProjectCategoryResultDTO::getProjectTotal).reversed()).collect(Collectors.toList()));
}); });
collect.forEach(p -> {
p.getChildren().forEach(c -> {
c.setTotalRatio(ratio(c.getProjectTotal(), p.getProjectTotal()));
});
});
return collect; return collect;
} }
@ -376,7 +382,7 @@ public class ScreenProjectServiceImpl implements ScreenProjectService {
PageCategoryProjectListResultDTO result = new PageCategoryProjectListResultDTO(); PageCategoryProjectListResultDTO result = new PageCategoryProjectListResultDTO();
List<CategoryProjectListResultDTO> list; List<CategoryProjectListResultDTO> list;
PageInfo<CategoryProjectListResultDTO> objectPageInfo = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getIsPage()) PageInfo<CategoryProjectListResultDTO> objectPageInfo = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getIsPage())
.doSelectPageInfo(() -> screenProjectDataDao.selectCategoryProjectList(tokenDto.getCustomerId(), formDTO.getOrgId(), formDTO.getCategoryCode(), formDTO.getStatus())); .doSelectPageInfo(() -> screenProjectDataDao.selectCategoryProjectList(tokenDto.getCustomerId(), formDTO.getOrgId(), formDTO.getCategoryCode(), formDTO.getStatus(),formDTO.getStartTime(),formDTO.getEndTime()));
list = objectPageInfo.getList(); list = objectPageInfo.getList();
result.setTotal(Integer.valueOf(String.valueOf(objectPageInfo.getTotal()))); result.setTotal(Integer.valueOf(String.valueOf(objectPageInfo.getTotal())));

43
epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectDataDao.xml

@ -162,24 +162,29 @@
<!-- 查询分类下的项目列表 --> <!-- 查询分类下的项目列表 -->
<select id="selectCategoryProjectList" resultType="com.epmet.project.dto.result.CategoryProjectListResultDTO"> <select id="selectCategoryProjectList" resultType="com.epmet.project.dto.result.CategoryProjectListResultDTO">
SELECT SELECT
ALL_CATEGORY_NAME AS category, DISTINCT pd.PROJECT_ID AS projectId,
CASE WHEN PROJECT_STATUS_CODE = 'closed_case' THEN 'closed' ELSE PROJECT_STATUS_CODE END AS projectStatus, pd.ALL_CATEGORY_NAME AS category,
IFNULL(PROJECT_TITLE,'') AS projectTitle, CASE WHEN pd.PROJECT_STATUS_CODE = 'closed_case' THEN 'closed' ELSE pd.PROJECT_STATUS_CODE END AS projectStatus,
DATE_FORMAT(PROJECT_CREATE_TIME,'%Y-%m-%d %h:%i:%s') AS createTime, IFNULL(pd.PROJECT_TITLE,'') AS projectTitle,
ORG_ID, DATE_FORMAT(pd.PROJECT_CREATE_TIME,'%Y-%m-%d %h:%i:%s') AS createTime,
ORG_TYPE, pd.ORG_ID,
PROJECT_ID, pd.ORG_TYPE,
LINK_NAME, pd.LINK_NAME,
LINK_MOBILE, pd.LINK_MOBILE,
PROJECT_ADDRESS pd.PROJECT_ADDRESS
FROM screen_project_data FROM screen_project_data pd
WHERE DEL_FLAG = '0' INNER JOIN screen_project_category pc ON (pc.PROJECT_ID = pd.PROJECT_ID AND pc.DEL_FLAG = '0' AND pc.CATEGORY_CODE IS NOT NULL)
<if test=' status == "closed" '> WHERE pd.DEL_FLAG = '0'
AND PROJECT_STATUS_CODE IN ('closed_case','closed') <if test=' status == "closed" '>
</if> AND pd.PROJECT_STATUS_CODE IN ('closed_case','closed')
AND CONCAT(ALL_PARENT_IDS,':',ORG_ID) LIKE CONCAT('%',#{orgId},'%') </if>
AND CATEGORY_CODE LIKE CONCAT('%',#{categoryCode},'%') AND CONCAT(pd.ALL_PARENT_IDS,':',pd.ORG_ID) LIKE CONCAT('%',#{orgId},'%')
AND CUSTOMER_ID = #{customerId} AND pc.CATEGORY_CODE LIKE CONCAT(#{categoryCode},'%')
ORDER BY PROJECT_CREATE_TIME DESC AND pd.CUSTOMER_ID = #{customerId}
AND DATE_FORMAT(pd.PROJECT_CREATE_TIME,'%Y%m%d') <![CDATA[ <= ]]> #{endTime}
<if test="null != startTime and startTime != '' ">
AND DATE_FORMAT(pd.PROJECT_CREATE_TIME,'%Y%m%d') >= #{startTime}
</if>
ORDER BY pd.PROJECT_CREATE_TIME DESC
</select> </select>
</mapper> </mapper>

2
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/result/GridAndOrgCategoryCountResultDTO.java

@ -44,6 +44,8 @@ public class GridAndOrgCategoryCountResultDTO implements Serializable {
private String customerId; private String customerId;
private String categoryOriginCustomerId;
/** /**
* 分类CODE * 分类CODE
*/ */

14
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java

@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.RenException; 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.DateUtils; import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.commons.tools.validator.ValidatorUtils;
@ -60,9 +62,7 @@ import org.springframework.web.bind.annotation.*;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.ArrayList; import java.util.*;
import java.util.Date;
import java.util.List;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future; import java.util.concurrent.Future;
@ -73,7 +73,8 @@ import java.util.concurrent.Future;
public class DemoController { public class DemoController {
@Autowired @Autowired
private StatsDemoService demoService; private StatsDemoService demoService;
@Autowired
private RedisUtils redisUtils;
@Autowired @Autowired
private ExecutorService executorService; private ExecutorService executorService;
@ -1084,16 +1085,21 @@ public class DemoController {
@RequestParam(name = "startDate",required = false)String startDate, @RequestParam(name = "startDate",required = false)String startDate,
@RequestParam(name = "endDate",required = false)String endDate @RequestParam(name = "endDate",required = false)String endDate
){ ){
long start = System.currentTimeMillis(); long start = System.currentTimeMillis();
Set<String> result = new LinkedHashSet<>();
if (StringUtils.isNotBlank(startDate) && StringUtils.isNotBlank(endDate)){ if (StringUtils.isNotBlank(startDate) && StringUtils.isNotBlank(endDate)){
List<String> daysBetween = DateUtils.getDaysBetween(startDate, endDate); List<String> daysBetween = DateUtils.getDaysBetween(startDate, endDate);
daysBetween.forEach(d -> { daysBetween.forEach(d -> {
screenProjectCategoryGridAndOrgDailyService.extractCategoryProjectGridData(customerId,d); screenProjectCategoryGridAndOrgDailyService.extractCategoryProjectGridData(customerId,d);
screenProjectCategoryGridAndOrgDailyService.extractCategoryProjectOrgData(customerId,d); screenProjectCategoryGridAndOrgDailyService.extractCategoryProjectOrgData(customerId,d);
result.add(d);
redisUtils.hSet(RedisKeys.getBackDoorbizExcuteResult("gridandorgdailynew"),customerId,result,3*24*60*60L);
}); });
}else { }else {
screenProjectCategoryGridAndOrgDailyService.extractCategoryProjectGridData(customerId,dateId); screenProjectCategoryGridAndOrgDailyService.extractCategoryProjectGridData(customerId,dateId);
screenProjectCategoryGridAndOrgDailyService.extractCategoryProjectOrgData(customerId,dateId); screenProjectCategoryGridAndOrgDailyService.extractCategoryProjectOrgData(customerId,dateId);
redisUtils.hSet(RedisKeys.getBackDoorbizExcuteResult("gridandorgdailynew"),customerId,result,3*24*60*60L);
} }
long end = System.currentTimeMillis(); long end = System.currentTimeMillis();
long l = (end - start) / 1000; long l = (end - start) / 1000;

17
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectDataDao.java

@ -80,7 +80,7 @@ public interface ScreenProjectDataDao extends BaseDao<ScreenProjectDataEntity> {
* @author zxc * @author zxc
* @date 2021/11/10 3:12 下午 * @date 2021/11/10 3:12 下午
*/ */
List<GridAndOrgCategoryCountResultDTO> selectGridCategoryProjectCount(@Param("customerIds") List<String> customerIds,@Param("dateId") String dateId, List<GridAndOrgCategoryCountResultDTO> selectGridCategoryProjectCount(@Param("dateId") String dateId,@Param("parentCustomerId") String parentCustomerId,
@Param("status")String status,@Param("customerId") String customerId, @Param("status")String status,@Param("customerId") String customerId,
@Param("subCount")Integer subCount); @Param("subCount")Integer subCount);
@ -96,4 +96,19 @@ public interface ScreenProjectDataDao extends BaseDao<ScreenProjectDataEntity> {
List<GridAndOrgCategoryCountResultDTO> selectOrgCategoryProjectCount(@Param("dateId") String dateId, @Param("status")String status, List<GridAndOrgCategoryCountResultDTO> selectOrgCategoryProjectCount(@Param("dateId") String dateId, @Param("status")String status,
@Param("customerId") String customerId, @Param("subCount")Integer subCount, @Param("customerId") String customerId, @Param("subCount")Integer subCount,
@Param("allAgencies") List<GridAndOrgCategoryCountResultDTO> allAgencies); @Param("allAgencies") List<GridAndOrgCategoryCountResultDTO> allAgencies);
/**
* @Description 查询组织下的1级项目分类
* @param dateId
* @param status
* @param customerId
* @param subCount
* @param allAgencies
* @author zxc
* @date 2021/11/11 11:14 上午
*/
List<GridAndOrgCategoryCountResultDTO> selectOrgCategoryOneLevelProjectCount(@Param("dateId") String dateId, @Param("status")String status,
@Param("customerId") String customerId, @Param("subCount")Integer subCount,
@Param("allAgencies") List<GridAndOrgCategoryCountResultDTO> allAgencies);
} }

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

@ -65,6 +65,8 @@ public class ScreenProjectCategoryGridAndOrgDailyServiceImpl implements ScreenPr
*/ */
@Override @Override
public void extractCategoryProjectGridData(String customerId, String dateId) { public void extractCategoryProjectGridData(String customerId, String dateId) {
log.info("开始执行网格项目分类统计");
long start = System.currentTimeMillis();
List<CustomerRelationEntity> relationInfo = relationService.selectSubCustomer(customerId); List<CustomerRelationEntity> relationInfo = relationService.selectSubCustomer(customerId);
List<String> customerIds = new ArrayList<>(); List<String> customerIds = new ArrayList<>();
customerIds.add(customerId); customerIds.add(customerId);
@ -72,19 +74,28 @@ public class ScreenProjectCategoryGridAndOrgDailyServiceImpl implements ScreenPr
List<GridAndOrgCategoryCountResultDTO> closedList = new ArrayList<>(); List<GridAndOrgCategoryCountResultDTO> closedList = new ArrayList<>();
if (CollectionUtils.isEmpty(relationInfo)){ if (CollectionUtils.isEmpty(relationInfo)){
// 单客户 // 单客户
allList = screenProjectDataDao.selectGridCategoryProjectCount(customerIds, dateId, ProjectConstant.PROJECT_STATUS_ALL,customerId, NumConstant.FOUR); allList = screenProjectDataDao.selectGridCategoryProjectCount(dateId, customerId, ProjectConstant.PROJECT_STATUS_ALL,customerId, NumConstant.FOUR);
closedList = screenProjectDataDao.selectGridCategoryProjectCount(customerIds, dateId, ProjectConstant.PROJECT_STATUS_CLOSED,customerId, NumConstant.FOUR); closedList = screenProjectDataDao.selectGridCategoryProjectCount(dateId, customerId, ProjectConstant.PROJECT_STATUS_CLOSED,customerId, NumConstant.FOUR);
}else { }else {
// 多客户 // 多客户
List<String> subCustomerIds = relationInfo.stream().map(CustomerRelationEntity::getCustomerId).collect(Collectors.toList()); List<String> subCustomerIds = relationInfo.stream().map(CustomerRelationEntity::getCustomerId).collect(Collectors.toList());
customerIds.addAll(subCustomerIds); customerIds.addAll(subCustomerIds);
allList = screenProjectDataDao.selectGridCategoryProjectCount(customerIds, dateId, ProjectConstant.PROJECT_STATUS_ALL,customerId, NumConstant.TWO); List<GridAndOrgCategoryCountResultDTO> finalAllList = allList;
closedList = screenProjectDataDao.selectGridCategoryProjectCount(customerIds, dateId, ProjectConstant.PROJECT_STATUS_CLOSED,customerId, NumConstant.TWO); List<GridAndOrgCategoryCountResultDTO> finalClosedList1 = closedList;
customerIds.forEach(c -> {
List<GridAndOrgCategoryCountResultDTO> all = screenProjectDataDao.selectGridCategoryProjectCount(dateId, customerId, ProjectConstant.PROJECT_STATUS_ALL, c, NumConstant.TWO);
finalAllList.addAll(all);
List<GridAndOrgCategoryCountResultDTO> closed = screenProjectDataDao.selectGridCategoryProjectCount(dateId, customerId, ProjectConstant.PROJECT_STATUS_CLOSED, c, NumConstant.TWO);
finalClosedList1.addAll(closed);
});
} }
List<GridAndOrgCategoryCountResultDTO> finalClosedList = closedList; List<GridAndOrgCategoryCountResultDTO> finalClosedList = closedList;
allList.forEach(a -> finalClosedList.stream().filter(c -> c.getGridId().equals(a.getGridId()) && c.getCategoryCode().equals(a.getCategoryCode())).forEach(c -> a.setClosedProjectTotal(c.getClosedProjectTotal()))); allList.forEach(a -> finalClosedList.stream().filter(c -> c.getGridId().equals(a.getGridId()) && c.getCategoryCode().equals(a.getCategoryCode())).forEach(c -> a.setClosedProjectTotal(c.getClosedProjectTotal())));
gridDel(customerId,dateId); gridDel(customerId,dateId);
log.info("网格-所有项目分类即将插入的集合{}",JSON.toJSONString(allList));
gridInsert(allList); gridInsert(allList);
long end = System.currentTimeMillis();
log.info("网格项目分类统计结束,耗时:"+ (end-start)/1000 + "s");
} }
/** /**
@ -128,6 +139,8 @@ public class ScreenProjectCategoryGridAndOrgDailyServiceImpl implements ScreenPr
*/ */
@Override @Override
public void extractCategoryProjectOrgData(String customerId, String dateId) { public void extractCategoryProjectOrgData(String customerId, String dateId) {
log.info("开始执行组织项目分类统计");
long start = System.currentTimeMillis();
List<CustomerRelationEntity> relationInfo = relationService.selectSubCustomer(customerId); List<CustomerRelationEntity> relationInfo = relationService.selectSubCustomer(customerId);
List<String> customerIds = new ArrayList<>(); List<String> customerIds = new ArrayList<>();
customerIds.add(customerId); customerIds.add(customerId);
@ -136,10 +149,18 @@ public class ScreenProjectCategoryGridAndOrgDailyServiceImpl implements ScreenPr
// one customer // one customer
List<ScreenProjectOrgDailyDTO> agencies = screenCustomerAgencyDao.selectAgencyByCustomer(customerId); List<ScreenProjectOrgDailyDTO> agencies = screenCustomerAgencyDao.selectAgencyByCustomer(customerId);
List<GridAndOrgCategoryCountResultDTO> allAgencies = ConvertUtils.sourceToTarget(agencies, GridAndOrgCategoryCountResultDTO.class); List<GridAndOrgCategoryCountResultDTO> allAgencies = ConvertUtils.sourceToTarget(agencies, GridAndOrgCategoryCountResultDTO.class);
result = screenProjectDataDao.selectOrgCategoryProjectCount(dateId, ProjectConstant.PROJECT_STATUS_ALL, customerId, NumConstant.FOUR, allAgencies); result = screenProjectDataDao.selectOrgCategoryProjectCount(dateId, ProjectConstant.PROJECT_STATUS_ALL, customerId, NumConstant.FOUR, allAgencies);
List<GridAndOrgCategoryCountResultDTO> closedList = screenProjectDataDao.selectOrgCategoryProjectCount(dateId, ProjectConstant.PROJECT_STATUS_CLOSED, customerId, NumConstant.FOUR, allAgencies); List<GridAndOrgCategoryCountResultDTO> closedList = screenProjectDataDao.selectOrgCategoryProjectCount(dateId, ProjectConstant.PROJECT_STATUS_CLOSED, customerId, NumConstant.FOUR, allAgencies);
result.forEach(r -> closedList.stream().filter(c -> r.getOrgId().equals(c.getOrgId()) && r.getCategoryCode().equals(c.getCategoryCode())).forEach(c -> r.setClosedProjectTotal(c.getClosedProjectTotal()))); result.forEach(r -> closedList.stream().filter(c -> r.getOrgId().equals(c.getOrgId()) && r.getCategoryCode().equals(c.getCategoryCode())).forEach(c -> r.setClosedProjectTotal(c.getClosedProjectTotal())));
}else {
List<GridAndOrgCategoryCountResultDTO> oneLevelList = screenProjectDataDao.selectOrgCategoryOneLevelProjectCount(dateId, ProjectConstant.PROJECT_STATUS_ALL, customerId, NumConstant.FOUR, allAgencies);
List<GridAndOrgCategoryCountResultDTO> oneLevelClosedList = screenProjectDataDao.selectOrgCategoryOneLevelProjectCount(dateId, ProjectConstant.PROJECT_STATUS_CLOSED, customerId, NumConstant.FOUR, allAgencies);
oneLevelList.forEach(a -> oneLevelClosedList.stream().filter(c -> a.getOrgId().equals(c.getOrgId()) && a.getCategoryCode().equals(c.getCategoryCode())).forEach(c -> a.setClosedProjectTotal(c.getClosedProjectTotal())));
result.addAll(oneLevelList);
}else {
// more customers // more customers
// 去除孔村的客户ID,孔村镇的单独查😡 // 去除孔村的客户ID,孔村镇的单独查😡
List<String> subCustomerIds = relationInfo.stream().map(CustomerRelationEntity::getCustomerId).collect(Collectors.toList()); List<String> subCustomerIds = relationInfo.stream().map(CustomerRelationEntity::getCustomerId).collect(Collectors.toList());
@ -149,6 +170,7 @@ public class ScreenProjectCategoryGridAndOrgDailyServiceImpl implements ScreenPr
continue; continue;
} }
} }
subCustomerIds.add(customerId);
List<GridAndOrgCategoryCountResultDTO> allAgencies = screenCustomerAgencyDao.selectParentSonAgency(subCustomerIds, PingYinConstant.KONG_CUN_CUSTOMER_ID); List<GridAndOrgCategoryCountResultDTO> allAgencies = screenCustomerAgencyDao.selectParentSonAgency(subCustomerIds, PingYinConstant.KONG_CUN_CUSTOMER_ID);
List<List<GridAndOrgCategoryCountResultDTO>> partition = ListUtils.partition(allAgencies, NumConstant.FIFTY); List<List<GridAndOrgCategoryCountResultDTO>> partition = ListUtils.partition(allAgencies, NumConstant.FIFTY);
List<GridAndOrgCategoryCountResultDTO> allOrgCategoryList = result; List<GridAndOrgCategoryCountResultDTO> allOrgCategoryList = result;
@ -156,11 +178,20 @@ public class ScreenProjectCategoryGridAndOrgDailyServiceImpl implements ScreenPr
List<GridAndOrgCategoryCountResultDTO> allOrgList = screenProjectDataDao.selectOrgCategoryProjectCount(dateId, ProjectConstant.PROJECT_STATUS_ALL, customerId, NumConstant.TWO, p); List<GridAndOrgCategoryCountResultDTO> allOrgList = screenProjectDataDao.selectOrgCategoryProjectCount(dateId, ProjectConstant.PROJECT_STATUS_ALL, customerId, NumConstant.TWO, p);
List<GridAndOrgCategoryCountResultDTO> closedOrgList = screenProjectDataDao.selectOrgCategoryProjectCount(dateId, ProjectConstant.PROJECT_STATUS_CLOSED, customerId, NumConstant.TWO, p); List<GridAndOrgCategoryCountResultDTO> closedOrgList = screenProjectDataDao.selectOrgCategoryProjectCount(dateId, ProjectConstant.PROJECT_STATUS_CLOSED, customerId, NumConstant.TWO, p);
allOrgList.forEach(a -> closedOrgList.stream().filter(c -> a.getOrgId().equals(c.getOrgId()) && a.getCategoryCode().equals(c.getCategoryCode())).forEach(c -> a.setClosedProjectTotal(c.getClosedProjectTotal()))); allOrgList.forEach(a -> closedOrgList.stream().filter(c -> a.getOrgId().equals(c.getOrgId()) && a.getCategoryCode().equals(c.getCategoryCode())).forEach(c -> a.setClosedProjectTotal(c.getClosedProjectTotal())));
List<GridAndOrgCategoryCountResultDTO> oneLevelList = screenProjectDataDao.selectOrgCategoryOneLevelProjectCount(dateId, ProjectConstant.PROJECT_STATUS_ALL, customerId, NumConstant.TWO, p);
List<GridAndOrgCategoryCountResultDTO> oneLevelClosedList = screenProjectDataDao.selectOrgCategoryOneLevelProjectCount(dateId, ProjectConstant.PROJECT_STATUS_CLOSED, customerId, NumConstant.TWO, p);
oneLevelList.forEach(a -> oneLevelClosedList.stream().filter(c -> a.getOrgId().equals(c.getOrgId()) && a.getCategoryCode().equals(c.getCategoryCode())).forEach(c -> a.setClosedProjectTotal(c.getClosedProjectTotal())));
allOrgList.addAll(oneLevelList);
allOrgCategoryList.addAll(allOrgList); allOrgCategoryList.addAll(allOrgList);
}); });
} }
orgDel(customerId,dateId); orgDel(customerId,dateId);
log.info("组织-即将插入的项目分类{}",JSON.toJSONString(result));
orgInsert(result); orgInsert(result);
long end = System.currentTimeMillis();
log.info("组织项目分类统计结束,耗时:"+ (end-start)/1000 + "s");
} }
/** /**

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

@ -373,11 +373,12 @@ public class ScreenProjectDataServiceImpl extends BaseServiceImpl<ScreenProjectD
entity.setCategoryCode(categoryEntity.getEpmetCategoryCode()); entity.setCategoryCode(categoryEntity.getEpmetCategoryCode());
CustomerProjectCategoryDictEntity parent = customerProjectCategoryDictService.getByCategoryCode(parentCustomer.getData(), categoryEntity.getEpmetCategoryCode()); CustomerProjectCategoryDictEntity parent = customerProjectCategoryDictService.getByCategoryCode(parentCustomer.getData(), categoryEntity.getEpmetCategoryCode());
entity.setParentCategoryCode(parent.getParentCategoryCode()); entity.setParentCategoryCode(parent.getParentCategoryCode());
entity.setLevel(parent.getLevel());
} else { } else {
entity.setCategoryCode(categoryEntity.getCategoryCode()); entity.setCategoryCode(categoryEntity.getCategoryCode());
entity.setParentCategoryCode(categoryEntity.getParentCategoryCode()); entity.setParentCategoryCode(categoryEntity.getParentCategoryCode());
entity.setLevel(categoryEntity.getLevel());
} }
entity.setLevel(categoryEntity.getLevel());
} }
projectCategoryList.add(entity); projectCategoryList.add(entity);
}); });

44
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectDataDao.xml

@ -274,7 +274,7 @@
<select id="selectGridCategoryProjectCount" resultType="com.epmet.dto.screen.result.GridAndOrgCategoryCountResultDTO"> <select id="selectGridCategoryProjectCount" resultType="com.epmet.dto.screen.result.GridAndOrgCategoryCountResultDTO">
SELECT SELECT
#{dateId} AS dateId, #{dateId} AS dateId,
#{customerId} AS customerId, #{parentCustomerId} AS customerId,
pc.CATEGORY_CODE, pc.CATEGORY_CODE,
pd.ORG_ID AS gridId, pd.ORG_ID AS gridId,
pd.PARENT_ID AS pid, pd.PARENT_ID AS pid,
@ -287,12 +287,9 @@
COUNT(DISTINCT pc.PROJECT_ID) AS projectTotal COUNT(DISTINCT pc.PROJECT_ID) AS projectTotal
</if> </if>
FROM screen_project_data pd FROM screen_project_data pd
LEFT JOIN screen_project_category pc ON (pc.PROJECT_ID = pd.PROJECT_ID AND pc.DEL_FLAG = '0') inner JOIN screen_project_category pc ON (pc.PROJECT_ID = pd.PROJECT_ID AND pc.DEL_FLAG = '0' AND pc.CATEGORY_CODE IS NOT NULL)
WHERE pd.DEL_FLAG = '0' WHERE pd.DEL_FLAG = '0'
AND pd.CUSTOMER_ID IN AND pd.CUSTOMER_ID =#{customerId}
<foreach collection="customerIds" item="c" separator="," open="(" close=")">
#{c}
</foreach>
AND DATE_FORMAT(pd.PROJECT_CREATE_TIME,'%Y%m%d') <![CDATA[ <= ]]> #{dateId} AND DATE_FORMAT(pd.PROJECT_CREATE_TIME,'%Y%m%d') <![CDATA[ <= ]]> #{dateId}
AND pd.ORG_TYPE = 'grid' AND pd.ORG_TYPE = 'grid'
AND pc.level = 2 AND pc.level = 2
@ -303,7 +300,7 @@
UNION ALL UNION ALL
SELECT SELECT
#{dateId} AS dateId, #{dateId} AS dateId,
#{customerId} AS customerId, #{parentCustomerId} AS customerId,
left(pc.CATEGORY_CODE, #{subCount}) AS categoryCode, left(pc.CATEGORY_CODE, #{subCount}) AS categoryCode,
pd.ORG_ID AS gridId, pd.ORG_ID AS gridId,
pd.PARENT_ID AS pid, pd.PARENT_ID AS pid,
@ -316,12 +313,9 @@
COUNT(DISTINCT pc.PROJECT_ID) AS projectTotal COUNT(DISTINCT pc.PROJECT_ID) AS projectTotal
</if> </if>
FROM screen_project_data pd FROM screen_project_data pd
INNER JOIN screen_project_category pc ON (pc.PROJECT_ID = pd.PROJECT_ID AND pc.DEL_FLAG = '0') INNER JOIN screen_project_category pc ON (pc.PROJECT_ID = pd.PROJECT_ID AND pc.DEL_FLAG = '0' AND pc.CATEGORY_CODE IS NOT NULL)
WHERE pd.DEL_FLAG = '0' WHERE pd.DEL_FLAG = '0'
AND pd.CUSTOMER_ID IN AND pd.CUSTOMER_ID = #{customerId}
<foreach collection="customerIds" item="c" separator="," open="(" close=")">
#{c}
</foreach>
AND DATE_FORMAT(pd.PROJECT_CREATE_TIME,'%Y%m%d') <![CDATA[ <= ]]> #{dateId} AND DATE_FORMAT(pd.PROJECT_CREATE_TIME,'%Y%m%d') <![CDATA[ <= ]]> #{dateId}
AND pd.ORG_TYPE = 'grid' AND pd.ORG_TYPE = 'grid'
<if test=' status == "closed" '> <if test=' status == "closed" '>
@ -336,6 +330,7 @@
SELECT SELECT
#{dateId} AS dateId, #{dateId} AS dateId,
#{customerId} AS customerId, #{customerId} AS customerId,
pd.customer_id AS categoryOriginCustomerId,
pc.CATEGORY_CODE, pc.CATEGORY_CODE,
#{a.orgId} AS orgId, #{a.orgId} AS orgId,
#{a.pid} AS pid, #{a.pid} AS pid,
@ -349,25 +344,30 @@
COUNT(DISTINCT pc.PROJECT_ID) AS projectTotal COUNT(DISTINCT pc.PROJECT_ID) AS projectTotal
</if> </if>
FROM screen_project_data pd FROM screen_project_data pd
LEFT JOIN screen_project_category pc ON (pc.PROJECT_ID = pd.PROJECT_ID AND pc.DEL_FLAG = '0') inner JOIN screen_project_category pc ON (pc.PROJECT_ID = pd.PROJECT_ID AND pc.DEL_FLAG = '0' AND pc.CATEGORY_CODE IS NOT NULL)
WHERE pd.DEL_FLAG = '0' WHERE pd.DEL_FLAG = '0'
AND pc.level = 2 AND pc.level = 2
AND DATE_FORMAT(pd.PROJECT_CREATE_TIME,'%Y%m%d') <![CDATA[ <= ]]> #{dateId} AND DATE_FORMAT(pd.PROJECT_CREATE_TIME,'%Y%m%d') <![CDATA[ <= ]]> #{dateId}
AND ALL_PARENT_IDS LIKE #{a.orgId} AND ALL_PARENT_IDS LIKE CONCAT('%',#{a.orgId},'%')
<if test=' status == "closed" '> <if test=' status == "closed" '>
AND pd.PROJECT_STATUS_CODE IN ('closed','closed_case') AND pd.PROJECT_STATUS_CODE IN ('closed','closed_case')
</if> </if>
GROUP BY pc.CATEGORY_CODE GROUP BY pc.CATEGORY_CODE
UNION ALL </foreach>
</select>
<select id="selectOrgCategoryOneLevelProjectCount" resultType="com.epmet.dto.screen.result.GridAndOrgCategoryCountResultDTO">
<foreach collection="allAgencies" item="a" separator=" UNION ALL ">
SELECT SELECT
#{dateId} AS dateId, #{dateId} AS dateId,
#{customerId} AS customerId, #{customerId} AS customerId,
pd.customer_id AS categoryOriginCustomerId,
left(pc.CATEGORY_CODE, #{subCount}) AS categoryCode, left(pc.CATEGORY_CODE, #{subCount}) AS categoryCode,
#{a.orgId} AS orgId, #{a.orgId} AS orgId,
#{a.pid} AS pid, #{a.pid} AS pid,
#{a.pids} AS pids, #{a.pids} AS pids,
#{a.orgType} AS orgType, #{a.orgType} AS orgType,
pc.`LEVEL`, 1 AS level,
<if test=' status == "closed" '> <if test=' status == "closed" '>
COUNT(DISTINCT pc.PROJECT_ID) AS closedProjectTotal COUNT(DISTINCT pc.PROJECT_ID) AS closedProjectTotal
</if> </if>
@ -375,13 +375,13 @@
COUNT(DISTINCT pc.PROJECT_ID) AS projectTotal COUNT(DISTINCT pc.PROJECT_ID) AS projectTotal
</if> </if>
FROM screen_project_data pd FROM screen_project_data pd
INNER JOIN screen_project_category pc ON (pc.PROJECT_ID = pd.PROJECT_ID AND pc.DEL_FLAG = '0') INNER JOIN screen_project_category pc ON (pc.PROJECT_ID = pd.PROJECT_ID AND pc.DEL_FLAG = '0' AND pc.CATEGORY_CODE IS NOT NULL)
WHERE pd.DEL_FLAG = '0' WHERE pd.DEL_FLAG = '0'
AND DATE_FORMAT(pd.PROJECT_CREATE_TIME,'%Y%m%d') <![CDATA[ <= ]]> #{dateId} AND DATE_FORMAT(pd.PROJECT_CREATE_TIME,'%Y%m%d') <![CDATA[ <= ]]> #{dateId}
AND ALL_PARENT_IDS LIKE #{a.orgId} AND ALL_PARENT_IDS LIKE CONCAT('%',#{a.orgId},'%')
<if test=' status == "closed" '> <if test=' status == "closed" '>
AND pd.PROJECT_STATUS_CODE IN ('closed','closed_case') AND pd.PROJECT_STATUS_CODE IN ('closed','closed_case')
</if> </if>
GROUP BY categoryCode GROUP BY categoryCode
</foreach> </foreach>
</select> </select>

24
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/GridOptionFormDTO.java

@ -0,0 +1,24 @@
package com.epmet.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @Description /gov/org/customergrid/gridoption
* @Author yinzuomei
* @Date 2021/11/12 10:54 上午
*/
@Data
public class GridOptionFormDTO implements Serializable {
/**
* 部门Id
*/
@NotBlank(message = "组织机构ID不能为空")
private String agencyId;
//等着杨林改完,我再限制必填吧
//@NotBlank(message = "查询条件和查看居民详情:query;新增或修改居民信息:addorupdate")
private String purpose;
}

1
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/BuildingController.java

@ -194,6 +194,7 @@ public class BuildingController {
if(resultList.size()> NumConstant.ZERO){ if(resultList.size()> NumConstant.ZERO){
Collections.sort(resultList); Collections.sort(resultList);
String subList = resultList.stream().map(String::valueOf).collect(Collectors.joining("、")); String subList = resultList.stream().map(String::valueOf).collect(Collectors.joining("、"));
log.warn(str + "第" + subList + "行未成功!");
return new Result().error(9999, str+"第"+subList+"行未成功!"); return new Result().error(9999, str+"第"+subList+"行未成功!");
} }
return new Result().ok(str); return new Result().ok(str);

8
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerGridController.java

@ -289,15 +289,17 @@ public class CustomerGridController {
/** /**
* @Description 获取组织下网格选项 * @Description 获取组织下网格选项
* 居民信息1查询条件 :所属网格下拉框2查看详情所属网格下拉框
* label: 社区-网格
* value: 网格id
* @Param formDTO * @Param formDTO
* @Return {@link Result<List<OptionResultDTO>>} * @Return {@link Result<List<OptionResultDTO>>}
* @Author zhaoqifeng * @Author zhaoqifeng
* @Date 2021/10/26 14:02 * @Date 2021/10/26 14:02
*/ */
@PostMapping("gridoption") @PostMapping("gridoption")
public Result<List<OptionResultDTO>> getGridOption(@RequestBody AgencyIdFormDTO formDTO){ public Result<List<OptionResultDTO>> getGridOption(@RequestBody GridOptionFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO); ValidatorUtils.validateEntity(formDTO);
return new Result<List<OptionResultDTO>>().ok(customerGridService.getGridOption(formDTO.getAgencyId())); return new Result<List<OptionResultDTO>>().ok(customerGridService.getGridOption(formDTO.getAgencyId(),formDTO.getPurpose()));
} }
} }

1
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/HouseController.java

@ -163,6 +163,7 @@ public class HouseController {
if(resultList.size()> NumConstant.ZERO){ if(resultList.size()> NumConstant.ZERO){
Collections.sort(resultList); Collections.sort(resultList);
String subList = resultList.stream().map(String::valueOf).collect(Collectors.joining("、")); String subList = resultList.stream().map(String::valueOf).collect(Collectors.joining("、"));
log.warn(str + "第" + subList + "行未成功!");
return new Result().error(9999, str+"第"+subList+"行未成功!"); return new Result().error(9999, str+"第"+subList+"行未成功!");
} }
return new Result().ok(str); return new Result().ok(str);

6
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcNeighborHoodController.java

@ -17,8 +17,10 @@
package com.epmet.controller; package com.epmet.controller;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.dto.result.OptionResultDTO; import com.epmet.commons.tools.dto.result.OptionResultDTO;
import com.epmet.commons.tools.page.PageData; 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.utils.Result;
import com.epmet.commons.tools.validator.AssertUtils; import com.epmet.commons.tools.validator.AssertUtils;
import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.commons.tools.validator.ValidatorUtils;
@ -91,8 +93,8 @@ public class IcNeighborHoodController {
* @Date 2021/10/26 14:38 * @Date 2021/10/26 14:38
*/ */
@PostMapping("neighborhoodoption") @PostMapping("neighborhoodoption")
public Result<List<OptionResultDTO>> getNeighborHoodOptions(@RequestBody IcNeighborHoodDTO dto) { public Result<List<OptionResultDTO>> getNeighborHoodOptions(@LoginUser TokenDto tokenDto, @RequestBody IcNeighborHoodDTO dto) {
return new Result<List<OptionResultDTO>>().ok(icNeighborHoodService.getNeighborHoodOptions(dto.getAgencyId(), dto.getGridId())); return new Result<List<OptionResultDTO>>().ok(icNeighborHoodService.getNeighborHoodOptions(dto.getAgencyId(), dto.getGridId(),tokenDto.getUserId(),tokenDto.getCustomerId()));
} }
/** /**

5
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/NeighborHoodController.java

@ -219,10 +219,11 @@ public class NeighborHoodController {
// log.info(JSON.toJSONString(result)); // log.info(JSON.toJSONString(result));
List<Integer> resultList = neighborHoodService.importExcel(customerId,result,tokenDTO.getUserId(),numList); List<Integer> resultList = neighborHoodService.importExcel(customerId,result,tokenDTO.getUserId(),numList);
String str = String.format("共%s条,成功导入%s条。",numList.size()+result.size(),numList.size()+result.size()-resultList.size()); String str = String.format("共%s条,成功导入%s条。",numList.size()+result.size(),numList.size()+result.size()-resultList.size());
if(resultList.size()> NumConstant.ZERO){ if (resultList.size() > NumConstant.ZERO) {
Collections.sort(resultList); Collections.sort(resultList);
String subList = resultList.stream().map(String::valueOf).collect(Collectors.joining("、")); String subList = resultList.stream().map(String::valueOf).collect(Collectors.joining("、"));
return new Result().error(9999, str+"第"+subList+"行未成功!"); log.warn(str + "第" + subList + "行未成功!");
return new Result().error(9999, str + "第" + subList + "行未成功!");
} }
return new Result().ok(str); return new Result().ok(str);
} }

3
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java

@ -18,6 +18,7 @@
package com.epmet.dao; package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.commons.tools.dto.result.OptionResultDTO;
import com.epmet.dto.CustomerGridDTO; import com.epmet.dto.CustomerGridDTO;
import com.epmet.dto.UserIdAndPidDTO; import com.epmet.dto.UserIdAndPidDTO;
import com.epmet.dto.UserIdDTO; import com.epmet.dto.UserIdDTO;
@ -342,4 +343,6 @@ public interface CustomerGridDao extends BaseDao<CustomerGridEntity> {
* @Description 查询组织下直属网格列表 * @Description 查询组织下直属网格列表
**/ **/
List<CustomerGridEntity> selectByPid(@Param("pid") String pid); List<CustomerGridEntity> selectByPid(@Param("pid") String pid);
List<OptionResultDTO> getGridOptionForQuery(String gridPids);
} }

2
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java

@ -337,5 +337,5 @@ public interface CustomerGridService extends BaseService<CustomerGridEntity> {
* @Author zhaoqifeng * @Author zhaoqifeng
* @Date 2021/10/26 14:01 * @Date 2021/10/26 14:01
*/ */
List<OptionResultDTO> getGridOption(String agencyId); List<OptionResultDTO> getGridOption(String agencyId,String purpose);
} }

2
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcNeighborHoodService.java

@ -102,7 +102,7 @@ public interface IcNeighborHoodService extends BaseService<IcNeighborHoodEntity>
* @Author zhaoqifeng * @Author zhaoqifeng
* @Date 2021/10/26 14:32 * @Date 2021/10/26 14:32
*/ */
List<OptionResultDTO> getNeighborHoodOptions(String agencyId, String gridId); List<OptionResultDTO> getNeighborHoodOptions(String agencyId, String gridId,String staffId,String customerId);
/** /**
* @Description 通过ID查询小区信息 * @Description 通过ID查询小区信息

11
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/BuildingServiceImpl.java

@ -245,7 +245,9 @@ public class BuildingServiceImpl implements BuildingService {
//封装数据 //封装数据
List<IcBuildingEntity> buildingEntityList = new ArrayList<>(); List<IcBuildingEntity> buildingEntityList = new ArrayList<>();
List<IcBuildingUnitEntity> icBuildingUnitEntityList = new ArrayList<>(); List<IcBuildingUnitEntity> icBuildingUnitEntityList = new ArrayList<>();
for (IcBuildingExcel icBuildingExcel : list) { Iterator<IcBuildingExcel> iterator1 = list.iterator();
while (iterator1.hasNext()) {
IcBuildingExcel icBuildingExcel = iterator1.next();
IcBuildingEntity entity = new IcBuildingEntity(); IcBuildingEntity entity = new IcBuildingEntity();
String uuid = UUID.randomUUID().toString().replace("-", ""); String uuid = UUID.randomUUID().toString().replace("-", "");
entity.setId(uuid); entity.setId(uuid);
@ -254,6 +256,7 @@ public class BuildingServiceImpl implements BuildingService {
if ("".equals(entity.getNeighborHoodId())) { if ("".equals(entity.getNeighborHoodId())) {
//str.append("".equals(str) ? icBuildingExcel.getNeighborHoodName() : str.append("、").append(icBuildingExcel.getNeighborHoodName())); //str.append("".equals(str) ? icBuildingExcel.getNeighborHoodName() : str.append("、").append(icBuildingExcel.getNeighborHoodName()));
numList.add(icBuildingExcel.getRowNum()); numList.add(icBuildingExcel.getRowNum());
iterator1.remove();
continue; continue;
} }
entity.setBuildingName(icBuildingExcel.getBuildingName()); entity.setBuildingName(icBuildingExcel.getBuildingName());
@ -278,7 +281,11 @@ public class BuildingServiceImpl implements BuildingService {
//同一小区下不能存在楼栋名字一样的 //同一小区下不能存在楼栋名字一样的
Integer count = icBuildingDao.checkBuildName(entity.getNeighborHoodId(),entity.getBuildingName(),null); Integer count = icBuildingDao.checkBuildName(entity.getNeighborHoodId(),entity.getBuildingName(),null);
if (null != count && count > 0) { if (null != count && count > 0) {
throw new RenException(EpmetErrorCode.BUILDING_NAME_EXITED.getCode(),EpmetErrorCode.BUILDING_NAME_EXITED.getMsg()); //throw new RenException(EpmetErrorCode.BUILDING_NAME_EXITED.getCode(),EpmetErrorCode.BUILDING_NAME_EXITED.getMsg());
log.error(EpmetErrorCode.BUILDING_NAME_EXITED.getMsg());
numList.add(icBuildingExcel.getRowNum());
iterator1.remove();
continue;
} }
icBuildingUnitEntityList.addAll(unitList); icBuildingUnitEntityList.addAll(unitList);
} }

16
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java

@ -844,7 +844,20 @@ public class CustomerGridServiceImpl extends BaseServiceImpl<CustomerGridDao, Cu
* @Date 2021/10/26 14:01 * @Date 2021/10/26 14:01
*/ */
@Override @Override
public List<OptionResultDTO> getGridOption(String agencyId) { public List<OptionResultDTO> getGridOption(String agencyId, String purpose) {
//查询条件和查看居民详情:query;新增或修改居民信息:addorupdate
if ("query".equals(purpose) || StringUtils.isEmpty(purpose)) {
CustomerAgencyDTO customerAgencyDTO = customerAgencyService.get(agencyId);
String gridPids = "";
if (null != customerAgencyDTO) {
if (StringUtils.isEmpty(customerAgencyDTO.getPid()) || NumConstant.ZERO_STR.equals(customerAgencyDTO.getPid())) {
gridPids = agencyId;
} else {
gridPids = customerAgencyDTO.getPids().concat(StrConstant.COLON).concat(agencyId);
}
}
return baseDao.getGridOptionForQuery(gridPids);
}
LambdaQueryWrapper<CustomerGridEntity> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<CustomerGridEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(CustomerGridEntity::getPid, agencyId); wrapper.eq(CustomerGridEntity::getPid, agencyId);
wrapper.last("ORDER BY CONVERT ( GRID_NAME USING gbk ) ASC"); wrapper.last("ORDER BY CONVERT ( GRID_NAME USING gbk ) ASC");
@ -859,4 +872,5 @@ public class CustomerGridServiceImpl extends BaseServiceImpl<CustomerGridDao, Cu
return dto; return dto;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
} }
} }

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

@ -161,7 +161,9 @@ public class HouseServiceImpl implements HouseService {
}); });
//封装数据 //封装数据
List<IcHouseEntity> houseEntityList = new ArrayList<>(); List<IcHouseEntity> houseEntityList = new ArrayList<>();
for (IcHouseExcel icHouseExcel : list) { Iterator<IcHouseExcel> iterator1 = list.iterator();
while (iterator1.hasNext()) {
IcHouseExcel icHouseExcel = iterator1.next();
IcHouseEntity entity = new IcHouseEntity(); IcHouseEntity entity = new IcHouseEntity();
String uuid = UUID.randomUUID().toString().replace("-", ""); String uuid = UUID.randomUUID().toString().replace("-", "");
entity.setId(uuid); entity.setId(uuid);
@ -175,6 +177,7 @@ public class HouseServiceImpl implements HouseService {
if ("".equals(entity.getNeighborHoodId()) || "".equals(entity.getBuildingId()) || "".equals(entity.getBuildingUnitId())) { if ("".equals(entity.getNeighborHoodId()) || "".equals(entity.getBuildingId()) || "".equals(entity.getBuildingUnitId())) {
//str.append("".equals(str) ? icHouseExcel.getBuildingName() + icHouseExcel.getBuildingUnit() : str.append("、").append(icHouseExcel.getBuildingName() + icHouseExcel.getBuildingUnit())); //str.append("".equals(str) ? icHouseExcel.getBuildingName() + icHouseExcel.getBuildingUnit() : str.append("、").append(icHouseExcel.getBuildingName() + icHouseExcel.getBuildingUnit()));
numList.add(icHouseExcel.getRowNum()); numList.add(icHouseExcel.getRowNum());
iterator1.remove();
continue; continue;
} }
entity.setDoorName(icHouseExcel.getDoorName()); entity.setDoorName(icHouseExcel.getDoorName());
@ -187,7 +190,11 @@ public class HouseServiceImpl implements HouseService {
//同一楼栋,单元内,房屋名称唯一 //同一楼栋,单元内,房屋名称唯一
Integer count = icHouseDao.checkDoorNameUq(entity.getNeighborHoodId(), entity.getBuildingId(), entity.getBuildingUnitId(), entity.getDoorName(),null); Integer count = icHouseDao.checkDoorNameUq(entity.getNeighborHoodId(), entity.getBuildingId(), entity.getBuildingUnitId(), entity.getDoorName(),null);
if (null != count && count > 0) { if (null != count && count > 0) {
throw new RenException(EpmetErrorCode.DOOR_NAME_EXITED.getCode(), EpmetErrorCode.DOOR_NAME_EXITED.getMsg()); //throw new RenException(EpmetErrorCode.DOOR_NAME_EXITED.getCode(), EpmetErrorCode.DOOR_NAME_EXITED.getMsg());
log.error(EpmetErrorCode.DOOR_NAME_EXITED.getMsg());
numList.add(icHouseExcel.getRowNum());
iterator1.remove();
continue;
} }
houseEntityList.add(entity); houseEntityList.add(entity);
} }

17
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcNeighborHoodServiceImpl.java

@ -22,8 +22,10 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.dto.result.OptionResultDTO; import com.epmet.commons.tools.dto.result.OptionResultDTO;
import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.dao.IcNeighborHoodDao; import com.epmet.dao.IcNeighborHoodDao;
import com.epmet.dto.IcNeighborHoodDTO; import com.epmet.dto.IcNeighborHoodDTO;
@ -113,13 +115,18 @@ public class IcNeighborHoodServiceImpl extends BaseServiceImpl<IcNeighborHoodDao
* @Date 2021/10/26 14:32 * @Date 2021/10/26 14:32
*/ */
@Override @Override
public List<OptionResultDTO> getNeighborHoodOptions(String agencyId, String gridId) { public List<OptionResultDTO> getNeighborHoodOptions(String agencyId, String gridId,String staffId,String customerId) {
if (StringUtils.isBlank(agencyId)) { if (StringUtils.isBlank(agencyId)&&StringUtils.isEmpty(gridId)) {
log.error("组织ID为空"); log.info("agencyId与gridId都为空时,默认查询当前工作人员所属组织下的小区");
return Collections.emptyList(); CustomerStaffInfoCacheResult result= CustomerStaffRedis.getStaffInfo(customerId,staffId);
if (null == result || StringUtils.isBlank(result.getAgencyId())) {
log.error(String.format("staffId:%s,工作人员缓存信息查询异常"));
return Collections.emptyList();
}
agencyId=result.getAgencyId();
} }
LambdaQueryWrapper<IcNeighborHoodEntity> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<IcNeighborHoodEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(IcNeighborHoodEntity::getAgencyId, agencyId); wrapper.eq(StringUtils.isNotBlank(agencyId),IcNeighborHoodEntity::getAgencyId, agencyId);
wrapper.eq(StringUtils.isNotBlank(gridId), IcNeighborHoodEntity::getGridId, gridId); wrapper.eq(StringUtils.isNotBlank(gridId), IcNeighborHoodEntity::getGridId, gridId);
wrapper.last("ORDER BY CONVERT ( NEIGHBOR_HOOD_NAME USING gbk ) ASC"); wrapper.last("ORDER BY CONVERT ( NEIGHBOR_HOOD_NAME USING gbk ) ASC");
List<IcNeighborHoodEntity> list = baseDao.selectList(wrapper); List<IcNeighborHoodEntity> list = baseDao.selectList(wrapper);

12
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/NeighborHoodServiceImpl.java

@ -253,6 +253,7 @@ public class NeighborHoodServiceImpl implements NeighborHoodService {
if (!obj.getAgencyName().trim().equals(staffInfoCache.getAgencyName())) { if (!obj.getAgencyName().trim().equals(staffInfoCache.getAgencyName())) {
numList.add(obj.getRowNum()); numList.add(obj.getRowNum());
iterator.remove(); iterator.remove();
continue;
} }
//当前组织下网格名不存在的也不允许导入 //当前组织下网格名不存在的也不允许导入
AtomicBoolean br = new AtomicBoolean(true); AtomicBoolean br = new AtomicBoolean(true);
@ -293,11 +294,17 @@ public class NeighborHoodServiceImpl implements NeighborHoodService {
//封装数据 //封装数据
List<IcNeighborHoodEntity> neighborHoodEntityList = new ArrayList<>(); List<IcNeighborHoodEntity> neighborHoodEntityList = new ArrayList<>();
List<IcNeighborHoodPropertyEntity> icNeighborHoodPropertyEntityList = new ArrayList<>(); List<IcNeighborHoodPropertyEntity> icNeighborHoodPropertyEntityList = new ArrayList<>();
for (IcNeighborHoodExcel icNeighborHoodExcel : list) { Iterator<IcNeighborHoodExcel> iterator1 = list.iterator();
while (iterator1.hasNext()) {
IcNeighborHoodExcel icNeighborHoodExcel = iterator1.next();
//同一客户下,小区名称唯一 //同一客户下,小区名称唯一
Integer count = icNeighborHoodDao.checkNameUq(customerId,icNeighborHoodExcel.getNeighborHoodName(),null); Integer count = icNeighborHoodDao.checkNameUq(customerId,icNeighborHoodExcel.getNeighborHoodName(),null);
if (null != count && count > 0) { if (null != count && count > 0) {
throw new RenException(EpmetErrorCode.NEIGHBOOR_NAME_EXITED.getCode(), icNeighborHoodExcel.getNeighborHoodName()+EpmetErrorCode.NEIGHBOOR_NAME_EXITED.getMsg()); //throw new RenException(EpmetErrorCode.NEIGHBOOR_NAME_EXITED.getCode(), icNeighborHoodExcel.getNeighborHoodName()+EpmetErrorCode.NEIGHBOOR_NAME_EXITED.getMsg());
log.error(icNeighborHoodExcel.getNeighborHoodName()+EpmetErrorCode.NEIGHBOOR_NAME_EXITED.getMsg());
numList.add(icNeighborHoodExcel.getRowNum());
iterator1.remove();
continue;
} }
IcNeighborHoodEntity entity = new IcNeighborHoodEntity(); IcNeighborHoodEntity entity = new IcNeighborHoodEntity();
@ -313,6 +320,7 @@ public class NeighborHoodServiceImpl implements NeighborHoodService {
//网格名对应不上的数据舍弃 //网格名对应不上的数据舍弃
if ("".equals(entity.getGridId())) { if ("".equals(entity.getGridId())) {
numList.add(icNeighborHoodExcel.getRowNum()); numList.add(icNeighborHoodExcel.getRowNum());
iterator1.remove();
continue; continue;
} }
entity.setAddress(icNeighborHoodExcel.getAddress()); entity.setAddress(icNeighborHoodExcel.getAddress());

15
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml

@ -689,4 +689,19 @@
AND pid = #{pid} AND pid = #{pid}
</select> </select>
<select id="getGridOptionForQuery" parameterType="java.lang.String" resultType="com.epmet.commons.tools.dto.result.OptionResultDTO">
select
cg.id as value,
(
case when ca.ORGANIZATION_NAME is null or ca.ORGANIZATION_NAME='' then cg.GRID_NAME
else concat(ca.ORGANIZATION_NAME,'-',cg.GRID_NAME)
end
)as label
from customer_grid cg
left join customer_agency ca
on(cg.PID=ca.id and ca.DEL_FLAG='0')
where cg.DEL_FLAG='0'
and cg.PIDS like concat(#{gridPids},'%')
order by ca.CREATED_TIME asc,cg.CREATED_TIME asc
</select>
</mapper> </mapper>

14
epmet-module/open-data-worker/open-data-worker-client/src/main/java/com/epmet/opendata/dto/ExDeptDTO.java

@ -68,14 +68,24 @@ public class ExDeptDTO implements Serializable {
*/ */
private String gridCode; private String gridCode;
/**
* 组织类型
*/
private String isCgorg;
/** /**
* 区县平台部门id * 区县平台部门id
*/ */
private String deptIdQx; private String qxDeptId;
/**
* 区县平台部门/网格名称
*/
private String qxDeptCode;
/** /**
* 区县平台部门/网格名称 * 区县平台部门/网格名称
*/ */
private String deptNameQx; private String qxDeptName;
} }

16
epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/entity/ExDeptEntity.java

@ -65,18 +65,28 @@ public class ExDeptEntity {
private String deptCode; private String deptCode;
/** /**
* * 省标准区划编码/网格编码
*/ */
private String gridCode; private String gridCode;
/**
* 组织类型
*/
private String isCgorg;
/** /**
* 区县平台部门id * 区县平台部门id
*/ */
private String deptIdQx; private String qxDeptId;
/**
* 区县平台部门/网格名称
*/
private String qxDeptCode;
/** /**
* 区县平台部门/网格名称 * 区县平台部门/网格名称
*/ */
private String deptNameQx; private String qxDeptName;
} }

8
epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/BaseGridInfoServiceImpl.java

@ -90,8 +90,8 @@ public class BaseGridInfoServiceImpl extends BaseServiceImpl<BaseGridInfoDao, Ba
List<ExDeptEntity> ExList = new ArrayList<>(); List<ExDeptEntity> ExList = new ArrayList<>();
result.getData().forEach(ag->{ result.getData().forEach(ag->{
ExDeptEntity entity = new ExDeptEntity(); ExDeptEntity entity = new ExDeptEntity();
entity.setDeptIdQx(ag.getId()); entity.setQxDeptId(ag.getId());
entity.setDeptNameQx(ag.getOrganizationName()); entity.setQxDeptName(ag.getOrganizationName());
entity.setGridCode(ag.getCode()); entity.setGridCode(ag.getCode());
ExList.add(entity); ExList.add(entity);
}); });
@ -138,8 +138,8 @@ public class BaseGridInfoServiceImpl extends BaseServiceImpl<BaseGridInfoDao, Ba
List<ExDeptEntity> ExList = new ArrayList<>(); List<ExDeptEntity> ExList = new ArrayList<>();
result.getData().forEach(ag -> { result.getData().forEach(ag -> {
ExDeptEntity entity = new ExDeptEntity(); ExDeptEntity entity = new ExDeptEntity();
entity.setDeptIdQx(ag.getId()); entity.setQxDeptId(ag.getId());
entity.setDeptNameQx(ag.getGridName()); entity.setQxDeptName(ag.getGridName());
entity.setGridCode(ag.getCode()); entity.setGridCode(ag.getCode());
ExList.add(entity); ExList.add(entity);
}); });

2
epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/ExDeptServiceImpl.java

@ -104,7 +104,7 @@ public class ExDeptServiceImpl extends BaseServiceImpl<ExDeptDao, ExDeptEntity>
@Override @Override
public Map<String, Integer> getDeptMap() { public Map<String, Integer> getDeptMap() {
LambdaQueryWrapper<ExDeptEntity> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<ExDeptEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.ne(ExDeptEntity::getGridCode, null); wrapper.isNotNull(ExDeptEntity::getGridCode);
List<ExDeptEntity> entityList = baseDao.selectList(wrapper); List<ExDeptEntity> entityList = baseDao.selectList(wrapper);
if (CollectionUtils.isEmpty(entityList)) { if (CollectionUtils.isEmpty(entityList)) {
return Collections.emptyMap(); return Collections.emptyMap();

5
epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/IcResiCategoryStatsConfigFormDTO.java

@ -53,13 +53,13 @@ public class IcResiCategoryStatsConfigFormDTO implements Serializable {
/** /**
* 数据平台分类图标 * 数据平台分类图标
*/ */
@NotBlank(message = "管理平台分类图标不能为空",groups = {UpdateGroup.class}) @NotBlank(message = "数据平台分类图标不能为空",groups = {UpdateGroup.class})
private String dataIcon; private String dataIcon;
/** /**
* 房屋显示分类图标 * 房屋显示分类图标
*/ */
@NotBlank(message = "管理平台分类图标不能为空",groups = {UpdateGroup.class}) @NotBlank(message = "房屋显示分类图标不能为空",groups = {UpdateGroup.class})
private String houseShowIcon; private String houseShowIcon;
/** /**
@ -72,7 +72,6 @@ public class IcResiCategoryStatsConfigFormDTO implements Serializable {
private String warn; private String warn;
private Integer level1; private Integer level1;
private Integer level2; private Integer level2;
private Integer level3; private Integer level3;

26
epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/ResiCategoryStatsConfigController.java

@ -29,6 +29,7 @@ import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.AddGroup; import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup; import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.constant.IcResiCategoryStatsConfigConstant;
import com.epmet.dao.IcResiCategoryStatsConfigDao; import com.epmet.dao.IcResiCategoryStatsConfigDao;
import com.epmet.dao.IcResiCategoryWarnConfigDao; import com.epmet.dao.IcResiCategoryWarnConfigDao;
import com.epmet.dto.IcResiCategoryStatsConfigDTO; import com.epmet.dto.IcResiCategoryStatsConfigDTO;
@ -89,8 +90,23 @@ public class ResiCategoryStatsConfigController {
ValidatorUtils.validateEntity(formDTO, UpdateGroup.class); ValidatorUtils.validateEntity(formDTO, UpdateGroup.class);
String customerId = tokenDTO.getCustomerId(); String customerId = tokenDTO.getCustomerId();
// String customerId = "123123"; // String customerId = "123123";
Integer level1 = formDTO.getLevel1();
Integer level2 = formDTO.getLevel2();
Integer level3 = formDTO.getLevel3();
if(IcResiCategoryStatsConfigConstant.WARN_YES.equals(formDTO.getWarn())){
//判断level1 和level2 的值
if(null ==level1 || level1==0){
return new Result().error(8001,"等级1阈值需大于0");
}
if(null == level2 || level2==0){
return new Result().error(8001,"等级2阈值需大于0");
}
if(level1<=level2){
return new Result().error(8001,"等级1阈值需大于等级2阈值");
}
}
resiCategoryStatsConfigService.update(customerId,formDTO); resiCategoryStatsConfigService.update(customerId,formDTO);
return new Result(); return new Result().ok("修改成功");
} }
@PostMapping("updatestatus") @PostMapping("updatestatus")
public Result updateStatus(@LoginUser TokenDto tokenDTO,@RequestBody IcResiCategoryStatsConfigFormDTO formDTO){ public Result updateStatus(@LoginUser TokenDto tokenDTO,@RequestBody IcResiCategoryStatsConfigFormDTO formDTO){
@ -98,7 +114,7 @@ public class ResiCategoryStatsConfigController {
String customerId = tokenDTO.getCustomerId(); String customerId = tokenDTO.getCustomerId();
// String customerId = "123123"; // String customerId = "123123";
resiCategoryStatsConfigService.updateStatus(customerId,formDTO); resiCategoryStatsConfigService.updateStatus(customerId,formDTO);
return new Result(); return new Result().ok("修改成功");
} }
@PostMapping("updatesort") @PostMapping("updatesort")
public Result updateSort(@LoginUser TokenDto tokenDTO,@RequestBody List<IcResiCategoryStatsConfigSortFormDTO> formDTOs){ public Result updateSort(@LoginUser TokenDto tokenDTO,@RequestBody List<IcResiCategoryStatsConfigSortFormDTO> formDTOs){
@ -118,10 +134,11 @@ public class ResiCategoryStatsConfigController {
} }
@PostMapping("resicategorystatslistshowd") @PostMapping("resicategorystatslistshowd")
public Result<List<IcResiCategoryStatsConfigDTO>> resiCategoryStatsListShowd(){ public Result<List<IcResiCategoryStatsConfigDTO>> resiCategoryStatsListShowd(@LoginUser TokenDto tokenDTO){
//获取预警配置列表 //获取预警配置列表
List<IcResiCategoryStatsConfigEntity> statsConfigEntityList = icResiCategoryStatsConfigDao.selectList(new QueryWrapper<IcResiCategoryStatsConfigEntity>() List<IcResiCategoryStatsConfigEntity> statsConfigEntityList = icResiCategoryStatsConfigDao.selectList(new QueryWrapper<IcResiCategoryStatsConfigEntity>()
.lambda() .lambda()
.eq(IcResiCategoryStatsConfigEntity::getCustomerId,tokenDTO.getCustomerId())
.eq(IcResiCategoryStatsConfigEntity::getStatus,"show") .eq(IcResiCategoryStatsConfigEntity::getStatus,"show")
.orderByAsc(IcResiCategoryStatsConfigEntity::getSort)); .orderByAsc(IcResiCategoryStatsConfigEntity::getSort));
@ -129,10 +146,11 @@ public class ResiCategoryStatsConfigController {
} }
@PostMapping("resicategorywarnlist") @PostMapping("resicategorywarnlist")
public Result<List<IcResiCategoryWarnConfigDTO>> resiCategoryWarnList(){ public Result<List<IcResiCategoryWarnConfigDTO>> resiCategoryWarnList(@LoginUser TokenDto tokenDTO){
//获取预警配置列表 //获取预警配置列表
List<IcResiCategoryWarnConfigEntity> warnConfigEntityList = icResiCategoryWarnConfigDao.selectList(new QueryWrapper<IcResiCategoryWarnConfigEntity>() List<IcResiCategoryWarnConfigEntity> warnConfigEntityList = icResiCategoryWarnConfigDao.selectList(new QueryWrapper<IcResiCategoryWarnConfigEntity>()
.lambda() .lambda()
.eq(IcResiCategoryWarnConfigEntity::getCustomerId,tokenDTO.getCustomerId())
.orderByAsc(IcResiCategoryWarnConfigEntity::getSort)); .orderByAsc(IcResiCategoryWarnConfigEntity::getSort));
return new Result<List<IcResiCategoryWarnConfigDTO>>().ok(ConvertUtils.sourceToTarget(warnConfigEntityList, IcResiCategoryWarnConfigDTO.class)); return new Result<List<IcResiCategoryWarnConfigDTO>>().ok(ConvertUtils.sourceToTarget(warnConfigEntityList, IcResiCategoryWarnConfigDTO.class));

26
epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/ResiCategoryStatsConfigServiceImpl.java

@ -49,14 +49,14 @@ public class ResiCategoryStatsConfigServiceImpl implements ResiCategoryStatsConf
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public List<IcResiCategoryStatsConfigResultDTO> list(String customerId) { public List<IcResiCategoryStatsConfigResultDTO> list(String customerId) {
//1.获取IC_FORM_ITEM 中 用于数据分析字段的 id 和label //1.获取IC_FORM_ITEM 中 用于数据分析字段的 id 和label
List<IcFormItemEntity> icFormItemEntityList = icFormItemDao.selectList(new QueryWrapper<IcFormItemEntity>().lambda().eq(IcFormItemEntity::getDataAnalyse, 1)); List<IcFormItemEntity> icFormItemEntityList = icFormItemDao.selectList(new QueryWrapper<IcFormItemEntity>().lambda().eq(IcFormItemEntity::getCustomerId,customerId).eq(IcFormItemEntity::getDataAnalyse, 1));
if(CollectionUtils.isEmpty(icFormItemEntityList)){ if(CollectionUtils.isEmpty(icFormItemEntityList)){
return new ArrayList<>(); return new ArrayList<>();
} }
Set<String> groupIds = icFormItemEntityList.stream().filter(item-> !"0".equals(item.getItemGroupId())).map(item->item.getItemGroupId()).collect(Collectors.toSet()); Set<String> groupIds = icFormItemEntityList.stream().filter(item-> !"0".equals(item.getItemGroupId())).map(item->item.getItemGroupId()).collect(Collectors.toSet());
List<IcFormItemGroupEntity> icFormItemGroupEntityList = new ArrayList<>(); List<IcFormItemGroupEntity> icFormItemGroupEntityList = new ArrayList<>();
if(!CollectionUtils.isEmpty(groupIds)){ if(!CollectionUtils.isEmpty(groupIds)){
icFormItemGroupEntityList.addAll(icFormItemGroupDao.selectList(new QueryWrapper<IcFormItemGroupEntity>().lambda().in(IcFormItemGroupEntity::getId, groupIds))); icFormItemGroupEntityList.addAll(icFormItemGroupDao.selectList(new QueryWrapper<IcFormItemGroupEntity>().lambda().eq(IcFormItemGroupEntity::getCustomerId,customerId).in(IcFormItemGroupEntity::getId, groupIds)));
} }
//获取tableName和COLUMN_NAME //获取tableName和COLUMN_NAME
Map<String,IcFormItemEntity> tableColumnMap = new HashMap<>(); Map<String,IcFormItemEntity> tableColumnMap = new HashMap<>();
@ -75,8 +75,8 @@ public class ResiCategoryStatsConfigServiceImpl implements ResiCategoryStatsConf
}); });
//2.获取ic_resi_category_stats_config 和 ic_resi_category_warn_config 表中的数据 //2.获取ic_resi_category_stats_config 和 ic_resi_category_warn_config 表中的数据
List<IcResiCategoryStatsConfigEntity> statsConfigEntityList = icResiCategoryStatsConfigDao.selectList(null); List<IcResiCategoryStatsConfigEntity> statsConfigEntityList = icResiCategoryStatsConfigDao.selectList(new QueryWrapper<IcResiCategoryStatsConfigEntity>().lambda().eq(IcResiCategoryStatsConfigEntity::getCustomerId,customerId));
List<IcResiCategoryWarnConfigEntity> warnConfigEntityList = icResiCategoryWarnConfigDao.selectList(null); List<IcResiCategoryWarnConfigEntity> warnConfigEntityList = icResiCategoryWarnConfigDao.selectList(new QueryWrapper<IcResiCategoryWarnConfigEntity>().lambda().eq(IcResiCategoryWarnConfigEntity::getCustomerId,customerId));
//3.新增不存在的,删除不在tableColumnMap的 //3.新增不存在的,删除不在tableColumnMap的
Map<String,IcResiCategoryStatsConfigEntity> statsTableColumnMap = new HashMap<>(); Map<String,IcResiCategoryStatsConfigEntity> statsTableColumnMap = new HashMap<>();
@ -103,7 +103,7 @@ public class ResiCategoryStatsConfigServiceImpl implements ResiCategoryStatsConf
entity.setDataIcon(""); entity.setDataIcon("");
entity.setHouseShowIcon(""); entity.setHouseShowIcon("");
entity.setStatus("show"); entity.setStatus("show");
entity.setSort(0); entity.setSort(icFormItemEntity.getSort());
newStatsEntityList.add(entity); newStatsEntityList.add(entity);
}); });
if(!CollectionUtils.isEmpty(newStatsEntityList)){ if(!CollectionUtils.isEmpty(newStatsEntityList)){
@ -129,8 +129,11 @@ public class ResiCategoryStatsConfigServiceImpl implements ResiCategoryStatsConf
} }
//4.返回数据 //4.返回数据
List<IcResiCategoryStatsConfigEntity> statsConfigList = icResiCategoryStatsConfigDao.selectList(new QueryWrapper<IcResiCategoryStatsConfigEntity>().lambda().orderByAsc(IcResiCategoryStatsConfigEntity::getSort)); List<IcResiCategoryStatsConfigEntity> statsConfigList = icResiCategoryStatsConfigDao.selectList(new QueryWrapper<IcResiCategoryStatsConfigEntity>().lambda()
List<IcResiCategoryWarnConfigEntity> warnConfigList = icResiCategoryWarnConfigDao.selectList(null); .eq(IcResiCategoryStatsConfigEntity::getCustomerId,customerId)
.orderByAsc(IcResiCategoryStatsConfigEntity::getSort));
List<IcResiCategoryWarnConfigEntity> warnConfigList = icResiCategoryWarnConfigDao.selectList(new QueryWrapper<IcResiCategoryWarnConfigEntity>().lambda()
.eq(IcResiCategoryWarnConfigEntity::getCustomerId,customerId));
Map<String,IcResiCategoryWarnConfigEntity> warnMap =new HashMap<>(); Map<String,IcResiCategoryWarnConfigEntity> warnMap =new HashMap<>();
warnConfigList.forEach(item->{ warnConfigList.forEach(item->{
warnMap.put(item.getTableName()+"-"+item.getColumnName(),item); warnMap.put(item.getTableName()+"-"+item.getColumnName(),item);
@ -169,6 +172,7 @@ public class ResiCategoryStatsConfigServiceImpl implements ResiCategoryStatsConf
return result; return result;
} }
IcResiCategoryWarnConfigEntity icResiCategoryWarnConfigEntity = icResiCategoryWarnConfigDao.selectOne(new QueryWrapper<IcResiCategoryWarnConfigEntity>().lambda() IcResiCategoryWarnConfigEntity icResiCategoryWarnConfigEntity = icResiCategoryWarnConfigDao.selectOne(new QueryWrapper<IcResiCategoryWarnConfigEntity>().lambda()
.eq(IcResiCategoryWarnConfigEntity::getCustomerId, icResiCategoryStatsConfigDTO.getCustomerId())
.eq(IcResiCategoryWarnConfigEntity::getTableName, icResiCategoryStatsConfigDTO.getTableName()) .eq(IcResiCategoryWarnConfigEntity::getTableName, icResiCategoryStatsConfigDTO.getTableName())
.eq(IcResiCategoryWarnConfigEntity::getColumnName, icResiCategoryStatsConfigDTO.getColumnName())); .eq(IcResiCategoryWarnConfigEntity::getColumnName, icResiCategoryStatsConfigDTO.getColumnName()));
@ -205,10 +209,9 @@ public class ResiCategoryStatsConfigServiceImpl implements ResiCategoryStatsConf
//更新配置预警 //更新配置预警
if(IcResiCategoryStatsConfigConstant.WARN_YES.equals(formDTO.getWarn())){ if(IcResiCategoryStatsConfigConstant.WARN_YES.equals(formDTO.getWarn())){
//TODO 判断阈值范围
//更新 //更新
IcResiCategoryWarnConfigEntity icResiCategoryWarnConfigEntity = icResiCategoryWarnConfigDao.selectOne(new QueryWrapper<IcResiCategoryWarnConfigEntity>().lambda() IcResiCategoryWarnConfigEntity icResiCategoryWarnConfigEntity = icResiCategoryWarnConfigDao.selectOne(new QueryWrapper<IcResiCategoryWarnConfigEntity>().lambda()
.eq(IcResiCategoryWarnConfigEntity::getCustomerId,customerId)
.eq(IcResiCategoryWarnConfigEntity::getTableName, icResiCategoryStatsConfigDTO.getTableName()) .eq(IcResiCategoryWarnConfigEntity::getTableName, icResiCategoryStatsConfigDTO.getTableName())
.eq(IcResiCategoryWarnConfigEntity::getColumnName, icResiCategoryStatsConfigDTO.getColumnName())); .eq(IcResiCategoryWarnConfigEntity::getColumnName, icResiCategoryStatsConfigDTO.getColumnName()));
if(null == icResiCategoryWarnConfigEntity){ if(null == icResiCategoryWarnConfigEntity){
@ -236,6 +239,7 @@ public class ResiCategoryStatsConfigServiceImpl implements ResiCategoryStatsConf
}else if(IcResiCategoryStatsConfigConstant.WARN_NO.equals(formDTO.getWarn())){ }else if(IcResiCategoryStatsConfigConstant.WARN_NO.equals(formDTO.getWarn())){
//删除 //删除
icResiCategoryWarnConfigDao.delete(new QueryWrapper<IcResiCategoryWarnConfigEntity>().lambda() icResiCategoryWarnConfigDao.delete(new QueryWrapper<IcResiCategoryWarnConfigEntity>().lambda()
.eq(IcResiCategoryWarnConfigEntity::getCustomerId,customerId)
.eq(IcResiCategoryWarnConfigEntity::getTableName,icResiCategoryStatsConfigDTO.getTableName()) .eq(IcResiCategoryWarnConfigEntity::getTableName,icResiCategoryStatsConfigDTO.getTableName())
.eq(IcResiCategoryWarnConfigEntity::getColumnName,icResiCategoryStatsConfigDTO.getColumnName())); .eq(IcResiCategoryWarnConfigEntity::getColumnName,icResiCategoryStatsConfigDTO.getColumnName()));
} }
@ -269,8 +273,8 @@ public class ResiCategoryStatsConfigServiceImpl implements ResiCategoryStatsConf
} }
icResiCategoryStatsConfigService.updateBatchById(entityList); icResiCategoryStatsConfigService.updateBatchById(entityList);
//排序更新预警的 //排序更新预警的
List<IcResiCategoryStatsConfigEntity> statsConfigEntityList = icResiCategoryStatsConfigDao.selectList(null); List<IcResiCategoryStatsConfigEntity> statsConfigEntityList = icResiCategoryStatsConfigDao.selectList(new QueryWrapper<IcResiCategoryStatsConfigEntity>().lambda().eq(IcResiCategoryStatsConfigEntity::getCustomerId,customerId));
List<IcResiCategoryWarnConfigEntity> warnConfigEntityList = icResiCategoryWarnConfigDao.selectList(null); List<IcResiCategoryWarnConfigEntity> warnConfigEntityList = icResiCategoryWarnConfigDao.selectList(new QueryWrapper<IcResiCategoryWarnConfigEntity>().lambda().eq(IcResiCategoryWarnConfigEntity::getCustomerId,customerId));
if(CollectionUtils.isEmpty(warnConfigEntityList)){ if(CollectionUtils.isEmpty(warnConfigEntityList)){
return ; return ;
} }

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

@ -181,6 +181,7 @@ public class IcResiUserController {
*/ */
@RequestMapping(value = "/exportExcel2") @RequestMapping(value = "/exportExcel2")
public void exportExcel(@RequestHeader String customerId,@LoginUser TokenDto tokenDto, @RequestBody IcResiUserPageFormDTO pageFormDTO, HttpServletResponse response) throws Exception { public void exportExcel(@RequestHeader String customerId,@LoginUser TokenDto tokenDto, @RequestBody IcResiUserPageFormDTO pageFormDTO, HttpServletResponse response) throws Exception {
//tokenDto.setUserId("9e37adcce6472152e6508a19d3683e02");
CustomerStaffInfoCacheResult staffInfoCacheResult = CustomerStaffRedis.getStaffInfo(customerId, tokenDto.getUserId()); CustomerStaffInfoCacheResult staffInfoCacheResult = CustomerStaffRedis.getStaffInfo(customerId, tokenDto.getUserId());
String staffOrgPath = null; String staffOrgPath = null;
if (StringUtils.isNotBlank(staffInfoCacheResult.getAgencyPIds()) && !NumConstant.ZERO_STR.equals(staffInfoCacheResult.getAgencyPIds())) { if (StringUtils.isNotBlank(staffInfoCacheResult.getAgencyPIds()) && !NumConstant.ZERO_STR.equals(staffInfoCacheResult.getAgencyPIds())) {
@ -194,7 +195,7 @@ public class IcResiUserController {
Map<String, Map<String, FormItemResult>> otherSheetItems = buildItemMap(resiFormItems); Map<String, Map<String, FormItemResult>> otherSheetItems = buildItemMap(resiFormItems);
Map<String, Map<String, Object>> resiMainList = icResiUserService.getDataForExport(otherSheetItems.get(BASE_TABLE_NAME),new HashMap<>(), pageFormDTO.getCustomerId(), pageFormDTO.getFormCode(), BASE_TABLE_NAME, pageFormDTO.getConditions(),staffInfoCacheResult.getAgencyId(),staffOrgPath); Map<String, Map<String, Object>> resiMainList = icResiUserService.getDataForExport(otherSheetItems.get(BASE_TABLE_NAME),new HashMap<>(),BASE_TABLE_NAME, pageFormDTO,staffInfoCacheResult.getAgencyId(),staffOrgPath);
//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\"}]"); //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)); log.info("resiMainList:{}", JSON.toJSONString(resiMainList));
String templatePath = "excel/ic_resi_info_cid.xls"; String templatePath = "excel/ic_resi_info_cid.xls";
@ -211,7 +212,7 @@ public class IcResiUserController {
if (item.getChildGroup() != null) { if (item.getChildGroup() != null) {
if (!item.getChildGroup().getTableName().equals(BASE_TABLE_NAME)) { if (!item.getChildGroup().getTableName().equals(BASE_TABLE_NAME)) {
Map<String, FormItemResult> itemMap1 = otherSheetItems.get(item.getChildGroup().getTableName()); Map<String, FormItemResult> itemMap1 = otherSheetItems.get(item.getChildGroup().getTableName());
Map<String, Map<String, Object>> resiChildMap = icResiUserService.getDataForExport(itemMap1,resiMainList, pageFormDTO.getCustomerId(), pageFormDTO.getFormCode(), item.getChildGroup().getTableName(), pageFormDTO.getConditions(),staffInfoCacheResult.getAgencyId(),staffOrgPath); Map<String, Map<String, Object>> resiChildMap = icResiUserService.getDataForExport(itemMap1,resiMainList, item.getChildGroup().getTableName(),pageFormDTO,staffInfoCacheResult.getAgencyId(),staffOrgPath);
//resiChildMap.forEach((key, value) -> value.putAll(resiMainList.get(key))); //resiChildMap.forEach((key, value) -> value.putAll(resiMainList.get(key)));
Map<String, Object> mapData2 = new HashMap<>(); Map<String, Object> mapData2 = new HashMap<>();
@ -246,7 +247,7 @@ public class IcResiUserController {
resiFormAllItems.stream().collect(Collectors.groupingBy(e ->e.get));*/ resiFormAllItems.stream().collect(Collectors.groupingBy(e ->e.get));*/
Map<String, Map<String, Object>> resiMainList = icResiUserService.getDataForExport(otherSheetItems.get(BASE_TABLE_NAME),new HashMap<>(), pageFormDTO.getCustomerId(), pageFormDTO.getFormCode(), BASE_TABLE_NAME, pageFormDTO.getConditions(),staffInfoCacheResult.getAgencyId(),staffOrgPath); Map<String, Map<String, Object>> resiMainList = icResiUserService.getDataForExport(otherSheetItems.get(BASE_TABLE_NAME),new HashMap<>(), BASE_TABLE_NAME, pageFormDTO,staffInfoCacheResult.getAgencyId(),staffOrgPath);
//========================================= //=========================================
String templatePath = "excel/ic_resi_info_cid_for_easy_excel.xlsx"; String templatePath = "excel/ic_resi_info_cid_for_easy_excel.xlsx";
@ -266,7 +267,7 @@ public class IcResiUserController {
if (item.getChildGroup() != null) { if (item.getChildGroup() != null) {
if (!item.getChildGroup().getTableName().equals(BASE_TABLE_NAME)) { if (!item.getChildGroup().getTableName().equals(BASE_TABLE_NAME)) {
Map<String, FormItemResult> itemMap1 = otherSheetItems.get(item.getChildGroup().getTableName()); Map<String, FormItemResult> itemMap1 = otherSheetItems.get(item.getChildGroup().getTableName());
Map<String, Map<String, Object>> resiChildMap = icResiUserService.getDataForExport(itemMap1,resiMainList, pageFormDTO.getCustomerId(), pageFormDTO.getFormCode(), item.getChildGroup().getTableName(), pageFormDTO.getConditions(),staffInfoCacheResult.getAgencyId(),staffOrgPath); Map<String, Map<String, Object>> resiChildMap = icResiUserService.getDataForExport(itemMap1,resiMainList,item.getChildGroup().getTableName() , pageFormDTO, staffInfoCacheResult.getAgencyId(),staffOrgPath);
//resiChildMap.forEach((key, value) -> value.putAll(resiMainList.get(key))); //resiChildMap.forEach((key, value) -> value.putAll(resiMainList.get(key)));
int sheetNo = n.incrementAndGet(); int sheetNo = n.incrementAndGet();
@ -409,9 +410,9 @@ public class IcResiUserController {
* @date 2021/11/3 1:42 下午 * @date 2021/11/3 1:42 下午
*/ */
@PostMapping("searchbyname") @PostMapping("searchbyname")
public Result<List<SearchByNameResultDTO>> searchByName(@RequestBody SearchByNameFormDTO formDTO, @LoginUser TokenDto tokenDto) { public Result<PageData<SearchByNameResultDTO>> searchByName(@RequestBody SearchByNameFormDTO formDTO, @LoginUser TokenDto tokenDto) {
ValidatorUtils.validateEntity(formDTO, SearchByNameFormDTO.SearchByNameForm.class); ValidatorUtils.validateEntity(formDTO, SearchByNameFormDTO.SearchByNameForm.class);
return new Result<List<SearchByNameResultDTO>>().ok(icResiUserService.searchByName(formDTO, tokenDto)); return new Result<PageData<SearchByNameResultDTO>>().ok(icResiUserService.searchByName(formDTO, tokenDto));
} }
@NotNull @NotNull

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

@ -57,29 +57,32 @@ public class StatsResiWarnController {
private StatsResiWarnService statsResiWarnService; private StatsResiWarnService statsResiWarnService;
@PostMapping("list") @PostMapping("list")
public Result list(@RequestBody StatsResiListFormDTO formDTO){ public Result list(@LoginUser TokenDto tokenDto,@RequestBody StatsResiListFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO); ValidatorUtils.validateEntity(formDTO);
List<IcStatsResiResultDTO> icStatsResiResultDTOList = statsResiWarnService.list(formDTO.getId(),formDTO.getLevel()); String customerId = tokenDto.getCustomerId();
List<IcStatsResiResultDTO> icStatsResiResultDTOList = statsResiWarnService.list(customerId,formDTO.getId(),formDTO.getLevel());
return new Result().ok(icStatsResiResultDTOList); return new Result().ok(icStatsResiResultDTOList);
} }
@PostMapping("buildingwarnlist") @PostMapping("buildingwarnlist")
public Result buildingWarnList(@RequestBody StatsResiWarnFormDTO formDTO){ public Result buildingWarnList(@LoginUser TokenDto tokenDto,@RequestBody StatsResiWarnFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO, StatsResiWarnFormDTO.ListSelectedBuilding.class); ValidatorUtils.validateEntity(formDTO, StatsResiWarnFormDTO.ListSelectedBuilding.class);
String customerId = tokenDto.getCustomerId();
String agencyID = formDTO.getAgencyId(); String agencyID = formDTO.getAgencyId();
List<IcStatsResiWarnBuildingResultDTO> icStatsResiWarnBuildingResultDTOS = statsResiWarnService.buildingwWarnList(agencyID); List<IcStatsResiWarnBuildingResultDTO> icStatsResiWarnBuildingResultDTOS = statsResiWarnService.buildingwWarnList(customerId,agencyID);
return new Result().ok(icStatsResiWarnBuildingResultDTOS); return new Result().ok(icStatsResiWarnBuildingResultDTOS);
} }
@PostMapping("userwarnlist") @PostMapping("userwarnlist")
public Result userWarnList(@RequestBody StatsResiWarnFormDTO formDTO){ public Result userWarnList(@LoginUser TokenDto tokenDto,@RequestBody StatsResiWarnFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO, StatsResiWarnFormDTO.ListSelectedUser.class); ValidatorUtils.validateEntity(formDTO, StatsResiWarnFormDTO.ListSelectedUser.class);
String customerId = tokenDto.getCustomerId();
List<String> buildingIdList = formDTO.getBuildingIdList(); List<String> buildingIdList = formDTO.getBuildingIdList();
if(CollectionUtils.isEmpty(buildingIdList)){ if(CollectionUtils.isEmpty(buildingIdList)){
return new Result(); return new Result();
} }
List<IcStatsResiWarnUserResultDTO> icStatsResiWarnUserResultDTOS = statsResiWarnService.userWarnList(formDTO.getConfigId(), formDTO.getBuildingIdList()); List<IcStatsResiWarnUserResultDTO> icStatsResiWarnUserResultDTOS = statsResiWarnService.userWarnList(customerId,formDTO.getConfigId(), formDTO.getBuildingIdList());
return new Result().ok(icStatsResiWarnUserResultDTOS); return new Result().ok(icStatsResiWarnUserResultDTOS);
} }

18
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcStatsResiWarnDao.java

@ -35,17 +35,27 @@ import java.util.Map;
@Mapper @Mapper
public interface IcStatsResiWarnDao extends BaseDao<IcStatsResiWarnEntity> { public interface IcStatsResiWarnDao extends BaseDao<IcStatsResiWarnEntity> {
List<IcStatsResiWarnEntity> selectResiWarnByAgencyId(@Param("agencyId") String agencyId); List<IcStatsResiWarnEntity> selectResiWarnByAgencyId(@Param("customerId") String customerId,@Param("agencyId") String agencyId);
List<Map<String,String>> userWarnList(@Param("buildingIdList") List<String> buildingIdList, @Param("tableName") String tableName, @Param("columnName") String columnName); List<Map<String,String>> userWarnList(@Param("customerId") String customerId,
@Param("buildingIdList") List<String> buildingIdList,
@Param("tableName") String tableName,
@Param("columnName") String columnName);
Integer countListByLevelAndCol( Integer countListByLevelAndCol(
@Param("customerId") String customerId,
@Param("tableName") String tableName, @Param("tableName") String tableName,
@Param("columnName") String columnName, @Param("columnName") String columnName,
@Param("id")String id, @Param("id")String id,
@Param("level")String level); @Param("level")String level);
List<IcStatsResiWarnEntity> resiWarn(@Param("tableName") String tableName,@Param("columnName") String columnName); List<IcStatsResiWarnEntity> resiWarn(@Param("customerId") String customerId,
IcStatsResiWarnEntity resiWarnById(@Param("tableName") String tableName,@Param("columnName") String columnName,@Param("icStatsResiWarn") IcStatsResiWarnEntity icStatsResiWarn); @Param("tableName") String tableName,
@Param("columnName") String columnName);
IcStatsResiWarnEntity resiWarnById(@Param("customerId") String customerId,
@Param("tableName") String tableName,
@Param("columnName") String columnName,
@Param("icStatsResiWarn") IcStatsResiWarnEntity icStatsResiWarn);
} }

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

@ -99,7 +99,7 @@ public interface IcResiUserService extends BaseService<IcResiUserEntity> {
* @author zxc * @author zxc
* @date 2021/11/3 1:42 下午 * @date 2021/11/3 1:42 下午
*/ */
List<SearchByNameResultDTO> searchByName(SearchByNameFormDTO formDTO,TokenDto tokenDto); PageData<SearchByNameResultDTO> searchByName(SearchByNameFormDTO formDTO, TokenDto tokenDto);
/** /**
@ -107,13 +107,10 @@ public interface IcResiUserService extends BaseService<IcResiUserEntity> {
* *
* @param itemList * @param itemList
* @param resiMainList * @param resiMainList
* @param customerId
* @param formCode
* @param baseTableName * @param baseTableName
* @param conditions
* @return * @return
*/ */
Map<String, Map<String, Object>> getDataForExport(Map<String, FormItemResult> itemList, Map<String, Map<String, Object>> resiMainList, String customerId, String formCode, String baseTableName, List<ResiUserQueryValueDTO> conditions,String currentStaffAgencyId, Map<String, Map<String, Object>> getDataForExport(Map<String, FormItemResult> itemList, Map<String, Map<String, Object>> resiMainList, String baseTableName, IcResiUserPageFormDTO pageFormDTO, String currentStaffAgencyId,
String staffOrgPath); String staffOrgPath);
/** /**

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

@ -31,11 +31,11 @@ import java.util.List;
*/ */
public interface StatsResiWarnService{ public interface StatsResiWarnService{
List<IcStatsResiWarnBuildingResultDTO> buildingwWarnList(String agencyID); List<IcStatsResiWarnBuildingResultDTO> buildingwWarnList(String customerId,String agencyID);
List<IcStatsResiWarnUserResultDTO> userWarnList(String configId, List<String> buildingIdList); List<IcStatsResiWarnUserResultDTO> userWarnList(String customerId,String configId, List<String> buildingIdList);
List<IcStatsResiResultDTO> list(String id, String level); List<IcStatsResiResultDTO> list(String customerId,String id, String level);
void resiWarn(String customerId); void resiWarn(String customerId);

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

@ -570,7 +570,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
* @date 2021/11/3 1:42 下午 * @date 2021/11/3 1:42 下午
*/ */
@Override @Override
public List<SearchByNameResultDTO> searchByName(SearchByNameFormDTO formDTO, TokenDto tokenDto) { public PageData<SearchByNameResultDTO> searchByName(SearchByNameFormDTO formDTO, TokenDto tokenDto) {
// 查询工作人员所属组织 // 查询工作人员所属组织
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(tokenDto.getCustomerId(), tokenDto.getUserId()); CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(tokenDto.getCustomerId(), tokenDto.getUserId());
if (null == staffInfo){ if (null == staffInfo){
@ -580,7 +580,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
PageInfo<SearchByNameResultDTO> pageInfo = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()).doSelectPageInfo(() -> baseDao.searchByName(formDTO.getName(), staffInfo.getAgencyId(), no)); PageInfo<SearchByNameResultDTO> pageInfo = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()).doSelectPageInfo(() -> baseDao.searchByName(formDTO.getName(), staffInfo.getAgencyId(), no));
List<SearchByNameResultDTO> result = pageInfo.getList(); List<SearchByNameResultDTO> result = pageInfo.getList();
if (CollectionUtils.isEmpty(result)){ if (CollectionUtils.isEmpty(result)){
return new ArrayList<>(); return new PageData<>(new ArrayList<>(), pageInfo.getTotal());
} }
// 查询小区,楼号,网格 // 查询小区,楼号,网格
Result<List<AllGridsByUserIdResultDTO>> gridResult = govOrgOpenFeignClient.getGridListByGridIds(result.stream().map(SearchByNameResultDTO::getGridId).collect(Collectors.toList())); Result<List<AllGridsByUserIdResultDTO>> gridResult = govOrgOpenFeignClient.getGridListByGridIds(result.stream().map(SearchByNameResultDTO::getGridId).collect(Collectors.toList()));
@ -605,7 +605,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
item.setBuildNum(buildMap.get(item.getBuildId())); item.setBuildNum(buildMap.get(item.getBuildId()));
}); });
return result; return new PageData<>(result, pageInfo.getTotal());
} }
/** /**
@ -614,19 +614,17 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
* *
* @param formItemMap key 表名 value formItem * @param formItemMap key 表名 value formItem
* @param resiMainList * @param resiMainList
* @param customerId
* @param formCode
* @param baseTableName * @param baseTableName
* @param conditions
* @return * @return
*/ */
@Override @Override
public Map<String, Map<String, Object>> getDataForExport(Map<String, FormItemResult> formItemMap, Map<String, Map<String, Object>> resiMainList, String customerId, String formCode, String baseTableName, List<ResiUserQueryValueDTO> conditions, public Map<String, Map<String, Object>> getDataForExport(Map<String, FormItemResult> formItemMap, Map<String, Map<String, Object>> resiMainList, String baseTableName,IcResiUserPageFormDTO pageFormDTO,
String currentStaffAgencyId, String currentStaffAgencyId,
String staffOrgPath) { String staffOrgPath) {
List<Map<String, Object>> mapList = this.dynamicQuery(customerId, formCode, baseTableName, conditions,currentStaffAgencyId,staffOrgPath); List<Map<String, Object>> mapList = this.dynamicQuery(pageFormDTO.getCustomerId(), pageFormDTO.getFormCode(), baseTableName, pageFormDTO.getConditions(),currentStaffAgencyId,staffOrgPath);
Map<String, Map<String, Object>> result = new LinkedHashMap<>(); Map<String, Map<String, Object>> result = new LinkedHashMap<>();
mapList.stream().filter(Objects::nonNull).forEach(map -> { mapList.stream().filter(Objects::nonNull).forEach(map -> {
//遍历所有字段 格式化时间字段
map.forEach((k,o) -> { map.forEach((k,o) -> {
if (o instanceof java.sql.Date){ if (o instanceof java.sql.Date){
o = DateUtils.format(((Date) o),DateUtils.DATE_PATTERN); o = DateUtils.format(((Date) o),DateUtils.DATE_PATTERN);
@ -635,18 +633,27 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
o = DateUtils.format(new Date(((Timestamp) o).getTime()),DateUtils.DATE_TIME_PATTERN); o = DateUtils.format(new Date(((Timestamp) o).getTime()),DateUtils.DATE_TIME_PATTERN);
} }
map.put(k,o); map.put(k,o);
//把checkbox radio select的值放入到map里 并添加对应的
}); });
String resiId = (String) map.getOrDefault(UserConstant.IC_RESI_USER, ""); Object gridId = map.get(UserConstant.GRID_ID);
String resiId = null;
//获取用户Id
if ("ic_resi_user".equals(baseTableName)) { if ("ic_resi_user".equals(baseTableName)) {
resiId = (String) map.get("ID"); resiId = (String) map.get("ID");
}else {
resiId = (String) map.get(UserConstant.IC_RESI_USER);
} }
if (StringUtils.isBlank(resiId)){ if (StringUtils.isBlank(resiId)){
log.error("getDataForExport error,resiId:{}",resiId); log.error("getDataForExport error,resiId is net exist:{}",map);
return; return;
} }
//把人放进去
result.put(resiId, map); result.put(resiId, map);
for (Map.Entry<String, FormItemResult> e : formItemMap.entrySet()) { for (Map.Entry<String, FormItemResult> e : formItemMap.entrySet()) {
String k = e.getKey(); String k = e.getKey();
FormItemResult v = e.getValue(); FormItemResult v = e.getValue();
@ -658,13 +665,12 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
Map<String, IcResiUserImportServiceImpl.ColumnWrapper> columnWrappers = new HashMap<>(); Map<String, IcResiUserImportServiceImpl.ColumnWrapper> columnWrappers = new HashMap<>();
if (v.getItemId().equals("1078")) { if (v.getItemId().equals("1078")) {
Map<String, Object> userMap = resiMainList.get(map.get(UserConstant.IC_RESI_USER)); Map<String, Object> userMap = resiMainList.get(map.get(UserConstant.IC_RESI_USER));
Object gridId = userMap.get(UserConstant.GRID_ID);
IcResiUserImportServiceImpl.ColumnWrapper value = new IcResiUserImportServiceImpl.ColumnWrapper(); IcResiUserImportServiceImpl.ColumnWrapper value = new IcResiUserImportServiceImpl.ColumnWrapper();
value.setColValue(gridId.toString()); value.setColValue(gridId.toString());
columnWrappers.put("1001", value); columnWrappers.put("1001", value);
} }
//todo 获取 options //todo 获取 options
Map<String, String> stringMap = icResiUserImportService.listRemoteOptions(columnWrappers, v.getOptionSourceValue(), null); Map<String, String> stringMap = icResiUserImportService.listRemoteOptions(columnWrappers, v.getOptionSourceValue(), currentStaffAgencyId);
if ("checkbox".equals(v.getItemType())) { if ("checkbox".equals(v.getItemType())) {
stringMap.forEach((label, value) -> map.put(value, vauleStr.contains(value) ? "是" : "否")); stringMap.forEach((label, value) -> map.put(value, vauleStr.contains(value) ? "是" : "否"));
} else if ("select".equals(v.getItemType())) { } else if ("select".equals(v.getItemType())) {
@ -704,15 +710,15 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
map.putAll(resiMainList.get(resiId)); map.putAll(resiMainList.get(resiId));
return; return;
} }
Object gridId = map.get(UserConstant.GRID_ID);
if (gridId != null) { /*if (gridId != null) {
CustomerGridFormDTO formDTO = new CustomerGridFormDTO(); CustomerGridFormDTO formDTO = new CustomerGridFormDTO();
formDTO.setGridId(gridId.toString()); formDTO.setGridId(gridId.toString());
Result<CustomerGridDTO> gridInfoRes = govOrgOpenFeignClient.getGridBaseInfoByGridId(formDTO); Result<CustomerGridDTO> gridInfoRes = govOrgOpenFeignClient.getGridBaseInfoByGridId(formDTO);
if (gridInfoRes != null && gridInfoRes.success() && gridInfoRes.getData() != null) { if (gridInfoRes != null && gridInfoRes.success() && gridInfoRes.getData() != null) {
map.put(UserConstant.GRID_NAME, gridInfoRes.getData().getGridName()); map.put(UserConstant.GRID_NAME, gridInfoRes.getData().getGridName());
} }
} }*/
Object homeId = map.get(UserConstant.HOME_ID); Object homeId = map.get(UserConstant.HOME_ID);
if (homeId != null) { if (homeId != null) {
HashSet<String> houseIds = new HashSet<>(); HashSet<String> houseIds = new HashSet<>();

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

@ -52,7 +52,7 @@ public class StatsResiWarnServiceImpl implements StatsResiWarnService {
private IcResiUserDao icResiUserDao; private IcResiUserDao icResiUserDao;
@Override @Override
public List<IcStatsResiWarnBuildingResultDTO> buildingwWarnList(String agencyID) { public List<IcStatsResiWarnBuildingResultDTO> buildingwWarnList(String customerId,String agencyID) {
List<IcStatsResiWarnBuildingResultDTO> result = new ArrayList<>(); List<IcStatsResiWarnBuildingResultDTO> result = new ArrayList<>();
//feign获取当前需要预警的配置信息以及阈值 //feign获取当前需要预警的配置信息以及阈值
Result<List<IcResiCategoryWarnConfigDTO>> warnResult = operCustomizeOpenFeignClient.resiCategoryWarnList(); Result<List<IcResiCategoryWarnConfigDTO>> warnResult = operCustomizeOpenFeignClient.resiCategoryWarnList();
@ -81,7 +81,7 @@ public class StatsResiWarnServiceImpl implements StatsResiWarnService {
return resiWarnBuildingResultDTO; return resiWarnBuildingResultDTO;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
//统计数量 //统计数量
List<IcStatsResiWarnEntity> icStatsResiWarnEntityList = icStatsResiWarnDao.selectResiWarnByAgencyId(agencyID); List<IcStatsResiWarnEntity> icStatsResiWarnEntityList = icStatsResiWarnDao.selectResiWarnByAgencyId(customerId,agencyID);
if(CollectionUtils.isEmpty(icStatsResiWarnEntityList )){ if(CollectionUtils.isEmpty(icStatsResiWarnEntityList )){
return result; return result;
} }
@ -115,7 +115,7 @@ public class StatsResiWarnServiceImpl implements StatsResiWarnService {
} }
@Override @Override
public List<IcStatsResiWarnUserResultDTO> userWarnList(String configId, List<String> buildingIdList) { public List<IcStatsResiWarnUserResultDTO> userWarnList(String customerId,String configId, List<String> buildingIdList) {
//feign根据buildingIdList 获取网格,小区,楼宇 信息 //feign根据buildingIdList 获取网格,小区,楼宇 信息
Result<List<BuildingResultDTO>> buildingList = govOrgOpenFeignClient.buildingListByIds(buildingIdList); Result<List<BuildingResultDTO>> buildingList = govOrgOpenFeignClient.buildingListByIds(buildingIdList);
if (!buildingList.success() || null == buildingList.getData()) { if (!buildingList.success() || null == buildingList.getData()) {
@ -137,7 +137,7 @@ public class StatsResiWarnServiceImpl implements StatsResiWarnService {
IcResiCategoryWarnConfigDTO icResiCategoryWarnConfigDTO = warnResult.getData(); IcResiCategoryWarnConfigDTO icResiCategoryWarnConfigDTO = warnResult.getData();
//根据buildingID,tableName he columnName获取名字 //根据buildingID,tableName he columnName获取名字
List<Map<String, String>> maps = icStatsResiWarnDao.userWarnList(buildingIdList, icResiCategoryWarnConfigDTO.getTableName(), icResiCategoryWarnConfigDTO.getColumnName()); List<Map<String, String>> maps = icStatsResiWarnDao.userWarnList(customerId,buildingIdList, icResiCategoryWarnConfigDTO.getTableName(), icResiCategoryWarnConfigDTO.getColumnName());
result.forEach(item->{ result.forEach(item->{
item.setConfigId(configId); item.setConfigId(configId);
List<Map<String, String>> buildingIds = maps.stream().filter(map -> item.getBuildingId().equals(map.get("buildingId"))).collect(Collectors.toList()); List<Map<String, String>> buildingIds = maps.stream().filter(map -> item.getBuildingId().equals(map.get("buildingId"))).collect(Collectors.toList());
@ -147,7 +147,7 @@ public class StatsResiWarnServiceImpl implements StatsResiWarnService {
} }
@Override @Override
public List<IcStatsResiResultDTO> list(String id, String level) { public List<IcStatsResiResultDTO> list(String customerId,String id, String level) {
//获取所有配置类项 getshow //获取所有配置类项 getshow
Result<List<IcResiCategoryStatsConfigDTO>> statsResult = operCustomizeOpenFeignClient.resiCategoryStatsListShowd(); Result<List<IcResiCategoryStatsConfigDTO>> statsResult = operCustomizeOpenFeignClient.resiCategoryStatsListShowd();
if (!statsResult.success() || null == statsResult.getData()) { if (!statsResult.success() || null == statsResult.getData()) {
@ -164,7 +164,7 @@ public class StatsResiWarnServiceImpl implements StatsResiWarnService {
resultDTO.setHouseShowIcon(item.getHouseShowIcon()); resultDTO.setHouseShowIcon(item.getHouseShowIcon());
resultDTO.setManagementIcon(item.getManagementIcon()); resultDTO.setManagementIcon(item.getManagementIcon());
//根据id ,level 获取count //根据id ,level 获取count
Integer count = icStatsResiWarnDao.countListByLevelAndCol(item.getTableName(),item.getColumnName(),id,level); Integer count = icStatsResiWarnDao.countListByLevelAndCol(customerId,item.getTableName(),item.getColumnName(),id,level);
resultDTO.setCount(count); resultDTO.setCount(count);
result.add(resultDTO); result.add(resultDTO);
}); });
@ -187,10 +187,10 @@ public class StatsResiWarnServiceImpl implements StatsResiWarnService {
//保存数据 //保存数据
List<IcStatsResiWarnEntity> icStatsResiWarnEntities = new ArrayList<>(); List<IcStatsResiWarnEntity> icStatsResiWarnEntities = new ArrayList<>();
for (IcResiCategoryWarnConfigDTO item : icResiCategoryWarnConfigDTOList) { for (IcResiCategoryWarnConfigDTO item : icResiCategoryWarnConfigDTOList) {
icStatsResiWarnDao.delete(new QueryWrapper<IcStatsResiWarnEntity>().lambda().eq(IcStatsResiWarnEntity::getConfigId,item.getId())); icStatsResiWarnDao.delete(new QueryWrapper<IcStatsResiWarnEntity>().lambda().eq(IcStatsResiWarnEntity::getConfigId,item.getId()).eq(IcStatsResiWarnEntity::getCustomerId,customerId));
List<IcStatsResiWarnEntity> maps = icStatsResiWarnDao.resiWarn(item.getTableName(), item.getColumnName());
List<IcStatsResiWarnEntity> maps = icStatsResiWarnDao.resiWarn(customerId,item.getTableName(), item.getColumnName());
if(CollectionUtils.isEmpty(maps)){ if(CollectionUtils.isEmpty(maps)){
continue; continue;
} }
@ -226,6 +226,11 @@ public class StatsResiWarnServiceImpl implements StatsResiWarnService {
if(null == icResiUserEntity){ if(null == icResiUserEntity){
return ; return ;
} }
IcStatsResiWarnEntity query = new IcStatsResiWarnEntity();
query.setAgencyId(icResiUserEntity.getAgencyId());
query.setGridId(icResiUserEntity.getGridId());
query.setNeighborHoodId(icResiUserEntity.getVillageId());
query.setBuildingId(icResiUserEntity.getBuildId());
//保存数据 //保存数据
for (IcResiCategoryWarnConfigDTO item : icResiCategoryWarnConfigDTOList) { for (IcResiCategoryWarnConfigDTO item : icResiCategoryWarnConfigDTOList) {
@ -233,11 +238,13 @@ public class StatsResiWarnServiceImpl implements StatsResiWarnService {
IcStatsResiWarnEntity icStatsResiWarn = icStatsResiWarnDao.selectOne(new QueryWrapper<IcStatsResiWarnEntity>().lambda() IcStatsResiWarnEntity icStatsResiWarn = icStatsResiWarnDao.selectOne(new QueryWrapper<IcStatsResiWarnEntity>().lambda()
.eq(IcStatsResiWarnEntity::getConfigId,item.getId()) .eq(IcStatsResiWarnEntity::getConfigId,item.getId())
.eq(IcStatsResiWarnEntity::getCustomerId,customerId)
.eq(IcStatsResiWarnEntity::getAgencyId, icResiUserEntity.getAgencyId()) .eq(IcStatsResiWarnEntity::getAgencyId, icResiUserEntity.getAgencyId())
.eq(IcStatsResiWarnEntity::getGridId, icResiUserEntity.getGridId()) .eq(IcStatsResiWarnEntity::getGridId, icResiUserEntity.getGridId())
.eq(IcStatsResiWarnEntity::getNeighborHoodId, icResiUserEntity.getVillageId()) .eq(IcStatsResiWarnEntity::getNeighborHoodId, icResiUserEntity.getVillageId())
.eq(IcStatsResiWarnEntity::getBuildingId, icResiUserEntity.getBuildId())); .eq(IcStatsResiWarnEntity::getBuildingId, icResiUserEntity.getBuildId()));
//统计数量
IcStatsResiWarnEntity resiWarnEntity = icStatsResiWarnDao.resiWarnById(customerId,item.getTableName(), item.getColumnName(),query);
if(null == icStatsResiWarn){ if(null == icStatsResiWarn){
//如果不存在,新增统计数量 //如果不存在,新增统计数量
icStatsResiWarn = new IcStatsResiWarnEntity(); icStatsResiWarn = new IcStatsResiWarnEntity();
@ -248,18 +255,23 @@ public class StatsResiWarnServiceImpl implements StatsResiWarnService {
icStatsResiWarn.setBuildingId(icResiUserEntity.getBuildId()); icStatsResiWarn.setBuildingId(icResiUserEntity.getBuildId());
icStatsResiWarn.setConfigId(item.getId()); icStatsResiWarn.setConfigId(item.getId());
icStatsResiWarn.setCustomerId(customerId); icStatsResiWarn.setCustomerId(customerId);
IcStatsResiWarnEntity resiWarnEntity = icStatsResiWarnDao.resiWarnById(item.getTableName(), item.getColumnName(),icStatsResiWarn);
if(null == resiWarnEntity){ if(null == resiWarnEntity){
continue; icStatsResiWarn.setCount(0);
}else{
icStatsResiWarn.setCount(resiWarnEntity.getCount());
} }
icStatsResiWarn.setCount(resiWarnEntity.getCount());
icStatsResiWarnDao.insert(icStatsResiWarn); icStatsResiWarnDao.insert(icStatsResiWarn);
}else{ }else{
//如果存在,更新统计数量 //如果存在,更新统计数量
IcStatsResiWarnEntity resiWarnEntity = icStatsResiWarnDao.resiWarnById(item.getTableName(), item.getColumnName(),icStatsResiWarn); if(null == resiWarnEntity){
icStatsResiWarn.setCount(resiWarnEntity.getCount()); icStatsResiWarn.setCount(0);
}else{
icStatsResiWarn.setCount(resiWarnEntity.getCount());
}
icStatsResiWarn.setCustomerId(customerId); icStatsResiWarn.setCustomerId(customerId);
icStatsResiWarnDao.updateById(icStatsResiWarn); icStatsResiWarnDao.updateById(icStatsResiWarn);
} }

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

Binary file not shown.

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

Binary file not shown.

BIN
epmet-user/epmet-user-server/src/main/resources/excel/ic_resi_info_cid_for_easy_excel.xlsx

Binary file not shown.

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

@ -187,7 +187,7 @@
GRID_ID GRID_ID
FROM ic_resi_user FROM ic_resi_user
WHERE DEL_FLAG = '0' WHERE DEL_FLAG = '0'
AND PIDS LIKE CONCAT('%',#{agencyId},'%') AND (AGENCY_ID = #{agencyId} OR PIDS LIKE CONCAT('%',#{agencyId},'%'))
AND `NAME` LIKE CONCAT('%',#{name},'%') AND `NAME` LIKE CONCAT('%',#{name},'%')
ORDER BY `NAME` ORDER BY `NAME`
</select> </select>

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

@ -29,6 +29,7 @@
<if test="agencyId != null and agencyId.trim() != ''"> <if test="agencyId != null and agencyId.trim() != ''">
AND (AGENCY_ID = #{agencyId} or CONCAT(':',AGENCY_PIDS, ':') like CONCAT('%:',#{agencyId},':%')) AND (AGENCY_ID = #{agencyId} or CONCAT(':',AGENCY_PIDS, ':') like CONCAT('%:',#{agencyId},':%'))
</if> </if>
and CUSTOMER_ID = #{customerId}
</select> </select>
<select id="userWarnList" resultType="map"> <select id="userWarnList" resultType="map">
@ -46,10 +47,12 @@
</if> </if>
<if test="tableName!='ic_resi_user'"> <if test="tableName!='ic_resi_user'">
and ID in ( and ID in (
select IC_RESI_USER from ${tableName} where ${columnName} = '1' and DEL_FLAG = '0' select IC_RESI_USER from ${tableName} where ${columnName} = '1' and CUSTOMER_ID = #{customerId} and DEL_FLAG = '0'
) )
</if> </if>
and CUSTOMER_ID = #{customerId}
and DEL_FLAG = '0' and DEL_FLAG = '0'
group by BUILD_ID group by BUILD_ID
</select> </select>
@ -63,7 +66,7 @@
</if> </if>
<if test="tableName!='ic_resi_user'"> <if test="tableName!='ic_resi_user'">
and ID in ( and ID in (
select IC_RESI_USER from ${tableName} where ${columnName} = '1' and DEL_FLAG = '0' select IC_RESI_USER from ${tableName} where ${columnName} = '1' and CUSTOMER_ID = #{customerId} and DEL_FLAG = '0'
) )
</if> </if>
<if test="level=='agency'"> <if test="level=='agency'">
@ -78,6 +81,7 @@
<if test="level=='building'"> <if test="level=='building'">
AND BUILD_ID = #{id} AND BUILD_ID = #{id}
</if> </if>
and CUSTOMER_ID = #{customerId}
and DEL_FLAG = '0' and DEL_FLAG = '0'
</select> </select>
@ -97,10 +101,11 @@
</if> </if>
<if test="tableName!='ic_resi_user'"> <if test="tableName!='ic_resi_user'">
and ID in ( and ID in (
select IC_RESI_USER from ${tableName} where ${columnName} = '1' and DEL_FLAG = '0' select IC_RESI_USER from ${tableName} where ${columnName} = '1' and CUSTOMER_ID = #{customerId} and DEL_FLAG = '0'
) )
</if> </if>
and DEL_FLAG = '0' and CUSTOMER_ID = #{customerId}
and DEL_FLAG = '0'
group by AGENCY_ID,GRID_ID,VILLAGE_ID,BUILD_ID group by AGENCY_ID,GRID_ID,VILLAGE_ID,BUILD_ID
</select> </select>
<select id="resiWarnById" resultType="com.epmet.entity.IcStatsResiWarnEntity"> <select id="resiWarnById" resultType="com.epmet.entity.IcStatsResiWarnEntity">
@ -118,9 +123,10 @@
</if> </if>
<if test="tableName!='ic_resi_user'"> <if test="tableName!='ic_resi_user'">
and ID in ( and ID in (
select IC_RESI_USER from ${tableName} where ${columnName} = '1' and DEL_FLAG = '0' select IC_RESI_USER from ${tableName} where ${columnName} = '1' and CUSTOMER_ID = #{customerId} and DEL_FLAG = '0'
) )
</if> </if>
and CUSTOMER_ID = #{customerId}
and DEL_FLAG = '0' and DEL_FLAG = '0'
and AGENCY_ID = #{icStatsResiWarn.agencyId} and GRID_ID =#{icStatsResiWarn.gridId} and VILLAGE_ID=#{icStatsResiWarn.neighborHoodId} and BUILD_ID=#{icStatsResiWarn.buildingId} and AGENCY_ID = #{icStatsResiWarn.agencyId} and GRID_ID =#{icStatsResiWarn.gridId} and VILLAGE_ID=#{icStatsResiWarn.neighborHoodId} and BUILD_ID=#{icStatsResiWarn.buildingId}
group by AGENCY_ID,GRID_ID,VILLAGE_ID,BUILD_ID group by AGENCY_ID,GRID_ID,VILLAGE_ID,BUILD_ID

Loading…
Cancel
Save