ZhuDeKang 3 месяцев назад
Родитель
Сommit
07bb8ee0f4
17 измененных файлов с 356 добавлено и 147 удалено
  1. 8 0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java
  2. 7 8
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java
  3. 4 0
      ruoyi-admin/src/main/resources/application.yml
  4. 69 2
      ruoyi-admin/src/test/java/com/ruoyi/JasyptTest.java
  5. 14 6
      ruoyi-api-patform/src/main/java/com/ruoyi/interfaces/controller/MdModelInfoController.java
  6. 7 0
      ruoyi-api-patform/src/main/java/com/ruoyi/interfaces/controller/MyAttentionController.java
  7. 28 0
      ruoyi-api-patform/src/main/java/com/ruoyi/interfaces/controller/PtServiceController.java
  8. 4 0
      ruoyi-api-patform/src/main/java/com/ruoyi/interfaces/domain/vo/MdFlowDispatchVo.java
  9. 5 2
      ruoyi-api-patform/src/main/java/com/ruoyi/interfaces/service/impl/MdFlowDispatchServiceImpl.java
  10. 15 2
      ruoyi-api-patform/src/main/java/com/ruoyi/interfaces/service/impl/MdModelInfoServiceImpl.java
  11. 19 6
      ruoyi-api-patform/src/main/java/com/ruoyi/interfaces/service/impl/PtServiceServiceImpl.java
  12. 1 0
      ruoyi-api-patform/src/main/java/com/ruoyi/interfaces/snailJob/FlowJob.java
  13. 0 1
      ruoyi-api-patform/src/main/resources/mapper/interfaces/PtServiceMapper.xml
  14. 20 0
      ruoyi-common/src/main/java/com/ruoyi/common/config/Sm4Config.java
  15. 68 27
      ruoyi-common/src/main/java/com/ruoyi/common/utils/SM4Util.java
  16. 68 90
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java
  17. 19 3
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java

+ 8 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java

@@ -1,6 +1,8 @@
 package com.ruoyi.web.controller.system;
 
 import java.util.List;
+
+import com.ruoyi.common.utils.SM4Util;
 import org.apache.commons.lang3.ArrayUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
@@ -34,6 +36,10 @@ public class SysDeptController extends BaseController
     @Autowired
     private ISysDeptService deptService;
 
+    @Autowired
+    private SM4Util sm4Util;
+
+
     /**
      * 获取部门列表
      */
@@ -81,6 +87,7 @@ public class SysDeptController extends BaseController
             return error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在");
         }
         dept.setCreateBy(getUsername());
+        dept.setPhone(sm4Util.encrypt(dept.getPhone()));
         return toAjax(deptService.insertDept(dept));
     }
 
@@ -107,6 +114,7 @@ public class SysDeptController extends BaseController
             return error("该部门包含未停用的子部门!");
         }
         dept.setUpdateBy(getUsername());
+        dept.setPhone(sm4Util.encrypt(dept.getPhone()));
         return toAjax(deptService.updateDept(dept));
     }
 

+ 7 - 8
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java

@@ -8,6 +8,7 @@ import com.ruoyi.common.core.domain.entity.SysRole;
 import com.ruoyi.common.core.domain.entity.SysUser;
 import com.ruoyi.common.core.page.TableDataInfo;
 import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.utils.SM4Util;
 import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.common.utils.poi.ExcelUtil;
@@ -47,6 +48,8 @@ public class SysUserController extends BaseController
     @Autowired
     private ISysPostService postService;
 
+    @Autowired
+    private SM4Util sm4Util;
     /**
      * 获取用户列表
      */
@@ -124,16 +127,15 @@ public class SysUserController extends BaseController
         {
             return error("新增用户'" + user.getUserName() + "'失败,登录账号已存在");
         }
-        else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user))
-        {
-            return error("新增用户'" + user.getUserName() + "'失败,手机号码已存在");
-        }
         else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user))
         {
             return error("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在");
         }
         user.setCreateBy(getUsername());
         user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
+
+        user.setPhonenumber(sm4Util.encrypt(user.getPhonenumber()));
+
         return toAjax(userService.insertUser(user));
     }
 
@@ -153,15 +155,12 @@ public class SysUserController extends BaseController
         {
             return error("修改用户'" + user.getUserName() + "'失败,登录账号已存在");
         }
-        else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user))
-        {
-            return error("修改用户'" + user.getUserName() + "'失败,手机号码已存在");
-        }
         else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user))
         {
             return error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
         }
         user.setUpdateBy(getUsername());
+        user.setPhonenumber(sm4Util.encrypt(user.getPhonenumber()));
         return toAjax(userService.updateUser(user));
     }
 

+ 4 - 0
ruoyi-admin/src/main/resources/application.yml

@@ -197,3 +197,7 @@ golden:
     enabled: true
     work-dir: D:/Workspaces/sh-model-platform/plugins
     path: D:/Workspaces/sh-model-platform/plugins
+
+#sm4密钥
+sm4:
+  secret-key: "8E4A7C2F9B1D5E3A6C8F0B2D4E6A8C05" # 32位十六进制字符串,对应16字节密钥

+ 69 - 2
ruoyi-admin/src/test/java/com/ruoyi/JasyptTest.java

@@ -3,10 +3,23 @@ package com.ruoyi;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.github.yulichang.wrapper.MPJLambdaWrapper;
-import com.ruoyi.common.utils.sm4.SM4Util;
+import com.ruoyi.common.core.domain.entity.SysDept;
+import com.ruoyi.common.core.domain.entity.SysUser;
+import com.ruoyi.common.utils.SM4Util;
+import com.ruoyi.common.utils.spring.SpringUtils;
+import com.ruoyi.interfaces.domain.MdModelInfo;
+import com.ruoyi.interfaces.domain.PtService;
+import com.ruoyi.interfaces.domain.SysMetaDatasource;
+import com.ruoyi.interfaces.service.IMdModelInfoService;
+import com.ruoyi.interfaces.service.ISysMetaDatasourceService;
+import com.ruoyi.interfaces.service.PtServiceService;
 import com.ruoyi.model.dpp.dal.dataobject.etl.DppEtlTaskDO;
 import com.ruoyi.model.etl.mapper.DppEtlTaskMapper;
 import com.ruoyi.model.etl.mapper.TestDppEtlTaskMapper;
