123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176 |
- package com.bosshand.virgo.api.controller;
- import com.bosshand.virgo.api.model.Payment;
- import com.bosshand.virgo.api.model.PaymentInvoice;
- import com.bosshand.virgo.api.model.PaymentOrdinary;
- import com.bosshand.virgo.api.model.PaymentRecord;
- import com.bosshand.virgo.api.service.PaymentService;
- import com.bosshand.virgo.core.response.Response;
- import io.swagger.annotations.Api;
- import io.swagger.annotations.ApiOperation;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.*;
- import java.util.HashMap;
- import java.util.List;
- import java.util.Map;
- @RestController
- @RequestMapping({"payment"})
- @Api(tags = {"账单缴费发票管理"})
- public class PaymentController {
- @Autowired
- PaymentService paymentService;
- @ApiOperation("分页获取")
- @RequestMapping(value = "/{currPage}/{pageSize}", method = RequestMethod.POST)
- public Response list(@RequestBody Payment payment, @PathVariable int currPage, @PathVariable int pageSize) {
- int totalCount = paymentService.getTotalCount(payment);
- List<Payment> dataList = paymentService.getLimit(payment, currPage, pageSize);
- Map<String, Object> result = new HashMap<>();
- result.put("dataList", dataList);
- result.put("totalCount", totalCount);
- return Response.ok(result);
- }
- @ApiOperation("详情")
- @RequestMapping(value = "/{id}", method = RequestMethod.GET)
- public Response get(@PathVariable long id) {
- return Response.ok(paymentService.get(id));
- }
- @ApiOperation("更新状态")
- @RequestMapping(value = "/updateStatus/{id}/{status}", method = RequestMethod.PUT)
- public Response update(@PathVariable long id, @PathVariable Integer status) {
- paymentService.updateStatus(id, status);
- return Response.ok();
- }
- @ApiOperation("生成账单")
- @RequestMapping(value = "/generate/{contractId}", method = RequestMethod.GET)
- public Response generate(@PathVariable long contractId) {
- List<Payment> list = paymentService.getContractId(contractId);
- if (list.size() > 0) {
- //return Response.fail(200001, "合同下账单已生成好了!");
- }
- paymentService.generate(contractId);
- return Response.ok("账单已生成!");
- }
- /**
- * 发票记录
- */
- @ApiOperation("发票记录详情")
- @RequestMapping(value = "/invoice/{id}", method = RequestMethod.GET)
- public Response getInvoice(@PathVariable long id) {
- return Response.ok(paymentService.getInvoice(id));
- }
- @ApiOperation("保存发票记录")
- @RequestMapping(value = "/invoice", method = RequestMethod.POST)
- public Response insertInvoice(@RequestBody PaymentInvoice paymentInvoice) {
- paymentService.insertInvoice(paymentInvoice);
- return Response.ok();
- }
- @ApiOperation("获取发票记录")
- @RequestMapping(value = "/invoice/query", method = RequestMethod.POST)
- public Response getInvoiceList(@RequestBody PaymentInvoice paymentInvoice) {
- return Response.ok(paymentService.getInvoiceList(paymentInvoice));
- }
- @ApiOperation("更新发票记录")
- @RequestMapping(value = "/invoice/update", method = RequestMethod.PUT)
- public Response updateInvoice(@RequestBody PaymentInvoice paymentInvoice) {
- paymentService.updateInvoice(paymentInvoice);
- return Response.ok();
- }
- @ApiOperation("删除发票记录")
- @RequestMapping(value = "/invoice/delete/{id}", method = RequestMethod.DELETE)
- public Response deleteInvoice(@PathVariable long id) {
- paymentService.deleteInvoice(id);
- return Response.ok();
- }
- /**
- * 付款记录
- */
- @ApiOperation("付款记录详情")
- @RequestMapping(value = "/record/{id}", method = RequestMethod.GET)
- public Response getPaymentRecord(@PathVariable long id) {
- return Response.ok(paymentService.getPaymentRecord(id));
- }
- @ApiOperation("保存付款记录")
- @RequestMapping(value = "/record", method = RequestMethod.POST)
- public Response insertPaymentRecord(@RequestBody PaymentRecord paymentRecord) {
- paymentService.insertPaymentRecord(paymentRecord);
- return Response.ok();
- }
- @ApiOperation("获取付款记录")
- @RequestMapping(value = "/record/query", method = RequestMethod.POST)
- public Response getPaymentRecordList(@RequestBody PaymentRecord paymentRecord) {
- return Response.ok(paymentService.getPaymentRecordList(paymentRecord));
- }
- @ApiOperation("更新付款记录")
- @RequestMapping(value = "/record/update", method = RequestMethod.PUT)
- public Response updatePaymentRecord(@RequestBody PaymentRecord paymentRecord) {
- paymentService.updatePaymentRecord(paymentRecord);
- return Response.ok();
- }
- @ApiOperation("删除付款记录")
- @RequestMapping(value = "/record/delete/{id}", method = RequestMethod.DELETE)
- public Response deletePaymentRecord(@PathVariable long id) {
- paymentService.deletePaymentRecord(id);
- return Response.ok();
- }
- /**
- * 普通账单
- */
- @ApiOperation("普通账单分页获取")
- @RequestMapping(value = "/ordinary/{currPage}/{pageSize}", method = RequestMethod.POST)
- public Response list(@RequestBody PaymentOrdinary paymentOrdinary, @PathVariable int currPage, @PathVariable int pageSize) {
- int totalCount = paymentService.getTotalCount(paymentOrdinary);
- List<PaymentOrdinary> dataList = paymentService.getLimit(paymentOrdinary, currPage, pageSize);
- Map<String, Object> result = new HashMap<>();
- result.put("dataList", dataList);
- result.put("totalCount", totalCount);
- return Response.ok(result);
- }
- @ApiOperation("普通账单详情")
- @RequestMapping(value = "/ordinary/{id}", method = RequestMethod.GET)
- public Response getPaymentOrdinary(@PathVariable long id) {
- return Response.ok(paymentService.getPaymentOrdinary(id));
- }
- @ApiOperation("普通账单保存")
- @RequestMapping(value = "/ordinary", method = RequestMethod.POST)
- public Response insertPaymentOrdinary(@RequestBody PaymentOrdinary paymentOrdinary) {
- paymentService.insertPaymentOrdinary(paymentOrdinary);
- return Response.ok();
- }
- @ApiOperation("普通账单更新")
- @RequestMapping(value = "/ordinary", method = RequestMethod.PUT)
- public Response updatePaymentOrdinary(@RequestBody PaymentOrdinary paymentOrdinary) {
- paymentService.updatePaymentOrdinary(paymentOrdinary);
- return Response.ok();
- }
- @ApiOperation("普通账单删除")
- @RequestMapping(value = "/ordinary/{id}", method = RequestMethod.DELETE)
- public Response update(@PathVariable long id) {
- paymentService.deletePaymentOrdinary(id);
- return Response.ok();
- }
- }
|