|
|
|
@ -76,7 +76,7 @@ public class SDNYMainProcessController extends AbstractController { |
|
|
|
|
@PostMapping("/sn/singleInvoiceCheck") |
|
|
|
|
@ResponseBody |
|
|
|
|
@SysLog("发票查验") |
|
|
|
|
public ResponseEntity<Map<String,Object>> singleInvoiceCheck(@RequestBody Map<String, String> pramsMap) { |
|
|
|
|
public ResponseEntity<String> singleInvoiceCheck(@RequestBody Map<String, String> pramsMap) { |
|
|
|
|
log.info("传入的参数为:{}",pramsMap); |
|
|
|
|
String userid = "101833"; |
|
|
|
|
String dbName = "business"; |
|
|
|
@ -89,12 +89,12 @@ public class SDNYMainProcessController extends AbstractController { |
|
|
|
|
JSONObject checkInvoiceResult = null; |
|
|
|
|
InvoiceUtil iu = new InvoiceUtil(pramsMap.get("invoiceCode")); |
|
|
|
|
String fplxdm = iu.getFplxdm(); |
|
|
|
|
if(fplxdm != null) { |
|
|
|
|
if(fplxdm != null || "10107".equals(pramsMap.get("invoiceType")) || "10108".equals(pramsMap.get("invoiceType"))) { |
|
|
|
|
//查验类发票,执行查验操作后入库
|
|
|
|
|
log.info("查验类发票,执行查验操作后入库"); |
|
|
|
|
//权限校验
|
|
|
|
|
if (pramsMap.get("invoiceNumber").isEmpty()) { |
|
|
|
|
return ResponseEntity.ok(R.error("发票号码不能为空!")); |
|
|
|
|
return ResponseEntity.ok(JSONObject.toJSONString(R.error("发票号码不能为空!"))); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
pramsMap.put("invoiceNo", pramsMap.get("invoiceNumber")); |
|
|
|
@ -105,11 +105,11 @@ public class SDNYMainProcessController extends AbstractController { |
|
|
|
|
pramsMap.put("invoiceDate", billingDate); |
|
|
|
|
pramsMap.put("billingDate", billingDate); |
|
|
|
|
} else { |
|
|
|
|
return ResponseEntity.ok(R.error("开票日期不能为空!")); |
|
|
|
|
return ResponseEntity.ok(JSONObject.toJSONString(R.error("开票日期不能为空!"))); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (pramsMap.get("invoiceType").isEmpty()) { |
|
|
|
|
return ResponseEntity.ok(R.error("开票日期不能为空!")); |
|
|
|
|
return ResponseEntity.ok(JSONObject.toJSONString(R.error("开票日期不能为空!"))); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (SNFplxEnum.ZP.getSnFplxDm().equals(pramsMap.get("invoiceType")) |
|
|
|
@ -119,11 +119,11 @@ public class SDNYMainProcessController extends AbstractController { |
|
|
|
|
|| SNFplxEnum.QDZP.getSnFplxDm().equals(pramsMap.get("invoiceType")) |
|
|
|
|
|| SNFplxEnum.QDPP.getSnFplxDm().equals(pramsMap.get("invoiceType"))) { |
|
|
|
|
if (pramsMap.get("totalAmount").isEmpty()) { |
|
|
|
|
return ResponseEntity.ok(R.error("金额不能为空!")); |
|
|
|
|
return ResponseEntity.ok(JSONObject.toJSONString(R.error("金额不能为空!"))); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
if (pramsMap.get("checkCode").isEmpty()) { |
|
|
|
|
return ResponseEntity.ok(R.error("校验码不能为空!")); |
|
|
|
|
return ResponseEntity.ok(JSONObject.toJSONString(R.error("校验码不能为空!"))); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -136,7 +136,7 @@ public class SDNYMainProcessController extends AbstractController { |
|
|
|
|
String uuid = (StringUtils.isBlank(pramsMap.get("invoiceCode")) ? "" : pramsMap.get("invoiceCode")) + pramsMap.get("invoiceNo"); |
|
|
|
|
String notes = invoiceQueryService.checkingInvoiceInfo("business", uuid, getUserInfo()); |
|
|
|
|
if (notes != null) { |
|
|
|
|
return ResponseEntity.ok(R.error(notes)); |
|
|
|
|
return ResponseEntity.ok(JSONObject.toJSONString(R.error(notes))); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//查询底账库是否有对应发票,有则直接返回
|
|
|
|
@ -147,7 +147,7 @@ public class SDNYMainProcessController extends AbstractController { |
|
|
|
|
String checkInvoice = JSONObject.toJSONString(checkInvoiceByUuid); |
|
|
|
|
data.put("data", checkInvoice); |
|
|
|
|
|
|
|
|
|
return ResponseEntity.ok(data); |
|
|
|
|
return ResponseEntity.ok(JSONObject.toJSONString(data)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -170,7 +170,7 @@ public class SDNYMainProcessController extends AbstractController { |
|
|
|
|
signSaveInvoiceInfoService.saveQueryInvoiceResult(checkInvoiceResult, userid, "1", dbName); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return ResponseEntity.ok(data); |
|
|
|
|
return ResponseEntity.ok(JSONObject.toJSONString(data)); |
|
|
|
|
} |
|
|
|
|
}else{ |
|
|
|
|
//其他类发票,直接入库
|
|
|
|
@ -189,10 +189,10 @@ public class SDNYMainProcessController extends AbstractController { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
data.put("data", checkInvoiceResult); |
|
|
|
|
return ResponseEntity.ok(data); |
|
|
|
|
return ResponseEntity.ok(JSONObject.toJSONString(data)); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
return ResponseEntity.ok(R.error().put("data", checkInvoiceResult)); |
|
|
|
|
return ResponseEntity.ok(JSONObject.toJSONString(R.error().put("data", checkInvoiceResult))); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -201,7 +201,7 @@ public class SDNYMainProcessController extends AbstractController { |
|
|
|
|
@PostMapping("/sn/syncInvoiceInfo") |
|
|
|
|
@ResponseBody |
|
|
|
|
@SysLog("同步发票信息") |
|
|
|
|
public ResponseEntity<Map<String,Object>> syncInvoiceInfo(@RequestBody SNRequestObject snRequestObject) { |
|
|
|
|
public ResponseEntity<String> syncInvoiceInfo(@RequestBody SNRequestObject snRequestObject) { |
|
|
|
|
|
|
|
|
|
log.info("影像系统同步数据:{}",JSONObject.toJSONString(snRequestObject)); |
|
|
|
|
|
|
|
|
@ -239,7 +239,13 @@ public class SDNYMainProcessController extends AbstractController { |
|
|
|
|
String snFplx = ""; |
|
|
|
|
String invoiceCode = invoice.getInvoiceCode(); |
|
|
|
|
String invoiceNo = invoice.getInvoiceNumber(); |
|
|
|
|
reimburse = snPushCheckRecordService.updateInvoicePoll(snRequestObject, company, taxNo, reimburse, invoice, fplxdm, invoiceCode, invoiceNo); |
|
|
|
|
result = snPushCheckRecordService.updateInvoicePoll(snRequestObject, company, taxNo, reimburse, invoice, fplxdm, invoiceCode, invoiceNo); |
|
|
|
|
|
|
|
|
|
if(!"ok".equals(result) && !"0000".equals(result)){ |
|
|
|
|
R data = new R(1000, "default success"); |
|
|
|
|
data.put("data", result); |
|
|
|
|
return ResponseEntity.ok(JSONObject.toJSONString(data)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//推送到SAP
|
|
|
|
|
SNSAPObject object = convertToSapOnject(invoice, imageId,compCode); |
|
|
|
@ -254,18 +260,18 @@ public class SDNYMainProcessController extends AbstractController { |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
log.error("", e); |
|
|
|
|
return ResponseEntity.ok(R.error(CommonConstants.MSG_ERR_PUSH_SDNY)); |
|
|
|
|
return ResponseEntity.ok(JSONObject.toJSONString(R.error(CommonConstants.MSG_ERR_PUSH_SDNY))); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
R data = new R(1000, "default success"); |
|
|
|
|
data.put("data", result); |
|
|
|
|
return ResponseEntity.ok(data); |
|
|
|
|
return ResponseEntity.ok(JSONObject.toJSONString(data)); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
} |
|
|
|
|
return ResponseEntity.ok(R.error(CommonConstants.MSG_ERR_DEFAULT)); |
|
|
|
|
return ResponseEntity.ok(JSONObject.toJSONString(R.error(CommonConstants.MSG_ERR_DEFAULT))); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -289,16 +295,14 @@ public class SDNYMainProcessController extends AbstractController { |
|
|
|
|
String dataExchangeId = paramMap.get("dataExchangeId"); |
|
|
|
|
|
|
|
|
|
TreeMap<String, String> sortMap = new TreeMap<>(); |
|
|
|
|
sortMap.put(ConfigurerInfo.SECRETID, secretId); |
|
|
|
|
sortMap.put(ConfigurerInfo.DATA_EXCHANGE_ID, dataExchangeId); |
|
|
|
|
sortMap.put(ConfigurerInfo.ENCRYPTCODE, "0"); |
|
|
|
|
sortMap.put(ConfigurerInfo.ZIPCODE, "0"); |
|
|
|
|
sortMap.put(ConfigurerInfo.CONTENT, content); |
|
|
|
|
sortMap.put("SecretId", secretId); |
|
|
|
|
sortMap.put("dataExchangeId", dataExchangeId); |
|
|
|
|
sortMap.put("encryptCode", "0"); |
|
|
|
|
sortMap.put("zipCode", "0"); |
|
|
|
|
sortMap.put("content", content); |
|
|
|
|
|
|
|
|
|
String url = "POST"+ ip +"/invoice/jxpt/api/v5/"+ apiCode +"?"; |
|
|
|
|
|
|
|
|
|
String data = "POST"+ ip +"/invoice/jxpt/api/v5/"+ apiCode +"?SecretId="+ secretId + "&content="+ content +"&dataExchangeId="+ dataExchangeId +"&encryptCode=0&zipCode=0"; |
|
|
|
|
|
|
|
|
|
String signature = HmacSHA1Util.genSign(url, sortMap,secretKey); |
|
|
|
|
return signature; |
|
|
|
|
} |
|
|
|
@ -332,7 +336,7 @@ public class SDNYMainProcessController extends AbstractController { |
|
|
|
|
info.setZJKZM(snInvoice.getImportCertificateNo()); |
|
|
|
|
info.setZDJZH(snInvoice.getCertificateNo()); |
|
|
|
|
info.setZGFMC(snInvoice.getPurchaserName()); |
|
|
|
|
if(snInvoice.getTotalAmount() != null && snInvoice.getTotalAmount() != null) { |
|
|
|
|
if(snInvoice.getTotalAmount() != null && snInvoice.getTotalTax() != null) { |
|
|
|
|
BigDecimal total = new BigDecimal(snInvoice.getTotalAmount()); |
|
|
|
|
BigDecimal tax = new BigDecimal(snInvoice.getTotalTax()); |
|
|
|
|
BigDecimal subtract = total.subtract(tax); |
|
|
|
@ -384,7 +388,11 @@ public class SDNYMainProcessController extends AbstractController { |
|
|
|
|
sapInvoiceDetail.setZSL(snInvoiceDetail.getQuantity()); |
|
|
|
|
sapInvoiceDetail.setZSM(info.getZSM()); |
|
|
|
|
sapInvoiceDetail.setZGGXH(snInvoiceDetail.getSpecificationModel()); |
|
|
|
|
if(snInvoice.getInvoiceCode() != null) { |
|
|
|
|
sapInvoiceDetail.setZTID(snInvoice.getInvoiceCode() + snInvoice.getInvoiceNumber()); |
|
|
|
|
}else{ |
|
|
|
|
sapInvoiceDetail.setZTID(snInvoice.getInvoiceNumber()); |
|
|
|
|
} |
|
|
|
|
sapInvoiceDetailList.add(sapInvoiceDetail); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|