Commit a8586f0a authored by 刘林's avatar 刘林

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

parents cbb7dac2 7f71d352
......@@ -24,10 +24,10 @@ public class ProjectContraptionChangeDataDto extends BaseChangeDataDto {
private static final long serialVersionUID = 1L;
@FieldDisplayDefine(value = "工程装置名称")
@FieldDisplayDefine(value = "工程(装置)名称/项目名称")
private String projectContraption;
@FieldDisplayDefine(value = "工程装置编号")
@FieldDisplayDefine(value = "工程(装置)编号/项目编号")
private String projectContraptionNo;
@FieldDisplayDefine(value = "设备品种代码")
......
package com.yeejoin.amos.boot.module.jg.biz.edit.process.biz.installNotice;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import com.yeejoin.amos.boot.module.jg.api.dto.FieldChangeMeta;
import com.yeejoin.amos.boot.module.jg.api.entity.JgInstallationNotice;
import com.yeejoin.amos.boot.module.jg.api.enums.BusinessTypeEnum;
import com.yeejoin.amos.boot.module.jg.biz.edit.core.RouterEventPublisher;
import com.yeejoin.amos.boot.module.jg.biz.edit.event.BaseBizDataChangeEvent;
import com.yeejoin.amos.boot.module.jg.biz.edit.process.biz.DefaultBizDataChangeHandler;
import com.yeejoin.amos.boot.module.ymt.api.enums.FlowStatusEnum;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Component;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.*;
@Component
public class InstallNoticeDataChangeHandler extends DefaultBizDataChangeHandler<BaseBizDataChangeEvent> {
protected InstallNoticeDataChangeHandler(RouterEventPublisher routerEventPublisher, ApplicationContext applicationContext) {
private final InstallNoticeEditUpdateService installNoticeEditUpdateService;
protected InstallNoticeDataChangeHandler(InstallNoticeEditUpdateService installNoticeEditUpdateService, RouterEventPublisher routerEventPublisher, ApplicationContext applicationContext) {
super(routerEventPublisher, applicationContext);
this.installNoticeEditUpdateService = installNoticeEditUpdateService;
}
@Override
......@@ -31,12 +36,12 @@ public class InstallNoticeDataChangeHandler extends DefaultBizDataChangeHandler<
@Override
public Boolean beforeCheck(String bizId, String applyNo, ModelType model, Map<String, Object> changeData) {
return null;
return true;
}
@Override
public Set<String> getEqs(String applyNo) {
return Collections.emptySet();
return installNoticeEditUpdateService.getEqsByApplyNo(applyNo);
}
@Override
......@@ -46,11 +51,17 @@ public class InstallNoticeDataChangeHandler extends DefaultBizDataChangeHandler<
@Override
public Boolean bizIsFinished(String applyNo, ModelType model, Map<String, Object> changeData) {
return null;
JgInstallationNotice installationNotice = installNoticeEditUpdateService.getInstallationNoticeService().getOne(new LambdaQueryWrapper<JgInstallationNotice>().eq(JgInstallationNotice::getApplyNo, applyNo).select(BaseEntity::getSequenceNbr, JgInstallationNotice::getNoticeStatus));
return installationNotice.getNoticeStatus().equals(String.valueOf(FlowStatusEnum.TO_BE_FINISHED.getCode()));
}
@Override
public Set<String> getProjectContraptionIds(String applyNo) {
return Collections.emptySet();
JgInstallationNotice installationNotice = installNoticeEditUpdateService.getOneByApplyNo(applyNo);
Set<String> projectContraptionIds = new HashSet<>();
projectContraptionIds.add(installationNotice.getProjectContraptionId());
projectContraptionIds.remove(null);
projectContraptionIds.remove("");
return projectContraptionIds;
}
}
package com.yeejoin.amos.boot.module.jg.biz.edit.process.biz.installNotice;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import com.yeejoin.amos.boot.module.jg.api.entity.JgInstallationNotice;
import com.yeejoin.amos.boot.module.jg.api.entity.JgInstallationNoticeEq;
import com.yeejoin.amos.boot.module.jg.biz.service.impl.JgInstallationNoticeEqServiceImpl;
import com.yeejoin.amos.boot.module.jg.biz.service.impl.JgInstallationNoticeServiceImpl;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
@Service
@RequiredArgsConstructor
@Getter
public class InstallNoticeEditUpdateService {
private final JgInstallationNoticeServiceImpl installationNoticeService;
private final JgInstallationNoticeEqServiceImpl installationNoticeEqService;
public Set<String> getEqsByApplyNo(String applyNo) {
JgInstallationNotice jgInstallationNotice = installationNoticeService.getOne(new LambdaQueryWrapper<JgInstallationNotice>().eq(JgInstallationNotice::getApplyNo, applyNo).select(BaseEntity::getSequenceNbr));
List<JgInstallationNoticeEq> eqs = installationNoticeEqService.list(new LambdaQueryWrapper<JgInstallationNoticeEq>().eq(JgInstallationNoticeEq::getEquipTransferId, jgInstallationNotice.getSequenceNbr()).select(JgInstallationNoticeEq::getEquId));
return eqs.stream().map(JgInstallationNoticeEq::getEquId).collect(Collectors.toSet());
}
public JgInstallationNotice getOneByApplyNo(String applyNo) {
return installationNoticeService.getOne(new LambdaQueryWrapper<JgInstallationNotice>().eq(JgInstallationNotice::getApplyNo, applyNo));
}
}
package com.yeejoin.amos.boot.module.jg.biz.edit.process.biz.useRegister;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.jg.api.dto.FieldChangeMeta;
......@@ -43,27 +42,6 @@ public class UseRegisterUpdateService {
private final JgUseRegistrationEqServiceImpl useRegistrationEqService;
public void convertStringToJsonObject(Object obj, String[] jsonFields) {
if (obj instanceof JSONObject) {
JSONObject jsonObject = (JSONObject) obj;
for (String field : jsonFields) {
if (jsonObject.get(field) != null && jsonObject.get(field) instanceof String) {
jsonObject.put(field, JSON.parse(JSONObject.toJSONString(jsonObject.get(field))));
}
}
} else if (obj instanceof Map) {
Map<String, Object> map = (Map<String, Object>) obj;
for (String field : jsonFields) {
if (map.containsKey(field) && map.get(field) instanceof String) {
map.put(field, JSON.parse((String) map.get(field)));
}
}
} else {
// 处理其他类型
System.out.println("Unsupported Object Type");
}
}
public void updateBizInfo(Map<String, Object> changeData) {
}
......
......@@ -131,6 +131,7 @@ public class CommonEquipDataProcessService {
throw new RuntimeException(e);
}
}
public static <T extends IBaseChangeData> void castMap2Bean(Map<String, Object> map, T target) {
BeanUtil.copyProperties(JSON.parse(JSONObject.toJSONString(map)), target, true);
}
......@@ -844,16 +845,36 @@ public class CommonEquipDataProcessService {
}
public Map<String, ?> getProjectContraptionBySeq(String projectContraptionId, Set<String> records) {
JSONObject jsonObject = new JSONObject();
IdxBizJgProjectContraption projectContraption = idxBizJgProjectContraptionServiceImpl.getById(projectContraptionId);
jsonObject.put("pipelineLength", projectContraption.getPipelineLength());
jsonObject.put("projectContraption", projectContraption.getProjectContraption());
jsonObject.put("projectContraptionNo", projectContraption.getProjectContraptionNo());
List<Map<String, Object>> equList = jgUseRegistrationService.getBaseMapper().queryForUnitPipelineEquipment(new ArrayList<>(records));
Map<String, Object> re = BeanUtil.beanToMap(projectContraption);
this.convertStringToJsonObject(re, IdxBizJgProjectContraptionServiceImpl.getJsonFieldsCamel());
List<Map<String, Object>> equList = jgUseRegistrationService.getBaseMapper().queryForUnitPipelineEquipmentForEdit(new ArrayList<>(records));
// 检验报告数据格式化 转json
equList.stream().filter(e -> e.get("inspectReport") != null).forEach(item -> item.put("inspectReport", JSON.parse(item.get("inspectReport").toString())));
jsonObject.put("tableData", equList);
return jsonObject;
re.put("projectContraptionId", projectContraption.getSequenceNbr());
re.put("tableData", equList);
return re;
}
public void convertStringToJsonObject(Object obj, String[] jsonFields) {
if (obj instanceof JSONObject) {
JSONObject jsonObject = (JSONObject) obj;
for (String field : jsonFields) {
if (jsonObject.get(field) != null && jsonObject.get(field) instanceof String) {
jsonObject.put(field, JSON.parse(jsonObject.get(field).toString()));
}
}
} else if (obj instanceof Map) {
Map<String, Object> map = (Map<String, Object>) obj;
for (String field : jsonFields) {
if (map.containsKey(field) && map.get(field) instanceof String) {
map.put(field, JSON.parse(map.get(field).toString()));
}
}
} else {
// 处理其他类型
System.out.println("Unsupported Object Type");
}
}
public IPage<?> getProjectContraptionsBySeqs(Set<String> projectContraptionIds, JSONObject params) {
......@@ -871,21 +892,27 @@ public class CommonEquipDataProcessService {
.in(BaseEntity::getSequenceNbr, projectContraptionIds)
.orderByDesc(IdxBizJgProjectContraption::getRecDate)
.page(page);
List<Map<String, Object>> records = new ArrayList<>();
if (!ValidationUtil.isEmpty(pageList.getRecords())) {
pageList.getRecords().forEach(record -> {
BigDecimal pipelineLength = BigDecimal.valueOf(record.getPipelineLength());
BigDecimal roundedValue = pipelineLength.setScale(3, RoundingMode.HALF_UP);
BigDecimal strippedValue = roundedValue.stripTrailingZeros();
record.setPipelineLength(Double.valueOf(strippedValue.toPlainString()));
Map<String, Object> item = new HashMap<>();
record.setDataSourceName(EquipSourceEnum.getDataSourceName(record.getDataSource()));
record.setFullAddress(
Stream.of(record.getProvinceName(), record.getCityName(), record.getCountyName(), record.getStreetName(), record.getAddress())
.map(value -> value == null ? "" : value)
.collect(Collectors.joining())
);
BeanUtil.copyProperties(record, item);
BigDecimal pipelineLength = BigDecimal.valueOf(record.getPipelineLength());
BigDecimal roundedValue = pipelineLength.setScale(2, RoundingMode.HALF_UP);
item.put("pipelineLength", roundedValue.toPlainString());
records.add(item);
});
}
return pageList;
Page<Map<String, Object>> page1 = new Page<>();
BeanUtil.copyProperties(pageList, page1);
page1.setRecords(records);
return page1;
}
public void updateEsDataOfEquip(String record, IBaseChangeData changeDataDto) {
......
......@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.jg.biz.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.text.CharSequenceUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
......@@ -130,6 +131,14 @@ public class IdxBizJgProjectContraptionServiceImpl extends BaseService<IdxBizJgP
return this.saveOrUpdate(projectContraption);
}
public static String[] getJsonFieldsCamel(){
List<String> camelFields = new ArrayList<>();
for(String field : jsonFields) {
camelFields.add(CharSequenceUtil.toCamelCase(field));
}
return camelFields.toArray(new String[0]);
}
/**
* 根据工程装置seq物理删除装置表数据和对应设备信息(数据库+es)
*
......
......@@ -135,4 +135,24 @@ public class IdxBizJgConstructionInfo extends TzsBaseEntity implements IBaseChan
@TableField(value = "\"CONSTRUCTION_OTHER_ACCESSORIES\"")
private String constructionOtherAccessories;
@FieldDisplayDefine(value = "施工区域-省")
@TableField(value = "\"CONSTRUCTION_PROVINCE\"")
private String constructionProvince;
@FieldDisplayDefine(value = "施工区域-市")
@TableField(value = "\"CONSTRUCTION_CITY\"")
private String constructionCity;
@FieldDisplayDefine(value = "施工区域-区/县")
@TableField(value = "\"CONSTRUCTION_COUNTY\"")
private String constructionCounty;
@FieldDisplayDefine(value = "施工区域-街道")
@TableField(value = "\"CONSTRUCTION_STREET\"")
private String constructionStreet;
@FieldDisplayDefine(value = "施工区域-详细地址")
@TableField(value = "\"CONSTRUCTION_ADDRESS\"")
private String constructionAddress;
}
......@@ -168,4 +168,11 @@ public class IdxBizJgMaintenanceRecordInfo extends TzsBaseEntity implements IBas
*/
@TableField("\"SOURCE_ID\"")
private String sourceId;
/**
* 其他维保附件
*/
@FieldDisplayDefine(value = "其他维保附件", type = JSON.class)
@TableField("\"ME_OTHER_ACCESSORIES\"")
private String ME_OTHER_ACCESSORIES;
}
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