Commit 41ba7c8e authored by 刘林's avatar 刘林

fix(jg):【现场问题】压力容器-气瓶,三级审批优化V1

parent ed2a8ab4
package com.yeejoin.amos.boot.module.jg.api.mapper; package com.yeejoin.amos.boot.module.jg.api.mapper;
import com.yeejoin.amos.boot.module.common.api.mapper.CustomBaseMapper;
import com.yeejoin.amos.boot.module.jg.api.entity.JgCertificateChangeRecordEq; import com.yeejoin.amos.boot.module.jg.api.entity.JgCertificateChangeRecordEq;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/** /**
* Mapper 接口 * Mapper 接口
...@@ -9,6 +9,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; ...@@ -9,6 +9,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
* @author system_generator * @author system_generator
* @date 2024-07-05 * @date 2024-07-05
*/ */
public interface JgCertificateChangeRecordEqMapper extends BaseMapper<JgCertificateChangeRecordEq> { public interface JgCertificateChangeRecordEqMapper extends CustomBaseMapper<JgCertificateChangeRecordEq> {
} }
package com.yeejoin.amos.boot.module.jg.api.mapper; package com.yeejoin.amos.boot.module.jg.api.mapper;
import com.yeejoin.amos.boot.module.common.api.mapper.CustomBaseMapper;
import com.yeejoin.amos.boot.module.jg.api.dto.JgUseRegistrationEqDto; import com.yeejoin.amos.boot.module.jg.api.dto.JgUseRegistrationEqDto;
import com.yeejoin.amos.boot.module.jg.api.entity.JgUseRegistrationEq; import com.yeejoin.amos.boot.module.jg.api.entity.JgUseRegistrationEq;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
...@@ -13,7 +14,7 @@ import java.util.List; ...@@ -13,7 +14,7 @@ import java.util.List;
* @author system_generator * @author system_generator
* @date 2023-12-18 * @date 2023-12-18
*/ */
public interface JgUseRegistrationEqMapper extends BaseMapper<JgUseRegistrationEq> { public interface JgUseRegistrationEqMapper extends CustomBaseMapper<JgUseRegistrationEq> {
@Update("update tzs_jg_use_registration_eq set is_invalid = 1 where equ_id = #{equipId} and equip_transfer_id != #{currentDocumentId} ") @Update("update tzs_jg_use_registration_eq set is_invalid = 1 where equ_id = #{equipId} and equip_transfer_id != #{currentDocumentId} ")
void updateEquipIsVaildByEquipIdAndCurrentDocumentId(@Param("equipId") String equipId, @Param("currentDocumentId") String currentDocumentId); void updateEquipIsVaildByEquipIdAndCurrentDocumentId(@Param("equipId") String equipId, @Param("currentDocumentId") String currentDocumentId);
......
...@@ -14,6 +14,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseHelper; ...@@ -14,6 +14,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.io.IOException;
/** /**
* 用于业务变更过程中历史数据处理的控制层 * 用于业务变更过程中历史数据处理的控制层
...@@ -319,4 +320,20 @@ public class DataHandlerController extends BaseController { ...@@ -319,4 +320,20 @@ public class DataHandlerController extends BaseController {
public ResponseModel<Integer> modifySupervisionOrgBranchCode(@RequestParam(value = "isModify",defaultValue = "false") boolean isModify) { public ResponseModel<Integer> modifySupervisionOrgBranchCode(@RequestParam(value = "isModify",defaultValue = "false") boolean isModify) {
return ResponseHelper.buildResponse(dataHandlerService.modifySupervisionOrgBranchCode(isModify)); return ResponseHelper.buildResponse(dataHandlerService.modifySupervisionOrgBranchCode(isModify));
} }
/**
* @apiNote 删除导入管道未纳管的数据
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "PUT", value = "删除导入管道未纳管的数据", notes = "删除导入管道未纳管的数据")
@PutMapping(value = "/equip/deleteImportedPipelineData")
public ResponseModel<Integer> deleteImportedPipelineData(@RequestParam(value = "uscUnitCreditCode") String uscUnitCreditCode,
@RequestParam(value = "projectContraption") String projectContraption,
@RequestParam(value = "dataSource", defaultValue = "jg_pl") String dataSource,
@RequestParam(value = "isDelete", defaultValue = "false") boolean isDelete) throws IOException {
return ResponseHelper.buildResponse(dataHandlerService.deleteImportedPipelineData(uscUnitCreditCode, projectContraption, dataSource, isDelete));
}
} }
\ No newline at end of file
...@@ -2093,6 +2093,7 @@ public class DataDockServiceImpl { ...@@ -2093,6 +2093,7 @@ public class DataDockServiceImpl {
factoryInfo.setRecord(record); factoryInfo.setRecord(record);
factoryInfo.setRecDate(new Date()); factoryInfo.setRecDate(new Date());
factoryInfo.setSequenceNbr(null); factoryInfo.setSequenceNbr(null);
factoryInfo.setFactoryIsComplete("2");
factoryInfoList.add(factoryInfo); factoryInfoList.add(factoryInfo);
// 施工信息 // 施工信息
......
...@@ -53,8 +53,14 @@ import com.yeejoin.amos.boot.module.ymt.api.mapper.*; ...@@ -53,8 +53,14 @@ import com.yeejoin.amos.boot.module.ymt.api.mapper.*;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.lucene.queryparser.classic.QueryParser;
import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.client.RestHighLevelClient;
import org.elasticsearch.index.query.BoolQueryBuilder; import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -63,7 +69,7 @@ import org.springframework.util.ObjectUtils; ...@@ -63,7 +69,7 @@ import org.springframework.util.ObjectUtils;
import org.springframework.util.StopWatch; import org.springframework.util.StopWatch;
import org.typroject.tyboot.core.foundation.context.RequestContext; import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import java.io.IOException;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
...@@ -76,7 +82,6 @@ import java.util.concurrent.atomic.AtomicInteger; ...@@ -76,7 +82,6 @@ import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Function; import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static com.alibaba.fastjson.JSON.toJSONString; import static com.alibaba.fastjson.JSON.toJSONString;
import static com.yeejoin.amos.boot.module.jg.biz.service.impl.JgInstallationNoticeServiceImpl.CONSTRUCTION_TYPE; import static com.yeejoin.amos.boot.module.jg.biz.service.impl.JgInstallationNoticeServiceImpl.CONSTRUCTION_TYPE;
import static com.yeejoin.amos.boot.module.jg.biz.service.impl.JgInstallationNoticeServiceImpl.CONSTRUCTION_TYPE_NAME; import static com.yeejoin.amos.boot.module.jg.biz.service.impl.JgInstallationNoticeServiceImpl.CONSTRUCTION_TYPE_NAME;
...@@ -161,6 +166,8 @@ public class DataHandlerServiceImpl { ...@@ -161,6 +166,8 @@ public class DataHandlerServiceImpl {
private final IdxBizJgOtherInfoMapper otherInfoMapper; private final IdxBizJgOtherInfoMapper otherInfoMapper;
private final RestHighLevelClient restHighLevelClient;
/** /**
* 安装告知压力管道历史数据修复-详情中的设备列表修改为汇总表格式 * 安装告知压力管道历史数据修复-详情中的设备列表修改为汇总表格式
...@@ -2056,4 +2063,73 @@ public class DataHandlerServiceImpl { ...@@ -2056,4 +2063,73 @@ public class DataHandlerServiceImpl {
log.info("==========>record,{},orgBranchCode,{},orgBranchName,{}",dto.getSEQUENCE_NBR(),dto.getORG_BRANCH_CODE(),dto.getORG_BRANCH_NAME()); log.info("==========>record,{},orgBranchCode,{},orgBranchName,{}",dto.getSEQUENCE_NBR(),dto.getORG_BRANCH_CODE(),dto.getORG_BRANCH_NAME());
return map; return map;
} }
public Integer deleteImportedPipelineData(String uscUnitCreditCode, String projectContraption, String dataSource, boolean isDelete) throws IOException {
List<String> records = this.queryImportedPipelineRecords(uscUnitCreditCode, projectContraption, dataSource);
if (records.isEmpty()) {
return 0;
}
if (isDelete) {
superviseInfoMapper.deleteDataAll(records);
deleteFromEs(records);
}
return records.size();
}
/**
* 查询需要删除的设备
*/
private List<String> queryImportedPipelineRecords(String uscUnitCreditCode,
String projectContraption,
String dataSource) throws IOException {
BoolQueryBuilder boolQuery = QueryBuilders.boolQuery()
.must(QueryBuilders.termQuery("DATA_SOURCE.keyword", dataSource))
.must(QueryBuilders.termQuery("IS_INTO_MANAGEMENT", false))
.must(QueryBuilders.termQuery("PROJECT_CONTRAPTION.keyword", projectContraption))
.must(QueryBuilders.wildcardQuery(
"USC_UNIT_CREDIT_CODE", "*" + QueryParser.escape(uscUnitCreditCode.toLowerCase()) + "*"))
.must(QueryBuilders.termQuery("STATUS", "已认领"));
SearchSourceBuilder sourceBuilder = new SearchSourceBuilder()
.query(boolQuery)
.fetchSource(new String[]{"SEQUENCE_NBR"}, null)
.size(10000);
SearchRequest request = new SearchRequest(IDX_BIZ_VIEW_JG_ALL).source(sourceBuilder);
SearchResponse response = restHighLevelClient.search(request, RequestOptions.DEFAULT);
return Arrays.stream(response.getHits().getHits())
.map(hit -> (String) hit.getSourceAsMap().get("SEQUENCE_NBR"))
.filter(Objects::nonNull)
.collect(Collectors.toList());
}
/**
* 删除ES中的数据(两个索引)
*/
private void deleteFromEs(List<String> records) {
List<ESEquipmentCategoryDto> esDtoList = buildEsCategoryDtos(records);
List<ESEquipmentInfo> esNewDtoList = buildEsInfoDtos(records);
if (!esDtoList.isEmpty()) {
esEquipmentCategory.deleteAll(esDtoList);
}
if (!esNewDtoList.isEmpty()) {
esEquipmentDao.deleteAll(esNewDtoList);
}
}
private List<ESEquipmentCategoryDto> buildEsCategoryDtos(List<String> records) {
return records.stream().map(v -> {
ESEquipmentCategoryDto dto = new ESEquipmentCategoryDto();
dto.setSEQUENCE_NBR(v);
return dto;
}).collect(Collectors.toList());
}
private List<ESEquipmentInfo> buildEsInfoDtos(List<String> records) {
return records.stream().map(v -> {
ESEquipmentInfo dto = new ESEquipmentInfo();
dto.setSEQUENCE_NBR(v);
return dto;
}).collect(Collectors.toList());
}
} }
...@@ -4333,6 +4333,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -4333,6 +4333,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
.map(d -> DateUtil.parse(d, "yyyy-MM-dd")) .map(d -> DateUtil.parse(d, "yyyy-MM-dd"))
.ifPresent(factoryInfo::setProduceDate); .ifPresent(factoryInfo::setProduceDate);
factoryInfo.setImported(Optional.ofNullable(data.getImported()).orElse("0")); factoryInfo.setImported(Optional.ofNullable(data.getImported()).orElse("0"));
factoryInfo.setFactoryIsComplete("2");
factoryInfoList.add(factoryInfo); factoryInfoList.add(factoryInfo);
// 注册登记 // 注册登记
......
...@@ -44,4 +44,7 @@ public class JgUseRegistrationEqServiceImpl extends BaseService<JgUseRegistratio ...@@ -44,4 +44,7 @@ public class JgUseRegistrationEqServiceImpl extends BaseService<JgUseRegistratio
return list(queryWrapper); return list(queryWrapper);
} }
public int saveBatch(List<JgUseRegistrationEq> registrationEqList) {
return this.baseMapper.insertBatchSomeColumn(registrationEqList,1000);
}
} }
\ No newline at end of file
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