Commit d198fbf2 authored by 刘林's avatar 刘林

fix(jg):9监管设备履历,添加作废之后删除功能

parent 6eda483f
......@@ -2,6 +2,8 @@ package com.yeejoin.amos.boot.module.jg.api.mapper;
import com.yeejoin.amos.boot.module.jg.api.entity.JgResumeInfo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* Mapper 接口
......@@ -11,4 +13,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/
public interface JgResumeInfoMapper extends BaseMapper<JgResumeInfo> {
void deleteBatchByBusinessId(@Param("idList") List<String> idList);
}
......@@ -2,4 +2,10 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.jg.api.mapper.JgResumeInfoMapper">
<delete id="deleteBatchByBusinessId">
delete from tzs_jg_resume_info where "business_id" in
<foreach collection="idList" separator="," item="id" open="(" close=");">
#{id}
</foreach>
</delete>
</mapper>
......@@ -3325,7 +3325,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
} catch (ParseException e) {
log.error("日期转换失败:", e);
}
String equCode = Optional.ofNullable(dto.getEquCategoryCode()).orElse(dto.getEquDefineCode());
String equCode = Optional.ofNullable(dto.getEquDefineCode()).orElse(dto.getEquCategoryCode());
String registrationCode = equCode + receiveCompanyCode + ym;
ResponseModel<String> responseModel = tzsServiceFeignClient.deviceRegistrationCode(registrationCode);
return responseModel.getResult();
......
......@@ -1206,20 +1206,23 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
changeRecordEq.setEquId(jgRelationEquip.getEquId());//设备主键
changeRecordEq.setProductCode(idxBizJgFactoryInfo.getFactoryNum());
certificateChangeRecordEqService.save(changeRecordEq);
jgResumeInfoService.createWithModel(JgResumeInfoDto.builder()
.applyNo(jgInstallationNotice.getApplyNo())
.businessType(BusinessTypeEnum.JG_INSTALLATION_NOTIFICATION.getName())
.businessId(jgInstallationNotice.getSequenceNbr() + "")
.equId(jgRelationEquip.getEquId())
.approvalUnit(jgInstallationNotice.getReceiveOrgName())
.approvalUnitCode(jgInstallationNotice.getReceiveOrgCreditCode())
.status("正常")
.routePath(taskV2Model1.getRoutePath())
.build());
});
// 更新关联设备表
jgInstallationNoticeEqService.updateBatchById(jgRelationEquips);
jgResumeInfoService.saveBatchResume(
jgRelationEquips.stream()
.map(v -> JgResumeInfoDto.builder()
.applyNo(jgInstallationNotice.getApplyNo())
.businessType(BusinessTypeEnum.JG_MAINTENANCE_RECORD.getName())
.businessId(String.valueOf(jgInstallationNotice.getSequenceNbr()))
.equId(String.valueOf(v.getEquId()))
.approvalUnit(jgInstallationNotice.getReceiveOrgName())
.approvalUnitCode(jgInstallationNotice.getReceiveOrgCreditCode())
.status("正常")
.routePath(taskV2Model1.getRoutePath())
.build())
.collect(Collectors.toList())
);
} else {
jgInstallationNotice.setNextExecuteIds(workflowResultDto.getNextExecutorRoleIds());
jgInstallationNotice.setNextExecuteUserIds(workflowResultDto.getNextExecutorUserIds());
......@@ -1616,6 +1619,14 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
// 6.es 回退
this.rollBackEsInfo(jgRelationEquip, idxBizJgRegisterInfo);
});
//删除设备履历信息
List<String> equipTransferIds = jgInstallationNoticeEqs.stream()
.map(JgInstallationNoticeEq::getEquipTransferId)
.filter(Objects::nonNull)
.collect(Collectors.toList());
if (!equipTransferIds.isEmpty()) {
jgResumeInfoService.deleteBatchByBusinessId(equipTransferIds);
}
}
/**
......
......@@ -888,6 +888,15 @@ public class JgMaintenanceContractServiceImpl extends BaseService<JgMaintenanceC
if (!CollectionUtils.isEmpty(equipmentLists)) {
List<String> list = equipmentLists.stream().filter(t -> t.getEquId() != null).map(JgMaintenanceContractEq::getEquId).collect(Collectors.toList());
maintenanceContractEqMapper.updateIdxBizJgRegisterInfo(list);
// 删除批量业务ID信息
List<String> equipTransferIds = equipmentLists.stream()
.map(JgMaintenanceContractEq::getEquipTransferId)
.filter(Objects::nonNull)
.collect(Collectors.toList());
if (!equipTransferIds.isEmpty()) {
jgResumeInfoService.deleteBatchByBusinessId(equipTransferIds);
}
jgResumeInfoService.deleteBatchByBusinessId(equipmentLists.stream().filter(t -> t.getEquipTransferId() != null).map(JgMaintenanceContractEq::getEquId).collect(Collectors.toList()));
}
}
// private void delRepeatUseEquipData(JgMaintenanceContract maintenanceContract) {
......
......@@ -53,4 +53,12 @@ public class JgResumeInfoServiceImpl extends BaseService<JgResumeInfoDto, JgResu
public void deleteByBusinessId(String businessId) {
this.baseMapper.delete(new LambdaQueryWrapper<JgResumeInfo>().eq(JgResumeInfo::getBusinessId, businessId));
}
/**
* 根据业务id进行删除
* @param idList 业务id
*/
public void deleteBatchByBusinessId(List<String> idList) {
this.baseMapper.deleteBatchByBusinessId(idList);
}
}
\ No newline at end of file
......@@ -359,15 +359,6 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
equip.setEquId(String.valueOf(x.get("record")));
equip.setVehicleId(vehicleInformation.getSequenceNbr() + "");
equipList.add(equip);
jgResumeInfoService.createWithModel(JgResumeInfoDto.builder()
.applyNo(vehicleInformation.getApplyNo())
.businessType(BusinessTypeEnum.JG_VEHICLE_GAS_APPLICATION.getName())
.businessId(vehicleInformation.getSequenceNbr() + "")
.equId(String.valueOf(x.get("record")))
.approvalUnit(vehicleInformation.getReceiveOrgName())
.approvalUnitCode(vehicleInformation.getReceiveOrgCode())
.status("正常")
.build());
});
// 保存关联设备信息
jgVehicleInformationEqService.saveBatch(equipList);
......@@ -1483,6 +1474,13 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
// 4.es的EQU_STATE, USE_ORG_CODE、ORG_BRANCH_CODE、ORG_BRANCH_NAME、STATUS
this.rollBackForEquipEsInfo(record);
});
List<String> equipTransferIds = eqList.stream()
.map(JgVehicleInformationEq::getVehicleId)
.filter(Objects::nonNull)
.collect(Collectors.toList());
if (!equipTransferIds.isEmpty()) {
jgResumeInfoService.deleteBatchByBusinessId(equipTransferIds);
}
}
private void rollBackForEquipEsInfo(String record) {
......@@ -1930,16 +1928,18 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
equip.setEquId(String.valueOf(x.get("record")));
equip.setVehicleId(vehicleInformation.getSequenceNbr() + "");
equipList.add(equip);
jgResumeInfoService.createWithModel(JgResumeInfoDto.builder()
.applyNo(vehicleInformation.getApplyNo())
.businessType(BusinessTypeEnum.JG_VEHICLE_GAS_APPLICATION.getName())
.businessId(vehicleInformation.getSequenceNbr() + "")
.equId(String.valueOf(x.get("record")))
.approvalUnit(vehicleInformation.getReceiveOrgName())
.approvalUnitCode(vehicleInformation.getReceiveOrgCode())
.status("正常")
.build());
//新增添加设备履历
if (StringUtils.isEmpty(vehicleInfoDto.getSequenceNbr())){
jgResumeInfoService.createWithModel(JgResumeInfoDto.builder()
.applyNo(vehicleInformation.getApplyNo())
.businessType(BusinessTypeEnum.JG_VEHICLE_GAS_APPLICATION.getName())
.businessId(vehicleInformation.getSequenceNbr() + "")
.equId(String.valueOf(x.get("record")))
.approvalUnit(vehicleInformation.getReceiveOrgName())
.approvalUnitCode(vehicleInformation.getReceiveOrgCode())
.status("正常")
.build());
}
// 查询注册信息
LambdaQueryWrapper<IdxBizJgRegisterInfo> queryRegisterWrapper = new QueryWrapper<IdxBizJgRegisterInfo>().lambda();
queryRegisterWrapper.eq(IdxBizJgRegisterInfo::getRecord, String.valueOf(x.get("record")));
......@@ -2126,15 +2126,6 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
equip.setEquId(String.valueOf(x.get("record")));
equip.setVehicleId(vehicleInformation.getSequenceNbr() + "");
equipList.add(equip);
jgResumeInfoService.createWithModel(JgResumeInfoDto.builder()
.applyNo(vehicleInformation.getApplyNo())
.businessType(BusinessTypeEnum.JG_VEHICLE_GAS_APPLICATION.getName())
.businessId(vehicleInformation.getSequenceNbr() + "")
.equId(String.valueOf(x.get("record")))
.approvalUnit(vehicleInformation.getReceiveOrgName())
.approvalUnitCode(vehicleInformation.getReceiveOrgCode())
.status("正常")
.build());
// 查询注册信息
LambdaQueryWrapper<IdxBizJgRegisterInfo> queryRegisterWrapper = new QueryWrapper<IdxBizJgRegisterInfo>().lambda();
......
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