From bb4c1e2bdfa12698acf582aa07e05c6f11778195 Mon Sep 17 00:00:00 2001
From: xuhy <3313886187@qq.com>
Date: 星期二, 14 一月 2025 11:28:41 +0800
Subject: [PATCH] 计费规则

---
 ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TCompanyController.java |   47 +++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 39 insertions(+), 8 deletions(-)

diff --git a/ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TCompanyController.java b/ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TCompanyController.java
index 78e8867..f500e74 100644
--- a/ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TCompanyController.java
+++ b/ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TCompanyController.java
@@ -23,10 +23,7 @@
 import com.stylefeng.guns.core.log.LogObjectHolder;
 import org.springframework.web.bind.annotation.RequestParam;
 
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 /**
  * 分公司管理控制器
@@ -294,7 +291,7 @@
      */
     @RequestMapping(value = "/add")
     @ResponseBody
-    public Object add(TCompany tCompany,@RequestParam String subArr,String account,String password) {
+    public Object add(TCompany tCompany,@RequestParam String subArr,String account,String password,String content) {
         //判断账号是否已存在
         int count = userService.selectCount(new EntityWrapper<User>().eq("account", account)
                 .eq("status",1));
@@ -320,6 +317,14 @@
         user.setName(tCompany.getName());
         user.setSex(1);
         userService.insert(user);
+
+        // 添加计费规则
+        TSystemPrice tSystemPrice = new TSystemPrice();
+        tSystemPrice.setCompanyId(tCompany.getId());
+        tSystemPrice.setType(2);
+        tSystemPrice.setState(1);
+        tSystemPrice.setContent(content);
+        systemPriceService.insert(tSystemPrice);
 
         //添加经营区域
         addSocpe(subArr,tCompany.getId());
@@ -355,7 +360,7 @@
      */
     @RequestMapping(value = "/addFranchisee")
     @ResponseBody
-    public Object addFranchisee(TCompany tCompany,String account,String password) {
+    public Object addFranchisee(TCompany tCompany,String account,String password,String content) {
         //判断账号是否已存在
         int count = userService.selectCount(
                 new EntityWrapper<User>().eq("account", account)
@@ -385,6 +390,14 @@
         user.setName(tCompany.getName());
         user.setSex(1);
         userService.insert(user);
+
+        // 添加计费规则
+        TSystemPrice tSystemPrice = new TSystemPrice();
+        tSystemPrice.setCompanyId(tCompany.getId());
+        tSystemPrice.setType(2);
+        tSystemPrice.setState(1);
+        tSystemPrice.setContent(content);
+        systemPriceService.insert(tSystemPrice);
 
         return SUCCESS_TIP;
     }
@@ -417,7 +430,7 @@
      */
     @RequestMapping(value = "/update")
     @ResponseBody
-    public Object update(TCompany tCompany,@RequestParam String subArr,String account,String password,Integer userId) {
+    public Object update(TCompany tCompany,@RequestParam String subArr,String account,String password,Integer userId,String content) {
         //判断账号
         User user = userService.selectById(userId);
         if (SinataUtil.isNotEmpty(account) && SinataUtil.isNotEmpty(password)){
@@ -436,6 +449,15 @@
         tCompanyService.updateById(tCompany);
         user.setName(tCompany.getName());
         userService.updateById(user);
+
+        // 修改计费规则
+        TSystemPrice tSystemPrice = systemPriceService.selectOne(new EntityWrapper<TSystemPrice>().eq("companyId", tCompany.getId())
+                .eq("type", 2)
+                .last("LIMIT 1"));
+        if (Objects.nonNull(tSystemPrice)){
+            tSystemPrice.setContent(content);
+            systemPriceService.updateById(tSystemPrice);
+        }
 
         //添加经营区域
         addSocpe(subArr,tCompany.getId());
@@ -462,7 +484,7 @@
      */
     @RequestMapping(value = "/updateFranchisee")
     @ResponseBody
-    public Object updateFranchisee(TCompany tCompany,String account,String password,Integer userId) {
+    public Object updateFranchisee(TCompany tCompany,String account,String password,Integer userId,String content) {
         //判断账号
         User user = userService.selectById(userId);
         if (!user.getAccount().equals(account)){
@@ -481,6 +503,15 @@
         user.setName(tCompany.getName());
         userService.updateById(user);
 
+        // 修改计费规则
+        TSystemPrice tSystemPrice = systemPriceService.selectOne(new EntityWrapper<TSystemPrice>().eq("companyId", tCompany.getId())
+                .eq("type", 2)
+                .last("LIMIT 1"));
+        if (Objects.nonNull(tSystemPrice)){
+            tSystemPrice.setContent(content);
+            systemPriceService.updateById(tSystemPrice);
+        }
+
         return SUCCESS_TIP;
     }
 

--
Gitblit v1.7.1