New file |
| | |
| | | package com.stylefeng.guns.modular.system.controller.specialTrain; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import com.stylefeng.guns.core.base.tips.ErrorTip; |
| | | import com.stylefeng.guns.core.common.constant.factory.PageFactory; |
| | | import com.stylefeng.guns.core.log.LogObjectHolder; |
| | | import com.stylefeng.guns.core.shiro.ShiroKit; |
| | | import com.stylefeng.guns.core.util.SinataUtil; |
| | | import com.stylefeng.guns.modular.system.model.SpecialAreaBilling; |
| | | import com.stylefeng.guns.modular.system.model.TLocation; |
| | | import com.stylefeng.guns.modular.system.model.TServerCarmodel; |
| | | import com.stylefeng.guns.modular.system.model.TSystemPrice; |
| | | import com.stylefeng.guns.modular.system.service.ITServerCarmodelService; |
| | | import com.stylefeng.guns.modular.system.service.ITSpecialAreaBillingService; |
| | | import com.stylefeng.guns.modular.system.service.ITSystemPriceService; |
| | | import com.stylefeng.guns.modular.system.util.PushMinistryOfTransportUtil; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.util.StringUtils; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 专车价格设置控制器 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2020-08-29 10:50:13 |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/specialAreaBilling") |
| | | public class TSpecialAreaBillingController extends BaseController { |
| | | |
| | | private String PREFIX = "/system/specialAreaBilling/"; |
| | | |
| | | @Autowired |
| | | private ITSpecialAreaBillingService specialAreaBillingService; |
| | | |
| | | |
| | | /** |
| | | * 跳转到专车价格设置首页 |
| | | */ |
| | | @RequestMapping("") |
| | | public String index() { |
| | | return PREFIX + "specialAreaBilling.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到添加专车价格设置 |
| | | */ |
| | | @RequestMapping("/add") |
| | | public String add(Model model) { |
| | | return PREFIX + "specialAreaBilling_add.html"; |
| | | } |
| | | /** |
| | | * 跳转到添加专车价格设置 |
| | | */ |
| | | @RequestMapping("/edit/{id}") |
| | | public String edit(@PathVariable("id") Integer id,Model model) { |
| | | SpecialAreaBilling specialAreaBilling = specialAreaBillingService.selectById(id); |
| | | model.addAttribute("data",specialAreaBilling); |
| | | model.addAttribute("id",id); |
| | | return PREFIX + "specialAreaBilling_edit.html"; |
| | | } |
| | | /** |
| | | * 跳转到添加专车价格设置 |
| | | */ |
| | | @RequestMapping("/detail") |
| | | public String update(Model model) { |
| | | return PREFIX + "specialAreaBilling_detail.html"; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取专车价格设置列表 |
| | | */ |
| | | @RequestMapping(value = "/list") |
| | | @ResponseBody |
| | | public Object list(String areaName) { |
| | | Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); |
| | | page.setRecords(specialAreaBillingService.list(page,areaName)); |
| | | return super.packForBT(page); |
| | | } |
| | | @RequestMapping(value = "/addSpecialAreaBilling") |
| | | @ResponseBody |
| | | public Object addSpecialAreaBilling(String areaName,String priceCoefficient,String remark,Integer state,String coordinate) { |
| | | if(!StringUtils.hasLength(coordinate)){ |
| | | return ResultUtil. error("特殊区域不能为空"); |
| | | } |
| | | SpecialAreaBilling specialAreaBilling = new SpecialAreaBilling(); |
| | | specialAreaBilling.setAreaName(areaName); |
| | | specialAreaBilling.setPriceCoefficient(Double.parseDouble(priceCoefficient)); |
| | | specialAreaBilling.setRemark(remark); |
| | | specialAreaBilling.setCoordinate(coordinate.replace("_","")); |
| | | specialAreaBilling.setState(state); |
| | | specialAreaBilling.setInsertTime(new Date()); |
| | | specialAreaBillingService.insert(specialAreaBilling); |
| | | return ResultUtil.success(); |
| | | } |
| | | @RequestMapping(value = "/editSpecialAreaBilling") |
| | | @ResponseBody |
| | | public Object editSpecialAreaBilling(Integer id,String areaName,String priceCoefficient,String remark,Integer state,String coordinate) { |
| | | if(!StringUtils.hasLength(coordinate)){ |
| | | return ResultUtil. error("特殊区域不能为空"); |
| | | } |
| | | SpecialAreaBilling specialAreaBilling = specialAreaBillingService.selectById(id); |
| | | specialAreaBilling.setAreaName(areaName); |
| | | specialAreaBilling.setPriceCoefficient(Double.parseDouble(priceCoefficient)); |
| | | specialAreaBilling.setRemark(remark); |
| | | specialAreaBilling.setCoordinate(coordinate.replace("_","")); |
| | | specialAreaBilling.setState(state); |
| | | specialAreaBillingService.updateById(specialAreaBilling); |
| | | return ResultUtil.success(); |
| | | } |
| | | @RequestMapping(value = "/delete") |
| | | @ResponseBody |
| | | public Object delete(Integer id) { |
| | | SpecialAreaBilling specialAreaBilling = specialAreaBillingService.selectById(id); |
| | | specialAreaBilling.setState(3); |
| | | specialAreaBillingService.updateById(specialAreaBilling); |
| | | return ResultUtil.success(); |
| | | } |
| | | @RequestMapping(value = "/freeze") |
| | | @ResponseBody |
| | | public Object freeze(Integer id) { |
| | | SpecialAreaBilling specialAreaBilling = specialAreaBillingService.selectById(id); |
| | | specialAreaBilling.setState(2); |
| | | specialAreaBillingService.updateById(specialAreaBilling); |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/thaw") |
| | | @ResponseBody |
| | | public Object thaw(Integer id) { |
| | | SpecialAreaBilling specialAreaBilling = specialAreaBillingService.selectById(id); |
| | | specialAreaBilling.setState(1); |
| | | specialAreaBillingService.updateById(specialAreaBilling); |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | } |