Commit 66e1081d authored by tianbo's avatar tianbo

Merge branch 'develop_tzs_main' into develop_tzs_register

parents 8b7197dc 56afc391
package com.yeejoin.amos.boot.module.common.biz.service.impl;
import com.yeejoin.amos.boot.module.common.api.dao.ESEquipmentCategory;
import com.yeejoin.amos.boot.module.common.api.dto.ESEquipmentCategoryDto;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.elasticsearch.action.search.SearchRequest;
......@@ -11,7 +9,6 @@ import org.elasticsearch.client.RestHighLevelClient;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.SearchHit;
import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.springframework.data.elasticsearch.core.ElasticsearchOperations;
import org.springframework.stereotype.Service;
import java.io.IOException;
......@@ -26,19 +23,8 @@ import static com.yeejoin.amos.boot.module.common.api.constant.TZSCommonConstant
@Slf4j
public class EquipmentCategoryService {
private final ESEquipmentCategory equipmentCategoryDao;
private final ElasticsearchOperations elasticsearchOperations;
private final RestHighLevelClient restHighLevelClient;
public ESEquipmentCategoryDto saveWithImmediateRefresh(ESEquipmentCategoryDto dto) {
ESEquipmentCategoryDto saved = equipmentCategoryDao.save(dto);
// 手动触发索引刷新
elasticsearchOperations.indexOps(ESEquipmentCategoryDto.class).refresh();
return saved;
}
public List<String> findSequenceNbrByIds(List<String> ids) {
SearchSourceBuilder sourceBuilder = new SearchSourceBuilder()
.query(QueryBuilders.termsQuery("SEQUENCE_NBR.keyword", ids))
......
......@@ -2055,7 +2055,7 @@ public class DataDockServiceImpl {
.map(value -> value == null || "null".equals(value) ? "" : value)
.collect(Collectors.joining()));
manageLambdaUpdateWrapper.set(JgUseRegistrationManage::getRecDate, new Date());
manageLambdaUpdateWrapper.eq(BaseEntity::getSequenceNbr, jgUseRegistrationManages.stream().map(BaseEntity::getSequenceNbr).collect(Collectors.toList()));
manageLambdaUpdateWrapper.in(BaseEntity::getSequenceNbr, jgUseRegistrationManages.stream().map(BaseEntity::getSequenceNbr).collect(Collectors.toList()));
jgUseRegistrationManageService.update(manageLambdaUpdateWrapper);
}
}
......
......@@ -278,8 +278,6 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
@Autowired
ESEquipmentCategory esEquipmentCategory;
@Autowired
EquipmentCategoryService equipmentCategoryService;
@Autowired
ICommonService commonService;
@Autowired
CommonMapper commonMapper;
......@@ -310,8 +308,6 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
@Autowired
private IdxBizJgInspectionDetectionInfoServiceImpl idxBizJgInspectionDetectionInfoService;
@Autowired
private IIdxBizJgOtherInfoService idxBizJgOtherInfoService;
@Autowired
private CodeUtil codeUtil;
@Autowired
private TzsServiceFeignClient tzsServiceFeignClient;
......@@ -336,8 +332,6 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
@Autowired
private JgRegistrationHistoryServiceImpl jgRegistrationHistoryService;
@Autowired
private SafetyProblemTracingMapper safetyProblemTracingMapper;
@Autowired
private RedisTemplate<String, String> redisTemplate;
@Autowired
private TzBaseEnterpriseInfoMapper baseEnterpriseInfoMapper;
......@@ -4171,7 +4165,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
dto.setNEXT_INSPECT_DATE(DateUtil.parse(DateUtil.format(nextInspectDate, DatePattern.NORM_DATE_PATTERN)).getTime());
}
this.setWhetherSphericalTank(dto);
equipmentCategoryService.saveWithImmediateRefresh(dto);
esEquipmentCategory.save(dto);
}
}
......@@ -5232,19 +5226,22 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
//checkNotBlank(data.getProduceUnitName(), "制造单位名称不能为空;", result);
// checkNotBlank(data.getProduceLicenseNum(), "制造许可编号不能为空;", result);
//checkNotBlank(data.getFactoryNum(), "出厂编号/产品编码不能为空;", result);
// if ("0".equals(data.getWhetherVehicleCylinder())) {
//// checkNotBlank(data.getCylinderCategory(), "气瓶分类不能为空;", result);
// if (!StringUtils.isEmpty(data.getFactoryNum()) && !StringUtils.isEmpty(data.getProduceUnitCreditCode())){
// checkFactoryNumUnique(data.getFactoryNum(), data.getProduceUnitCreditCode(), data.getProduceUnitName(), result);
// if (factoryNumList.contains(data.getProduceUnitCreditCode() + "_" +data.getFactoryNum())){
// result.append("同一制造单位下,出厂编码不能重复!;");
// }
// }
// } else {
// if (!StringUtils.isEmpty(data.getFactoryNum())){
// checkFactoryNumUniquenessForVehicleCylinder(data.getFactoryNum(), result);
// }
// }
if ("0".equals(data.getWhetherVehicleCylinder())) {
// checkNotBlank(data.getCylinderCategory(), "气瓶分类不能为空;", result);
checkNotBlank(data.getProduceUnitCreditCode(), "制造单位统一社会信用代码不能为空;", result);
checkNotBlank(data.getFactoryNum(), "出厂编号/产品编号不能为空;", result);
if (!StringUtils.isEmpty(data.getFactoryNum()) && !StringUtils.isEmpty(data.getProduceUnitCreditCode())){
checkFactoryNumUnique(data.getFactoryNum(), data.getProduceUnitCreditCode(), data.getProduceUnitName(), result);
if (factoryNumList.contains(data.getProduceUnitCreditCode() + "_" +data.getFactoryNum())){
result.append("同一制造单位下,出厂编码不能重复!;");
}
factoryNumList.add(data.getProduceUnitCreditCode() + "_" +data.getFactoryNum());
}
} else {
if (!StringUtils.isEmpty(data.getFactoryNum())){
checkFactoryNumUniquenessForVehicleCylinder(data.getFactoryNum(), result);
}
}
// checkNotBlank(data.getProduceDate(), "制造日期不能为空;", result);
Optional.ofNullable(data.getProduceDate()).ifPresent(v -> checkDateFormatCorrect(v, "制造日期格式不正确;", result));
//checkNotBlank(data.getInspectOrgName(), "检测机构名称不能为空;", result);
......
......@@ -289,8 +289,9 @@ public class JgOverDesignServiceLifeServiceImpl extends BaseService<JgOverDesign
equip.setSafetyAssessmentCreditCode(Objects.toString(device.get("safetyAssessmentCreditCode"), ""));
equip.setSafetyAssessmentResult(Objects.toString(device.get("safetyAssessmentResult"), ""));
equip.setSafetyAssessmentDate(castDate2TimeStr(Objects.toString(device.get("safetyAssessmentDate"), null)));
if (!ObjectUtils.isEmpty(device.get("safetyAssessmentReport"))) {
equip.setSafetyAssessmentReport(JSONObject.toJSONString(device.get("safetyAssessmentReport")));
Object report = device.get("safetyAssessmentReport");
if (!ObjectUtils.isEmpty(report)) {
equip.setSafetyAssessmentReport(report instanceof String ? (String) report : JSONObject.toJSONString(report));
}
equipList.add(equip);
overDesignServiceLife.setEquList(Objects.toString(device.get("equListCode"), ""));
......@@ -999,7 +1000,7 @@ public class JgOverDesignServiceLifeServiceImpl extends BaseService<JgOverDesign
resultDataMap.put("sequenceNbrs", registration.getSequenceNbr());
commonService.convertStringToJsonobject(resultDataMap, new String[]{"otherAccessories"});
commonService.convertStringToJsonobject(resultDataMap, new String[]{"useRegistrationFormFile"});
commonService.convertStringToJsonobject(resultDataMap, new String[]{"safetyAssessmentReport"});
//commonService.convertStringToJsonobject(resultDataMap, new String[]{"safetyAssessmentReport"});
return resultDataMap;
}
......
package com.yeejoin.amos.boot.module.jg.biz.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.map.MapUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
......@@ -16,6 +17,7 @@ import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import com.yeejoin.amos.boot.biz.common.entity.DataDictionary;
import com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl;
import com.yeejoin.amos.boot.module.common.api.constant.TZSCommonConstant;
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.dto.SafetyProblemTracingDto;
......@@ -27,6 +29,7 @@ import com.yeejoin.amos.boot.module.jg.api.mapper.CommonMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.SafetyProblemTracingMapper;
import com.yeejoin.amos.boot.module.jg.api.service.ISafetyProblemTracingService;
import com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgRegisterInfoService;
import com.yeejoin.amos.boot.module.ymt.api.dto.EquipWaitRefreshDataQualityScore;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgInspectionDetectionInfo;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgMaintenanceRecordInfo;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgOtherInfo;
......@@ -71,6 +74,9 @@ public class SafetyProblemTracingServiceImpl extends BaseService<SafetyProblemTr
@Autowired
CommonMapper commonMapper;
@Autowired
private EsBulkService esBulkService;
/**
* 分页查询
*/
......@@ -332,16 +338,21 @@ public class SafetyProblemTracingServiceImpl extends BaseService<SafetyProblemTr
} catch (Exception e) {
log.error("Other表更新失败,设备record:{},错误原因:{}", records, e.getMessage(), e);
}
// 分批更新
Lists.partition(new ArrayList<>(records), 100).forEach(partition -> {
try {
// es更新
esBulkService.bulkUpdateFieldsByIds(this.buildUpdateFields(partition), TZSCommonConstant.ES_INDEX_NAME_JG_ALL);
} catch (Exception e) {
log.error("安全追溯实时更新ES状态更新失败,数据为:「{}」", partition, e);
}
});
log.info("ES状态更新成功,记录数:{}", records.size());
}
// 更新ES状态(添加异常处理)
try {
Iterable<ESEquipmentCategoryDto> esEquipmentIter = esEquipmentCategory.findAllById(records);
esEquipmentIter.forEach(dto ->
dto.setProblemStatus(SafetyProblemStatusEnum.HANDLED.getCode()));
esEquipmentCategory.saveAll(esEquipmentIter);
log.info("ES状态更新成功,记录数:{}", records.size());
} catch (Exception e) {
log.error("ES状态更新失败,设备record:{},错误原因:{}", records, e.getMessage(), e);
}
protected Map<String, Map<String, Object>> buildUpdateFields(List<String> records) {
Map<String, Map<String, Object>> fieldMap = new HashMap<>();
records.forEach(record -> fieldMap.put(record, MapUtil.of("problemStatus", SafetyProblemStatusEnum.HANDLED.getCode())));
return fieldMap;
}
}
\ No newline at end of file
......@@ -147,6 +147,8 @@ public interface JyjcInspectionApplicationMapper extends BaseMapper<JyjcInspecti
List<Map<String, Object>> selectPieLineListOfNoInspectInfo(@Param("records") List<String> records);
Page<JSONObject> selectEquipList(Page<JSONObject> page,@Param("queryParams") Map<String, Object> map);
Long queryAllFinishedEquipCount(@Param("orgCode") String orgCode, @Param("dpFilterParamDto") DPFilterParamDto dpFilterParamDto);
}
......@@ -898,4 +898,20 @@
</if>
order by ibjui.REC_DATE DESC
</select>
<select id="queryAllFinishedEquipCount" resultType="java.lang.Long">
SELECT
count(1)
FROM
tz_jyjc_inspection_application a,
tz_base_enterprise_info b,
tz_jyjc_inspection_result r
where
a.inspection_unit_code= b.use_unit_code
and a.application_no = r.application_no
and ((b.supervise_org_code != '50' and b.supervise_org_code LIKE CONCAT (#{orgCode}, '%')) or (b.supervise_org_code = '50' and b.office_region LIKE CONCAT ('%', #{dpFilterParamDto.cityCode}, '%')))
and a.status = '6616'
and EXISTS (select 1 from tz_jyjc_inspection_result r where r.result_status='2' and a.application_no = r.application_no)
and date_ge(CAST(a.accept_date as date),#{dpFilterParamDto.beginDate}) and date_le(CAST(a.accept_date as date),#{dpFilterParamDto.endDate})
</select>
</mapper>
......@@ -3100,6 +3100,7 @@ public class JGDPStatisticsServiceImpl {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
String formattedDate = dateFormat.format(auditPassDate);
objMap.put("REGISTRATION_DATE", formattedDate);
objMap.put("REGISTRATION_ORG_NAME", jgUseRegistrationManage.getReceiveOrgName());
});
}
return objMap;
......
......@@ -994,10 +994,12 @@ public class JYJCDPStatisticsServiceImpl {
//受理数量
Long pendingCount = inspectionApplicationMapper.queryAllPendingAndFinishedCount(orgCode, dpFilterParamDto);
ydata.add(pendingCount);
//检验完成
//检验完成单据数量
Long finshCount = inspectionApplicationMapper.queryAllFinishedCount(orgCode, dpFilterParamDto);
ydata.add(finshCount);
//检验合格数量
//检验完成单据对应设备数量
Long finshEquipCount = inspectionApplicationMapper.queryAllFinishedEquipCount(orgCode, dpFilterParamDto);
//检验合格设备数量
Long qualifiedCount = inspectionApplicationMapper.queryQualifiedCount(orgCode, dpFilterParamDto);
// 计算比率
......@@ -1006,8 +1008,8 @@ public class JYJCDPStatisticsServiceImpl {
completionRate = (double) finshCount / pendingCount;
}
double qualifiedRate = 0.0;
if (finshCount != 0 && qualifiedCount != 0) {
qualifiedRate = (double) qualifiedCount / finshCount;
if (finshEquipCount != 0 && qualifiedCount != 0) {
qualifiedRate = (double) qualifiedCount / finshEquipCount;
}
String[] xdata = {
"报检",
......
......@@ -157,7 +157,7 @@
{ "key": "FULLAREA", "label": "所属区域" },
{ "key": "FULLADDRESS", "label": "设备详细地址" },
{ "key": "USE_ORG_CODE", "label": "使用登记证编号" },
{ "key": "ORG_BRANCH_NAME", "label": "登记机关" },
{ "key": "REGISTRATION_ORG_NAME", "label": "登记机关" },
{ "key": "REGISTRATION_DATE", "label": "登记日期" },
{ "key": "NEXT_INSPECT_DATE", "label": "下一次检验日期" }
......
......@@ -161,7 +161,7 @@
{ "key": "FULLAREA", "label": "所属区域" },
{ "key": "FULLADDRESS", "label": "设备详细地址" },
{ "key": "USE_ORG_CODE", "label": "使用登记证编号" },
{ "key": "ORG_BRANCH_NAME", "label": "登记机关" },
{ "key": "REGISTRATION_ORG_NAME", "label": "登记机关" },
{ "key": "REGISTRATION_DATE", "label": "登记日期" },
{ "key": "NEXT_INSPECT_DATE", "label": "下一次检验日期" }
......@@ -173,7 +173,7 @@
{ "key": "FULLAREA", "label": "所属区域" },
{ "key": "FULLADDRESS", "label": "设备详细地址" },
{ "key": "USE_ORG_CODE", "label": "使用登记证编号" },
{ "key": "ORG_BRANCH_NAME", "label": "登记机关" },
{ "key": "REGISTRATION_ORG_NAME", "label": "登记机关" },
{ "key": "REGISTRATION_DATE", "label": "登记日期" },
{ "key": "NEXT_INSPECT_DATE", "label": "下一次检验日期" }
],
......@@ -184,7 +184,7 @@
{ "key": "FULLAREA", "label": "所属区域" },
{ "key": "FULLADDRESS", "label": "设备详细地址" },
{ "key": "USE_ORG_CODE", "label": "使用登记证编号" },
{ "key": "ORG_BRANCH_NAME", "label": "登记机关" },
{ "key": "REGISTRATION_ORG_NAME", "label": "登记机关" },
{ "key": "REGISTRATION_DATE", "label": "登记日期" },
{ "key": "NEXT_INSPECTION_DATE", "label": "下次检验日期" },
{ "key": "CAR_NUMBER", "label": "车牌号" },
......
......@@ -157,7 +157,7 @@
{ "key": "FULLAREA", "label": "所属区域" },
{ "key": "FULLADDRESS", "label": "设备详细地址" },
{ "key": "USE_ORG_CODE", "label": "使用登记证编号" },
{ "key": "ORG_BRANCH_NAME", "label": "登记机关" },
{ "key": "REGISTRATION_ORG_NAME", "label": "登记机关" },
{ "key": "REGISTRATION_DATE", "label": "登记日期" },
{ "key": "NEXT_INSPECT_DATE", "label": "下一次检验日期" },
{ "key": "ME_UNIT_NAME", "label": "维保单位名称" },
......
......@@ -153,7 +153,7 @@
{ "key": "FULLAREA", "label": "所属区域" },
{ "key": "FULLADDRESS", "label": "设备详细地址" },
{ "key": "USE_ORG_CODE", "label": "使用登记证编号" },
{ "key": "ORG_BRANCH_NAME", "label": "登记机关" },
{ "key": "REGISTRATION_ORG_NAME", "label": "登记机关" },
{ "key": "REGISTRATION_DATE", "label": "登记日期" },
{ "key": "NEXT_INSPECT_DATE", "label": "下一次检验日期" }
],
......
......@@ -149,7 +149,7 @@
{ "key": "FULLAREA", "label": "所属区域" },
{ "key": "FULLADDRESS", "label": "设备详细地址" },
{ "key": "USE_ORG_CODE", "label": "使用登记证编号" },
{ "key": "ORG_BRANCH_NAME", "label": "登记机关" },
{ "key": "REGISTRATION_ORG_NAME", "label": "登记机关" },
{ "key": "REGISTRATION_DATE", "label": "登记日期" },
{ "key": "NEXT_INSPECT_DATE", "label": "下一次检验日期" }
],
......
......@@ -143,7 +143,7 @@
{ "key": "FULLAREA", "label": "所属区域" },
{ "key": "FULLADDRESS", "label": "设备详细地址" },
{ "key": "USE_ORG_CODE", "label": "使用登记证编号" },
{ "key": "ORG_BRANCH_NAME", "label": "登记机关" },
{ "key": "REGISTRATION_ORG_NAME", "label": "登记机关" },
{ "key": "REGISTRATION_DATE", "label": "登记日期" },
{ "key": "NEXT_INSPECT_DATE", "label": "下一次检验日期" }
......
......@@ -150,7 +150,7 @@
{ "key": "FULLAREA", "label": "所属区域" },
{ "key": "FULLADDRESS", "label": "设备详细地址" },
{ "key": "USE_ORG_CODE", "label": "使用登记证编号" },
{ "key": "ORG_BRANCH_NAME", "label": "登记机关" },
{ "key": "REGISTRATION_ORG_NAME", "label": "登记机关" },
{ "key": "REGISTRATION_DATE", "label": "登记日期" },
{ "key": "NEXT_INSPECT_DATE", "label": "下一次检验日期" }
......@@ -162,7 +162,7 @@
{ "key": "FULLAREA", "label": "所属区域" },
{ "key": "FULLADDRESS", "label": "设备详细地址" },
{ "key": "USE_ORG_CODE", "label": "使用登记证编号" },
{ "key": "ORG_BRANCH_NAME", "label": "登记机关" },
{ "key": "REGISTRATION_ORG_NAME", "label": "登记机关" },
{ "key": "REGISTRATION_DATE", "label": "登记日期" },
{ "key": "NEXT_INSPECT_DATE", "label": "下一次检验日期" }
],
......
......@@ -149,7 +149,7 @@
{ "key": "FULLAREA", "label": "所属区域" },
{ "key": "FULLADDRESS", "label": "设备详细地址" },
{ "key": "USE_ORG_CODE", "label": "使用登记证编号" },
{ "key": "ORG_BRANCH_NAME", "label": "登记机关" },
{ "key": "REGISTRATION_ORG_NAME", "label": "登记机关" },
{ "key": "REGISTRATION_DATE", "label": "登记日期" },
{ "key": "NEXT_INSPECT_DATE", "label": "下一次检验日期" }
],
......
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