Browse Source

联建单位-按分类统计数量及占比

dev
HAHA 3 years ago
parent
commit
e69d596c1c
  1. 22
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/PartyTypepercentFormDTO.java
  2. 33
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/PartyTypepercentResultDTO.java
  3. 48
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcPartyUnitController.java
  4. 19
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcPartyUnitDao.java
  5. 17
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcPartyUnitService.java
  6. 85
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyUnitServiceImpl.java
  7. 13
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcPartyUnitDao.xml

22
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/PartyTypepercentFormDTO.java

@ -0,0 +1,22 @@
package com.epmet.dto.form;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotBlank;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class PartyTypepercentFormDTO {
private static final long serialVersionUID = -3833404131164761022L;
/**
* 组织id
*/
@NotBlank(message = "组织id不能为空")
private String agencyId;
}

33
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/PartyTypepercentResultDTO.java

@ -0,0 +1,33 @@
package com.epmet.dto.result;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class PartyTypepercentResultDTO {
private static final long serialVersionUID = -5256798094892121661L;
/**
* 联建单位类型
*/
private String label;
/**
* 数量
*/
private String value;
/**
* 联建单位编码
*/
private String code;
/**
* 联建单位数量占比(%)
*/
private String percent;
}

48
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcPartyUnitController.java

