Commit a87aab13 authored by jiaorz's avatar jiaorz

Merge remote-tracking branch 'origin/master-invoice-modular' into master-invoice-modular

# Conflicts:
#	xx-universal/xx-universal-server/src/main/java/com/xxfc/platform/universal/controller/InvoiceController.java
#	xx-universal/xx-universal-server/src/main/java/com/xxfc/platform/universal/service/InvoiceBiz.java
parents f9247a00 019e2e45
......@@ -66,7 +66,11 @@ public class InvoiceVo {
*/
private String purchaserPhone="0";
/**
* 用户id
*/
private Integer userId;
private String createBy;
private List<OrderData> orders;
......
package com.xxfc.platform.universal.controller;
import com.alibaba.fastjson.JSONException;
import com.github.wxiaoqi.security.common.exception.BaseException;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.rest.BaseController;
......@@ -35,8 +34,14 @@ public class InvoiceController extends BaseController<InvoiceBiz, Invoice> {
*/
@GetMapping("/dutyParagraph")
public ObjectRestResponse getDutyParagraphByCode(@RequestParam("code") String code) {
String dutyParagraph = baseBiz.getDutyParagraphByCode(code);
return ObjectRestResponse.succ(dutyParagraph);
try {
String dutyParagraph = baseBiz.getDutyParagraphByCode(code);
return ObjectRestResponse.succ(dutyParagraph);
} catch (BaseException e) {
return ObjectRestResponse.createFailedResult(ResultCode.FAILED_CODE, e.getMessage());
} catch (Exception e) {
return ObjectRestResponse.createFailedResult(ResultCode.FAILED_CODE, "获取公司全名失败");
}
}
/**
......@@ -47,8 +52,14 @@ public class InvoiceController extends BaseController<InvoiceBiz, Invoice> {
*/
@GetMapping("/corporateName")
public ObjectRestResponse corporateName(@RequestParam("name") String name) {
List<Map<String, String>> mapList = baseBiz.corporateName(name);
return ObjectRestResponse.succ(mapList);
try {
List<Map<String, String>> mapList = baseBiz.corporateName(name);
return ObjectRestResponse.succ(mapList);
} catch (BaseException e) {
return ObjectRestResponse.createFailedResult(ResultCode.FAILED_CODE, e.getMessage());
} catch (Exception e) {
return ObjectRestResponse.createFailedResult(ResultCode.FAILED_CODE, "获取公司全名失败");
}
}
/**
......@@ -59,7 +70,12 @@ public class InvoiceController extends BaseController<InvoiceBiz, Invoice> {
* @throws Exception
*/
@PostMapping("/invoicing")
public ObjectRestResponse invoicing(@RequestBody InvoiceVo invoiceVo) {
public ObjectRestResponse invoicing(@RequestBody InvoiceVo invoiceVo) throws Exception {
// String token = request.getHeader("Authorization");
// log.info("开票信息={}", invoiceVo);
// IJWTInfo infoFromToken = userAuthUtil.getInfoFromToken(token);
// invoiceVo.setUserId(Integer.valueOf(infoFromToken.getId()));
// invoiceVo.setCreateBy(infoFromToken.getName());
try {
String invoicing = baseBiz.Invoicing(invoiceVo);
......
......@@ -44,9 +44,7 @@ import java.util.concurrent.TimeUnit;
public class InvoiceBiz extends BaseBiz<InvoiceMapper, Invoice> {
private final InvoiceDao invoiceDao;
private final UserAuthConfig userAuthConfig;
private final HttpServletRequest request;
private final UserAuthUtil userAuthUtil;
private final InvoiceQueryErrorBiz invoiceQueryErrorBiz;
private final OrderFeign orderFeign;
private static final SnowflakeIdWorker snowflakeIdWorker = new SnowflakeIdWorker(0, 0);
......@@ -153,11 +151,8 @@ public class InvoiceBiz extends BaseBiz<InvoiceMapper, Invoice> {
* @param orders
* @throws Exception
*/
public void insertInvoic(Invoice invoice, String invoiceSerialNum, List<OrderData> orders) throws Exception {
public void insertInvoic(Invoice invoice, String invoiceSerialNum, List<OrderData> orders,HttpServletRequest request) throws Exception {
IJWTInfo infoFromToken = userAuthUtil.getInfoFromToken(userAuthConfig.getToken(request));
invoice.setUserId(Integer.valueOf(infoFromToken.getId()));
invoice.setCreateBy(infoFromToken.getName());
invoice.setInvoiceSerialNum(invoiceSerialNum);
BigDecimal taxExcludedAmount = BigDecimal.ZERO;
BigDecimal taxIncludedAmount = BigDecimal.ZERO;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment