Browse Source

Merge branch 'develop' into release_temp

dev_shibei_match
sunyuchao 4 years ago
parent
commit
1277bbfae3
  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. 3
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/BuildingService.java
  5. 3
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/HouseService.java
  6. 2
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/NeighborHoodService.java
  7. 17
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/BuildingServiceImpl.java
  8. 19
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java
  9. 7
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/NeighborHoodServiceImpl.java
  10. 46
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StatsResiWarnCountFormDTO.java
  11. 9
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StatsResiWarnController.java
  12. 2
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcStatsResiWarnDao.java
  13. 2
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/StatsResiWarnService.java
  14. 60
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StatsResiWarnServiceImpl.java
  15. 22
      epmet-user/epmet-user-server/src/main/resources/mapper/IcStatsResiWarnDao.xml

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

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

17
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;
}
//查询所有组织和网格根据名字
@ -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

19
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());
@ -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;
}

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

@ -240,7 +240,7 @@ 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);
//组织名称不一样的数据舍弃
@ -248,6 +248,7 @@ public class NeighborHoodServiceImpl implements NeighborHoodService {
while (iterator.hasNext()) {
IcNeighborHoodExcel obj = iterator.next();
if (!obj.getAgencyName().trim().equals(staffInfoCache.getAgencyName())) {
numList.add(obj.getRowNum());
iterator.remove();
}
}
@ -255,7 +256,7 @@ public class NeighborHoodServiceImpl implements NeighborHoodService {
//导入
if(CollectionUtils.isEmpty(list)){
return ;
return numList;
}
//获取所有组织 list
List<String> agencyNameList = list.stream().map(item -> item.getAgencyName()).collect(Collectors.toList());
@ -294,6 +295,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 +314,7 @@ public class NeighborHoodServiceImpl implements NeighborHoodService {
icNeighborHoodService.insertBatch(neighborHoodEntityList);
icNeighborHoodPropertyService.insertBatch(icNeighborHoodPropertyEntityList);
return numList;
}

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;
}

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();
}
}

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

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

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

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>
Loading…
Cancel
Save