Commit 7727d145 authored by 刘林's avatar 刘林

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

parents 7f84c1c9 d85613a3
......@@ -104,87 +104,6 @@ public class CylinderController {
@RestEventTrigger(value = "openapiLogEventHandler")
public ResponseModel<String> cylinderFillingInfo(@RequestBody String fillingData) throws Exception {
cylinderService.cylinderFillingHandler(fillingData);
// String token = RequestContext.getToken();
// AgencyUserModel me = Privilege.agencyUserClient.getme().getResult();
// String tokenKey = Redis.genKey(Constant.TOKEN_PREFIX, token);
// BizTokenModel bizTokenModel = (BizTokenModel)this.redisTemplate.opsForValue().get(tokenKey);
//
// JSONObject jsonobject = JSONObject.fromObject(fillingData);
// CylinderFillingDataValidationResultModel validateResult = null;
// CylinderFillingMessage cylinderFillingMessage = new CylinderFillingMessage();
// cylinderFillingMessage.setTime(simpleDateFormat.format(new Date()));
// cylinderFillingMessage.setFillingCompanyName(me.getCompanys().get(0).getCompanyName());
// cylinderFillingMessage.setAppId(bizTokenModel.getAppId());
// try {
// validateResult = cylinderFillingDataValidationService.validateFilling(jsonobject);
// } catch (Exception e) {
// e.printStackTrace();
// logger.error("液化气体气瓶充装信息上报,数据校验失败");
// cylinderFillingMessage.setMessage(e.getMessage());
// }
//
// if (!ObjectUtils.isEmpty(validateResult)) {
// cylinderFillingMessage.setCylinderNumber(validateResult.getCylinderNumber());
// List<String> message = new ArrayList<>();
// Integer errorNumber = 0;
// JSONObject error = new JSONObject();
// if (!ObjectUtils.isEmpty(validateResult.getBeforeErrorData())) {
// errorNumber += validateResult.getBeforeErrorData().size();
// error.put("充装前检查错误数据:", validateResult.getBeforeErrorData());
// message.add("充装前检查数据异常气瓶数:" + validateResult.getBeforeErrorCylinderNumber());
// }
//
// if (!ObjectUtils.isEmpty(validateResult.getRecordErrorData())) {
// errorNumber += validateResult.getRecordErrorData().size();
// error.put("填充错误数据:", validateResult.getRecordErrorData());
// message.add("充装记录数据异常气瓶数:" + validateResult.getRecordErrorCylinderNumber());
// }
//
// if (!ObjectUtils.isEmpty(validateResult.getAfterErrorData())) {
// errorNumber += validateResult.getAfterErrorData().size();
// error.put("充装后错误数据:", validateResult.getAfterErrorData());
// message.add("充装后复查数据异常气瓶数:" + validateResult.getAfterErrorCylinderNumber());
// }
//
// if (!org.springframework.util.ObjectUtils.isEmpty(validateResult.getSeqCodeErrorData())) {
// errorNumber += validateResult.getSeqCodeErrorData().size();
// error.put("气瓶信息不存在:", validateResult.getSeqCodeErrorData());
// message.add("气瓶信息不存在数量:" + validateResult.getSeqCodeErrorData().size());
// }
//
// if (errorNumber <= 0) {
// message.add("液化气体气瓶充装信息成功数:" + validateResult.getSuccessCylinderNumber() + "条");
// } else {
// cylinderFillingMessage.setMessage(String.join("条; ", message) + "个");
// CylinderFillingMessageModel cylinderFillingMessageModel = new CylinderFillingMessageModel();
// BeanUtils.copyProperties(cylinderFillingMessage, cylinderFillingMessageModel);
// cylinderFillingMessageService.createWithModel(cylinderFillingMessageModel);
// emqKeeper.getMqttClient().publish("openapi/cylinder/filling", JSONObject.fromObject(cylinderFillingMessage).toString().getBytes(), 2, false);
//
// throw new BadRequest(error.toString());
// }
// } else {
// throw new BadRequest("数据校验失败!!!");
// }
//
// TmCylinderFillingModelList cylinderFillingModelList = com.alibaba.fastjson.JSONObject.parseObject(fillingData, TmCylinderFillingModelList.class);
//
// List<TmCylinderFillingModel> fillingBeforeList = cylinderFillingModelList.getFillingBefore();
// List<TmCylinderFillingRecordModel> fillingList = cylinderFillingModelList.getFilling();
// List<TmCylinderFillingCheckModel> fillingAfterList = cylinderFillingModelList.getFillingAfter();
// if (ValidationUtil.isEmpty(fillingBeforeList) && ValidationUtil.isEmpty(fillingList) && ValidationUtil.isEmpty(fillingAfterList)) {
// throw new BadRequest("液化气体气瓶充装信息-充装前检查信息、液化气体气瓶充装信息-充装记录信息、液化气体气瓶充装信息-充装后复查信息为空.");
// }
// cylinderFillingService.createCylinderFillingBefore(fillingBeforeList);
// cylinderFillingRecordService.createCylinderFilling(fillingList);
// cylinderFillingCheckService.createCylinderFillingAfter(fillingAfterList);
//
// CylinderFillingMessageModel cylinderFillingMessageModel = new CylinderFillingMessageModel();
// BeanUtils.copyProperties(cylinderFillingMessage, cylinderFillingMessageModel);
// cylinderFillingMessageModel.setAppId(bizTokenModel.getAppId());
// cylinderFillingMessageService.createWithModel(cylinderFillingMessageModel);
// emqKeeper.getMqttClient().publish("openapi/cylinder/filling", JSONObject.fromObject(cylinderFillingMessage).toString().getBytes(), 2, false);
// Double a = (double) (1/0);
return ResponseHelper.buildResponse("OK");
}
......
package com.yeejoin.amos.api.openapi.face.service;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.amos.api.openapi.face.model.TmCylinderFillingExamineModel;
......@@ -94,6 +95,7 @@ public class TmCylinderFillingExamineService extends MyBaseServiceImpl<TmCylinde
}
}
@DS("tzs")
private void syncCylinderFillingExamine(List<TmCylinderFillingExamineModel> model) {
syncCylinderDataService.syncCylinderFillingExamine(model);
}
......
package com.yeejoin.amos.api.openapi.face.service;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.amos.api.openapi.face.model.TmCylinderOffloadingModel;
......@@ -70,6 +71,7 @@ public class TmCylinderOffloadingService extends MyBaseServiceImpl<TmCylinderOff
* 同步气站信息至气瓶服务
* @param model
*/
@DS("tzs")
private void syncCylinderOffloadingModel(List<TmCylinderOffloadingModel> model) {
syncCylinderDataService.syncCylinderOffloading(model);
}
......
......@@ -34,10 +34,6 @@ public class DictParamsConverter implements Converter<String> {
dictMap.put("过热器出口集箱", "6006");
dictMap.put("启动分离器", "6007");
dictMap.put("长输管道", "5994");
dictMap.put("磁粉", "5988");
dictMap.put("射线", "5986");
dictMap.put("超声", "5987");
dictMap.put("渗透", "5989");
dictMap.put("A1", "6094");
dictMap.put("A2", "6095");
dictMap.put("A7", "6100");
......
package com.yeejoin.amos.boot.module.jg.api.dto;
import com.alibaba.excel.converters.Converter;
import com.alibaba.excel.enums.CellDataTypeEnum;
import com.alibaba.excel.metadata.CellData;
import com.alibaba.excel.metadata.GlobalConfiguration;
import com.alibaba.excel.metadata.property.ExcelContentProperty;
import java.util.HashMap;
import java.util.Map;
public class InspectConclusionConverter implements Converter<String> {
private static final Map<String, String> dictMap = new HashMap<>();
static {
// 填充映射关系
dictMap.put("合格", "6040");
dictMap.put("不合格", "6041");
dictMap.put("复检合格", "6042");
dictMap.put("复检不合格", "6043");
dictMap.put("整改后合格", "6045");
dictMap.put("符合", "6046");
dictMap.put("不符合", "6047");
dictMap.put("符合要求", "6048");
dictMap.put("基本符合要求", "6049");
dictMap.put("不符合要求", "6050");
dictMap.put("允许使用", "6051");
dictMap.put("降压使用", "6052");
dictMap.put("进行合于使用评价", "6053");
dictMap.put("其他", "6044");
}
@Override
public Class<?> supportJavaTypeKey() {
// 实体类中对象属性类型
return String.class;
}
@Override
public CellDataTypeEnum supportExcelTypeKey() {
return CellDataTypeEnum.STRING;
}
@Override
public String convertToJavaData(CellData cellData, ExcelContentProperty excelContentProperty,
GlobalConfiguration globalConfiguration) {
// 从Cell中读取数据
String cellValue = cellData.getStringValue();
// 判断Excel中的值,将其转换为预期的数值
return dictMap.getOrDefault(cellValue, null);
}
@Override
public CellData convertToExcelData(String o, ExcelContentProperty excelContentProperty, GlobalConfiguration globalConfiguration) throws Exception {
return new CellData("");
}
}
\ No newline at end of file
package com.yeejoin.amos.boot.module.jg.api.dto;
import com.alibaba.excel.converters.Converter;
import com.alibaba.excel.enums.CellDataTypeEnum;
import com.alibaba.excel.metadata.CellData;
import com.alibaba.excel.metadata.GlobalConfiguration;
import com.alibaba.excel.metadata.property.ExcelContentProperty;
import java.util.HashMap;
import java.util.Map;
public class InspectTypeConverter implements Converter<String> {
private static final Map<String, String> dictMap = new HashMap<>();
static {
// 填充映射关系
dictMap.put("定期检验", "DQJY");
dictMap.put("首次检验", "SCJY");
dictMap.put("安装监督检验", "AZJDJY");
dictMap.put("改造监督检验", "GZJDJY");
dictMap.put("维修监督检验", "WXJDJY");
dictMap.put("制造监督检验", "ZZJDJY");
}
@Override
public Class<?> supportJavaTypeKey() {
// 实体类中对象属性类型
return String.class;
}
@Override
public CellDataTypeEnum supportExcelTypeKey() {
return CellDataTypeEnum.STRING;
}
@Override
public String convertToJavaData(CellData cellData, ExcelContentProperty excelContentProperty,
GlobalConfiguration globalConfiguration) {
// 从Cell中读取数据
String cellValue = cellData.getStringValue();
// 判断Excel中的值,将其转换为预期的数值
return dictMap.getOrDefault(cellValue, null);
}
@Override
public CellData convertToExcelData(String o, ExcelContentProperty excelContentProperty, GlobalConfiguration globalConfiguration) throws Exception {
return new CellData("");
}
}
\ No newline at end of file
package com.yeejoin.amos.boot.module.jg.api.dto;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
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;
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "管道-设备信息", description = "管道-设备信息")
public class PipingExcelDto extends BaseDto {
@ExcelIgnore
private static final long serialVersionUID = 1L;
//----------------------------------------------------------------------基本信息
@ApiModelProperty(value = "设备种类")
@ExcelIgnore
private String equList;
@ApiModelProperty(value = "设备类别")
@ExcelIgnore
private String equCategory;
@ApiModelProperty(value = "设备品种")
@ExcelIgnore
private String equDefine;
@ApiModelProperty(value = "单位内编号")
@ExcelProperty(value = "单位内编号")
private String useInnerCode;
@ApiModelProperty(value = "产品名称")
@ExcelProperty(value = "产品名称")
private String productName;
@ApiModelProperty(value = "管道名称(登记单元)")
@ExcelProperty(value = "管道名称(登记单元)")
private String pipeName;
@ApiModelProperty(value = "设备型号")
@ExcelProperty(value = "设备型号")
private String equType;
@ApiModelProperty(value = "设备总价值(万元)")
@ExcelProperty(value = "设备总价值(万元)")
private String equPrice;
@ApiModelProperty(value = "有无设备代码")
@ExcelProperty(value = "有无设备代码")
private String equCodeType;
@ApiModelProperty(value = "设备代码")
@ExcelProperty(value = "设备代码")
private String equCode;
@ApiModelProperty(value = "工程(装置)名称")
@ExcelProperty(value = "工程(装置)名称")
private String projectContraption;
@ApiModelProperty(value = "工程(装置)编号")
@ExcelProperty(value = "工程(装置)编号")
private String projectContraptionNo;
@ApiModelProperty(value = "使用登记证编号")
@ExcelProperty(value = "使用登记证编号")
private String useOrgCode;
//-----------------------------------------------------------------------使用信息
@ApiModelProperty(value = "使用单位统一社会信用代码")
@ExcelProperty(value = "使用单位统一社会信用代码")
private String useUnitCode;
@ApiModelProperty(value = "使用单位名称")
@ExcelProperty(value = "使用单位名称")
private String useUnit;
//-----------------------------------------------------------------------安装信息
@ApiModelProperty(value = "安装单位统一社会信用代码")
@ExcelProperty(value = "安装单位统一社会信用代码")
private String installUnitCode;
@ApiModelProperty(value = "安装单位名称")
@ExcelProperty(value = "安装单位名称")
private String installUnitName;
//-----------------------------------------------------------------------检验检测信息
@ApiModelProperty(value = "检验检测机构统一社会信用代码")
@ExcelProperty(value = "检验检测机构统一社会信用代码")
private String inspectUnitCode;
@ApiModelProperty(value = "检验检测机构名称")
@ExcelProperty(value = "检验检测机构名称")
private String inspectUnitName;
@ApiModelProperty(value = "检验结论")
@ExcelProperty(value = "检验结论")
private String inspectConclusion;
@ApiModelProperty(value = "检验类型")
@ExcelProperty(value = "检验类型")
private String inspectType;
@ApiModelProperty(value = "检验日期")
@ExcelProperty(value = "检验日期")
private String inspectDate;
@ApiModelProperty(value = "检验人员名称")
@ExcelProperty(value = "检验人员名称")
private String inspectPersonName;
@ApiModelProperty(value = "下次检验日期")
@ExcelProperty(value = "下次检验日期")
private String nextInspectDate;
@ApiModelProperty(value = "检验报告编号")
@ExcelProperty(value = "检验报告编号")
private String inspectReportCode;
//-----------------------------------------------------------------------设计信息
@ApiModelProperty(value = "设计单位统一社会信用代码")
@ExcelProperty(value = "设计单位统一社会信用代码")
private String designUnitCreditCode;
@ApiModelProperty(value = "设计单位名称")
@ExcelProperty(value = "设计单位名称")
private String designUnitName;
//--------------------------------------------------------------------压力管道----技术参数
@ExcelProperty(value = "管道类别")
@ApiModelProperty(value = "管道类别")
private String pipelineClass;
@ExcelProperty(value = "公称壁厚(mm)")
@ApiModelProperty(value = "公称壁厚(mm)")
private String wallThickness;
@ExcelProperty(value = "公称直径(mm)")
@ApiModelProperty(value = "公称直径(mm)")
private String nominalDiameter;
@ExcelProperty(value = "管道长度(m)")
@ApiModelProperty(value = "管道长度(m)")
private String pipeLength;
@ExcelProperty(value = "设计-压力(MPa)")
@ApiModelProperty(value = "设计-压力(MPa)")
private String pressure;
@ExcelProperty(value = "设计-介质")
@ApiModelProperty(value = "设计-介质")
private String medium;
@ExcelProperty(value = "起/始位置 (经纬度)(格式:经度-纬度)")
@ApiModelProperty(value = "起/始位置 (经纬度)(格式:经度-纬度)")
private String startePosition;
@ExcelProperty(value = "设计-温度(℃)")
@ApiModelProperty(value = "设计-温度(℃)")
private String temperature;
@ExcelProperty(value = "管道编号")
@ApiModelProperty(value = "管道编号")
private String pipelineNumber;
@ExcelProperty(value = "管道级别")
@ApiModelProperty(value = "管道级别")
private String deviceLevel;
@ExcelProperty(value = "工作条件-压力(MPa)")
@ApiModelProperty(value = "工作条件-压力(MPa)")
private String workPressure;
@ExcelProperty(value = "工作条件-温度(℃)")
@ApiModelProperty(value = "工作条件-温度(℃)")
private String workTemperature;
@ExcelProperty(value = "工作条件-介质")
@ApiModelProperty(value = "工作条件-介质")
private String workMedium;
@ExcelProperty(value = "备注")
@ApiModelProperty(value = "备注")
private String remarks;
}
\ No newline at end of file
......@@ -13,7 +13,9 @@ public enum PipelineEnum {
PRESSURE_PIPELINE("压力管道", "8000"),
INDUSTRIAL_PIPELINE("工业管道", "8300");
INDUSTRIAL_PIPELINE("工业管道", "8300"),
LONG_DISTANCE_PIPELINE("长输管道", "8100"),
COMMON_PIPELINE("公用管道", "8200");
private final String name;
......
......@@ -7,6 +7,7 @@ import org.apache.commons.io.FilenameUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.typroject.tyboot.component.event.RestEventTrigger;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
......@@ -58,32 +59,38 @@ public class DataDockController {
return ResponseHelper.buildResponse(dataDockService.dataCheckAndImportEquipmentData(remark, file));
}
// @TycloudOperation(ApiLevel = UserType.AGENCY)
// @PostMapping(value = "/delete")
// @ApiOperation(httpMethod = "POST", value = "八大类历史设备导入shanchu", notes = "八大类历史设备导入shachu")
// public Object importData() {
// dataDockService.delete();
// return ResponseHelper.buildResponse("ok");
// }
/**
* 工业管道批量检查
**/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/checkGYGDData")
@ApiOperation(httpMethod = "POST", value = "工业管道批量检查", notes = "工业管道批量检查")
@RestEventTrigger(value = "operateLogRestEventHandler")
public ResponseModel<?> checkGYGDData(@RequestPart("file") MultipartFile multipartFile) throws Exception {
return ResponseHelper.buildResponse(dataDockService.checkGDData(multipartFile, true));
}
/**
* 工业 、公用、长输管道批量保存
**/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/savePipingData")
@ApiOperation(httpMethod = "POST", value = "工业管道批量保存", notes = "工业管道批量保存")
@RestEventTrigger(value = "operateLogRestEventHandler")
public ResponseModel<?> savePipingData(@RequestBody Map<String, Object> paramMap) {
return ResponseHelper.buildResponse(dataDockService.savePipingData(paramMap));
}
/**
* 公用、长输道批量检查
**/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/checkGYCSGDData")
@ApiOperation(httpMethod = "POST", value = "公用、长输管道批量检查", notes = "公用、长输管道批量检查")
@RestEventTrigger(value = "operateLogRestEventHandler")
public ResponseModel<?> checkGYCSGDData(@RequestPart("file") MultipartFile multipartFile) throws Exception {
return ResponseHelper.buildResponse(dataDockService.checkGDData(multipartFile, false));
}
// @TycloudOperation(ApiLevel = UserType.AGENCY)
// @GetMapping(value = "/yanChang/ORG_BRANCH_CODE")
// @ApiOperation(httpMethod = "get", value = "延炼-延长-刷入属地监管部门", notes = "延炼-延长-刷入属地监管部门")
// public Object writeOrgBranchCode2YanChang(@RequestParam String remark) {
// if (ValidationUtil.isEmpty(remark)) {
// throw new BadRequest("remark必填!");
// }
// return ResponseHelper.buildResponse("更新成功,共" + dataDockService.writeOrgBranchCode2YanChang(remark) + "条数据");
// }
//
// @TycloudOperation(ApiLevel = UserType.AGENCY)
// @GetMapping(value = "/yanChang/USE_PLACE")
// @ApiOperation(httpMethod = "get", value = "延炼-延长-刷入所属区域", notes = "延炼-延长-刷入所属区域")
// public Object writeUsePlace2YanChang(@RequestParam String remark) {
// if (ValidationUtil.isEmpty(remark)) {
// throw new BadRequest("remark必填!");
// }
// return ResponseHelper.buildResponse("更新成功,共" + dataDockService.writeUsePlace2YanChang(remark) + "条数据");
// }
}
......@@ -6,9 +6,11 @@ import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.jg.biz.service.impl.IdxBizJgProjectContraptionServiceImpl;
import com.yeejoin.amos.boot.module.ymt.api.dto.IdxBizJgProjectContraptionDto;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgInspectionDetectionInfo;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgProjectContraption;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
......@@ -16,6 +18,9 @@ import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
......@@ -97,6 +102,7 @@ public class IdxBizJgProjectContraptionController extends BaseController {
return ResponseHelper.buildResponse(idxBizJgProjectContraptionServiceImpl.proConPageByParams(params, page, reginParams));
}
/**
* 根据入参 列表查询(当前)单位下的工程管道
*
......@@ -127,6 +133,70 @@ public class IdxBizJgProjectContraptionController extends BaseController {
}
/**
* 根据sequenceNbr分页查询管道信息
*
* @param sequenceNbr
* @param current 当前页
* @param size 大小
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/techParamsPipelinePage")
@ApiOperation(httpMethod = "GET",value = "根据sequenceNbr查询管道信息", notes = "管道工程装置表分页查询")
public ResponseModel <Page<Map<String, Object>>> techParamsPipelinePage(@RequestParam("sequenceNbr") String sequenceNbr,
@RequestParam(value = "current") int current,
@RequestParam(value = "size") int size) {
return ResponseHelper.buildResponse(idxBizJgProjectContraptionServiceImpl.techParamsPipelinePage(sequenceNbr,current,size));
}
/**
* 新增或者更新检验信息
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/saveOrUpdateDetectionInfo")
@ApiOperation(httpMethod = "POST", value = "新增或者更新检验信息", notes = "新增或者更新检验信息")
public ResponseModel<?> saveOrUpdateDetectionInfo(@RequestBody IdxBizJgInspectionDetectionInfo detectionInfo) {
idxBizJgProjectContraptionServiceImpl.saveOrUpdateDetectionInfo(detectionInfo);
return ResponseHelper.buildResponse("更新成功");
}
/**
* 新增或者更新检验信息批量
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/saveOrUpdateDetectionInfoBatch")
@ApiOperation(httpMethod = "POST", value = "新增或者更新检验信息", notes = "新增或者更新检验信息")
public ResponseModel<?> saveOrUpdateDetectionInfoBatch(@RequestBody List<IdxBizJgInspectionDetectionInfo> detectionInfos) {
idxBizJgProjectContraptionServiceImpl.saveOrUpdateDetectionInfoBatch(detectionInfos);
return ResponseHelper.buildResponse("更新成功");
}
/**
* 获取检验信息详情
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getDetectionInfoDetail")
@ApiOperation(httpMethod = "GET", value = "获取检验信息详情", notes = "获取检验信息详情")
public ResponseModel<IdxBizJgInspectionDetectionInfo> getDetectionInfoDetail(@RequestParam("sequenceNbr") String sequenceNbr) {
return ResponseHelper.buildResponse(idxBizJgProjectContraptionServiceImpl.getDetectionInfoDetail(sequenceNbr));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/summaryBasicInfo/export")
@ApiOperation(httpMethod = "GET", value = "导出基本信息汇总表(长输/公用管道)", notes = "导出基本信息汇总表(长输/公用管道)")
public void exportSummaryBasicInfo(HttpServletResponse response,
@RequestParam("sequenceNbr") String sequenceNbr,
@RequestParam("category") String category) {
idxBizJgProjectContraptionServiceImpl.exportSummaryBasicInfo(sequenceNbr, response, category);
}
/**
* 列表分页查询
*
* @param current 当前页
......@@ -144,6 +214,7 @@ public class IdxBizJgProjectContraptionController extends BaseController {
return ResponseHelper.buildResponse(idxBizJgProjectContraptionServiceImpl.queryForIdxBizJgProjectContraptionPage(page));
}
/**
* 列表全部数据查询
*
......@@ -155,4 +226,5 @@ public class IdxBizJgProjectContraptionController extends BaseController {
public ResponseModel<List<IdxBizJgProjectContraptionDto>> selectForList() {
return ResponseHelper.buildResponse(idxBizJgProjectContraptionServiceImpl.queryForIdxBizJgProjectContraptionList());
}
}
......@@ -7,8 +7,12 @@ import com.alibaba.excel.event.AnalysisEventListener;
import com.alibaba.excel.read.metadata.ReadSheet;
import com.alibaba.excel.read.metadata.holder.ReadRowHolder;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
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.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.biz.common.utils.SnowflakeIdUtil;
import com.yeejoin.amos.boot.module.common.api.dao.ESEquipmentCategory;
......@@ -16,6 +20,7 @@ import com.yeejoin.amos.boot.module.common.api.dto.ESEquipmentCategoryDto;
import com.yeejoin.amos.boot.module.jg.api.converter.EquCategoryConverter;
import com.yeejoin.amos.boot.module.jg.api.converter.EquDefineConverter;
import com.yeejoin.amos.boot.module.jg.api.dto.EquipInfoExcelDto;
import com.yeejoin.amos.boot.module.jg.api.dto.PipingExcelDto;
import com.yeejoin.amos.boot.module.jg.biz.feign.TzsServiceFeignClient;
import com.yeejoin.amos.boot.module.jg.biz.service.*;
import com.yeejoin.amos.boot.module.ymt.api.entity.*;
......@@ -34,6 +39,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils;
import org.springframework.web.multipart.MultipartFile;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
......@@ -69,6 +75,7 @@ public class DataDockServiceImpl {
private final IIdxBizJgTechParamsRopewayService iIdxBizJgTechParamsRopewayService;
private final IIdxBizJgTechParamsElevatorService iIdxBizJgTechParamsElevatorService;
private final IdxBizJgProjectContraptionServiceImpl idxBizJgProjectContraptionServiceImpl;
private final IdxBizJgConstructionInfoServiceImpl idxBizJgConstructionInfoService;
private final TzBaseEnterpriseInfoMapper tzBaseEnterpriseInfoMapper;
private final RedisUtils redisUtils;
private final TzsServiceFeignClient tzsServiceFeignClient;
......@@ -123,28 +130,6 @@ public class DataDockServiceImpl {
}
}
// public void delete() {
// List<String> records = idxBizJgUseInfoService.lambdaQuery().select(IdxBizJgUseInfo::getRecord).likeRight(IdxBizJgUseInfo::getRemark, "延炼").list()
// .stream().map(IdxBizJgUseInfo::getRecord).collect(Collectors.toList());
//
//
// // saveProjectContraption(equ, equList);
// idxBizJgUseInfoService.getBaseMapper().delete(new LambdaQueryWrapper<IdxBizJgUseInfo>().in(IdxBizJgUseInfo::getRecord, records));
// idxBizJgDesignInfoService.getBaseMapper().delete(new LambdaQueryWrapper<IdxBizJgDesignInfo>().in(IdxBizJgDesignInfo::getRecord, records));
// idxBizJgFactoryInfoService.getBaseMapper().delete(new LambdaQueryWrapper<IdxBizJgFactoryInfo>().in(IdxBizJgFactoryInfo::getRecord, records));
// idxBizJgRegisterInfoServiceImpl.getBaseMapper().delete(new LambdaQueryWrapper<IdxBizJgRegisterInfo>().in(IdxBizJgRegisterInfo::getRecord, records));
// idxBizJgSupervisionInfoService.getBaseMapper().delete(new LambdaQueryWrapper<IdxBizJgSupervisionInfo>().in(IdxBizJgSupervisionInfo::getRecord, records));
// iIdxBizJgTechParamsLiftingService.getBaseMapper().delete(new LambdaQueryWrapper<IdxBizJgTechParamsLifting>().in(IdxBizJgTechParamsLifting::getRecord, records));
// iIdxBizJgTechParamsVehicleService.getBaseMapper().delete(new LambdaQueryWrapper<IdxBizJgTechParamsVehicle>().in(IdxBizJgTechParamsVehicle::getRecord, records));
// iIdxBizJgTechParamsBoilerService.getBaseMapper().delete(new LambdaQueryWrapper<IdxBizJgTechParamsBoiler>().in(IdxBizJgTechParamsBoiler::getRecord, records));
// iIdxBizJgTechParamsVesselService.getBaseMapper().delete(new LambdaQueryWrapper<IdxBizJgTechParamsVessel>().in(IdxBizJgTechParamsVessel::getRecord, records));
// iIdxBizJgTechParamsPipelineService.getBaseMapper().delete(new LambdaQueryWrapper<IdxBizJgTechParamsPipeline>().in(IdxBizJgTechParamsPipeline::getRecord, records));
// iIdxBizJgTechParamsRidesService.getBaseMapper().delete(new LambdaQueryWrapper<IdxBizJgTechParamsRides>().in(IdxBizJgTechParamsRides::getRecord, records));
// iIdxBizJgTechParamsRopewayService.getBaseMapper().delete(new LambdaQueryWrapper<IdxBizJgTechParamsRopeway>().in(IdxBizJgTechParamsRopeway::getRecord, records));
// iIdxBizJgTechParamsElevatorService.getBaseMapper().delete(new LambdaQueryWrapper<IdxBizJgTechParamsElevator>().in(IdxBizJgTechParamsElevator::getRecord, records));
// records.forEach(record -> this.saveEquInfoToEs(record));
// }
public Integer writeOrgBranchCode2YanChang(String remark) {
List<String> records = idxBizJgUseInfoService.lambdaQuery().select(IdxBizJgUseInfo::getRecord).eq(IdxBizJgUseInfo::getRemark, remark).list().stream().map(IdxBizJgUseInfo::getRecord).collect(Collectors.toList());
......@@ -172,72 +157,6 @@ public class DataDockServiceImpl {
.orElse("");
}
public Integer writeUsePlace2YanChang(String remark) {
List<String> records = idxBizJgUseInfoService.lambdaQuery()
.select(IdxBizJgUseInfo::getRecord)
.eq(IdxBizJgUseInfo::getRemark, remark)
.list()
.stream()
.map(IdxBizJgUseInfo::getRecord)
.collect(Collectors.toList());
if (records.isEmpty()) {
return 0;
}
Optional<String> useUnitCreditCode = idxBizJgUseInfoService.lambdaQuery()
.select(IdxBizJgUseInfo::getUseUnitCreditCode)
.eq(IdxBizJgUseInfo::getRecord, records.get(0))
.list().stream().findFirst().map(IdxBizJgUseInfo::getUseUnitCreditCode);
useUnitCreditCode.ifPresent(useCode -> {
TzBaseEnterpriseInfo enterpriseInfo = tzBaseEnterpriseInfoMapper.selectOne(new LambdaQueryWrapper<TzBaseEnterpriseInfo>()
.eq(TzBaseEnterpriseInfo::getUseUnitCode, useCode));
String provinceName = enterpriseInfo.getProvince();
String provinceCode = "610000";
String cityName = enterpriseInfo.getCity();
String cityCode = "";
if (!ValidationUtil.isEmpty(cityName)) {
cityCode = getRegionCode(cityName, "CITY");
}
String districtName = enterpriseInfo.getDistrict();
String districtCode = "";
if (!ValidationUtil.isEmpty(districtName)) {
districtCode = getRegionCode(districtName, "COUNTY");
}
String usePlace = provinceName + "/" + cityName + "/" + districtName;
String usePlaceCode = provinceCode + "#" + cityCode + "#" + districtCode;
idxBizJgUseInfoService.lambdaUpdate()
.set(IdxBizJgUseInfo::getProvince, provinceCode)
.set(IdxBizJgUseInfo::getProvinceName, provinceName)
.set(IdxBizJgUseInfo::getCity, cityCode)
.set(IdxBizJgUseInfo::getCityName, cityName)
.set(IdxBizJgUseInfo::getCounty, districtCode)
.set(IdxBizJgUseInfo::getCountyName, districtName)
.set(IdxBizJgUseInfo::getStreetName, enterpriseInfo.getStreet())
.set(IdxBizJgUseInfo::getAddress, enterpriseInfo.getAddress())
.set(!ValidationUtil.isEmpty(enterpriseInfo.getLatitude()) && !ValidationUtil.isEmpty(enterpriseInfo.getLongitude()),
IdxBizJgUseInfo::getLongitudeLatitude,
String.format("{\"latitude\":\"%s\",\"longitude\":\"%s\"}", enterpriseInfo.getLatitude(), enterpriseInfo.getLongitude()))
.in(IdxBizJgUseInfo::getRecord, records)
.update();
records.forEach(record -> {
log.error("向{}刷入使用地点信息", record);
HashMap<String, Map<String, Object>> objMap = new HashMap<>();
HashMap<String, Object> param = new HashMap<>();
param.put("USE_PLACE", usePlace);
param.put("USE_PLACE_CODE", usePlaceCode);
objMap.put(record, param);
tzsServiceFeignClient.commonUpdateEsDataByIds(objMap);
});
});
return records.size();
}
/**
* 保存工程装置表信息
*/
......@@ -1054,7 +973,7 @@ public class DataDockServiceImpl {
res = res.substring(0, res.length() - 4) + "0" + res.substring(res.length() - 4);
}
if (!res.matches("\\d{4}-\\d{2}-\\d{2}")) {
if (!res.matches("\\d{4}-\\d{2}-\\d{2}") && !res.matches("\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}")) {
rowError.append(errorMessage);
return null;
}
......@@ -1162,9 +1081,9 @@ public class DataDockServiceImpl {
checkNotBlank(data.getWallThickness_YLGD(), "公称壁厚不能为空;", rowError);
checkNotBlank(data.getNominalDiameter(), "公称直径不能为空;", rowError);
checkNotBlank(data.getPipeLength(), "管道长度不能为空;", rowError);
checkNotBlank(data.getPressure(), "压力不能为空;", rowError);
checkNotBlank(data.getMedium_YLGD(), "介质不能为空;", rowError);
checkNotBlank(data.getTemperature_YLGD(), "温度不能为空;", rowError);
checkNotBlank(data.getPressure(), "设计-压力不能为空;", rowError);
checkNotBlank(data.getMedium_YLGD(), "设计-介质不能为空;", rowError);
checkNotBlank(data.getTemperature_YLGD(), "设计-温度不能为空;", rowError);
checkNotBlank(data.getPipelineNumber(), "管道编号不能为空;", rowError);
checkNotBlank(data.getDeviceLevel_YLGD(), "管道级别不能为空;", rowError);
Optional.ofNullable(data.getStartePosition()).ifPresent(v -> {
......@@ -1172,7 +1091,7 @@ public class DataDockServiceImpl {
rowError.append("起/始位置 (经纬度)格式不正确");
}
});
if (!org.apache.commons.lang3.ObjectUtils.isEmpty(data.getStartePosition()) && data.getStartePosition().split("-").length == 2) {
if (!ObjectUtils.isEmpty(data.getStartePosition()) && data.getStartePosition().split("-").length == 2) {
String[] split = data.getStartePosition().split("-");
data.setStartePosition(String.format("{\"latitude\":%s,\"longitude\":%s}", split[0], split[1]));
}
......@@ -1383,4 +1302,409 @@ public class DataDockServiceImpl {
// }
// }
}
/**
* 检查管道的excel数据格式
*
* @param multipartFile 文件
* @param isGYGD 是否工业管道
* @return 结果集合
* @throws Exception 检测不通过,异常情况描述
*/
public Object checkGDData(MultipartFile multipartFile, Boolean isGYGD) throws Exception {
List<PipingExcelDto> dataList = new ArrayList<>();
List<String> resultGDError = new ArrayList<>();
try {
EasyExcel.read(multipartFile.getInputStream(), PipingExcelDto.class, new AnalysisEventListener<PipingExcelDto>() {
@Override
public void invoke(PipingExcelDto data, AnalysisContext context) {
resultGDError.add(checkGDExcelData(data, context, isGYGD).toString());
dataList.add(data);
}
@Override
public void doAfterAllAnalysed(AnalysisContext context) {
if (CollectionUtils.isEmpty(dataList)) {
log.info("你上传了一个空数据的Excel文档!");
resultGDError.add("你上传了一个空数据的Excel文档!");
throw new BadRequest("你上传了一个空数据的Excel文档!");
}
}
}).headRowNumber(4).sheet().doRead();
if (resultGDError.stream().anyMatch(input -> !input.isEmpty())) {
throw new BadRequest("上传失败!");
}
return dataList;
} catch (Exception e) {
throw new Exception(resultGDError.stream()
.filter(s -> !s.isEmpty())
.collect(Collectors.joining("<br/>")));
}
}
public StringBuffer checkGDExcelData(PipingExcelDto data, AnalysisContext context, Boolean isGYGD) {
StringBuffer rowError = new StringBuffer();
ReadRowHolder readRowHolder = context.readRowHolder();
int rowIndex = readRowHolder.getRowIndex() + 1;
try {
log.info("解析第{}行数据:{}", rowIndex, JSON.toJSONString(data));
checkNotBlank(data.getPipeName(), "管道名称不能为空;", rowError);
// 同一工程装置下管道编号不能重复
if (!ValidationUtil.isEmpty(data.getProjectContraption())) {
// 使用单位Code
String useUnitCode = String.valueOf(data.getUseUnitCode()).trim();
// 使用单位名称
String useUnit = String.valueOf(data.getUseUnit()).trim();
// 工程装置名称
String proConName = data.getProjectContraption().trim();
// 查询该企业下工程装置名称
IdxBizJgProjectContraption oldContraption = idxBizJgProjectContraptionService.lambdaQuery()
.eq(IdxBizJgProjectContraption::getUseUnitCreditCode, useUnitCode)
.eq(IdxBizJgProjectContraption::getUseUnitName, useUnit)
.eq(IdxBizJgProjectContraption::getProjectContraption, proConName)
.list().stream().findFirst().orElse(null);
Optional.ofNullable(oldContraption).ifPresent(old -> {
List<String> pipelineNumberList = idxBizJgProjectContraptionServiceImpl.getBaseMapper()
.selectEquipList(String.valueOf(old.getSequenceNbr()))
.stream()
.map(item -> (String) item.get("pipelineNumber"))
.collect(Collectors.toList());
if (pipelineNumberList.contains(data.getPipelineNumber())) {
rowError.append(String.format("系统中工程装置(%s)下已经存在管道编号(%s);", data.getProjectContraption(), data.getPipelineNumber()));
}
});
List<String> list = projectContraptionMap.get(data.getProjectContraption());
if (null != list) {
// 判断该装置下是否已经存在该管道编号
if (list.contains(data.getPipelineNumber())) {
rowError.append(String.format("同一工程装置(%s)下管道编号不能重复;", data.getProjectContraption()));
}
list.add(data.getPipelineNumber());
} else {
list = new ArrayList<>();
}
projectContraptionMap.put(data.getProjectContraption(), list);
}
checkNotBlank(data.getDesignUnitCreditCode(), "设计单位统一社会信用代码不能为空;", rowError);
checkNotBlank(data.getDesignUnitName(), "设计单位名称不能为空;", rowError);
checkNotBlank(data.getInspectUnitCode(), "检验检测机构统一社会信用代码不能为空;", rowError);
checkNotBlank(data.getInspectUnitName(), "检验检测机构名称不能为空;", rowError);
checkNotBlank(data.getInspectConclusion(), "检验结论不能为空;", rowError);
checkNotBlank(data.getInspectType(), "检验类型不能为空;", rowError);
checkNotBlank(data.getInspectDate(), "检验日期不能为空;", rowError);
Optional.ofNullable(data.getInspectDate()).ifPresent(v -> checkDateFormatCorrect(v, "检验日期格式不正确;", rowError));
checkNotBlank(data.getInspectPersonName(), "检验人员名称不能为空;", rowError);
checkNotBlank(data.getNextInspectDate(), "下次检验日期不能为空;", rowError);
Optional.ofNullable(data.getNextInspectDate()).ifPresent(v -> checkDateFormatCorrect(v, "下次检验日期格式不正确;", rowError));
checkNotBlank(data.getInspectReportCode(), "检验报告编号不能为空;", rowError);
checkNotBlank(data.getInstallUnitCode(), "安装单位统一社会信用代码不能为空;", rowError);
checkNotBlank(data.getInstallUnitName(), "安装单位名称不能为空;", rowError);
// 技术参数
checkNotBlank(data.getWallThickness(), "公称壁厚不能为空;", rowError);
Optional.ofNullable(data.getWallThickness()).ifPresent(item -> checkPipeSpecifications(item, "公称壁厚请输入数字或者/分割的范围,如2/6", rowError));
checkNotBlank(data.getNominalDiameter(), "公称直径不能为空;", rowError);
Optional.ofNullable(data.getNominalDiameter()).ifPresent(item -> checkPipeSpecifications(item, "公称直径请输入数字或者/分割的范围,如2/6", rowError));
checkNotBlank(data.getPipeLength(), "管道长度不能为空;", rowError);
Optional.ofNullable(data.getPipeLength()).ifPresent(item -> checkDateFormatNumber(item, "管道长度必须为数字", rowError));
checkNotBlank(data.getPressure(), "设计-压力不能为空;", rowError);
checkNotBlank(data.getMedium(), "设计-介质不能为空;", rowError);
checkNotBlank(data.getTemperature(), "设计-温度不能为空;", rowError);
checkNotBlank(data.getPipelineNumber(), "管道编号不能为空;", rowError);
checkNotBlank(data.getDeviceLevel(), "管道级别不能为空;", rowError);
// 工业管道校验使用信息
if (isGYGD) {
// todo
}
// 如果存在错误信息,则抛出 BadRequest 异常
if (rowError.length() > 0) {
rowError.insert(0, "Excel第[" + rowIndex + "]行 -> ");
}
} catch (Exception e) {
log.error("行索引数: [{}] -> 失败的 Excel 数据: [{}]", rowIndex, JSON.toJSONString(data), e);
throw e;
}
return rowError;
}
/**
* 管道规格格式校验
*
* @param item
* @param errorMessage
* @param rowError
*/
public void checkPipeSpecifications(String item, String errorMessage, StringBuffer rowError) {
String regex = "^\\d(\\d*[.]?\\d*)([-/]\\d*[.]?\\d*)?$";
if (!item.matches(regex)) {
rowError.append(errorMessage);
}
}
@GlobalTransactional(rollbackFor = Exception.class)
public Object savePipingData(Map<String, Object> paramMap) {
JSONObject equipInfo = JSON.parseObject(toJSONString(paramMap.get("equipInfo")), JSONObject.class);
JSONObject attachmentUpload = JSON.parseObject(toJSONString(paramMap.get("attachmentUpload")), JSONObject.class);
List<PipingExcelDto> equLists = JSONArray.parseArray(toJSONString(attachmentUpload.get("equLists"))).toJavaList(PipingExcelDto.class);
ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
CompanyBo company = reginParams.getCompany();
// 是否工业管道
boolean isYLGD = "8300".equals(String.valueOf(equipInfo.get("EQU_CATEGORY")));
if (isYLGD) {
this.saveIndustrialPipData(company, equipInfo, equLists);
} else {
this.savePublicLongDistancePipData(company, equipInfo, equLists);
}
return Boolean.TRUE;
}
/**
* 工业管道保存
*
* @param equipInfo
* @param equLists
*/
public void saveIndustrialPipData(CompanyBo company, JSONObject equipInfo, List<PipingExcelDto> equLists) {
String equList = String.valueOf(equipInfo.get("EQU_LIST"));
String equCategory = String.valueOf(equipInfo.get("EQU_CATEGORY"));
String equDefine = String.valueOf(equipInfo.get("EQU_DEFINE"));
// 1. 校验是否第一次上传,限制同一个工程装置(同一编号同一名称)只能导一次 todo
// 2. 有使用登记证 -
// 2.1 匹配本单位使用登记证 匹配成功 系统存在改使用登记证
// 2.1.0 匹配本单位下的工程装置名称和工程装置编号不是一一对应的,抛出异常
// 2.1.1 匹配本单位下的工程装置(同一编号同一名称) (一一对应) 匹配成功 ===》(将设备挂到改装置下)
// 2.1.1 匹配本单位下的工程装置(同一编号同一名称) (一一对应) 匹配失败 ===》 生成新工程装置表数据
// 2.2 匹配本单位使用登记证 匹配失败 系统不存在改使用登记证
// 2.2.0 匹配本单位下的工程装置(同一编号同一名称) (一一对应) 匹配成功 抛出异常
// 2.2.1 生成使用登记证表数据
// 2.2.2 生成工程装置表信息
// 3. 更新管道对应的idx表数据
}
// 通用方法初始化 List
private <T> List<T> initializeList() {
return new ArrayList<>(15);
}
/**
* 公用、长输管道保存
*
* @param equipInfo
* @param equLists
*/
public void savePublicLongDistancePipData(CompanyBo company, JSONObject equipInfo, List<PipingExcelDto> equLists) {
String companyCode = company.getCompanyCode().split("_")[0];
String companyName = company.getCompanyName();
String equList = String.valueOf(equipInfo.get("EQU_LIST"));
String equCategory = String.valueOf(equipInfo.get("EQU_CATEGORY"));
String equDefine = String.valueOf(equipInfo.get("EQU_DEFINE"));
// 设备来源
String dataSource = "jg_his";
// 属地监管部门
String orgBranchCode = String.valueOf(equipInfo.get("orgBranchCode"));
// 所属属地
String vehicleApanage = String.valueOf(equipInfo.get("VEHICLE_APANAGE"));
// 工程装置名称
String projectContraption = String.valueOf(equipInfo.get("PROJECT_CONTRAPTION"));
// 工程装置编号
String projectContraptionNo = String.valueOf(equipInfo.get("PROJECT_CONTRAPTION_NO"));
// 产品照片
String productPhoto = toJSONString(equipInfo.get("PRODUCT_PHOTO"));
// 产品质量合格证明
String productQualificationCertificate = toJSONString(equipInfo.get("PRODUCT_QUALIFICATION_CERTIFICATE"));
// 其他附件
String otherAccessories = toJSONString(equipInfo.get("OTHER_ACCESSORIES"));
// 汇总管道长度
double pipelineLength = equLists.stream().mapToDouble(item -> Double.parseDouble(item.getPipeLength())).sum();
// 1. 校验是否第一次上传,限制同一个工程装置(同一编号同一名称)只能导一次 todo
// 2. 工程装置名称和工程装置编号不是一一对应的,抛出异常
Integer existsConflictNum = idxBizJgProjectContraptionService.lambdaQuery()
.eq(IdxBizJgProjectContraption::getUseUnitCreditCode, companyCode)
.eq(IdxBizJgProjectContraption::getUseUnitName, companyName)
.eq(IdxBizJgProjectContraption::getIsIntoManagement, Boolean.TRUE)
.eq(IdxBizJgProjectContraption::getIsDelete, Boolean.FALSE)
.and(wrapper -> wrapper
.ne(IdxBizJgProjectContraption::getProjectContraptionNo, projectContraptionNo)
.eq(IdxBizJgProjectContraption::getProjectContraption, projectContraption)
.or()
.eq(IdxBizJgProjectContraption::getProjectContraptionNo, projectContraptionNo)
.ne(IdxBizJgProjectContraption::getProjectContraption, projectContraption)
)
.count();
if (existsConflictNum > 0) {
throw new BadRequest("工程装置名称或编号与本单位下的已存在的数据冲突!");
}
// 3. 无证 - 匹配本单位下的工程装置(同一编号同一名称)
List<IdxBizJgProjectContraption> projectContraptions = idxBizJgProjectContraptionService.lambdaQuery()
.select(IdxBizJgProjectContraption::getPipelineLength)
.eq(IdxBizJgProjectContraption::getUseUnitCreditCode, companyCode)
.eq(IdxBizJgProjectContraption::getUseUnitName, companyName)
.eq(IdxBizJgProjectContraption::getEquCategory, equCategory)// 限制到设备类别
.eq(IdxBizJgProjectContraption::getIsIntoManagement, Boolean.TRUE)
.eq(IdxBizJgProjectContraption::getIsDelete, Boolean.FALSE)
.eq(IdxBizJgProjectContraption::getProjectContraption, projectContraption)
.eq(IdxBizJgProjectContraption::getProjectContraptionNo, projectContraptionNo)
.list();
// 3.1 匹配不到数据 生成一条工程装置表信息
if (projectContraptions.isEmpty()) {
IdxBizJgProjectContraption contraption = IdxBizJgProjectContraption.builder()
.projectContraption(projectContraption)
.projectContraptionNo(projectContraptionNo)
.useUnitCreditCode(companyCode)
.useUnitName(companyName)
// .uscUnitCreditCode().uscUnitName()
.equList(equList)
.equListName(EquipmentClassifityEnum.getNameByCode(equList))
.equCategory(equCategory)
.equCategoryName(EquCategoryConverter.getKeyByValue(equCategory))
.equDefine(equDefine)
.equDefineName(EquDefineConverter.getKeyByValue(equDefine))
.pipelineLength(pipelineLength)
.productPhoto(productPhoto)
.otherAccessories(otherAccessories)
.orgCode(orgBranchCode.split("_")[0])
.orgName(orgBranchCode.split("_")[1])
.productQualificationCertificate(productQualificationCertificate)
// .province().provinceName().city().cityName().county().countyName().street().streetName().address()
.supervisoryCode(idxBizJgRegisterInfoServiceImpl.getSupervisoryCode(vehicleApanage, equCategory))
.isIntoManagement(Boolean.TRUE)
.dataSource(dataSource)
// .equCode()
.isFirstMerge(Boolean.FALSE)
.build();
idxBizJgProjectContraptionService.save(contraption);
}
// 3.2 匹配到数据 名称和编号能一一对应,增补到改工程装置上
double oldPipLength = projectContraptions.stream().mapToDouble(item -> Double.parseDouble(String.valueOf(item.getPipelineLength()))).sum();
idxBizJgProjectContraptionService.lambdaUpdate()
.set(IdxBizJgProjectContraption::getPipelineLength, Double.sum(oldPipLength, pipelineLength))
.update();
// 4. 更新管道对应的idx表数据
List<IdxBizJgUseInfo> useInfoList = initializeList();
List<IdxBizJgDesignInfo> designInfoList = initializeList();
List<IdxBizJgFactoryInfo> factoryInfoList = initializeList();
List<IdxBizJgConstructionInfo> constructionInfoList = initializeList();
List<IdxBizJgRegisterInfo> registerInfoList = initializeList();
List<IdxBizJgSupervisionInfo> supervisionInfoList = initializeList();
List<IdxBizJgOtherInfo> otherInfoList = initializeList();
List<IdxBizJgTechParamsPipeline> paramsPipelineList = initializeList();
List<ESEquipmentCategoryDto> esEquipmentCategoryList = initializeList();
for (PipingExcelDto pipeline : equLists) {
String record = UUID.randomUUID().toString();
// 使用信息
IdxBizJgUseInfo useInfo = JSON.parseObject(toJSONString(pipeline), IdxBizJgUseInfo.class);
// 使用信息
useInfo.setRecord(record);
useInfo.setSequenceNbr(null);
useInfo.setRecDate(new Date());
useInfo.setDataSource(dataSource);
useInfo.setIsIntoManagement(Boolean.FALSE);
useInfo.setUseUnitCreditCode(companyCode);
useInfo.setUseUnitName(companyName);
useInfo.setProjectContraption(projectContraption);
useInfo.setProjectContraptionId(projectContraptionNo);
useInfoList.add(useInfo);
// 设计信息
IdxBizJgDesignInfo designInfo = JSON.parseObject(toJSONString(pipeline), IdxBizJgDesignInfo.class);
designInfo.setRecord(record);
designInfo.setRecDate(new Date());
designInfo.setSequenceNbr(null);
designInfoList.add(designInfo);
// 制造信息
IdxBizJgFactoryInfo factoryInfo = JSON.parseObject(toJSONString(pipeline), IdxBizJgFactoryInfo.class);
factoryInfo.setRecord(record);
factoryInfo.setRecDate(new Date());
factoryInfo.setSequenceNbr(null);
factoryInfoList.add(factoryInfo);
// 施工信息
IdxBizJgConstructionInfo constructionInfo = JSON.parseObject(toJSONString(pipeline), IdxBizJgConstructionInfo.class);
constructionInfo.setRecord(record);
constructionInfo.setRecDate(new Date());
constructionInfo.setSequenceNbr(null);
constructionInfoList.add(constructionInfo);
// 注册登记信息
IdxBizJgRegisterInfo registerInfo = JSON.parseObject(toJSONString(pipeline), IdxBizJgRegisterInfo.class);
registerInfo.setRecord(record);
registerInfo.setRecDate(new Date());
registerInfo.setSequenceNbr(null);
registerInfo.setEquCodeType("2");
// registerInfo.setRegisterState(this.getRegCode());
// registerInfo.setEquCode();
// 监督管理
IdxBizJgSupervisionInfo supervisionInfo = JSON.parseObject(toJSONString(pipeline), IdxBizJgSupervisionInfo.class);
supervisionInfo.setRecord(record);
supervisionInfo.setRecDate(new Date());
supervisionInfo.setSequenceNbr(null);
supervisionInfoList.add(supervisionInfo);
// 其他信息
IdxBizJgOtherInfo otherInfo = JSON.parseObject(toJSONString(pipeline), IdxBizJgOtherInfo.class);
otherInfo.setRecord(record);
otherInfo.setSequenceNbr(null);
otherInfo.setClaimStatus("已认领");
otherInfo.setRecDate(new Date());
otherInfoList.add(otherInfo);
// 管道技术参数
IdxBizJgTechParamsPipeline pipelineInfo = JSON.parseObject(toJSONString(pipeline), IdxBizJgTechParamsPipeline.class);
if (!ValidationUtil.isEmpty(pipelineInfo)) {
pipelineInfo.setRecord(record);
pipelineInfo.setRecDate(new Date());
pipelineInfo.setSequenceNbr(null);
paramsPipelineList.add(pipelineInfo);
}
registerInfo.setProductName(pipelineInfo.getPipeName());
registerInfoList.add(registerInfo);
// ESEquipmentCategoryDto esEquipmentDto = JSON.parseObject(toJSONString(equipmentInfoForm), ESEquipmentCategoryDto.class);
// esEquipmentDto.setDATA_SOURCE(useInfo.getDataSource());
// if (inspectionDetectionInfo.getNextInspectDate() != null) {
// esEquipmentDto.setNEXT_INSPECT_DATE(inspectionDetectionInfo.getNextInspectDate().getTime());
// }
// esEquipmentDto.setREC_DATE(System.currentTimeMillis());
// esEquipmentDto.setSEQUENCE_NBR(record);
// esEquipmentDto.setIS_INTO_MANAGEMENT(false);
// esEquipmentDto.setEQU_CATEGORY_CODE(registerInfo.getEquCategory());
// esEquipmentDto.setEQU_CATEGORY(equCategoryName);
// esEquipmentDto.setEQU_LIST_CODE(registerInfo.getEquList());
// esEquipmentDto.setEQU_LIST(equListName);
// esEquipmentDto.setEQU_DEFINE_CODE(registerInfo.getEquDefine());
// esEquipmentDto.setEQU_DEFINE(equListName);
// esEquipmentDto.setSTATUS("已认领");
// esEquipmentDto.setUSC_UNIT_CREDIT_CODE(projectContraption.getUscUnitCreditCode());
// esEquipmentDto.setUSC_UNIT_NAME(projectContraption.getUscUnitName());
// esEquipmentDto.setPROJECT_CONTRAPTION(projectContraption.getProjectContraption());
// esEquipmentDto.setPRODUCT_NAME(pipelineInfo.getPipeName());
// esEquipmentDto.setProjectContraptionId(String.valueOf(sequenceNbr));
// if (inspectionDetectionInfo.getNextInspectDate() != null) {
// esEquipmentDto.setNEXT_INSPECT_DATE(inspectionDetectionInfo.getNextInspectDate().getTime());
// }
// esEquipmentCategoryList.add(esEquipmentDto);
}
idxBizJgUseInfoService.saveBatch(useInfoList);
idxBizJgDesignInfoService.saveBatch(designInfoList);
idxBizJgConstructionInfoService.saveBatch(constructionInfoList);
idxBizJgFactoryInfoService.saveBatch(factoryInfoList);
idxBizJgRegisterInfoServiceImpl.saveBatch(registerInfoList);
idxBizJgOtherInfoService.saveBatch(otherInfoList);
idxBizJgSupervisionInfoService.saveBatch(supervisionInfoList);
iIdxBizJgTechParamsPipelineService.saveBatch(paramsPipelineList);
esEquipmentCategory.saveAll(esEquipmentCategoryList);
}
}
package com.yeejoin.amos.boot.module.jg.biz.service.impl;
import java.util.stream.Stream;
import java.util.stream.Collectors;
import com.alibaba.fastjson.JSONObject;
import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.bo.CompanyBo;
......@@ -11,20 +9,42 @@ import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.jg.api.enums.CompanyTypeEnum;
import com.yeejoin.amos.boot.module.jg.api.enums.EquipSourceEnum;
import com.yeejoin.amos.boot.module.jg.api.enums.PipelineEnum;
import com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgProjectContraptionService;
import com.yeejoin.amos.boot.module.ymt.api.dto.IdxBizJgProjectContraptionDto;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgInspectionDetectionInfo;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgProjectContraption;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgUseInfo;
import com.yeejoin.amos.boot.module.ymt.api.entity.TzBaseEnterpriseInfo;
import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgProjectContraptionMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.TzBaseEnterpriseInfoMapper;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import lombok.extern.slf4j.Slf4j;
import lombok.var;
import org.apache.commons.io.IOUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.net.URLEncoder;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import java.util.stream.Stream;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
/**
* 管道工程装置表服务实现类
......@@ -32,6 +52,7 @@ import java.util.*;
* @author system_generator
* @date 2024-12-11
*/
@Slf4j
@Service
public class IdxBizJgProjectContraptionServiceImpl extends BaseService<IdxBizJgProjectContraptionDto, IdxBizJgProjectContraption, IdxBizJgProjectContraptionMapper> implements IIdxBizJgProjectContraptionService {
......@@ -52,6 +73,12 @@ public class IdxBizJgProjectContraptionServiceImpl extends BaseService<IdxBizJgP
private IdxBizJgRegisterInfoServiceImpl registerInfoService;
@Autowired
private CommonServiceImpl commonServiceImpl;
@Autowired
private IdxBizJgInspectionDetectionInfoServiceImpl detectionInfoService;
@Autowired
private TzBaseEnterpriseInfoMapper tzBaseEnterpriseInfoMapper;
@Autowired
private CommonServiceImpl commonService;
@Override
public boolean saveOrUpdateData(IdxBizJgProjectContraption projectContraption) {
......@@ -212,4 +239,187 @@ public class IdxBizJgProjectContraptionServiceImpl extends BaseService<IdxBizJgP
resultMap.put(EQUIP_INFO_FORM_ID, projectContraptionMap);
return resultMap;
}
public Page<Map<String, Object>> techParamsPipelinePage(String sequenceNbr,int current, int size) {
Page<Map<String, Object>> page=new Page<>();
page.setCurrent(current);
page.setSize(size);
page.setRecords(baseMapper.selectEquipListPage(sequenceNbr,(current-1)*size,size));
page.setTotal(baseMapper.selectEquipCount(sequenceNbr));
return page;
}
public void saveOrUpdateDetectionInfo(IdxBizJgInspectionDetectionInfo detectionInfo) {
detectionInfo.setRecDate(new Date());
detectionInfoService.saveOrUpdateData(detectionInfo);
}
public void saveOrUpdateDetectionInfoBatch(List<IdxBizJgInspectionDetectionInfo> detectionInfos) {
if(CollectionUtil.isNotEmpty(detectionInfos)){
for (IdxBizJgInspectionDetectionInfo detectionInfo : detectionInfos) {
detectionInfo.setRecDate(new Date());
}
detectionInfoService.saveOrUpdateBatch(detectionInfos);
}
}
public IdxBizJgInspectionDetectionInfo getDetectionInfoDetail(String sequenceNbr) {
return detectionInfoService.getById(sequenceNbr);
}
public void exportSummaryBasicInfo(String sequenceNbr, HttpServletResponse response, String category) {
//长输/公共管道汇总
if ("8200".equals(category) || "8100".equals(category)) {
// 总数
double total;
// 每页显示条数,默认 10
int size = 10;
IdxBizJgProjectContraption idxBizJgProjectContraption = baseMapper.selectById(sequenceNbr);
if (ValidationUtil.isEmpty(idxBizJgProjectContraption)) {
throw new BadRequest("没有查询到汇总信息!");
}
List<Map<String, Object>> allEquipment = baseMapper.selectEquipListByExport(sequenceNbr);
total = allEquipment.size();
AgencyUserModel result = new AgencyUserModel();
if (!ValidationUtil.isEmpty(idxBizJgProjectContraption.getRecUserId())) {
result = Privilege.agencyUserClient.queryByUserId(idxBizJgProjectContraption.getRecUserId()).getResult();
}
// 模板
String wordPath = "PressurePipeBasicInformationSummary.ftl";
// 文件名前缀
String filePrefix = "压力管道基本信息汇总表_";
// 压力包名称
String customFileName = filePrefix + idxBizJgProjectContraption.getProjectContraptionNo() + ".zip";
// 总页数
int page = (int) Math.ceil(total / size);
// 异步获取数据
List<CompletableFuture<byte[]>> futures = pressurePipeDataPreparation(page, idxBizJgProjectContraption, size, total, allEquipment, wordPath, filePrefix, result,category);
// byte[]压缩zip
toZipFile(response, futures, filePrefix, customFileName);
}
}
/**
* 压力管道数据
*
* @return
*/
private List<CompletableFuture<byte[]>> pressurePipeDataPreparation(int page, IdxBizJgProjectContraption idxBizJgProjectContraption, int size, double total, List<Map<String, Object>> equipmentLists, String wordPath, String filePrefix, AgencyUserModel result,String category) {
Map<String, Object> exportParamsMap = new HashMap<>();
exportParamsMap.put("page", page);
LocalDate currentDate = LocalDate.now();
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
String formattedDate = currentDate.format(formatter);
exportParamsMap.put("printDate", formattedDate);
//获取分类名称
exportParamsMap.put("categoryName", PipelineEnum.getMessage(category));
// 使用单位
exportParamsMap.put("useUnitName", idxBizJgProjectContraption.getUseUnitName());
// 使用单位地址
String useUnitCreditCode = String.valueOf(idxBizJgProjectContraption.getUseUnitCreditCode());
TzBaseEnterpriseInfo enterpriseInfo = tzBaseEnterpriseInfoMapper.selectOne(new LambdaQueryWrapper<TzBaseEnterpriseInfo>().eq(TzBaseEnterpriseInfo::getUseCode, useUnitCreditCode));
exportParamsMap.put("fullAddress", enterpriseInfo.getAddress());
exportParamsMap.put("nameOfProjectDevice", idxBizJgProjectContraption.getProjectContraption());
// 安全管理部门
exportParamsMap.put("orgBranchName", "");
// 安全管理员
exportParamsMap.put("safetyManager", "");
// 联系电话
exportParamsMap.put("phone", ValidationUtil.isEmpty(result.getMobile()) ? "" : result.getMobile());
// 经办人
exportParamsMap.put("agent", ValidationUtil.isEmpty(result.getRealName()) ? "" : result.getRealName());
// 电子邮箱
exportParamsMap.put("email", ValidationUtil.isEmpty(result.getEmail()) ? "" : result.getEmail());
List<CompletableFuture<byte[]>> futures = IntStream.rangeClosed(1, page)
.mapToObj(current -> CompletableFuture.supplyAsync(() -> {
// 创建独立的参数副本
Map<String, Object> currentExportParamsMap = new HashMap<>(exportParamsMap);
currentExportParamsMap.put("current", current);
// 数据分页
int start = (current - 1) * size;
int end = ((current - 1) * size + size) < total ? (current - 1) * size + size : (int) total;
// 数据截取
List<Map<String, Object>> equData = equipmentLists.subList(start, end);
// 设备数据填充
this.pressurePipeEquData(currentExportParamsMap, equData, current, size);
return commonService.generateSummaryOfCylinderInfo(currentExportParamsMap, wordPath, filePrefix);
})).collect(Collectors.toList());
CompletableFuture.allOf(futures.toArray(new CompletableFuture[page])).join();
return futures;
}
/**
* 压力管道设备数据填充
*/
public void pressurePipeEquData(Map<String, Object> exportParamsMap, List<Map<String, Object>> equData, int current, int size) {
String[] fieldNames = {"productName", "pipelineNumber", "deviceLevel", "designUnitName", "uscUnitName",
"uscDate", "useDate", "nominalDiameter", "wallThickness", "pipeLength", "pressure", "temperature",
"medium", "inspectConclusion", "inspectOrgName", "nextInspectDate", "remarks"};
// 填充有效数据
for (int curr = 0; curr < equData.size(); curr++) {
Map<String, Object> map = equData.get(curr);
int serialNum = curr + 1;
for (String fieldName : fieldNames) {
exportParamsMap.put("num" + serialNum, (current - 1) * size + (curr + 1));
exportParamsMap.put(fieldName + serialNum, setSpecialParamFields(fieldName, map));
}
}
// 填充剩余空白项至指定总页数
for (int curr = equData.size(); curr < size; curr++) {
int serialNum = curr + 1;
for (String fieldName : fieldNames) {
exportParamsMap.put("num" + serialNum, "");
exportParamsMap.put(fieldName + serialNum, ""); // 使用空字符串填充空白项
}
}
}
private Object trimIfEmpty(Object obj) {
return ValidationUtil.isEmpty(obj) ? "" : obj;
}
private Object setSpecialParamFields(String fieldName, Map<String, Object> equip){
switch (fieldName) {
case "pressure":
return trimIfEmpty(equip.get(fieldName)) + "/" + trimIfEmpty(equip.get("workPressure"));
case "temperature":
return trimIfEmpty(equip.get(fieldName)) + "/" + trimIfEmpty(equip.get("workTemperature"));
case "medium":
return trimIfEmpty(equip.get(fieldName)) + "/" + trimIfEmpty(equip.get("workMedium"));
default:
return ValidationUtil.isEmpty(equip.get(fieldName)) ? "" : equip.get(fieldName);
}
}
private static void toZipFile(HttpServletResponse response, List<CompletableFuture<byte[]>> futures, String filePrefix, String customFileName) {
// 打包zip
try (ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
ZipOutputStream zip = new ZipOutputStream(outputStream)) {
for (int i = 0; i < futures.size(); i++) {
try {
zip.putNextEntry(new ZipEntry(filePrefix + "第" + (i + 1) + "页" + ".pdf"));
IOUtils.write(futures.get(i).join(), zip);
zip.closeEntry(); // 每个条目结束后关闭
} catch (IOException e) {
log.error("打包zip失败:" + e.getMessage());
throw new BadRequest("打包zip失败");
}
}
// 所有条目写入完成后关闭 ZipOutputStream
zip.finish();
// 设置响应头并将压缩文件写入 HttpServletResponse
response.setCharacterEncoding("UTF-8");
response.setHeader("content-Type", "application/zip");
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(customFileName, "UTF-8"));
response.setHeader("Access-Control-Expose-Headers", "Content-Disposition");
IOUtils.write(outputStream.toByteArray(), response.getOutputStream());
} catch (IOException e) {
throw new RuntimeException("导出异常:", e);
}
}
}
\ No newline at end of file
......@@ -138,6 +138,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
public static final String DATA_SOURCE_NAME = "DATA_SOURCE_NAME";
public static final String USE_PLACE_CODE = "USE_PLACE_CODE";
public static final String EQU_CATEGORY_CODE = "EQU_CATEGORY_CODE";
public static final String EQU_LIST_CODE = "EQU_LIST_CODE";
public static final String PROJECT_CONTRAPTION = "PROJECT_CONTRAPTION";// 工程装置名称
/**
* 业务类型 0:单个新增 1:批量导入
......@@ -393,9 +394,9 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
}
LinkedHashMap equipmentInfoForm = (LinkedHashMap) checkAndCast(paramMap.get(EQUIP_INFO_FORM_ID));
String dataSource = (String) equipmentInfoForm.get(DATA_SOURCE);
String equCategory = (String) equipmentInfoForm.get(EQU_CATEGORY);
String equListCode = (String) equipmentInfoForm.get(EQU_LIST);
//管道添加设备
if (PipelineEnum.INDUSTRIAL_PIPELINE.getCode().equals(equCategory)) {
if (PipelineEnum.PRESSURE_PIPELINE.getCode().equals(equListCode)) {
return this.pipelineEquipCreateOrUpdate(paramMap);
}
if(dataSource.contains("black")){
......@@ -1142,16 +1143,22 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
if ("his".equals(dataSource) || "black".equals(dataSource)) {
// 历史数据导入设备类别限制 bug-21172
if (!ObjectUtils.isEmpty(type) && "PL_DR".equals(type)) {
if (EquipmentClassifityEnum.YLRQ.getCode().equals(equList)) {
return this.baseMapper.queryAllEquCategoriesUnderTheEquList(equList).stream()
.filter(x -> "2300".equals(x.getDictDataKey()))
.collect(Collectors.toList());
}
// 历史数据新增设备类别限制 bug-21139
if (!ObjectUtils.isEmpty(equList) && "8000".equals(equList)) {
if (EquipmentClassifityEnum.YLGD.getCode().equals(equList) && "his".equals(dataSource)) {
return this.baseMapper.queryAllEquCategoriesUnderTheEquList(equList).stream()
.filter(x -> "8300".equals(x.getDictDataKey()))
.collect(Collectors.toList());
}
if (EquipmentClassifityEnum.YLGD.getCode().equals(equList) && "black".equals(dataSource)) {
return this.baseMapper.queryAllEquCategoriesUnderTheEquList(equList).stream()
.filter(x -> !"8300".equals(x.getDictDataKey()))
.collect(Collectors.toList());
}
}
return this.baseMapper.queryAllEquCategoriesUnderTheEquList(equList);
}
......@@ -2473,13 +2480,19 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
boolMust.must(scBuilder);
}
// 设备种类编码
if (!ObjectUtils.isEmpty(map.getString("EQU_LIST_CODE"))) {
if (!ObjectUtils.isEmpty(map.getString(EQU_LIST_CODE))) {
BoolQueryBuilder elcBuilder = QueryBuilders.boolQuery();
String test = QueryParser.escape(map.getString("EQU_LIST_CODE"));
elcBuilder.must(QueryBuilders.matchPhraseQuery("EQU_LIST_CODE", test));
String test = QueryParser.escape(map.getString(EQU_LIST_CODE));
elcBuilder.must(QueryBuilders.matchPhraseQuery(EQU_LIST_CODE, test));
boolMust.must(elcBuilder);
} else {
BoolQueryBuilder pBuilder = QueryBuilders.boolQuery();
String test = QueryParser.escape("8000");//不查管道,管道新菜单查询
pBuilder.mustNot(QueryBuilders.termQuery(EQU_LIST_CODE, test));
boolMust.must(pBuilder);
}
// 设备类别编码
// 设备品种编码
if (!ObjectUtils.isEmpty(map.getString("EQU_DEFINE_CODE"))) {
BoolQueryBuilder elcBuilder = QueryBuilders.boolQuery();
String test = QueryParser.escape(map.getString("EQU_DEFINE_CODE"));
......@@ -2500,11 +2513,6 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
String test = QueryParser.escape(map.getString(EQU_CATEGORY_CODE));
pBuilder.must(QueryBuilders.termQuery(EQU_CATEGORY_CODE, test));
boolMust.must(pBuilder);
} else {
BoolQueryBuilder pBuilder = QueryBuilders.boolQuery();
String test = QueryParser.escape("8300");//不查管道,管道新菜单查询
pBuilder.mustNot(QueryBuilders.termQuery(EQU_CATEGORY_CODE, test));
boolMust.must(pBuilder);
}
// 是否车用气瓶
if (!ObjectUtils.isEmpty(map.getString(WHETHER_VEHICLE_CYLINDER))) {
......@@ -3821,7 +3829,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
otherInfo.setRecDate(new Date());
otherInfo.setCylinderStampAttachment(cylinderStampAttachment);
if ("his".equals(equipInfoDto.getDataSource())) {
otherInfo.setSupervisoryCode(this.getSupervisoryCode(equipInfoDto.getPossession(), registerInfo));
otherInfo.setSupervisoryCode(this.getSupervisoryCode(equipInfoDto.getPossession(), registerInfo.getEquCategory()));
}
otherInfo.setClaimStatus("已认领");
otherInfoList.add(otherInfo);
......@@ -4335,13 +4343,13 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
/**
* 生成监管码
*/
private String getSupervisoryCode(String possession, IdxBizJgRegisterInfo registerInfo) {
public String getSupervisoryCode(String possession, String equCategory) {
Map<String, Object> map = new HashMap<>();
boolean isXiXian = XI_XIAN.getCode().equals(possession);
String cityOrCountyCode = isXiXian ? XIAN_YANG.getCode() : possession;
map.put("cityCode", cityOrCountyCode);
map.put("isXiXian", isXiXian ? 1 : 0);
map.put("equCategory", registerInfo.getEquCategory());
map.put("equCategory", equCategory);
map.put("countyCode", cityOrCountyCode);
return Optional.ofNullable(tzsServiceFeignClient.createCode(map).getResult())
.filter(res -> !res.isEmpty())
......
......@@ -2436,6 +2436,8 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
String formattedDate = currentDate.format(formatter);
exportParamsMap.put("printDate", formattedDate);
//获取分类名称
exportParamsMap.put("categoryName", "工业管道");
// 使用单位
exportParamsMap.put("useUnitName", jsonObject.get("useUnitName"));
// 使用单位地址
......
......@@ -69,7 +69,7 @@
<w:sz w:val="36"/>
<w:szCs w:val="36"/>
</w:rPr>
<w:t>工业管道</w:t>
<w:t>${categoryName}</w:t>
</w:r>
</w:p>
<w:p w14:paraId="7AEDB7EF" w14:textId="156F0207" w:rsidR="00EA7A71" w:rsidRDefault="00DB6291">
......
package com.yeejoin.amos.boot.module.jyjc.api.entity;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import org.typroject.tyboot.core.rdbms.orm.entity.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.util.Date;
/**
* 检验检测历史数据表
*
* @author system_generator
* @date 2025-01-14
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName(value = "tz_jyjc_inspection_history", autoResultMap = true)
public class JyjcInspectionHistory extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 来源seq
*/
@TableField("s_seq")
private Long sSeq;
/**
* 推送数据
*/
@TableField(value = "history_data", typeHandler = JacksonTypeHandler.class)
private JSONObject historyData;
/**
* 备注
*/
@TableField("remark")
private String remark;
/**
* 来源类型
*/
@TableField("s_type")
private String sType;
}
......@@ -124,6 +124,13 @@ public interface JyjcInspectionApplicationMapper extends BaseMapper<JyjcInspecti
* @return List<Map<String, Object>>
*/
List<Map<String, Object>> selectPieLineListOfInspect(@Param("records") List<String> records);
/**
* 查询指定管道的信息,样式为汇总表样式-无检验信息
* @param records 管道ids
* @return List<Map<String, Object>>
*/
List<Map<String, Object>> selectPieLineListOfNoInspectInfo(@Param("records") List<String> records);
}
package com.yeejoin.amos.boot.module.jyjc.api.mapper;
import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionHistory;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* 检验检测历史数据表 Mapper 接口
*
* @author system_generator
* @date 2025-01-14
*/
public interface JyjcInspectionHistoryMapper extends BaseMapper<JyjcInspectionHistory> {
}
package com.yeejoin.amos.boot.module.jyjc.api.model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.typroject.tyboot.core.rdbms.model.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 检验检测历史数据表
*
* @author system_generator
* @date 2025-01-14
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value="JyjcInspectionHistoryModel", description="检验检测历史数据表")
public class JyjcInspectionHistoryModel extends BaseModel {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "来源seq")
private Long sSeq;
@ApiModelProperty(value = "推送数据")
private String historyData;
@ApiModelProperty(value = "备注")
private String remark;
@ApiModelProperty(value = "来源类型")
private String sType;
}
package com.yeejoin.amos.boot.module.jyjc.api.service;
/**
* 检验检测历史数据表接口类
*
* @author system_generator
* @date 2025-01-14
*/
public interface IJyjcInspectionHistoryService {}
......@@ -25,4 +25,11 @@ public interface IJyjcInspectionResultParamService {
* @return 字段列表
*/
List<Map<String,Object>> getParamByEquipTypeCode(String equipTypeCode);
/**
* 根据
* @param sequenceNbr
* @return
*/
JyjcInspectionResultParam getOneParamByResultSeq(Long sequenceNbr);
}
......@@ -682,6 +682,50 @@
LEFT JOIN idx_biz_jg_register_info ri on ri."RECORD" = ui."RECORD"
LEFT JOIN idx_biz_jg_tech_params_pipeline pp ON pp."RECORD" = ui."RECORD"
</sql>
<sql id="page-list-pipeline-no-inspect">
SELECT
ui."USE_UNIT_NAME" useUnitName,
ui."USE_UNIT_CREDIT_CODE" useUnitCreditCode,
ui."PROJECT_CONTRAPTION_ID" as projectContraptionId,
to_char(ui."USE_DATE", 'YYYY-MM') useDate,
(SELECT DESIGN_UNIT_NAME from idx_biz_jg_design_info where "RECORD" = ui."RECORD") designUnitName,
(SELECT USC_UNIT_NAME from idx_biz_jg_construction_info where "RECORD" = ui."RECORD" ORDER BY USC_DATE DESC limit 1) uscUnitName,
to_char((SELECT USC_DATE from idx_biz_jg_construction_info where "RECORD" = ui."RECORD" ORDER BY USC_DATE DESC limit 1), 'YYYY-MM') uscDate,
ui."RECORD" record,
ui.IS_INTO_MANAGEMENT as isIntoManagement,
ri."EQU_CODE" equCode,
ri."EQU_LIST" equList,
(select name from tz_equipment_category where code = ri."EQU_LIST") equListName,
ri."EQU_CATEGORY" equCategory,
(select name from tz_equipment_category where code = ri."EQU_CATEGORY") equCategoryName,
ri."EQU_DEFINE" equDefine,
(select name from tz_equipment_category where code = ri."EQU_DEFINE") equDefineName,
-- 历史遗留问题 故 as
pp."PIPE_NAME" as productName,
ri."BRAND_NAME" brandName,
ri."EQU_TYPE" equType,
ri."EQU_CODE_TYPE" equCodeType,
ri."WHETHER_VEHICLE_CYLINDER" whetherVehicleCylinder,
ri."USE_ORG_CODE" useOrgCode,
pp."DEVICE_NAME" deviceName,
(select name from cb_data_dictionary where code = pp."DEVICE_LEVEL" and type = 'GBI') deviceLevel,
pp."PIPE_NAME" pipeName,
pp."PIPELINE_NUMBER" pipelineNumber,
pp."NOMINAL_DIAMETER" nominalDiameter,
pp."WALL_THICKNESS" wallThickness,
pp."PIPE_LENGTH" pipeLength,
pp."PRESSURE" pressure,
pp."TEMPERATURE" temperature,
pp."MEDIUM" medium,
pp."REMARKS" remarks,
pp."WORK_PRESSURE" AS workPressure,
pp."WORK_TEMPERATURE" AS workTemperature,
pp."WORK_MEDIUM" AS workMedium
FROM
idx_biz_jg_use_info ui
LEFT JOIN idx_biz_jg_register_info ri on ri."RECORD" = ui."RECORD"
LEFT JOIN idx_biz_jg_tech_params_pipeline pp ON pp."RECORD" = ui."RECORD"
</sql>
<select id="selectPieLineListByProjectId" resultType="java.util.Map">
select * from (
<include refid="page-list-pipeline"/>
......@@ -700,4 +744,13 @@
</foreach>
ORDER BY ui.REC_DATE DESC
</select>
<select id="selectPieLineListOfNoInspectInfo" resultType="java.util.Map">
<include refid="page-list-pipeline-no-inspect"/>
WHERE
ui.record in
<foreach collection="records" item="record" open="(" close=")" separator=",">
#{record}
</foreach>
ORDER BY ui.REC_DATE DESC
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.jyjc.api.mapper.JyjcInspectionHistoryMapper">
</mapper>
......@@ -71,7 +71,6 @@ import org.redisson.api.RLock;
import org.redisson.api.RedissonClient;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -172,6 +171,9 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
@Resource
private SnowflakeIdUtil sequence;
@Resource
private JyjcInspectionHistoryServiceImpl inspectionHistoryService;
@NotNull
public static List<DictionarieModel> getDictionarieModels(String bizType) {
......@@ -431,7 +433,7 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
}
private void setEquipCategoryIfPieLine(JyjcInspectionApplicationModel model, JyjcInspectionApplicationEquip equipInfo, JyjcInspectionApplicationEquipDto equipDto) {
if(model.getEquipClassify().equals(EquipmentClassifityEnum.YLGD.getCode())){
if (model.getEquipClassify().equals(EquipmentClassifityEnum.YLGD.getCode())) {
equipInfo.setEquipUnicode(model.getProjectContraptionId());
equipInfo.setEquList(equipDto.getEquList());
equipInfo.setEquCategory(equipDto.getEquCategory());
......@@ -443,7 +445,7 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
}
private String buildTaskContent(JyjcInspectionApplicationModel model){
private String buildTaskContent(JyjcInspectionApplicationModel model) {
return String.format("来自%s%s的业务办理,【申请单号:%s】", model.getEquList(), StringUtils.isNotBlank(model.getSupervisoryCode()) ? "【" + model.getSupervisoryCode() + "】" : "", model.getApplicationNo());
}
......@@ -603,7 +605,26 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
Map<String, Object> map = BeanUtil.beanToMap(model);
// 附件
Map<String, Object> attMap = getAttachmentMap(sequenceNbr);
if(model.getEquipClassify().equals(EquipmentClassifityEnum.YLGD.getCode())){
// 已完成的显示json数据 需兼容老数据
if (model.getStatus().equals(String.valueOf(FlowStatusEnum.TO_BE_FINISHED.getCode()))) {
JyjcInspectionHistory inspectionHistory = inspectionHistoryService.getBySSeq(sequenceNbr);
if (inspectionHistory != null) {
// 新报检单记录历史数据的逻辑
map.putAll(inspectionHistory.getHistoryData());
} else {
// 历史单位之前未记录历史数据的逻辑
if (model.getEquipClassify().equals(EquipmentClassifityEnum.YLGD.getCode())) {
// 压力管道
map.putAll(getDeviceListByProjectContraption2(model));
} else {
// 其他设备
List<Map<String, Object>> arrayList = getEquipInfoList(sequenceNbr, model);
map.put("equip", arrayList);
}
}
} else {
// 未审批完成的显示实时数据
if (model.getEquipClassify().equals(EquipmentClassifityEnum.YLGD.getCode())) {
// 压力管道
map.putAll(getDeviceListByProjectContraption2(model));
} else {
......@@ -611,6 +632,7 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
List<Map<String, Object>> arrayList = getEquipInfoList(sequenceNbr, model);
map.put("equip", arrayList);
}
}
map.putAll(attMap);
map.put("companyType", companyType);
this.setPlanData(sequenceNbr, map);
......@@ -722,7 +744,7 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
List<JyjcInspectionResult> resultModels = new ArrayList<>();
List<JgResumeInfoDto> jgResumeInfoDtoList = new ArrayList<>();
Date now = DateUtil.date();
if(model.getEquipClassify().equals(EquipmentClassifityEnum.YLGD.getCode())){
if (model.getEquipClassify().equals(EquipmentClassifityEnum.YLGD.getCode())) {
List<String> codes = tzsServiceFeignClient.applicationFormCode(ApplicationFormTypeEnum.JG.getCode(), 1).getResult();
JyjcInspectionResult resultModel = new JyjcInspectionResult();
resultModel.setInspectionUnitCode(model.getInspectionUnitCode());
......@@ -741,7 +763,7 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
// 装置信息查询
resultModel.setEquipUnicode(model.getProjectContraptionId());
IdxBizJgProjectContraption projectContraption = idxBizJgProjectContraptionMapper.selectById(model.getProjectContraptionId());
if(projectContraption != null){
if (projectContraption != null) {
resultModel.setEquipUnicode(projectContraption.getSequenceNbr() + "");
resultModel.setSupervisoryCode(projectContraption.getSupervisoryCode());
resultModel.setEquCategory(projectContraption.getEquCategory());
......@@ -755,7 +777,7 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
this.setResultTypeByBizType(resultModel, model.getBizType());
resultModels.add(resultModel);
// TODO 以管道汇总样式表暂存json,在结果录入后,将数据更新技术参数,考虑老数据
Map<String, Object> paramDetail = getDeviceListByProjectContraption2(model);
Map<String, Object> paramDetail = getDeviceListByProjectContraption3(model);
JyjcInspectionResultParam resultParam = new JyjcInspectionResultParam();
resultParam.setResultSeq(resultModel.getSequenceNbr());
resultParam.setParamJson(JSON.toJSONString(paramDetail));
......@@ -799,6 +821,7 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
// 报检信息推送 TODO
// this.pushInspectionApplication(model);
this.saveBatchResume(jgResumeInfoDtoList);
this.createHisAfterReceive(model);
// 更新流程中的流程数据
commonService.saveExecuteFlowData2Redis(model.getProcessInstanceId(), this.buildInstanceRuntimeData(entity));
} catch (InterruptedException e) {
......@@ -810,6 +833,19 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
}
}
public void createHisAfterReceive(JyjcInspectionApplicationModel model) {
if (model.getEquipClassify().equals(EquipmentClassifityEnum.YLGD.getCode())) {
JSONObject hisData = getDeviceListByProjectContraption2(model);
inspectionHistoryService.saveBySeq(model.getSequenceNbr(), hisData, model.getInspectionType());
} else {
List<Map<String, Object>> arrayList = getEquipInfoList(model.getSequenceNbr(), model);
JSONObject hisData = new JSONObject();
hisData.put("equip", arrayList);
inspectionHistoryService.saveBySeq(model.getSequenceNbr(), hisData, model.getInspectionType());
}
}
private void saveBatchResume(List<JgResumeInfoDto> jgResumeInfoDtoList) {
try {
jgFeignClient.saveBatchResume(jgResumeInfoDtoList);
......@@ -1391,7 +1427,7 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
public IPage<IdxBizJgProjectContraption> getJgProjectContraptionPage(String inspectionType, Page<IdxBizJgProjectContraption> page, String companyCode, String equCategory) {
// 兼容个人业务
if(companyCode.contains("_")){
if (companyCode.contains("_")) {
companyCode = companyCode.split("_")[1];
}
// 定期检验,查询当前使用单位,工业管道: 查询当前使用单位下已纳管且有使用登记证的装置,且非流程中的 ;公用管道、长输管道:已纳管且做过检验的,且非流程中的
......@@ -1400,7 +1436,8 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
/**
* 查询指定装置下的装置基本信息、施工信息、管道信息(前缀装置列表已进行过滤,故不进行状态的过滤)
* 查询指定装置下的装置基本信息、施工/使用信息、管道信息(前缀装置列表已进行过滤,故不进行状态的过滤)--报检发起使用
*
* @param projectContraptionSeq 装置id
* @return 装置的详情
*/
......@@ -1413,55 +1450,98 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
re.put("projectContraptionId", projectContraptionSeq);
re.put("projectContraptionNo", projectContraption.getProjectContraptionNo());
re.put("pipelineLength", projectContraption.getPipelineLength());
this.setConstructionInfo(projectContraptionSeq, re);
re.put("useRegistrationCode ", projectContraption.getUseRegistrationCode());
this.setInstallAddress(projectContraption, re);
this.setUseAddress(projectContraption, re);
return re;
}
/**
* 查询指定报检单据下的装置管道信息
* 使用地点-使用登记完成后回把使用登记的地点信息写到装置表。定期检验时显示
* @param projectContraption 装置
* @param re 返回结果:增加使用地点(工业管道是使用登记时的地址);公用、长输管道是安装地址(无使用登记证)
*/
private void setUseAddress(IdxBizJgProjectContraption projectContraption, Map<String, Object> re) {
re.put("useAddress", getDetailAddress(projectContraption));
}
/**
* 查询指定报检单据下的装置管道信息-----报检详情使用与getDeviceListByProjectContraption区别,指定了管道
*
* @param applicationModel 报检单据信息
* @return 装置的详情
*/
public Map<String, Object> getDeviceListByProjectContraption2(JyjcInspectionApplicationModel applicationModel) {
public JSONObject getDeviceListByProjectContraption2(JyjcInspectionApplicationModel applicationModel) {
IdxBizJgProjectContraption projectContraption = idxBizJgProjectContraptionMapper.selectById(applicationModel.getProjectContraptionId());
List<JyjcInspectionApplicationEquipModel> applicationEquipModels = applicationEquipService.listApplicationEquipByApplicationSeq(applicationModel.getSequenceNbr());
List<String> records = applicationEquipModels.stream().map(JyjcInspectionApplicationEquipModel::getEquipUnicode).collect(Collectors.toList());
Map<String, Object> re = new HashMap<>();
JSONObject jsonObject = new JSONObject();
List<Map<String, Object>> equList = this.getBaseMapper().selectPieLineListOfInspect(records);
re.put("equip", equList);
re.put("projectContraption", projectContraption.getProjectContraption());
re.put("projectContraptionId", applicationModel.getProjectContraptionId());
re.put("projectContraptionNo", projectContraption.getProjectContraptionNo());
re.put("pipelineLength", calTotalLength(equList));
this.setConstructionInfo(applicationModel.getProjectContraptionId(), re);
return re;
jsonObject.put("equip", equList);
jsonObject.put("projectContraption", projectContraption.getProjectContraption());
jsonObject.put("projectContraptionId", applicationModel.getProjectContraptionId());
jsonObject.put("projectContraptionNo", projectContraption.getProjectContraptionNo());
jsonObject.put("pipelineLength", calTotalLength(equList));
jsonObject.put("useRegistrationCode ", projectContraption.getUseRegistrationCode());
this.setInstallAddress(projectContraption, jsonObject);
this.setUseAddress(projectContraption, jsonObject);
return jsonObject;
}
private String calTotalLength(List<Map<String, Object>> equList){
double pipeLengthSum = equList.stream().map(r->r.get("pipeLength")).filter(Objects::nonNull).mapToDouble(l->Double.parseDouble(String.valueOf(l))).sum();
BigDecimal pipeLengthSumBig = new BigDecimal(String.valueOf(pipeLengthSum)).setScale(3, RoundingMode.HALF_UP);
return pipeLengthSumBig.toPlainString();
private void setInstallAddress(IdxBizJgProjectContraption projectContraption, Map<String, Object> re) {
re.put("installAddress", getDetailAddress(projectContraption));
}
private void setConstructionInfo(String projectContraptionSeq, Map<String, Object> re) {
LambdaQueryWrapper<IdxBizJgProjectConstruction> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(IdxBizJgProjectConstruction::getProjectContraptionId, projectContraptionSeq)
.orderByDesc(IdxBizJgProjectConstruction::getUscDate).last("limit 1");
IdxBizJgProjectConstruction construction = idxBizJgProjectConstructionMapper.selectOne(queryWrapper);
if(construction != null){
re.put("installAddress", getDetailAddress(construction));
/**
* 安装地址:安装告知完成后,此字段为安装地址
* @param projectContraption 装置
* @param jsonObject 增加安装地址
*/
private void setInstallAddress(IdxBizJgProjectContraption projectContraption, JSONObject jsonObject) {
jsonObject.put("installAddress", getDetailAddress(projectContraption));
}
/**
* 管道报检结果-管道详情页签-数据缓存---与getDeviceListByProjectContraption2区别,汇总表内不包含检验信息
* @param applicationModel 申请单
* @return 无检验信息的汇总管道-检验结果页面专用
*/
public JSONObject getDeviceListByProjectContraption3(JyjcInspectionApplicationModel applicationModel) {
JSONObject jsonObject = new JSONObject();
IdxBizJgProjectContraption projectContraption = idxBizJgProjectContraptionMapper.selectById(applicationModel.getProjectContraptionId());
List<JyjcInspectionApplicationEquipModel> applicationEquipModels = applicationEquipService.listApplicationEquipByApplicationSeq(applicationModel.getSequenceNbr());
List<String> records = applicationEquipModels.stream().map(JyjcInspectionApplicationEquipModel::getEquipUnicode).collect(Collectors.toList());
List<Map<String, Object>> equList = this.getBaseMapper().selectPieLineListOfNoInspectInfo(records);
jsonObject.put("equip", equList);
jsonObject.put("projectContraption", projectContraption.getProjectContraption());
jsonObject.put("projectContraptionId", applicationModel.getProjectContraptionId());
jsonObject.put("projectContraptionNo", projectContraption.getProjectContraptionNo());
jsonObject.put("pipelineLength", calTotalLength(equList));
jsonObject.put("useRegistrationCode ", projectContraption.getUseRegistrationCode());
this.setInstallAddress(projectContraption, jsonObject);
this.setUseAddress(projectContraption, jsonObject);
return jsonObject;
}
private String calTotalLength(List<Map<String, Object>> equList) {
double pipeLengthSum = equList.stream().map(r -> r.get("pipeLength")).filter(Objects::nonNull).mapToDouble(l -> Double.parseDouble(String.valueOf(l))).sum();
BigDecimal pipeLengthSumBig = new BigDecimal(String.valueOf(pipeLengthSum)).setScale(3, RoundingMode.HALF_UP);
return pipeLengthSumBig.toPlainString();
}
private String trimIfNull(String str){
if(StringUtils.isBlank(str)){
private String trimIfNull(String str) {
if (StringUtils.isBlank(str)) {
return "";
}
return str.trim();
}
private String getDetailAddress(IdxBizJgProjectConstruction construction){
return trimIfNull(construction.getProvinceName()) + trimIfNull(construction.getCityName()) + trimIfNull(construction.getCountyName()) + trimIfNull(construction.getStreetName());
private String getDetailAddress(IdxBizJgProjectConstruction construction) {
return trimIfNull(construction.getProvinceName()) + trimIfNull(construction.getCityName()) + trimIfNull(construction.getCountyName()) + trimIfNull(construction.getStreetName() + trimIfNull(construction.getAddress()));
}
private String getDetailAddress(IdxBizJgProjectContraption projectContraption) {
return trimIfNull(projectContraption.getProvinceName()) + trimIfNull(projectContraption.getCityName()) + trimIfNull(projectContraption.getCountyName()) + trimIfNull(projectContraption.getStreetName() + trimIfNull(projectContraption.getAddress()));
}
}
\ No newline at end of file
package com.yeejoin.amos.boot.module.jyjc.biz.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionHistory;
import com.yeejoin.amos.boot.module.jyjc.api.mapper.JyjcInspectionHistoryMapper;
import com.yeejoin.amos.boot.module.jyjc.api.model.JyjcInspectionHistoryModel;
import com.yeejoin.amos.boot.module.jyjc.api.service.IJyjcInspectionHistoryService;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.util.Date;
/**
* 检验检测历史数据表服务实现类
*
* @author system_generator
* @date 2025-01-14
*/
@Service
public class JyjcInspectionHistoryServiceImpl extends BaseService<JyjcInspectionHistoryModel, JyjcInspectionHistory, JyjcInspectionHistoryMapper> implements IJyjcInspectionHistoryService {
public JyjcInspectionHistory getBySSeq(Long sSeq) {
return this.getOne(new LambdaQueryWrapper<JyjcInspectionHistory>().eq(JyjcInspectionHistory::getSSeq, sSeq));
}
public void saveBySeq(Long sSeq, JSONObject hisData, String sType) {
JyjcInspectionHistory history = this.getBySSeq(sSeq);
if (history != null) {
history.setHistoryData(hisData);
this.updateById(history);
} else {
history = new JyjcInspectionHistory();
history.setHistoryData(hisData);
history.setSSeq(sSeq);
history.setRecDate(new Date());
history.setSType(sType);
super.saveOrUpdate(history);
}
}
}
\ No newline at end of file
......@@ -60,4 +60,11 @@ public class JyjcInspectionResultParamServiceImpl extends BaseService<JyjcInspec
}
return paramList;
}
@Override
public JyjcInspectionResultParam getOneParamByResultSeq(Long sequenceNbr) {
LambdaQueryWrapper<JyjcInspectionResultParam> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(JyjcInspectionResultParam::getResultSeq, sequenceNbr);
return this.baseMapper.selectOne(wrapper);
}
}
\ No newline at end of file
......@@ -8,6 +8,9 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yeejoin.amos.boot.biz.common.excel.ExcelUtil;
import com.yeejoin.amos.boot.biz.common.utils.SnowflakeIdUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
......@@ -16,15 +19,18 @@ import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.common.api.dao.ESEquipmentCategory;
import com.yeejoin.amos.boot.module.common.api.dto.ESEquipmentCategoryDto;
import com.yeejoin.amos.boot.module.jg.api.dto.DynamicColumnDto;
import com.yeejoin.amos.boot.module.jg.api.mapper.CommonMapper;
import com.yeejoin.amos.boot.module.jyjc.api.common.StringUtil;
import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionApplication;
import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionResult;
import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionResultAttachment;
import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionResultParam;
import com.yeejoin.amos.boot.module.jyjc.api.enums.BizTypeEnum;
import com.yeejoin.amos.boot.module.jyjc.api.enums.EquipCategoryEnum;
import com.yeejoin.amos.boot.module.jyjc.api.enums.ResultStatusEnum;
import com.yeejoin.amos.boot.module.jyjc.api.mapper.JyjcInspectionApplicationMapper;
import com.yeejoin.amos.boot.module.jyjc.api.mapper.JyjcInspectionResultMapper;
import com.yeejoin.amos.boot.module.jyjc.api.model.JyjcInspectionApplicationModel;
import com.yeejoin.amos.boot.module.jyjc.api.model.JyjcInspectionResultDataModel;
import com.yeejoin.amos.boot.module.jyjc.api.model.JyjcInspectionResultModel;
import com.yeejoin.amos.boot.module.jyjc.api.service.IJyjcInspectionResultAttachmentService;
......@@ -36,7 +42,8 @@ import com.yeejoin.amos.boot.module.jyjc.biz.event.UseInfoSaveToDbEvent;
import com.yeejoin.amos.boot.module.jyjc.biz.event.publisher.BizEmqPublisher;
import com.yeejoin.amos.boot.module.jyjc.biz.event.publisher.EventPublisher;
import com.yeejoin.amos.boot.module.jyjc.biz.util.JsonUtils;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgProjectContraption;
import com.yeejoin.amos.boot.module.ymt.api.entity.AbstractEquipBaseEntity;
import com.yeejoin.amos.boot.module.ymt.api.entity.EquipTechParamPipeline;
import com.yeejoin.amos.boot.module.ymt.api.entity.InspectionDetectionInfo;
import com.yeejoin.amos.boot.module.ymt.api.entity.TzsUserInfo;
import com.yeejoin.amos.boot.module.ymt.api.enums.EquipmentClassifityEnum;
......@@ -77,7 +84,6 @@ public class JyjcInspectionResultServiceImpl extends BaseService<JyjcInspectionR
private static final String JYJC_SUBMIT_FILE_JYBG = "JYBG";
private static final String JYJC_SUBMIT_KEY = "inspectResult";
private static final String JYJC_PIELINE = "pieLine";
private static final String JYJC_RESULT_STATUS = "2";
@Autowired
......@@ -123,10 +129,16 @@ public class JyjcInspectionResultServiceImpl extends BaseService<JyjcInspectionR
private ESEquipmentCategory esEquipmentCategory;
@Autowired
JyjcInspectionApplicationMapper inspectionApplicationMapper;
JyjcInspectionApplicationServiceImpl inspectionApplicationService;
@Autowired
private IdxBizJgProjectContraptionMapper idxBizJgProjectContraptionMapper;
private CommonMapper jgCommonMapper;
@Autowired
private ObjectMapper objectMapper;
@Autowired
private EquipTechParamPipelineMapper techParamPipelineMapper;
/**
* 检验检测单位分页查询
......@@ -284,34 +296,131 @@ public class JyjcInspectionResultServiceImpl extends BaseService<JyjcInspectionR
if (!CollectionUtils.isEmpty(paramList)) {
resultParamService.saveOrUpdateBatch(paramList);
}
JyjcInspectionResultModel dbResultModel = this.queryBySeq(model.getSequenceNbr());
// 更新使用信息、检验信息、技术参数
this.updateTechParamAndInspectInfo(dbResultModel, jybgFile);
// 更新单据信息的json(公共)
this.updateHisDataAfterResultUpdate(dbResultModel);
return dbResultModel;
}
//插入操作历史记录
private void updateTechParamAndInspectInfo(JyjcInspectionResultModel model, JyjcInspectionResultAttachment jybgFile){
if(model.getEquList().equals(EquipmentClassifityEnum.YLGD.getCode())){
// 管道逻辑: 循环更新技术参数、检验信息更新或者插入、使用信息更新(数据库及es)
JyjcInspectionResultParam param = iJyjcInspectionResultParamService.getOneParamByResultSeq(model.getSequenceNbr());
if (!ObjectUtils.isEmpty(param.getParamJson())) {
JSONObject paramObj = JSON.parseObject(param.getParamJson());
try {
List<Map<String, Object>> equips = objectMapper.readValue(
objectMapper.writeValueAsString(paramObj.get("equip")),
new TypeReference<ArrayList<Map<String, Object>>>() {
}
);
equips.forEach(e->{
String record = String.valueOf(e.get("record"));
// 1.更新管道的技术参数
EquipTechParamPipeline techParamPipeline = new EquipTechParamPipeline();
BeanUtil.copyProperties(e, techParamPipeline,true);
LambdaUpdateWrapper<EquipTechParamPipeline> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(AbstractEquipBaseEntity::getRecord, record);
updateWrapper.set(EquipTechParamPipeline::getNominalDiameter, techParamPipeline.getNominalDiameter());
updateWrapper.set(EquipTechParamPipeline::getWallThickness, techParamPipeline.getWallThickness());
updateWrapper.set(EquipTechParamPipeline::getPipeLength, techParamPipeline.getPipeLength());
updateWrapper.set(EquipTechParamPipeline::getPressure, techParamPipeline.getPressure());
updateWrapper.set(EquipTechParamPipeline::getTemperature, techParamPipeline.getTemperature());
updateWrapper.set(EquipTechParamPipeline::getMedium, techParamPipeline.getMedium());
updateWrapper.set(EquipTechParamPipeline::getWorkMedium, techParamPipeline.getWorkMedium());
updateWrapper.set(EquipTechParamPipeline::getWorkPressure, techParamPipeline.getWorkPressure());
updateWrapper.set(EquipTechParamPipeline::getWorkTemperature, techParamPipeline.getWorkTemperature());
updateWrapper.set(EquipTechParamPipeline::getRemarks, techParamPipeline.getRemarks());
techParamPipelineMapper.update(null,updateWrapper);
// 2.检验信息更新或者插入
InspectionDetectionInfo info = new InspectionDetectionInfo();
LambdaQueryWrapper<InspectionDetectionInfo> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(InspectionDetectionInfo::getInspectReportNo, model.getResultNo());
wrapper.eq(InspectionDetectionInfo::getRecord, record);
wrapper.eq(InspectionDetectionInfo::getInspectOrgCode, model.getInspectionUnitCode());
List<InspectionDetectionInfo> list = inspectionDetectionInfoMapper.selectList(wrapper);
if (CollectionUtils.isEmpty(list)) {
// 无则插入
extracted(model, info, jybgFile, record);
info.setSequenceNbr(sequence.nextId() + "");
inspectionDetectionInfoMapper.insert(info);
// 对方不查询库 所以无事务操作
bizEmqPublisher.sendInspectionMsgAfterSave(info, "insert");
} else {
// 已经维护过则更新
info = list.get(0);
extracted(model, info, jybgFile, record);
inspectionDetectionInfoMapper.updateById(info);
// 对方不查询库 所以无事务操作
bizEmqPublisher.sendInspectionMsgAfterSave(info, "update");
}
// 3.更新使用信息表,最新检验信息
useInfoMapper.updateByRecord(record, model.getNextInspectionDate(), model.getInspectionType(), model.getApplicationNo());
// 4.更新es下次检验日期
this.updateEquipNextInspectDate(model, record);
});
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
}
}
} else {
// 台套逻辑: 单条更新技术参数、检验信息更新或者插入、使用信息更新(数据库及es)
// 1.动态更新技术参数
List<DynamicColumnDto> columns = new ArrayList<>();
JyjcInspectionResultParam param = iJyjcInspectionResultParamService.getOneParamByResultSeq(model.getSequenceNbr());
if (param != null) {
if (!ObjectUtils.isEmpty(param.getParamJson())) {
JSONObject paramObj = JSON.parseObject(param.getParamJson());
paramObj.forEach((k,v)->{
DynamicColumnDto columnDto = new DynamicColumnDto();
columnDto.setColumnName(String.format("\"%s\"", StrUtil.toUnderlineCase(k).toUpperCase()));
columnDto.setColumnValue(v == null ? null : String.valueOf(v));
columns.add(columnDto);
});
String tableName = this.getTableName(param.getParamType());
jgCommonMapper.updateTechParamDynamic(tableName, model.getEquipUnicode(), columns);
}
}
// 2.检验信息更新或者插入
InspectionDetectionInfo info = new InspectionDetectionInfo();
QueryWrapper<InspectionDetectionInfo> wrapper = new QueryWrapper<>();
wrapper.lambda().eq(InspectionDetectionInfo::getInspectReportNo, model.getResultNo());
List<InspectionDetectionInfo> list = inspectionDetectionInfoMapper.selectList(wrapper);
if (CollectionUtils.isEmpty(list)) {
extracted(model, info, jybgFile);
extracted(model, info, jybgFile, model.getEquipUnicode());
info.setSequenceNbr(sequence.nextId() + "");
inspectionDetectionInfoMapper.insert(info);
// 对方不查询库 所以无事务操作
bizEmqPublisher.sendInspectionMsgAfterSave(info, "insert");
} else {
info = list.get(0);
extracted(model, info, jybgFile);
extracted(model, info, jybgFile, model.getEquipUnicode());
inspectionDetectionInfoMapper.updateById(info);
// 对方不查询库 所以无事务操作
bizEmqPublisher.sendInspectionMsgAfterSave(info, "update");
}
//更新使用信息表
// 3.更新使用信息表最新的检验信息
useInfoMapper.updateByRecord(model.getEquipUnicode(), model.getNextInspectionDate(), model.getInspectionType(), model.getApplicationNo());
this.updateEquipNextInspectDate(model);
return model;
// 4.es更新下次检验日期
this.updateEquipNextInspectDate(model, model.getEquipUnicode());
}
}
private String getTableName(String paramType) {
return String.format("\"%s\"", StrUtil.toUnderlineCase(paramType));
}
private void updateHisDataAfterResultUpdate(JyjcInspectionResultModel model) {
JyjcInspectionApplication application = inspectionApplicationService.getOne(new LambdaQueryWrapper<JyjcInspectionApplication>().eq(JyjcInspectionApplication::getApplicationNo, model.getApplicationNo()));
inspectionApplicationService.createHisAfterReceive(BeanUtil.copyProperties(application, JyjcInspectionApplicationModel.class));
}
private void updateEquipNextInspectDate(JyjcInspectionResultModel model) {
private void updateEquipNextInspectDate(JyjcInspectionResultModel model, String record) {
if (model.getNextInspectionDate() != null) {
Optional<ESEquipmentCategoryDto> optional = esEquipmentCategory.findById(model.getEquipUnicode());
Optional<ESEquipmentCategoryDto> optional = esEquipmentCategory.findById(record);
if (optional.isPresent()) {
ESEquipmentCategoryDto esEquipmentCategoryDto = optional.get();
esEquipmentCategoryDto.setNEXT_INSPECT_DATE(model.getNextInspectionDate().getTime());
......@@ -320,10 +429,10 @@ public class JyjcInspectionResultServiceImpl extends BaseService<JyjcInspectionR
}
}
private void extracted(JyjcInspectionResultModel model, InspectionDetectionInfo info, JyjcInspectionResultAttachment jybgFile) {
private void extracted(JyjcInspectionResultModel model, InspectionDetectionInfo info, JyjcInspectionResultAttachment jybgFile, String record) {
info.setInspectOrgName(model.getInspectionUnitName());
info.setInspectType(model.getInspectionType());
info.setRecord(model.getEquipUnicode());
info.setRecord(record);
info.setInspectDate(model.getInspectionDate());
info.setInspectStaff(getInspectUserName(model));
info.setInspectStaffCode(model.getInspector());
......@@ -332,7 +441,7 @@ public class JyjcInspectionResultServiceImpl extends BaseService<JyjcInspectionR
// json字段暂时注释
// info.setProblemRemark(model.getNonConformance());
info.setNextInspectDate(model.getNextInspectionDate());
info.setSequenceCode(model.getEquipUnicode());
info.setSequenceCode(record);
info.setInspectOrgCode(model.getInspectionUnitCode());
info.setInspectReportNo(model.getResultNo());
info.setRecDate(new Date());
......
......@@ -2413,6 +2413,7 @@ public class JGDPStatisticsServiceImpl {
equipParamsMap.put(EQU_LIST, String.valueOf(equIpClassMap.get(EQU_LIST)));
equipParamsMap.put(EQU_CATEGORY, String.valueOf(equIpClassMap.get(EQU_CATEGORY)));
equipParamsMap.put(EQU_DEFINE, String.valueOf(equIpClassMap.get(EQU_DEFINE)));
equipParamsMap.put("PIPELINE_CLASS", String.valueOf(equIpClassMap.get(EQU_DEFINE)));
resultMap.put(EQUIP_PARAMS_FORM_ID, equipParamsMap);
}
}
......
......@@ -302,7 +302,7 @@ public interface PlanTaskMapper extends BaseMapper {
void insertAll(String table, StaticDay item);
void updateData(String table, List<StaticDay> list);
void updateData(String table, @Param(value = "list") List<StaticDay> list);
void updateSingle(String table, int riskEnd, int noRiskEnd, String orgCode, String checkTime);
......
......@@ -267,32 +267,29 @@ public class PatrolDataSyncServiceImpl implements IPatrolDataSyncService {
List<Map<String, Object>> listDay = checkMapper.planCount(runDate, null, String.valueOf(PlanTaskTypeStatusEnum.day.getValue()), null,null,null);
List<StaticDay> staticDays = listDay.stream().map(e->{
String s = JSON.toJSONString(e);
StaticDay staticDay = JSON.parseObject(s, StaticDay.class);
return staticDay;
return JSON.parseObject(s, StaticDay.class);
}).collect(Collectors.toList());
// 插入周统计表
List<Map<String, Object>> listWeek = checkMapper.planCount(runDate, null, String.valueOf(PlanTaskTypeStatusEnum.week.getValue()), null,null,null);
List<StaticDay> staticWeeks = listWeek.stream().map(e->{
String s = JSON.toJSONString(e);
StaticDay staticWeek = JSON.parseObject(s, StaticDay.class);
return staticWeek;
return JSON.parseObject(s, StaticDay.class);
}).collect(Collectors.toList());
// 插入月统计表
List<Map<String, Object>> listMonth = checkMapper.planCount(runDate, null, String.valueOf(PlanTaskTypeStatusEnum.month.getValue()), null,null,null);
List<StaticDay> staticMonths = listMonth.stream().map(e->{
String s = JSON.toJSONString(e);
StaticDay staticMonth = JSON.parseObject(s, StaticDay.class);
return staticMonth;
return JSON.parseObject(s, StaticDay.class);
}).collect(Collectors.toList());
if(staticDays.size() > 0) {
planTaskMapper.updateData(P_STATIC_DAY,staticDays);
if(!staticDays.isEmpty()) {
planTaskMapper.updateData(P_STATIC_DAY, staticDays);
}
if(staticWeeks.size() > 0) {
planTaskMapper.updateData(P_STATIC_WEEK,staticDays);
if(!staticWeeks.isEmpty()) {
planTaskMapper.updateData(P_STATIC_WEEK, staticWeeks);
}
if(staticMonths.size() > 0) {
planTaskMapper.updateData(P_STATIC_MONTH,staticDays);
if(!staticMonths.isEmpty()) {
planTaskMapper.updateData(P_STATIC_MONTH, staticMonths);
}
log.info("更新统计表完成=======");
}
......
......@@ -51,4 +51,27 @@ public interface IdxBizJgProjectContraptionMapper extends BaseMapper<IdxBizJgPro
* @return 分页
*/
IPage<IdxBizJgProjectContraption> queryJgProjectContraptionPage(Page<IdxBizJgProjectContraption> page, @Param("inspectionType") String inspectionType, @Param("companyCode") String companyCode, @Param("equCategory") String equCategory);
/**
* 获取管道信息分页
* @param sequenceNbr
* @param current
* @param size
* @return
*/
List<Map<String, Object>> selectEquipListPage(@Param("sequenceNbr") String sequenceNbr, @Param("current") int current, @Param("size") int size);
/**
* 获取管道信息总数
* @param sequenceNbr
* @return
*/
long selectEquipCount(@Param("sequenceNbr") String sequenceNbr);
/**
* 获取导出传输/公共管道的信息
* @param sequenceNbr
* @return
*/
List<Map<String, Object>> selectEquipListByExport(@Param("sequenceNbr") String sequenceNbr);
}
......@@ -141,6 +141,47 @@
and p.is_into_management = false
and n.is_delete = false
</select>
<select id="selectEquipListPage" resultType="java.util.Map">
SELECT ibjtpp."SEQUENCE_NBR" AS sequenceNbr,
ibjtpp."PIPE_NAME" AS pipeName,
ibjtpp."PIPELINE_NUMBER" AS pipelineNumber,
ibjtpp."DEVICE_LEVEL" AS deviceLevel,
ibjtpp."NOMINAL_DIAMETER" AS nominalDiameter,
ibjtpp."WALL_THICKNESS" AS wallThickness,
ibjtpp."PIPE_LENGTH" AS pipeLength,
ibjtpp."PRESSURE" AS pressure,
ibjtpp."TEMPERATURE" AS temperature,
ibjtpp."MEDIUM" AS medium,
ibjtpp."WORK_PRESSURE" AS workPressure,
ibjtpp."WORK_TEMPERATURE" AS workTemperature,
ibjtpp."WORK_MEDIUM" AS workMedium,
ibjtpp."REMARKS" AS remarks,
(select SEQUENCE_NBR from idx_biz_jg_inspection_detection_info where "RECORD" = ibjui."RECORD" ORDER BY INSPECT_DATE DESC limit 1) detectionInfoSequenceNbr,
(select INSPECT_ORG_NAME from idx_biz_jg_inspection_detection_info where "RECORD" = ibjui."RECORD" ORDER BY INSPECT_DATE DESC limit 1) inspectOrgName,
(select INSPECT_CONCLUSION from idx_biz_jg_inspection_detection_info where "RECORD" = ibjui."RECORD" ORDER BY INSPECT_DATE DESC limit 1) inspectConclusion,
(select NEXT_INSPECT_DATE from idx_biz_jg_inspection_detection_info where "RECORD" = ibjui."RECORD" ORDER BY INSPECT_DATE DESC limit 1) nextInspectDate,
(select USC_UNIT_NAME from idx_biz_jg_construction_info jci where ibjui.RECORD = jci.RECORD ORDER BY jci."USC_DATE" DESC limit 1) as uscUnitName,
(select USC_DATE from idx_biz_jg_construction_info jci where ibjui.RECORD = jci.RECORD ORDER BY jci."USC_DATE" DESC limit 1) as uscDate,
ibjdi."DESIGN_UNIT_NAME" AS designUnitName,
ibjui."USE_DATE" AS useDate,
ibjui."RECORD" AS record
FROM idx_biz_jg_use_info ibjui
LEFT JOIN idx_biz_jg_tech_params_pipeline ibjtpp ON ibjui.RECORD = ibjtpp.RECORD
LEFT JOIN idx_biz_jg_design_info ibjdi ON ibjui.RECORD = ibjdi.RECORD
WHERE ibjui.project_contraption_id = #{sequenceNbr}
ORDER BY ibjtpp.REC_DATE ASC
limit #{current},#{size}
</select>
<select id="selectEquipCount" resultType="long">
SELECT count(1)
FROM idx_biz_jg_use_info ibjui
LEFT JOIN idx_biz_jg_tech_params_pipeline ibjtpp ON ibjui.RECORD = ibjtpp.RECORD
LEFT JOIN idx_biz_jg_design_info ibjdi ON ibjui.RECORD = ibjdi.RECORD
WHERE ibjui.project_contraption_id = #{sequenceNbr}
ORDER BY ibjtpp.REC_DATE ASC
</select>
<select id="queryJgProjectContraptionPage"
resultType="com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgProjectContraption">
select
......@@ -171,5 +212,35 @@
</otherwise>
</choose>
and not EXISTS (SELECt 1 FROM tz_jyjc_inspection_application a where a.status='6611' and a.application_unit_code=#{companyCode} and a.project_contraption_id = pc.sequence_nbr)
and (pc.project_contraption_parent_id is null or pc.project_contraption_parent_id = '')
</select>
<select id="selectEquipListByExport" resultType="java.util.Map">
SELECT ibjtpp."PIPE_NAME" AS productName,
ibjtpp."PIPELINE_NUMBER" AS pipelineNumber,
ibjtpp."DEVICE_LEVEL" AS deviceLevel,
ibjtpp."NOMINAL_DIAMETER" AS nominalDiameter,
ibjtpp."WALL_THICKNESS" AS wallThickness,
ibjtpp."PIPE_LENGTH" AS pipeLength,
ibjtpp."PRESSURE" AS pressure,
ibjtpp."TEMPERATURE" AS temperature,
ibjtpp."MEDIUM" AS medium,
ibjtpp."WORK_PRESSURE" AS workPressure,
ibjtpp."WORK_TEMPERATURE" AS workTemperature,
ibjtpp."WORK_MEDIUM" AS workMedium,
ibjtpp."REMARKS" AS remarks,
(select INSPECT_ORG_NAME from idx_biz_jg_inspection_detection_info where "RECORD" = ibjui."RECORD" ORDER BY INSPECT_DATE DESC limit 1) inspectOrgName,
(select INSPECT_CONCLUSION from idx_biz_jg_inspection_detection_info where "RECORD" = ibjui."RECORD" ORDER BY INSPECT_DATE DESC limit 1) inspectConclusion,
(select NEXT_INSPECT_DATE from idx_biz_jg_inspection_detection_info where "RECORD" = ibjui."RECORD" ORDER BY INSPECT_DATE DESC limit 1) nextInspectDate,
(select USC_UNIT_NAME from idx_biz_jg_construction_info jci where ibjui.RECORD = jci.RECORD ORDER BY jci."USC_DATE" DESC limit 1) as uscUnitName,
(select USC_DATE from idx_biz_jg_construction_info jci where ibjui.RECORD = jci.RECORD ORDER BY jci."USC_DATE" DESC limit 1) as uscDate,
ibjdi."DESIGN_UNIT_NAME" AS designUnitName,
ibjui."USE_DATE" AS useDate,
ibjui."RECORD" AS record
FROM idx_biz_jg_use_info ibjui
LEFT JOIN idx_biz_jg_tech_params_pipeline ibjtpp ON ibjui.RECORD = ibjtpp.RECORD
LEFT JOIN idx_biz_jg_design_info ibjdi ON ibjui.RECORD = ibjdi.RECORD
WHERE ibjui.project_contraption_id = #{sequenceNbr}
ORDER BY ibjtpp.REC_DATE ASC
</select>
</mapper>
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