package com.stylefeng.guns.modular.system.controller;
|
|
import cn.hutool.core.date.DateUtil;
|
import com.baomidou.mybatisplus.mapper.EntityWrapper;
|
import com.baomidou.mybatisplus.plugins.Page;
|
import com.stylefeng.guns.core.util.ToolUtil;
|
import com.stylefeng.guns.modular.system.service.ITPriceService;
|
import com.stylefeng.guns.modular.system.utils.tips.ErrorTip;
|
import com.stylefeng.guns.modular.system.model.*;
|
import com.stylefeng.guns.modular.system.service.ITOrderService;
|
import com.stylefeng.guns.modular.system.utils.tips.SuccessTip;
|
import io.swagger.annotations.Api;
|
import io.swagger.annotations.ApiImplicitParam;
|
import io.swagger.annotations.ApiImplicitParams;
|
import io.swagger.annotations.ApiOperation;
|
import org.apache.ibatis.annotations.Param;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.boot.autoconfigure.cache.CacheProperties;
|
import org.springframework.stereotype.Controller;
|
import org.springframework.web.bind.annotation.*;
|
|
import javax.annotation.Resource;
|
import java.math.BigDecimal;
|
import java.text.SimpleDateFormat;
|
import java.util.ArrayList;
|
import java.util.Calendar;
|
import java.util.Date;
|
import java.util.List;
|
|
@Controller
|
@Api(tags = "财务信息")
|
@RequestMapping("/api/tFinance")
|
public class FinanceController {
|
|
|
@Autowired
|
private ITOrderService orderService;
|
|
|
@ApiOperation(value = "卡车公司-应收报表列表",notes="卡车公司-应收报表列表")
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."),
|
@ApiImplicitParam(name = "pageNumber", value = "pageNumber", required = true, dataType = "int",paramType = "query"),
|
@ApiImplicitParam(name = "pageSize", value = "pageSize", required = true, dataType = "int",paramType = "query"),
|
@ApiImplicitParam(name = "time", value = "时间 (时间 - 时间)", required = false, dataType = "String"),
|
@ApiImplicitParam(name = "name", value = "名称", required = false, dataType = "String"),
|
@ApiImplicitParam(name = "id", value = "id", required = true, dataType = "int"),
|
})
|
@PostMapping(value = "/list")
|
@ResponseBody
|
public Object list(int pageNumber,int pageSize,String time,String name,int id) {
|
Page<ReceivableVo> receivableVoPage = new Page<>(pageNumber, pageSize);
|
return new SuccessTip(orderService.getReceivable(receivableVoPage,time,name,id));
|
}
|
|
|
@ApiOperation(value = "应付报表列表",notes="应付报表列表")
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."),
|
@ApiImplicitParam(name = "pageNumber", value = "pageNumber", required = true, dataType = "int",paramType = "query"),
|
@ApiImplicitParam(name = "pageSize", value = "pageSize", required = true, dataType = "int",paramType = "query"),
|
@ApiImplicitParam(name = "time", value = "时间 (时间 - 时间)", required = false, dataType = "String"),
|
@ApiImplicitParam(name = "name", value = "名称", required = false, dataType = "String"),
|
@ApiImplicitParam(name = "id", value = "id", required = true, dataType = "int"),
|
})
|
@PostMapping(value = "/payList")
|
@ResponseBody
|
public Object payList(int pageNumber,int pageSize,String time,String name,int id) {
|
Page<ShouldPayVo> receivableVoPage = new Page<>(pageNumber, pageSize);
|
|
return new SuccessTip(orderService.getPayList(receivableVoPage,time,name,id));
|
}
|
|
@ApiOperation(value = "应收款票据列表",notes="应收款票据列表")
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."),
|
@ApiImplicitParam(name = "pageNumber", value = "pageNumber", required = true, dataType = "int",paramType = "query"),
|
@ApiImplicitParam(name = "pageSize", value = "pageSize", required = true, dataType = "int",paramType = "query"),
|
@ApiImplicitParam(name = "time", value = "时间 (时间 - 时间)", required = false, dataType = "String"),
|
@ApiImplicitParam(name = "name", value = "名称", required = false, dataType = "String"),
|
@ApiImplicitParam(name = "invoicesId", value = "invoicesId", required = false, dataType = "Integer"),
|
@ApiImplicitParam(name = "orderId", value = "orderId", required = false, dataType = "Integer"),
|
@ApiImplicitParam(name = "state", value = "1未支付完 2已支付", required = false, dataType = "Integer"),
|
@ApiImplicitParam(name = "id", value = "id", required = true, dataType = "Integer"),
|
})
|
@PostMapping(value = "/listOfReceivables")
|
@ResponseBody
|
public Object listOfReceivables(int pageNumber,int pageSize,String time,String name,Integer invoicesId,Integer orderId,Integer state,Integer id) {
|
Page<ReceivablesList> receivableVoPage = new Page<>(pageNumber, pageSize);
|
List<ReceivablesList> receivablesLists = orderService.listOfReceivables(receivableVoPage, time, name, invoicesId, orderId, state,id);
|
receivableVoPage.setRecords(receivablesLists);
|
return new SuccessTip(receivableVoPage);
|
}
|
|
@ApiOperation(value = "应收款票据详情",notes="应收款票据详情")
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."),
|
@ApiImplicitParam(name = "number", value = "订单id", required = true, dataType = "Long"),
|
})
|
@GetMapping(value = "/listOfReceivablesInfo")
|
@ResponseBody
|
public Object listOfReceivablesInfo(Long number) {
|
return new SuccessTip(orderService.listOfReceivablesInfoOne(number));
|
}
|
|
@ApiOperation(value = "应收款票据详情--编辑",notes="应收款票据详情--编辑")
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."),
|
@ApiImplicitParam(name = "number", value = "订单id", required = true, dataType = "Long"),
|
})
|
@GetMapping(value = "/listOfReceivablesInfoUpdate")
|
@ResponseBody
|
public Object listOfReceivablesInfoUpdate(Long number) {
|
return new SuccessTip(orderService.listOfReceivablesInfo(number));
|
}
|
|
@Resource
|
private ITPriceService priceService;
|
|
@ApiOperation(value = "应收款票据详情--添加价格",notes="应收款票据详情--添加价格")
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."),
|
@ApiImplicitParam(name = "number", value = "订单id", required = true, dataType = "Long"),
|
@ApiImplicitParam(name = "type", value = "价格类型名称", required = true, dataType = "String"),
|
@ApiImplicitParam(name = "price", value = "价格", required = true, dataType = "Double"),
|
})
|
@GetMapping(value = "/addPrice")
|
@ResponseBody
|
public Object addPrice(Long number,String type,Double price) {
|
TPrice tPrice = new TPrice();
|
tPrice.setOrderId(number);
|
tPrice.setType(type);
|
BigDecimal bigDecimal = new BigDecimal(price);
|
tPrice.setPrice(bigDecimal);
|
tPrice.setCarPrice(bigDecimal);
|
tPrice.setCreateTime(new Date());
|
tPrice.setState("1");
|
try {
|
priceService.insert(tPrice);
|
return new SuccessTip();
|
}catch (Exception e){
|
e.printStackTrace();
|
}
|
return new ErrorTip(500,"ERROR");
|
}
|
|
@ApiOperation(value = "应收款票据详情--编辑价格",notes="应收款票据详情--编辑价格")
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."),
|
})
|
@PostMapping(value = "/updatePrice")
|
@ResponseBody
|
public Object updatePrice(@RequestBody List<TPrice> prices,String note) {
|
priceService.insertBatch(prices);
|
Long orderId = prices.get(0).getOrderId();
|
TOrder tOrder = orderService.selectById(orderId);
|
tOrder.setNote(note);
|
return new SuccessTip();
|
}
|
|
@ApiOperation(value = "应收款票据详情--删除价格",notes="应收款票据详情--删除价格")
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."),
|
@ApiImplicitParam(name = "id", value = "价格id", required = true, dataType = "int"),
|
})
|
@GetMapping(value = "/delPrice")
|
@ResponseBody
|
public Object delPrice(int id) {
|
try {
|
priceService.deleteById(id);
|
return new SuccessTip();
|
}catch (Exception e){
|
e.printStackTrace();
|
}
|
return new ErrorTip(500,"ERROR");
|
}
|
|
@ApiOperation(value = "应付款票据列表",notes="应付款票据列表")
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."),
|
@ApiImplicitParam(name = "pageNumber", value = "pageNumber", required = true, dataType = "int",paramType = "query"),
|
@ApiImplicitParam(name = "pageSize", value = "pageSize", required = true, dataType = "int",paramType = "query"),
|
@ApiImplicitParam(name = "time", value = "时间 (时间 - 时间)", required = false, dataType = "String"),
|
@ApiImplicitParam(name = "name", value = "名称", required = false, dataType = "String"),
|
@ApiImplicitParam(name = "billId", value = "billId", required = false, dataType = "Integer"),
|
@ApiImplicitParam(name = "orderId", value = "orderId", required = false, dataType = "Integer"),
|
@ApiImplicitParam(name = "state", value = "1未支付完 2已支付", required = false, dataType = "Integer"),
|
@ApiImplicitParam(name = "id", value = "id", required = true, dataType = "Integer"),
|
})
|
@GetMapping(value = "/listOfPay")
|
@ResponseBody
|
public Object listOfPay(int pageNumber,int pageSize,String time,String name,Integer billId,Integer orderId,Integer state,Integer id) {
|
Page<PayList> receivableVoPage = new Page<>(pageNumber, pageSize);
|
List<PayList> payLists = orderService.listOfPay(receivableVoPage, time, name, billId, orderId, state,id);
|
receivableVoPage.setRecords(payLists);
|
return new SuccessTip(receivableVoPage);
|
}
|
|
@ApiOperation(value = "应付款票据详情",notes="应付款票据详情")
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."),
|
@ApiImplicitParam(name = "number", value = "订单id", required = true, dataType = "Long"),
|
})
|
@GetMapping(value = "/listOPayInfo")
|
@ResponseBody
|
public Object listOPayInfo(Long number) {
|
return new SuccessTip(orderService.listOPayInfo(number));
|
}
|
|
@ApiOperation(value = "应收款票据-Receive a payment",notes="应收款票据-Receive a payment")
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."),
|
@ApiImplicitParam(name = "number", value = "票据号", required = true, dataType = "String"),
|
})
|
@GetMapping(value = "/receivePayment")
|
@ResponseBody
|
public Object receivePayment(@RequestParam String number) {
|
TOrder tOrder = orderService.selectOne(new EntityWrapper<TOrder>().eq("invoice_number", number).eq("status", 1));
|
tOrder.setPayStatus(1);
|
tOrder.setSuccessTime(new Date());
|
boolean b = orderService.updateById(tOrder);
|
|
return new SuccessTip();
|
}
|
|
|
// @ApiOperation(value = "是否同意付款卡车公司",notes="是否同意付款卡车公司")
|
// @ApiImplicitParams({
|
// @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."),
|
// })
|
// @PostMapping(value = "/agreeOfPayment")
|
// @ResponseBody
|
// public Object confirmationOfPayment(@RequestBody PaymentReq req) {
|
// return new SuccessTip(orderService.confirmationOfPayment(req
|
// .getNumber(),req.getType(),req.getRemark()));
|
// }
|
|
|
//
|
// @ApiOperation(value = "卡车公司付款确认",notes="卡车公司付款确认")
|
// @ApiImplicitParams({
|
// @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."),
|
// @ApiImplicitParam(name = "number", value = "订单id", required = true, dataType = "Long"),
|
// })
|
// @GetMapping(value = "/confirmationOfPayment")
|
// @ResponseBody
|
// public Object confirmationOfPayment(@RequestParam Long number) {
|
// return new SuccessTip(orderService.agreeOfPayment(number));
|
// }
|
|
|
|
}
|