From 7feb722a12e26f5572c7df9ccc1ce8c1e26b9f94 Mon Sep 17 00:00:00 2001 From: Pu Zhibing <393733352@qq.com> Date: 星期二, 22 四月 2025 23:30:07 +0800 Subject: [PATCH] 新增加功能 --- ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TCompanyController.java | 78 ++++++++++++++++++++++++++++++++------- 1 files changed, 64 insertions(+), 14 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 7024b4e..107073f 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 @@ -11,9 +11,7 @@ import com.stylefeng.guns.core.util.DateUtil; import com.stylefeng.guns.core.util.SinataUtil; import com.stylefeng.guns.modular.system.model.*; -import com.stylefeng.guns.modular.system.service.ITCompanyCityService; -import com.stylefeng.guns.modular.system.service.ITRegionService; -import com.stylefeng.guns.modular.system.service.IUserService; +import com.stylefeng.guns.modular.system.service.*; import com.stylefeng.guns.modular.system.util.PushMinistryOfTransportUtil; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Controller; @@ -24,12 +22,8 @@ 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.ITCompanyService; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.Map; +import java.util.*; /** * 分公司管理控制器 @@ -57,6 +51,8 @@ @Autowired private PushMinistryOfTransportUtil pushMinistryOfTransportUtil; + @Autowired + private ITSystemPriceService systemPriceService; @Value("${pushMinistryOfTransport}") private boolean pushMinistryOfTransport; @@ -149,6 +145,11 @@ List<Map<String, Object>> scopeList = tCompanyService.getCompanyScopeById(tCompanyId); model.addAttribute("scopeList",scopeList); + //计费规则 + TSystemPrice tSystemPrice = systemPriceService.selectOne(new EntityWrapper<TSystemPrice>().eq("companyId", tCompanyId) + .eq("type", 2).last("LIMIT 1")); + model.addAttribute("contentExclusive",JSONObject.parseObject(tSystemPrice.getContent())); + return PREFIX + "tCompany_detail.html"; } @@ -172,6 +173,10 @@ //经营区域 List<Map<String, Object>> scopeList = tCompanyService.getCompanyScopeById(tCompanyId); model.addAttribute("scopeList",scopeList); + //计费规则 + TSystemPrice tSystemPrice = systemPriceService.selectOne(new EntityWrapper<TSystemPrice>().eq("companyId", tCompanyId) + .eq("type", 2).last("LIMIT 1")); + model.addAttribute("contentExclusive",JSONObject.parseObject(tSystemPrice.getContent())); return PREFIX + "tCompany_edit.html"; } @@ -193,11 +198,13 @@ }else { model.addAttribute("companyName","平台"); } - - //系统用户对象 User user = userService.selectOne(new EntityWrapper<User>().eq("roleType", 3).eq("objectId", tCompanyId)); model.addAttribute("user",user); + //计费规则 + TSystemPrice tSystemPrice = systemPriceService.selectOne(new EntityWrapper<TSystemPrice>().eq("companyId", tCompanyId) + .eq("type", 2).last("LIMIT 1")); + model.addAttribute("contentExclusive",JSONObject.parseObject(tSystemPrice.getContent())); return PREFIX + "tCompany_detailFranchisee.html"; } @@ -224,6 +231,11 @@ //系统用户对象 User user = userService.selectOne(new EntityWrapper<User>().eq("roleType", 3).eq("objectId", tCompanyId)); model.addAttribute("user",user); + + //计费规则 + TSystemPrice tSystemPrice = systemPriceService.selectOne(new EntityWrapper<TSystemPrice>().eq("companyId", tCompanyId) + .eq("type", 2).last("LIMIT 1")); + model.addAttribute("contentExclusive",JSONObject.parseObject(tSystemPrice.getContent())); return PREFIX + "tCompany_updateFranchisee.html"; } @@ -297,7 +309,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)); @@ -323,6 +335,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()); @@ -358,7 +378,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) @@ -389,6 +409,14 @@ 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; } @@ -408,6 +436,10 @@ .eq("objectId", tCompany.getId())); user.setStatus(3); userService.updateById(user); + + // 删除分公司的计费规则 + systemPriceService.delete(new EntityWrapper<TSystemPrice>().eq("companyId", tCompany.getId())); + return SUCCESS_TIP; } @@ -416,7 +448,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)){ @@ -435,6 +467,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()); @@ -461,7 +502,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)){ @@ -480,6 +521,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