From bd8c4d0191879275492ab70798b9be267dc9f5b8 Mon Sep 17 00:00:00 2001
From: lihang <lihang@vci-tech.com>
Date: 星期五, 12 五月 2023 17:00:53 +0800
Subject: [PATCH] 业务类型新增按钮
---
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmEngineServiceImpl.java | 420 +++++++++++++++++++++++++++++++----------------------------
1 files changed, 221 insertions(+), 199 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 0f9d00c..d5dbbc5 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
@@ -3,32 +3,28 @@
import com.alibaba.fastjson.JSONObject;
import com.alibaba.nacos.common.utils.StringUtils;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.sun.corba.se.impl.orbutil.ObjectUtility;
import com.vci.ubcs.code.bo.CodeClassifyFullInfoBO;
import com.vci.ubcs.code.dto.CodeOrderDTO;
import com.vci.ubcs.code.dto.datapush.BaseModelDTO;
import com.vci.ubcs.code.entity.CodeAllCode;
import com.vci.ubcs.code.entity.CodeOsbtmtypeEntity;
-import com.vci.ubcs.code.entity.CodeRule;
import com.vci.ubcs.code.entity.CodeWupinEntity;
import com.vci.ubcs.code.enumpack.CodeDefaultLC;
import com.vci.ubcs.code.enumpack.CodeLevelTypeEnum;
import com.vci.ubcs.code.enumpack.CodeSecTypeEnum;
import com.vci.ubcs.code.mapper.CodeAllCodeMapper;
import com.vci.ubcs.code.mapper.CodeOsbtmtypeMapper;
-import com.vci.ubcs.code.mapper.CodeRuleMapper;
+import com.vci.ubcs.code.mapper.CommonsMapper;
import com.vci.ubcs.code.service.*;
import com.vci.ubcs.code.vo.CodeClstempattrVO;
import com.vci.ubcs.code.vo.CodeClstemplateVO;
import com.vci.ubcs.code.vo.CodeKeyattrrepeatVO;
import com.vci.ubcs.code.vo.pagemodel.CodeBasicSecVO;
+import com.vci.ubcs.code.vo.pagemodel.CodeClassifyTemplateAttrVO;
import com.vci.ubcs.code.vo.pagemodel.CodeClassifyVO;
import com.vci.ubcs.code.vo.pagemodel.CodeRuleVO;
-import com.vci.ubcs.omd.entity.Dict;
import com.vci.ubcs.starter.exception.VciBaseException;
-import com.vci.ubcs.starter.revision.model.BaseModel;
import com.vci.ubcs.starter.web.enumpck.UserSecretEnum;
import com.vci.ubcs.starter.web.pagemodel.KeyValue;
import com.vci.ubcs.starter.web.toolmodel.DateConverter;
@@ -40,7 +36,6 @@
import com.vci.ubcs.system.feign.IDictBizClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springblade.core.mp.support.Query;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
import org.springframework.beans.BeanUtils;
@@ -50,7 +45,6 @@
import javax.annotation.Resource;
import java.util.*;
-import java.util.concurrent.CopyOnWriteArrayList;
import java.util.stream.Collectors;
/**
@@ -97,6 +91,17 @@
private ICodeClassifyService classifyService;
/**
+ * 鍏紡鐨勬湇鍔�
+ */
+ @Autowired
+ private FormulaServiceImpl formulaService;
+
+ /**
+ * 閫氱敤鏌ヨ
+ */
+ @Resource
+ CommonsMapper commonsMapper;
+ /**
* 鍏抽敭灞炴�х殑閰嶇疆
*/
@Autowired
@@ -142,15 +147,15 @@
* @return 涓嬫媺閫夐」
*/
@Override
- public List<KeyValue> listComboboxItems(CodeClstempattrVO attrVO) {
+ public List<KeyValue> listComboboxItems(CodeClassifyTemplateAttrVO attrVO) {
List<KeyValue> comboboxKVs = null;
- if (StringUtils.isNotBlank(attrVO.getEnumstring())) {
- comboboxKVs = JSONObject.parseArray(attrVO.getEnumstring(), KeyValue.class);
+ 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());
+ R<List<DictBiz>> list = iDictBizClient.getList(attrVO.getEnumId());
if(list.isSuccess()){
for (DictBiz datum : list.getData()) {
KeyValue keyValue = new KeyValue();
@@ -187,14 +192,14 @@
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 {
+ 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());
}
@@ -230,23 +235,30 @@
switchDateAttrOnOrder(templateVO, orderDTO);
//9.鐢熸垚缂栫爜鐨勪俊鎭�
// ClientBusinessObject cbo = boService.createCBOByBtmName(classifyFullInfo.getTopClassifyVO().getBtmtypeid());
-// CodeWupinEntity cbo = createCBOByBtmName(classifyFullInfo.getTopClassifyVO().getBtmtypeid());
+ CodeWupinEntity cbo = createCBOByBtmName(classifyFullInfo.getTopClassifyVO().getBtmtypeid());
// //榛樿鐨勫睘鎬ч兘涓嶇敤浠庡墠绔嫹璐�
// //璁剧疆缂栫爜闇�瑕佺殑榛樿灞炴�х殑鍐呭
-// copyValueToCBO(classifyFullInfo, cbo, orderDTO, templateVO, false);
+ copyValueToCBO(classifyFullInfo, cbo, orderDTO, templateVO, false);
// //TODO:鍥犱负榛樿鐨勫睘鎬ч兘涓嶆嫹璐濓紝鐩墠闆嗗洟鐮佸彨name锛屽苟娌℃湁浠嶥TO鎷疯礉鍒癱bo閲屻�傚鍔犱竴涓崟鐙鐞嗭紝浠ュ悗鍐嶇湅瑕佷笉瑕佽皟鏁�
-// cbo.setName(orderDTO.getName() == null ? "" : orderDTO.getName());
+ cbo.setName(orderDTO.getName() == null ? "" : orderDTO.getName());
// //end -- modify by lihang @20220407
-// List<CodeWupinEntity> cboList = new ArrayList<>();
-//
-// //澶囨敞
-// cbo.setDescription(orderDTO.getDescription());
+ 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);
-//// batchSaveSelectChar(templateVO, cboList);
-// return codeList.size() > 0 ? codeList.get(0) : "";
- return null;
+ 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;
}
/**
@@ -257,8 +269,8 @@
* @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())
+ Map<String,CodeClassifyTemplateAttrVO> 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) {
//闇�瑕侀噸鏂版煡璇竴涓嬶紝鍥犱负杩欎釜鏄寚瀹氱殑鍒嗙被杩涙潵鐨�
@@ -269,11 +281,11 @@
//鍒嗙被娉ㄥ叆鐨勭紪鍙锋垨鑰呭悕绉帮紝
//灞傜骇鍖呭惈鎸囧畾灞傚拰鏈�灏忓眰
CodeClassifyVO classifyVO = null;
- if (!CodeLevelTypeEnum.MIN.getValue().equalsIgnoreCase(attrVO.getClassifyinvokelevel()) && !"min".equalsIgnoreCase(attrVO.getClassifyinvokelevel())) {
+ 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());
+ int level = VciBaseUtil.getInt(attrVO.getClassifyInvokeLevel());
if (classifyVOS.size() >= level && level > 0) {
classifyVO = classifyVOS.get(level - 1);
}
@@ -283,11 +295,11 @@
}
if (classifyVO == null) {
//璇存槑灞傜骇鏈夎
- orderDTO.getData().put(attrId, "鍒嗙被鏍戜笂娌℃湁灞傜骇[" + attrVO.getClassifyinvokelevel() + "]");
+ orderDTO.getData().put(attrId, "鍒嗙被鏍戜笂娌℃湁灞傜骇[" + attrVO.getClassifyInvokeLevel() + "]");
// classifyVO = classifyFullInfoBO.getCurrentClassifyVO();
} else {
Map<String, String> classifyDataMap = VciBaseUtil.objectToMapString(classifyVO);
- String value = classifyDataMap.getOrDefault(attrVO.getClassifyinvokeattr(), "");
+ String value = classifyDataMap.getOrDefault(attrVO.getClassifyInvokeAttr(), "");
orderDTO.getData().put(attrId, value);
}
});
@@ -328,9 +340,9 @@
* @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()))
+ Map<String, CodeClassifyTemplateAttrVO> 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) -> {
@@ -369,7 +381,7 @@
* @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));
+ Map<String, CodeClassifyTemplateAttrVO> 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);
@@ -381,7 +393,7 @@
}
dataLowMap.putAll(orderDTO.getData());
compAttrVOMap.forEach((attrId, attrVO) -> {
-// dataLowMap.put(attrId, formulaService.getValueByFormula(dataLowMap, attrVO.getComponentrule()));
+ dataLowMap.put(attrId, formulaService.getValueByFormula(dataLowMap, attrVO.getComponentRule()));
});
dataLowMap.forEach((key, value) -> {
setValueToOrderDTO(orderDTO, key, value);
@@ -413,11 +425,11 @@
* @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));
+ Map<String, CodeClassifyTemplateAttrVO> 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())) {
+ if (StringUtils.isNotBlank(value) && !value.matches(attrVO.getVerifyRule())) {
//鏍¢獙姝e垯琛ㄨ揪寮�
throw new VciBaseException("灞炴�{0}]鐨勫�间笉绗﹀悎鏍¢獙瑙勫垯鐨勮姹�", new String[]{attrVO.getName()});
}
@@ -437,7 +449,7 @@
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, CodeClassifyTemplateAttrVO> 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());
//鍏ㄩ儴鍘荤┖鐨勪紭鍏堢骇澶т簬鍘荤┖
@@ -449,29 +461,30 @@
if (value == null) {
value = "";
}
-// wrapperKeyAttrConditionMap(value, keyRuleVO, attrId, trim, ignoreCase, ignoreWidth, trimAll, conditionMap);
+ 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 (!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) {
-// String ruleInfoMsg = keyRuleVO == null ? "" : "鏌ヨ瑙勫垯锛氬幓闄ょ┖鏍�--{0},蹇界暐澶у皬鍐�--{1},蹇界暐鍏ㄥ崐瑙�--{2},蹇界暐鍏ㄩ儴绌烘牸--{3}";
-// String[] objs = new String[]{trim ? "鏄�" : "鍚�", ignoreCase ? "鏄�" : "鍚�", ignoreWidth ? "鏄�" : "鍚�", trimAll ? "鏄�" : "鍚�"};
-// throw new VciBaseException("鏍规嵁鎮ㄥ~鍐欑殑鍏抽敭灞炴�х殑鍐呭锛岀粨鍚堝叧閿睘鎬ф煡璇㈣鍒欙紝鍙戠幇杩欎釜鏁版嵁宸茬粡鍦ㄧ郴缁熶腑瀛樺湪浜嗐�傝淇!銆�" + ruleInfoMsg, objs);
-// }
-// }
+ 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);
+ }
+ }
}
/**
@@ -486,54 +499,54 @@
* @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);
-// }
-// }
-// }
+ @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);
+ }
+ }
+ }
/**
* 鏍¢獙鏋氫妇鐨勫唴瀹�
@@ -544,7 +557,7 @@
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));
+ Map<String, CodeClassifyTemplateAttrVO> 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);
@@ -566,7 +579,7 @@
* @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));
+ Map<String, CodeClassifyTemplateAttrVO> 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);
@@ -660,77 +673,77 @@
* @return CodeWupinEntity
* @throws VciBaseException 鍒濆鍖栧嚭閿欑殑鏄細鎶涘嚭寮傚父
*/
-// @Override
-// public CodeWupinEntity createCBOByBtmName(String btmName)
-// throws VciBaseException {
-// if(btmName!=null){
-// btmName = btmName.trim().toLowerCase();
+ @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});
+// }
// }
-// 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;
-// }
+// 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;
+ }
/**
* 鏄惁涓轰慨鏀瑰拷鐣ョ殑灞炴��
@@ -753,27 +766,36 @@
* @param templateVO 妯℃澘鐨勫璞�
* @param cboList 鏁版嵁鐨勫唴瀹�
*/
-// @Override
-// public void batchSaveSelectChar(CodeClstemplateVO templateVO, List<ClientBusinessObject> 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 = new CopyOnWriteArrayList<>();
+ @Override
+ public void batchSaveSelectChar(CodeClstemplateVO templateVO, /*List<ClientBusinessObject> cboList*/
+ List<String> cboList) {
+ if (templateVO != null && !CollectionUtils.isEmpty(cboList)) {
+ //鏄紓姝ョ殑锛屾墍浠ョ洿鎺ュ惊鐜�
+ List<CodeClassifyTemplateAttrVO> 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.getAttributeValue(attrVO.getId());
+// String value = cbo.get.getAttributeValue(attrVO.getId());
// if (StringUtils.isNotBlank(value)) {
// valuesList.add(value);
// }
// });
-// if (!CollectionUtils.isEmpty(valuesList)) {
+ 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);
-// }
-// });
-// }
-// }
-// }
+ }
+ });
+ }
+ }
+ }
}
--
Gitblit v1.10.0