From f1338e26eaf421a1e5f90d406af093f3616861b6 Mon Sep 17 00:00:00 2001
From: ludc
Date: 星期一, 25 九月 2023 09:47:08 +0800
Subject: [PATCH] 代码打包
---
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmEngineServiceImpl.java | 142 +++++++++++++++++++++++++++++++++++++----------
1 files changed, 111 insertions(+), 31 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 eaca080..0a3fb50 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
@@ -5,6 +5,7 @@
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.vci.ubcs.code.applyjtcodeservice.vo.BaseModelVO;
import com.vci.ubcs.code.bo.CodeClassifyFullInfoBO;
import com.vci.ubcs.code.bo.CodeTemplateAttrSqlBO;
import com.vci.ubcs.code.constant.FrameWorkDefaultValueConstant;
@@ -15,11 +16,13 @@
import com.vci.ubcs.code.enumpack.*;
import com.vci.ubcs.code.mapper.CommonsMapper;
import com.vci.ubcs.code.service.*;
+import com.vci.ubcs.code.util.ClientBusinessObject;
import com.vci.ubcs.code.vo.CodeKeyAttrRepeatVO;
import com.vci.ubcs.code.vo.CodeReferConfigVO;
import com.vci.ubcs.code.vo.pagemodel.UITableFieldVO;
import com.vci.ubcs.code.vo.pagemodel.UITablePageVO;
import com.vci.ubcs.code.vo.pagemodel.*;
+import com.vci.ubcs.code.wrapper.BaseMdodelWrapper;
import com.vci.ubcs.flow.core.dto.FlowStatusDTO;
import com.vci.ubcs.flow.core.feign.IMDMIFlowAttrClient;
import com.vci.ubcs.flow.core.vo.ProcessStageAttrVO;
@@ -54,6 +57,7 @@
import com.vci.ubcs.system.user.feign.IUserClient;
import net.logstash.logback.encoder.org.apache.commons.lang3.StringUtils;
import oracle.sql.TIMESTAMP;
+import org.aspectj.apache.bcel.classfile.Code;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springblade.core.cache.utils.CacheUtil;
@@ -435,18 +439,11 @@
//澶囨敞
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 (BaseModel baseModel : cboList) {
-// charList.add(baseModel.getId());
-// }
batchSaveSelectChar(templateVO, cboList);
return codeList.size() > 0 ? codeList.get(0) : "";
-// return null;
}
/**
@@ -471,7 +468,7 @@
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());
+ 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);
@@ -751,7 +748,29 @@
return dataList;
}
- /**
+ /**
+ * 鏍规嵁褰撳墠鐢宠缂栫爜鐨勫垎绫伙紝閫愬眰寰�涓婃牎楠屾槸鍚︾鍚堝睘浜庨厤缃殑涓殑鍒嗙被瀛愯妭鐐圭殑鍒�
+ * 绫伙紝濡傛灉绗﹀悎锛屽垯璇ュ垎绫荤敵璇风殑缂栫爜涓洪泦鍥㈢爜杩斿洖true锛屽弽涔嬪垯涓轰紒涓氱紪鐮佽繑鍥瀎alse
+ * @param parameter 浼犲叆鏁版嵁,classifyGroupCode:閰嶇疆鐨勪腑鐨勫垎绫婚《鑺傜偣锛宱id锛氶�夋嫨鑺傜偣鐨刼id
+ */
+ @Override
+ public R checkGroupCode(Map<String, String> parameter) {
+ List<CodeClassify> codeClassifyList = classifyService.selectAllLevelParentByOid(parameter.get("oid"));
+ Set<String> configGroupCode = Arrays.stream(parameter.get("classifyGroupCode").split("#")).collect(Collectors.toSet());
+// Boolean checkGroupFlag = false;//鏄惁鏌ヨ鍒伴厤缃殑椤跺眰鍒嗙被涓�
+ for (int i = codeClassifyList.size()-1; i >= 0; i--) {
+ if(configGroupCode.contains(codeClassifyList.get(i).getId())){
+// checkGroupFlag = true;
+ return R.data("true");
+ }
+// if(checkGroupFlag && parameter.get("nowApplyCode").equals(codeClassifyList.get(i).getId())){
+// return R.data(true);
+// }
+ }
+ return R.data("false");
+ }
+
+ /**
* 灏佽鍏抽敭灞炴�х殑鏌ヨ璇彞
*
* @param value 褰撳墠鐨勫��
@@ -1370,6 +1389,9 @@
uiTableConfigVO.setQueryColumns(queryColumns);
//set缁欒〃鏍奸厤缃睘鎬�
uiFormReferVO.setTableConfig(uiTableConfigVO);
+ //瀛楁鍚嶄笉涓�鑷达紝闇�瑕佹墜鍔╯et
+ uiFormReferVO.setMuti(Func.toBoolean(codeReferConfig.getIsMuti()));
+ uiFormReferVO.setInitSort(new UIFieldSortVO(codeReferConfig.getSortField(),codeReferConfig.getSortType()));
// 绛涢�夋潯浠�
HashMap<String, String> whereMap = new HashMap<>();
if(!CollectionUtils.isEmpty(codeReferConfig.getCodeSrchCondConfigVOS())){
@@ -2413,7 +2435,6 @@
return phaseAttrService.listAttrByTemplateOidAndPhaseId(templateVO.getOid(), phase);
}
-
/**
* 璺緞涓婂寘鍚綋鍓嶅垎绫荤殑鎵�鏈夊垎绫讳俊鎭�
*
@@ -2761,13 +2782,13 @@
CodeSecTypeEnum.CODE_FIXED_SEC.getValue(),
CodeSecTypeEnum.CODE_VARIABLE_SEC.getValue(),
CodeSecTypeEnum.CODE_CLASSIFY_SEC.getValue(),
- CodeSecTypeEnum.CODE_REFER_SEC.getValue()
+ CodeSecTypeEnum.CODE_REFER_SEC.getValue(),
+ CodeSecTypeEnum.CODE_DATE_SEC.getValue()
);
// 鍙鐮佹绫诲瀷
List<String> readOnlyTypes = Arrays.asList(
CodeSecTypeEnum.CODE_LEVEL_SEC.getValue(),
- CodeSecTypeEnum.CODE_ATTR_SEC.getValue(),
- CodeSecTypeEnum.CODE_DATE_SEC.getValue()
+ CodeSecTypeEnum.CODE_ATTR_SEC.getValue()
);
// 闅愯棌鐮佹绫诲瀷
/*List<String> hideType = Arrays.asList(
@@ -2784,7 +2805,7 @@
// 鏃ユ湡鐮佹璁剧疆榛樿鍊�
if (secVO.getSecType().equals(CodeSecTypeEnum.CODE_DATE_SEC.getValue())) {
try {
- secVO.setCodeDateFormatStr(Func.format(new Date(),secVO.getCodeDateFormatStr()));
+ secVO.setCodeDateValue(Func.format(new Date(),secVO.getCodeDateFormatStr()));
}catch (Exception e){
throw new ServiceException("鏃ユ湡鐮佹鏃ユ湡鏍煎紡閰嶇疆鏈夎锛屽鑷磋浆鎹㈠嚭閿欙細"+e.getMessage());
}
@@ -2802,7 +2823,7 @@
// 鏃ユ湡鐮佹璁剧疆榛樿鍊�
if (secVO.getSecType().equals(CodeSecTypeEnum.CODE_DATE_SEC.getValue())) {
try {
- secVO.setCodeDateFormatStr(Func.format(new Date(),secVO.getCodeDateFormatStr()));
+ secVO.setCodeDateValue(Func.format(new Date(),secVO.getCodeDateFormatStr()));
}catch (Exception e){
throw new ServiceException("鏃ユ湡鐮佹鏃ユ湡鏍煎紡閰嶇疆鏈夎锛屽鑷磋浆鎹㈠嚭閿欙細"+e.getMessage());
}
@@ -2824,7 +2845,7 @@
// 鏃ユ湡鐮佹璁剧疆榛樿鍊�
if (secVO.getSecType().equals(CodeSecTypeEnum.CODE_DATE_SEC.getValue())) {
try {
- secVO.setCodeDateFormatStr(Func.format(new Date(),secVO.getCodeDateFormatStr()));
+ secVO.setCodeDateValue(Func.format(new Date(),secVO.getCodeDateFormatStr()));
}catch (Exception e){
throw new ServiceException("鏃ユ湡鐮佹鏃ユ湡鏍煎紡閰嶇疆鏈夎锛屽鑷磋浆鎹㈠嚭閿欙細"+e.getMessage());
}
@@ -2851,7 +2872,7 @@
} else {
if (CollectionUtils.isEmpty(fullInfoBO.getParentClassifyVOs())) {
//璇存槑宸茬粡鏄渶楂樺眰绾�,
- throw new VciBaseException("褰撳墠涓婚搴撳垎绫伙紝浠ュ強瀹冪殑鎵�鏈夌殑涓婄骇鍒嗙被閮芥病鏈夎缃紪鐮佽鍒�");
+ throw new ServiceException("褰撳墠涓婚搴撳垎绫伙紝浠ュ強瀹冪殑鎵�鏈夌殑涓婄骇鍒嗙被閮芥病鏈夎缃紪鐮佽鍒�");
}
List<CodeClassifyVO> parentClassifyVOList = fullInfoBO.getParentClassifyVOs().stream().sorted((o1, o2) -> o1.getDataLevel().compareTo(o2.getDataLevel())).collect(Collectors.toList());
//浠庢渶楂樼殑level寮�濮嬭幏鍙�
@@ -2863,7 +2884,7 @@
}
}
if (StringUtils.isBlank(codeRuleOid)) {
- throw new VciBaseException("褰撳墠涓婚搴撳垎绫伙紝浠ュ強瀹冪殑鎵�鏈夌殑涓婄骇鍒嗙被閮芥病鏈夎缃紪鐮佽鍒�");
+ throw new ServiceException("褰撳墠涓婚搴撳垎绫伙紝浠ュ強瀹冪殑鎵�鏈夌殑涓婄骇鍒嗙被閮芥病鏈夎缃紪鐮佽鍒�");
}
}
return ruleService.getObjectHasSecByOid(codeRuleOid);
@@ -3560,7 +3581,6 @@
return baseModels;
}
-
/**
* 鏍规嵁涓氬姟绫诲瀷鍚嶇О鍒涘缓涓氬姟鏁版嵁婧愬璞�
*
@@ -3669,20 +3689,79 @@
return R.success("鏇存柊鎴愬姛锛�");
}
+ /**
+ * 鏇存柊涓氬姟鏁版嵁鍚屾椂瀵圭爜鍊艰〃鏁版嵁鎿嶄綔鎺ュ彛
+ *
+ * @param btmType 涓氬姟绫诲瀷
+ * @param baseModels 澶勭悊鏁版嵁
+ * @return 澶勭悊鐘舵��
+ */
+ @Transactional(rollbackFor = VciBaseException.class)
+ @Override
+ public R<Integer> updateBatchBtypeDatas(String btmType, List<BaseModel> baseModels) {
- /**
+ //浣跨敤浼犲叆鐨勪笟鍔$被鍨嬫煡璇㈣〃
+ R<List<BtmTypeVO>> listR = btmTypeClient.selectByIdCollection(Collections.singletonList(btmType));
+ if (!listR.isSuccess() || listR.getData().size() == 0) {
+ throw new VciBaseException("浼犲叆涓氬姟绫诲瀷鏈煡璇㈠埌鐩稿簲琛ㄥ崟锛岃妫�鏌ワ紒");
+ }
+ //鑾峰彇褰撳墠涓氬姟绫诲瀷鎵�鏈夊瓧娈电敤鏉ュ仛瀵规瘮
+ R<BtmTypeVO> allAttributeByBtmId = btmTypeClient.getAllAttributeByBtmId(btmType);
+ if (!allAttributeByBtmId.isSuccess() || allAttributeByBtmId.getData().getAttributes().size() == 0) {
+ throw new VciBaseException("浼犲叆涓氬姟绫诲瀷鏈煡璇㈠埌鐩稿簲瀛楁淇℃伅锛岃妫�鏌ワ紒");
+ }
+ Set<String> existFild = allAttributeByBtmId.getData().getAttributes().stream().map(btmTypeAttributeVO -> {
+ return btmTypeAttributeVO.getId();
+ }).collect(Collectors.toSet());
+ if(!CollectionUtils.isEmpty(baseModels)){
+ List<String> oidList=baseModels.stream().filter(data-> com.baomidou.mybatisplus.core.toolkit.StringUtils.isNotBlank(data.getOid())).map(BaseModel::getOid).distinct().collect(Collectors.toList());
+ LambdaQueryWrapper<CodeAllCode> lqw = new LambdaQueryWrapper<>();
+ lqw.in(CodeAllCode::getCreateCodeOid,oidList);
+ List<CodeAllCode> codeAllCodeList= codeAllCodeService.selectByWrapper(lqw);
+ Map<String, CodeAllCode> cboMap = codeAllCodeList.stream().filter(cbo -> cbo != null).collect(Collectors.toList()).stream().collect(Collectors.toMap(s -> s.getCreateCodeOid(), t -> t));
+ List<CodeAllCode> newCodeAllCodeList=new ArrayList<>();
+ //灏哹ean杞负map,mybatis缁熶竴澶勭悊
+ List<Map<String, String>> maps = new ArrayList<>();
+ try {
+ baseModels.stream().forEach(baseModel->{
+ String oid=baseModel.getOid();
+ try {
+ maps.add(VciBaseUtil.convertBean2Map(baseModel,existFild));
+ } catch (Exception e) {
+ throw new VciBaseException("绫诲瀷杞崲閿欒锛�" + e.getMessage());
+ }
+ if(cboMap.containsKey(oid)){
+ CodeAllCode codeAllCode= cboMap.get(oid);
+ codeAllCode.setId(baseModel.getId());
+ codeAllCode.setLastModifier(AuthUtil.getUser().getUserName());
+ codeAllCode.setLastModifyTime(new Date());
+ codeAllCode.setLcStatus(baseModel.getLcStatus());
+ newCodeAllCodeList.add(codeAllCode);
+ }
+ });
+ commonsMapper.updateBatchByBaseModel(listR.getData().get(0).getTableName(), maps);
+ codeAllCodeService.saveOrUpdateBatch(newCodeAllCodeList);
+ } catch (Exception e) {
+ throw new VciBaseException("绫诲瀷杞崲閿欒锛�" + e.getMessage());
+ }
+
+ }
+ return R.success("鏇存柊鎴愬姛锛�");
+ }
+
+ /**
* 鑾峰彇鍙傜収鐨勪俊鎭�
*
* @param referConfigVO 鍙傜収鐨勯厤缃�
* @return 鍒楄〃鏁版嵁
*/
@Override
- public IPage<BaseModel> referDataGrid(UIFormReferVO referConfigVO, BaseQueryObject baseQueryObject) throws VciBaseException {
+ public IPage<BaseModelVO> referDataGrid(UIFormReferVO referConfigVO, BaseQueryObject baseQueryObject) throws VciBaseException {
//checkReferConfig(referConfigVO);
//浣跨敤涓氬姟绫诲瀷鏌ヨ
R<BtmTypeVO> allAttributeByBtmId = btmTypeClient.getAllAttributeByBtmId(referConfigVO.getReferType());
if (!allAttributeByBtmId.isSuccess()) {
- throw new ServiceException("涓氬姟绫诲瀷feign鎺ュ彛璋冪敤閿欒锛�");
+ throw new ServiceException("涓氬姟绫诲瀷feign鎺ュ彛璋冪敤閿欒;"+allAttributeByBtmId.getMsg());
}
if (Func.isEmpty(allAttributeByBtmId.getData())) {
throw new VciBaseException("浼犲叆涓氬姟绫诲瀷鏈煡璇㈠埌鐩稿簲琛ㄥ崟锛岃妫�鏌ワ紒");
@@ -3709,6 +3788,7 @@
if (listR.getData().isEmpty()) {
throw new VciBaseException("浼犲叆涓氬姟绫诲瀷鏈煡璇㈠埌鐩稿簲琛ㄥ崟锛岃妫�鏌ワ紒");
}
+ // TODO:鍙傜収閰嶇疆鐨勬ā绯婃煡璇㈣繃婊ゆ潯浠舵殏鏈鐞�
String namesql = "";
if (StringUtils.isNotBlank(baseQueryObject.getConditionMap().get("name"))) {
String s = baseQueryObject.getConditionMap().get("name");
@@ -3758,27 +3838,28 @@
ZonedDateTime zdt = localDateTime.atZone(zoneId);
Date date = Date.from(zdt.toInstant());
setter.invoke(obj, date);
- map.remove(property.getName().toUpperCase());
+ //map.remove(property.getName().toUpperCase());
} //oracle鐨勬暟瀛椾负BigDecimal鐨勶紝闇�瑕佽繘琛岃浆鎹㈡垚Integer锛屽惁鍒欏皢鎶ラ敊
else if (map.get(property.getName().toUpperCase()) instanceof BigDecimal
&& ("Integer").equals(setter.getParameterTypes()[0].getSimpleName())) {
setter.invoke(obj, ((BigDecimal) map.get(property.getName().toUpperCase())).intValue());
- map.remove(property.getName().toUpperCase());
+ //map.remove(property.getName().toUpperCase());
} else if (map.get(property.getName().toUpperCase()) != null) {
if(setter.getParameterTypes()[0].getSimpleName().equals("String")){
setter.invoke(obj, map.get(property.getName().toUpperCase()) == null ? null:String.valueOf(map.get(property.getName().toUpperCase())));
}else{
setter.invoke(obj, map.get(property.getName().toUpperCase()));
}
- map.remove(property.getName().toUpperCase());
+ //map.remove(property.getName().toUpperCase());
}
}
}
for (Object key : map.keySet()) {
map.put(key, String.valueOf(map.get(key)));
}
-
- ((BaseModel) obj).setData(map);
+ Map<String, String> newMap = new HashMap<>();
+ map.forEach((key, value) -> newMap.put(String.valueOf(key).toLowerCase(), String.valueOf(value)));
+ ((BaseModel) obj).setData(newMap);
baseModels.add((BaseModel) obj);
}
} catch (Exception e) {
@@ -3789,10 +3870,10 @@
+ "and lastv = " + VciBaseUtil.toInSql(baseQueryObject.getConditionMap().get("lastv").toString())) + " and" : "where") + SPACE + "1=1 "
+ lcstatusSql + namesql + codesql
);
- IPage<BaseModel> objectDataGrid = new Page<>();
+ IPage<BaseModelVO> objectDataGrid = new Page<>();
objectDataGrid.setPages(baseQueryObject.getPage());
objectDataGrid.setCurrent(baseQueryObject.getPage());
- objectDataGrid.setRecords(baseModels);
+ objectDataGrid.setRecords(BaseMdodelWrapper.build().listVO(baseModels));
objectDataGrid.setSize(baseQueryObject.getLimit());
objectDataGrid.setTotal(total);
return objectDataGrid;
@@ -3917,7 +3998,6 @@
treeWrapperOptions.setParentOid(queryObject.getParentOid());
return revisionModelUtil.doList2Trees(codeClassifies, treeWrapperOptions, null);
}
-
@Override
public boolean checkUnAttrUnEdit(String attrName) {
--
Gitblit v1.9.3