From 0b8990b4a3cfa8126287a594f0d3810ec97b2e15 Mon Sep 17 00:00:00 2001
From: wangting <675591594@qq.com>
Date: 星期五, 14 七月 2023 16:00:08 +0800
Subject: [PATCH] 弹窗展示
---
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeRuleServiceImpl.java | 78 ++++++++++++++++++++++++++++++--------
1 files changed, 61 insertions(+), 17 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 86eb60d..2d4778c 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,15 +17,10 @@
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;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.vci.ubcs.code.constant.MdmBtmTypeConstant;
import com.vci.ubcs.code.dto.CodeBasicSecDTO;
import com.vci.ubcs.code.dto.CodeRuleDTO;
@@ -44,8 +39,6 @@
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;
@@ -54,13 +47,14 @@
import com.vci.ubcs.starter.web.util.BeanUtilForVCI;
import com.vci.ubcs.starter.web.util.VciBaseUtil;
import com.vci.ubcs.starter.web.util.WebUtil;
-import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.constant.BladeConstant;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.Func;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -110,6 +104,11 @@
@Resource
private RevisionModelUtil revisionModelUtil;
+ @Value("${user-info.tenant-id}")
+ private String tenantId;
+ @Value("${user-info.id}")
+ private String userId;
+
/**
* 鍒嗛〉鏌ヨ
* @param query
@@ -118,6 +117,11 @@
*/
@Override
public IPage<CodeRuleVO> gridCodeRule(Query query, Map<String,Object> conidtionMap) {
+ //濡傛灉绛変簬鑷繁閰嶇疆鐨勭鐞嗙粍绉熸埛id鍜岀鐞嗙粍瓒呯璐﹀彿锛屽氨涓嶉渶瑕佹寜鐓ц鍒欐墍鏈夎�呮潵杩涜鏌ヨ
+ if(!(AuthUtil.getTenantId().equals(this.tenantId) && AuthUtil.getUserId().toString().equals(this.userId))){
+ // 鎸夌収瑙勫垯鎵�鏈夎�呮潵鏌ヨ
+ conidtionMap.put("owner",AuthUtil.getUserId());
+ }
IPage<CodeRule> codeRuleIPage = this.codeRuleMapper.selectPage(Condition.getPage(query), UBCSCondition.getQueryWrapper(conidtionMap, CodeRule.class));
//do杞瑅o鍚屾椂setLcStatusText鐢熷懡鍛ㄦ湡鍊硷紝骞跺寘瑁呮垚鍒嗛〉瀵硅薄杩斿洖
return CodeRuleWrapper.build().pageVO(codeRuleIPage);
@@ -133,7 +137,7 @@
@Override
public R addSave(CodeRuleDTO codeRuleDTO) throws VciBaseException {
VciBaseUtil.alertNotNull(codeRuleDTO, "闇�瑕佹坊鍔犵殑鏁版嵁瀵硅薄");
- if(checkCodeRuleRepeat(codeRuleDTO.getId())){
+ if(checkCodeRuleRepeat(codeRuleDTO)){
return R.fail("瑙勫垯缂栧彿宸插瓨鍦紒");
}
// 灏咲TO杞崲涓篋O
@@ -147,14 +151,21 @@
/**
* 妫�鏌d缂栧彿鏄惁閲嶅
- * @param id 褰撳墠缂栧彿
+ * @param codeRuleDTO 褰撳墠鍒ゆ柇鏄惁閲嶅鐨勫璞�
* @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;
+ public boolean checkCodeRuleRepeat(CodeRuleDTO codeRuleDTO){
+ List<CodeRule> codeRulesList = this.codeRuleMapper.selectList(Wrappers.<CodeRule>query().lambda().eq(CodeRule::getId, codeRuleDTO.getId()));
+ if(!codeRulesList.isEmpty()){
+ return codeRulesList.parallelStream().anyMatch(codeRule -> {
+ if(StringUtils.isNotBlank(codeRuleDTO.getOid())){
+ // 浠h〃鏄慨鏀�
+ return !codeRule.getOid().equals(codeRuleDTO.getOid());
+ }else {
+ return true;
+ }
+ });
}
return false;
}
@@ -166,7 +177,7 @@
* @return true琛ㄧず鍙互缂栬緫鎴栧垹闄わ紝false琛ㄧず涓嶅彲浠�
*/
@Override
- public boolean checkEditDelStatus(String lcStatus) {
+ public boolean checkEditDelStatus(String lcStatus) throws VciBaseException {
if (CodeRuleLC.RELEASED.getValue().equals(lcStatus) || CodeRuleLC.DISABLED.getValue().equals(lcStatus)) {
return false;
}
@@ -183,7 +194,7 @@
@Override
public R editSave(CodeRuleDTO codeRuleDTO) throws VciBaseException{
VciBaseUtil.alertNotNull(codeRuleDTO, "鏁版嵁瀵硅薄", codeRuleDTO.getOid(), "涓绘暟鎹紪鐮佽鍒欎富閿�");
- if(checkCodeRuleRepeat(codeRuleDTO.getId())){
+ if(checkCodeRuleRepeat(codeRuleDTO)){
return R.fail("瑙勫垯缂栧彿宸插瓨鍦紒");
}
if (!checkEditDelStatus(codeRuleDTO.getLcStatus())) {
@@ -192,6 +203,9 @@
//灏咲TO杞崲涓篋O
CodeRule codeRule = selectByOid(codeRuleDTO.getOid());
revisionModelUtil.copyFromDTOIgnore(codeRuleDTO, codeRule);
+ if(!codeRule.getOwner().equals(codeRuleDTO.getOwner())){
+ codeRule.setOwner(codeRuleDTO.getOwner());
+ }
DefaultAttrAssimtUtil.updateDefaultAttrAssimt(codeRule);
return R.status(codeRuleMapper.updateById(codeRule)>0);
}
@@ -478,6 +492,34 @@
}
/**
+ * 妫�鏌ョ浉浼肩紪鐮佽鍒欙紝骞惰繑鍥炲搴旂殑缁撴灉
+ * @param oid 涓婚敭
+ * @return 鎵ц缁撴灉
+ */
+ @Override
+ public R checkLikeCodeRule(String oid) throws VciBaseException {
+ CodeRuleVO codeRuleVO = getObjectByOid(oid);
+ // 1銆佸幓鎺夋祦姘寸爜娈碉紝璁$畻鍑哄叾浠栫爜娈靛�奸暱搴︼紝鍦ㄥ凡鍙戝竷鐨勮鍒欎腑姣斿鍑洪暱搴︿竴鑷寸殑缂栫爜瑙勫垯
+ HashMap<String, Object> condtionMap = new HashMap<>();
+ condtionMap.put("pkCodeRule_equal",codeRuleVO.getOid());
+ condtionMap.put("secType_notequal", CodeSecTypeEnum.CODE_SERIAL_SEC);
+ codeRuleVO.setSecVOList(codeBasicSecService.listCodeBasicSecByRuleOid(condtionMap));
+ // TODO 寰呭畬鍠�
+
+
+ // 2銆佸湪1銆佺殑鍩虹涓婂啀姣斿鐮佹绫诲瀷鐨勯『搴忎竴鑷寸殑缂栫爜璺潃
+
+ // 3銆佸湪2銆佺殑鍩虹涓婃瘮杈冪爜娈电爜鍊奸暱搴︼紝瀵规瘮鍑洪暱搴︾浉鍚岀殑缂栫爜瑙勫垯
+
+ // 4銆佸湪3銆佺殑鍩虹涓婃瘮杈冪爜鍊兼槸鍚︾浉鍚�
+
+
+ // 鏈�鍚庡皢缁撴灉杩涜杩斿洖
+
+ return null;
+ }
+
+ /**
* 鎵归噺鏁版嵁瀵硅薄杞崲涓烘樉绀哄璞�
*
* @param codeRules 鏁版嵁瀵硅薄鍒楄〃
@@ -513,7 +555,9 @@
//濡傛灉鏈塴cstatus鐨勭被鐨勮瘽
vo.setLcStatusText(CodeRuleLC.getTextByValue(vo.getLcStatus()));
if (hasSec) {
- List<CodeBasicSecVO> codeBasicSecVOS = codeBasicSecService.listCodeBasicSecByRuleOid(vo.getOid());
+ Map<String, Object> condtionMap = new HashMap<>();
+ condtionMap.put("pkCodeRule",vo.getOid());
+ List<CodeBasicSecVO> codeBasicSecVOS = codeBasicSecService.listCodeBasicSecByRuleOid(condtionMap);
//鏌ヨ鐮佹
vo.setSecVOList(codeBasicSecVOS);
}
--
Gitblit v1.9.3