| | |
| | | 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; |
| | |
| | | import java.util.Arrays; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * 控制器 |
| | |
| | | |
| | | @Autowired |
| | | private ITSystemConfigService tSystemConfigService; |
| | | @Autowired |
| | | private ITAgentService agentService; |
| | | |
| | | /** |
| | | * 跳转到首页 |
| | |
| | | TSystemConfig tSystemConfig = tSystemConfigService.selectOne(new EntityWrapper<TSystemConfig>().eq("type", 2) |
| | | .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")); |
| | | 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("num1",jsonObject.getString("num1")); |
| | | model.addAttribute("num2",jsonObject.getString("num2")); |
| | | model.addAttribute("num3",jsonObject.getString("num3")); |
| | | model.addAttribute("num4",jsonObject.getString("num4")); |
| | | model.addAttribute("num5",jsonObject.getString("num5")); |
| | | model.addAttribute("num6",jsonObject.getString("num6")); |
| | | model.addAttribute("num7",jsonObject.getString("num7")); |
| | | return PREFIX + "tSystemConfigCommissionShareRules.html"; |
| | | } |
| | | |
| | |
| | | JSONObject jsonObject = JSONObject.parseObject(tSystemConfig.getContent()); |
| | | model.addAttribute("num1",jsonObject.getInteger("num1")); |
| | | model.addAttribute("num2",jsonObject.getInteger("num2")); |
| | | model.addAttribute("num3",jsonObject.getInteger("num3")); |
| | | model.addAttribute("num3",jsonObject.getString("num3")); |
| | | return PREFIX + "tSystemConfigExtractionRules.html"; |
| | | } |
| | | /** |
| | |
| | | } |
| | | 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); |
| | |
| | | */ |
| | | @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")); |
| | | 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", 7) |
| | | .last("LIMIT 1")); |
| | | JSONObject jsonObject = JSONObject.parseObject(tSystemConfig.getContent()); |
| | | model.addAttribute("num1",jsonObject.getString("num1")); |
| | | } |
| | | if(roleType == 3){ |
| | | TAgent tAgent = agentService.selectById(objectId); |
| | | if (Objects.nonNull(tAgent)){ |
| | | model.addAttribute("num1",tAgent.getServiceCalls()); |
| | | } |
| | | } |
| | | return PREFIX + "tSystemConfigServiceMgmt.html"; |
| | | } |
| | | |
| | |
| | | @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; |
| | | } |
| | | /** |
| | | * 获取列表 |
| | |
| | | } |
| | | |
| | | /** |
| | | * 修改价格规则开关 |
| | | */ |
| | | @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}") |