|
|
|
@ -1,13 +1,23 @@ |
|
|
|
|
package com.dxhy.core.job.controller; |
|
|
|
|
|
|
|
|
|
import java.math.BigDecimal; |
|
|
|
|
import java.text.DateFormat; |
|
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
|
import java.util.Date; |
|
|
|
|
import java.util.List; |
|
|
|
|
import java.util.Map; |
|
|
|
|
import java.util.concurrent.LinkedBlockingQueue; |
|
|
|
|
import java.util.concurrent.ThreadPoolExecutor; |
|
|
|
|
import java.util.concurrent.TimeUnit; |
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
|
|
|
|
|
|
import com.alibaba.cloud.commons.lang.StringUtils; |
|
|
|
|
import com.dxhy.core.job.pojo.CheckNoDetailInvoice; |
|
|
|
|
import com.dxhy.core.job.service.CheckTaskService; |
|
|
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
|
|
import org.springframework.web.bind.annotation.PostMapping; |
|
|
|
|
import org.springframework.web.bind.annotation.RequestBody; |
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping; |
|
|
|
|
import org.springframework.web.bind.annotation.RestController; |
|
|
|
|
|
|
|
|
@ -31,6 +41,8 @@ public class InvoiceInterfaceController extends AbstractController { |
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
private InvoiceInterfaceService invoiceInterfaceService; |
|
|
|
|
@Resource |
|
|
|
|
private CheckTaskService checkTaskService; |
|
|
|
|
|
|
|
|
|
@Value("${jxjk.threadNum}") |
|
|
|
|
private Integer threadNum; |
|
|
|
@ -61,4 +73,39 @@ public class InvoiceInterfaceController extends AbstractController { |
|
|
|
|
threadPoolExecutor.awaitTermination(60, TimeUnit.SECONDS); |
|
|
|
|
log.info("全票面底账采集任务结束-"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@PostMapping("/checkone") |
|
|
|
|
public void checkone(@RequestBody Map<String, String> params) { |
|
|
|
|
try { |
|
|
|
|
String invoiceCode = params.get("invoiceCode"); |
|
|
|
|
String billingDate = params.get("billingDate"); |
|
|
|
|
String totalAmount = params.get("totalAmount"); |
|
|
|
|
String invoiceNumber = params.get("invoiceNumber"); |
|
|
|
|
String invoiceType = params.get("invoiceType"); |
|
|
|
|
String checkCode = params.get("checkCode"); |
|
|
|
|
String purchaserTaxNo = params.get("purchaserTaxNo"); |
|
|
|
|
|
|
|
|
|
CheckNoDetailInvoice invoice = new CheckNoDetailInvoice(); |
|
|
|
|
invoice.setInvoiceCode(invoiceCode); |
|
|
|
|
invoice.setInvoiceNo(invoiceNumber); |
|
|
|
|
|
|
|
|
|
DateFormat fmt =new SimpleDateFormat("yyyy-MM-dd"); |
|
|
|
|
Date date = fmt.parse(billingDate); |
|
|
|
|
invoice.setInvoiceDate(date); |
|
|
|
|
if(StringUtils.isNotEmpty(totalAmount)) { |
|
|
|
|
if("31".equals(invoiceType)) { |
|
|
|
|
invoice.setTotalAmount(new BigDecimal(totalAmount)); |
|
|
|
|
}else{ |
|
|
|
|
invoice.setInvoiceAmount(new BigDecimal(totalAmount)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
invoice.setInvoiceType(invoiceType); |
|
|
|
|
invoice.setCheckCode(checkCode); |
|
|
|
|
invoice.setBuyerTaxNo(purchaserTaxNo); |
|
|
|
|
|
|
|
|
|
checkTaskService.checkOne(invoice, ""); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
log.error("调用开放平台OCR接口失败,", e); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|