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()); String notes = invoiceQueryService.checkingInvoiceInfo("business", uuid, getUserInfo());
if (notes != null) { if (notes != null) {
return ResponseEntity.ok(R.error(notes)); return ResponseEntity.ok(R.error(notes));
@ -113,15 +113,15 @@ public class SDNYMainProcessController extends AbstractController {
|| SNFplxEnum.QDPP.getSnFplxDm().equals(pramsMap.get("invoiceType")) || SNFplxEnum.QDPP.getSnFplxDm().equals(pramsMap.get("invoiceType"))
) { ) {
pramsMap.put("invoiceType",fplxdm); pramsMap.put("invoiceType", fplxdm);
//查验发票数据 //查验发票数据
checkInvoiceResult = snPushCheckRecordService.singleCheckInvoice(pramsMap); checkInvoiceResult = snPushCheckRecordService.singleCheckInvoice(pramsMap);
if(!checkInvoiceResult.containsKey("code")){ if (!checkInvoiceResult.containsKey("code")) {
return ResponseEntity.ok(R.ok().put("data", checkInvoiceResult)); return ResponseEntity.ok(R.ok().put("data", checkInvoiceResult));
} }
}else{ } else {
//价税分离 //价税分离
// snPushCheckRecordService.valoremTaxCount(); // snPushCheckRecordService.valoremTaxCount();
} }
@ -142,37 +142,44 @@ public class SDNYMainProcessController extends AbstractController {
List<String> gfshAll = UserInfoUtil.getGfshAll(getUserInfo().getOrg()); List<String> gfshAll = UserInfoUtil.getGfshAll(getUserInfo().getOrg());
String gfsh = "";
//String notes = invoiceQueryService.checkingInvoiceInfo(dbName, uuid, getUserInfo()); if (gfshAll.size() > 0) {
gfsh = gfshAll.get(0);
}
//入票池 //入票池
try {
snPushCheckRecordService.pushInvoiceToRecordInvoice(snRequestObject, gfsh, company);
//推送到SAP
List<SNInvoice> invoiceInfoList = snRequestObject.getInvoiceInfoList();
//推送到SAP String imageId = snRequestObject.getImageId();
List<SNInvoice> invoiceInfoList = snRequestObject.getInvoiceInfoList();
String imageId = snRequestObject.getImageId();
for(SNInvoice invoice : invoiceInfoList) { for (SNInvoice invoice : invoiceInfoList) {
SNSAPObject object = convertToSapOnject(invoice,imageId); SNSAPObject object = convertToSapOnject(invoice, imageId);
JSONObject sapObj = (JSONObject) JSONObject.toJSON(object); JSONObject sapObj = (JSONObject) JSONObject.toJSON(object);
String result = ""; String result = "";
try { try {
//将信息推送到影像系统 //将信息推送到影像系统
result = snPushCheckRecordService.pushCheckResultToSAP(sapObj); result = snPushCheckRecordService.pushCheckResultToSAP(sapObj);
return ResponseEntity.ok(R.ok().put("data", result)); return ResponseEntity.ok(R.ok().put("data", result));
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
log.error("", e); log.error("", e);
return ResponseEntity.ok(R.error(CommonConstants.MSG_ERR_DEFAULT)); 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)); 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(); Date date = new Date();
@ -226,7 +233,7 @@ public class SDNYMainProcessController extends AbstractController {
info.setZBZ(snInvoice.getRemarks()); info.setZBZ(snInvoice.getRemarks());
List<SNInvoiceDetail> invoiceLineList = snInvoice.getInvoiceLineList(); List<SNInvoiceDetail> invoiceLineList = snInvoice.getInvoiceLineList();
List<SAPInvoiceDetail> sapInvoiceDetailList = new ArrayList<>(); List<SAPInvoiceDetail> sapInvoiceDetailList = new ArrayList<>();
if(invoiceLineList != null && invoiceLineList.size() > 0){ if (invoiceLineList != null && invoiceLineList.size() > 0) {
SNInvoiceDetail snInvoiceDetail = invoiceLineList.get(0); SNInvoiceDetail snInvoiceDetail = invoiceLineList.get(0);
String taxRate = snInvoiceDetail.getTaxRate(); String taxRate = snInvoiceDetail.getTaxRate();
info.setZSM(taxRate); 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.util.InvoiceUtil;
import com.dxhy.common.vo.UserInfo; import com.dxhy.common.vo.UserInfo;
import com.dxhy.erp.dao.AreaDao; 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.dao.OrgUserInfoDao;
import com.dxhy.erp.entity.BaseTDxRecordInvoice; 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.ApiCheckInvoiceSingleRequest;
import com.dxhy.erp.entity.kfpt.ApiRequest; import com.dxhy.erp.entity.kfpt.ApiRequest;
import com.dxhy.erp.entity.kfpt.ApiResponse; import com.dxhy.erp.entity.kfpt.ApiResponse;
import com.dxhy.erp.entity.kfpt.TokenResponse; import com.dxhy.erp.entity.kfpt.TokenResponse;
import com.dxhy.erp.entity.sdny.InvoiceDetail; import com.dxhy.erp.entity.sdny.InvoiceDetail;
import com.dxhy.erp.entity.sdny.InvoiceInfo; 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.SNRequestObject;
import com.dxhy.erp.entity.sdny.area.Area; import com.dxhy.erp.entity.sdny.area.Area;
import com.dxhy.erp.utils.*; import com.dxhy.erp.utils.*;
import com.dxhy.erp.utils.Base64;
import com.google.gson.JsonArray; import com.google.gson.JsonArray;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@ -32,10 +37,8 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.text.ParseException; import java.text.ParseException;
import java.util.ArrayList; import java.text.SimpleDateFormat;
import java.util.HashMap; import java.util.*;
import java.util.List;
import java.util.Map;
/** /**
* 与山东能源交互数据主类 * 与山东能源交互数据主类
@ -78,6 +81,12 @@ public class SNPushCheckRecordService extends AbstractServiceAdapter {
@Autowired @Autowired
private OrgUserInfoDao orgUserInfoDao; private OrgUserInfoDao orgUserInfoDao;
@Resource
private BaseTDxTaxCurrentDao baseTDxTaxCurrentDao;
@Resource
private BaseTDxRecordInvoiceDao baseTDxRecordInvoiceDao;
public String pushCheckResultToSAP(JSONObject result) throws Exception { public String pushCheckResultToSAP(JSONObject result) throws Exception {
result.put("systemSign", ""); result.put("systemSign", "");
result.put("roleIds", ""); result.put("roleIds", "");
@ -90,41 +99,55 @@ public class SNPushCheckRecordService extends AbstractServiceAdapter {
return post; return post;
} }
public String pushInvoiceToRecordInvoice(SNRequestObject snRequestObject) throws Exception { public String pushInvoiceToRecordInvoice(SNRequestObject snRequestObject,String taxNo,String company) throws Exception {
QueryWrapper<BaseTDxTaxCurrent> currentWrapper = new QueryWrapper<>();
currentWrapper.eq("taxno", taxNo);
// QueryWrapper<BaseTDxTaxCurrent> currentWrapper = new QueryWrapper<>(); DynamicContextHolder.push("business" + DbConstant.BUSINESS_READ);
// currentWrapper.eq("taxno", gfsbh); BaseTDxTaxCurrent current = baseTDxTaxCurrentDao.selectOne(currentWrapper);
// DynamicContextHolder.push("business" + DbConstant.BUSINESS_READ);
// BaseTDxTaxCurrent current = baseTDxTaxCurrentDao.selectOne(currentWrapper); List<SNInvoice> invoiceInfoList = snRequestObject.getInvoiceInfoList();
//
// if(invoiceInfoList != null && invoiceInfoList.size() > 0) {
// BaseTDxRecordInvoice recordInvoice = new BaseTDxRecordInvoice();
// recordInvoice.setUuid(fpdm + fphm); for(SNInvoice snInvoice : invoiceInfoList) {
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
// try { String fpdm = snInvoice.getInvoiceCode();
// recordInvoice.setInvoiceDate(sdf.parse(kprq)); String fphm = snInvoice.getInvoiceNumber();
// } catch (ParseException e) { String kprq = snInvoice.getBillingDate();
// e.printStackTrace(); String je = snInvoice.getTotalAmount();
// } String xfsh = snInvoice.getSalesTaxNo();
// recordInvoice.setInvoiceCode(fpdm); String se = snInvoice.getAmountTax();
// recordInvoice.setInvoiceNo(fphm); String gfsbh = snInvoice.getPurchaserTaxNo();
// recordInvoice.setInvoiceAmount(new BigDecimal(je)); String gfmc = snInvoice.getPurchaserName();
// recordInvoice.setTaxAmount(new BigDecimal(se)); String invoiceType = snInvoice.getInvoiceType();
// recordInvoice.setXfTaxNo(xfsh);
// recordInvoice.setGfTaxNo(gfsbh); BaseTDxRecordInvoice recordInvoice = new BaseTDxRecordInvoice();
// recordInvoice.setGfName(gfmc); recordInvoice.setUuid(fpdm + fphm);
// recordInvoice.setRzlx("5"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
// recordInvoice.setYqsqStatus("1"); try {
// recordInvoice.setYqCurrentPeriod(current.getCurrentTaxPeriod()); recordInvoice.setInvoiceDate(sdf.parse(kprq));
// recordInvoice.setCreateDate(new Date()); } catch (ParseException e) {
// recordInvoice.setYqsqDate(new Date()); e.printStackTrace();
// recordInvoice.setSourceSystem("2"); }
// recordInvoice.setInvoiceStatus("0"); recordInvoice.setInvoiceCode(fpdm);
// recordInvoice.setInvoiceType(invoiceType); recordInvoice.setInvoiceNo(fphm);
// recordInvoice.setCompany((String)pramsMap.get("company")); recordInvoice.setInvoiceAmount(new BigDecimal(je));
// baseTDxRecordInvoiceDao.insert(recordInvoice); 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 ""; return "";
} }

Loading…
Cancel
Save