Browse Source

Merge remote-tracking branch 'remotes/origin/dev' into pingyin_master

dev
jianjun 4 years ago
parent
commit
da60dde254
  1. 36
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/ExcelUtils.java
  2. 32
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/excel/ExportMultiView.java
  3. 5
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/form/CustomerDataManageFormDTO.java
  4. 1
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/CustomerDataManageResultDTO.java
  5. 4
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/evaluationindex/ScreenAgencyOrGridListDTO.java
  6. 62
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/evaluationindex/ScreenCustomerGridDTO.java
  7. 11
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/DataStatsController.java
  8. 24
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/evaluationindex/EvaluationIndexDao.java
  9. 28
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/excel/CustomerDataManageExcel.java
  10. 174
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/impl/DataStatsServiceImpl.java
  11. 4
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/evaluationindex/EvaluationIndexService.java
  12. 25
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/evaluationindex/impl/EvaluationIndexServiceImpl.java
  13. 21
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/evaluationindex/EvaluationIndexDao.xml
  14. 2
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/ImportGeneralDTO.java
  15. 3
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/HouseErrorInfoModel.java
  16. 6
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/HouseInfoModel.java
  17. 19
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/ImportHouseInfoListener.java
  18. 2
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcBuildingUnitServiceImpl.java
  19. 13
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcNeighborHoodServiceImpl.java
  20. 2
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcBuildingDao.xml
  21. 10
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java
  22. 3
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBadgeServiceImpl.java

36
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/ExcelUtils.java

@ -10,6 +10,8 @@ package com.epmet.commons.tools.utils;
import cn.afterturn.easypoi.excel.ExcelExportUtil; import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams; import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
import com.epmet.commons.tools.utils.excel.ExportMultiView;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.Workbook;
@ -19,12 +21,8 @@ import org.springframework.util.CollectionUtils;
import javax.servlet.ServletOutputStream; import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.io.OutputStream;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.util.ArrayList; import java.util.*;
import java.util.Collection;
import java.util.Date;
import java.util.List;
/** /**
* Excel工具类 * Excel工具类
@ -121,8 +119,11 @@ public class ExcelUtils {
out.flush(); out.flush();
out.close(); out.close();
} }
public static OutputStream getOutputStreamForExcel(String fileName, HttpServletResponse response) throws Exception { public static ServletOutputStream getOutputStreamForExcel(String fileName, HttpServletResponse response) throws Exception {
fileName = URLEncoder.encode(fileName, "UTF-8"); fileName = URLEncoder.encode(fileName, "UTF-8");
if (!fileName.endsWith(".xls") ||!fileName.endsWith(".xlsx")){
fileName = fileName + ".xlsx";
}
response.setContentType("application/vnd.ms-excel"); response.setContentType("application/vnd.ms-excel");
response.setCharacterEncoding("utf8"); response.setCharacterEncoding("utf8");
response.setHeader("Content-Disposition", "attachment;filename=" + fileName); response.setHeader("Content-Disposition", "attachment;filename=" + fileName);
@ -131,4 +132,27 @@ public class ExcelUtils {
return response.getOutputStream(); return response.getOutputStream();
} }
/**
* desc:easypoi导出多个sheet
* @param fileName
* @param list
* @param response
* @throws Exception
*/
public static void exportMultiSheetExcel(String fileName, List<ExportMultiView> list, HttpServletResponse response) throws Exception {
List<Map<String,Object>> excel = new ArrayList<>();
for(ExportMultiView view :list){
Map<String,Object> sheet = new HashMap<>();
sheet.put("title",view.getExportParams());
sheet.put("entity",view.getCls());
sheet.put("data", view.getDataList());
excel.add(sheet);
}
Workbook workbook = ExcelExportUtil.exportExcel(excel, ExcelType.XSSF);
ServletOutputStream outputStream = ExcelUtils.getOutputStreamForExcel(fileName, response);
workbook.write(outputStream);
outputStream.flush();
outputStream.close();
}
} }

32
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/excel/ExportMultiView.java

@ -0,0 +1,32 @@
package com.epmet.commons.tools.utils.excel;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import lombok.AllArgsConstructor;
import lombok.Data;
import java.util.List;
/**
* desc:easypoi 导出多个sheet
*
* @author: LiuJanJun
* @date: 2022/3/29 1:13 下午
* @version: 1.0
*/
@Data
@AllArgsConstructor
public class ExportMultiView {
/**
* 导出的参数 比如设置表头
*/
private ExportParams exportParams;
/**
* 要导出的数据列
*/
private List<?> dataList;
/**
* excel对应的类
*/
private Class<?> cls;
}

5
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/form/CustomerDataManageFormDTO.java

@ -64,4 +64,9 @@ public class CustomerDataManageFormDTO implements Serializable {
private String sourceType; private String sourceType;
//数据类型【组织agency 网格grid】 //数据类型【组织agency 网格grid】
private String dataType; private String dataType;
/**
* desc:是否是导出
*/
private boolean export;
} }

1
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/CustomerDataManageResultDTO.java

