From f0b4d0e6bc47a18f4e10ca4c007dcaa01c9c9647 Mon Sep 17 00:00:00 2001
From: xuhy <3313886187@qq.com>
Date: 星期二, 16 五月 2023 15:10:35 +0800
Subject: [PATCH] BUG修改

---
 management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TSystemConfigController.java |   34 ++++++++++++++++++++++++++--------
 1 files changed, 26 insertions(+), 8 deletions(-)

diff --git a/management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TSystemConfigController.java b/management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TSystemConfigController.java
index 86ffb3a..faea423 100644
--- a/management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TSystemConfigController.java
+++ b/management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TSystemConfigController.java
@@ -4,6 +4,11 @@
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.mapper.EntityWrapper;
 import com.stylefeng.guns.core.base.controller.BaseController;
+import com.stylefeng.guns.core.shiro.ShiroKit;
+import com.stylefeng.guns.modular.system.model.TAgent;
+import com.stylefeng.guns.modular.system.model.TBranchOffice;
+import com.stylefeng.guns.modular.system.service.ITAgentService;
+import com.stylefeng.guns.modular.system.service.ITBranchOfficeService;
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.ResponseBody;
@@ -18,6 +23,7 @@
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
+import java.util.Objects;
 
 /**
  * 控制器
@@ -33,6 +39,8 @@
 
     @Autowired
     private ITSystemConfigService tSystemConfigService;
+    @Autowired
+    private ITAgentService agentService;
 
     /**
      * 跳转到首页
@@ -191,14 +199,24 @@
     @ResponseBody
     public Object systemConfigSubmit(Integer type,String content) {
 
-        TSystemConfig tSystemConfig = tSystemConfigService.selectOne(new EntityWrapper<TSystemConfig>().eq("type", type)
-                .last("LIMIT 1"));
-
-        System.err.println(content);
-
-        tSystemConfig.setContent(content);
-
-        return tSystemConfigService.updateById(tSystemConfig);
+        Integer roleType = Objects.requireNonNull(ShiroKit.getUser()).getRoleType();
+        Integer objectId = Objects.requireNonNull(ShiroKit.getUser()).getObjectId();
+        if(roleType == 1){
+            TSystemConfig tSystemConfig = tSystemConfigService.selectOne(new EntityWrapper<TSystemConfig>().eq("type", type)
+                    .last("LIMIT 1"));
+            tSystemConfig.setContent(content);
+            tSystemConfigService.updateById(tSystemConfig);
+        }
+        if(roleType == 3){
+            TAgent tAgent = agentService.selectById(objectId);
+            if (Objects.nonNull(tAgent)){
+                JSONObject jsonObject = JSONObject.parseObject(content);
+                String num1 = jsonObject.getString("num1");
+                tAgent.setServiceCalls(num1);
+                agentService.updateById(tAgent);
+            }
+        }
+        return SUCCESS_TIP;
     }
     /**
      * 获取列表

--
Gitblit v1.7.1