| | |
| | | import cn.hutool.core.date.DateUtil; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.intuit.oauth2.exception.InvalidRequestException; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.system.service.ITPriceService; |
| | | import com.stylefeng.guns.modular.system.utils.InvoicesDataUploadUtil; |
| | | import com.stylefeng.guns.modular.system.utils.RedisUtil; |
| | | 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 io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | 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 org.springframework.web.servlet.View; |
| | | |
| | | 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; |
| | | import java.util.*; |
| | | |
| | | @Controller |
| | | @Api(tags = "财务信息") |
| | | @RequestMapping("/api/tFinance") |
| | | @Slf4j |
| | | public class FinanceController { |
| | | |
| | | |
| | | @Autowired |
| | | private ITOrderService orderService; |
| | | |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | |
| | | private final String INVOICE_DATA = "CARINVOICE:"; |
| | | |
| | | |
| | | @ApiOperation(value = "卡车公司-应收报表列表",notes="卡车公司-应收报表列表") |
| | |
| | | @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) { |
| | | 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)); |
| | | return new SuccessTip(orderService.getReceivable(receivableVoPage,time,name,id)); |
| | | } |
| | | |
| | | |
| | |
| | | @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) { |
| | | 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)); |
| | | return new SuccessTip(orderService.getPayList(receivableVoPage,time,name,id)); |
| | | } |
| | | |
| | | @ApiOperation(value = "应收款票据列表",notes="应收款票据列表") |
| | |
| | | @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) { |
| | | 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); |
| | | List<ReceivablesList> receivablesLists = orderService.listOfReceivables(receivableVoPage, time, name, invoicesId, orderId, state,id); |
| | | receivableVoPage.setRecords(receivablesLists); |
| | | return new SuccessTip(receivableVoPage); |
| | | } |
| | | |
| | | @ApiOperation(value = "应收款票据quickBooks",notes="应收款票据quickBooks") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), |
| | | }) |
| | | @GetMapping(value = "/exportQuickBook") |
| | | @ResponseBody |
| | | public Object exportQuickBooks(){ |
| | | List<Map<String,Object>> orders = orderService.queryAllOrderDatas(); |
| | | redisUtil.setStrValue(INVOICE_DATA+"",orders.toString()); |
| | | try { |
| | | View view = InvoicesDataUploadUtil.connectToQuickBooks(); |
| | | log.info("view:{}",view); |
| | | } catch (InvalidRequestException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return new com.stylefeng.guns.core.base.tips.SuccessTip(); |
| | | } |
| | | |
| | | |
| | | |
| | | @ApiOperation(value = "应收款票据详情",notes="应收款票据详情") |
| | | @ApiImplicitParams({ |
| | |
| | | @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"), |
| | | @ApiImplicitParam(name = "type", value = "价格类型名称", required = false, dataType = "String"), |
| | | @ApiImplicitParam(name = "price", value = "价格", required = false, dataType = "Double"), |
| | | }) |
| | | @GetMapping(value = "/updatePrice") |
| | | @PostMapping(value = "/updatePrice") |
| | | @ResponseBody |
| | | public Object updatePrice(int id,String type,Double price) { |
| | | TPrice tPrice = priceService.selectById(id); |
| | | if(ToolUtil.isNotEmpty(type)){ |
| | | tPrice.setType(type); |
| | | } |
| | | if(ToolUtil.isNotEmpty(price)){ |
| | | BigDecimal bigDecimal = new BigDecimal(price); |
| | | tPrice.setPrice(bigDecimal); |
| | | tPrice.setCarPrice(bigDecimal); |
| | | } |
| | | try { |
| | | priceService.updateById(tPrice); |
| | | return new SuccessTip(); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | return new ErrorTip(500,"ERROR"); |
| | | public Object updatePrice(@RequestBody List<TPrice> prices,String note) { |
| | | String randomString = ToolUtil.getRandomString(15); |
| | | prices.forEach(e->e.setNumber(randomString)); |
| | | priceService.insertBatch(prices); |
| | | Long orderId = prices.get(0).getOrderId(); |
| | | TOrder tOrder = orderService.selectById(orderId); |
| | | tOrder.setNote(note); |
| | | return new SuccessTip(); |
| | | } |
| | | |
| | | @ApiOperation(value = "应收款票据详情--删除价格",notes="应收款票据详情--删除价格") |
| | |
| | | @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) { |
| | | 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); |
| | | List<PayList> payLists = orderService.listOfPay(receivableVoPage, time, name, billId, orderId, state,id); |
| | | receivableVoPage.setRecords(payLists); |
| | | return new SuccessTip(receivableVoPage); |
| | | } |