Commit 897f8799 authored by suhuiguang's avatar suhuiguang

Merge branch 'develop_tzs_main' of http://39.100.92.250:5000/moa/amos-boot-biz…

Merge branch 'develop_tzs_main' of http://39.100.92.250:5000/moa/amos-boot-biz into develop_tzs_main
parents ddfe5922 6098a5ed
......@@ -44,7 +44,7 @@ public class DataRefreshListener {
private final TzsDataRefreshMessageServiceImpl tzsDataRefreshMessageService;
@TransactionalEventListener(value = DataRefreshEvent.class)
@TransactionalEventListener(value = DataRefreshEvent.class, fallbackExecution = true)
@Async
public void onEquipCreateOrEdit(DataRefreshEvent event) {
log.info("收到数据刷新消息:{}", JSONObject.toJSONString(event));
......
......@@ -40,10 +40,12 @@ 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.jg.api.dto.*;
import com.yeejoin.amos.boot.module.jg.api.entity.JgRegistrationHistory;
import com.yeejoin.amos.boot.module.jg.api.entity.JgResumeInfoEq;
import com.yeejoin.amos.boot.module.jg.api.entity.JgUseRegistration;
import com.yeejoin.amos.boot.module.jg.api.entity.JgUseRegistrationManage;
import com.yeejoin.amos.boot.module.jg.api.enums.*;
import com.yeejoin.amos.boot.module.jg.api.mapper.CommonMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgResumeInfoEqMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgUseRegistrationManageMapper;
import com.yeejoin.amos.boot.module.jg.api.service.IJgChangeRegistrationTransferService;
import com.yeejoin.amos.boot.module.jg.api.service.IJgInstallationNoticeService;
......@@ -133,6 +135,7 @@ import java.util.stream.Collectors;
import java.util.stream.Stream;
import static com.yeejoin.amos.boot.module.jg.biz.service.impl.DataHandlerServiceImpl.IDX_BIZ_EQUIPMENT_INFO;
import static com.yeejoin.amos.boot.module.jg.biz.service.impl.JgChangeRegistrationNameServiceImpl.DB_BATCH_SIZE;
/**
* 装备分类服务实现类
......@@ -314,15 +317,14 @@ public class CommonServiceImpl implements ICommonService {
@Autowired
private CbDataDictTypeHandler dataDictTypeHandler;
@Autowired
private JgResumeInfoServiceImpl jgResumeInfoService;
@Autowired
private RestHighLevelClient restHighLevelClient;
@Autowired
CodeUtil codeUtil;
private CodeUtil codeUtil;
@Autowired
private JgResumeInfoEqMapper jgResumeInfoEqMapper;
public static final String DATA_QUALITY_SCORE = "DATA_QUALITY_SCORE";
......@@ -3500,4 +3502,19 @@ public class CommonServiceImpl implements ICommonService {
public String queryBaseUnitNameByCreditCode(String unitCreditCode) {
return ValidationUtil.isEmpty(unitCreditCode) ? unitCreditCode : commonMapper.queryUnitNameByCreditCode(unitCreditCode);
}
public void batchInsertResumeEq(Long resumeId, List<Map<String, Object>> equipmentLists) {
List<JgResumeInfoEq> list = equipmentLists.stream()
.map(e -> JgResumeInfoEq.builder()
.resumeId(resumeId)
.equId(String.valueOf(e.get("record")))
.build())
.collect(Collectors.toList());
for (int i = 0; i < list.size(); i += DB_BATCH_SIZE) {
jgResumeInfoEqMapper.insertBatchSomeColumn(
list.subList(i, Math.min(i + DB_BATCH_SIZE, list.size()))
);
}
}
}
\ No newline at end of file
......@@ -28,6 +28,7 @@ import com.yeejoin.amos.boot.module.common.api.dao.ExcelImportErrorLogDao;
import com.yeejoin.amos.boot.module.common.api.dto.ESEquipmentCategoryDto;
import com.yeejoin.amos.boot.module.common.api.dto.ExcelImportErrorLogDto;
import com.yeejoin.amos.boot.module.common.api.enums.ConstructionTypeEnum;
import com.yeejoin.amos.boot.module.common.api.enums.CylinderTypeEnum;
import com.yeejoin.amos.boot.module.jg.api.common.DataDockTemplateVersionUtils;
import com.yeejoin.amos.boot.module.jg.api.common.PipLenCalUtils;
import com.yeejoin.amos.boot.module.jg.api.converter.DictParamsConverter;
......@@ -39,10 +40,7 @@ import com.yeejoin.amos.boot.module.jg.api.entity.*;
import com.yeejoin.amos.boot.module.jg.api.enums.BusinessTypeEnum;
import com.yeejoin.amos.boot.module.jg.api.enums.CertificateStatusEnum;
import com.yeejoin.amos.boot.module.jg.api.enums.SafetyProblemStatusEnum;
import com.yeejoin.amos.boot.module.jg.api.mapper.CommonMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgUseRegistrationEqMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgUseRegistrationManageMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgVehicleInformationMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.*;
import com.yeejoin.amos.boot.module.jg.biz.config.LocalBadRequest;
import com.yeejoin.amos.boot.module.jg.biz.context.EquipUsedCheckStrategyContext;
import com.yeejoin.amos.boot.module.jg.biz.context.FlowingEquipRedisContext;
......@@ -98,6 +96,7 @@ import java.util.stream.StreamSupport;
import static com.alibaba.fastjson.JSON.toJSONString;
import static com.yeejoin.amos.boot.module.common.api.constant.TZSCommonConstant.EQU_CATEGORY_CODE_GDYLRQ;
import static com.yeejoin.amos.boot.module.jg.biz.service.impl.IdxBizJgRegisterInfoServiceImpl.toCamelCase;
import static com.yeejoin.amos.boot.module.jg.biz.service.impl.JgChangeRegistrationNameServiceImpl.DB_BATCH_SIZE;
@Slf4j
@Service
......@@ -142,6 +141,7 @@ public class DataDockServiceImpl {
private final CodeUtil codeUtil;
private final CommonMapper commonMapper;
private final JgResumeInfoServiceImpl jgResumeInfoService;
private final JgResumeInfoEqMapper jgResumeInfoEqMapper;
private final IdxBizJgMaintenanceRecordInfoServiceImpl idxBizJgMaintenanceRecordInfoService;
private final TzBaseEnterpriseInfoMapper enterpriseInfoMapper;
private final Map<String, Object> resultError = new HashMap<>();
......@@ -842,7 +842,7 @@ public class DataDockServiceImpl {
* @param record 设备唯一编码
*/
private void saveEquInfoToEs(String record, String isCompleteXa) {
Map<String, Object> map = categoryOtherInfoMapper.selectDataById(record);
Map<String, Object> map = categoryOtherInfoMapper.selectJgAllViewDataById(record);
ESEquipmentCategoryDto equipmentCategoryDto = JSON.parseObject(toJSONString(map), ESEquipmentCategoryDto.class);
if (!ObjectUtils.isEmpty(equipmentCategoryDto)) {
long recTime;
......@@ -1727,6 +1727,9 @@ public class DataDockServiceImpl {
this.updatePipelineLength(projectContraptionIdSet);
this.createResumePipelineBatch(projectContraptionIdSet, String.format(pipelineRoutePath, projectContraptionIdSet), company);
eventPublisher.publish(new EquipCreateOrEditEvent(this, BusinessTypeEnum.JG_NEW_PROJECT.name(), projectContraptionIdSet, EquipCreateOrEditEvent.EquipType.project));
}else if (CylinderTypeEnum.CYLINDER.getCode().equals(equCategory)){
this.createResumeCylinderBatch(recordSet,dataSource, equipRoutePath, company);
eventPublisher.publish(new EquipCreateOrEditEvent(this,BusinessTypeEnum.JG_NEW_EQUIP.name(),recordSet, EquipCreateOrEditEvent.EquipType.equip));
}else{
this.createResumeBatch(recordSet,dataSource, equipRoutePath, company);
eventPublisher.publish(new EquipCreateOrEditEvent(this,BusinessTypeEnum.JG_NEW_EQUIP.name(),recordSet, EquipCreateOrEditEvent.EquipType.equip));
......@@ -1745,6 +1748,29 @@ public class DataDockServiceImpl {
}
}
private void createResumeCylinderBatch(Set<String> records, String dataSource, String equipRoutePath, CompanyBo company) {
JgResumeInfoDto dto = JgResumeInfoDto.builder()
.businessType(BusinessTypeEnum.JG_NEW_EQUIP.getName())
.status("正常")
.approvalUnitCode(company.getCompanyCode())
.approvalUnit(company.getCompanyName())
.changeContent(BusinessTypeEnum.JG_NEW_EQUIP.getName() + "业务办理")
.routePath(String.format(equipRoutePath, dataSource))
.build();
jgResumeInfoService.saveBatchResume(Collections.singletonList(dto));
List<JgResumeInfoEq> list = records.stream()
.map(record -> JgResumeInfoEq.builder()
.resumeId(dto.getSequenceNbr())
.equId(record)
.build())
.collect(Collectors.toList());
for (int i = 0; i < list.size(); i += DB_BATCH_SIZE) {
jgResumeInfoEqMapper.insertBatchSomeColumn(
list.subList(i, Math.min(i + DB_BATCH_SIZE, list.size()))
);
}
}
private void updatePipelineLength(Set<String> projectContraptionIdSet) {
projectContraptionIdSet.forEach(pieLineDataChangeService::updatePipelineLength);
}
......@@ -2950,7 +2976,7 @@ public class DataDockServiceImpl {
idxBizJgUseInfoService.updateById(useInfo);
// es更新
Map<String, Object> map = categoryOtherInfoMapper.selectDataById(useInfo.getRecord());
Map<String, Object> map = categoryOtherInfoMapper.selectJgAllViewDataById(useInfo.getRecord());
ESEquipmentCategoryDto equipmentCategoryDto = JSON.parseObject(toJSONString(map), ESEquipmentCategoryDto.class);
equipmentCategoryDto.setIS_INTO_MANAGEMENT(Boolean.TRUE);
esEquipmentCategory.save(equipmentCategoryDto);
......
......@@ -106,7 +106,6 @@ import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import java.util.stream.StreamSupport;
import static com.alibaba.fastjson.JSON.toJSONString;
import static com.yeejoin.amos.boot.module.jg.biz.service.impl.JgInstallationNoticeServiceImpl.CONSTRUCTION_TYPE;
......@@ -1141,7 +1140,7 @@ public class DataHandlerServiceImpl {
}
String[] recordArr = records.trim().split(",");
for (String record : recordArr) {
Map<String, Object> map = categoryOtherInfoMapper.selectDataById(record);
Map<String, Object> map = categoryOtherInfoMapper.selectJgAllViewDataById(record);
categoryOtherInfoMapper.updateEsStatus(record);
ESEquipmentCategoryDto dto = JSON.parseObject(toJSONString(map), ESEquipmentCategoryDto.class);
Optional<ESEquipmentCategoryDto> data = esEquipmentCategory.findById(record);
......
......@@ -16,12 +16,14 @@ import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.biz.common.utils.SnowflakeIdUtil;
import com.yeejoin.amos.boot.module.common.api.enums.CylinderTypeEnum;
import com.yeejoin.amos.boot.module.jg.api.dto.*;
import com.yeejoin.amos.boot.module.jg.api.entity.*;
import com.yeejoin.amos.boot.module.jg.api.enums.BusinessTypeEnum;
import com.yeejoin.amos.boot.module.jg.api.enums.CompanyTypeEnum;
import com.yeejoin.amos.boot.module.jg.api.enums.PipelineEnum;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgCertificateReplenishMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgResumeInfoEqMapper;
import com.yeejoin.amos.boot.module.jg.api.service.IJgCertificateReplenishService;
import com.yeejoin.amos.boot.module.jg.api.vo.SortVo;
import com.yeejoin.amos.boot.module.jg.biz.config.LocalBadRequest;
......@@ -74,6 +76,8 @@ import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import static com.yeejoin.amos.boot.module.jg.biz.service.impl.JgChangeRegistrationNameServiceImpl.DB_BATCH_SIZE;
/**
* 使用登记表补证服务实现类
*
......@@ -157,6 +161,7 @@ public class JgCertificateReplenishServiceImpl extends BaseService<JgCertificate
private final IdxBizJgFactoryInfoServiceImpl idxBizJgFactoryInfoService;
private final JgCertificateReplenishMapper jgCertificateReplenishMapper;
private final JgResumeInfoServiceImpl jgResumeInfoService;
private final JgResumeInfoEqMapper jgResumeInfoEqMapper;
private final IdxBizJgProjectContraptionServiceImplService jgProjectContraptionServiceImplService;
/**
......@@ -545,6 +550,29 @@ public class JgCertificateReplenishServiceImpl extends BaseService<JgCertificate
private void createResume(JgCertificateReplenish certificateReplenish, String routePath) {
List<JgCertificateReplenishEq> replenishEqs = certificateReplenishEqService.getBaseMapper().selectList(new LambdaQueryWrapper<JgCertificateReplenishEq>()
.eq(JgCertificateReplenishEq::getCertificateReplenishId, certificateReplenish.getSequenceNbr()));
if (CylinderTypeEnum.CYLINDER.getCode().equals(certificateReplenish.getEquCategoryCode())){
JgResumeInfoDto dto = JgResumeInfoDto.builder().applyNo(certificateReplenish.getApplyNo())
.businessType(BusinessTypeEnum.JG_REPLACEMENT_REGISTRATION.getName())
.businessId(String.valueOf(certificateReplenish.getSequenceNbr()))
.approvalUnit(certificateReplenish.getReceiveOrgName())
.approvalUnitCode(certificateReplenish.getReceiveOrgCode())
.status("正常")
.changeContent(BusinessTypeEnum.JG_REPLACEMENT_REGISTRATION.getName() + "业务办理")
.routePath(routePath)
.build();
jgResumeInfoService.saveBatchResume(Collections.singletonList(dto));
List<JgResumeInfoEq> list = replenishEqs.stream()
.map(eq -> JgResumeInfoEq.builder()
.resumeId(dto.getSequenceNbr())
.equId(eq.getEquId())
.build())
.collect(Collectors.toList());
for (int i = 0; i < list.size(); i += DB_BATCH_SIZE) {
jgResumeInfoEqMapper.insertBatchSomeColumn(
list.subList(i, Math.min(i + DB_BATCH_SIZE, list.size()))
);
}
}else{
jgResumeInfoService.saveBatchResume(replenishEqs.stream().map(eq-> JgResumeInfoDto.builder().applyNo(certificateReplenish.getApplyNo())
.businessType(BusinessTypeEnum.JG_REPLACEMENT_REGISTRATION.getName())
.businessId(String.valueOf(certificateReplenish.getSequenceNbr()))
......@@ -557,6 +585,7 @@ public class JgCertificateReplenishServiceImpl extends BaseService<JgCertificate
.build()).collect(Collectors.toList())
);
}
}
public void saveManageRecord(JgCertificateReplenish certRep, TaskV2Model taskV2Model) {
Long certChangeRecordSeq = sequence.nextId();
......
......@@ -792,6 +792,7 @@ public class JgChangeRegistrationNameServiceImpl extends BaseService<JgChangeReg
public void updateExecuteIds(String instanceId, JgChangeRegistrationName jgChangeRegistrationName, String operate, ProcessTaskDTO processTaskDTO) {
List<String> roleListNext = new ArrayList<>();
List<String> roleListAll = new ArrayList<>();
List<String> recordList;
String taskCode = FlowStatusEnum.TO_BE_FINISHED.getName();
String taskName = "";
String nextTaskId = "";
......@@ -834,7 +835,10 @@ public class JgChangeRegistrationNameServiceImpl extends BaseService<JgChangeReg
// 更新代办
TaskV2Model taskV2Model = updateTaskModel(jgChangeRegistrationName, operate);
// 修改业务信息
updateInfoOther(taskV2Model, jgChangeRegistrationName);
recordList = updateInfoOther(taskV2Model, jgChangeRegistrationName);
Lists.partition(recordList, ES_BATCH_SIZE)
.forEach(batch -> updateEsData(batch, jgChangeRegistrationName));
this.updateEnterpriseInfo(jgChangeRegistrationName);
}
// 保存redis最新流程数据
commonService.saveExecuteFlowData2Redis(jgChangeRegistrationName.getInstanceId(), this.buildInstanceRuntimeData(jgChangeRegistrationName));
......@@ -879,7 +883,7 @@ public class JgChangeRegistrationNameServiceImpl extends BaseService<JgChangeReg
return commonService.getDictionaryCodeByName(auditStatus);
}
public void updateInfoOther(TaskV2Model taskV2Model, JgChangeRegistrationName jgChangeRegistrationName) {
public List<String> updateInfoOther(TaskV2Model taskV2Model, JgChangeRegistrationName jgChangeRegistrationName) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
LambdaUpdateWrapper<RegUnitInfo> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(RegUnitInfo::getUnitCode, jgChangeRegistrationName.getUseUnitCreditCode());
......@@ -932,8 +936,6 @@ public class JgChangeRegistrationNameServiceImpl extends BaseService<JgChangeReg
final List<String> recordList = new ArrayList<>(allEquipIds);
Lists.partition(recordList, DB_BATCH_SIZE)
.forEach(batch -> jgUseInfoMapper.updateUseUnitNameByRecords(useUnitName, creditCode, batch));
Lists.partition(recordList, ES_BATCH_SIZE)
.forEach(batch -> updateEsData(batch, jgChangeRegistrationName));
}
if (!CollectionUtils.isEmpty(certificateSeqList)) {
final String newUseUnitName = jgChangeRegistrationName.getNewUseUnitName();
......@@ -1017,7 +1019,11 @@ public class JgChangeRegistrationNameServiceImpl extends BaseService<JgChangeReg
})
.collect(Collectors.toList());
Lists.partition(eqRecords, DB_BATCH_SIZE).forEach(batch -> jgCertificateChangeRecordEqMapper.insertBatchSomeColumn(batch));
this.createResumeBatch(recordProjectContraptionIdMap, cylinderEquipIds, jgChangeRegistrationName, taskV2Model.getRoutePath());
return allEquipIds;
}
private void updateEnterpriseInfo(JgChangeRegistrationName jgChangeRegistrationName) {
// 当企业下所有使用登记证单位信息都改为最新的时候再去修改系统中单位信息
Optional.ofNullable(tzBaseEnterpriseInfoMapper.selectOne(
Wrappers.<TzBaseEnterpriseInfo>lambdaQuery()
......@@ -1070,7 +1076,6 @@ public class JgChangeRegistrationNameServiceImpl extends BaseService<JgChangeReg
throw new RuntimeException(e);
}
});
this.createResumeBatch(recordProjectContraptionIdMap, cylinderEquipIds, jgChangeRegistrationName, taskV2Model.getRoutePath());
}
private void createResumeBatch(Map<String, String> recordProjectContraptionIdMap, Set<String> cylinderEquipIds, JgChangeRegistrationName jgChangeRegistrationName, String routePath) {
......@@ -1231,8 +1236,11 @@ public class JgChangeRegistrationNameServiceImpl extends BaseService<JgChangeReg
// 更新代办
TaskV2Model taskV2Model = updateTaskModel(jgChangeRegistrationName, "0");
// 修改业务信息
updateInfoOther(taskV2Model, jgChangeRegistrationName);
List<String> recordList = updateInfoOther(taskV2Model, jgChangeRegistrationName);
commonService.saveExecuteFlowData2Redis(jgChangeRegistrationName.getInstanceId(), this.buildInstanceRuntimeData(jgChangeRegistrationName));
this.getBaseMapper().updateById(jgChangeRegistrationName);
Lists.partition(recordList, ES_BATCH_SIZE)
.forEach(batch -> updateEsData(batch, jgChangeRegistrationName));
this.updateEnterpriseInfo(jgChangeRegistrationName);
}
}
......@@ -17,20 +17,15 @@ import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import com.yeejoin.amos.boot.biz.common.utils.SnowflakeIdUtil;
import com.yeejoin.amos.boot.module.common.api.dao.ESEquipmentCategory;
import com.yeejoin.amos.boot.module.common.api.dto.ESEquipmentCategoryDto;
import com.yeejoin.amos.boot.module.common.api.enums.CylinderTypeEnum;
import com.yeejoin.amos.boot.module.common.api.service.ICompensateFlowDataOfRedis;
import com.yeejoin.amos.boot.module.common.biz.refresh.DataRefreshEvent;
import com.yeejoin.amos.boot.module.jg.api.dto.*;
import com.yeejoin.amos.boot.module.jg.api.entity.JgEnableDisable;
import com.yeejoin.amos.boot.module.jg.api.entity.JgEnableDisableEq;
import com.yeejoin.amos.boot.module.jg.api.entity.JgRegistrationHistory;
import com.yeejoin.amos.boot.module.jg.api.entity.JgUseRegistrationManage;
import com.yeejoin.amos.boot.module.jg.api.entity.*;
import com.yeejoin.amos.boot.module.jg.api.enums.BusinessTypeEnum;
import com.yeejoin.amos.boot.module.jg.api.enums.CertificateStatusEnum;
import com.yeejoin.amos.boot.module.jg.api.enums.CompanyTypeEnum;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgEnableDisableEqMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgEnableDisableMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgRegistrationHistoryMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgUseRegistrationManageMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.*;
import com.yeejoin.amos.boot.module.jg.api.service.IJgEnableDisableService;
import com.yeejoin.amos.boot.module.jg.api.vo.SortVo;
import com.yeejoin.amos.boot.module.jg.biz.config.LocalBadRequest;
......@@ -75,6 +70,7 @@ import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import static com.yeejoin.amos.boot.module.jg.biz.service.impl.JgChangeRegistrationNameServiceImpl.DB_BATCH_SIZE;
import static java.util.stream.Collectors.toSet;
/**
......@@ -99,6 +95,8 @@ public class JgEnableDisableServiceImpl extends BaseService<JgEnableDisableDto,
@Autowired
JgResumeInfoServiceImpl jgResumeInfoService;
@Autowired
private JgResumeInfoEqMapper jgResumeInfoEqMapper;
@Autowired
private CommonServiceImpl commonService;
......@@ -696,28 +694,49 @@ public class JgEnableDisableServiceImpl extends BaseService<JgEnableDisableDto,
}
private void createResume(JgEnableDisable jgEnableDisable, String routePath) {
if (!jgEnableDisable.getEquListCode().equals(EquipmentClassifityEnum.YLGD.getCode())) { // 非压力管道按照设备记录履历
LambdaQueryWrapper<JgEnableDisableEq> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(JgEnableDisableEq::getEnableDisableApplyId, jgEnableDisable.getSequenceNbr());
List<JgEnableDisableEq> enableDisableEqs = jgEnableDisableEqService.list(queryWrapper);
jgResumeInfoService.saveBatchResume(enableDisableEqs.stream().map(eq -> JgResumeInfoDto.builder().applyNo(jgEnableDisable.getApplyNo())
.businessType(getRegistrationClass(jgEnableDisable))
.businessId(String.valueOf(jgEnableDisable.getSequenceNbr()))
.equId(eq.getEquId())
.approvalUnit(jgEnableDisable.getReceiveOrgName())
.approvalUnitCode(jgEnableDisable.getReceiveCompanyCode())
.status("正常")
.createUserId(jgEnableDisable.getCreateUserId())
.createUserName(jgEnableDisable.getCreateUserName())
.changeContent(getRegistrationClass(jgEnableDisable) + "业务办理")
.routePath(routePath)
.build()).collect(Collectors.toList())
List<JgEnableDisableEq> enableDisableEqs =
jgEnableDisableEqService.list(
new LambdaQueryWrapper<JgEnableDisableEq>()
.eq(JgEnableDisableEq::getEnableDisableApplyId,
jgEnableDisable.getSequenceNbr())
);
} else { // 压力管道按照装置记录履历
jgResumeInfoService.saveBatchResume(Collections.singletonList(JgResumeInfoDto.builder().applyNo(jgEnableDisable.getApplyNo())
String equListCode = jgEnableDisable.getEquListCode();
// 1️⃣ 压力管道:按装置记录履历
if (EquipmentClassifityEnum.YLGD.getCode().equals(equListCode)) {
JgResumeInfoDto resume = buildBaseResume(jgEnableDisable, routePath);
resume.setEquId(jgEnableDisable.getProjectContraptionId());
jgResumeInfoService.saveBatchResume(Collections.singletonList(resume));
return;
}
// 2️⃣ 气瓶:一条履历 + 多设备关系
if (CylinderTypeEnum.CYLINDER.getCode().equals(equListCode)) {
JgResumeInfoDto resume = buildBaseResume(jgEnableDisable, routePath);
jgResumeInfoService.saveBatchResume(Collections.singletonList(resume));
batchInsertResumeEq(resume.getSequenceNbr(), enableDisableEqs);
return;
}
// 3️⃣ 其他设备:按设备直接记履历
List<JgResumeInfoDto> resumeList = enableDisableEqs.stream()
.map(eq -> {
JgResumeInfoDto dto = buildBaseResume(jgEnableDisable, routePath);
dto.setEquId(eq.getEquId());
return dto;
})
.collect(Collectors.toList());
jgResumeInfoService.saveBatchResume(resumeList);
}
private JgResumeInfoDto buildBaseResume(JgEnableDisable jgEnableDisable, String routePath) {
return JgResumeInfoDto.builder()
.applyNo(jgEnableDisable.getApplyNo())
.businessType(getRegistrationClass(jgEnableDisable))
.businessId(String.valueOf(jgEnableDisable.getSequenceNbr()))
.equId(jgEnableDisable.getProjectContraptionId())
.approvalUnit(jgEnableDisable.getReceiveOrgName())
.approvalUnitCode(jgEnableDisable.getReceiveCompanyCode())
.status("正常")
......@@ -725,7 +744,23 @@ public class JgEnableDisableServiceImpl extends BaseService<JgEnableDisableDto,
.createUserName(jgEnableDisable.getCreateUserName())
.changeContent(getRegistrationClass(jgEnableDisable) + "业务办理")
.routePath(routePath)
.build();
}
private void batchInsertResumeEq(Long resumeId, List<JgEnableDisableEq> eqs) {
if (CollectionUtils.isEmpty(eqs)) {
return;
}
List<JgResumeInfoEq> list = eqs.stream()
.map(eq -> JgResumeInfoEq.builder()
.resumeId(resumeId)
.equId(eq.getEquId())
.build())
.collect(Collectors.toList());
for (int i = 0; i < list.size(); i += DB_BATCH_SIZE) {
jgResumeInfoEqMapper.insertBatchSomeColumn(
list.subList(i, Math.min(i + DB_BATCH_SIZE, list.size()))
);
}
}
......
......@@ -20,11 +20,13 @@ import com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.biz.common.utils.SnowflakeIdUtil;
import com.yeejoin.amos.boot.module.common.api.enums.CylinderTypeEnum;
import com.yeejoin.amos.boot.module.jg.api.dto.*;
import com.yeejoin.amos.boot.module.jg.api.entity.*;
import com.yeejoin.amos.boot.module.jg.api.enums.*;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgOverDesignServiceLifeEqMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgOverDesignServiceLifeMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgResumeInfoEqMapper;
import com.yeejoin.amos.boot.module.jg.api.service.IJgOverDesignServiceLifeService;
import com.yeejoin.amos.boot.module.jg.biz.config.LocalBadRequest;
import com.yeejoin.amos.boot.module.jg.biz.context.EquipUsedCheckStrategyContext;
......@@ -79,6 +81,8 @@ import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.function.Function;
import java.util.stream.Collectors;
import static com.yeejoin.amos.boot.module.jg.biz.service.impl.JgChangeRegistrationNameServiceImpl.DB_BATCH_SIZE;
import static java.util.stream.Collectors.toList;
/**
......@@ -110,6 +114,7 @@ public class JgOverDesignServiceLifeServiceImpl extends BaseService<JgOverDesign
private final JgUseRegistrationManageServiceImpl useRegistrationManageService;
private final IIdxBizJgInspectionDetectionInfoService iIdxBizJgInspectionDetectionInfoService;
private final JgResumeInfoServiceImpl jgResumeInfoService;
private final JgResumeInfoEqMapper jgResumeInfoEqMapper;
private final InspectionDetectionInfoMapper inspectionDetectionInfoMapper;
private final SnowflakeIdUtil sequence;
private final EventPublisher eventPublisher;
......@@ -726,6 +731,29 @@ public class JgOverDesignServiceLifeServiceImpl extends BaseService<JgOverDesign
}
private void saveResumeInfo(TaskV2Model taskV2Model, JgOverDesignServiceLife jgOverDesignServiceLife, List<IdxBizJgDesignInfo> designInfoList) {
if (CylinderTypeEnum.CYLINDER.getCode().equals(jgOverDesignServiceLife.getEquCategory())){
JgResumeInfoDto dto = JgResumeInfoDto.builder().applyNo(jgOverDesignServiceLife.getApplyNo())
.businessType(BusinessTypeEnum.JG_OVER_DESIGN_SERVICE_LIFE.getName())
.businessId(String.valueOf(jgOverDesignServiceLife.getSequenceNbr()))
.approvalUnit(jgOverDesignServiceLife.getReceiveOrgName())
.approvalUnitCode(jgOverDesignServiceLife.getReceiveCompanyCode())
.status("正常")
.changeContent(BusinessTypeEnum.JG_OVER_DESIGN_SERVICE_LIFE.getName() + "业务办理")
.routePath(taskV2Model.getRoutePath())
.build();
jgResumeInfoService.saveBatchResume(Collections.singletonList(dto));
List<JgResumeInfoEq> list = designInfoList.stream()
.map(eq -> JgResumeInfoEq.builder()
.resumeId(dto.getSequenceNbr())
.equId(eq.getRecord())
.build())
.collect(Collectors.toList());
for (int i = 0; i < list.size(); i += DB_BATCH_SIZE) {
jgResumeInfoEqMapper.insertBatchSomeColumn(
list.subList(i, Math.min(i + DB_BATCH_SIZE, list.size()))
);
}
}else{
jgResumeInfoService.saveBatchResume(designInfoList.stream().map(eq-> JgResumeInfoDto.builder().applyNo(jgOverDesignServiceLife.getApplyNo())
.businessType(BusinessTypeEnum.JG_OVER_DESIGN_SERVICE_LIFE.getName())
.businessId(String.valueOf(jgOverDesignServiceLife.getSequenceNbr()))
......@@ -738,6 +766,7 @@ public class JgOverDesignServiceLifeServiceImpl extends BaseService<JgOverDesign
.build()).collect(Collectors.toList())
);
}
}
/**
* 发送超设计使用年限消息
......
......@@ -1355,19 +1355,18 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
.routePath(taskV2Model.getRoutePath())
.build());
}else{
for (Map<String, Object> equipmentMap : equipmentLists) {
resumeList.add(JgResumeInfoDto.builder()
JgResumeInfoDto dto = JgResumeInfoDto.builder()
.applyNo(jgUseRegistration.getApplyNo())
.businessType(BusinessTypeEnum.JG_USAGE_REGISTRATION.getName())
.businessId(jgUseRegistration.getSequenceNbr() + "")
.equId(Objects.toString(equipmentMap.get("record"),""))
.approvalUnit(jgUseRegistration.getReceiveOrgName())
.approvalUnitCode(jgUseRegistration.getReceiveCompanyCode())
.changeContent(BusinessTypeEnum.JG_USAGE_REGISTRATION.getName() + "业务办理")
.status("正常")
.routePath(taskV2Model.getRoutePath())
.build());
}
.build();
jgResumeInfoService.saveBatchResume(Collections.singletonList(dto));
commonServiceImpl.batchInsertResumeEq(dto.getSequenceNbr(),equipmentLists);
}
// 批量收集的结果
List<JgCertificateChangeRecordEq> jgCertificateChangeRecordEqBatchList = new ArrayList<>();
......
......@@ -32,10 +32,7 @@ import com.yeejoin.amos.boot.module.common.api.enums.CylinderTypeEnum;
import com.yeejoin.amos.boot.module.jg.api.dto.*;
import com.yeejoin.amos.boot.module.jg.api.entity.*;
import com.yeejoin.amos.boot.module.jg.api.enums.*;
import com.yeejoin.amos.boot.module.jg.api.mapper.CommonMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgUseRegistrationManageMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgVehicleInformationEqMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgVehicleInformationMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.*;
import com.yeejoin.amos.boot.module.jg.api.service.IJgVehicleInformationService;
import com.yeejoin.amos.boot.module.jg.api.vo.JgVehicleInformationVo;
import com.yeejoin.amos.boot.module.jg.api.vo.SortVo;
......@@ -107,6 +104,7 @@ import java.util.stream.Stream;
import static com.yeejoin.amos.boot.module.jg.api.enums.VehicleApanageEnum.XIAN_YANG;
import static com.yeejoin.amos.boot.module.jg.api.enums.VehicleApanageEnum.XI_XIAN;
import static com.yeejoin.amos.boot.module.jg.biz.service.impl.JgChangeRegistrationNameServiceImpl.DB_BATCH_SIZE;
import static com.yeejoin.amos.boot.module.jg.biz.service.impl.JgUseRegistrationServiceImpl.getAuditPassedDate;
/**
......@@ -173,6 +171,8 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
@Autowired
private JgResumeInfoServiceImpl jgResumeInfoService;
@Autowired
private JgResumeInfoEqMapper jgResumeInfoEqMapper;
@Autowired
private TzBaseEnterpriseInfoMapper tzBaseEnterpriseInfoMapper;
@Autowired
private JgCertificateChangeRecordServiceImpl certificateChangeRecordService;
......@@ -1053,22 +1053,29 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
// 生成一条tzs_jg_certificate_change_record记录
generateCertificateChangeRecord(jgVehicleInformation, registerInfo, changeRecordId, taskV2Model);
jgResumeInfoService.saveBatchResume(
equipIdList.stream()
.map(equipId -> JgResumeInfoDto.builder()
JgResumeInfoDto dto = JgResumeInfoDto.builder()
.applyNo(jgVehicleInformation.getApplyNo())
.businessType(BusinessTypeEnum.JG_VEHICLE_GAS_APPLICATION.getName())
.businessId(String.valueOf(jgVehicleInformation.getSequenceNbr()))
.equId(equipId)
.approvalUnit(jgVehicleInformation.getReceiveOrgName())
.approvalUnitCode(jgVehicleInformation.getReceiveCompanyCode())
.status("正常")
.changeContent(BusinessTypeEnum.JG_VEHICLE_GAS_APPLICATION.getName() + "业务办理")
.routePath(taskV2Model.getRoutePath())
.build();
jgResumeInfoService.saveBatchResume(Collections.singletonList(dto));
List<JgResumeInfoEq> list = equipIdList.stream()
.map(equipId -> JgResumeInfoEq.builder()
.resumeId(dto.getSequenceNbr())
.equId(equipId)
.build())
.collect(Collectors.toList())
.collect(Collectors.toList());
for (int i = 0; i < list.size(); i += DB_BATCH_SIZE) {
jgResumeInfoEqMapper.insertBatchSomeColumn(
list.subList(i, Math.min(i + DB_BATCH_SIZE, list.size()))
);
}
// 车用气瓶评分
eventPublisher.publish(new EquipCreateOrEditEvent(this, BusinessTypeEnum.JG_VEHICLE_GAS_APPLICATION.name(), Sets.newHashSet(equipIdList), EquipCreateOrEditEvent.EquipType.equip));
}
......
......@@ -13,7 +13,9 @@ import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.biz.common.utils.SnowflakeIdUtil;
import com.yeejoin.amos.boot.module.common.api.dao.ESEquipmentCategory;
import com.yeejoin.amos.boot.module.common.api.dao.EsEquipmentDao;
import com.yeejoin.amos.boot.module.common.api.dto.ESEquipmentCategoryDto;
import com.yeejoin.amos.boot.module.common.api.entity.ESEquipmentInfo;
import com.yeejoin.amos.boot.module.jg.api.dto.ShCarDto;
import com.yeejoin.amos.boot.module.jg.api.entity.*;
import com.yeejoin.amos.boot.module.jg.api.enums.BusinessTypeEnum;
......@@ -94,6 +96,8 @@ public class ShCarServiceImpl extends BaseService<ShCar, ShCar, ShCarMapper> imp
@Resource
private ESEquipmentCategory esEquipmentCategory;
@Resource
private EsEquipmentDao esEquipmentDao;
@Resource
private TzsServiceFeignClient tzsServiceFeignClient;
@Resource
private JgVehicleInformationServiceImpl vehicleInformationService;
......@@ -707,13 +711,23 @@ public class ShCarServiceImpl extends BaseService<ShCar, ShCar, ShCarMapper> imp
* 认领过程中报错,回滚第一步的es数据
*/
public void handleClaimFailed(List<String> records) {
if (!records.isEmpty()) {
records.forEach(record -> {
Optional<ESEquipmentCategoryDto> data = esEquipmentCategory.findById(record);
if (!ObjectUtils.isEmpty(data)) {
esEquipmentCategory.deleteById(record);
esEquipmentCategory.deleteAll(this.buildEquipCategoryData(records));
esEquipmentDao.deleteAll(this.buildEquipData(records));
}
});
private Iterable<? extends ESEquipmentInfo> buildEquipData(List<String> records) {
return records.stream().map(record->{
ESEquipmentInfo esEquipmentInfo = new ESEquipmentInfo();
esEquipmentInfo.setSEQUENCE_NBR(record);
return esEquipmentInfo;
}).collect(Collectors.toList());
}
private Iterable<? extends ESEquipmentCategoryDto> buildEquipCategoryData(List<String> records) {
return records.stream().map(record->{
ESEquipmentCategoryDto esEquipmentInfo = new ESEquipmentCategoryDto();
esEquipmentInfo.setSEQUENCE_NBR(record);
return esEquipmentInfo;
}).collect(Collectors.toList());
}
}
\ No newline at end of file
......@@ -30,7 +30,7 @@ public interface CategoryOtherInfoMapper extends BaseMapper<CategoryOtherInfo> {
int updateOtherInfo(String supervisorCode, String editStatus);
Map<String, Object> selectDataById(String id);
Map<String, Object> selectJgAllViewDataById(String id);
CategoryOtherInfo queryInitCode(@Param("initCode") @NonNull String initCode);
......
......@@ -73,7 +73,7 @@
LEFT JOIN idx_biz_jg_use_info ibjui ON ibjoi.RECORD = ibjui.RECORD
WHERE ibjoi."RECORD" = #{record}
</select>
<select id="selectDataById" resultType="java.util.Map">
<select id="selectJgAllViewDataById" resultType="java.util.Map">
SELECT "SEQUENCE_NBR",
"REC_DATE",
"CREATE_DATE",
......
......@@ -1664,7 +1664,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
@Override
public void checkEsData(String id) {
Map<String, Object> map = categoryOtherInfoMapper.selectDataById(id);
Map<String, Object> map = categoryOtherInfoMapper.selectJgAllViewDataById(id);
categoryOtherInfoMapper.updateEsStatus(id);
ESEquipmentCategoryDto dto = JSON.parseObject(toJSONString(map), ESEquipmentCategoryDto.class);
Optional<ESEquipmentCategoryDto> data = esEquipmentCategory.findById(id);
......
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