|
|
@ -28,6 +28,8 @@ import com.epmet.dto.form.ImportTaskCommonFormDTO; |
|
|
|
import com.epmet.dto.result.IcCoverageCategoryDictListResultDTO; |
|
|
|
import com.epmet.dto.result.IcDangerousChemicalsListResultDTO; |
|
|
|
import com.epmet.dto.result.UploadImgResultDTO; |
|
|
|
import com.epmet.dto.result.lingshan.DangerousChemicalsTypeStatDetailDTO; |
|
|
|
import com.epmet.dto.result.lingshan.DangerousChemicalsTypeStatResultDTO; |
|
|
|
import com.epmet.entity.IcDangerousChemicalsEntity; |
|
|
|
import com.epmet.feign.EpmetAdminOpenFeignClient; |
|
|
|
import com.epmet.feign.EpmetCommonServiceOpenFeignClient; |
|
|
@ -59,10 +61,7 @@ import java.io.IOException; |
|
|
|
import java.io.OutputStream; |
|
|
|
import java.nio.file.Files; |
|
|
|
import java.nio.file.Path; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.UUID; |
|
|
|
import java.util.*; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
/** |
|
|
@ -115,7 +114,7 @@ public class IcDangerousChemicalsServiceImpl extends BaseServiceImpl<IcDangerous |
|
|
|
Result<Map<String, String>> statusRes = adminOpenFeignClient.dictMap(DictTypeEnum.IC_DANGER_TYPE.getCode()); |
|
|
|
Map<String, String> statusMap = statusRes.success() && MapUtils.isNotEmpty(statusRes.getData()) ? statusRes.getData() : new HashMap<>(); |
|
|
|
//企业类别字典数据
|
|
|
|
List<IcCoverageCategoryDictListResultDTO> dictList = coverageService.dictMap(formDTO.getCustomerId(), "dangerous_chemicals"); |
|
|
|
List<IcCoverageCategoryDictListResultDTO> dictList = coverageService.dictMap(formDTO.getCustomerId(), CoveragePlaceTypeEnum.DANGEROUS_CHEMICALS.getCode()); |
|
|
|
Map<String, String> dictMap = dictList.stream().collect(Collectors.toMap(IcCoverageCategoryDictListResultDTO::getValue, IcCoverageCategoryDictListResultDTO::getLabel)); |
|
|
|
for (IcDangerousChemicalsListResultDTO v : list) { |
|
|
|
if (StringUtils.isNotBlank(v.getCategory())) { |
|
|
@ -225,7 +224,7 @@ public class IcDangerousChemicalsServiceImpl extends BaseServiceImpl<IcDangerous |
|
|
|
Result<Map<String, String>> statusRes = adminOpenFeignClient.dictMap(DictTypeEnum.IC_DANGER_TYPE.getCode()); |
|
|
|
Map<String, String> statusMap = statusRes.success() && MapUtils.isNotEmpty(statusRes.getData()) ? statusRes.getData() : new HashMap<>(); |
|
|
|
//企业类别字典数据
|
|
|
|
List<IcCoverageCategoryDictListResultDTO> dictList = coverageService.dictMap(formDTO.getCustomerId(), "city_management"); |
|
|
|
List<IcCoverageCategoryDictListResultDTO> dictList = coverageService.dictMap(formDTO.getCustomerId(), CoveragePlaceTypeEnum.DANGEROUS_CHEMICALS.getCode()); |
|
|
|
Map<String, String> dictMap = dictList.stream().collect(Collectors.toMap(IcCoverageCategoryDictListResultDTO::getValue, IcCoverageCategoryDictListResultDTO::getLabel)); |
|
|
|
if (StringUtils.isNotBlank(resultDTO.getCategory())) { |
|
|
|
resultDTO.setCategoryName(dictMap.get(resultDTO.getCategory())); |
|
|
@ -355,4 +354,89 @@ public class IcDangerousChemicalsServiceImpl extends BaseServiceImpl<IcDangerous |
|
|
|
queryWrapper.eq(IcDangerousChemicalsEntity::getOrgId,orgId).eq(IcDangerousChemicalsEntity::getName,name); |
|
|
|
return baseDao.selectOne(queryWrapper); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 灵山大屏-安全生产-生产企业类型统计 |
|
|
|
* |
|
|
|
* @param orgId |
|
|
|
* @param orgType |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public List<DangerousChemicalsTypeStatResultDTO> typeStat(String customerId,String staffId,String orgId, String orgType) { |
|
|
|
// 企业类别字典数据
|
|
|
|
List<IcCoverageCategoryDictListResultDTO> dictList = coverageService.dictMap(customerId, CoveragePlaceTypeEnum.DANGEROUS_CHEMICALS.getCode()); |
|
|
|
if (CollectionUtils.isEmpty(dictList)) { |
|
|
|
return new ArrayList<>(); |
|
|
|
} |
|
|
|
String orgIdPath = queryOrgIdPath(customerId,staffId,orgId, orgType); |
|
|
|
if (StringUtils.isBlank(orgIdPath)) { |
|
|
|
return new ArrayList<>(); |
|
|
|
} |
|
|
|
List<DangerousChemicalsTypeStatResultDTO> resultList = new ArrayList<>(); |
|
|
|
for (IcCoverageCategoryDictListResultDTO dto : dictList) { |
|
|
|
DangerousChemicalsTypeStatResultDTO resultDTO = new DangerousChemicalsTypeStatResultDTO(); |
|
|
|
resultDTO.setName(dto.getLabel()); |
|
|
|
LambdaQueryWrapper<IcDangerousChemicalsEntity> countWrapper = new LambdaQueryWrapper<>(); |
|
|
|
countWrapper.eq(IcDangerousChemicalsEntity::getCustomerId, customerId) |
|
|
|
.likeRight(IcDangerousChemicalsEntity::getOrgIdPath, orgIdPath) |
|
|
|
.eq(IcDangerousChemicalsEntity::getCategory, dto.getValue()); |
|
|
|
resultDTO.setValue(baseDao.selectCount(countWrapper)); |
|
|
|
resultDTO.setTypeCode(dto.getValue()); |
|
|
|
resultList.add(resultDTO); |
|
|
|
} |
|
|
|
return resultList; |
|
|
|
} |
|
|
|
|
|
|
|
private String queryOrgIdPath(String customerId,String staffId,String orgId, String orgType) { |
|
|
|
String orgIdPath = ""; |
|
|
|
// 如果没传,默认查询当前工作人员所属组织
|
|
|
|
if (StringUtils.isBlank(orgId) && StringUtils.isBlank(orgType)) { |
|
|
|
CustomerStaffInfoCacheResult staffInfoCacheResult = CustomerStaffRedis.getStaffInfo(customerId, staffId); |
|
|
|
orgId = staffInfoCacheResult.getAgencyId(); |
|
|
|
orgType = OrgTypeEnum.AGENCY.getCode(); |
|
|
|
} |
|
|
|
if (OrgTypeEnum.AGENCY.getCode().equals(orgType)) { |
|
|
|
CustomerAgencyDTO customerAgencyDTO = SpringContextUtils.getBean(CustomerAgencyService.class).get(orgId); |
|
|
|
orgIdPath = PidUtils.convertPid2OrgIdPath(customerAgencyDTO.getId(), customerAgencyDTO.getPids()); |
|
|
|
} else if (OrgTypeEnum.GRID.getCode().equals(orgType)) { |
|
|
|
CustomerGridDTO customerGridDTO = SpringContextUtils.getBean(CustomerGridService.class).get(orgId); |
|
|
|
orgIdPath = PidUtils.convertPid2OrgIdPath(customerGridDTO.getId(), customerGridDTO.getPids()); |
|
|
|
} |
|
|
|
return orgIdPath; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 灵山大屏-安全生产-生产企业类型统计,点击饼图,查询列表及详情 |
|
|
|
* |
|
|
|
* @param customerId |
|
|
|
* @param staffId |
|
|
|
* @param orgId |
|
|
|
* @param orgType |
|
|
|
* @param typeCode |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public List<DangerousChemicalsTypeStatDetailDTO> distribution(String customerId, String staffId, String orgId, String orgType, String typeCode) { |
|
|
|
// 企业类别字典数据
|
|
|
|
List<IcCoverageCategoryDictListResultDTO> dictList = coverageService.dictMap(customerId, CoveragePlaceTypeEnum.DANGEROUS_CHEMICALS.getCode()); |
|
|
|
if (CollectionUtils.isEmpty(dictList)) { |
|
|
|
return new ArrayList<>(); |
|
|
|
} |
|
|
|
Map<String, String> categoryDictMap = dictList.stream().collect(Collectors.toMap(IcCoverageCategoryDictListResultDTO::getValue, IcCoverageCategoryDictListResultDTO::getLabel)); |
|
|
|
|
|
|
|
String orgIdPath = queryOrgIdPath(customerId, staffId, orgId, orgType); |
|
|
|
if (StringUtils.isBlank(orgIdPath)) { |
|
|
|
return new ArrayList<>(); |
|
|
|
} |
|
|
|
List<DangerousChemicalsTypeStatDetailDTO> list = baseDao.selectDistributionList(customerId, orgIdPath, typeCode); |
|
|
|
list.forEach(l -> { |
|
|
|
// 赋值企业分类名称
|
|
|
|
if (MapUtils.isNotEmpty(categoryDictMap) && categoryDictMap.containsKey(l.getCategory())) { |
|
|
|
l.setType(categoryDictMap.get(l.getCategory())); |
|
|
|
} |
|
|
|
}); |
|
|
|
return list; |
|
|
|
} |
|
|
|
} |