From d513c39c9a3d9ee3dddc34579cedab5279fc5049 Mon Sep 17 00:00:00 2001 From: yuxc <653031404@qq.com> Date: 星期五, 16 六月 2023 17:33:02 +0800 Subject: [PATCH] 1、主要对对批量保存流程执行页面修改的内容接口与修改主题库数据接口的测试,以及对升版接口的移植及调试 --- Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmEngineServiceImpl.java | 318 +++++++++++++++++++++++++++++++++------------------- 1 files changed, 203 insertions(+), 115 deletions(-) diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmEngineServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmEngineServiceImpl.java index fc99a8c..d0a25a9 100644 --- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmEngineServiceImpl.java +++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmEngineServiceImpl.java @@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.toolkit.SqlHelper; import com.fasterxml.jackson.databind.ObjectMapper; +import com.sun.corba.se.impl.orbutil.ObjectUtility; import com.vci.ubcs.code.bo.CodeClassifyFullInfoBO; import com.vci.ubcs.code.bo.CodeTemplateAttrSqlBO; import com.vci.ubcs.code.constant.FrameWorkDefaultValueConstant; @@ -69,15 +70,21 @@ import javax.annotation.Resource; import java.beans.BeanInfo; +import java.beans.IntrospectionException; import java.beans.Introspector; import java.beans.PropertyDescriptor; +import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.math.BigDecimal; +import java.sql.SQLException; +import java.sql.Timestamp; import java.time.LocalDateTime; import java.time.ZoneId; import java.time.ZonedDateTime; import java.util.*; import java.util.concurrent.ConcurrentHashMap; +import java.util.function.Supplier; import java.util.stream.Collectors; import static com.vci.ubcs.code.constant.FrameWorkLangCodeConstant.DATA_OID_NOT_EXIST; @@ -118,7 +125,7 @@ @Resource ISysClient iSysClient; /** - * 绯荤粺鐨勬湇鍔� + * 瀵嗙骇鏈嶅姟 */ @Resource private IWebSecretClient secretService; @@ -434,11 +441,11 @@ List<String> codeList = productCodeService.productCodeAndSaveData(classifyFullInfo, templateVO, ruleVO, orderDTO.getSecDTOList(),cboList); - List<String> charList = new ArrayList<>(); - for (BaseModel baseModel : cboList) { - charList.add(baseModel.getId()); - } - batchSaveSelectChar(templateVO, charList); +// List<String> charList = new ArrayList<>(); +// for (BaseModel baseModel : cboList) { +// charList.add(baseModel.getId()); +// } + batchSaveSelectChar(templateVO, cboList); return codeList.size() > 0 ? codeList.get(0) : ""; // return null; } @@ -662,7 +669,7 @@ } else if (StringUtils.isNotBlank(orderDTO.getCopyFromVersion())) { sql[0] += " and oid != '" + orderDTO.getCopyFromVersion() + "'"; } - sql[0] += " and islastR = '1' and islastV = '1' "; + sql[0] += " and lastR = '1' and lastV = '1' "; // if (boService.queryCountBySql(sql[0], new HashMap<>()) > 0) { if (Integer.parseInt(commonsMapper.selectById(sql[0]).get(0)) > 0) { String ruleInfoMsg = keyRuleVO == null ? "" : "鏌ヨ瑙勫垯锛氬幓闄ょ┖鏍�--{0},蹇界暐澶у皬鍐�--{1},蹇界暐鍏ㄥ崐瑙�--{2},蹇界暐鍏ㄩ儴绌烘牸--{3}"; @@ -957,7 +964,7 @@ */ @Override public void batchSaveSelectChar(CodeClassifyTemplateVO templateVO, /*List<ClientBusinessObject> cboList*/ - List<String> cboList) { + List<BaseModel> cboList) { if (templateVO != null && !CollectionUtils.isEmpty(cboList)) { //鏄紓姝ョ殑锛屾墍浠ョ洿鎺ュ惊鐜� List<CodeClassifyTemplateAttrVO> selectAttrVOs = templateVO.getAttributes().stream().filter(s -> StringUtils.isNotBlank(s.getLibraryIdentification())).collect(Collectors.toList()); @@ -965,13 +972,26 @@ if (!CollectionUtils.isEmpty(selectAttrVOs)) { // SessionInfo sessionInfo = VciBaseUtil.getCurrentUserSessionInfo(); selectAttrVOs.parallelStream().forEach(attrVO -> { - List<String> valuesList = cboList; -// cboList.parallelStream().forEach(cbo -> { + List<String> valuesList = new ArrayList<>(); + cboList.parallelStream().forEach(cbo -> { // String value = cbo.get.getAttributeValue(attrVO.getId()); -// if (StringUtils.isNotBlank(value)) { -// valuesList.add(value); -// } -// }); + + //灏哹ean杞负map,mybatis缁熶竴澶勭悊 + Map<String,String> map = null; + +// baseModels.stream().forEach(model-> { + try { + map = VciBaseUtil.convertBean2Map(cbo); + } catch (Exception e) { + throw new VciBaseException("绫诲瀷杞崲閿欒锛�" + e.getMessage()); + } +// }); + + String value = map.get(attrVO.getId()); + if (StringUtils.isNotBlank(value)) { + valuesList.add(value); + } + }); if (!CollectionUtils.isEmpty(valuesList)) { for (String s : valuesList) { DictBiz dictBiz = new DictBiz(); @@ -1989,12 +2009,15 @@ // CodeClassifyFullInfoBO classifyFullInfo = classifyService.getClassifyFullInfo(orderDTO.getCodeClassifyOid()); CodeClassifyFullInfoBO classifyFullInfo = classifyService.getClassifyFullInfo(orderDTO.getCodeClassifyOid()); //鎵句笟鍔$被鍨嬶紝鐒跺悗浣跨敤涓婚敭鍘昏幏鍙栨暟鎹簱閲岀殑鏁版嵁 -// List<ClientBusinessObject> cbos = boService.queryCBO(classifyFullInfo.getTopClassifyVO().getBtmtypeid(), WebUtil.getOidQuery(orderDTO.getOid())); + List<BaseModel> cbos = selectByTypeAndOid(classifyFullInfo.getTopClassifyVO().getBtmtypeid(), orderDTO.getOid()); - QueryWrapper<CodeWupin> btmWrapper = new QueryWrapper<>(); - btmWrapper.eq("OID",orderDTO.getOid()); - CodeWupin cbo = codeWupinMapper.selectOne(btmWrapper); - + if (CollectionUtils.isEmpty(cbos)) { + throw new VciBaseException(DATA_OID_NOT_EXIST); + } +// QueryWrapper<CodeWupin> btmWrapper = new QueryWrapper<>(); +// btmWrapper.eq("OID",orderDTO.getOid()); +// CodeWupin cbo = codeWupinMapper.selectOne(btmWrapper); + BaseModel cbo = cbos.get(0); // CodeClstemplateVO templateVO = templateService.getObjectHasAttrByOid(orderDTO.getTemplateOid()); // CodeRuleVO ruleVO = ruleService.getObjectHasSecByOid(orderDTO.getCodeRuleOid()); @@ -2032,7 +2055,7 @@ cbo.setDescription(orderDTO.getDescription()); cbo.setName(orderDTO.getName()); try { - cbo.setDescription(orderDTO.getDescription()); + cbo.setDescription( StringUtils.isBlank(orderDTO.getDescription())?"":orderDTO.getDescription()); cbo.setName(orderDTO.getName()); //// cbo.setAttributeValueWithNoCheck("description", orderDTO.getDescription()); // cbo.setAttributeValue("name", orderDTO.getName()); @@ -2040,8 +2063,9 @@ e.printStackTrace(); } cbo.setLastModifyTime(new Date()); - cbo.setLastModifier(AuthUtil.getUser().getUserName()); - codeWupinMapper.updateById(cbo); + cbo.setLastModifier(String.valueOf(AuthUtil.getUser().getUserId())); + updateBatchByBaseModel(classifyFullInfo.getTopClassifyVO().getBtmtypeid(), Collections.singletonList(cbo)); +// codeWupinMapper.updateById(cbo); // // List<CodeWupinEntity> cboList = new ArrayList<>(); // @@ -2067,7 +2091,8 @@ // List<ClientBusinessObject> cboList = new ArrayList<>(); // cboList.add(cbo); // boService.persistenceBatch(batchCBO); - batchSaveSelectChar(templateVO, Arrays.asList(cbo.getId())); + batchSaveSelectChar(templateVO, Collections.singletonList(cbo)); +// batchSaveSelectChar(templateVO, Arrays.asList(cbo.getId())); } /** @@ -2235,67 +2260,77 @@ */ @Override public R batchUpdateCode(List<CodeOrderDTO> orderDTOList) { -// VciBaseUtil.alertNotNull(orderDTOList,"缂栫爜鐢宠鐩稿叧鐨勫睘鎬у唴瀹�"); -// orderDTOList.forEach(orderDTO -> { -// VciBaseUtil.alertNotNull(orderDTO, "缂栫爜鐢宠鐩稿叧鐨勫睘鎬х殑鍐呭閮戒负绌�", orderDTO.getOid(), "鏁版嵁涓婚敭", -// orderDTO.getCodeClassifyOid(), "涓婚搴撳垎绫荤殑涓婚敭"); -// }); -// Map<String, CodeOrderDTO> orderDTOMap = orderDTOList.stream().filter(orderDTO -> orderDTO != null && StringUtils.isNotBlank(orderDTO.getOid())).collect(Collectors.toList()).stream().collect(Collectors.toMap(s -> s.getOid(), t -> t)); -// List<ClientBusinessObject> updateList = new ArrayList<>(); -// // 搴旇閮芥槸涓�涓垎绫讳笅鐨勪笟鍔℃暟鎹紝鎵剧涓�鏉$殑灏辫 -// CodeClassifyFullInfoBO classifyFullInfo = classifyService.getClassifyFullInfo(orderDTOList.get(0).getCodeClassifyOid()); + VciBaseUtil.alertNotNull(orderDTOList,"缂栫爜鐢宠鐩稿叧鐨勫睘鎬у唴瀹�"); + orderDTOList.forEach(orderDTO -> { + VciBaseUtil.alertNotNull(orderDTO, "缂栫爜鐢宠鐩稿叧鐨勫睘鎬х殑鍐呭閮戒负绌�", orderDTO.getOid(), "鏁版嵁涓婚敭", + orderDTO.getCodeClassifyOid(), "涓婚搴撳垎绫荤殑涓婚敭"); + }); + Map<String, CodeOrderDTO> orderDTOMap = orderDTOList.stream().filter(orderDTO -> orderDTO != null && StringUtils.isNotBlank(orderDTO.getOid())).collect(Collectors.toList()).stream().collect(Collectors.toMap(s -> s.getOid(), t -> t)); + List<BaseModel> updateList = new ArrayList<>(); + // 搴旇閮芥槸涓�涓垎绫讳笅鐨勪笟鍔℃暟鎹紝鎵剧涓�鏉$殑灏辫 + CodeClassifyFullInfoBO topClassifyFullInfo = classifyService.getClassifyFullInfo(orderDTOList.get(0).getCodeClassifyOid()); // Map<String,String> cboOidMap = new HashMap<>(); -// if (CollectionUtils.isEmpty(orderDTOMap.keySet())){ -// throw new VciBaseException(DATA_OID_NOT_EXIST); -// } + if (CollectionUtils.isEmpty(orderDTOMap.keySet())){ + throw new VciBaseException(DATA_OID_NOT_EXIST); + } + + List<BaseModel> cboList = selectByTypeAndOid(topClassifyFullInfo.getTopClassifyVO().getBtmtypeid(), VciBaseUtil.array2String(orderDTOMap.keySet().toArray(new String[0]))); // cboOidMap.put("oid",QueryOptionConstant.IN + "(" + VciBaseUtil.toInSql(orderDTOMap.keySet().toArray(new String[0])) + ")"); // List<ClientBusinessObject> cboList = boService.queryCBO(classifyFullInfo.getTopClassifyVO().getBtmtypeid(), cboOidMap); -// if (CollectionUtils.isEmpty(cboList)){ -// throw new VciBaseException(DATA_OID_NOT_EXIST); -// } + if (CollectionUtils.isEmpty(cboList)){ + throw new VciBaseException(DATA_OID_NOT_EXIST); + } // BatchCBO batchCBO = new BatchCBO(); // CodeClassifyTemplateVO firstTemplateVO = templateService.getObjectHasAttrByOid(orderDTOMap.values().stream().findFirst().get().getTemplateOid()); -// Map<String, ClientBusinessObject> cboMap = cboList.stream().filter(cbo -> cbo != null).collect(Collectors.toList()).stream().collect(Collectors.toMap(s -> s.getOid(), t -> t)); -// orderDTOMap.keySet().stream().forEach(oid -> { -// CodeOrderDTO orderDTO = orderDTOMap.get(oid); -// ClientBusinessObject cbo = cboMap.get(oid); -// if (!cbo.getTs().contains(VciDateUtil.date2Str(orderDTO.getTs(), VciDateUtil.DateTimeFormat))) { -// throw new VciBaseException("鏁版嵁涓嶆槸鏈�鏂扮殑锛屽彲鑳戒粬浜哄凡缁忎慨鏀癸紝璇峰埛鏂板悗鍐嶈瘯"); -// } -// if (!CodeDefaultLC.EDITING.getValue().equalsIgnoreCase(cbo.getLcStatus()) && !orderDTO.isEditInProcess()) { -// throw new VciBaseException("鏁版嵁涓嶆槸{0}鐨勭姸鎬侊紝涓嶅厑璁镐慨鏀�", new String[]{CodeDefaultLC.EDITING.getText()}); -// } -// //1. 鍒ゆ柇蹇呰緭椤� -// CodeClassifyTemplateVO templateVO = templateService.getObjectHasAttrByOid(orderDTO.getTemplateOid()); -// checkRequiredAttrOnOrder(templateVO, orderDTO); -// //2.鍏堟敞鍏ワ紝鍐嶇粍鍚堬紝鏈�鍚庢牎楠� -// switchClassifyLevelOnOrder(templateVO, classifyFullInfo, orderDTO); -// //3.澶勭悊缁勫悎瑙勫垯銆傜粍鍚堣鍒欎笉鑳戒娇鐢ㄧ紪鐮佺殑灞炴�э紝鍥犱负缂栫爜鐨勭敓鎴愬彲鑳芥槸闇�瑕佸睘鎬х殑 -// switchComponentAttrOnOrder(templateVO, orderDTO); -// //4.鏍¢獙瑙勫垯 -// checkVerifyOnOrder(templateVO, orderDTO); -// //5.鍒ゆ柇鍏抽敭灞炴�� -// checkKeyAttrOnOrder(classifyFullInfo, templateVO, orderDTO); -// //6.鏍¢獙鏋氫妇鐨勫唴瀹规槸鍚︽纭� -// checkEnumOnOrder(templateVO, orderDTO); -// //7.澶勭悊鏃堕棿鏍煎紡锛屽湪鏁版嵁搴撻噷闈笉璁烘槸瀛楃涓茶繕鏄棩鏈熸牸寮忥紝閮戒娇鐢ㄧ浉鍚岀殑鏍煎紡瀛樺偍 -// switchDateAttrOnOrder(templateVO, orderDTO); -// //榛樿鐨勫唴瀹逛笉鑳藉彉锛屾墍浠ュ彧闇�瑕佹嫹璐濊嚜瀹氫箟鐨勭浉鍏冲睘鎬у嵆鍙� -// copyValueToCBO(classifyFullInfo, cbo, orderDTO, templateVO, true); -// //浼佷笟鐮佸拰闆嗗洟鐮佺殑涓嶄慨鏀� -// cbo.setDescription(orderDTO.getDescription()); -// cbo.setName(orderDTO.getName()); + Map<String, BaseModel> cboMap = cboList.stream().filter(cbo -> cbo != null).collect(Collectors.toList()).stream().collect(Collectors.toMap(s -> s.getOid(), t -> t)); + orderDTOMap.keySet().stream().forEach(oid -> { + CodeOrderDTO orderDTO = orderDTOMap.get(oid); + CodeClassifyFullInfoBO classifyFullInfo = classifyService.getClassifyFullInfo(orderDTO.getCodeClassifyOid()); + CodeClassifyTemplateVO firstTemplateVO = templateService.getObjectHasAttrByOid(orderDTOMap.values().stream().findFirst().get().getTemplateOid()); + BaseModel cbo = cboMap.get(oid); + String code=cbo.getId(); + if (!cbo.getTs().toString().contains(orderDTO.getTs().toString())) { + throw new VciBaseException("鏁版嵁涓嶆槸鏈�鏂扮殑锛屽彲鑳戒粬浜哄凡缁忎慨鏀癸紝璇峰埛鏂板悗鍐嶈瘯"); + } + if (!CodeDefaultLC.EDITING.getValue().equalsIgnoreCase(cbo.getLcStatus()) && !orderDTO.isEditInProcess()) { + throw new VciBaseException("鏁版嵁涓嶆槸{0}鐨勭姸鎬侊紝涓嶅厑璁镐慨鏀�", new String[]{CodeDefaultLC.EDITING.getText()}); + } + //1. 鍒ゆ柇蹇呰緭椤� + CodeClassifyTemplateVO templateVO = templateService.getObjectHasAttrByOid(orderDTO.getTemplateOid()); + checkRequiredAttrOnOrder(templateVO, orderDTO); + //2.鍏堟敞鍏ワ紝鍐嶇粍鍚堬紝鏈�鍚庢牎楠� + switchClassifyLevelOnOrder(templateVO, classifyFullInfo, orderDTO); + //3.澶勭悊缁勫悎瑙勫垯銆傜粍鍚堣鍒欎笉鑳戒娇鐢ㄧ紪鐮佺殑灞炴�э紝鍥犱负缂栫爜鐨勭敓鎴愬彲鑳芥槸闇�瑕佸睘鎬х殑 + switchComponentAttrOnOrder(templateVO, orderDTO); + //4.鏍¢獙瑙勫垯 + checkVerifyOnOrder(templateVO, orderDTO); + //5.鍒ゆ柇鍏抽敭灞炴�� + checkKeyAttrOnOrder(classifyFullInfo, templateVO, orderDTO); + //6.鏍¢獙鏋氫妇鐨勫唴瀹规槸鍚︽纭� + checkEnumOnOrder(templateVO, orderDTO); + //7.澶勭悊鏃堕棿鏍煎紡锛屽湪鏁版嵁搴撻噷闈笉璁烘槸瀛楃涓茶繕鏄棩鏈熸牸寮忥紝閮戒娇鐢ㄧ浉鍚岀殑鏍煎紡瀛樺偍 + switchDateAttrOnOrder(templateVO, orderDTO); + //榛樿鐨勫唴瀹逛笉鑳藉彉锛屾墍浠ュ彧闇�瑕佹嫹璐濊嚜瀹氫箟鐨勭浉鍏冲睘鎬у嵆鍙� + copyValueToCBO(classifyFullInfo, cbo, orderDTO, templateVO, true); + //浼佷笟鐮佸拰闆嗗洟鐮佺殑涓嶄慨鏀� + cbo.setDescription(StringUtils.isBlank(orderDTO.getDescription())?"":orderDTO.getDescription()); + cbo.setName(orderDTO.getName()); // try { -// cbo.setAttributeValueWithNoCheck("description", orderDTO.getDescription()); +// cbo.setAttributeValue("id",code); + cbo.setId(code); + cbo.setDescription(StringUtils.isBlank(orderDTO.getDescription())?"":orderDTO.getDescription()); +// cbo.setAttributeValueWithNoCheck("description", StringUtils.isBlank(orderDTO.getDescription())?"":orderDTO.getDescription()); // cbo.setAttributeValue("name", orderDTO.getName()); + cbo.setName(orderDTO.getName()); // } catch (VCIError e) { // e.printStackTrace(); // } // batchCBO.getUpdateCbos().add(cbo); -// updateList.add(cbo); -// }); + updateList.add(cbo); + batchSaveSelectChar(firstTemplateVO, cboList); + }); // boService.persistenceBatch(batchCBO); -// batchSaveSelectChar(firstTemplateVO, cboList); + updateBatchByBaseModel(topClassifyFullInfo.getTopClassifyVO().getBtmtypeid(),updateList); return R.success("鎿嶄綔鎴愬姛锛�"); } @@ -2378,64 +2413,76 @@ */ @Override public void upSaveCode(CodeOrderDTO orderDTO) { + VciBaseUtil.alertNotNull(orderDTO, "缂栫爜鏁版嵁鎵�鍦ㄤ笟鍔$被鍚嶇О", orderDTO.getBtmname()); + String btmName=orderDTO.getBtmname(); + //鎵句笟鍔$被鍨嬶紝鐒跺悗浣跨敤涓婚敭鍘昏幏鍙栨暟鎹簱閲岀殑鏁版嵁 + List<BaseModel> cbos = selectByTypeAndOid(btmName, orderDTO.getCopyFromVersion()); + if (CollectionUtils.isEmpty(cbos)) { + throw new VciBaseException(DATA_OID_NOT_EXIST); + } + BaseModel oldCbo = cbos.get(0); + + if (!CodeDefaultLC.RELEASED.getValue().equalsIgnoreCase(oldCbo.getLcStatus())) { + throw new VciBaseException("鏁版嵁涓嶆槸{0}鐨勭姸鎬侊紝涓嶅厑璁告暟鎹洿鏀�", new String[]{CodeDefaultLC.RELEASED.getText()}); + } + + //鏍规嵁鏁版嵁鑾峰彇鍒嗙被oid + String codeClassifyOid=oldCbo.getData().get(CODE_CLASSIFY_OID_FIELD.toUpperCase()); + orderDTO.setCodeClassifyOid(codeClassifyOid); + CodeClassifyFullInfoBO classifyFullInfo = classifyService.getClassifyFullInfo(orderDTO.getCodeClassifyOid()); + CodeClassifyTemplateVO templateVO= this.getUsedTemplateByClassifyOid(orderDTO.getCodeClassifyOid()); + orderDTO.setTemplateOid(templateVO.getOid()); VciBaseUtil.alertNotNull(orderDTO, "缂栫爜鐢宠鐩稿叧鐨勫睘鎬х殑鍐呭涓虹┖", orderDTO.getCopyFromVersion(), "鍘熷鏁版嵁鐨勪富閿�", orderDTO.getCodeClassifyOid(), "涓婚搴撳垎绫荤殑涓婚敭"); - CodeClassifyFullInfoBO classifyFullInfo = classifyService.getClassifyFullInfo(orderDTO.getCodeClassifyOid()); - //鎵句笟鍔$被鍨嬶紝鐒跺悗浣跨敤涓婚敭鍘昏幏鍙栨暟鎹簱閲岀殑鏁版嵁 -// List<ClientBusinessObject> cbos = boService.queryCBO(classifyFullInfo.getTopClassifyVO().getBtmtypeid(), WebUtil.getOidQuery(orderDTO.getCopyFromVersion())); -// if (CollectionUtils.isEmpty(cbos)) { -// throw new VciBaseException(DATA_OID_NOT_EXIST); -// } -// ClientBusinessObject oldCbo = cbos.get(0); -// if (!CodeDefaultLC.RELEASED.getValue().equalsIgnoreCase(oldCbo.getLcStatus())) { -// throw new VciBaseException("鏁版嵁涓嶆槸{0}鐨勭姸鎬侊紝涓嶅厑璁告暟鎹洿鏀�", new String[]{CodeDefaultLC.RELEASED.getText()}); -// } -// //闇�瑕佸崌鐗� + + //闇�瑕佸崌鐗� // ClientBusinessObjectOperation cboOperation = new ClientBusinessObjectOperation(); -// ClientBusinessObject cbo = null; + BaseModel cbo = null; // try { // //cbo = cboOperation.createBusinessObjectVersion(oldCbo,VciBaseUtil.getCurrentUserId()); -// cbo = cboOperation.reviseBusinessObject(oldCbo, ""); + cbo = reviseBusinessObject(oldCbo); // } catch (VCIError e) { // throw new VciBaseException("鍒濆鍖栫浉鍏崇殑鍐呭鍑虹幇浜嗛敊璇�", new String[0], e); // } -// //1. 鍒ゆ柇蹇呰緭椤� -// CodeClassifyTemplateVO templateVO = templateService.getObjectHasAttrByOid(orderDTO.getTemplateOid()); -// checkRequiredAttrOnOrder(templateVO, orderDTO); -// //2.鍏堟敞鍏ワ紝鍐嶇粍鍚堬紝鏈�鍚庢牎楠� -// switchClassifyLevelOnOrder(templateVO, classifyFullInfo, orderDTO); -// //3.澶勭悊缁勫悎瑙勫垯銆傜粍鍚堣鍒欎笉鑳戒娇鐢ㄧ紪鐮佺殑灞炴�э紝鍥犱负缂栫爜鐨勭敓鎴愬彲鑳芥槸闇�瑕佸睘鎬х殑 -// switchComponentAttrOnOrder(templateVO, orderDTO); -// //4.鏍¢獙瑙勫垯 -// checkVerifyOnOrder(templateVO, orderDTO); -// //5.鍒ゆ柇鍏抽敭灞炴�� -// checkKeyAttrOnOrder(classifyFullInfo, templateVO, orderDTO); -// //6.鏍¢獙鏋氫妇鐨勫唴瀹规槸鍚︽纭� -// checkEnumOnOrder(templateVO, orderDTO); -// //7.澶勭悊鏃堕棿鏍煎紡锛屽湪鏁版嵁搴撻噷闈笉璁烘槸瀛楃涓茶繕鏄棩鏈熸牸寮忥紝閮戒娇鐢ㄧ浉鍚岀殑鏍煎紡瀛樺偍 -// switchDateAttrOnOrder(templateVO, orderDTO); -// //榛樿鐨勫唴瀹逛笉鑳藉彉锛屾墍浠ュ彧闇�瑕佹嫹璐濊嚜瀹氫箟鐨勭浉鍏冲睘鎬у嵆鍙� -// copyValueToCBO(classifyFullInfo, cbo, orderDTO, templateVO, true); -// //浼佷笟鐮佸拰闆嗗洟鐮佺殑涓嶄慨鏀� -// cbo.setDescription(orderDTO.getDescription()); -// cbo.setName(orderDTO.getName()); + //1. 鍒ゆ柇蹇呰緭椤� + //CodeClassifyTemplateVO templateVO = templateService.getObjectHasAttrByOid(orderDTO.getTemplateOid()); + checkRequiredAttrOnOrder(templateVO, orderDTO); + //2.鍏堟敞鍏ワ紝鍐嶇粍鍚堬紝鏈�鍚庢牎楠� + switchClassifyLevelOnOrder(templateVO, classifyFullInfo, orderDTO); + //3.澶勭悊缁勫悎瑙勫垯銆傜粍鍚堣鍒欎笉鑳戒娇鐢ㄧ紪鐮佺殑灞炴�э紝鍥犱负缂栫爜鐨勭敓鎴愬彲鑳芥槸闇�瑕佸睘鎬х殑 + switchComponentAttrOnOrder(templateVO, orderDTO); + //4.鏍¢獙瑙勫垯 + checkVerifyOnOrder(templateVO, orderDTO); + //5.鍒ゆ柇鍏抽敭灞炴�� + checkKeyAttrOnOrder(classifyFullInfo, templateVO, orderDTO); + //6.鏍¢獙鏋氫妇鐨勫唴瀹规槸鍚︽纭� + checkEnumOnOrder(templateVO, orderDTO); + //7.澶勭悊鏃堕棿鏍煎紡锛屽湪鏁版嵁搴撻噷闈笉璁烘槸瀛楃涓茶繕鏄棩鏈熸牸寮忥紝閮戒娇鐢ㄧ浉鍚岀殑鏍煎紡瀛樺偍 + switchDateAttrOnOrder(templateVO, orderDTO); + //榛樿鐨勫唴瀹逛笉鑳藉彉锛屾墍浠ュ彧闇�瑕佹嫹璐濊嚜瀹氫箟鐨勭浉鍏冲睘鎬у嵆鍙� + copyValueToCBO(classifyFullInfo, cbo, orderDTO, templateVO, true); + //浼佷笟鐮佸拰闆嗗洟鐮佺殑涓嶄慨鏀� + cbo.setDescription(StringUtils.isBlank(orderDTO.getDescription())?"":orderDTO.getDescription()); + cbo.setName(orderDTO.getName()); // try { -// cbo.setAttributeValueWithNoCheck("description", orderDTO.getDescription()); -// cbo.setAttributeValue("name", orderDTO.getName()); + cbo.setDescription(StringUtils.isBlank(orderDTO.getDescription())?"":orderDTO.getDescription()); +// cbo.setAttributeValueWithNoCheck("description", StringUtils.isBlank(orderDTO.getDescription())?"":orderDTO.getDescription()); + cbo.setName(orderDTO.getName()); // } catch (VCIError e) { // e.printStackTrace(); // } -// //鏁版嵁鐨勬椂鍊欙紝缂栫爜鏄笉鍙樼殑 -// cbo.setCreateTime(DateUtils.convert2String(new Date(Long.parseLong(cbo.getCreateTime())), "yyyy-MM-dd HH:mm:ss")); -// cbo.setLastModifyTime(DateUtils.convert2String(new Date(Long.parseLong(cbo.getLastModifyTime())), "yyyy-MM-dd HH:mm:ss")); + //鏁版嵁鐨勬椂鍊欙紝缂栫爜鏄笉鍙樼殑 + cbo.setCreateTime(cbo.getCreateTime()); + cbo.setLastModifyTime(cbo.getLastModifyTime()); // List<ClientBusinessObject> cboList = new ArrayList<>(); // cboList.add(cbo); -// try { + try { // cboOperation.saveRevisionBuinessObject(cbo); -// } catch (VCIError vciError) { -// throw new VciBaseException("鏁版嵁鏇存敼淇濆瓨鍑洪敊浜�", new String[0], vciError); -// } -// batchSaveSelectChar(templateVO, cboList); + insertBatchByType(cbo.getBtmname(), Collections.singletonList(cbo)); + } catch (Exception vciError) { + throw new VciBaseException("鏁版嵁鏇存敼淇濆瓨鍑洪敊浜�", new String[0], vciError); + } + batchSaveSelectChar(templateVO, Collections.singletonList(cbo)); } /** @@ -3358,4 +3405,45 @@ return "pl_code_"+refertype.trim().toLowerCase(); } + + public BaseModel reviseBusinessObject(BaseModel fromBo) { + BaseModel toBo = new BaseModel(); +// Map<String,String> data = new HashMap<>(); +// toBo.getData().put(data); + toBo.setOid(VciBaseUtil.getPk()); + toBo.setRevisionOid(VciBaseUtil.getPk()); + toBo.setNameOid(fromBo.getNameOid()); + toBo.setBtmname(fromBo.getBtmname()); + toBo.setLastR(String.valueOf(1)); + toBo.setFirstR(String.valueOf(0)); + toBo.setFirstV(String.valueOf(1)); + toBo.setLastV(String.valueOf(1)); + toBo.setCreator(String.valueOf(AuthUtil.getUser().getUserId())); + toBo.setCreateTime(new Date()); + toBo.setLastModifier(String.valueOf(AuthUtil.getUser().getUserId())); + toBo.setLastModifyTime(new Date()); + toBo.setRevisionRule(fromBo.getRevisionRule()); + toBo.setVersionRule(fromBo.getVersionRule()); +// RevisionValueObject rvObj = this.getNextRevision(fromBo.getBtmName(), fromBo.getNameoid(), item.revRuleName, item.revInput, revisionVal); + R<List<BtmTypeVO>> listR = btmTypeClient.selectByIdCollection(Collections.singletonList(fromBo.getBtmname())); + Map<String, Object> nextRevision = commonsMapper.getNextRevision(listR.getData().get(0).getTableName(), fromBo.getNameOid()); + toBo.setRevisionSeq(Integer.parseInt(nextRevision.get("REVISIONSEQ").toString())); + toBo.setRevisionValue(nextRevision.get("REVISIONVAL").toString()); +// VersionValueObject versionObj = this.getVersionValue(item.verRuleName); + toBo.setVersionSeq(Integer.valueOf(nextRevision.get("VERSIONSEQ").toString())); + toBo.setVersionValue(nextRevision.get("VERSIONVAL").toString()); + toBo.setLctid(fromBo.getLctid()); + toBo.setLcStatus("Editing"); + toBo.setId(fromBo.getId()); + toBo.setName(fromBo.getName()); + toBo.setDescription(fromBo.getDescription()); + toBo.setOwner(String.valueOf(AuthUtil.getUser().getUserId())); +// toBo.setCheckinBy(String.valueOf(AuthUtil.getUser().getUserId())); + toBo.setCopyFromVersion(fromBo.getOid()); + toBo.getData().putAll(fromBo.getData()); + toBo.getData().put("CHECKINBY",String.valueOf(AuthUtil.getUser().getUserId())); +// this.initRevisionTypeAttributeValue(fromBo, toBo); + return toBo; + + } } -- Gitblit v1.9.3