Browse Source

Merge remote-tracking branch 'remotes/origin/dev_ic_platform' into develop

master
jianjun 4 years ago
parent
commit
8ffb38a718
  1. 6
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/ResiCategoryStatsConfigController.java
  2. 22
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/ResiCategoryStatsConfigServiceImpl.java
  3. 9
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java
  4. 15
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StatsResiWarnController.java
  5. 18
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcStatsResiWarnDao.java
  6. 5
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java
  7. 6
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/StatsResiWarnService.java
  8. 30
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java
  9. 40
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StatsResiWarnServiceImpl.java
  10. BIN
      epmet-user/epmet-user-server/src/main/resources/excel/ic_resi_info_cid.xls
  11. BIN
      epmet-user/epmet-user-server/src/main/resources/excel/ic_resi_info_cid_for_easy_excel.xls
  12. BIN
      epmet-user/epmet-user-server/src/main/resources/excel/ic_resi_info_cid_for_easy_excel.xlsx
  13. 16
      epmet-user/epmet-user-server/src/main/resources/mapper/IcStatsResiWarnDao.xml

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

@ -134,10 +134,11 @@ public class ResiCategoryStatsConfigController {
}
@PostMapping("resicategorystatslistshowd")
public Result<List<IcResiCategoryStatsConfigDTO>> resiCategoryStatsListShowd(){
public Result<List<IcResiCategoryStatsConfigDTO>> resiCategoryStatsListShowd(@LoginUser TokenDto tokenDTO){
//获取预警配置列表
List<IcResiCategoryStatsConfigEntity> statsConfigEntityList = icResiCategoryStatsConfigDao.selectList(new QueryWrapper<IcResiCategoryStatsConfigEntity>()
.lambda()
.eq(IcResiCategoryStatsConfigEntity::getCustomerId,tokenDTO.getCustomerId())
.eq(IcResiCategoryStatsConfigEntity::getStatus,"show")
.orderByAsc(IcResiCategoryStatsConfigEntity::getSort));
@ -145,10 +146,11 @@ public class ResiCategoryStatsConfigController {
}
@PostMapping("resicategorywarnlist")
public Result<List<IcResiCategoryWarnConfigDTO>> resiCategoryWarnList(){
public Result<List<IcResiCategoryWarnConfigDTO>> resiCategoryWarnList(@LoginUser TokenDto tokenDTO){
//获取预警配置列表
List<IcResiCategoryWarnConfigEntity> warnConfigEntityList = icResiCategoryWarnConfigDao.selectList(new QueryWrapper<IcResiCategoryWarnConfigEntity>()
.lambda()
.eq(IcResiCategoryWarnConfigEntity::getCustomerId,tokenDTO.getCustomerId())
.orderByAsc(IcResiCategoryWarnConfigEntity::getSort));
return new Result<List<IcResiCategoryWarnConfigDTO>>().ok(ConvertUtils.sourceToTarget(warnConfigEntityList, IcResiCategoryWarnConfigDTO.class));

22
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)
public List<IcResiCategoryStatsConfigResultDTO> list(String customerId) {
//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)){
return new ArrayList<>();
}
Set<String> groupIds = icFormItemEntityList.stream().filter(item-> !"0".equals(item.getItemGroupId())).map(item->item.getItemGroupId()).collect(Collectors.toSet());
List<IcFormItemGroupEntity> icFormItemGroupEntityList = new ArrayList<>();
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
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 表中的数据
List<IcResiCategoryStatsConfigEntity> statsConfigEntityList = icResiCategoryStatsConfigDao.selectList(null);
List<IcResiCategoryWarnConfigEntity> warnConfigEntityList = icResiCategoryWarnConfigDao.selectList(null);
List<IcResiCategoryStatsConfigEntity> statsConfigEntityList = icResiCategoryStatsConfigDao.selectList(new QueryWrapper<IcResiCategoryStatsConfigEntity>().lambda().eq(IcResiCategoryStatsConfigEntity::getCustomerId,customerId));
List<IcResiCategoryWarnConfigEntity> warnConfigEntityList = icResiCategoryWarnConfigDao.selectList(new QueryWrapper<IcResiCategoryWarnConfigEntity>().lambda().eq(IcResiCategoryWarnConfigEntity::getCustomerId,customerId));
//3.新增不存在的,删除不在tableColumnMap的
Map<String,IcResiCategoryStatsConfigEntity> statsTableColumnMap = new HashMap<>();
@ -129,8 +129,11 @@ public class ResiCategoryStatsConfigServiceImpl implements ResiCategoryStatsConf
}
//4.返回数据
List<IcResiCategoryStatsConfigEntity> statsConfigList = icResiCategoryStatsConfigDao.selectList(new QueryWrapper<IcResiCategoryStatsConfigEntity>().lambda().orderByAsc(IcResiCategoryStatsConfigEntity::getSort));
List<IcResiCategoryWarnConfigEntity> warnConfigList = icResiCategoryWarnConfigDao.selectList(null);
List<IcResiCategoryStatsConfigEntity> statsConfigList = icResiCategoryStatsConfigDao.selectList(new QueryWrapper<IcResiCategoryStatsConfigEntity>().lambda()
.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<>();
warnConfigList.forEach(item->{
warnMap.put(item.getTableName()+"-"+item.getColumnName(),item);
@ -169,6 +172,7 @@ public class ResiCategoryStatsConfigServiceImpl implements ResiCategoryStatsConf
return result;
}
IcResiCategoryWarnConfigEntity icResiCategoryWarnConfigEntity = icResiCategoryWarnConfigDao.selectOne(new QueryWrapper<IcResiCategoryWarnConfigEntity>().lambda()
.eq(IcResiCategoryWarnConfigEntity::getCustomerId, icResiCategoryStatsConfigDTO.getCustomerId())
.eq(IcResiCategoryWarnConfigEntity::getTableName, icResiCategoryStatsConfigDTO.getTableName())
.eq(IcResiCategoryWarnConfigEntity::getColumnName, icResiCategoryStatsConfigDTO.getColumnName()));
@ -207,6 +211,7 @@ public class ResiCategoryStatsConfigServiceImpl implements ResiCategoryStatsConf
if(IcResiCategoryStatsConfigConstant.WARN_YES.equals(formDTO.getWarn())){
//更新
IcResiCategoryWarnConfigEntity icResiCategoryWarnConfigEntity = icResiCategoryWarnConfigDao.selectOne(new QueryWrapper<IcResiCategoryWarnConfigEntity>().lambda()
.eq(IcResiCategoryWarnConfigEntity::getCustomerId,customerId)
.eq(IcResiCategoryWarnConfigEntity::getTableName, icResiCategoryStatsConfigDTO.getTableName())
.eq(IcResiCategoryWarnConfigEntity::getColumnName, icResiCategoryStatsConfigDTO.getColumnName()));
if(null == icResiCategoryWarnConfigEntity){
@ -234,6 +239,7 @@ public class ResiCategoryStatsConfigServiceImpl implements ResiCategoryStatsConf
}else if(IcResiCategoryStatsConfigConstant.WARN_NO.equals(formDTO.getWarn())){
//删除
icResiCategoryWarnConfigDao.delete(new QueryWrapper<IcResiCategoryWarnConfigEntity>().lambda()
.eq(IcResiCategoryWarnConfigEntity::getCustomerId,customerId)
.eq(IcResiCategoryWarnConfigEntity::getTableName,icResiCategoryStatsConfigDTO.getTableName())
.eq(IcResiCategoryWarnConfigEntity::getColumnName,icResiCategoryStatsConfigDTO.getColumnName()));
}
@ -267,8 +273,8 @@ public class ResiCategoryStatsConfigServiceImpl implements ResiCategoryStatsConf
}
icResiCategoryStatsConfigService.updateBatchById(entityList);
//排序更新预警的
List<IcResiCategoryStatsConfigEntity> statsConfigEntityList = icResiCategoryStatsConfigDao.selectList(null);
List<IcResiCategoryWarnConfigEntity> warnConfigEntityList = icResiCategoryWarnConfigDao.selectList(null);
List<IcResiCategoryStatsConfigEntity> statsConfigEntityList = icResiCategoryStatsConfigDao.selectList(new QueryWrapper<IcResiCategoryStatsConfigEntity>().lambda().eq(IcResiCategoryStatsConfigEntity::getCustomerId,customerId));
List<IcResiCategoryWarnConfigEntity> warnConfigEntityList = icResiCategoryWarnConfigDao.selectList(new QueryWrapper<IcResiCategoryWarnConfigEntity>().lambda().eq(IcResiCategoryWarnConfigEntity::getCustomerId,customerId));
if(CollectionUtils.isEmpty(warnConfigEntityList)){
return ;
}

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

@ -181,6 +181,7 @@ public class IcResiUserController {
*/
@RequestMapping(value = "/exportExcel2")
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());
String staffOrgPath = null;
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, 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\"}]");
log.info("resiMainList:{}", JSON.toJSONString(resiMainList));
String templatePath = "excel/ic_resi_info_cid.xls";
@ -211,7 +212,7 @@ public class IcResiUserController {
if (item.getChildGroup() != null) {
if (!item.getChildGroup().getTableName().equals(BASE_TABLE_NAME)) {
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)));
Map<String, Object> mapData2 = new HashMap<>();
@ -246,7 +247,7 @@ public class IcResiUserController {
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";
@ -266,7 +267,7 @@ public class IcResiUserController {
if (item.getChildGroup() != null) {
if (!item.getChildGroup().getTableName().equals(BASE_TABLE_NAME)) {
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)));
int sheetNo = n.incrementAndGet();

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

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

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

@ -35,17 +35,27 @@ import java.util.Map;
@Mapper
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(
@Param("customerId") String customerId,
@Param("tableName") String tableName,
@Param("columnName") String columnName,
@Param("id")String id,
@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);
List<IcStatsResiWarnEntity> resiWarn(@Param("customerId") String customerId,
@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);
}

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

@ -107,13 +107,10 @@ public interface IcResiUserService extends BaseService<IcResiUserEntity> {
*
* @param itemList
* @param resiMainList
* @param customerId
* @param formCode
* @param baseTableName
* @param conditions
* @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);
/**

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{
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);

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

@ -614,19 +614,17 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
*
* @param formItemMap key 表名 value formItem
* @param resiMainList
* @param customerId
* @param formCode
* @param baseTableName
* @param conditions
* @return
*/
@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 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<>();
mapList.stream().filter(Objects::nonNull).forEach(map -> {
//遍历所有字段 格式化时间字段
map.forEach((k,o) -> {
if (o instanceof java.sql.Date){
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);
}
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)) {
resiId = (String) map.get("ID");
}else {
resiId = (String) map.get(UserConstant.IC_RESI_USER);
}
if (StringUtils.isBlank(resiId)){
log.error("getDataForExport error,resiId:{}",resiId);
log.error("getDataForExport error,resiId is net exist:{}",map);
return;
}
//把人放进去
result.put(resiId, map);
for (Map.Entry<String, FormItemResult> e : formItemMap.entrySet()) {
String k = e.getKey();
FormItemResult v = e.getValue();
@ -658,13 +665,12 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
Map<String, IcResiUserImportServiceImpl.ColumnWrapper> columnWrappers = new HashMap<>();
if (v.getItemId().equals("1078")) {
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();
value.setColValue(gridId.toString());
columnWrappers.put("1001", value);
}
//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())) {
stringMap.forEach((label, value) -> map.put(value, vauleStr.contains(value) ? "是" : "否"));
} else if ("select".equals(v.getItemType())) {
@ -704,15 +710,15 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
map.putAll(resiMainList.get(resiId));
return;
}
Object gridId = map.get(UserConstant.GRID_ID);
if (gridId != null) {
/*if (gridId != null) {
CustomerGridFormDTO formDTO = new CustomerGridFormDTO();
formDTO.setGridId(gridId.toString());
Result<CustomerGridDTO> gridInfoRes = govOrgOpenFeignClient.getGridBaseInfoByGridId(formDTO);
if (gridInfoRes != null && gridInfoRes.success() && gridInfoRes.getData() != null) {
map.put(UserConstant.GRID_NAME, gridInfoRes.getData().getGridName());
}
}
}*/
Object homeId = map.get(UserConstant.HOME_ID);
if (homeId != null) {
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;
@Override
public List<IcStatsResiWarnBuildingResultDTO> buildingwWarnList(String agencyID) {
public List<IcStatsResiWarnBuildingResultDTO> buildingwWarnList(String customerId,String agencyID) {
List<IcStatsResiWarnBuildingResultDTO> result = new ArrayList<>();
//feign获取当前需要预警的配置信息以及阈值
Result<List<IcResiCategoryWarnConfigDTO>> warnResult = operCustomizeOpenFeignClient.resiCategoryWarnList();
@ -81,7 +81,7 @@ public class StatsResiWarnServiceImpl implements StatsResiWarnService {
return resiWarnBuildingResultDTO;
}).collect(Collectors.toList());
//统计数量
List<IcStatsResiWarnEntity> icStatsResiWarnEntityList = icStatsResiWarnDao.selectResiWarnByAgencyId(agencyID);
List<IcStatsResiWarnEntity> icStatsResiWarnEntityList = icStatsResiWarnDao.selectResiWarnByAgencyId(customerId,agencyID);
if(CollectionUtils.isEmpty(icStatsResiWarnEntityList )){
return result;
}
@ -115,7 +115,7 @@ public class StatsResiWarnServiceImpl implements StatsResiWarnService {
}
@Override
public List<IcStatsResiWarnUserResultDTO> userWarnList(String configId, List<String> buildingIdList) {
public List<IcStatsResiWarnUserResultDTO> userWarnList(String customerId,String configId, List<String> buildingIdList) {
//feign根据buildingIdList 获取网格,小区,楼宇 信息
Result<List<BuildingResultDTO>> buildingList = govOrgOpenFeignClient.buildingListByIds(buildingIdList);
if (!buildingList.success() || null == buildingList.getData()) {
@ -137,7 +137,7 @@ public class StatsResiWarnServiceImpl implements StatsResiWarnService {
IcResiCategoryWarnConfigDTO icResiCategoryWarnConfigDTO = warnResult.getData();
//根据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->{
item.setConfigId(configId);
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
public List<IcStatsResiResultDTO> list(String id, String level) {
public List<IcStatsResiResultDTO> list(String customerId,String id, String level) {
//获取所有配置类项 getshow
Result<List<IcResiCategoryStatsConfigDTO>> statsResult = operCustomizeOpenFeignClient.resiCategoryStatsListShowd();
if (!statsResult.success() || null == statsResult.getData()) {
@ -164,7 +164,7 @@ public class StatsResiWarnServiceImpl implements StatsResiWarnService {
resultDTO.setHouseShowIcon(item.getHouseShowIcon());
resultDTO.setManagementIcon(item.getManagementIcon());
//根据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);
result.add(resultDTO);
});
@ -187,10 +187,10 @@ public class StatsResiWarnServiceImpl implements StatsResiWarnService {
//保存数据
List<IcStatsResiWarnEntity> icStatsResiWarnEntities = new ArrayList<>();
for (IcResiCategoryWarnConfigDTO item : icResiCategoryWarnConfigDTOList) {
icStatsResiWarnDao.delete(new QueryWrapper<IcStatsResiWarnEntity>().lambda().eq(IcStatsResiWarnEntity::getConfigId,item.getId()));
List<IcStatsResiWarnEntity> maps = icStatsResiWarnDao.resiWarn(item.getTableName(), item.getColumnName());
icStatsResiWarnDao.delete(new QueryWrapper<IcStatsResiWarnEntity>().lambda().eq(IcStatsResiWarnEntity::getConfigId,item.getId()).eq(IcStatsResiWarnEntity::getCustomerId,customerId));
List<IcStatsResiWarnEntity> maps = icStatsResiWarnDao.resiWarn(customerId,item.getTableName(), item.getColumnName());
if(CollectionUtils.isEmpty(maps)){
continue;
}
@ -226,6 +226,11 @@ public class StatsResiWarnServiceImpl implements StatsResiWarnService {
if(null == icResiUserEntity){
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) {
@ -233,11 +238,13 @@ public class StatsResiWarnServiceImpl implements StatsResiWarnService {
IcStatsResiWarnEntity icStatsResiWarn = icStatsResiWarnDao.selectOne(new QueryWrapper<IcStatsResiWarnEntity>().lambda()
.eq(IcStatsResiWarnEntity::getConfigId,item.getId())
.eq(IcStatsResiWarnEntity::getCustomerId,customerId)
.eq(IcStatsResiWarnEntity::getAgencyId, icResiUserEntity.getAgencyId())
.eq(IcStatsResiWarnEntity::getGridId, icResiUserEntity.getGridId())
.eq(IcStatsResiWarnEntity::getNeighborHoodId, icResiUserEntity.getVillageId())
.eq(IcStatsResiWarnEntity::getBuildingId, icResiUserEntity.getBuildId()));
//统计数量
IcStatsResiWarnEntity resiWarnEntity = icStatsResiWarnDao.resiWarnById(customerId,item.getTableName(), item.getColumnName(),query);
if(null == icStatsResiWarn){
//如果不存在,新增统计数量
icStatsResiWarn = new IcStatsResiWarnEntity();
@ -248,18 +255,23 @@ public class StatsResiWarnServiceImpl implements StatsResiWarnService {
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(0);
}else{
icStatsResiWarn.setCount(resiWarnEntity.getCount());
}
icStatsResiWarn.setCount(resiWarnEntity.getCount());
icStatsResiWarnDao.insert(icStatsResiWarn);
}else{
//如果存在,更新统计数量
IcStatsResiWarnEntity resiWarnEntity = icStatsResiWarnDao.resiWarnById(item.getTableName(), item.getColumnName(),icStatsResiWarn);
icStatsResiWarn.setCount(resiWarnEntity.getCount());
if(null == resiWarnEntity){
icStatsResiWarn.setCount(0);
}else{
icStatsResiWarn.setCount(resiWarnEntity.getCount());
}
icStatsResiWarn.setCustomerId(customerId);
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.

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

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

Loading…
Cancel
Save