| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.vci.ubcs.code.service.ICodeReferBtmTypeService; |
| | | import com.vci.ubcs.omd.feign.IAttributeClient; |
| | | import com.vci.ubcs.omd.feign.IBtmAttributeClient; |
| | | import com.vci.ubcs.omd.feign.IBtmTypeClient; |
| | | import com.vci.ubcs.omd.vo.AttributeVO; |
| | | import com.vci.ubcs.omd.vo.BtmTypeAttributeVO; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.rmi.ServerException; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | private IBtmTypeClient btmTypeClient; |
| | | |
| | | /** |
| | | * 业务类型属性服务 |
| | | */ |
| | | @Resource |
| | | private IAttributeClient attributeClient; |
| | | |
| | | /** |
| | | * 获取业务类型列表 |
| | | * @param baseQueryObject 查询条件 |
| | | * @return 列表的内容 |
| | |
| | | Map<String, String> conditionMap = baseQueryObject.getConditionMap(); |
| | | conditionMap.put("domain", AppConstant.APPLICATION_NAME_CODE); |
| | | baseQueryObject.setConditionMap(conditionMap); |
| | | Page<BtmTypeVO> refPage = null; |
| | | try { |
| | | refPage = btmTypeClient.getRefPage(baseQueryObject).getData(); |
| | | }catch (Exception e){ |
| | | R<Page<BtmTypeVO>> btmTypeClientRefPage = btmTypeClient.getRefPage(baseQueryObject); |
| | | if(!btmTypeClientRefPage.isSuccess()){ |
| | | throw new ServiceException("业务类型feign接口调用错误"); |
| | | } |
| | | return refPage; |
| | | return btmTypeClientRefPage.getData(); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return 属性的信息 |
| | | */ |
| | | @Override |
| | | public Page<AttributeVO> gridAttributesByBtmId(BaseQueryObject baseQueryObject) { |
| | | public Page<BtmTypeAttributeVO> gridAttributesByBtmId(BaseQueryObject baseQueryObject) throws ServiceException { |
| | | String btmTypeId = baseQueryObject.getConditionMap().containsKey("btmTypeId")?baseQueryObject.getConditionMap().get("btmTypeId"):""; |
| | | if(StringUtils.isBlank(btmTypeId)){ |
| | | return new Page<AttributeVO>(); |
| | | return new Page<>(); |
| | | } |
| | | String hasDefaultAttr = baseQueryObject.getConditionMap().getOrDefault("hasDefaultAttr","false"); |
| | | String attrId = baseQueryObject.getConditionMap().containsKey("name")?baseQueryObject.getConditionMap().get("name").replace("*",""):""; |
| | | String attrName = baseQueryObject.getConditionMap().containsKey("label") ? baseQueryObject.getConditionMap().get("label").replace("*","") : ""; |
| | | // TODO 根据业务类型id获取关联的属性 |
| | | List<BtmTypeAttributeVO> boAttrs = null; //attributeClient.get(); |
| | | List<BtmTypeAttributeVO> boAttrs = null; |
| | | try { |
| | | boAttrs = btmTypeClient.getAllAttributeByBtmId(btmTypeId).getData().getAttributes(); |
| | | }catch (Exception e){ |
| | | throw new ServiceException("业务类型feign接口调用错误"); |
| | | } |
| | | if(boAttrs == null){ |
| | | boAttrs = new ArrayList<>(); |
| | | } |
| | | if(BooleanEnum.TRUE.getValue().equalsIgnoreCase(hasDefaultAttr)){ |
| | | // TODO 获取默认的属性 |
| | | List<BtmTypeAttributeVO> finalBoAttrs = boAttrs; |
| | | |
| | | List<BtmTypeAttributeVO> btmTypeAttributeVOS = new ArrayList<>(); //attributeClient.getDefaultAttributeVOs(); |
| | | btmTypeAttributeVOS.stream().forEach(attr->{ |
| | | BtmTypeVO btmTypeVO = btmTypeClient.getDefaultAttrByBtmId(btmTypeId).getData(); |
| | | btmTypeVO.getAttributes().stream().forEach(attr->{ |
| | | BtmTypeAttributeVO attributeVO = new BtmTypeAttributeVO(); |
| | | BeanUtil.convert(attr,attributeVO); |
| | | attributeVO.setAttributeLength(attr.getAttributeLength()); |
| | |
| | | } |
| | | return usedFlag; |
| | | }).collect(Collectors.toList()); |
| | | |
| | | return new Page<>(); |
| | | Page<BtmTypeAttributeVO> btmTypeAttributeVOPage = new Page<>(); |
| | | btmTypeAttributeVOPage.setRecords(attrList); |
| | | return btmTypeAttributeVOPage; |
| | | } |
| | | |
| | | |