Commit 66308606 authored by suhuiguang's avatar suhuiguang

fix(jyjc): 报检规则4.0开发

1..机构分类增加到证表,历史数据处理
parent 94fc4620
......@@ -29,4 +29,12 @@ public class HisDataHandlerController {
hisDataHandlerService.pieLineDataHandlerV1();
return ResponseHelper.buildResponse(true);
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "PUT", value = "开通机构分类历史数据处理,补充机构分类到证表")
@PutMapping(value = "/v1/open/data")
public ResponseModel<Boolean> openDataHandlerV1() {
hisDataHandlerService.openDataHandlerV1();
return ResponseHelper.buildResponse(true);
}
}
package com.yeejoin.amos.boot.module.jyjc.biz.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.yeejoin.amos.boot.module.common.api.dto.BaseEnterpriseCertDto;
import com.yeejoin.amos.boot.module.common.api.entity.BaseEnterpriseCert;
import com.yeejoin.amos.boot.module.common.biz.service.impl.BaseEnterpriseCertServiceImpl;
import com.yeejoin.amos.boot.module.jyjc.api.common.BizCommonConstant;
import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionApplication;
import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionApplicationEquip;
import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionHistory;
import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcOpeningApplication;
import com.yeejoin.amos.boot.module.jyjc.api.mapper.JyjcInspectionApplicationEquipMapper;
import com.yeejoin.amos.boot.module.jyjc.api.mapper.JyjcInspectionApplicationMapper;
import lombok.extern.slf4j.Slf4j;
......@@ -23,6 +31,15 @@ public class HisDataHandlerServiceImpl {
@Resource
private JyjcInspectionApplicationMapper jyjcInspectionApplicationMapper;
@Resource
private JyjcInspectionHistoryServiceImpl inspectionHistoryService;
@Resource
private JyjcOpeningApplicationServiceImpl jyjcOpeningApplicationService;
@Resource
private BaseEnterpriseCertServiceImpl enterpriseCertService;
@Transactional(rollbackFor = Exception.class)
public void pieLineDataHandlerV1() {
List<JyjcInspectionApplicationEquip> applicationEquips = jyjcInspectionApplicationEquipMapper.queryWaitFlushData();
......@@ -42,4 +59,26 @@ public class HisDataHandlerServiceImpl {
List<JyjcInspectionApplicationEquip> applicationEquipAfter = jyjcInspectionApplicationEquipMapper.queryWaitFlushData();
log.info("处理前:待压力管道数据条数: {}", applicationEquipAfter.size());
}
public void openDataHandlerV1() {
List<JyjcOpeningApplication> openingApplications = jyjcOpeningApplicationService.list(new LambdaQueryWrapper<JyjcOpeningApplication>().eq(JyjcOpeningApplication::getStatus, "已完成"));
openingApplications.forEach(jyjcOpeningApplication -> {
JyjcInspectionHistory history = inspectionHistoryService.getBySSeq(jyjcOpeningApplication.getSequenceNbr());
if (history != null) {
JSONObject hisData = history.getHistoryData();
List<BaseEnterpriseCertDto> certDtos = hisData.getJSONArray(BizCommonConstant.UNIT_LICENCE_KEY).toJavaList(BaseEnterpriseCertDto.class);
fillAgencyClassify2Cert(jyjcOpeningApplication, certDtos);
}
});
}
private void fillAgencyClassify2Cert(JyjcOpeningApplication jyjcOpeningApplication, List<BaseEnterpriseCertDto> certDtos) {
certDtos.forEach(certDto -> {
List<Long> certSeqs = jyjcOpeningApplicationService.getCertFromHisData(jyjcOpeningApplication, certDto);
LambdaUpdateWrapper<BaseEnterpriseCert> updateWrapperCert = new LambdaUpdateWrapper<>();
updateWrapperCert.set(BaseEnterpriseCert::getAgencyClassify, jyjcOpeningApplication.getAgencyClassify());
updateWrapperCert.in(com.yeejoin.amos.boot.biz.common.entity.BaseEntity::getSequenceNbr, certSeqs);
enterpriseCertService.update(null, updateWrapperCert);
});
}
}
......@@ -432,7 +432,7 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp
});
}
private List<Long> getCertFromHisData(JyjcOpeningApplication jyjcOpeningApplication, BaseEnterpriseCertDto certDto) {
public List<Long> getCertFromHisData(JyjcOpeningApplication jyjcOpeningApplication, BaseEnterpriseCertDto certDto) {
return enterpriseCertService.list(new LambdaQueryWrapper<BaseEnterpriseCert>()
.eq(BaseEnterpriseCert::getUnitCode, jyjcOpeningApplication.getUnitCode())
.eq(BaseEnterpriseCert::getUnitType, Optional.ofNullable(OpenBizTypeEnumV2.getOneByCode(jyjcOpeningApplication.getOpenBizType())).map(OpenBizTypeEnumV2::getUnitType).orElse(null))
......
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