|
|
@ -3,21 +3,26 @@ package com.dxhy.erp.service; |
|
|
|
import cn.hutool.core.date.DatePattern; |
|
|
|
import cn.hutool.core.date.DatePattern; |
|
|
|
import cn.hutool.core.date.DateUtil; |
|
|
|
import cn.hutool.core.date.DateUtil; |
|
|
|
import cn.hutool.http.HttpUtil; |
|
|
|
import cn.hutool.http.HttpUtil; |
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.dxhy.common.constant.DbConstant; |
|
|
|
import com.dxhy.common.constant.DbConstant; |
|
|
|
import com.dxhy.common.datasource.config.DynamicContextHolder; |
|
|
|
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.OrgUserInfoDao; |
|
|
|
import com.dxhy.erp.dao.OrgUserInfoDao; |
|
|
|
|
|
|
|
import com.dxhy.erp.entity.BaseTDxRecordInvoice; |
|
|
|
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.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.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; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
@ -85,6 +90,45 @@ public class SNPushCheckRecordService extends AbstractServiceAdapter { |
|
|
|
return post; |
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ""; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public JSONObject checkInvoice(Map<String, String> pramsMap, UserInfo userInfo) { |
|
|
|
public JSONObject checkInvoice(Map<String, String> pramsMap, UserInfo userInfo) { |
|
|
|
|
|
|
|
|
|
|
@ -158,11 +202,12 @@ public class SNPushCheckRecordService extends AbstractServiceAdapter { |
|
|
|
|
|
|
|
|
|
|
|
private JSONObject convertToSnObject(String content, JSONObject jsonObject, String invoiceType) { |
|
|
|
private JSONObject convertToSnObject(String content, JSONObject jsonObject, String invoiceType) { |
|
|
|
|
|
|
|
|
|
|
|
HashMap contentMap = JSONObject.parseObject(Base64.decode(content).toString(), HashMap.class); |
|
|
|
String con = new String(Base64.decode(content)); |
|
|
|
|
|
|
|
HashMap contentMap = JSONObject.parseObject(con, HashMap.class); |
|
|
|
|
|
|
|
|
|
|
|
if ("0000".equals(contentMap.get("code"))) { |
|
|
|
if ("0000".equals(contentMap.get("code"))) { |
|
|
|
|
|
|
|
|
|
|
|
HashMap<String, String> invoiceData = (HashMap<String, String>) contentMap.get("data"); |
|
|
|
HashMap<String, Object> invoiceData = JSONObject.parseObject(contentMap.get("data").toString(), HashMap.class); |
|
|
|
|
|
|
|
|
|
|
|
jsonObject.put("invoiceType", invoiceType); |
|
|
|
jsonObject.put("invoiceType", invoiceType); |
|
|
|
jsonObject.put("administrativeDivisionNo", ""); |
|
|
|
jsonObject.put("administrativeDivisionNo", ""); |
|
|
@ -212,26 +257,24 @@ public class SNPushCheckRecordService extends AbstractServiceAdapter { |
|
|
|
jsonObject.put("idcardNo", invoiceData.get("sfzh")); |
|
|
|
jsonObject.put("idcardNo", invoiceData.get("sfzh")); |
|
|
|
|
|
|
|
|
|
|
|
List<Map<String, String>> returnDetailList = new ArrayList<>(); |
|
|
|
List<Map<String, String>> returnDetailList = new ArrayList<>(); |
|
|
|
String detailListStr = invoiceData.get("detailList"); |
|
|
|
JSONArray detailList = (JSONArray) invoiceData.get("detailList"); |
|
|
|
List<Map<String, String>> detailList = JSONObject.parseObject(detailListStr, List.class); |
|
|
|
for (int i = 0;i<detailList.size();i++) { |
|
|
|
int i = 1; |
|
|
|
JSONObject detail = (JSONObject) detailList.get(i); |
|
|
|
for (Map<String, String> detail : detailList) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, String> snDetailMap = new HashMap<String, String>(); |
|
|
|
Map<String, String> snDetailMap = new HashMap<String, String>(); |
|
|
|
snDetailMap.put("rowNo", i + ""); |
|
|
|
snDetailMap.put("rowNo", i + ""); |
|
|
|
snDetailMap.put("commodityCode", detail.get("mxbh")); |
|
|
|
snDetailMap.put("commodityCode", detail.getString("mxbh")); |
|
|
|
snDetailMap.put("commodityName", detail.get("hwmc")); |
|
|
|
snDetailMap.put("commodityName", detail.getString("hwmc")); |
|
|
|
snDetailMap.put("specificationModel", detail.get("ggxh")); |
|
|
|
snDetailMap.put("specificationModel", detail.getString("ggxh")); |
|
|
|
snDetailMap.put("unit", detail.get("jldw")); |
|
|
|
snDetailMap.put("unit", detail.getString("jldw")); |
|
|
|
snDetailMap.put("quantity", detail.get("spsl")); |
|
|
|
snDetailMap.put("quantity", detail.getString("spsl")); |
|
|
|
snDetailMap.put("unitPrice", detail.get("hsdj")); |
|
|
|
snDetailMap.put("unitPrice", detail.getString("hsdj")); |
|
|
|
snDetailMap.put("amount", detail.get("je")); |
|
|
|
snDetailMap.put("amount", detail.getString("je")); |
|
|
|
snDetailMap.put("taxRate", detail.get("sl")); |
|
|
|
snDetailMap.put("taxRate", detail.getString("sl")); |
|
|
|
snDetailMap.put("tax", detail.get("se")); |
|
|
|
snDetailMap.put("tax", detail.getString("se")); |
|
|
|
snDetailMap.put("currentDateEnd", detail.get("txrqz")); |
|
|
|
snDetailMap.put("currentDateEnd", detail.getString("txrqz")); |
|
|
|
snDetailMap.put("currentDateStart", detail.get("txrqq")); |
|
|
|
snDetailMap.put("currentDateStart", detail.getString("txrqq")); |
|
|
|
snDetailMap.put("licensePlateNum", detail.get("cph")); |
|
|
|
snDetailMap.put("licensePlateNum", detail.getString("cph")); |
|
|
|
snDetailMap.put("type", detail.get("lx")); |
|
|
|
snDetailMap.put("type", detail.getString("lx")); |
|
|
|
|
|
|
|
|
|
|
|
returnDetailList.add(snDetailMap); |
|
|
|
returnDetailList.add(snDetailMap); |
|
|
|
i++; |
|
|
|
i++; |
|
|
|