|
|
@ -34,6 +34,7 @@ import com.epmet.constants.ImportTaskConstants; |
|
|
|
import com.epmet.dao.IcCommunitySelfOrganizationDao; |
|
|
|
import com.epmet.dao.IcUserDemandRecDao; |
|
|
|
import com.epmet.dto.IcCommunitySelfOrganizationDTO; |
|
|
|
import com.epmet.dto.SysDictDataDTO; |
|
|
|
import com.epmet.dto.form.*; |
|
|
|
import com.epmet.dto.form.demand.ServiceQueryFormDTO; |
|
|
|
import com.epmet.dto.result.*; |
|
|
@ -716,20 +717,20 @@ public class IcCommunitySelfOrganizationServiceImpl extends BaseServiceImpl<IcCo |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public List<SelfOrgCategoryTotalResDTO> querySelfOrgCategoryTotal(String customerId, String staffId) { |
|
|
|
Result<Map<String, String>> dictMapRes = adminOpenFeignClient.dictMap(DictTypeEnum.SELF_ORG_CATEGORY.getCode()); |
|
|
|
if (!dictMapRes.success() || MapUtils.isEmpty(dictMapRes.getData())) { |
|
|
|
Result<List<SysDictDataDTO>> dictDataListRes = adminOpenFeignClient.dictDataList(DictTypeEnum.SELF_ORG_CATEGORY.getCode()); |
|
|
|
if (!dictDataListRes.success() || CollectionUtils.isEmpty(dictDataListRes.getData())) { |
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "社区自组织分类查询异常"); |
|
|
|
} |
|
|
|
CustomerStaffInfoCacheResult staffInfo=getStaffInfo(customerId,staffId); |
|
|
|
CustomerStaffInfoCacheResult staffInfo = getStaffInfo(customerId, staffId); |
|
|
|
List<SelfOrgCategoryTotalResDTO> list = baseDao.selectCountGroupByCategory(customerId, staffInfo.getAgencyId()); |
|
|
|
Map<String, Integer> map = list.stream().collect(Collectors.toMap(SelfOrgCategoryTotalResDTO::getCategoryCode, SelfOrgCategoryTotalResDTO::getTotal, (key1, key2) -> key2)); |
|
|
|
List<SelfOrgCategoryTotalResDTO> resultList = new ArrayList<>(); |
|
|
|
for (String key : dictMapRes.getData().keySet()) { |
|
|
|
for (SysDictDataDTO dict : dictDataListRes.getData()) { |
|
|
|
SelfOrgCategoryTotalResDTO resDTO = new SelfOrgCategoryTotalResDTO(); |
|
|
|
resDTO.setCategoryCode(key); |
|
|
|
resDTO.setCategoryName(dictMapRes.getData().get(key)); |
|
|
|
resDTO.setTotal(map.containsKey(key) ? map.get(key) : NumConstant.ZERO); |
|
|
|
resDTO.setColor(SelfOrgCategoryEnum.getEnum(key).getColor()); |
|
|
|
resDTO.setCategoryCode(dict.getDictValue()); |
|
|
|
resDTO.setCategoryName(dict.getDictLabel()); |
|
|
|
resDTO.setTotal(map.containsKey(dict.getDictValue()) ? map.get(dict.getDictValue()) : NumConstant.ZERO); |
|
|
|
resDTO.setColor(SelfOrgCategoryEnum.getEnum(dict.getDictValue()).getColor()); |
|
|
|
resultList.add(resDTO); |
|
|
|
} |
|
|
|
return resultList; |
|
|
|