ariesy 对接开放平台查验-调用开放平台成功 v4

release
yefei 2 years ago
parent e4f93c399d
commit fa8a8b02d4
  1. 55
      dxhy-erp/src/main/java/com/dxhy/erp/controller/SDNYMainProcessController.java
  2. 20
      dxhy-erp/src/main/java/com/dxhy/erp/dao/BaseTDxTaxCurrentDao.java
  3. 106
      dxhy-erp/src/main/java/com/dxhy/erp/entity/BaseTDxTaxCurrent.java
  4. 101
      dxhy-erp/src/main/java/com/dxhy/erp/service/SNPushCheckRecordService.java

@ -95,7 +95,7 @@ public class SDNYMainProcessController extends AbstractController {
}
}
String uuid = (StringUtils.isBlank(pramsMap.get("invoiceCode"))?"":pramsMap.get("invoiceCode"))+ pramsMap.get("invoiceNo");
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));
@ -113,15 +113,15 @@ public class SDNYMainProcessController extends AbstractController {
|| SNFplxEnum.QDPP.getSnFplxDm().equals(pramsMap.get("invoiceType"))
) {
pramsMap.put("invoiceType",fplxdm);
pramsMap.put("invoiceType", fplxdm);
//查验发票数据
checkInvoiceResult = snPushCheckRecordService.singleCheckInvoice(pramsMap);
if(!checkInvoiceResult.containsKey("code")){
if (!checkInvoiceResult.containsKey("code")) {
return ResponseEntity.ok(R.ok().put("data", checkInvoiceResult));
}
}else{
} else {
//价税分离
// snPushCheckRecordService.valoremTaxCount();
}
@ -142,37 +142,44 @@ public class SDNYMainProcessController extends AbstractController {
List<String> gfshAll = UserInfoUtil.getGfshAll(getUserInfo().getOrg());
//String notes = invoiceQueryService.checkingInvoiceInfo(dbName, uuid, getUserInfo());
String gfsh = "";
if (gfshAll.size() > 0) {
gfsh = gfshAll.get(0);
}
//入票池
try {
snPushCheckRecordService.pushInvoiceToRecordInvoice(snRequestObject, gfsh, company);
//推送到SAP
List<SNInvoice> invoiceInfoList = snRequestObject.getInvoiceInfoList();
//推送到SAP
List<SNInvoice> invoiceInfoList = snRequestObject.getInvoiceInfoList();
String imageId = snRequestObject.getImageId();
String imageId = snRequestObject.getImageId();
for(SNInvoice invoice : invoiceInfoList) {
SNSAPObject object = convertToSapOnject(invoice,imageId);
JSONObject sapObj = (JSONObject) JSONObject.toJSON(object);
for (SNInvoice invoice : invoiceInfoList) {
SNSAPObject object = convertToSapOnject(invoice, imageId);
JSONObject sapObj = (JSONObject) JSONObject.toJSON(object);
String result = "";
try {
//将信息推送到影像系统
result = snPushCheckRecordService.pushCheckResultToSAP(sapObj);
String result = "";
try {
//将信息推送到影像系统
result = snPushCheckRecordService.pushCheckResultToSAP(sapObj);
return ResponseEntity.ok(R.ok().put("data", result));
} catch (Exception e) {
e.printStackTrace();
log.error("", e);
return ResponseEntity.ok(R.error(CommonConstants.MSG_ERR_DEFAULT));
return ResponseEntity.ok(R.ok().put("data", result));
} catch (Exception e) {
e.printStackTrace();
log.error("", e);
return ResponseEntity.ok(R.error(CommonConstants.MSG_ERR_DEFAULT));
}
}
return ResponseEntity.ok(R.error(CommonConstants.MSG_ERR_DEFAULT));
} catch (Exception e) {
e.printStackTrace();
}
return ResponseEntity.ok(R.error(CommonConstants.MSG_ERR_DEFAULT));
}
private SNSAPObject convertToSapOnject(SNInvoice snInvoice,String imageId) {
private SNSAPObject convertToSapOnject(SNInvoice snInvoice, String imageId) {
Date date = new Date();
@ -226,7 +233,7 @@ public class SDNYMainProcessController extends AbstractController {
info.setZBZ(snInvoice.getRemarks());
List<SNInvoiceDetail> invoiceLineList = snInvoice.getInvoiceLineList();
List<SAPInvoiceDetail> sapInvoiceDetailList = new ArrayList<>();
if(invoiceLineList != null && invoiceLineList.size() > 0){
if (invoiceLineList != null && invoiceLineList.size() > 0) {
SNInvoiceDetail snInvoiceDetail = invoiceLineList.get(0);
String taxRate = snInvoiceDetail.getTaxRate();
info.setZSM(taxRate);

@ -0,0 +1,20 @@
package com.dxhy.erp.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dxhy.erp.entity.BaseTDxTaxCurrent;
import org.apache.ibatis.annotations.Mapper;
/**
*
*
* 企业税务信息表dao
*
*
* @author peipei.li
* @date 2019-04-23
*/
@SuppressWarnings("AlibabaClassNamingShouldBeCamel")
@Mapper
public interface BaseTDxTaxCurrentDao extends BaseMapper<BaseTDxTaxCurrent> {
}

@ -0,0 +1,106 @@
package com.dxhy.erp.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
*
*
* 企业税务信息表
*
* @author peipei.li
* @date 2019-04-23
*/
@SuppressWarnings("AlibabaClassNamingShouldBeCamel")
@Data
@TableName("t_dx_tax_current")
public class BaseTDxTaxCurrent implements Serializable {
private static final long serialVersionUID = -6721685467254429845L;
/**
* id
*/
private Long id;
/**
* 税号
*/
private String taxno;
/**
* 企业名称
*/
private String taxname;
/**
* 当前税款所属期
*/
private String currentTaxPeriod;
/**
* 当前税款所属期可勾选发票的起始开票日期
*/
private String selectStartDate;
/**
* 当前税款所属期可勾选发票的截止开票日期
*/
private String selectEndDate;
/**
* 当前税款所属期可勾选发票操作截止日期
*/
private String operationEndDate;
/**
* 企业旧税号
*/
private String oldTaxNo;
/**
* 申报周期值为3-季度/1-
*/
private String declarePeriod;
/**
* 信用等级值为a/b/c/d或者空
*/
private String creditRating;
/**
* update_time
*/
private Date updateTime;
/**
* create_time
*/
private Date createTime;
/**
* 锁定状态0否1是
*/
private String latchStatus;
/**
* 抵扣限额
*/
private BigDecimal limitDkse;
private String bussiPwd;
private String newBussiPwd;
private String companyType;
private String oilType;
private String taxpayerType;
private String syncTime;
private String indexInfo;
private String periodIndexInfo;
private String monthIndexInfo;
}

@ -11,17 +11,22 @@ import com.dxhy.common.datasource.config.DynamicContextHolder;
import com.dxhy.common.util.InvoiceUtil;
import com.dxhy.common.vo.UserInfo;
import com.dxhy.erp.dao.AreaDao;
import com.dxhy.erp.dao.BaseTDxRecordInvoiceDao;
import com.dxhy.erp.dao.BaseTDxTaxCurrentDao;
import com.dxhy.erp.dao.OrgUserInfoDao;
import com.dxhy.erp.entity.BaseTDxRecordInvoice;
import com.dxhy.erp.entity.BaseTDxTaxCurrent;
import com.dxhy.erp.entity.kfpt.ApiCheckInvoiceSingleRequest;
import com.dxhy.erp.entity.kfpt.ApiRequest;
import com.dxhy.erp.entity.kfpt.ApiResponse;
import com.dxhy.erp.entity.kfpt.TokenResponse;
import com.dxhy.erp.entity.sdny.InvoiceDetail;
import com.dxhy.erp.entity.sdny.InvoiceInfo;
import com.dxhy.erp.entity.sdny.SNInvoice;
import com.dxhy.erp.entity.sdny.SNRequestObject;
import com.dxhy.erp.entity.sdny.area.Area;
import com.dxhy.erp.utils.*;
import com.dxhy.erp.utils.Base64;
import com.google.gson.JsonArray;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
@ -32,10 +37,8 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.text.SimpleDateFormat;
import java.util.*;
/**
* 与山东能源交互数据主类
@ -78,6 +81,12 @@ public class SNPushCheckRecordService extends AbstractServiceAdapter {
@Autowired
private OrgUserInfoDao orgUserInfoDao;
@Resource
private BaseTDxTaxCurrentDao baseTDxTaxCurrentDao;
@Resource
private BaseTDxRecordInvoiceDao baseTDxRecordInvoiceDao;
public String pushCheckResultToSAP(JSONObject result) throws Exception {
result.put("systemSign", "");
result.put("roleIds", "");
@ -90,41 +99,55 @@ public class SNPushCheckRecordService extends AbstractServiceAdapter {
return post;
}
public String pushInvoiceToRecordInvoice(SNRequestObject snRequestObject) throws Exception {
// QueryWrapper<BaseTDxTaxCurrent> currentWrapper = new QueryWrapper<>();
// currentWrapper.eq("taxno", gfsbh);
// DynamicContextHolder.push("business" + DbConstant.BUSINESS_READ);
// BaseTDxTaxCurrent current = baseTDxTaxCurrentDao.selectOne(currentWrapper);
//
//
// BaseTDxRecordInvoice recordInvoice = new BaseTDxRecordInvoice();
// recordInvoice.setUuid(fpdm + fphm);
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
// try {
// recordInvoice.setInvoiceDate(sdf.parse(kprq));
// } catch (ParseException e) {
// e.printStackTrace();
// }
// recordInvoice.setInvoiceCode(fpdm);
// recordInvoice.setInvoiceNo(fphm);
// recordInvoice.setInvoiceAmount(new BigDecimal(je));
// recordInvoice.setTaxAmount(new BigDecimal(se));
// recordInvoice.setXfTaxNo(xfsh);
// recordInvoice.setGfTaxNo(gfsbh);
// recordInvoice.setGfName(gfmc);
// recordInvoice.setRzlx("5");
// recordInvoice.setYqsqStatus("1");
// recordInvoice.setYqCurrentPeriod(current.getCurrentTaxPeriod());
// recordInvoice.setCreateDate(new Date());
// recordInvoice.setYqsqDate(new Date());
// recordInvoice.setSourceSystem("2");
// recordInvoice.setInvoiceStatus("0");
// recordInvoice.setInvoiceType(invoiceType);
// recordInvoice.setCompany((String)pramsMap.get("company"));
// baseTDxRecordInvoiceDao.insert(recordInvoice);
public String pushInvoiceToRecordInvoice(SNRequestObject snRequestObject,String taxNo,String company) throws Exception {
QueryWrapper<BaseTDxTaxCurrent> currentWrapper = new QueryWrapper<>();
currentWrapper.eq("taxno", taxNo);
DynamicContextHolder.push("business" + DbConstant.BUSINESS_READ);
BaseTDxTaxCurrent current = baseTDxTaxCurrentDao.selectOne(currentWrapper);
List<SNInvoice> invoiceInfoList = snRequestObject.getInvoiceInfoList();
if(invoiceInfoList != null && invoiceInfoList.size() > 0) {
for(SNInvoice snInvoice : invoiceInfoList) {
String fpdm = snInvoice.getInvoiceCode();
String fphm = snInvoice.getInvoiceNumber();
String kprq = snInvoice.getBillingDate();
String je = snInvoice.getTotalAmount();
String xfsh = snInvoice.getSalesTaxNo();
String se = snInvoice.getAmountTax();
String gfsbh = snInvoice.getPurchaserTaxNo();
String gfmc = snInvoice.getPurchaserName();
String invoiceType = snInvoice.getInvoiceType();
BaseTDxRecordInvoice recordInvoice = new BaseTDxRecordInvoice();
recordInvoice.setUuid(fpdm + fphm);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
try {
recordInvoice.setInvoiceDate(sdf.parse(kprq));
} catch (ParseException e) {
e.printStackTrace();
}
recordInvoice.setInvoiceCode(fpdm);
recordInvoice.setInvoiceNo(fphm);
recordInvoice.setInvoiceAmount(new BigDecimal(je));
recordInvoice.setTaxAmount(new BigDecimal(se));
recordInvoice.setXfTaxNo(xfsh);
recordInvoice.setGfTaxNo(gfsbh);
recordInvoice.setGfName(gfmc);
recordInvoice.setRzlx("5");
recordInvoice.setYqsqStatus("1");
recordInvoice.setYqCurrentPeriod(current.getCurrentTaxPeriod());
recordInvoice.setCreateDate(new Date());
recordInvoice.setYqsqDate(new Date());
recordInvoice.setSourceSystem("2");
recordInvoice.setInvoiceStatus("0");
recordInvoice.setInvoiceType(invoiceType);
recordInvoice.setCompany(company);
baseTDxRecordInvoiceDao.insert(recordInvoice);
}
}
return "";
}

Loading…
Cancel
Save