From 607ebaf27b44e0d27925715e4c2d7e2ffff257f0 Mon Sep 17 00:00:00 2001
From: ludc
Date: 星期二, 11 七月 2023 09:49:33 +0800
Subject: [PATCH] 前端代码打包
---
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeRuleServiceImpl.java | 82 ++++++++++++++++++++++++++++++++++++-----
1 files changed, 72 insertions(+), 10 deletions(-)
diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeRuleServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeRuleServiceImpl.java
index 1a35355..86eb60d 100644
--- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeRuleServiceImpl.java
+++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeRuleServiceImpl.java
@@ -17,6 +17,8 @@
package com.vci.ubcs.code.service.impl;
import com.alibaba.cloud.commons.lang.StringUtils;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
@@ -28,6 +30,7 @@
import com.vci.ubcs.code.dto.CodeBasicSecDTO;
import com.vci.ubcs.code.dto.CodeRuleDTO;
import com.vci.ubcs.code.entity.*;
+import com.vci.ubcs.code.enumpack.CodeSecTypeEnum;
import com.vci.ubcs.code.lifecycle.CodeRuleLC;
import com.vci.ubcs.code.mapper.CodeRuleMapper;
import com.vci.ubcs.code.mapper.CodeSerialValueMapper;
@@ -36,16 +39,18 @@
import com.vci.ubcs.code.service.ICodeBasicSecService;
import com.vci.ubcs.code.service.ICodeClassifyService;
import com.vci.ubcs.code.service.ICodeRuleService;
+import com.vci.ubcs.code.vo.pagemodel.CodeBasicSecVO;
import com.vci.ubcs.code.vo.pagemodel.CodeClassifyVO;
import com.vci.ubcs.code.vo.pagemodel.CodeRuleVO;
import com.vci.ubcs.code.wrapper.CodeClassifyWrapper;
import com.vci.ubcs.code.wrapper.CodeRuleWrapper;
+import com.vci.ubcs.omd.cache.EnumCache;
+import com.vci.ubcs.omd.enums.EnumEnum;
import com.vci.ubcs.starter.exception.VciBaseException;
import com.vci.ubcs.starter.revision.service.RevisionModelUtil;
import com.vci.ubcs.starter.util.DefaultAttrAssimtUtil;
import com.vci.ubcs.starter.util.UBCSCondition;
-import com.vci.ubcs.starter.web.pagemodel.BladeQueryObject;
-import com.vci.ubcs.starter.web.pagemodel.KeyValue;
+import com.vci.ubcs.starter.web.pagemodel.*;
import com.vci.ubcs.starter.web.util.BeanUtilForVCI;
import com.vci.ubcs.starter.web.util.VciBaseUtil;
import com.vci.ubcs.starter.web.util.WebUtil;
@@ -55,6 +60,7 @@
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.BeanUtil;
+import org.springblade.core.tool.utils.Func;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -125,15 +131,32 @@
* @throws VciBaseException 鍙傛暟涓虹┖锛屽敮涓�椤癸紝蹇呰緭椤逛笉閫氳繃鏃朵細鎶涘嚭寮傚父
*/
@Override
- public boolean addSave(CodeRuleDTO codeRuleDTO) throws VciBaseException {
+ public R addSave(CodeRuleDTO codeRuleDTO) throws VciBaseException {
VciBaseUtil.alertNotNull(codeRuleDTO, "闇�瑕佹坊鍔犵殑鏁版嵁瀵硅薄");
- //灏咲TO杞崲涓篋O
+ if(checkCodeRuleRepeat(codeRuleDTO.getId())){
+ return R.fail("瑙勫垯缂栧彿宸插瓨鍦紒");
+ }
+ // 灏咲TO杞崲涓篋O
CodeRule codeRule = Objects.requireNonNull(BeanUtil.copy(codeRuleDTO, CodeRule.class));
- String userId = AuthUtil.getUserId().toString();
+ // 濉厖榛樿鍊�
DefaultAttrAssimtUtil.addDefaultAttrAssimt(codeRule, MdmBtmTypeConstant.CODE_RULE);
codeRule.setLctid(CODE_RULE_LC);
codeRule.setLcStatus(FRAMEWORK_RELEASE_EDITING);
- return codeRuleMapper.insert(codeRule)>0;
+ return R.status(codeRuleMapper.insert(codeRule)>0);
+ }
+
+ /**
+ * 妫�鏌d缂栧彿鏄惁閲嶅
+ * @param id 褰撳墠缂栧彿
+ * @return 杩斿洖false琛ㄧず鏈噸澶�
+ */
+ @Override
+ public boolean checkCodeRuleRepeat(String id){
+ Long count = this.codeRuleMapper.selectCount(Wrappers.<CodeRule>query().lambda().eq(CodeRule::getId, id));
+ if(count>0){
+ return true;
+ }
+ return false;
}
/**
@@ -158,8 +181,11 @@
* @throws VciBaseException 鍙傛暟涓虹┖锛屽敮涓�椤癸紝蹇呰緭椤逛笉閫氳繃鏃朵細鎶涘嚭寮傚父
*/
@Override
- public boolean editSave(CodeRuleDTO codeRuleDTO) throws VciBaseException{
+ public R editSave(CodeRuleDTO codeRuleDTO) throws VciBaseException{
VciBaseUtil.alertNotNull(codeRuleDTO, "鏁版嵁瀵硅薄", codeRuleDTO.getOid(), "涓绘暟鎹紪鐮佽鍒欎富閿�");
+ if(checkCodeRuleRepeat(codeRuleDTO.getId())){
+ return R.fail("瑙勫垯缂栧彿宸插瓨鍦紒");
+ }
if (!checkEditDelStatus(codeRuleDTO.getLcStatus())) {
throw new VciBaseException("缂栫爜瑙勫垯宸插彂甯冿紝涓嶅厑璁哥紪杈戞垨鍒犻櫎");
}
@@ -167,7 +193,7 @@
CodeRule codeRule = selectByOid(codeRuleDTO.getOid());
revisionModelUtil.copyFromDTOIgnore(codeRuleDTO, codeRule);
DefaultAttrAssimtUtil.updateDefaultAttrAssimt(codeRule);
- return codeRuleMapper.updateById(codeRule)>0;
+ return R.status(codeRuleMapper.updateById(codeRule)>0);
}
/**
@@ -320,6 +346,21 @@
}
/**
+ * 涓婚敭鎵归噺鑾峰彇涓绘暟鎹紪鐮佽鍒�
+ *
+ * @param oidCollections 涓婚敭闆嗗悎锛屼絾鏄彈鎬ц兘褰卞搷锛屽缓璁竴娆℃煡璇笉瓒呰繃10000涓�
+ * @param hasSec 鏄惁鍖呭惈鐮佹
+ * @return 涓绘暟鎹紪鐮佽鍒欐樉绀哄璞�
+ * @throws VciBaseException 鏌ヨ鍑虹幇寮傚父鏃朵細鎶涘嚭
+ */
+ @Override
+ public Collection<CodeRuleVO> listCodeRuleByIds(Collection<String> oidCollections, boolean hasSec) throws VciBaseException {
+ VciBaseUtil.alertNotNull(oidCollections, "鏁版嵁瀵硅薄涓婚敭闆嗗悎");
+ List<CodeRule> codeRuleDOList = listCodeRuleDOByOidCollections(oidCollections);
+ return codeRuleDO2VOs(codeRuleDOList, true);
+ }
+
+ /**
* 浣跨敤涓婚敭闆嗗悎鏌ヨ鏁版嵁瀵硅薄
*
* @param oidCollections 涓婚敭鐨勯泦鍚�
@@ -424,7 +465,6 @@
return R.data(exFlag&&exFlag1);
}
-
/**
* 浣跨敤涓婚敭鑾峰彇缂栫爜瑙勫垯鐨勫唴瀹�
*
@@ -435,6 +475,27 @@
public CodeRuleVO getObjectHasSecByOid(String oid) {
CodeRule ruleDO = selectByOid(oid);
return codeRuleDO2VO(ruleDO, true);
+ }
+
+ /**
+ * 鎵归噺鏁版嵁瀵硅薄杞崲涓烘樉绀哄璞�
+ *
+ * @param codeRules 鏁版嵁瀵硅薄鍒楄〃
+ * @param hasSec 鏄惁鍖呭惈鐮佹
+ * @return 鏄剧ず瀵硅薄
+ * @throws VciBaseException 鍙傛暟涓虹┖鎴栬�呬笉瀛樺湪鐨勬椂鍊欎細鎶涘嚭寮傚父
+ */
+ public List<CodeRuleVO> codeRuleDO2VOs(Collection<CodeRule> codeRules, boolean hasSec) throws VciBaseException {
+ List<CodeRuleVO> voList = new ArrayList<CodeRuleVO>();
+ if (!CollectionUtils.isEmpty(codeRules)) {
+ for (CodeRule s : codeRules) {
+ CodeRuleVO vo = codeRuleDO2VO(s,true);
+ if (vo != null) {
+ voList.add(vo);
+ }
+ }
+ }
+ return voList;
}
/**
@@ -452,8 +513,9 @@
//濡傛灉鏈塴cstatus鐨勭被鐨勮瘽
vo.setLcStatusText(CodeRuleLC.getTextByValue(vo.getLcStatus()));
if (hasSec) {
+ List<CodeBasicSecVO> codeBasicSecVOS = codeBasicSecService.listCodeBasicSecByRuleOid(vo.getOid());
//鏌ヨ鐮佹
- vo.setSecVOList(codeBasicSecService.listCodeBasicSecByRuleOid(vo.getOid()));
+ vo.setSecVOList(codeBasicSecVOS);
}
}
return vo;
--
Gitblit v1.9.3