| | |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.alibaba.nacos.common.utils.StringUtils; |
| | | import com.baomidou.mybatisplus.core.conditions.Wrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.github.yulichang.wrapper.MPJLambdaWrapper; |
| | | import com.vci.ubcs.code.constant.MdmBtmTypeConstant; |
| | | |
| | | import com.vci.ubcs.code.dto.CodeClassifyTemplateAttrDTO; |
| | | import com.vci.ubcs.code.entity.CodeClassify; |
| | | import com.vci.ubcs.code.entity.CodeClassifyTemplateAttr; |
| | | import com.vci.ubcs.code.entity.CodeClassifyTemplate; |
| | | import com.vci.ubcs.code.enumpack.CodeLevelTypeEnum; |
| | | import com.vci.ubcs.code.mapper.CodeClassifyTemplateAttrMapper; |
| | | import com.vci.ubcs.code.mapper.CodeClassifyTemplateMapper; |
| | | import com.vci.ubcs.code.mapper.CodeOsbtmtypeattributeMapper; |
| | | import com.vci.ubcs.code.service.ICodeClassifyTemplateAttrService; |
| | | import com.vci.ubcs.code.service.ICodeReferConfigService; |
| | | import com.vci.ubcs.code.service.ICodeTempphaseService; |
| | | import com.vci.ubcs.code.vo.CodeOsbtmtypeattributeVO; |
| | | import com.vci.ubcs.code.vo.CodeReferConfigVO; |
| | | import com.vci.ubcs.code.vo.pagemodel.CodeClassifyTemplateAttrVO; |
| | | import com.vci.ubcs.code.vo.pagemodel.UIFormReferVO; |
| | | import com.vci.ubcs.code.wrapper.CodeClassifyTemplateAttrWrapper; |
| | | import com.vci.ubcs.omd.feign.IBtmTypeClient; |
| | | import com.vci.ubcs.omd.vo.BtmTypeAttributeVO; |
| | | import com.vci.ubcs.omd.vo.BtmTypeVO; |
| | | import com.vci.ubcs.starter.exception.VciBaseException; |
| | | import com.vci.ubcs.starter.revision.service.RevisionModelUtil; |
| | | import com.vci.ubcs.starter.util.DefaultAttrAssimtUtil; |
| | | import com.vci.ubcs.starter.util.MdmBtmTypeConstant; |
| | | import com.vci.ubcs.starter.util.PatternUtil; |
| | | import com.vci.ubcs.starter.util.UBCSCondition; |
| | | import com.vci.ubcs.starter.web.enumpck.VciFieldTypeEnum; |
| | | import com.vci.ubcs.starter.web.pagemodel.*; |
| | | import com.vci.ubcs.starter.util.Map2MPJLambdaUtil; |
| | | import com.vci.ubcs.starter.web.pagemodel.PageHelper; |
| | | import com.vci.ubcs.starter.web.util.BeanUtilForVCI; |
| | | import com.vci.ubcs.starter.web.util.VciBaseUtil; |
| | | import com.vci.ubcs.starter.web.util.VciDateUtil; |
| | | import com.vci.ubcs.system.entity.DictBiz; |
| | | import com.vci.ubcs.system.feign.IDictBizClient; |
| | | import org.springblade.core.log.exception.ServiceException; |
| | | import org.springblade.core.mp.support.Condition; |
| | | import org.springblade.core.mp.support.Query; |
| | | import org.springblade.core.secure.utils.AuthUtil; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.cglib.beans.BeanMap; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | @Resource |
| | | private CodeClassifyTemplateAttrMapper codeClassifyTemplateAttrMapper; |
| | | |
| | | // @Resource |
| | | // CodeClstempattrMapper codeClstempattrMapper; |
| | | // @Resource |
| | | // ICodeTempphaseService codeTempphaseService; |
| | | |
| | | @Resource |
| | | IDictBizClient iDictBizClient; |
| | | |
| | | @Resource |
| | | CodeClassifyTemplateMapper codeClassifyTemplateMapper; |
| | | |
| | | @Resource |
| | | CodeOsbtmtypeattributeMapper codeOsbtmtypeattributeMapper; |
| | | private ICodeReferConfigService codeReferConfigService; |
| | | |
| | | @Resource |
| | | @Lazy |
| | | ICodeTempphaseService codeTempphaseService; |
| | | |
| | | /** |
| | | * 对象的操作 |
| | | */ |
| | | @Autowired(required = false) |
| | | private RevisionModelUtil revisionModelUtil; |
| | | |
| | | /** |
| | | * 属性服务对象 |
| | | */ |
| | | @Resource |
| | | private IBtmTypeClient btmTypeClient; |
| | | |
| | | /** |
| | | * 查询所有的主题库分类的模板属性 |
| | |
| | | if(conditionMap == null){ |
| | | conditionMap = new HashMap<String, String>(); |
| | | } |
| | | return gridCodeClassifyTemplateAttr(Map2MPJLambdaUtil.getMPJLambdaWrapperByMapString(conditionMap, CodeClassifyTemplateAttr.class),pageHelper); |
| | | return gridCodeClassifyTemplateAttr(UBCSCondition.getMPJLambdaWrapperByMapString(conditionMap, CodeClassifyTemplateAttr.class),pageHelper); |
| | | } |
| | | |
| | | @Override |
| | |
| | | // conditionMap.put("classifytemplateoid", QueryOptionConstant.IN + "(" + VciBaseUtil.toInSql(templateOids.toArray(new String[0])) + ")"); |
| | | // PageHelper pageHelper = new PageHelper(-1); |
| | | // pageHelper.addDefaultAsc("orderNum"); |
| | | List<CodeClassifyTemplateAttr> attrDOS = baseMapper.selectByClassifytemplateoid(VciBaseUtil.toInSql(templateOids.toArray(new String[0]))); |
| | | // QueryWrapper<CodeClassifyTemplateAttr> wrapper = new QueryWrapper<>(); |
| | | // wrapper.in("classifytemplateoid",templateOids); |
| | | // wrapper.orderByAsc("orderNum"); |
| | | List<CodeClassifyTemplateAttr> attrDOS = baseMapper.selectByClassifytemplateoidRel(VciBaseUtil.toInSql(templateOids.toArray(new String[0]))); |
| | | // baseMapper.selectByClassifytemplateoid(VciBaseUtil.toInSql(templateOids.toArray(new String[0]))); |
| | | |
| | | if(!CollectionUtils.isEmpty(attrDOS)){ |
| | | attrDOList.addAll(attrDOS); |
| | |
| | | * @throws VciBaseException 拷贝属性出错的时候会抛出异常 |
| | | */ |
| | | @Override |
| | | public CodeClassifyTemplateAttrVO codeClassifyTemplateAttrDO2VO(CodeClassifyTemplateAttr codeClassifyTemplateAttrDO) throws VciBaseException{ |
| | | public CodeClassifyTemplateAttrVO codeClassifyTemplateAttrDO2VO(CodeClassifyTemplateAttr codeClassifyTemplateAttrDO) throws VciBaseException{ |
| | | CodeClassifyTemplateAttrVO vo = new CodeClassifyTemplateAttrVO(); |
| | | if(codeClassifyTemplateAttrDO != null){ |
| | | BeanUtilForVCI.copyPropertiesIgnoreCase(codeClassifyTemplateAttrDO,vo); |
| | |
| | | pageHelper = new PageHelper(-1); |
| | | } |
| | | pageHelper.addDefaultAsc("ordernum"); |
| | | // IPage iPage = new IPage(); |
| | | Query query = new Query(); |
| | | query.setAscs("ordernum"); |
| | | // query.setSize(100); |
| | | query.setSize(pageHelper.getLimit()); |
| | | if(pageHelper.getLimit() != -1){ |
| | | query.setSize(pageHelper.getLimit()); |
| | | query.setCurrent(pageHelper.getPage()); |
| | | } |
| | | // Condition.getPage(query) |
| | | CodeClassifyTemplateAttr codeClstempattrVO = new CodeClassifyTemplateAttr(); |
| | | // BeanUtil.toBean(map,codeClstempattrVO); |
| | | // BeanUtil |
| | | BeanMap beanMap = BeanMap.create(codeClstempattrVO); |
| | | |
| | | beanMap.putAll(conditionMap); |
| | | // Condition.getQueryWrapper( |
| | | IPage<CodeClassifyTemplateAttr> doList = baseMapper. |
| | | selectPage(Condition.getPage(query), Condition.getQueryWrapper(codeClstempattrVO)); |
| | | |
| | | |
| | | selectPage(Condition.getPage(query), UBCSCondition.getQueryWrapperByMapString(conditionMap,CodeClassifyTemplateAttr.class).orderByAsc("ordernum")); |
| | | if (!CollectionUtils.isEmpty(doList.getRecords())) { |
| | | // CodeClstempattrEntity codeClstempattrEntity = new CodeClstempattrEntity(); |
| | | // BeanUtils.copyProperties(conditionMap, codeClstempattrEntity); |
| | | // List<CodeClstempattrEntity> codeClstempattrEntities = new ArrayList<>(); |
| | | // BeanUtils.copyProperties(doList,codeClstempattrEntities); |
| | | // codeClstempattrEntities.addAll(doList); |
| | | dataGrid.setData(codeClassifyTemplateAttrDO2VOs(doList.getRecords())); |
| | | dataGrid.setTotal(VciBaseUtil.getInt(String.valueOf(baseMapper.selectCount(Condition.getQueryWrapper(codeClstempattrVO))))); |
| | | dataGrid.setTotal(VciBaseUtil.getInt(String.valueOf(baseMapper.selectCount(UBCSCondition.getQueryWrapperByMapString(conditionMap,CodeClassifyTemplateAttr.class))))); |
| | | } |
| | | return dataGrid; |
| | | } |
| | |
| | | throw new VciBaseException("模板属性英文名称【{0}】重复",new String[]{ repeatIdList.stream().collect(Collectors.joining(","))}); |
| | | } |
| | | |
| | | //模板oid |
| | | // 模板oid |
| | | String CLASSIFYTEMPLATEOID = null; |
| | | // |
| | | CodeReferConfigVO codeReferConfigVO = null; |
| | | //转换 |
| | | List<CodeClassifyTemplateAttr> codeClassifyTemplateAttrDOInsert = new ArrayList<CodeClassifyTemplateAttr>(); |
| | | List<String> prefix = new ArrayList<>(); |
| | |
| | | //将DTO转换为DO |
| | | CodeClassifyTemplateAttr codeClassifyTemplateAttrDO = new CodeClassifyTemplateAttr(); |
| | | BeanUtilForVCI.copyPropertiesIgnoreCase(codeClassifyTemplateAttrDTO,codeClassifyTemplateAttrDO); |
| | | codeClassifyTemplateAttrDO.setCreateTime(codeClassifyTemplateAttrDO.getCreateTime()!=null?codeClassifyTemplateAttrDO.getCreateTime():new Date()); |
| | | // codeClassifyTemplateAttrDO.setCreator(String.valueOf(AuthUtil.getUser().getUserId())); |
| | | codeClassifyTemplateAttrDO.setCreator(String.valueOf(AuthUtil.getUser().getAccount())); |
| | | codeClassifyTemplateAttrDO.setLastModifyTime(new Date()); |
| | | // codeClassifyTemplateAttrDO.setLastModifier(String.valueOf(AuthUtil.getUser().getUserId())); |
| | | codeClassifyTemplateAttrDO.setLastModifier(String.valueOf(AuthUtil.getUser().getAccount())); |
| | | codeClassifyTemplateAttrDOInsert.add(codeClassifyTemplateAttrDO); |
| | | |
| | | if(StringUtils.isNotBlank(codeClassifyTemplateAttrDO.getPrefixValue())){ |
| | |
| | | throw new VciBaseException("{0}{1}属性的时间格式不符合要求",new String[]{codeClassifyTemplateAttrDO.getId(),codeClassifyTemplateAttrDO.getName()}); |
| | | } |
| | | //如果是组合规则,里面使用的属性不能缺失,也都得显示 |
| | | String componentrule = codeClassifyTemplateAttrDTO.getComponentrule(); |
| | | String componentrule = codeClassifyTemplateAttrDTO.getComponentRule(); |
| | | boolean isContainsDynamicParameter = PatternUtil.isContainsDynamicParameter(componentrule); |
| | | if(isContainsDynamicParameter){ |
| | | List<String> userdAttrList = PatternUtil.getKeyListByContent(componentrule);//包含的所有${xxx}中的xxx |
| | |
| | | } |
| | | //要看看表单是否显示 |
| | | String unFormDisplayAttr = userdAttrList.stream().filter(s -> !VciBaseUtil.getBoolean(attrDTOMap.getOrDefault(s.toLowerCase(Locale.ROOT), |
| | | new CodeClassifyTemplateAttrDTO()).getFormdisplayflag())).collect(Collectors.joining(",")); |
| | | new CodeClassifyTemplateAttrDTO()).getFormDisplayFlag())).collect(Collectors.joining(",")); |
| | | if(StringUtils.isNotBlank(unFormDisplayAttr)){ |
| | | throw new VciBaseException("{0}属性是组合规则,但是规则里包含的属性[{1}]在当前模板中没有设置 表单显示 ",new String[]{codeClassifyTemplateAttrDO.getName(),unFormDisplayAttr}); |
| | | } |
| | |
| | | } |
| | | |
| | | if(CLASSIFYTEMPLATEOID==null){ |
| | | CLASSIFYTEMPLATEOID = codeClassifyTemplateAttrDTO.getClassifytemplateoid(); |
| | | CLASSIFYTEMPLATEOID = codeClassifyTemplateAttrDTO.getClassifyTemplateOid(); |
| | | } |
| | | |
| | | // 参照配置是否需要持久化 |
| | | codeReferConfigVO = JSONObject.parseObject(codeClassifyTemplateAttrDTO.getReferConfig(), CodeReferConfigVO.class); |
| | | if(Func.isNotEmpty(codeReferConfigVO) && codeReferConfigVO.getIsPersistence()=="true"){ |
| | | codeReferConfigService.insert(codeReferConfigVO); |
| | | } |
| | | } |
| | | |
| | | //执行数据保存操作 |
| | | // WebUtil.setPersistence(false);//不执行保存 |
| | | |
| | | //先都删了 |
| | | // VciQueryWrapperForDO deleteAttrWrapper = new VciQueryWrapperForDO(CodeClassifyTemplateAttrDO.class); |
| | | // deleteAttrWrapper.addQueryMap("CLASSIFYTEMPLATEOID",CLASSIFYTEMPLATEOID); |
| | | Map<String,Object> condition = new HashMap<>(); |
| | | condition.put("CLASSIFYTEMPLATEOID",CLASSIFYTEMPLATEOID); |
| | | List<CodeClassifyTemplateAttr> codeClassifyTemplateAttrDODelete = baseMapper.selectByMap(condition); |
| | |
| | | for (CodeClassifyTemplateAttr codeClassifyTemplateAttrDO:codeClassifyTemplateAttrDODelete){ |
| | | oids.add(codeClassifyTemplateAttrDO.getOid()); |
| | | } |
| | | // BatchCBO batchCBOTemplateDelete = new BatchCBO(); |
| | | if(!CollectionUtils.isEmpty(oids)){ |
| | | baseMapper.deleteBatchIds(oids); |
| | | this.removeBatchByIds(oids); |
| | | } |
| | | |
| | | //再新增 |
| | | if(!CollectionUtils.isEmpty(codeClassifyTemplateAttrDOInsert)){ |
| | | this.saveBatch(codeClassifyTemplateAttrDOInsert); |
| | |
| | | |
| | | } |
| | | |
| | | |
| | | // SessionInfo sessionInfo = VciBaseUtil.getCurrentUserSessionInfo(); |
| | | //处理可输可选的字符 |
| | | if(!CollectionUtils.isEmpty(prefix)){ |
| | | for (String s : prefix) { |
| | | DictBiz dictBiz = new DictBiz(); |
| | | dictBiz.setCode(MdmBtmTypeConstant.CODE_CLASSIFY_TEMPLATE_ATTR); |
| | | dictBiz.setDictKey(s); |
| | | dictBiz.setDictValue("prefix"); |
| | | dictBiz.setDictKey("prefix"); |
| | | dictBiz.setDictValue(s); |
| | | iDictBizClient.getCheck(dictBiz) ; |
| | | } |
| | | // .saveBySameNamespaceAndFlag(MdmBtmTypeConstant.CODE_CLASSIFY_TEMPLATE_ATTR,"prefix",prefix,sessionInfo); |
| | | } |
| | | if(!CollectionUtils.isEmpty(suffix)){ |
| | | for (String s : suffix) { |
| | | DictBiz dictBiz = new DictBiz(); |
| | | dictBiz.setCode(MdmBtmTypeConstant.CODE_CLASSIFY_TEMPLATE_ATTR); |
| | | dictBiz.setDictKey(s); |
| | | dictBiz.setDictValue("suffix"); |
| | | dictBiz.setDictKey("suffix"); |
| | | dictBiz.setDictValue(s); |
| | | iDictBizClient.getCheck(dictBiz) ; |
| | | } |
| | | // charService.saveBySameNamespaceAndFlag(MdmBtmTypeConstant.CODE_CLASSIFY_TEMPLATE_ATTR,"suffix",suffix,sessionInfo); |
| | | } |
| | | if(!CollectionUtils.isEmpty(dateFormates)){ |
| | | for (String s : dateFormates) { |
| | | DictBiz dictBiz = new DictBiz(); |
| | | dictBiz.setCode(MdmBtmTypeConstant.CODE_CLASSIFY_TEMPLATE_ATTR); |
| | | dictBiz.setDictKey(s); |
| | | dictBiz.setDictValue("dateFormates"); |
| | | dictBiz.setDictKey("dateFormates"); |
| | | dictBiz.setDictValue(s); |
| | | iDictBizClient.getCheck(dictBiz) ; |
| | | } |
| | | // charService.saveBySameNamespaceAndFlag(MdmBtmTypeConstant.CODE_CLASSIFY_TEMPLATE_ATTR,"dateFormates",dateFormates,sessionInfo); |
| | | } |
| | | |
| | | // WebUtil.setPersistence(true);//执行保存 |
| | | // boService.persistenceBatch(batchCBOTemplateDelete);//一起执行保存 |
| | | return codeClassifyTemplateAttrDO2VOs(codeClassifyTemplateAttrDOInsert); |
| | | } |
| | | |
| | |
| | | } |
| | | return isKV; |
| | | } |
| | | |
| | | public boolean checkKVObj(String kvString){ |
| | | boolean isKV = true; |
| | | try { |
| | |
| | | } |
| | | |
| | | //判断传过来的参照配置是否是json格式 |
| | | if(StringUtils.isNotBlank(codeClassifyTemplateAttrDTO.getReferbtmid())&&!checkKVObj(codeClassifyTemplateAttrDTO.getReferbtmid())){ |
| | | if(StringUtils.isNotBlank(codeClassifyTemplateAttrDTO.getReferBtmId())&&!checkKVObj(codeClassifyTemplateAttrDTO.getReferBtmId())){ |
| | | throw new VciBaseException("枚举注入数据格式错误!"); |
| | | } |
| | | |
| | |
| | | public CodeClassifyTemplateAttrVO getObjectByOid(String oid) throws VciBaseException{ |
| | | return codeClassifyTemplateAttrDO2VO(selectByOid(oid)); |
| | | } |
| | | |
| | | /** |
| | | * 主键查询数据对象 |
| | | * @param oid 主键 |
| | |
| | | } |
| | | |
| | | /** |
| | | * 参照主题库分类的模板属性列表 |
| | | * @param conditionMap 查询条件 |
| | | * @param pageHelper 分页和排序 |
| | | * @return 主题库分类的模板属性显示对象列表,生效的内容 |
| | | * @throws VciBaseException 查询条件和分页出错的时候会抛出异常 |
| | | */ |
| | | // @Override |
| | | // public DataGrid<CodeClassifyTemplateAttrVO> refDataGridCodeClassifyTemplateAttr(Map<String, String> conditionMap, PageHelper pageHelper) throws VciBaseException{ |
| | | // if(conditionMap == null){ |
| | | // conditionMap = new HashMap<String, String>(); |
| | | // } |
| | | // return gridCodeClassifyTemplateAttr(conditionMap,pageHelper); |
| | | // } |
| | | |
| | | /** |
| | | * 查询这个模板,业务类型下的所有未选择的属性 |
| | | * @param baseQueryObject |
| | | * @return |
| | | */ |
| | | @Override |
| | | public DataGrid<CodeOsbtmtypeattributeVO> codeClassifyTemplateAttrByBtm(BaseQueryObject baseQueryObject){ |
| | | public DataGrid<BtmTypeAttributeVO> codeClassifyTemplateAttrByBtm(BaseQueryObject baseQueryObject){ |
| | | if(baseQueryObject.getConditionMap() == null){ |
| | | baseQueryObject.setConditionMap(new HashMap<>()); |
| | | } |
| | | DataGrid<CodeOsbtmtypeattributeVO> dataGrid=new DataGrid<CodeOsbtmtypeattributeVO>(); |
| | | DataGrid<BtmTypeAttributeVO> dataGrid=new DataGrid<BtmTypeAttributeVO>(); |
| | | //模板oid |
| | | String templateAttrOid = baseQueryObject.getConditionMap().get("oid"); |
| | | String name = baseQueryObject.getConditionMap().getOrDefault("name",""); |
| | |
| | | |
| | | //查询模板对象 |
| | | CodeClassifyTemplate codeClassifyTemplateDO = codeClassifyTemplateMapper.selectById(templateAttrOid); |
| | | |
| | | //这个业务类型下的所有属性 |
| | | List<CodeOsbtmtypeattributeVO> boAttrs = (List<CodeOsbtmtypeattributeVO>) codeOsbtmtypeattributeMapper.selectById(codeClassifyTemplateDO.getBtmTypeId());// this.btmService.listAttributeByBtmId(codeClassifyTemplateDO.getBtmTypeId()); |
| | | // codeOsbtmtypeattributeMapper.selectById(codeClassifyTemplateDO.getBtmTypeId()); |
| | | // BeanUtils.copyProperties(codeOsbtmtypeattributeMapper.selectById(codeClassifyTemplateDO.getBtmTypeId()),boAttrs); |
| | | //把默认的属性也添加到boAttrs |
| | | if(boAttrs == null){ |
| | | boAttrs = new ArrayList<>(); |
| | | // 没有模板对象不执行逻辑 |
| | | if(Objects.isNull(codeClassifyTemplateDO)){ |
| | | dataGrid.setData(new ArrayList<>()); |
| | | dataGrid.setTotal(0); |
| | | return dataGrid; |
| | | } |
| | | if(!false){ |
| | | // List<CodeOsbtmtypeattributeVO> finalBoAttrs = boAttrs; |
| | | // attributeService.getDefaultAttributeVOs().stream().forEach(attr-> { |
| | | // CodeOsbtmtypeattributeVO attributeVO = new CodeOsbtmtypeattributeVO(); |
| | | // BeanUtil.convert(attr, attributeVO); |
| | | // if ("id".equalsIgnoreCase(attributeVO.getId())) { |
| | | // attributeVO.setName("企业编码"); |
| | | // } |
| | | // if ("name".equalsIgnoreCase(attributeVO.getId())) { |
| | | // attributeVO.setName("集团码"); |
| | | // } |
| | | // attributeVO.setAttrDataType(attr.getAttributeDataType()); |
| | | // attributeVO.setAttributeLength(attr.getAttrLength()); |
| | | // attributeVO.setReferBtmTypeId(attr.getBtmTypeId()); |
| | | // attributeVO.setReferBtmTypeName(attr.getBtmTypeName()); |
| | | // finalBoAttrs.add(attributeVO); |
| | | // }); |
| | | // boAttrs = finalBoAttrs; |
| | | Object o = null; |
| | | //这个业务类型下的所有属性 |
| | | R<BtmTypeVO> btmTypeVOR = btmTypeClient.getAllAttributeByBtmId(codeClassifyTemplateDO.getBtmTypeId()); |
| | | if(!btmTypeVOR.isSuccess()){ |
| | | throw new ServiceException("业务类型feign调用错误!"); |
| | | } |
| | | |
| | | //这个模板下已经有的属性 |
| | | // VciQueryWrapperForDO queryWrapper = new VciQueryWrapperForDO(CodeClassifyTemplateAttrDO.class); |
| | | // queryWrapper.addQueryMap("CLASSIFYTEMPLATEOID",templateAttrOid); |
| | | // VciQueryWrapperForDO queryWrapper = new VciQueryWrapperForDO(CodeClassifyTemplateAttrDO.class); |
| | | // queryWrapper.addQueryMap("CLASSIFYTEMPLATEOID",templateAttrOid); |
| | | Map<String,Object> condition = new HashMap<>(1); |
| | | condition.put("CLASSIFYTEMPLATEOID",templateAttrOid); |
| | | |
| | | List<CodeClassifyTemplateAttr> codeClassifyTemplateAttrDOList = baseMapper.selectByMap(condition); |
| | | |
| | | List<String> btmOids = new ArrayList<String>(); |
| | | List<String> btmIds = new ArrayList<String>(); |
| | | for (CodeClassifyTemplateAttr codeClassifyTemplateAttrDO:codeClassifyTemplateAttrDOList){ |
| | | btmOids.add(codeClassifyTemplateAttrDO.getId()); |
| | | btmIds.add(codeClassifyTemplateAttrDO.getId()); |
| | | } |
| | | |
| | | //过滤掉已经存在的属性 |
| | | List<CodeOsbtmtypeattributeVO> boAttrss = new ArrayList<CodeOsbtmtypeattributeVO>(); |
| | | |
| | | for (CodeOsbtmtypeattributeVO osBtmTypeAttributeVO:boAttrs){ |
| | | if(!btmOids.contains(osBtmTypeAttributeVO.getId())){ |
| | | List<BtmTypeAttributeVO> boAttrss = new ArrayList<BtmTypeAttributeVO>(); |
| | | for (BtmTypeAttributeVO osBtmTypeAttributeVO:btmTypeVOR.getData().getAttributes()){ |
| | | if(!btmIds.contains(osBtmTypeAttributeVO.getId())){ |
| | | //看看是不是有模糊查询 |
| | | boolean inSearch = true; |
| | | if(StringUtils.isNotBlank(name) && !osBtmTypeAttributeVO.getName().contains(name.replace("*",""))){ |
| | |
| | | inSearch = false; |
| | | } |
| | | if(inSearch) { |
| | | if(!VciFieldTypeEnum.VTDouble.equals(osBtmTypeAttributeVO.getAttrDataType())){ |
| | | osBtmTypeAttributeVO.setPrecisionLength(null); |
| | | osBtmTypeAttributeVO.setScaleLength(null); |
| | | } |
| | | boAttrss.add(osBtmTypeAttributeVO); |
| | | } |
| | | } |
| | | } |
| | | // 按照id升序排序 |
| | | boAttrss = boAttrss.stream().sorted(Comparator.comparing(BtmTypeAttributeVO::getId)).collect(Collectors.toList()); |
| | | dataGrid.setData(boAttrss); |
| | | dataGrid.setTotal(boAttrss.size()); |
| | | return dataGrid; |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | public DataGrid<CodeOsbtmtypeattributeVO> codeClassifyTemplateAttrByBtmHave(BaseQueryObject baseQueryObject){ |
| | | DataGrid<CodeOsbtmtypeattributeVO> dataGrid=new DataGrid<CodeOsbtmtypeattributeVO>(); |
| | | public DataGrid<BtmTypeAttributeVO> codeClassifyTemplateAttrByBtmHave(BaseQueryObject baseQueryObject){ |
| | | DataGrid<BtmTypeAttributeVO> dataGrid=new DataGrid<BtmTypeAttributeVO>(); |
| | | //模板oid |
| | | String templateAttrOid = baseQueryObject.getConditionMap().get("oid"); |
| | | |
| | |
| | | CodeClassifyTemplate codeClassifyTemplateDO = codeClassifyTemplateMapper.selectById(templateAttrOid); |
| | | |
| | | //这个业务类型下的所有属性 |
| | | List<CodeOsbtmtypeattributeVO> boAttrs = (List<CodeOsbtmtypeattributeVO>) codeOsbtmtypeattributeMapper.selectById(codeClassifyTemplateDO.getBtmTypeId());//this.btmService.listAttributeByBtmIdHasDefault(codeClassifyTemplateDO.getBtmTypeId()); |
| | | // codeOsbtmtypeattributeMapper.selectById(codeClassifyTemplateDO.getBtmTypeId()); |
| | | // BeanUtils.copyProperties(codeOsbtmtypeattributeMapper.selectById(codeClassifyTemplateDO.getBtmTypeId()),boAttrs); |
| | | // TODO 已完善 |
| | | List<BtmTypeAttributeVO> boAttrs = (List<BtmTypeAttributeVO>) btmTypeClient.getAllAttributeByBtmId(codeClassifyTemplateDO.getBtmTypeId()); |
| | | //这个模板下已经有的属性 |
| | | //把默认的属性也添加到boAttrs |
| | | if(boAttrs == null){ |
| | | boAttrs = new ArrayList<>(); |
| | | } |
| | | // VciQueryWrapperForDO queryWrapper = new VciQueryWrapperForDO(CodeClassifyTemplateAttrDO.class); |
| | | // queryWrapper.addQueryMap("CLASSIFYTEMPLATEOID",templateAttrOid); |
| | | |
| | | // Map<String,Object> condition = new HashMap<>(1); |
| | | // condition.put("CLASSIFYTEMPLATEOID",templateAttrOid); |
| | | |
| | | QueryWrapper<CodeClassifyTemplateAttr> wrapper=new QueryWrapper<>(); |
| | | wrapper.eq("CLASSIFYTEMPLATEOID",templateAttrOid); |
| | | |
| | |
| | | } |
| | | |
| | | //过滤掉除了自身的别的属性 |
| | | List<CodeOsbtmtypeattributeVO> boAttrss = new ArrayList<CodeOsbtmtypeattributeVO>(); |
| | | List<BtmTypeAttributeVO> boAttrss = new ArrayList<BtmTypeAttributeVO>(); |
| | | |
| | | for (CodeOsbtmtypeattributeVO osBtmTypeAttributeVO:boAttrs){ |
| | | for (BtmTypeAttributeVO osBtmTypeAttributeVO:boAttrs){ |
| | | if(btmOids.contains(osBtmTypeAttributeVO.getId())){ |
| | | boAttrss.add(osBtmTypeAttributeVO); |
| | | } |
| | |
| | | return R.success("操作成功!"); |
| | | } |
| | | |
| | | /** |
| | | * 使用查询封装器来查询 |
| | | * @param wrapper 查询封装器 |
| | | * @return 数据对象 |
| | | */ |
| | | @Override |
| | | public List<CodeClassifyTemplateAttr> selectByWrapper(Wrapper wrapper) { |
| | | return codeClassifyTemplateAttrMapper.selectList(wrapper); |
| | | } |
| | | |
| | | } |