Commit 039a3022 authored by tianbo's avatar tianbo

feat(jg): 实现超设计使用年限业务流程优化

- 新增 OverDesignDataChangeHandler 和 OverDesignEditUpdateService 处理器处理单据查看设备履历功能 - 超设计使用年限变更通过后,修改设备状态为在用状态、证状态为已登记 - 调整使用登记证查询逻辑,按记录日期降序取最新一条数据
parent 48fd74f2
package com.yeejoin.amos.boot.module.jg.biz.edit.process.biz.overDesign;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import com.yeejoin.amos.boot.module.common.biz.event.CommonPublisher;
import com.yeejoin.amos.boot.module.jg.api.dto.FieldChangeMeta;
import com.yeejoin.amos.boot.module.jg.api.dto.PipelineChangeItemDto;
import com.yeejoin.amos.boot.module.jg.api.entity.JgOverDesignServiceLife;
import com.yeejoin.amos.boot.module.jg.api.enums.BusinessTypeEnum;
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.*;
/**
* 设备停用启用编辑处理器
*/
@Component
public class OverDesignDataChangeHandler extends DefaultBizDataChangeHandler<BaseBizDataChangeEvent> {
private final OverDesignEditUpdateService overDesignEditUpdateService;
protected OverDesignDataChangeHandler(CommonPublisher routerEventPublisher, ApplicationContext applicationContext, OverDesignEditUpdateService overDesignEditUpdateService) {
super(routerEventPublisher, applicationContext);
this.overDesignEditUpdateService = overDesignEditUpdateService;
}
@Override
public String canHandleBizType() {
return BusinessTypeEnum.JG_OVER_DESIGN_SERVICE_LIFE.name();
}
@Override
public List<FieldChangeMeta> postSave(String bizId, String applyNo, ModelType model, Map<String, Object> changeData, List<FieldChangeMeta> allChangeColumns, Map<String, List<PipelineChangeItemDto>> pipelineChangeItemMap) {
return Collections.emptyList();
}
@Override
public Boolean beforeCheck(String bizId, String applyNo, ModelType model, Map<String, Object> changeData) {
return Boolean.TRUE;
}
@Override
public Set<String> getEqs(String applyNo) {
return overDesignEditUpdateService.getEqsByApplyNo(applyNo);
}
/**
* 管道专用-判断数据是实时落库,还是先存到json
*
* @param applyNo 单据号
* @return 是否需要临时存储
*/
@Override
public Boolean requiresTemporarySave(String applyNo) {
return false;
}
@Override
public Boolean bizIsFinished(String applyNo) {
JgOverDesignServiceLife overDesignServiceLife = overDesignEditUpdateService.getOverDesignServiceLifeService().getOne(new LambdaQueryWrapper<JgOverDesignServiceLife>().eq(JgOverDesignServiceLife::getApplyNo, applyNo).select(BaseEntity::getSequenceNbr, JgOverDesignServiceLife::getStatus));
return overDesignServiceLife.getStatus().equals(FlowStatusEnum.TO_BE_FINISHED.getName());
}
@Override
public Set<String> getProjectContraptionIds(String applyNo) {
return new HashSet<>();
}
@Override
public void preSave(String bizId, String applyNo, ModelType model, Map<String, Object> changeData) {
}
}
package com.yeejoin.amos.boot.module.jg.biz.edit.process.biz.overDesign;
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.JgOverDesignServiceLife;
import com.yeejoin.amos.boot.module.jg.api.entity.JgOverDesignServiceLifeEq;
import com.yeejoin.amos.boot.module.jg.biz.service.impl.JgOverDesignServiceLifeEqServiceImpl;
import com.yeejoin.amos.boot.module.jg.biz.service.impl.JgOverDesignServiceLifeServiceImpl;
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 OverDesignEditUpdateService {
private final JgOverDesignServiceLifeServiceImpl overDesignServiceLifeService;
private final JgOverDesignServiceLifeEqServiceImpl overDesignServiceLifeEqService;
public Set<String> getEqsByApplyNo(String applyNo) {
JgOverDesignServiceLife overDesignServiceLifeServiceOne = overDesignServiceLifeService.getOne(new LambdaQueryWrapper<JgOverDesignServiceLife>().eq(JgOverDesignServiceLife::getApplyNo, applyNo).select(BaseEntity::getSequenceNbr));
List<JgOverDesignServiceLifeEq> eqs = overDesignServiceLifeEqService.list(new LambdaQueryWrapper<JgOverDesignServiceLifeEq>().eq(JgOverDesignServiceLifeEq::getOverDesignId, overDesignServiceLifeServiceOne.getSequenceNbr()).select(JgOverDesignServiceLifeEq::getEquId, BaseEntity::getSequenceNbr));
return eqs.stream().map(JgOverDesignServiceLifeEq::getEquId).collect(Collectors.toSet());
}
public JgOverDesignServiceLife getOneByApplyNo(String applyNo) {
return overDesignServiceLifeService.getOne(new LambdaQueryWrapper<JgOverDesignServiceLife>().eq(JgOverDesignServiceLife::getApplyNo, applyNo));
}
}
\ No newline at end of file
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