Commit bd28a659 authored by 刘林's avatar 刘林

Merge remote-tracking branch 'origin/develop_tzs_register' into develop_tzs_register

parents 9fc56f2d f8b363f1
......@@ -22,15 +22,17 @@ public interface JgInstallationNoticeMapper extends CustomBaseMapper<JgInstallat
/**
* 分页查询
*
* @param page 分页对象
* @param model 查询参数
* @param type 类型:enterprise-企业端、supervision-监管端
* @param page 分页对象
* @param model 查询参数
* @param type 类型:enterprise-企业端、supervision-监管端
* @param orgCode 公司的orgCode
* @return 安装告知列表
*/
Page<Map<String, Object>> queryForPage(Page<JgInstallationNotice> page,
@Param("param") JgInstallationNoticeDto model,
@Param("type") String type,
@Param("sort") SortVo sort,
@Param("companyCode") String companyCode,
@Param("orgCode") String orgCode);
/**
......
......@@ -30,4 +30,6 @@ public interface SafetyProblemTracingMapper extends BaseMapper<SafetyProblemTrac
List<Map<String, Object>> getBusinessCount(@Param("sourceTypeCode") String sourceTypeCode, @Param("orgCode") String orgCode);
Long countByTypeListAndOrgCode(@Param("typeList") List<String> typeList, @Param("orgCode") String orgCode, @Param("mainBody") String mainBody);
List<Map<String, Object>> countEquOverdue(@Param("typeList") List<String> typeList,@Param("orgCode") String orgCode);
}
......@@ -75,17 +75,21 @@
</if>
</if>
<if test="type == 'supervision'">
AND (isn.receive_org_credit_code = #{orgCode} or isn.transfer_to_user_ids like concat('%',#{param.transferToUserIds},'%'))
AND (
isn.receive_org_credit_code = #{companyCode}
or isn.transfer_to_user_ids like concat('%',#{param.transferToUserIds},'%')
or isn.org_branch_code like concat(#{orgCode}, '%')
)
AND isn.instance_id <![CDATA[<>]]> ''
</if>
<if test="type == 'company'">
AND (isn.install_unit_credit_code = #{orgCode} or isn.transfer_to_user_ids like concat('%',#{param.transferToUserIds},'%'))
AND (isn.install_unit_credit_code = #{companyCode} or isn.transfer_to_user_ids like concat('%',#{param.transferToUserIds},'%'))
</if>
<if test="type == 'testAdmin'">
((AND isn.receive_org_credit_code = #{orgCode}
((AND isn.receive_org_credit_code = #{companyCode}
AND isn.instance_id <![CDATA[<>]]> '')
or
AND isn.install_unit_credit_code = #{orgCode})
AND isn.install_unit_credit_code = #{companyCode})
</if>
</where>
ORDER BY
......
......@@ -36,7 +36,11 @@
and tjvi.use_unit_credit_code = #{dto.useUnitCode}
</if>
<if test="dto.dataType == 'supervision' ">
and tjvi.receive_company_code = #{dto.useUnitCreditCode}
and
(
tjvi.receive_company_code = #{dto.useUnitCreditCode}
or tjvi.org_branch_code like concat(#{dto.orgBranchCode}, '%')
)
AND tjvi.status <![CDATA[<>]]> '使用单位待提交'
</if>
<if test="dto.dataType == 'company' ">
......
......@@ -118,7 +118,7 @@
else 'green' end problemStatusColor
FROM
tzs_safety_problem_tracing spt
LEFT JOIN tz_base_enterprise_info ei on ei.sequence_nbr = spt.source_id
LEFT JOIN tz_base_enterprise_info ei on ei.use_unit_code = spt.principal_unit_code
WHERE
spt.sequence_nbr = #{problemId}
UNION
......@@ -199,4 +199,26 @@
and source_type_code = #{mainBody}
</if>
</select>
<select id="countEquOverdue" resultType="java.util.Map">
SELECT
equip_list_code equipListCode,
COUNT(1) count
FROM
tzs_safety_problem_tracing
WHERE
is_delete = '0'
<if test="orgCode != null and orgCode != ''">
and governing_body_org_code like CONCAT(#{orgCode}, '%')
</if>
<if test="typeList != null and typeList.size > 0">
and problem_type in
<foreach collection="typeList" item="type" open="(" separator="," close=")">
#{type}
</foreach>
</if>
and source_type_code = '3'
AND equip_list_code IS NOT NULL
GROUP BY
equip_list_code
</select>
</mapper>
......@@ -142,6 +142,7 @@ public class JgVehicleInformationController extends BaseController {
dto.setDataType(BaseController.COMPANY_TYPE_COMPANY);
} else {
dto.setDataType(BaseController.COMPANY_TYPE_SUPERVISION);
dto.setOrgBranchCode(info.getCompany().getOrgCode());
}
Page<Map<String, Object>> list = jgVehicleInformationServiceImpl.getPageList(dto,sort, page, dto.getRoleIds());
list.getRecords().forEach(x -> {
......
......@@ -564,10 +564,11 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
String sort,
ReginParams reginParams) {
String orgCode = reginParams.getCompany().getCompanyCode();
String companyCode = reginParams.getCompany().getCompanyCode();
SortVo sortMap = commonService.sortFieldConversion(sort);
model.setTransferToUserIds(reginParams.getUserModel().getUserId());
Page<Map<String, Object>> noticePage = jgInstallationNoticeMapper.queryForPage(page, model, type, sortMap, orgCode);
String orgCode = reginParams.getCompany().getOrgCode();
Page<Map<String, Object>> noticePage = jgInstallationNoticeMapper.queryForPage(page, model, type, sortMap, companyCode, orgCode);
List<Map<String, Object>> mappedRecords = noticePage.getRecords().stream().peek(notice -> {
Optional<Long> noticeStatusOpt = Optional.ofNullable((String) notice.get("noticeStatus")).map(Long::valueOf);
noticeStatusOpt.ifPresent(status -> {
......
......@@ -10,10 +10,8 @@ import com.yeejoin.amos.boot.biz.common.dto.JyjcInspectionApplicationDto;
import com.yeejoin.amos.boot.module.common.api.dto.AttachmentDto;
import com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamDto;
import com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamForDetailDto;
import com.yeejoin.amos.boot.module.common.api.enums.AlertCallEnum;
import com.yeejoin.amos.boot.module.common.api.enums.JYJCBusinessTypeEnum;
import com.yeejoin.amos.boot.module.common.api.enums.JYJCResultEnum;
import com.yeejoin.amos.boot.module.common.api.enums.UnitTypeEnum;
import com.yeejoin.amos.boot.module.common.api.enums.*;
import com.yeejoin.amos.boot.module.jg.api.mapper.SafetyProblemTracingMapper;
import com.yeejoin.amos.boot.module.jyjc.api.dto.InspectTimeCountDto;
import com.yeejoin.amos.boot.module.jyjc.api.dto.InspectionTimelinesDto;
import com.yeejoin.amos.boot.module.jyjc.api.dto.PublicityInspectOrgInfoDto;
......@@ -49,6 +47,7 @@ import org.elasticsearch.search.sort.SortOrder;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
......@@ -108,13 +107,15 @@ public class JYJCDPStatisticsServiceImpl {
private JYJCStatisticsMapper jyjcStatisticsMapper;
private SafetyProblemTracingMapper safetyProblemTracingMapper;
/**
* 法定检验机构名单
*/
@Value("${jyjc.legal.companyCode:12610100750228848W,12610300MB2943942F,12610400435630992M,12610200435252143F,126105007326878566,12610600MB29845683,126108004366752362,12610700MB296441XY,12610900353680128G,126110004363154256,126100004352004822}")
private String legalCompanyCodes;
public JYJCDPStatisticsServiceImpl(JyjcInspectionApplicationEquipMapper inspectionApplicationEquipMapper, JyjcInspectionApplicationMapper inspectionApplicationMapper, TzsUserInfoMapper tzsUserInfoMapper, JyjcInspectionResultMapper inspectionResultMapper, JyjcOpeningApplicationMapper openingApplicationMapper, RestHighLevelClient restHighLevelClient, StCommonServiceImpl stCommonService, JYJCStatisticsMapper jyjcStatisticsMapper) {
public JYJCDPStatisticsServiceImpl(JyjcInspectionApplicationEquipMapper inspectionApplicationEquipMapper, JyjcInspectionApplicationMapper inspectionApplicationMapper, TzsUserInfoMapper tzsUserInfoMapper, JyjcInspectionResultMapper inspectionResultMapper, JyjcOpeningApplicationMapper openingApplicationMapper, RestHighLevelClient restHighLevelClient, StCommonServiceImpl stCommonService, JYJCStatisticsMapper jyjcStatisticsMapper, SafetyProblemTracingMapper safetyProblemTracingMapper) {
this.inspectionApplicationEquipMapper = inspectionApplicationEquipMapper;
this.inspectionApplicationMapper = inspectionApplicationMapper;
this.tzsUserInfoMapper = tzsUserInfoMapper;
......@@ -123,6 +124,7 @@ public class JYJCDPStatisticsServiceImpl {
this.restHighLevelClient = restHighLevelClient;
this.stCommonService = stCommonService;
this.jyjcStatisticsMapper = jyjcStatisticsMapper;
this.safetyProblemTracingMapper = safetyProblemTracingMapper;
}
......@@ -547,7 +549,7 @@ public class JYJCDPStatisticsServiceImpl {
// 5.检验检测临期设备数数量统计
this.staticsCenterMapCountDataTemporary(result, dpFilterParamDto);
// 6.检验检测超期设备数数量统计
this.staticsCenterMapCountDataOverdue(result, dpFilterParamDto);
this.staticsCenterMapCountDataOverdueNew(result, orgCode,dpFilterParamDto);
// 7.检验机构总量 inspectionAgencyCount
this.countAllRegInspectCompany(result, orgCode,dpFilterParamDto.getCityCode());
// 8.第三方检验机构数量 thirdInspectionAgencyCount
......@@ -572,6 +574,15 @@ public class JYJCDPStatisticsServiceImpl {
result.put("bizKtCount", num);
}
private void staticsCenterMapCountDataOverdueNew(Map<String, Object> result, String orgCode, DPFilterParamDto dpFilterParamDto) {
long num = 0;
List<String> typeList = new ArrayList<>();
typeList.add("维保超期");
typeList.add("检验超期");
num = safetyProblemTracingMapper.countByTypeListAndOrgCode(typeList,orgCode, IssueMainBodyEnum.EQUIPMENT.getCode());
result.put("jyjccqsbCount", num);
}
private void staticsCenterMapCountDataTemporary(Map<String, Object> result, DPFilterParamDto dpFilterParamDto) {
long num = 0;
CountRequest request = new CountRequest();
......@@ -794,7 +805,7 @@ public class JYJCDPStatisticsServiceImpl {
// 1.检验检测临期设备数数量统计
result.put("approach", staticsCenterMapCountDataForJyTimeTemporary(dpFilterParamDto, equipmentCategoryDtos));
// 2.检验检测超期设备数数量统计
result.put("overdue", staticsCenterMapCountDataForJyTimeOverdue(dpFilterParamDto, equipmentCategoryDtos));
result.put("overdue", staticsCenterMapCountDataForJyTimeOverdueNew(dpFilterParamDto, equipmentCategoryDtos));
}
private List<Long> staticsCenterMapCountDataForJyTimeTemporary(DPFilterParamDto dpFilterParamDto, List<EquipmentCategoryDto> equipmentCategoryDtos) {
......@@ -835,6 +846,26 @@ public class JYJCDPStatisticsServiceImpl {
return seresData;
}
private List<Long> staticsCenterMapCountDataForJyTimeOverdueNew(DPFilterParamDto dpFilterParamDto, List<EquipmentCategoryDto> equipmentCategoryDtos) {
List<Long> seresData = new ArrayList<>();
// 区域信息模糊查询
String orgCode = stCommonService.getAndSetOrgCode(dpFilterParamDto.getCityCode());
List<String> typeList = new ArrayList<>();
typeList.add("维保超期");
typeList.add("检验超期");
List<Map<String,Object>> result = safetyProblemTracingMapper.countEquOverdue(typeList,orgCode);
Map<String,Long> countMap = new HashMap<>();
if(!CollectionUtils.isEmpty(result)) {
result.forEach(r -> {
countMap.put(r.get("equipListCode").toString(), (Long) r.get("count"));
});
}
equipmentCategoryDtos.forEach(c -> {
seresData.add(countMap.getOrDefault(c.getCode(), 0L));
});
return seresData;
}
private List<Long> staticsCenterMapCountDataForJyTimeOverdue(DPFilterParamDto dpFilterParamDto, List<EquipmentCategoryDto> equipmentCategoryDtos) {
List<Long> seresData = new ArrayList<>();
SearchRequest request = new SearchRequest();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment