From 6c170b6b427f0882da35957e73f385d318970a06 Mon Sep 17 00:00:00 2001 From: wangting <675591594@qq.com> Date: 星期五, 25 十月 2024 17:59:19 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/SecretGradeServiceI.java | 28 +++++ Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsTypeActionController.java | 2 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/SecretGradeServiceImpl.java | 175 +++++++++++++++++++++++++++++++++++ Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/SmUserQueryServiceI.java | 2 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmUserQueryServiceImpl.java | 2 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/SecretGradeController.java | 61 ++++++++++++ 6 files changed, 267 insertions(+), 3 deletions(-) diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/SmUserQueryServiceI.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/SmUserQueryServiceI.java index 576e2b5..4b161db 100644 --- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/SmUserQueryServiceI.java +++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/SmUserQueryServiceI.java @@ -29,7 +29,7 @@ boolean checkUserExist(String userName,String oid) throws PLException; /** - * 鏍规嵁鐢ㄦ埛鍚嶈幏鍙栫敤鎴风殑瀵硅薄锛屼笉鍖哄垎澶у皬鍐� + * 鏍规嵁鐢ㄦ埛鍚嶈幏鍙栫敤鎴风殑瀵硅薄锛屼笉鍖哄垎澶у皬鍐� * @param userId 鐢ㄦ埛鍚� * @return 鐢ㄦ埛鐨勬樉绀哄璞★紝濡傛灉鐢ㄦ埛涓嶅瓨鍦ㄥ垯杩斿洖null锛屼笉浼氭姏鍑哄紓甯� * @throws VciBaseException 鍙傛暟涓虹┖鎴栬�呮暟鎹簱瀛樺湪闂鐨勬椂鍊欎細鎶涘嚭寮傚父 diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmUserQueryServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmUserQueryServiceImpl.java index f2ba751..3aaab00 100644 --- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmUserQueryServiceImpl.java +++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmUserQueryServiceImpl.java @@ -1040,7 +1040,7 @@ rootTreeList.add(childTree); }); } - }else if(OrgTypeEnum.ORG_TYPE_DEPT.getValue().equals(dataType)) {//濡傛灉鏄儴闂� + }else if(OrgTypeEnum.ORG_TYPE_DEPT.getValue().equals(dataType)) {//濡傛灉鏄儴闂� DeptInfo[] deptInfos=new DeptInfo[]{}; Tree departmentTree=new Tree(); if(OrgTypeEnum.ORG_TYPE_DEPT.getValue().equals(parentId)) { diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsTypeActionController.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsTypeActionController.java index 9f96bde..cf9ba0d 100644 --- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsTypeActionController.java +++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsTypeActionController.java @@ -55,7 +55,7 @@ * @return */ @PostMapping( "/savePLTypeAction") - @VciBusinessLog(operateName = "娣诲姞灞炴��") + @VciBusinessLog(operateName = "娣诲姞绫诲瀷Action") public BaseResult savePLTypeAction(@RequestBody PLTypeActionDTO plActionDTO) { try { return actionServiceI.savePLTypeAction(plActionDTO); diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/SecretGradeController.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/SecretGradeController.java new file mode 100644 index 0000000..63802ba --- /dev/null +++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/SecretGradeController.java @@ -0,0 +1,61 @@ +package com.vci.web.controller; + +import com.vci.corba.common.PLException; +import com.vci.dto.PLTypeActionDTO; +import com.vci.starter.web.annotation.log.VciBusinessLog; +import com.vci.starter.web.pagemodel.BaseResult; +import com.vci.starter.web.util.VciBaseUtil; +import com.vci.web.service.SecretGradeServiceI; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.Arrays; +import java.util.Map; + +/** + * 瀵嗙骇绠$悊鎺у埗鍣� + * @author ludc + * @date 2024/10/25 16:58 + */ +@RequestMapping("/secretGradeController") +@RestController +public class SecretGradeController { + + @Resource + private SecretGradeServiceI secretGradeServiceI; + + /** + * 鏃ュ織 + */ + private Logger logger = LoggerFactory.getLogger(getClass()); + + /** + * 鑾峰彇瀵嗙骇绠$悊閰嶇疆 + * @return + */ + @GetMapping("/getSecretGradeConfig") + public BaseResult getSecretGradeConfig(){ + try { + return BaseResult.dataList(secretGradeServiceI.getSecretGradeConfig()); + } catch (PLException e) { + BaseResult objectBaseResult = new BaseResult<>(); + objectBaseResult.setCode(Integer.parseInt(e.code)); + objectBaseResult.setMsg(Arrays.toString(e.messages)); + return objectBaseResult; + } + } + + /** + * 鐢ㄦ埛/鏈哄櫒瀵嗙骇鍋滃惎閰嶇疆淇濆瓨 + * @param secretGradeMap + * @return + */ + @PostMapping( "/secretGradeServiceI") + @VciBusinessLog(operateName = "娣诲姞灞炴��") + public BaseResult saveSecretGrade(Map<String, Boolean> secretGradeMap) { + return secretGradeServiceI.saveSecretGrade(secretGradeMap); + } + +} diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/SecretGradeServiceI.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/SecretGradeServiceI.java new file mode 100644 index 0000000..02449f9 --- /dev/null +++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/SecretGradeServiceI.java @@ -0,0 +1,28 @@ +package com.vci.web.service; + +import com.vci.corba.common.PLException; +import com.vci.starter.web.pagemodel.BaseResult; + +import java.util.Map; + +/** + * 瀵嗙骇绠$悊鏈嶅姟 + * @author ludc + * @date 2024/10/25 16:47 + */ +public interface SecretGradeServiceI { + + /** + * 鑾峰彇瀵嗙骇绠$悊閰嶇疆 + * @return + */ + Map<String,Boolean> getSecretGradeConfig() throws PLException; + + /** + * 鐢ㄦ埛/鏈哄櫒瀵嗙骇鍋滃惎閰嶇疆淇濆瓨 + * @param secretGradeMap + * @return + */ + BaseResult saveSecretGrade(Map<String,Boolean> secretGradeMap); + +} diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/SecretGradeServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/SecretGradeServiceImpl.java new file mode 100644 index 0000000..205b38a --- /dev/null +++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/SecretGradeServiceImpl.java @@ -0,0 +1,175 @@ +package com.vci.web.service.impl; + +import com.vci.client.common.providers.ClientServiceProvider; +import com.vci.common.exception.VciException; +import com.vci.corba.common.PLException; +import com.vci.corba.common.data.UserEntityInfo; +import com.vci.corba.framework.data.AppConfigCategoryInfo; +import com.vci.corba.framework.data.AppConfigDetailInfo; +import com.vci.corba.omd.etm.EnumItem; +import com.vci.corba.omd.etm.EnumType; +import com.vci.starter.web.pagemodel.BaseResult; +import com.vci.starter.web.util.VciBaseUtil; +import com.vci.starter.web.util.WebThreadLocalUtil; +import com.vci.web.service.SecretGradeServiceI; +import com.vci.web.util.PlatformClientUtil; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import javax.swing.*; +import java.util.HashMap; +import java.util.Map; + +/** + * 瀵嗙骇绠$悊鏈嶅姟 + * @author ludc + * @date 2024/10/25 16:49 + */ +@Service +public class SecretGradeServiceImpl implements SecretGradeServiceI { + + @Autowired + private PlatformClientUtil platformClientUtil; + + /** + * 鏃ュ織 + */ + private Logger logger = LoggerFactory.getLogger(getClass()); + + /** + * 鑾峰彇瀵嗙骇绠$悊閰嶇疆 + * @return + */ + @Override + public Map<String, Boolean> getSecretGradeConfig() throws PLException { + Map<String, Boolean> returnMap = new HashMap<>(); + //map.put(); + String userId = WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId(); + UserEntityInfo userEntityInfo = new UserEntityInfo(userId,""); + AppConfigDetailInfo userConfigDetail = platformClientUtil.getFrameworkService().getAppConfigDetailByKey("userSecuritySwith", userEntityInfo); + AppConfigDetailInfo ipConfigDetail = platformClientUtil.getFrameworkService().getAppConfigDetailByKey("ipSecuritySwitch",userEntityInfo); + if ("on".equals(userConfigDetail.value)) { + returnMap.put("userSecuritySwith",true); + }else{ + returnMap.put("userSecuritySwith",false); + } + + if ("on".equals(ipConfigDetail.value)) { + returnMap.put("ipSecuritySwitch",true); + }else{ + returnMap.put("ipSecuritySwitch",false); + } + return returnMap; + } + + /** + * 鐢ㄦ埛/鏈哄櫒瀵嗙骇鍋滃惎閰嶇疆淇濆瓨 + * @param secretGradeMap + * @return + */ + @Override + public BaseResult saveSecretGrade(Map<String, Boolean> secretGradeMap){ + VciBaseUtil.alertNotNull(secretGradeMap,"瀵嗙骇閰嶇疆瀵硅薄"); + Boolean userSecuritySwith = secretGradeMap.getOrDefault("userSecuritySwith", false); + Boolean ipSecuritySwitch = secretGradeMap.getOrDefault("ipSecuritySwitch", false); + + try{ + String userId = WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId(); + UserEntityInfo userEntityInfo = new UserEntityInfo(userId,""); + AppConfigCategoryInfo[] categories = platformClientUtil.getFrameworkService().getAppConfigCategorys(userEntityInfo); + String secretGradeCategoryId = ""; + for (int i = 0; i < categories.length; i++) { + if ("绯荤粺瀵嗙骇閰嶇疆".equals(categories[i].name)) { + secretGradeCategoryId = categories[i].id; + break; + } + } + + if ("".equals(secretGradeCategoryId)) { + AppConfigCategoryInfo categoryObj = new AppConfigCategoryInfo(); + categoryObj.name = "绯荤粺瀵嗙骇閰嶇疆"; + categoryObj.desc = "绯荤粺瀵嗙骇閰嶇疆"; + secretGradeCategoryId = platformClientUtil.getFrameworkService().saveAppConfigCategory(categoryObj,userEntityInfo); + } + + AppConfigDetailInfo userConfigDetail = platformClientUtil.getFrameworkService().getAppConfigDetailByKey("userSecuritySwith", userEntityInfo); + AppConfigDetailInfo ipConfigDetail = platformClientUtil.getFrameworkService().getAppConfigDetailByKey("ipSecuritySwitch",userEntityInfo); + + if (ipSecuritySwitch) { + if (ipConfigDetail.id != null && !"".equals(ipConfigDetail.id)) { + ipConfigDetail.value = "on"; + boolean res = platformClientUtil.getFrameworkService().updateAppConfigDetail(ipConfigDetail,userEntityInfo); + System.out.println("ip閰嶇疆淇敼缁撴灉-------" + res); + } else { + ipConfigDetail = new AppConfigDetailInfo(); + ipConfigDetail.key = "ipSecuritySwitch"; + ipConfigDetail.value = "on"; + ipConfigDetail.name = "鏈哄櫒瀵嗙骇鍋滃惎"; + ipConfigDetail.desc = "value鍊间负on鏃朵唬琛ㄦ満鍣ㄥ瘑绾у紑鍚紝鍊间负鍏朵粬鎴栬�呬笉閰嶇疆鏃朵唬琛ㄤ笉寮�鍚��"; + ipConfigDetail.categoryId = secretGradeCategoryId; + String res = platformClientUtil.getFrameworkService().saveAppConfigDetail(ipConfigDetail,userEntityInfo); + System.out.println("ip閰嶇疆淇濆瓨缁撴灉-------" + res); + } + } else { + if (ipConfigDetail.id != null && !"".equals(ipConfigDetail.id)) { + ipConfigDetail.value = "off"; + platformClientUtil.getFrameworkService().updateAppConfigDetail(ipConfigDetail,userEntityInfo); + } + } + + if (userSecuritySwith) { + if (userConfigDetail.id != null && !"".equals(userConfigDetail.id)) { + userConfigDetail.value = "on"; + boolean res = platformClientUtil.getFrameworkService().updateAppConfigDetail(userConfigDetail,userEntityInfo); + System.out.println("user閰嶇疆淇敼缁撴灉-------" + res); + } else { + userConfigDetail = new AppConfigDetailInfo(); + userConfigDetail.key = "userSecuritySwith"; + userConfigDetail.value = "on"; + userConfigDetail.name = "鐢ㄦ埛瀵嗙骇鍋滃惎"; + userConfigDetail.categoryId = secretGradeCategoryId; + userConfigDetail.desc = ("value鍊间负on鏃朵唬琛ㄧ敤鎴峰瘑绾у紑鍚紝鍊间负鍏朵粬鎴栬�呬笉閰嶇疆鏃朵唬琛ㄤ笉寮�鍚��"); + String res = platformClientUtil.getFrameworkService().saveAppConfigDetail(userConfigDetail,userEntityInfo); + System.out.println("user閰嶇疆淇濆瓨缁撴灉-------" + res); + } + updateUserSecretGrade(); + } else { + if (userConfigDetail.id != null && !"".equals(userConfigDetail.id)) { + userConfigDetail.value = "off"; + boolean res = platformClientUtil.getFrameworkService().updateAppConfigDetail(userConfigDetail,userEntityInfo); + System.out.println("user閰嶇疆淇敼缁撴灉-------" + res); + } + } + return BaseResult.success("淇濆瓨閰嶇疆鎴愬姛"); + }catch (Exception e){ + String errorLog = "淇濆瓨閰嶇疆澶辫触锛屽師鍥狅細"+VciBaseUtil.getExceptionMessage(e); + logger.error(errorLog); + return BaseResult.fail(errorLog); + } + } + + /** + * 淇敼鐢ㄦ埛鐨勫瘑闆� + * @throws PLException + */ + private void updateUserSecretGrade() throws PLException { + EnumType enumType = platformClientUtil.getEnumService().getEnumTypeByName("usersecurityenum"); + EnumItem[] children = enumType.items; + int grade = 10; + if (children.length > 0) { + grade = Integer.parseInt(children[0].value); + for (int i = 0; i < children.length; i++) { + EnumItem child = children[i]; + if (grade >= Integer.parseInt(child.value)) { + grade = Integer.parseInt(child.value); + } + } + } + String updateSql = "update pluser set plsecretgrade = '" + grade + "' " + + "where plsecretgrade is null"; + platformClientUtil.getBOFService().executeUpdateSql(updateSql); + } + +} -- Gitblit v1.9.3