¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.vci.ubcs.code.service.impl; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.alibaba.nacos.common.utils.StringUtils; |
| | | 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.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.ICodeTempphaseService; |
| | | import com.vci.ubcs.code.vo.CodeOsbtmtypeattributeVO; |
| | | import com.vci.ubcs.code.vo.pagemodel.CodeClassifyTemplateAttrVO; |
| | | import com.vci.ubcs.code.wrapper.CodeClassifyTemplateAttrWrapper; |
| | | import com.vci.ubcs.starter.exception.VciBaseException; |
| | | import com.vci.ubcs.starter.revision.service.RevisionModelUtil; |
| | | import com.vci.ubcs.starter.util.PatternUtil; |
| | | import com.vci.ubcs.starter.web.enumpck.VciFieldTypeEnum; |
| | | import com.vci.ubcs.starter.web.pagemodel.*; |
| | | 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.mp.support.Condition; |
| | | import org.springblade.core.mp.support.Query; |
| | | import org.springblade.core.tool.api.R; |
| | | 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; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import static com.vci.ubcs.code.constant.FrameWorkLangCodeConstant.*; |
| | | import static com.vci.ubcs.code.constant.FrameWorkLangCodeConstant.DATA_OID_NOT_EXIST; |
| | | |
| | | /** |
| | | * 主é¢åºåç±»çæ¨¡æ¿å±æ§æå¡ |
| | | * @author ludc |
| | | * @date 2023/5/5 |
| | | */ |
| | | @Service |
| | | public class CodeClassifyTemplateAttrServiceImpl extends ServiceImpl<CodeClassifyTemplateAttrMapper, CodeClassifyTemplateAttr> implements ICodeClassifyTemplateAttrService { |
| | | |
| | | /** |
| | | * æ°æ®æä½å± |
| | | */ |
| | | @Resource |
| | | private CodeClassifyTemplateAttrMapper codeClassifyTemplateAttrMapper; |
| | | |
| | | // @Resource |
| | | // CodeClstempattrMapper codeClstempattrMapper; |
| | | // @Resource |
| | | // ICodeTempphaseService codeTempphaseService; |
| | | @Resource |
| | | IDictBizClient iDictBizClient; |
| | | @Resource |
| | | CodeClassifyTemplateMapper codeClassifyTemplateMapper; |
| | | @Resource |
| | | CodeOsbtmtypeattributeMapper codeOsbtmtypeattributeMapper; |
| | | @Resource |
| | | @Lazy |
| | | ICodeTempphaseService codeTempphaseService; |
| | | /** |
| | | * 对象çæä½ |
| | | */ |
| | | @Autowired(required = false) |
| | | private RevisionModelUtil revisionModelUtil; |
| | | |
| | | /** |
| | | * æ¥è¯¢ææç主é¢åºåç±»çæ¨¡æ¿å±æ§ |
| | | * @param mpjLambdaWrapper æ¥è¯¢æ¡ä»¶ |
| | | * @param pageHelper å页åæåº |
| | | * @return æ§è¡ç»æ |
| | | * @throws VciBaseException æ¥è¯¢æ¡ä»¶åå页åºéçæ¶å伿åºå¼å¸¸ |
| | | */ |
| | | @Override |
| | | public IPage<CodeClassifyTemplateAttrVO> gridCodeClassifyTemplateAttr(MPJLambdaWrapper<CodeClassifyTemplateAttr> mpjLambdaWrapper , PageHelper pageHelper) throws VciBaseException { |
| | | //没æä¼ éåæ°ï¼å°±ä¸æ§è¡æ¥è¯¢é»è¾ |
| | | if(mpjLambdaWrapper == null){ |
| | | return new Page<>(); |
| | | } |
| | | Query query = new Query(); |
| | | if (pageHelper == null) { |
| | | pageHelper = new PageHelper(-1); |
| | | query.setSize(-1); |
| | | }else { |
| | | query.setCurrent(pageHelper.getPage()); |
| | | query.setSize(pageHelper.getLimit()); |
| | | } |
| | | //pageHelper.addDefaultAsc("ordernum"); |
| | | query.setAscs("ORDERNUM"); |
| | | //è¿å¿æ¯ä¸ªè¿è¡¨æ¥è¯¢ |
| | | IPage<CodeClassifyTemplateAttr> doList = codeClassifyTemplateAttrMapper.selectPage(Condition.getPage(query), mpjLambdaWrapper); |
| | | IPage<CodeClassifyTemplateAttrVO> voList = new Page<>(); |
| | | if (!CollectionUtils.isEmpty(doList.getRecords())) { |
| | | voList = CodeClassifyTemplateAttrWrapper.build().pageVO(doList); |
| | | } |
| | | return voList; |
| | | } |
| | | |
| | | // /** |
| | | // * åç
§ä¸»é¢åºåç±»çæ¨¡æ¿å±æ§å表 |
| | | // * @param conditionMap æ¥è¯¢æ¡ä»¶ |
| | | // * @param pageHelper å页åæåº |
| | | // * @return 主é¢åºåç±»çæ¨¡æ¿å±æ§æ¾ç¤ºå¯¹è±¡å表ï¼çæçå
容 |
| | | // * @throws VciBaseException æ¥è¯¢æ¡ä»¶åå页åºéçæ¶å伿åºå¼å¸¸ |
| | | // */ |
| | | // @Override |
| | | // public IPage<CodeClassifyTemplateAttrVO> refDataGridCodeClassifyTemplateAttr(Map<String, Object> conditionMap, PageHelper pageHelper) throws VciBaseException{ |
| | | // if(conditionMap == null){ |
| | | // conditionMap = new HashMap<String, Object>(); |
| | | // } |
| | | // return gridCodeClassifyTemplateAttr(Map2MPLLambdaUtil.getMPJLambdaWrapper(conditionMap, CodeClassifyTemplateAttr.class),pageHelper); |
| | | // } |
| | | |
| | | @Override |
| | | public IPage<CodeClassifyTemplateAttrVO> selectCodeClstempattrPage(IPage<CodeClassifyTemplateAttrVO> page, CodeClassifyTemplateAttrVO CodeClstempattr) { |
| | | return page.setRecords(baseMapper.selectCodeClstempattrPage(page, CodeClstempattr)); |
| | | } |
| | | |
| | | /** |
| | | * ä½¿ç¨æ¨¡æ¿ç主é®è·å模æ¿ç屿§--æ¹é |
| | | * |
| | | * @param templateOidCollection 模æ¿çä¸»é® |
| | | * @return 屿§çä¿¡æ¯ |
| | | */ |
| | | @Override |
| | | public List<CodeClassifyTemplateAttrVO> listCodeClassifyTemplateAttrByTemplateOids(Collection<String> templateOidCollection) { |
| | | if(CollectionUtils.isEmpty(templateOidCollection)){ |
| | | return new ArrayList<>(); |
| | | } |
| | | List<CodeClassifyTemplateAttr> attrDOList = new ArrayList<>(); |
| | | VciBaseUtil.switchCollectionForOracleIn(templateOidCollection).stream().forEach(templateOids->{ |
| | | // Map<String,String> conditionMap = new HashMap<>(); |
| | | // 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]))); |
| | | |
| | | if(!CollectionUtils.isEmpty(attrDOS)){ |
| | | attrDOList.addAll(attrDOS); |
| | | } |
| | | }); |
| | | return codeClassifyTemplateAttrDO2VOs(attrDOList); |
| | | } |
| | | |
| | | /** |
| | | * æ¹éæ°æ®å¯¹è±¡è½¬æ¢ä¸ºæ¾ç¤ºå¯¹è±¡ |
| | | * @param codeClassifyTemplateAttrDOs æ°æ®å¯¹è±¡å表 |
| | | * @return æ¾ç¤ºå¯¹è±¡ |
| | | * @throws VciBaseException åæ°ä¸ºç©ºæè
ä¸åå¨çæ¶å伿åºå¼å¸¸ |
| | | */ |
| | | @Override |
| | | public List<CodeClassifyTemplateAttrVO> codeClassifyTemplateAttrDO2VOs(Collection<CodeClassifyTemplateAttr> codeClassifyTemplateAttrDOs) throws VciBaseException{ |
| | | List<CodeClassifyTemplateAttrVO> voList = new ArrayList<CodeClassifyTemplateAttrVO>(); |
| | | if(!CollectionUtils.isEmpty(codeClassifyTemplateAttrDOs)){ |
| | | for(CodeClassifyTemplateAttr s: codeClassifyTemplateAttrDOs){ |
| | | CodeClassifyTemplateAttrVO vo = codeClassifyTemplateAttrDO2VO(s); |
| | | if(vo != null){ |
| | | voList.add(vo); |
| | | } |
| | | } |
| | | } |
| | | return voList; |
| | | } |
| | | |
| | | /** |
| | | * æ°æ®å¯¹è±¡è½¬æ¢ä¸ºæ¾ç¤ºå¯¹è±¡ |
| | | * @param codeClassifyTemplateAttrDO æ°æ®å¯¹è±¡ |
| | | * @return æ¾ç¤ºå¯¹è±¡ |
| | | * @throws VciBaseException æ·è´å±æ§åºéçæ¶å伿åºå¼å¸¸ |
| | | */ |
| | | @Override |
| | | public CodeClassifyTemplateAttrVO codeClassifyTemplateAttrDO2VO(CodeClassifyTemplateAttr codeClassifyTemplateAttrDO) throws VciBaseException{ |
| | | CodeClassifyTemplateAttrVO vo = new CodeClassifyTemplateAttrVO(); |
| | | if(codeClassifyTemplateAttrDO != null){ |
| | | BeanUtilForVCI.copyPropertiesIgnoreCase(codeClassifyTemplateAttrDO,vo); |
| | | //妿ælcstatusçç±»çè¯ |
| | | vo.setAttributeDataTypeText(VciFieldTypeEnum.getTextByValue(vo.getAttributeDataType())); |
| | | } |
| | | return vo; |
| | | } |
| | | |
| | | // @Override |
| | | // public IPage<CodeClassifyTemplateAttrVO> selectCodeClstempattrPage(IPage<CodeClassifyTemplateAttrVO> page, CodeClassifyTemplateAttrVO CodeClstempattr) { |
| | | // return page.setRecords(baseMapper.selectCodeClstempattrPage(page, CodeClstempattr)); |
| | | // } |
| | | |
| | | |
| | | // /** |
| | | // * ä½¿ç¨æ¨¡æ¿ç主é®è·å模æ¿ç屿§--æ¹é |
| | | // * |
| | | // * @param templateOidCollection 模æ¿çä¸»é® |
| | | // * @return 屿§çä¿¡æ¯ |
| | | // */ |
| | | // @Override |
| | | // public List<CodeClassifyTemplateAttrVO> listCodeClassifyTemplateAttrByTemplateOids(Collection<String> templateOidCollection) { |
| | | // if(CollectionUtils.isEmpty(templateOidCollection)){ |
| | | // return new ArrayList<>(); |
| | | // } |
| | | // List<CodeClassifyTemplateAttr> attrDOList = new ArrayList<>(); |
| | | // VciBaseUtil.switchCollectionForOracleIn(templateOidCollection).stream().forEach(templateOids->{ |
| | | //// Map<String,String> conditionMap = new HashMap<>(); |
| | | //// 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]))); |
| | | // |
| | | // if(!CollectionUtils.isEmpty(attrDOS)){ |
| | | // attrDOList.addAll(attrDOS); |
| | | // } |
| | | // }); |
| | | // return codeClassifyTemplateAttrDO2VOs(attrDOList); |
| | | // } |
| | | |
| | | // /** |
| | | // * æ¹éæ°æ®å¯¹è±¡è½¬æ¢ä¸ºæ¾ç¤ºå¯¹è±¡ |
| | | // * @param codeClassifyTemplateAttrDOs æ°æ®å¯¹è±¡å表 |
| | | // * @return æ¾ç¤ºå¯¹è±¡ |
| | | // */ |
| | | // @Override |
| | | // public List<CodeClassifyTemplateAttrVO> codeClassifyTemplateAttrDO2VOs(Collection<CodeClassifyTemplateAttr> codeClassifyTemplateAttrDOs){ |
| | | // List<CodeClassifyTemplateAttrVO> voList = new ArrayList<CodeClassifyTemplateAttrVO>(); |
| | | // if(!CollectionUtils.isEmpty(codeClassifyTemplateAttrDOs)){ |
| | | // for(CodeClassifyTemplateAttr s: codeClassifyTemplateAttrDOs){ |
| | | // CodeClassifyTemplateAttrVO vo = codeClassifyTemplateAttrDO2VO(s); |
| | | // if(vo != null){ |
| | | // voList.add(vo); |
| | | // } |
| | | // } |
| | | // } |
| | | // return voList; |
| | | // } |
| | | |
| | | // /** |
| | | // * æ°æ®å¯¹è±¡è½¬æ¢ä¸ºæ¾ç¤ºå¯¹è±¡ |
| | | // * @param codeClassifyTemplateAttrDO æ°æ®å¯¹è±¡ |
| | | // * @return æ¾ç¤ºå¯¹è±¡ |
| | | // */ |
| | | // @Override |
| | | // public CodeClassifyTemplateAttrVO codeClassifyTemplateAttrDO2VO(CodeClassifyTemplateAttr codeClassifyTemplateAttrDO){ |
| | | // CodeClassifyTemplateAttrVO vo = new CodeClassifyTemplateAttrVO(); |
| | | // if(codeClassifyTemplateAttrDO != null){ |
| | | // BeanUtilForVCI.copyPropertiesIgnoreCase(codeClassifyTemplateAttrDO,vo); |
| | | // //妿ælcstatusçç±»çè¯ |
| | | // vo.setAttributeDataTypeText(VciFieldTypeEnum.getTextByValue(vo.getAttributeDataType())); |
| | | // } |
| | | // return vo; |
| | | // } |
| | | |
| | | /** |
| | | * æ¥è¯¢ææç主é¢åºåç±»çæ¨¡æ¿å±æ§ |
| | | * @param conditionMap æ¥è¯¢æ¡ä»¶ |
| | | * @param pageHelper å页åæåº |
| | | * @return æ§è¡ç»æ |
| | | */ |
| | | @Override |
| | | public DataGrid<CodeClassifyTemplateAttrVO> gridCodeClassifyTemplateAttr(Map<String, String> conditionMap, PageHelper pageHelper) { |
| | | DataGrid<CodeClassifyTemplateAttrVO> dataGrid=new DataGrid<CodeClassifyTemplateAttrVO>(); |
| | | //没æä¼ éåæ°ï¼å°±ä¸æ§è¡æ¥è¯¢é»è¾ |
| | | if(conditionMap.size()==0){ |
| | | dataGrid.setData(new ArrayList<>()); |
| | | dataGrid.setTotal(0); |
| | | return dataGrid; |
| | | } |
| | | |
| | | if (pageHelper == null) { |
| | | pageHelper = new PageHelper(-1); |
| | | } |
| | | pageHelper.addDefaultAsc("ordernum"); |
| | | // IPage iPage = new IPage(); |
| | | Query query = new Query(); |
| | | query.setAscs("ordernum"); |
| | | // query.setSize(100); |
| | | 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)); |
| | | |
| | | |
| | | 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))))); |
| | | } |
| | | return dataGrid; |
| | | } |
| | | |
| | | /** |
| | | * å¢å 主é¢åºåç±»çæ¨¡æ¿å±æ§ |
| | | * @param codeClassifyTemplateAttrDTO 主é¢åºåç±»çæ¨¡æ¿å±æ§æ°æ®ä¼ è¾å¯¹è±¡ |
| | | * @return æ§è¡ç»æ |
| | | */ |
| | | @Override |
| | | public CodeClassifyTemplateAttrVO addSave(CodeClassifyTemplateAttrDTO codeClassifyTemplateAttrDTO){ |
| | | VciBaseUtil.alertNotNull(codeClassifyTemplateAttrDTO,"éè¦æ·»å çæ°æ®å¯¹è±¡"); |
| | | //å°DTO转æ¢ä¸ºDO |
| | | CodeClassifyTemplateAttr codeClassifyTemplateAttrDO = new CodeClassifyTemplateAttr(); |
| | | BeanUtilForVCI.copyPropertiesIgnoreCase(codeClassifyTemplateAttrDTO,codeClassifyTemplateAttrDO); |
| | | baseMapper.insert(codeClassifyTemplateAttrDO); |
| | | return codeClassifyTemplateAttrDO2VO(codeClassifyTemplateAttrDO); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * æ¹éæ·»å |
| | | * @param codeClassifyTemplateAttrDTOs æ°æ®ä¼ è¾å¯¹è±¡ |
| | | * @return ä¿ååçæ¾ç¤ºå¯¹è±¡ |
| | | */ |
| | | @Override |
| | | @Transactional |
| | | public List<CodeClassifyTemplateAttrVO> batchAddSave(List<CodeClassifyTemplateAttrDTO> codeClassifyTemplateAttrDTOs) { |
| | | if(CollectionUtils.isEmpty(codeClassifyTemplateAttrDTOs)){ |
| | | return new ArrayList<>(); |
| | | } |
| | | |
| | | //忿屿§çè±æåç§°ï¼ç¬¬ä¸ä¸ªéªè¯éè¦ç¨å° |
| | | Map<String,CodeClassifyTemplateAttrDTO> attrDTOMap =codeClassifyTemplateAttrDTOs.stream().collect(Collectors.toMap(s->s.getId().toLowerCase(Locale.ROOT), t->t)); |
| | | |
| | | //æ¾å±æ§ä¸æååéå¤ |
| | | Map<String, Long> nameCountMap = codeClassifyTemplateAttrDTOs.stream().collect(Collectors.groupingBy(s -> s.getName(), Collectors.counting())); |
| | | List<String> repeatNameList = nameCountMap.keySet().stream().filter(s -> nameCountMap.get(s) > 1).collect(Collectors.toList()); |
| | | if(!CollectionUtils.isEmpty(repeatNameList)){ |
| | | throw new VciBaseException("模æ¿å±æ§ä¸æåç§°ã{0}ãéå¤",new String[]{ repeatNameList.stream().collect(Collectors.joining(","))}); |
| | | } |
| | | //æ¾å±æ§è±æååéå¤ |
| | | Map<String, Long> idCountMap = codeClassifyTemplateAttrDTOs.stream().collect(Collectors.groupingBy(s -> s.getId().toLowerCase(Locale.ROOT), Collectors.counting())); |
| | | List<String> repeatIdList = idCountMap.keySet().stream().filter(s -> idCountMap.get(s) > 1).collect(Collectors.toList()); |
| | | if(!CollectionUtils.isEmpty(repeatIdList)){ |
| | | throw new VciBaseException("模æ¿å±æ§è±æåç§°ã{0}ãéå¤",new String[]{ repeatIdList.stream().collect(Collectors.joining(","))}); |
| | | } |
| | | |
| | | //模æ¿oid |
| | | String CLASSIFYTEMPLATEOID = null; |
| | | //è½¬æ¢ |
| | | List<CodeClassifyTemplateAttr> codeClassifyTemplateAttrDOInsert = new ArrayList<CodeClassifyTemplateAttr>(); |
| | | List<String> prefix = new ArrayList<>(); |
| | | List<String> suffix = new ArrayList<>(); |
| | | List<String> dateFormates = new ArrayList<>(); |
| | | for (CodeClassifyTemplateAttrDTO codeClassifyTemplateAttrDTO:codeClassifyTemplateAttrDTOs){ |
| | | VciBaseUtil.alertNotNull(codeClassifyTemplateAttrDTO,"éè¦æ·»å çæ°æ®å¯¹è±¡"); |
| | | //å°DTO转æ¢ä¸ºDO |
| | | CodeClassifyTemplateAttr codeClassifyTemplateAttrDO = new CodeClassifyTemplateAttr(); |
| | | BeanUtilForVCI.copyPropertiesIgnoreCase(codeClassifyTemplateAttrDTO,codeClassifyTemplateAttrDO); |
| | | codeClassifyTemplateAttrDOInsert.add(codeClassifyTemplateAttrDO); |
| | | |
| | | if(StringUtils.isNotBlank(codeClassifyTemplateAttrDO.getPrefixValue())){ |
| | | prefix.add(codeClassifyTemplateAttrDO.getPrefixValue()); |
| | | } |
| | | if(StringUtils.isNotBlank(codeClassifyTemplateAttrDO.getSuffixValue())){ |
| | | suffix.add(codeClassifyTemplateAttrDO.getSuffixValue()); |
| | | } |
| | | if(StringUtils.isNotBlank(codeClassifyTemplateAttrDO.getCodeDateFormat())){ |
| | | dateFormates.add(codeClassifyTemplateAttrDO.getCodeDateFormat()); |
| | | } |
| | | //å¤æä¼ è¿æ¥çæä¸¾æ³¨å
¥æ¯å¦æ¯jsonArræ ¼å¼ |
| | | if(StringUtils.isNotBlank(codeClassifyTemplateAttrDO.getEnumString())&&!checkKVArr(codeClassifyTemplateAttrDO.getEnumString())){ |
| | | throw new VciBaseException("{0}{1}屿§çæä¸¾æ³¨å
¥æ°æ®æ ¼å¼é误!",new String[]{codeClassifyTemplateAttrDO.getId(),codeClassifyTemplateAttrDO.getName()}); |
| | | } |
| | | //å类注å
¥ |
| | | if(StringUtils.isNotBlank(codeClassifyTemplateAttrDO.getClassifyInvokeAttr()) |
| | | && !CodeLevelTypeEnum.MIN.getValue().equalsIgnoreCase(codeClassifyTemplateAttrDO.getClassifyInvokeLevel()) |
| | | && VciBaseUtil.getInt(codeClassifyTemplateAttrDO.getClassifyInvokeLevel()) < 0){ |
| | | throw new VciBaseException("{0}{1}屿§çæ¯å类注å
¥ï¼ä½æ¯æ³¨å
¥å±çº§ä¸è½å°äº0!",new String[]{codeClassifyTemplateAttrDO.getId(),codeClassifyTemplateAttrDO.getName()}); |
| | | } |
| | | |
| | | //å¤æä¼ è¿æ¥çåç
§é
ç½®æ¯å¦æ¯jsonæ ¼å¼ |
| | | if(StringUtils.isNotBlank(codeClassifyTemplateAttrDO.getReferConfig())&&!checkKVObj(codeClassifyTemplateAttrDO.getReferConfig())){ |
| | | throw new VciBaseException("{0}{1}屿§çåç
§é
ç½®æ°æ®æ ¼å¼é误!",new String[]{codeClassifyTemplateAttrDO.getId(),codeClassifyTemplateAttrDO.getName()}); |
| | | } |
| | | if(StringUtils.isNotBlank(codeClassifyTemplateAttrDO.getCodeDateFormat()) && !checkDateFormat(codeClassifyTemplateAttrDO.getCodeDateFormat())){ |
| | | throw new VciBaseException("{0}{1}屿§çæ¶é´æ ¼å¼ä¸ç¬¦åè¦æ±",new String[]{codeClassifyTemplateAttrDO.getId(),codeClassifyTemplateAttrDO.getName()}); |
| | | } |
| | | //妿æ¯ç»åè§åï¼éé¢ä½¿ç¨ç屿§ä¸è½ç¼ºå¤±ï¼ä¹é½å¾æ¾ç¤º |
| | | String componentrule = codeClassifyTemplateAttrDTO.getComponentrule(); |
| | | boolean isContainsDynamicParameter = PatternUtil.isContainsDynamicParameter(componentrule); |
| | | if(isContainsDynamicParameter){ |
| | | List<String> userdAttrList = PatternUtil.getKeyListByContent(componentrule);//å
å«çææ${xxx}ä¸çxxx |
| | | if(!CollectionUtils.isEmpty(userdAttrList)){ |
| | | String unExistAttr = userdAttrList.stream().filter(s -> !attrDTOMap.containsKey(s.toLowerCase(Locale.ROOT))).collect(Collectors.joining(",")); |
| | | if(StringUtils.isNotBlank(unExistAttr)){ |
| | | throw new VciBaseException("{0}屿§æ¯ç»åè§åï¼ä½æ¯è§åéå
å«ç屿§[{1}]å¨å½å模æ¿ä¸ä¸åå¨!",new String[]{codeClassifyTemplateAttrDO.getName(), unExistAttr}); |
| | | } |
| | | //è¦ççè¡¨åæ¯å¦æ¾ç¤º |
| | | String unFormDisplayAttr = userdAttrList.stream().filter(s -> !VciBaseUtil.getBoolean(attrDTOMap.getOrDefault(s.toLowerCase(Locale.ROOT), |
| | | 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(); |
| | | } |
| | | |
| | | } |
| | | |
| | | //æ§è¡æ°æ®ä¿åæä½ |
| | | // 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); |
| | | |
| | | //oids |
| | | List<String> oids = new ArrayList<String>(); |
| | | for (CodeClassifyTemplateAttr codeClassifyTemplateAttrDO:codeClassifyTemplateAttrDODelete){ |
| | | oids.add(codeClassifyTemplateAttrDO.getOid()); |
| | | } |
| | | // BatchCBO batchCBOTemplateDelete = new BatchCBO(); |
| | | if(!CollectionUtils.isEmpty(oids)){ |
| | | baseMapper.deleteBatchIds(oids); |
| | | } |
| | | |
| | | //åæ°å¢ |
| | | if(!CollectionUtils.isEmpty(codeClassifyTemplateAttrDOInsert)){ |
| | | this.saveBatch(codeClassifyTemplateAttrDOInsert); |
| | | } |
| | | |
| | | //è°ç¨é¶æ®µ |
| | | if(!CollectionUtils.isEmpty(codeClassifyTemplateAttrDOInsert)){ |
| | | codeTempphaseService.codeTemplateAttrModifyTrigger(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"); |
| | | 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"); |
| | | 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"); |
| | | iDictBizClient.getCheck(dictBiz) ; |
| | | } |
| | | // charService.saveBySameNamespaceAndFlag(MdmBtmTypeConstant.CODE_CLASSIFY_TEMPLATE_ATTR,"dateFormates",dateFormates,sessionInfo); |
| | | } |
| | | |
| | | // WebUtil.setPersistence(true);//æ§è¡ä¿å |
| | | // boService.persistenceBatch(batchCBOTemplateDelete);//ä¸èµ·æ§è¡ä¿å |
| | | return codeClassifyTemplateAttrDO2VOs(codeClassifyTemplateAttrDOInsert); |
| | | } |
| | | |
| | | public boolean checkKVArr(String kvString){ |
| | | boolean isKV = true; |
| | | try { |
| | | JSONObject.parseArray(kvString, KeyValue.class); |
| | | }catch (Exception e){ |
| | | isKV=false; |
| | | } |
| | | return isKV; |
| | | } |
| | | public boolean checkKVObj(String kvString){ |
| | | boolean isKV = true; |
| | | try { |
| | | JSONObject.parseObject(kvString, UIFormReferVO.class); |
| | | }catch (Exception e){ |
| | | isKV=false; |
| | | } |
| | | return isKV; |
| | | } |
| | | |
| | | /** |
| | | * æ ¡éªæ¶é´æ ¼å¼ |
| | | * @param dateFormat æ¶é´æ ¼å¼ |
| | | * @return trueè¡¨ç¤ºæ ¡éªéè¿ |
| | | */ |
| | | public boolean checkDateFormat(String dateFormat){ |
| | | try{ |
| | | VciDateUtil.date2Str(new Date(),dateFormat); |
| | | return true; |
| | | }catch (Throwable e){ |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * ä¿®æ¹ä¸»é¢åºåç±»çæ¨¡æ¿å±æ§ |
| | | * @param codeClassifyTemplateAttrDTO 主é¢åºåç±»çæ¨¡æ¿å±æ§æ°æ®ä¼ è¾å¯¹è±¡ |
| | | * @return æ§è¡ç»æ |
| | | * @throws VciBaseException åæ°ä¸ºç©ºï¼å¯ä¸é¡¹ï¼å¿
è¾é¡¹ä¸éè¿æ¶ä¼æåºå¼å¸¸ |
| | | */ |
| | | @Override |
| | | public R editSave(CodeClassifyTemplateAttrDTO codeClassifyTemplateAttrDTO) throws VciBaseException{ |
| | | VciBaseUtil.alertNotNull(codeClassifyTemplateAttrDTO,"æ°æ®å¯¹è±¡",codeClassifyTemplateAttrDTO.getOid(),"主é¢åºåç±»çæ¨¡æ¿å±æ§ä¸»é®"); |
| | | |
| | | //å¤æä¼ è¿æ¥çæä¸¾æ³¨å
¥æ¯å¦æ¯jsonArræ ¼å¼ |
| | | if(StringUtils.isNotBlank(codeClassifyTemplateAttrDTO.getEnumString())&&!checkKVArr(codeClassifyTemplateAttrDTO.getEnumString())){ |
| | | throw new VciBaseException("æä¸¾æ³¨å
¥æ°æ®æ ¼å¼é误!"); |
| | | } |
| | | |
| | | //å¤æä¼ è¿æ¥çåç
§é
ç½®æ¯å¦æ¯jsonæ ¼å¼ |
| | | if(StringUtils.isNotBlank(codeClassifyTemplateAttrDTO.getReferbtmid())&&!checkKVObj(codeClassifyTemplateAttrDTO.getReferbtmid())){ |
| | | throw new VciBaseException("æä¸¾æ³¨å
¥æ°æ®æ ¼å¼é误!"); |
| | | } |
| | | |
| | | |
| | | //æ£æ¥ts |
| | | CodeClassifyTemplateAttr codeClassifyTemplateAttrDOCopyFromDTO = new CodeClassifyTemplateAttr(); |
| | | // BeanUtilForVCI.copyPropertiesIgnoreCase(codeClassifyTemplateAttrDTO,codeClassifyTemplateAttrDOCopyFromDTO); |
| | | // boolean tsBoolean = boService.checkTs(codeClassifyTemplateAttrDOCopyFromDTO); |
| | | |
| | | //æ£æ¥ts |
| | | // Map<String,Object> condition = new HashMap<>(2); |
| | | // condition.put("oid",codeClassifyTemplateAttrDTO.getOid()); |
| | | // condition.put("ts",codeClassifyTemplateAttrDTO.getTs()); |
| | | CodeClassifyTemplateAttr detail = baseMapper.selectById(codeClassifyTemplateAttrDTO.getOid()); |
| | | if(!detail.getTs().toString().equals(codeClassifyTemplateAttrDTO.getTs().toString())){//䏿¯ææ°çä¸è®©æ¹ |
| | | return R.fail("å½åæ°æ®ä¸æ¯ææ°ï¼è¯·å·æ°ååä¿®æ¹ï¼"); |
| | | } |
| | | |
| | | //å°DTO转æ¢ä¸ºDO |
| | | CodeClassifyTemplateAttr codeClassifyTemplateAttrDO = baseMapper.selectById(codeClassifyTemplateAttrDTO.getOid()); |
| | | revisionModelUtil.copyFromDTOIgnore(codeClassifyTemplateAttrDTO,codeClassifyTemplateAttrDO); |
| | | baseMapper.updateById(codeClassifyTemplateAttrDO); |
| | | return R.data(codeClassifyTemplateAttrDO2VO(codeClassifyTemplateAttrDO)); |
| | | } |
| | | |
| | | /** |
| | | * å é¤ä¸»é¢åºåç±»çæ¨¡æ¿å±æ§ |
| | | * @param codeClassifyTemplateAttrDTO 主é¢åºåç±»çæ¨¡æ¿å±æ§æ°æ®ä¼ è¾å¯¹è±¡ï¼oidåtséè¦ä¼ è¾ |
| | | * @return å é¤ç»æåé¦ï¼ï¼successï¼æåï¼failï¼å¤±è´¥ |
| | | * @throws VciBaseException åæ°ä¸ºç©ºï¼è¢«å¼ç¨æ¶æåºå¼å¸¸ |
| | | */ |
| | | @Override |
| | | public R deleteCodeClassifyTemplateAttr(CodeClassifyTemplateAttrDTO codeClassifyTemplateAttrDTO) throws VciBaseException{ |
| | | VciBaseUtil.alertNotNull(codeClassifyTemplateAttrDTO,"主é¢åºåç±»çæ¨¡æ¿å±æ§æ°æ®å¯¹è±¡",codeClassifyTemplateAttrDTO.getOid(),"主é¢åºåç±»çæ¨¡æ¿å±æ§ç主é®"); |
| | | CodeClassifyTemplateAttr codeClassifyTemplateAttrDO = baseMapper.selectById(codeClassifyTemplateAttrDTO.getOid()); |
| | | R baseResult = checkIsCanDeleteForDO(codeClassifyTemplateAttrDTO,codeClassifyTemplateAttrDO); |
| | | if(baseResult.isSuccess()) { |
| | | }else{ |
| | | return baseResult; |
| | | } |
| | | //æ§è¡å é¤æä½ |
| | | int deleteNum = baseMapper.deleteById(codeClassifyTemplateAttrDO.getOid()); |
| | | return deleteNum>0?R.success(DELETE_SUCCESS):R.fail(DELETE_FAIL); |
| | | } |
| | | |
| | | /** |
| | | * æ ¡éªæ¯å¦å¯ä»¥å é¤ï¼å¦æåå¨ä¸çº§ï¼å¹¶ä¸ä¸çº§ææ°æ®å¼ç¨åä¸è½å é¤ |
| | | * @param codeClassifyTemplateAttrDTO æ°æ®ä¼ è¾å¯¹è±¡ |
| | | * @param codeClassifyTemplateAttrDO æ°æ®åºä¸çæ°æ®å¯¹è±¡ |
| | | * @return success为true为å¯ä»¥å é¤ï¼falseè¡¨ç¤ºææ°æ®å¼ç¨ï¼obj为true表示æä¸çº§ |
| | | */ |
| | | private R checkIsCanDeleteForDO(CodeClassifyTemplateAttrDTO codeClassifyTemplateAttrDTO, CodeClassifyTemplateAttr codeClassifyTemplateAttrDO) { |
| | | // boService.checkTs(codeClassifyTemplateAttrDO); |
| | | // Map<String,Object> condition = new HashMap<>(2); |
| | | // condition.put("oid",codeClassifyTemplateAttrDTO.getOid()); |
| | | // condition.put("ts",codeClassifyTemplateAttrDTO.getTs()); |
| | | CodeClassifyTemplateAttr detail = baseMapper.selectById(codeClassifyTemplateAttrDTO.getOid()); |
| | | // .selectOne(Condition.getQueryWrapper(condition,CodeClstempattrEntity.class)); |
| | | |
| | | if(!detail.getTs().toString().equals(codeClassifyTemplateAttrDTO.getTs().toString())){//䏿¯ææ°çä¸è®©æ¹ |
| | | return R.fail("å½åæ°æ®ä¸æ¯ææ°ï¼è¯·å·æ°ååä¿®æ¹ï¼"); |
| | | } |
| | | if(!checkIsLinked(codeClassifyTemplateAttrDO.getOid())) { |
| | | return R.success("å¯ä»¥å é¤ï¼"); |
| | | }else{ |
| | | return R.fail(DATA_LINKED_NOT_DELETE); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * æ ¡éªæ¯å¦è¢«å¼ç¨ |
| | | * @param oid ä¸»é® |
| | | * @throws VciBaseException 被å¼ç¨çæ¶å伿åºå¼å¸¸ |
| | | */ |
| | | private boolean checkIsLinked(String oid) throws VciBaseException{ |
| | | //TODO æ·»å éè¦æ ¡éªå¼ç¨çå°æ¹ |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 主é®è·å主é¢åºåç±»çæ¨¡æ¿å±æ§ |
| | | * @param oid ä¸»é® |
| | | * @return 主é¢åºåç±»çæ¨¡æ¿å±æ§æ¾ç¤ºå¯¹è±¡ |
| | | * @throws VciBaseException åæ°ä¸ºç©ºï¼æ°æ®ä¸å卿¶ä¼æåºå¼å¸¸ |
| | | */ |
| | | @Override |
| | | public CodeClassifyTemplateAttrVO getObjectByOid(String oid) throws VciBaseException{ |
| | | return codeClassifyTemplateAttrDO2VO(selectByOid(oid)); |
| | | } |
| | | /** |
| | | * 䏻鮿¥è¯¢æ°æ®å¯¹è±¡ |
| | | * @param oid ä¸»é® |
| | | * @return æ°æ®å¯¹è±¡ |
| | | * @throws VciBaseException åæ°ä¸ºç©ºï¼å¹¶ä¸æ°æ®ä¸åå¨çæ¶å伿åºå¼å¸¸ |
| | | */ |
| | | private CodeClassifyTemplateAttr selectByOid(String oid) throws VciBaseException{ |
| | | VciBaseUtil.alertNotNull(oid,"主é®"); |
| | | CodeClassifyTemplateAttr codeClassifyTemplateAttrDO = baseMapper.selectById(oid.trim()); |
| | | if(codeClassifyTemplateAttrDO == null || StringUtils.isBlank(codeClassifyTemplateAttrDO.getOid())){ |
| | | throw new VciBaseException(DATA_OID_NOT_EXIST); |
| | | } |
| | | return codeClassifyTemplateAttrDO; |
| | | } |
| | | |
| | | /** |
| | | * 䏻鮿¹éè·å主é¢åºåç±»çæ¨¡æ¿å±æ§ |
| | | * @param oidCollections 主é®éåï¼ä½æ¯åæ§è½å½±åï¼å»ºè®®ä¸æ¬¡æ¥è¯¢ä¸è¶
è¿10000个 |
| | | * @return 主é¢åºåç±»çæ¨¡æ¿å±æ§æ¾ç¤ºå¯¹è±¡ |
| | | * @throws VciBaseException æ¥è¯¢åºç°å¼å¸¸æ¶ä¼æåº |
| | | */ |
| | | @Override |
| | | public Collection<CodeClassifyTemplateAttrVO> listCodeClassifyTemplateAttrByOids(Collection<String> oidCollections) { |
| | | VciBaseUtil.alertNotNull(oidCollections,"æ°æ®å¯¹è±¡ä¸»é®éå"); |
| | | List<CodeClassifyTemplateAttr> codeClassifyTemplateAttrDOList = listCodeClassifyTemplateAttrDOByOidCollections(oidCollections); |
| | | return codeClassifyTemplateAttrDO2VOs(codeClassifyTemplateAttrDOList); |
| | | } |
| | | |
| | | /** |
| | | * 使ç¨ä¸»é®éåæ¥è¯¢æ°æ®å¯¹è±¡ |
| | | * @param oidCollections 主é®çéå |
| | | * @return æ°æ®å¯¹è±¡å表 |
| | | */ |
| | | private List<CodeClassifyTemplateAttr> listCodeClassifyTemplateAttrDOByOidCollections(Collection<String> oidCollections){ |
| | | List<CodeClassifyTemplateAttr> codeClassifyTemplateAttrDOList = new ArrayList<CodeClassifyTemplateAttr>(); |
| | | if(!CollectionUtils.isEmpty(oidCollections)){ |
| | | Collection<Collection<String>> oidCollectionsList = VciBaseUtil.switchCollectionForOracleIn(oidCollections); |
| | | for(Collection<String> oids: oidCollectionsList){ |
| | | List<CodeClassifyTemplateAttr> tempDOList = baseMapper.selectBatchIds(oids); |
| | | if(!CollectionUtils.isEmpty(tempDOList)){ |
| | | codeClassifyTemplateAttrDOList.addAll(tempDOList); |
| | | } |
| | | } |
| | | } |
| | | return codeClassifyTemplateAttrDOList; |
| | | } |
| | | |
| | | /** |
| | | * åç
§ä¸»é¢åºåç±»çæ¨¡æ¿å±æ§å表 |
| | | * @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){ |
| | | if(baseQueryObject.getConditionMap() == null){ |
| | | baseQueryObject.setConditionMap(new HashMap<>()); |
| | | } |
| | | DataGrid<CodeOsbtmtypeattributeVO> dataGrid=new DataGrid<CodeOsbtmtypeattributeVO>(); |
| | | //模æ¿oid |
| | | String templateAttrOid = baseQueryObject.getConditionMap().get("oid"); |
| | | String name = baseQueryObject.getConditionMap().getOrDefault("name",""); |
| | | String id = baseQueryObject.getConditionMap().getOrDefault("id",""); |
| | | |
| | | //没æoid䏿§è¡é»è¾ |
| | | if(StringUtils.isBlank(templateAttrOid)){ |
| | | dataGrid.setData(new ArrayList<>()); |
| | | dataGrid.setTotal(0); |
| | | return dataGrid; |
| | | } |
| | | |
| | | //æ¥è¯¢æ¨¡æ¿å¯¹è±¡ |
| | | 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(!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; |
| | | } |
| | | |
| | | //è¿ä¸ªæ¨¡æ¿ä¸å·²ç»æç屿§ |
| | | // 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>(); |
| | | for (CodeClassifyTemplateAttr codeClassifyTemplateAttrDO:codeClassifyTemplateAttrDOList){ |
| | | btmOids.add(codeClassifyTemplateAttrDO.getId()); |
| | | } |
| | | |
| | | //è¿æ»¤æå·²ç»åå¨ç屿§ |
| | | List<CodeOsbtmtypeattributeVO> boAttrss = new ArrayList<CodeOsbtmtypeattributeVO>(); |
| | | |
| | | for (CodeOsbtmtypeattributeVO osBtmTypeAttributeVO:boAttrs){ |
| | | if(!btmOids.contains(osBtmTypeAttributeVO.getId())){ |
| | | //ççæ¯ä¸æ¯ææ¨¡ç³æ¥è¯¢ |
| | | boolean inSearch = true; |
| | | if(StringUtils.isNotBlank(name) && !osBtmTypeAttributeVO.getName().contains(name.replace("*",""))){ |
| | | inSearch = false; |
| | | } |
| | | if(StringUtils.isNotBlank(id) && !osBtmTypeAttributeVO.getId().contains(id.replace("*",""))){ |
| | | inSearch = false; |
| | | } |
| | | if(inSearch) { |
| | | boAttrss.add(osBtmTypeAttributeVO); |
| | | } |
| | | } |
| | | } |
| | | dataGrid.setData(boAttrss); |
| | | dataGrid.setTotal(boAttrss.size()); |
| | | return dataGrid; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * æ¥è¯¢è¿ä¸ªæ¨¡æ¿ï¼ä¸å¡ç±»åä¸å·²éæ©ç屿§ |
| | | * @param baseQueryObject |
| | | * @return |
| | | */ |
| | | @Override |
| | | public DataGrid<CodeOsbtmtypeattributeVO> codeClassifyTemplateAttrByBtmHave(BaseQueryObject baseQueryObject){ |
| | | DataGrid<CodeOsbtmtypeattributeVO> dataGrid=new DataGrid<CodeOsbtmtypeattributeVO>(); |
| | | //模æ¿oid |
| | | String templateAttrOid = baseQueryObject.getConditionMap().get("oid"); |
| | | |
| | | //没æoid䏿§è¡é»è¾ |
| | | if(StringUtils.isBlank(templateAttrOid)){ |
| | | dataGrid.setData(new ArrayList<>()); |
| | | dataGrid.setTotal(0); |
| | | return dataGrid; |
| | | } |
| | | |
| | | //æ¥è¯¢æ¨¡æ¿å¯¹è±¡ |
| | | 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); |
| | | //è¿ä¸ªæ¨¡æ¿ä¸å·²ç»æç屿§ |
| | | //æé»è®¤ç屿§ä¹æ·»å å°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<CodeClassifyTemplateAttr> codeClassifyTemplateAttrDOList = baseMapper.selectList(wrapper); |
| | | List<String> btmOids = new ArrayList<String>(); |
| | | for (CodeClassifyTemplateAttr codeClassifyTemplateAttrDO:codeClassifyTemplateAttrDOList){ |
| | | btmOids.add(codeClassifyTemplateAttrDO.getId()); |
| | | } |
| | | |
| | | //è¿æ»¤æé¤äºèªèº«çå«ç屿§ |
| | | List<CodeOsbtmtypeattributeVO> boAttrss = new ArrayList<CodeOsbtmtypeattributeVO>(); |
| | | |
| | | for (CodeOsbtmtypeattributeVO osBtmTypeAttributeVO:boAttrs){ |
| | | if(btmOids.contains(osBtmTypeAttributeVO.getId())){ |
| | | boAttrss.add(osBtmTypeAttributeVO); |
| | | } |
| | | } |
| | | dataGrid.setData(boAttrss); |
| | | dataGrid.setTotal(boAttrss.size()); |
| | | return dataGrid; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 忥å°å
¶ä»æ¨¡æ¿ |
| | | * @param codeClassifyTemplateAttrDTO oid |
| | | * @return |
| | | */ |
| | | @Override |
| | | public R copyto(CodeClassifyTemplateAttrDTO codeClassifyTemplateAttrDTO) throws VciBaseException{ |
| | | |
| | | String templateAttrOid = codeClassifyTemplateAttrDTO.getOid(); |
| | | |
| | | //æ¥è¯¢åºæ¥è¦å¤å¶ç对象 |
| | | CodeClassifyTemplateAttr codeClassifyTemplateAttrDO = selectByOid(templateAttrOid); |
| | | String id = codeClassifyTemplateAttrDO.getId();//è±æåç§° |
| | | String classfyTemplateOid = codeClassifyTemplateAttrDO.getClassifyTemplateOid(); |
| | | |
| | | //æ¥è¯¢å
¶ä»id=idçæ¨¡æ¿å±æ§ |
| | | // VciQueryWrapperForDO queryWrapper = new VciQueryWrapperForDO(CodeClassifyTemplateAttrDO.class); |
| | | // queryWrapper.addQueryMap("id",id); |
| | | // Map<String,Object> condition = new HashMap<>(1); |
| | | // condition.put("id",id); |
| | | QueryWrapper<CodeClassifyTemplateAttr> wrapper=new QueryWrapper<>(); |
| | | wrapper.eq("id",id); |
| | | //ææid=idçæ¨¡æ¿å±æ§ |
| | | List<CodeClassifyTemplateAttr> codeClassifyTemplateAttrDOList =baseMapper.selectList(wrapper); |
| | | |
| | | //è¦å é¤ç模æ¿å±æ§çoids |
| | | List<String> deleteOids = new ArrayList<String>(); |
| | | //è¦ä¿®æ¹ç模æ¿å±æ§å¯¹è±¡ |
| | | List<CodeClassifyTemplateAttr> codeClassifyTemplateAttrDOListInsert = new ArrayList<CodeClassifyTemplateAttr>(); |
| | | for (CodeClassifyTemplateAttr codeClassifyTemplateAttrDOi:codeClassifyTemplateAttrDOList){ |
| | | String oid = codeClassifyTemplateAttrDOi.getOid(); |
| | | String templateOldOid = codeClassifyTemplateAttrDOi.getClassifyTemplateOid(); |
| | | |
| | | CodeClassifyTemplateAttr codeClassifyTemplateAttrDOInsert = new CodeClassifyTemplateAttr(); |
| | | BeanUtilForVCI.copyPropertiesIgnoreCase(codeClassifyTemplateAttrDO,codeClassifyTemplateAttrDOInsert); |
| | | codeClassifyTemplateAttrDOInsert.setOid(oid); |
| | | codeClassifyTemplateAttrDOInsert.setClassifyTemplateOid(templateOldOid); |
| | | codeClassifyTemplateAttrDOListInsert.add(codeClassifyTemplateAttrDOInsert); |
| | | |
| | | deleteOids.add(codeClassifyTemplateAttrDOi.getOid()); |
| | | } |
| | | |
| | | // WebUtil.setPersistence(false);//䏿§è¡ä¿å |
| | | |
| | | //å é¤ |
| | | // BatchCBO batchCBOTemplateAttrDelete = codeClassifyTemplateAttrDOissifyTemplateAttrMapper.batchDeleteByOids(deleteOids); |
| | | baseMapper.deleteBatchIds(deleteOids); |
| | | //åæ°å¢ |
| | | // BatchCBO batchCBOTemplateAttrInsert = codeClassifyTemplateAttrMapper.batchInsert(codeClassifyTemplateAttrDOListInsert); |
| | | // batchCBOTemplateAttrDelete.copyFromOther(batchCBOTemplateAttrInsert); |
| | | this.saveBatch(codeClassifyTemplateAttrDOListInsert); |
| | | |
| | | // WebUtil.setPersistence(true);//æ§è¡ä¿å |
| | | // boService.persistenceBatch(batchCBOTemplateAttrDelete);//ä¸èµ·æ§è¡ä¿å |
| | | |
| | | return R.success("æä½æåï¼"); |
| | | } |
| | | |
| | | } |