| | |
| | | package com.vci.web.service.impl; |
| | | |
| | | import com.vci.client.mw.ClientSessionUtility; |
| | | import com.vci.corba.common.PLException; |
| | | import com.vci.corba.omd.vrm.VersionRule; |
| | | import com.vci.dto.OsRevisionRuleDTO; |
| | | import com.vci.starter.web.annotation.log.VciUnLog; |
| | | import com.vci.starter.web.util.VciDateUtil; |
| | | import com.vci.pagemodel.OsRevisionRuleVO; |
| | | import com.vci.web.service.OsRevisionRuleServiceI; |
| | | import com.vci.web.util.Func; |
| | | import com.vci.web.util.PlatformClientUtil; |
| | | import com.vci.web.util.WebUtil; |
| | | import org.apache.commons.lang3.StringUtils; |
| | |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.swing.*; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | @Autowired(required = false) |
| | | @Lazy |
| | | private OsRevisionRuleServiceI self; |
| | | |
| | | /** |
| | | * 查询所有的版本规则 |
| | | * |
| | |
| | | @VciUnLog |
| | | public Map<String, OsRevisionRuleVO> selectAllRevisionMap() { |
| | | return Optional.ofNullable(self.selectAllRevision()).orElseGet(()->new ArrayList<>()).stream().collect(Collectors.toMap(s->s.getId().toLowerCase(),t->t,(o1,o2)->o1)); |
| | | } |
| | | |
| | | /** |
| | | * 创建版本规则 |
| | | * @param osRevisionRuleDTO |
| | | * @return |
| | | */ |
| | | @Override |
| | | public boolean addVersionRule(OsRevisionRuleDTO osRevisionRuleDTO) throws PLException { |
| | | VersionRule vr = platformClientUtil.getVersionService().getVersionRule(osRevisionRuleDTO.getName()); |
| | | //name不为空 |
| | | if(Func.isNotEmpty(vr) && !"".equals(vr.name)){ |
| | | throw new PLException("500",new String[]{"名称重复请更换名称!"}); |
| | | } |
| | | |
| | | platformClientUtil.getVersionService().addVersionRule(this.dto2VersionRule(osRevisionRuleDTO)); |
| | | return false; |
| | | } |
| | | |
| | | @Override |
| | | public boolean updateVersionRule(OsRevisionRuleDTO osRevisionRuleDTO) { |
| | | |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * dto对象转换为VersionRule对象 |
| | | * @return |
| | | */ |
| | | private VersionRule dto2VersionRule(OsRevisionRuleDTO osRevisionRuleDTO){ |
| | | VersionRule newVR = new VersionRule(); |
| | | newVR.name = osRevisionRuleDTO.getId(); |
| | | newVR.tag = osRevisionRuleDTO.getName(); |
| | | newVR.jumpCharacter = osRevisionRuleDTO.getPrefixCode(); |
| | | /*newVR.initialValue = jtf3.getText(); |
| | | newVR.stepLength = jtf4.getText(); |
| | | newVR.prefixion = jtf5.getText(); |
| | | newVR.suffix = jtf6.getText(); |
| | | newVR.description = jta.getText();*/ |
| | | String userName = ClientSessionUtility.getCurUserName(); |
| | | newVR.creator = userName; |
| | | newVR.modifier = userName; |
| | | return newVR; |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | /** |
| | | * 查询应用范围 |
| | | * @param vrName 版本规则英文名称 |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<Map<String, String>> getUsedVersionRuleList(String vrName) throws PLException { |
| | | if(Func.isBlank(vrName)){ |
| | | throw new PLException("500",new String[]{"请选择要查询应用范围的属性!"}); |
| | | } |
| | | String[] btNames = platformClientUtil.getBtmService().getBTNamesByVerName(vrName); |
| | | if(Func.isEmpty(btNames)){ |
| | | return new ArrayList<>(); |
| | | } |
| | | List<Map<String,String>> btmNameMapList = new ArrayList<>(); |
| | | Arrays.stream(btNames).forEach(btName->{ |
| | | Map<String, String> itemMap = new HashMap<>(); |
| | | itemMap.put("versionRuleName",vrName); |
| | | itemMap.put("source",btName); |
| | | btmNameMapList.add(itemMap); |
| | | }); |
| | | return btmNameMapList; |
| | | } |
| | | |
| | | /** |
| | | * 清除缓存 |
| | | */ |
| | | @Override |
| | | public void clearCache() { |
| | | |
| | | } |
| | | |
| | | } |