| | |
| | | package com.stylefeng.guns.modular.system.controller.general; |
| | | |
| | | 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 org.springframework.web.bind.annotation.RequestParam; |
| | | import com.stylefeng.guns.modular.system.model.TSystemConfig; |
| | | import com.stylefeng.guns.modular.system.service.ITSystemConfigService; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 控制器 |
| | |
| | | } |
| | | |
| | | /** |
| | | * 跳转到抽成规则 |
| | | */ |
| | | @RequestMapping("/extractionRules") |
| | | public String extractionRules(Model model) { |
| | | TSystemConfig tSystemConfig = tSystemConfigService.selectOne(new EntityWrapper<TSystemConfig>().eq("type", 3) |
| | | .last("LIMIT 1")); |
| | | JSONObject jsonObject = JSONObject.parseObject(tSystemConfig.getContent()); |
| | | model.addAttribute("num1",jsonObject.getInteger("num1")); |
| | | model.addAttribute("num2",jsonObject.getInteger("num2")); |
| | | model.addAttribute("num3",jsonObject.getInteger("num3")); |
| | | return PREFIX + "tSystemConfigExtractionRules.html"; |
| | | } |
| | | /** |
| | | * 跳转到积分规则 |
| | | */ |
| | | @RequestMapping("/integralRules") |
| | | public String integralRules(Model model) { |
| | | TSystemConfig tSystemConfig = tSystemConfigService.selectOne(new EntityWrapper<TSystemConfig>().eq("type", 4) |
| | | .last("LIMIT 1")); |
| | | JSONObject jsonObject = JSONObject.parseObject(tSystemConfig.getContent()); |
| | | model.addAttribute("num1",jsonObject.getString("num1")); |
| | | model.addAttribute("num2",jsonObject.getString("num2")); |
| | | model.addAttribute("num3",jsonObject.getInteger("num3")); |
| | | model.addAttribute("num4",jsonObject.getInteger("num4")); |
| | | model.addAttribute("num5",jsonObject.getInteger("num5")); |
| | | model.addAttribute("num6",jsonObject.getInteger("num6")); |
| | | model.addAttribute("num7",jsonObject.getInteger("num7")); |
| | | model.addAttribute("num8",jsonObject.getInteger("num8")); |
| | | model.addAttribute("num9",jsonObject.getInteger("num9")); |
| | | model.addAttribute("num10",jsonObject.getInteger("num10")); |
| | | return PREFIX + "tSystemConfigIntegralRules.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到价格规则 |
| | | */ |
| | | @RequestMapping("/priceRules") |
| | | public String priceRules(Model model) { |
| | | TSystemConfig tSystemConfig = tSystemConfigService.selectOne(new EntityWrapper<TSystemConfig>().eq("type", 5) |
| | | .last("LIMIT 1")); |
| | | 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) |
| | | .last("LIMIT 1")); |
| | | JSONObject jsonObj = JSONObject.parseObject(config.getContent()); |
| | | Integer zcOne = jsonObj.getInteger("num1"); |
| | | model.addAttribute("zcOne",zcOne); |
| | | model.addAttribute("array",objects); |
| | | JSONObject extraCost = JSONObject.parseObject(jsonObject.getString("ExtraCost")); |
| | | model.addAttribute("ExtraCost",extraCost); |
| | | return PREFIX + "tSystemConfigPriceRules.html"; |
| | | } |
| | | /** |
| | | * 跳转到余额规则 |
| | | */ |
| | | @RequestMapping("/balanceRules") |
| | | public String balanceRules(Model model) { |
| | | TSystemConfig tSystemConfig = tSystemConfigService.selectOne(new EntityWrapper<TSystemConfig>().eq("type", 6) |
| | | .last("LIMIT 1")); |
| | | JSONObject jsonObject = JSONObject.parseObject(tSystemConfig.getContent()); |
| | | model.addAttribute("num1",jsonObject.getInteger("num1")); |
| | | model.addAttribute("num2",jsonObject.getInteger("num2")); |
| | | return PREFIX + "tSystemConfigBalanceRules.html"; |
| | | } |
| | | /** |
| | | * 跳转到客服管理 |
| | | */ |
| | | @RequestMapping("/serviceMgmt") |
| | | public String serviceMgmt(Model model) { |
| | | TSystemConfig tSystemConfig = tSystemConfigService.selectOne(new EntityWrapper<TSystemConfig>().eq("type", 7) |
| | | .last("LIMIT 1")); |
| | | JSONObject jsonObject = JSONObject.parseObject(tSystemConfig.getContent()); |
| | | model.addAttribute("num1",jsonObject.getString("num1")); |
| | | return PREFIX + "tSystemConfigServiceMgmt.html"; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取列表 |
| | | */ |
| | | @RequestMapping(value = "/systemConfigSubmit") |
| | |
| | | |
| | | TSystemConfig tSystemConfig = tSystemConfigService.selectOne(new EntityWrapper<TSystemConfig>().eq("type", type) |
| | | .last("LIMIT 1")); |
| | | |
| | | System.err.println(content); |
| | | |
| | | tSystemConfig.setContent(content); |
| | | |
| | |
| | | } |
| | | |
| | | /** |
| | | * 修改价格规则开关 |
| | | */ |
| | | @RequestMapping(value = "/openOrClose") |
| | | @ResponseBody |
| | | public Object openOrClose(Integer num1) { |
| | | TSystemConfig config = tSystemConfigService.selectOne(new EntityWrapper<TSystemConfig>().eq("type", 8) |
| | | .last("LIMIT 1")); |
| | | JSONObject jsonObject = JSONObject.parseObject(config.getContent()); |
| | | jsonObject.remove(jsonObject.getString("num1")); |
| | | jsonObject.put("num1",num1); |
| | | config.setContent(JSONObject.toJSONString(jsonObject)); |
| | | tSystemConfigService.updateById(config); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 修改启动页状态 |
| | | */ |
| | | @RequestMapping(value = "/updateStartState") |
| | | @ResponseBody |
| | | public Object updateStartState(Integer num2) { |
| | | TSystemConfig config = tSystemConfigService.selectOne(new EntityWrapper<TSystemConfig>().eq("type", 8) |
| | | .last("LIMIT 1")); |
| | | JSONObject jsonObject = JSONObject.parseObject(config.getContent()); |
| | | jsonObject.remove(jsonObject.getString("num2")); |
| | | jsonObject.put("num2",num2); |
| | | config.setContent(JSONObject.toJSONString(jsonObject)); |
| | | tSystemConfigService.updateById(config); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 详情 |
| | | */ |
| | | @RequestMapping(value = "/detail/{tSystemConfigId}") |