Browse Source

社区党建数据分析

dev
zhaoqifeng 4 years ago
parent
commit
5b7ceebe5a
  1. 23
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyActivityServiceImpl.java

23
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyActivityServiceImpl.java

@ -72,6 +72,10 @@ public class IcPartyActivityServiceImpl extends BaseServiceImpl<IcPartyActivityD
private IcPartyUnitService icPartyUnitService;
@Resource
private IcResiDemandDictService icResiDemandDictService;
/**
* 服务事项code
*/
private static final String SERVICE_MATTER_CODE = "1010";
@Override
public PageData<IcPartyActivityDTO> search(PartyActivityFormDTO formDTO) {
@ -152,7 +156,7 @@ public class IcPartyActivityServiceImpl extends BaseServiceImpl<IcPartyActivityD
IcPartyActivityEntity entity = baseDao.selectById(id);
SubCodeFormDTO codeFormDTO = new SubCodeFormDTO();
codeFormDTO.setCustomerId(entity.getCustomerId());
codeFormDTO.setParentCategoryCode("1010");
codeFormDTO.setParentCategoryCode(SERVICE_MATTER_CODE);
Map<String, String> categoryMap = icResiDemandDictService.querySubCodeList(codeFormDTO).stream().collect(Collectors.toMap(OptionDTO::getValue, OptionDTO::getLabel));
IcPartyActivityDTO dto = ConvertUtils.sourceToTarget(entity, IcPartyActivityDTO.class);
dto.setServiceMatterName(categoryMap.get(dto.getServiceMatter()));
@ -213,7 +217,7 @@ public class IcPartyActivityServiceImpl extends BaseServiceImpl<IcPartyActivityD
//获取服务事项
SubCodeFormDTO codeFormDTO = new SubCodeFormDTO();
codeFormDTO.setCustomerId(tokenDto.getCustomerId());
codeFormDTO.setParentCategoryCode("1010");
codeFormDTO.setParentCategoryCode(SERVICE_MATTER_CODE);
Map<String, String> categoryMap = icResiDemandDictService.querySubCodeList(codeFormDTO).stream().collect(Collectors.toMap(OptionDTO::getLabel, OptionDTO::getValue));
//获取联建单位
IcPartyUnitDTO unitDTO = new IcPartyUnitDTO();
@ -338,6 +342,7 @@ public class IcPartyActivityServiceImpl extends BaseServiceImpl<IcPartyActivityD
setDate(formDTO);
}
PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize());
//获取活动列表
LambdaQueryWrapper<IcPartyActivityEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.and(wp -> wp.eq(IcPartyActivityEntity::getAgencyId, formDTO.getAgencyId()).or().
like(IcPartyActivityEntity::getPids, formDTO.getAgencyId()));
@ -351,11 +356,14 @@ public class IcPartyActivityServiceImpl extends BaseServiceImpl<IcPartyActivityD
IcPartyUnitDTO unitDTO = new IcPartyUnitDTO();
unitDTO.setAgencyId(formDTO.getAgencyId());
if (CollectionUtils.isNotEmpty(dtoList)) {
//获取联建单位
Map<String, String> option = icPartyUnitService.option(unitDTO).stream().collect(Collectors.toMap(OptionDTO::getValue, OptionDTO::getLabel));
//获取服务事项字典
SubCodeFormDTO codeFormDTO = new SubCodeFormDTO();
codeFormDTO.setCustomerId(tokenDto.getCustomerId());
codeFormDTO.setParentCategoryCode("1010");
codeFormDTO.setParentCategoryCode(SERVICE_MATTER_CODE);
Map<String, String> categoryMap = icResiDemandDictService.querySubCodeList(codeFormDTO).stream().collect(Collectors.toMap(OptionDTO::getValue, OptionDTO::getLabel));
//数据组装
dtoList.forEach(dto -> {
dto.setServiceMatterName(categoryMap.get(dto.getServiceMatter()));
dto.setUnitName(option.get(dto.getUnitId()));
@ -365,9 +373,16 @@ public class IcPartyActivityServiceImpl extends BaseServiceImpl<IcPartyActivityD
return new PageData<>(dtoList, pageInfo.getTotal());
}
/**
* 近30天开始时间和结束时间 精确到秒
* @Param formDTO
* @Return
* @Author zhaoqifeng
* @Date 2021/12/13 17:40
*/
private void setDate(PartyActivityFormDTO formDTO) {
String start = DateUtils.getBeforeNDay(30);
formDTO.setEndTime(DateUtils.parse(start.concat("000000"), DateUtils.DATE_TIME_NO_SPLIT));
formDTO.setStartTime(DateUtils.parse(start.concat("000000"), DateUtils.DATE_TIME_NO_SPLIT));
String end = DateUtils.format(new Date(), DateUtils.DATE_PATTERN);
formDTO.setEndTime(DateUtils.parse(end.concat(" 23:59:59"), DateUtils.DATE_TIME_PATTERN));
}

Loading…
Cancel
Save