Commit e9e6c1f2 authored by tianbo's avatar tianbo

Merge remote-tracking branch 'origin/develop_tzs_bugfix' into develop_tzs_register

parents a78da737 d4ca4d97
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.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* Mapper 接口
......@@ -9,6 +9,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
* @author system_generator
* @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;
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.entity.JgUseRegistrationEq;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
......@@ -13,7 +14,7 @@ import java.util.List;
* @author system_generator
* @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} ")
void updateEquipIsVaildByEquipIdAndCurrentDocumentId(@Param("equipId") String equipId, @Param("currentDocumentId") String currentDocumentId);
......
......@@ -14,6 +14,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.annotation.Resource;
import java.io.IOException;
/**
* 用于业务变更过程中历史数据处理的控制层
......@@ -319,4 +320,20 @@ public class DataHandlerController extends BaseController {
public ResponseModel<Integer> modifySupervisionOrgBranchCode(@RequestParam(value = "isModify",defaultValue = "false") boolean 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 {
factoryInfo.setRecord(record);
factoryInfo.setRecDate(new Date());
factoryInfo.setSequenceNbr(null);
factoryInfo.setFactoryIsComplete("2");
factoryInfoList.add(factoryInfo);
// 施工信息
......
......@@ -53,8 +53,14 @@ import com.yeejoin.amos.boot.module.ymt.api.mapper.*;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
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.QueryBuilders;
import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -63,7 +69,7 @@ import org.springframework.util.ObjectUtils;
import org.springframework.util.StopWatch;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import java.io.IOException;
import java.lang.reflect.Method;
import java.math.BigDecimal;
import java.math.RoundingMode;
......@@ -76,7 +82,6 @@ import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Function;
import java.util.stream.Collectors;
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_NAME;
......@@ -161,6 +166,8 @@ public class DataHandlerServiceImpl {
private final IdxBizJgOtherInfoMapper otherInfoMapper;
private final RestHighLevelClient restHighLevelClient;
/**
* 安装告知压力管道历史数据修复-详情中的设备列表修改为汇总表格式
......@@ -2056,4 +2063,73 @@ public class DataHandlerServiceImpl {
log.info("==========>record,{},orgBranchCode,{},orgBranchName,{}",dto.getSEQUENCE_NBR(),dto.getORG_BRANCH_CODE(),dto.getORG_BRANCH_NAME());
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
.map(d -> DateUtil.parse(d, "yyyy-MM-dd"))
.ifPresent(factoryInfo::setProduceDate);
factoryInfo.setImported(Optional.ofNullable(data.getImported()).orElse("0"));
factoryInfo.setFactoryIsComplete("2");
factoryInfoList.add(factoryInfo);
// 注册登记
......
......@@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
......@@ -174,26 +175,23 @@ public class JgMaintenanceContractServiceImpl extends BaseService<JgMaintenanceC
} else {
// 完成的显示历史表的数据
JSONArray objects = commonService.queryHistoryDataObj(dto.getSequenceNbr());
// 兼容老数据
if (objects.isEmpty()) {
List<Map<String, Object>> list = maintenanceContractMapper.selectEquipList(sequenceNbr);
if (!ObjectUtils.isEmpty(list)) {
vo.setEquipmentLists(list);
}
List<Map<String, Object>> equipmentList;
if (objects == null || objects.isEmpty()) {
equipmentList = Optional.ofNullable(maintenanceContractMapper.selectEquipList(sequenceNbr))
.orElse(Collections.emptyList());
} else {
//如果EQU_DEFINE是数字进行转换
for (int i = 0; i < objects.size(); i++) {
JSONObject currentObject = objects.getJSONObject(i);
String equDefineCode = currentObject.getString("EQU_DEFINE");
if (equDefineCode.chars().anyMatch(Character::isDigit)) {
currentObject.put("EQU_DEFINE", maintenanceContractMapper.getNameByEquDefine(equDefineCode));
// 遍历 JSONArray,如果 EQU_DEFINE 包含数字,则进行转换
objects.forEach(obj -> {
JSONObject json = (JSONObject) obj;
String equDefineCode = json.getString("EQU_DEFINE");
if (equDefineCode != null && equDefineCode.chars().anyMatch(Character::isDigit)) {
String name = maintenanceContractMapper.getNameByEquDefine(equDefineCode);
json.put("EQU_DEFINE", name);
}
}
List equList = objects.toJavaList(Map.class);
vo.setEquipmentLists(equList);
});
equipmentList = JSONObject.parseObject(objects.toJSONString(),new TypeReference<List<Map<String, Object>>>() {});
}
vo.setEquipmentLists(equipmentList);
}
// 对象转换 填充登录人单位类型 权限
JSONObject re = BeanUtil.copyProperties(vo, JSONObject.class);
......
......@@ -44,4 +44,7 @@ public class JgUseRegistrationEqServiceImpl extends BaseService<JgUseRegistratio
return list(queryWrapper);
}
public int saveBatch(List<JgUseRegistrationEq> registrationEqList) {
return this.baseMapper.insertBatchSomeColumn(registrationEqList,1000);
}
}
\ No newline at end of file
......@@ -20,6 +20,7 @@ import com.yeejoin.amos.boot.module.common.api.enums.CylinderTypeEnum;
import com.yeejoin.amos.boot.module.common.api.enums.UnitTypeEnum;
import com.yeejoin.amos.boot.module.common.api.enums.UserPostEnum;
import com.yeejoin.amos.boot.module.statistcs.biz.utils.JsonUtils;
import com.yeejoin.amos.boot.module.statistcs.biz.utils.QueryBuilderUtils;
import com.yeejoin.amos.boot.module.statistics.api.enums.InformationManageTypeEnum;
import com.yeejoin.amos.boot.module.statistics.api.feign.TzsServiceFeignClient;
import com.yeejoin.amos.boot.module.statistics.api.mapper.AlertStatisticsMapper;
......@@ -755,11 +756,15 @@ public class ZLDPStatisticsServiceImpl {
.filter(region -> !"西咸新区".equals(region.getRegionName()))
.map(region -> {
String orgCode = stCommonService.getAndSetOrgCode(region.getRegionCode().toString());
Long equipIsManageNum = staticsCenterMapCountDataForEquipIsManage(orgCode, paramDto);
Long equipTotal = getEquipTotalForCode(paramDto.getTreeValue(), region.getRegionCode().toString());
BoolQueryBuilder queryBuilder = QueryBuilders.boolQuery();
queryBuilder.must(QueryBuilders.existsQuery("SUPERVISORY_CODE"));
queryBuilder.mustNot(QueryBuilders.termQuery("SUPERVISORY_CODE", "null"));
Long equipIsManageNum = staticsCenterMapCountDataForEquipIsManage(queryBuilder,orgCode, paramDto);
Long equipTotal = staticsCenterMapCountDataForEquipIsManage(null, orgCode, paramDto);
CountDto dto = new CountDto();
dto.setLongValue(equipTotal);
dto.setStrValue(calculateClaimRate(equipTotal, equipIsManageNum, decimalFormat));
dto.setKeyStr(orgCode);
return dto;
}).collect(Collectors.toList());
}
......@@ -812,17 +817,19 @@ public class ZLDPStatisticsServiceImpl {
return decimalFormat.format(claimRate);
}
private Long staticsCenterMapCountDataForEquipIsManage(String orgCode, DPFilterParamForDetailDto paramDto) {
private Long staticsCenterMapCountDataForEquipIsManage(BoolQueryBuilder queryBuilder, String orgCode, DPFilterParamForDetailDto paramDto) {
long num = 0;
CountRequest request = new CountRequest();
request.indices("idx_biz_view_jg_all");
request.indices("idx_biz_equipment_info");
BoolQueryBuilder boolMust = QueryBuilders.boolQuery();
if (!ObjectUtils.isEmpty(queryBuilder)) {
boolMust = QueryBuilderUtils.copyBoolQuery(queryBuilder);
}
// 按照管辖机构区域信息模糊查询
boolMust.must(QueryBuilders.wildcardQuery("ORG_BRANCH_CODE.keyword", QueryParser.escape(orgCode) + "*"));
boolMust.must(QueryBuilders.existsQuery("SUPERVISORY_CODE"));
boolMust.mustNot(QueryBuilders.termQuery("SUPERVISORY_CODE","null"));
String[] status = {"草稿","已拒领","待认领"};
boolMust.mustNot(QueryBuilders.termsQuery("STATUS",Arrays.asList(status)));
boolMust.must(QueryBuilders.prefixQuery("ORG_BRANCH_CODE", orgCode));
String[] status = {"草稿", "已拒领", "待认领"};
boolMust.mustNot(QueryBuilders.termsQuery("STATUS", Arrays.asList(status)));
String[] equCategoryCode = {"2300"};
boolMust.mustNot(QueryBuilders.termsQuery("EQU_CATEGORY_CODE",Arrays.asList(equCategoryCode)));
String[] equListCode = {"8000"};
......
......@@ -345,8 +345,8 @@
where supervision_org_code like concat(#{oldOrgCode}, '%');
update tzs_safety_problem_tracing
set governing_body_code = replace(governing_body_code, #{oldOrgCode}, #{newOrgCode})
where governing_body_code like concat(#{oldOrgCode}, '%');
set governing_body_org_code = replace(governing_body_org_code, #{oldOrgCode}, #{newOrgCode})
where governing_body_org_code like concat(#{oldOrgCode}, '%');
update tz_alert_called
set biz_org_code = replace(biz_org_code, #{oldOrgCode}, #{newOrgCode})
......
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