Pu Zhibing
6 天以前 4c99ee7028c3fe58a2cd4b8273b22c75c45574fc
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
package com.stylefeng.guns.modular.system.controller.general;
 
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.plugins.Page;
import com.stylefeng.guns.core.base.controller.BaseController;
import com.stylefeng.guns.core.common.constant.factory.PageFactory;
import com.stylefeng.guns.modular.system.model.SettlementAllocation;
import com.stylefeng.guns.modular.system.service.ISettlementAllocationService;
import com.stylefeng.guns.modular.system.service.ISettlementRecordService;
import com.stylefeng.guns.modular.system.util.ResultUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
 
import java.util.List;
import java.util.Map;
 
/**
 * @author zhibing.pu
 * @Date 2023/8/14 16:16
 */
@Controller
@RequestMapping("/settlementAllocation")
public class SettlementAllocationController extends BaseController {
 
    private String PREFIX = "/system/settlementAllocation/";
 
    @Autowired
    private ISettlementAllocationService settlementAllocationService;
 
    @Autowired
    private ISettlementRecordService settlementRecordService;
 
 
 
 
 
    /**
     * 跳转到配置页
     * @return
     */
    @GetMapping("/showSettlementAllocation")
    public String showSettlementAllocation(Model model){
        SettlementAllocation settlementAllocation = settlementAllocationService.selectOne(null);
        if(null != settlementAllocation){
            model.addAttribute("item", JSON.parseObject(settlementAllocation.getContent()));
        }else{
            model.addAttribute("item", null);
        }
        return PREFIX + "settlementAllocation.html";
    }
 
 
    /**
     * 修改配置
     * @param json
     * @return
     */
    @ResponseBody
    @PostMapping("/setSettlementAllocation")
    public ResultUtil setSettlementAllocation(String json){
        SettlementAllocation settlementAllocation = settlementAllocationService.selectOne(null);
        if(null == settlementAllocation){
            settlementAllocation = new SettlementAllocation();
            settlementAllocation.setContent(json);
            settlementAllocationService.insert(settlementAllocation);
        }else{
            settlementAllocation.setContent(json);
            settlementAllocationService.updateById(settlementAllocation);
        }
        return ResultUtil.success();
    }
 
 
    /**
     * 获取结算记录列表
     * @param time
     * @param money
     * @param status
     * @param driverName
     * @return
     */
    @ResponseBody
    @PostMapping("/querySettlementRecordList")
    public Object querySettlementRecordList(String time, Double money, Integer status, String driverName){
        Page<Map<String, Object>> page = new PageFactory().defaultPage();
        List<Map<String, Object>> list = settlementRecordService.querySettlementRecordList(page, time, money, status, driverName);
        page.setRecords(list);
        return super.packForBT(page);
    }
}