From 33fb76bd70cf84cebbe26b96e5faedd22961f0b0 Mon Sep 17 00:00:00 2001
From: puzhibing <393733352@qq.com>
Date: 星期三, 16 八月 2023 15:54:47 +0800
Subject: [PATCH] 修改bug

---
 management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TBranchOfficeController.java |  329 ++++++++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 293 insertions(+), 36 deletions(-)

diff --git a/management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TBranchOfficeController.java b/management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TBranchOfficeController.java
index 55f20e3..f0266f0 100644
--- a/management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TBranchOfficeController.java
+++ b/management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TBranchOfficeController.java
@@ -1,18 +1,26 @@
 package com.stylefeng.guns.modular.system.controller.general;
 
+import cn.hutool.crypto.SecureUtil;
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.mapper.EntityWrapper;
 import com.stylefeng.guns.core.base.controller.BaseController;
 import com.stylefeng.guns.core.base.tips.SuccessTip;
+import com.stylefeng.guns.core.common.constant.state.ManagerStatus;
 import com.stylefeng.guns.core.shiro.ShiroKit;
+import com.stylefeng.guns.core.util.SinataUtil;
 import com.stylefeng.guns.modular.system.controller.resp.TBranchOfficeResp;
 import com.stylefeng.guns.modular.system.controller.resp.TDriverResp;
+import com.stylefeng.guns.modular.system.enums.StatusEnum;
 import com.stylefeng.guns.modular.system.model.*;
-import com.stylefeng.guns.modular.system.service.ITRegionService;
-import com.stylefeng.guns.modular.system.service.ITSystemConfigService;
+import com.stylefeng.guns.modular.system.service.*;
+import com.stylefeng.guns.modular.system.util.RedisUtil;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Controller;
+import org.springframework.transaction.annotation.Propagation;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.CollectionUtils;
 import org.springframework.util.StringUtils;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.ResponseBody;
@@ -21,8 +29,9 @@
 import org.springframework.beans.factory.annotation.Autowired;
 import com.stylefeng.guns.core.log.LogObjectHolder;
 import org.springframework.web.bind.annotation.RequestParam;
-import com.stylefeng.guns.modular.system.service.ITBranchOfficeService;
 
+import java.util.ArrayList;
+import java.util.Date;
 import java.util.List;
 import java.util.Objects;
 import java.util.stream.Collectors;
@@ -46,12 +55,21 @@
 
     @Autowired
     private ITRegionService tRegionService;
+    @Autowired
+    private ITDriverService tDriverService;
+    @Autowired
+    private ITDriverWorkService tDriverWorkService;
+    @Autowired
+    private IUserService userService;
+    @Autowired
+    private RedisUtil redisUtil;
 
     /**
      * 跳转到首页
      */
     @RequestMapping("")
