nc推送改造(进行中);
This commit is contained in:
+2
@@ -44,4 +44,6 @@ public interface BillManageMapper extends BaseMapper<BillManage>
|
|||||||
String getDeptName(@Param("dictCode") String dictCode);
|
String getDeptName(@Param("dictCode") String dictCode);
|
||||||
|
|
||||||
String getOrgCodeNc(@Param("organizationId") Long organizationId);
|
String getOrgCodeNc(@Param("organizationId") Long organizationId);
|
||||||
|
|
||||||
|
Long getShipperId(@Param("userId") Long userId, @Param("organizationId") Long organizationId);
|
||||||
}
|
}
|
||||||
+682
-81
@@ -9,7 +9,9 @@ import com.fasterxml.jackson.core.JsonProcessingException;
|
|||||||
import com.fasterxml.jackson.core.type.TypeReference;
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
import com.fasterxml.jackson.databind.JsonMappingException;
|
import com.fasterxml.jackson.databind.JsonMappingException;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import com.mhd.bms.domain.billManage.entity.BillDetail;
|
||||||
import com.mhd.bms.domain.billManage.entity.BillManage;
|
import com.mhd.bms.domain.billManage.entity.BillManage;
|
||||||
|
import com.mhd.bms.domain.billManage.repository.facade.IBillDetailService;
|
||||||
import com.mhd.bms.domain.billManage.repository.facade.IBillManageService;
|
import com.mhd.bms.domain.billManage.repository.facade.IBillManageService;
|
||||||
import com.mhd.bms.domain.billManage.repository.mapper.BillManageMapper;
|
import com.mhd.bms.domain.billManage.repository.mapper.BillManageMapper;
|
||||||
import com.mhd.bms.domain.billManage.repository.po.BillManagePO;
|
import com.mhd.bms.domain.billManage.repository.po.BillManagePO;
|
||||||
@@ -24,6 +26,8 @@ import com.mhd.bms.domain.ncDataPushConfig.entity.NcDataPushConfig;
|
|||||||
import com.mhd.bms.domain.ncDataPushConfig.repository.mapper.NcDataPushConfigMapper;
|
import com.mhd.bms.domain.ncDataPushConfig.repository.mapper.NcDataPushConfigMapper;
|
||||||
import com.mhd.bms.domain.ncLog.entity.NcLog;
|
import com.mhd.bms.domain.ncLog.entity.NcLog;
|
||||||
import com.mhd.bms.domain.ncLog.repository.mapper.NcLogMapper;
|
import com.mhd.bms.domain.ncLog.repository.mapper.NcLogMapper;
|
||||||
|
import com.mhd.bms.domain.settlementCustomers.entity.SettlementCustomers;
|
||||||
|
import com.mhd.bms.domain.settlementCustomers.repository.facade.ISettlementCustomersService;
|
||||||
import com.mhd.bms.interfaces.dto.billManage.BillManageDTO;
|
import com.mhd.bms.interfaces.dto.billManage.BillManageDTO;
|
||||||
import com.mhd.common.core.domain.dto.ReconciliationDTO;
|
import com.mhd.common.core.domain.dto.ReconciliationDTO;
|
||||||
import com.mhd.common.core.domain.dto.nc.*;
|
import com.mhd.common.core.domain.dto.nc.*;
|
||||||
@@ -83,6 +87,8 @@ public class BillManageImpl extends ServiceImpl<BillManageMapper, BillManage> im
|
|||||||
@Autowired
|
@Autowired
|
||||||
private BillManageMapper billManageMapper;
|
private BillManageMapper billManageMapper;
|
||||||
@Autowired
|
@Autowired
|
||||||
|
private IBillDetailService billDetailService;
|
||||||
|
@Autowired
|
||||||
private BmsInvoiceListMapper bmsInvoiceListMapper;
|
private BmsInvoiceListMapper bmsInvoiceListMapper;
|
||||||
|
|
||||||
//nc测试环境地址
|
//nc测试环境地址
|
||||||
@@ -103,6 +109,8 @@ public class BillManageImpl extends ServiceImpl<BillManageMapper, BillManage> im
|
|||||||
private BmsMakeOutInvoiceMapper bmsMakeOutInvoiceMapper;
|
private BmsMakeOutInvoiceMapper bmsMakeOutInvoiceMapper;
|
||||||
@Resource
|
@Resource
|
||||||
private BmsMakeOutInvoiceItemMapper bmsMakeOutInvoiceItemMapper;
|
private BmsMakeOutInvoiceItemMapper bmsMakeOutInvoiceItemMapper;
|
||||||
|
@Autowired
|
||||||
|
private ISettlementCustomersService settlementCustomersService;
|
||||||
/**
|
/**
|
||||||
* 查询账单管理列表
|
* 查询账单管理列表
|
||||||
*/
|
*/
|
||||||
@@ -177,7 +185,6 @@ public class BillManageImpl extends ServiceImpl<BillManageMapper, BillManage> im
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public boolean synchronousNc_TY(String businessDocumentDetaliId) {
|
public boolean synchronousNc_TY(String businessDocumentDetaliId) {
|
||||||
BillManage reconciliation=billManageMapper.selectById(businessDocumentDetaliId);
|
BillManage reconciliation=billManageMapper.selectById(businessDocumentDetaliId);
|
||||||
if(reconciliation.getSynchronousStatus()==1){
|
if(reconciliation.getSynchronousStatus()==1){
|
||||||
@@ -190,10 +197,13 @@ public class BillManageImpl extends ServiceImpl<BillManageMapper, BillManage> im
|
|||||||
SimpleDateFormat sdf2 = new SimpleDateFormat("MM");
|
SimpleDateFormat sdf2 = new SimpleDateFormat("MM");
|
||||||
String dateString = sdf.format(date);
|
String dateString = sdf.format(date);
|
||||||
String invoiceId = reconciliation.getInvoiceId();
|
String invoiceId = reconciliation.getInvoiceId();
|
||||||
List<BmsMakeOutInvoice> bmsMakeOutInvoices = bmsMakeOutInvoiceMapper.selectList(new LambdaQueryWrapper<BmsMakeOutInvoice>().eq(BmsMakeOutInvoice::getInvoiceId, invoiceId));
|
// List<BmsMakeOutInvoice> bmsMakeOutInvoices = bmsMakeOutInvoiceMapper.selectList(new LambdaQueryWrapper<BmsMakeOutInvoice>().eq(BmsMakeOutInvoice::getInvoiceId, invoiceId));
|
||||||
if (bmsMakeOutInvoices != null && bmsMakeOutInvoices.size() > 0){
|
List<BillDetail> billDetails = billDetailService.list(new LambdaQueryWrapper<BillDetail>()
|
||||||
|
.eq(BillDetail::getBillManageId, businessDocumentDetaliId)
|
||||||
|
.eq(BillDetail::getDelFlag, 1));
|
||||||
|
if (billDetails!=null && billDetails.size()>0){
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for (BmsMakeOutInvoice make : bmsMakeOutInvoices) {
|
for (BillDetail make : billDetails) {
|
||||||
count++;
|
count++;
|
||||||
List<Ysitem> ysitemList=new ArrayList<Ysitem>();
|
List<Ysitem> ysitemList=new ArrayList<Ysitem>();
|
||||||
String url = "";
|
String url = "";
|
||||||
@@ -213,8 +223,19 @@ public class BillManageImpl extends ServiceImpl<BillManageMapper, BillManage> im
|
|||||||
String deptName = billManageMapper.getDeptName(customerUserDept);
|
String deptName = billManageMapper.getDeptName(customerUserDept);
|
||||||
String salespersonNcCode = billManageMapper.getsalespersonNcCode(salesmanId);
|
String salespersonNcCode = billManageMapper.getsalespersonNcCode(salesmanId);
|
||||||
String salesmanCodeNc=salespersonNcCode;
|
String salesmanCodeNc=salespersonNcCode;
|
||||||
String appointShipper=make.getActualInvoiceCustomerName();
|
|
||||||
String actualInvoiceCustomerId = make.getActualInvoiceCustomerId();
|
Long settlementCustomersId = reconciliation.getSettlementCustomersId();
|
||||||
|
SettlementCustomers settlementCustomers = settlementCustomersService.getById(settlementCustomersId);
|
||||||
|
if (settlementCustomers==null){
|
||||||
|
throw new ServiceException("结算对象未找到!");
|
||||||
|
}
|
||||||
|
Long settlementEntityId = settlementCustomers.getSettlementEntityId();
|
||||||
|
Long shipperId = billManageMapper.getShipperId(settlementEntityId, organizationId);
|
||||||
|
if (shipperId==null||shipperId==0){
|
||||||
|
throw new ServiceException("结算对象未找到!");
|
||||||
|
}
|
||||||
|
String appointShipper=settlementCustomers.getSettlementEntity();
|
||||||
|
String actualInvoiceCustomerId = String.valueOf(shipperId);
|
||||||
String customerCodeNc = billManageMapper.getCustomerCodeNc(actualInvoiceCustomerId);
|
String customerCodeNc = billManageMapper.getCustomerCodeNc(actualInvoiceCustomerId);
|
||||||
String customerCodeNcJson = billManageMapper.getCustomerCodeNcJson(actualInvoiceCustomerId);
|
String customerCodeNcJson = billManageMapper.getCustomerCodeNcJson(actualInvoiceCustomerId);
|
||||||
if (customerCodeNcJson != null && !customerCodeNcJson.isEmpty()) {
|
if (customerCodeNcJson != null && !customerCodeNcJson.isEmpty()) {
|
||||||
@@ -241,85 +262,82 @@ public class BillManageImpl extends ServiceImpl<BillManageMapper, BillManage> im
|
|||||||
String documentPreparerNcCode = billManageMapper.getDocumentPreparerNcCode(salesmanId);
|
String documentPreparerNcCode = billManageMapper.getDocumentPreparerNcCode(salesmanId);
|
||||||
String makerCodeNc = documentPreparerNcCode;
|
String makerCodeNc = documentPreparerNcCode;
|
||||||
String settlementCurrencyNcCode = settlementCurrency;
|
String settlementCurrencyNcCode = settlementCurrency;
|
||||||
String invoiceNumber=make.getInvoiceNumber();
|
|
||||||
List<BmsMakeOutInvoiceItem> bmsMakeOutInvoiceItems = bmsMakeOutInvoiceItemMapper.selectList(new LambdaQueryWrapper<BmsMakeOutInvoiceItem>().eq(BmsMakeOutInvoiceItem::getMakeId, make.getId()));
|
if(make.getBillingAmount().compareTo(BigDecimal.ZERO)>0){
|
||||||
if (bmsMakeOutInvoiceItems != null && bmsMakeOutInvoiceItems.size() > 0) {
|
Ysitem item=new Ysitem();
|
||||||
for (BmsMakeOutInvoiceItem item1 : bmsMakeOutInvoiceItems) {
|
if (deptValue != null && !deptValue.isEmpty()) {
|
||||||
if(item1.getInvoiceValue().compareTo(BigDecimal.ZERO)>0){
|
item.setSo_deptid(deptValue);
|
||||||
Ysitem item=new Ysitem();
|
} else {
|
||||||
if (deptValue != null && !deptValue.isEmpty()) {
|
item.setSo_deptid("NG0408");
|
||||||
item.setSo_deptid(deptValue);
|
}
|
||||||
} else {
|
if (deptValue != null && !deptValue.isEmpty()) {
|
||||||
item.setSo_deptid("NG0408");
|
item.setPk_deptid(deptValue);
|
||||||
}
|
} else {
|
||||||
if (deptValue != null && !deptValue.isEmpty()) {
|
item.setPk_deptid("NG0408");
|
||||||
item.setPk_deptid(deptValue);
|
}
|
||||||
} else {
|
//业务员nc
|
||||||
item.setPk_deptid("NG0408");
|
item.setPk_psndoc(salesmanCodeNc);
|
||||||
}
|
//客户nc
|
||||||
//业务员nc
|
item.setCustomer(customerCodeNc);
|
||||||
item.setPk_psndoc(salesmanCodeNc);
|
item.setObjtype("0");
|
||||||
//客户nc
|
item.setDirection("1");
|
||||||
item.setCustomer(customerCodeNc);
|
String invoiceItem = make.getInvoiceItem();
|
||||||
item.setObjtype("0");
|
List<String> names = new ArrayList<>();
|
||||||
item.setDirection("1");
|
List<String> nccodes = new ArrayList<>();
|
||||||
String invoiceItem = item1.getInvoiceItem();
|
if (invoiceItem != null && !invoiceItem.isEmpty()) {
|
||||||
List<String> names = new ArrayList<>();
|
String[] items = invoiceItem.split(",");
|
||||||
List<String> nccodes = new ArrayList<>();
|
for (String s : items) {
|
||||||
if (invoiceItem != null && !invoiceItem.isEmpty()) {
|
String invoiceItemName1 = billManageMapper.getInvoiceItemName(s);
|
||||||
String[] items = invoiceItem.split(",");
|
String invoiceItemNcCode1 = billManageMapper.getInvoiceItemNcCode(s);
|
||||||
for (String s : items) {
|
names.add(invoiceItemName1);
|
||||||
String invoiceItemName1 = billManageMapper.getInvoiceItemName(s);
|
nccodes.add(invoiceItemNcCode1);
|
||||||
String invoiceItemNcCode1 = billManageMapper.getInvoiceItemNcCode(s);
|
|
||||||
names.add(invoiceItemName1);
|
|
||||||
nccodes.add(invoiceItemNcCode1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
String invoiceItemName = String.join(",", names);
|
|
||||||
//item.setDef29(invoiceItemName);
|
|
||||||
if (deptName != null && !deptName.isEmpty()) {
|
|
||||||
item.setScomment(deptName+":应收"+appointShipper+invoiceItemName+invoiceNumber);
|
|
||||||
} else {
|
|
||||||
item.setScomment("业务部:应收"+appointShipper+invoiceItemName+invoiceNumber);
|
|
||||||
}
|
|
||||||
// item.setPk_currtype("CNY");
|
|
||||||
item.setPk_currtype(settlementCurrencyNcCode);
|
|
||||||
item.setPurchaseorder("");
|
|
||||||
item.setTaxrate(String.valueOf(item1.getTaxRate()));
|
|
||||||
item.setQuantity_de("0");
|
|
||||||
item.setMoney_de(String.valueOf(item1.getInvoiceValue()));
|
|
||||||
item.setMoney_bal(String.valueOf(item1.getInvoiceValue()));
|
|
||||||
BigDecimal tax_de=item1.getTaxAmount();
|
|
||||||
BigDecimal notax_de=item1.getTaxFreeFee();
|
|
||||||
item.setNotax_de(String.valueOf(notax_de));
|
|
||||||
item.setLocal_tax_de(String.valueOf(tax_de));
|
|
||||||
item.setTax_de(String.valueOf(tax_de));
|
|
||||||
item.setPrice(String.valueOf(item1.getInvoiceValue()));
|
|
||||||
item.setTaxprice(String.valueOf(item1.getInvoiceValue()));
|
|
||||||
// 费用类别
|
|
||||||
String feeType = item1.getFeeType();
|
|
||||||
String serviceItemsCodeNc = billManageMapper.getServiceItemsCodeNc(feeType);
|
|
||||||
if (serviceItemsCodeNc != null && !serviceItemsCodeNc.isEmpty()) {
|
|
||||||
item.setDef75(serviceItemsCodeNc);
|
|
||||||
} else {
|
|
||||||
item.setDef75("T04");
|
|
||||||
}
|
|
||||||
String invoiceItem1 = item1.getInvoiceItem();
|
|
||||||
if (invoiceItem1 != null && !invoiceItem1.isEmpty()) {
|
|
||||||
String[] split = invoiceItem1.split(",");
|
|
||||||
item.setDef29(split[0]);
|
|
||||||
//item.setDef29(invoiceItem1);
|
|
||||||
}
|
|
||||||
if (nccodes != null && !nccodes.isEmpty()&&nccodes.size()>0) {
|
|
||||||
item.setDef29(nccodes.get(0));
|
|
||||||
}
|
|
||||||
item.setTaxcodeid("ZL01");
|
|
||||||
item.setInvoiceno(invoiceNumber);
|
|
||||||
ysitemList.add(item);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
String invoiceItemName = String.join(",", names);
|
||||||
|
//item.setDef29(invoiceItemName);
|
||||||
|
if (deptName != null && !deptName.isEmpty()) {
|
||||||
|
item.setScomment(deptName+":应收"+appointShipper+invoiceItemName);
|
||||||
|
} else {
|
||||||
|
item.setScomment("业务部:应收"+appointShipper+invoiceItemName);
|
||||||
|
}
|
||||||
|
// item.setPk_currtype("CNY");
|
||||||
|
item.setPk_currtype(settlementCurrencyNcCode);
|
||||||
|
item.setPurchaseorder("");
|
||||||
|
item.setTaxrate(String.valueOf(make.getTaxRate()));
|
||||||
|
item.setQuantity_de("0");
|
||||||
|
item.setMoney_de(String.valueOf(make.getBillingAmount()));
|
||||||
|
item.setMoney_bal(String.valueOf(make.getBillingAmount()));
|
||||||
|
BigDecimal tax_de=make.getTaxAmount();
|
||||||
|
BigDecimal notax_de=make.getTaxFreeFee();
|
||||||
|
item.setNotax_de(String.valueOf(notax_de));
|
||||||
|
item.setLocal_tax_de(String.valueOf(tax_de));
|
||||||
|
item.setTax_de(String.valueOf(tax_de));
|
||||||
|
item.setPrice(String.valueOf(make.getBillingAmount()));
|
||||||
|
item.setTaxprice(String.valueOf(make.getBillingAmount()));
|
||||||
|
// 费用类别
|
||||||
|
String feeType = make.getFeeType();
|
||||||
|
String serviceItemsCodeNc = billManageMapper.getServiceItemsCodeNc(feeType);
|
||||||
|
if (serviceItemsCodeNc != null && !serviceItemsCodeNc.isEmpty()) {
|
||||||
|
item.setDef75(serviceItemsCodeNc);
|
||||||
|
} else {
|
||||||
|
item.setDef75("T04");
|
||||||
|
}
|
||||||
|
String invoiceItem1 = make.getInvoiceItem();
|
||||||
|
if (invoiceItem1 != null && !invoiceItem1.isEmpty()) {
|
||||||
|
String[] split = invoiceItem1.split(",");
|
||||||
|
item.setDef29(split[0]);
|
||||||
|
//item.setDef29(invoiceItem1);
|
||||||
|
}
|
||||||
|
if (nccodes != null && !nccodes.isEmpty()&&nccodes.size()>0) {
|
||||||
|
item.setDef29(nccodes.get(0));
|
||||||
|
}
|
||||||
|
item.setTaxcodeid("ZL01");
|
||||||
|
// item.setInvoiceno(invoiceNumber);
|
||||||
|
ysitemList.add(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Ysbodys bodys=new Ysbodys();
|
Ysbodys bodys=new Ysbodys();
|
||||||
bodys.setItem(ysitemList);
|
bodys.setItem(ysitemList);
|
||||||
Ysbillhead billhead=new Ysbillhead();
|
Ysbillhead billhead=new Ysbillhead();
|
||||||
@@ -469,6 +487,298 @@ public class BillManageImpl extends ServiceImpl<BillManageMapper, BillManage> im
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//按发票推送版本
|
||||||
|
// public boolean synchronousNc_TY(String businessDocumentDetaliId) {
|
||||||
|
// BillManage reconciliation=billManageMapper.selectById(businessDocumentDetaliId);
|
||||||
|
// if(reconciliation.getSynchronousStatus()==1){
|
||||||
|
// throw new ServiceException("该记录已同步,不需要再次同步");
|
||||||
|
// }
|
||||||
|
// try {
|
||||||
|
// Date date = reconciliation.getCreateTime();
|
||||||
|
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
// SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy");
|
||||||
|
// SimpleDateFormat sdf2 = new SimpleDateFormat("MM");
|
||||||
|
// String dateString = sdf.format(date);
|
||||||
|
// String invoiceId = reconciliation.getInvoiceId();
|
||||||
|
// List<BmsMakeOutInvoice> bmsMakeOutInvoices = bmsMakeOutInvoiceMapper.selectList(new LambdaQueryWrapper<BmsMakeOutInvoice>().eq(BmsMakeOutInvoice::getInvoiceId, invoiceId));
|
||||||
|
// if (bmsMakeOutInvoices != null && bmsMakeOutInvoices.size() > 0){
|
||||||
|
// int count = 0;
|
||||||
|
// for (BmsMakeOutInvoice make : bmsMakeOutInvoices) {
|
||||||
|
// count++;
|
||||||
|
// List<Ysitem> ysitemList=new ArrayList<Ysitem>();
|
||||||
|
// String url = "";
|
||||||
|
// Long organizationId = reconciliation.getOrganizationId();
|
||||||
|
// String organizationName = reconciliation.getOrganizationName();
|
||||||
|
// String ncUrl = billManageMapper.getNcUrl("nc", organizationName, organizationId);
|
||||||
|
// if (ncUrl!=null&&ncUrl!="") {
|
||||||
|
// url = ncUrl;
|
||||||
|
// } else {
|
||||||
|
// reconciliation.setSynchronousStatus(2);
|
||||||
|
// billManageMapper.updateById(reconciliation);
|
||||||
|
// throw new ServiceException("未找到该组织的推送地址!");
|
||||||
|
// }
|
||||||
|
// String salesmanId = reconciliation.getSalesmanId();
|
||||||
|
// String customerUserDept = billManageMapper.getCustomerUserDept(salesmanId);
|
||||||
|
// String deptValue = billManageMapper.getDeptValue(customerUserDept);
|
||||||
|
// String deptName = billManageMapper.getDeptName(customerUserDept);
|
||||||
|
// String salespersonNcCode = billManageMapper.getsalespersonNcCode(salesmanId);
|
||||||
|
// String salesmanCodeNc=salespersonNcCode;
|
||||||
|
// String appointShipper=make.getActualInvoiceCustomerName();
|
||||||
|
// String actualInvoiceCustomerId = make.getActualInvoiceCustomerId();
|
||||||
|
// String customerCodeNc = billManageMapper.getCustomerCodeNc(actualInvoiceCustomerId);
|
||||||
|
// String customerCodeNcJson = billManageMapper.getCustomerCodeNcJson(actualInvoiceCustomerId);
|
||||||
|
// if (customerCodeNcJson != null && !customerCodeNcJson.isEmpty()) {
|
||||||
|
// ObjectMapper objectMapper = new ObjectMapper();
|
||||||
|
// List<Map<String, Object>> listNc = objectMapper.readValue(
|
||||||
|
// customerCodeNcJson,
|
||||||
|
// new TypeReference<List<Map<String, Object>>>() {}
|
||||||
|
// );
|
||||||
|
// if (listNc != null && listNc.size() > 0) {
|
||||||
|
// Map<String, Object> targetMap = listNc.stream()
|
||||||
|
// .filter(map -> {
|
||||||
|
// Object codeObj = map.get("code");
|
||||||
|
// return codeObj != null && codeObj.toString().equals(reconciliation.getOrganizationId().toString());
|
||||||
|
// })
|
||||||
|
// .findFirst()
|
||||||
|
// .orElse(null);
|
||||||
|
// if (targetMap != null) {
|
||||||
|
// customerCodeNc = (String) targetMap.get("ncCustomer");
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// String settlementCurrency=reconciliation.getSettlementCurrency();
|
||||||
|
// String orgCodeNc = billManageMapper.getOrgCodeNc(organizationId);
|
||||||
|
// String documentPreparerNcCode = billManageMapper.getDocumentPreparerNcCode(salesmanId);
|
||||||
|
// String makerCodeNc = documentPreparerNcCode;
|
||||||
|
// String settlementCurrencyNcCode = settlementCurrency;
|
||||||
|
// String invoiceNumber=make.getInvoiceNumber();
|
||||||
|
// List<BmsMakeOutInvoiceItem> bmsMakeOutInvoiceItems = bmsMakeOutInvoiceItemMapper.selectList(new LambdaQueryWrapper<BmsMakeOutInvoiceItem>().eq(BmsMakeOutInvoiceItem::getMakeId, make.getId()));
|
||||||
|
// if (bmsMakeOutInvoiceItems != null && bmsMakeOutInvoiceItems.size() > 0) {
|
||||||
|
// for (BmsMakeOutInvoiceItem item1 : bmsMakeOutInvoiceItems) {
|
||||||
|
// if(item1.getInvoiceValue().compareTo(BigDecimal.ZERO)>0){
|
||||||
|
// Ysitem item=new Ysitem();
|
||||||
|
// if (deptValue != null && !deptValue.isEmpty()) {
|
||||||
|
// item.setSo_deptid(deptValue);
|
||||||
|
// } else {
|
||||||
|
// item.setSo_deptid("NG0408");
|
||||||
|
// }
|
||||||
|
// if (deptValue != null && !deptValue.isEmpty()) {
|
||||||
|
// item.setPk_deptid(deptValue);
|
||||||
|
// } else {
|
||||||
|
// item.setPk_deptid("NG0408");
|
||||||
|
// }
|
||||||
|
// //业务员nc
|
||||||
|
// item.setPk_psndoc(salesmanCodeNc);
|
||||||
|
// //客户nc
|
||||||
|
// item.setCustomer(customerCodeNc);
|
||||||
|
// item.setObjtype("0");
|
||||||
|
// item.setDirection("1");
|
||||||
|
// String invoiceItem = item1.getInvoiceItem();
|
||||||
|
// List<String> names = new ArrayList<>();
|
||||||
|
// List<String> nccodes = new ArrayList<>();
|
||||||
|
// if (invoiceItem != null && !invoiceItem.isEmpty()) {
|
||||||
|
// String[] items = invoiceItem.split(",");
|
||||||
|
// for (String s : items) {
|
||||||
|
// String invoiceItemName1 = billManageMapper.getInvoiceItemName(s);
|
||||||
|
// String invoiceItemNcCode1 = billManageMapper.getInvoiceItemNcCode(s);
|
||||||
|
// names.add(invoiceItemName1);
|
||||||
|
// nccodes.add(invoiceItemNcCode1);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// String invoiceItemName = String.join(",", names);
|
||||||
|
// //item.setDef29(invoiceItemName);
|
||||||
|
// if (deptName != null && !deptName.isEmpty()) {
|
||||||
|
// item.setScomment(deptName+":应收"+appointShipper+invoiceItemName+invoiceNumber);
|
||||||
|
// } else {
|
||||||
|
// item.setScomment("业务部:应收"+appointShipper+invoiceItemName+invoiceNumber);
|
||||||
|
// }
|
||||||
|
// // item.setPk_currtype("CNY");
|
||||||
|
// item.setPk_currtype(settlementCurrencyNcCode);
|
||||||
|
// item.setPurchaseorder("");
|
||||||
|
// item.setTaxrate(String.valueOf(item1.getTaxRate()));
|
||||||
|
// item.setQuantity_de("0");
|
||||||
|
// item.setMoney_de(String.valueOf(item1.getInvoiceValue()));
|
||||||
|
// item.setMoney_bal(String.valueOf(item1.getInvoiceValue()));
|
||||||
|
// BigDecimal tax_de=item1.getTaxAmount();
|
||||||
|
// BigDecimal notax_de=item1.getTaxFreeFee();
|
||||||
|
// item.setNotax_de(String.valueOf(notax_de));
|
||||||
|
// item.setLocal_tax_de(String.valueOf(tax_de));
|
||||||
|
// item.setTax_de(String.valueOf(tax_de));
|
||||||
|
// item.setPrice(String.valueOf(item1.getInvoiceValue()));
|
||||||
|
// item.setTaxprice(String.valueOf(item1.getInvoiceValue()));
|
||||||
|
//// 费用类别
|
||||||
|
// String feeType = item1.getFeeType();
|
||||||
|
// String serviceItemsCodeNc = billManageMapper.getServiceItemsCodeNc(feeType);
|
||||||
|
// if (serviceItemsCodeNc != null && !serviceItemsCodeNc.isEmpty()) {
|
||||||
|
// item.setDef75(serviceItemsCodeNc);
|
||||||
|
// } else {
|
||||||
|
// item.setDef75("T04");
|
||||||
|
// }
|
||||||
|
// String invoiceItem1 = item1.getInvoiceItem();
|
||||||
|
// if (invoiceItem1 != null && !invoiceItem1.isEmpty()) {
|
||||||
|
// String[] split = invoiceItem1.split(",");
|
||||||
|
// item.setDef29(split[0]);
|
||||||
|
// //item.setDef29(invoiceItem1);
|
||||||
|
// }
|
||||||
|
// if (nccodes != null && !nccodes.isEmpty()&&nccodes.size()>0) {
|
||||||
|
// item.setDef29(nccodes.get(0));
|
||||||
|
// }
|
||||||
|
// item.setTaxcodeid("ZL01");
|
||||||
|
// item.setInvoiceno(invoiceNumber);
|
||||||
|
// ysitemList.add(item);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// Ysbodys bodys=new Ysbodys();
|
||||||
|
// bodys.setItem(ysitemList);
|
||||||
|
// Ysbillhead billhead=new Ysbillhead();
|
||||||
|
// billhead.setPk_group("CNK");
|
||||||
|
// if (orgCodeNc != null && !orgCodeNc.isEmpty()) {
|
||||||
|
// billhead.setPk_org(orgCodeNc);
|
||||||
|
// billhead.setSett_org(orgCodeNc);
|
||||||
|
// } else {
|
||||||
|
// billhead.setPk_org("NG04");
|
||||||
|
// billhead.setSett_org("NG04");
|
||||||
|
// }
|
||||||
|
// billhead.setCreationtime(dateString);
|
||||||
|
// billhead.setCreator(makerCodeNc);
|
||||||
|
// billhead.setPk_billtype("F0");
|
||||||
|
// billhead.setPk_tradetype("D0");
|
||||||
|
// billhead.setBillclass("ys");
|
||||||
|
// billhead.setIsinit("N");
|
||||||
|
// date=reconciliation.getCreateTime();
|
||||||
|
// dateString = sdf.format(date);
|
||||||
|
// billhead.setBilldate(dateString);
|
||||||
|
// billhead.setSyscode("0");
|
||||||
|
// billhead.setBillno("");
|
||||||
|
// billhead.setDef59("");
|
||||||
|
// billhead.setSrc_syscode("0");
|
||||||
|
// billhead.setBillstatus("0");
|
||||||
|
// billhead.setBillmaker(makerCodeNc);
|
||||||
|
// billhead.setPk_busitype("");
|
||||||
|
// billhead.setBillyear(sdf1.format(date));
|
||||||
|
// billhead.setBillperiod(sdf2.format(date));
|
||||||
|
// billhead.setEffectstatus("0");
|
||||||
|
// billhead.setDef28("nqyw");
|
||||||
|
// billhead.setDef29(reconciliation.getBillNumber());
|
||||||
|
// billhead.setBodys(bodys);
|
||||||
|
// Ysbill bill=new Ysbill();
|
||||||
|
// bill.setId("ys"+String.valueOf(reconciliation.getBillManageId())+"_"+count);
|
||||||
|
// bill.setBillhead(billhead);
|
||||||
|
// Ysufinterface ufinterface=new Ysufinterface();
|
||||||
|
// ufinterface.setAccount("NKNC");
|
||||||
|
// ufinterface.setBilltype("F0");
|
||||||
|
// ufinterface.setBusinessunitcode("");
|
||||||
|
// ufinterface.setFilename("");
|
||||||
|
// ufinterface.setIsexchange("Y");
|
||||||
|
// if (orgCodeNc != null && !orgCodeNc.isEmpty()) {
|
||||||
|
// ufinterface.setOrgcode(orgCodeNc);
|
||||||
|
// ufinterface.setReceiver(orgCodeNc);
|
||||||
|
// } else {
|
||||||
|
// ufinterface.setOrgcode("NG04");
|
||||||
|
// ufinterface.setReceiver("NG04");
|
||||||
|
// }
|
||||||
|
// ufinterface.setReplace("Y");
|
||||||
|
// ufinterface.setRoottag("");
|
||||||
|
// ufinterface.setSender("nqyw");
|
||||||
|
// ufinterface.setBill(bill);
|
||||||
|
// JAXBContext jaxbContext = JAXBContext.newInstance(Ysufinterface.class);
|
||||||
|
// Marshaller marshaller = jaxbContext.createMarshaller();
|
||||||
|
// marshaller.setProperty(Marshaller.JAXB_FRAGMENT, true);
|
||||||
|
// marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); // 格式化输出,可选
|
||||||
|
// StringWriter sw = new StringWriter();
|
||||||
|
// marshaller.marshal(ufinterface, sw);
|
||||||
|
// String xmlString = sw.toString(); // 这是要发送的XML字符串
|
||||||
|
// System.out.println(xmlString);
|
||||||
|
// NcLog ncLog=new NcLog();
|
||||||
|
// ncLog.setOrderId(reconciliation.getBillManageId());
|
||||||
|
// ncLog.setRequestBody(xmlString);
|
||||||
|
// ncLog.setResponeBody("");
|
||||||
|
// ncLog.setType(0L);
|
||||||
|
// ncLog.setSendTime(new Date());
|
||||||
|
// ncLog.setOrganizationId(reconciliation.getOrganizationId());
|
||||||
|
// ncLog.setOrganizationName(reconciliation.getOrganizationName());
|
||||||
|
// ncLog.setTopOrganizationId(reconciliation.getTopOrganizationId());
|
||||||
|
// ncLogMapper.insert(ncLog);
|
||||||
|
// reconciliation.setSynchronousStatus(1);
|
||||||
|
// reconciliation.setSynchronousTime(new Date());
|
||||||
|
// reconciliation.setNcId("ys"+String.valueOf(reconciliation.getBillManageId()));
|
||||||
|
// //reconciliationMapper.updateById(reconciliation);
|
||||||
|
// CloseableHttpClient httpClient = HttpClients.createDefault();
|
||||||
|
// HttpPost httpPost = new HttpPost(url);
|
||||||
|
// StringEntity postingString = new StringEntity(xmlString, "UTF-8");
|
||||||
|
// httpPost.setEntity(postingString);
|
||||||
|
// httpPost.setHeader("Content-type", "application/xml");
|
||||||
|
// try {
|
||||||
|
// CloseableHttpResponse response = httpClient.execute(httpPost);
|
||||||
|
// String responseString = EntityUtils.toString(response.getEntity());
|
||||||
|
// System.out.println(responseString);
|
||||||
|
// ncLog.setResponeBody(responseString);
|
||||||
|
// // 创建DOM解析器
|
||||||
|
// DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
||||||
|
// DocumentBuilder builder = factory.newDocumentBuilder();
|
||||||
|
// Document document = builder.parse(new InputSource(new StringReader(responseString)));
|
||||||
|
//
|
||||||
|
// // 获取根元素
|
||||||
|
// Element root = document.getDocumentElement();
|
||||||
|
//
|
||||||
|
// // 获取ufinterface元素的属性
|
||||||
|
// String billtype = root.getAttribute("billtype");
|
||||||
|
// String filename = root.getAttribute("filename");
|
||||||
|
// System.out.println("billtype: " + billtype);
|
||||||
|
// System.out.println("filename: " + filename);
|
||||||
|
//
|
||||||
|
// // 获取sendresult节点
|
||||||
|
// NodeList sendResultList = root.getElementsByTagName("sendresult");
|
||||||
|
// if (sendResultList.getLength() > 0) {
|
||||||
|
// Element sendResult = (Element) sendResultList.item(0);
|
||||||
|
//
|
||||||
|
// // 获取子元素内容
|
||||||
|
// String bdocid = sendResult.getElementsByTagName("bdocid").item(0).getTextContent();
|
||||||
|
// String resultcode = sendResult.getElementsByTagName("resultcode").item(0).getTextContent();
|
||||||
|
// String content = sendResult.getElementsByTagName("content").item(0).getTextContent();
|
||||||
|
//
|
||||||
|
// System.out.println("bdocid: " + bdocid);
|
||||||
|
// System.out.println("resultcode: " + resultcode);
|
||||||
|
// System.out.println("content: " + content);
|
||||||
|
// if(resultcode.equals("1")){
|
||||||
|
// reconciliation.setSynchronousStatus(1);
|
||||||
|
// }else{
|
||||||
|
// reconciliation.setSynchronousStatus(2);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// ncLogMapper.updateById(ncLog);
|
||||||
|
// billManageMapper.updateById(reconciliation);
|
||||||
|
// response.close();
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// reconciliation.setSynchronousStatus(2);
|
||||||
|
// billManageMapper.updateById(reconciliation);
|
||||||
|
// e.printStackTrace();
|
||||||
|
// } finally {
|
||||||
|
// try {
|
||||||
|
// httpClient.close();
|
||||||
|
// } catch (IOException e) {
|
||||||
|
// e.printStackTrace();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// } else {
|
||||||
|
// reconciliation.setSynchronousStatus(2);
|
||||||
|
// billManageMapper.updateById(reconciliation);
|
||||||
|
// }
|
||||||
|
// } catch (JAXBException e) {
|
||||||
|
// reconciliation.setSynchronousStatus(2);
|
||||||
|
// billManageMapper.updateById(reconciliation);
|
||||||
|
// e.printStackTrace();
|
||||||
|
// } catch (JsonMappingException e) {
|
||||||
|
// throw new RuntimeException(e);
|
||||||
|
// } catch (JsonProcessingException e) {
|
||||||
|
// throw new RuntimeException(e);
|
||||||
|
// }
|
||||||
|
// return true;
|
||||||
|
// }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean synchronousNcSK(String businessDocumentDetaliIds) {
|
public boolean synchronousNcSK(String businessDocumentDetaliIds) {
|
||||||
String [] businessDocumentDetaliIdArray=businessDocumentDetaliIds.split(",");
|
String [] businessDocumentDetaliIdArray=businessDocumentDetaliIds.split(",");
|
||||||
@@ -779,6 +1089,297 @@ public class BillManageImpl extends ServiceImpl<BillManageMapper, BillManage> im
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//按发票推送版本
|
||||||
|
// public boolean synchronousNcSK_TY(String businessDocumentDetaliId) {
|
||||||
|
// BillManage reconciliation=billManageMapper.selectById(businessDocumentDetaliId);
|
||||||
|
// if(reconciliation.getSkSynchronousStatus()==1){
|
||||||
|
// throw new ServiceException("该记录已同步,不需要再次同步");
|
||||||
|
// }
|
||||||
|
// try {
|
||||||
|
// Date date = reconciliation.getCreateTime();
|
||||||
|
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
// SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy");
|
||||||
|
// SimpleDateFormat sdf2 = new SimpleDateFormat("MM");
|
||||||
|
// String dateString = sdf.format(date);
|
||||||
|
// String invoiceId = reconciliation.getInvoiceId();
|
||||||
|
// ReconciliationDTO makeQuery=new ReconciliationDTO();
|
||||||
|
// makeQuery.setInnerNumber(invoiceId);
|
||||||
|
// List<BmsMakeOutInvoice> bmsMakeOutInvoices = bmsMakeOutInvoiceMapper.selectList(new LambdaQueryWrapper<BmsMakeOutInvoice>().eq(BmsMakeOutInvoice::getInvoiceId, invoiceId));
|
||||||
|
// if (bmsMakeOutInvoices != null && bmsMakeOutInvoices.size() > 0) {
|
||||||
|
// int count= 0;
|
||||||
|
// for (BmsMakeOutInvoice make : bmsMakeOutInvoices) {
|
||||||
|
// count++;
|
||||||
|
// List<SKitem> ysitemList=new ArrayList<SKitem>();
|
||||||
|
// ReconciliationDTO reconciliationDTO=new ReconciliationDTO();
|
||||||
|
// reconciliationDTO.setInnerNumber(reconciliation.getBillNumber());
|
||||||
|
// String url = "";
|
||||||
|
// Long organizationId = reconciliation.getOrganizationId();
|
||||||
|
// String orgCodeNc = billManageMapper.getOrgCodeNc(organizationId);
|
||||||
|
// String organizationName = reconciliation.getOrganizationName();
|
||||||
|
// String ncUrl = billManageMapper.getNcUrl("nc", organizationName, organizationId);
|
||||||
|
// if (ncUrl!=null&&ncUrl!="") {
|
||||||
|
// url = ncUrl;
|
||||||
|
// } else {
|
||||||
|
// reconciliation.setSkSynchronousStatus(2);
|
||||||
|
// billManageMapper.updateById(reconciliation);
|
||||||
|
// throw new ServiceException("未找到该组织的推送地址!");
|
||||||
|
// }
|
||||||
|
// List<BmsMakeOutInvoiceItem> bmsMakeOutInvoiceItems = bmsMakeOutInvoiceItemMapper.selectList(new LambdaQueryWrapper<BmsMakeOutInvoiceItem>().eq(BmsMakeOutInvoiceItem::getMakeId, make.getId()));
|
||||||
|
// String makerCodeNc = "";
|
||||||
|
// if(bmsMakeOutInvoiceItems != null && bmsMakeOutInvoiceItems.size() > 0){
|
||||||
|
// if(ObjectUtil.isNotNull(bmsMakeOutInvoiceItems)){
|
||||||
|
// // 汇总 list 中 invoiceValue 的总值
|
||||||
|
// BigDecimal totalInvoiceValue = bmsMakeOutInvoiceItems.stream()
|
||||||
|
// .map(BmsMakeOutInvoiceItem::getInvoiceValue)
|
||||||
|
// .filter(java.util.Objects::nonNull)
|
||||||
|
// .reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||||
|
//
|
||||||
|
// // 将 feeType 用、拼接起来
|
||||||
|
// String feeTypes = bmsMakeOutInvoiceItems.stream()
|
||||||
|
// .map(BmsMakeOutInvoiceItem::getFeeType)
|
||||||
|
// .filter(java.util.Objects::nonNull)
|
||||||
|
// .collect(java.util.stream.Collectors.joining("、"));
|
||||||
|
//
|
||||||
|
// // 按 createTime 倒序排序并获取第一条记录
|
||||||
|
// BmsMakeOutInvoiceItem firstItem = bmsMakeOutInvoiceItems.stream()
|
||||||
|
// .sorted((a, b) -> {
|
||||||
|
// if (a.getCreateTime() == null) return 1;
|
||||||
|
// if (b.getCreateTime() == null) return -1;
|
||||||
|
// return b.getCreateTime().compareTo(a.getCreateTime());
|
||||||
|
// })
|
||||||
|
// .findFirst()
|
||||||
|
// .orElse(null);
|
||||||
|
// String salesmanId = reconciliation.getSalesmanId();
|
||||||
|
// String customerUserDept = billManageMapper.getCustomerUserDept(salesmanId);
|
||||||
|
// String deptValue = billManageMapper.getDeptValue(customerUserDept);
|
||||||
|
// String deptName = billManageMapper.getDeptName(customerUserDept);
|
||||||
|
// String salespersonNcCode = billManageMapper.getsalespersonNcCode(salesmanId);
|
||||||
|
// String salesmanCodeNc=salespersonNcCode;
|
||||||
|
// String appointShipper=make.getActualInvoiceCustomerName();
|
||||||
|
// String actualInvoiceCustomerId = make.getActualInvoiceCustomerId();
|
||||||
|
// String customerCodeNc = billManageMapper.getCustomerCodeNc(actualInvoiceCustomerId);
|
||||||
|
// String customerCodeNcJson = billManageMapper.getCustomerCodeNcJson(actualInvoiceCustomerId);
|
||||||
|
// if (customerCodeNcJson != null && !customerCodeNcJson.isEmpty()) {
|
||||||
|
// ObjectMapper objectMapper = new ObjectMapper();
|
||||||
|
// List<Map<String, Object>> listNc = objectMapper.readValue(
|
||||||
|
// customerCodeNcJson,
|
||||||
|
// new TypeReference<List<Map<String, Object>>>() {}
|
||||||
|
// );
|
||||||
|
// if (listNc != null && listNc.size() > 0) {
|
||||||
|
// Map<String, Object> targetMap = listNc.stream()
|
||||||
|
// .filter(map -> {
|
||||||
|
// Object codeObj = map.get("code");
|
||||||
|
// return codeObj != null && codeObj.toString().equals(reconciliation.getOrganizationId().toString());
|
||||||
|
// })
|
||||||
|
// .findFirst()
|
||||||
|
// .orElse(null);
|
||||||
|
// if (targetMap != null) {
|
||||||
|
// customerCodeNc = (String) targetMap.get("ncCustomer");
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// String documentPreparerNcCode = billManageMapper.getDocumentPreparerNcCode(salesmanId);
|
||||||
|
// String settlementCurrency=reconciliation.getSettlementCurrency();
|
||||||
|
// String settlementCurrencyNcCode = settlementCurrency;
|
||||||
|
// makerCodeNc=documentPreparerNcCode;
|
||||||
|
// SKitem item=new SKitem();
|
||||||
|
// if (deptValue != null && !deptValue.isEmpty()) {
|
||||||
|
// item.setSo_deptid(deptValue);
|
||||||
|
// } else {
|
||||||
|
// item.setSo_deptid("NG0408");
|
||||||
|
// }
|
||||||
|
// if (deptValue != null && !deptValue.isEmpty()) {
|
||||||
|
// item.setPk_deptid(deptValue);
|
||||||
|
// } else {
|
||||||
|
// item.setPk_deptid("NG0408");
|
||||||
|
// }
|
||||||
|
// item.setCheckdirection("ar");
|
||||||
|
// item.setPk_psndoc(salesmanCodeNc);
|
||||||
|
// item.setCustomer(customerCodeNc);
|
||||||
|
// item.setPurchaseorder("");
|
||||||
|
// item.setObjtype("0");
|
||||||
|
// item.setDirection("1");
|
||||||
|
// if (deptName != null && !deptName.isEmpty()) {
|
||||||
|
// if (feeTypes != null && !feeTypes.isEmpty()) {
|
||||||
|
// item.setScomment(deptName+":"+appointShipper+feeTypes);
|
||||||
|
// } else {
|
||||||
|
// item.setScomment(deptName+":"+appointShipper+feeTypes);
|
||||||
|
// }
|
||||||
|
// } else {
|
||||||
|
// if (feeTypes != null && !feeTypes.isEmpty()) {
|
||||||
|
// item.setScomment("业务部:"+appointShipper+feeTypes);
|
||||||
|
// } else {
|
||||||
|
// item.setScomment("业务部:"+appointShipper+feeTypes);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// // 费用类别
|
||||||
|
// String feeType = firstItem.getFeeType();
|
||||||
|
// String serviceItemsCodeNc = billManageMapper.getServiceItemsCodeNc(feeType);
|
||||||
|
// if (serviceItemsCodeNc != null && !serviceItemsCodeNc.isEmpty()) {
|
||||||
|
// item.setDef75(serviceItemsCodeNc);
|
||||||
|
// } else {
|
||||||
|
// item.setDef75("T10");
|
||||||
|
// }
|
||||||
|
// String invoiceItem1 = firstItem.getInvoiceItem();
|
||||||
|
// if (invoiceItem1 != null && !invoiceItem1.isEmpty()) {
|
||||||
|
// String[] split = invoiceItem1.split(",");
|
||||||
|
// item.setDef29(split[0]);
|
||||||
|
// }
|
||||||
|
// item.setPk_currtype(settlementCurrencyNcCode);
|
||||||
|
// item.setMoney_cr(String.valueOf(totalInvoiceValue));
|
||||||
|
// item.setMoney_bal(String.valueOf(totalInvoiceValue));
|
||||||
|
// ysitemList.add(item);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// SKbodys bodys=new SKbodys();
|
||||||
|
// bodys.setItem(ysitemList);
|
||||||
|
// SKbillhead billhead=new SKbillhead();
|
||||||
|
// billhead.setPk_group("CNK");
|
||||||
|
// if (orgCodeNc != null && !orgCodeNc.isEmpty()) {
|
||||||
|
// billhead.setPk_org(orgCodeNc);
|
||||||
|
// billhead.setSett_org(orgCodeNc);
|
||||||
|
// } else {
|
||||||
|
// billhead.setPk_org("NG04");
|
||||||
|
// billhead.setSett_org("NG04");
|
||||||
|
// }
|
||||||
|
// billhead.setCreationtime(dateString);
|
||||||
|
// billhead.setPk_billtype("F2");
|
||||||
|
// billhead.setCreator(makerCodeNc);
|
||||||
|
// billhead.setPk_tradetype("D2");
|
||||||
|
// billhead.setBillclass("sk");
|
||||||
|
// billhead.setBilldate(dateString);
|
||||||
|
// billhead.setSyscode("0");
|
||||||
|
// billhead.setBillno("");
|
||||||
|
// billhead.setDef59("");
|
||||||
|
// billhead.setSrc_syscode("0");
|
||||||
|
// billhead.setBillstatus("0");
|
||||||
|
// billhead.setBillmaker(makerCodeNc);
|
||||||
|
// billhead.setPk_busitype("");
|
||||||
|
// billhead.setBillyear(sdf1.format(date));
|
||||||
|
// billhead.setBillperiod(sdf2.format(date));
|
||||||
|
// billhead.setEffectstatus("0");
|
||||||
|
// billhead.setDef28("nqyw");
|
||||||
|
// billhead.setDef29(reconciliation.getBillNumber());
|
||||||
|
// billhead.setBodys(bodys);
|
||||||
|
// SKbill bill=new SKbill();
|
||||||
|
// bill.setId("sk"+String.valueOf(reconciliation.getBillManageId())+"_"+count);
|
||||||
|
// bill.setBillhead(billhead);
|
||||||
|
// SKufinterface ufinterface=new SKufinterface();
|
||||||
|
// ufinterface.setAccount("NKNC");
|
||||||
|
// ufinterface.setBilltype("F2");
|
||||||
|
// ufinterface.setBusinessunitcode("");
|
||||||
|
// ufinterface.setFilename("");
|
||||||
|
// ufinterface.setIsexchange("Y");
|
||||||
|
// if (orgCodeNc != null && !orgCodeNc.isEmpty()) {
|
||||||
|
// ufinterface.setOrgcode(orgCodeNc);
|
||||||
|
// ufinterface.setReceiver(orgCodeNc);
|
||||||
|
// } else {
|
||||||
|
// ufinterface.setOrgcode("NG04");
|
||||||
|
// ufinterface.setReceiver("NG04");
|
||||||
|
// }
|
||||||
|
// ufinterface.setReplace("Y");
|
||||||
|
// ufinterface.setRoottag("");
|
||||||
|
// ufinterface.setSender("nqyw");
|
||||||
|
// ufinterface.setBill(bill);
|
||||||
|
// JAXBContext jaxbContext = null;
|
||||||
|
// //String xmlString ="<ufinterface account=\"NKNC\" billtype=\"F0\" businessunitcode=\"\" filename=\"\" groupcode=\"CNK\" isexchange=\"Y\" orgcode=\"NG10\" receiver=\"NG10\" replace=\"Y\" roottag=\"\" sender=\"NKT_MY\">";
|
||||||
|
// jaxbContext = JAXBContext.newInstance(SKufinterface.class);
|
||||||
|
// Marshaller marshaller = jaxbContext.createMarshaller();
|
||||||
|
// marshaller.setProperty(Marshaller.JAXB_FRAGMENT, true);
|
||||||
|
// marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); // 格式化输出,可选
|
||||||
|
// StringWriter sw = new StringWriter();
|
||||||
|
// marshaller.marshal(ufinterface, sw);
|
||||||
|
// String xmlString = sw.toString(); // 这是要发送的XML字符串
|
||||||
|
// System.out.println(xmlString);
|
||||||
|
// NcLog ncLog=new NcLog();
|
||||||
|
// ncLog.setOrderId(reconciliation.getBillManageId());
|
||||||
|
// ncLog.setRequestBody(xmlString);
|
||||||
|
// ncLog.setResponeBody("");
|
||||||
|
// ncLog.setType(1L);
|
||||||
|
// ncLog.setSendTime(new Date());
|
||||||
|
// ncLog.setOrganizationId(reconciliation.getOrganizationId());
|
||||||
|
// ncLog.setOrganizationName(reconciliation.getOrganizationName());
|
||||||
|
// ncLog.setTopOrganizationId(reconciliation.getTopOrganizationId());
|
||||||
|
// ncLogMapper.insert(ncLog);
|
||||||
|
// reconciliation.setSkSynchronousStatus(1);
|
||||||
|
// reconciliation.setSkSynchronousTime(new Date());
|
||||||
|
// reconciliation.setSkNcId("sk"+String.valueOf(reconciliation.getBillManageId()));
|
||||||
|
// //reconciliationMapper.updateById(reconciliation);
|
||||||
|
// CloseableHttpClient httpClient = HttpClients.createDefault();
|
||||||
|
// HttpPost httpPost = new HttpPost(url);
|
||||||
|
// StringEntity postingString = new StringEntity(xmlString, "UTF-8");
|
||||||
|
// httpPost.setEntity(postingString);
|
||||||
|
// httpPost.setHeader("Content-type", "application/xml");
|
||||||
|
// try {
|
||||||
|
// CloseableHttpResponse response = httpClient.execute(httpPost);
|
||||||
|
// String responseString = EntityUtils.toString(response.getEntity());
|
||||||
|
// System.out.println(responseString);
|
||||||
|
// ncLog.setResponeBody(responseString);
|
||||||
|
// // 创建DOM解析器
|
||||||
|
// DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
||||||
|
// DocumentBuilder builder = factory.newDocumentBuilder();
|
||||||
|
// Document document = builder.parse(new InputSource(new StringReader(responseString)));
|
||||||
|
//
|
||||||
|
// // 获取根元素
|
||||||
|
// Element root = document.getDocumentElement();
|
||||||
|
//
|
||||||
|
// // 获取ufinterface元素的属性
|
||||||
|
// String billtype = root.getAttribute("billtype");
|
||||||
|
// String filename = root.getAttribute("filename");
|
||||||
|
// System.out.println("billtype: " + billtype);
|
||||||
|
// System.out.println("filename: " + filename);
|
||||||
|
//
|
||||||
|
// // 获取sendresult节点
|
||||||
|
// NodeList sendResultList = root.getElementsByTagName("sendresult");
|
||||||
|
// if (sendResultList.getLength() > 0) {
|
||||||
|
// Element sendResult = (Element) sendResultList.item(0);
|
||||||
|
//
|
||||||
|
// // 获取子元素内容
|
||||||
|
// String bdocid = sendResult.getElementsByTagName("bdocid").item(0).getTextContent();
|
||||||
|
// String resultcode = sendResult.getElementsByTagName("resultcode").item(0).getTextContent();
|
||||||
|
// String content = sendResult.getElementsByTagName("content").item(0).getTextContent();
|
||||||
|
//
|
||||||
|
// System.out.println("bdocid: " + bdocid);
|
||||||
|
// System.out.println("resultcode: " + resultcode);
|
||||||
|
// System.out.println("content: " + content);
|
||||||
|
// if(resultcode.equals("1")){
|
||||||
|
// reconciliation.setSkSynchronousStatus(1);
|
||||||
|
// }else{
|
||||||
|
// reconciliation.setSkSynchronousStatus(2);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// ncLogMapper.updateById(ncLog);
|
||||||
|
// billManageMapper.updateById(reconciliation);
|
||||||
|
// response.close();
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// reconciliation.setSkSynchronousStatus(2);
|
||||||
|
// billManageMapper.updateById(reconciliation);
|
||||||
|
// e.printStackTrace();
|
||||||
|
// } finally {
|
||||||
|
// try {
|
||||||
|
// httpClient.close();
|
||||||
|
// } catch (IOException e) {
|
||||||
|
// e.printStackTrace();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
// } else {
|
||||||
|
// reconciliation.setSkSynchronousStatus(2);
|
||||||
|
// billManageMapper.updateById(reconciliation);
|
||||||
|
// }
|
||||||
|
// } catch (JAXBException e) {
|
||||||
|
// reconciliation.setSkSynchronousStatus(2);
|
||||||
|
// billManageMapper.updateById(reconciliation);
|
||||||
|
// e.printStackTrace();
|
||||||
|
// } catch (JsonMappingException e) {
|
||||||
|
// throw new RuntimeException(e);
|
||||||
|
// } catch (JsonProcessingException e) {
|
||||||
|
// throw new RuntimeException(e);
|
||||||
|
// }
|
||||||
|
// return true;
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int editIsInvoice(String billNumber, Integer isInvoice, String invoiceId, String invoiceMakeTime,String applyNumber) {
|
public int editIsInvoice(String billNumber, Integer isInvoice, String invoiceId, String invoiceMakeTime,String applyNumber) {
|
||||||
|
|||||||
@@ -162,4 +162,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
SELECT NC_CODE FROM NGWL_TEST_PRODUCT."SYS_ORGANIZATION" where DEL_FLAG = 1 and organization_id = #{organizationId} limit 1
|
SELECT NC_CODE FROM NGWL_TEST_PRODUCT."SYS_ORGANIZATION" where DEL_FLAG = 1 and organization_id = #{organizationId} limit 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getShipperId" resultType="java.lang.Long">
|
||||||
|
SELECT SHIPPER_ID FROM NGWL_TEST_USER."USER_SHIPPER" where DEL_FLAG = '1' and user_id = #{userId} and organization_id = #{organizationId} limit 1
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
Reference in New Issue
Block a user