¶Ô±ÈÐÂÎļþ |
| | |
| | | /* |
| | | * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
| | | * |
| | | * Redistribution and use in source and binary forms, with or without |
| | | * modification, are permitted provided that the following conditions are met: |
| | | * |
| | | * Redistributions of source code must retain the above copyright notice, |
| | | * this list of conditions and the following disclaimer. |
| | | * Redistributions in binary form must reproduce the above copyright |
| | | * notice, this list of conditions and the following disclaimer in the |
| | | * documentation and/or other materials provided with the distribution. |
| | | * Neither the name of the dreamlu.net developer nor the names of its |
| | | * contributors may be used to endorse or promote products derived from |
| | | * this software without specific prior written permission. |
| | | * Author: Chill åºéª (smallchill@163.com) |
| | | */ |
| | | 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.service.impl.ServiceImpl; |
| | | import com.vci.ubcs.code.constant.MdmBtmTypeConstant; |
| | | import com.vci.ubcs.code.dto.CodeClstempattrDTO; |
| | | import com.vci.ubcs.code.entity.CodeClassifyTemplateAttr; |
| | | import com.vci.ubcs.code.entity.CodeClstempattrEntity; |
| | | import com.vci.ubcs.code.entity.CodeClstemplateEntity; |
| | | import com.vci.ubcs.code.enumpack.CodeLevelTypeEnum; |
| | | import com.vci.ubcs.code.mapper.CodeClstempattrMapper; |
| | | import com.vci.ubcs.code.mapper.CodeClstemplateMapper; |
| | | import com.vci.ubcs.code.mapper.CodeOsbtmtypeattributeMapper; |
| | | import com.vci.ubcs.code.service.ICodeClstempattrService; |
| | | import com.vci.ubcs.code.service.ICodeTempphaseService; |
| | | import com.vci.ubcs.code.vo.CodeClstempattrVO; |
| | | import com.vci.ubcs.code.vo.CodeOsbtmtypeattributeVO; |
| | | 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.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.cglib.beans.BeanMap; |
| | | 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.*; |
| | | |
| | | /** |
| | | * ç¼ç åºå®ä¹-模æ¿å±æ§ æå¡å®ç°ç±» |
| | | * |
| | | * @author yuxc |
| | | * @since 2023-04-19 |
| | | */ |
| | | @Service |
| | | public class CodeClstempattrServiceImpl extends ServiceImpl<CodeClstempattrMapper, CodeClstempattrEntity> implements ICodeClstempattrService { |
| | | |
| | | @Resource |
| | | CodeClstempattrMapper codeClstempattrMapper; |
| | | // @Resource |
| | | // ICodeTempphaseService codeTempphaseService; |
| | | @Resource |
| | | IDictBizClient iDictBizClient; |
| | | @Resource |
| | | CodeClstemplateMapper codeClstemplateMapper; |
| | | @Resource |
| | | CodeOsbtmtypeattributeMapper codeOsbtmtypeattributeMapper; |
| | | @Resource |
| | | ICodeTempphaseService codeTempphaseService; |
| | | |
| | | /** |
| | | * 对象çæä½ |
| | | */ |
| | | @Autowired(required = false) |
| | | private RevisionModelUtil revisionModelUtil; |
| | | |
| | | @Override |
| | | public IPage<CodeClstempattrVO> selectCodeClstempattrPage(IPage<CodeClstempattrVO> page, CodeClstempattrVO CodeClstempattr) { |
| | | return page.setRecords(baseMapper.selectCodeClstempattrPage(page, CodeClstempattr)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * ä½¿ç¨æ¨¡æ¿ç主é®è·å模æ¿ç屿§--æ¹é |
| | | * |
| | | * @param templateOidCollection 模æ¿çä¸»é® |
| | | * @return 屿§çä¿¡æ¯ |
| | | */ |
| | | @Override |
| | | public List<CodeClstempattrVO> listCodeClassifyTemplateAttrByTemplateOids(Collection<String> templateOidCollection) { |
| | | if(CollectionUtils.isEmpty(templateOidCollection)){ |
| | | return new ArrayList<>(); |
| | | } |
| | | List<CodeClstempattrEntity> 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<CodeClstempattrEntity> 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<CodeClstempattrVO> codeClassifyTemplateAttrDO2VOs(Collection<CodeClstempattrEntity> codeClassifyTemplateAttrDOs){ |
| | | List<CodeClstempattrVO> voList = new ArrayList<CodeClstempattrVO>(); |
| | | if(!CollectionUtils.isEmpty(codeClassifyTemplateAttrDOs)){ |
| | | for(CodeClstempattrEntity s: codeClassifyTemplateAttrDOs){ |
| | | CodeClstempattrVO vo = codeClassifyTemplateAttrDO2VO(s); |
| | | if(vo != null){ |
| | | voList.add(vo); |
| | | } |
| | | } |
| | | } |
| | | return voList; |
| | | } |
| | | |
| | | /** |
| | | * æ°æ®å¯¹è±¡è½¬æ¢ä¸ºæ¾ç¤ºå¯¹è±¡ |
| | | * @param codeClassifyTemplateAttrDO æ°æ®å¯¹è±¡ |
| | | * @return æ¾ç¤ºå¯¹è±¡ |
| | | */ |
| | | @Override |
| | | public CodeClstempattrVO codeClassifyTemplateAttrDO2VO(CodeClstempattrEntity codeClassifyTemplateAttrDO){ |
| | | CodeClstempattrVO vo = new CodeClstempattrVO(); |
| | | if(codeClassifyTemplateAttrDO != null){ |
| | | BeanUtilForVCI.copyPropertiesIgnoreCase(codeClassifyTemplateAttrDO,vo); |
| | | //妿ælcstatusçç±»çè¯ |
| | | vo.setAttributeDataTypeText(VciFieldTypeEnum.getTextByValue(vo.getAttributedatatype())); |
| | | } |
| | | return vo; |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢ææç主é¢åºåç±»çæ¨¡æ¿å±æ§ |
| | | * @param conditionMap æ¥è¯¢æ¡ä»¶ |
| | | * @param pageHelper å页åæåº |
| | | * @return æ§è¡ç»æ |
| | | */ |
| | | @Override |
| | | public DataGrid<CodeClstempattrVO> gridCodeClassifyTemplateAttr(Map<String, String> conditionMap, PageHelper pageHelper) { |
| | | DataGrid<CodeClstempattrVO> dataGrid=new DataGrid<CodeClstempattrVO>(); |
| | | //没æä¼ éåæ°ï¼å°±ä¸æ§è¡æ¥è¯¢é»è¾ |
| | | 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) |
| | | CodeClstempattrVO codeClstempattrVO = new CodeClstempattrVO(); |
| | | // BeanUtil.toBean(map,codeClstempattrVO); |
| | | // BeanUtil |
| | | BeanMap beanMap = BeanMap.create(codeClstempattrVO); |
| | | |
| | | beanMap.putAll(conditionMap); |
| | | // Condition.getQueryWrapper( |
| | | IPage<CodeClstempattrEntity> 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 CodeClstempattrVO addSave(CodeClstempattrDTO codeClassifyTemplateAttrDTO){ |
| | | VciBaseUtil.alertNotNull(codeClassifyTemplateAttrDTO,"éè¦æ·»å çæ°æ®å¯¹è±¡"); |
| | | //å°DTO转æ¢ä¸ºDO |
| | | CodeClstempattrEntity codeClassifyTemplateAttrDO = new CodeClstempattrEntity(); |
| | | BeanUtilForVCI.copyPropertiesIgnoreCase(codeClassifyTemplateAttrDTO,codeClassifyTemplateAttrDO); |
| | | baseMapper.insert(codeClassifyTemplateAttrDO); |
| | | return codeClassifyTemplateAttrDO2VO(codeClassifyTemplateAttrDO); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * æ¹éæ·»å |
| | | * @param codeClassifyTemplateAttrDTOs æ°æ®ä¼ è¾å¯¹è±¡ |
| | | * @return ä¿ååçæ¾ç¤ºå¯¹è±¡ |
| | | */ |
| | | @Override |
| | | @Transactional |
| | | public List<CodeClstempattrVO> batchAddSave(List<CodeClstempattrDTO> codeClassifyTemplateAttrDTOs) { |
| | | if(CollectionUtils.isEmpty(codeClassifyTemplateAttrDTOs)){ |
| | | return new ArrayList<>(); |
| | | } |
| | | |
| | | //忿屿§çè±æåç§°ï¼ç¬¬ä¸ä¸ªéªè¯éè¦ç¨å° |
| | | Map<String,CodeClstempattrDTO> 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<CodeClstempattrEntity> codeClassifyTemplateAttrDOInsert = new ArrayList<CodeClstempattrEntity>(); |
| | | List<String> prefix = new ArrayList<>(); |
| | | List<String> suffix = new ArrayList<>(); |
| | | List<String> dateFormates = new ArrayList<>(); |
| | | for (CodeClstempattrEntity codeClassifyTemplateAttrDTO:codeClassifyTemplateAttrDTOs){ |
| | | VciBaseUtil.alertNotNull(codeClassifyTemplateAttrDTO,"éè¦æ·»å çæ°æ®å¯¹è±¡"); |
| | | //å°DTO转æ¢ä¸ºDO |
| | | CodeClstempattrEntity codeClassifyTemplateAttrDO = new CodeClstempattrEntity(); |
| | | 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 CodeClstempattrDTO()).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<CodeClstempattrEntity> codeClassifyTemplateAttrDODelete = baseMapper.selectByMap(condition); |
| | | |
| | | //oids |
| | | List<String> oids = new ArrayList<String>(); |
| | | for (CodeClstempattrEntity 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)){ |
| | | List<CodeClassifyTemplateAttr> codeClassifyTemplateAttrs = new ArrayList<>(); |
| | | for (CodeClstempattrEntity codeClstempattrEntity : codeClassifyTemplateAttrDOInsert) { |
| | | CodeClassifyTemplateAttr codeClassifyTemplateAttr = new CodeClassifyTemplateAttr(); |
| | | BeanUtils.copyProperties(codeClstempattrEntity,codeClassifyTemplateAttr);; |
| | | codeClassifyTemplateAttrs.add(codeClassifyTemplateAttr); |
| | | } |
| | | codeTempphaseService.codeTemplateAttrModifyTrigger(codeClassifyTemplateAttrs); |
| | | |
| | | } |
| | | |
| | | |
| | | // 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(CodeClstempattrDTO 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 |
| | | CodeClstempattrEntity codeClassifyTemplateAttrDOCopyFromDTO = new CodeClstempattrEntity(); |
| | | // 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()); |
| | | CodeClstempattrEntity detail = baseMapper.selectById(codeClassifyTemplateAttrDTO.getOid()); |
| | | if(!detail.getTs().toString().equals(codeClassifyTemplateAttrDTO.getTs().toString())){//䏿¯ææ°çä¸è®©æ¹ |
| | | return R.fail("å½åæ°æ®ä¸æ¯ææ°ï¼è¯·å·æ°ååä¿®æ¹ï¼"); |
| | | } |
| | | |
| | | //å°DTO转æ¢ä¸ºDO |
| | | CodeClstempattrEntity 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(CodeClstempattrDTO codeClassifyTemplateAttrDTO) throws VciBaseException{ |
| | | VciBaseUtil.alertNotNull(codeClassifyTemplateAttrDTO,"主é¢åºåç±»çæ¨¡æ¿å±æ§æ°æ®å¯¹è±¡",codeClassifyTemplateAttrDTO.getOid(),"主é¢åºåç±»çæ¨¡æ¿å±æ§ç主é®"); |
| | | CodeClstempattrEntity 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(CodeClstempattrDTO codeClassifyTemplateAttrDTO, CodeClstempattrEntity codeClassifyTemplateAttrDO) { |
| | | // boService.checkTs(codeClassifyTemplateAttrDO); |
| | | // Map<String,Object> condition = new HashMap<>(2); |
| | | // condition.put("oid",codeClassifyTemplateAttrDTO.getOid()); |
| | | // condition.put("ts",codeClassifyTemplateAttrDTO.getTs()); |
| | | CodeClstempattrEntity 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 CodeClstempattrVO getObjectByOid(String oid) throws VciBaseException{ |
| | | return codeClassifyTemplateAttrDO2VO(selectByOid(oid)); |
| | | } |
| | | /** |
| | | * 䏻鮿¥è¯¢æ°æ®å¯¹è±¡ |
| | | * @param oid ä¸»é® |
| | | * @return æ°æ®å¯¹è±¡ |
| | | * @throws VciBaseException åæ°ä¸ºç©ºï¼å¹¶ä¸æ°æ®ä¸åå¨çæ¶å伿åºå¼å¸¸ |
| | | */ |
| | | private CodeClstempattrEntity selectByOid(String oid) throws VciBaseException{ |
| | | VciBaseUtil.alertNotNull(oid,"主é®"); |
| | | CodeClstempattrEntity 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<CodeClstempattrVO> listCodeClassifyTemplateAttrByOids(Collection<String> oidCollections) { |
| | | VciBaseUtil.alertNotNull(oidCollections,"æ°æ®å¯¹è±¡ä¸»é®éå"); |
| | | List<CodeClstempattrEntity> codeClassifyTemplateAttrDOList = listCodeClassifyTemplateAttrDOByOidCollections(oidCollections); |
| | | return codeClassifyTemplateAttrDO2VOs(codeClassifyTemplateAttrDOList); |
| | | } |
| | | |
| | | /** |
| | | * 使ç¨ä¸»é®éåæ¥è¯¢æ°æ®å¯¹è±¡ |
| | | * @param oidCollections 主é®çéå |
| | | * @return æ°æ®å¯¹è±¡å表 |
| | | */ |
| | | private List<CodeClstempattrEntity> listCodeClassifyTemplateAttrDOByOidCollections(Collection<String> oidCollections){ |
| | | List<CodeClstempattrEntity> codeClassifyTemplateAttrDOList = new ArrayList<CodeClstempattrEntity>(); |
| | | if(!CollectionUtils.isEmpty(oidCollections)){ |
| | | Collection<Collection<String>> oidCollectionsList = VciBaseUtil.switchCollectionForOracleIn(oidCollections); |
| | | for(Collection<String> oids: oidCollectionsList){ |
| | | List<CodeClstempattrEntity> tempDOList = baseMapper.selectBatchIds(oids); |
| | | if(!CollectionUtils.isEmpty(tempDOList)){ |
| | | codeClassifyTemplateAttrDOList.addAll(tempDOList); |
| | | } |
| | | } |
| | | } |
| | | return codeClassifyTemplateAttrDOList; |
| | | } |
| | | |
| | | /** |
| | | * åç
§ä¸»é¢åºåç±»çæ¨¡æ¿å±æ§å表 |
| | | * @param conditionMap æ¥è¯¢æ¡ä»¶ |
| | | * @param pageHelper å页åæåº |
| | | * @return 主é¢åºåç±»çæ¨¡æ¿å±æ§æ¾ç¤ºå¯¹è±¡å表ï¼çæçå
容 |
| | | * @throws VciBaseException æ¥è¯¢æ¡ä»¶åå页åºéçæ¶å伿åºå¼å¸¸ |
| | | */ |
| | | @Override |
| | | public DataGrid<CodeClstempattrVO> 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; |
| | | } |
| | | |
| | | //æ¥è¯¢æ¨¡æ¿å¯¹è±¡ |
| | | CodeClstemplateEntity codeClassifyTemplateDO = codeClstemplateMapper.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<CodeClstempattrEntity> codeClassifyTemplateAttrDOList = codeClstempattrMapper.selectByMap(condition); |
| | | |
| | | List<String> btmOids = new ArrayList<String>(); |
| | | for (CodeClstempattrEntity 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; |
| | | } |
| | | |
| | | //æ¥è¯¢æ¨¡æ¿å¯¹è±¡ |
| | | CodeClstemplateEntity codeClassifyTemplateDO = codeClstemplateMapper.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<CodeClstempattrEntity> wrapper=new QueryWrapper<>(); |
| | | wrapper.eq("CLASSIFYTEMPLATEOID",templateAttrOid); |
| | | |
| | | List<CodeClstempattrEntity> codeClassifyTemplateAttrDOList = codeClstempattrMapper.selectList(wrapper); |
| | | List<String> btmOids = new ArrayList<String>(); |
| | | for (CodeClstempattrEntity 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(CodeClstempattrDTO codeClassifyTemplateAttrDTO) throws VciBaseException{ |
| | | |
| | | String templateAttrOid = codeClassifyTemplateAttrDTO.getOid(); |
| | | |
| | | //æ¥è¯¢åºæ¥è¦å¤å¶ç对象 |
| | | CodeClstempattrEntity 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<CodeClstempattrEntity> wrapper=new QueryWrapper<>(); |
| | | wrapper.eq("id",id); |
| | | //ææid=idçæ¨¡æ¿å±æ§ |
| | | List<CodeClstempattrEntity> codeClassifyTemplateAttrDOList =codeClstempattrMapper.selectList(wrapper); |
| | | |
| | | //è¦å é¤ç模æ¿å±æ§çoids |
| | | List<String> deleteOids = new ArrayList<String>(); |
| | | //è¦ä¿®æ¹ç模æ¿å±æ§å¯¹è±¡ |
| | | List<CodeClstempattrEntity> codeClassifyTemplateAttrDOListInsert = new ArrayList<CodeClstempattrEntity>(); |
| | | for (CodeClstempattrEntity codeClassifyTemplateAttrDOi:codeClassifyTemplateAttrDOList){ |
| | | String oid = codeClassifyTemplateAttrDOi.getOid(); |
| | | String templateOldOid = codeClassifyTemplateAttrDOi.getClassifytemplateoid(); |
| | | |
| | | CodeClstempattrEntity codeClassifyTemplateAttrDOInsert = new CodeClstempattrEntity(); |
| | | 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); |
| | | codeClstempattrMapper.deleteBatchIds(deleteOids); |
| | | //åæ°å¢ |
| | | // BatchCBO batchCBOTemplateAttrInsert = codeClassifyTemplateAttrMapper.batchInsert(codeClassifyTemplateAttrDOListInsert); |
| | | // batchCBOTemplateAttrDelete.copyFromOther(batchCBOTemplateAttrInsert); |
| | | this.saveBatch(codeClassifyTemplateAttrDOListInsert); |
| | | |
| | | // WebUtil.setPersistence(true);//æ§è¡ä¿å |
| | | // boService.persistenceBatch(batchCBOTemplateAttrDelete);//ä¸èµ·æ§è¡ä¿å |
| | | |
| | | return R.success("æä½æåï¼"); |
| | | } |
| | | } |