-    public String index() {
+    public String index(Model model) {
+        model.addAttribute("userType", Objects.requireNonNull(ShiroKit.getUser()).getRoleType());
         return PREFIX + "tBranchOffice.html";
     }
 
@@ -79,14 +97,14 @@
         TRegion district = tRegionService.selectOne(new EntityWrapper<TRegion>().eq("code", tBranchOffice.getDistrictCode())
                 .last("LIMIT 1"));
 
-        if(StringUtils.hasLength(tBranchOffice.getDistrictName())){
+        if(StringUtils.hasLength(tBranchOffice.getDistrictName()) && !tBranchOffice.getDistrictName().equals(tBranchOffice.getCityName())){
             tBranchOfficeResp.setArea(tBranchOffice.getProvinceName()+"/"+tBranchOffice.getCityName()+"/"+tBranchOffice.getDistrictName());
         }else {
             tBranchOfficeResp.setArea(tBranchOffice.getProvinceName()+"/"+tBranchOffice.getCityName());
         }
 
         if(Objects.nonNull(city)){
-            if(Objects.nonNull(district)){
+            if(Objects.nonNull(district) && !district.getCode().equals(city.getCode())){
                 tBranchOfficeResp.setAreaId(city.getParentId()+"/"+city.getId()+"/"+district.getId());
             }else {
                 tBranchOfficeResp.setAreaId(city.getParentId()+"/"+city.getId());
@@ -95,6 +113,41 @@
 
         model.addAttribute("item",tBranchOfficeResp);
         LogObjectHolder.me().set(tBranchOffice);
+
+        TSystemConfig tSystemConfig = tSystemConfigService.selectOne(new EntityWrapper<TSystemConfig>().eq("type", 5)
+                .eq("companyId", tBranchOfficeId).last("LIMIT 1"));
+        if(null != tSystemConfig){
+            JSONObject jsonObject = JSONObject.parseObject(tSystemConfig.getContent());
+            JSONArray array = jsonObject.getJSONArray("ChargeStandard");
+            JSONArray objects = new JSONArray();
+            for (int i = 0; i < array.size(); i++) {
+                JSONObject jsonObject1 = JSONObject.parseObject(JSONObject.toJSONString(array.get(i)));
+                if(i == 0){
+                    jsonObject1.put("key",0);
+                }else {
+                    jsonObject1.put("key",1);
+                }
+                objects.add(jsonObject1);
+            }
+            TSystemConfig config = tSystemConfigService.selectOne(new EntityWrapper<TSystemConfig>().eq("type", 8)
+                    .eq("companyId", tBranchOfficeId).last("LIMIT 1"));
+            JSONObject jsonObj = JSONObject.parseObject(config.getContent());
+            Integer zcOne = jsonObj.getInteger("num1");
+            String serviceTel = jsonObj.getString("num2");
+            Integer zcTwo = jsonObj.getInteger("num3");
+            model.addAttribute("zcOne", zcOne);
+            model.addAttribute("serviceTel", serviceTel);
+            model.addAttribute("zcTwo", zcTwo);
+            model.addAttribute("array",objects);
+            JSONObject extraCost = JSONObject.parseObject(jsonObject.getString("ExtraCost"));
+            model.addAttribute("ExtraCost",extraCost);
+        }else{
+            model.addAttribute("zcOne",1);
+            model.addAttribute("serviceTel", "");
+            model.addAttribute("zcTwo", 1);
+            model.addAttribute("array",null);
+            model.addAttribute("ExtraCost",null);
+        }
         return PREFIX + "tBranchOffice_edit.html";
     }
 
@@ -108,6 +161,40 @@
         JSONObject jsonObject = JSONObject.parseObject(tSystemConfig.getContent());
         model.addAttribute("num2",jsonObject.getInteger("num2"));
         model.addAttribute("num3",jsonObject.getInteger("num3"));
+        TSystemConfig tSystemConfig1 = tSystemConfigService.selectOne(new EntityWrapper<TSystemConfig>().eq("type", 5)
+                .eq("companyId", tBranchOfficeId).last("LIMIT 1"));
+        if(null != tSystemConfig1){
+            JSONObject jsonObject2 = JSONObject.parseObject(tSystemConfig1.getContent());
+            JSONArray array = jsonObject2.getJSONArray("ChargeStandard");
+            JSONArray objects = new JSONArray();
+            for (int i = 0; i < array.size(); i++) {
+                JSONObject jsonObject1 = JSONObject.parseObject(JSONObject.toJSONString(array.get(i)));
+                if(i == 0){
+                    jsonObject1.put("key",0);
+                }else {
+                    jsonObject1.put("key",1);
+                }
+                objects.add(jsonObject1);
+            }
+            TSystemConfig config = tSystemConfigService.selectOne(new EntityWrapper<TSystemConfig>().eq("type", 8)
+                    .eq("companyId", tBranchOfficeId).last("LIMIT 1"));
+            JSONObject jsonObj = JSONObject.parseObject(config.getContent());
+            Integer zcOne = jsonObj.getInteger("num1");
+            String serviceTel = jsonObj.getString("num2");
+            Integer zcTwo = jsonObj.getInteger("num3");
+            model.addAttribute("zcOne", zcOne);
+            model.addAttribute("serviceTel", serviceTel);
+            model.addAttribute("zcTwo", zcTwo);
+            model.addAttribute("array",objects);
+            JSONObject extraCost = JSONObject.parseObject(jsonObject2.getString("ExtraCost"));
+            model.addAttribute("ExtraCost",extraCost);
+        }else{
+            model.addAttribute("zcOne",1);
+            model.addAttribute("serviceTel", "");
+            model.addAttribute("zcTwo", 1);
+            model.addAttribute("array",null);
+            model.addAttribute("ExtraCost",null);
+        }
         return PREFIX + "tBranchOfficeDetail.html";
     }
 
@@ -115,28 +202,19 @@
      * 跳转区域页面新增
      */
     @RequestMapping("/areaPageAdd")
-    public String areaPageAdd(Model model) {
+    public String areaPageAdd(String area,String areaId,Model model) {
+        String[] split1 = areaId.split("/");
         List<TRegion> tRegions = tRegionService.selectList(new EntityWrapper<TRegion>().eq("parent_id", 0));
         model.addAttribute("provinceList",tRegions);
-        return PREFIX + "tBranchOfficeAreaAdd.html";
-    }
-
-    /**
-     * 跳转区域页面编辑
-     */
-    @RequestMapping("/areaPageUpdate")
-    public String areaPageUpdate(String area,String areaId,Model model) {
-        List<TRegion> tRegions = tRegionService.selectList(new EntityWrapper<TRegion>().eq("parent_id", 0));
-        model.addAttribute("provinceList",tRegions);
-        List<Integer> provinceIds = tRegions.stream().map(TRegion::getId).collect(Collectors.toList());
-        // 查询市
-        List<TRegion> tRegions1 = tRegionService.selectList(new EntityWrapper<TRegion>().in("parent_id", provinceIds));
-        model.addAttribute("cityList",tRegions1);
-
-        // 查询区
-        List<Integer> cityIds = tRegions1.stream().map(TRegion::getId).collect(Collectors.toList());
-        List<TRegion> tRegions2 = tRegionService.selectList(new EntityWrapper<TRegion>().in("parent_id", cityIds));
-        model.addAttribute("districtList",tRegions2);
+//        List<Integer> provinceIds = tRegions.stream().map(TRegion::getId).collect(Collectors.toList());
+//        // 查询市
+//        List<TRegion> tRegions1 = tRegionService.selectList(new EntityWrapper<TRegion>().eq("parent_id", split1[0]));
+//        model.addAttribute("cityList",tRegions1);
+//
+//        // 查询区
+//        List<Integer> cityIds = tRegions1.stream().map(TRegion::getId).collect(Collectors.toList());
+//        List<TRegion> tRegions2 = tRegionService.selectList(new EntityWrapper<TRegion>().in("parent_id", cityIds));
+//        model.addAttribute("districtList",tRegions2);
 
         if(StringUtils.hasLength(area) && StringUtils.hasLength(areaId)){
             String[] split = area.split("/");
@@ -148,7 +226,6 @@
                 model.addAttribute("districtName","");
             }
 
-            String[] split1 = areaId.split("/");
             model.addAttribute("provinceId",split1[0]);
             model.addAttribute("cityId",split1[1]);
             if(split1.length>2) {
@@ -156,7 +233,65 @@
             }else {
                 model.addAttribute("districtId", "");
             }
+
+            List<TRegion> tRegions1 = tRegionService.selectList(new EntityWrapper<TRegion>().eq("parent_id", split1[0]));
+            model.addAttribute("cityList",tRegions1);
+
+            // 查询区
+            List<TRegion> tRegions2 = tRegionService.selectList(new EntityWrapper<TRegion>().in("parent_id", split1[1]));
+            model.addAttribute("districtList",tRegions2);
+        }else {
+            model.addAttribute("cityList",new ArrayList<>());
+            model.addAttribute("districtList",new ArrayList<>());
+
+            model.addAttribute("provinceName","");
+            model.addAttribute("cityName","");
+            model.addAttribute("districtName","");
+
+            model.addAttribute("provinceId","");
+            model.addAttribute("cityId","");
+            model.addAttribute("districtId", "");
         }
+        return PREFIX + "tBranchOfficeAreaAdd.html";
+    }
+
+    /**
+     * 跳转区域页面编辑
+     */
+    @RequestMapping("/areaPageUpdate")
+    public String areaPageUpdate(String area,String areaId,Model model) {
+
+        String[] split = area.split("/");
+        model.addAttribute("provinceName",split[0]);
+        model.addAttribute("cityName",split[1]);
+        if(split.length>2){
+            model.addAttribute("districtName",split[2]);
+        }else {
+            model.addAttribute("districtName","");
+        }
+
+        String[] split1 = areaId.split("/");
+        String provinceId = split1[0];
+        model.addAttribute("provinceId",split1[0]);
+        model.addAttribute("cityId",split1[1]);
+        if(split1.length>2) {
+            model.addAttribute("districtId", split1[2]);
+        }else {
+            model.addAttribute("districtId", "");
+        }
+
+        List<TRegion> tRegions = tRegionService.selectList(new EntityWrapper<TRegion>().eq("parent_id", 0));
+        model.addAttribute("provinceList",tRegions);
+//        List<Integer> provinceIds = tRegions.stream().map(TRegion::getId).collect(Collectors.toList());
+        // 查询市
+        List<TRegion> tRegions1 = tRegionService.selectList(new EntityWrapper<TRegion>().eq("parent_id", provinceId));
+        model.addAttribute("cityList",tRegions1);
+
+        // 查询区
+        List<Integer> cityIds = tRegions1.stream().map(TRegion::getId).collect(Collectors.toList());
+        List<TRegion> tRegions2 = tRegionService.selectList(new EntityWrapper<TRegion>().in("parent_id", split1[1]));
+        model.addAttribute("districtList",tRegions2);
+
         return PREFIX + "tBranchOfficeAreaUpdate.html";
     }
 
@@ -167,6 +302,9 @@
     @ResponseBody
     public Object list(String branchOfficeName,String principal,String principalPhone,Integer operatingBusiness ,Integer status) {
         List<TBranchOfficeResp> tBranchOfficeRespList = tBranchOfficeService.getPageList(branchOfficeName,principal,principalPhone,operatingBusiness,status);
+        for (TBranchOfficeResp tBranchOfficeResp : tBranchOfficeRespList) {
+            tBranchOfficeResp.setUserType(Objects.requireNonNull(ShiroKit.getUser()).getRoleType());
+        }
         // 分公司查询优惠券,订单,司机等信息
         tBranchOfficeService.queryOtherInfo(tBranchOfficeRespList);
         return tBranchOfficeRespList;
@@ -177,6 +315,10 @@
     @ResponseBody
     public Object areaCity(Integer parentId,Model model) {
         List<TRegion> tRegions = tRegionService.selectList(new EntityWrapper<TRegion>().eq("parent_id", parentId));
+        /*if(CollectionUtils.isEmpty(tRegions) && StringUtils.hasLength(parentName)){
+            TRegion parent = tRegionService.selectOne(new EntityWrapper<TRegion>().eq("name", parentName));
+            tRegions = tRegionService.selectList(new EntityWrapper<TRegion>().eq("parent_id", parentId));
+        }*/
         model.addAttribute("list",tRegions);
         return tRegions;
     }
@@ -188,7 +330,7 @@
     @ResponseBody
     public Object start(Integer id) {
         TBranchOffice tBranchOffice = tBranchOfficeService.selectById(id);
-        tBranchOffice.setStatus(1);
+        tBranchOffice.setStatus(StatusEnum.NORMAL.getCode());
         tBranchOfficeService.updateById(tBranchOffice);
         return SUCCESS_TIP;
     }
@@ -200,8 +342,25 @@
     @ResponseBody
     public Object updateStatus(Integer id) {
         TBranchOffice tBranchOffice = tBranchOfficeService.selectById(id);
-        tBranchOffice.setStatus(2);
+        tBranchOffice.setStatus(StatusEnum.FREEZE.getCode());
         tBranchOfficeService.updateById(tBranchOffice);
+        List<TDriver> list = tDriverService.selectList(new EntityWrapper<TDriver>()
+                .eq("branchOfficeId", tBranchOffice.getId()));
+        for (TDriver tDriver : list) {
+            String value = redisUtil.getValue("DRIVER_" + tDriver.getPhone());
+            redisUtil.remove(value);
+            redisUtil.remove("DRIVER_" + tDriver.getPhone());
+            TDriverWork tDriverWork = tDriverWorkService.selectOne(new EntityWrapper<TDriverWork>()
+                    .eq("driverId", tDriver.getId())
+                    .eq("status", 1)
+                    .orderBy("workTime", false)
+                    .last("LIMIT 1"));
+            if(Objects.nonNull(tDriverWork)){
+                tDriverWork.setStatus(2);
+                tDriverWork.setOffWorkTime(new Date());
+                tDriverWorkService.updateById(tDriverWork);
+            }
+        }
         return SUCCESS_TIP;
     }
 
@@ -219,19 +378,50 @@
      */
     @RequestMapping(value = "/add")
     @ResponseBody
-    public Object add(TBranchOffice tBranchOffice) {
-        int count = tBranchOfficeService.selectCount(new EntityWrapper<TBranchOffice>().eq("branchOfficeName", tBranchOffice.getBranchOfficeName()));
+    @Transactional(rollbackFor = Exception.class,propagation = Propagation.REQUIRES_NEW)
+    public Object add(TBranchOffice tBranchOffice, Integer systemPriceType, String systemPriceContent, Integer isTaxiCar, Integer holiday, String serviceTel) {
+        int count = tBranchOfficeService.selectCount(new EntityWrapper<TBranchOffice>().eq("branchOfficeName", tBranchOffice.getBranchOfficeName()).ne("status", 3));
         if(count>0){
             return new SuccessTip(500,"该分公司名称已存在!");
         }
-
+        int count1 = userService.selectCount(new EntityWrapper<User>().eq("account", tBranchOffice.getAccount()).ne("status", 3));
+        if (count1 > 0){
+            return new SuccessTip(500,"该账号已存在!");
+        }
         Object o = tBranchOfficeService.addOrUpdate(tBranchOffice);
         if(Objects.nonNull(o)){
             return o;
         }
-        tBranchOffice.setStatus(1);
+        tBranchOffice.setPrincipal(tBranchOffice.getPrincipal().replace(" ",""));
+        tBranchOffice.setStatus(StatusEnum.NORMAL.getCode());
 
         tBranchOfficeService.insert(tBranchOffice);
+
+        //添加User对象
+        User user = new User();
+        user.setAccount(tBranchOffice.getAccount());
+        user.setSalt(ShiroKit.getRandomSalt(5));
+        user.setPassword(ShiroKit.md5(tBranchOffice.getPassword(), user.getSalt()));
+        user.setStatus(ManagerStatus.OK.getCode());
+        user.setRoleid("3");
+        user.setDeptid(25);
+        user.setCreatetime(new Date());
+        user.setRoleType(2);
+        user.setObjectId(tBranchOffice.getId());
+        user.setName(tBranchOffice.getPrincipal());
+        user.setSex(1);
+        userService.insert(user);
+        //添加价格规则
+        TSystemConfig tSystemConfig = new TSystemConfig();
+        tSystemConfig.setCompanyId(tBranchOffice.getId());
+        tSystemConfig.setType(systemPriceType);
+        tSystemConfig.setContent(systemPriceContent);
+        tSystemConfigService.insert(tSystemConfig);
+        tSystemConfig = new TSystemConfig();
+        tSystemConfig.setType(8);
+        tSystemConfig.setCompanyId(tBranchOffice.getId());
+        tSystemConfig.setContent("{\"num1\":" + isTaxiCar + ",\"num2\":\"" + serviceTel + "\",\"num3\":" + holiday + "}");
+        tSystemConfigService.insert(tSystemConfig);
         return SUCCESS_TIP;
     }
 
@@ -241,7 +431,15 @@
     @RequestMapping(value = "/delete")
     @ResponseBody
     public Object delete(@RequestParam Integer tBranchOfficeId) {
-        tBranchOfficeService.deleteById(tBranchOfficeId);
+        TBranchOffice tBranchOffice = tBranchOfficeService.selectById(tBranchOfficeId);
+        tBranchOffice.setStatus(StatusEnum.DELETE.getCode());
+        tBranchOfficeService.updateById(tBranchOffice);
+        List<User> users = userService.selectList(new EntityWrapper<User>().eq("role_type", 2).eq("object_id", tBranchOfficeId));
+        for (User user : users) {
+            user.setStatus(3);
+            userService.updateById(user);
+        }
+        tSystemConfigService.delete(new EntityWrapper<TSystemConfig>().eq("type", 5).eq("companyId", tBranchOfficeId));
         return SUCCESS_TIP;
     }
 
@@ -250,9 +448,44 @@
      */
     @RequestMapping(value = "/update")
     @ResponseBody
-    public Object update(TBranchOffice tBranchOffice) {
-        TBranchOffice office = tBranchOfficeService.selectOne(new EntityWrapper<TBranchOffice>().eq("branchOfficeName", tBranchOffice.getBranchOfficeName())
+    @Transactional(rollbackFor = Exception.class,propagation = Propagation.REQUIRES_NEW)
+    public Object update(TBranchOffice tBranchOffice, Integer systemPriceType, String systemPriceContent, Integer holiday, Integer isTaxiCar, String serviceTel) {    TBranchOffice branchOffice = tBranchOfficeService.selectById(tBranchOffice.getId());
+        User user = userService.selectOne(new EntityWrapper<User>()
+                .eq("role_type", 2)
+                .eq("object_id", branchOffice.getId())
                 .last("LIMIT 1"));
+        //判断账号是否已存在
+        if (SinataUtil.isNotEmpty(tBranchOffice.getAccount()) && SinataUtil.isNotEmpty(tBranchOffice.getPassword())){
+            if(Objects.isNull(user)){
+                //添加User对象
+                user.setAccount(tBranchOffice.getAccount());
+                user.setSalt(ShiroKit.getRandomSalt(5));
+                user.setPassword(ShiroKit.md5(tBranchOffice.getPassword(), user.getSalt()));
+                user.setStatus(ManagerStatus.OK.getCode());
+                user.setRoleid("3");
+                user.setDeptid(25);
+                user.setCreatetime(new Date());
+                user.setRoleType(2);
+                user.setObjectId(tBranchOffice.getId());
+                user.setName(tBranchOffice.getPrincipal());
+                user.setSex(1);
+                userService.insert(user);
+            }else {
+                if (!tBranchOffice.getAccount().equals(user.getAccount())){
+                    //判断账号是否已存在
+                    int count = userService.selectCount(new EntityWrapper<User>().eq("account", tBranchOffice.getAccount()).ne("status", 3));
+                    if (count > 0){
+                        return new SuccessTip(500,"该账号已存在!");
+                    }
+                }
+                user.setAccount(tBranchOffice.getAccount());
+                user.setPassword(ShiroKit.md5(tBranchOffice.getPassword(), user.getSalt()));
+                userService.updateById(user);
+            }
+        }
+
+        TBranchOffice office = tBranchOfficeService.selectOne(new EntityWrapper<TBranchOffice>().eq("branchOfficeName", tBranchOffice.getBranchOfficeName())
+                .ne("status", 3).last("LIMIT 1"));
         if(Objects.nonNull(office) && !tBranchOffice.getId().equals(office.getId())){
             return new SuccessTip(500,"该分公司名称已存在!");
         }
@@ -262,7 +495,31 @@
         if(Objects.nonNull(o)){
             return o;
         }
+        tBranchOffice.setPrincipal(tBranchOffice.getPrincipal().replace(" ",""));
         tBranchOfficeService.updateById(tBranchOffice);
+
+        TSystemConfig tSystemConfig = tSystemConfigService.selectOne(new EntityWrapper<TSystemConfig>().eq("type", 5).eq("companyId", tBranchOffice.getId()));
+        if(null == tSystemConfig){
+            tSystemConfig = new TSystemConfig();
+            tSystemConfig.setType(systemPriceType);
+            tSystemConfig.setCompanyId(tBranchOffice.getId());
+            tSystemConfig.setContent(systemPriceContent);
+            tSystemConfigService.insert(tSystemConfig);
+        }else{
+            tSystemConfig.setContent(systemPriceContent);
+            tSystemConfigService.updateById(tSystemConfig);
+        }
+        tSystemConfig = tSystemConfigService.selectOne(new EntityWrapper<TSystemConfig>().eq("type", 8).eq("companyId", tBranchOffice.getId()));
+        if(null == tSystemConfig){
+            tSystemConfig = new TSystemConfig();
+            tSystemConfig.setType(8);
+            tSystemConfig.setCompanyId(tBranchOffice.getId());
+            tSystemConfig.setContent("{\"num1\":" + isTaxiCar + ",\"num2\":\"" + serviceTel + "\",\"num3\":" + holiday + "}");
+            tSystemConfigService.insert(tSystemConfig);
+        }else{
+            tSystemConfig.setContent("{\"num1\":" + isTaxiCar + ",\"num2\":\"" + serviceTel + "\",\"num3\":" + holiday + "}");
+            tSystemConfigService.updateById(tSystemConfig);
+        }
         return SUCCESS_TIP;
     }
 

--
Gitblit v1.7.1