+import com.ruoyi.system.mapper.SysDeptMapper;
+import com.ruoyi.system.mapper.SysUserMapper;
+import com.ruoyi.system.service.ISysDeptService;
+import com.ruoyi.system.service.ISysUserService;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -25,9 +38,63 @@ import static org.junit.jupiter.api.Assertions.assertNotNull;
 @RunWith(SpringRunner.class)
 public class JasyptTest {
 
+    @Autowired
+    private SM4Util sm4Util;
+
+    @Autowired
+    private IMdModelInfoService mdModelInfoService;
+
+    @Autowired
+    private PtServiceService ptServiceService;
+    @Autowired
+    private ISysMetaDatasourceService datasourceService;
+    @Autowired
+    private SysDeptMapper deptService;
+    @Autowired
+    private SysUserMapper userService;
+
 
     @Test
     public void test() {
-        System.out.println(SM4Util.selfCheck());
+
+        /*List<MdModelInfo> mdModelInfos = mdModelInfoService.selectMdModelInfoList(null);
+        mdModelInfos.forEach(p->{
+            p.setMdContact(sm4Util.encrypt(p.getMdContact()));
+            p.setDevContact(sm4Util.encrypt(p.getDevContact()));
+            mdModelInfoService.updateMdModelInfo(p);
+        });
+*/
+/*        List<PtService> ptServices = ptServiceService.selectAllColumns(null);
+        ptServices.forEach(p->{
+            p.setDevelopContacter(sm4Util.encrypt(p.getDevelopContacter()));
+            p.setMaintainContacer(sm4Util.encrypt(p.getMaintainContacer()));
+            p.setAdName(sm4Util.encrypt(p.getAdName()));
+
+            ptServiceService.put(p);
+        });
+
+        */
+   /*     List<SysMetaDatasource> sysMetaDatasources = datasourceService.selectSysMetaDatasourceList(null);
+        sysMetaDatasources.forEach(p -> {
+            p.setDsUser(sm4Util.encrypt(p.getDsUser()));
+            p.setDsPass(sm4Util.encrypt(p.getDsPass()));
+
+            datasourceService.updateSysMetaDatasource(p);
+
+        });*/
+
+        List<SysDept> sysDepts = deptService.selectDeptList(null);
+
+        sysDepts.forEach(p->{
+            p.setPhone(sm4Util.encrypt(p.getPhone()));
+            deptService.updateDept(p);
+
+        });
+        List<SysUser> sysUsers = userService.selectUserList(null);
+        sysUsers.forEach(p->{
+            p.setPhonenumber(sm4Util.encrypt(p.getPhonenumber()));
+            userService.updateUser(p);
+        });
+
     }
 }

+ 14 - 6
ruoyi-api-patform/src/main/java/com/ruoyi/interfaces/controller/MdModelInfoController.java

@@ -7,10 +7,7 @@ import com.ruoyi.common.core.page.TableDataInfo;
 import com.ruoyi.common.core.page.TableSupport;
 import com.ruoyi.common.core.text.Convert;
 import com.ruoyi.common.enums.BusinessType;
-import com.ruoyi.common.utils.DateUtils;
-import com.ruoyi.common.utils.PageUtils;
-import com.ruoyi.common.utils.ServletUtils;
-import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.common.utils.*;
 import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.interfaces.domain.MdAudit;
 import com.ruoyi.interfaces.domain.MdModelInfo;
