You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

119 lines
5.4 KiB
Java

6 years ago
package com.gszc.controller;
import com.alibaba.fastjson.JSONObject;
import com.gszc.build.Result;
import com.gszc.build.ResultBuilder;
import com.gszc.entity.Invoice;
import com.gszc.entity.InvoiceHeader;
import com.gszc.service.impl.InvoiceServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
6 years ago
import io.swagger.annotations.ApiImplicitParams;
6 years ago
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.List;
@Api(value = "工商注册 API", tags = {"小程序开票api"})
@RestController
@RequestMapping("/mini/invoice")
public class MiniInvoiceController {
@Autowired
InvoiceServiceImpl invoiceService;
@PostMapping("/addInvoice")
@ApiImplicitParam(name = "token", value = "token", required = true, dataType = "String", paramType = "header")
@ApiOperation(value = "开票", notes = "开票")
@ResponseBody
public Result addInvoice(@ModelAttribute @Valid Invoice invoice) {
invoiceService.addInvoice(invoice);
return ResultBuilder.success().build();
}
@PostMapping("/invoiceList")
6 years ago
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", required = true, dataType = "String", paramType = "header"),
@ApiImplicitParam(name = "userId", value = "用户id", required = true, dataType = "String"),
@ApiImplicitParam(name = "type", value = "状态 disable办理中 enable已完成", dataType = "String")
})
6 years ago
@ApiOperation(value = "开票记录", notes = "开票记录")
6 years ago
public Result invoiceList(String userId,String type) {
6 years ago
6 years ago
List<Invoice> invoiceList = invoiceService.invoiceList(userId,type);
6 years ago
return ResultBuilder.withPayload(invoiceList).build();
}
@PostMapping("/invoiceDetail")
@ApiImplicitParam(name = "token", value = "token", required = true, dataType = "String", paramType = "header")
@ApiOperation(value = "开票详情", notes = "开票详情")
public Result invoiceDetail(String invoiceId) {
JSONObject jsonObject = invoiceService.invoiceDetail(invoiceId);
return ResultBuilder.withPayload(jsonObject).build();
}
@PostMapping("/invoiceHeaderList")
@ApiImplicitParam(name = "token", value = "token", required = true, dataType = "String", paramType = "header")
@ApiOperation(value = "发票抬头列表", notes = "发票抬头列表")
public Result invoiceHeaderList(String userId) {
List<InvoiceHeader> invoiceHeaderList = invoiceService.invoiceHeaderList(userId);
return ResultBuilder.withPayload(invoiceHeaderList).build();
}
@PostMapping("/addInvoiceHeader")
@ApiImplicitParam(name = "token", value = "token", required = true, dataType = "String", paramType = "header")
@ApiOperation(value = "添加发票抬头", notes = "添加发票抬头")
@ResponseBody
public Result addInvoiceHeader(@ModelAttribute @Valid InvoiceHeader invoiceHeader) {
invoiceService.addInvoiceHeader(invoiceHeader);
return ResultBuilder.success().build();
}
@PostMapping("/updateInvoiceHeader")
@ApiImplicitParam(name = "token", value = "token", required = true, dataType = "String", paramType = "header")
@ApiOperation(value = "编辑发票抬头", notes = "编辑发票抬头")
@ResponseBody
public Result updateInvoiceHeader(@ModelAttribute @Valid InvoiceHeader invoiceHeader) {
invoiceService.updateInvoiceHeader(invoiceHeader);
return ResultBuilder.success().build();
}
@PostMapping("/deleteInvoiceHeader")
@ApiImplicitParam(name = "token", value = "token", required = true, dataType = "String", paramType = "header")
@ApiOperation(value = "删除发票抬头", notes = "删除发票抬头")
@ResponseBody
public Result deleteInvoiceHeader(String invoiceHeaderId) {
invoiceService.deleteInvoiceHeader(invoiceHeaderId);
return ResultBuilder.success().build();
}
@PostMapping("/invoiceHeaderDetail")
@ApiImplicitParam(name = "token", value = "token", required = true, dataType = "String", paramType = "header")
@ApiOperation(value = "发票抬头详情", notes = "发票抬头详情")
public Result invoiceHeaderDetail(String invoiceHeaderId) {
InvoiceHeader invoiceHeader = invoiceService.invoiceHeaderDetail(invoiceHeaderId);
return ResultBuilder.withPayload(invoiceHeader).build();
}
6 years ago
@PostMapping("/trackingDetail")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", required = true, dataType = "String", paramType = "header"),
@ApiImplicitParam(name = "trackingCompany", value = "快递公司简称 顺丰速运-SF 百世快递-HTKY 中通快递-ZTO 申通快递-STO 圆通速递-YTO 韵达速递-YD 邮政快递包裹-YZPY EMS-EMS 天天快递-HHTT 京东快递-JD 优速快递-UC 德邦快递-DBL", required = true, dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "trackingCode", value = "快递号", required = true, dataType = "String", paramType = "query")
})
@ApiOperation(value = "物流信息", notes = "物流信息")
public Result trackingDetail(String trackingCompany, String trackingCode) {
JSONObject result = invoiceService.trackingDetail(trackingCompany, trackingCode);
return ResultBuilder.withPayload(result).build();
}
6 years ago
}