Commit 47d4fdfb authored by 刘林's avatar 刘林

fix(jg):超设计使用年限功能开发

parent 2835b898
......@@ -30,24 +30,6 @@ public class JgOverDesignServiceLifeDto extends BaseDto {
@ApiModelProperty(value = "使用单位统一信用代码")
private String useUnitCreditCode;
@ApiModelProperty(value = "安全评估机构名称")
private String safetyAssessmentName;
@ApiModelProperty(value = "安全评估机构统一信用代码")
private String safetyAssessmentCreditCode;
@ApiModelProperty(value = "安全评估报告")
private String safetyAssessmentReport;
@ApiModelProperty(value = "安全评估结果")
private String safetyAssessmentResult;
@ApiModelProperty(value = "安全评估日期")
private Date safetyAssessmentDate;
@ApiModelProperty(value = "使用登记编号")
private String useRegistrationCode;
@ApiModelProperty(value = "其他附件")
private String otherAccessories;
......
......@@ -36,4 +36,22 @@ public class JgOverDesignServiceLifeEqDto extends BaseDto {
@ApiModelProperty(value = "创建人")
private String createUserName;
@ApiModelProperty(value = "安全评估机构名称")
private String safetyAssessmentName;
@ApiModelProperty(value = "安全评估机构统一信用代码")
private String safetyAssessmentCreditCode;
@ApiModelProperty(value = "安全评估报告")
private String safetyAssessmentReport;
@ApiModelProperty(value = "安全评估结果")
private String safetyAssessmentResult;
@ApiModelProperty(value = "安全评估日期")
private Date safetyAssessmentDate;
@ApiModelProperty(value = "使用登记编号")
private String useRegistrationCode;
}
......@@ -99,4 +99,22 @@ public class JgOverDesignServiceLifeEq extends BaseEntity {
*/
@TableField("delay_service_life")
private String delayServiceLife;
/**
* 设备种类
*/
@TableField("equ_list")
private String equList;
/**
* 设备类别
*/
@TableField("equ_category")
private String equCategory;
/**
* 设备品种
*/
@TableField("equ_define")
private String equDefine;
}
package com.yeejoin.amos.boot.module.jg.api.mapper;
import com.yeejoin.amos.boot.module.jg.api.dto.CompanyEquipCountDto;
import com.yeejoin.amos.boot.module.jg.api.entity.JgOverDesignServiceLife;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import java.util.List;
/**
* Mapper 接口
......@@ -11,4 +13,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/
public interface JgOverDesignServiceLifeMapper extends BaseMapper<JgOverDesignServiceLife> {
List<CompanyEquipCountDto> queryForFlowingEquipList();
}
......@@ -2,4 +2,13 @@
<!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.jg.api.mapper.JgOverDesignServiceLifeMapper">
<select id="queryForFlowingEquipList" resultType="com.yeejoin.amos.boot.module.jg.api.dto.CompanyEquipCountDto">
select a.use_unit_credit_code as companyCode,
group_concat(b.equ_id) as records
from tzs_jg_over_design_service_life a,
tzs_jg_over_design_service_life_eq b
where a.sequence_nbr = b.over_design_id
and a.status in ('待受理')
GROUP BY a.use_unit_credit_code
</select>
</mapper>
package com.yeejoin.amos.boot.module.jg.biz.service.impl;
import com.yeejoin.amos.boot.module.jg.api.dto.CompanyEquipCountDto;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgOverDesignServiceLifeMapper;
import lombok.extern.slf4j.Slf4j;
import org.redisson.api.RBucket;
import org.redisson.api.RedissonClient;
import org.springframework.stereotype.Component;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
/**
* @author LiuLin
*/
@Component
@Slf4j
public class JgOverDesignServiceLifeCheckImpl extends BaseEquipUsedCheckService {
private RedissonClient redissonClient;
private String bizType = "overDesignServiceLife";
private JgOverDesignServiceLifeMapper overDesignServiceLifeMapper;
public JgOverDesignServiceLifeCheckImpl(RedissonClient redissonClient, JgOverDesignServiceLifeMapper overDesignServiceLifeMapper) {
this.redissonClient = redissonClient;
this.overDesignServiceLifeMapper = overDesignServiceLifeMapper;
}
@Override
public RedissonClient getRedisClient() {
return redissonClient;
}
@Override
public String getApplyBizType() {
return bizType;
}
@Override
public void init() {
// 初始化在流程中设备数据
List<CompanyEquipCountDto> companyEquipCountDtos = overDesignServiceLifeMapper.queryForFlowingEquipList();
companyEquipCountDtos.remove(null);
companyEquipCountDtos.forEach(c -> {
RBucket<Set<String>> rBucket = redissonClient.getBucket(getFlowingEquipRedisKey(c.getCompanyCode(), bizType));
rBucket.set(Arrays.stream(c.getRecords().split(",")).collect(Collectors.toSet()));
});
}
}
......@@ -128,7 +128,6 @@ public class JgOverDesignServiceLifeServiceImpl extends BaseService<JgOverDesign
}
}
JgOverDesignServiceLifeDto overDesignDto = JSON.parseObject(JSON.toJSONString(map), JgOverDesignServiceLifeDto.class);
//新增使用登记表字段
Optional.ofNullable(map.get("useRegistrationFormFile"))
.map(JSONObject::toJSONString)
.ifPresent(overDesignDto::setUseRegistrationFormFile);
......@@ -195,24 +194,26 @@ public class JgOverDesignServiceLifeServiceImpl extends BaseService<JgOverDesign
overDesignServiceLife.setStatus(SUBMIT_DATA.equals(map.get("submit")) ? WorkFlowStatusEnum.USE_SUBMIT.getPass() : WorkFlowStatusEnum.USE_RECEIVE.getPass());
this.save(overDesignServiceLife);
} else {
// 删除以前设备关联关系
this.getBaseMapper().updateById(overDesignServiceLife);
LambdaQueryWrapper<JgOverDesignServiceLifeEq> lambda = new QueryWrapper<JgOverDesignServiceLifeEq>().lambda();
lambda.eq(JgOverDesignServiceLifeEq::getOverDesignId, overDesignServiceLife.getSequenceNbr());
jgOverDesignServiceLifeEqService.getBaseMapper().delete(lambda);
}
// 更新关联气瓶信息
if (!CollectionUtils.isEmpty(equipmentLists)) {
List<JgOverDesignServiceLifeEq> equipList = new ArrayList<>();
equipmentLists.forEach(device -> {
JgOverDesignServiceLifeEq equip = JSON.parseObject(JSON.toJSONString(device), JgOverDesignServiceLifeEq.class);
JgOverDesignServiceLifeEq equip = new JgOverDesignServiceLifeEq();
equip.setEquId(String.valueOf(device.get("record")));
equip.setOverDesignId(Objects.toString(overDesignServiceLife.getSequenceNbr()));
equip.setDeviceInfo(JSONObject.toJSONString(device));
equip.setUseRegistrationCode(Objects.toString(device.get("USE_ORG_CODE")));
equip.setEquList(Objects.toString(device.get("EQU_LIST_CODE")));
equip.setEquCategory(Objects.toString(device.get("EQU_CATEGORY_CODE")));
equip.setEquDefine(Objects.toString(device.get("EQU_DEFINE_CODE")));
if (!ObjectUtils.isEmpty(device.get("SAFETY_ASSESSMENT_REPORT"))) {
equip.setSafetyAssessmentReport(JSONObject.toJSONString(device.get("SAFETY_ASSESSMENT_REPORT")));
}
equip.setEquCategory(Objects.toString(device.get("EQU_CATEGORY_CODE")));
equipList.add(equip);
});
jgOverDesignServiceLifeEqService.saveBatch(equipList);
......
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