ariesy 增加查验接口幂等性

release
yefei 2 years ago
parent 130580e31e
commit 08e33f4e81
  1. 4
      dxhy-erp/pom.xml
  2. 376
      dxhy-erp/src/main/java/com/dxhy/erp/controller/SDNYMainProcessController.java

@ -156,6 +156,10 @@
<artifactId>spring-cloud-starter-bootstrap</artifactId> <artifactId>spring-cloud-starter-bootstrap</artifactId>
<version>3.0.2</version> <version>3.0.2</version>
</dependency> </dependency>
<dependency>
<groupId>org.redisson</groupId>
<artifactId>redisson-spring-boot-starter</artifactId>
</dependency>
</dependencies> </dependencies>
<build> <build>
<finalName>${project.artifactId}</finalName> <finalName>${project.artifactId}</finalName>

@ -12,7 +12,6 @@ import com.dxhy.common.exception.BaseException;
import com.dxhy.common.util.InvoiceUtil; import com.dxhy.common.util.InvoiceUtil;
import com.dxhy.common.utils.Base64Encoding; import com.dxhy.common.utils.Base64Encoding;
import com.dxhy.common.utils.R; import com.dxhy.common.utils.R;
import com.dxhy.erp.dao.*;
import com.dxhy.erp.entity.*; import com.dxhy.erp.entity.*;
import com.dxhy.erp.entity.sdny.*; import com.dxhy.erp.entity.sdny.*;
import com.dxhy.erp.model.InvoiceDetailInfo; import com.dxhy.erp.model.InvoiceDetailInfo;
@ -21,11 +20,14 @@ import com.dxhy.erp.utils.Base64;
import com.dxhy.erp.utils.HmacSHA1Util; import com.dxhy.erp.utils.HmacSHA1Util;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.redisson.api.RLock;
import org.redisson.api.RedissonClient;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.Async;
import org.springframework.util.Base64Utils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
@ -86,6 +88,9 @@ public class SDNYMainProcessController extends AbstractController {
@Autowired @Autowired
private ImageSubmitService imageSubmitService; private ImageSubmitService imageSubmitService;
@Resource
private RedissonClient redisson;
/** /**
* 查验发票 * 查验发票
*/ */
@ -489,220 +494,241 @@ public class SDNYMainProcessController extends AbstractController {
@SysLog("发票查验") @SysLog("发票查验")
public ResponseEntity<String> singleInvoiceCheck(@RequestBody Map<String, String> pramsMap) throws Exception { public ResponseEntity<String> singleInvoiceCheck(@RequestBody Map<String, String> pramsMap) throws Exception {
log.info("传入的参数为:{}", pramsMap); log.info("传入的参数为:{}", pramsMap);
String dbName = "business"; String param = JSONObject.toJSONString(pramsMap);
JSONObject checkInvoiceResult = null; //加分布式锁
String lockKey = Base64Utils.encodeToString(param.getBytes());
RLock lock = redisson.getLock(lockKey);
try {
boolean isLock = lock.tryLock();
InvoiceUtil iu = new InvoiceUtil(pramsMap.get("invoiceCode")); if (!isLock) {
String fplxdm = iu.getFplxdm(); log.info("当前已有线程获取到锁");
if (fplxdm != null || "10107".equals(pramsMap.get("invoiceType")) || "10108".equals(pramsMap.get("invoiceType")) || pramsMap.get("invoiceCode").startsWith("50000")) { } else {
//查验类发票,执行查验操作后入库
log.info("查验类发票,执行查验操作后入库");
//权限校验
if (StringUtils.isBlank(pramsMap.get("invoiceNumber"))) {
return ResponseEntity.ok(JSONObject.toJSONString(R.error("发票号码不能为空!")));
}
pramsMap.put("invoiceNo", pramsMap.get("invoiceNumber")); String dbName = "business";
JSONObject checkInvoiceResult = null;
InvoiceUtil iu = new InvoiceUtil(pramsMap.get("invoiceCode"));
String fplxdm = iu.getFplxdm();
if (fplxdm != null || "10107".equals(pramsMap.get("invoiceType")) || "10108".equals(pramsMap.get("invoiceType")) || pramsMap.get("invoiceCode").startsWith("50000")) {
//查验类发票,执行查验操作后入库
log.info("查验类发票,执行查验操作后入库");
//权限校验
if (StringUtils.isBlank(pramsMap.get("invoiceNumber"))) {
return ResponseEntity.ok(JSONObject.toJSONString(R.error("发票号码不能为空!")));
}
if (StringUtils.isNotBlank(pramsMap.get("billingDate"))) { pramsMap.put("invoiceNo", pramsMap.get("invoiceNumber"));
String billingDate = pramsMap.get("billingDate").replaceAll("-", "");
iu.setKprq(pramsMap.get("billingDate"));
pramsMap.put("invoiceDate", billingDate);
pramsMap.put("billingDate", billingDate);
} else {
return ResponseEntity.ok(JSONObject.toJSONString(R.error("开票日期不能为空!")));
}
if (StringUtils.isBlank(pramsMap.get("invoiceType"))) { if (StringUtils.isNotBlank(pramsMap.get("billingDate"))) {
return ResponseEntity.ok(JSONObject.toJSONString(R.error("发票类型不能为空!"))); String billingDate = pramsMap.get("billingDate").replaceAll("-", "");
} iu.setKprq(pramsMap.get("billingDate"));
pramsMap.put("invoiceDate", billingDate);
pramsMap.put("billingDate", billingDate);
} else {
return ResponseEntity.ok(JSONObject.toJSONString(R.error("开票日期不能为空!")));
}
if (SNFplxEnum.ZP.getSnFplxDm().equals(pramsMap.get("invoiceType")) if (StringUtils.isBlank(pramsMap.get("invoiceType"))) {
|| SNFplxEnum.JDC.getSnFplxDm().equals(pramsMap.get("invoiceType")) return ResponseEntity.ok(JSONObject.toJSONString(R.error("发票类型不能为空!")));
|| SNFplxEnum.DZZP.getSnFplxDm().equals(pramsMap.get("invoiceType")) }
|| SNFplxEnum.ESC.getSnFplxDm().equals(pramsMap.get("invoiceType"))
|| SNFplxEnum.QDZP.getSnFplxDm().equals(pramsMap.get("invoiceType"))
|| SNFplxEnum.QDPP.getSnFplxDm().equals(pramsMap.get("invoiceType"))) {
if (StringUtils.isBlank(pramsMap.get("totalAmount"))) {
return ResponseEntity.ok(JSONObject.toJSONString(R.error("金额不能为空!")));
}
} else {
if (StringUtils.isBlank(pramsMap.get("checkCode"))) {
return ResponseEntity.ok(JSONObject.toJSONString(R.error("校验码不能为空!")));
}
}
if ("10107".equals(pramsMap.get("invoiceType")) || "10108".equals(pramsMap.get("invoiceType"))) { if (SNFplxEnum.ZP.getSnFplxDm().equals(pramsMap.get("invoiceType"))
pramsMap.put("invoiceType", "21"); || SNFplxEnum.JDC.getSnFplxDm().equals(pramsMap.get("invoiceType"))
} || SNFplxEnum.DZZP.getSnFplxDm().equals(pramsMap.get("invoiceType"))
|| SNFplxEnum.ESC.getSnFplxDm().equals(pramsMap.get("invoiceType"))
|| SNFplxEnum.QDZP.getSnFplxDm().equals(pramsMap.get("invoiceType"))
|| SNFplxEnum.QDPP.getSnFplxDm().equals(pramsMap.get("invoiceType"))) {
if (StringUtils.isBlank(pramsMap.get("totalAmount"))) {
return ResponseEntity.ok(JSONObject.toJSONString(R.error("金额不能为空!")));
}
} else {
if (StringUtils.isBlank(pramsMap.get("checkCode"))) {
return ResponseEntity.ok(JSONObject.toJSONString(R.error("校验码不能为空!")));
}
}
log.info("发票类型为:{}", pramsMap.get("invoiceType")); if ("10107".equals(pramsMap.get("invoiceType")) || "10108".equals(pramsMap.get("invoiceType"))) {
pramsMap.put("invoiceType", "21");
}
String uuid = (StringUtils.isBlank(pramsMap.get("invoiceCode")) ? "" : pramsMap.get("invoiceCode")) + pramsMap.get("invoiceNo"); log.info("发票类型为:{}", pramsMap.get("invoiceType"));
log.info("uuid={}", uuid);
String notes = invoiceQueryService.checkingInvoiceInfo("business", uuid, getUserInfo());
if (notes != null) {
return ResponseEntity.ok(JSONObject.toJSONString(R.error(notes)));
}
//非通行费类发票 先判断底账库中是否已存在 String uuid = (StringUtils.isBlank(pramsMap.get("invoiceCode")) ? "" : pramsMap.get("invoiceCode")) + pramsMap.get("invoiceNo");
if (!"32000".equals(pramsMap.get("invoiceType"))) { log.info("uuid={}", uuid);
//查询底账库是否有对应发票,有则直接返回 String notes = invoiceQueryService.checkingInvoiceInfo("business", uuid, getUserInfo());
QueryWrapper<BaseTDxRecordInvoice> recordWrapper = new QueryWrapper<>(); if (notes != null) {
recordWrapper.eq("uuid", uuid); return ResponseEntity.ok(JSONObject.toJSONString(R.error(notes)));
BaseTDxRecordInvoice checkInvoiceByUuid = snPushCheckRecordService.selectRecordByWrapper(recordWrapper); }
if (checkInvoiceByUuid != null) {
log.info("进项票池已存在发票.直接返回票池信息");
R data = new R(1000, "default success");
//如果购方名称为空,则查验之后补充购销方相关信息 //非通行费类发票 先判断底账库中是否已存在
String gfName = checkInvoiceByUuid.getGfName(); if (!"32000".equals(pramsMap.get("invoiceType"))) {
String gfAddressAndPhone = checkInvoiceByUuid.getGfAddressAndPhone(); //查询底账库是否有对应发票,有则直接返回
if(StringUtils.isEmpty(gfName) || StringUtils.isEmpty(gfAddressAndPhone)){ QueryWrapper<BaseTDxRecordInvoice> recordWrapper = new QueryWrapper<>();
log.info("购方名称为空,查验补充信息"); recordWrapper.eq("uuid", uuid);
checkInvoiceResult = snPushCheckRecordService.singleCheckInvoice(pramsMap, null); BaseTDxRecordInvoice checkInvoiceByUuid = snPushCheckRecordService.selectRecordByWrapper(recordWrapper);
if (checkInvoiceByUuid != null) {
log.info("进项票池已存在发票.直接返回票池信息");
R data = new R(1000, "default success");
//如果购方名称为空,则查验之后补充购销方相关信息
String gfName = checkInvoiceByUuid.getGfName();
String gfAddressAndPhone = checkInvoiceByUuid.getGfAddressAndPhone();
if (StringUtils.isEmpty(gfName) || StringUtils.isEmpty(gfAddressAndPhone)) {
log.info("购方名称为空,查验补充信息");
checkInvoiceResult = snPushCheckRecordService.singleCheckInvoice(pramsMap, null);
if (!checkInvoiceResult.containsKey("code")) {
if (!checkInvoiceResult.containsKey("cyjg")) {
snPushCheckRecordService.updateInvoice(dbName, checkInvoiceResult, recordWrapper);
} else if (checkInvoiceResult.containsKey("cyjg") && !"0001".equals(checkInvoiceResult.getString("cyjg"))) {
data = errorInfo(checkInvoiceResult, data);
return ResponseEntity.ok(JSONObject.toJSONString(data));
if (!checkInvoiceResult.containsKey("code")) { }
if (!checkInvoiceResult.containsKey("cyjg")) { }
snPushCheckRecordService.updateInvoice(dbName, checkInvoiceResult, recordWrapper); checkInvoiceByUuid = snPushCheckRecordService.selectRecordByWrapper(recordWrapper);
} else if (checkInvoiceResult.containsKey("cyjg") && !"0001".equals(checkInvoiceResult.getString("cyjg"))) { }
data = errorInfo(checkInvoiceResult, data);
return ResponseEntity.ok(JSONObject.toJSONString(data));
String invoiceNo = checkInvoiceByUuid.getInvoiceNo();
QueryWrapper<BaseTDxRecordInvoiceDetail> detailWrapper = new QueryWrapper<>();
detailWrapper.eq("uuid", uuid);
List<BaseTDxRecordInvoiceDetail> baseTDxRecordInvoiceDetail = null;
List<TDxVehicleSaleInvoice> vehicleList = null;
if ("10104".equals(pramsMap.get("invoiceType")) || "10105".equals(pramsMap.get("invoiceType"))) {
vehicleList = snPushCheckRecordService.vihicleList(uuid);
} else {
baseTDxRecordInvoiceDetail = snPushCheckRecordService.selectRecordDetailListByWrapper(detailWrapper);
} }
}
checkInvoiceByUuid = snPushCheckRecordService.selectRecordByWrapper(recordWrapper);
}
String invoiceNo = checkInvoiceByUuid.getInvoiceNo(); if ((baseTDxRecordInvoiceDetail == null || baseTDxRecordInvoiceDetail.size() == 0) && (vehicleList == null || vehicleList.size() == 0)) {
QueryWrapper<BaseTDxRecordInvoiceDetail> detailWrapper = new QueryWrapper<>(); checkInvoiceResult = snPushCheckRecordService.singleCheckInvoice(pramsMap, null);
detailWrapper.eq("uuid", uuid);
if (!checkInvoiceResult.containsKey("code")) {
if (!checkInvoiceResult.containsKey("cyjg")) {
//先删除原有主数据,再查验更新主数据和明细数据
snPushCheckRecordService.updateInvoice(dbName, checkInvoiceResult, recordWrapper);
if ("10104".equals(pramsMap.get("invoiceType")) || "10105".equals(pramsMap.get("invoiceType"))) {
vehicleList = snPushCheckRecordService.vihicleList(uuid);
} else {
baseTDxRecordInvoiceDetail = snPushCheckRecordService.selectRecordDetailListByWrapper(detailWrapper);
}
} else if (checkInvoiceResult.containsKey("cyjg") && !"0001".equals(checkInvoiceResult.getString("cyjg"))) {
data = errorInfo(checkInvoiceResult, data);
return ResponseEntity.ok(JSONObject.toJSONString(data));
}
}
}
JSONObject checkInvoice = (JSONObject) JSONObject.toJSON(checkInvoiceByUuid);
JSONArray checkInvoiceDetail = (JSONArray) JSONObject.toJSON(baseTDxRecordInvoiceDetail);
JSONObject vehicleDetail = new JSONObject();
if (vehicleList != null && vehicleList.size() > 0) {
vehicleDetail = (JSONObject) JSONObject.toJSON(vehicleList.get(0));
}
List<BaseTDxRecordInvoiceDetail> baseTDxRecordInvoiceDetail = null; convertToResult(checkInvoice, checkInvoiceDetail, vehicleDetail);
List<TDxVehicleSaleInvoice> vehicleList = null;
if ("10104".equals(pramsMap.get("invoiceType")) || "10105".equals(pramsMap.get("invoiceType"))) {
vehicleList = snPushCheckRecordService.vihicleList(uuid);
} else {
baseTDxRecordInvoiceDetail = snPushCheckRecordService.selectRecordDetailListByWrapper(detailWrapper);
}
if ((baseTDxRecordInvoiceDetail == null || baseTDxRecordInvoiceDetail.size() == 0) && (vehicleList == null || vehicleList.size() == 0)) { data.put("data", checkInvoice);
checkInvoiceResult = snPushCheckRecordService.singleCheckInvoice(pramsMap, null); //查验结果保存
//saveCheckLog(pramsMap, checkInvoice);
if (!checkInvoiceResult.containsKey("code")) { return ResponseEntity.ok(JSONObject.toJSONString(data));
if (!checkInvoiceResult.containsKey("cyjg")) { } else {
//先删除原有主数据,再查验更新主数据和明细数据 TdxSaleRecordInvoice tdxSaleRecordInvoice = snPushCheckRecordService.selectSaleByUuid(uuid);
snPushCheckRecordService.updateInvoice(dbName, checkInvoiceResult, recordWrapper); log.info("tdxSaleRecordInvoice={}", tdxSaleRecordInvoice);
if (tdxSaleRecordInvoice != null) {
log.info("销项票池已存在发票.直接返回票池信息");
R data = new R(1000, "default success");
String invoiceNo = tdxSaleRecordInvoice.getInvoiceNo();
QueryWrapper<RecordInvoiceSaleDetailModel> saleDetailWrapper = new QueryWrapper<>();
saleDetailWrapper.eq("invoice_no", invoiceNo);
List<RecordInvoiceSaleDetailModel> recordInvoiceSaleDetailModel = snPushCheckRecordService.selectSaleListByWrapper(saleDetailWrapper);
JSONObject checkInvoice = (JSONObject) JSONObject.toJSON(tdxSaleRecordInvoice);
JSONArray saleDetail = (JSONArray) JSONObject.toJSON(recordInvoiceSaleDetailModel);
convertToResult(checkInvoice, saleDetail);
data.put("data", checkInvoice);
//查验结果保存
// saveCheckLog(pramsMap,checkInvoice);
if ("10104".equals(pramsMap.get("invoiceType")) || "10105".equals(pramsMap.get("invoiceType"))) {
vehicleList = snPushCheckRecordService.vihicleList(uuid);
} else {
baseTDxRecordInvoiceDetail = snPushCheckRecordService.selectRecordDetailListByWrapper(detailWrapper);
}
} else if (checkInvoiceResult.containsKey("cyjg") && !"0001".equals(checkInvoiceResult.getString("cyjg"))) {
data = errorInfo(checkInvoiceResult, data);
return ResponseEntity.ok(JSONObject.toJSONString(data)); return ResponseEntity.ok(JSONObject.toJSONString(data));
} }
} }
} }
JSONObject checkInvoice = (JSONObject) JSONObject.toJSON(checkInvoiceByUuid);
JSONArray checkInvoiceDetail = (JSONArray) JSONObject.toJSON(baseTDxRecordInvoiceDetail); try {
JSONObject vehicleDetail = new JSONObject(); checkInvoiceResult = snPushCheckRecordService.singleCheckInvoice(pramsMap, "1");
if(vehicleList != null && vehicleList.size() > 0) { log.info("查验结果为:{}", checkInvoiceResult);
vehicleDetail = (JSONObject) JSONObject.toJSON(vehicleList.get(0)); } catch (Exception e) {
e.printStackTrace();
log.error("查验失败,errormsg:{}", e.getMessage());
return ResponseEntity.ok(JSONObject.toJSONString(R.error("查验失败," + e.getMessage())));
} }
convertToResult(checkInvoice, checkInvoiceDetail, vehicleDetail); if (!checkInvoiceResult.containsKey("code")) {
data.put("data", checkInvoice); if (checkInvoiceResult.containsKey("cyjg") && !"0001".equals(checkInvoiceResult.getString("cyjg"))) {
//查验结果保存 R data = new R();
//saveCheckLog(pramsMap, checkInvoice); data = errorInfo(checkInvoiceResult, data);
return ResponseEntity.ok(JSONObject.toJSONString(data));
}
return ResponseEntity.ok(JSONObject.toJSONString(data));
} else {
TdxSaleRecordInvoice tdxSaleRecordInvoice = snPushCheckRecordService.selectSaleByUuid(uuid);
log.info("tdxSaleRecordInvoice={}", tdxSaleRecordInvoice);
if (tdxSaleRecordInvoice != null) {
log.info("销项票池已存在发票.直接返回票池信息");
R data = new R(1000, "default success"); R data = new R(1000, "default success");
data.put("message", "success");
String invoiceNo = tdxSaleRecordInvoice.getInvoiceNo(); if (!checkInvoiceResult.containsKey("cyjg")) {
QueryWrapper<RecordInvoiceSaleDetailModel> saleDetailWrapper = new QueryWrapper<>(); checkInvoiceResult.put("invoiceNo", checkInvoiceResult.getString("invoiceNumber"));
saleDetailWrapper.eq("invoice_no", invoiceNo); log.info("返回给影像系统的结果为:{}", checkInvoiceResult);
List<RecordInvoiceSaleDetailModel> recordInvoiceSaleDetailModel = snPushCheckRecordService.selectSaleListByWrapper(saleDetailWrapper); signSaveInvoiceInfoService.saveQueryInvoiceResult(checkInvoiceResult, "", "1", dbName);
}
JSONObject checkInvoice = (JSONObject) JSONObject.toJSON(tdxSaleRecordInvoice);
JSONArray saleDetail = (JSONArray) JSONObject.toJSON(recordInvoiceSaleDetailModel);
convertToResult(checkInvoice, saleDetail);
data.put("data", checkInvoice); Object o = checkInvoiceResult.get("invoiceLineList");
//查验结果保存 JSONArray jsonArray = JSONObject.parseArray(JSONObject.toJSONString(o));
// saveCheckLog(pramsMap,checkInvoice); for (Object object : jsonArray) {
Map map = JSONObject.parseObject(JSONObject.toJSONString(object), Map.class);
String taxRate = (String) map.get("taxRate");
if ("0".equals(taxRate) || "*".equals(taxRate) || "**".equals(taxRate) || "***".equals(taxRate) || "不征税".equals(taxRate) || "免税".equals(taxRate)) {
map.put("taxRate", "0.00");
}
}
data.put("data", checkInvoiceResult);
return ResponseEntity.ok(JSONObject.toJSONString(data)); return ResponseEntity.ok(JSONObject.toJSONString(data));
} }
} } else {
} //其他类发票,直接入库
R data = new R(1000, "default success");
if (checkInvoiceResult != null && !checkInvoiceResult.isEmpty()) {
log.info("其他类发票,不做查验,直接入库");
data.put("message", "success");
try { checkInvoiceResult.put("invoiceNo", checkInvoiceResult.getString("invoiceNumber"));
checkInvoiceResult = snPushCheckRecordService.singleCheckInvoice(pramsMap, "1"); checkInvoiceResult.put("message", "入库成功");
log.info("查验结果为:{}", checkInvoiceResult); log.info("返回给影像系统的结果为:{}", checkInvoiceResult);
} catch (Exception e) {
e.printStackTrace();
log.error("查验失败,errormsg:{}", e.getMessage());
return ResponseEntity.ok(JSONObject.toJSONString(R.error("查验失败," + e.getMessage())));
}
if (!checkInvoiceResult.containsKey("code")) { data.put("data", checkInvoiceResult);
} else {
data.put("message", "error 其他类发票不支持查验");
}
if (checkInvoiceResult.containsKey("cyjg") && !"0001".equals(checkInvoiceResult.getString("cyjg"))) {
R data = new R();
data = errorInfo(checkInvoiceResult, data);
return ResponseEntity.ok(JSONObject.toJSONString(data)); return ResponseEntity.ok(JSONObject.toJSONString(data));
} }
R data = new R(1000, "default success"); return ResponseEntity.ok(JSONObject.toJSONString(R.error().put("data", checkInvoiceResult)));
data.put("message", "success");
if (!checkInvoiceResult.containsKey("cyjg")) {
checkInvoiceResult.put("invoiceNo", checkInvoiceResult.getString("invoiceNumber"));
log.info("返回给影像系统的结果为:{}", checkInvoiceResult);
signSaveInvoiceInfoService.saveQueryInvoiceResult(checkInvoiceResult, "", "1", dbName);
}
Object o = checkInvoiceResult.get("invoiceLineList");
JSONArray jsonArray = JSONObject.parseArray(JSONObject.toJSONString(o));
for (Object object : jsonArray) {
Map map = JSONObject.parseObject(JSONObject.toJSONString(object), Map.class);
String taxRate = (String) map.get("taxRate");
if ("0".equals(taxRate) || "*".equals(taxRate) || "**".equals(taxRate) || "***".equals(taxRate) || "不征税".equals(taxRate) || "免税".equals(taxRate)) {
map.put("taxRate", "0.00");
}
}
data.put("data", checkInvoiceResult);
return ResponseEntity.ok(JSONObject.toJSONString(data));
} }
} else { }catch (Exception e) {
//其他类发票,直接入库 e.printStackTrace();
R data = new R(1000, "default success"); return ResponseEntity.ok(JSONObject.toJSONString(R.error().put("data", "")));
if (checkInvoiceResult != null && !checkInvoiceResult.isEmpty()) {
log.info("其他类发票,不做查验,直接入库");
data.put("message", "success");
checkInvoiceResult.put("invoiceNo", checkInvoiceResult.getString("invoiceNumber"));
checkInvoiceResult.put("message", "入库成功");
log.info("返回给影像系统的结果为:{}", checkInvoiceResult);
data.put("data", checkInvoiceResult);
} else {
data.put("message", "error 其他类发票不支持查验");
}
return ResponseEntity.ok(JSONObject.toJSONString(data));
} }
finally {
return ResponseEntity.ok(JSONObject.toJSONString(R.error().put("data", checkInvoiceResult))); //关锁
lock.unlock();
}
return ResponseEntity.ok(JSONObject.toJSONString(R.error().put("data", "请求正在处理,不要重复提交")));
} }
@Async @Async

Loading…
Cancel
Save