|
|
@ -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) { |
|
|
|