Commit b7f4c297 authored by 刘林's avatar 刘林

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

parents 43fa673f 5955715d
...@@ -44,4 +44,8 @@ public interface JgInstallationNoticeMapper extends CustomBaseMapper<JgInstallat ...@@ -44,4 +44,8 @@ public interface JgInstallationNoticeMapper extends CustomBaseMapper<JgInstallat
List<CompanyEquipCountDto> queryForFlowingEquipList(); List<CompanyEquipCountDto> queryForFlowingEquipList();
List<InstallationVo> queryInstallationInIds(@Param("ids") List<String> ids); List<InstallationVo> queryInstallationInIds(@Param("ids") List<String> ids);
List<Map<String, Object>> getDeviceListByProjectContraption(@Param("projectContraption") String projectContraption);
Map<String, Object> getPipelineEquInfoByRecord(@Param("record") String record);
} }
...@@ -86,4 +86,6 @@ public interface IJgInstallationNoticeService extends IService<JgInstallationNot ...@@ -86,4 +86,6 @@ public interface IJgInstallationNoticeService extends IService<JgInstallationNot
JgInstallationNotice cancelApplication(Long sequenceNbr, String cancelReason); JgInstallationNotice cancelApplication(Long sequenceNbr, String cancelReason);
Boolean historyDataRepair(); Boolean historyDataRepair();
Object getDeviceListByProjectContraption(String projectContraption);
} }
...@@ -200,4 +200,107 @@ ...@@ -200,4 +200,107 @@
isn.create_date DESC, isn.apply_no DESC isn.create_date DESC, isn.apply_no DESC
</select> </select>
<sql id="page-list-pipeline">
SELECT ui."USE_UNIT_NAME" useUnitName,
ui."USE_UNIT_CREDIT_CODE" useUnitCreditCode,
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,
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,
ri."PRODUCT_NAME" productName,
ri."BRAND_NAME" brandName,
ri."EQU_TYPE" equType,
ri."EQU_CODE_TYPE" equCodeType,
ri."WHETHER_VEHICLE_CYLINDER" whetherVehicleCylinder,
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,
(select INSPECT_ORG_NAME
from idx_biz_jg_inspection_detection_info
where "RECORD" = ui."RECORD"
ORDER BY REC_DATE DESC
limit 1) inspectOrgName,
(select name
from cb_data_dictionary
where type = 'JYJL'
and code = (select INSPECT_CONCLUSION
from idx_biz_jg_inspection_detection_info
where "RECORD" = ui."RECORD"
ORDER BY REC_DATE DESC
limit 1)) inspectConclusion,
to_char((select NEXT_INSPECT_DATE
from idx_biz_jg_inspection_detection_info
where "RECORD" = ui."RECORD"
ORDER BY REC_DATE DESC
limit 1), 'YYYY-MM-DD') nextInspectDate
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="getDeviceListByProjectContraption" resultType="java.util.Map">
<include refid="page-list-pipeline"/>
<where>
ri."EQU_CATEGORY" = '8300'
and ui."DATA_SOURCE" like 'jg%' and ui."DATA_SOURCE" not like 'jg_his%'
<if test="projectContraption != null and projectContraption != ''">
and ui."PROJECT_CONTRAPTION" = #{projectContraption}
</if>
-- 排除 已经做过安装告知的
AND NOT EXISTS (
SELECT 1
FROM
tzs_jg_installation_notice n,
tzs_jg_installation_notice_eq ne
WHERE
n.sequence_nbr = ne.equip_transfer_id
AND ne.equ_id = ui."RECORD"
AND (
n.notice_status = '6621'
OR n.notice_status = '6612'
OR n.notice_status = '6614'
OR n.notice_status = '6615'
OR n.notice_status = '6616'
OR n.notice_status = '6618'
)
AND n.is_delete = 0
)
</where>
</select>
<select id="getPipelineEquInfoByRecord" resultType="java.util.Map">
<include refid="page-list-pipeline"/>
<where>
<if test="record != null and record != ''">
and ui."RECORD" = #{record}
</if>
</where>
</select>
</mapper> </mapper>
...@@ -169,4 +169,12 @@ public class JgInstallationNoticeController extends BaseController { ...@@ -169,4 +169,12 @@ public class JgInstallationNoticeController extends BaseController {
public ResponseModel<Boolean> historyDataRepair() { public ResponseModel<Boolean> historyDataRepair() {
return ResponseHelper.buildResponse(iJgInstallationNoticeService.historyDataRepair()); return ResponseHelper.buildResponse(iJgInstallationNoticeService.historyDataRepair());
} }
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "查询工程装置下的所有未做安装告知、不在安装告知流程、安装告知作废的设备",
notes = "查询工程装置下的所有未做安装告知、不在安装告知流程、安装告知作废的设备")
@GetMapping(value = "/getDeviceListByProjectContraption")
public ResponseModel<Object> getDeviceListByProjectContraption(@RequestParam("projectContraption") String projectContraption) {
return ResponseHelper.buildResponse(iJgInstallationNoticeService.getDeviceListByProjectContraption(projectContraption));
}
} }
...@@ -7,8 +7,9 @@ import com.alibaba.fastjson.JSONObject; ...@@ -7,8 +7,9 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.yeejoin.amos.boot.biz.common.utils.SnowflakeIdUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.github.pagehelper.util.StringUtil; import com.github.pagehelper.util.StringUtil;
import com.yeejoin.amos.boot.biz.common.bo.CompanyBo; import com.yeejoin.amos.boot.biz.common.bo.CompanyBo;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams; import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
...@@ -19,6 +20,7 @@ import com.yeejoin.amos.boot.biz.common.entity.TzsBaseEntity; ...@@ -19,6 +20,7 @@ import com.yeejoin.amos.boot.biz.common.entity.TzsBaseEntity;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils; import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey; 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.RedisUtils;
import com.yeejoin.amos.boot.biz.common.utils.SnowflakeIdUtil;
import com.yeejoin.amos.boot.module.common.api.dao.ESEquipmentCategory; import com.yeejoin.amos.boot.module.common.api.dao.ESEquipmentCategory;
import com.yeejoin.amos.boot.module.common.api.dto.ESEquipmentCategoryDto; import com.yeejoin.amos.boot.module.common.api.dto.ESEquipmentCategoryDto;
import com.yeejoin.amos.boot.module.jg.api.dto.*; import com.yeejoin.amos.boot.module.jg.api.dto.*;
...@@ -28,7 +30,6 @@ import com.yeejoin.amos.boot.module.jg.api.enums.CompanyTypeEnum; ...@@ -28,7 +30,6 @@ import com.yeejoin.amos.boot.module.jg.api.enums.CompanyTypeEnum;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgInstallationNoticeEqMapper; import com.yeejoin.amos.boot.module.jg.api.mapper.JgInstallationNoticeEqMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgInstallationNoticeMapper; import com.yeejoin.amos.boot.module.jg.api.mapper.JgInstallationNoticeMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgRegistrationHistoryMapper; import com.yeejoin.amos.boot.module.jg.api.mapper.JgRegistrationHistoryMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgUseRegistrationMapper;
import com.yeejoin.amos.boot.module.jg.api.service.IJgInstallationNoticeService; import com.yeejoin.amos.boot.module.jg.api.service.IJgInstallationNoticeService;
import com.yeejoin.amos.boot.module.jg.api.vo.SortVo; import com.yeejoin.amos.boot.module.jg.api.vo.SortVo;
import com.yeejoin.amos.boot.module.jg.api.vo.tableDataExportVo.InstallationVo; import com.yeejoin.amos.boot.module.jg.api.vo.tableDataExportVo.InstallationVo;
...@@ -51,7 +52,6 @@ import com.yeejoin.amos.boot.module.ymt.api.enums.EquCodeTypeEnum; ...@@ -51,7 +52,6 @@ import com.yeejoin.amos.boot.module.ymt.api.enums.EquCodeTypeEnum;
import com.yeejoin.amos.boot.module.ymt.api.enums.FlowStatusEnum; import com.yeejoin.amos.boot.module.ymt.api.enums.FlowStatusEnum;
import com.yeejoin.amos.boot.module.ymt.api.mapper.*; import com.yeejoin.amos.boot.module.ymt.api.mapper.*;
import com.yeejoin.amos.component.feign.model.FeignClientResult; import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.component.robot.AmosRequestContext;
import com.yeejoin.amos.feign.privilege.Privilege; import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel; import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.CompanyModel; import com.yeejoin.amos.feign.privilege.model.CompanyModel;
...@@ -69,7 +69,6 @@ import org.redisson.api.RedissonClient; ...@@ -69,7 +69,6 @@ import org.redisson.api.RedissonClient;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.Resource;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -178,7 +177,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN ...@@ -178,7 +177,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
private JgRegistrationHistoryServiceImpl jgRegistrationHistoryService; private JgRegistrationHistoryServiceImpl jgRegistrationHistoryService;
@Autowired @Autowired
private EquipTechParamPipelineMapper equipTechParamPipelineMapper; private ObjectMapper objectMapper;
@Autowired @Autowired
EventPublisher eventPublisher; EventPublisher eventPublisher;
...@@ -1708,60 +1707,72 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN ...@@ -1708,60 +1707,72 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
useInfoService.update(updateWrapper); useInfoService.update(updateWrapper);
} }
@Transactional
@Override @Override
@Transactional(rollbackFor = Exception.class)
public Boolean historyDataRepair() { public Boolean historyDataRepair() {
List<JgInstallationNotice> list = this.lambdaQuery().list(); List<JgInstallationNotice> noticeList = this.getBaseMapper().selectList(new LambdaQueryWrapper<JgInstallationNotice>()
ArrayList<JgInstallationNoticeEq> jgInstallationNoticeEqs = new ArrayList<>(); .eq(JgInstallationNotice::getEquCategoryCode, "8300"));
ArrayList<JgRegistrationHistory> jgRegistrationHistories = new ArrayList<>();
list.forEach(item -> { List<JgRegistrationHistory> jgRegistrationHistories = noticeList.stream()
// 设备信息 .map(notice -> {
List<JgInstallationNoticeEq> equList = jgInstallationNoticeEqService.lambdaQuery().eq(JgInstallationNoticeEq::getEquipTransferId, item.getSequenceNbr()).list(); JgRegistrationHistory history = getRegistrationHistory(String.valueOf(notice.getSequenceNbr()));
JgRegistrationHistory jgRegistrationHistory = jgRegistrationHistoryService.lambdaQuery() if (history == null) return null;
.eq(JgRegistrationHistory::getCurrentDocumentId, item.getSequenceNbr()) try {
.eq(JgRegistrationHistory::getIsDelete, false) Map<String, Object> hisData = objectMapper.readValue(
.one(); history.getChangeData(),
if (!ObjectUtils.isEmpty(jgRegistrationHistory) && !ObjectUtils.isEmpty(jgRegistrationHistory.getChangeData())) { new TypeReference<Map<String, Object>>() {
List<String> ids = equList.stream().map(JgInstallationNoticeEq::getEquId).collect(Collectors.toList()); }
Iterable<ESEquipmentCategoryDto> equips = esEquipmentCategory.findAllById(ids); );
List<Map<String, Object>> equipListMaps = getEquipListMaps(equips); // 获取设备列表并处理每个设备信息
JSONObject object = JSONObject.parseObject(jgRegistrationHistory.getChangeData()); List<Map<String, Object>> deviceList = objectMapper.readValue(
object.put("deviceList", equipListMaps); objectMapper.writeValueAsString(hisData.get("deviceList")),
jgRegistrationHistory.setChangeData(JSONObject.toJSONString(object)); new TypeReference<ArrayList<Map<String, Object>>>() {
jgRegistrationHistories.add(jgRegistrationHistory); }
} );
equList.forEach(equ -> { deviceList.forEach(device -> {
if (!ObjectUtils.isEmpty(item.getInformNumber())) { String record = String.valueOf(device.get("record"));
equ.setInformNumber(item.getInformNumber()); Map<String, Object> pipelineEquInfo = this.baseMapper.getPipelineEquInfoByRecord(record);
} device.putAll(pipelineEquInfo);
IdxBizJgRegisterInfo registerInfo = idxBizJgRegisterInfoService.lambdaQuery().eq(IdxBizJgRegisterInfo::getRecord, equ.getEquId()).one(); });
if (!ObjectUtils.isEmpty(registerInfo) && !ObjectUtils.isEmpty(registerInfo.getEquList()) && !ObjectUtils.isEmpty(registerInfo.getEquCategory())) { // 更新处理后的数据回到 history 对象
equ.setEquListCode(registerInfo.getEquList()); hisData.put("deviceList", deviceList);
equ.setEquCategoryCode(registerInfo.getEquCategory()); history.setChangeData(objectMapper.writeValueAsString(hisData)); // 更新 changeData 字段
if (ObjectUtils.isEmpty(item.getEquListCode()) || ObjectUtils.isEmpty(item.getEquCategoryCode())) { } catch (Exception e) {
item.setEquListCode(registerInfo.getEquList()); log.error("JSON 数据处理失败!", e);
item.setEquCategoryCode(registerInfo.getEquCategory()); throw new RuntimeException(e.getMessage());
if ("8300".equals(item.getEquCategoryCode())) {
LambdaQueryWrapper<EquipTechParamPipeline> lambda = new QueryWrapper<EquipTechParamPipeline>().lambda();
lambda.eq(EquipTechParamPipeline::getRecord, equ.getEquId());
EquipTechParamPipeline equipTechParamPipeline = equipTechParamPipelineMapper.selectOne(lambda);
if (!ObjectUtils.isEmpty(equipTechParamPipeline) && !ObjectUtils.isEmpty(equipTechParamPipeline.getDeviceName())) {
item.setProjectContraption(equipTechParamPipeline.getDeviceName());
}
}
} }
} return history;
jgInstallationNoticeEqs.add(equ); })
}); .filter(Objects::nonNull)
.collect(Collectors.toList());
}); // 批量更新历史表数据
// 修改历史表数据
jgRegistrationHistoryService.updateBatchById(jgRegistrationHistories); jgRegistrationHistoryService.updateBatchById(jgRegistrationHistories);
this.updateBatchById(list);
jgInstallationNoticeEqService.updateBatchById(jgInstallationNoticeEqs);
return Boolean.TRUE; return Boolean.TRUE;
} }
// 辅助方法:根据 DocumentId 获取历史记录
private JgRegistrationHistory getRegistrationHistory(String documentId) {
return jgRegistrationHistoryService.getBaseMapper().selectOne(
new QueryWrapper<JgRegistrationHistory>().lambda()
.eq(JgRegistrationHistory::getCurrentDocumentId, documentId)
.eq(JgRegistrationHistory::getIsDelete, false)
);
}
/**
* 查询工程装置下的所有未做安装告知、不在安装告知流程、安装告知作废的设备
*
* @param projectContraption 工程装置名称
* @return 设备列表
*/
@Override
public Object getDeviceListByProjectContraption(String projectContraption) {
List<Map<String, Object>> deviceList = this.baseMapper.getDeviceListByProjectContraption(projectContraption);
return new JSONObject().fluentPut("deviceList", deviceList);
}
@Override @Override
public boolean beforeCheck(JgInstallationNotice notice) { public boolean beforeCheck(JgInstallationNotice notice) {
return notice.getInstanceId() != null && !notice.getNoticeStatus().equals(String.valueOf(FlowStatusEnum.TO_BE_FINISHED.getCode())) &&!notice.getNoticeStatus().equals(String.valueOf(FlowStatusEnum.TO_BE_DISCARD.getCode())); return notice.getInstanceId() != null && !notice.getNoticeStatus().equals(String.valueOf(FlowStatusEnum.TO_BE_FINISHED.getCode())) &&!notice.getNoticeStatus().equals(String.valueOf(FlowStatusEnum.TO_BE_DISCARD.getCode()));
......
...@@ -34,10 +34,11 @@ public class EquipTechParamPipeline extends AbstractEquipBaseEntity { ...@@ -34,10 +34,11 @@ public class EquipTechParamPipeline extends AbstractEquipBaseEntity {
@TableField(value = "\"STATUS\"") @TableField(value = "\"STATUS\"")
private String status; private String status;
/** /**
* * 工程(装置)名称 * * 工程(装置)名称--废弃,以use_info表为准
*/ */
@Deprecated
@TableField(value = "\"DEVICE_NAME\"") @TableField(value = "\"DEVICE_NAME\"")
private String deviceName; private String deviceName;
/** /**
......
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