Browse Source

Merge remote-tracking branch 'remotes/origin/develop' into 主线测试

master
jianjun 3 years ago
parent
commit
97f8e14036
  1. 30
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/ExcelUtils.java
  2. 23
      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. 18
      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. 62
      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. 13
      epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/service/impl/UserAccessServiceImpl.java
  15. 5
      epmet-user/epmet-user-client/src/main/java/com/epmet/constant/IcResiUserConstant.java
  16. 20
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcTripReportRecordDTO.java
  17. 115
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcTripReportFormDTO.java
  18. 13
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/MyReportedTripFormDTO.java
  19. 4
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserInfoOnEnterGridResultDTO.java
  20. 35
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcTripReportRecordController.java
  21. 5
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcTripReportRecordDao.java
  22. 2
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserBaseInfoDao.java
  23. 15
      epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcTripReportRecordEntity.java
  24. 16
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcTripReportRecordService.java
  25. 1
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiCollectServiceImpl.java
  26. 55
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcTripReportRecordServiceImpl.java
  27. 17
      epmet-user/epmet-user-server/src/main/resources/mapper/IcTripReportRecordDao.xml
  28. 10
      epmet-user/epmet-user-server/src/main/resources/mapper/UserBaseInfoDao.xml

30
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.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.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
@ -19,12 +21,8 @@ import org.springframework.util.CollectionUtils;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.OutputStream;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.List;
import java.util.*;
/**
* Excel工具类
@ -121,8 +119,11 @@ public class ExcelUtils {
out.flush();
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");
if (!fileName.endsWith(".xls") ||!fileName.endsWith(".xlsx")){
fileName = fileName + ".xlsx";
}
response.setContentType("application/vnd.ms-excel");
response.setCharacterEncoding("utf8");
response.setHeader("Content-Disposition", "attachment;filename=" + fileName);
@ -131,4 +132,21 @@ public class ExcelUtils {
return response.getOutputStream();
}
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());
List<?> dataList = view.getDataList();
sheet.put("data", dataList);
excel.add(sheet);
}
Workbook workbook = ExcelExportUtil.exportExcel(excel, ExcelType.XSSF);
ServletOutputStream outputStream = ExcelUtils.getOutputStreamForExcel(fileName, response);
workbook.write(outputStream);
outputStream.flush();
outputStream.close();
}
}

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

@ -0,0 +1,23 @@
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;
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;
//数据类型【组织agency 网格grid】
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 {
List<CustomerDataManage> list = new ArrayList<>();
List<CustomerDataManage> allGridList = new ArrayList<>();
private Integer total;
@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 List<AgencyGrid> agencyGridList;
/**
* 所有下级网格列表
*/
private List<AgencyGrid> allGridList;
@Data
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 java.io.Serializable;
import java.util.Date;
/**
@ -54,66 +53,5 @@ public class ScreenCustomerGridDTO implements Serializable {
*/
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;
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.validator.ValidatorUtils;
import com.epmet.dataaggre.dto.datastats.form.*;
import com.epmet.dataaggre.dto.datastats.result.*;
import com.epmet.dataaggre.excel.CustomerDataManageExcel;
import com.epmet.dataaggre.service.datastats.DataStatsService;
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 java.text.ParseException;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/**
* @Author sun
@ -228,6 +227,7 @@ public class DataStatsController {
@PostMapping("operateexport")
public void CustomerDataManage(@RequestBody CustomerDataManageFormDTO formDTO, HttpServletResponse response) throws Exception {
ValidatorUtils.validateEntity(formDTO, CustomerDataManageFormDTO.CustomerDataManageForm.class);
formDTO.setExport(true);
dataStatsService.CustomerDataManage(formDTO,response);
}
@ -239,6 +239,7 @@ public class DataStatsController {
@PostMapping("operatedata")
public Result<CustomerDataManageResultDTO> operatedata(@RequestBody CustomerDataManageFormDTO formDTO) throws ParseException {
ValidatorUtils.validateEntity(formDTO, CustomerDataManageFormDTO.CustomerDataManageForm.class);
formDTO.setExport(false);
return new Result<CustomerDataManageResultDTO>().ok(dataStatsService.operateExport(formDTO));
}

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

@ -64,20 +64,22 @@ public interface EvaluationIndexDao {
/**
* 根据组织Id查询治理指数
* @author zhaoqifeng
* @date 2021/6/25 16:36
*
* @param agencyIds
* @param dateId
* @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);
/**
* 获取组织信息
* @author zhaoqifeng
* @date 2021/6/29 13:58
*
* @param agencyId
* @return com.epmet.dataaggre.dto.evaluationindex.ScreenCustomerAgencyDTO
* @author zhaoqifeng
* @date 2021/6/29 13:58
*/
ScreenCustomerAgencyDTO getAgencyInfo(@Param("agencyId") String agencyId);
@ -118,4 +120,12 @@ public interface EvaluationIndexDao {
* @author sun
*/
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
* @DateTime 2021/9/10 10:15 上午
* @DateTime 2021/9/10 10:10 上午
* @DESC
*/
@Data
public class CustomerDataManageExcel {
@Excel(name = "组织")
@Excel(name = "组织",width = 20)
private String orgName;
@Excel(name = "用户数")
@Excel(name = "用户数",width = 10)
private Integer userCount;
@Excel(name = "居民数")
@Excel(name = "居民数",width = 10)
private Integer residentCount;
@Excel(name = "党员数")
@Excel(name = "党员数",width = 10)
private Integer partyMemberCount;
@Excel(name = "小组数")
@Excel(name = "小组数",width = 10)
private Integer groupCount;
@Excel(name = "话题数")
@Excel(name = "话题数",width = 10)
private Integer topicCount;
@Excel(name = "议题数")
@Excel(name = "议题数",width = 10)
private Integer issueCount;
@Excel(name = "项目数")
@Excel(name = "项目数",width = 10)
private Integer projectCount;
@Excel(name = "结案项目数")
@Excel(name = "结案项目数",width = 10)
private Integer closedProjectCount;
@Excel(name = "巡查人数")
@Excel(name = "巡查人数",width = 10)
private Integer patrolPeopleCount;
@Excel(name = "巡查次数")
@Excel(name = "巡查次数",width = 10)
private Integer patrolCount;
@Excel(name = "巡查时长")
@Excel(name = "巡查时长",width = 15)
private String patrolDuration;
@Excel(name = "例行工作次数")
@Excel(name = "例行工作次数",width = 15)
private Integer patrolRoutineWorkTimes;
/**

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

@ -1,5 +1,6 @@
package com.epmet.dataaggre.service.datastats.impl;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import com.alibaba.fastjson.JSON;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.tools.constant.NumConstant;
@ -10,6 +11,7 @@
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.commons.tools.utils.ExcelUtils;
import com.epmet.commons.tools.utils.excel.ExportMultiView;
import com.epmet.dataaggre.constant.DataSourceConstant;
import com.epmet.dataaggre.constant.OrgConstant;
import com.epmet.dataaggre.dao.datastats.DataStatsDao;
@ -1878,7 +1880,32 @@ public class DataStatsServiceImpl implements DataStatsService, ResultDataResolve
@Override
public void CustomerDataManage(CustomerDataManageFormDTO formDTO, HttpServletResponse response) throws Exception {
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)){
CustomerDataManageResultDTO.CustomerDataManage c = new CustomerDataManageResultDTO.CustomerDataManage();
c.setOrgName("合计");
@ -1897,9 +1924,6 @@ public class DataStatsServiceImpl implements DataStatsService, ResultDataResolve
c.setPatrolDuration(getHm(c.getPatrolDurationInteger()));
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
public CustomerDataManageResultDTO operateExport(CustomerDataManageFormDTO formDTO) throws ParseException {
CustomerDataManageResultDTO resultDTO = new CustomerDataManageResultDTO();
List<CustomerDataManageResultDTO.CustomerDataManage> dataManageList = new ArrayList<>();
//1.必要参数校验及处理
String startTimeForm = formDTO.getStartTime();
if ("Interval".equals(formDTO.getType()) && StringUtils.isEmpty(startTimeForm)) {
@ -1974,7 +1997,7 @@ public class DataStatsServiceImpl implements DataStatsService, ResultDataResolve
}
//2.查询组织信息,判断查询下级组织还是网格数据
ScreenAgencyOrGridListDTO agencyGrid = indexService.getSubAgencyOrGridList(formDTO.getAgencyId());
ScreenAgencyOrGridListDTO agencyGrid = indexService.getSubAgencyOrGridList(formDTO.getAgencyId(), formDTO.isExport());
if (null == agencyGrid) {
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());
formDTO.setDataType(!OrgLevelEnum.COMMUNITY.getCode().equals(agencyGrid.getLevel()) ? OrgTypeEnum.AGENCY.getCode() : OrgTypeEnum.GRID.getCode());
formDTO.setIdList(idList);
//获取组织级别数据
CustomerDataManageResultDTO resultDTO = getDataManageResultDTO(formDTO, startTimeForm, agencyGrid.getAgencyGridList(),agencyGrid.getLevel());
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.查询截止日期用户、群组、话题、议题、项目、巡查数据
formDTO.setSourceType("end");
@ -2029,7 +2067,7 @@ public class DataStatsServiceImpl implements DataStatsService, ResultDataResolve
}
//5.封装数据
for (ScreenAgencyOrGridListDTO.AgencyGrid org : agencyGrid.getAgencyGridList()) {
for (ScreenAgencyOrGridListDTO.AgencyGrid org : agencyGridList) {
CustomerDataManageResultDTO.CustomerDataManage dto = new CustomerDataManageResultDTO.CustomerDataManage();
dto.setOrgId(org.getOrgId());
dto.setOrgName(org.getOrgName());
@ -2083,12 +2121,12 @@ public class DataStatsServiceImpl implements DataStatsService, ResultDataResolve
int patrolDurationInteger = NumConstant.ZERO;
HashSet set = new HashSet();
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();
patrolDurationInteger += u.getPatrolDurationInteger();
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();
patrolDurationInteger += u.getPatrolDurationInteger();
set.add(u.getStaffId());
@ -2099,10 +2137,10 @@ public class DataStatsServiceImpl implements DataStatsService, ResultDataResolve
int patrolRoutineWorkTimes = NumConstant.ZERO;
if (CollectionUtils.isNotEmpty(workCountList) && workCountList.get(NumConstant.ZERO) != null) {
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();
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();
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> getSubAllGridByAgencyPath(String fullAgencyPath);
/**
* 根据组织ID获取治理指数
* @author zhaoqifeng
@ -88,7 +90,7 @@ public interface EvaluationIndexService {
* @Description 根据组织Id判断查询直属下级组织/网格列表组织存在子客户的查询包含子客户组织数据
* @author sun
*/
ScreenAgencyOrGridListDTO getSubAgencyOrGridList(String agencyId);
ScreenAgencyOrGridListDTO getSubAgencyOrGridList(String agencyId, Boolean isGetSubAllGrid);
/**
* @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;
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.utils.ConvertUtils;
import com.epmet.dataaggre.constant.DataSourceConstant;
import com.epmet.dataaggre.dao.evaluationindex.EvaluationIndexDao;
import com.epmet.dataaggre.dto.datastats.form.GovrnRatioFormDTO;
@ -75,6 +76,15 @@ public class EvaluationIndexServiceImpl implements EvaluationIndexService {
return evaluationIndexDao.getSubGridList(agencyId);
}
/**
* @Description 查询所有下级网格
* @author sun
*/
@Override
public List<ScreenCustomerGridDTO> getSubAllGridByAgencyPath(String fullAgencyPath) {
return evaluationIndexDao.getSubAllGridByAgencyPath(fullAgencyPath);
}
/**
* 根据组织ID获取治理指数
*
@ -165,7 +175,7 @@ public class EvaluationIndexServiceImpl implements EvaluationIndexService {
* @author sun
*/
@Override
public ScreenAgencyOrGridListDTO getSubAgencyOrGridList(String agencyId) {
public ScreenAgencyOrGridListDTO getSubAgencyOrGridList(String agencyId, Boolean isGetSubAllGrid) {
ScreenAgencyOrGridListDTO resultDTO = new ScreenAgencyOrGridListDTO();
List<ScreenAgencyOrGridListDTO.AgencyGrid> agencyGridList = new ArrayList<>();
//1.查询组织信息
@ -178,6 +188,17 @@ public class EvaluationIndexServiceImpl implements EvaluationIndexService {
List<ScreenCustomerAgencyDTO> agencyList = new ArrayList<>();
List<ScreenCustomerGridDTO> gridList = new ArrayList<>();
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())) {
//2-1.直属下级组织列表
//2.判断客户是否存在子客户

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

@ -118,7 +118,8 @@
agency_name AS agencyName,
level AS level,
area_code AS areaCode,
parent_area_code AS parentAreaCode
parent_area_code AS parentAreaCode,
pids pids
FROM
screen_customer_agency
WHERE
@ -211,5 +212,23 @@
AND all_parent_ids LIKE CONCAT('%', #{agencyId}, '%')
GROUP BY org_id, DATE_FORMAT(project_create_time, "%Y%m%d")
</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>

13
epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/service/impl/UserAccessServiceImpl.java

@ -1,6 +1,9 @@
package com.epmet.service.impl;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.redis.common.CustomerOrgRedis;
import com.epmet.commons.tools.redis.common.bean.GridInfoCache;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.EnterGridFormDTO;
@ -37,6 +40,16 @@ public class UserAccessServiceImpl implements UserAccessService {
userInfoParams.setGridId(formDTO.getGridId());
Result<UserInfoOnEnterGridResultDTO> userInfoResult =
epmetUserFeignClient.getUserInfoAndRoles(userInfoParams);
//获取网格缓存信息
if(userInfoResult.success()){
GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(userInfoResult.getData().getCurrentGridId());
if (null == gridInfo) {
log.error(String.format("居民端进网格接口获取网格缓存信息失败,网格Id->%s",userInfoResult.getData().getCurrentGridId()));
return userInfoResult;
}
userInfoResult.getData().setAgencyId(gridInfo.getPid());
userInfoResult.getData().setAgencyName(gridInfo.getAgencyName());
}
return userInfoResult;
}
}

5
epmet-user/epmet-user-client/src/main/java/com/epmet/constant/IcResiUserConstant.java

@ -8,4 +8,9 @@ package com.epmet.constant;
public interface IcResiUserConstant {
String IC_RESI_USER = "ic_resi_user";
/**
* 居民端小程序的人resi;数字社区的居民icresi;未关联上的other
*/
String USER_TYPE_RESI="resi";
String USER_TYPE_IC_RESI="icresi";
}

20
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcTripReportRecordDTO.java

@ -1,5 +1,6 @@
package com.epmet.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.io.Serializable;
@ -22,6 +23,21 @@ public class IcTripReportRecordDTO implements Serializable {
*/
private String id;
/**
* 居民端用户所在网格id,数字社区居民所属网格id
*/
private String gridId;
/**
* 居民端上报的存储用户所在网格的组织id;
*/
private String agencyId;
/**
* agency_id的所有上级
*/
private String pids;
/**
* 客户Id
*/
@ -80,11 +96,13 @@ public class IcTripReportRecordDTO implements Serializable {
/**
* 到达日期
*/
@JsonFormat(pattern = "yyyy-MM-dd")
private Date arriveDate;
/**
* 离开日期
*/
@JsonFormat(pattern = "yyyy-MM-dd")
private Date leaveDate;
/**
@ -122,4 +140,6 @@ public class IcTripReportRecordDTO implements Serializable {
*/
private Date updatedTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
private Date reportTime;
}

115
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcTripReportFormDTO.java

@ -0,0 +1,115 @@
package com.epmet.dto.form;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;
/**
* 行程上报居民端入参
*/
@Data
public class IcTripReportFormDTO implements Serializable {
public interface ResiUserInternalGroup {
}
public interface ResiUserRequired extends CustomerClientShowGroup {
}
/**
* 客户Id
*/
private String customerId;
/**
* 姓名
*/
@NotBlank(message = "姓名不能为空", groups = {ResiUserRequired.class})
private String name;
/**
* 手机号
*/
@NotBlank(message = "手机号不能为空", groups = {ResiUserRequired.class})
private String mobile;
/**
* 身份证号
*/
@NotBlank(message = "身份证号不能为空", groups = {ResiUserRequired.class})
private String idCard;
/**
* 现居地编码
*/
@NotBlank(message = "现居地编码不能为空", groups = {ResiUserRequired.class})
private String presentAddressCode;
/**
* 现居地名称eg:山东省青岛市黄岛区玫瑰山路社区
*/
@NotBlank(message = "现居地名称不能为空", groups = {ResiUserRequired.class})
private String presentAddress;
/**
* 详细地址
*/
@NotBlank(message = "详细地址不能为空", groups = {ResiUserRequired.class})
private String detailAddress;
/**
* 来源地区编码
*/
@NotBlank(message = "来自地区编码不能为空", groups = {ResiUserRequired.class})
private String sourceAddressCode;
/**
* 来源地区地址
*/
@NotBlank(message = "来自地区名称不能为空", groups = {ResiUserRequired.class})
private String sourceAddress;
/**
* 到达日期
*/
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd")
@NotNull(message = "来到本地时间不能为空", groups = {ResiUserRequired.class})
private Date arriveDate;
/**
* 离开日期
*/
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date leaveDate;
/**
* 备注信息
*/
@Length(max = 500, message = "备注最多可输入500字", groups = {ResiUserRequired.class})
private String remark;
@NotBlank(message = "网格不能为空", groups = {ResiUserInternalGroup.class})
private String gridId;
//后端自己赋值
/**
* 用户id
*/
private String userId;
/**
* 居民端小程序的人resi;数字社区的居民icresi;未关联上的other
*/
private String userType;
}

13
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/MyReportedTripFormDTO.java

@ -0,0 +1,13 @@
package com.epmet.dto.form;
import com.epmet.commons.tools.dto.form.PageFormDTO;
import lombok.Data;
/**
* 居民端小程序我的上报
*/
@Data
public class MyReportedTripFormDTO extends PageFormDTO {
private String userId;
private String customerId;
}

4
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserInfoOnEnterGridResultDTO.java

@ -77,4 +77,8 @@ public class UserInfoOnEnterGridResultDTO implements Serializable{
private String orgName = "";
//工作人员添加入口类型(组织:agency;部门:dept;网格:gridId)
private String orgType = "";
//进入的网格所属组织
private String agencyId;
private String agencyName;
}

35
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcTripReportRecordController.java

@ -1,18 +1,25 @@
package com.epmet.controller;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.aop.NoRepeatSubmit;
import com.epmet.commons.tools.dto.form.PageFormDTO;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.AssertUtils;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.constant.IcResiUserConstant;
import com.epmet.dto.IcTripReportRecordDTO;
import com.epmet.dto.form.IcTripReportFormDTO;
import com.epmet.dto.form.MyReportedTripFormDTO;
import com.epmet.service.IcTripReportRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
@ -23,7 +30,7 @@ import java.util.Map;
* @since v1.0.0 2022-03-25
*/
@RestController
@RequestMapping("triprecord")
@RequestMapping("tripreport")
public class IcTripReportRecordController {
@Autowired
@ -67,6 +74,32 @@ public class IcTripReportRecordController {
return new Result();
}
/**
* 居民端小程序上报行程
* @param tokenDto
* @param formDTO
* @return
*/
@PostMapping("resi-save")
public Result resiSave(@LoginUser TokenDto tokenDto, @RequestBody IcTripReportFormDTO formDTO){
formDTO.setCustomerId(tokenDto.getCustomerId());
formDTO.setUserId(tokenDto.getUserId());
formDTO.setUserType(IcResiUserConstant.USER_TYPE_RESI);
ValidatorUtils.validateEntity(formDTO,IcTripReportFormDTO.ResiUserRequired.class,IcTripReportFormDTO.ResiUserInternalGroup.class);
return new Result().ok(icTripReportRecordService.resiSave(formDTO));
}
/**
* 居民端小程序我的上报
* @param tokenDto
* @return
*/
@PostMapping("resi-list")
public Result<List<IcTripReportRecordDTO>> resiList(@LoginUser TokenDto tokenDto,@RequestBody MyReportedTripFormDTO formDTO){
formDTO.setCustomerId(tokenDto.getCustomerId());
formDTO.setUserId(tokenDto.getUserId());
ValidatorUtils.validateEntity(formDTO, PageFormDTO.AddUserInternalGroup.class);
return new Result<List<IcTripReportRecordDTO>>().ok(icTripReportRecordService.resiList(formDTO));
}
}

5
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcTripReportRecordDao.java

@ -1,8 +1,12 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.IcTripReportRecordDTO;
import com.epmet.entity.IcTripReportRecordEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 行程上报信息
@ -13,4 +17,5 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface IcTripReportRecordDao extends BaseDao<IcTripReportRecordEntity> {
List<IcTripReportRecordDTO> selectMyReported(@Param("userId") String userId, @Param("customerId") String customerId, @Param("idCard") String idCard);
}

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

@ -90,4 +90,6 @@ public interface UserBaseInfoDao extends BaseDao<UserBaseInfoEntity> {
Integer selectCountIdNum(@Param("idNum") String idNum,
@Param("customerId")String customerId,
@Param("excludeUserId")String excludeUserId);
String selectIdCard(String userId);
}

15
epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcTripReportRecordEntity.java

@ -21,6 +21,21 @@ public class IcTripReportRecordEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 居民端用户所在网格id,数字社区居民所属网格id
*/
private String gridId;
/**
* 居民端上报的存储用户所在网格的组织id;
*/
private String agencyId;
/**
* agency_id的所有上级
*/
private String pids;
/**
* 客户Id
*/

16
epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcTripReportRecordService.java

@ -3,6 +3,8 @@ package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.IcTripReportRecordDTO;
import com.epmet.dto.form.IcTripReportFormDTO;
import com.epmet.dto.form.MyReportedTripFormDTO;
import com.epmet.entity.IcTripReportRecordEntity;
import java.util.List;
@ -75,4 +77,18 @@ public interface IcTripReportRecordService extends BaseService<IcTripReportRecor
* @date 2022-03-25
*/
void delete(String[] ids);
/**
* 居民端小程序上报行程
* @param formDTO
* @return
*/
String resiSave(IcTripReportFormDTO formDTO);
/**
* 居民端小程序我的上报
* @param formDTO
* @return
*/
List<IcTripReportRecordDTO> resiList(MyReportedTripFormDTO formDTO);
}

1
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiCollectServiceImpl.java

@ -155,6 +155,7 @@ public class IcResiCollectServiceImpl extends BaseServiceImpl<IcResiCollectDao,
*
* @param formDTO
*/
@Transactional(rollbackFor = Exception.class)
@Override
public void saveResi(ResiCollectFormDTO formDTO) {
IcResiCollectEntity origin = baseDao.selectByAddress(formDTO.getAddress());

55
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcTripReportRecordServiceImpl.java

@ -4,13 +4,24 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.redis.common.CustomerOrgRedis;
import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache;
import com.epmet.commons.tools.redis.common.bean.GridInfoCache;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.dao.IcTripReportRecordDao;
import com.epmet.dao.UserBaseInfoDao;
import com.epmet.dto.IcTripReportRecordDTO;
import com.epmet.dto.form.IcTripReportFormDTO;
import com.epmet.dto.form.MyReportedTripFormDTO;
import com.epmet.entity.IcTripReportRecordEntity;
import com.epmet.service.IcTripReportRecordService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -26,7 +37,8 @@ import java.util.Map;
*/
@Service
public class IcTripReportRecordServiceImpl extends BaseServiceImpl<IcTripReportRecordDao, IcTripReportRecordEntity> implements IcTripReportRecordService {
@Autowired
private UserBaseInfoDao userBaseInfoDao;
@Override
public PageData<IcTripReportRecordDTO> page(Map<String, Object> params) {
@ -80,4 +92,45 @@ public class IcTripReportRecordServiceImpl extends BaseServiceImpl<IcTripReportR
baseDao.deleteBatchIds(Arrays.asList(ids));
}
/**
* 居民端小程序上报行程
*
* @param formDTO
* @return
*/
@Override
@Transactional(rollbackFor = Exception.class)
public String resiSave(IcTripReportFormDTO formDTO) {
GridInfoCache gridInfoCache = CustomerOrgRedis.getGridInfo(formDTO.getGridId());
if (null == gridInfoCache) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "查询网格信息异常", EpmetErrorCode.SERVER_ERROR.getMsg());
}
AgencyInfoCache agencyInfoCache = CustomerOrgRedis.getAgencyInfo(gridInfoCache.getPid());
if (null == agencyInfoCache) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "查询组织信息异常", EpmetErrorCode.SERVER_ERROR.getMsg());
}
IcTripReportRecordEntity entity = ConvertUtils.sourceToTarget(formDTO, IcTripReportRecordEntity.class);
entity.setAgencyId(gridInfoCache.getPid());
entity.setPids(agencyInfoCache.getPids());
insert(entity);
return entity.getId();
}
/**
* 居民端小程序我的上报
*
* @param formDTO
* @return
*/
@Override
public List<IcTripReportRecordDTO> resiList(MyReportedTripFormDTO formDTO) {
String idCard=userBaseInfoDao.selectIdCard(formDTO.getUserId());
PageInfo<IcTripReportRecordDTO> result = PageHelper.startPage(formDTO.getPageNo(),
formDTO.getPageSize()).doSelectPageInfo(() -> baseDao.selectMyReported(formDTO.getUserId(),
formDTO.getCustomerId(),idCard));
return result.getList();
}
}

17
epmet-user/epmet-user-server/src/main/resources/mapper/IcTripReportRecordDao.xml

@ -3,6 +3,23 @@
<mapper namespace="com.epmet.dao.IcTripReportRecordDao">
<select id="selectMyReported" parameterType="map" resultType="com.epmet.dto.IcTripReportRecordDTO">
SELECT
r.*,
r.CREATED_TIME AS reportTime
FROM
ic_trip_report_record r
WHERE
r.DEL_FLAG = '0'
AND r.CUSTOMER_ID = #{customerId}
AND ( r.CREATED_BY = #{userId}
<if test='null != idCard and "" != idCard'>
OR r.ID_CARD = #{idCard}
</if>
)
ORDER BY
r.CREATED_TIME DESC
</select>
</mapper>

10
epmet-user/epmet-user-server/src/main/resources/mapper/UserBaseInfoDao.xml

@ -143,4 +143,14 @@
AND ubi.user_id != #{excludeUserId}
</if>
</select>
<select id="selectIdCard" parameterType="java.lang.String" resultType="java.lang.String">
SELECT
ubi.ID_NUM
FROM
user_base_info ubi
WHERE
ubi.USER_ID = #{userId}
AND ubi.DEL_FLAG = '0'
</select>
</mapper>

Loading…
Cancel
Save