From d1e3a87aad6f737394b33852d9496d673472ddbe Mon Sep 17 00:00:00 2001 From: yuxc <653031404@qq.com> Date: 星期二, 16 五月 2023 18:19:17 +0800 Subject: [PATCH] 主要完成修改Class统一命名,与老平台命名一致,删除多余VOClass等。 --- Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmEngineServiceImpl.java | 1830 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 1,830 insertions(+), 0 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 new file mode 100644 index 0000000..83a94ca --- /dev/null +++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmEngineServiceImpl.java @@ -0,0 +1,1830 @@ +package com.vci.ubcs.code.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.vci.ubcs.code.entity.CodeAllCode; +import com.vci.ubcs.code.mapper.CodeAllCodeMapper; +import com.vci.ubcs.code.service.*; +import org.springframework.stereotype.Service; + +/** + * 涓绘暟鎹紩鎿庢湇鍔� + * + * @author weidy + * @date 2022-2-22 + */ +@Service +public class MdmEngineServiceImpl extends ServiceImpl<CodeAllCodeMapper, CodeAllCode> implements MdmEngineService { + + +// /** +// * 妯℃澘鐨勬湇鍔� +// */ +// @Resource +// private CodeClstemplateServiceImpl templateService; +// /** +// * 妯℃澘鐨勬湇鍔� +// */ +// @Resource +// private CodeOsbtmtypeMapper codeOsbtmtypeMapper; +// /** +// * 鐢熸垚缂栫爜鐨勬湇鍔� +// */ +// @Resource +// private MdmProductCodeService productCodeService; +// /** +// * 瀛楀吀鐨勬湇鍔� +// */ +// @Resource +// IDictBizClient iDictBizClient; +// /** +// * 鍏紡鐨勬湇鍔� +// */ +// @Autowired +// private FormulaServiceImpl formulaService; +// +// /** +// * 閫氱敤鏌ヨ +// */ +// @Resource +// CommonsMapper commonsMapper; +// /** +// * 缂栫爜瑙勫垯鐨勬湇鍔� +// */ +// @Autowired +// private ICodeRuleService ruleService; +// +// /** +// * 鍒嗙被鐨勬湇鍔� +// */ +// @Resource +// private ICodeClassifyService classifyService; +// +// /** +// * 鍏抽敭灞炴�х殑閰嶇疆 +// */ +// @Autowired +// private ICodeKeyattrrepeatService keyRuleService; +// /** +// * 鏃ュ織 +// */ +// private Logger logger = LoggerFactory.getLogger(getClass()); +// +// /** +// * 绌烘牸 +// */ +// public static final String SPACE = " "; +// +// /** +// * 瀵嗙骇鐨勫瓧娈� +// */ +// public static final String SECRET_FILED = "secretgrade"; +// /** +// * 鐢ㄦ埛鏂板鏁版嵁鐨勬椂鍊欏彲浠ユ煡鐪嬬殑瀵嗙骇 +// */ +// public static final String MY_DATA_SECRET = "myDataSecret"; +// /** +// * 鎷疯礉鐨勭増鏈� +// */ +// public static final String COPY_FROM_VERSION = "copyfromversion"; +// /** +// * 鍙槸sql +// */ +// public static final String ONLY = "${vcionly}"; +// +// /** +// * 榛樿鐨勬椂闂存牸寮� +// */ +// private static final String DATETIME_FORMAT = "yyyy-mm-dd hh24:mi:ss"; +// +// /** +// * 鏃ユ湡鏍煎紡 +// */ +// private static final String DATE_FORMAT = "yyyy-mm-dd"; +// +// /** +// * 蹇呰緭 +// */ +// public static final String REQUIRED_CHAR = "*"; +// /** +// * 鏇挎崲瀛楃 +// */ +// public static final String SPECIAL_CHAR = "VCI"; +//// @Autowired +//// private CodeOsbtmtypeMapper codeOsbtmtypeMapper; +// +// +// +// /** +// * 浣跨敤鍒嗙被鐨勪富閿幏鍙栧彲浠ヤ娇鐢ㄧ殑妯℃澘瀵硅薄 +// * +// * @param codeClassifyOid 鍒嗙被鐨勪富閿� +// * @return 妯℃澘鐨勬樉绀哄璞� +// */ +// @Override +// public CodeClstemplateVO getUsedTemplateByClassifyOid(String codeClassifyOid) { +// return getUsedTemplateByClassifyOid(codeClassifyOid, true); +// } +// +// /** +// * 浣跨敤鍒嗙被鐨勪富閿幏鍙栧彲浠ヤ娇鐢ㄧ殑妯℃澘瀵硅薄 +// * +// * @param codeClassifyOid 鍒嗙被鐨勪富閿� +// * @param hasAttr 鍖呭惈灞炴�� +// * @return 妯℃澘鐨勬樉绀哄璞� +// */ +// @Override +// public CodeClstemplateVO getUsedTemplateByClassifyOid(String codeClassifyOid, boolean hasAttr) { +// List<CodeClstemplateVO> templateVOs = templateService.listReleaseTemplateByClassifyOid(codeClassifyOid, hasAttr); +// return templateVOs.get(templateVOs.size() - 1); +// } +// +// /** +// * 鑾峰彇鏋氫妇鐨勪笅鎷夐�夐」 +// * +// * @param attrVO 妯℃澘灞炴�х殑瀵硅薄 +// * @return 涓嬫媺閫夐」 +// */ +// @Override +// public List<KeyValue> listComboboxItems(CodeClassifyTemplateAttrVO attrVO) { +// List<KeyValue> comboboxKVs = null; +// if (StringUtils.isNotBlank(attrVO.getEnumString())) { +// comboboxKVs = JSONObject.parseArray(attrVO.getEnumString(), KeyValue.class); +// } else { +//// comboboxKVs = enumService.getEnum(attrVO.getEnumid()); +//// Dict dict = new Dict(); +//// dict.setParentId(Long.valueOf(attrVO.getEnumid())); +// R<List<DictBiz>> list = iDictBizClient.getList(attrVO.getEnumId()); +// if(list.isSuccess()){ +// for (DictBiz datum : list.getData()) { +// KeyValue keyValue = new KeyValue(); +// keyValue.setKey(datum.getDictKey()); +// keyValue.setValue(datum.getDictValue()); +// comboboxKVs.add(keyValue); +// } +// } +// } +// return comboboxKVs; +// } +// /** +// * 淇敼鐘舵�� +// * +// * @param baseModelDTO 鏁版嵁浼犺緭瀵硅薄 +// */ +// @Override +// public void changeStatus(BaseModelDTO baseModelDTO) { +// VciBaseUtil.alertNotNull(baseModelDTO, "鏁版嵁淇℃伅", baseModelDTO.getOid(), "涓婚敭", baseModelDTO.getBtmname(), "涓氬姟绫诲瀷", baseModelDTO.getLcStatus(), "鐩爣鐘舵��"); +// List<String> oids = VciBaseUtil.str2List(baseModelDTO.getOid()); +//// List<ClientBusinessObject> cboList = boService.selectCBOByOidCollection(oids, baseModelDTO.getBtmname()); +// //鎻掍釜鐐� 涓氬姟绫诲瀷瀹屾垚鍚庨渶瑕佷慨鏀� +// QueryWrapper<CodeOsbtmtypeEntity> wrapper = new QueryWrapper<>(); +// wrapper.eq("BTMNAME",baseModelDTO.getBtmname()); +// wrapper.in("OID",oids); +// List<CodeOsbtmtypeEntity> cboList = codeOsbtmtypeMapper.selectList(wrapper); +// //杩橀渶瑕佷慨鏀筧llCode鐨勭敓鍛藉懆鏈� +//// Map<String, String> conditionMap = new HashMap<>(); +// QueryWrapper<CodeAllCode> allCodeWrapper = new QueryWrapper<>(); +// allCodeWrapper.eq("createcodebtm",baseModelDTO.getBtmname()); +// allCodeWrapper.in("createcodeoid",oids); +//// conditionMap.put("createcodeoid", QueryOptionConstant.IN + "(" + VciBaseUtil.toInSql(oids.toArray(new String[0])) + ")"); +//// conditionMap.put("createcodebtm", baseModelDTO.getBtmname()); +// List<CodeAllCode> codeCbos = baseMapper.selectList(allCodeWrapper); +//// List<ClientBusinessObject> codeCbos = boService.queryCBO(MdmBtmTypeConstant.CODE_ALL_CODE, conditionMap); +// // 鍥炴敹闇�瑕佷笟鍔℃暟鎹垹闄� +// if (CodeDefaultLC.TASK_BACK.getValue().equals(baseModelDTO.getLcStatus())) { +//// BatchCBO batchCBO = new BatchCBO(); +//// batchCBO.getDeleteCbos().addAll(cboList); +// codeOsbtmtypeMapper.deleteBatchIds(cboList); +//// boService.persistenceBatch(batchCBO); +// } else { +//// lifeCycleService.transCboStatus(cboList, baseModelDTO.getLcStatus()); +// } +//// lifeCycleService.transCboStatus(codeCbos, baseModelDTO.getLcStatus()); +// } +// +// +// /** +// * 鐢宠鍗曚竴缂栫爜 +// * +// * @param orderDTO 鐢宠鐨勪俊鎭紝闇�瑕佸寘鍚睘鎬х殑鍐呭鍜岀爜娈电浉鍏崇殑鍐呭 +// * @return 杩斿洖缂栫爜鐨勫唴瀹� +// */ +// @Override +// public String addSaveCode(CodeOrderDTO orderDTO) { +// VciBaseUtil.alertNotNull(orderDTO, "缂栫爜鐢宠鐩稿叧鐨勫睘鎬у拰鐮佹鐨勫唴瀹归兘涓虹┖", orderDTO.getCodeClassifyOid(), "涓婚搴撳垎绫荤殑涓婚敭", +// orderDTO.getTemplateOid(), "妯℃澘鐨勪富閿�", orderDTO.getCodeRuleOid(), "缂栫爜瑙勫垯鐨勪富閿�"); +// CodeClassifyFullInfoBO classifyFullInfo = classifyService.getClassifyFullInfo(orderDTO.getCodeClassifyOid()); +// CodeClstemplateVO templateVO = templateService.getObjectHasAttrByOid(orderDTO.getTemplateOid()); +// CodeRuleVO ruleVO = ruleService.getObjectHasSecByOid(orderDTO.getCodeRuleOid()); +// //1.鍒ゆ柇瑙勫垯涓櫎浜嗘祦姘寸爜娈碉紝鏄惁鏈夊叾浠栫爜娈� +// checkSecValueOnOrder(ruleVO, orderDTO); +// //2.鍒ゆ柇蹇呰緭椤� +// checkRequiredAttrOnOrder(templateVO, orderDTO); +// //3.鍏堟敞鍏ワ紝鍐嶇粍鍚堬紝鏈�鍚庢牎楠� +// switchClassifyLevelOnOrder(templateVO, classifyFullInfo, orderDTO); +// //4.澶勭悊缁勫悎瑙勫垯銆傜粍鍚堣鍒欎笉鑳戒娇鐢ㄧ紪鐮佺殑灞炴�э紝鍥犱负缂栫爜鐨勭敓鎴愬彲鑳芥槸闇�瑕佸睘鎬х殑 +// switchComponentAttrOnOrder(templateVO, orderDTO); +// //5.鏍¢獙瑙勫垯 +// checkVerifyOnOrder(templateVO, orderDTO); +// //6.鍏抽敭灞炴�� +// checkKeyAttrOnOrder(classifyFullInfo, templateVO, orderDTO); +// //7.鏋氫妇杞崲 +// checkEnumOnOrder(templateVO, orderDTO); +// //8.澶勭悊鏃堕棿鏍煎紡锛屽湪鏁版嵁搴撻噷闈笉璁烘槸瀛楃涓茶繕鏄棩鏈熸牸寮忥紝閮戒娇鐢ㄧ浉鍚岀殑鏍煎紡瀛樺偍 +// switchDateAttrOnOrder(templateVO, orderDTO); +// //9.鐢熸垚缂栫爜鐨勪俊鎭� +//// ClientBusinessObject cbo = boService.createCBOByBtmName(classifyFullInfo.getTopClassifyVO().getBtmtypeid()); +// CodeWupinEntity cbo = createCBOByBtmName(classifyFullInfo.getTopClassifyVO().getBtmtypeid()); +//// //榛樿鐨勫睘鎬ч兘涓嶇敤浠庡墠绔嫹璐� +//// //璁剧疆缂栫爜闇�瑕佺殑榛樿灞炴�х殑鍐呭 +// copyValueToCBO(classifyFullInfo, cbo, orderDTO, templateVO, false); +//// //TODO:鍥犱负榛樿鐨勫睘鎬ч兘涓嶆嫹璐濓紝鐩墠闆嗗洟鐮佸彨name锛屽苟娌℃湁浠嶥TO鎷疯礉鍒癱bo閲屻�傚鍔犱竴涓崟鐙鐞嗭紝浠ュ悗鍐嶇湅瑕佷笉瑕佽皟鏁� +// cbo.setName(orderDTO.getName() == null ? "" : orderDTO.getName()); +//// //end -- modify by lihang @20220407 +// List<CodeWupinEntity> cboList = new ArrayList<>(); +// +// //澶囨敞 +// cbo.setDescription(orderDTO.getDescription()); +// cboList.add(cbo); +//// +//// cboList.add(cbo); +// List<String> codeList = productCodeService.productCodeAndSaveData(classifyFullInfo, templateVO, ruleVO, orderDTO.getSecDTOList(),cboList); +// +// +// List<String> charList = new ArrayList<>(); +// for (CodeWupinEntity wupinEntity : cboList) { +// charList.add(wupinEntity.getId()); +// } +// batchSaveSelectChar(templateVO, charList); +// return codeList.size() > 0 ? codeList.get(0) : ""; +//// return null; +// } +// +// /** +// * 澶勭悊鍒嗙被娉ㄥ叆鐨勪俊鎭� +// * +// * @param templateVO 妯℃澘鐨勬樉绀哄璞★紝蹇呴』瑕佸悗妯℃澘鐨勫睘鎬� +// * @param classifyFullInfoBO 鍒嗙被鐨勫叏璺緞 +// * @param orderDTO 缂栫爜鐢宠鐨勪俊鎭� +// */ +// private void switchClassifyLevelOnOrder(CodeClstemplateVO templateVO, CodeClassifyFullInfoBO classifyFullInfoBO, CodeOrderDTO orderDTO) { +// Map<String,CodeClstempattrVO> classifyAttrVOMap = templateVO.getAttributes().stream().filter( +// s -> StringUtils.isNotBlank(s.getClassifyinvokeattr()) && StringUtils.isNotBlank(s.getClassifyinvokelevel()) +// ).collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t)); +// if (classifyFullInfoBO.getTopClassifyVO() == null) { +// //闇�瑕侀噸鏂版煡璇竴涓嬶紝鍥犱负杩欎釜鏄寚瀹氱殑鍒嗙被杩涙潵鐨� +// +// } +// if (!CollectionUtils.isEmpty(classifyAttrVOMap)) { +// classifyAttrVOMap.forEach((attrId, attrVO) -> { +// //鍒嗙被娉ㄥ叆鐨勭紪鍙锋垨鑰呭悕绉帮紝 +// //灞傜骇鍖呭惈鎸囧畾灞傚拰鏈�灏忓眰 +// CodeClassifyVO classifyVO = null; +// if (!CodeLevelTypeEnum.MIN.getValue().equalsIgnoreCase(attrVO.getClassifyinvokelevel()) && !"min".equalsIgnoreCase(attrVO.getClassifyinvokelevel())) { +// //鎸囧畾浜嗗眰绾х殑 +// //娉ㄦ剰锛屽洜涓烘煡璇笂绾у垎绫诲嚭鏉ョ殑灞傜骇鏄�掑簭鐨勶紝鍗抽《灞傝妭鐐规槸鏈�澶х殑鍊� +// List<CodeClassifyVO> classifyVOS = classifyFullInfoBO.getParentClassifyVOs().stream().sorted(((o1, o2) -> o2.getDataLevel().compareTo(o1.getDataLevel()))).collect(Collectors.toList()); +// int level = VciBaseUtil.getInt(attrVO.getClassifyinvokelevel()); +// if (classifyVOS.size() >= level && level > 0) { +// classifyVO = classifyVOS.get(level - 1); +// } +// } else { +// //褰撳墠鐨勫垎绫� +// classifyVO = classifyFullInfoBO.getCurrentClassifyVO(); +// } +// if (classifyVO == null) { +// //璇存槑灞傜骇鏈夎 +// orderDTO.getData().put(attrId, "鍒嗙被鏍戜笂娌℃湁灞傜骇[" + attrVO.getClassifyinvokelevel() + "]"); +// // classifyVO = classifyFullInfoBO.getCurrentClassifyVO(); +// } else { +// Map<String, String> classifyDataMap = VciBaseUtil.objectToMapString(classifyVO); +// String value = classifyDataMap.getOrDefault(attrVO.getClassifyinvokeattr(), ""); +// orderDTO.getData().put(attrId, value); +// } +// }); +// } +// } +// +// +// /** +// * 鍒ゆ柇缂栫爜鐨勭爜娈垫槸鍚﹁緭鍏ユ垨鑰呴�夋嫨浜嗙爜鍊� +// * +// * @param ruleVO 瑙勫垯鐨勬樉绀哄璞� +// * @param orderDTO 缂栫爜鐢宠鐨勫唴瀹� +// */ +// @Override +// public void checkSecValueOnOrder(CodeRuleVO ruleVO, CodeOrderDTO orderDTO) { +// List<String> unSerialSecOidList = ruleVO.getSecVOList().stream().filter( +// s -> !(CodeSecTypeEnum.CODE_SERIAL_SEC.getValue().equalsIgnoreCase(s.getSecType()) +// || CodeSecTypeEnum.CODE_ATTR_SEC.getValue().equalsIgnoreCase(s.getSecType()) +// || CodeSecTypeEnum.CODE_DATE_SEC.getValue().equalsIgnoreCase(s.getSecType()) +// || CodeSecTypeEnum.CODE_LEVEL_SEC.getValue().equalsIgnoreCase(s.getSecType()) +// || VciBaseUtil.getBoolean(s.getNullableFlag())) +// ).map(CodeBasicSecVO::getOid).collect(Collectors.toList()); +// if (!CollectionUtils.isEmpty(unSerialSecOidList)) { +// if (CollectionUtils.isEmpty(orderDTO.getSecDTOList())) { +// throw new VciBaseException("闈炴祦姘寸爜娈�(鎴栬�呭繀杈撶爜娈碉級蹇呴』瑕佽緭鍏�(鎴栭�夋嫨)鐮佸��"); +// } +// if (orderDTO.getSecDTOList().stream().anyMatch(s -> !unSerialSecOidList.contains(s.getSecOid()) +// && StringUtils.isBlank(s.getSecValue()))) { +// throw new VciBaseException("闈炴祦姘寸爜娈�(鎴栬�呭繀杈撶爜娈碉級蹇呴』瑕佽緭鍏�(鎴栭�夋嫨)鐮佸��"); +// } +// } +// } +// +// /** +// * 鏍¢獙灞炴�ф槸鍚︿负蹇呰緭 +// * +// * @param templateVO 妯℃澘鐨勬樉绀哄璞★紝闇�瑕佸寘鍚ā鏉垮睘鎬� +// * @param orderDTO 缂栫爜鐢宠鐨勪俊鎭� +// */ +// private void checkRequiredAttrOnOrder(CodeClstemplateVO templateVO, CodeOrderDTO orderDTO) { +// Map<String, CodeClstempattrVO> requiredAttrMap = templateVO.getAttributes().stream().filter( +// s -> VciBaseUtil.getBoolean(s.getRequireflag()) && StringUtils.isBlank(s.getComponentrule()) +// && StringUtils.isBlank(s.getClassifyinvokeattr())) +// .collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t)); +// if (!CollectionUtils.isEmpty(requiredAttrMap)) { +// requiredAttrMap.forEach((attrId, attrVO) -> { +// //鍙湁浼佷笟缂栫爜锛岀姸鎬侊紝澶囨敞锛屾ā鏉夸富閿紝鍒嗙被涓婚敭杩欏嚑涓槸鍥哄畾鐨勶紝鍏朵綑閮芥槸鑷閰嶇疆鐨� +// if (StringUtils.isBlank(getValueFromOrderDTO(orderDTO, attrId))) { +// throw new VciBaseException("灞炴�с�恵0}銆戝繀椤昏杈撳叆(閫夋嫨)鍐呭", new String[]{attrVO.getName()}); +// } +// }); +// } +// } +// +// /** +// * 浠庣紪鐮佺敵璇蜂俊鎭璞′笂鑾峰彇鏌愪釜灞炴�х殑鍊� +// * +// * @param orderDTO 缂栫爜鐢宠瀵硅薄 +// * @param attrId 灞炴�х殑缂栧彿 +// * @return 鍊� +// */ +// private String getValueFromOrderDTO(CodeOrderDTO orderDTO, String attrId) { +// attrId = attrId.toLowerCase(Locale.ROOT); +// String value = null; +// if (VciQueryWrapperForDO.BASIC_FIELD_MAP.containsKey(attrId)) { +// value = WebUtil.getStringValueFromObject(WebUtil.getValueFromField(WebUtil.getFieldForObject(attrId, orderDTO.getClass()).getName(), orderDTO)); +// } else { +// //璇存槑鏄嚜琛岄厤缃殑 +// //鍓嶇蹇呴』瑕佷紶閫掑皬鍐欑殑灞炴�� +// value = orderDTO.getData().getOrDefault(attrId, ""); +// } +// return value; +// } +// +// /** +// * 杞崲缁勫悎瑙勫垯鐨勫�� +// * +// * @param templateVO 妯℃澘鐨勬樉绀哄璞★紝闇�瑕佸寘鍚ā鏉垮睘鎬� +// * @param orderDTO 缂栫爜鐢宠鐨勪俊鎭� +// */ +// private void switchComponentAttrOnOrder(CodeClstemplateVO templateVO, CodeOrderDTO orderDTO) { +// Map<String, CodeClstempattrVO> compAttrVOMap = templateVO.getAttributes().stream().filter(s -> StringUtils.isNotBlank(s.getComponentrule())).collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t)); +// if (!CollectionUtils.isEmpty(compAttrVOMap)) { +// Map<String, String> dataMap = WebUtil.objectToMapString(orderDTO); +// +// Map<String, String> dataLowMap = new HashMap<>(); +// if (!CollectionUtils.isEmpty(dataMap)) { +// dataMap.forEach((key, value) -> { +// dataLowMap.put(key.toLowerCase(Locale.ROOT), value); +// }); +// } +// dataLowMap.putAll(orderDTO.getData()); +// compAttrVOMap.forEach((attrId, attrVO) -> { +// dataLowMap.put(attrId, formulaService.getValueByFormula(dataLowMap, attrVO.getComponentrule())); +// }); +// dataLowMap.forEach((key, value) -> { +// setValueToOrderDTO(orderDTO, key, value); +// }); +// } +// } +// +// +// /** +// * 璁剧疆鏂扮殑鍊煎埌鐢宠瀵硅薄涓� +// * +// * @param orderDTO 缂栫爜鐢宠瀵硅薄 +// * @param attrId 灞炴�х殑缂栧彿 +// * @param value 鍊� +// */ +// private void setValueToOrderDTO(CodeOrderDTO orderDTO, String attrId, String value) { +// attrId = attrId.toLowerCase(Locale.ROOT); +// if (VciQueryWrapperForDO.BASIC_FIELD_MAP.containsKey(attrId)) { +// WebUtil.setValueToField(WebUtil.getFieldForObject(attrId, orderDTO.getClass()).getName(), orderDTO, value); +// } else { +// orderDTO.getData().put(attrId, value); +// } +// } +// +// /** +// * 鏍¢獙姝e垯琛ㄨ揪寮忔槸鍚︽纭� +// * +// * @param templateVO 妯℃澘鐨勪俊鎭紝蹇呴』鍖呭惈灞炴�х殑鍐呭 +// * @param orderDTO 缂栫爜鐢宠鐨勭浉鍏崇殑淇℃伅 +// */ +// private void checkVerifyOnOrder(CodeClstemplateVO templateVO, CodeOrderDTO orderDTO) { +// Map<String, CodeClstempattrVO> verifyAttrVOMap = templateVO.getAttributes().stream().filter(s -> StringUtils.isNotBlank(s.getVerifyrule())).collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t)); +// if (!CollectionUtils.isEmpty(verifyAttrVOMap)) { +// verifyAttrVOMap.forEach((attrId, attrVO) -> { +// String value = getValueFromOrderDTO(orderDTO, attrId); +// if (StringUtils.isNotBlank(value) && !value.matches(attrVO.getVerifyrule())) { +// //鏍¢獙姝e垯琛ㄨ揪寮� +// throw new VciBaseException("灞炴�{0}]鐨勫�间笉绗﹀悎鏍¢獙瑙勫垯鐨勮姹�", new String[]{attrVO.getName()}); +// } +// }); +// } +// } +// +// /** +// * 鏍¢獙鍏抽敭灞炴�� +// * +// * @param classifyFullInfo 鍒嗙被鐨勫叏閮ㄤ俊鎭� +// * @param templateVO 妯℃澘鐨勫唴瀹癸紝蹇呴』鍖呭惈妯℃澘灞炴�� +// * @param orderDTO 缂栫爜鐢宠鐨勭浉鍏崇殑淇℃伅 +// */ +// private void checkKeyAttrOnOrder(CodeClassifyFullInfoBO classifyFullInfo, CodeClstemplateVO templateVO, CodeOrderDTO orderDTO) { +// //鍏堣幏鍙栧叧閿睘鎬х殑瑙勫垯锛屼篃鍒╃敤缁ф壙鐨勬柟寮� +// CodeKeyattrrepeatVO keyRuleVO = keyRuleService.getRuleByClassifyFullInfo(classifyFullInfo); +// //娉ㄦ剰鐨勬槸keyRuleVO鍙兘涓虹┖锛岃〃绀轰笉浣跨敤瑙勫垯鎺у埗 +// //鑾峰彇鎵�鏈夌殑鍏抽敭灞炴�� +// Map<String, CodeClstempattrVO> ketAttrMap = templateVO.getAttributes().stream().filter(s -> VciBaseUtil.getBoolean(s.getKeyattrflag())).collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t)); +// Map<String, String> conditionMap = new HashMap<>(); +// boolean trimAll = keyRuleVO == null ? false : VciBaseUtil.getBoolean(keyRuleVO.getIgnoreallspaceflag()); +// //鍏ㄩ儴鍘荤┖鐨勪紭鍏堢骇澶т簬鍘荤┖ +// boolean trim = keyRuleVO == null ? false : VciBaseUtil.getBoolean(keyRuleVO.getIgnorespaceflag()); +// boolean ignoreCase = keyRuleVO == null ? false : VciBaseUtil.getBoolean(keyRuleVO.getIgnorecaseflag()); +// boolean ignoreWidth = keyRuleVO == null ? false : VciBaseUtil.getBoolean(keyRuleVO.getIgnorewidthflag()); +// ketAttrMap.forEach((attrId, attrVO) -> { +// String value = getValueFromOrderDTO(orderDTO, attrId); +// if (value == null) { +// value = ""; +// } +// wrapperKeyAttrConditionMap(value, keyRuleVO, attrId, trim, ignoreCase, ignoreWidth, trimAll, conditionMap); +// }); +// +// //娌℃湁闄愬埗鍒嗙被锛屼絾鏄竴涓ā鏉垮彧鍙兘鍦ㄤ竴涓笟鍔$被鍨嬮噷闈紝鎵�浠ョ洿鎺ユ煡璇㈣繖涓笟鍔$被鍨嬪嵆鍙� +// +// if (!CollectionUtils.isEmpty(conditionMap)) { +// final String[] sql = {"select count(*) from " + VciBaseUtil.getTableName(classifyFullInfo.getTopClassifyVO().getBtmtypeid()) + " t where 1 = 1 "}; +// conditionMap.forEach((key, value) -> { +// sql[0] += " and " + key + " = " + value; +// }); +// if (StringUtils.isNotBlank(orderDTO.getOid())) { +// //淇敼鐨勬椂鍊欙紝闇�瑕佹帓闄よ嚜宸� +// sql[0] += " and oid != '" + orderDTO.getOid() + "'"; +// } else if (StringUtils.isNotBlank(orderDTO.getCopyFromVersion())) { +// sql[0] += " and oid != '" + orderDTO.getCopyFromVersion() + "'"; +// } +// sql[0] += " and islastR = '1' and islastV = '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}"; +// String[] objs = new String[]{trim ? "鏄�" : "鍚�", ignoreCase ? "鏄�" : "鍚�", ignoreWidth ? "鏄�" : "鍚�", trimAll ? "鏄�" : "鍚�"}; +// throw new VciBaseException("鏍规嵁鎮ㄥ~鍐欑殑鍏抽敭灞炴�х殑鍐呭锛岀粨鍚堝叧閿睘鎬ф煡璇㈣鍒欙紝鍙戠幇杩欎釜鏁版嵁宸茬粡鍦ㄧ郴缁熶腑瀛樺湪浜嗐�傝淇!銆�" + ruleInfoMsg, objs); +// } +// } +// } +// +// /** +// * 灏佽鍏抽敭灞炴�х殑鏌ヨ璇彞 +// * +// * @param value 褰撳墠鐨勫�� +// * @param keyRuleVO 鍏抽敭灞炴�х殑鎺у埗瑙勫垯锛屽彲浠ヤ负绌� +// * @param attrId 灞炴�х殑缂栧彿 +// * @param trim 鏄惁鍘婚櫎绌烘牸 +// * @param ignoreCase 鏄惁涓嶅尯鍒嗗ぇ灏忓啓 +// * @param ignoreWidth 鏄惁蹇界暐鍏ㄥ崐瑙� +// * @param trimAll 鏄惁蹇界暐鍏ㄩ儴绌烘牸 +// * @param conditionMap 鏌ヨ鏉′欢 +// */ +// @Override +// public void wrapperKeyAttrConditionMap(String value, CodeKeyattrrepeatVO keyRuleVO, String attrId, +// boolean trim, boolean ignoreCase, boolean ignoreWidth, +// boolean trimAll, Map<String, String> conditionMap) { +// boolean ignoreSpace = trim || trimAll; +// if (StringUtils.isBlank(value)) { +// //涓虹┖鐨勬椂鍊欙紝涓嶈兘鐢≦ueryOperation.ISNULL锛屽钩鍙颁笉鐭ラ亾鍟ユ椂鍊欎笉澶勭悊杩欑浜� +// conditionMap.put("t."+attrId, "null"); +// } else { +// if (keyRuleVO != null) { +// String queryKey = ""; +// String queryValue = ""; +// +// String temp = ""; +// if (ignoreCase && ignoreSpace && ignoreWidth) { +// //蹇界暐澶у皬鍐欙紝涓斿幓绌猴紝蹇界暐鍏ㄥ崐瑙� +// temp = (trimAll ? "REPLACE" : "TRIM") + "(UPPER(to_single_byte(%s)) " + (trimAll ? ",' ','')" : ")"); +// } else if (ignoreCase && ignoreSpace && !ignoreWidth) { +// //蹇界暐澶у皬鍐欍�佸幓绌恒�佷笉蹇界暐鍏ㄥ崐瑙� +// temp = (trimAll ? "REPLACE" : "TRIM") + "(UPPER(%s) " + (trimAll ? ",' ','')" : ")"); +// } else if (ignoreCase && !ignoreSpace && ignoreWidth) { +// //蹇界暐澶у皬鍐欍�佷笉鍘荤┖銆佸拷鐣ュ叏鍗婅 +// temp = "UPPER(to_single_byte(%s))"; +// } else if (!ignoreCase && ignoreSpace && ignoreWidth) { +// //涓嶅拷鐣ュぇ灏忓啓銆佸幓绌恒�佸拷鐣ュ叏鍗婅 +// temp = (trimAll ? "REPLACE" : "TRIM") + "(to_single_byte(%s) " + (trimAll ? ",' ','')" : ")"); +// } else if (ignoreCase && !ignoreSpace && !ignoreWidth) { +// //蹇界暐澶у皬鍐欍�佷笉鍘荤┖銆佷笉蹇界暐鍏ㄥ崐瑙� +// temp = "UPPER(%s)"; +// } else if (!ignoreCase && !ignoreCase && ignoreWidth) { +// //涓嶅拷鐣ュぇ灏忓啓銆佷笉鍘荤┖銆佸拷鐣ュ叏鍗婅 +// temp = "to_single_byte(%s)"; +// } else if (!ignoreCase && ignoreSpace && !ignoreWidth) { +// //涓嶅拷鐣ュぇ灏忓啓銆佸幓绌恒�佷笉蹇界暐鍏ㄥ崐瑙� +// temp = (trimAll ? "REPLACE" : "TRIM") + "(%s " + (trimAll ? ",' ','')" : ")"); +// } else if (!ignoreCase && !ignoreSpace && !ignoreWidth) { +// //涓嶅拷鐣ュぇ灏忓啓銆佷笉鍘荤┖銆佷笉蹇界暐鍏ㄥ崐瑙� +// temp = "%s"; +// } +// queryKey = String.format(temp, "t."+attrId); +// queryValue = String.format(temp, "'" + (trim ? value.trim() : value) + "'"); +// conditionMap.put(queryKey, queryValue); +// } else { +// //涓虹┖鐨勬椂鍊欎笉浠h〃涓嶆牎楠岋紝鍙槸涓嶅幓闄ょ浉鍏崇殑淇℃伅 +// conditionMap.put("t."+attrId, value); +// } +// } +// } +// +// /** +// * 鏍¢獙鏋氫妇鐨勫唴瀹� +// * +// * @param templateVO 妯℃澘鐨勬樉绀哄璞★紝闇�瑕佸寘鍚睘鎬� +// * @param orderDTO 缂栫爜鐢宠鐨勪俊鎭� +// */ +// private void checkEnumOnOrder(CodeClstemplateVO templateVO, CodeOrderDTO orderDTO) { +// //濡傛灉鏋氫妇鍙互淇敼锛屽垯涓嶉渶瑕佹牎楠屾槸鍚︾鍚堟灇涓剧殑閫夐」 +// +// Map<String, CodeClstempattrVO> enumAttrVOMap = templateVO.getAttributes().stream().filter(s -> (StringUtils.isNotBlank(s.getEnumstring()) || StringUtils.isNotBlank(s.getEnumid())) && !VciBaseUtil.getBoolean(s.getEnumeditflag())).collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t)); +// if (!CollectionUtils.isEmpty(enumAttrVOMap)) { +// enumAttrVOMap.forEach((attrId, attrVO) -> { +// String value = getValueFromOrderDTO(orderDTO, attrId); +// if (StringUtils.isNotBlank(value)) { +// CodeClassifyTemplateAttrVO codeClassifyTemplateAttrVO = new CodeClassifyTemplateAttrVO(); +// BeanUtils.copyProperties(attrVO,codeClassifyTemplateAttrVO); +// //鏈夊�兼墠鑳芥牎楠� +// List<KeyValue> comboboxKVs = listComboboxItems(codeClassifyTemplateAttrVO); +// if (!comboboxKVs.stream().anyMatch(s -> value.equalsIgnoreCase(s.getKey()))) { +// throw new VciBaseException("灞炴�с�恵0}銆戠殑鍊间笉绗﹀悎鏋氫妇鐨勮姹�", new String[]{attrVO.getName()}); +// } +// } +// }); +// } +// } +// +// /** +// * 杞崲鏃堕棿鐨勬牸寮� +// * +// * @param templateVO 妯℃澘鐨勬樉绀哄璞★紝闇�瑕佸寘鍚睘鎬� +// * @param orderDTO 缂栫爜鐢宠鐨勪俊鎭� +// */ +// private void switchDateAttrOnOrder(CodeClstemplateVO templateVO, CodeOrderDTO orderDTO) { +// Map<String, CodeClstempattrVO> dateAttrVOMap = templateVO.getAttributes().stream().filter(s -> StringUtils.isNotBlank(s.getCodedateformat())).collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t)); +// if (!CollectionUtils.isEmpty(dateAttrVOMap)) { +// dateAttrVOMap.forEach((attrId, attrVO) -> { +// String value = getValueFromOrderDTO(orderDTO, attrId); +// if (StringUtils.isNotBlank(value)) { +// DateConverter dateConverter = new DateConverter(); +// dateConverter.setAsText(value); +// value = VciDateUtil.date2Str(dateConverter.getValue(), VciDateUtil.DateTimeMillFormat); +// setValueToOrderDTO(orderDTO, attrId, value); +// } +// }); +// } +// } +// +// /** +// * 鎷疯礉鏁版嵁鍒癱bo瀵硅薄涓� +// * +// * @param classifyFullInfo 鍒嗙被鐨勫叏閮ㄤ俊鎭� +// * @param cbo 涓氬姟鏁版嵁 +// * @param orderDTO 缂栫爜鐢宠鐨勪俊鎭� +// * @param templateVO 妯℃澘鐨勬樉绀哄璞� +// * @param edit 鏄惁涓轰慨鏀� +// */ +// private void copyValueToCBO(CodeClassifyFullInfoBO classifyFullInfo, CodeWupinEntity cbo, +// CodeOrderDTO orderDTO, CodeClstemplateVO templateVO, +// boolean edit) { +// String fullPath = ""; +// if (!CollectionUtils.isEmpty(classifyFullInfo.getParentClassifyVOs())) { +// fullPath = classifyFullInfo.getParentClassifyVOs().stream().sorted(((o1, o2) -> o2.getDataLevel().compareTo(o1.getDataLevel()))) +// .map(CodeClassifyVO::getOid).collect(Collectors.joining("##")); +// } else { +// fullPath = classifyFullInfo.getCurrentClassifyVO().getOid(); +// } +// +//// BeanUtils. +// BeanUtils.copyProperties(orderDTO.getData(),cbo); +// cbo.setMaterialtype(Short.valueOf("1001")); +//// orderDTO.getData().forEach((key, value) -> { +//// if (!edit || (!checkUnAttrUnEdit(key) && +//// !VciQueryWrapperForDO.LC_STATUS_FIELD.equalsIgnoreCase(key))) { +//// try { +//// cbo.setAttributeValue(key, value); +//// } catch (Exception e) { +//// logger.error("璁剧疆灞炴�х殑鍊奸敊璇�", e); +//// } +//// } +//// }); +// try { +// +// cbo.setCodeclsfid(classifyFullInfo.getCurrentClassifyVO().getOid()); +// cbo.setCodetemplateoid(templateVO.getOid()); +// cbo.setCodeclsfpath(fullPath); +//// cbo.setMaterialclassify("model_type"); +//// cbo.setMaterialname(orderDTO.getData().get("materialname")); +//// cbo.setShifoupihaoguanli("true"); +//// cbo.setKucunwl("true"); +//// cbo.setXiaoshouwl("false"); +// if (!edit && StringUtils.isBlank(orderDTO.getLcStatus())) { +// //鎵剧敓鍛藉懆鏈熺殑璧峰鐘舵�侊紝鎻掍釜鐐癸紝鐪嬬敓鍛藉懆鏈熸槸鍚﹂渶瑕佸垱寤� +// if (StringUtils.isNotBlank(cbo.getLctid())) { +//// OsLifeCycleVO lifeCycleVO = lifeCycleService.getLifeCycleById(cbo.getLctid()); +//// if (lifeCycleVO != null) { +//// cbo.setLcStatus("Editing"); +////// cbo.setLcStatus(lifeCycleVO.getStartStatus()); +//// } else { +// cbo.setLcStatus(CodeDefaultLC.EDITING.getValue()); +//// } +// } else { +// cbo.setLcStatus(CodeDefaultLC.EDITING.getValue()); +// } +// +// } +// +// int secret = VciBaseUtil.getInt(cbo.getSecretGrade().toString()); +// //鎻掍釜鐐癸紝鍚庣画鐪嬪瘑绾ф湇鍔℃槸鍚﹀彲鐢� +//// if (secret == 0 || !secretService.checkDataSecret(secret)) { +// if (secret == 0 ) { +// Integer userSecret = VciBaseUtil.getCurrentUserSecret(); +//// cbo.setAttributeValue(SECRET_FIELD, String.valueOf((userSecret == null || userSecret == 0) ? UserSecretEnum.NONE.getValue() : userSecret)); +// cbo.setSecretGrade(userSecret == null || userSecret == 0 ? UserSecretEnum.NONE.getValue() : userSecret); +// } +// } catch (Throwable e) { +// logger.error("璁剧疆榛樿鐨勫睘鎬х殑鍊奸敊璇�", e); +// } +// } +// +// +// /** +// * 鍒濆鍖栦笟鍔$被鍨� +// * --鍒涘缓浜洪粯璁や负褰撳墠鐢ㄦ埛锛屽鏋滈渶瑕佷慨鏀癸紝鍙互鍦ㄨ幏鍙栧悗鑷澶勭悊 +// * @param btmName 涓氬姟绫诲瀷鐨勫悕绉帮紝浼氳嚜鍔ㄥ彉鎴愬皬鍐� +// * @return CodeWupinEntity +// * @throws VciBaseException 鍒濆鍖栧嚭閿欑殑鏄細鎶涘嚭寮傚父 +// */ +// @Override +// public CodeWupinEntity createCBOByBtmName(String btmName) +// throws VciBaseException { +// if(btmName!=null){ +// btmName = btmName.trim().toLowerCase(); +// } +// String userid = AuthUtil.getUser().getUserName(); +//// if(!hasCreatedCbos.containsKey(btmName)){ +//// if(StringUtils.isEmpty(userid)){ +//// throw new VciBaseException(msgCodePrefix +"noHasUserid"); +//// } +//// try { +//// hasCreatedCbos.put(btmName, createBusinessObject(btmName)); +//// } catch (Exception e) { +//// logger.error("鍒涘缓涓氬姟绫诲瀷瀵硅薄",e); +//// throw new VciBaseException(msgCodePrefix + "initBoError",new String[]{btmName}); +//// } +//// } +//// ClientBusinessObject cbo = cloneClientBusinessObject(hasCreatedCbos.get(btmName)); +// +// QueryWrapper<CodeOsbtmtypeEntity> btmWrapper = new QueryWrapper<>(); +// btmWrapper.eq("ID",btmName); +// CodeOsbtmtypeEntity btmTypeVO = codeOsbtmtypeMapper.selectOne(btmWrapper); +//// OsBtmTypeVO btmTypeVO = btmService.getBtmById(boName); +// String userName = AuthUtil.getUser().getUserName(); +// CodeWupinEntity wupinEntity = new CodeWupinEntity(); +// wupinEntity.setOid(null); +//// bo.setRevisionid((new ObjectUtility()).getNewObjectID36()); +//// bo.setNameoid((new ObjectUtility()).getNewObjectID36()); +// wupinEntity.setBtmname(btmName); +// wupinEntity.setLastR(String.valueOf(1)); +// wupinEntity.setFirstR(String.valueOf(1)); +// wupinEntity.setFirstV(String.valueOf(1)); +// wupinEntity.setLastV(String.valueOf(1)); +// wupinEntity.setCreator(userName); +// wupinEntity.setCreateTime(new Date()); +// wupinEntity.setLastModifier(userName); +// wupinEntity.setLastModifyTime(new Date()); +// wupinEntity.setRevisionRule(btmTypeVO.getRevisionruleid()); +// wupinEntity.setVersionRule(String.valueOf(btmTypeVO.getVersionRule())); +// if(StringUtils.isNotBlank(btmTypeVO.getRevisionruleid())){ +// //鎻掍釜鐐癸紝闇�瑕侀棶鍕囧摜鐗堟湰闂锛屽睍绀洪粯璁や负1 +//// OsRevisionRuleVO revisionRuleVO = revisionRuleService.getRevisionRuleById(btmTypeVO.getRevisionruleid()); +// wupinEntity.setRevisionValue("1"); +// } +// +// wupinEntity.setRevisionSeq(1); +// wupinEntity.setVersionSeq(1); +// //鎻掍釜鐐癸紝闇�瑕侀棶鍕囧摜鐗堟湰闂锛屽睍绀洪粯璁や负1 +// wupinEntity.setVersionValue("1"); +// wupinEntity.setLctid("wupinLC"); +// wupinEntity.setLcStatus("Editing"); +// wupinEntity.setId(""); +// wupinEntity.setName(""); +// wupinEntity.setDescription(""); +// wupinEntity.setOwner(userName); +// wupinEntity.setCheckinby(userName); +// wupinEntity.setCopyFromVersion(""); +// wupinEntity.setMaterialtype((short) 1001); +// wupinEntity.setCaigouwl("true"); +// wupinEntity.setShifoupihaoguanli("true"); +// wupinEntity.setKucunwl("true"); +// wupinEntity.setXiaoshouwl("false"); +// wupinEntity.setPassing("true"); +// +//// this.initTypeAttributeValue(wupinEntity,btmTypeVO); +// return wupinEntity; +// +// +//// return cbo; +// } +// +// /** +// * 鏄惁涓轰慨鏀瑰拷鐣ョ殑灞炴�� +// * @param attrName 灞炴�х殑鍚嶅瓧 +// * @return true 琛ㄧず搴旇蹇界暐 +// */ +// boolean checkUnAttrUnEdit(String attrName){ +// return (VciQueryWrapperForDO.OID_FIELD.equalsIgnoreCase(attrName) +// ||"ts".equalsIgnoreCase(attrName) +// || "lastmodifier".equalsIgnoreCase(attrName) +// || "lastmodifytime".equalsIgnoreCase(attrName) +// || "createtime".equalsIgnoreCase(attrName) +// || "checkintime".equalsIgnoreCase(attrName) +// ||"checkouttime".equalsIgnoreCase(attrName)); +// } +// +// /** +// * 淇濆瓨鍙緭鍙�夌殑淇℃伅 +// * +// * @param templateVO 妯℃澘鐨勫璞� +// * @param cboList 鏁版嵁鐨勫唴瀹� +// */ +// @Override +// public void batchSaveSelectChar(CodeClstemplateVO templateVO, /*List<ClientBusinessObject> cboList*/ +// List<String> cboList) { +// if (templateVO != null && !CollectionUtils.isEmpty(cboList)) { +// //鏄紓姝ョ殑锛屾墍浠ョ洿鎺ュ惊鐜� +// List<CodeClstempattrVO> selectAttrVOs = templateVO.getAttributes().stream().filter(s -> StringUtils.isNotBlank(s.getLibraryidentification())).collect(Collectors.toList()); +// +// if (!CollectionUtils.isEmpty(selectAttrVOs)) { +//// SessionInfo sessionInfo = VciBaseUtil.getCurrentUserSessionInfo(); +// selectAttrVOs.parallelStream().forEach(attrVO -> { +// List<String> valuesList = cboList; +//// cboList.parallelStream().forEach(cbo -> { +//// String value = cbo.get.getAttributeValue(attrVO.getId()); +//// if (StringUtils.isNotBlank(value)) { +//// valuesList.add(value); +//// } +//// }); +// if (!CollectionUtils.isEmpty(valuesList)) { +// for (String s : valuesList) { +// DictBiz dictBiz = new DictBiz(); +// dictBiz.setCode(templateVO.getBtmTypeId()); +// dictBiz.setDictKey(s); +// dictBiz.setDictValue(s); +// //浠庡師鏉ョ殑charService锛堝彲杈撳彲閫夛級鏇存敼涓鸿皟鐢╫md涓殑鎺ュ彛鏉ュ疄鐜� +// iDictBizClient.getCheck(dictBiz); +// } +//// charService.saveBySameNamespaceAndFlag(templateVO.getBtmTypeId(), attrVO.getLibraryIdentification(), valuesList, sessionInfo); +// } +// }); +// } +// } +// } +// +// @Override +// public MdmUIInfoVO getFormDefineByTemplateOid(String templateOid, String codeClassifyOid) { +// CodeClstemplateVO templateVO = templateService.getObjectHasAttrByOid(templateOid); +// MdmUIInfoVO uiInfoVO = new MdmUIInfoVO(); +// uiInfoVO.setTemplateVO(templateVO); +// uiInfoVO.setFormDefineVO(wrapperFormDefineByTemplate(templateVO, codeClassifyOid)); +// wrapperResemble(templateVO, uiInfoVO); +// return uiInfoVO; +// } +// +// +// /** +// * 妯℃澘灞炴�ц浆鎹负琛ㄥ崟瀹氫箟鐨勪俊鎭� +// * +// * @param templateVO 妯℃澘鐨勬樉绀哄璞� +// * @param codeClassifyOid 鍒嗙被鐨勪富閿紝涓虹┖鐨勬椂鍊欙紝鑾峰彇妯℃澘鎵�灞炵殑鍒嗙被涓婚敭.鐢ㄤ簬浜х敓鍒嗙被娉ㄥ叆 +// * @return 琛ㄦ牸鐨勪俊鎭� +// */ +// private UIFormDefineVO wrapperFormDefineByTemplate(CodeClstemplateVO templateVO, String codeClassifyOid) { +// UIFormDefineVO formDefineVO = new UIFormDefineVO(); +// formDefineVO.setOid(templateVO.getOid()); +// formDefineVO.setBtmType(templateVO.getBtmTypeId()); +// if (StringUtils.isBlank(codeClassifyOid)) { +// codeClassifyOid = templateVO.getCodeClassifyOid(); +// } +// CodeClassifyFullInfoBO classifyFullInfo = classifyService.getClassifyFullInfo(codeClassifyOid); +// +// List<UIFormItemVO> itemVOS = new ArrayList<>(); +// Map<String, List<CodeClstempattrVO>> attrGroupMap = templateVO.getAttributes().stream(). +// filter(s -> StringUtils.isNotBlank(s.getAttributegroup())).collect(Collectors.groupingBy(s -> s.getAttributegroup())); +// +// templateVO.getAttributes().forEach(attrVO -> { +// UIFormItemVO formItemVO = templateAttr2FormField(attrVO, templateVO.getBtmTypeId()); +// itemVOS.add(formItemVO); +// }); +// //澶勭悊灞炴�у垎缁� +// if (!CollectionUtils.isEmpty(attrGroupMap)) { +// //鎸夌収鍒嗙粍鐨勫睘鎬ф帓鍒楋紝鎵惧埌姣忎竴涓垎缁勭殑绗竴涓睘鎬� +// for (String key : attrGroupMap.keySet()) { +// List<CodeClstempattrVO> value = attrGroupMap.get(key); +// //鎵惧埌杩欎釜鍒嗙粍鐨勫睘鎬х殑绗竴涓� +// CodeClstempattrVO attrVO = value.stream().sorted(((o1, o2) -> o1.getOrdernum().compareTo(o2.getOrdernum()))).findFirst().get(); +// //鎴戜滑鎵惧埌杩欎釜灞炴�у湪鏈�缁堢殑itemVOs閲岀殑浣嶇疆 +// UIFormItemVO lineVO = new UIFormItemVO(); +// lineVO.setField(attrVO.getId() + "_line"); +// lineVO.setType("line"); +// lineVO.setText(key); +// //鎵句綅缃� +// for (int i = 0; i < itemVOS.size(); i++) { +// UIFormItemVO record = itemVOS.get(i); +// if (record.getField().equalsIgnoreCase(attrVO.getId())) { +// itemVOS.add(i, lineVO); +// break; +// } +// } +// } +// } +// +// CodeOrderDTO orderDTO = new CodeOrderDTO(); +// switchClassifyLevelOnOrder(templateVO, classifyFullInfo, orderDTO); +// if (!CollectionUtils.isEmpty(orderDTO.getData())) { +// orderDTO.getData().forEach((key, value) -> { +// for (int i = 0; i < itemVOS.size(); i++) { +// UIFormItemVO itemVO = itemVOS.get(i); +// if (itemVO.getField().equalsIgnoreCase(key)) { +// itemVO.setDefaultValue(value); +// break; +// } +// } +// }); +// } +// formDefineVO.setItems(itemVOS); +// //鏌ヨ鏄惁鏈夊垎绫绘敞鍏ョ殑 +// return formDefineVO; +// } +// /** +// * 灞炴�х被鍨嬩笌js涓殑瀛楁绫诲瀷鐨勬槧灏� +// */ +// private static Map<String, String> vciFieldTypeMap = new HashMap<String, String>() {{ +// put(VciFieldTypeEnum.VTString.name(), "text"); +// put(VciFieldTypeEnum.VTInteger.name(), "text"); +// put(VciFieldTypeEnum.VTLong.name(), "text"); +// put(VciFieldTypeEnum.VTDouble.name(), "text"); +// put(VciFieldTypeEnum.VTClob.name(), "text"); +// put(VciFieldTypeEnum.VTBoolean.name(), "truefalse"); +// put(VciFieldTypeEnum.VTDateTime.name(), "datetime"); +// put(VciFieldTypeEnum.VTDate.name(), "datetime"); +// put(VciFieldTypeEnum.VTTime.name(), "datetime"); +// put(VciFieldTypeEnum.VTFilePath.name(), "file"); +// }}; +// +// /** +// * 妯℃澘灞炴�ц浆鎹负琛ㄥ崟鐨勫瓧娈� +// * +// * @param attrVO 妯℃澘灞炴�� +// * @param btmType 涓氬姟绫诲瀷 +// * @return 琛ㄥ崟鐨勫瓧娈� +// */ +// @Override +// public UIFormItemVO templateAttr2FormField(CodeClstempattrVO attrVO, String btmType) { +// +// UIFormItemVO itemVO = new UIFormItemVO(); +// if (SECRET_FILED.equalsIgnoreCase(attrVO.getId())) { +//// attrVO.setEnumid(OsEnumServiceImpl.MY_DATA_SECRET); +// attrVO.setEnumid(MY_DATA_SECRET); +// } +// itemVO.setField(attrVO.getId()); +// itemVO.setText(attrVO.getName()); +// itemVO.setType(vciFieldTypeMap.getOrDefault(attrVO.getAttributedatatype(), "text")); +// if (VciBaseUtil.getBoolean(attrVO.getTextareaflag())) { +// itemVO.setType("textarea"); +// } +// if (VciFieldTypeEnum.VTLong.name().equalsIgnoreCase(attrVO.getAttributedatatype()) +// || VciFieldTypeEnum.VTInteger.name().equalsIgnoreCase(attrVO.getAttributedatatype()) +// || VciFieldTypeEnum.VTDouble.name().equalsIgnoreCase(attrVO.getAttributedatatype())) { +// itemVO.setVerify("number"); +// } +// itemVO.setReadOnly(VciBaseUtil.getBoolean(attrVO.getReadonlyflag())); +// itemVO.setKeyAttr(VciBaseUtil.getBoolean(attrVO.getKeyattrflag())); +// itemVO.setRequired(VciBaseUtil.getBoolean(attrVO.getRequireflag())); +// itemVO.setDefaultValue(attrVO.getDefaultvalue()); +// itemVO.setDateFormate(attrVO.getCodedateformat()); +// itemVO.setHidden(!VciBaseUtil.getBoolean(attrVO.getFormdisplayflag())); +// itemVO.setVerify(attrVO.getVerifyrule()); +// itemVO.setPrefix(attrVO.getPrefixvalue()); +// itemVO.setSuffix(attrVO.getSuffixvalue()); +// itemVO.setTooltips(attrVO.getExplain()); +// itemVO.setSelectLibFlag(attrVO.getLibraryidentification()); +// //鐪嬬湅鏄惁鏈夋灇涓� +// if ((StringUtils.isNotBlank(attrVO.getEnumstring()) +// && !"[]".equalsIgnoreCase(attrVO.getEnumstring())) || +// StringUtils.isNotBlank(attrVO.getEnumid())) { +// itemVO.setType("combox"); +// itemVO.setComboxKey(attrVO.getEnumid()); +// if (StringUtils.isNotBlank(attrVO.getEnumstring())) { +// //鎸囧畾鐨勪笅鎷夋鍐呭 +// itemVO.setData(JSONObject.parseArray(attrVO.getEnumstring(), KeyValue.class)); +// if (StringUtils.isBlank(attrVO.getEnumid())) { +// itemVO.setComboxKey(itemVO.getField() + "_data"); +// } +// } +// } +// //鐪嬫槸鍚︽湁鍙傜収 +// if (StringUtils.isNotBlank(attrVO.getReferbtmid()) || StringUtils.isNotBlank(attrVO.getReferconfig())) { +// itemVO.setType("refer"); +// itemVO.setShowField(itemVO.getField() + "name"); +// if (StringUtils.isNotBlank(attrVO.getReferconfig())) { +// //閰嶇疆鐨勫唴瀹� +// itemVO.setReferConfig(JSONObject.parseObject(attrVO.getReferconfig(), UIFormReferVO.class)); +// } else { +// UIFormReferVO formReferVO = new UIFormReferVO(); +// formReferVO.setType("default"); +// formReferVO.setReferType(attrVO.getReferbtmid()); +// itemVO.setReferConfig(formReferVO); +// } +// } +// +// //濡傛灉鏄粍鍚堣鍒欙紝鍒嗙被娉ㄥ叆鐨勶紝鏄剧ず涓哄彧璇� +// if (StringUtils.isNotBlank(attrVO.getComponentrule())) { +// itemVO.setReadOnly(true); +// itemVO.setTooltips("鏈睘鎬т负缁勫悎瑙勫垯"); +// itemVO.setRequired(false); +// } +// if (StringUtils.isNotBlank(attrVO.getClassifyinvokeattr())) { +// itemVO.setReadOnly(!VciBaseUtil.getBoolean(attrVO.getClassifyinvokeeditflag())); +// itemVO.setTooltips("鏈睘鎬ф槸鍒嗙被娉ㄥ叆"); +// itemVO.setRequired(false); +// } +// +// if (VciQueryWrapperForDO.LC_STATUS_FIELD.equalsIgnoreCase(itemVO.getField())) { +// //鏄敓鍛藉懆鏈熺姸鎬� +// itemVO.setType("combox"); +// itemVO.setComboxKey(btmType + LC_STATUS_SUBFIX); +// } +// return itemVO; +// } +// +// +// /** +// * 灏佽鐩镐技椤规煡璇㈢殑鍒楄〃 +// * +// * @param templateVO 妯℃澘鐨勬樉绀哄璞� +// * @param uiInfoVO 椤甸潰鐨勪俊鎭� +// */ +// private void wrapperResemble(CodeClstemplateVO templateVO, MdmUIInfoVO uiInfoVO) { +// List<CodeClstempattrVO> resembleAttrList = templateVO.getAttributes().stream().filter(s -> VciBaseUtil.getBoolean(s.getSamerepeatattrflag()) +// || VciQueryWrapperForDO.ID_FIELD.equalsIgnoreCase(s.getId())).collect(Collectors.toList()); +// if (!CollectionUtils.isEmpty(resembleAttrList) && resembleAttrList.size() > 1) { +// UITableDefineVO resembleTable = new UITableDefineVO(); +// resembleTable.setOid(templateVO.getOid()); +// resembleTable.setBtmType(templateVO.getBtmTypeId()); +// resembleTable.setDisplayQueryArea(false); +// resembleTable.setPageVO(new UITablePageVO()); +// //澶勭悊鎵�鏈夌殑鍒楋紝杩欎釜妯℃澘娌℃湁鍚堝苟鐨勮〃澶寸殑鎯呭喌 +// List<UITableFieldVO> fieldVOList = new ArrayList<>(); +// resembleAttrList.forEach(attrVO -> { +// UITableFieldVO tableFieldVO = templateAttr2TableField(attrVO,false); +// tableFieldVO.setHidden(false); +// fieldVOList.add(tableFieldVO); +// }); +// List<List<UITableFieldVO>> cols = new ArrayList<>(); +// cols.add(fieldVOList); +// resembleTable.setCols(cols); +// uiInfoVO.setResembleTableVO(resembleTable); +// } +// } +// +// +// /** +// * 妯℃澘灞炴�ц浆鎹负琛ㄦ牸鏄剧ず鐨勯厤缃� +// * +// * @param attrVO 妯℃澘灞炴�� +// * @param forEdit 鏄惁鏄紪杈戞墍闇� +// * @return 琛ㄦ牸鐨勫瓧娈� +// */ +// @Override +// public UITableFieldVO templateAttr2TableField(CodeClstempattrVO attrVO,boolean forEdit) { +// UITableFieldVO fieldVO = new UITableFieldVO(); +// if (SECRET_FILED.equalsIgnoreCase(attrVO.getId())) { +// attrVO.setEnumid(MY_DATA_SECRET); +// } +// fieldVO.setField(attrVO.getId()); +// fieldVO.setTitle(attrVO.getName()); +// fieldVO.setFieldType(vciFieldTypeMap.getOrDefault(attrVO.getAttributedatatype(), "text")); +// fieldVO.setSort(true); +// fieldVO.setSortField(fieldVO.getField()); +// fieldVO.setQueryField(fieldVO.getField()); +// if (forEdit){ +// fieldVO.setHidden(!VciBaseUtil.getBoolean(attrVO.getFormdisplayflag())); +// }else { +// fieldVO.setHidden(!VciBaseUtil.getBoolean(attrVO.getTabledisplayflag())); +// } +// if (attrVO.getAttrtablewidth() != null && attrVO.getAttrtablewidth() > 0) { +// fieldVO.setMinWidth(Integer.valueOf(attrVO.getAttrtablewidth())); +// fieldVO.setWidth(Integer.valueOf(attrVO.getAttrtablewidth())); +// } +// //鐪嬬湅鏄惁鏈夋灇涓� +// if ((StringUtils.isNotBlank(attrVO.getEnumstring()) +// && !"[]".equalsIgnoreCase(attrVO.getEnumstring())) || +// StringUtils.isNotBlank(attrVO.getEnumid())) { +// fieldVO.setFieldType("combox"); +// fieldVO.setField(fieldVO.getField() + "Text"); +// fieldVO.setComboxKey(attrVO.getEnumid()); +// if (StringUtils.isNotBlank(attrVO.getEnumstring())) { +// //鎸囧畾鐨勪笅鎷夋鍐呭 +// fieldVO.setData(JSONObject.parseArray(attrVO.getEnumstring(), KeyValue.class)); +// if (StringUtils.isBlank(attrVO.getEnumid())) { +// fieldVO.setComboxKey(fieldVO.getField() + "_data"); +// } +// }else { +// List<KeyValue> osEnumItemVOList= enumService.getEnum(attrVO.getEnumid()); +// fieldVO.setData(osEnumItemVOList); +// } +// } +// //鐪嬫槸鍚︽湁鍙傜収 +// if (StringUtils.isNotBlank(attrVO.getReferbtmid()) || StringUtils.isNotBlank(attrVO.getReferconfig())) { +// fieldVO.setFieldType("refer"); +// fieldVO.setQueryField(fieldVO.getField()); +// fieldVO.setField(fieldVO.getField() + "name"); +// fieldVO.setShowField(fieldVO.getField()); +// if (StringUtils.isNotBlank(attrVO.getReferconfig())) { +// //閰嶇疆鐨勫唴瀹� +// fieldVO.setReferConfig(JSONObject.parseObject(attrVO.getReferconfig(), UIFormReferVO.class)); +// } else { +// UIFormReferVO formReferVO = new UIFormReferVO(); +// formReferVO.setType("default"); +// formReferVO.setReferType(attrVO.getReferbtmid()); +// fieldVO.setReferConfig(formReferVO); +// } +// } +// if (VciQueryWrapperForDO.LC_STATUS_FIELD.equalsIgnoreCase(fieldVO.getSortField())) { +// fieldVO.setField("lcstatus_text"); +// } +// Map<String, String> eventJsMap = new HashMap<>(); +// //瓒呴摼鎺ヤ笌妯℃澘鏄簰鏂� +// if (StringUtils.isNotBlank(attrVO.getTablehref())) { +// String event = fieldVO.getSortField() + "_href"; +// eventJsMap.put(event, attrVO.getTablehref()); +// fieldVO.setTemplet("function(d){ return '<a class=\"layui-btn layui-btn-intable \" lay-event=\"" + event + "\">d." + fieldVO.getField() + "</a>';}"); +// } +// if (StringUtils.isNotBlank(attrVO.getTabledisplayjs())) { +// //鐩存帴鍐檉unction(d){ return xxxxx;} +// fieldVO.setTemplet(attrVO.getTabledisplayjs()); +// } +// if (StringUtils.isBlank(fieldVO.getTemplet()) && VciFieldTypeEnum.VTBoolean.name().equalsIgnoreCase(attrVO.getAttributedatatype())) { +// fieldVO.setTemplet("function(d){return $webUtil.formateBoolean(d." + fieldVO.getField() + ");}"); +// } +// fieldVO.setOptionJsMap(eventJsMap); +// fieldVO.setStyle(attrVO.getTabledisplaystyle()); +// //鍒楄〃閲屼笉鍏佽鐩存帴缂栬緫 +// fieldVO.setDateFormate(attrVO.getCodedateformat()); +// return fieldVO; +// } +// +// +// /** +// * 鐩镐技椤规煡璇� +// * +// * @param orderDTO 缂栫爜鐨勭浉鍏充俊鎭� +// * @return 鏁版嵁鍒楄〃 +// */ +// @Override +// public DataGrid<Map<String, String>> resembleQuery(CodeOrderDTO orderDTO) { +// VciBaseUtil.alertNotNull(orderDTO, "鐢宠鐨勪俊鎭�", orderDTO.getCodeClassifyOid(), "鍒嗙被涓婚敭", orderDTO.getTemplateOid(), "妯℃澘涓婚敭"); +// CodeClassifyFullInfoBO fullInfoBO = classifyService.getClassifyFullInfo(orderDTO.getCodeClassifyOid()); +// CodeClassifyTemplateVO templateVO = templateService.getObjectHasAttrByOid(orderDTO.getTemplateOid()); +// switchClassifyLevelOnOrder(templateVO, fullInfoBO, orderDTO); +// switchDateAttrOnOrder(templateVO, orderDTO); +// switchComponentAttrOnOrder(templateVO, orderDTO); +// //闇�瑕佽幏鍙栨槸鍚︽湁鐩镐技鏌ヨ灞炴�� +// Map<String, CodeClassifyTemplateAttrVO> attrVOs = templateVO.getAttributes().stream().filter(s -> VciBaseUtil.getBoolean(s.getSamerepeatattrflag())).collect(Collectors.toMap(s -> s.getId(), t -> t)); +// if (CollectionUtils.isEmpty(attrVOs)) { +// //閮芥病鏈夊睘鎬э紝鑲畾涓嶈兘鏌ヨ浜� +// return new DataGrid<>(); +// } +// Map<String, String> conditionMap = new HashMap<>(); +// //鎴戜滑棣栧厛鑾峰彇鏈夋病鏈夋煡璇㈣鍒� +// CodeResembleRuleVO resembleRuleVO = Optional.ofNullable(getUseResembleRule(fullInfoBO, fullInfoBO.getCurrentClassifyVO())).orElseGet(() -> new CodeResembleRuleVO()); +// attrVOs.forEach((attrId, attrVO) -> { +// String value = getValueFromOrderDTO(orderDTO, attrId); +// if (value == null) { +// value = ""; +// } +// wrapperResembleConditionMap(value, resembleRuleVO, attrId, conditionMap); +// }); +// +// //娌℃湁闄愬埗鍒嗙被锛屼絾鏄竴涓ā鏉垮彧鍙兘鍦ㄤ竴涓笟鍔$被鍨嬮噷闈紝鎵�浠ョ洿鎺ユ煡璇㈣繖涓笟鍔$被鍨嬪嵆鍙� +// if (!CollectionUtils.isEmpty(conditionMap)) { +// Map<String, String> andConditionMap = new HashMap<>(); +// andConditionMap.put("islastr", "1"); +// andConditionMap.put("islastv", "1"); +// if (StringUtils.isNotBlank(orderDTO.getOid())) { +// andConditionMap.put("oid", QueryOptionConstant.NOTEQUAL + orderDTO.getOid()); +// } +// conditionMap.putAll(andConditionMap); +// PageHelper pageHelper = new PageHelper(-1); +// pageHelper.addDefaultDesc("id"); +// return queryGrid(fullInfoBO.getTopClassifyVO().getBtmtypeid(), templateVO, conditionMap, pageHelper); +// } +// return new DataGrid<>(); +// } +// +// /** +// * 鑾峰彇浣跨敤鐨勭浉浼兼煡璇㈣鍒� +// * +// * @param fullInfoBO 绫诲叏閮ㄤ俊鎭� +// * @param currentClassifyVO 褰撳墠鐨勫垎绫� +// * @return 瑙勫垯锛屽鏋滀笉瀛樺湪浼氳繑鍥濶ull +// */ +// @Override +// public CodeResembleRuleVO getUseResembleRule(CodeClassifyFullInfoBO fullInfoBO, CodeClassifyVO currentClassifyVO) { +// if (currentClassifyVO == null) { +// return null; +// } +// if (currentClassifyVO != null && StringUtils.isNotBlank(currentClassifyVO.getCodeResembleRuleOid())) { +// //璇存槑宸茬粡瀛樺湪 +// return resembleRuleService.getObjectByOid(currentClassifyVO.getCodeResembleRuleOid()); +// } +// if (StringUtils.isBlank(currentClassifyVO.getParentcodeclassifyoid())) { +// return null; +// } +// Map<String, CodeClassifyVO> classifyVOMap = fullInfoBO.getParentClassifyVOs().stream().collect(Collectors.toMap(s -> s.getOid(), t -> t)); +// return getUseResembleRule(fullInfoBO, classifyVOMap.getOrDefault(currentClassifyVO.getParentcodeclassifyoid(), null)); +// } +// +// /** +// * 灏佽鐩镐技椤规煡璇㈢殑鏌ヨ鏉′欢鐨勬槧灏� +// * +// * @param value 鍊� +// * @param resembleRuleVO 鐩镐技椤硅鍒� +// * @param attrId 灞炴�х殑缂栧彿 +// * @param conditionMap 鏌ヨ鏉′欢 +// */ +// @Override +// public void wrapperResembleConditionMap(String value, CodeResembleRuleVO resembleRuleVO, String attrId, Map<String, String> conditionMap) { +// boolean ignoreSpace = VciBaseUtil.getBoolean(resembleRuleVO.getIgnorespaceflag()) || VciBaseUtil.getBoolean(resembleRuleVO.getIgnoreallspaceflag()); +// if (StringUtils.isBlank(value)) { +// //涓虹┖鐨勬椂鍊欏氨涓嶆煡璇㈠畠灏辨槸 +// } else { +// String queryKey = ""; +// String queryValue = ""; +// boolean ignoreCase = VciBaseUtil.getBoolean(resembleRuleVO.getIgnorecaseflag()); +// boolean ignoreWidth = VciBaseUtil.getBoolean(resembleRuleVO.getIgnorewidthflag()); +// boolean trimAll = VciBaseUtil.getBoolean(resembleRuleVO.getIgnoreallspaceflag()); +// boolean trim = VciBaseUtil.getBoolean(resembleRuleVO.getIgnoreallspaceflag()); +// String temp = ""; +// if (ignoreCase && ignoreSpace && ignoreWidth) { +// //蹇界暐澶у皬鍐欙紝涓斿幓绌猴紝蹇界暐鍏ㄥ崐瑙� +// temp = (trimAll ? "REPLACE" : "TRIM") + "(UPPER(to_single_byte('%s')) " + (trimAll ? ",' ','')" : ")"); +// } else if (ignoreCase && ignoreSpace && !ignoreWidth) { +// //蹇界暐澶у皬鍐欍�佸幓绌恒�佷笉蹇界暐鍏ㄥ崐瑙� +// temp = (trimAll ? "REPLACE" : "TRIM") + "(UPPER(%s) " + (trimAll ? ",' ','')" : ")"); +// } else if (ignoreCase && !ignoreSpace && ignoreWidth) { +// //蹇界暐澶у皬鍐欍�佷笉鍘荤┖銆佸拷鐣ュ叏鍗婅 +// temp = "UPPER(to_single_byte('%s'))"; +// } else if (!ignoreCase && ignoreSpace && ignoreWidth) { +// //涓嶅拷鐣ュぇ灏忓啓銆佸幓绌恒�佸拷鐣ュ叏鍗婅 +// temp = (trimAll ? "REPLACE" : "TRIM") + "(to_single_byte('%s') " + (trimAll ? ",' ','')" : ")"); +// } else if (ignoreCase && !ignoreSpace && !ignoreWidth) { +// //蹇界暐澶у皬鍐欍�佷笉鍘荤┖銆佷笉蹇界暐鍏ㄥ崐瑙� +// temp = "UPPER(%s)"; +// } else if (!ignoreCase && !ignoreCase && ignoreWidth) { +// //涓嶅拷鐣ュぇ灏忓啓銆佷笉鍘荤┖銆佸拷鐣ュ叏鍗婅 +// temp = "to_single_byte('%s')"; +// } else if (!ignoreCase && ignoreSpace && !ignoreWidth) { +// //涓嶅拷鐣ュぇ灏忓啓銆佸幓绌恒�佷笉蹇界暐鍏ㄥ崐瑙� +// temp = (trimAll ? "REPLACE" : "TRIM") + "(%s " + (trimAll ? ",' ','')" : ")"); +// } else if (!ignoreCase && !ignoreSpace && !ignoreWidth) { +// //涓嶅拷鐣ュぇ灏忓啓銆佷笉鍘荤┖銆佷笉蹇界暐鍏ㄥ崐瑙� +// temp = "%s"; +// } +// if (StringUtils.isNotBlank(resembleRuleVO.getLinkCharacter())) { +// List<String> chars = VciBaseUtil.str2List(resembleRuleVO.getLinkCharacter()); +// for (int i = 0; i < chars.size(); i++) { +// String s = chars.get(i); +// temp = "replace(" + temp + ",'" + s + "','')"; +// } +// } +// queryValue = String.format(temp, (trim ? value.trim() : value)); +// temp = temp.replace("to_single_byte('%s')","to_single_byte(%s)"); +// queryKey = String.format(temp, "t."+attrId); +// conditionMap.put(queryKey, QueryOptionConstant.OR + queryValue); +// } +// } +// +// +// /** +// * 鏌ヨ缂栫爜鏁版嵁鐨勫垪琛� +// * +// * @param btmType 涓氬姟绫诲瀷 +// * @param templateVO 妯℃澘鐨勫璞★紝闇�瑕佸寘鍚ā鏉跨殑灞炴�� +// * @param conditionMap 鏌ヨ鏉′欢 +// * @param pageHelper 鍒嗛〉瀵硅薄 +// * @return 鏁版嵁鍒楄〃 +// */ +// @Override +// public DataGrid<Map<String, String>> queryGrid(String btmType, CodeClassifyTemplateVO templateVO, Map<String, String> conditionMap, PageHelper pageHelper) { +// CodeTemplateAttrSqlBO sqlBO = getSqlByTemplateVO(btmType, templateVO, conditionMap, pageHelper); +//// List<Map> maps = boService.queryByOnlySqlForMap(sqlBO.getSqlHasPage()); +// List<Map> maps = commonsMapper.selectBySql(sqlBO.getSqlHasPage()); +// DataGrid<Map<String, String>> dataGrid = new DataGrid<>(); +// List<Map<String, String>> dataList = new ArrayList<>(); +// if (!CollectionUtils.isEmpty(maps)) { +// maps.stream().forEach(map -> { +// Map<String, String> data = new HashMap<>(); +// map.forEach((key, value) -> { +// data.put(((String) key).toLowerCase(Locale.ROOT), (String) value); +// }); +// dataList.add(data); +// }); +// } +// dataGrid.setData(dataList); +// if (!CollectionUtils.isEmpty(dataList)) { +// wrapperData(dataGrid.getData(), templateVO, sqlBO.getSelectFieldList(), false); +// dataGrid.setTotal(Long.parseLong(commonsMapper.selectBySql(sqlBO.getSqlCount()).get(0).values().toArray()[0].toString());); +// } +// return dataGrid; +// } +// +// +// /** +// * 灏佽鏌ヨ鍑烘潵鐨勬暟鎹� +// * +// * @param dataMap 鏁版嵁鐨勬槧灏� +// * @param templateVO 妯℃澘鐨勫睘鎬� +// * @param onlySelectAttrIdList 浠呬粎鏌ヨ鐨勫睘鎬у瓧娈� +// * @param form 琛ㄥ崟閲屼娇鐢� +// */ +// @Override +// public void wrapperData(List<Map<String, String>> dataMap, CodeClassifyTemplateVO templateVO, +// Collection<String> onlySelectAttrIdList, boolean form) { +// if (onlySelectAttrIdList == null) { +// onlySelectAttrIdList = new ArrayList<>(); +// } +// //鍏堣浆鎹竴涓嬫椂闂存牸寮� +// List<String> finalOnlySelectAttrIdList = onlySelectAttrIdList.stream().collect(Collectors.toList()); +// List<CodeClassifyTemplateAttrVO> dateFormatAttrVOs = templateVO.getAttributes().stream().filter( +// s -> StringUtils.isNotBlank(s.getCodeDateFormat()) && +// (finalOnlySelectAttrIdList.size() == 0 || finalOnlySelectAttrIdList.contains(s.getId().toLowerCase(Locale.ROOT))) +// ).collect(Collectors.toList()); +// //鏋氫妇鐨勫唴瀹� +// List<CodeClassifyTemplateAttrVO> enumAttrVOs = templateVO.getAttributes().stream().filter( +// s -> (StringUtils.isNotBlank(s.getEnumId()) || StringUtils.isNotBlank(s.getEnumString())) +// && +// (finalOnlySelectAttrIdList.size() == 0 || finalOnlySelectAttrIdList.contains(s.getId().toLowerCase(Locale.ROOT))) +// ).collect(Collectors.toList()); +// +// List<String> userIds = new ArrayList<>(); +// dataMap.stream().forEach(data -> { +// //澶勭悊鏃堕棿 +// if (!form) { +// //琛ㄥ崟鐨勬椂鍊欏彧鑳界敤缁熶竴鐨勬椂闂存牸寮� +// wrapperDateFormat(dateFormatAttrVOs, data); +// } +// //澶勭悊鏋氫妇 +// wrapperEnum(enumAttrVOs, data); +// String lcstatus = data.get(VciQueryWrapperForDO.LC_STATUS_FIELD); +// String copyFromVersion = data.getOrDefault(COPY_FROM_VERSION,""); +// if ((CodeDefaultLC.EDITING.getValue().equalsIgnoreCase(lcstatus) || CodeDefaultLC.AUDITING.getValue().equalsIgnoreCase(lcstatus)) +// && StringUtils.isBlank(copyFromVersion) +// ) { +// data.put(VciQueryWrapperForDO.ID_FIELD, "******"); +// } +// data.put(VciQueryWrapperForDO.LC_STATUS_FIELD_TEXT.toLowerCase(Locale.ROOT), CodeDefaultLC.getTextByValue(lcstatus)); +// if(CodeDefaultLC.EDITING.getValue().equalsIgnoreCase(lcstatus) +// && StringUtils.isNotBlank(copyFromVersion)){ +// data.put(VciQueryWrapperForDO.LC_STATUS_FIELD_TEXT.toLowerCase(Locale.ROOT), "淇敼涓�"); +// } +// if (data.containsKey("creator")) { +// userIds.add(data.get("creator")); +// } +// if (data.containsKey("lastmodifier")) { +// userIds.add(data.get("lastmodifier")); +// } +// }); +// if (!CollectionUtils.isEmpty(userIds)) { +// Map<String, SmUserVO> userVOMap = Optional.ofNullable(userQueryService.listUserByUserIds(userIds)).orElseGet(() -> new ArrayList<>()).stream().collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t)); +// dataMap.stream().forEach(data -> { +// String creator = data.getOrDefault("creator", null); +// if (StringUtils.isNotBlank(creator) && userVOMap.containsKey(creator.toLowerCase(Locale.ROOT))) { +// data.put("creator", creator + "(" + userVOMap.get(creator.toLowerCase(Locale.ROOT)).getName() + ")"); +// } +// String lastmodifier = data.getOrDefault("lastmodifier", null); +// if (StringUtils.isNotBlank(lastmodifier) && userVOMap.containsKey(lastmodifier.toLowerCase(Locale.ROOT))) { +// data.put("lastmodifier", lastmodifier + "(" + userVOMap.get(lastmodifier.toLowerCase(Locale.ROOT)).getName() + ")"); +// } +// }); +// } +// } +// +// +// /** +// * 澶勭悊鏃堕棿鏍煎紡 +// * +// * @param dateFormatAttrVOs 鏃堕棿鏍煎紡鐨勫睘鎬� +// * @param data 褰撳墠琛屾暟鎹� +// */ +// private void wrapperDateFormat(Collection<CodeClassifyTemplateAttrVO> dateFormatAttrVOs, Map<String, String> data) { +// if (!CollectionUtils.isEmpty(dateFormatAttrVOs)) { +// dateFormatAttrVOs.stream().forEach(dateFormatAttrVO -> { +// String attrId = dateFormatAttrVO.getId().toLowerCase(Locale.ROOT); +// String oldValue = data.getOrDefault(attrId, null); +// if (StringUtils.isNotBlank(oldValue)) { +// DateConverter dateConverter = new DateConverter(); +// try { +// dateConverter.setAsText(oldValue); +// Date value = dateConverter.getValue(); +// if (value != null) { +// data.put(attrId, VciDateUtil.date2Str(value, dateFormatAttrVO.getCodeDateFormat())); +// } +// } catch (Throwable e) { +// //杞崲鍙兘鏈夐棶棰橈紝杩欏氨浣跨敤鍘熸湰瀛樺偍鐨勫�� +// } +// } +// }); +// } +// } +// +// +// /** +// * 澶勭悊鏋氫妇鐨勫唴瀹癸紝濡傛灉涓嶅湪鏋氫妇涓紝浼氳繑鍥炲師鏈殑鍊� +// * +// * @param enumAttrVOs 鏋氫妇灞炴�� +// * @param data 褰撳墠琛屾暟鎹� +// */ +// private void wrapperEnum(Collection<CodeClassifyTemplateAttrVO> enumAttrVOs, Map<String, String> data) { +// //澶勭悊鏋氫妇鐨勫唴瀹癸紝涓轰簡鍏煎浠ュ墠鐨勬暟鎹�,濡傛灉鏁版嵁涓嶈兘浣跨敤鏋氫妇杞崲鐨勮瘽锛岄偅杩樻槸鏄剧ず浠ュ墠鐨勫�� +// if (!CollectionUtils.isEmpty(enumAttrVOs)) { +// enumAttrVOs.stream().forEach(enumAttrVO -> { +// String attrId = enumAttrVO.getId().toLowerCase(Locale.ROOT); +// String oldValue = data.getOrDefault(attrId, null); +// if (StringUtils.isNotBlank(oldValue)) { +// List<KeyValue> comboxKVs = listComboboxItems(enumAttrVO); +// String newValue = oldValue; +// KeyValue keyValue = Optional.ofNullable(comboxKVs).orElseGet(() -> new ArrayList<>()).stream().filter(s -> s.getKey().equalsIgnoreCase(oldValue)).findFirst().orElseGet(() -> null); +// if (keyValue != null) { +// newValue = keyValue.getValue(); +// } +// data.put(attrId + "Text", newValue); +// } +// }); +// } +// } +// +// +// /** +// * 鏍规嵁妯℃澘灞炴�х敓鎴愮浉搴旂殑sql淇℃伅 +// * +// * @param btmType 涓氬姟绫诲瀷 +// * @param templateVO 妯℃澘鏄剧ず瀵硅薄锛屽繀椤诲寘鍚睘鎬� +// * @param conditionMap 鏌ヨ鏉′欢 +// * @param pageHelper 鍒嗛〉鍜屾帓搴忓璞� +// * @return sql鐨勭浉鍏充俊鎭� +// */ +// @Override +// public CodeTemplateAttrSqlBO getSqlByTemplateVO(String btmType, CodeClassifyTemplateVO templateVO, Map<String, String> conditionMap, PageHelper pageHelper) { +// //鍥犱负鍙傜収涓嶄竴瀹氭槸鍦ㄥ钩鍙扮殑灞炴�ф睜閲岄潰璁剧疆锛屾墍浠ユ垜浠緱闇�瑕佽嚜琛屽鐞� +// //鍙傝�僔ciQueryWrapper鏉ュ鐞� +// //1. 鎵惧埌鎵�鏈夌殑瀛楁锛� +// Map<String, CodeClassifyTemplateAttrVO> attrVOMap = templateVO.getAttributes().stream().collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t)); +// List<String> selectFieldList = attrVOMap.keySet().stream().collect(Collectors.toList()); +// +// //鎵�鏈夌殑鍙傜収鐨勫瓧娈� +// Map<String/**灞炴�у瓧娈�**/, String> joinTableList = new ConcurrentHashMap<>(); +// List<CodeClassifyTemplateAttrVO> referAttrVOs = templateVO.getAttributes().stream().filter( +// s -> StringUtils.isNotBlank(s.getReferBtmId()) || StringUtils.isNotBlank(s.getReferConfig()) +// ).collect(Collectors.toList()); +// Map<String/**鍙傜収鐨勫睘鎬�**/, String/**瀹為檯鐨勫瓧娈�**/> referFieldMap = new HashMap<>(); +// if (!CollectionUtils.isEmpty(referAttrVOs)) { +// referAttrVOs.parallelStream().forEach(attrVO -> { +// UIFormReferVO referVO = null; +// if (StringUtils.isNotBlank(attrVO.getReferConfig())) { +// referVO = JSONObject.parseObject(attrVO.getReferConfig(), UIFormReferVO.class); +// } else { +// referVO = new UIFormReferVO(); +// referVO.setReferType(attrVO.getReferBtmId()); +// referVO.setValueField(VciQueryWrapperForDO.OID_FIELD); +// referVO.setTextField("name"); +// } +// +// String referTable = VciBaseUtil.getTableName(referVO.getReferType()); +// String referTableNick = attrVO.getId() + "0"; +// String left = " left join " + referTable + " " + referTableNick + " on " + referTableNick + "." + referVO.getValueField() + " = t." + attrVO.getId(); +// joinTableList.put(attrVO.getId(), left); +// String referShowField = attrVO.getId() + "Name"; +// List<String> textFields = VciBaseUtil.str2List(referVO.getTextField()); +// String showFieldInSource = ""; +// if (textFields.contains("name")) { +// showFieldInSource = "name"; +// } else { +// showFieldInSource = textFields.get(0); +// } +// referFieldMap.put(attrVO.getId(), referTableNick + "." + showFieldInSource); +// selectFieldList.add(referTableNick + "." + showFieldInSource + " as " + referShowField); +// }); +// } +// Optional.ofNullable(attributeService.getDefaultAttributeVOMap()).orElseGet(() -> new HashMap<>()).keySet().stream().forEach(attrId -> { +// if (!selectFieldList.contains(attrId) && !"secretgrade".equalsIgnoreCase(attrId)) { +// selectFieldList.add(attrId); +// } +// }); +// if (!selectFieldList.contains(CODE_FIELD)) { +// selectFieldList.add(CODE_FIELD); +// } +// if (!selectFieldList.contains(CODE_CLASSIFY_OID_FIELD)) { +// selectFieldList.add(CODE_CLASSIFY_OID_FIELD); +// } +// if (!selectFieldList.contains(CODE_TEMPLATE_OID_FIELD)) { +// selectFieldList.add(CODE_TEMPLATE_OID_FIELD); +// } +// if (!selectFieldList.contains(CODE_FULL_PATH_FILED)) { +// selectFieldList.add(CODE_FULL_PATH_FILED); +// } +// +// //澶勭悊鏌ヨ鏉′欢 +// //TODO 楠岃瘉sql娉ㄥ叆 +// List<String> andSql = new ArrayList<>(); +// List<String> orSql = new ArrayList<>(); +// if (!CollectionUtils.isEmpty(conditionMap)) { +// Map<String, String> orConditionMap = new HashMap<>(); +// Map<String, String> andCondtionMap = new HashMap<>(); +// //鍏堝垎绂籵r鐨勬煡璇㈡潯浠讹紝鍙﹀褰撴煡璇㈡潯浠舵槸绌虹殑鏃跺�欎篃涓嶆煡璇� +// conditionMap.forEach((k, v) -> { +// if (StringUtils.isNotBlank(v)) { +// if (v.startsWith(QueryOptionConstant.OR)) { +// orConditionMap.put(k, v.substring(QueryOptionConstant.OR.length())); +// } else { +// andCondtionMap.put(k, v); +// } +// } +// }); +// +// andCondtionMap.forEach((k, v) -> { +// andSql.add(getConditionSql(k.toLowerCase(), v, referFieldMap, attrVOMap)); +// }); +// orConditionMap.forEach((k, v) -> { +// orSql.add(getConditionSql(k.toLowerCase(), v, referFieldMap, attrVOMap)); +// }); +// } +// //缁勫悎璧锋潵 +// StringBuilder andSb = new StringBuilder(); +// andSql.stream().forEach(s -> { +// andSb.append(s).append(SPACE).append(QueryOptionConstant.AND).append(SPACE); +// }); +// +// String andString = andSb.toString().trim(); +// String endWithSql = QueryOptionConstant.AND; +// if (andString.endsWith(endWithSql)) { +// andString = andString.substring(0, andString.length() - endWithSql.length()); +// } +// +// String orString = orSql.stream().collect(Collectors.joining(" or ")); +// String whereSql = ""; +// if (StringUtils.isNotBlank(orString)) { +// if (StringUtils.isBlank(andString)) { +// andString = " 1 = 1 "; +// } +// whereSql = SPACE + "(" + SPACE + andString + SPACE + ") and (" + SPACE + orString + SPACE + ")" + SPACE; +// } else { +// whereSql = andString + SPACE; +// } +// if (attrVOMap.keySet().contains("secretgrade")) { +// Integer userSecret = VciBaseUtil.getCurrentUserSecret(); +// if (userSecret == null || userSecret == 0) { +// userSecret = secretService.getMinUserSecret(); +// } +// whereSql += " and ( t.secretGrade <= " + userSecret + ") "; +// } +// String tableName = VciBaseUtil.getTableName(btmType); +// String sql = "select " + selectFieldList.stream().map(s -> (s.contains(".") ? s : ("t." + s))).collect(Collectors.joining(",")) +// + " from " + tableName + SPACE + "t" + SPACE +// + joinTableList.values().stream().collect(Collectors.joining(SPACE)) +// + (StringUtils.isBlank(whereSql) ? "" : " where ") + whereSql; +// if (pageHelper == null) { +// pageHelper = new PageHelper(-1); +// } +// //鐪嬬湅鎺掑簭 +// String orderSql = pageHelper.getOrderSql("t"); +// sql += (orderSql == null ? "" : orderSql); +// String whereSubfixForPage = " ) A where rownum < " + (pageHelper.getLimit() * pageHelper.getPage() + 1) + ") where RN >= " +// + (pageHelper.getLimit() * (pageHelper.getPage() - 1) + 1); +// String sqlHasPage = pageHelper.getLimit() > 0 ? ("select * from (select A.*,rownum RN from (" + sql + whereSubfixForPage) : sql; +// String sqlCount = "select count(1) from " + tableName + SPACE + "t" + SPACE + joinTableList.values().stream().collect(Collectors.joining(SPACE)) +// + (StringUtils.isBlank(whereSql) ? "" : " where ") + whereSql; +// CodeTemplateAttrSqlBO sqlBO = new CodeTemplateAttrSqlBO(); +// sqlBO.setTableName(tableName); +// sqlBO.setJoinTable(joinTableList); +// sqlBO.setNickName("t"); +//// sqlBO.setPageHelper(pageHelper); +// sqlBO.setSqlHasPage(sqlHasPage); +// sqlBO.setSqlCount(sqlCount); +// sqlBO.setSqlUnPage(sql); +// return sqlBO; +// } +// +// +// /** +// * 缁勫悎鏌ヨ鏉′欢鐨剆ql +// * +// * @param key 瀛楁 +// * @param value 鍚嶅瓧 +// * @param referFieldMap 鍙傜収鐨勫瓧娈� +// * @param attrVOMap 灞炴�х殑鏄犲皠 +// * @return Sql璇彞 +// */ +// private String getConditionSql(String key, String value, Map<String/**鍙傜収鐨勫睘鎬�**/, String/**瀹為檯鐨勫睘鎬�**/> referFieldMap, Map<String, CodeClassifyTemplateAttrVO> attrVOMap) { +// if (key.endsWith("_begin")) { +// //璇存槑鏄�>=鐨勩�傛垜浠渶瑕佸厛鑾峰彇涓�涓� +// String field = (key.substring(0, key.length() - 6).toLowerCase().trim()); +// if (referFieldMap.containsKey(field)) { +// //璇存槑杩樻槸鍙傜収閲岄潰鐨勶紝鎴戜滑榛樿杩欑鎯呭喌涓嬮兘鏄瓧绗︿覆鍚э紝鍥犱负鍙傜収鐨勫睘鎬т笉涓�瀹氱敤鐨勫钩鍙扮殑灞炴�ф睜閲岀殑锛屾墍浠ュぇ閮ㄥ垎鎯呭喌涓嬶紝鏄剧ず鐨勫睘鎬ч兘鏄瓧绗︿覆鍚� +// return referFieldMap.get(field) + SPACE + " >= '" + value + "'" + SPACE; +// } else { +// return (field.contains(".") ? "" : "t.") + field + SPACE + " >= " + getStringValueInWhere(value, field, attrVOMap); +// } +// } else if (key.endsWith("_end")) { +// //璇存槑鏄�<=鐨勩�傛垜浠渶瑕佸厛鑾峰彇涓�涓� +// String field = (key.substring(0, key.length() - 6).toLowerCase().trim()); +// if (referFieldMap.containsKey(field)) { +// //璇存槑杩樻槸鍙傜収閲岄潰鐨勶紝鎴戜滑榛樿杩欑鎯呭喌涓嬮兘鏄瓧绗︿覆鍚э紝鍥犱负鍙傜収鐨勫睘鎬т笉涓�瀹氱敤鐨勫钩鍙扮殑灞炴�ф睜閲岀殑锛屾墍浠ュぇ閮ㄥ垎鎯呭喌涓嬶紝鏄剧ず鐨勫睘鎬ч兘鏄瓧绗︿覆鍚� +// return referFieldMap.get(field) + SPACE + " <= '" + value + "'" + SPACE; +// } else { +// return (field.contains(".") ? "" : "t.") + field + SPACE + " <= " + getStringValueInWhere(field, value, attrVOMap); +// } +// } else { +// if (referFieldMap.containsKey(key)) { +// //璇存槑鏄弬鐓х殑锛屾垜浠弬鐓х殑鏌ヨ閮借涓烘槸瀛楃涓诧紝濡傛灉鏄椂闂存牸寮忕殑鏌ヨ鑲畾鏈夐棶棰橈紝 +// String selectKey = referFieldMap.get(key); +// return getSqlByValue(selectKey, value, null); +// } else { +// return getSqlByValue(key, value, attrVOMap); +// } +// } +// +// } +// +// /** +// * 鑾峰彇鏌ヨ鏉′欢涓殑鍊肩殑锛屽鐞嗕笉鍚岀殑绫诲瀷 +// * +// * @param value 鍊� +// * @param field 瀛楁鍚嶇О +// * @return 鏃ユ湡鎴栬�呮椂闂存牸寮忎細鍖呮嫭to_date锛屽瓧绗︿覆浼氬姞' +// */ +// private String getStringValueInWhere(String field, String value, Map<String, CodeClassifyTemplateAttrVO> attrVOMap) { +// if ((field.contains(".") && !field.toLowerCase(Locale.ROOT).startsWith("t.")) || attrVOMap == null +// || !field.replace("t.", "").matches(RegExpConstant.LETTER) || value.startsWith(ONLY)) { +// //璇存槑鍙兘鏄寚瀹氱殑鏌愪釜鏉′欢锛岀洿鎺ヨ繑鍥� +// if (value.startsWith(ONLY)) { +// value = value.replace(ONLY, ""); +// } +// if ((value.startsWith("(") && value.endsWith(")")) || (value.startsWith("'") && value.endsWith("'"))) { +// return value; +// } +// if (field.contains(".") && attrVOMap != null && attrVOMap.containsKey(field.split("\\.")[0].toLowerCase(Locale.ROOT))) { +// //鏄弬鐓� +// return "'" + value + "'"; +// } else { +// return value; +// } +// } else { +// //鐪嬬湅鏄笉鏄繖涓璞¢噷鐨勫睘鎬� +// if (attrVOMap.containsKey(field)) { +// VciFieldTypeEnum fieldTypeEnum = VciFieldTypeEnum.valueOf(attrVOMap.get(field).getAttributeDataType()); +// if ("ts".equalsIgnoreCase(field)) { +// return "to_timestamp('" + value + "', '" + DATETIME_FORMAT + ".ff')"; +// } +// DateConverter dateConverter = new DateConverter(); +// if (VciFieldTypeEnum.VTDateTime.equals(fieldTypeEnum)) { +// //瀹為檯涓婏紝鏁版嵁搴撻兘鏄痶imestamp鐨勭被鍨�. +// dateConverter.setAsText(value); +// return "to_date('" + dateConverter.getAsText(VciDateUtil.DateTimeFormat) + "','" + DATETIME_FORMAT + "')"; +// } else if (VciFieldTypeEnum.VTDate.equals(fieldTypeEnum)) { +// dateConverter.setAsText(value); +// return "to_date('" + dateConverter.getAsText(VciDateUtil.DateFormat) + "','" + DATE_FORMAT + "')"; +// } else if (VciFieldTypeEnum.VTDouble.equals(fieldTypeEnum) +// || VciFieldTypeEnum.VTLong.equals(fieldTypeEnum) +// || VciFieldTypeEnum.VTInteger.equals(fieldTypeEnum)) { +// return value; +// } else { +// return "'" + value + "'"; +// } +// } else { +// if ((value.startsWith("(") && value.endsWith(")")) || (value.startsWith("'") && value.endsWith("'"))) { +// return value; +// } +// return "'" + value + "'"; +// } +// } +// +// } +// +// /** +// * 灏佽鏈�缁堢殑sql璇彞涓殑鍊奸儴鍒� +// * +// * @param selectKey 鏌ヨ鐨勫瓧娈� +// * @param value 鍊� +// * @param attrVOMap 灞炴�х殑鏄剧ず瀵硅薄鏄犲皠 +// * @return sql閲岀殑鍊� +// */ +// private String getSqlByValue(String selectKey, String value, Map<String, CodeClassifyTemplateAttrVO> attrVOMap) { +// StringBuilder sql = new StringBuilder(); +// if (!selectKey.contains(".") && (attrVOMap.containsKey(selectKey.toLowerCase(Locale.ROOT)) || attributeService.isDefaultAttr(selectKey) || selectKey.matches(RegExpConstant.LETTER))) { +// sql.append("t."); +// } +// if (value.startsWith(QueryOptionConstant.IN)) { +// sql.append(selectKey) +// .append(SPACE) +// .append("in") +// .append(SPACE) +// .append("(") +// .append(value.replace(QueryOptionConstant.IN, "")) +// .append(")"); +// } else if (value.startsWith(QueryOptionConstant.NOTIN)) { +// sql.append(selectKey) +// .append(SPACE) +// .append("not in") +// .append(SPACE) +// .append("(") +// .append(value.replace(QueryOptionConstant.NOTIN, "")) +// .append(")"); +// } else if (value.startsWith(QueryOptionConstant.NOTEQUAL)) { +// value = value.replace(QueryOptionConstant.NOTEQUAL, ""); +// value = getStringValueInWhere(selectKey, value, attrVOMap); +// sql.append(selectKey) +// .append(SPACE) +// .append(QueryOptionConstant.NOTEQUAL) +// .append(SPACE) +// .append(value); +// } else if (value.startsWith(QueryOptionConstant.MORETHAN)) { +// value = value.replace(QueryOptionConstant.MORETHAN, ""); +// value = getStringValueInWhere(selectKey, value, attrVOMap); +// sql.append(selectKey) +// .append(SPACE) +// .append(QueryOptionConstant.MORETHAN) +// .append(SPACE) +// .append(value); +// } else if (value.startsWith(QueryOptionConstant.MORE)) { +// value = value.replace(QueryOptionConstant.MORE, ""); +// value = getStringValueInWhere(selectKey, value, attrVOMap); +// sql.append(selectKey) +// .append(SPACE) +// .append(QueryOptionConstant.MORE) +// .append(SPACE) +// .append(value); +// } else if (value.startsWith(QueryOptionConstant.LESSTHAN)) { +// value = value.replace(QueryOptionConstant.LESSTHAN, ""); +// value = getStringValueInWhere(selectKey, value, attrVOMap); +// +// sql.append(selectKey) +// .append(SPACE) +// .append(QueryOptionConstant.LESSTHAN) +// .append(SPACE) +// .append(value); +// } else if (value.startsWith(QueryOptionConstant.LESS)) { +// value = value.replace(QueryOptionConstant.LESS, ""); +// value = getStringValueInWhere(selectKey, value, attrVOMap); +// +// sql.append(selectKey) +// .append(SPACE) +// .append(QueryOptionConstant.LESS) +// .append(SPACE) +// .append(value); +// } else if (value.startsWith(QueryOptionConstant.ISNOTNULL)) { +// sql.append(selectKey) +// .append(SPACE) +// .append(" is not null"); +// } else if (value.startsWith(QueryOptionConstant.ISNULL)) { +// sql.append(selectKey) +// .append(SPACE) +// .append(" is null"); +// } else if (value.contains("*")) { +// //璇存槑鏄痩ike锛屾垨鑰卨efe like ,right like +// value = getStringValueInWhere(selectKey, value, attrVOMap); +// sql.append(selectKey) +// .append(SPACE) +// .append("like") +// .append(SPACE) +// // .append("'") +// .append(value.replace("*", "%")) +// // .append("'") +// .append(SPACE); +// } else { +// value= value.replace(SPECIAL_CHAR,REQUIRED_CHAR); +// value = getStringValueInWhere(selectKey, value, attrVOMap); +// +// sql.append(selectKey) +// .append(SPACE) +// .append(QueryOptionConstant.EQUAL) +// .append(SPACE) +// .append(value); +// } +// sql.append(SPACE); +// return sql.toString(); +// } +// +// /** +// * 淇敼涓婚搴撴暟鎹� +// * +// * @param orderDTO 鏁版嵁鐨勫唴瀹癸紝涓嶇敤鍖呭惈鐮佹鐨勫唴瀹逛簡 +// */ +// @Override +// public void editSaveCode(CodeOrderDTO orderDTO) { +// VciBaseUtil.alertNotNull(orderDTO, "缂栫爜鐢宠鐩稿叧鐨勫睘鎬х殑鍐呭閮戒负绌�", orderDTO.getOid(), "鏁版嵁涓婚敭", +// orderDTO.getCodeClassifyOid(), "涓婚搴撳垎绫荤殑涓婚敭"); +//// CodeClassifyFullInfoBO classifyFullInfo = classifyService.getClassifyFullInfo(orderDTO.getCodeClassifyOid()); +// CodeClassifyFullInfoBO classifyFullInfo = classifyService.getClassifyFullInfo(orderDTO.getCodeClassifyOid()); +// //鎵句笟鍔$被鍨嬶紝鐒跺悗浣跨敤涓婚敭鍘昏幏鍙栨暟鎹簱閲岀殑鏁版嵁 +//// List<ClientBusinessObject> cbos = boService.queryCBO(classifyFullInfo.getTopClassifyVO().getBtmtypeid(), WebUtil.getOidQuery(orderDTO.getOid())); +// +// QueryWrapper<CodeOsbtmtypeEntity> btmWrapper = new QueryWrapper<>(); +// btmWrapper.eq("OID",orderDTO.getOid()); +// CodeWupinEntity cbo = codeOsbtmtypeMapper.selectOne(btmWrapper); +// +//// CodeClstemplateVO templateVO = templateService.getObjectHasAttrByOid(orderDTO.getTemplateOid()); +//// CodeRuleVO ruleVO = ruleService.getObjectHasSecByOid(orderDTO.getCodeRuleOid()); +// +// if (cbo != null) { +// throw new VciBaseException(DATA_OID_NOT_EXIST); +// } +//// ClientBusinessObject cbo = cbos.get(0); +// if (!cbo.getTs().toString().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()); +// try { +// cbo.setDescription(orderDTO.getDescription()); +// cbo.setName(orderDTO.getName()); +////// cbo.setAttributeValueWithNoCheck("description", orderDTO.getDescription()); +//// cbo.setAttributeValue("name", orderDTO.getName()); +// } catch (Exception e) { +// e.printStackTrace(); +// } +// +// +// List<CodeWupinEntity> cboList = new ArrayList<>(); +// +// //澶囨敞 +// cbo.setDescription(orderDTO.getDescription()); +// cboList.add(cbo); +//// +//// cboList.add(cbo); +// List<String> codeList = productCodeService.productCodeAndSaveData(classifyFullInfo, templateVO, ruleVO, orderDTO.getSecDTOList(),cboList); +// +// +// List<String> charList = new ArrayList<>(); +// for (CodeWupinEntity wupinEntity : cboList) { +// charList.add(wupinEntity.getId()); +// } +// batchSaveSelectChar(templateVO, charList); +// return codeList.size() > 0 ? codeList.get(0) : ""; +// +// +// +// +// //淇敼鐨勬椂鍊欙紝缂栫爜鏄笉鍙樼殑 +//// BatchCBO batchCBO = new BatchCBO(); +//// batchCBO.getUpdateCbos().add(cbo); +//// List<ClientBusinessObject> cboList = new ArrayList<>(); +//// cboList.add(cbo); +//// boService.persistenceBatch(batchCBO); +// batchSaveSelectChar(templateVO, cboList); +// } + +} -- Gitblit v1.9.3