xuhy
7 天以前 782862750392a4428c40d6407b509aa015a5aa7d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
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();
    }
 
}