Browse Source

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

dev_shibei_match
jianjun 4 years ago
parent
commit
a676605f65
  1. 22
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/BuildingController.java
  2. 16
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/HouseController.java
  3. 22
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/NeighborHoodController.java
  4. 6
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java
  5. 3
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcBuildingDao.java
  6. 3
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcNeighborHoodDao.java
  7. 3
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/BuildingService.java
  8. 3
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/HouseService.java
  9. 2
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/NeighborHoodService.java
  10. 19
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/BuildingServiceImpl.java
  11. 21
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java
  12. 28
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/NeighborHoodServiceImpl.java
  13. 8
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml
  14. 4
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcBuildingDao.xml
  15. 4
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcNeighborHoodDao.xml
  16. 2
      epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/CustomerFormResultDTO.java
  17. 2
      epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/FormGroupDTO.java
  18. 2
      epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/FormItemResult.java
  19. 2
      epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/FormItemResult2.java
  20. 2
      epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/OperCustomizeOpenFeignClient.java
  21. 2
      epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/fallback/OperCustomizeOpenFeignClientFallback.java
  22. 6
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcFormController.java
  23. 8
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcFormDao.java
  24. 6
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcFormService.java
  25. 27
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcFormServiceImpl.java
  26. 8
      epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcFormDao.xml
  27. 46
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StatsResiWarnCountFormDTO.java
  28. 205
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java
  29. 9
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StatsResiWarnController.java
  30. 4
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java
  31. 2
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcStatsResiWarnDao.java
  32. 7
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java
  33. 2
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/StatsResiWarnService.java
  34. 23
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserImportServiceImpl.java
  35. 19
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java
  36. 60
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StatsResiWarnServiceImpl.java
  37. 3
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StatsStaffPatrolRecordDailyServiceImpl.java
  38. 2
      epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml
  39. 22
      epmet-user/epmet-user-server/src/main/resources/mapper/IcStatsResiWarnDao.xml
  40. 6
      epmet-user/epmet-user-server/src/test/java/com/epmet/epmetuser/test/IcResiUserControllerTest.java

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

@ -23,6 +23,7 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.aop.NoRepeatSubmit;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
@ -47,10 +48,8 @@ import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
/**
@ -180,15 +179,24 @@ public class BuildingController {
List<IcBuildingExcel> failList = importResult.getFailList();
//存放错误数据行号
List<Integer> numList = new ArrayList<>();
if(!CollectionUtils.isEmpty(failList)){
for ( IcBuildingExcel entity : failList) {
log.error("第{}行,{}",entity.getRowNum(),entity.getErrorMsg());//打印失败的行 和失败的信息
numList.add(entity.getRowNum());
}
return new Result().error(8001,failList.get(0).getErrorMsg());
//return new Result().error(8001,failList.get(0).getErrorMsg());
}
List<IcBuildingExcel> result =importResult.getList();
return new Result().ok(buildingService.importExcel(customerId,result,tokenDTO.getUserId()));
List<Integer> resultList = buildingService.importExcel(customerId,result,tokenDTO.getUserId(),numList);
String str = String.format("共%s条,成功导入%s条。",numList.size()+result.size(),numList.size()+result.size()-resultList.size());
if(resultList.size()> NumConstant.ZERO){
Collections.sort(resultList);
String subList = resultList.stream().map(String::valueOf).collect(Collectors.joining("、"));
return new Result().error(9999, str+"第"+subList+"行未成功!");
}
return new Result().ok(str);
}
/**

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

@ -21,6 +21,7 @@ import cn.afterturn.easypoi.excel.entity.TemplateExportParams;
import cn.afterturn.easypoi.excel.entity.result.ExcelImportResult;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.aop.NoRepeatSubmit;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
@ -42,6 +43,7 @@ import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.*;
import java.util.stream.Collectors;
/**
@ -145,15 +147,25 @@ public class HouseController {
List<IcHouseExcel> failList = importResult.getFailList();
//存放错误数据行号
List<Integer> numList = new ArrayList<>();
if(!CollectionUtils.isEmpty(failList)){
for ( IcHouseExcel entity : failList) {
log.error("第{}行,{}",entity.getRowNum(),entity.getErrorMsg());//打印失败的行 和失败的信息
numList.add(entity.getRowNum());
}
return new Result().error(8001,failList.get(0).getErrorMsg());
//return new Result().error(8001,failList.get(0).getErrorMsg());
}
List<IcHouseExcel> result =importResult.getList();
return new Result().ok(houseService.importExcel(customerId,result,tokenDTO.getUserId()));
List<Integer> resultList = houseService.importExcel(customerId,result,tokenDTO.getUserId(),numList);
String str = String.format("共%s条,成功导入%s条。",numList.size()+result.size(),numList.size()+result.size()-resultList.size());
if(resultList.size()> NumConstant.ZERO){
Collections.sort(resultList);
String subList = resultList.stream().map(String::valueOf).collect(Collectors.joining("、"));
return new Result().error(9999, str+"第"+subList+"行未成功!");
}
return new Result().ok(str);
}
@PostMapping( "queryListHouseInfo")

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

@ -22,6 +22,7 @@ import cn.afterturn.easypoi.excel.entity.result.ExcelImportResult;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.aop.NoRepeatSubmit;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
@ -45,10 +46,8 @@ import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
/**
@ -207,16 +206,25 @@ public class NeighborHoodController {
// List<IcNeighborHoodExcel> result = ExcelPoiUtils.importExcel(file, 0, 1, IcNeighborHoodExcel.class);
List<IcNeighborHoodExcel> failList = importResult.getFailList();
//存放错误数据行号
List<Integer> numList = new ArrayList<>();
if(!CollectionUtils.isEmpty(failList)){
for ( IcNeighborHoodExcel entity : failList) {
log.error("第{}行,{}",entity.getRowNum(),entity.getErrorMsg());//打印失败的行 和失败的信息
numList.add(entity.getRowNum());
}
return new Result().error(8001,failList.get(0).getErrorMsg());
//return new Result().error(8001,failList.get(0).getErrorMsg());
}
List<IcNeighborHoodExcel> result =importResult.getList();
// log.info(JSON.toJSONString(result));
neighborHoodService.importExcel(customerId,result,tokenDTO.getUserId());
return new Result();
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());
if(resultList.size()> NumConstant.ZERO){
Collections.sort(resultList);
String subList = resultList.stream().map(String::valueOf).collect(Collectors.joining("、"));
return new Result().error(9999, str+"第"+subList+"行未成功!");
}
return new Result().ok(str);
}

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

@ -336,4 +336,10 @@ public interface CustomerGridDao extends BaseDao<CustomerGridEntity> {
* @Date 2021/10/25 16:04
*/
List<UnitDTO> selectUnitList(@Param("buildingId") String buildingId);
/**
* @Author sun
* @Description 查询组织下直属网格列表
**/
List<CustomerGridEntity> selectByPid(@Param("pid") String pid);
}

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

