添加Log日志,修改小程序接口Controller请求路径为Restful风格使其规范,修改方法名称,非mapper层不用select关键字

This commit is contained in:
wen 2022-01-04 11:23:09 +08:00
parent 1137c1782e
commit 525848b786
3 changed files with 33 additions and 30 deletions

View File

@ -2,6 +2,8 @@ package com.xhpc.invoice.api;
import com.xhpc.common.core.web.controller.BaseController;
import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.common.log.annotation.Log;
import com.xhpc.common.log.enums.BusinessType;
import com.xhpc.invoice.domain.*;
import com.xhpc.invoice.service.XhpcInvoiceService;
import org.springframework.web.bind.annotation.*;
@ -37,13 +39,14 @@ public class XhpcInvoiceApiController extends BaseController {
}
/**
* 保存用户所要开的发票信息
* 保存用户提交的开发票的信息
*
* @author WH
* @date 2021/12/28 14:54
* @since version-1.0
*/
@PostMapping()
@Log(title = "用户要开发票", businessType = BusinessType.INSERT)
@PostMapping("/user/commit")
public AjaxResult saveInvoiceInfo(@RequestBody SaveInvoiceInfoRequest saveInvoiceInfoRequest) throws Exception {
xhpcInvoiceService.saveInvoiceInfo(saveInvoiceInfoRequest);
@ -57,15 +60,15 @@ public class XhpcInvoiceApiController extends BaseController {
* @date 2021/12/27 12:23
* @since version-1.0
*/
@PostMapping(value = "/selectInvoiceHistoryRecords")
public AjaxResult selectInvoiceHistoryRecords(@RequestBody InvoiceHistoryRecordsRequest invoiceHistoryRecordsRequest) {
@GetMapping(value = "/user/history")
public AjaxResult findInvoiceHistoryRecords(@RequestBody InvoiceHistoryRecordsRequest invoiceHistoryRecordsRequest) {
InvoiceHistoryRecordsResponse invoiceHistoryRecordsResponse = xhpcInvoiceService.selectInvoiceHistoryRecords(invoiceHistoryRecordsRequest);
InvoiceHistoryRecordsResponse invoiceHistoryRecordsResponse = xhpcInvoiceService.findInvoiceHistoryRecords(invoiceHistoryRecordsRequest);
return AjaxResult.success(invoiceHistoryRecordsResponse);
}
/**
* 回显已经处理的开的的电子发票详情信息
* 回显电子发票详情信息
*
* @param invoiceId 要回显的发票id
* @return 返回包含了指定数据的AjaxResult
@ -73,28 +76,28 @@ public class XhpcInvoiceApiController extends BaseController {
* @date 2021/12/27 13:11
* @since version-1.0
*/
@GetMapping(value = "/selectSpecificInvoiced")
public AjaxResult selectSpecificInvoiced(@RequestParam Long invoiceId) {
@GetMapping(value = "/specific-info")
public AjaxResult findSpecificInvoicedInfo(@RequestParam Long invoiceId) {
SpecificInvoicedResponse specificInvoicedResponse = xhpcInvoiceService.selectSpecificInvoiced(invoiceId);
SpecificInvoicedResponse specificInvoicedResponse = xhpcInvoiceService.findSpecificInvoicedInfo(invoiceId);
return AjaxResult.success(specificInvoicedResponse);
}
/**
* 根据用户id用户类型要查询的当前时间的年月日查询该用户3个月内可以开发票的订单
* 根据用户id用户类型要查询的当前时间的年月日查询该用户3个月内可以开发票的历史订单
*
* @author WH
* @date 2021/12/24 14:10
* @since version-1.0
*/
@PostMapping(value = "/selectInvoicedOrders")
public AjaxResult selectInvoicedOrders(@RequestBody InvoicedOrdersRequest invoicedOrdersRequest) {
@GetMapping(value = "/user/history-orders")
public AjaxResult findUserHistoryOrders(@RequestBody InvoicedOrdersRequest invoicedOrdersRequest) {
if (invoicedOrdersRequest.getCurrentPage() == null || invoicedOrdersRequest.getItems() == null) {
return AjaxResult.error("分页参数不能为空:当前页数参数或当页要显示的条数为空");
}
InvoiceOrdersResponse invoiceOrdersResponse = xhpcInvoiceService.selectInvoicedOrders(invoicedOrdersRequest);
InvoiceOrdersResponse invoiceOrdersResponse = xhpcInvoiceService.findUserHistoryOrders(invoicedOrdersRequest);
return AjaxResult.success(invoiceOrdersResponse);
@ -107,24 +110,24 @@ public class XhpcInvoiceApiController extends BaseController {
* @date 2021/12/23 15:07
* @since version-1.0
*/
@GetMapping(value = "/selectInvoiceTitleInfo")
public AjaxResult selectInvoiceTitleInfo(@RequestParam(value = "firmName") String firmName) {
@GetMapping(value = "/title-info")
public AjaxResult findTitleInfo(@RequestParam(value = "firmName") String firmName) {
InvoiceTitleResponse invoiceTitleResponse = xhpcInvoiceService.selectInvoiceTitleInfo(firmName);
InvoiceTitleResponse invoiceTitleResponse = xhpcInvoiceService.findTitleInfo(firmName);
return AjaxResult.success(invoiceTitleResponse);
}
/**
* 查询用户最后一次输入的发票信息
* 查询用户最后一次所提交的发票信息
*
* @author WH
* @date 2021/12/23 15:07
* @since version-1.0
*/
@GetMapping(value = "/selectUserInputInvoiceInfo")
public AjaxResult selectUserInputInvoiceInfo(@RequestParam(value = "creatorId") Long creatorId, @RequestParam("creatorType") Integer creatorType) {
@GetMapping(value = "/user/last-info")
public AjaxResult findUserLastInputInfo(@RequestParam(value = "creatorId") Long creatorId, @RequestParam("creatorType") Integer creatorType) {
TitleResponse titleResponse = xhpcInvoiceService.selectUserInputInvoiceInfo(creatorId, creatorType);
TitleResponse titleResponse = xhpcInvoiceService.findUserLastInputInfo(creatorId, creatorType);
return AjaxResult.success(titleResponse);
}

View File

@ -67,7 +67,7 @@ public interface XhpcInvoiceService {
* @date 2021/12/23 15:29
* @since version-1.0
*/
InvoiceTitleResponse selectInvoiceTitleInfo(String firmName);
InvoiceTitleResponse findTitleInfo(String firmName);
/**
* 查询用户输入的最后一次的开发票所填写的信息
@ -79,7 +79,7 @@ public interface XhpcInvoiceService {
* @date 2021/12/23 17:23
* @since version-1.0
*/
TitleResponse selectUserInputInvoiceInfo(Long creatorId, Integer creatorType);
TitleResponse findUserLastInputInfo(Long creatorId, Integer creatorType);
/**
* 根据用户id用户类型要查询的当前时间的年月日查询该用户3个月内可以开发票的订单
@ -90,7 +90,7 @@ public interface XhpcInvoiceService {
* @date 2021/12/24 10:42
* @since version-1.0
*/
InvoiceOrdersResponse selectInvoicedOrders(InvoicedOrdersRequest invoicedOrdersRequest);
InvoiceOrdersResponse findUserHistoryOrders(InvoicedOrdersRequest invoicedOrdersRequest);
/**
* 根据发票id查询回显发票所需要的数据
@ -101,7 +101,7 @@ public interface XhpcInvoiceService {
* @date 2021/12/27 13:12
* @since version-1.0
*/
SpecificInvoicedResponse selectSpecificInvoiced(Long invoiceId);
SpecificInvoicedResponse findSpecificInvoicedInfo(Long invoiceId);
/**
* 根据前端传递过来的请求参数查询所需要的开发票历史记录
@ -112,7 +112,7 @@ public interface XhpcInvoiceService {
* @date 2021/12/27 14:49
* @since version-1.0
*/
InvoiceHistoryRecordsResponse selectInvoiceHistoryRecords(InvoiceHistoryRecordsRequest invoiceHistoryRecordsRequest);
InvoiceHistoryRecordsResponse findInvoiceHistoryRecords(InvoiceHistoryRecordsRequest invoiceHistoryRecordsRequest);
/**
* 将用户申请的发票信息保存到数据库中

View File

@ -188,7 +188,7 @@ public class XhpcInvoiceServiceImpl implements XhpcInvoiceService {
}
@Override
public InvoiceTitleResponse selectInvoiceTitleInfo(String firmName) {
public InvoiceTitleResponse findTitleInfo(String firmName) {
List<XhpcInvoice> xhpcInvoiceList = xhpcInvoiceMapper.selectInvoiceTitleInfo(firmName);
ArrayList<InvoiceTitleResponse.DataDTO> dataDTOList = new ArrayList<>();
@ -214,7 +214,7 @@ public class XhpcInvoiceServiceImpl implements XhpcInvoiceService {
* @since version-1.0
*/
@Override
public TitleResponse selectUserInputInvoiceInfo(Long creatorId, Integer creatorType) {
public TitleResponse findUserLastInputInfo(Long creatorId, Integer creatorType) {
XhpcInvoice xhpcInvoice = xhpcInvoiceMapper.selectUserLastInputInvoiceInfo(creatorId, creatorType);
TitleResponse titleResponse = new TitleResponse();
@ -233,7 +233,7 @@ public class XhpcInvoiceServiceImpl implements XhpcInvoiceService {
* @since version-1.0
*/
@Override
public InvoiceOrdersResponse selectInvoicedOrders(InvoicedOrdersRequest invoicedOrdersRequest) {
public InvoiceOrdersResponse findUserHistoryOrders(InvoicedOrdersRequest invoicedOrdersRequest) {
//计算分页索引,放置到currentPage属性中
int startIndex = (invoicedOrdersRequest.getCurrentPage() - 1) * invoicedOrdersRequest.getItems();
invoicedOrdersRequest.setCurrentPage(startIndex);
@ -269,7 +269,7 @@ public class XhpcInvoiceServiceImpl implements XhpcInvoiceService {
*/
@Override
@Transactional(rollbackFor = Exception.class)
public SpecificInvoicedResponse selectSpecificInvoiced(Long invoiceId) {
public SpecificInvoicedResponse findSpecificInvoicedInfo(Long invoiceId) {
//对拷发票部分数据
XhpcInvoice xhpcInvoice = xhpcInvoiceMapper.selectByPrimaryKey(invoiceId);
@ -371,7 +371,7 @@ public class XhpcInvoiceServiceImpl implements XhpcInvoiceService {
* @since version-1.0
*/
@Override
public InvoiceHistoryRecordsResponse selectInvoiceHistoryRecords(InvoiceHistoryRecordsRequest invoiceHistoryRecordsRequest) {
public InvoiceHistoryRecordsResponse findInvoiceHistoryRecords(InvoiceHistoryRecordsRequest invoiceHistoryRecordsRequest) {
//计算分页索引
int startIndex = (int) ((invoiceHistoryRecordsRequest.getCurrentPage() - 1) * invoiceHistoryRecordsRequest.getItems());
if (startIndex < 0) {