Commit 8a33ee4e authored by suhuiguang's avatar suhuiguang

Merge branch 'develop_tzs_register' of…

Merge branch 'develop_tzs_register' of http://39.100.92.250:5000/moa/amos-boot-biz into develop_tzs_register
parents 759ddd1d 78ac8664
...@@ -17,4 +17,6 @@ public interface JgRegistrationHistoryMapper extends BaseMapper<JgRegistrationHi ...@@ -17,4 +17,6 @@ public interface JgRegistrationHistoryMapper extends BaseMapper<JgRegistrationHi
@Select("select sequence_nbr from tzs_jg_registration_history where registration_class = #{registratioClass} and current_document_id = #{documentId} and is_delete = 0") @Select("select sequence_nbr from tzs_jg_registration_history where registration_class = #{registratioClass} and current_document_id = #{documentId} and is_delete = 0")
Long getSequenceNbrByRegistratioClassAndDocumentId(@Param("registratioClass") String registratioClass, @Param("documentId") String documentId); Long getSequenceNbrByRegistratioClassAndDocumentId(@Param("registratioClass") String registratioClass, @Param("documentId") String documentId);
JgRegistrationHistory queryLatestRegistrationHistory(@Param("projectContraptionSeq") Long projectContraptionSeq);
} }
...@@ -2,4 +2,15 @@ ...@@ -2,4 +2,15 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!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.JgRegistrationHistoryMapper"> <mapper namespace="com.yeejoin.amos.boot.module.jg.api.mapper.JgRegistrationHistoryMapper">
<select id="queryLatestRegistrationHistory" resultType="com.yeejoin.amos.boot.module.jg.api.entity.JgRegistrationHistory">
SELECT his.change_data
FROM tzs_jg_use_registration tjur
LEFT JOIN tzs_jg_registration_history his
ON tjur.sequence_nbr = his.current_document_id
WHERE tjur.is_delete = 0
AND tjur.project_contraption_id = #{projectContraptionSeq}
AND tjur.status <![CDATA[ <> ]]> '已作废'
ORDER BY tjur.rec_date DESC
LIMIT 1
</select>
</mapper> </mapper>
...@@ -171,6 +171,18 @@ public class IdxBizJgProjectContraptionController extends BaseController { ...@@ -171,6 +171,18 @@ public class IdxBizJgProjectContraptionController extends BaseController {
} }
/** /**
* 根据sequenceNbr删除datasource为jg_his_gd_pl的数据
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@DeleteMapping(value = "/deleteByHisGdPl")
@ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除datasource为jg_his_gd_pl的数据", notes = "根据sequenceNbr删除datasource为jg_his_gd_pl的数据")
public ResponseModel<Boolean> deleteByHisGdPl(@RequestParam(value = "sequenceNbr") Long sequenceNbr) {
return ResponseHelper.buildResponse(idxBizJgProjectContraptionServiceImpl.deleteByHisGdPl(sequenceNbr));
}
/**
* 获取检验信息详情 * 获取检验信息详情
* *
* @return * @return
......
...@@ -24,4 +24,6 @@ public interface IIdxBizJgProjectContraptionService extends IService<IdxBizJgPro ...@@ -24,4 +24,6 @@ public interface IIdxBizJgProjectContraptionService extends IService<IdxBizJgPro
IPage<IdxBizJgProjectContraption> proConPageByParams(Map<String, String> params, Page<IdxBizJgProjectContraption> page, ReginParams reginParams); IPage<IdxBizJgProjectContraption> proConPageByParams(Map<String, String> params, Page<IdxBizJgProjectContraption> page, ReginParams reginParams);
List<IdxBizJgProjectContraption> proConListByParams(Map<String, String> params, ReginParams reginParams); List<IdxBizJgProjectContraption> proConListByParams(Map<String, String> params, ReginParams reginParams);
Boolean deleteByHisGdPl(Long sequenceNbr);
} }
\ No newline at end of file
package com.yeejoin.amos.boot.module.jg.biz.service.impl; package com.yeejoin.amos.boot.module.jg.biz.service.impl;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
...@@ -8,16 +10,21 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; ...@@ -8,16 +10,21 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.bo.CompanyBo; import com.yeejoin.amos.boot.biz.common.bo.CompanyBo;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams; import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
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.jg.api.converter.DictParamsConverter;
import com.yeejoin.amos.boot.module.jg.api.dto.InspectConclusionConverter;
import com.yeejoin.amos.boot.module.jg.api.dto.InspectTypeConverter;
import com.yeejoin.amos.boot.module.jg.api.dto.PipingExcelDto;
import com.yeejoin.amos.boot.module.jg.api.enums.CompanyTypeEnum; import com.yeejoin.amos.boot.module.jg.api.enums.CompanyTypeEnum;
import com.yeejoin.amos.boot.module.jg.api.enums.EquipSourceEnum; import com.yeejoin.amos.boot.module.jg.api.enums.EquipSourceEnum;
import com.yeejoin.amos.boot.module.jg.api.enums.PipelineEnum; import com.yeejoin.amos.boot.module.jg.api.enums.PipelineEnum;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgVehicleInformationMapper; import com.yeejoin.amos.boot.module.jg.api.mapper.JgVehicleInformationMapper;
import com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgProjectContraptionService; import com.yeejoin.amos.boot.module.jg.biz.feign.TzsServiceFeignClient;
import com.yeejoin.amos.boot.module.jg.biz.service.*;
import com.yeejoin.amos.boot.module.ymt.api.dto.IdxBizJgProjectContraptionDto; import com.yeejoin.amos.boot.module.ymt.api.dto.IdxBizJgProjectContraptionDto;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgInspectionDetectionInfo; import com.yeejoin.amos.boot.module.ymt.api.entity.*;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgProjectContraption;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgUseInfo;
import com.yeejoin.amos.boot.module.ymt.api.entity.TzBaseEnterpriseInfo;
import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgProjectContraptionMapper; import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgProjectContraptionMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.TzBaseEnterpriseInfoMapper; import com.yeejoin.amos.boot.module.ymt.api.mapper.TzBaseEnterpriseInfoMapper;
import com.yeejoin.amos.feign.privilege.Privilege; import com.yeejoin.amos.feign.privilege.Privilege;
...@@ -87,6 +94,26 @@ public class IdxBizJgProjectContraptionServiceImpl extends BaseService<IdxBizJgP ...@@ -87,6 +94,26 @@ public class IdxBizJgProjectContraptionServiceImpl extends BaseService<IdxBizJgP
private JgVehicleInformationMapper jgVehicleInformationMapper; private JgVehicleInformationMapper jgVehicleInformationMapper;
@Autowired @Autowired
private JgInstallationNoticeServiceImpl jgInstallationNoticeService; private JgInstallationNoticeServiceImpl jgInstallationNoticeService;
@Autowired
private IdxBizJgUseInfoServiceImpl idxBizJgUseInfoService;
@Autowired
private IdxBizJgDesignInfoServiceImpl idxBizJgDesignInfoService;
@Autowired
private IdxBizJgFactoryInfoServiceImpl idxBizJgFactoryInfoService;
@Autowired
private IdxBizJgRegisterInfoServiceImpl idxBizJgRegisterInfoService;
@Autowired
private IdxBizJgSupervisionInfoServiceImpl idxBizJgSupervisionInfoService;
@Autowired
private IdxBizJgOtherInfoServiceImpl idxBizJgOtherInfoService;
@Autowired
private IdxBizJgTechParamsPipelineServiceImpl idxBizJgTechParamsPipelineService;
@Autowired
private IdxBizJgInspectionDetectionInfoServiceImpl idxBizJgInspectionDetectionInfoService;
@Autowired
private IdxBizJgConstructionInfoServiceImpl idxBizJgConstructionInfoService;
@Autowired
private ESEquipmentCategory esEquipmentCategory;
@Override @Override
public boolean saveOrUpdateData(IdxBizJgProjectContraption projectContraption) { public boolean saveOrUpdateData(IdxBizJgProjectContraption projectContraption) {
...@@ -474,4 +501,82 @@ public class IdxBizJgProjectContraptionServiceImpl extends BaseService<IdxBizJgP ...@@ -474,4 +501,82 @@ public class IdxBizJgProjectContraptionServiceImpl extends BaseService<IdxBizJgP
projectContraption.setUseUnitCreditCode(companyInfoMap.get("creditCode").toString()); projectContraption.setUseUnitCreditCode(companyInfoMap.get("creditCode").toString());
return this.saveOrUpdateData(projectContraption); return this.saveOrUpdateData(projectContraption);
} }
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean deleteByHisGdPl(Long sequenceNbr) {
IdxBizJgProjectContraption idxBizJgProjectContraption = baseMapper.selectById(sequenceNbr);
if(Objects.nonNull(idxBizJgProjectContraption)){
String dataSource = idxBizJgProjectContraption.getDataSource();
if(!"jg_his_gd_pl".equals(dataSource)){
throw new BadRequest("数据源不是导入类型禁止删除");
}
// 删除管道对应的idx表数据
this.deletePipInfoToIdxTables(idxBizJgProjectContraption);
// 删除工程装置表信息
removeById(idxBizJgProjectContraption.getSequenceNbr());
}
return Boolean.TRUE;
}
private void deletePipInfoToIdxTables(IdxBizJgProjectContraption idxBizJgProjectContraption) {
Long jgProjectContraptionSequenceNbr = idxBizJgProjectContraption.getSequenceNbr();
LambdaQueryWrapper<IdxBizJgUseInfo> jgUseInfoWrapper = new LambdaQueryWrapper<>();
jgUseInfoWrapper.eq(IdxBizJgUseInfo::getProjectContraptionId,jgProjectContraptionSequenceNbr);
List<IdxBizJgUseInfo> useInfos = idxBizJgUseInfoService.list(jgUseInfoWrapper);
//获取records
List<String> records = new ArrayList<>();
if(CollectionUtil.isNotEmpty(useInfos)){
for (IdxBizJgUseInfo useInfo : useInfos) {
records.add(useInfo.getRecord());
}
}
if(CollectionUtil.isNotEmpty(records)){
// 删除检验检测信息
LambdaQueryWrapper<IdxBizJgInspectionDetectionInfo> inspectionDetectionInfoWrapper = new LambdaQueryWrapper<>();
inspectionDetectionInfoWrapper.in(IdxBizJgInspectionDetectionInfo::getRecord,records);
idxBizJgInspectionDetectionInfoService.remove(inspectionDetectionInfoWrapper);
// 删除设计信息
LambdaQueryWrapper<IdxBizJgDesignInfo> designInfoWrapper = new LambdaQueryWrapper<>();
designInfoWrapper.in(IdxBizJgDesignInfo::getRecord,records);
idxBizJgDesignInfoService.remove(designInfoWrapper);
// 删除制造信息
LambdaQueryWrapper<IdxBizJgFactoryInfo> factoryInfoWrapper = new LambdaQueryWrapper<>();
factoryInfoWrapper.in(IdxBizJgFactoryInfo::getRecord,records);
idxBizJgFactoryInfoService.remove(factoryInfoWrapper);
// 删除施工信息
LambdaQueryWrapper<IdxBizJgConstructionInfo> constructionInfoWrapper = new LambdaQueryWrapper<>();
constructionInfoWrapper.in(IdxBizJgConstructionInfo::getRecord,records);
idxBizJgConstructionInfoService.remove(constructionInfoWrapper);
// 删除注册登记信息
LambdaQueryWrapper<IdxBizJgRegisterInfo> registerInfoWrapper = new LambdaQueryWrapper<>();
registerInfoWrapper.in(IdxBizJgRegisterInfo::getRecord,records);
idxBizJgRegisterInfoService.remove(registerInfoWrapper);
// 删除监督管理
LambdaQueryWrapper<IdxBizJgSupervisionInfo> supervisionInfoWrapper = new LambdaQueryWrapper<>();
supervisionInfoWrapper.in(IdxBizJgSupervisionInfo::getRecord,records);
idxBizJgSupervisionInfoService.remove(supervisionInfoWrapper);
// 删除其他信息
LambdaQueryWrapper<IdxBizJgOtherInfo> otherInfoWrapper = new LambdaQueryWrapper<>();
otherInfoWrapper.in(IdxBizJgOtherInfo::getRecord,records);
idxBizJgOtherInfoService.remove(otherInfoWrapper);
// 删除管道技术参数
LambdaQueryWrapper<IdxBizJgTechParamsPipeline> techParamsPipelineWrapper = new LambdaQueryWrapper<>();
techParamsPipelineWrapper.in(IdxBizJgTechParamsPipeline::getRecord,records);
idxBizJgTechParamsPipelineService.remove(techParamsPipelineWrapper);
//删除es数据
for (String record : records) {
esEquipmentCategory.deleteById(record);
}
// 删除使用信息
idxBizJgUseInfoService.remove(jgUseInfoWrapper);
}
}
} }
\ No newline at end of file
...@@ -60,4 +60,7 @@ public class JgRegistrationHistoryServiceImpl extends BaseService<JgRegistration ...@@ -60,4 +60,7 @@ public class JgRegistrationHistoryServiceImpl extends BaseService<JgRegistration
return this.update(history, historyWapper); return this.update(history, historyWapper);
} }
public JgRegistrationHistory queryLatestRegistrationHistory(Long projectContraptionSeq) {
return this.baseMapper.queryLatestRegistrationHistory(projectContraptionSeq);
}
} }
\ No newline at end of file
...@@ -3977,31 +3977,32 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD ...@@ -3977,31 +3977,32 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
.put("projectContraptionId", projectContraptionSeq) .put("projectContraptionId", projectContraptionSeq)
.put("projectContraptionNo", projectContraption.getProjectContraptionNo()) .put("projectContraptionNo", projectContraption.getProjectContraptionNo())
.put("pipelineLength", totalPipelineLength); .put("pipelineLength", totalPipelineLength);
setProjectContraptionInfo(projectContraptionSeq, resultBuilder); if (Objects.nonNull(projectContraption.getUseRegistrationCode())){
setProjectContraptionInfo(projectContraption, resultBuilder);
}
return resultBuilder.build(); return resultBuilder.build();
} }
private void setProjectContraptionInfo(String projectContraptionSeq, MapBuilder<String, Object> re) { private void setProjectContraptionInfo(IdxBizJgProjectContraption projectContraption, MapBuilder<String, Object> re) {
LambdaQueryWrapper<IdxBizJgProjectConstruction> queryWrapper = new LambdaQueryWrapper<>(); // 查询最新的历史记录
queryWrapper.eq(IdxBizJgProjectConstruction::getProjectContraptionId, projectContraptionSeq) JgRegistrationHistory history = jgRegistrationHistoryService.queryLatestRegistrationHistory(projectContraption.getSequenceNbr());
.orderByDesc(IdxBizJgProjectConstruction::getUscDate).last("limit 1");
IdxBizJgProjectConstruction construction = idxBizJgProjectConstructionMapper.selectOne(queryWrapper); if (history != null && history.getChangeData() != null) {
if(construction != null){ JSONObject hisJson = JSON.parseObject(history.getChangeData());
re.put("installLeaderName", construction.getConstructionLeaderName()); Map<String, Object> fieldMappings = new HashMap<>();
re.put("installLeaderPhone",construction.getConstructionLeaderPhone()); fieldMappings.put("useRegistrationCode", projectContraption.getUseRegistrationCode());
re.put("installStartDate", construction.getUscDate()); fieldMappings.put("safetyManager", hisJson.get("safetyManager"));
re.put("installPropertyUnitName", construction.getConstructionLeaderName()); fieldMappings.put("useDate", hisJson.get("useDate"));
re.put("installProxyStatementAttachment", JSON.parse(construction.getProxyStatementAttachment())); fieldMappings.put("otherAccessories", hisJson.get("otherAccessories"));
re.put("installContractAttachment", JSON.parse(construction.getConstructionContractAttachment())); fieldMappings.put("factoryUseSiteStreet", hisJson.get("factoryUseSiteStreet"));
re.put("insOtherAccessories", JSON.parse(construction.getConstructionOtherAccessories())); fieldMappings.put("province", hisJson.get("province"));
re.put("installStreet", construction.getStreetName()); fieldMappings.put("address", hisJson.get("address"));
re.put("installProvince", construction.getProvinceName()); fieldMappings.put("city", hisJson.get("city"));
re.put("installAddress", construction.getAddress()); fieldMappings.put("isXixian", hisJson.get("isXixian"));
re.put("installCity", construction.getCityName()); fieldMappings.put("county", hisJson.get("county"));
re.put("installIsXixian", construction.getIsXixian()); fieldMappings.put("longitudeLatitude", hisJson.get("longitudeLatitude"));
re.put("installCounty", construction.getCountyName()); fieldMappings.put("estateUnitName", hisJson.get("estateUnitName"));
re.put("uscUnitCreditCode", construction.getUscUnitCreditCode()); fieldMappings.forEach(re::put);
re.put("uscUnitName", construction.getUscUnitName());
} }
} }
......
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