@@ -37,6 +34,9 @@ public class MdModelInfoController extends BaseController {
     @Autowired
     private IMdModelInfoService mdModelInfoService;
 
+    @Autowired
+    private SM4Util sm4Util;
+
     /**
      * 查询模型信息列表
      */
@@ -89,6 +89,10 @@ public class MdModelInfoController extends BaseController {
         if (StringUtils.isNull(mdModelInfo.getEnname())) return error("【模型英文名称】不可为空");
         mdModelInfo.setRegUser(getUsername());
         mdModelInfo.setAudit("0");
+
+        mdModelInfo.setMdContact(sm4Util.decrypt(mdModelInfo.getMdContact()));
+        mdModelInfo.setDevContact(sm4Util.decrypt(mdModelInfo.getDevContact()));
+
         return AjaxResult.success(mdModelInfoService.insertMdModelInfo(mdModelInfo));
     }
 
@@ -101,6 +105,9 @@ public class MdModelInfoController extends BaseController {
     public AjaxResult edit(@RequestBody MdModelInfo mdModelInfo) {
         if (StringUtils.isNull(mdModelInfo.getName())) return error("【模型名称】不可为空");
         if (StringUtils.isNull(mdModelInfo.getEnname())) return error("【模型英文名称】不可为空");
+        mdModelInfo.setMdContact(sm4Util.decrypt(mdModelInfo.getMdContact()));
+        mdModelInfo.setDevContact(sm4Util.decrypt(mdModelInfo.getDevContact()));
+
         return toAjax(mdModelInfoService.updateMdModelInfo(mdModelInfo));
     }
 
@@ -119,12 +126,13 @@ public class MdModelInfoController extends BaseController {
      *
      */
     @PostMapping("/modelSetRela")
-    public  AjaxResult modelSetRela(@RequestBody MdModelSetRelaVo modelSet) {
+    public AjaxResult modelSetRela(@RequestBody MdModelSetRelaVo modelSet) {
         modelSet.setCreateBy(getUsername());
         return toAjax(mdModelInfoService.modelSetRela(modelSet));
     }
+
     @DeleteMapping("/modelSetRela")
-    public  AjaxResult deleteModelSetRela(MdModelSetRelaVo modelSet) {
+    public AjaxResult deleteModelSetRela(MdModelSetRelaVo modelSet) {
         return toAjax(mdModelInfoService.deleteModelSetRela(modelSet));
     }
 

+ 7 - 0
ruoyi-api-patform/src/main/java/com/ruoyi/interfaces/controller/MyAttentionController.java

@@ -1,6 +1,7 @@
 package com.ruoyi.interfaces.controller;
 
 import com.github.pagehelper.PageHelper;
+import com.ruoyi.common.utils.SM4Util;
 import com.ruoyi.interfaces.core.page.Page;
 import com.ruoyi.interfaces.core.page.PageParam;
 import com.ruoyi.interfaces.core.page.PageUtils;
@@ -30,6 +31,9 @@ public class MyAttentionController extends BaseController {
     @Autowired
     private PtServiceMapper ptServiceMapper;
 
+    @Autowired
+    private SM4Util  sm4Util;
+
     @ApiOperation("添加关注")
     @RequestMapping(value = "/insert", method = RequestMethod.POST)
     public AjaxResult insertAttention(@RequestBody MyAttention myAttention) {
@@ -38,6 +42,9 @@ public class MyAttentionController extends BaseController {
         }
         myAttention.setUserId(String.valueOf(getUserId()));
         PtService ptService = ptServiceMapper.selectByPrimaryKey(myAttention.getSrvId());
+        ptService.setDevelopContacter(sm4Util.decrypt(ptService.getDevelopContacter()));
+        ptService.setMaintainContacer(sm4Util.decrypt(ptService.getMaintainContacer()));
+        ptService.setAdName(sm4Util.decrypt(ptService.getAdName()));
         if (ptService == null) {
             return AjaxResult.error("传参异常【srvId】");
         }

+ 28 - 0
ruoyi-api-patform/src/main/java/com/ruoyi/interfaces/controller/PtServiceController.java

@@ -10,6 +10,7 @@ import com.ruoyi.common.core.page.TableDataInfo;
 import com.ruoyi.common.utils.DateUtils;
 import com.ruoyi.common.utils.ExceptionUtil;
 import com.ruoyi.common.utils.JsonUtils;
+import com.ruoyi.common.utils.SM4Util;
 import com.ruoyi.interfaces.core.page.Page;
 import com.ruoyi.interfaces.core.page.PageParam;
 import com.ruoyi.interfaces.core.page.PageUtils;
@@ -51,6 +52,9 @@ public class PtServiceController extends BaseController {
     @Autowired
     private IPtServiceRunLogService serviceRunLogService;
 
+    @Autowired
+    private SM4Util sm4Util;
+
     @ApiOperation("添加数据")
     @PostMapping(value = "/save")
     public AjaxResult save(@RequestBody PtService ptService) {
@@ -58,6 +62,10 @@ public class PtServiceController extends BaseController {
             ptService.setViewNum(0);
         }
         ptService.setAudit("0");
+        ptService.setDevelopContacter(sm4Util.encrypt(ptService.getDevelopContacter()));
+        ptService.setMaintainContacer(sm4Util.encrypt(ptService.getMaintainContacer()));
+        ptService.setAdName(sm4Util.encrypt(ptService.getAdName()));
+
         boolean save = ptServiceService.save(ptService);
         if (save) {
             return AjaxResult.success(ptService);
@@ -104,6 +112,7 @@ public class PtServiceController extends BaseController {
     @RequestMapping(value = "/get")
     public AjaxResult get(@RequestParam String srvId) {
         PtService ptService = ptServiceMapper.selectByPrimaryKey(srvId);
+
         ptService.setViewNum(ptService.getViewNum() + 1);
         ptServiceMapper.updateByPrimaryKeySelective(ptService);
 
@@ -114,6 +123,11 @@ public class PtServiceController extends BaseController {
         ptService.setUrl(url);
         ptService.setExample(url + "?accessToken='值'");
         Map<String, Object> map = new HashMap<>(3);
+
+        ptService.setDevelopContacter(sm4Util.decrypt(ptService.getDevelopContacter()));
+        ptService.setMaintainContacer(sm4Util.decrypt(ptService.getMaintainContacer()));
+        ptService.setAdName(sm4Util.decrypt(ptService.getAdName()));
+
         map.put("ptService", ptService);
         map.put("list", list);
         map.put("returnList", returnList);
@@ -125,6 +139,10 @@ public class PtServiceController extends BaseController {
     @RequestMapping(value = "/get/{srvId}")
     public AjaxResult getById(@PathVariable String srvId) {
         PtService ptService = ptServiceMapper.selectByPrimaryKey(srvId);
+        ptService.setDevelopContacter(sm4Util.decrypt(ptService.getDevelopContacter()));
+        ptService.setMaintainContacer(sm4Util.decrypt(ptService.getMaintainContacer()));
+        ptService.setAdName(sm4Util.decrypt(ptService.getAdName()));
+
         List<PtServiceParam> list = ptServiceParamMapper.selectAll(srvId);
         List<PtServiceReturn> returnList = ptServiceReturnService.selectPtServiceReturnBySrvId(srvId);
         List<PtServiceFile> fileList = ptServiceFileService.selectAll(srvId);
@@ -150,6 +168,7 @@ public class PtServiceController extends BaseController {
     public Page publicList(@RequestBody PageParam<PtService> ptServicePage) {
         PageHelper.startPage(ptServicePage);
         List<PtService> list = ptServiceMapper.selectAllPublic(ptServicePage.getData());
+
         PageInfo<PtService> pageInfo = new PageInfo<>(list);
         return PageUtils.convert(pageInfo);
     }
@@ -161,6 +180,11 @@ public class PtServiceController extends BaseController {
         PtService service = Optional.ofNullable(ptServicePage.getData()).orElse(new PtService());
         service.setStatus("1");
         List<PtService> list = ptServiceMapper.selectAllPublic(ptServicePage.getData());
+        list.forEach(p->{
+            p.setDevelopContacter(sm4Util.decrypt(p.getDevelopContacter()));
+            p.setMaintainContacer(sm4Util.decrypt(p.getMaintainContacer()));
+            p.setAdName(sm4Util.decrypt(p.getAdName()));
+        });
         PageInfo<PtService> pageInfo = new PageInfo<>(list);
         return PageUtils.convert(pageInfo);
     }
@@ -181,6 +205,10 @@ public class PtServiceController extends BaseController {
 
     @PutMapping()
     public AjaxResult put(@RequestBody PtService ptService) {
+        ptService.setDevelopContacter(sm4Util.encrypt(ptService.getDevelopContacter()));
+        ptService.setMaintainContacer(sm4Util.encrypt(ptService.getMaintainContacer()));
+        ptService.setAdName(sm4Util.encrypt(ptService.getAdName()));
+
         return AjaxResult.success(ptServiceService.put(ptService));
     }
 

+ 4 - 0
ruoyi-api-patform/src/main/java/com/ruoyi/interfaces/domain/vo/MdFlowDispatchVo.java

@@ -171,6 +171,10 @@ public class MdFlowDispatchVo extends JobRequestVo {
         this.updateTime = updateTime;
     }
 
+    public void flowParamStringSetNull(){
+        this.flowParamString = null;
+    }
+
     public String getFlowParamString() {
         if (StringUtils.isEmpty(flowParamString) && StringUtils.isNotEmpty(flowParam)) {
             flowParamString = JsonUtils.objectToJson(flowParam);

+ 5 - 2
ruoyi-api-patform/src/main/java/com/ruoyi/interfaces/service/impl/MdFlowDispatchServiceImpl.java

@@ -33,7 +33,7 @@ public class MdFlowDispatchServiceImpl implements IMdFlowDispatchService {
 
         HashMap<String, Object> argsMap = new HashMap<>();
         argsMap.put("appId", jobRequest.getAppId());
-        argsMap.put("flowParam", jobRequest.getFlowParam());
+        argsMap.put("params", jobRequest.getFlowParam());
 
 
         jobRequest.setArgsStrMap(argsMap);
@@ -78,9 +78,11 @@ public class MdFlowDispatchServiceImpl implements IMdFlowDispatchService {
 
     @Override
     public Long update(MdFlowDispatchVo flowDispatchVo) {
+        flowDispatchVo.flowParamStringSetNull();
+
         HashMap<String, Object> argsMap = new HashMap<>();
         argsMap.put("appId", flowDispatchVo.getAppId());
-        argsMap.put("flowParam", flowDispatchVo.getFlowParam());
+        argsMap.put("params", flowDispatchVo.getFlowParam());
 
 
         flowDispatchVo.setArgsStrMap(argsMap);
@@ -106,6 +108,7 @@ public class MdFlowDispatchServiceImpl implements IMdFlowDispatchService {
         if (!updateState) {
             return 0L;
         }
+
         return flowDispatchMapper.updateMdFlowJob(flowDispatchVo);
     }
 

+ 15 - 2
ruoyi-api-patform/src/main/java/com/ruoyi/interfaces/service/impl/MdModelInfoServiceImpl.java

@@ -3,6 +3,7 @@ package com.ruoyi.interfaces.service.impl;
 import java.util.List;
 
 import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.common.utils.SM4Util;
 import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.common.utils.uuid.IdUtils;
 import com.ruoyi.interfaces.domain.MdModelInfo;
@@ -27,6 +28,8 @@ public class MdModelInfoServiceImpl implements IMdModelInfoService {
     @Autowired
     private IMdModelFileService mdModelFileService;
 
+    @Autowired
+    private SM4Util sm4Util;
 
     /**
      * 查询模型信息
@@ -36,7 +39,11 @@ public class MdModelInfoServiceImpl implements IMdModelInfoService {
      */
     @Override
     public MdModelInfo selectMdModelInfoByMdid(String mdid) {
-        return mdModelInfoMapper.selectMdModelInfoByMdid(mdid);
+        MdModelInfo mdModelInfo = mdModelInfoMapper.selectMdModelInfoByMdid(mdid);
+        mdModelInfo.setMdContact(sm4Util.decrypt(mdModelInfo.getMdContact()));
+        mdModelInfo.setDevContact(sm4Util.decrypt(mdModelInfo.getDevContact()));
+
+        return mdModelInfo;
     }
 
     /**
@@ -47,7 +54,13 @@ public class MdModelInfoServiceImpl implements IMdModelInfoService {
      */
     @Override
     public List<MdModelInfo> selectMdModelInfoList(MdModelInfo mdModelInfo) {
-        return mdModelInfoMapper.selectMdModelInfoList(mdModelInfo);
+        List<MdModelInfo> mdModelInfos = mdModelInfoMapper.selectMdModelInfoList(mdModelInfo);
+        mdModelInfos.forEach(p->{
+            p.setMdContact(sm4Util.decrypt(p.getMdContact()));
+            p.setDevContact(sm4Util.decrypt(p.getDevContact()));
+
+        });
+        return mdModelInfos;
     }
 
     /**

+ 19 - 6
ruoyi-api-patform/src/main/java/com/ruoyi/interfaces/service/impl/PtServiceServiceImpl.java

@@ -4,10 +4,7 @@ import com.alibaba.fastjson2.JSON;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ruoyi.common.config.RuoYiConfig;
 import com.ruoyi.common.constant.Constants;
-import com.ruoyi.common.utils.DateUtils;
-import com.ruoyi.common.utils.JsonUtils;
-import com.ruoyi.common.utils.RedisOperator;
-import com.ruoyi.common.utils.SecurityUtils;
+import com.ruoyi.common.utils.*;
 import com.ruoyi.common.utils.http.HttpUtils;
 import com.ruoyi.common.utils.uuid.IdUtils;
 import com.ruoyi.interfaces.domain.PtService;
@@ -44,6 +41,9 @@ public class PtServiceServiceImpl extends ServiceImpl<PtServiceMapper, PtService
     @Autowired
     private PtServiceParamMapper ptServiceParamMapper;
 
+    @Autowired
+    private SM4Util sm4Util;
+
     public PtServiceServiceImpl(PtServiceMapper ptServiceMapper, RedisOperator redisOperator) {
         this.ptServiceMapper = ptServiceMapper;
         this.redisOperator = redisOperator;
@@ -114,12 +114,25 @@ public class PtServiceServiceImpl extends ServiceImpl<PtServiceMapper, PtService
      */
     @Override
     public MdModelInfoVo modelService(MdModelInfoVo par) {
-        return ptServiceMapper.selectModelService(par);
+        MdModelInfoVo mdModelInfoVo = ptServiceMapper.selectModelService(par);
+        mdModelInfoVo.getServiceList().forEach(p -> {
+            p.setDevelopContacter(sm4Util.decrypt(p.getDevelopContacter()));
+            p.setMaintainContacer(sm4Util.decrypt(p.getMaintainContacer()));
+            p.setAdName(sm4Util.decrypt(p.getAdName()));
+
+        });
+        return mdModelInfoVo;
     }
 
     @Override
     public List<PtService> selectAllColumns(PtService ptService) {
-        return ptServiceMapper.selectAllColumns(ptService);
+        List<PtService> ptServices = ptServiceMapper.selectAllColumns(ptService);
+        ptServices.forEach(p -> {
+            p.setDevelopContacter(sm4Util.decrypt(p.getDevelopContacter()));
+            p.setMaintainContacer(sm4Util.decrypt(p.getMaintainContacer()));
+            p.setAdName(sm4Util.decrypt(p.getAdName()));
+        });
+        return ptServices;
     }
 
     @Override

+ 1 - 0
ruoyi-api-patform/src/main/java/com/ruoyi/interfaces/snailJob/FlowJob.java

@@ -26,6 +26,7 @@ public class FlowJob {
         System.out.println(jobArgs.getJobParams());
         MdAppFlow flowPar = JsonUtils.jsonToPojo(jobArgs.getJobParams().toString(), MdAppFlow.class);
         MdAppFlow mdAppFlow = mdAppFlowService.selectMdAppFlowByAppId(flowPar.getAppId());
+        System.out.println(mdAppFlow.getFlowGraph());
         Tinyflow tinyflow = TinyflowUtil.getTinyflow(mdAppFlow.getFlowGraph());
         Chain chain = tinyflow.toChain();
         Map<String, Object> stringObjectMap = chain.executeForResult(flowPar.getParams());

+ 0 - 1
ruoyi-api-patform/src/main/resources/mapper/interfaces/PtServiceMapper.xml

@@ -445,7 +445,6 @@ PUBLISH_TIME
             <if test="uptm != null">UPTM = #{uptm},</if>
             <if test="rlstm != null">RLSTM = #{rlstm},</if>
             <if test="sort != null">SORT = #{sort},</if>
-
         </trim>
         where SRV_ID = #{srvId,jdbcType=VARCHAR}
     </update>

+ 20 - 0
ruoyi-common/src/main/java/com/ruoyi/common/config/Sm4Config.java

@@ -0,0 +1,20 @@
+package com.ruoyi.common.config;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.context.annotation.Configuration;
+
+@Configuration
+@ConfigurationProperties(prefix = "sm4")
+public class Sm4Config {
+    
+    private String secretKey;
+
+    // getter 和 setter
+    public String getSecretKey() {
+        return secretKey;
+    }
+
+    public void setSecretKey(String secretKey) {
+        this.secretKey = secretKey;
+    }
+}

+ 68 - 27
ruoyi-common/src/main/java/com/ruoyi/common/utils/sm4/SM4Util.java → ruoyi-common/src/main/java/com/ruoyi/common/utils/SM4Util.java

@@ -1,6 +1,9 @@
-package com.ruoyi.common.utils.sm4;
+package com.ruoyi.common.utils;
 
+import com.ruoyi.common.config.Sm4Config;
 import org.bouncycastle.jce.provider.BouncyCastleProvider;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
 
 import javax.crypto.Cipher;
 import javax.crypto.spec.SecretKeySpec;
@@ -9,11 +12,15 @@ import java.security.Security;
 import java.util.Base64;
 
 /**
- * SM4加密算法静态工具类
- * 使用硬编码固定密钥,通过静态方法直接调用
+ * SM4加密算法工具类
+ * 使用固定密钥,直接从配置文件读取
+ * 兼容Java 8版本
  */
+@Component
 public class SM4Util {
 
+    private final byte[] key;
+
     static {
         // 添加BouncyCastleProvider
         Security.addProvider(new BouncyCastleProvider());
@@ -23,14 +30,46 @@ public class SM4Util {
     private static final String ALGORITHM_NAME = "SM4";
     private static final String ALGORITHM_NAME_ECB_PADDING = "SM4/ECB/PKCS5Padding";
 
-    // 硬编码的固定密钥(16字节)
-    // 在实际项目中,请替换为您自己的密钥
-    private static final byte[] SECRET_KEY = {
-        (byte) 0x01, (byte) 0x23, (byte) 0x45, (byte) 0x67,
-        (byte) 0x89, (byte) 0xAB, (byte) 0xCD, (byte) 0xEF,
-        (byte) 0xFE, (byte) 0xDC, (byte) 0xBA, (byte) 0x98,
-        (byte) 0x76, (byte) 0x54, (byte) 0x32, (byte) 0x10
-    };
+    @Autowired
+    public SM4Util(Sm4Config sm4Config) {
+        // 从配置文件中读取密钥并转换为字节数组
+        this.key = hexStringToBytes(sm4Config.getSecretKey());
+        if (this.key.length != 16) {
+            throw new IllegalArgumentException("SM4密钥必须是16字节(32位十六进制字符串)");
+        }
+    }
+
+    /**
+     * 将十六进制字符串转换为字节数组(兼容Java 8)
+     */
+    private byte[] hexStringToBytes(String hexString) {
+        if (hexString == null || hexString.length() % 2 != 0) {
+            throw new IllegalArgumentException("无效的十六进制字符串");
+        }
+
+        int len = hexString.length();
+        byte[] data = new byte[len / 2];
+        for (int i = 0; i < len; i += 2) {
+            data[i / 2] = (byte) ((Character.digit(hexString.charAt(i), 16) << 4)
+                    + Character.digit(hexString.charAt(i + 1), 16));
+        }
+        return data;
+    }
+
+    /**
+     * 将字节数组转换为十六进制字符串(兼容Java 8)
+     */
+    private String bytesToHexString(byte[] bytes) {
+        StringBuilder hexString = new StringBuilder();
+        for (byte b : bytes) {
+            String hex = Integer.toHexString(0xff & b);
+            if (hex.length() == 1) {
+                hexString.append('0');
+            }
+            hexString.append(hex);
+        }
+        return hexString.toString().toUpperCase();
+    }
 
     /**
      * 加密字符串
@@ -38,10 +77,11 @@ public class SM4Util {
      * @param data 待加密的字符串
      * @return Base64编码的加密结果
      */
-    public static String encrypt(String data) {
+    public String encrypt(String data) {
+        if (StringUtils.isNull(data)) return null;
         try {
             Cipher cipher = Cipher.getInstance(ALGORITHM_NAME_ECB_PADDING, BouncyCastleProvider.PROVIDER_NAME);
-            SecretKeySpec secretKeySpec = new SecretKeySpec(SECRET_KEY, ALGORITHM_NAME);
+            SecretKeySpec secretKeySpec = new SecretKeySpec(key, ALGORITHM_NAME);
             cipher.init(Cipher.ENCRYPT_MODE, secretKeySpec);
             byte[] encrypted = cipher.doFinal(data.getBytes(StandardCharsets.UTF_8));
             return Base64.getEncoder().encodeToString(encrypted);
@@ -56,10 +96,11 @@ public class SM4Util {
      * @param encryptedData Base64编码的加密数据
      * @return 解密后的原始字符串
      */
-    public static String decrypt(String encryptedData) {
+    public String decrypt(String encryptedData) {
+        if (StringUtils.isNull(encryptedData)) return null;
         try {
             Cipher cipher = Cipher.getInstance(ALGORITHM_NAME_ECB_PADDING, BouncyCastleProvider.PROVIDER_NAME);
-            SecretKeySpec secretKeySpec = new SecretKeySpec(SECRET_KEY, ALGORITHM_NAME);
+            SecretKeySpec secretKeySpec = new SecretKeySpec(key, ALGORITHM_NAME);
             cipher.init(Cipher.DECRYPT_MODE, secretKeySpec);
             byte[] encryptedBytes = Base64.getDecoder().decode(encryptedData);
             byte[] decrypted = cipher.doFinal(encryptedBytes);
@@ -75,10 +116,10 @@ public class SM4Util {
      * @param data 待加密的字节数组
      * @return 加密后的字节数组
      */
-    public static byte[] encrypt(byte[] data) {
+    public byte[] encrypt(byte[] data) {
         try {
             Cipher cipher = Cipher.getInstance(ALGORITHM_NAME_ECB_PADDING, BouncyCastleProvider.PROVIDER_NAME);
-            SecretKeySpec secretKeySpec = new SecretKeySpec(SECRET_KEY, ALGORITHM_NAME);
+            SecretKeySpec secretKeySpec = new SecretKeySpec(key, ALGORITHM_NAME);
             cipher.init(Cipher.ENCRYPT_MODE, secretKeySpec);
             return cipher.doFinal(data);
         } catch (Exception e) {
@@ -92,10 +133,10 @@ public class SM4Util {
      * @param encryptedData 加密的字节数组
      * @return 解密后的原始字节数组
      */
-    public static byte[] decrypt(byte[] encryptedData) {
+    public byte[] decrypt(byte[] encryptedData) {
         try {
             Cipher cipher = Cipher.getInstance(ALGORITHM_NAME_ECB_PADDING, BouncyCastleProvider.PROVIDER_NAME);
-            SecretKeySpec secretKeySpec = new SecretKeySpec(SECRET_KEY, ALGORITHM_NAME);
+            SecretKeySpec secretKeySpec = new SecretKeySpec(key, ALGORITHM_NAME);
             cipher.init(Cipher.DECRYPT_MODE, secretKeySpec);
             return cipher.doFinal(encryptedData);
         } catch (Exception e) {
@@ -103,10 +144,17 @@ public class SM4Util {
         }
     }
 
+    /**
+     * 获取当前使用的密钥(十六进制格式)
+     */
+    public String getKeyHex() {
+        return bytesToHexString(key);
+    }
+
     /**
      * 验证加密解密功能是否正常
      */
-    public static boolean selfCheck() {
+    public boolean selfCheck() {
         try {
             String testData = "SM4测试数据123";
             String encrypted = encrypt(testData);
@@ -116,11 +164,4 @@ public class SM4Util {
             return false;
         }
     }
-
-    /**
-     * 获取密钥信息(用于调试)
-     */
-    public static String getKeyInfo() {
-        return "SM4密钥已硬编码在工具类中,长度: " + SECRET_KEY.length + " 字节";
-    }
 }

+ 68 - 90
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java

@@ -4,6 +4,8 @@ import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
 import java.util.stream.Collectors;
+
+import com.ruoyi.common.utils.SM4Util;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.ruoyi.common.annotation.DataScope;
@@ -23,66 +25,68 @@ import com.ruoyi.system.service.ISysDeptService;
 
 /**
  * 部门管理 服务实现
- * 
+ *
  * @author ruoyi
  */
 @Service
-public class SysDeptServiceImpl implements ISysDeptService
-{
+public class SysDeptServiceImpl implements ISysDeptService {
     @Autowired
     private SysDeptMapper deptMapper;
 
     @Autowired
     private SysRoleMapper roleMapper;
 
+    @Autowired
+    private SM4Util sm4Util;
+
     /**
      * 查询部门管理数据
-     * 
+     *
      * @param dept 部门信息
      * @return 部门信息集合
      */
     @Override
     @DataScope(deptAlias = "d")
-    public List<SysDept> selectDeptList(SysDept dept)
-    {
-        return deptMapper.selectDeptList(dept);
+    public List<SysDept> selectDeptList(SysDept dept) {
+        List<SysDept> sysDepts = deptMapper.selectDeptList(dept);
+        sysDepts.forEach(p -> {
+            p.setPhone(sm4Util.decrypt(p.getPhone()));
+
+        });
+        return sysDepts;
     }
 
     /**
      * 查询部门树结构信息
-     * 
+     *
      * @param dept 部门信息
      * @return 部门树信息集合
      */
     @Override
-    public List<TreeSelect> selectDeptTreeList(SysDept dept)
-    {
+    public List<TreeSelect> selectDeptTreeList(SysDept dept) {
         List<SysDept> depts = SpringUtils.getAopProxy(this).selectDeptList(dept);
+
         return buildDeptTreeSelect(depts);
     }
 
     /**
      * 构建前端所需要树结构
-     * 
+     *
      * @param depts 部门列表
      * @return 树结构列表
      */
     @Override
-    public List<SysDept> buildDeptTree(List<SysDept> depts)
-    {
+    public List<SysDept> buildDeptTree(List<SysDept> depts) {
         List<SysDept> returnList = new ArrayList<SysDept>();
         List<Long> tempList = depts.stream().map(SysDept::getDeptId).collect(Collectors.toList());
-        for (SysDept dept : depts)
-        {
+        for (SysDept dept : depts) {
             // 如果是顶级节点, 遍历该父节点的所有子节点
-            if (!tempList.contains(dept.getParentId()))
-            {
+            if (!tempList.contains(dept.getParentId())) {
                 recursionFn(depts, dept);
                 returnList.add(dept);
             }
         }
-        if (returnList.isEmpty())
-        {
+        if (returnList.isEmpty()) {
             returnList = depts;
         }
         return returnList;
@@ -90,93 +94,87 @@ public class SysDeptServiceImpl implements ISysDeptService
 
     /**
      * 构建前端所需要下拉树结构
-     * 
+     *
      * @param depts 部门列表
      * @return 下拉树结构列表
      */
     @Override
-    public List<TreeSelect> buildDeptTreeSelect(List<SysDept> depts)
-    {
+    public List<TreeSelect> buildDeptTreeSelect(List<SysDept> depts) {
         List<SysDept> deptTrees = buildDeptTree(depts);
         return deptTrees.stream().map(TreeSelect::new).collect(Collectors.toList());
     }
 
     /**
      * 根据角色ID查询部门树信息
-     * 
+     *
      * @param roleId 角色ID
      * @return 选中部门列表
      */
     @Override
-    public List<Long> selectDeptListByRoleId(Long roleId)
-    {
+    public List<Long> selectDeptListByRoleId(Long roleId) {
         SysRole role = roleMapper.selectRoleById(roleId);
         return deptMapper.selectDeptListByRoleId(roleId, role.isDeptCheckStrictly());
     }
 
     /**
      * 根据部门ID查询信息
-     * 
+     *
      * @param deptId 部门ID
      * @return 部门信息
      */
     @Override
-    public SysDept selectDeptById(Long deptId)
-    {
-        return deptMapper.selectDeptById(deptId);
+    public SysDept selectDeptById(Long deptId) {
+        SysDept sysDept = deptMapper.selectDeptById(deptId);
+        sysDept.setPhone(sm4Util.decrypt(sysDept.getPhone()));
+        return sysDept;
     }
 
     /**
      * 根据ID查询所有子部门(正常状态)
-     * 
+     *
      * @param deptId 部门ID
      * @return 子部门数
      */
     @Override
-    public int selectNormalChildrenDeptById(Long deptId)
-    {
+    public int selectNormalChildrenDeptById(Long deptId) {
         return deptMapper.selectNormalChildrenDeptById(deptId);
     }
 
     /**
      * 是否存在子节点
-     * 
+     *
      * @param deptId 部门ID
      * @return 结果
      */
     @Override
-    public boolean hasChildByDeptId(Long deptId)
-    {
+    public boolean hasChildByDeptId(Long deptId) {
         int result = deptMapper.hasChildByDeptId(deptId);
         return result > 0;
     }
 
     /**
      * 查询部门是否存在用户
-     * 
+     *
      * @param deptId 部门ID
      * @return 结果 true 存在 false 不存在
      */
     @Override
-    public boolean checkDeptExistUser(Long deptId)
-    {
+    public boolean checkDeptExistUser(Long deptId) {
         int result = deptMapper.checkDeptExistUser(deptId);
         return result > 0;
     }
 
     /**
      * 校验部门名称是否唯一
-     * 
+     *
      * @param dept 部门信息
      * @return 结果
      */
     @Override
-    public boolean checkDeptNameUnique(SysDept dept)
-    {
+    public boolean checkDeptNameUnique(SysDept dept) {
         Long deptId = StringUtils.isNull(dept.getDeptId()) ? -1L : dept.getDeptId();
         SysDept info = deptMapper.checkDeptNameUnique(dept.getDeptName(), dept.getParentId());
-        if (StringUtils.isNotNull(info) && info.getDeptId().longValue() != deptId.longValue())
-        {
+        if (StringUtils.isNotNull(info) && info.getDeptId().longValue() != deptId.longValue()) {
             return UserConstants.NOT_UNIQUE;
         }
         return UserConstants.UNIQUE;
@@ -184,19 +182,16 @@ public class SysDeptServiceImpl implements ISysDeptService
 
     /**
      * 校验部门是否有数据权限
-     * 
+     *
      * @param deptId 部门id
      */
     @Override
-    public void checkDeptDataScope(Long deptId)
-    {
-        if (!SysUser.isAdmin(SecurityUtils.getUserId()) && StringUtils.isNotNull(deptId))
-        {
+    public void checkDeptDataScope(Long deptId) {
+        if (!SysUser.isAdmin(SecurityUtils.getUserId()) && StringUtils.isNotNull(deptId)) {
             SysDept dept = new SysDept();
             dept.setDeptId(deptId);
             List<SysDept> depts = SpringUtils.getAopProxy(this).selectDeptList(dept);
-            if (StringUtils.isEmpty(depts))
-            {
+            if (StringUtils.isEmpty(depts)) {
                 throw new ServiceException("没有权限访问部门数据!");
             }
         }
@@ -204,17 +199,15 @@ public class SysDeptServiceImpl implements ISysDeptService
 
     /**
      * 新增保存部门信息
-     * 
+     *
      * @param dept 部门信息
      * @return 结果
      */
     @Override
-    public int insertDept(SysDept dept)
-    {
+    public int insertDept(SysDept dept) {
         SysDept info = deptMapper.selectDeptById(dept.getParentId());
         // 如果父节点不为正常状态,则不允许新增子节点
-        if (!UserConstants.DEPT_NORMAL.equals(info.getStatus()))
-        {
+        if (!UserConstants.DEPT_NORMAL.equals(info.getStatus())) {
             throw new ServiceException("部门停用,不允许新增");
         }
         dept.setAncestors(info.getAncestors() + "," + dept.getParentId());
@@ -223,17 +216,15 @@ public class SysDeptServiceImpl implements ISysDeptService
 
     /**
      * 修改保存部门信息
-     * 
+     *
      * @param dept 部门信息
      * @return 结果
      */
     @Override
-    public int updateDept(SysDept dept)
-    {
+    public int updateDept(SysDept dept) {
         SysDept newParentDept = deptMapper.selectDeptById(dept.getParentId());
         SysDept oldDept = deptMapper.selectDeptById(dept.getDeptId());
-        if (StringUtils.isNotNull(newParentDept) && StringUtils.isNotNull(oldDept))
-        {
+        if (StringUtils.isNotNull(newParentDept) && StringUtils.isNotNull(oldDept)) {
             String newAncestors = newParentDept.getAncestors() + "," + newParentDept.getDeptId();
             String oldAncestors = oldDept.getAncestors();
             dept.setAncestors(newAncestors);
@@ -241,8 +232,7 @@ public class SysDeptServiceImpl implements ISysDeptService
         }
         int result = deptMapper.updateDept(dept);
         if (UserConstants.DEPT_NORMAL.equals(dept.getStatus()) && StringUtils.isNotEmpty(dept.getAncestors())
-                && !StringUtils.equals("0", dept.getAncestors()))
-        {
+                && !StringUtils.equals("0", dept.getAncestors())) {
             // 如果该部门是启用状态,则启用该部门的所有上级部门
             updateParentDeptStatusNormal(dept);
         }
@@ -251,11 +241,10 @@ public class SysDeptServiceImpl implements ISysDeptService
 
     /**
      * 修改该部门的父级部门状态
-     * 
+     *
      * @param dept 当前部门
      */
-    private void updateParentDeptStatusNormal(SysDept dept)
-    {
+    private void updateParentDeptStatusNormal(SysDept dept) {
         String ancestors = dept.getAncestors();
         Long[] deptIds = Convert.toLongArray(ancestors);
         deptMapper.updateDeptStatusNormal(deptIds);
@@ -263,48 +252,41 @@ public class SysDeptServiceImpl implements ISysDeptService
 
     /**
      * 修改子元素关系
-     * 
-     * @param deptId 被修改的部门ID
+     *
+     * @param deptId       被修改的部门ID
      * @param newAncestors 新的父ID集合
      * @param oldAncestors 旧的父ID集合
      */
-    public void updateDeptChildren(Long deptId, String newAncestors, String oldAncestors)
-    {
+    public void updateDeptChildren(Long deptId, String newAncestors, String oldAncestors) {
         List<SysDept> children = deptMapper.selectChildrenDeptById(deptId);
-        for (SysDept child : children)
-        {
+        for (SysDept child : children) {
             child.setAncestors(child.getAncestors().replaceFirst(oldAncestors, newAncestors));
         }
-        if (children.size() > 0)
-        {
+        if (children.size() > 0) {
             deptMapper.updateDeptChildren(children);
         }
     }
 
     /**
      * 删除部门管理信息
-     * 
+     *
      * @param deptId 部门ID
      * @return 结果
      */
     @Override
-    public int deleteDeptById(Long deptId)
-    {
+    public int deleteDeptById(Long deptId) {
         return deptMapper.deleteDeptById(deptId);
     }
 
     /**
      * 递归列表
      */
-    private void recursionFn(List<SysDept> list, SysDept t)
-    {
+    private void recursionFn(List<SysDept> list, SysDept t) {
         // 得到子节点列表
         List<SysDept> childList = getChildList(list, t);
         t.setChildren(childList);
-        for (SysDept tChild : childList)
-        {
-            if (hasChild(list, tChild))
-            {
+        for (SysDept tChild : childList) {
+            if (hasChild(list, tChild)) {
                 recursionFn(list, tChild);
             }
         }
@@ -313,15 +295,12 @@ public class SysDeptServiceImpl implements ISysDeptService
     /**
      * 得到子节点列表
      */
-    private List<SysDept> getChildList(List<SysDept> list, SysDept t)
-    {
+    private List<SysDept> getChildList(List<SysDept> list, SysDept t) {
         List<SysDept> tlist = new ArrayList<SysDept>();
         Iterator<SysDept> it = list.iterator();
-        while (it.hasNext())
-        {
+        while (it.hasNext()) {
             SysDept n = (SysDept) it.next();
-            if (StringUtils.isNotNull(n.getParentId()) && n.getParentId().longValue() == t.getDeptId().longValue())
-            {
+            if (StringUtils.isNotNull(n.getParentId()) && n.getParentId().longValue() == t.getDeptId().longValue()) {
                 tlist.add(n);
             }
         }
@@ -331,8 +310,7 @@ public class SysDeptServiceImpl implements ISysDeptService
     /**
      * 判断是否有子节点
      */
-    private boolean hasChild(List<SysDept> list, SysDept t)
-    {
+    private boolean hasChild(List<SysDept> list, SysDept t) {
         return getChildList(list, t).size() > 0;
     }
 }

+ 19 - 3
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java

@@ -5,6 +5,7 @@ import com.ruoyi.common.constant.UserConstants;
 import com.ruoyi.common.core.domain.entity.SysRole;
 import com.ruoyi.common.core.domain.entity.SysUser;
 import com.ruoyi.common.exception.ServiceException;
+import com.ruoyi.common.utils.SM4Util;
 import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.common.utils.bean.BeanValidators;
@@ -62,6 +63,9 @@ public class SysUserServiceImpl implements ISysUserService
     @Autowired
     protected Validator validator;
 
+    @Autowired
+    private SM4Util sm4Util;
+
     /**
      * 根据条件分页查询用户列表
      * 
@@ -72,7 +76,12 @@ public class SysUserServiceImpl implements ISysUserService
     @DataScope(deptAlias = "d", userAlias = "u")
     public List<SysUser> selectUserList(SysUser user)
     {
-        return userMapper.selectUserList(user);
+        List<SysUser> sysUsers = userMapper.selectUserList(user);
+        sysUsers.forEach(p->{
+            p.setPhonenumber(sm4Util.decrypt(p.getPhonenumber()));
+        });
+
+        return sysUsers;
     }
 
     /**
@@ -85,7 +94,12 @@ public class SysUserServiceImpl implements ISysUserService
     @DataScope(deptAlias = "d", userAlias = "u")
     public List<SysUser> selectAllocatedList(SysUser user)
     {
-        return userMapper.selectAllocatedList(user);
+        List<SysUser> sysUsers = userMapper.selectAllocatedList(user);
+        sysUsers.forEach(p->{
+            p.setPhonenumber(sm4Util.decrypt(p.getPhonenumber()));
+        });
+
+        return sysUsers;
     }
 
     /**
@@ -122,7 +136,9 @@ public class SysUserServiceImpl implements ISysUserService
     @Override
     public SysUser selectUserById(Long userId)
     {
-        return userMapper.selectUserById(userId);
+        SysUser sysUser = userMapper.selectUserById(userId);
+        sysUser.setPhonenumber(sm4Util.decrypt(sysUser.getPhonenumber()));
+        return sysUser;
     }
 
     /**