@ -14,6 +14,7 @@ import java.util.List;
public class CustomerDataManageResultDTO { public class CustomerDataManageResultDTO {
List<CustomerDataManage> list = new ArrayList<>(); List<CustomerDataManage> list = new ArrayList<>();
List<CustomerDataManage> allGridList = new ArrayList<>();
private Integer total; private Integer total;
@Data @Data

4
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/evaluationindex/ScreenAgencyOrGridListDTO.java

@ -16,6 +16,10 @@ public class ScreenAgencyOrGridListDTO implements Serializable {
private String level; private String level;
//直属下级组织或网格集合 //直属下级组织或网格集合
private List<AgencyGrid> agencyGridList; private List<AgencyGrid> agencyGridList;
/**
* 所有下级网格列表
*/
private List<AgencyGrid> allGridList;
@Data @Data
public static class AgencyGrid { public static class AgencyGrid {

62
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/evaluationindex/ScreenCustomerGridDTO.java

@ -20,7 +20,6 @@ package com.epmet.dataaggre.dto.evaluationindex;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date;
/** /**
@ -54,66 +53,5 @@ public class ScreenCustomerGridDTO implements Serializable {
*/ */
private String gridName; private String gridName;
/**
* 网格所属组织id
*/
private String parentAgencyId;
/**
* 坐标区域
*/
private String areaMarks;
/**
* 中心点位
*/
private String centerMark;
/**
* 党支部=网格的位置
*/
private String partyMark;
/**
* 删除标识 0.未删除 1.已删除
*/
private Integer delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
/**
* 数据更新至: yyyy|yyyyMM|yyyyMMdd(08-21新增)
*/
private String dataEndTime;
/**
* 所有上级ID用英文逗号分开
*/
private String allParentIds;
private String pid;
private String pids;
} }

11
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/DataStatsController.java

@ -1,21 +1,20 @@
package com.epmet.dataaggre.controller; package com.epmet.dataaggre.controller;
import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.utils.ExcelUtils;
import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dataaggre.dto.datastats.form.*; import com.epmet.dataaggre.dto.datastats.form.*;
import com.epmet.dataaggre.dto.datastats.result.*; import com.epmet.dataaggre.dto.datastats.result.*;
import com.epmet.dataaggre.excel.CustomerDataManageExcel;
import com.epmet.dataaggre.service.datastats.DataStatsService; import com.epmet.dataaggre.service.datastats.DataStatsService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.text.ParseException; import java.text.ParseException;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
/** /**
* @Author sun * @Author sun
@ -228,6 +227,7 @@ public class DataStatsController {
@PostMapping("operateexport") @PostMapping("operateexport")
public void CustomerDataManage(@RequestBody CustomerDataManageFormDTO formDTO, HttpServletResponse response) throws Exception { public void CustomerDataManage(@RequestBody CustomerDataManageFormDTO formDTO, HttpServletResponse response) throws Exception {
ValidatorUtils.validateEntity(formDTO, CustomerDataManageFormDTO.CustomerDataManageForm.class); ValidatorUtils.validateEntity(formDTO, CustomerDataManageFormDTO.CustomerDataManageForm.class);
formDTO.setExport(true);
dataStatsService.CustomerDataManage(formDTO,response); dataStatsService.CustomerDataManage(formDTO,response);
} }
@ -239,6 +239,7 @@ public class DataStatsController {
@PostMapping("operatedata") @PostMapping("operatedata")
public Result<CustomerDataManageResultDTO> operatedata(@RequestBody CustomerDataManageFormDTO formDTO) throws ParseException { public Result<CustomerDataManageResultDTO> operatedata(@RequestBody CustomerDataManageFormDTO formDTO) throws ParseException {
ValidatorUtils.validateEntity(formDTO, CustomerDataManageFormDTO.CustomerDataManageForm.class); ValidatorUtils.validateEntity(formDTO, CustomerDataManageFormDTO.CustomerDataManageForm.class);
formDTO.setExport(false);
return new Result<CustomerDataManageResultDTO>().ok(dataStatsService.operateExport(formDTO)); return new Result<CustomerDataManageResultDTO>().ok(dataStatsService.operateExport(formDTO));
} }

24
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/evaluationindex/EvaluationIndexDao.java

@ -32,7 +32,7 @@ import java.util.List;
/** /**
* @Author sun * @Author sun
* @Description 指标统计服务 * @Description 指标统计服务
*/ */
@Mapper @Mapper
public interface EvaluationIndexDao { public interface EvaluationIndexDao {
@ -64,20 +64,22 @@ public interface EvaluationIndexDao {
/** /**
* 根据组织Id查询治理指数 * 根据组织Id查询治理指数
* @author zhaoqifeng *
* @date 2021/6/25 16:36
* @param agencyIds * @param agencyIds
* @param dateId * @param dateId
* @return java.util.List<com.epmet.dataaggre.dto.evaluationindex.ScreenGovernRankDataDailyDTO> * @return java.util.List<com.epmet.dataaggre.dto.evaluationindex.ScreenGovernRankDataDailyDTO>
* @author zhaoqifeng
* @date 2021/6/25 16:36
*/ */
ScreenGovernRankDataDailyDTO getGovernRankList(@Param("agencyIds") List<String> agencyIds, @Param("dateId") String dateId); ScreenGovernRankDataDailyDTO getGovernRankList(@Param("agencyIds") List<String> agencyIds, @Param("dateId") String dateId);
/** /**
* 获取组织信息 * 获取组织信息
* @author zhaoqifeng *
* @date 2021/6/29 13:58
* @param agencyId * @param agencyId
* @return com.epmet.dataaggre.dto.evaluationindex.ScreenCustomerAgencyDTO * @return com.epmet.dataaggre.dto.evaluationindex.ScreenCustomerAgencyDTO
* @author zhaoqifeng
* @date 2021/6/29 13:58
*/ */
ScreenCustomerAgencyDTO getAgencyInfo(@Param("agencyId") String agencyId); ScreenCustomerAgencyDTO getAgencyInfo(@Param("agencyId") String agencyId);
@ -100,12 +102,12 @@ public interface EvaluationIndexDao {
List<ScreenCustomerAgencyDTO> getSubAgencyListByAgency(@Param("agencyId") String agencyId, @Param("areaCode") String areaCode, @Param("list") List<String> list); List<ScreenCustomerAgencyDTO> getSubAgencyListByAgency(@Param("agencyId") String agencyId, @Param("areaCode") String areaCode, @Param("list") List<String> list);
/** /**
* @Description 根据组织ID查询组织名 * @Description 根据组织ID查询组织名
* @Param agencyId * @Param agencyId
* @author zxc * @author zxc
* @date 2021/9/10 3:54 下午 * @date 2021/9/10 3:54 下午
*/ */
String selectAgencyNameByAgencyId(@Param("agencyId")String agencyId); String selectAgencyNameByAgencyId(@Param("agencyId") String agencyId);
/** /**
* @Description 按dateId查询组织下一级分类项目总数统计 * @Description 按dateId查询组织下一级分类项目总数统计
@ -118,4 +120,12 @@ public interface EvaluationIndexDao {
* @author sun * @author sun
*/ */
List<GridDateIdResultDTO> getGridProejctToProjectMain(GridLivelyFormDTO formDTO); List<GridDateIdResultDTO> getGridProejctToProjectMain(GridLivelyFormDTO formDTO);
/**
* desc:根据组织全路径 获取所有网格
*
* @param fullAgencyPath
* @return
*/
List<ScreenCustomerGridDTO> getSubAllGridByAgencyPath(@Param("fullAgencyPath") String fullAgencyPath);
} }

28
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/excel/CustomerDataManageExcel.java

@ -5,49 +5,49 @@ import lombok.Data;
/** /**
* @Author zxc * @Author zxc
* @DateTime 2021/9/10 10:15 上午 * @DateTime 2021/9/10 10:10 上午
* @DESC * @DESC
*/ */
@Data @Data
public class CustomerDataManageExcel { public class CustomerDataManageExcel {
@Excel(name = "组织") @Excel(name = "组织",width = 20)
private String orgName; private String orgName;
@Excel(name = "用户数") @Excel(name = "用户数",width = 10)
private Integer userCount; private Integer userCount;
@Excel(name = "居民数") @Excel(name = "居民数",width = 10)
private Integer residentCount; private Integer residentCount;
@Excel(name = "党员数") @Excel(name = "党员数",width = 10)
private Integer partyMemberCount; private Integer partyMemberCount;
@Excel(name = "小组数") @Excel(name = "小组数",width = 10)
private Integer groupCount; private Integer groupCount;
@Excel(name = "话题数") @Excel(name = "话题数",width = 10)
private Integer topicCount; private Integer topicCount;
@Excel(name = "议题数") @Excel(name = "议题数",width = 10)
private Integer issueCount; private Integer issueCount;
@Excel(name = "项目数") @Excel(name = "项目数",width = 10)
private Integer projectCount; private Integer projectCount;
@Excel(name = "结案项目数") @Excel(name = "结案项目数",width = 10)
private Integer closedProjectCount; private Integer closedProjectCount;
@Excel(name = "巡查人数") @Excel(name = "巡查人数",width = 10)
private Integer patrolPeopleCount; private Integer patrolPeopleCount;
@Excel(name = "巡查次数") @Excel(name = "巡查次数",width = 10)
private Integer patrolCount; private Integer patrolCount;
@Excel(name = "巡查时长") @Excel(name = "巡查时长",width = 15)
private String patrolDuration; private String patrolDuration;
@Excel(name = "例行工作次数") @Excel(name = "例行工作次数",width = 15)
private Integer patrolRoutineWorkTimes; private Integer patrolRoutineWorkTimes;
/** /**

174
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/impl/DataStatsServiceImpl.java

@ -1,61 +1,63 @@
package com.epmet.dataaggre.service.datastats.impl; package com.epmet.dataaggre.service.datastats.impl;
import com.alibaba.fastjson.JSON; import cn.afterturn.easypoi.excel.entity.ExportParams;
import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.alibaba.fastjson.JSON;
import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.tools.enums.OrgLevelEnum; import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.enums.OrgTypeEnum; import com.epmet.commons.tools.enums.OrgLevelEnum;
import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.enums.OrgTypeEnum;
import com.epmet.commons.tools.feign.ResultDataResolver; import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.feign.ResultDataResolver;
import com.epmet.commons.tools.utils.DateUtils; import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.ExcelUtils; import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.dataaggre.constant.DataSourceConstant; import com.epmet.commons.tools.utils.ExcelUtils;
import com.epmet.dataaggre.constant.OrgConstant; import com.epmet.commons.tools.utils.excel.ExportMultiView;
import com.epmet.dataaggre.dao.datastats.DataStatsDao; import com.epmet.dataaggre.constant.DataSourceConstant;
import com.epmet.dataaggre.dao.datastats.FactGridMemberStatisticsDailyDao; import com.epmet.dataaggre.constant.OrgConstant;
import com.epmet.dataaggre.dto.datastats.FactGroupActDailyDTO; import com.epmet.dataaggre.dao.datastats.DataStatsDao;
import com.epmet.dataaggre.dto.datastats.form.*; import com.epmet.dataaggre.dao.datastats.FactGridMemberStatisticsDailyDao;
import com.epmet.dataaggre.dto.datastats.result.*; import com.epmet.dataaggre.dto.datastats.FactGroupActDailyDTO;
import com.epmet.dataaggre.dto.epmetuser.FactIcuserCategoryAnalysisDailyDTO; import com.epmet.dataaggre.dto.datastats.form.*;
import com.epmet.dataaggre.dto.epmetuser.form.GridMemberPatrolListFormDTO; import com.epmet.dataaggre.dto.datastats.result.*;
import com.epmet.dataaggre.dto.epmetuser.result.GridMemberPatrolListResultDTO; import com.epmet.dataaggre.dto.epmetuser.FactIcuserCategoryAnalysisDailyDTO;
import com.epmet.dataaggre.dto.epmetuser.result.PatrolDailySumResult; import com.epmet.dataaggre.dto.epmetuser.form.GridMemberPatrolListFormDTO;
import com.epmet.dataaggre.dto.evaluationindex.ScreenAgencyOrGridListDTO; import com.epmet.dataaggre.dto.epmetuser.result.GridMemberPatrolListResultDTO;
import com.epmet.dataaggre.dto.evaluationindex.ScreenCustomerAgencyDTO; import com.epmet.dataaggre.dto.epmetuser.result.PatrolDailySumResult;
import com.epmet.dataaggre.dto.evaluationindex.ScreenCustomerGridDTO; import com.epmet.dataaggre.dto.evaluationindex.ScreenAgencyOrGridListDTO;
import com.epmet.dataaggre.dto.evaluationindex.ScreenGovernRankDataDailyDTO; import com.epmet.dataaggre.dto.evaluationindex.ScreenCustomerAgencyDTO;
import com.epmet.dataaggre.dto.govorg.form.GridLivelyFormDTO; import com.epmet.dataaggre.dto.evaluationindex.ScreenCustomerGridDTO;
import com.epmet.dataaggre.dto.govorg.result.GridDateIdResultDTO; import com.epmet.dataaggre.dto.evaluationindex.ScreenGovernRankDataDailyDTO;
import com.epmet.dataaggre.dto.govorg.result.GridMemberDataAnalysisResultDTO; import com.epmet.dataaggre.dto.govorg.form.GridLivelyFormDTO;
import com.epmet.dataaggre.dto.govproject.form.ProjectTotalFormDTO; import com.epmet.dataaggre.dto.govorg.result.GridDateIdResultDTO;
import com.epmet.dataaggre.dto.resigroup.ActCategoryDictDTO; import com.epmet.dataaggre.dto.govorg.result.GridMemberDataAnalysisResultDTO;
import com.epmet.dataaggre.dto.resigroup.result.GroupActRankDetailDTO; import com.epmet.dataaggre.dto.govproject.form.ProjectTotalFormDTO;
import com.epmet.dataaggre.entity.datastats.DimAgencyEntity; import com.epmet.dataaggre.dto.resigroup.ActCategoryDictDTO;
import com.epmet.dataaggre.entity.datastats.FactAgencyGovernDailyEntity; import com.epmet.dataaggre.dto.resigroup.result.GroupActRankDetailDTO;
import com.epmet.dataaggre.excel.CustomerDataManageExcel; import com.epmet.dataaggre.entity.datastats.DimAgencyEntity;
import com.epmet.dataaggre.service.datastats.DataStatsService; import com.epmet.dataaggre.entity.datastats.FactAgencyGovernDailyEntity;
import com.epmet.dataaggre.service.epmetuser.StatsStaffPatrolRecordDailyService; import com.epmet.dataaggre.excel.CustomerDataManageExcel;
import com.epmet.dataaggre.service.evaluationindex.EvaluationIndexService; import com.epmet.dataaggre.service.datastats.DataStatsService;
import com.epmet.dataaggre.service.govorg.GovOrgService; import com.epmet.dataaggre.service.epmetuser.StatsStaffPatrolRecordDailyService;
import com.epmet.dataaggre.service.opercrm.CustomerRelation; import com.epmet.dataaggre.service.evaluationindex.EvaluationIndexService;
import com.github.pagehelper.PageHelper; import com.epmet.dataaggre.service.govorg.GovOrgService;
import lombok.extern.slf4j.Slf4j; import com.epmet.dataaggre.service.opercrm.CustomerRelation;
import org.apache.commons.collections4.CollectionUtils; import com.github.pagehelper.PageHelper;
import org.apache.commons.lang3.StringUtils; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Service; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import javax.servlet.http.HttpServletResponse; import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.math.RoundingMode; import javax.servlet.http.HttpServletResponse;
import java.text.NumberFormat; import java.math.BigDecimal;
import java.text.ParseException; import java.math.RoundingMode;
import java.text.SimpleDateFormat; import java.text.NumberFormat;
import java.util.*; import java.text.ParseException;
import java.util.concurrent.atomic.AtomicInteger; import java.text.SimpleDateFormat;
import java.util.concurrent.atomic.AtomicReference; import java.util.*;
import java.util.stream.Collectors; import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
/** /**
* @Author sun * @Author sun
@ -1878,7 +1880,32 @@ public class DataStatsServiceImpl implements DataStatsService, ResultDataResolve
@Override @Override
public void CustomerDataManage(CustomerDataManageFormDTO formDTO, HttpServletResponse response) throws Exception { public void CustomerDataManage(CustomerDataManageFormDTO formDTO, HttpServletResponse response) throws Exception {
String openTime = formDTO.getStartTime(); String openTime = formDTO.getStartTime();
List<CustomerDataManageResultDTO.CustomerDataManage> result = operateExport(formDTO).getList(); CustomerDataManageResultDTO operateExport = operateExport(formDTO);
List<CustomerDataManageResultDTO.CustomerDataManage> result = operateExport.getList();
setTotal(result);
formDTO.setStartTime(openTime);
String fileName = excelName(formDTO);
ExportParams exportParams = new ExportParams(fileName,fileName);
//exportParams.setAutoSize(true);
List<ExportMultiView> exportList = new ArrayList<>();
List<CustomerDataManageExcel> excelList = ConvertUtils.sourceToTarget(result, CustomerDataManageExcel.class);
exportList.add(new ExportMultiView(exportParams,excelList,CustomerDataManageExcel.class));
if (formDTO.isExport()){
List<CustomerDataManageResultDTO.CustomerDataManage> gridResult = operateExport.getAllGridList();
setTotal(gridResult);
ExportParams exportParams2 = new ExportParams(fileName,"网格数据");
//exportParams2.setAutoSize(true);
List<CustomerDataManageExcel> excelList2 = ConvertUtils.sourceToTarget(gridResult, CustomerDataManageExcel.class);
exportList.add(new ExportMultiView(exportParams2,excelList2,CustomerDataManageExcel.class));
}
//ExcelUtils.exportExcelToTargetDisposeAll(response,fileName,result, CustomerDataManageExcel.class);
ExcelUtils.exportMultiSheetExcel(fileName, exportList, response);
}
public void setTotal(List<CustomerDataManageResultDTO.CustomerDataManage> result) {
if (!CollectionUtils.isEmpty(result)){ if (!CollectionUtils.isEmpty(result)){
CustomerDataManageResultDTO.CustomerDataManage c = new CustomerDataManageResultDTO.CustomerDataManage(); CustomerDataManageResultDTO.CustomerDataManage c = new CustomerDataManageResultDTO.CustomerDataManage();
c.setOrgName("合计"); c.setOrgName("合计");
@ -1897,9 +1924,6 @@ public class DataStatsServiceImpl implements DataStatsService, ResultDataResolve
c.setPatrolDuration(getHm(c.getPatrolDurationInteger())); c.setPatrolDuration(getHm(c.getPatrolDurationInteger()));
result.add(c); result.add(c);
} }
formDTO.setStartTime(openTime);
String fileName = excelName(formDTO);
ExcelUtils.exportExcelToTargetDisposeAll(response,fileName,result, CustomerDataManageExcel.class);
} }
/** /**
@ -1958,8 +1982,7 @@ public class DataStatsServiceImpl implements DataStatsService, ResultDataResolve
*/ */
@Override @Override
public CustomerDataManageResultDTO operateExport(CustomerDataManageFormDTO formDTO) throws ParseException { public CustomerDataManageResultDTO operateExport(CustomerDataManageFormDTO formDTO) throws ParseException {
CustomerDataManageResultDTO resultDTO = new CustomerDataManageResultDTO();
List<CustomerDataManageResultDTO.CustomerDataManage> dataManageList = new ArrayList<>();
//1.必要参数校验及处理 //1.必要参数校验及处理
String startTimeForm = formDTO.getStartTime(); String startTimeForm = formDTO.getStartTime();
if ("Interval".equals(formDTO.getType()) && StringUtils.isEmpty(startTimeForm)) { if ("Interval".equals(formDTO.getType()) && StringUtils.isEmpty(startTimeForm)) {
@ -1974,7 +1997,7 @@ public class DataStatsServiceImpl implements DataStatsService, ResultDataResolve
} }
//2.查询组织信息,判断查询下级组织还是网格数据 //2.查询组织信息,判断查询下级组织还是网格数据
ScreenAgencyOrGridListDTO agencyGrid = indexService.getSubAgencyOrGridList(formDTO.getAgencyId()); ScreenAgencyOrGridListDTO agencyGrid = indexService.getSubAgencyOrGridList(formDTO.getAgencyId(), formDTO.isExport());
if (null == agencyGrid) { if (null == agencyGrid) {
return new CustomerDataManageResultDTO(); return new CustomerDataManageResultDTO();
} }
@ -1982,7 +2005,22 @@ public class DataStatsServiceImpl implements DataStatsService, ResultDataResolve
List<String> idList = agencyGrid.getAgencyGridList().stream().map(ScreenAgencyOrGridListDTO.AgencyGrid::getOrgId).collect(Collectors.toList()); List<String> idList = agencyGrid.getAgencyGridList().stream().map(ScreenAgencyOrGridListDTO.AgencyGrid::getOrgId).collect(Collectors.toList());
formDTO.setDataType(!OrgLevelEnum.COMMUNITY.getCode().equals(agencyGrid.getLevel()) ? OrgTypeEnum.AGENCY.getCode() : OrgTypeEnum.GRID.getCode()); formDTO.setDataType(!OrgLevelEnum.COMMUNITY.getCode().equals(agencyGrid.getLevel()) ? OrgTypeEnum.AGENCY.getCode() : OrgTypeEnum.GRID.getCode());
formDTO.setIdList(idList); formDTO.setIdList(idList);
//获取组织级别数据
CustomerDataManageResultDTO resultDTO = getDataManageResultDTO(formDTO, startTimeForm, agencyGrid.getAgencyGridList(),agencyGrid.getLevel());
resultDTO.setTotal(idList.size()); resultDTO.setTotal(idList.size());
if (formDTO.isExport()){
formDTO.setDataType(OrgTypeEnum.GRID.getCode());
idList = agencyGrid.getAllGridList().stream().map(ScreenAgencyOrGridListDTO.AgencyGrid::getOrgId).collect(Collectors.toList());
formDTO.setIdList(idList);
CustomerDataManageResultDTO allGridData = getDataManageResultDTO(formDTO, startTimeForm, agencyGrid.getAllGridList(),agencyGrid.getLevel());
resultDTO.setAllGridList(allGridData.getList());
}
return resultDTO;
}
public CustomerDataManageResultDTO getDataManageResultDTO(CustomerDataManageFormDTO formDTO, String startTimeForm, List<ScreenAgencyOrGridListDTO.AgencyGrid> agencyGridList,String orgLevel) {
CustomerDataManageResultDTO resultDTO = new CustomerDataManageResultDTO();
List<CustomerDataManageResultDTO.CustomerDataManage> dataManageList = new ArrayList<>();
//3.查询截止日期用户、群组、话题、议题、项目、巡查数据 //3.查询截止日期用户、群组、话题、议题、项目、巡查数据
formDTO.setSourceType("end"); formDTO.setSourceType("end");
@ -2029,7 +2067,7 @@ public class DataStatsServiceImpl implements DataStatsService, ResultDataResolve
} }
//5.封装数据 //5.封装数据
for (ScreenAgencyOrGridListDTO.AgencyGrid org : agencyGrid.getAgencyGridList()) { for (ScreenAgencyOrGridListDTO.AgencyGrid org : agencyGridList) {
CustomerDataManageResultDTO.CustomerDataManage dto = new CustomerDataManageResultDTO.CustomerDataManage(); CustomerDataManageResultDTO.CustomerDataManage dto = new CustomerDataManageResultDTO.CustomerDataManage();
dto.setOrgId(org.getOrgId()); dto.setOrgId(org.getOrgId());
dto.setOrgName(org.getOrgName()); dto.setOrgName(org.getOrgName());
@ -2083,12 +2121,12 @@ public class DataStatsServiceImpl implements DataStatsService, ResultDataResolve
int patrolDurationInteger = NumConstant.ZERO; int patrolDurationInteger = NumConstant.ZERO;
HashSet set = new HashSet(); HashSet set = new HashSet();
for (CustomerDataManageResultDTO.CustomerDataManage u : patrolEnd) { for (CustomerDataManageResultDTO.CustomerDataManage u : patrolEnd) {
if (OrgLevelEnum.COMMUNITY.getCode().equals(agencyGrid.getLevel()) && org.getOrgId().equals(u.getOrgId())) { if (OrgLevelEnum.COMMUNITY.getCode().equals(orgLevel) && org.getOrgId().equals(u.getOrgId())) {
patroCount += u.getPatrolCount(); patroCount += u.getPatrolCount();
patrolDurationInteger += u.getPatrolDurationInteger(); patrolDurationInteger += u.getPatrolDurationInteger();
set.add(u.getStaffId()); set.add(u.getStaffId());
} }
if (!OrgLevelEnum.COMMUNITY.getCode().equals(agencyGrid.getLevel()) && u.getOrgId().contains(org.getOrgId())) { if (!OrgLevelEnum.COMMUNITY.getCode().equals(orgLevel) && u.getOrgId().contains(org.getOrgId())) {
patroCount += u.getPatrolCount(); patroCount += u.getPatrolCount();
patrolDurationInteger += u.getPatrolDurationInteger(); patrolDurationInteger += u.getPatrolDurationInteger();
set.add(u.getStaffId()); set.add(u.getStaffId());
@ -2099,10 +2137,10 @@ public class DataStatsServiceImpl implements DataStatsService, ResultDataResolve
int patrolRoutineWorkTimes = NumConstant.ZERO; int patrolRoutineWorkTimes = NumConstant.ZERO;
if (CollectionUtils.isNotEmpty(workCountList) && workCountList.get(NumConstant.ZERO) != null) { if (CollectionUtils.isNotEmpty(workCountList) && workCountList.get(NumConstant.ZERO) != null) {
for (CustomerDataManageResultDTO.CustomerDataManage work : workCountList) { for (CustomerDataManageResultDTO.CustomerDataManage work : workCountList) {
if (OrgLevelEnum.COMMUNITY.getCode().equals(agencyGrid.getLevel()) && org.getOrgId().equals(work.getOrgId())) { if (OrgLevelEnum.COMMUNITY.getCode().equals(orgLevel) && org.getOrgId().equals(work.getOrgId())) {
patrolRoutineWorkTimes += work.getPatrolRoutineWorkTimes(); patrolRoutineWorkTimes += work.getPatrolRoutineWorkTimes();
set.add(work.getStaffId()); set.add(work.getStaffId());
} else if (!OrgLevelEnum.COMMUNITY.getCode().equals(agencyGrid.getLevel()) && work.getOrgId().contains(org.getOrgId())) { } else if (!OrgLevelEnum.COMMUNITY.getCode().equals(orgLevel) && work.getOrgId().contains(org.getOrgId())) {
patrolRoutineWorkTimes += work.getPatrolRoutineWorkTimes(); patrolRoutineWorkTimes += work.getPatrolRoutineWorkTimes();
set.add(work.getStaffId()); set.add(work.getStaffId());
} }

4
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/evaluationindex/EvaluationIndexService.java

@ -44,6 +44,8 @@ public interface EvaluationIndexService {
*/ */
List<ScreenCustomerGridDTO> getSubGridList(String agencyId); List<ScreenCustomerGridDTO> getSubGridList(String agencyId);
List<ScreenCustomerGridDTO> getSubAllGridByAgencyPath(String fullAgencyPath);
/** /**
* 根据组织ID获取治理指数 * 根据组织ID获取治理指数
* @author zhaoqifeng * @author zhaoqifeng
@ -88,7 +90,7 @@ public interface EvaluationIndexService {
* @Description 根据组织Id判断查询直属下级组织/网格列表组织存在子客户的查询包含子客户组织数据 * @Description 根据组织Id判断查询直属下级组织/网格列表组织存在子客户的查询包含子客户组织数据
* @author sun * @author sun
*/ */
ScreenAgencyOrGridListDTO getSubAgencyOrGridList(String agencyId); ScreenAgencyOrGridListDTO getSubAgencyOrGridList(String agencyId, Boolean isGetSubAllGrid);
/** /**
* @Description 按dateId查询组织下一级分类项目总数统计 * @Description 按dateId查询组织下一级分类项目总数统计

25
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/evaluationindex/impl/EvaluationIndexServiceImpl.java

@ -1,8 +1,9 @@
package com.epmet.dataaggre.service.evaluationindex.impl; package com.epmet.dataaggre.service.evaluationindex.impl;
import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.enums.OrgLevelEnum;
import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.dataaggre.constant.DataSourceConstant; import com.epmet.dataaggre.constant.DataSourceConstant;
import com.epmet.dataaggre.dao.evaluationindex.EvaluationIndexDao; import com.epmet.dataaggre.dao.evaluationindex.EvaluationIndexDao;
import com.epmet.dataaggre.dto.datastats.form.GovrnRatioFormDTO; import com.epmet.dataaggre.dto.datastats.form.GovrnRatioFormDTO;
@ -75,6 +76,15 @@ public class EvaluationIndexServiceImpl implements EvaluationIndexService {
return evaluationIndexDao.getSubGridList(agencyId); return evaluationIndexDao.getSubGridList(agencyId);
} }
/**
* @Description 查询所有下级网格
* @author sun
*/
@Override
public List<ScreenCustomerGridDTO> getSubAllGridByAgencyPath(String fullAgencyPath) {
return evaluationIndexDao.getSubAllGridByAgencyPath(fullAgencyPath);
}
/** /**
* 根据组织ID获取治理指数 * 根据组织ID获取治理指数
* *
@ -165,7 +175,7 @@ public class EvaluationIndexServiceImpl implements EvaluationIndexService {
* @author sun * @author sun
*/ */
@Override @Override
public ScreenAgencyOrGridListDTO getSubAgencyOrGridList(String agencyId) { public ScreenAgencyOrGridListDTO getSubAgencyOrGridList(String agencyId, Boolean isGetSubAllGrid) {
ScreenAgencyOrGridListDTO resultDTO = new ScreenAgencyOrGridListDTO(); ScreenAgencyOrGridListDTO resultDTO = new ScreenAgencyOrGridListDTO();
List<ScreenAgencyOrGridListDTO.AgencyGrid> agencyGridList = new ArrayList<>(); List<ScreenAgencyOrGridListDTO.AgencyGrid> agencyGridList = new ArrayList<>();
//1.查询组织信息 //1.查询组织信息
@ -178,6 +188,17 @@ public class EvaluationIndexServiceImpl implements EvaluationIndexService {
List<ScreenCustomerAgencyDTO> agencyList = new ArrayList<>(); List<ScreenCustomerAgencyDTO> agencyList = new ArrayList<>();
List<ScreenCustomerGridDTO> gridList = new ArrayList<>(); List<ScreenCustomerGridDTO> gridList = new ArrayList<>();
List<ScreenAgencyOrGridListDTO.AgencyGrid> finalAgencyGridList = agencyGridList; List<ScreenAgencyOrGridListDTO.AgencyGrid> finalAgencyGridList = agencyGridList;
if (isGetSubAllGrid && OrgLevelEnum.STREET.getCode().equals(dto.getLevel())){
gridList = evaluationIndexDao.getSubAllGridByAgencyPath(dto.getPids().concat(StrConstant.COLON).concat(dto.getAgencyId()));
List<ScreenAgencyOrGridListDTO.AgencyGrid> allGridList = new ArrayList<>();
gridList.forEach(gr->{
ScreenAgencyOrGridListDTO.AgencyGrid org = new ScreenAgencyOrGridListDTO.AgencyGrid();
org.setOrgId(gr.getGridId());
org.setOrgName(gr.getGridName());
allGridList.add(org);
});
resultDTO.setAllGridList(allGridList);
}
if (!"community".equals(dto.getLevel())) { if (!"community".equals(dto.getLevel())) {
//2-1.直属下级组织列表 //2-1.直属下级组织列表
//2.判断客户是否存在子客户 //2.判断客户是否存在子客户

21
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/evaluationindex/EvaluationIndexDao.xml

@ -118,7 +118,8 @@
agency_name AS agencyName, agency_name AS agencyName,
level AS level, level AS level,
area_code AS areaCode, area_code AS areaCode,
parent_area_code AS parentAreaCode parent_area_code AS parentAreaCode,
pids pids
FROM FROM
screen_customer_agency screen_customer_agency
WHERE WHERE
@ -211,5 +212,23 @@
AND all_parent_ids LIKE CONCAT('%', #{agencyId}, '%') AND all_parent_ids LIKE CONCAT('%', #{agencyId}, '%')
GROUP BY org_id, DATE_FORMAT(project_create_time, "%Y%m%d") GROUP BY org_id, DATE_FORMAT(project_create_time, "%Y%m%d")
</select> </select>
<select id="getSubAllGridByAgencyPath" resultType="com.epmet.dataaggre.dto.evaluationindex.ScreenCustomerGridDTO">
SELECT
customer_id AS customerId,
grid_id AS gridId,
grid_name AS gridName,
parent_agency_id AS parentAgencyId,
area_marks AS areaMarks,
center_mark AS centerMark,
party_mark AS partyMark,
data_end_time AS dataEndTime,
all_parent_ids AS allParentIds
FROM
screen_customer_grid
WHERE
del_flag = '0'
AND all_parent_ids LIKE concat(#{fullAgencyPath},'%')
order by parentAgencyId,gridName
</select>
</mapper> </mapper>

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

@ -68,7 +68,7 @@ public class ImportGeneralDTO implements Serializable {
/** /**
* 单元号ID * 单元号ID
*/ */
private Integer buildingUnit; private String buildingUnit;
private String buildingUnitId; private String buildingUnitId;
/** /**

3
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/HouseErrorInfoModel.java

@ -13,6 +13,9 @@ import org.hibernate.validator.constraints.Length;
@Data @Data
public class HouseErrorInfoModel { public class HouseErrorInfoModel {
@Excel(name = "行号(不计算表头)", width = 20)
private Integer num;
@Excel(name = "所属小区", width = 20) @Excel(name = "所属小区", width = 20)
private String neighborHoodName; private String neighborHoodName;

6
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/HouseInfoModel.java

@ -1,5 +1,6 @@
package com.epmet.model; package com.epmet.model;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data; import lombok.Data;
import org.hibernate.validator.constraints.Length; import org.hibernate.validator.constraints.Length;
@ -26,7 +27,7 @@ public class HouseInfoModel {
private String buildingName; private String buildingName;
@ExcelProperty(value = "单元号") @ExcelProperty(value = "单元号")
private Integer buildingUnit; private String buildingUnit;
@ExcelProperty(value = "门牌号") @ExcelProperty(value = "门牌号")
private String doorName; private String doorName;
@ -49,4 +50,7 @@ public class HouseInfoModel {
@ExcelProperty(value = "房主身份证") @ExcelProperty(value = "房主身份证")
private String ownerIdCard; private String ownerIdCard;
@ExcelIgnore
private Integer num;
} }

19
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/ImportHouseInfoListener.java

@ -67,7 +67,7 @@ public class ImportHouseInfoListener extends AnalysisEventListener<HouseInfoMode
/** /**
* 本次导入涉及到的楼宇id 用于更新住户数 * 本次导入涉及到的楼宇id 用于更新住户数
*/ */
private Set<String> buildingIdSet = new ConcurrentHashSet<>(); // private Set<String> buildingIdSet = new ConcurrentHashSet<>();
private ImportInfoFormDTO formDTO; private ImportInfoFormDTO formDTO;
private IcBuildingDao icBuildingDao; private IcBuildingDao icBuildingDao;
@ -96,6 +96,7 @@ public class ImportHouseInfoListener extends AnalysisEventListener<HouseInfoMode
ImportGeneralDTO dto = ConvertUtils.sourceToTarget(data, ImportGeneralDTO.class); ImportGeneralDTO dto = ConvertUtils.sourceToTarget(data, ImportGeneralDTO.class);
dto.setNum(num); dto.setNum(num);
dto.setCustomerId(formDTO.getCustomerId()); dto.setCustomerId(formDTO.getCustomerId());
info.setNum(num);
if(StringUtils.isBlank(data.getAgencyName())){ if(StringUtils.isBlank(data.getAgencyName())){
nums.add(num); nums.add(num);
disposeErrorMsg(info, "所属组织的值未填写"); disposeErrorMsg(info, "所属组织的值未填写");
@ -136,9 +137,13 @@ public class ImportHouseInfoListener extends AnalysisEventListener<HouseInfoMode
disposeErrorMsg(info, "门牌号的值未填写"); disposeErrorMsg(info, "门牌号的值未填写");
return; return;
} }
if(null == data.getBuildingUnit()){ /**
* 2022-03-29 需求改动单元号修改 eg 1 改为 1单元
* 做限制此字段中必须带有 "单元"2字不存在就不给导入
*/
if(StringUtils.isBlank(data.getBuildingUnit()) || !data.getBuildingUnit().contains("单元")){
nums.add(num); nums.add(num);
disposeErrorMsg(info, "单元号的值未填写"); disposeErrorMsg(info, "单元号的值未填写或者格式不正确");
return; return;
} }
// 应产品要求 // 应产品要求
@ -535,13 +540,13 @@ public class ImportHouseInfoListener extends AnalysisEventListener<HouseInfoMode
public void doAfterAllAnalysed(AnalysisContext context) { public void doAfterAllAnalysed(AnalysisContext context) {
finalDispose(); finalDispose();
// 更新ic_building户数 // 更新ic_building户数
if (!CollectionUtils.isEmpty(buildingIdSet)){ /*if (!CollectionUtils.isEmpty(buildingIdSet)){
List<UpdateBuildingHouseNumResultDTO> houseNum = icBuildingDao.selectHouseNum(buildingIdSet); List<UpdateBuildingHouseNumResultDTO> houseNum = icBuildingDao.selectHouseNum(buildingIdSet);
if (!CollectionUtils.isEmpty(houseNum)){ if (!CollectionUtils.isEmpty(houseNum)){
icBuildingDao.allUpdateHouseNum(houseNum); icBuildingDao.allUpdateHouseNum(houseNum);
} }
buildingIdSet = null; buildingIdSet = null;
} }*/
// 删除缓存 // 删除缓存
icHouseRedis.delTemporaryCacheGrids(formDTO.getCustomerId(), formDTO.getUserId()); icHouseRedis.delTemporaryCacheGrids(formDTO.getCustomerId(), formDTO.getUserId());
icHouseRedis.delTemporaryCacheNeighBorHood(formDTO.getCustomerId(), formDTO.getUserId()); icHouseRedis.delTemporaryCacheNeighBorHood(formDTO.getCustomerId(), formDTO.getUserId());
@ -582,7 +587,7 @@ public class ImportHouseInfoListener extends AnalysisEventListener<HouseInfoMode
public void houseInsert(List<ImportGeneralDTO> houses){ public void houseInsert(List<ImportGeneralDTO> houses){
if (!CollectionUtils.isEmpty(houses)){ if (!CollectionUtils.isEmpty(houses)){
icHouseService.insertBatch(ConvertUtils.sourceToTarget(houses, IcHouseEntity.class)); icHouseService.insertBatch(ConvertUtils.sourceToTarget(houses, IcHouseEntity.class));
buildingIdSet.addAll(houses.stream().map(ImportGeneralDTO::getBuildingId).collect(Collectors.toSet())); // buildingIdSet.addAll(houses.stream().map(ImportGeneralDTO::getBuildingId).collect(Collectors.toSet()));
} }
} }
@ -590,7 +595,7 @@ public class ImportHouseInfoListener extends AnalysisEventListener<HouseInfoMode
public void houseUpdate(List<ImportGeneralDTO> houses){ public void houseUpdate(List<ImportGeneralDTO> houses){
if (!CollectionUtils.isEmpty(houses)){ if (!CollectionUtils.isEmpty(houses)){
icHouseService.houseUpdate(houses); icHouseService.houseUpdate(houses);
buildingIdSet.addAll(houses.stream().map(ImportGeneralDTO::getBuildingId).collect(Collectors.toSet())); // buildingIdSet.addAll(houses.stream().map(ImportGeneralDTO::getBuildingId).collect(Collectors.toSet()));
} }
} }

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

@ -148,7 +148,7 @@ public class IcBuildingUnitServiceImpl extends BaseServiceImpl<IcBuildingUnitDao
public IcBuildingUnitDTO getUnitInfo(String buildingId, String unitName) { public IcBuildingUnitDTO getUnitInfo(String buildingId, String unitName) {
LambdaQueryWrapper<IcBuildingUnitEntity> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<IcBuildingUnitEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(IcBuildingUnitEntity::getBuildingId, buildingId); wrapper.eq(IcBuildingUnitEntity::getBuildingId, buildingId);
wrapper.eq(IcBuildingUnitEntity::getUnitNum, unitName); wrapper.eq(IcBuildingUnitEntity::getUnitName, unitName);
IcBuildingUnitEntity entity = baseDao.selectOne(wrapper); IcBuildingUnitEntity entity = baseDao.selectOne(wrapper);
return ConvertUtils.sourceToTarget(entity, IcBuildingUnitDTO.class); return ConvertUtils.sourceToTarget(entity, IcBuildingUnitDTO.class);
} }

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

@ -526,7 +526,7 @@ public class IcNeighborHoodServiceImpl extends BaseServiceImpl<IcNeighborHoodDao
item.setBuildingId(buildingId); item.setBuildingId(buildingId);
} }
//3.获取单元ID,判断单元是否存在,不存在则添加单元,存在则直接获取单元ID //3.获取单元ID,判断单元是否存在,不存在则添加单元,存在则直接获取单元ID
if (null != item.getBuildingUnit()) { if (StringUtils.isNotBlank(item.getBuildingUnit())) {
String unitId = getUnitId(formDTO.getCustomerId(), item); String unitId = getUnitId(formDTO.getCustomerId(), item);
item.setBuildingUnitId(unitId); item.setBuildingUnitId(unitId);
} }
@ -535,7 +535,7 @@ public class IcNeighborHoodServiceImpl extends BaseServiceImpl<IcNeighborHoodDao
String buildingId = getBuildingId(formDTO.getCustomerId(), item); String buildingId = getBuildingId(formDTO.getCustomerId(), item);
item.setBuildingId(buildingId); item.setBuildingId(buildingId);
//获取单元ID,判断单元是否存在,不存在则添加单元,存在则直接获取单元ID //获取单元ID,判断单元是否存在,不存在则添加单元,存在则直接获取单元ID
if (null != item.getBuildingUnit()) { if (StringUtils.isNotBlank(item.getBuildingUnit())) {
String unitId = getUnitId(formDTO.getCustomerId(), item); String unitId = getUnitId(formDTO.getCustomerId(), item);
item.setBuildingUnitId(unitId); item.setBuildingUnitId(unitId);
} }
@ -628,7 +628,10 @@ public class IcNeighborHoodServiceImpl extends BaseServiceImpl<IcNeighborHoodDao
*/ */
private String getUnitId(String customerId, ImportGeneralDTO info) { private String getUnitId(String customerId, ImportGeneralDTO info) {
//根据楼栋ID和单元名获取单元信息 //根据楼栋ID和单元名获取单元信息
IcBuildingUnitDTO unit = icBuildingUnitService.getUnitInfo(info.getBuildingId(), String.valueOf(info.getBuildingUnit())); /**
* 2022-03-29 需求改动单元号修改 eg 1 改为 1单元
*/
IcBuildingUnitDTO unit = icBuildingUnitService.getUnitInfo(info.getBuildingId(), info.getBuildingUnit());
if (null != unit) { if (null != unit) {
return unit.getId(); return unit.getId();
} }
@ -636,8 +639,8 @@ public class IcNeighborHoodServiceImpl extends BaseServiceImpl<IcNeighborHoodDao
IcBuildingUnitEntity unitEntity = new IcBuildingUnitEntity(); IcBuildingUnitEntity unitEntity = new IcBuildingUnitEntity();
unitEntity.setCustomerId(customerId); unitEntity.setCustomerId(customerId);
unitEntity.setBuildingId(info.getBuildingId()); unitEntity.setBuildingId(info.getBuildingId());
unitEntity.setUnitName(info.getBuildingUnit() +"单元"); unitEntity.setUnitName(info.getBuildingUnit());
unitEntity.setUnitNum(String.valueOf(info.getBuildingUnit())); unitEntity.setUnitNum(info.getBuildingUnit().replace("单元",""));
icBuildingUnitService.insert(unitEntity); icBuildingUnitService.insert(unitEntity);
return unitEntity.getId(); return unitEntity.getId();

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

@ -294,7 +294,7 @@
<select id="selectAllBuildingUnitByBuildingId" resultType="com.epmet.dto.ImportGeneralDTO"> <select id="selectAllBuildingUnitByBuildingId" resultType="com.epmet.dto.ImportGeneralDTO">
SELECT SELECT
u.ID AS buildingUnitId, u.ID AS buildingUnitId,
u.UNIT_NUM AS buildingUnit, u.UNIT_NAME AS buildingUnit,
u.BUILDING_ID,b.NEIGHBOR_HOOD_ID u.BUILDING_ID,b.NEIGHBOR_HOOD_ID
FROM ic_building_unit u FROM ic_building_unit u
INNER JOIN ic_building b ON (b.ID = u.BUILDING_ID AND b.DEL_FLAG = '0') INNER JOIN ic_building b ON (b.ID = u.BUILDING_ID AND b.DEL_FLAG = '0')

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

@ -24,6 +24,7 @@ import com.alibaba.excel.write.metadata.fill.FillWrapper;
import com.epmet.commons.rocketmq.messages.IcResiUserAddMQMsg; import com.epmet.commons.rocketmq.messages.IcResiUserAddMQMsg;
import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.aop.NoRepeatSubmit; import com.epmet.commons.tools.aop.NoRepeatSubmit;
import com.epmet.commons.tools.constant.AppClientConstant;
import com.epmet.commons.tools.constant.Constant; import com.epmet.commons.tools.constant.Constant;
import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.constant.StrConstant;
@ -486,6 +487,15 @@ public class IcResiUserController implements ResultDataResolver {
} catch (IOException e) { } catch (IOException e) {
log.error("【导入居民信息失败】清理上传的文件失败:{}", ExceptionUtils.getErrorStackTrace(e)); log.error("【导入居民信息失败】清理上传的文件失败:{}", ExceptionUtils.getErrorStackTrace(e));
} }
//推送MQ事件
IcResiUserAddMQMsg mqMsg = new IcResiUserAddMQMsg();
mqMsg.setCustomerId(EpmetRequestHolder.getHeader(AppClientConstant.CUSTOMER_ID));
//mqMsg.setIcResiUser(resiUserId);
SystemMsgFormDTO form = new SystemMsgFormDTO();
form.setMessageType(SystemMessageType.IC_RESI_USER_ADD);
form.setContent(mqMsg);
epmetMessageOpenFeignClient.sendSystemMsgByMQ(form);
} }
}); });

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

@ -279,7 +279,8 @@ public class UserBadgeServiceImpl implements UserBadgeService {
userBadgeDao.insertUserBadgeCertificateRecord(form); userBadgeDao.insertUserBadgeCertificateRecord(form);
//TODO 站内信发送 //TODO 站内信发送
String badgeName = badgeDao.selectBadgeName(form.getCustomerId(), form.getBadgeId()); String badgeName = badgeDao.selectBadgeName(form.getCustomerId(), form.getBadgeId());
String msg = String.format(BadgeConstant.MESSAGE_CONTENT, userBaseInfoResultDTOS.get(NumConstant.ZERO).getDistrict().concat(userBaseInfoResultDTOS.get(NumConstant.ZERO).getRealName()), badgeName); String s = StringUtils.isBlank(userBaseInfoResultDTOS.get(NumConstant.ZERO).getDistrict()) ? userBaseInfoResultDTOS.get(NumConstant.ZERO).getRealName() : userBaseInfoResultDTOS.get(NumConstant.ZERO).getDistrict().concat(userBaseInfoResultDTOS.get(NumConstant.ZERO).getRealName());
String msg = String.format(BadgeConstant.MESSAGE_CONTENT, s, badgeName);
// 记录待审核id,和消息类型 // 记录待审核id,和消息类型
sendMessage(BadgeConstant.AUTH_TITLE,msg,form.getGridId(),form.getUserId(),form.getCustomerId(), sendMessage(BadgeConstant.AUTH_TITLE,msg,form.getGridId(),form.getUserId(),form.getCustomerId(),
UserMessageTypeConstant.BADGE_AUTH_APPLY, UserMessageTypeConstant.BADGE_AUTH_APPLY,

Loading…
Cancel
Save