@ -56,7 +56,8 @@ public interface IcBuildingDao extends BaseDao<IcBuildingEntity> {
List<CustomerAgencyEntity> selectAgencyChildrenList(@Param("agencyId") String agencyId);
List<Map<String, Object>> selectListByName(@Param("neighborNameList")ArrayList<String> strings,
List<Map<String, Object>> selectListByName(@Param("customerId") String customerId,
@Param("neighborNameList")ArrayList<String> strings,
@Param("buildingNameList") ArrayList<String> strings1,
@Param("buildingUnitList") ArrayList<Integer> integers);

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

@ -43,7 +43,8 @@ public interface IcNeighborHoodDao extends BaseDao<IcNeighborHoodEntity> {
// List<IcNeighborHoodExcel> searchAllNeighborhood(@Param(Constants.WRAPPER) QueryWrapper<IcNeighborHoodEntity> neighborHoodEntityQueryWrapper);
List<IcNeighborHoodExcel> searchAllNeighborhood(@Param("neighbor") IcNeighborHoodEntity neighbor, @Param("house")IcHouseEntity house);
List<IcNeighborHoodEntity> selectListByName(@Param("neighborNameList")List<String> neighborNameList,
List<IcNeighborHoodEntity> selectListByName(@Param("customerId") String customerId,
@Param("neighborNameList")List<String> neighborNameList,
@Param("agencyNameList") List<String> agencyNameList,
@Param("gridNameList") List<String> gridNameList);

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

@ -17,7 +17,6 @@
package com.epmet.service;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.BuildingTreeLevelDTO;
import com.epmet.dto.form.IcBulidingFormDTO;
import com.epmet.dto.form.ListIcNeighborHoodFormDTO;
@ -53,7 +52,7 @@ public interface BuildingService {
List<BuildingTreeLevelDTO> treeList(String customerId);
Result importExcel(String customerId, List<IcBuildingExcel> list, String staffId);
List<Integer> importExcel(String customerId, List<IcBuildingExcel> list, String staffId, List<Integer> numList);
IcNeighborHoodResultDTO listBuilding(ListIcNeighborHoodFormDTO formDTO);

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

@ -17,7 +17,6 @@
package com.epmet.service;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.IcHouseFormDTO;
import com.epmet.dto.form.ListIcNeighborHoodFormDTO;
import com.epmet.dto.result.HouseInfoDTO;
@ -48,7 +47,7 @@ public interface HouseService {
void delHouse(String houseId);
Result importExcel(String customerId, List<IcHouseExcel> list, String staffId);
List<Integer> importExcel(String customerId, List<IcHouseExcel> list, String staffId, List<Integer> numList);
IcNeighborHoodResultDTO listNeighborhood(ListIcNeighborHoodFormDTO formDTO);

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

@ -52,5 +52,5 @@ public interface NeighborHoodService{
*/
void exportNeighborhoodinfo(ListIcNeighborHoodFormDTO formDTO, HttpServletResponse response) throws Exception ;
void importExcel(String customerId,List<IcNeighborHoodExcel> list,String staffId);
List<Integer> importExcel(String customerId, List<IcNeighborHoodExcel> list, String staffId, List<Integer> numList);
}

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

@ -9,7 +9,6 @@ import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dao.*;
import com.epmet.dto.BuildingTreeLevelDTO;
import com.epmet.dto.CustomerStaffAgencyDTO;
@ -210,7 +209,7 @@ public class BuildingServiceImpl implements BuildingService {
@Override
@Transactional(rollbackFor = Exception.class)
public Result importExcel(String customerId, List<IcBuildingExcel> list, String staffId) {
public List<Integer> importExcel(String customerId, List<IcBuildingExcel> list, String staffId, List<Integer> numList) {
//2021.11.9 需求变更 当前工作人员只能导致自己所属组织下数据,网格名对应不上的数据舍弃【注:需求就这样】 sun
CustomerStaffInfoCacheResult staffInfoCache = CustomerStaffRedis.getStaffInfo(customerId, staffId);
//组织名称不一样的数据舍弃
@ -218,15 +217,16 @@ public class BuildingServiceImpl implements BuildingService {
while (iterator.hasNext()) {
IcBuildingExcel obj = iterator.next();
if (!obj.getAgencyName().trim().equals(staffInfoCache.getAgencyName())) {
numList.add(obj.getRowNum());
iterator.remove();
}
}
//用于存储匹配不上的数据给前端的提示 如南宁社区不存在
StringBuffer str = new StringBuffer("");
//StringBuffer str = new StringBuffer("");
//end sun
//导入
if(CollectionUtils.isEmpty(list)){
return new Result();
return numList;
}
//查询所有组织和网格根据名字
@ -236,7 +236,7 @@ public class BuildingServiceImpl implements BuildingService {
Set<String> neighborNameList = list.stream().map(item -> item.getNeighborHoodName()).collect(Collectors.toSet());
Set<String> agencyNameList = list.stream().map(item -> item.getAgencyName()).collect(Collectors.toSet());
Set<String> gridNameList = list.stream().map(item -> item.getGridName()).collect(Collectors.toSet());
List<IcNeighborHoodEntity> neighborHoodList = icNeighborHoodDao.selectListByName(new ArrayList<String>(neighborNameList),new ArrayList<String>(agencyNameList),new ArrayList<String>(gridNameList));
List<IcNeighborHoodEntity> neighborHoodList = icNeighborHoodDao.selectListByName(customerId, new ArrayList<String>(neighborNameList),new ArrayList<String>(agencyNameList),new ArrayList<String>(gridNameList));
// List<IcNeighborHoodEntity> neighborHoodList = icNeighborHoodDao.selectList(new QueryWrapper<IcNeighborHoodEntity>().lambda().in(IcNeighborHoodEntity::getNeighborHoodName, neighborNameList));
Map<String,IcNeighborHoodEntity> neighborHoodMap = neighborHoodList.stream().collect(Collectors.toMap(IcNeighborHoodEntity::getNeighborHoodName, Function.identity(),(key1, key2)->key1));
@ -252,7 +252,8 @@ public class BuildingServiceImpl implements BuildingService {
entity.setCustomerId(customerId);
entity.setNeighborHoodId(Optional.ofNullable(neighborHoodMap.get(icBuildingExcel.getNeighborHoodName())).map(u->u.getId()).orElse(""));//neighborHoodMap.get(icBuildingExcel.getNeighborHoodName()).getId()
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());
continue;
}
entity.setBuildingName(icBuildingExcel.getBuildingName());
@ -286,10 +287,10 @@ public class BuildingServiceImpl implements BuildingService {
icBuildingService.insertBatch(buildingEntityList);
icBuildingUnitService.insertBatch(icBuildingUnitEntityList);
if(!"".equals(str)){
/* if(!"".equals(str)){
return new Result().error(9999, str.append("不存在").toString());
}
return new Result();
}*/
return numList;
}
@Override

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

@ -8,7 +8,6 @@ import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dao.IcBuildingDao;
import com.epmet.dao.IcBuildingUnitDao;
import com.epmet.dao.IcHouseDao;
@ -24,7 +23,6 @@ import com.epmet.entity.IcHouseEntity;
import com.epmet.enums.HousePurposeEnums;
import com.epmet.enums.HouseRentFlagEnums;
import com.epmet.enums.HouseTypeEnums;
import com.epmet.excel.IcBuildingExcel;
import com.epmet.excel.IcHouseExcel;
import com.epmet.service.HouseService;
import com.epmet.service.IcBuildingService;
@ -123,7 +121,8 @@ public class HouseServiceImpl implements HouseService {
}
@Override
public Result importExcel(String customerId, List<IcHouseExcel> list, String staffId) {
@Transactional(rollbackFor = Exception.class)
public List<Integer> importExcel(String customerId, List<IcHouseExcel> list, String staffId, List<Integer> numList) {
//2021.11.10 需求变更 当前工作人员只能导致自己所属组织下数据,对应不上的数据舍弃【注:需求就这样】 sun
CustomerStaffInfoCacheResult staffInfoCache = CustomerStaffRedis.getStaffInfo(customerId, staffId);
//组织名称不一样的数据舍弃
@ -131,15 +130,16 @@ public class HouseServiceImpl implements HouseService {
while (iterator.hasNext()) {
IcHouseExcel obj = iterator.next();
if (!obj.getAgencyName().trim().equals(staffInfoCache.getAgencyName())) {
numList.add(obj.getRowNum());
iterator.remove();
}
}
//用于存储匹配不上的数据给前端的提示 如南宁社区不存在
StringBuffer str = new StringBuffer("");
//StringBuffer str = new StringBuffer("");
//end sun
//导入
if(CollectionUtils.isEmpty(list)){
return new Result();
return numList;
}
//获取所有小区 list
// List<String> neighborNameList = list.stream().map(item -> item.getNeighborHoodName()).collect(Collectors.toList());
@ -153,7 +153,7 @@ public class HouseServiceImpl implements HouseService {
Set<String> neighborNameList = list.stream().map(item -> item.getNeighborHoodName()).collect(Collectors.toSet());
Set<String> buildingNameList = list.stream().map(item -> item.getBuildingName()).collect(Collectors.toSet());
Set<Integer> buildingUnitList = list.stream().map(item -> item.getBuildingUnit()).collect(Collectors.toSet());
List<Map<String,Object>> buildMapList = icBuildingDao.selectListByName(new ArrayList<String>(neighborNameList),new ArrayList<String>(buildingNameList),new ArrayList<Integer>(buildingUnitList));
List<Map<String,Object>> buildMapList = icBuildingDao.selectListByName(customerId, new ArrayList<String>(neighborNameList),new ArrayList<String>(buildingNameList),new ArrayList<Integer>(buildingUnitList));
//转Map
Map<String,Map<String,Object>> buildMap = new HashMap<>();
buildMapList.forEach(item->{
@ -173,7 +173,8 @@ public class HouseServiceImpl implements HouseService {
entity.setBuildingUnitId(String.valueOf(Optional.ofNullable(item).map(u->u.get("buildingUnitId")).orElse("")));
entity.setHouseName(icHouseExcel.getBuildingName()+"-"+icHouseExcel.getBuildingUnit()+"-"+icHouseExcel.getDoorName());
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());
continue;
}
entity.setDoorName(icHouseExcel.getDoorName());
@ -193,10 +194,10 @@ public class HouseServiceImpl implements HouseService {
//3.保存
icHouseService.insertBatch(houseEntityList);
if(!"".equals(str)){
/*if(!"".equals(str)){
return new Result().error(9999, str.append("不存在").toString());
}
return new Result();
}*/
return numList;
}

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

@ -36,6 +36,7 @@ import org.springframework.util.StringUtils;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.*;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Function;
import java.util.stream.Collectors;
@ -240,32 +241,49 @@ public class NeighborHoodServiceImpl implements NeighborHoodService {
@Override
@Transactional(rollbackFor = Exception.class)
public void importExcel(String customerId,List<IcNeighborHoodExcel> list,String staffId) {
public List<Integer> importExcel(String customerId,List<IcNeighborHoodExcel> list,String staffId, List<Integer> numList) {
//2021.11.9 需求变更 当前工作人员只能导致自己所属组织下数据,网格名对应不上的数据舍弃【注:需求就这样】 sun
CustomerStaffInfoCacheResult staffInfoCache = CustomerStaffRedis.getStaffInfo(customerId, staffId);
//查询当前组织下网格列表
List<CustomerGridEntity> customerGridList = customerGridDao.selectByPid(staffInfoCache.getAgencyId());
//组织名称不一样的数据舍弃
Iterator<IcNeighborHoodExcel> iterator = list.iterator();
while (iterator.hasNext()) {
IcNeighborHoodExcel obj = iterator.next();
if (!obj.getAgencyName().trim().equals(staffInfoCache.getAgencyName())) {
numList.add(obj.getRowNum());
iterator.remove();
}
//当前组织下网格名不存在的也不允许导入
AtomicBoolean br = new AtomicBoolean(true);
customerGridList.forEach(g->{
if(obj.getGridName().trim().equals(g.getGridName())){
br.set(false);
}
});
if(br.get()){
numList.add(obj.getRowNum());
iterator.remove();
}
}
//end sun
//导入
if(CollectionUtils.isEmpty(list)){
return ;
return numList;
}
//获取所有组织 list
List<String> agencyNameList = list.stream().map(item -> item.getAgencyName()).collect(Collectors.toList());
agencyNameList = agencyNameList.stream().distinct().collect(Collectors.toList());
//获取所有网格 list
List<String> gridNameList = list.stream().map(item->item.getGridName()).collect(Collectors.toList());
//List<String> gridNameList = list.stream().map(item->item.getGridName()).collect(Collectors.toList());
//获取所有物业 list
List<String> propertyNameList = list.stream().map(item->item.getPropertyName()).collect(Collectors.toList());
propertyNameList = propertyNameList.stream().distinct().collect(Collectors.toList());
//查询对应的id
List<CustomerAgencyEntity> customerAgencyList = customerAgencyDao.selectList(new QueryWrapper<CustomerAgencyEntity>().lambda().in(CustomerAgencyEntity::getOrganizationName, agencyNameList));
List<CustomerGridEntity> customerGridList = customerGridDao.selectList(new QueryWrapper<CustomerGridEntity>().lambda().in(CustomerGridEntity::getGridName, gridNameList));
//List<CustomerGridEntity> customerGridList = customerGridDao.selectList(new QueryWrapper<CustomerGridEntity>().lambda().in(CustomerGridEntity::getGridName, gridNameList));
List<IcPropertyManagementEntity> icPropertyManagementList = icPropertyManagementDao.selectList(new QueryWrapper<IcPropertyManagementEntity>().lambda().in(IcPropertyManagementEntity::getName, propertyNameList));
Map<String,CustomerAgencyEntity> agencyMap = customerAgencyList.stream().collect(Collectors.toMap(CustomerAgencyEntity::getOrganizationName, Function.identity(),(key1, key2)->key1));
@ -294,6 +312,7 @@ public class NeighborHoodServiceImpl implements NeighborHoodService {
entity.setGridId(Optional.ofNullable(gridMap.get(icNeighborHoodExcel.getGridName().trim())).map(u->u.getId()).orElse(""));//gridMap.get(icNeighborHoodExcel.getGridName()).getId()
//网格名对应不上的数据舍弃
if ("".equals(entity.getGridId())) {
numList.add(icNeighborHoodExcel.getRowNum());
continue;
}
entity.setAddress(icNeighborHoodExcel.getAddress());
@ -312,6 +331,7 @@ public class NeighborHoodServiceImpl implements NeighborHoodService {
icNeighborHoodService.insertBatch(neighborHoodEntityList);
icNeighborHoodPropertyService.insertBatch(icNeighborHoodPropertyEntityList);
return numList;
}

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

@ -680,5 +680,13 @@
DEL_FLAG = '0'
AND BUILDING_ID = #{buildingId}
</select>
<select id="selectByPid" resultType="com.epmet.entity.CustomerGridEntity">
SELECT
*
FROM customer_grid
WHERE
del_flag = '0'
AND pid = #{pid}
</select>
</mapper>

4
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcBuildingDao.xml

@ -283,7 +283,9 @@
<foreach collection="buildingUnitList" open="(" separator="," close=")" item="val">
#{val}
</foreach>
WHERE a.DEL_FLAG = '0' and a.NEIGHBOR_HOOD_NAME in
WHERE a.DEL_FLAG = '0'
AND a.CUSTOMER_ID = #{customerId}
and a.NEIGHBOR_HOOD_NAME in
<foreach collection="neighborNameList" open="(" separator="," close=")" item="val">
#{val}
</foreach>

4
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcNeighborHoodDao.xml

@ -193,7 +193,9 @@
<foreach collection="gridNameList" open="(" separator="," close=")" item="val">
#{val}
</foreach>
where a.DEL_FLAG= '0'and a.NEIGHBOR_HOOD_NAME in
where a.DEL_FLAG= '0'
AND a.CUSTOMER_ID = #{customerId}
and a.NEIGHBOR_HOOD_NAME in
<foreach collection="neighborNameList" open="(" separator="," close=")" item="val">
#{val}
</foreach>

2
epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/CustomerFormResultDTO.java

@ -27,7 +27,7 @@ public class CustomerFormResultDTO implements Serializable {
/**
* 表单项
*/
private List<FormItem> itemList;
private List<FormItemResult> itemList;
/**
* 表单分组

2
epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/FormGroupDTO.java

@ -42,6 +42,6 @@ public class FormGroupDTO implements Serializable {
/**
* 分组里面的组件
*/
private List<FormItem2> itemList;
private List<FormItemResult2> itemList;
}

2
epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/FormItem.java → epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/FormItemResult.java

@ -12,7 +12,7 @@ import java.util.List;
* @Date 2021/10/26 2:15 下午
*/
@Data
public class FormItem implements Serializable {
public class FormItemResult implements Serializable {
private static final long serialVersionUID = 7443085469505238040L;
/**

2
epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/FormItem2.java → epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/FormItemResult2.java

@ -12,7 +12,7 @@ import java.util.List;
* @Date 2021/10/26 4:29 下午
*/
@Data
public class FormItem2 implements Serializable {
public class FormItemResult2 implements Serializable {
private static final long serialVersionUID = -7571266621687396261L;
/**
* 父项ID

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

@ -91,7 +91,7 @@ public interface OperCustomizeOpenFeignClient {
* @date 2021.10.28 15:19:59
*/
@PostMapping("/oper/customize/icform/items")
Result<List<FormItem>> listItems(@RequestBody CustomerFormQueryDTO formDto);
Result<List<FormItemResult>> listItems(@RequestBody CustomerFormQueryDTO formDto);
/**
* @Author sun

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

@ -73,7 +73,7 @@ public class OperCustomizeOpenFeignClientFallback implements OperCustomizeOpenFe
}
@Override
public Result<List<FormItem>> listItems(CustomerFormQueryDTO formDto) {
public Result<List<FormItemResult>> listItems(CustomerFormQueryDTO formDto) {
return ModuleUtils.feignConError(ServiceConstant.OPER_CUSTOMIZE_SERVER, "listItems", formDto);
}

6
epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcFormController.java

@ -187,9 +187,9 @@ public class IcFormController {
* @date 2021.10.28 15:19:59
*/
@PostMapping("items")
public Result<List<FormItem>> listItems(@LoginUser TokenDto tokenDto, @RequestBody CustomerFormQueryDTO formDto) {
public Result<List<FormItemResult>> listItems(@LoginUser TokenDto tokenDto, @RequestBody CustomerFormQueryDTO formDto) {
ValidatorUtils.validateEntity(formDto, CustomerFormQueryDTO.GetFormInfoGroup.class);
List<FormItem> rst = icFormService.listItems(tokenDto.getCustomerId(), formDto.getFormCode());
return new Result<List<FormItem>>().ok(rst);
List<FormItemResult> rst = icFormService.listItems(tokenDto.getCustomerId(), formDto.getFormCode());
return new Result<List<FormItemResult>>().ok(rst);
}
}

8
epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcFormDao.java

@ -20,7 +20,7 @@ package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.result.CustomerFormResultDTO;
import com.epmet.dto.result.FormGroupDTO;
import com.epmet.dto.result.FormItem;
import com.epmet.dto.result.FormItemResult;
import com.epmet.dto.result.OptionDTO;
import com.epmet.entity.IcFormEntity;
import org.apache.ibatis.annotations.Mapper;
@ -47,9 +47,9 @@ public interface IcFormDao extends BaseDao<IcFormEntity> {
*/
CustomerFormResultDTO selectByCode(@Param("customerId") String customerId, @Param("formCode") String formCode);
List<FormItem> selectItemList(String formId, Boolean dynamic);
List<FormItemResult> selectItemList(String formId, Boolean dynamic);
List<FormItem> selectItemListByGroupId(String groupId);
List<FormItemResult> selectItemListByGroupId(String groupId);
List<OptionDTO> selectListOption(String itemId);
List<FormGroupDTO> selectListGroup(String formId);
@ -64,5 +64,5 @@ public interface IcFormDao extends BaseDao<IcFormEntity> {
* @author wxz
* @date 2021.10.28 16:43:00
*/
List<FormItem> listItems(@Param("formId") String formId);
List<FormItemResult> listItems(@Param("formId") String formId);
}

6
epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcFormService.java

@ -22,7 +22,7 @@ import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.IcFormDTO;
import com.epmet.dto.form.CustomerFormQueryDTO;
import com.epmet.dto.result.CustomerFormResultDTO;
import com.epmet.dto.result.FormItem;
import com.epmet.dto.result.FormItemResult;
import com.epmet.entity.IcFormEntity;
import java.util.List;
@ -115,5 +115,5 @@ public interface IcFormService extends BaseService<IcFormEntity> {
* @author wxz
* @date 2021.10.27 17:41:59
*/
List<FormItem> listItems(String customerId, String formCode);
}
List<FormItemResult> listItems(String customerId, String formCode);
}

27
epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcFormServiceImpl.java

@ -17,9 +17,7 @@
package com.epmet.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
@ -35,21 +33,18 @@ import com.epmet.dto.IcFormDTO;
import com.epmet.dto.form.CustomerFormQueryDTO;
import com.epmet.dto.result.CustomerFormResultDTO;
import com.epmet.dto.result.FormGroupDTO;
import com.epmet.dto.result.FormItem;
import com.epmet.dto.result.FormItemResult;
import com.epmet.entity.IcFormEntity;
import com.epmet.redis.CustomerFootBarRedis;
import com.epmet.service.IcFormService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Optional;
/**
* 配置表单
@ -61,7 +56,7 @@ import java.util.Optional;
public class IcFormServiceImpl extends BaseServiceImpl<IcFormDao, IcFormEntity> implements IcFormService {
@Autowired
private CustomerFootBarRedis customerFootBarRedis;
@Autowired
private RedisUtils redisUtils;
@ -135,7 +130,7 @@ public class IcFormServiceImpl extends BaseServiceImpl<IcFormDao, IcFormEntity>
if (null == resultDTO) {
throw new RenException(EpmetErrorCode.CUSTOMER_FORM_NOT_EXITS.getCode(),EpmetErrorCode.CUSTOMER_FORM_NOT_EXITS.getMsg());
}
List<FormItem> itemList=baseDao.selectItemList(resultDTO.getFormId(),formDto.getDynamic());
List<FormItemResult> itemList=baseDao.selectItemList(resultDTO.getFormId(),formDto.getDynamic());
List<FormGroupDTO> groupList=baseDao.selectListGroup(resultDTO.getFormId());
resultDTO.setItemList(itemList);
resultDTO.setGroupList(groupList);
@ -144,13 +139,13 @@ public class IcFormServiceImpl extends BaseServiceImpl<IcFormDao, IcFormEntity>
}
@Override
public List<FormItem> listItems(String customerId, String formCode) {
public List<FormItemResult> listItems(String customerId, String formCode) {
// 从redis取
String icFormItemsKey = RedisKeys.getIcFormItemsKey(customerId, formCode);
Object objValue = redisUtils.get(icFormItemsKey);
if (objValue != null) {
return ((JSONArray) objValue).toJavaList(FormItem.class);
return ((JSONArray) objValue).toJavaList(FormItemResult.class);
//return JSON.parseObject((String) objValue, type);
}
@ -160,14 +155,14 @@ public class IcFormServiceImpl extends BaseServiceImpl<IcFormDao, IcFormEntity>
throw new RenException(EpmetErrorCode.CUSTOMER_FORM_NOT_EXITS.getCode(),EpmetErrorCode.CUSTOMER_FORM_NOT_EXITS.getMsg());
}
List<FormItem> formItems = baseDao.listItems(formResultDto.getFormId());
formItems.forEach(i -> {
List<FormItemResult> formItemResults = baseDao.listItems(formResultDto.getFormId());
formItemResults.forEach(i -> {
i.setOptions(baseDao.selectListOption(i.getItemId()));
});
// 缓存
redisUtils.set(icFormItemsKey, formItems);
redisUtils.set(icFormItemsKey, formItemResults);
return formItems;
return formItemResults;
}
}

8
epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcFormDao.xml

@ -17,7 +17,7 @@
</select>
<resultMap id="FormItemMap1" type="com.epmet.dto.result.FormItem">
<resultMap id="FormItemMap1" type="com.epmet.dto.result.FormItemResult">
<id property="itemId" column="item_id" ></id>
<result property="tableName" column="table_name"/>
<result property="parentItemId" column="PARENT_ITEM_ID"/>
@ -123,13 +123,13 @@
<result property="sort" column="sort"/>
<result property="supportAdd" column="SUPPORT_ADD"/>
<result property="tableName" column="TABLE_NAME"/>
<collection property="itemList" ofType="com.epmet.dto.result.FormItem2"
<collection property="itemList" ofType="com.epmet.dto.result.FormItemResult2"
column="group_id" select="com.epmet.dao.IcFormDao.selectItemListByGroupId">
</collection>
</resultMap>
<resultMap id="FormItemMap2" type="com.epmet.dto.result.FormItem2">
<resultMap id="FormItemMap2" type="com.epmet.dto.result.FormItemResult2">
<id property="itemId" column="item_id" ></id>
<result property="tableName" column="table_name"/>
<result property="parentItemId" column="PARENT_ITEM_ID"/>
@ -210,7 +210,7 @@
g.SORT ASC
</select>
<select id="listItems" resultType="com.epmet.dto.result.FormItem">
<select id="listItems" resultType="com.epmet.dto.result.FormItemResult">
SELECT fi.ID AS item_id,
case
when g.TABLE_NAME is null or g.TABLE_NAME = '' then 'ic_resi_user'

46
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StatsResiWarnCountFormDTO.java

@ -0,0 +1,46 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.List;
/**
* 预警统计表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-11-04
*/
@Data
public class StatsResiWarnCountFormDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 组织id
*/
@NotBlank(message = "用户id不能为空")
private String userId;
}

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

@ -29,10 +29,12 @@ import com.alibaba.fastjson.JSON;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.aop.NoRepeatSubmit;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.ExceptionUtils;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
@ -178,58 +180,21 @@ public class IcResiUserController {
* @throws Exception
*/
@RequestMapping(value = "/exportExcel2")
public void exportExcel(@RequestHeader String customerId, @RequestBody IcResiUserPageFormDTO pageFormDTO, HttpServletResponse response) throws Exception {
public void exportExcel(@RequestHeader String customerId,@LoginUser TokenDto tokenDto, @RequestBody IcResiUserPageFormDTO pageFormDTO, HttpServletResponse response) throws Exception {
CustomerStaffInfoCacheResult staffInfoCacheResult = CustomerStaffRedis.getStaffInfo(customerId, tokenDto.getUserId());
String staffOrgPath = null;
if (StringUtils.isNotBlank(staffInfoCacheResult.getAgencyPIds()) && !NumConstant.ZERO_STR.equals(staffInfoCacheResult.getAgencyPIds())) {
staffOrgPath = staffInfoCacheResult.getAgencyPIds().concat(":").concat(staffInfoCacheResult.getAgencyId());
}else{
staffOrgPath=staffInfoCacheResult.getAgencyId();
}
pageFormDTO.setCustomerId(customerId);
pageFormDTO.setPageFlag(false);
CustomerFormResultDTO resiFormItems = getResiFormItems(pageFormDTO.getCustomerId());
Map<String, Map<String, FormItem>> otherSheetItems = new HashMap<>();
CustomerFormResultDTO resiFormItems = getResiFormAddItems(pageFormDTO.getCustomerId());
//主表的
for (FormItem formItem : resiFormItems.getItemList()) {
if (StringUtils.isBlank(formItem.getColumnName())) {
continue;
}
Map<String, FormItem> itemMap = otherSheetItems.getOrDefault(formItem.getTableName(), new HashMap<>());
otherSheetItems.putIfAbsent(formItem.getTableName(), itemMap);
if (formItem.getItemType().equals("checkbox") || formItem.getItemType().equals("select") || formItem.getItemType().equals("radio")) {
itemMap.put(formItem.getColumnName().concat(formItem.getColumnNum() == 0 ? "" : formItem.getColumnNum().toString()), formItem);
}
if (formItem.getChildGroup() != null) {
itemMap = otherSheetItems.getOrDefault(formItem.getChildGroup().getTableName(), new HashMap<>());
otherSheetItems.putIfAbsent(formItem.getChildGroup().getTableName(), itemMap);
for (FormItem2 item2 : formItem.getChildGroup().getItemList()) {
if (StringUtils.isBlank(item2.getColumnName())) {
continue;
}
if ("checkbox".equals(item2.getItemType()) || "select".equals(item2.getItemType()) || "radio".equals(item2.getItemType())) {
itemMap.put(item2.getColumnName().concat(item2.getColumnNum() == 0 ? "" : item2.getColumnNum().toString()), ConvertUtils.sourceToTarget(item2, FormItem.class));
}
}
}
}
//其他sheet
for (FormGroupDTO groupItem : resiFormItems.getGroupList()) {
if (groupItem.getItemList() == null) {
continue;
}
Map<String, FormItem> itemMap = otherSheetItems.getOrDefault(groupItem.getTableName(), new HashMap<>());
otherSheetItems.putIfAbsent(groupItem.getTableName(), itemMap);
for (FormItem2 formItem2 : groupItem.getItemList()) {
if (StringUtils.isBlank(formItem2.getColumnName())) {
continue;
}
if ("checkbox".equals(formItem2.getItemType()) || "select".equals(formItem2.getItemType()) || "radio".equals(formItem2.getItemType())) {
itemMap.put(formItem2.getColumnName().concat(formItem2.getColumnNum() == 0 ? "" : formItem2.getColumnNum().toString()), ConvertUtils.sourceToTarget(formItem2, FormItem.class));
}
}
}
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());
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);
//resiMainList = (List<Map<String, Object>>)JSON.parse("[{\"IS_BDHJ\":\"1\",\"IS_SPECIAL\":\"1\",\"IS_XFRY\":\"0\",\"REMARKS\":\"beizhu\",\"IS_PARTY\":\"1\",\"icResiUserId\":\"yzmtest2\",\"HOME_ID\":\"中海国际社区一里城1号楼1单元101\",\"HOUSE_TYPE\":\"平房\",\"UNIT_NAME\":\"1单元\",\"GRID_ID\":\"市北区-市北区第三网格3\",\"IS_DB\":\"0\",\"GENDER\":\"男\",\"BIRTHDAY\":\"2021-10-04\",\"IS_VETERANS\":\"0\",\"IS_MB\":\"0\",\"IS_UNEMPLOYED\":\"0\",\"DEMAND_NAME\":null,\"IS_KC\":\"0\",\"IS_ENSURE_HOUSE\":\"0\",\"IS_SD\":\"0\",\"NAME\":\"尹作梅\",\"RDSJ\":null,\"IS_VOLUNTEER\":\"1\",\"GRID_ID_VALUE\":\"e74829ffc43d5470eba6b5e060c11e63\",\"IS_SZ\":\"0\",\"IS_CJ\":\"0\",\"HOME_ID_VALUE\":\"200\",\"DEMAND_CATEGORY_IDS\":null,\"VILLAGE_NAME\":\"中海国际社区一里城\",\"IS_DBH\":\"0\",\"IS_SN\":\"0\",\"BUILD_NAME\":\"1号楼\",\"IS_YLFN\":\"0\",\"IS_UNITED_FRONT\":\"0\",\"ID_CARD\":\"371325199310260529\",\"MOBILE\":\"15764229697\",\"IS_OLD_PEOPLE\":\"0\",\"DOOR_NAME\":\"101\"},{\"IS_SPECIAL\":\"1\",\"IS_XFRY\":\"0\",\"REMARKS\":\"beizhu\",\"IS_PARTY\":\"1\",\"icResiUserId\":\"yzmtest\",\"HOME_ID\":\"中海国际社区一里城1号楼1单元101\",\"HOUSE_TYPE\":\"平房\",\"UNIT_NAME\":\"1单元\",\"GRID_ID\":\"市北区-市北区第三网格3\",\"IS_DB\":\"0\",\"GENDER\":\"男\",\"BIRTHDAY\":\"2021-10-04\",\"IS_VETERANS\":\"0\",\"IS_MB\":\"0\",\"IS_UNEMPLOYED\":\"0\",\"DEMAND_NAME\":\"心理咨询\",\"IS_KC\":\"0\",\"IS_ENSURE_HOUSE\":\"0\",\"IS_SD\":\"0\",\"NAME\":\"尹作梅\",\"RDSJ\":\"2021-10-28 00:00:00\",\"IS_VOLUNTEER\":\"1\",\"GRID_ID_VALUE\":\"e74829ffc43d5470eba6b5e060c11e63\",\"IS_SZ\":\"0\",\"IS_CJ\":\"0\",\"HOME_ID_VALUE\":\"200\",\"DEMAND_CATEGORY_IDS\":\"10180002\",\"VILLAGE_NAME\":\"中海国际社区一里城\",\"IS_DBH\":\"0\",\"IS_SN\":\"0\",\"BUILD_NAME\":\"1号楼\",\"IS_YLFN\":\"0\",\"IS_UNITED_FRONT\":\"0\",\"ID_CARD\":\"371325199310260529\",\"MOBILE\":\"15764229697\",\"IS_OLD_PEOPLE\":\"0\",\"DOOR_NAME\":\"101\"}]");
log.info("resiMainList:{}", JSON.toJSONString(resiMainList));
String templatePath = "excel/ic_resi_info_cid.xls";
@ -241,12 +206,12 @@ public class IcResiUserController {
System.out.println("===resiMainList==="+" "+JSON.toJSONString(resiMainList.values()));
sheetMap.put(0, mapData);
AtomicInteger n = new AtomicInteger();
for (FormItem item : resiFormItems.getItemList()) {
for (FormItemResult item : resiFormItems.getItemList()) {
if (item.getChildGroup() != null) {
if (!item.getChildGroup().getTableName().equals(BASE_TABLE_NAME)) {
Map<String, FormItem> 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());
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);
//resiChildMap.forEach((key, value) -> value.putAll(resiMainList.get(key)));
Map<String, Object> mapData2 = new HashMap<>();
@ -263,58 +228,25 @@ public class IcResiUserController {
}
@RequestMapping(value = "/exportExcel")
public void exportExcelByEasyExcel(@RequestHeader String customerId, @RequestBody IcResiUserPageFormDTO pageFormDTO, HttpServletResponse response) throws Exception {
public void exportExcelByEasyExcel(@RequestHeader String customerId,@LoginUser TokenDto tokenDto, @RequestBody IcResiUserPageFormDTO pageFormDTO, HttpServletResponse response) throws Exception {
//tokenDto.setUserId("9e37adcce6472152e6508a19d3683e02");
CustomerStaffInfoCacheResult staffInfoCacheResult = CustomerStaffRedis.getStaffInfo(customerId, tokenDto.getUserId());
String staffOrgPath = null;
if (StringUtils.isNotBlank(staffInfoCacheResult.getAgencyPIds()) && !NumConstant.ZERO_STR.equals(staffInfoCacheResult.getAgencyPIds())) {
staffOrgPath = staffInfoCacheResult.getAgencyPIds().concat(":").concat(staffInfoCacheResult.getAgencyId());
}else{
staffOrgPath=staffInfoCacheResult.getAgencyId();
}
pageFormDTO.setCustomerId(customerId);
pageFormDTO.setPageFlag(false);
CustomerFormResultDTO resiFormItems = getResiFormItems(pageFormDTO.getCustomerId());
CustomerFormResultDTO resiFormItems = getResiFormAddItems(pageFormDTO.getCustomerId());
Map<String, Map<String, FormItemResult>> otherSheetItems = buildItemMap(resiFormItems);
Map<String, Map<String, FormItem>> otherSheetItems = new HashMap<>();
/*List<FormItemResult> resiFormAllItems = getResiFormAllItems(pageFormDTO.getCustomerId());
resiFormAllItems.stream().collect(Collectors.groupingBy(e ->e.get));*/
//主表的
for (FormItem formItem : resiFormItems.getItemList()) {
if (StringUtils.isBlank(formItem.getColumnName())) {
continue;
}
Map<String, FormItem> itemMap = otherSheetItems.getOrDefault(formItem.getTableName(), new HashMap<>());
otherSheetItems.putIfAbsent(formItem.getTableName(), itemMap);
if (formItem.getItemType().equals("checkbox") || formItem.getItemType().equals("select") || formItem.getItemType().equals("radio")) {
itemMap.put(formItem.getColumnName().concat(formItem.getColumnNum() == 0 ? "" : formItem.getColumnNum().toString()), formItem);
}
if (formItem.getChildGroup() != null) {
itemMap = otherSheetItems.getOrDefault(formItem.getChildGroup().getTableName(), new HashMap<>());
otherSheetItems.putIfAbsent(formItem.getChildGroup().getTableName(), itemMap);
for (FormItem2 item2 : formItem.getChildGroup().getItemList()) {
if (StringUtils.isBlank(item2.getColumnName())) {
continue;
}
if ("checkbox".equals(item2.getItemType()) || "select".equals(item2.getItemType()) || "radio".equals(item2.getItemType())) {
itemMap.put(item2.getColumnName().concat(item2.getColumnNum() == 0 ? "" : item2.getColumnNum().toString()), ConvertUtils.sourceToTarget(item2, FormItem.class));
}
}
}
}
//其他sheet
for (FormGroupDTO groupItem : resiFormItems.getGroupList()) {
if (groupItem.getItemList() == null) {
continue;
}
Map<String, FormItem> itemMap = otherSheetItems.getOrDefault(groupItem.getTableName(), new HashMap<>());
otherSheetItems.putIfAbsent(groupItem.getTableName(), itemMap);
for (FormItem2 formItem2 : groupItem.getItemList()) {
if (StringUtils.isBlank(formItem2.getColumnName())) {
continue;
}
if ("checkbox".equals(formItem2.getItemType()) || "select".equals(formItem2.getItemType()) || "radio".equals(formItem2.getItemType())) {
itemMap.put(formItem2.getColumnName().concat(formItem2.getColumnNum() == 0 ? "" : formItem2.getColumnNum().toString()), ConvertUtils.sourceToTarget(formItem2, FormItem.class));
}
}
}
Map<String, Map<String, Object>> resiMainList = icResiUserService.getDataForExport(otherSheetItems.get(BASE_TABLE_NAME),new HashMap<>(), pageFormDTO.getCustomerId(), pageFormDTO.getFormCode(), BASE_TABLE_NAME, pageFormDTO.getConditions());
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);
//=========================================
String templatePath = "excel/ic_resi_info_cid_for_easy_excel.xlsx";
@ -329,12 +261,12 @@ public class IcResiUserController {
//=======================================
AtomicInteger n = new AtomicInteger();
for (FormItem item : resiFormItems.getItemList()) {
for (FormItemResult item : resiFormItems.getItemList()) {
if (item.getChildGroup() != null) {
if (!item.getChildGroup().getTableName().equals(BASE_TABLE_NAME)) {
Map<String, FormItem> 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());
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);
//resiChildMap.forEach((key, value) -> value.putAll(resiMainList.get(key)));
int sheetNo = n.incrementAndGet();
@ -348,6 +280,57 @@ public class IcResiUserController {
excelWriter.finish();
}
@NotNull
private Map<String, Map<String, FormItemResult>> buildItemMap(CustomerFormResultDTO resiFormItems) {
Map<String, Map<String, FormItemResult>> otherSheetItems = new HashMap<>();
//主表的
for (FormItemResult formItemResult : resiFormItems.getItemList()) {
if (StringUtils.isBlank(formItemResult.getColumnName())) {
continue;
}
Map<String, FormItemResult> itemMap = otherSheetItems.getOrDefault(formItemResult.getTableName(), new HashMap<>());
otherSheetItems.putIfAbsent(formItemResult.getTableName(), itemMap);
if (formItemResult.getItemType().equals("checkbox") || formItemResult.getItemType().equals("select") || formItemResult.getItemType().equals("radio")) {
itemMap.put(formItemResult.getColumnName().concat(formItemResult.getColumnNum() == 0 ? "" : formItemResult.getColumnNum().toString()), formItemResult);
}
if (formItemResult.getChildGroup() != null) {
itemMap = otherSheetItems.getOrDefault(formItemResult.getChildGroup().getTableName(), new HashMap<>());
otherSheetItems.putIfAbsent(formItemResult.getChildGroup().getTableName(), itemMap);
for (FormItemResult2 item2 : formItemResult.getChildGroup().getItemList()) {
if (StringUtils.isBlank(item2.getColumnName())) {
continue;
}
if ("checkbox".equals(item2.getItemType()) || "select".equals(item2.getItemType()) || "radio".equals(item2.getItemType())) {
itemMap.put(item2.getColumnName().concat(item2.getColumnNum() == 0 ? "" : item2.getColumnNum().toString()), ConvertUtils.sourceToTarget(item2, FormItemResult.class));
}
}
}
}
//其他sheet
for (FormGroupDTO groupItem : resiFormItems.getGroupList()) {
if (groupItem.getItemList() == null) {
continue;
}
Map<String, FormItemResult> itemMap = otherSheetItems.getOrDefault(groupItem.getTableName(), new HashMap<>());
otherSheetItems.putIfAbsent(groupItem.getTableName(), itemMap);
for (FormItemResult2 formItemResult2 : groupItem.getItemList()) {
if (StringUtils.isBlank(formItemResult2.getColumnName())) {
continue;
}
if ("checkbox".equals(formItemResult2.getItemType()) || "select".equals(formItemResult2.getItemType()) || "radio".equals(formItemResult2.getItemType())) {
itemMap.put(formItemResult2.getColumnName().concat(formItemResult2.getColumnNum() == 0 ? "" : formItemResult2.getColumnNum().toString()), ConvertUtils.sourceToTarget(formItemResult2, FormItemResult.class));
}
}
}
return otherSheetItems;
}
private static OutputStream getOutputStream(String fileName, HttpServletResponse response) throws Exception {
fileName = URLEncoder.encode(fileName, "UTF-8");
response.setContentType("application/vnd.ms-excel");
@ -397,13 +380,14 @@ public class IcResiUserController {
}
@PostMapping("test")
public Result<List<Map<String, Object>>> test(@RequestBody DynamicQueryFormDTO formDTO) {
public Result<List<Map<String, Object>>> test(@LoginUser TokenDto tokenDto,@RequestBody DynamicQueryFormDTO formDTO) {
formDTO.setCustomerId("45687aa479955f9d06204d415238f7cc");
//formDTO.setCustomerId(tokenDto.getCustomerId());
return new Result<List<Map<String, Object>>>().ok(icResiUserService.dynamicQuery(formDTO.getCustomerId(),
formDTO.getFormCode(),
formDTO.getResultTableName(),
formDTO.getConditions()));
formDTO.getConditions(),
tokenDto.getUserId(),null));
}
/**
@ -431,7 +415,7 @@ public class IcResiUserController {
}
@NotNull
private CustomerFormResultDTO getResiFormItems(String customerId) {
private CustomerFormResultDTO getResiFormAddItems(String customerId) {
CustomerFormQueryDTO queryDTO = new CustomerFormQueryDTO();
queryDTO.setFormCode("resi_base_info");
queryDTO.setCustomerId(customerId);
@ -443,6 +427,19 @@ public class IcResiUserController {
return resultForm.getData();
}
@NotNull
private List<FormItemResult> getResiFormAllItems(String customerId) {
CustomerFormQueryDTO queryDTO = new CustomerFormQueryDTO();
queryDTO.setFormCode("resi_base_info");
queryDTO.setCustomerId(customerId);
Result<List<FormItemResult>> resultForm = operCustomizeOpenFeignClient.listItems(queryDTO);
if (resultForm == null || !resultForm.success() || resultForm.getData() == null) {
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode());
}
System.out.println(JSON.toJSONString(resultForm.getData()));
return resultForm.getData();
}
/**
* @Description 个人信息-家庭关系
* @Param formDTO

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

@ -23,6 +23,7 @@ import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dto.form.StatsResiListFormDTO;
import com.epmet.dto.form.StatsResiWarnCountFormDTO;
import com.epmet.dto.form.StatsResiWarnFormDTO;
import com.epmet.dto.result.IcStatsResiResultDTO;
import com.epmet.dto.result.IcStatsResiWarnBuildingResultDTO;
@ -83,7 +84,7 @@ public class StatsResiWarnController {
}
/**
* 统计
* 统计所有
* @return
*/
@PostMapping("resiwarn")
@ -91,5 +92,11 @@ public class StatsResiWarnController {
statsResiWarnService.resiWarn(tokenDto.getCustomerId());
return new Result();
}
@PostMapping("resiWarnByOne")
public Result resiWarnByOne(@LoginUser TokenDto tokenDto,@RequestBody StatsResiWarnCountFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO);
statsResiWarnService.resiWarnByOne(tokenDto.getCustomerId(),formDTO.getUserId());
return new Result();
}
}

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

@ -100,7 +100,9 @@ public interface IcResiUserDao extends BaseDao<IcResiUserEntity> {
List<Map<String,Object>> dynamicQuery(@Param("customerId")String customerId,
@Param("resultTableName")String resultTableName,
@Param("conditions") List<ResiUserQueryValueDTO> conditions,
@Param("subTables") List<String> subTables);
@Param("subTables") List<String> subTables,
@Param("currentStaffAgencyId")String currentStaffAgencyId,
@Param("staffOrgPath")String staffOrgPath);
/**
* @Description 查询个人信息

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

@ -46,4 +46,6 @@ public interface IcStatsResiWarnDao extends BaseDao<IcStatsResiWarnEntity> {
@Param("level")String level);
List<IcStatsResiWarnEntity> resiWarn(@Param("tableName") String tableName,@Param("columnName") String columnName);
IcStatsResiWarnEntity resiWarnById(@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

@ -80,7 +80,9 @@ public interface IcResiUserService extends BaseService<IcResiUserEntity> {
List<Map<String,Object>> dynamicQuery(String customerId,
String formCode,
String resultTableName,
List<ResiUserQueryValueDTO> conditions);
List<ResiUserQueryValueDTO> conditions,
String currentStaffAgencyId,
String staffOrgPath);
/**
* @Description 查询个人数据
@ -111,7 +113,8 @@ public interface IcResiUserService extends BaseService<IcResiUserEntity> {
* @param conditions
* @return
*/
Map<String, Map<String, Object>> getDataForExport(Map<String, FormItem> itemList, Map<String, Map<String, Object>> resiMainList, String customerId, String formCode, String baseTableName, List<ResiUserQueryValueDTO> conditions);
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,
String staffOrgPath);
/**
* @Description 家庭关系

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

@ -38,4 +38,6 @@ public interface StatsResiWarnService{
List<IcStatsResiResultDTO> list(String id, String level);
void resiWarn(String customerId);
void resiWarnByOne(String customerId,String userId);
}

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

@ -5,7 +5,6 @@ import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.EasyExcelFactory;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.dto.result.OptionResultDTO;
@ -21,7 +20,7 @@ import com.epmet.dto.form.AgencyIdFormDTO;
import com.epmet.dto.form.CustomerFormQueryDTO;
import com.epmet.dto.form.HouseFormDTO;
import com.epmet.dto.form.LoginUserDetailsFormDTO;
import com.epmet.dto.result.FormItem;
import com.epmet.dto.result.FormItemResult;
import com.epmet.dto.result.LoginUserDetailsResultDTO;
import com.epmet.dto.result.OptionDTO;
import com.epmet.entity.IcResiUserEntity;
@ -262,7 +261,7 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
Map<Integer, List<String>> headers = mergeHead(headList);
// 查询form相关信息
List<FormItem> customerItems = listFormItems(IMPORT_IC_RESI_FORM_CODE);
List<FormItemResult> customerItems = listFormItems(IMPORT_IC_RESI_FORM_CODE);
// 清洗表头数据
Map<Integer, String> abandonedHeaders = washHeaders(headers, customerItems);
@ -271,7 +270,7 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
HashMap<String, List<Integer>> combinedHeaders = combineHeaders(headers);
// 得到客户配置item数据
Map<String, FormItem> formItemMap = customerItems.stream().collect(
Map<String, FormItemResult> formItemMap = customerItems.stream().collect(
Collectors.toMap(formItem -> {
String groupLabel = formItem.getGroupLabel();
String label = formItem.getLabel();
@ -311,7 +310,7 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
Map<Integer, List<String>> headers = mergeHead(headList);
// 查询form相关信息
List<FormItem> customerItems = listFormItems(IMPORT_IC_RESI_FORM_CODE);
List<FormItemResult> customerItems = listFormItems(IMPORT_IC_RESI_FORM_CODE);
// 清洗表头数据
Map<Integer, String> abandonedHeaders = washHeaders(headers, customerItems);
@ -320,7 +319,7 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
HashMap<String, List<Integer>> combinedHeaders = combineHeaders(headers);
// 得到客户配置item数据
Map<String, FormItem> formItemMap = customerItems.stream().collect(
Map<String, FormItemResult> formItemMap = customerItems.stream().collect(
Collectors.toMap(formItem -> {
String groupLabel = formItem.getGroupLabel();
String label = formItem.getLabel();
@ -461,7 +460,7 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
// skipedRow.setInfo("信息已存在,跳过导入");
// skipedRow.setTableName(targetTableName);
// skipedRows.get().get(targetTableName).add(skipedRow);
//
//
// continue;
//}
@ -603,10 +602,10 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
* @param formCode
* @return
*/
private List<FormItem> listFormItems(String formCode) {
private List<FormItemResult> listFormItems(String formCode) {
CustomerFormQueryDTO form = new CustomerFormQueryDTO();
form.setFormCode(formCode);
Result<List<FormItem>> result = operCustomizeOpenFeignClient.listItems(form);
Result<List<FormItemResult>> result = operCustomizeOpenFeignClient.listItems(form);
return getResultDataOrThrowsException(result, ServiceConstant.OPER_CUSTOMIZE_SERVER, EpmetErrorCode.SERVER_ERROR.getCode(), "【居民信息excel导入】查询表单相关信息失败");
}
@ -643,7 +642,7 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
* @author wxz
* @date 2021.10.28 21:07:12
*/
private Map<Integer, String> washHeaders(Map<Integer, List<String>> headers, List<FormItem> items) {
private Map<Integer, String> washHeaders(Map<Integer, List<String>> headers, List<FormItemResult> items) {
List<String> itemLabels = items.stream().map(i -> i.getLabel()).collect(Collectors.toList());
Map<Integer, String> abandonedHeaders = new HashMap<>();
for (Map.Entry<Integer, List<String>> entry:headers.entrySet()) {
@ -675,7 +674,7 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
* @param abandonedHeaders
* @return
*/
private Map<String, ColumnWrapper> convertExcelHeaders2DBColumnWrappers(Map<String, FormItem> formItemMap, Map<String, List<Integer>> combinedHeaders,
private Map<String, ColumnWrapper> convertExcelHeaders2DBColumnWrappers(Map<String, FormItemResult> formItemMap, Map<String, List<Integer>> combinedHeaders,
List<Map<Integer, String>> datas, Map<Integer, String> abandonedHeaders) {
// HashMap<String, List<ColumnWrapper>> tables = new HashMap<>();
@ -684,7 +683,7 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
for (Map.Entry<String, List<Integer>> entry : combinedHeaders.entrySet()) {
String combinedHeader = entry.getKey();
FormItem item = formItemMap.get(combinedHeader);
FormItemResult item = formItemMap.get(combinedHeader);
if (item == null) {
// 如果数据库中没有该项,可能是用户自己定义的项,忽略

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

@ -290,6 +290,8 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
String staffOrgPath=StrConstant.EPMETY_STR;
if(StringUtils.isNotBlank(staffInfoCacheResult.getAgencyPIds())&& !NumConstant.ZERO_STR.equals(staffInfoCacheResult.getAgencyPIds())){
staffOrgPath=staffInfoCacheResult.getAgencyPIds().concat(":").concat(staffInfoCacheResult.getAgencyId());
}else{
staffOrgPath=staffInfoCacheResult.getAgencyId();
}
// 查询列表展示项,如果没有,直接返回
@ -467,16 +469,19 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
public List<Map<String,Object>> dynamicQuery(String customerId,
String formCode,
String resultTableName,
List<ResiUserQueryValueDTO> conditions){
List<ResiUserQueryValueDTO> conditions,
String currentStaffAgencyId,
String staffOrgPath){
CustomerFormQueryDTO queryDTO=new CustomerFormQueryDTO();
queryDTO.setCustomerId(customerId);
queryDTO.setFormCode(formCode);
//所有的子表
Result<List<String>> subTablesRes=operCustomizeOpenFeignClient.querySubTables(queryDTO);
List<String> subTables=new ArrayList<>();
if(subTablesRes.success()&&CollectionUtils.isNotEmpty(subTablesRes.getData())){
subTables =subTablesRes.getData();
}
return baseDao.dynamicQuery(customerId,resultTableName,conditions,subTables);
return baseDao.dynamicQuery(customerId,resultTableName,conditions,subTables,currentStaffAgencyId,staffOrgPath);
}
/**
@ -616,8 +621,10 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
* @return
*/
@Override
public Map<String, Map<String, Object>> getDataForExport(Map<String, FormItem> formItemMap, Map<String, Map<String, Object>> resiMainList, String customerId, String formCode, String baseTableName, List<ResiUserQueryValueDTO> conditions) {
List<Map<String, Object>> mapList = this.dynamicQuery(customerId, formCode, baseTableName, conditions);
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,
String currentStaffAgencyId,
String staffOrgPath) {
List<Map<String, Object>> mapList = this.dynamicQuery(customerId, formCode, baseTableName, conditions,currentStaffAgencyId,staffOrgPath);
Map<String, Map<String, Object>> result = new LinkedHashMap<>();
mapList.stream().filter(Objects::nonNull).forEach(map -> {
map.forEach((k,o) -> {
@ -640,9 +647,9 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
return;
}
result.put(resiId, map);
for (Map.Entry<String, FormItem> e : formItemMap.entrySet()) {
for (Map.Entry<String, FormItemResult> e : formItemMap.entrySet()) {
String k = e.getKey();
FormItem v = e.getValue();
FormItemResult v = e.getValue();
Object temp = map.get(k);
String vauleStr = temp == null ? "" : temp.toString();

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

@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dao.IcResiUserDao;
import com.epmet.dao.IcStatsResiWarnDao;
import com.epmet.dto.IcResiCategoryStatsConfigDTO;
import com.epmet.dto.IcResiCategoryWarnConfigDTO;
@ -12,6 +13,7 @@ import com.epmet.dto.result.BuildingResultDTO;
import com.epmet.dto.result.IcStatsResiResultDTO;
import com.epmet.dto.result.IcStatsResiWarnBuildingResultDTO;
import com.epmet.dto.result.IcStatsResiWarnUserResultDTO;
import com.epmet.entity.IcResiUserEntity;
import com.epmet.entity.IcStatsResiWarnEntity;
import com.epmet.feign.GovOrgOpenFeignClient;
import com.epmet.feign.OperCustomizeOpenFeignClient;
@ -46,6 +48,9 @@ public class StatsResiWarnServiceImpl implements StatsResiWarnService {
@Autowired
private OperCustomizeOpenFeignClient operCustomizeOpenFeignClient;
@Resource
private IcResiUserDao icResiUserDao;
@Override
public List<IcStatsResiWarnBuildingResultDTO> buildingwWarnList(String agencyID) {
List<IcStatsResiWarnBuildingResultDTO> result = new ArrayList<>();
@ -207,4 +212,59 @@ public class StatsResiWarnServiceImpl implements StatsResiWarnService {
icStatsResiWarnService.insertBatch(icStatsResiWarnEntities,500);
}
@Override
public void resiWarnByOne(String customerId, String userId) {
// 获取预警配置项
Result<List<IcResiCategoryWarnConfigDTO>> warnResult = operCustomizeOpenFeignClient.resiCategoryWarnList();
if (!warnResult.success() || null == warnResult.getData()) {
throw new RenException("预警配置查询失败:"+ warnResult.getMsg());
}
List<IcResiCategoryWarnConfigDTO> icResiCategoryWarnConfigDTOList = warnResult.getData();
IcResiUserEntity icResiUserEntity = icResiUserDao.selectById(userId);
if(null == icResiUserEntity){
return ;
}
//保存数据
for (IcResiCategoryWarnConfigDTO item : icResiCategoryWarnConfigDTOList) {
//查询这个用户信息
IcStatsResiWarnEntity icStatsResiWarn = icStatsResiWarnDao.selectOne(new QueryWrapper<IcStatsResiWarnEntity>().lambda()
.eq(IcStatsResiWarnEntity::getConfigId,item.getId())
.eq(IcStatsResiWarnEntity::getAgencyId, icResiUserEntity.getAgencyId())
.eq(IcStatsResiWarnEntity::getGridId, icResiUserEntity.getGridId())
.eq(IcStatsResiWarnEntity::getNeighborHoodId, icResiUserEntity.getVillageId())
.eq(IcStatsResiWarnEntity::getBuildingId, icResiUserEntity.getBuildId()));
if(null == icStatsResiWarn){
//如果不存在,新增统计数量
icStatsResiWarn = new IcStatsResiWarnEntity();
icStatsResiWarn.setAgencyId(icResiUserEntity.getAgencyId());
icStatsResiWarn.setAgencyPids(icResiUserEntity.getPids());
icStatsResiWarn.setGridId(icResiUserEntity.getGridId());
icStatsResiWarn.setNeighborHoodId(icResiUserEntity.getVillageId());
icStatsResiWarn.setBuildingId(icResiUserEntity.getBuildId());
icStatsResiWarn.setConfigId(item.getId());
icStatsResiWarn.setCustomerId(customerId);
IcStatsResiWarnEntity resiWarnEntity = icStatsResiWarnDao.resiWarnById(item.getTableName(), item.getColumnName(),icStatsResiWarn);
if(null == resiWarnEntity){
continue;
}
icStatsResiWarn.setCount(resiWarnEntity.getCount());
icStatsResiWarnDao.insert(icStatsResiWarn);
}else{
//如果存在,更新统计数量
IcStatsResiWarnEntity resiWarnEntity = icStatsResiWarnDao.resiWarnById(item.getTableName(), item.getColumnName(),icStatsResiWarn);
icStatsResiWarn.setCount(resiWarnEntity.getCount());
icStatsResiWarn.setCustomerId(customerId);
icStatsResiWarnDao.updateById(icStatsResiWarn);
}
}
}
}

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

@ -47,6 +47,9 @@ public class StatsStaffPatrolRecordDailyServiceImpl extends BaseServiceImpl<Stat
return result;
}
public static void main(String[] args) {
System.out.println(DateUtils.getBeforeNDay(NumConstant.ZERO));
}
/**
* @Description 查询巡查次数和时长
* @Param agencyId

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

@ -143,7 +143,7 @@
</if>
<where>
<include refid="listWhere"></include>
<include refid="listWhereForPage"></include>
</where>
group by IC_RESI_USER.id
order by ic_resi_user.CREATED_TIME desc

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

@ -103,4 +103,26 @@
and DEL_FLAG = '0'
group by AGENCY_ID,GRID_ID,VILLAGE_ID,BUILD_ID
</select>
<select id="resiWarnById" resultType="com.epmet.entity.IcStatsResiWarnEntity">
SELECT
AGENCY_ID as agencyId,
PIDS as agencyPids,
GRID_ID as gridId,
VILLAGE_ID as neighborHoodId,
BUILD_ID as buildingId,
count(*) as count
from ic_resi_user
where 1=1
<if test="tableName=='ic_resi_user'">
and ${columnName} = '1'
</if>
<if test="tableName!='ic_resi_user'">
and ID in (
select IC_RESI_USER from ${tableName} where ${columnName} = '1' and DEL_FLAG = '0'
)
</if>
and DEL_FLAG = '0'
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
</select>
</mapper>

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

@ -11,7 +11,7 @@ import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.CustomerFormQueryDTO;
import com.epmet.dto.result.CustomerFormResultDTO;
import com.epmet.dto.result.FormGroupDTO;
import com.epmet.dto.result.FormItem;
import com.epmet.dto.result.FormItemResult;
import com.epmet.feign.OperCustomizeOpenFeignClient;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
@ -75,7 +75,7 @@ public class IcResiUserControllerTest {
private Map<String,List<ExcelExportEntity>> buildHeaderByItem(CustomerFormResultDTO resultForm) {
//form中的itemlist 为一级表头 但是要排除每个item中含有childGroup的
List<FormItem> itemList = resultForm.getItemList();
List<FormItemResult> itemList = resultForm.getItemList();
List<FormGroupDTO> groupList = resultForm.getGroupList();
Map<String,List<ExcelExportEntity>> everySheetHeaderMap = new LinkedHashMap<>();
@ -155,7 +155,7 @@ public class IcResiUserControllerTest {
return everySheetHeaderMap;
}
private void buildHeader(Map<String, List<ExcelExportEntity>> everySheetHeaderMap, FormItem item, ExcelExportEntity header) {
private void buildHeader(Map<String, List<ExcelExportEntity>> everySheetHeaderMap, FormItemResult item, ExcelExportEntity header) {
List<ExcelExportEntity> firstSheetHeaderList = new ArrayList<>();
List<ExcelExportEntity> secondHeaderList = new ArrayList<>();
item.getChildGroup().getItemList().forEach(item2->{

Loading…
Cancel
Save