Commit a3669bec authored by suhuiguang's avatar suhuiguang

Merge branch 'develop_tzs_bugfix' into develop_tzs_register

parents 8240aff8 168d2e0c
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 org.springframework.data.elasticsearch.core.ElasticsearchOperations;
import org.springframework.stereotype.Service;
@Service
@RequiredArgsConstructor
public class EquipmentCategoryService {
private final ESEquipmentCategory equipmentCategoryDao;
private final ElasticsearchOperations elasticsearchOperations;
public ESEquipmentCategoryDto saveWithImmediateRefresh(ESEquipmentCategoryDto dto) {
ESEquipmentCategoryDto saved = equipmentCategoryDao.save(dto);
// 手动触发索引刷新
elasticsearchOperations.indexOps(ESEquipmentCategoryDto.class).refresh();
return saved;
}
}
\ No newline at end of file
......@@ -67,7 +67,10 @@ public class DictParamsConverter implements Converter<String> {
dictMap.put("D级", "5960");
dictMap.put("GC1", "6002");
dictMap.put("GC2", "6003");
dictMap.put("GC3", "6005");
dictMap.put("GCD", "6004");
dictMap.put("GD1", "6006");
dictMap.put("GD2", "6007");
dictMap.put("压缩天然气", "COMPRESSED_NATURAL_GAS");
dictMap.put("液化天然气", "LIQUEFIED_NATURAL_GAS");
dictMap.put("液化石油气", "LIQUEFIED_PETROLEUM_GAS");
......
......@@ -146,6 +146,15 @@ public interface CommonMapper extends BaseMapper<EquipmentCategory> {
@Param("produceUnitCreditCode") String produceUnitCreditCode);
/**
* 查询出厂编码是否重复
*
* @param factoryNum 出厂编码
* @return Integer
*/
List<Map<String, Object>> checkFactoryNumUniqueWithUseName(@Param("factoryNum") String factoryNum,
@Param("produceUnitCreditCode") String produceUnitCreditCode);
/**
* 使用登记证编号全库唯一校验
*
* @param useRegistrationCode
......
......@@ -991,6 +991,20 @@
AND ibjfi."RECORD" <![CDATA[ <> ]]> #{record}
</if>
</select>
<select id="checkFactoryNumUniqueWithUseName" resultType="java.util.Map">
SELECT
ibjui.USE_UNIT_NAME as useUnitName,
COUNT(1)
FROM idx_biz_jg_factory_info ibjfi
LEFT JOIN idx_biz_jg_register_info ibjri ON ibjfi."RECORD" = ibjri."RECORD"
LEFT JOIN idx_biz_jg_other_info joi ON joi."RECORD" = ibjfi."RECORD"
LEFT JOIN idx_biz_jg_use_info ibjui ON ibjui."RECORD" = ibjri."RECORD"
WHERE ibjri.EQU_LIST = '2000'
AND ibjri.EQU_CATEGORY = '2300'
AND ibjfi.FACTORY_NUM = #{factoryNum}
AND ibjfi.PRODUCE_UNIT_CREDIT_CODE = #{produceUnitCreditCode}
AND joi.CLAIM_STATUS = '已认领'
</select>
<select id="useRegistrationCertificateAccountUnique" resultType="java.lang.Integer">
SELECT COUNT( 1 )
......
......@@ -1019,6 +1019,9 @@
<if test="jsonObject.factoryNum != null and jsonObject.factoryNum != ''">
and aa.factoryNum like concat('%',#{jsonObject.factoryNum},'%')
</if>
<if test="jsonObject.productName != null and jsonObject.productName != ''">
and aa.productName like concat('%',#{jsonObject.productName},'%')
</if>
<if test="jsonObject.nextInspectDate != null and jsonObject.nextInspectDate != ''">
and aa.nextInspectDate =#{jsonObject.nextInspectDate}
</if>
......
......@@ -54,6 +54,8 @@ public class JgTableDataExportController extends BaseController {
@GetMapping(value = "/certificate")
@ApiOperation(httpMethod = "GET", value = "登记证列表数据导出", notes = "登记证列表数据导出")
public ResponseModel<String> certificateExport(JgUseRegistrationManageDto dto,
// 区分非审批列表导出(isJG --> jg),还是审批列表导出 ,默认审批列表导出
@RequestParam(value = "isJG", defaultValue = "false") Boolean isJG,
@RequestParam(value = "ids", required = false) String ids,
@RequestParam(value = "sort", required = false) String sort) {
String uuid = UUID.randomUUID().toString();
......@@ -61,7 +63,7 @@ public class JgTableDataExportController extends BaseController {
RequestContextWrapper contextWrapper = RequestContextWrapper.capture();
new Thread(() -> {
contextWrapper.apply();
iJgTableDataExportService.certificate(uuid, dto, ids == null ? new ArrayList<>() : Arrays.asList(ids.split(",")), sort);
iJgTableDataExportService.certificate(uuid, dto, isJG, ids == null ? new ArrayList<>() : Arrays.asList(ids.split(",")), sort);
}).start();
return ResponseHelper.buildResponse("后台处理中,请注意下载!");
}
......
......@@ -168,11 +168,7 @@ public class JgUseRegistrationManageController extends BaseController {
@RequestParam(value = "sort", required = false) String sort,
@RequestParam(value = "current") int current,
@RequestParam(value = "size") int size) {
Page<JgUseRegistrationManageDto> page = new Page<JgUseRegistrationManageDto>();
page.setCurrent(current);
page.setSize(size);
ReginParams info = getSelectedOrgInfo();
return ResponseHelper.buildResponse(jgUseRegistrationManageServiceImpl.queryForJgUseRegistrationManagePageForJG(page, dto, sort, info.getCompany().getOrgCode()));
return ResponseHelper.buildResponse(jgUseRegistrationManageServiceImpl.queryForJgUseRegistrationManagePageForJG(dto, sort, current, size));
}
/**
* 列表分页查询-大屏监督管理使用
......
......@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.yeejoin.amos.boot.biz.common.entity.TzsBaseEntity;
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.common.biz.service.impl.EquipmentCategoryService;
import com.yeejoin.amos.boot.module.jg.api.dto.ReminderItemDto;
import com.yeejoin.amos.boot.module.jg.biz.reminder.biz.factory.GradeStrategyFactory;
import com.yeejoin.amos.boot.module.jg.biz.reminder.core.event.EquipCreateOrEditEvent;
......@@ -18,6 +19,7 @@ import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgUseInfo;
import com.yeejoin.amos.boot.module.ymt.api.enums.EquipmentClassifityEnum;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
......@@ -44,6 +46,9 @@ public class EquipQualityScoreUpdateService implements IQualityScoreUpdate {
private final GradeStrategyFactory gradeStrategyFactory;
@Autowired
EquipmentCategoryService equipmentCategoryService;
@Override
public Boolean support(EquipCreateOrEditEvent.EquipType equipType) {
return EquipCreateOrEditEvent.EquipType.equip.equals(equipType);
......@@ -61,7 +66,7 @@ public class EquipQualityScoreUpdateService implements IQualityScoreUpdate {
Integer level = this.getReminderLevel(bizType, record);
op.ifPresent(equipmentCategory -> {
equipmentCategory.setDataQualityScore(level);
equipmentCategoryDao.save(equipmentCategory);
equipmentCategoryService.saveWithImmediateRefresh(equipmentCategory);
});
LambdaUpdateWrapper<IdxBizJgUseInfo> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(IdxBizJgUseInfo::getRecord, record);
......
......@@ -19,7 +19,7 @@ public interface IJgTableDataExportService {
void gen(String jsonName, String voName, String tableName);
void certificate(String uuid, JgUseRegistrationManageDto dto, List<String> ids, String sort);
void certificate(String uuid, JgUseRegistrationManageDto dto, Boolean isJG, List<String> ids, String sort);
void maintenance(HttpServletResponse response, List<String> ids);
......
......@@ -223,6 +223,7 @@ public class CommonServiceImpl implements ICommonService {
@Autowired
@Lazy
JgEquipTransferServiceImpl jgEquipTransferServiceImpl;
@Lazy
@Autowired
JgReformNoticeServiceImpl jgReformNoticeService;
@Autowired
......
......@@ -2290,8 +2290,12 @@ public class DataDockServiceImpl {
JSONObject inspectionDetectionInfoJO = (JSONObject) JSON.toJSON(inspectionDetectionInfo);
jsonObject.putAll(inspectionDetectionInfoJO);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
jsonObject.put("inspectDate", sdf.format(inspectionDetectionInfo.getInspectDate()));
jsonObject.put("nextInspectDate", sdf.format(inspectionDetectionInfo.getNextInspectDate()));
jsonObject.put("inspectDate", Optional.ofNullable(inspectionDetectionInfo.getInspectDate())
.map(sdf::format)
.orElse(null));
jsonObject.put("nextInspectDate", Optional.ofNullable(inspectionDetectionInfo.getNextInspectDate())
.map(sdf::format)
.orElse(null));
jsonObject.put("orgBranchCode", paramsDto.getOrgBranchCode() + "_" + paramsDto.getOrgBranchName());
jsonObject.put("projectContraption", projectContraption.getProjectContraption());
jsonObject.put("projectContraptionNo", projectContraption.getProjectContraptionNo());
......
......@@ -250,15 +250,15 @@ public class JgTableDataExportServiceImpl implements IJgTableDataExportService {
* 登记证列表数据导出
*/
@Override
public void certificate(String uuid, JgUseRegistrationManageDto dto, List<String> ids, String sort) {
public void certificate(String uuid, JgUseRegistrationManageDto dto, Boolean isJG, List<String> ids, String sort) {
RequestContextWrapper contextWrapper = RequestContextWrapper.capture();
List<CertificateVo> exportData;
if (ids.isEmpty()) {
// 查询首页数据
int currentPage = 1;
Page<JgUseRegistrationManageDto> firstPage = jgUseRegistrationManageServiceImpl.buildFilter(dto, currentPage, PAGE_SIZE);
Page<JgUseRegistrationManageDto> dtoPage = jgUseRegistrationManageServiceImpl.queryForJgUseRegistrationManagePage(firstPage, dto, sort);
Page<JgUseRegistrationManageDto> dtoPage = isJG ? jgUseRegistrationManageServiceImpl.queryForJgUseRegistrationManagePageForJG(dto, sort, currentPage, PAGE_SIZE)
: jgUseRegistrationManageServiceImpl.queryForJgUseRegistrationManagePage(jgUseRegistrationManageServiceImpl.buildFilter(dto, currentPage, PAGE_SIZE), dto, sort);
long total = dtoPage.getTotal();
int totalPage = (int) Math.ceil((double) total / PAGE_SIZE);
......@@ -276,8 +276,8 @@ public class JgTableDataExportServiceImpl implements IJgTableDataExportService {
CompletableFuture<List<String>> future = CompletableFuture.supplyAsync(() -> {
// 恢复上下文到子线程
contextWrapper.apply();
Page<JgUseRegistrationManageDto> page = jgUseRegistrationManageServiceImpl.buildFilter(dto, pageIndex, PAGE_SIZE);
Page<JgUseRegistrationManageDto> resultPage = jgUseRegistrationManageServiceImpl.queryForJgUseRegistrationManagePage(page, dto, sort);
Page<JgUseRegistrationManageDto> resultPage = isJG ? jgUseRegistrationManageServiceImpl.queryForJgUseRegistrationManagePageForJG(dto, sort, pageIndex, PAGE_SIZE)
: jgUseRegistrationManageServiceImpl.queryForJgUseRegistrationManagePage(jgUseRegistrationManageServiceImpl.buildFilter(dto, pageIndex, PAGE_SIZE), dto, sort);
return resultPage.getRecords().stream()
.map(JgUseRegistrationManageDto::getSequenceNbr)
.map(String::valueOf)
......@@ -325,14 +325,18 @@ public class JgTableDataExportServiceImpl implements IJgTableDataExportService {
if ("压力管道".equals(data.getEquList())) {
List<IdxBizJgProjectContraption> contraptions = idxBizJgProjectContraptionService.queryProConByCertSeq(data.getSequenceNbr());
for (IdxBizJgProjectContraption obj : contraptions) {
BeanUtil.copyProperties(obj, data);
exportData.add(data);
CertificateVo newData = new CertificateVo();
BeanUtil.copyProperties(data, newData);
BeanUtil.copyProperties(obj, newData);
exportData.add(newData);
}
} else {
List<JSONObject> jsonObjects = jgUseRegistrationManageServiceImpl.queryEquByCertificateSeq(Long.valueOf(data.getSequenceNbr()));
for (JSONObject obj : jsonObjects) {
BeanUtil.copyProperties(obj, data);
exportData.add(data);
CertificateVo newData = new CertificateVo();
BeanUtil.copyProperties(data, newData);
BeanUtil.copyProperties(obj, newData);
exportData.add(newData);
}
}
});
......
......@@ -319,15 +319,16 @@ public class JgUseRegistrationManageServiceImpl extends BaseService<JgUseRegistr
return jgUseRegistrationManageMapper.queryForPage(page, dto, sortMap);
}
public Page<JgUseRegistrationManageDto> queryForJgUseRegistrationManagePageForJG(Page<JgUseRegistrationManageDto> page,
JgUseRegistrationManageDto dto,
String sort, String orgCode) {
public Page<JgUseRegistrationManageDto> queryForJgUseRegistrationManagePageForJG(JgUseRegistrationManageDto dto, String sort, int current, int size) {
Page<JgUseRegistrationManageDto> page = new Page<JgUseRegistrationManageDto>();
page.setCurrent(current);
page.setSize(size);
SortVo sortMap = commonServiceImpl.sortFieldConversion(sort);
if (ApplicationFormTypeEnum.BF.getBusinessCode().equals(dto.getApplyType()) && (!CylinderTypeEnum.CYLINDER.getCode().equals(dto.getEquCategoryCode()) || dto.getRegType().equals(BusinessTypeEnum.JG_VEHICLE_GAS_APPLICATION.getName()))){
dto.setCertificateStatus(null);
dto.setIsScrap("0");
}
return jgUseRegistrationManageMapper.queryForPageForJG(page, dto, sortMap, orgCode);
return jgUseRegistrationManageMapper.queryForPageForJG(page, dto, sortMap, getSelectedOrgInfo().getCompany().getOrgCode());
}
public Page<JgUseRegistrationManageDto> getRecords(Page<JgUseRegistrationManageDto> page, JgUseRegistrationManageDto dto, String cityCode) {
......
......@@ -4172,7 +4172,8 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
if (registerInfo != null) {
registerInfo.setUseOrgCode(jgUseRegistration.getUseRegistrationCode());
registerInfo.setEquCodeType(String.valueOf(map.get("equCodeType")));
if(submitType.equals("tempSubmit")){
// 新提交或暂存后提交需生成设备代码
if(ValidationUtil.isEmpty(submitType) || "tempSubmit".equals(submitType)){
equCode = ObjectUtils.isEmpty(map.get("equCode")) && !StringUtils.isEmpty(jgUseRegistration.getReceiveCompanyCode())
? this.getEquCode(registerInfo, jgUseRegistration.getReceiveCompanyCode())
: String.valueOf(map.get("equCode"));
......@@ -4335,6 +4336,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
.build());
}
}
eventPublisher.publish(new EquipCreateOrEditEvent(this, BusinessTypeEnum.JG_NEW_EQUIP.name(), Sets.newHashSet(equipId), EquipCreateOrEditEvent.EquipType.equip));
return this.baseMapper.getDetailById(jgUseRegistration.getSequenceNbr());
} catch (BadRequest | LocalBadRequest e) {
log.error(e.getMessage(), e);
......
......@@ -616,7 +616,7 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
// todo 本来FillingEditPermForCurrentUser已赋值但是此业务也使用的key companyType故新赋值key
re.put("companyType2", CommonServiceImpl.getCompanyType(companyBo));
// 赋值数据质量等级
commonService.setDataQualityScore2Json(re, sequenceNbr + "", BusinessTypeEnum.JG_VEHICLE_GAS_APPLICATION);
// commonService.setDataQualityScore2Json(re, sequenceNbr + "", BusinessTypeEnum.JG_VEHICLE_GAS_APPLICATION);
return re;
}
......@@ -1872,7 +1872,7 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
String firstUseOrgCode = (String) eqLists.stream().findFirst().orElseThrow(() -> new BadRequest("设备列表为空,无法获取第一个设备信息")).get("useOrgCode");
String firstVin = (String) eqLists.stream().findFirst().orElseThrow(() -> new BadRequest("设备列表为空,无法获取第一个设备信息")).get("vin");
boolean isOrgCodeConsistent = useRegistrationCode.equals(firstUseOrgCode);
boolean isVinConsistent = identificationCode.equals(firstVin);
boolean isVinConsistent = "null".equals(identificationCode) && ValidationUtil.isEmpty(firstVin) || identificationCode.equals(firstVin);
return isSameChargingMedium && isSameVin && isOrgCodeConsistent && isVinConsistent;
})
.orElseThrow(() -> new BadRequest("使用登记证号、车辆VIN码与所选设备不一致,请重新选择设备!"));
......@@ -1890,11 +1890,11 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
.collect(Collectors.toList())
);
if (inspectionDetectionInfoList.stream().anyMatch(info ->
ObjectUtils.isEmpty(info) || ObjectUtils.isEmpty(info.getInspectType()) ||
ObjectUtils.isEmpty(info.getInspectConclusion()) || ObjectUtils.isEmpty(info.getInspectOrgCode()))) {
throw new BadRequest("请补充设备检验检测信息后提交!");
}
// if (inspectionDetectionInfoList.stream().anyMatch(info ->
// ObjectUtils.isEmpty(info) || ObjectUtils.isEmpty(info.getInspectType()) ||
// ObjectUtils.isEmpty(info.getInspectConclusion()) || ObjectUtils.isEmpty(info.getInspectOrgCode()))) {
// throw new BadRequest("请补充设备检验检测信息后提交!");
// }
vehicleInfoDto.setNextInspectionDate(inspectionDetectionInfoList.stream()
.map(IdxBizJgInspectionDetectionInfo::getNextInspectDate)
......@@ -2008,8 +2008,14 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
vehicleInformation.setRegDate(new Date());
vehicleInformation.setCreateUserName(reginParams.getUserModel().getRealName());
vehicleInformation.setGasNum(equipmentLists.size());
BigDecimal totalVolume = equipmentLists.stream()
.map(x -> new BigDecimal(String.valueOf(x.get("singleBottleVolume"))))
BigDecimal totalVolume = Optional.ofNullable(equipmentLists)
.orElse(Collections.emptyList())
.stream()
.map(x -> x.get("singleBottleVolume"))
.filter(Objects::nonNull) // 过滤 null 值
.map(Object::toString)
.filter(s -> !s.trim().isEmpty()) // 过滤空字符串
.map(BigDecimal::new)
.reduce(BigDecimal.ZERO, BigDecimal::add);
vehicleInformation.setVolume(totalVolume.toPlainString());
vehicleInformation.setFillingMedium(equipmentLists.stream()
......@@ -2138,7 +2144,10 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
// 保存关联设备信息
jgVehicleInformationEqService.saveBatch(equipList);
}
Set<String> recordSet = equipmentLists.stream()
.map(v -> (String) v.get("record"))
.collect(Collectors.toSet());
eventPublisher.publish(new EquipCreateOrEditEvent(this, BusinessTypeEnum.JG_NEW_EQUIP.name(), recordSet, EquipCreateOrEditEvent.EquipType.equip));
return Collections.singletonList(vehicleInformation);
}
......
......@@ -46,7 +46,8 @@
DATA_SOURCE,
USE_UNIT_NAME,
USE_DATE,
DATA_QUALITY_SCORE
DATA_QUALITY_SCORE,
IS_FIRST_MERGE as isFirstMerge
FROM
IDX_BIZ_JG_PROJECT_CONTRAPTION ibjpc
WHERE
......
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