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);
|
}
|
}
|