Commit e0ae3e1b authored by yangyang's avatar yangyang

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

parents 77c5206a a3669bec
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> { ...@@ -67,7 +67,10 @@ public class DictParamsConverter implements Converter<String> {
dictMap.put("D级", "5960"); dictMap.put("D级", "5960");
dictMap.put("GC1", "6002"); dictMap.put("GC1", "6002");
dictMap.put("GC2", "6003"); dictMap.put("GC2", "6003");
dictMap.put("GC3", "6005");
dictMap.put("GCD", "6004"); dictMap.put("GCD", "6004");
dictMap.put("GD1", "6006");
dictMap.put("GD2", "6007");
dictMap.put("压缩天然气", "COMPRESSED_NATURAL_GAS"); dictMap.put("压缩天然气", "COMPRESSED_NATURAL_GAS");
dictMap.put("液化天然气", "LIQUEFIED_NATURAL_GAS"); dictMap.put("液化天然气", "LIQUEFIED_NATURAL_GAS");
dictMap.put("液化石油气", "LIQUEFIED_PETROLEUM_GAS"); dictMap.put("液化石油气", "LIQUEFIED_PETROLEUM_GAS");
......
package com.yeejoin.amos.boot.module.jg.api.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 4个告知暂存列表分页查询
*
* @author system_generator
* @date 2023-12-20
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "JgNoticeToBeSubmitDto", description = "4个告知暂存列表分页查询")
public class JgNoticeToBeSubmitDto extends BaseDto {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "业务类型")
private String businessType;
@ApiModelProperty(value = "申请单号")
private String applyNo;
@ApiModelProperty(value = "设备种类")
private String equListName;
@ApiModelProperty(value = "设备类别")
private String equCategoryName;
@ApiModelProperty(value = "申请日期")
@JsonFormat(pattern = "yyyy-MM-dd")
private String createDate;
@ApiModelProperty(value = "接收机构")
private String receiveOrgName;
@ApiModelProperty(value = "状态")
private String status;
}
...@@ -146,6 +146,15 @@ public interface CommonMapper extends BaseMapper<EquipmentCategory> { ...@@ -146,6 +146,15 @@ public interface CommonMapper extends BaseMapper<EquipmentCategory> {
@Param("produceUnitCreditCode") String produceUnitCreditCode); @Param("produceUnitCreditCode") String produceUnitCreditCode);
/** /**
* 查询出厂编码是否重复
*
* @param factoryNum 出厂编码
* @return Integer
*/
List<Map<String, Object>> checkFactoryNumUniqueWithUseName(@Param("factoryNum") String factoryNum,
@Param("produceUnitCreditCode") String produceUnitCreditCode);
/**
* 使用登记证编号全库唯一校验 * 使用登记证编号全库唯一校验
* *
* @param useRegistrationCode * @param useRegistrationCode
......
...@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.jg.api.mapper; ...@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.jg.api.mapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.jg.api.dto.CompanyEquipCountDto; import com.yeejoin.amos.boot.module.jg.api.dto.CompanyEquipCountDto;
import com.yeejoin.amos.boot.module.jg.api.dto.JgInstallationNoticeDto; import com.yeejoin.amos.boot.module.jg.api.dto.JgInstallationNoticeDto;
import com.yeejoin.amos.boot.module.jg.api.dto.JgNoticeToBeSubmitDto;
import com.yeejoin.amos.boot.module.jg.api.entity.JgInstallationNotice; import com.yeejoin.amos.boot.module.jg.api.entity.JgInstallationNotice;
import com.yeejoin.amos.boot.module.jg.api.vo.SortVo; import com.yeejoin.amos.boot.module.jg.api.vo.SortVo;
import com.yeejoin.amos.boot.module.jg.api.vo.tableDataExportVo.InstallationVo; import com.yeejoin.amos.boot.module.jg.api.vo.tableDataExportVo.InstallationVo;
...@@ -69,4 +70,6 @@ public interface JgInstallationNoticeMapper extends CustomBaseMapper<JgInstallat ...@@ -69,4 +70,6 @@ public interface JgInstallationNoticeMapper extends CustomBaseMapper<JgInstallat
List<JgInstallationNotice> selectNotInsertProjectConstructionInstallNoticeList(); List<JgInstallationNotice> selectNotInsertProjectConstructionInstallNoticeList();
Set<Long> queryListByEqsAndStatus(@Param("records") Set<String> records, @Param("noticeStatus") String noticeStatus); Set<Long> queryListByEqsAndStatus(@Param("records") Set<String> records, @Param("noticeStatus") String noticeStatus);
Page<JgNoticeToBeSubmitDto> queryNoticeToBeSubmitPage(@Param("page") Page<JgNoticeToBeSubmitDto> page, @Param("companyCode")String companyCode);
} }
...@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.extension.service.IService; ...@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
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.module.jg.api.dto.JgInstallationNoticeDto; import com.yeejoin.amos.boot.module.jg.api.dto.JgInstallationNoticeDto;
import com.yeejoin.amos.boot.module.jg.api.dto.JgNoticeToBeSubmitDto;
import com.yeejoin.amos.boot.module.jg.api.entity.JgInstallationNotice; import com.yeejoin.amos.boot.module.jg.api.entity.JgInstallationNotice;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
...@@ -88,4 +89,8 @@ public interface IJgInstallationNoticeService extends IService<JgInstallationNot ...@@ -88,4 +89,8 @@ public interface IJgInstallationNoticeService extends IService<JgInstallationNot
JgInstallationNotice cancelApplication(Long sequenceNbr, String cancelReason); JgInstallationNotice cancelApplication(Long sequenceNbr, String cancelReason);
Object getDeviceListByProjectContraption(String projectContraptionSeq); Object getDeviceListByProjectContraption(String projectContraptionSeq);
Page<JgNoticeToBeSubmitDto> queryNoticeToBeSubmitPage(Page<JgNoticeToBeSubmitDto> page, ReginParams selectedOrgInfo);
Map<String, Map<String, Object>> getNoticeToBeSubmitDetails(Long sequenceNbr, CompanyBo company, String businessType);
} }
...@@ -991,6 +991,20 @@ ...@@ -991,6 +991,20 @@
AND ibjfi."RECORD" <![CDATA[ <> ]]> #{record} AND ibjfi."RECORD" <![CDATA[ <> ]]> #{record}
</if> </if>
</select> </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 id="useRegistrationCertificateAccountUnique" resultType="java.lang.Integer">
SELECT COUNT( 1 ) SELECT COUNT( 1 )
......
...@@ -385,4 +385,66 @@ ...@@ -385,4 +385,66 @@
</foreach> </foreach>
</if> </if>
</select> </select>
<select id="queryNoticeToBeSubmitPage" resultType="com.yeejoin.amos.boot.module.jg.api.dto.JgNoticeToBeSubmitDto">
SELECT
isn.sequence_nbr AS sequenceNbr,
'安装告知' AS businessType,
isn.apply_no AS applyNo,
ec1.name AS equListName,
ec2.name AS equCategoryName,
isn.receive_org_name AS receiveOrgName,
CASE isn.notice_status WHEN '6610' THEN '待提交' ELSE isn.notice_status END AS status,
DATE_FORMAT(isn.create_date, '%Y-%m-%d') AS createDate
FROM tzs_jg_installation_notice isn
LEFT JOIN tz_equipment_category ec1 ON ec1.code = isn.equ_list_code
LEFT JOIN tz_equipment_category ec2 ON ec2.code = isn.equ_category_code
WHERE isn.is_delete = false AND isn.notice_status = '6610'
AND isn.install_unit_credit_code = #{companyCode}
UNION ALL
SELECT
isn.sequence_nbr AS sequenceNbr,
'改造告知' AS businessType,
isn.apply_no AS applyNo,
isn.equ_list_name AS equListName,
isn.equ_category_name AS equCategoryName,
isn.receive_org_name AS receiveOrgName,
CASE isn.notice_status WHEN '6610' THEN '待提交' ELSE isn.notice_status END AS status,
DATE_FORMAT(isn.create_date, '%Y-%m-%d') AS createDate
FROM tzs_jg_reform_notice isn
WHERE isn.is_delete = false AND isn.notice_status = '6610'
AND isn.install_unit_credit_code = #{companyCode}
UNION ALL
SELECT
isn.sequence_nbr AS sequenceNbr,
'维修告知' AS businessType,
isn.apply_no AS applyNo,
ec1.name AS equListName,
ec2.name AS equCategoryName,
isn.receive_org_name AS receiveOrgName,
CASE isn.notice_status WHEN '6610' THEN '待提交' ELSE isn.notice_status END AS status,
DATE_FORMAT(isn.create_date, '%Y-%m-%d') AS createDate
FROM tzs_jg_maintain_notice isn
LEFT JOIN tz_equipment_category ec1 ON ec1.code = isn.equ_list_code
LEFT JOIN tz_equipment_category ec2 ON ec2.code = isn.equ_category
WHERE isn.is_delete = false AND isn.notice_status = '6610'
AND isn.install_unit_credit_code = #{companyCode}
UNION ALL
SELECT
isn.sequence_nbr AS sequenceNbr,
'移装告知' AS businessType,
isn.apply_no AS applyNo,
ec1.name AS equListName,
ec2.name AS equCategoryName,
isn.receive_org_name AS receiveOrgName,
CASE isn.notice_status WHEN '6610' THEN '待提交' ELSE isn.notice_status END AS status,
DATE_FORMAT(isn.create_date, '%Y-%m-%d') AS createDate
FROM tzs_jg_transfer_notice isn
LEFT JOIN tz_equipment_category ec1 ON ec1.code = isn.equ_list_code
LEFT JOIN tz_equipment_category ec2 ON ec2.code = isn.equ_category
WHERE isn.is_delete = false
AND isn.notice_status = '6610'
AND isn.install_unit_credit_code = #{companyCode}
ORDER BY createDate DESC, applyNo DESC
</select>
</mapper> </mapper>
...@@ -1019,6 +1019,9 @@ ...@@ -1019,6 +1019,9 @@
<if test="jsonObject.factoryNum != null and jsonObject.factoryNum != ''"> <if test="jsonObject.factoryNum != null and jsonObject.factoryNum != ''">
and aa.factoryNum like concat('%',#{jsonObject.factoryNum},'%') and aa.factoryNum like concat('%',#{jsonObject.factoryNum},'%')
</if> </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 != ''"> <if test="jsonObject.nextInspectDate != null and jsonObject.nextInspectDate != ''">
and aa.nextInspectDate =#{jsonObject.nextInspectDate} and aa.nextInspectDate =#{jsonObject.nextInspectDate}
</if> </if>
......
...@@ -8,6 +8,7 @@ import com.yeejoin.amos.boot.biz.common.bo.ReginParams; ...@@ -8,6 +8,7 @@ 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.module.common.biz.utils.CommonResponseUtil; import com.yeejoin.amos.boot.module.common.biz.utils.CommonResponseUtil;
import com.yeejoin.amos.boot.module.jg.api.dto.JgInstallationNoticeDto; import com.yeejoin.amos.boot.module.jg.api.dto.JgInstallationNoticeDto;
import com.yeejoin.amos.boot.module.jg.api.dto.JgNoticeToBeSubmitDto;
import com.yeejoin.amos.boot.module.jg.api.entity.JgInstallationNotice; import com.yeejoin.amos.boot.module.jg.api.entity.JgInstallationNotice;
import com.yeejoin.amos.boot.module.jg.api.service.IJgInstallationNoticeService; import com.yeejoin.amos.boot.module.jg.api.service.IJgInstallationNoticeService;
import com.yeejoin.amos.boot.module.jg.biz.service.impl.CommonServiceImpl; import com.yeejoin.amos.boot.module.jg.biz.service.impl.CommonServiceImpl;
...@@ -188,4 +189,32 @@ public class JgInstallationNoticeController extends BaseController { ...@@ -188,4 +189,32 @@ public class JgInstallationNoticeController extends BaseController {
String projectContraptionSeq = ValidationUtil.isEmpty(params.get("sequenceNbr")) ? String.valueOf(params.get("record")) : params.get("sequenceNbr").toString(); String projectContraptionSeq = ValidationUtil.isEmpty(params.get("sequenceNbr")) ? String.valueOf(params.get("record")) : params.get("sequenceNbr").toString();
return ResponseHelper.buildResponse(iJgInstallationNoticeService.getDeviceListByProjectContraption(projectContraptionSeq)); return ResponseHelper.buildResponse(iJgInstallationNoticeService.getDeviceListByProjectContraption(projectContraptionSeq));
} }
/**
* 4个告知暂存列表分页查询
*
* @param current 当前页
* @param size 每页大小
* @return Page
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/queryNoticeToBeSubmitPage")
@ApiOperation(httpMethod = "GET", value = "4个告知暂存列表分页查询", notes = "4个告知暂存列表分页查询")
public ResponseModel<Page<JgNoticeToBeSubmitDto>> queryNoticeToBeSubmitPage(@RequestParam(value = "number") int current,
@RequestParam(value = "size") int size) {
Page<JgNoticeToBeSubmitDto> page = new Page<>(current, size);
return ResponseHelper.buildResponse(iJgInstallationNoticeService.queryNoticeToBeSubmitPage(page,getSelectedOrgInfo()));
}
/**
* 4个告知暂存详情查询
*
* @param sequenceNbr 主键
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getNoticeToBeSubmitDetails")
@ApiOperation(httpMethod = "GET", value = "4个告知暂存详情查询", notes = "4个告知暂存详情查询")
public ResponseModel<Map<String, Map<String, Object>>> getNoticeToBeSubmitDetails(@RequestParam("sequenceNbr") Long sequenceNbr,
@RequestParam("businessType") String businessType) {
return ResponseHelper.buildResponse(iJgInstallationNoticeService.getNoticeToBeSubmitDetails(sequenceNbr, getSelectedOrgInfo().getCompany(), businessType));
}
} }
...@@ -54,6 +54,8 @@ public class JgTableDataExportController extends BaseController { ...@@ -54,6 +54,8 @@ public class JgTableDataExportController extends BaseController {
@GetMapping(value = "/certificate") @GetMapping(value = "/certificate")
@ApiOperation(httpMethod = "GET", value = "登记证列表数据导出", notes = "登记证列表数据导出") @ApiOperation(httpMethod = "GET", value = "登记证列表数据导出", notes = "登记证列表数据导出")
public ResponseModel<String> certificateExport(JgUseRegistrationManageDto dto, public ResponseModel<String> certificateExport(JgUseRegistrationManageDto dto,
// 区分非审批列表导出(isJG --> jg),还是审批列表导出 ,默认审批列表导出
@RequestParam(value = "isJG", defaultValue = "false") Boolean isJG,
@RequestParam(value = "ids", required = false) String ids, @RequestParam(value = "ids", required = false) String ids,
@RequestParam(value = "sort", required = false) String sort) { @RequestParam(value = "sort", required = false) String sort) {
String uuid = UUID.randomUUID().toString(); String uuid = UUID.randomUUID().toString();
...@@ -61,7 +63,7 @@ public class JgTableDataExportController extends BaseController { ...@@ -61,7 +63,7 @@ public class JgTableDataExportController extends BaseController {
RequestContextWrapper contextWrapper = RequestContextWrapper.capture(); RequestContextWrapper contextWrapper = RequestContextWrapper.capture();
new Thread(() -> { new Thread(() -> {
contextWrapper.apply(); 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(); }).start();
return ResponseHelper.buildResponse("后台处理中,请注意下载!"); return ResponseHelper.buildResponse("后台处理中,请注意下载!");
} }
......
...@@ -168,11 +168,7 @@ public class JgUseRegistrationManageController extends BaseController { ...@@ -168,11 +168,7 @@ public class JgUseRegistrationManageController extends BaseController {
@RequestParam(value = "sort", required = false) String sort, @RequestParam(value = "sort", required = false) String sort,
@RequestParam(value = "current") int current, @RequestParam(value = "current") int current,
@RequestParam(value = "size") int size) { @RequestParam(value = "size") int size) {
Page<JgUseRegistrationManageDto> page = new Page<JgUseRegistrationManageDto>(); return ResponseHelper.buildResponse(jgUseRegistrationManageServiceImpl.queryForJgUseRegistrationManagePageForJG(dto, sort, current, size));
page.setCurrent(current);
page.setSize(size);
ReginParams info = getSelectedOrgInfo();
return ResponseHelper.buildResponse(jgUseRegistrationManageServiceImpl.queryForJgUseRegistrationManagePageForJG(page, dto, sort, info.getCompany().getOrgCode()));
} }
/** /**
* 列表分页查询-大屏监督管理使用 * 列表分页查询-大屏监督管理使用
......
...@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; ...@@ -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.biz.common.entity.TzsBaseEntity;
import com.yeejoin.amos.boot.module.common.api.dao.ESEquipmentCategory; 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.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.api.dto.ReminderItemDto;
import com.yeejoin.amos.boot.module.jg.biz.reminder.biz.factory.GradeStrategyFactory; import com.yeejoin.amos.boot.module.jg.biz.reminder.biz.factory.GradeStrategyFactory;
import com.yeejoin.amos.boot.module.jg.biz.reminder.core.event.EquipCreateOrEditEvent; 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; ...@@ -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 com.yeejoin.amos.boot.module.ymt.api.enums.EquipmentClassifityEnum;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -44,6 +46,9 @@ public class EquipQualityScoreUpdateService implements IQualityScoreUpdate { ...@@ -44,6 +46,9 @@ public class EquipQualityScoreUpdateService implements IQualityScoreUpdate {
private final GradeStrategyFactory gradeStrategyFactory; private final GradeStrategyFactory gradeStrategyFactory;
@Autowired
EquipmentCategoryService equipmentCategoryService;
@Override @Override
public Boolean support(EquipCreateOrEditEvent.EquipType equipType) { public Boolean support(EquipCreateOrEditEvent.EquipType equipType) {
return EquipCreateOrEditEvent.EquipType.equip.equals(equipType); return EquipCreateOrEditEvent.EquipType.equip.equals(equipType);
...@@ -61,7 +66,7 @@ public class EquipQualityScoreUpdateService implements IQualityScoreUpdate { ...@@ -61,7 +66,7 @@ public class EquipQualityScoreUpdateService implements IQualityScoreUpdate {
Integer level = this.getReminderLevel(bizType, record); Integer level = this.getReminderLevel(bizType, record);
op.ifPresent(equipmentCategory -> { op.ifPresent(equipmentCategory -> {
equipmentCategory.setDataQualityScore(level); equipmentCategory.setDataQualityScore(level);
equipmentCategoryDao.save(equipmentCategory); equipmentCategoryService.saveWithImmediateRefresh(equipmentCategory);
}); });
LambdaUpdateWrapper<IdxBizJgUseInfo> updateWrapper = new LambdaUpdateWrapper<>(); LambdaUpdateWrapper<IdxBizJgUseInfo> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(IdxBizJgUseInfo::getRecord, record); updateWrapper.eq(IdxBizJgUseInfo::getRecord, record);
......
...@@ -19,7 +19,7 @@ public interface IJgTableDataExportService { ...@@ -19,7 +19,7 @@ public interface IJgTableDataExportService {
void gen(String jsonName, String voName, String tableName); 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); void maintenance(HttpServletResponse response, List<String> ids);
......
...@@ -223,6 +223,7 @@ public class CommonServiceImpl implements ICommonService { ...@@ -223,6 +223,7 @@ public class CommonServiceImpl implements ICommonService {
@Autowired @Autowired
@Lazy @Lazy
JgEquipTransferServiceImpl jgEquipTransferServiceImpl; JgEquipTransferServiceImpl jgEquipTransferServiceImpl;
@Lazy
@Autowired @Autowired
JgReformNoticeServiceImpl jgReformNoticeService; JgReformNoticeServiceImpl jgReformNoticeService;
@Autowired @Autowired
......
...@@ -2290,8 +2290,12 @@ public class DataDockServiceImpl { ...@@ -2290,8 +2290,12 @@ public class DataDockServiceImpl {
JSONObject inspectionDetectionInfoJO = (JSONObject) JSON.toJSON(inspectionDetectionInfo); JSONObject inspectionDetectionInfoJO = (JSONObject) JSON.toJSON(inspectionDetectionInfo);
jsonObject.putAll(inspectionDetectionInfoJO); jsonObject.putAll(inspectionDetectionInfoJO);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
jsonObject.put("inspectDate", sdf.format(inspectionDetectionInfo.getInspectDate())); jsonObject.put("inspectDate", Optional.ofNullable(inspectionDetectionInfo.getInspectDate())
jsonObject.put("nextInspectDate", sdf.format(inspectionDetectionInfo.getNextInspectDate())); .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("orgBranchCode", paramsDto.getOrgBranchCode() + "_" + paramsDto.getOrgBranchName());
jsonObject.put("projectContraption", projectContraption.getProjectContraption()); jsonObject.put("projectContraption", projectContraption.getProjectContraption());
jsonObject.put("projectContraptionNo", projectContraption.getProjectContraptionNo()); jsonObject.put("projectContraptionNo", projectContraption.getProjectContraptionNo());
......
...@@ -24,6 +24,7 @@ import com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl; ...@@ -24,6 +24,7 @@ import com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl;
import com.yeejoin.amos.boot.biz.common.utils.*; import com.yeejoin.amos.boot.biz.common.utils.*;
import com.yeejoin.amos.boot.module.common.api.dao.ESEquipmentCategory; 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.api.dto.ESEquipmentCategoryDto;
import com.yeejoin.amos.boot.module.common.biz.service.impl.EquipmentCategoryService;
import com.yeejoin.amos.boot.module.jg.api.dto.*; import com.yeejoin.amos.boot.module.jg.api.dto.*;
import com.yeejoin.amos.boot.module.jg.api.entity.*; import com.yeejoin.amos.boot.module.jg.api.entity.*;
import com.yeejoin.amos.boot.module.jg.api.enums.*; import com.yeejoin.amos.boot.module.jg.api.enums.*;
...@@ -66,6 +67,7 @@ import org.elasticsearch.search.sort.SortOrder; ...@@ -66,6 +67,7 @@ import org.elasticsearch.search.sort.SortOrder;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy;
import org.springframework.core.io.Resource; import org.springframework.core.io.Resource;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ValueOperations; import org.springframework.data.redis.core.ValueOperations;
...@@ -243,6 +245,8 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -243,6 +245,8 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
@Autowired @Autowired
ESEquipmentCategory esEquipmentCategory; ESEquipmentCategory esEquipmentCategory;
@Autowired @Autowired
EquipmentCategoryService equipmentCategoryService;
@Autowired
ICommonService commonService; ICommonService commonService;
@Autowired @Autowired
CommonMapper commonMapper; CommonMapper commonMapper;
...@@ -308,6 +312,8 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -308,6 +312,8 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
private IdxBizJgProjectContraptionServiceImplService idxBizJgProjectContraptionService; private IdxBizJgProjectContraptionServiceImplService idxBizJgProjectContraptionService;
@Value("classpath:/json/urlInfo.json") @Value("classpath:/json/urlInfo.json")
private Resource urlInfo; private Resource urlInfo;
@Lazy
@Autowired @Autowired
private CommonServiceImpl commonServiceImpl; private CommonServiceImpl commonServiceImpl;
...@@ -998,10 +1004,23 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -998,10 +1004,23 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
} }
} }
private void checkFactoryNumUnique(String factoryNum, String produceUnitCreditCode, StringBuilder result) { private void checkFactoryNumUnique(String factoryNum, String produceUnitCreditCode,String produceUnitName, StringBuilder result) {
// 车用气瓶业务里面的 出厂编号/产品编码 校验唯一性(产品编号在车用气瓶范围内全局唯一) // 车用气瓶业务里面的 出厂编号/产品编码 校验唯一性(产品编号在车用气瓶范围内全局唯一)
if (commonMapper.checkFactoryNumUnique(factoryNum, null, produceUnitCreditCode) > 0) { List<Map<String, Object>> unitList = commonMapper.checkFactoryNumUniqueWithUseName(factoryNum, produceUnitCreditCode);
result.append("出厂编号/产品编码在该企业中已存在!"); String duplicateUnits = unitList.stream()
.filter(m -> {
Object count = m.get("count");
return count != null && Integer.parseInt(String.valueOf(count)) > 0;
})
.map(m -> String.valueOf(m.get("useUnitName")))
.filter(Objects::nonNull)
.distinct()
.collect(Collectors.joining(","));
if (!duplicateUnits.isEmpty()) {
result.append(String.format(
"制造单位[%s]生产的出厂编号为[%s]的气瓶,已被[%s]录入系统,请核实!",
produceUnitName, factoryNum, duplicateUnits
));
} }
} }
...@@ -3277,7 +3296,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -3277,7 +3296,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
String sourceRecord = equipmentClassForm.get(RECORD).toString(); String sourceRecord = equipmentClassForm.get(RECORD).toString();
// bug-21203 // bug-21203
if (equipmentInfoForm.containsKey("DATA_SOURCE")) { if (equipmentInfoForm.containsKey("DATA_SOURCE")) {
String dataSourceCopy = equipmentInfoForm.get("DATA_SOURCE").toString(); String dataSourceCopy = dataSource;
if (dataSourceCopy.startsWith("jg_his_black")) { if (dataSourceCopy.startsWith("jg_his_black")) {
dataSource = "jg_his_black_" + sourceRecord; dataSource = "jg_his_black_" + sourceRecord;
} else if (dataSourceCopy.startsWith("jg_his")) { } else if (dataSourceCopy.startsWith("jg_his")) {
...@@ -3480,134 +3499,136 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -3480,134 +3499,136 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
List<IdxBizJgMainParts> mainPartsList = new ArrayList<>(); List<IdxBizJgMainParts> mainPartsList = new ArrayList<>();
List<IdxBizJgProtectionDevices> protectionDevicesList = new ArrayList<>(); List<IdxBizJgProtectionDevices> protectionDevicesList = new ArrayList<>();
// 电梯 if (!equipmentParamsForm.isEmpty()){
if (EquipmentClassifityEnum.DT.getCode().equals(equList)) { // 电梯
IdxBizJgTechParamsElevator elevator = JSON.parseObject(JSON.toJSONString(equipmentParamsForm), IdxBizJgTechParamsElevator.class); if (EquipmentClassifityEnum.DT.getCode().equals(equList)) {
if (!ValidationUtil.isEmpty(elevator)) { IdxBizJgTechParamsElevator elevator = JSON.parseObject(JSON.toJSONString(equipmentParamsForm), IdxBizJgTechParamsElevator.class);
elevator.setRecord(record); if (!ValidationUtil.isEmpty(elevator)) {
elevator.setRecDate(date); elevator.setRecord(record);
elevator.setSequenceNbr(OPERATESAVE.equals(operateType) ? null : String.valueOf(equipmentParamsForm.get("ELEVATOR_SEQ"))); elevator.setRecDate(date);
iIdxBizJgTechParamsElevatorService.saveOrUpdateData(elevator); elevator.setSequenceNbr(OPERATESAVE.equals(operateType) ? null : String.valueOf(equipmentParamsForm.get("ELEVATOR_SEQ")));
} iIdxBizJgTechParamsElevatorService.saveOrUpdateData(elevator);
} }
// 厂车
else if (EquipmentClassifityEnum.CC.getCode().equals(equList)) {
IdxBizJgTechParamsVehicle vehicle = JSON.parseObject(JSON.toJSONString(equipmentParamsForm), IdxBizJgTechParamsVehicle.class);
if (!ValidationUtil.isEmpty(vehicle)) {
vehicle.setRecord(record);
vehicle.setRecDate(date);
vehicle.setSequenceNbr(OPERATESAVE.equals(operateType) ? null : String.valueOf(equipmentParamsForm.get("VEHICLE_SEQ")));
iIdxBizJgTechParamsVehicleService.saveOrUpdateData(vehicle);
} }
// 厂车
else if (EquipmentClassifityEnum.CC.getCode().equals(equList)) {
IdxBizJgTechParamsVehicle vehicle = JSON.parseObject(JSON.toJSONString(equipmentParamsForm), IdxBizJgTechParamsVehicle.class);
if (!ValidationUtil.isEmpty(vehicle)) {
vehicle.setRecord(record);
vehicle.setRecDate(date);
vehicle.setSequenceNbr(OPERATESAVE.equals(operateType) ? null : String.valueOf(equipmentParamsForm.get("VEHICLE_SEQ")));
iIdxBizJgTechParamsVehicleService.saveOrUpdateData(vehicle);
}
// 主要零部件 // 主要零部件
List<String> subFormMainPartsList = new ArrayList<>(); List<String> subFormMainPartsList = new ArrayList<>();
subFormMainPartsList.add("subForm_sey164b51a"); subFormMainPartsList.add("subForm_sey164b51a");
subFormMainPartsList.add("subForm_tef7yf5fbr"); subFormMainPartsList.add("subForm_tef7yf5fbr");
mainPartsList = this.getAccessoryEntity(equipmentParamsForm, subFormMainPartsList, EQUIP_MAINPARTS_FORM_ID, record, date, operateType); mainPartsList = this.getAccessoryEntity(equipmentParamsForm, subFormMainPartsList, EQUIP_MAINPARTS_FORM_ID, record, date, operateType);
}
// 索道
else if (EquipmentClassifityEnum.KYSD.getCode().equals(equList)) {
IdxBizJgTechParamsRopeway ropeway = JSON.parseObject(JSON.toJSONString(equipmentParamsForm), IdxBizJgTechParamsRopeway.class);
if (!ValidationUtil.isEmpty(ropeway)) {
ropeway.setRecord(record);
ropeway.setRecDate(date);
ropeway.setSequenceNbr(OPERATESAVE.equals(operateType) ? null : String.valueOf(equipmentParamsForm.get("ROPEWAY_SEQ")));
iIdxBizJgTechParamsRopewayService.saveOrUpdateData(ropeway);
} }
// 索道
else if (EquipmentClassifityEnum.KYSD.getCode().equals(equList)) {
IdxBizJgTechParamsRopeway ropeway = JSON.parseObject(JSON.toJSONString(equipmentParamsForm), IdxBizJgTechParamsRopeway.class);
if (!ValidationUtil.isEmpty(ropeway)) {
ropeway.setRecord(record);
ropeway.setRecDate(date);
ropeway.setSequenceNbr(OPERATESAVE.equals(operateType) ? null : String.valueOf(equipmentParamsForm.get("ROPEWAY_SEQ")));
iIdxBizJgTechParamsRopewayService.saveOrUpdateData(ropeway);
}
// 主要零部件 // 主要零部件
List<String> subFormMainPartsList = new ArrayList<>(); List<String> subFormMainPartsList = new ArrayList<>();
subFormMainPartsList.add("subForm_5fi0jewuyh"); subFormMainPartsList.add("subForm_5fi0jewuyh");
mainPartsList = this.getAccessoryEntity(equipmentParamsForm, subFormMainPartsList, EQUIP_MAINPARTS_FORM_ID, record, date, operateType); mainPartsList = this.getAccessoryEntity(equipmentParamsForm, subFormMainPartsList, EQUIP_MAINPARTS_FORM_ID, record, date, operateType);
}
// 游乐设施
else if (EquipmentClassifityEnum.YLSS.getCode().equals(equList)) {
IdxBizJgTechParamsRides rides = JSON.parseObject(JSON.toJSONString(equipmentParamsForm), IdxBizJgTechParamsRides.class);
if (!ValidationUtil.isEmpty(rides)) {
rides.setRecord(record);
rides.setRecDate(date);
rides.setSequenceNbr(OPERATESAVE.equals(operateType) ? null : String.valueOf(equipmentParamsForm.get("RIDES_SEQ")));
iIdxBizJgTechParamsRidesService.saveOrUpdateData(rides);
} }
} // 游乐设施
// 锅炉 else if (EquipmentClassifityEnum.YLSS.getCode().equals(equList)) {
else if (EquipmentClassifityEnum.GL.getCode().equals(equList)) { IdxBizJgTechParamsRides rides = JSON.parseObject(JSON.toJSONString(equipmentParamsForm), IdxBizJgTechParamsRides.class);
IdxBizJgTechParamsBoiler boiler = JSON.parseObject(JSON.toJSONString(equipmentParamsForm), IdxBizJgTechParamsBoiler.class); if (!ValidationUtil.isEmpty(rides)) {
if (!ValidationUtil.isEmpty(boiler)) { rides.setRecord(record);
boiler.setRecord(record); rides.setRecDate(date);
boiler.setRecDate(date); rides.setSequenceNbr(OPERATESAVE.equals(operateType) ? null : String.valueOf(equipmentParamsForm.get("RIDES_SEQ")));
boiler.setSequenceNbr(OPERATESAVE.equals(operateType) ? null : String.valueOf(equipmentParamsForm.get("BOILER_SEQ"))); iIdxBizJgTechParamsRidesService.saveOrUpdateData(rides);
iIdxBizJgTechParamsBoilerService.saveOrUpdateData(boiler); }
} }
// 锅炉
else if (EquipmentClassifityEnum.GL.getCode().equals(equList)) {
IdxBizJgTechParamsBoiler boiler = JSON.parseObject(JSON.toJSONString(equipmentParamsForm), IdxBizJgTechParamsBoiler.class);
if (!ValidationUtil.isEmpty(boiler)) {
boiler.setRecord(record);
boiler.setRecDate(date);
boiler.setSequenceNbr(OPERATESAVE.equals(operateType) ? null : String.valueOf(equipmentParamsForm.get("BOILER_SEQ")));
iIdxBizJgTechParamsBoilerService.saveOrUpdateData(boiler);
}
// 主要零部件 // 主要零部件
List<String> subFormMainPartsList = new ArrayList<>(); List<String> subFormMainPartsList = new ArrayList<>();
subFormMainPartsList.add("subForm_1hh88r4m69"); subFormMainPartsList.add("subForm_1hh88r4m69");
mainPartsList = this.getAccessoryEntity(equipmentParamsForm, subFormMainPartsList, EQUIP_MAINPARTS_FORM_ID, record, date, operateType); mainPartsList = this.getAccessoryEntity(equipmentParamsForm, subFormMainPartsList, EQUIP_MAINPARTS_FORM_ID, record, date, operateType);
}
// 压力容器
else if (EquipmentClassifityEnum.YLRQ.getCode().equals(equList)) {
IdxBizJgTechParamsVessel vessel = JSON.parseObject(JSON.toJSONString(equipmentParamsForm), IdxBizJgTechParamsVessel.class);
if (!ValidationUtil.isEmpty(vessel)) {
vessel.setRecord(record);
vessel.setRecDate(date);
String VIN = ValidationUtil.isEmpty(equipmentInfoForm.get("identificationCode")) ? "" : (String) equipmentInfoForm.get("identificationCode");
vessel.setVin(VIN);
vessel.setSequenceNbr(OPERATESAVE.equals(operateType) ? null : String.valueOf(equipmentParamsForm.get("VESSEL_SEQ")));
iIdxBizJgTechParamsVesselService.saveOrUpdateData(vessel);
} }
// 压力容器
else if (EquipmentClassifityEnum.YLRQ.getCode().equals(equList)) {
IdxBizJgTechParamsVessel vessel = JSON.parseObject(JSON.toJSONString(equipmentParamsForm), IdxBizJgTechParamsVessel.class);
if (!ValidationUtil.isEmpty(vessel)) {
vessel.setRecord(record);
vessel.setRecDate(date);
String VIN = ValidationUtil.isEmpty(equipmentInfoForm.get("identificationCode")) ? "" : (String) equipmentInfoForm.get("identificationCode");
vessel.setVin(VIN);
vessel.setSequenceNbr(OPERATESAVE.equals(operateType) ? null : String.valueOf(equipmentParamsForm.get("VESSEL_SEQ")));
iIdxBizJgTechParamsVesselService.saveOrUpdateData(vessel);
}
// 主要零部件 // 主要零部件
List<String> subFormMainPartsList = new ArrayList<>(); List<String> subFormMainPartsList = new ArrayList<>();
subFormMainPartsList.add("subForm_fie04854f2"); subFormMainPartsList.add("subForm_fie04854f2");
mainPartsList = this.getAccessoryEntity(equipmentParamsForm, subFormMainPartsList, EQUIP_MAINPARTS_FORM_ID, record, date, operateType); mainPartsList = this.getAccessoryEntity(equipmentParamsForm, subFormMainPartsList, EQUIP_MAINPARTS_FORM_ID, record, date, operateType);
// 安全附件 // 安全附件
List<String> subFormProtectionDevicesList = new ArrayList<>(); List<String> subFormProtectionDevicesList = new ArrayList<>();
subFormProtectionDevicesList.add("subForm_d4xdzhsgdj"); subFormProtectionDevicesList.add("subForm_d4xdzhsgdj");
protectionDevicesList = this.getAccessoryEntity(equipmentParamsForm, subFormProtectionDevicesList, EQUIP_PROTECTIONDEVICES_FORM_ID, record, date, operateType); protectionDevicesList = this.getAccessoryEntity(equipmentParamsForm, subFormProtectionDevicesList, EQUIP_PROTECTIONDEVICES_FORM_ID, record, date, operateType);
}
// 压力管道
else if (EquipmentClassifityEnum.YLGD.getCode().equals(equList)) {
IdxBizJgTechParamsPipeline pipeline = JSON.parseObject(JSON.toJSONString(equipmentParamsForm), IdxBizJgTechParamsPipeline.class);
if (!ValidationUtil.isEmpty(pipeline)) {
pipeline.setRecord(record);
pipeline.setRecDate(date);
pipeline.setSequenceNbr(OPERATESAVE.equals(operateType) ? null : String.valueOf(equipmentParamsForm.get("PIPELINE_SEQ")));
iIdxBizJgTechParamsPipelineService.saveOrUpdateData(pipeline);
} }
// 压力管道
else if (EquipmentClassifityEnum.YLGD.getCode().equals(equList)) {
IdxBizJgTechParamsPipeline pipeline = JSON.parseObject(JSON.toJSONString(equipmentParamsForm), IdxBizJgTechParamsPipeline.class);
if (!ValidationUtil.isEmpty(pipeline)) {
pipeline.setRecord(record);
pipeline.setRecDate(date);
pipeline.setSequenceNbr(OPERATESAVE.equals(operateType) ? null : String.valueOf(equipmentParamsForm.get("PIPELINE_SEQ")));
iIdxBizJgTechParamsPipelineService.saveOrUpdateData(pipeline);
}
// 主要零部件 // 主要零部件
List<String> subFormMainPartsList = new ArrayList<>(); List<String> subFormMainPartsList = new ArrayList<>();
subFormMainPartsList.add("subForm_9n7nu55z8r"); subFormMainPartsList.add("subForm_9n7nu55z8r");
mainPartsList = this.getAccessoryEntity(equipmentParamsForm, subFormMainPartsList, EQUIP_MAINPARTS_FORM_ID, record, date, operateType); mainPartsList = this.getAccessoryEntity(equipmentParamsForm, subFormMainPartsList, EQUIP_MAINPARTS_FORM_ID, record, date, operateType);
}
// 起重机械
else if (EquipmentClassifityEnum.QZJX.getCode().equals(equList)) {
IdxBizJgTechParamsLifting lifting = JSON.parseObject(JSON.toJSONString(equipmentParamsForm), IdxBizJgTechParamsLifting.class);
if (!ValidationUtil.isEmpty(lifting)) {
lifting.setRecord(record);
lifting.setRecDate(date);
lifting.setSequenceNbr(OPERATESAVE.equals(operateType) ? null : String.valueOf(equipmentParamsForm.get("LIFTING_SEQ")));
iIdxBizJgTechParamsLiftingService.saveOrUpdateData(lifting);
} }
// 起重机械
else if (EquipmentClassifityEnum.QZJX.getCode().equals(equList)) {
IdxBizJgTechParamsLifting lifting = JSON.parseObject(JSON.toJSONString(equipmentParamsForm), IdxBizJgTechParamsLifting.class);
if (!ValidationUtil.isEmpty(lifting)) {
lifting.setRecord(record);
lifting.setRecDate(date);
lifting.setSequenceNbr(OPERATESAVE.equals(operateType) ? null : String.valueOf(equipmentParamsForm.get("LIFTING_SEQ")));
iIdxBizJgTechParamsLiftingService.saveOrUpdateData(lifting);
}
// 主要零部件 // 主要零部件
List<String> subFormMainPartsList = new ArrayList<>(); List<String> subFormMainPartsList = new ArrayList<>();
subFormMainPartsList.add("subForm_bqirdyvztt"); subFormMainPartsList.add("subForm_bqirdyvztt");
mainPartsList = this.getAccessoryEntity(equipmentParamsForm, subFormMainPartsList, EQUIP_MAINPARTS_FORM_ID, record, date, operateType); mainPartsList = this.getAccessoryEntity(equipmentParamsForm, subFormMainPartsList, EQUIP_MAINPARTS_FORM_ID, record, date, operateType);
// 安全附件 // 安全附件
List<String> subFormProtectionDevicesList = new ArrayList<>(); List<String> subFormProtectionDevicesList = new ArrayList<>();
subFormProtectionDevicesList.add("subForm_29yy3pdzhl"); subFormProtectionDevicesList.add("subForm_29yy3pdzhl");
subFormProtectionDevicesList.add("subForm_h5h4x0zhur"); subFormProtectionDevicesList.add("subForm_h5h4x0zhur");
protectionDevicesList = this.getAccessoryEntity(equipmentParamsForm, subFormProtectionDevicesList, EQUIP_PROTECTIONDEVICES_FORM_ID, record, date, operateType); protectionDevicesList = this.getAccessoryEntity(equipmentParamsForm, subFormProtectionDevicesList, EQUIP_PROTECTIONDEVICES_FORM_ID, record, date, operateType);
}
} }
// 八大类技术参数和主要零部件和安全附件表 // 八大类技术参数和主要零部件和安全附件表
...@@ -3668,7 +3689,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -3668,7 +3689,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
Date nextInspectDate = (Date) map.get("NEXT_INSPECT_DATE"); Date nextInspectDate = (Date) map.get("NEXT_INSPECT_DATE");
dto.setNEXT_INSPECT_DATE(DateUtil.parse(DateUtil.format(nextInspectDate, DatePattern.NORM_DATE_PATTERN)).getTime()); dto.setNEXT_INSPECT_DATE(DateUtil.parse(DateUtil.format(nextInspectDate, DatePattern.NORM_DATE_PATTERN)).getTime());
} }
esEquipmentCategory.save(dto); equipmentCategoryService.saveWithImmediateRefresh(dto);
} }
} }
...@@ -3927,7 +3948,8 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -3927,7 +3948,8 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
useInfo.setRecord(record); useInfo.setRecord(record);
useInfo.setRecDate(new Date()); useInfo.setRecDate(new Date());
useInfo.setCreateDate(new Date()); useInfo.setCreateDate(new Date());
useInfo.setDataSource("his".equals(equipInfoDto.getDataSource()) ? "jg_his" : "jg");// 区分历史设备和新增设备 String source = equipInfoDto.getDataSource();
useInfo.setDataSource("his".equals(source) ? "jg_his" : "black".equals(source) ? "jg_his_black" : "jg");// 区分历史设备和新增设备
useInfo.setEquState(null); useInfo.setEquState(null);
useInfo.setIsIntoManagement("his".equals(equipInfoDto.getDataSource()));// 历史气瓶导入为已纳管设备 useInfo.setIsIntoManagement("his".equals(equipInfoDto.getDataSource()));// 历史气瓶导入为已纳管设备
// 历史气瓶导入设备状态为在用 // 历史气瓶导入设备状态为在用
...@@ -3965,7 +3987,10 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -3965,7 +3987,10 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
factoryInfo.setInsUseMaintainExplain(insUseMaintainExplain); factoryInfo.setInsUseMaintainExplain(insUseMaintainExplain);
factoryInfo.setOtherAccessoriesFact(otherAccessoriesFact); factoryInfo.setOtherAccessoriesFact(otherAccessoriesFact);
factoryInfo.setFactSupervisionInspectionReport(factSupervisionInspectionReport); factoryInfo.setFactSupervisionInspectionReport(factSupervisionInspectionReport);
factoryInfo.setProduceDate(DateUtil.parse(data.getProduceDate(), "yyyy-MM-dd")); Optional.ofNullable(data.getProduceDate())
.filter(s -> !s.trim().isEmpty())
.map(d -> DateUtil.parse(d, "yyyy-MM-dd"))
.ifPresent(factoryInfo::setProduceDate);
factoryInfo.setImported(Optional.ofNullable(data.getImported()).orElse("0")); factoryInfo.setImported(Optional.ofNullable(data.getImported()).orElse("0"));
factoryInfoList.add(factoryInfo); factoryInfoList.add(factoryInfo);
...@@ -3997,13 +4022,17 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -3997,13 +4022,17 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
inspectionDetectionInfo.setRecDate(new Date()); inspectionDetectionInfo.setRecDate(new Date());
inspectionDetectionInfo.setInspectType("ZZJDJY"); inspectionDetectionInfo.setInspectType("ZZJDJY");
inspectionDetectionInfo.setInspectConclusion("6040");// 默认合格 inspectionDetectionInfo.setInspectConclusion("6040");// 默认合格
inspectionDetectionInfo.setInspectDate(DateUtil.parse(data.getInspectDate(), "yyyy-MM-dd"));
// 根据条件确定增加的年数 // 根据条件确定增加的年数
inspectionDetectionInfo.setNextInspectDate(Date.from( Optional.ofNullable(data.getInspectDate())
LocalDate.parse(data.getInspectDate(), DateTimeFormatter.ofPattern("yyyy-MM-dd")) .filter(s -> !s.trim().isEmpty())
.plusYears(SPECIAL_CYLINDER.getCode().equals(equipInfoDto.getEquDefineCode()) ? 3 : 4) .map(dateStr -> LocalDate.parse(dateStr, DateTimeFormatter.ofPattern("yyyy-MM-dd")))
.atStartOfDay(ZoneId.systemDefault()) .ifPresent(inspectDate -> {
.toInstant())); inspectionDetectionInfo.setInspectDate(Date.from(inspectDate.atStartOfDay(ZoneId.systemDefault()).toInstant()));
// 计算下次检测日期(加 3 年或 4 年)
int plusYears = SPECIAL_CYLINDER.getCode().equals(equipInfoDto.getEquDefineCode()) ? 3 : 4;
LocalDate nextInspectDate = inspectDate.plusYears(plusYears);
inspectionDetectionInfo.setNextInspectDate(Date.from(nextInspectDate.atStartOfDay(ZoneId.systemDefault()).toInstant()));
});
inspectionDetectionInfoList.add(inspectionDetectionInfo); inspectionDetectionInfoList.add(inspectionDetectionInfo);
// 其他信息 // 其他信息
...@@ -4075,8 +4104,13 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -4075,8 +4104,13 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
changeRecordEq.setProductCode(factoryInfo.getFactoryNum());// 产品编号 changeRecordEq.setProductCode(factoryInfo.getFactoryNum());// 产品编号
certificateChangeRecordEqService.save(changeRecordEq); certificateChangeRecordEqService.save(changeRecordEq);
} }
String nextInspectDateStr = Optional.ofNullable(inspectionDetectionInfo.getNextInspectDate())
.map(date -> date.toInstant()
.atZone(ZoneId.systemDefault())
.toLocalDate()
.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")))
.orElse(null);
Map<String, Object> equipMap = MapBuilder.<String, Object>create() Map<String, Object> equipMap = MapBuilder.<String, Object>create()
.put("equDefineName", equipInfoDto.getEquDefine())
.put("factoryNum", factoryInfo.getFactoryNum()) .put("factoryNum", factoryInfo.getFactoryNum())
.put("chargingMedium", data.getChargingMedium()) .put("chargingMedium", data.getChargingMedium())
.put("productName", data.getProductName()) .put("productName", data.getProductName())
...@@ -4084,20 +4118,16 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -4084,20 +4118,16 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
.put("produceDate", esEquipmentDto.getPRODUCE_DATE()) .put("produceDate", esEquipmentDto.getPRODUCE_DATE())
.put("nominalWorkingPressure", data.getNominalWorkingPressure()) .put("nominalWorkingPressure", data.getNominalWorkingPressure())
.put("singleBottleVolume", data.getSingleBottleVolume()) .put("singleBottleVolume", data.getSingleBottleVolume())
.put("singleBottleVolume", data.getSingleBottleVolume())
.put("inspectDate", data.getInspectDate()) .put("inspectDate", data.getInspectDate())
.put("equList", equipInfoDto.getEquListCode()) .put("equList", equipInfoDto.getEquListCode())
.put("equListName", equipInfoDto.getEquList()) .put("equListName", equipInfoDto.getEquList())
.put("equCategory", equipInfoDto.getEquCategoryCode())
.put("equCategoryName", equipInfoDto.getEquCategory())
.put("equDefine", equipInfoDto.getEquDefineCode()) .put("equDefine", equipInfoDto.getEquDefineCode())
.put("equDefineName", equipInfoDto.getEquDefine()) .put("equDefineName", equipInfoDto.getEquDefine())
.put("equCategoryName", equipInfoDto.getEquCategory())
.put("manageType", "unit") .put("manageType", "unit")
.put("equCategory", equipInfoDto.getEquCategoryCode())
.put("record", esEquipmentDto.getSEQUENCE_NBR()) .put("record", esEquipmentDto.getSEQUENCE_NBR())
.put("nextInspectDate", inspectionDetectionInfo.getNextInspectDate().toInstant() .put("nextInspectDate", nextInspectDateStr)
.atZone(ZoneId.systemDefault())
.toLocalDate()
.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")))
.put("useInnerCode", useInfo.getUseInnerCode()) .put("useInnerCode", useInfo.getUseInnerCode())
.put("informationSituation", data.getInformationSituation()) .put("informationSituation", data.getInformationSituation())
.build(); .build();
...@@ -4470,12 +4500,12 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -4470,12 +4500,12 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
log.info("解析第{}行数据:{}", rowIndex, JSON.toJSONString(data)); log.info("解析第{}行数据:{}", rowIndex, JSON.toJSONString(data));
// 检查各字段是否为空,如果为空则追加错误信息 // 检查各字段是否为空,如果为空则追加错误信息
checkNotBlank(data.getProductName(), "设备名称不能为空;", result); checkNotBlank(data.getProductName(), "设备名称不能为空;", result);
checkNotBlank(data.getBrandName(), "品牌名称不能为空;", result); //checkNotBlank(data.getBrandName(), "品牌名称不能为空;", result);
checkNotBlank(data.getEquType(), "设备型号不能为空;", result); // checkNotBlank(data.getEquType(), "设备型号不能为空;", result);
checkNotBlank(data.getUseInnerCode(), "单位内部编号不能为空;", result); //checkNotBlank(data.getUseInnerCode(), "单位内部编号不能为空;", result);
if (useInnerCodeList.contains(data.getUseInnerCode())) { // if (useInnerCodeList.contains(data.getUseInnerCode())) {
result.append("单位内部编号不能重复;"); // result.append("单位内部编号不能重复;");
} // }
checkNotBlank(data.getWhetherVehicleCylinder(), "是否车用气瓶不能为空;", result); checkNotBlank(data.getWhetherVehicleCylinder(), "是否车用气瓶不能为空;", result);
checkNotBlank(data.getEquCodeType(), "是否有设备代码不能为空;", result); checkNotBlank(data.getEquCodeType(), "是否有设备代码不能为空;", result);
if ("1".equals(data.getEquCodeType())) { if ("1".equals(data.getEquCodeType())) {
...@@ -4496,35 +4526,39 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -4496,35 +4526,39 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
} else { } else {
data.setEquCode(""); data.setEquCode("");
} }
checkNotBlank(data.getDesignUnitCreditCode(), "设计单位统一社会信用代码不能为空;", result); //checkNotBlank(data.getDesignUnitCreditCode(), "设计单位统一社会信用代码不能为空;", result);
checkNotBlank(data.getDesignUnitName(), "设计单位名称不能为空;", result); //checkNotBlank(data.getDesignUnitName(), "设计单位名称不能为空;", result);
Optional.ofNullable(data.getDesignDate()).ifPresent(v -> checkDateFormatCorrect(v, "设计日期格式不正确;", result)); Optional.ofNullable(data.getDesignDate()).ifPresent(v -> checkDateFormatCorrect(v, "设计日期格式不正确;", result));
Optional.ofNullable(data.getAppraisalDate()).ifPresent(v -> checkDateFormatCorrect(v, "设计文件鉴定日期格式不正确;", result)); Optional.ofNullable(data.getAppraisalDate()).ifPresent(v -> checkDateFormatCorrect(v, "设计文件鉴定日期格式不正确;", result));
checkNotBlank(data.getProduceUnitCreditCode(), "制造单位统一社会信用代码不能为空;", result); checkNotBlank(data.getProduceUnitCreditCode(), "制造单位统一社会信用代码不能为空;", result);
checkNotBlank(data.getProduceUnitName(), "制造单位名称不能为空;", result); checkNotBlank(data.getProduceUnitName(), "制造单位名称不能为空;", result);
checkNotBlank(data.getProduceLicenseNum(), "制造许可编号不能为空;", result); // checkNotBlank(data.getProduceLicenseNum(), "制造许可编号不能为空;", result);
checkNotBlank(data.getFactoryNum(), "出厂编号/产品编码不能为空;", result); checkNotBlank(data.getFactoryNum(), "出厂编号/产品编码不能为空;", result);
if ("0".equals(data.getWhetherVehicleCylinder())) { if ("0".equals(data.getWhetherVehicleCylinder())) {
checkNotBlank(data.getCylinderCategory(), "气瓶分类不能为空;", result); checkNotBlank(data.getCylinderCategory(), "气瓶分类不能为空;", result);
checkFactoryNumUnique(data.getFactoryNum(), data.getProduceUnitCreditCode(), result); if (!StringUtils.isEmpty(data.getFactoryNum())){
checkFactoryNumUnique(data.getFactoryNum(), data.getProduceUnitCreditCode(),data.getProduceUnitName(), result);
}
} else { } else {
checkFactoryNumUniquenessForVehicleCylinder(data.getFactoryNum(), result); if (!StringUtils.isEmpty(data.getFactoryNum())){
checkFactoryNumUniquenessForVehicleCylinder(data.getFactoryNum(), result);
}
} }
checkNotBlank(data.getProduceDate(), "制造日期不能为空;", result); // checkNotBlank(data.getProduceDate(), "制造日期不能为空;", result);
Optional.ofNullable(data.getProduceDate()).ifPresent(v -> checkDateFormatCorrect(v, "制造日期格式不正确;", result)); Optional.ofNullable(data.getProduceDate()).ifPresent(v -> checkDateFormatCorrect(v, "制造日期格式不正确;", result));
checkNotBlank(data.getInspectOrgName(), "检测机构名称不能为空;", result); //checkNotBlank(data.getInspectOrgName(), "检测机构名称不能为空;", result);
checkNotBlank(data.getInspectOrgCode(), "检测机构代码不能为空;", result); //checkNotBlank(data.getInspectOrgCode(), "检测机构代码不能为空;", result);
//checkInspectOrg(data.getInspectOrgCode(), result);//查询检验检测机构 //checkInspectOrg(data.getInspectOrgCode(), result);//查询检验检测机构
checkNotBlank(data.getInspectStaff(), "检测人员名称不能为空;", result); //checkNotBlank(data.getInspectStaff(), "检测人员名称不能为空;", result);
checkNotBlank(data.getInspectDate(), "检测日期不能为空;", result); //checkNotBlank(data.getInspectDate(), "检测日期不能为空;", result);
checkNotBlank(data.getInspectReportNo(), "检验报告编号不能为空;", result); //checkNotBlank(data.getInspectReportNo(), "检验报告编号不能为空;", result);
Optional.ofNullable(data.getInspectDate()).ifPresent(v -> checkDateFormatCorrect(v, "检测日期格式不正确;", result)); Optional.ofNullable(data.getInspectDate()).ifPresent(v -> checkDateFormatCorrect(v, "检测日期格式不正确;", result));
checkNotBlank(data.getSingleBottleVolume(), "单瓶容积不能为空;", result); //checkNotBlank(data.getSingleBottleVolume(), "单瓶容积不能为空;", result);
checkNotBlank(data.getChargingMedium(), "充装介质不能为空;", result); //checkNotBlank(data.getChargingMedium(), "充装介质不能为空;", result);
checkNotBlank(data.getNominalWorkingPressure(), "公称工作压力不能为空;", result); //checkNotBlank(data.getNominalWorkingPressure(), "公称工作压力不能为空;", result);
checkNotBlank(data.getInformationSituation(), "信息化管理情况(二维码、电子标签、无)不能为空;", result); //checkNotBlank(data.getInformationSituation(), "信息化管理情况(二维码、电子标签、无)不能为空;", result);
// 信息化管理情况校验 // 信息化管理情况校验
checkInformatManageInfo(data, result); //checkInformatManageInfo(data, result);
// 如果存在错误信息,则抛出 BadRequest 异常 // 如果存在错误信息,则抛出 BadRequest 异常
if (result.length() > 0) { if (result.length() > 0) {
result.insert(0, "Excel第[" + rowIndex + "]行 -> "); result.insert(0, "Excel第[" + rowIndex + "]行 -> ");
......
...@@ -197,6 +197,13 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN ...@@ -197,6 +197,13 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
EventPublisher eventPublisher; EventPublisher eventPublisher;
@Autowired @Autowired
private JgUseRegistrationServiceImpl jgUseRegistrationService; private JgUseRegistrationServiceImpl jgUseRegistrationService;
@Autowired
private JgReformNoticeServiceImpl jgReformNoticeService;
@Autowired
private JgTransferNoticeServiceImpl jgTransferNoticeService;
@Autowired
private JgMaintainNoticeServiceImpl jgMaintainNoticeService;
/** /**
* 安装改造维修单位吱资质类型:1234-安改维、1236-制造单位 * 安装改造维修单位吱资质类型:1234-安改维、1236-制造单位
...@@ -2030,6 +2037,39 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN ...@@ -2030,6 +2037,39 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
} }
@Override @Override
public Page<JgNoticeToBeSubmitDto> queryNoticeToBeSubmitPage(Page<JgNoticeToBeSubmitDto> page, ReginParams reginParams) {
String companyCode = reginParams.getCompany().getCompanyCode();
return jgInstallationNoticeMapper.queryNoticeToBeSubmitPage(page, companyCode);
}
@Override
public Map<String, Map<String, Object>> getNoticeToBeSubmitDetails(Long sequenceNbr, CompanyBo company, String businessType) {
Map<String, Map<String, Object>> notice = null;
switch (businessType) {
case "安装告知":
notice = this.queryBySequenceNbr(sequenceNbr, company);
notice.put("notice", notice.get("installationInfo"));
notice.remove("installationInfo");
break;
case "改造告知":
jgReformNoticeService.queryBySequenceNbr(sequenceNbr);
break;
case "维修告知":
notice = jgMaintainNoticeService.queryBySequenceNbr(sequenceNbr, company);
notice.put("notice", notice.get("maintainInfo"));
break;
case "移装告知":
notice = jgTransferNoticeService.queryBySequenceNbr(sequenceNbr, company);
notice.put("notice", notice.get("transferInfo"));
break;
default:
this.queryBySequenceNbr(sequenceNbr, company);
}
return notice;
}
@Override
public boolean beforeCheck(JgInstallationNotice notice) { public boolean beforeCheck(JgInstallationNotice notice) {
return notice.getInstanceId() != null && !notice.getNoticeStatus().equals(String.valueOf(FlowStatusEnum.TO_BE_FINISHED.getCode())) &&!notice.getNoticeStatus().equals(String.valueOf(FlowStatusEnum.TO_BE_DISCARD.getCode())); return notice.getInstanceId() != null && !notice.getNoticeStatus().equals(String.valueOf(FlowStatusEnum.TO_BE_FINISHED.getCode())) &&!notice.getNoticeStatus().equals(String.valueOf(FlowStatusEnum.TO_BE_DISCARD.getCode()));
} }
......
...@@ -250,15 +250,15 @@ public class JgTableDataExportServiceImpl implements IJgTableDataExportService { ...@@ -250,15 +250,15 @@ public class JgTableDataExportServiceImpl implements IJgTableDataExportService {
* 登记证列表数据导出 * 登记证列表数据导出
*/ */
@Override @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(); RequestContextWrapper contextWrapper = RequestContextWrapper.capture();
List<CertificateVo> exportData; List<CertificateVo> exportData;
if (ids.isEmpty()) { if (ids.isEmpty()) {
// 查询首页数据 // 查询首页数据
int currentPage = 1; int currentPage = 1;
Page<JgUseRegistrationManageDto> firstPage = jgUseRegistrationManageServiceImpl.buildFilter(dto, currentPage, PAGE_SIZE); Page<JgUseRegistrationManageDto> dtoPage = isJG ? jgUseRegistrationManageServiceImpl.queryForJgUseRegistrationManagePageForJG(dto, sort, currentPage, PAGE_SIZE)
Page<JgUseRegistrationManageDto> dtoPage = jgUseRegistrationManageServiceImpl.queryForJgUseRegistrationManagePage(firstPage, dto, sort); : jgUseRegistrationManageServiceImpl.queryForJgUseRegistrationManagePage(jgUseRegistrationManageServiceImpl.buildFilter(dto, currentPage, PAGE_SIZE), dto, sort);
long total = dtoPage.getTotal(); long total = dtoPage.getTotal();
int totalPage = (int) Math.ceil((double) total / PAGE_SIZE); int totalPage = (int) Math.ceil((double) total / PAGE_SIZE);
...@@ -276,8 +276,8 @@ public class JgTableDataExportServiceImpl implements IJgTableDataExportService { ...@@ -276,8 +276,8 @@ public class JgTableDataExportServiceImpl implements IJgTableDataExportService {
CompletableFuture<List<String>> future = CompletableFuture.supplyAsync(() -> { CompletableFuture<List<String>> future = CompletableFuture.supplyAsync(() -> {
// 恢复上下文到子线程 // 恢复上下文到子线程
contextWrapper.apply(); contextWrapper.apply();
Page<JgUseRegistrationManageDto> page = jgUseRegistrationManageServiceImpl.buildFilter(dto, pageIndex, PAGE_SIZE); Page<JgUseRegistrationManageDto> resultPage = isJG ? jgUseRegistrationManageServiceImpl.queryForJgUseRegistrationManagePageForJG(dto, sort, pageIndex, PAGE_SIZE)
Page<JgUseRegistrationManageDto> resultPage = jgUseRegistrationManageServiceImpl.queryForJgUseRegistrationManagePage(page, dto, sort); : jgUseRegistrationManageServiceImpl.queryForJgUseRegistrationManagePage(jgUseRegistrationManageServiceImpl.buildFilter(dto, pageIndex, PAGE_SIZE), dto, sort);
return resultPage.getRecords().stream() return resultPage.getRecords().stream()
.map(JgUseRegistrationManageDto::getSequenceNbr) .map(JgUseRegistrationManageDto::getSequenceNbr)
.map(String::valueOf) .map(String::valueOf)
...@@ -325,14 +325,18 @@ public class JgTableDataExportServiceImpl implements IJgTableDataExportService { ...@@ -325,14 +325,18 @@ public class JgTableDataExportServiceImpl implements IJgTableDataExportService {
if ("压力管道".equals(data.getEquList())) { if ("压力管道".equals(data.getEquList())) {
List<IdxBizJgProjectContraption> contraptions = idxBizJgProjectContraptionService.queryProConByCertSeq(data.getSequenceNbr()); List<IdxBizJgProjectContraption> contraptions = idxBizJgProjectContraptionService.queryProConByCertSeq(data.getSequenceNbr());
for (IdxBizJgProjectContraption obj : contraptions) { for (IdxBizJgProjectContraption obj : contraptions) {
BeanUtil.copyProperties(obj, data); CertificateVo newData = new CertificateVo();
exportData.add(data); BeanUtil.copyProperties(data, newData);
BeanUtil.copyProperties(obj, newData);
exportData.add(newData);
} }
} else { } else {
List<JSONObject> jsonObjects = jgUseRegistrationManageServiceImpl.queryEquByCertificateSeq(Long.valueOf(data.getSequenceNbr())); List<JSONObject> jsonObjects = jgUseRegistrationManageServiceImpl.queryEquByCertificateSeq(Long.valueOf(data.getSequenceNbr()));
for (JSONObject obj : jsonObjects) { for (JSONObject obj : jsonObjects) {
BeanUtil.copyProperties(obj, data); CertificateVo newData = new CertificateVo();
exportData.add(data); BeanUtil.copyProperties(data, newData);
BeanUtil.copyProperties(obj, newData);
exportData.add(newData);
} }
} }
}); });
......
...@@ -319,15 +319,16 @@ public class JgUseRegistrationManageServiceImpl extends BaseService<JgUseRegistr ...@@ -319,15 +319,16 @@ public class JgUseRegistrationManageServiceImpl extends BaseService<JgUseRegistr
return jgUseRegistrationManageMapper.queryForPage(page, dto, sortMap); return jgUseRegistrationManageMapper.queryForPage(page, dto, sortMap);
} }
public Page<JgUseRegistrationManageDto> queryForJgUseRegistrationManagePageForJG(Page<JgUseRegistrationManageDto> page, public Page<JgUseRegistrationManageDto> queryForJgUseRegistrationManagePageForJG(JgUseRegistrationManageDto dto, String sort, int current, int size) {
JgUseRegistrationManageDto dto, Page<JgUseRegistrationManageDto> page = new Page<JgUseRegistrationManageDto>();
String sort, String orgCode) { page.setCurrent(current);
page.setSize(size);
SortVo sortMap = commonServiceImpl.sortFieldConversion(sort); 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()))){ 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.setCertificateStatus(null);
dto.setIsScrap("0"); 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) { public Page<JgUseRegistrationManageDto> getRecords(Page<JgUseRegistrationManageDto> page, JgUseRegistrationManageDto dto, String cityCode) {
......
...@@ -4172,7 +4172,8 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD ...@@ -4172,7 +4172,8 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
if (registerInfo != null) { if (registerInfo != null) {
registerInfo.setUseOrgCode(jgUseRegistration.getUseRegistrationCode()); registerInfo.setUseOrgCode(jgUseRegistration.getUseRegistrationCode());
registerInfo.setEquCodeType(String.valueOf(map.get("equCodeType"))); 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()) equCode = ObjectUtils.isEmpty(map.get("equCode")) && !StringUtils.isEmpty(jgUseRegistration.getReceiveCompanyCode())
? this.getEquCode(registerInfo, jgUseRegistration.getReceiveCompanyCode()) ? this.getEquCode(registerInfo, jgUseRegistration.getReceiveCompanyCode())
: String.valueOf(map.get("equCode")); : String.valueOf(map.get("equCode"));
...@@ -4335,6 +4336,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD ...@@ -4335,6 +4336,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
.build()); .build());
} }
} }
eventPublisher.publish(new EquipCreateOrEditEvent(this, BusinessTypeEnum.JG_NEW_EQUIP.name(), Sets.newHashSet(equipId), EquipCreateOrEditEvent.EquipType.equip));
return this.baseMapper.getDetailById(jgUseRegistration.getSequenceNbr()); return this.baseMapper.getDetailById(jgUseRegistration.getSequenceNbr());
} catch (BadRequest | LocalBadRequest e) { } catch (BadRequest | LocalBadRequest e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
......
...@@ -616,7 +616,7 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform ...@@ -616,7 +616,7 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
// todo 本来FillingEditPermForCurrentUser已赋值但是此业务也使用的key companyType故新赋值key // todo 本来FillingEditPermForCurrentUser已赋值但是此业务也使用的key companyType故新赋值key
re.put("companyType2", CommonServiceImpl.getCompanyType(companyBo)); 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; return re;
} }
...@@ -1872,7 +1872,7 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform ...@@ -1872,7 +1872,7 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
String firstUseOrgCode = (String) eqLists.stream().findFirst().orElseThrow(() -> new BadRequest("设备列表为空,无法获取第一个设备信息")).get("useOrgCode"); String firstUseOrgCode = (String) eqLists.stream().findFirst().orElseThrow(() -> new BadRequest("设备列表为空,无法获取第一个设备信息")).get("useOrgCode");
String firstVin = (String) eqLists.stream().findFirst().orElseThrow(() -> new BadRequest("设备列表为空,无法获取第一个设备信息")).get("vin"); String firstVin = (String) eqLists.stream().findFirst().orElseThrow(() -> new BadRequest("设备列表为空,无法获取第一个设备信息")).get("vin");
boolean isOrgCodeConsistent = useRegistrationCode.equals(firstUseOrgCode); 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; return isSameChargingMedium && isSameVin && isOrgCodeConsistent && isVinConsistent;
}) })
.orElseThrow(() -> new BadRequest("使用登记证号、车辆VIN码与所选设备不一致,请重新选择设备!")); .orElseThrow(() -> new BadRequest("使用登记证号、车辆VIN码与所选设备不一致,请重新选择设备!"));
...@@ -1890,11 +1890,11 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform ...@@ -1890,11 +1890,11 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
.collect(Collectors.toList()) .collect(Collectors.toList())
); );
if (inspectionDetectionInfoList.stream().anyMatch(info -> // if (inspectionDetectionInfoList.stream().anyMatch(info ->
ObjectUtils.isEmpty(info) || ObjectUtils.isEmpty(info.getInspectType()) || // ObjectUtils.isEmpty(info) || ObjectUtils.isEmpty(info.getInspectType()) ||
ObjectUtils.isEmpty(info.getInspectConclusion()) || ObjectUtils.isEmpty(info.getInspectOrgCode()))) { // ObjectUtils.isEmpty(info.getInspectConclusion()) || ObjectUtils.isEmpty(info.getInspectOrgCode()))) {
throw new BadRequest("请补充设备检验检测信息后提交!"); // throw new BadRequest("请补充设备检验检测信息后提交!");
} // }
vehicleInfoDto.setNextInspectionDate(inspectionDetectionInfoList.stream() vehicleInfoDto.setNextInspectionDate(inspectionDetectionInfoList.stream()
.map(IdxBizJgInspectionDetectionInfo::getNextInspectDate) .map(IdxBizJgInspectionDetectionInfo::getNextInspectDate)
...@@ -2008,8 +2008,14 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform ...@@ -2008,8 +2008,14 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
vehicleInformation.setRegDate(new Date()); vehicleInformation.setRegDate(new Date());
vehicleInformation.setCreateUserName(reginParams.getUserModel().getRealName()); vehicleInformation.setCreateUserName(reginParams.getUserModel().getRealName());
vehicleInformation.setGasNum(equipmentLists.size()); vehicleInformation.setGasNum(equipmentLists.size());
BigDecimal totalVolume = equipmentLists.stream() BigDecimal totalVolume = Optional.ofNullable(equipmentLists)
.map(x -> new BigDecimal(String.valueOf(x.get("singleBottleVolume")))) .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); .reduce(BigDecimal.ZERO, BigDecimal::add);
vehicleInformation.setVolume(totalVolume.toPlainString()); vehicleInformation.setVolume(totalVolume.toPlainString());
vehicleInformation.setFillingMedium(equipmentLists.stream() vehicleInformation.setFillingMedium(equipmentLists.stream()
...@@ -2138,7 +2144,10 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform ...@@ -2138,7 +2144,10 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
// 保存关联设备信息 // 保存关联设备信息
jgVehicleInformationEqService.saveBatch(equipList); 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); return Collections.singletonList(vehicleInformation);
} }
......
...@@ -6,9 +6,6 @@ import com.yeejoin.amos.boot.biz.common.annotation.TechnicalParameter; ...@@ -6,9 +6,6 @@ import com.yeejoin.amos.boot.biz.common.annotation.TechnicalParameter;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Getter; import lombok.Getter;
import java.util.HashMap;
import java.util.Map;
@AllArgsConstructor @AllArgsConstructor
@Getter @Getter
public enum ConditionEnum { public enum ConditionEnum {
......
package com.yeejoin.amos.boot.module.statistics.api.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
@AllArgsConstructor
@Getter
public enum StatisticalAnalysisEnum {
/**
* 综合统计分析列表查询设备、企业、人员ES索引
*/
company("企业", "company", "idx_biz_enterprise_info"),
person("人员", "person", "idx_biz_user_info"),
equip("设备", "equip", "idx_biz_equipment_info");
private String name;
private String code;
private String key;
}
...@@ -28,7 +28,7 @@ import java.util.Map; ...@@ -28,7 +28,7 @@ import java.util.Map;
public class ComprehensiveStatisticalAnalysisController extends BaseController { public class ComprehensiveStatisticalAnalysisController extends BaseController {
@Autowired @Autowired
private ComprehensiveStatisticalAnalysisServiceImpl comprehensiveStatisticalAnalysisServiceImpl; private ComprehensiveStatisticalAnalysisServiceImpl statisticalAnalysisService;
/** /**
* 查询设备分类 * 查询设备分类
...@@ -41,8 +41,9 @@ public class ComprehensiveStatisticalAnalysisController extends BaseController { ...@@ -41,8 +41,9 @@ public class ComprehensiveStatisticalAnalysisController extends BaseController {
@ApiOperation(httpMethod = "POST", value = "查询设备分类", notes = "查询设备分类") @ApiOperation(httpMethod = "POST", value = "查询设备分类", notes = "查询设备分类")
public ResponseModel<List<Map<String, Object>>> queryEquipmentCategory(@RequestBody JSONObject category) { public ResponseModel<List<Map<String, Object>>> queryEquipmentCategory(@RequestBody JSONObject category) {
String key = category.getString("key") == null ? null : category.getString("key"); String key = category.getString("key") == null ? null : category.getString("key");
return ResponseHelper.buildResponse(comprehensiveStatisticalAnalysisServiceImpl.queryEquipmentCategory(key)); return ResponseHelper.buildResponse(statisticalAnalysisService.queryEquipmentCategory(key));
} }
/** /**
* @param jsonObject * @param jsonObject
* @return * @return
...@@ -50,10 +51,10 @@ public class ComprehensiveStatisticalAnalysisController extends BaseController { ...@@ -50,10 +51,10 @@ public class ComprehensiveStatisticalAnalysisController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/select/queryEquipmentSearchData") @PostMapping(value = "/select/queryEquipmentSearchData")
@ApiOperation(httpMethod = "POST", value = "查询设备查询条件", notes = "查询设备查询条件") @ApiOperation(httpMethod = "POST", value = "查询设备查询条件", notes = "查询设备查询条件")
public ResponseModel<JSONObject> queryEquipmentSearchData(@RequestBody JSONObject jsonObject){ public ResponseModel<JSONObject> queryEquipmentSearchData(@RequestBody JSONObject jsonObject) {
return ResponseHelper.buildResponse(comprehensiveStatisticalAnalysisServiceImpl.queryEquipmentSearchData(jsonObject.getString("value"))); return ResponseHelper.buildResponse(statisticalAnalysisService.queryEquipmentSearchData(jsonObject.getString("value")));
} }
/** /**
* @param * @param
* @return * @return
...@@ -61,7 +62,23 @@ public class ComprehensiveStatisticalAnalysisController extends BaseController { ...@@ -61,7 +62,23 @@ public class ComprehensiveStatisticalAnalysisController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/select/queryAdvancedSearch") @GetMapping(value = "/select/queryAdvancedSearch")
@ApiOperation(httpMethod = "GET", value = "查询高级筛选", notes = "查询高级筛选") @ApiOperation(httpMethod = "GET", value = "查询高级筛选", notes = "查询高级筛选")
public ResponseModel<JSONArray> query(){ public ResponseModel<JSONArray> query() {
return ResponseHelper.buildResponse(comprehensiveStatisticalAnalysisServiceImpl.queryAdvancedSearch()); return ResponseHelper.buildResponse(statisticalAnalysisService.queryAdvancedSearch());
}
/**
* 综合统计分析接口分页查询
*
* @param map
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/page")
@ApiOperation(httpMethod = "POST", value = "综合统计分析接口分页查询", notes = "综合统计分析接口分页查询")
public ResponseModel<JSONObject> queryForPage(@RequestBody Map<String, Object> map) {
JSONObject jsonObject = new JSONObject(map);
return ResponseHelper.buildResponse(statisticalAnalysisService.queryForPage(jsonObject));
} }
} }
...@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.statistcs.biz.service.impl; ...@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.statistcs.biz.service.impl;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.annotation.TechnicalParameter; import com.yeejoin.amos.boot.biz.common.annotation.TechnicalParameter;
import com.yeejoin.amos.boot.biz.common.entity.DataDictionary; import com.yeejoin.amos.boot.biz.common.entity.DataDictionary;
import com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl; import com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl;
...@@ -10,21 +11,32 @@ import com.yeejoin.amos.boot.module.common.biz.utils.TechParamUtil; ...@@ -10,21 +11,32 @@ import com.yeejoin.amos.boot.module.common.biz.utils.TechParamUtil;
import com.yeejoin.amos.boot.module.statistcs.biz.utils.JsonUtils; import com.yeejoin.amos.boot.module.statistcs.biz.utils.JsonUtils;
import com.yeejoin.amos.boot.module.statistics.api.enums.AdvanceSearchEnum; import com.yeejoin.amos.boot.module.statistics.api.enums.AdvanceSearchEnum;
import com.yeejoin.amos.boot.module.statistics.api.enums.ConditionEnum; import com.yeejoin.amos.boot.module.statistics.api.enums.ConditionEnum;
import com.yeejoin.amos.boot.module.statistics.api.enums.StatisticalAnalysisEnum;
import com.yeejoin.amos.boot.module.statistics.api.mapper.TzsCustomFilterMapper; import com.yeejoin.amos.boot.module.statistics.api.mapper.TzsCustomFilterMapper;
import com.yeejoin.amos.boot.module.ymt.api.enums.EquipmentClassifityEnum; import com.yeejoin.amos.boot.module.ymt.api.enums.EquipmentClassifityEnum;
import com.yeejoin.amos.component.feign.utils.FeignUtil; import lombok.RequiredArgsConstructor;
import com.yeejoin.amos.feign.systemctl.Systemctl; import lombok.extern.slf4j.Slf4j;
import com.yeejoin.amos.feign.systemctl.model.DictionarieModel; import org.elasticsearch.action.search.SearchRequest;
import com.yeejoin.amos.feign.systemctl.model.DictionarieValueModel; 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.index.query.TermsQueryBuilder;
import org.elasticsearch.search.SearchHit;
import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.elasticsearch.search.sort.SortOrder;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.Resource; import org.springframework.core.io.Resource;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import java.util.ArrayList; import java.io.IOException;
import java.util.List; import java.time.LocalDate;
import java.util.Map; import java.time.format.DateTimeFormatter;
import java.util.*;
/** /**
* 综合统计分析服务实现类 * 综合统计分析服务实现类
...@@ -33,8 +45,12 @@ import java.util.Map; ...@@ -33,8 +45,12 @@ import java.util.Map;
* @date 2025-06-24 * @date 2025-06-24
*/ */
@Service @Service
@Slf4j
@RequiredArgsConstructor
public class ComprehensiveStatisticalAnalysisServiceImpl { public class ComprehensiveStatisticalAnalysisServiceImpl {
final static String EQU_LIST = "EQU_LIST";
@Value("classpath:/json/equipCategory.json") @Value("classpath:/json/equipCategory.json")
private Resource equipCategory; private Resource equipCategory;
...@@ -43,6 +59,10 @@ public class ComprehensiveStatisticalAnalysisServiceImpl { ...@@ -43,6 +59,10 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
@Autowired @Autowired
private DataDictionaryServiceImpl dataDictionaryService; private DataDictionaryServiceImpl dataDictionaryService;
private final RestHighLevelClient restHighLevelClient;
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
public List<Map<String, Object>> queryEquipmentCategory(String key) { public List<Map<String, Object>> queryEquipmentCategory(String key) {
List<Map<String, Object>> list; List<Map<String, Object>> list;
Map<String, List<Map<String, Object>>> resourceJson = JsonUtils.getResourceJson(equipCategory); Map<String, List<Map<String, Object>>> resourceJson = JsonUtils.getResourceJson(equipCategory);
...@@ -58,30 +78,30 @@ public class ComprehensiveStatisticalAnalysisServiceImpl { ...@@ -58,30 +78,30 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
public JSONObject queryEquipmentSearchData(String value) { public JSONObject queryEquipmentSearchData(String value) {
List<TechParamItem> paramMetaList = TechParamUtil.getParamMetaList(value); List<TechParamItem> paramMetaList = TechParamUtil.getParamMetaList(value);
ArrayList<JSONObject> list = new ArrayList<>(); ArrayList<JSONObject> list = new ArrayList<>();
for(int i= 0;i< paramMetaList.size();i++){ for (int i = 0; i < paramMetaList.size(); i++) {
JSONObject object = new JSONObject(); JSONObject object = new JSONObject();
object.put("key",paramMetaList.get(i).getParamKey()); object.put("key", paramMetaList.get(i).getParamKey());
object.put("value",paramMetaList.get(i).getParamKey()); object.put("value", paramMetaList.get(i).getParamKey());
object.put("label",paramMetaList.get(i).getParamLabel()); object.put("label", paramMetaList.get(i).getParamLabel());
object.put("unit",paramMetaList.get(i).getUnit()); object.put("unit", paramMetaList.get(i).getUnit());
JSONObject skillConfig = new JSONObject(); JSONObject skillConfig = new JSONObject();
skillConfig.put("conditions",getConditionList(paramMetaList.get(i).getParamType(),paramMetaList.get(i).getDictCode())); skillConfig.put("conditions", getConditionList(paramMetaList.get(i).getParamType(), paramMetaList.get(i).getDictCode()));
if(!ValidationUtil.isEmpty(paramMetaList.get(i).getDictCode())){ if (!ValidationUtil.isEmpty(paramMetaList.get(i).getDictCode())) {
skillConfig.put("type","select"); skillConfig.put("type", "select");
skillConfig.put("data",getData(paramMetaList.get(i).getDictCode())); skillConfig.put("data", getData(paramMetaList.get(i).getDictCode()));
}else if(TechnicalParameter.ParamType.BIG_DECIMAL.equals(paramMetaList.get(i).getParamType())){ } else if (TechnicalParameter.ParamType.BIG_DECIMAL.equals(paramMetaList.get(i).getParamType())) {
skillConfig.put("type","inputNumber"); skillConfig.put("type", "inputNumber");
}else if(TechnicalParameter.ParamType.STRING.equals(paramMetaList.get(i).getParamType())){ } else if (TechnicalParameter.ParamType.STRING.equals(paramMetaList.get(i).getParamType())) {
skillConfig.put("type","input"); skillConfig.put("type", "input");
}else if(TechnicalParameter.ParamType.DATE.equals(paramMetaList.get(i).getParamType())){ } else if (TechnicalParameter.ParamType.DATE.equals(paramMetaList.get(i).getParamType())) {
skillConfig.put("type","date"); skillConfig.put("type", "date");
} }
skillConfig.put("isMulti",false); skillConfig.put("isMulti", false);
object.put("skillConfig",skillConfig); object.put("skillConfig", skillConfig);
list.add(object); list.add(object);
} }
JSONObject result = new JSONObject(); JSONObject result = new JSONObject();
result.put("techParam",list); result.put("techParam", list);
return result; return result;
} }
...@@ -94,15 +114,283 @@ public class ComprehensiveStatisticalAnalysisServiceImpl { ...@@ -94,15 +114,283 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
object.put("label", dictionary.getName()); object.put("label", dictionary.getName());
object.put("value", dictionary.getCode()); object.put("value", dictionary.getCode());
jsonArray.add(object); jsonArray.add(object);
} }
return jsonArray; return jsonArray;
} }
private JSONArray getConditionList(TechnicalParameter.ParamType value,String dictCode) { private JSONArray getConditionList(TechnicalParameter.ParamType value, String dictCode) {
return ConditionEnum.getByCode(ValidationUtil.isEmpty(dictCode) ? value : null); return ConditionEnum.getByCode(ValidationUtil.isEmpty(dictCode) ? value : null);
} }
public JSONArray queryAdvancedSearch() { public JSONArray queryAdvancedSearch() {
JSONArray all = AdvanceSearchEnum.getAll(); JSONArray all = AdvanceSearchEnum.getAll();
return all; return all;
} }
public JSONObject queryForPage(JSONObject filter) {
JSONObject result = new JSONObject();
Integer current = ObjectUtils.isEmpty(filter.getInteger("current")) ? 1 : filter.getInteger("current");
Integer size = ObjectUtils.isEmpty(filter.getInteger("pageSize")) ? 20 : filter.getInteger("pageSize");
Page<JSONObject> page = new Page<>(current, size);
String businessType = filter.getString("businessType");
if (ObjectUtils.isEmpty(businessType)) {
JSONObject statics = new JSONObject();
statics.put("totalCount", null);
result.put("statics", statics);
page.setRecords(new ArrayList<>());
page.setTotal(0);
result.put("pageData", page);
return result;
}
if (StatisticalAnalysisEnum.equip.getCode().equals(businessType)) {
result = queryEquipmentPage(filter, page, current, size);
} else if (StatisticalAnalysisEnum.company.getCode().equals(businessType)) {
result = queryCompanyPage(filter, page, current, size);
} else {
result = queryPersonPage(filter, page, current, size);
}
return result;
}
private JSONObject queryPersonPage(JSONObject filter, Page<JSONObject> page, Integer current, Integer size) {
JSONObject result = new JSONObject();
SearchRequest request = new SearchRequest();
request.indices(StatisticalAnalysisEnum.person.getKey());
SearchSourceBuilder builder = new SearchSourceBuilder();
builder.trackTotalHits(true);
BoolQueryBuilder boolMust = QueryBuilders.boolQuery();
// 排序
if (!ObjectUtils.isEmpty(filter.get("sort"))) {
JSONObject sort = JSONObject.parseObject(JSONObject.toJSONString(filter.get("sort")));
builder.sort(sort.getString("field"), sort.getString("order").equals("desc") ? SortOrder.DESC : SortOrder.ASC);
}
builder.query(boolMust);
builder.from((current - 1) * size);
builder.size(size);
request.source(builder);
List<JSONObject> list = new LinkedList<>();
long totle = 0;
try {
SearchResponse response = restHighLevelClient.search(request, RequestOptions.DEFAULT);
for (SearchHit hit : response.getHits().getHits()) {
JSONObject jsonObject = (JSONObject) JSONObject.toJSON(hit);
JSONObject dto = jsonObject.getJSONObject("sourceAsMap");
list.add(dto);
}
totle = Objects.requireNonNull(response.getInternalResponse().hits().getTotalHits()).value;
page.setRecords(list);
page.setTotal(totle);
result.put("pageData", page);
} catch (IOException e) {
throw new RuntimeException(e);
}
List<Map<String, Object>> statics = new ArrayList<>();
Map<String, Object> sum = new HashMap<>();
sum.put("name", "人员总数(人)");
sum.put("value", totle);
statics.add(sum);
result.put("statics", statics);
return result;
}
private JSONObject queryCompanyPage(JSONObject filter, Page<JSONObject> page, Integer current, Integer size) {
JSONObject result = new JSONObject();
SearchRequest request = new SearchRequest();
request.indices(StatisticalAnalysisEnum.company.getKey());
SearchSourceBuilder builder = new SearchSourceBuilder();
builder.trackTotalHits(true);
BoolQueryBuilder boolMust = QueryBuilders.boolQuery();
// 排序
if (!ObjectUtils.isEmpty(filter.get("sort"))) {
JSONObject sort = JSONObject.parseObject(JSONObject.toJSONString(filter.get("sort")));
builder.sort(sort.getString("field"), sort.getString("order").equals("desc") ? SortOrder.DESC : SortOrder.ASC);
}
builder.query(boolMust);
builder.from((current - 1) * size);
builder.size(size);
request.source(builder);
List<JSONObject> list = new LinkedList<>();
long totle = 0;
try {
SearchResponse response = restHighLevelClient.search(request, RequestOptions.DEFAULT);
for (SearchHit hit : response.getHits().getHits()) {
JSONObject jsonObject = (JSONObject) JSONObject.toJSON(hit);
JSONObject dto = jsonObject.getJSONObject("sourceAsMap");
list.add(dto);
}
totle = Objects.requireNonNull(response.getInternalResponse().hits().getTotalHits()).value;
page.setRecords(list);
page.setTotal(totle);
result.put("pageData", page);
} catch (IOException e) {
throw new RuntimeException(e);
}
List<Map<String, Object>> statics = new ArrayList<>();
Map<String, Object> sum = new HashMap<>();
sum.put("name", "企业总数(个)");
sum.put("value", totle);
statics.add(sum);
result.put("statics", statics);
return result;
}
private JSONObject queryEquipmentPage(JSONObject filter, Page<JSONObject> page, Integer current, Integer size) {
JSONObject result = new JSONObject();
SearchRequest request = new SearchRequest();
request.indices(StatisticalAnalysisEnum.equip.getKey());
SearchSourceBuilder builder = new SearchSourceBuilder();
builder.trackTotalHits(true);
BoolQueryBuilder boolMust = QueryBuilders.boolQuery();
// 筛选
if (!ObjectUtils.isEmpty(filter.get("filterParams"))) {
JSONObject filterParams = JSONObject.parseObject(JSONObject.toJSONString(filter.get("filterParams")));
String filterType = filter.getString("filterType");
if (filterType.equals("advanced")) {
filterParams.forEach((k, v) -> {
if (k.equals("techParam")) {
} else {
if (v instanceof JSONArray) {
if (!((JSONArray) v).contains("all")) {
String field = k;
// todo 所属单位筛选争议,需确认后完成
if (k.equals("NEXT_INSPECT_DATE")) {
String finalField = field;
((JSONArray) v).forEach(item -> {
boolMust.must(QueryBuilders.existsQuery(finalField));
if (item.equals("overdue")) {
// 超期:小于当前日期
boolMust.must(QueryBuilders.rangeQuery(finalField).lt(LocalDate.now().format(formatter)));
} else if (item.equals("near")) {
// 临期:小于等于当前日期加上30天
boolMust.must(QueryBuilders.rangeQuery(finalField).lte(LocalDate.now().plusDays(30).format(formatter)));
} else {
// 正常:大于当前日期加上30天
boolMust.must(QueryBuilders.rangeQuery(finalField).gt(LocalDate.now().plusDays(30).format(formatter)));
}
});
} else if (k.equals("USC_DATE")) {
String finalField = field;
((JSONArray) v).forEach(item -> {
boolMust.must(QueryBuilders.existsQuery(finalField));
if (item.equals("15")) {
// 15年以上:大于当前日期减去15年
boolMust.must(QueryBuilders.rangeQuery(finalField).gt(LocalDate.now().minusYears(15).format(formatter)));
} else if (item.equals("10-15")) {
// 10-15年:小于当前日期减去15年,大于等于当前日期减去10年
boolMust.must(QueryBuilders.rangeQuery(finalField).lt(LocalDate.now().minusYears(15).format(formatter)));
boolMust.must(QueryBuilders.rangeQuery(finalField).gte(LocalDate.now().minusYears(10).format(formatter)));
} else if (item.equals("5-10")) {
// 5-10年:小于当前日期减去10年,大于等于当前日期减去5年
boolMust.must(QueryBuilders.rangeQuery(finalField).lt(LocalDate.now().minusYears(10).format(formatter)));
boolMust.must(QueryBuilders.rangeQuery(finalField).gte(LocalDate.now().minusYears(5).format(formatter)));
} else if (item.equals("0-5")) {
// 0-5年:小于当前日期减去5年
boolMust.must(QueryBuilders.rangeQuery(finalField).lt(LocalDate.now().minusYears(5).format(formatter)));
}
});
} else if (k.equals("EQU_LIST") || k.equals("EQU_CATEGORY") || k.equals("EQU_DEFINE") || k.equals("EQU_STATE") || k.equals("DATA_QUALITY_SCORE") || k.equals("DATA_SOURCE")) {
if (k.equals("EQU_LIST")) {
field = "EQU_LIST_CODE";
} else if (k.equals("EQU_CATEGORY")) {
field = "EQU_CATEGORY_CODE";
} else if (k.equals("EQU_DEFINE")) {
field = "EQU_DEFINE_CODE";
}
boolMust.must(QueryBuilders.existsQuery(field));
TermsQueryBuilder termsQuery = QueryBuilders.termsQuery(field, (JSONArray) v);
boolMust.must(termsQuery);
}
}
}
}
});
} else {
}
JSONArray equList = JSONObject.parseArray(JSONObject.toJSONString(filterParams.get(EQU_LIST)));
if (!ObjectUtils.isEmpty(equList)) {
if (equList.contains("8000")) {
// 压力管道长度
Map<String, Object> pipeLong = new HashMap<>();
pipeLong.put("name", "压力管道(千米)");
// todo 调用大屏总览接口获取压力管道长度
pipeLong.put("value", 1000000);
}
if (equList.contains("2000")) {
// 气瓶数量
Map<String, Object> gasTank = new HashMap<>();
gasTank.put("name", "气瓶(个)");
// todo 调用大屏总览接口获取气瓶数量
gasTank.put("value", 1000000);
}
}
}
// 排序
if (!ObjectUtils.isEmpty(filter.get("sort"))) {
JSONObject sort = JSONObject.parseObject(JSONObject.toJSONString(filter.get("sort")));
builder.sort(sort.getString("field"), sort.getString("order").equals("desc") ? SortOrder.DESC : SortOrder.ASC);
}
builder.query(boolMust);
// builder.sort("REC_DATE", SortOrder.DESC);
builder.from((current - 1) * size);
builder.size(size);
request.source(builder);
List<JSONObject> list = new LinkedList<>();
long totle = 0;
try {
SearchResponse response = restHighLevelClient.search(request, RequestOptions.DEFAULT);
for (SearchHit hit : response.getHits().getHits()) {
JSONObject jsonObject = (JSONObject) JSONObject.toJSON(hit);
JSONObject dto = jsonObject.getJSONObject("sourceAsMap");
dto.put("record", dto.get("SEQUENCE_NBR"));
dto.put("equipAddress", dto.get("USE_PLACE") + "/" + dto.get("ADDRESS"));
list.add(dto);
}
totle = Objects.requireNonNull(response.getInternalResponse().hits().getTotalHits()).value;
page.setRecords(list);
page.setTotal(totle);
result.put("pageData", page);
} catch (IOException e) {
throw new RuntimeException(e);
}
List<Map<String, Object>> statics = new ArrayList<>();
Map<String, Object> sum = new HashMap<>();
sum.put("name", "设备总数(台套)");
sum.put("value", totle);
statics.add(sum);
result.put("statics", statics);
return result;
}
} }
\ No newline at end of file
...@@ -46,7 +46,8 @@ ...@@ -46,7 +46,8 @@
DATA_SOURCE, DATA_SOURCE,
USE_UNIT_NAME, USE_UNIT_NAME,
USE_DATE, USE_DATE,
DATA_QUALITY_SCORE DATA_QUALITY_SCORE,
IS_FIRST_MERGE as isFirstMerge
FROM FROM
IDX_BIZ_JG_PROJECT_CONTRAPTION ibjpc IDX_BIZ_JG_PROJECT_CONTRAPTION ibjpc
WHERE 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