| | |
| | | package com.vci.web.service.impl; |
| | | |
| | | import com.vci.corba.common.VCIError; |
| | | import com.vci.client.common.providers.ServiceProvider; |
| | | import com.vci.corba.common.PLException; |
| | | import com.vci.corba.omd.btm.BizType; |
| | | import com.vci.starter.web.annotation.log.VciUnLog; |
| | | import com.vci.starter.web.enumpck.BooleanEnum; |
| | | import com.vci.starter.web.exception.VciBaseException; |
| | |
| | | import com.vci.web.constant.CacheKeyConstant; |
| | | import com.vci.web.pageModel.*; |
| | | import com.vci.web.service.*; |
| | | import com.vci.web.util.PlatformClientUtil; |
| | | import com.vci.web.util.WebUtil; |
| | | import com.vci.web.util.*; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.cache.annotation.CacheEvict; |
| | | import org.springframework.cache.annotation.CachePut; |
| | | import org.springframework.cache.annotation.Cacheable; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | import plm.corba.btm.BtmItem; |
| | | |
| | | import java.util.*; |
| | | import java.util.function.Supplier; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import static com.vci.web.constant.CacheNameConstant.VCI_OBJECT_SERVICE; |
| | |
| | | /** |
| | | * 平台的调用工具类 |
| | | */ |
| | | @Autowired |
| | | private PlatformClientUtil platformClientUtil; |
| | | //@Autowired |
| | | //private PlatformClientUtil platformClientUtil; |
| | | |
| | | /** |
| | | * 属性的服务 |
| | |
| | | @Autowired(required = false) |
| | | @Lazy |
| | | private OsBtmServiceI self; |
| | | |
| | | /** |
| | | * 查询所有的业务类型 |
| | | * |
| | |
| | | @VciUnLog |
| | | public List<OsBtmTypeVO> selectAllBtm() { |
| | | try { |
| | | return btmDO2VOs(Arrays.stream(platformClientUtil.getBtmService().getAllBtmItem("")).collect(Collectors.toList())); |
| | | } catch (VCIError vciError) { |
| | | throw WebUtil.getVciBaseException(vciError); |
| | | // return btmDO2VOs(Arrays.stream(platformClientUtil.getBtmService().getAllBtmItem("")).collect(Collectors.toList())); |
| | | // return btmDO2VOs(Arrays.stream(ServiceProvider.getOMDService().getBTMService().getAllBtmItem("")).collect(Collectors.toList())); |
| | | return btmDO2VOs(Arrays.stream(ServiceProvider.getOMDService().getBTMService().getBizTypes("")).collect(Collectors.toList())); |
| | | } catch (PLException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | |
| | |
| | | * @return 显示对象 |
| | | */ |
| | | @Override |
| | | public List<OsBtmTypeVO> btmDO2VOs(Collection<BtmItem> btmItems) { |
| | | public List<OsBtmTypeVO> btmDO2VOs(Collection<BizType> btmItems) { |
| | | List<OsBtmTypeVO> VOS = new ArrayList<>(); |
| | | Optional.ofNullable(btmItems).orElseGet(()->new ArrayList<>()).stream().forEach(btmItem -> { |
| | | OsBtmTypeVO vo = btmDO2VO(btmItem); |
| | |
| | | * @return 显示对象 |
| | | */ |
| | | @Override |
| | | public OsBtmTypeVO btmDO2VO(BtmItem btmItem) { |
| | | public OsBtmTypeVO btmDO2VO(BizType btmItem) { |
| | | OsBtmTypeVO vo = new OsBtmTypeVO(); |
| | | if(btmItem !=null){ |
| | | vo.setOid(btmItem.oid); |
| | | vo.setCreator(btmItem.creator); |
| | | vo.setLastModifier(btmItem.modifier); |
| | | try { |
| | | vo.setCreateTime(VciDateUtil.str2Date(btmItem.createTime,VciDateUtil.DateTimeFormat)); |
| | | vo.setLastModifyTime(VciDateUtil.str2Date(btmItem.modifyTime,VciDateUtil.DateTimeFormat)); |
| | | vo.setTs(VciDateUtil.str2Date(btmItem.ts,VciDateUtil.DateTimeMillFormat)); |
| | | // btmItem.createTime拿到的是时间戳,但是这儿要的是例如2017-12-27 09:32:20.034这样的格式,所以不调用这个方法,改调用其他方法 |
| | | //vo.setCreateTime(VciDateUtil.str2Date(String.valueOf(btmItem.createTime),VciDateUtil.DateTimeFormat)); |
| | | vo.setCreateTime(Func.parse(btmItem.createTime, ConcurrentDateFormat.of(VciDateUtil.DateTimeFormat))); |
| | | vo.setLastModifyTime( Func.parse(btmItem.modifyTime, ConcurrentDateFormat.of(VciDateUtil.DateTimeFormat))); |
| | | vo.setTs(Func.parse(btmItem.ts, ConcurrentDateFormat.of(VciDateUtil.DateTimeFormat))); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | vo.setDescription(btmItem.description); |
| | | vo.setId(btmItem.name); |
| | | vo.setName(btmItem.label); |
| | | vo.setName(btmItem.label); |
| | | vo.setLifeCycleId(btmItem.lifeCycle); |
| | | vo.setAbstractFlag(btmItem.isAbstract); |
| | | vo.setImplClass(btmItem.implClass); |