| | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.vci.ubcs.omd.constant.BtmTypeConstant; |
| | | import com.vci.ubcs.omd.entity.BtmType; |
| | | import com.vci.ubcs.omd.entity.LifeCycleRule; |
| | | import com.vci.ubcs.omd.entity.Status; |
| | | import com.vci.ubcs.omd.mapper.BtmTypeMapper; |
| | | import com.vci.ubcs.omd.mapper.LifeCycleMapper; |
| | | import com.vci.ubcs.omd.mapper.StatusMapper; |
| | | import com.vci.ubcs.omd.entity.*; |
| | | import com.vci.ubcs.omd.mapper.*; |
| | | import com.vci.ubcs.omd.service.IStatusService; |
| | | import com.vci.ubcs.omd.vo.BtmTypeVO; |
| | | import com.vci.ubcs.omd.vo.StatusVO; |
| | |
| | | import com.vci.ubcs.starter.exception.VciBaseException; |
| | | import com.vci.ubcs.starter.web.util.BeanUtil; |
| | | import com.vci.ubcs.starter.web.util.VciBaseUtil; |
| | | import io.undertow.servlet.core.Lifecycle; |
| | | import org.springblade.core.mp.support.Condition; |
| | | import org.springblade.core.mp.support.Query; |
| | | import org.springblade.core.secure.utils.AuthUtil; |
| | |
| | | private final String REGEXP = "^[A-Za-z]+$"; |
| | | @Resource |
| | | private BtmTypeMapper btmTypeMapper; |
| | | @Resource |
| | | private LifeCycleNodeMapper lifeCycleNodeMapper; |
| | | @Resource |
| | | private LifeCycleMapper lifeCycleMapper; |
| | | /** |
| | |
| | | throw new VciBaseException("要删除的状态对象不能为空"); |
| | | } |
| | | Set<String> oidSet= new HashSet<>(); |
| | | Set<String> idSet= new HashSet<>(); |
| | | statusVOList.stream().forEach( s -> { |
| | | VciBaseUtil.alertNotNull(s.getOid(),"要删除的状态对象的主键"); |
| | | oidSet.add(s.getOid()); |
| | | idSet.add(s.getId()); |
| | | }); |
| | | //查询 |
| | | List<Status> statusDOList = listStatusByOidCollectionDO(oidSet); |
| | |
| | | } |
| | | }); |
| | | //检查属性是否被引用 |
| | | if(checkStatusUseds(oidSet)){ |
| | | if(checkStatusUseds(idSet)){ |
| | | throw new VciBaseException("要删除的状态在生命周期对象中被使用,无法删除"); |
| | | } |
| | | Collection<Collection<String>> oidCollections = VciBaseUtil.switchCollectionForOracleIn(oidInDbSet); |
| | |
| | | */ |
| | | @Override |
| | | public boolean checkStatusUseds(Collection<String> oidCollection) { |
| | | Long count = lifeCycleNodeMapper.selectCount(Wrappers.<LifeCycleNode>query().lambda().in(LifeCycleNode::getId,oidCollection)); |
| | | if(count>0){ |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | |
| | | */ |
| | | @Override |
| | | public boolean checkStatusUsed(String pkStatus) throws VciBaseException { |
| | | |
| | | return false; |
| | | } |
| | | |
| | |
| | | */ |
| | | @Override |
| | | public List<BtmTypeVO> getApplyRange(String id) { |
| | | List<BtmTypeVO> btmTypeVOS=new ArrayList<>(); |
| | | VciBaseUtil.alertNotNull(id,"状态英文名称"); |
| | | //lifeCycleMapper.selectList(Wrappers.<LifeCycleRule>query().lambda().eq(LifeCycleRule::getStartStatus,id)); |
| | | return BtmTypeWrapper.build().listEntityVO(btmTypeMapper.selectList(Wrappers.<BtmType>query().lambda().eq(BtmType::getRevisionRuleId,id))); |
| | | List<LifeCycleNode> selectList = lifeCycleNodeMapper.selectList(Wrappers.<LifeCycleNode>query().lambda().eq(LifeCycleNode::getId,id)); |
| | | List<String>lifeCycleOidList = new ArrayList<>(); |
| | | if(!CollectionUtils.isEmpty(selectList)){ |
| | | lifeCycleOidList = selectList.stream().map(LifeCycleNode::getLifeCycleOid).collect(Collectors.toList()); |
| | | List<LifeCycleRule>LifeCycleRuleList = lifeCycleMapper.selectList(Wrappers.<LifeCycleRule>query().lambda().in(LifeCycleRule::getOid,lifeCycleOidList)); |
| | | List<String>lifeCycleRuleIdList = new ArrayList<>(); |
| | | if(!CollectionUtils.isEmpty(LifeCycleRuleList)) { |
| | | lifeCycleRuleIdList = LifeCycleRuleList.stream().map(LifeCycleRule::getId).collect(Collectors.toList()); |
| | | btmTypeVOS= BtmTypeWrapper.build().listEntityVO(btmTypeMapper.selectList(Wrappers.<BtmType>query().lambda().in(BtmType::getLifeCycleId, lifeCycleRuleIdList))); |
| | | } |
| | | } |
| | | |
| | | return btmTypeVOS; |
| | | } |
| | | } |