Browse Source

Merge remote-tracking branch 'origin/dev_bugfix_ljj' into develop

dev
zxc 4 years ago
parent
commit
21a490c024
  1. 10
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/form/ScreenCentralZoneDataFormDTO.java
  2. 7
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectMainDailyDao.java
  3. 48
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/biz/impl/BizDataStatsServiceImpl.java
  4. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectMainDailyServiceImpl.java
  5. 205
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenGrassrootsGovernDataAbsorptionServiceImpl.java
  6. 11
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectMainDailyDao.xml
  7. 15
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcCommunitySelfOrganizationController.java
  8. 24
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/ExportCommunitySelfOrganizationExcel.java
  9. 2
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/ImportCommunitySelfOrganizationSon.java

10
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/form/ScreenCentralZoneDataFormDTO.java

@ -29,4 +29,14 @@ public class ScreenCentralZoneDataFormDTO implements Serializable {
private String endDate;
private String projectId;
/**
* 首次的话 全量拉取
*/
private Boolean isFirst;
/**
* 时间间隔天数 14 就是查询14天内的数据
*/
private String internalDay;
}

7
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectMainDailyDao.java

@ -26,6 +26,7 @@ import com.epmet.dto.indexcollect.result.CpcIndexCommonDTO;
import com.epmet.dto.pingyin.result.*;
import com.epmet.dto.screen.ScreenProjectDataDTO;
import com.epmet.dto.screen.form.ProjectSourceMapFormDTO;
import com.epmet.dto.screen.form.ScreenCentralZoneDataFormDTO;
import com.epmet.entity.evaluationindex.extract.*;
import com.epmet.entity.evaluationindex.screen.ScreenDifficultyDataEntity;
import org.apache.ibatis.annotations.Mapper;
@ -400,13 +401,13 @@ public interface FactOriginProjectMainDailyDao extends BaseDao<FactOriginProject
/**
* desc: 获取难点堵点项目数据
*
* @param customerId
* @param dateId
* @param param
* @param param
* @return java.util.List<com.epmet.entity.evaluationindex.extract.FactOriginProjectMainAndPeriodDTO>
* @author LiuJanJun
* @date 2021/4/12 1:35 下午
*/
List<FactOriginProjectMainAndPeriodDTO> getProjectForDiff(@Param("customerId") String customerId, @Param("offset") int offset, @Param("pageSize") int pageSize);
List<FactOriginProjectMainAndPeriodDTO> getProjectForDiff(@Param("param") ScreenCentralZoneDataFormDTO param, @Param("offset") int offset, @Param("pageSize") int pageSize);
/**
* desc: 获取难点堵点项目数据耗时

48
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/biz/impl/BizDataStatsServiceImpl.java

@ -78,7 +78,7 @@ public class BizDataStatsServiceImpl implements BizDataStatsService {
List<String> customerIdList = null;
do {
customerIdList = dimCustomerService.selectCustomerIdPage(pageNo++, pageSize);
if (!CollectionUtils.isEmpty(customerIdList)){
if (!CollectionUtils.isEmpty(customerIdList)) {
customerIds.addAll(customerIdList);
}
} while (!CollectionUtil.isEmpty(customerIdList) && customerIdList.size() == pageSize);
@ -99,8 +99,8 @@ public class BizDataStatsServiceImpl implements BizDataStatsService {
//校正参数里的前一天日期的数据
//获取所有网格员
List<CustomerGridStaffDTO> allGridMembers = getAllGridMembers(formDTO);
if (CollectionUtils.isEmpty(allGridMembers)){
log.warn("executeStaffPatrolStats have any gridMembers,param:{}",JSON.toJSONString(formDTO));
if (CollectionUtils.isEmpty(allGridMembers)) {
log.warn("executeStaffPatrolStats have any gridMembers,param:{}", JSON.toJSONString(formDTO));
return;
}
String yesterdayStr = getYesterdayString(formDTO);
@ -110,12 +110,12 @@ public class BizDataStatsServiceImpl implements BizDataStatsService {
//初始化参数里日期的数据 如果当前时间在1分钟内 则初始化
String todayDateDimId = DimIdGenerator.getDateDimId(new Date());
if (todayDateDimId.equals(formDTO.getDateId())){
if (todayDateDimId.equals(formDTO.getDateId())) {
//如果当前时间-1分钟还等于今天 则进行初始化操作 否则执行数据纠正
String dateDimId = DimIdGenerator.getDateDimId(new Date(System.currentTimeMillis() - 1 * 60 * 1000));
if (!dateDimId.equals(todayDateDimId)){
if (!dateDimId.equals(todayDateDimId)) {
initStaffPatrolTodayData(formDTO, allGridMembers);
}else{
} else {
reloadStaffPatrolStatsData(formDTO, allGridMembers);
}
}
@ -123,7 +123,7 @@ public class BizDataStatsServiceImpl implements BizDataStatsService {
}
private void reloadStaffPatrolStatsData(StaffPatrolStatsFormDTO formDTO, List<CustomerGridStaffDTO> allGridMembers) {
log.info("reloadStaffPatrolStatsData param:{}",JSON.toJSONString(formDTO));
log.info("reloadStaffPatrolStatsData param:{}", JSON.toJSONString(formDTO));
//获取昨日的巡查统计记录
//遍历网格员重新初始化数据
@ -216,7 +216,7 @@ public class BizDataStatsServiceImpl implements BizDataStatsService {
}
private void initStaffPatrolTodayData(StaffPatrolStatsFormDTO formDTO, List<CustomerGridStaffDTO> allGridMembers) {
log.info("initStaffPatrolTodayData param:{}",JSON.toJSONString(formDTO));
log.info("initStaffPatrolTodayData param:{}", JSON.toJSONString(formDTO));
List<StatsStaffPatrolRecordDailyDTO> insertList = buildInitPatrolStatsData(formDTO, allGridMembers);
Integer effectRow = statsStaffPatrolService.delAndInsertBatch(formDTO, insertList);
log.debug("initStaffPatrolStats insert rows:{}", effectRow);
@ -302,24 +302,24 @@ public class BizDataStatsServiceImpl implements BizDataStatsService {
daysBetween = DateUtils.getDaysBetween(param.getStartDate(), param.getEndDate());
}
List<String> finalDaysBetween = daysBetween;
threadPool.submit(() -> {
if (!isRange) {
try {
//初始化form里的今天的数据 并纠正昨日的数据
if (!isRange) {
try {
//初始化form里的今天的数据 并纠正昨日的数据
this.executeStaffPatrolStats(formDTO);
} catch (Exception e) {
log.error("【网格员巡查数据统计】发生异常,参数:" + JSON.toJSONString(formDTO), e);
}
} else {
try {
for (String dateDimId : finalDaysBetween) {
formDTO.setDateId(dateDimId);
this.executeStaffPatrolStats(formDTO);
} catch (Exception e) {
log.error("【网格员巡查数据统计】发生异常,参数:" + JSON.toJSONString(formDTO), e);
}
} else {
try {
for (String dateDimId : finalDaysBetween) {
formDTO.setDateId(dateDimId);
this.executeStaffPatrolStats(formDTO);
}
} catch (Exception e) {
log.error("【网格员巡查数据统计】发生异常,参数:" + JSON.toJSONString(param), e);
}
} catch (Exception e) {
log.error("【网格员巡查数据统计】发生异常,参数:" + JSON.toJSONString(param), e);
}
});
}
}
}

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectMainDailyServiceImpl.java

@ -525,7 +525,7 @@ public class FactOriginProjectMainDailyServiceImpl extends BaseServiceImpl<FactO
@Override
public List<FactOriginProjectMainAndPeriodDTO> getProjectAndPeriodForDiff(ScreenCentralZoneDataFormDTO param, int offset, int pageSize) {
return baseDao.getProjectForDiff(param.getCustomerId(),offset,pageSize);
return baseDao.getProjectForDiff(param,offset,pageSize);
}
@Override

205
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenGrassrootsGovernDataAbsorptionServiceImpl.java

@ -155,115 +155,120 @@ public class ScreenGrassrootsGovernDataAbsorptionServiceImpl implements ScreenGr
@Override
public boolean difficultyDataExtract(ScreenCentralZoneDataFormDTO param) {
//获取agency维度
List<DimAgencyEntity> agencyList = dimAgencyService.getAgencyListByCustomerId(param.getCustomerId());
Map<String, DimAgencyEntity> agencyMap = agencyList.stream().collect(Collectors.toMap(DimAgencyEntity::getId, o -> o, (o1, o2) -> o1));
//获取grid维度
List<GridInfoDTO> gridList = customerGridService.queryGridInfoList(param.getCustomerId());
Map<String, GridInfoDTO> gridMap = gridList.stream().collect(Collectors.toMap(GridInfoDTO::getGridId, o -> o, (o1, o2) -> o1));
//获取客户下所有项目分类
List<IssueProjectCategoryDictEntity> categoryList = issueProjectCategoryDictService.getAllByCId(param.getCustomerId());
//项目分类数据 todo 暂时查询所有
List<ProjectCategoryDTO> projectCategoryData = projectService.getProjectCategoryData(param.getCustomerId(), null);
//key projectId:categoryCode Set
Map<String, Set<String>> projectCategoryMap = projectCategoryData.stream()
.collect(Collectors.groupingBy(ProjectCategoryDTO::getProjectId, Collectors.mapping(ProjectCategoryDTO::getCategoryCode, Collectors.toSet())));
//获取业务库项目标题
List<ProjectDTO> bizProjectInfoList = projectService.getProjectInfo(param.getCustomerId(), null, null);
if (CollectionUtils.isEmpty(bizProjectInfoList)) {
log.warn("difficultyDataExtract customerId:{} have any project", param.getCustomerId());
return false;
}
Map<String, ProjectDTO> bizProjectInfoMap = bizProjectInfoList.stream().collect(Collectors.toMap(ProjectDTO::getId, o -> o, (o1, o2) -> o1));
int pageNo = NumConstant.ONE;
int pageSize = NumConstant.FIVE_HUNDRED;
List<FactOriginProjectMainAndPeriodDTO> difficultyBaseList;
do {
//1.根据客户Id 获取所有项目数据
int offset = (pageNo++ - NumConstant.ONE) * pageSize;
difficultyBaseList = factOriginProjectMainDailyService.getProjectAndPeriodForDiff(param, offset,pageSize);
if (CollectionUtils.isEmpty(difficultyBaseList)) {
try {
//默认查询10天内的数据
param.setInternalDay(DateUtils.getBeforeNDay(NumConstant.TEN));
//获取agency维度
List<DimAgencyEntity> agencyList = dimAgencyService.getAgencyListByCustomerId(param.getCustomerId());
Map<String, DimAgencyEntity> agencyMap = agencyList.stream().collect(Collectors.toMap(DimAgencyEntity::getId, o -> o, (o1, o2) -> o1));
//获取grid维度
List<GridInfoDTO> gridList = customerGridService.queryGridInfoList(param.getCustomerId());
Map<String, GridInfoDTO> gridMap = gridList.stream().collect(Collectors.toMap(GridInfoDTO::getGridId, o -> o, (o1, o2) -> o1));
//获取客户下所有项目分类
List<IssueProjectCategoryDictEntity> categoryList = issueProjectCategoryDictService.getAllByCId(param.getCustomerId());
//项目分类数据 todo 暂时查询所有
List<ProjectCategoryDTO> projectCategoryData = projectService.getProjectCategoryData(param.getCustomerId(), null);
//key projectId:categoryCode Set
Map<String, Set<String>> projectCategoryMap = projectCategoryData.stream()
.collect(Collectors.groupingBy(ProjectCategoryDTO::getProjectId, Collectors.mapping(ProjectCategoryDTO::getCategoryCode, Collectors.toSet())));
//获取业务库项目标题
List<ProjectDTO> bizProjectInfoList = projectService.getProjectInfo(param.getCustomerId(), null, null);
if (CollectionUtils.isEmpty(bizProjectInfoList)) {
log.warn("difficultyDataExtract customerId:{} have any project", param.getCustomerId());
return false;
}
//2.获取项目的所有节点耗时数据
List<FactOriginProjectOrgPeriodDailyEntity> projectPeriodList = difficultyBaseList.stream()
.filter(o->o.getPeriodList() != null)
.flatMap(o->o.getPeriodList().stream())
.collect(Collectors.toList());
//处理部门数去重(只要流转到就算)
Map<String, Set<String>> orgCountMap = new HashMap<>();
//被处理次数
Map<String, Integer> handleCountMap = new HashMap<>();
Set<String> valideProjectIdSet = fillAnyCountAndValidProject(param, projectPeriodList, orgCountMap, handleCountMap);
List<ScreenDifficultyDataEntity> diffList = new ArrayList<>();
List<ScreenDifficultyImgDataEntity> imgDataEntities = new ArrayList<>();
for (FactOriginProjectMainAndPeriodDTO project : difficultyBaseList) {
if (agencyMap.get(project.getAgencyId()) == null || bizProjectInfoMap.get(project.getId()) == null) {
log.warn("未获取到相关的项目信息或者项目的所属组织信息,agencyId:{},projectId:{}",project.getAgencyId(),project.getId());
continue;
}
//判断是否符合难点堵点条件
if (!valideProjectIdSet.contains(project.getId())) {
continue;
}
ScreenDifficultyDataEntity diffEntity = buildBaseDiffEntity(project, agencyMap, gridMap, bizProjectInfoMap);
Set<String> regCount = orgCountMap.get(project.getId());
if (regCount != null) {
diffEntity.setEventReOrg(regCount.size());
} else {
diffEntity.setEventReOrg(0);
}
Integer handleOrgCount = handleCountMap.get(project.getId());
if (handleOrgCount != null) {
diffEntity.setEventHandledCount(handleOrgCount);
} else {
diffEntity.setEventHandledCount(0);
Map<String, ProjectDTO> bizProjectInfoMap = bizProjectInfoList.stream().collect(Collectors.toMap(ProjectDTO::getId, o -> o, (o1, o2) -> o1));
int pageNo = NumConstant.ONE;
int pageSize = NumConstant.ONE_THOUSAND;
List<FactOriginProjectMainAndPeriodDTO> difficultyBaseList;
do {
//1.根据客户Id 获取所有项目数据
int offset = (pageNo++ - NumConstant.ONE) * pageSize;
difficultyBaseList = factOriginProjectMainDailyService.getProjectAndPeriodForDiff(param, offset,pageSize);
if (CollectionUtils.isEmpty(difficultyBaseList)) {
log.warn("difficultyDataExtract customerId:{} have any project", param.getCustomerId());
return false;
}
diffEntity.setDataEndTime(StringUtils.isBlank(param.getDateId())?DateUtils.getBeforeNDay(NumConstant.ONE):param.getDateId());
setCategoryInfo(diffEntity, project.getId(), categoryList, projectCategoryMap);
if (StringUtils.isNotBlank(project.getTopicId())) {
//获取图片及话题内容
ResiTopicAndImgResultDTO topicInfo = topicService.getTopicAndImgs(project.getTopicId(), "image");
if (topicInfo != null) {
List<TopicAttachmentDTO> topicImgList = topicInfo.getTopicImgList();
if (!CollectionUtils.isEmpty(topicImgList)){
diffEntity.setEventImgUrl(topicImgList.get(NumConstant.ZERO).getAttachmentUrl());
topicImgList.forEach(img -> {
ScreenDifficultyImgDataEntity imgData = new ScreenDifficultyImgDataEntity();
imgData.setEventId(project.getId());
imgData.setEventImgUrl(img.getAttachmentUrl());
imgData.setSort(img.getSort());
imgDataEntities.add(imgData);
imgData.setCustomerId(param.getCustomerId());
});
//2.获取项目的所有节点耗时数据
List<FactOriginProjectOrgPeriodDailyEntity> projectPeriodList = difficultyBaseList.stream()
.filter(o->o.getPeriodList() != null)
.flatMap(o->o.getPeriodList().stream())
.collect(Collectors.toList());
//处理部门数去重(只要流转到就算)
Map<String, Set<String>> orgCountMap = new HashMap<>();
//被处理次数
Map<String, Integer> handleCountMap = new HashMap<>();
Set<String> valideProjectIdSet = fillAnyCountAndValidProject(param, projectPeriodList, orgCountMap, handleCountMap);
List<ScreenDifficultyDataEntity> diffList = new ArrayList<>();
List<ScreenDifficultyImgDataEntity> imgDataEntities = new ArrayList<>();
for (FactOriginProjectMainAndPeriodDTO project : difficultyBaseList) {
if (agencyMap.get(project.getAgencyId()) == null || bizProjectInfoMap.get(project.getId()) == null) {
log.warn("未获取到相关的项目信息或者项目的所属组织信息,agencyId:{},projectId:{}",project.getAgencyId(),project.getId());
continue;
}
//判断是否符合难点堵点条件
if (!valideProjectIdSet.contains(project.getId())) {
continue;
}
ScreenDifficultyDataEntity diffEntity = buildBaseDiffEntity(project, agencyMap, gridMap, bizProjectInfoMap);
Set<String> regCount = orgCountMap.get(project.getId());
if (regCount != null) {
diffEntity.setEventReOrg(regCount.size());
} else {
diffEntity.setEventReOrg(0);
}
Integer handleOrgCount = handleCountMap.get(project.getId());
if (handleOrgCount != null) {
diffEntity.setEventHandledCount(handleOrgCount);
} else {
diffEntity.setEventHandledCount(0);
}
diffEntity.setDataEndTime(StringUtils.isBlank(param.getDateId())?DateUtils.getBeforeNDay(NumConstant.ONE):param.getDateId());
setCategoryInfo(diffEntity, project.getId(), categoryList, projectCategoryMap);
if (StringUtils.isNotBlank(project.getTopicId())) {
//获取图片及话题内容
ResiTopicAndImgResultDTO topicInfo = topicService.getTopicAndImgs(project.getTopicId(), "image");
if (topicInfo != null) {
List<TopicAttachmentDTO> topicImgList = topicInfo.getTopicImgList();
if (!CollectionUtils.isEmpty(topicImgList)){
diffEntity.setEventImgUrl(topicImgList.get(NumConstant.ZERO).getAttachmentUrl());
topicImgList.forEach(img -> {
ScreenDifficultyImgDataEntity imgData = new ScreenDifficultyImgDataEntity();
imgData.setEventId(project.getId());
imgData.setEventImgUrl(img.getAttachmentUrl());
imgData.setSort(img.getSort());
imgDataEntities.add(imgData);
imgData.setCustomerId(param.getCustomerId());
});
}
diffEntity.setEventContent(topicInfo.getTopicContent());
log.info("projectId:{} imgs:{}", project.getId(), imgDataEntities.stream().filter(o -> o.getEventId().equals(project.getId())).count());
}
diffEntity.setEventContent(topicInfo.getTopicContent());
log.info("projectId:{} imgs:{}", project.getId(), imgDataEntities.stream().filter(o -> o.getEventId().equals(project.getId())).count());
}
diffList.add(diffEntity);
}
diffList.add(diffEntity);
}
log.info("========:" + JSON.toJSONString(diffList));
log.info("========:" + JSON.toJSONString(imgDataEntities));
screenDifficultyDataService.dataClean(param.getCustomerId(),diffList,imgDataEntities);
} while (!CollectionUtils.isEmpty(difficultyBaseList)&&difficultyBaseList.size()==pageSize);
//log.info("【大屏数据抽取-难点赌点执行完毕】 客户Id{} 难点赌点数据{}", param.getCustomerId(), JSON.toJSONString(diffList));
//3.获取项目的最后操作记录
return true;
log.info("========:" + JSON.toJSONString(diffList));
log.info("========:" + JSON.toJSONString(imgDataEntities));
screenDifficultyDataService.dataClean(param.getCustomerId(),diffList,imgDataEntities);
log.info("difficultyDataExtract excute pageNo:{}",pageNo);
} while (!CollectionUtils.isEmpty(difficultyBaseList)&&difficultyBaseList.size()==pageSize);
//3.获取项目的最后操作记录
return true;
} finally {
log.info("【大屏数据抽取-难点赌点执行完毕】 客户Id{}", param.getCustomerId());
}
}
/**

11
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectMainDailyDao.xml

@ -668,10 +668,19 @@
m.id, m.date_id dateId, m.customer_id, m.issue_id, m.topic_id, m.grid_id,
m.pid, m.pids, m.agency_id, m.project_status, m.is_resolved,
m.topic_creator_id, m.is_party, m.is_overdue, m.finish_org_ids
<if test="param.isFirst == null or !param.isFirst">
, IFNULL(b.DATE_ID, DATE_FORMAT( now(), '%Y%m%d' )) as updateDate
</if>
FROM fact_origin_project_main_daily m
<if test="param.isFirst == null or !param.isFirst">
LEFT JOIN fact_origin_project_log_daily b ON m.ID = b.PROJECT_ID AND b.ACTION_CODE = 'close'
</if>
WHERE
m.CUSTOMER_ID = #{customerId}
m.CUSTOMER_ID = #{param.customerId}
AND m.DEL_FLAG = '0'
<if test="param.isFirst == null or !param.isFirst">
HAVING updateDate>= #{param.internalDay}
</if>
LIMIT #{offset} ,#{pageSize}
</select>
<select id="getProjectPeriodForDiff" resultType="com.epmet.entity.evaluationindex.extract.FactOriginProjectOrgPeriodDailyEntity">

15
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcCommunitySelfOrganizationController.java

@ -17,11 +17,16 @@
package com.epmet.controller;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
import cn.hutool.poi.excel.ExcelUtil;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.aop.NoRepeatSubmit;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.ExcelUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.AssertUtils;
@ -36,7 +41,9 @@ import com.epmet.dto.result.CommunitySelfOrganizationListResultDTO;
import com.epmet.dto.result.demand.OptionDTO;
import com.epmet.excel.ExportCommunitySelfOrganizationExcel;
import com.epmet.excel.IcCommunitySelfOrganizationExcel;
import com.epmet.excel.ImportCommunitySelfOrganizationSon;
import com.epmet.service.IcCommunitySelfOrganizationService;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.io.FilenameUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -113,7 +120,13 @@ public class IcCommunitySelfOrganizationController {
@PostMapping("exportcommunityselforganization")
public void exportCommunitySelfOrganization(HttpServletResponse response,@LoginUser TokenDto tokenDto,@RequestBody CommunitySelfOrganizationListFormDTO formDTO) throws Exception {
CommunitySelfOrganizationListResultDTO resultDTO = icCommunitySelfOrganizationService.communitySelfOrganizationList(tokenDto, formDTO);
ExcelUtils.exportExcelToTarget(response, null, resultDTO.getList(), ExportCommunitySelfOrganizationExcel.class);
List<ExportCommunitySelfOrganizationExcel> r = ConvertUtils.sourceToTarget(resultDTO.getList(), ExportCommunitySelfOrganizationExcel.class);
r.forEach(c -> {
if (CollectionUtils.isNotEmpty(c.getOrganizationPersonnel())){
c.setOrganizationPersonnel(ConvertUtils.sourceToTarget(c.getOrganizationPersonnel(), ImportCommunitySelfOrganizationSon.class));
}
});
ExcelUtils.exportExcelToTarget(response, null, r, ExportCommunitySelfOrganizationExcel.class);
}
/**

24
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/ExportCommunitySelfOrganizationExcel.java

@ -1,31 +1,37 @@
package com.epmet.excel;
import cn.afterturn.easypoi.excel.annotation.CellStyler;
import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelCollection;
import com.epmet.dto.IcCommunitySelfOrganizationPersonnelDTO;
import lombok.Data;
import java.util.List;
@Data
public class ExportCommunitySelfOrganizationExcel {
@Excel(name = "排序")
private Integer sort;
// @Excel(name = "排序")
// private Integer sort;
@Excel(name = "组织名称", width = 40)
@Excel(name = "组织名称", width = 40, needMerge = true)
private String organizationName;
@Excel(name = "组织人数", width = 20)
@Excel(name = "组织人数", width = 20, needMerge = true)
private Integer organizationPersonCount;
@Excel(name = "负责人姓名", width = 20)
@Excel(name = "负责人", width = 20, needMerge = true)
private String principalName;
@Excel(name = "负责人电话", width = 20)
@Excel(name = "联系电话", width = 20, needMerge = true)
private String principalPhone;
@Excel(name = "服务事项", width = 60)
@Excel(name = "服务事项", width = 60, needMerge = true)
private String serviceItem;
@Excel(name = "社区自组织创建时间", width = 20)
@Excel(name = "创建时间", width = 20, needMerge = true)
private String organizationCreatedTime;
@ExcelCollection(name = "组织成员")
private List<ImportCommunitySelfOrganizationSon> organizationPersonnel;
}

2
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/ImportCommunitySelfOrganizationSon.java

@ -14,7 +14,7 @@ public class ImportCommunitySelfOrganizationSon {
@Excel(name = "姓名")
private String personName;
@Excel(name = "电话")
@Excel(name = "电话", width = 20)
private String personPhone;
}

Loading…
Cancel
Save