Commit 6f74f827 authored by suhuiguang's avatar suhuiguang

feat(已纳管设备无证时可编辑):已纳管设备调整

1.已纳管设备调整 2.技术参数整理
parent 23503f7a
......@@ -4,6 +4,7 @@ package com.yeejoin.amos.boot.module.jg.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.bo.CompanyBo;
import com.yeejoin.amos.boot.biz.common.dto.CountDto;
import com.yeejoin.amos.boot.biz.common.dto.KeyValueDto;
import com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamDto;
import com.yeejoin.amos.boot.module.jg.api.bo.JgBizCountDataBO;
......@@ -314,5 +315,10 @@ public interface CommonMapper extends BaseMapper<EquipmentCategory> {
String queryUnitCreditCodeBySeq(String unitSeq);
String queryUnitNameByCreditCode(String unitCreditCode);
List<CountDto> countBizNumAfterUseRegBatchEquip(@Param("records") List<String> records);
List<CountDto> countBizNumAfterUseRegBatchProjectContraption(@Param("projectContraptionIds") List<Long> projectContraptionIds);
}
......@@ -28,7 +28,7 @@ public class DiffUtils {
public static boolean compare(String type, String newValue, String oldValue) {
if (isNullOrEmpty(newValue) && isNullOrEmpty(oldValue)) return true;
if (isNullOrEmpty(newValue) || isNullOrEmpty(oldValue)) return true;
if (isNullOrEmpty(newValue) || isNullOrEmpty(oldValue)) return false;
if (type == null) {
return Objects.equals(newValue, oldValue);
}
......
......@@ -3192,4 +3192,14 @@ public class CommonServiceImpl implements ICommonService {
result.put("dataQualityScore", String.valueOf(remindServiceImpl.getReminderLevel(bizId, businessTypeEnum.name())));
}
public static String genRegTypeByDataSource(String dataSource) {
if (dataSource.contains("jg_his_black")) {
return "2";
} else if (dataSource.contains("jg_his")) {
return "1";
} else {
return "0";
}
}
}
\ No newline at end of file
......@@ -15,6 +15,8 @@ import com.baomidou.mybatisplus.extension.service.additional.query.impl.LambdaQu
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.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.dto.CountDto;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import com.yeejoin.amos.boot.biz.common.entity.DataDictionary;
import com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
......@@ -24,6 +26,7 @@ import com.yeejoin.amos.boot.module.jg.api.entity.JgUseRegistrationManage;
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.api.mapper.CommonMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgVehicleInformationMapper;
import com.yeejoin.amos.boot.module.jg.api.vo.SortVo;
import com.yeejoin.amos.boot.module.jg.biz.core.BaseEntityService;
......@@ -135,6 +138,8 @@ public class IdxBizJgProjectContraptionServiceImplService extends BaseEntityServ
private RedisUtils redisUtils;
@Autowired
private JgUseRegistrationManageServiceImpl registrationManageService;
@Autowired
private CommonMapper commonMapper;
@Override
public boolean saveOrUpdateData(IdxBizJgProjectContraption projectContraption) {
......@@ -348,7 +353,9 @@ public class IdxBizJgProjectContraptionServiceImplService extends BaseEntityServ
IPage<IdxBizJgProjectContraption> pageList = queryWrapper.page(page);
// 单位类型区分的企业还是监管
String companyType2 = CommonServiceImpl.getCompanyType(company);
if (!ValidationUtil.isEmpty(pageList.getRecords())) {
Map<String, Boolean> projectContraptionUseMap = getPidUseMap(pageList);
pageList.getRecords().forEach(record -> {
BigDecimal pipelineLength = BigDecimal.valueOf(record.getPipelineLength());
BigDecimal roundedValue = pipelineLength.setScale(3, RoundingMode.HALF_UP);
......@@ -362,6 +369,10 @@ public class IdxBizJgProjectContraptionServiceImplService extends BaseEntityServ
.collect(Collectors.joining())
);
record.setCompanyType(companyType2);
// 来源类型:前端控制编辑按钮显示隐藏
record.setRegType(CommonServiceImpl.genRegTypeByDataSource(record.getDataSource()));
// 设置是否发生过后续业务::前端控制编辑按钮显示隐藏
record.setHappenAfterBiz(projectContraptionUseMap.getOrDefault(record.getProjectContraptionNo(), false));
});
List<Long> projectContraptionIdList = pageList.getRecords().stream().map(IdxBizJgProjectContraption::getSequenceNbr).collect(Collectors.toList());
......@@ -375,6 +386,16 @@ public class IdxBizJgProjectContraptionServiceImplService extends BaseEntityServ
return pageList;
}
/**
* 按照装置id查询 是否做过后续业务
* @param pageList 装置集合
* @return key-装置id;value-true(发生后续业务)、false(未发生后续业务)
*/
private Map<String, Boolean> getPidUseMap(IPage<IdxBizJgProjectContraption> pageList) {
List<CountDto> useCount = commonMapper.countBizNumAfterUseRegBatchProjectContraption(pageList.getRecords().stream().map(BaseEntity::getSequenceNbr).collect(Collectors.toList()));
return useCount.stream().collect(Collectors.toMap(CountDto::getKeyStr, e->e.getLongValue() > 0));
}
private SFunction<IdxBizJgProjectContraption, ?> resolveField(String field) {
switch (field) {
......
......@@ -19,6 +19,7 @@ import com.google.common.base.Joiner;
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.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.dto.CountDto;
import com.yeejoin.amos.boot.biz.common.entity.DataDictionary;
import com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl;
import com.yeejoin.amos.boot.biz.common.utils.*;
......@@ -2850,6 +2851,10 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
)
);
}
// 获取是否发生过后续业务集合
Map<String, Boolean> afterBizMap = getHasHappenAfterBiz(equIds);
// 更新设备使用情况和设备地址
for (JSONObject item : list) {
item.put("REC_DATE", Instant.ofEpochMilli(Long.parseLong(item.getString("REC_DATE")))
......@@ -2861,6 +2866,10 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
item.put("CAN_DELETE", this.checkEquipIsCanDelete(item.getString(SEQUENCE_NBR)));
// 单位类型区分是监管还是企业
item.put("companyType", companyLevel);
// 区分新增设备、历史有证设备、历史无证设备,与使用登记一致:0-新设备、1-历史有证设备、2-历史无证设备
item.put("regType", CommonServiceImpl.genRegTypeByDataSource(item.getString(DATA_SOURCE)));
// 是否发生后续业务,前端控制是否可编辑
item.put(BaseUseRegisterResultData.HAPPEN_AFTER_BIZ, afterBizMap.getOrDefault(item.getString(SEQUENCE_NBR), false));
item.put("DATA_QUALITY_SCORE", commonServiceImpl.castDataQualityScore2Name(item.getString(DATA_QUALITY_SCORE), item.getBoolean(IS_INTO_MANAGEMENT)));
}
}
......@@ -2873,6 +2882,11 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
return result;
}
private Map<String, Boolean> getHasHappenAfterBiz(List<String> equIds) {
List<CountDto> countDtoList = commonMapper.countBizNumAfterUseRegBatchEquip(equIds);
return countDtoList.stream().collect(Collectors.toMap(CountDto::getKeyStr, e-> e.getLongValue() > 0));
}
private String getCompanyLevel(JSONObject company) {
if (BaseController.COMPANY_TYPE_COMPANY.equals(company.getString("level"))) {
......
......@@ -319,5 +319,19 @@ public class IdxBizJgProjectContraption extends BaseEntity {
@TableField(exist = false)
private String companyType;
/**
* 是否发生后续业务
*/
@TableField(exist = false)
private Boolean happenAfterBiz;
/**
* 登记类型:0-新增;1-历史有证;2-历史无证
*/
@TableField(exist = false)
private String regType;
}
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