@ -33,12 +33,10 @@ import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.constants.ImportTaskConstants;
import com.epmet.dto.IcPartyUnitDTO;
import com.epmet.dto.form.ImportTaskCommonFormDTO;
import com.epmet.dto.form.PartyActivityFormDTO;
import com.epmet.dto.form.PartyUnitFormDTO;
import com.epmet.dto.form.PartyUnitListbriefFormDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.form.demand.ServiceQueryFormDTO;
import com.epmet.dto.result.ImportTaskCommonResultDTO;
import com.epmet.dto.result.PartyTypepercentResultDTO;
import com.epmet.dto.result.PartyUnitDistributionResultDTO;
import com.epmet.dto.result.PartyUnitListbrieResultDTO;
import com.epmet.dto.result.demand.OptionDTO;
@ -88,14 +86,14 @@ public class IcPartyUnitController {
@PostMapping("list")
public Result<PageData<IcPartyUnitDTO>> search(@LoginUser TokenDto tokenDto, @RequestBody PartyUnitFormDTO formDTO){
public Result<PageData<IcPartyUnitDTO>> search(@LoginUser TokenDto tokenDto, @RequestBody PartyUnitFormDTO formDTO) {
formDTO.setCustomerId(tokenDto.getCustomerId());
PageData<IcPartyUnitDTO> page = icPartyUnitService.search(formDTO);
return new Result<PageData<IcPartyUnitDTO>>().ok(page);
}
@PostMapping("detail")
public Result<IcPartyUnitDTO> get(@RequestBody IcPartyUnitDTO formDTO){
public Result<IcPartyUnitDTO> get(@RequestBody IcPartyUnitDTO formDTO) {
AssertUtils.isBlank(formDTO.getId(), "id");
IcPartyUnitDTO data = icPartyUnitService.get(formDTO.getId());
return new Result<IcPartyUnitDTO>().ok(data);
@ -103,7 +101,7 @@ public class IcPartyUnitController {
@PostMapping("save")
@NoRepeatSubmit
public Result save(@LoginUser TokenDto tokenDto, @RequestBody IcPartyUnitDTO dto){
public Result save(@LoginUser TokenDto tokenDto, @RequestBody IcPartyUnitDTO dto) {
//效验数据
dto.setCustomerId(tokenDto.getCustomerId());
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
@ -112,7 +110,7 @@ public class IcPartyUnitController {
}
@PostMapping("delete")
public Result delete(@RequestBody IcPartyUnitDTO dto){
public Result delete(@RequestBody IcPartyUnitDTO dto) {
//效验数据
AssertUtils.isBlank(dto.getId(), "id");
icPartyUnitService.delete(dto.getId());
@ -152,21 +150,22 @@ public class IcPartyUnitController {
* @return
*/
@PostMapping("servicelist")
public Result<List<OptionDTO>> queryServiceList(@LoginUser TokenDto tokenDto, @RequestBody ServiceQueryFormDTO formDTO){
public Result<List<OptionDTO>> queryServiceList(@LoginUser TokenDto tokenDto, @RequestBody ServiceQueryFormDTO formDTO) {
formDTO.setCustomerId(tokenDto.getCustomerId());
formDTO.setStaffId(tokenDto.getUserId());
ValidatorUtils.validateEntity(formDTO,ServiceQueryFormDTO.AddUserInternalGroup.class);
ValidatorUtils.validateEntity(formDTO, ServiceQueryFormDTO.AddUserInternalGroup.class);
return new Result<List<OptionDTO>>().ok(icPartyUnitService.queryServiceList(formDTO));
}
@PostMapping("option")
public Result<List<OptionDTO>> option(@RequestBody IcPartyUnitDTO dto){
public Result<List<OptionDTO>> option(@RequestBody IcPartyUnitDTO dto) {
AssertUtils.isBlank(dto.getAgencyId(), "agencyId");
return new Result<List<OptionDTO>>().ok(icPartyUnitService.option(dto));
}
/**
* 数据导入
*
* @Param tokenDto
* @Param response
* @Param file
@ -218,7 +217,7 @@ public class IcPartyUnitController {
* @Date 2021/12/8 14:52
*/
@PostMapping("typestatistics")
public Result<List<OptionDataResultDTO>> typeStatistics(@RequestBody PartyActivityFormDTO formDTO){
public Result<List<OptionDataResultDTO>> typeStatistics(@RequestBody PartyActivityFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO);
return new Result<List<OptionDataResultDTO>>().ok(icPartyUnitService.typeStatistics(formDTO));
}
@ -231,7 +230,7 @@ public class IcPartyUnitController {
* @Date 2021/12/9 10:11
*/
@PostMapping("distribution")
public Result<List<PartyUnitDistributionResultDTO>> distribution(@RequestBody PartyActivityFormDTO formDTO){
public Result<List<PartyUnitDistributionResultDTO>> distribution(@RequestBody PartyActivityFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO);
return new Result<List<PartyUnitDistributionResultDTO>>().ok(icPartyUnitService.distribution(formDTO));
}
@ -245,12 +244,27 @@ public class IcPartyUnitController {
* @date 2022/5/18 13:54
*/
@PostMapping("/listbrief")
public Result<PageData> getListbrief(@RequestBody PartyUnitListbriefFormDTO form,@LoginUser TokenDto tokenDto){
public Result<PageData> getListbrief(@RequestBody PartyUnitListbriefFormDTO form, @LoginUser TokenDto tokenDto) {
ValidatorUtils.validateEntity(form);
PageData data = icPartyUnitService.getListbrief(form,tokenDto);
PageData data = icPartyUnitService.getListbrief(form, tokenDto);
return new Result<PageData>().ok(data);
}
/**
* 联建单位-按分类统计数量及占比
*
* @param form
* @return com.epmet.commons.tools.utils.Result<java.util.List < com.epmet.dto.result.PartyTypepercentResultDTO>>
* @author LZN
* @date 2022/5/18 16:42
*/
@PostMapping("/statistics/typepercent")
public Result<List<PartyTypepercentResultDTO>> getTypepercent(@RequestBody PartyTypepercentFormDTO form) {
ValidatorUtils.validateEntity(form);
List<PartyTypepercentResultDTO> dto = icPartyUnitService.getTypepercent(form);
return new Result<List<PartyTypepercentResultDTO>>().ok(dto);
}
/**
* 计算区域化党建单位的群众满意度
*
@ -258,8 +272,8 @@ public class IcPartyUnitController {
* @return
*/
@PostMapping("cal-partyunit-satisfation")
public Result calPartyUnitSatisfation(@RequestBody ServerSatisfactionCalFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO,ServerSatisfactionCalFormDTO.AddUserInternalGroup.class);
public Result calPartyUnitSatisfation(@RequestBody ServerSatisfactionCalFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, ServerSatisfactionCalFormDTO.AddUserInternalGroup.class);
icPartyUnitService.calPartyUnitSatisfation(formDTO);
return new Result();
}

19
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcPartyUnitDao.java

@ -19,7 +19,9 @@ package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.commons.tools.dto.result.OptionDataResultDTO;
import com.epmet.dto.form.PartyTypepercentFormDTO;
import com.epmet.dto.form.PartyUnitListbriefFormDTO;
import com.epmet.dto.result.PartyTypepercentResultDTO;
import com.epmet.dto.result.PartyUnitDistributionResultDTO;
import com.epmet.dto.result.PartyUnitListbrieResultDTO;
import com.epmet.dto.result.demand.OptionDTO;
@ -41,22 +43,24 @@ public interface IcPartyUnitDao extends BaseDao<IcPartyUnitEntity> {
/**
* 需求指派选择区域化党建单位调用此接口
*
* @param agencyIds
* @param unitName
* @return
*/
List<OptionDTO> selectListByAgencyId(@Param("agencyIds") List<String> agencyIds,
@Param("unitName") String unitName,
@Param("customerId")String customerId);
@Param("customerId") String customerId);
/**
* 单位分类统计
*
* @Param agencyId
* @Return {@link java.util.List<com.epmet.commons.tools.dto.result.OptionDataResultDTO>}
* @Author zhaoqifeng
* @Date 2021/12/8 15:25
*/
List<OptionDataResultDTO> getTypeStatistics(@Param("agencyId")String agencyId);
List<OptionDataResultDTO> getTypeStatistics(@Param("agencyId") String agencyId);
/**
* @Description 联建单位分布
@ -65,7 +69,7 @@ public interface IcPartyUnitDao extends BaseDao<IcPartyUnitEntity> {
* @Author zhaoqifeng
* @Date 2021/12/9 14:24
*/
List<PartyUnitDistributionResultDTO> getDistribution(@Param("agencyId")String agencyId);
List<PartyUnitDistributionResultDTO> getDistribution(@Param("agencyId") String agencyId);
int updateSatisfaction(@Param("partyUnitId") String serverId, @Param("satisfaction") BigDecimal satisfaction);
@ -77,5 +81,12 @@ public interface IcPartyUnitDao extends BaseDao<IcPartyUnitEntity> {
* @author LZN
* @date 2022/5/18 13:54
*/
List<PartyUnitListbrieResultDTO> getListbrief(PartyUnitListbriefFormDTO form,String customerId);
List<PartyUnitListbrieResultDTO> getListbrief(PartyUnitListbriefFormDTO form, String customerId);
/**
* 联建单位-按分类统计数量及占比
*
* @param agencyId
*/
List<PartyTypepercentResultDTO> getTypepercent(@Param("agencyId") String agencyId);
}

17
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcPartyUnitService.java

@ -24,9 +24,11 @@ import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.dto.IcPartyUnitDTO;
import com.epmet.dto.form.PartyActivityFormDTO;
import com.epmet.dto.form.PartyTypepercentFormDTO;
import com.epmet.dto.form.PartyUnitFormDTO;
import com.epmet.dto.form.PartyUnitListbriefFormDTO;
import com.epmet.dto.form.demand.ServiceQueryFormDTO;
import com.epmet.dto.result.PartyTypepercentResultDTO;
import com.epmet.dto.result.PartyUnitDistributionResultDTO;
import com.epmet.dto.result.PartyUnitListbrieResultDTO;
import com.epmet.dto.result.demand.OptionDTO;
@ -83,7 +85,7 @@ public interface IcPartyUnitService extends BaseService<IcPartyUnitEntity> {
* @author generator
* @date 2021-11-19
*/
void save(TokenDto tokenDto, IcPartyUnitDTO dto);
void save(TokenDto tokenDto, IcPartyUnitDTO dto);
/**
@ -126,6 +128,7 @@ public interface IcPartyUnitService extends BaseService<IcPartyUnitEntity> {
/**
* 导入数据
*
* @Param tokenDto
* @Param response
* @Param file
@ -146,6 +149,7 @@ public interface IcPartyUnitService extends BaseService<IcPartyUnitEntity> {
/**
* 联建单位分布
*
* @Param formDTO
* @Return {@link List< PartyUnitDistributionResultDTO>}
* @Author zhaoqifeng
@ -155,6 +159,7 @@ public interface IcPartyUnitService extends BaseService<IcPartyUnitEntity> {
/**
* 计算区域化党建单位的群众满意度
*
* @param formDTO
*/
void calPartyUnitSatisfation(ServerSatisfactionCalFormDTO formDTO);
@ -163,7 +168,15 @@ public interface IcPartyUnitService extends BaseService<IcPartyUnitEntity> {
/**
* 联建单位-简要信息列表
*
* @param form
*/
PageData getListbrief(PartyUnitListbriefFormDTO form, TokenDto tokenDto);
/**
* 联建单位-按分类统计数量及占比
*
* @param form
*/
PageData getListbrief(PartyUnitListbriefFormDTO form,TokenDto tokenDto);
List<PartyTypepercentResultDTO> getTypepercent(PartyTypepercentFormDTO form);
}

85
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyUnitServiceImpl.java

@ -39,7 +39,9 @@ import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.exception.ExceptionUtils;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.redis.common.CustomerOrgRedis;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.redis.common.bean.GridInfoCache;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.ExcelPoiUtils;
@ -48,11 +50,9 @@ import com.epmet.constant.UserDemandConstant;
import com.epmet.constants.ImportTaskConstants;
import com.epmet.dao.IcPartyUnitDao;
import com.epmet.dto.IcPartyUnitDTO;
import com.epmet.dto.form.ImportTaskCommonFormDTO;
import com.epmet.dto.form.PartyActivityFormDTO;
import com.epmet.dto.form.PartyUnitFormDTO;
import com.epmet.dto.form.PartyUnitListbriefFormDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.form.demand.ServiceQueryFormDTO;
import com.epmet.dto.result.PartyTypepercentResultDTO;
import com.epmet.dto.result.PartyUnitDistributionResultDTO;
import com.epmet.dto.result.PartyUnitListbrieResultDTO;
import com.epmet.dto.result.UploadImgResultDTO;
@ -128,10 +128,10 @@ public class IcPartyUnitServiceImpl extends BaseServiceImpl<IcPartyUnitDao, IcPa
List<IcPartyUnitEntity> list = baseDao.selectList(wrapper);
PageInfo<IcPartyUnitEntity> pageInfo = new PageInfo<>(list);
List<IcPartyUnitDTO> dtoList = ConvertUtils.sourceToTarget(list, IcPartyUnitDTO.class);
Result<Map<String, String>> unitTypeMap = epmetAdminOpenFeignClient.dictMap(DictTypeEnum.PARTY_UNIT_TYPE.getCode());
Result<Map<String, String>> unitTypeMap = epmetAdminOpenFeignClient.dictMap(DictTypeEnum.PARTY_UNIT_TYPE.getCode());
//服务事项列表从需求分类中抽离出来,改为查询ic_service_item_dict表
List<OptionDTO> serviceItemList=icServiceItemDictService.queryDictList(formDTO.getCustomerId());
Map<String, String> categoryMap=serviceItemList.stream().collect(Collectors.toMap(OptionDTO::getValue, OptionDTO::getLabel));
List<OptionDTO> serviceItemList = icServiceItemDictService.queryDictList(formDTO.getCustomerId());
Map<String, String> categoryMap = serviceItemList.stream().collect(Collectors.toMap(OptionDTO::getValue, OptionDTO::getLabel));
//获取单位积分
Map<String, Integer> pointMap = icUserDemandRecService.getServicePoint(formDTO.getCustomerId(), UserDemandConstant.PARTY_UNIT);
dtoList.forEach(item -> {
@ -142,12 +142,12 @@ public class IcPartyUnitServiceImpl extends BaseServiceImpl<IcPartyUnitDao, IcPa
} else {
item.setServiceMatterList(new ArrayList<>());
}
if(StringUtils.isBlank(item.getSatisfaction())){
if (StringUtils.isBlank(item.getSatisfaction())) {
item.setSatisfaction(StrConstant.HYPHEN);
}else{
item.setSatisfaction(new BigDecimal(item.getSatisfaction()).setScale(2,BigDecimal.ROUND_HALF_UP).toString());
} else {
item.setSatisfaction(new BigDecimal(item.getSatisfaction()).setScale(2, BigDecimal.ROUND_HALF_UP).toString());
}
item.setScore(null == pointMap.get(item.getId())?NumConstant.ZERO:pointMap.get(item.getId()));
item.setScore(null == pointMap.get(item.getId()) ? NumConstant.ZERO : pointMap.get(item.getId()));
});
return new PageData<>(dtoList, pageInfo.getTotal());
}
@ -164,10 +164,10 @@ public class IcPartyUnitServiceImpl extends BaseServiceImpl<IcPartyUnitDao, IcPa
wrapper.orderByDesc(IcPartyUnitEntity::getUpdatedTime);
List<IcPartyUnitEntity> list = baseDao.selectList(wrapper);
List<IcPartyUnitDTO> dtoList = ConvertUtils.sourceToTarget(list, IcPartyUnitDTO.class);
Result<Map<String, String>> unitTypeMap = epmetAdminOpenFeignClient.dictMap(DictTypeEnum.PARTY_UNIT_TYPE.getCode());
Result<Map<String, String>> unitTypeMap = epmetAdminOpenFeignClient.dictMap(DictTypeEnum.PARTY_UNIT_TYPE.getCode());
//服务事项列表从需求分类中抽离出来,改为查询ic_service_item_dict表
List<OptionDTO> serviceItemList=icServiceItemDictService.queryDictList(formDTO.getCustomerId());
Map<String, String> categoryMap=serviceItemList.stream().collect(Collectors.toMap(OptionDTO::getValue, OptionDTO::getLabel));
List<OptionDTO> serviceItemList = icServiceItemDictService.queryDictList(formDTO.getCustomerId());
Map<String, String> categoryMap = serviceItemList.stream().collect(Collectors.toMap(OptionDTO::getValue, OptionDTO::getLabel));
//获取单位积分
Map<String, Integer> pointMap = icUserDemandRecService.getServicePoint(formDTO.getCustomerId(), UserDemandConstant.PARTY_UNIT);
dtoList.forEach(item -> {
@ -178,13 +178,13 @@ public class IcPartyUnitServiceImpl extends BaseServiceImpl<IcPartyUnitDao, IcPa
} else {
item.setServiceMatterList(new ArrayList<>());
}
item.setScore(null == pointMap.get(item.getId())?NumConstant.ZERO:pointMap.get(item.getId()));
item.setScore(null == pointMap.get(item.getId()) ? NumConstant.ZERO : pointMap.get(item.getId()));
});
return dtoList;
}
private QueryWrapper<IcPartyUnitEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
private QueryWrapper<IcPartyUnitEntity> getWrapper(Map<String, Object> params) {
String id = (String) params.get(FieldConstant.ID_HUMP);
QueryWrapper<IcPartyUnitEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
@ -200,14 +200,14 @@ public class IcPartyUnitServiceImpl extends BaseServiceImpl<IcPartyUnitDao, IcPa
//获取单位积分
Map<String, Integer> pointMap = icUserDemandRecService.getServicePoint(entity.getCustomerId(), UserDemandConstant.PARTY_UNIT);
dto.setServiceMatterList(Arrays.asList(dto.getServiceMatter().split(StrConstant.COMMA)));
dto.setScore(null == pointMap.get(id)?NumConstant.ZERO:pointMap.get(id));
dto.setScore(null == pointMap.get(id) ? NumConstant.ZERO : pointMap.get(id));
}
return dto;
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(TokenDto tokenDto, IcPartyUnitDTO dto) {
public void save(TokenDto tokenDto, IcPartyUnitDTO dto) {
IcPartyUnitEntity entity = ConvertUtils.sourceToTarget(dto, IcPartyUnitEntity.class);
CustomerStaffInfoCacheResult staff = CustomerStaffRedis.getStaffInfo(tokenDto.getCustomerId(), tokenDto.getUserId());
entity.setAgencyId(staff.getAgencyId());
@ -219,7 +219,7 @@ public class IcPartyUnitServiceImpl extends BaseServiceImpl<IcPartyUnitDao, IcPa
wrapper.eq(IcPartyUnitEntity::getAgencyId, entity.getAgencyId());
wrapper.eq(IcPartyUnitEntity::getUnitName, entity.getUnitName());
List<IcPartyUnitEntity> list = baseDao.selectList(wrapper);
if(StringUtils.isBlank(entity.getId())) {
if (StringUtils.isBlank(entity.getId())) {
if (CollectionUtils.isNotEmpty(list)) {
throw new EpmetException(EpmetErrorCode.PARTY_UNIT_NAME_EXITED.getCode(), EpmetErrorCode.PARTY_UNIT_NAME_EXITED.getMsg(), EpmetErrorCode.PARTY_UNIT_NAME_EXITED.getMsg());
}
@ -258,19 +258,19 @@ public class IcPartyUnitServiceImpl extends BaseServiceImpl<IcPartyUnitDao, IcPa
if (StringUtils.isNotBlank(staffInfoCacheResult.getAgencyPIds()) && !NumConstant.ZERO_STR.equals(staffInfoCacheResult.getAgencyPIds())) {
if (staffInfoCacheResult.getAgencyPIds().contains(StrConstant.COLON)) {
agencyIds.addAll(Arrays.asList(staffInfoCacheResult.getAgencyPIds().split(StrConstant.COLON)));
}else{
} else {
//当前用户属于第二级组织的人,不会有:
agencyIds.add(staffInfoCacheResult.getAgencyPIds());
}
}
agencyIds.add(staffInfoCacheResult.getAgencyId());
resultList=baseDao.selectListByAgencyId(agencyIds,formDTO.getServiceName(),formDTO.getCustomerId());
resultList = baseDao.selectListByAgencyId(agencyIds, formDTO.getServiceName(), formDTO.getCustomerId());
return resultList;
}
/**
* @Description 获取组织下单位列表
* @param dto
* @Description 获取组织下单位列表
* @Return {@link List< OptionDTO>}
* @Author zhaoqifeng
* @Date 2021/11/22 14:35
@ -347,8 +347,8 @@ public class IcPartyUnitServiceImpl extends BaseServiceImpl<IcPartyUnitDao, IcPa
if (null == staffInfoCache) {
throw new EpmetException(8000, "获取用户缓存失败");
}
List<OptionDTO> serviceItemList=icServiceItemDictService.queryDictList(tokenDto.getCustomerId());
Map<String, String> categoryMap=serviceItemList.stream().collect(Collectors.toMap(OptionDTO::getValue, OptionDTO::getLabel));
List<OptionDTO> serviceItemList = icServiceItemDictService.queryDictList(tokenDto.getCustomerId());
Map<String, String> categoryMap = serviceItemList.stream().collect(Collectors.toMap(OptionDTO::getValue, OptionDTO::getLabel));
//1.数据校验
Iterator<IcPartyUnitImportExcel> iterator = result.iterator();
while (iterator.hasNext()) {
@ -519,6 +519,7 @@ public class IcPartyUnitServiceImpl extends BaseServiceImpl<IcPartyUnitDao, IcPa
throw new RenException(result.getInternalMsg());
}
}
/**
* @param formDTO
* @Description 按类型统计单位数量
@ -543,7 +544,7 @@ public class IcPartyUnitServiceImpl extends BaseServiceImpl<IcPartyUnitDao, IcPa
OptionDataResultDTO dto = new OptionDataResultDTO();
dto.setLabel(item.getLabel());
dto.setCode(item.getValue());
dto.setValue(null == map.get(item.getValue())?NumConstant.ZERO_STR:map.get(item.getValue()));
dto.setValue(null == map.get(item.getValue()) ? NumConstant.ZERO_STR : map.get(item.getValue()));
return dto;
}).collect(Collectors.toList());
}
@ -559,7 +560,7 @@ public class IcPartyUnitServiceImpl extends BaseServiceImpl<IcPartyUnitDao, IcPa
*/
@Override
public List<PartyUnitDistributionResultDTO> distribution(PartyActivityFormDTO formDTO) {
Result<Map<String, String>> unitTypeMap = epmetAdminOpenFeignClient.dictMap(DictTypeEnum.PARTY_UNIT_TYPE.getCode());
Result<Map<String, String>> unitTypeMap = epmetAdminOpenFeignClient.dictMap(DictTypeEnum.PARTY_UNIT_TYPE.getCode());
List<PartyUnitDistributionResultDTO> list = baseDao.getDistribution(formDTO.getAgencyId());
if (CollectionUtils.isEmpty(list)) {
return Collections.emptyList();
@ -573,35 +574,49 @@ public class IcPartyUnitServiceImpl extends BaseServiceImpl<IcPartyUnitDao, IcPa
/**
* 计算区域化党建单位的群众满意度
* 总分需求个数
*
* @param formDTO
*/
@Transactional(rollbackFor = Exception.class)
@Override
public void calPartyUnitSatisfation(ServerSatisfactionCalFormDTO formDTO) {
log.info("收到消息内容啦...." + JSON.toJSONString(formDTO));
List<ServiceStatDTO> list = icUserDemandRecService.groupByServer(formDTO.getCustomerId(), formDTO.getServerId(),formDTO.getServiceType());
List<ServiceStatDTO> list = icUserDemandRecService.groupByServer(formDTO.getCustomerId(), formDTO.getServerId(), formDTO.getServiceType());
for (ServiceStatDTO serviceStatDTO : list) {
if (0 != serviceStatDTO.getDemandCount()) {
BigDecimal result = serviceStatDTO.getTotalScore().divide(new BigDecimal(serviceStatDTO.getDemandCount()), 4, BigDecimal.ROUND_HALF_UP);
baseDao.updateSatisfaction(serviceStatDTO.getServerId(),result);
baseDao.updateSatisfaction(serviceStatDTO.getServerId(), result);
}
}
}
@Override
public List<IcPartyUnitEntity> queryListById(List<String> partyUnitIds) {
if(CollectionUtils.isNotEmpty(partyUnitIds)){
if (CollectionUtils.isNotEmpty(partyUnitIds)) {
return baseDao.selectBatchIds(partyUnitIds);
}
return Collections.EMPTY_LIST;
}
@Override
public PageData getListbrief(PartyUnitListbriefFormDTO form,TokenDto tokenDto) {
PageHelper.startPage(form.getPageNo(),form.getPageSize());
List<PartyUnitListbrieResultDTO> dto = baseDao.getListbrief(form,tokenDto.getCustomerId());
PageInfo<PartyUnitListbrieResultDTO> info = new PageInfo<>(dto);
return new PageData<>(dto,info.getTotal());
public PageData getListbrief(PartyUnitListbriefFormDTO form, TokenDto tokenDto) {
PageHelper.startPage(form.getPageNo(), form.getPageSize());
List<PartyUnitListbrieResultDTO> dto = baseDao.getListbrief(form, tokenDto.getCustomerId());
PageInfo<PartyUnitListbrieResultDTO> info = new PageInfo<>(dto);
return new PageData<>(dto, info.getTotal());
}
@Override
public List<PartyTypepercentResultDTO> getTypepercent(PartyTypepercentFormDTO form) {
List<PartyTypepercentResultDTO> dto = baseDao.getTypepercent(form.getAgencyId());
int total = 0;
for (PartyTypepercentResultDTO item : dto) {
total = Integer.parseInt(item.getValue()) + total;
}
for (PartyTypepercentResultDTO item : dto) {
item.setPercent((Integer.parseInt(item.getValue()) * 100) / total + "%");
}
return dto;
}
private String getServiceMatter(Map<String, String> map, String matter) {

13
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcPartyUnitDao.xml

@ -110,6 +110,19 @@
order by
a.CREATED_TIME
</select>
<select id="getTypepercent" resultType="com.epmet.dto.result.PartyTypepercentResultDTO">
SELECT
a.type AS label,
count( a.type ) AS value,
a.id AS CODE
FROM
ic_party_unit a
WHERE
a.DEL_FLAG = '0'
AND a.AGENCY_ID = #{agencyId}
GROUP BY
a.type
</select>
<update id="updateSatisfaction" parameterType="map">
update ic_party_unit

Loading…
Cancel
Save