Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
@@ -83,6 +83,9 @@ public class Ysitem {
|
|||||||
@ApiModelProperty( "")
|
@ApiModelProperty( "")
|
||||||
private String def75;
|
private String def75;
|
||||||
|
|
||||||
|
@ApiModelProperty( "")
|
||||||
|
private String def29;
|
||||||
|
|
||||||
//税率id
|
//税率id
|
||||||
private String taxcodeid;
|
private String taxcodeid;
|
||||||
|
|
||||||
|
|||||||
+3
-1
@@ -53,6 +53,8 @@ public class ServiceItemsManage extends BaseVOEntity{
|
|||||||
@ApiModelProperty("备注")
|
@ApiModelProperty("备注")
|
||||||
@Excel(name = "备注")
|
@Excel(name = "备注")
|
||||||
private String remark;
|
private String remark;
|
||||||
|
@ApiModelProperty("服务项编码nc")
|
||||||
|
@Excel(name = "服务项编码nc")
|
||||||
|
private String serviceItemsCodeNc;
|
||||||
|
|
||||||
}
|
}
|
||||||
+4
@@ -59,4 +59,8 @@ public class ServiceItemsManagePO extends BaseVOEntity{
|
|||||||
|
|
||||||
private String costType;
|
private String costType;
|
||||||
|
|
||||||
|
@ApiModelProperty("服务项编码nc")
|
||||||
|
@Excel(name = "服务项编码nc")
|
||||||
|
private String serviceItemsCodeNc;
|
||||||
|
|
||||||
}
|
}
|
||||||
+5
@@ -53,6 +53,10 @@ public class ServiceItemsManageDO extends BaseVOEntity{
|
|||||||
@Excel(name = "备注")
|
@Excel(name = "备注")
|
||||||
private String remark;
|
private String remark;
|
||||||
|
|
||||||
|
@ApiModelProperty("服务项编码nc")
|
||||||
|
@Excel(name = "服务项编码nc")
|
||||||
|
private String serviceItemsCodeNc;
|
||||||
|
|
||||||
@ApiModelProperty(name = "组织ID集合")
|
@ApiModelProperty(name = "组织ID集合")
|
||||||
private List<Long> organizationIdList;
|
private List<Long> organizationIdList;
|
||||||
|
|
||||||
@@ -68,4 +72,5 @@ public class ServiceItemsManageDO extends BaseVOEntity{
|
|||||||
private String updateTimeStart;
|
private String updateTimeStart;
|
||||||
@ApiModelProperty(name = "修改时间查询条件结束日期")
|
@ApiModelProperty(name = "修改时间查询条件结束日期")
|
||||||
private String updateTimeEnd;
|
private String updateTimeEnd;
|
||||||
|
|
||||||
}
|
}
|
||||||
+4
@@ -61,4 +61,8 @@ public class ServiceItemsManageDTO extends BaseVOEntity{
|
|||||||
|
|
||||||
@ApiModelProperty("服务项管理ids")
|
@ApiModelProperty("服务项管理ids")
|
||||||
private String serviceItemsManageIds;
|
private String serviceItemsManageIds;
|
||||||
|
|
||||||
|
@ApiModelProperty("服务项编码nc")
|
||||||
|
@Excel(name = "服务项编码nc")
|
||||||
|
private String serviceItemsCodeNc;
|
||||||
}
|
}
|
||||||
+10
-1
@@ -7,6 +7,7 @@ import com.mhd.bms.application.server.receiptManage.ReceiptManageApplicationServ
|
|||||||
import com.mhd.bms.domain.billManage.entity.BillDetail;
|
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.IBillDetailService;
|
||||||
|
import com.mhd.bms.domain.billManage.repository.mapper.BillDetailMapper;
|
||||||
import com.mhd.bms.domain.billManage.repository.po.BillDetailPO;
|
import com.mhd.bms.domain.billManage.repository.po.BillDetailPO;
|
||||||
import com.mhd.bms.domain.billManage.repository.po.BillManagePO;
|
import com.mhd.bms.domain.billManage.repository.po.BillManagePO;
|
||||||
import com.mhd.bms.domain.billManage.repository.todo.BillDetailDO;
|
import com.mhd.bms.domain.billManage.repository.todo.BillDetailDO;
|
||||||
@@ -69,6 +70,8 @@ public class BillManageApplicationService {
|
|||||||
private ReceiptManageDomainService receiptManageDomainService;
|
private ReceiptManageDomainService receiptManageDomainService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private PaymentOrderDomainService paymentOrderDomainService;
|
private PaymentOrderDomainService paymentOrderDomainService;
|
||||||
|
@Autowired
|
||||||
|
private BillDetailMapper billDetailMapper;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -121,7 +124,13 @@ public class BillManageApplicationService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return billManageDomainService.queryList(billManageDO);
|
List<BillManagePO> billManagePOS = billManageDomainService.queryList(billManageDO);
|
||||||
|
for (BillManagePO billManagePO : billManagePOS) {
|
||||||
|
String billNumber = billManagePO.getBillNumber(); // 获取账单编号
|
||||||
|
List<BillDetail> billDetails = billDetailMapper.selectList(new LambdaQueryWrapper<BillDetail>().eq(BillDetail::getBillNumber, billNumber));
|
||||||
|
billManagePO.setBillDetailList(billDetails);
|
||||||
|
}
|
||||||
|
return billManagePOS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -82,4 +82,10 @@ public class BillDetail extends BaseVOEntity{
|
|||||||
private Double taxRate;
|
private Double taxRate;
|
||||||
@ApiModelProperty("结算币种")
|
@ApiModelProperty("结算币种")
|
||||||
private String settlementCurrency;
|
private String settlementCurrency;
|
||||||
|
@ApiModelProperty(value = "开票项目")
|
||||||
|
private String invoiceItem;
|
||||||
|
@ApiModelProperty(value = "开票项目名称")
|
||||||
|
private String invoiceItemName;
|
||||||
|
@ApiModelProperty(value = "费用类别")
|
||||||
|
private String feeType;
|
||||||
}
|
}
|
||||||
@@ -234,4 +234,9 @@ public class BillManage extends BaseVOEntity{
|
|||||||
private Double taxRate;
|
private Double taxRate;
|
||||||
@ApiModelProperty("结算币种")
|
@ApiModelProperty("结算币种")
|
||||||
private String settlementCurrency;
|
private String settlementCurrency;
|
||||||
|
@ApiModelProperty("业务员ID")
|
||||||
|
private String salesmanId;
|
||||||
|
|
||||||
|
@ApiModelProperty("业务员ID")
|
||||||
|
private String salesmanName;
|
||||||
}
|
}
|
||||||
+12
@@ -19,4 +19,16 @@ public interface BillManageMapper extends BaseMapper<BillManage>
|
|||||||
*/
|
*/
|
||||||
public List<BillManagePO> queryList(@Param("billManageDO") BillManageDO billManageDO);
|
public List<BillManagePO> queryList(@Param("billManageDO") BillManageDO billManageDO);
|
||||||
|
|
||||||
|
String getInvoiceItemName(@Param("invoiceItemId") String invoiceItemId);
|
||||||
|
|
||||||
|
String getCustomerCodeNc(@Param("actualInvoiceCustomerId") String actualInvoiceCustomerId);
|
||||||
|
|
||||||
|
String getDocumentPreparerNcCode(@Param("salesmanId") String salesmanId);
|
||||||
|
|
||||||
|
String getsalespersonNcCode(@Param("salesmanId") String salesmanId);
|
||||||
|
|
||||||
|
String getSettlementCurrencyNcCode(@Param("settlementCurrency") String settlementCurrency);
|
||||||
|
|
||||||
|
String getServiceItemsCodeNc(@Param("name") String name);
|
||||||
|
|
||||||
}
|
}
|
||||||
+333
-233
@@ -1,6 +1,7 @@
|
|||||||
package com.mhd.bms.domain.billManage.repository.persistence;
|
package com.mhd.bms.domain.billManage.repository.persistence;
|
||||||
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
@@ -11,19 +12,29 @@ import com.mhd.bms.domain.billManage.repository.po.BillManagePO;
|
|||||||
import com.mhd.bms.domain.billManage.repository.todo.BillManageDO;
|
import com.mhd.bms.domain.billManage.repository.todo.BillManageDO;
|
||||||
import com.mhd.bms.domain.bmsInvoiceList.entity.BmsInvoiceList;
|
import com.mhd.bms.domain.bmsInvoiceList.entity.BmsInvoiceList;
|
||||||
import com.mhd.bms.domain.bmsInvoiceList.repository.mapper.BmsInvoiceListMapper;
|
import com.mhd.bms.domain.bmsInvoiceList.repository.mapper.BmsInvoiceListMapper;
|
||||||
|
import com.mhd.bms.domain.bmsMakeOutInvoice.entity.BmsMakeOutInvoice;
|
||||||
|
import com.mhd.bms.domain.bmsMakeOutInvoice.repository.mapper.BmsMakeOutInvoiceMapper;
|
||||||
|
import com.mhd.bms.domain.bmsMakeOutInvoiceItem.entity.BmsMakeOutInvoiceItem;
|
||||||
|
import com.mhd.bms.domain.bmsMakeOutInvoiceItem.repository.mapper.BmsMakeOutInvoiceItemMapper;
|
||||||
import com.mhd.bms.domain.ncDataPushConfig.entity.NcDataPushConfig;
|
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.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.nc.*;
|
import com.mhd.common.core.domain.dto.nc.*;
|
||||||
import com.mhd.common.core.domain.entity.R;
|
import com.mhd.common.core.domain.entity.R;
|
||||||
import com.mhd.common.core.domain.entity.TmsOrder;
|
import com.mhd.common.core.domain.entity.TmsOrder;
|
||||||
import com.mhd.common.core.domain.po.UserPo;
|
import com.mhd.common.core.domain.po.UserPo;
|
||||||
|
import com.mhd.common.core.domain.po.thirdparty.SysDepartInterfaceInfoPo;
|
||||||
|
import com.mhd.common.core.domain.thirdparty.SysDepartInterfaceInfoDTO;
|
||||||
import com.mhd.common.core.exception.ServiceException;
|
import com.mhd.common.core.exception.ServiceException;
|
||||||
|
import com.mhd.common.core.feign.ThirdPartyServiceFeign;
|
||||||
import com.mhd.common.security.utils.SecurityUtils;
|
import com.mhd.common.security.utils.SecurityUtils;
|
||||||
import com.mhd.system.api.WlhyServiceFeign;
|
import com.mhd.system.api.WlhyServiceFeign;
|
||||||
import com.mhd.system.api.domain.TmsInvoiceListDetailsVO;
|
import com.mhd.system.api.domain.TmsInvoiceListDetailsVO;
|
||||||
|
import com.mhd.system.api.domain.TmsMakeOutInvoice;
|
||||||
|
import com.mhd.system.api.domain.TmsMakeOutInvoiceItem;
|
||||||
import com.mhd.system.api.model.LoginUser;
|
import com.mhd.system.api.model.LoginUser;
|
||||||
import org.apache.http.client.methods.CloseableHttpResponse;
|
import org.apache.http.client.methods.CloseableHttpResponse;
|
||||||
import org.apache.http.client.methods.HttpPost;
|
import org.apache.http.client.methods.HttpPost;
|
||||||
@@ -49,6 +60,7 @@ import java.io.IOException;
|
|||||||
import java.io.StringReader;
|
import java.io.StringReader;
|
||||||
import java.io.StringWriter;
|
import java.io.StringWriter;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.math.RoundingMode;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -80,6 +92,12 @@ public class BillManageImpl extends ServiceImpl<BillManageMapper, BillManage> im
|
|||||||
private WlhyServiceFeign wlhyServiceFeign;
|
private WlhyServiceFeign wlhyServiceFeign;
|
||||||
@Autowired
|
@Autowired
|
||||||
private NcDataPushConfigMapper ncDataPushConfigMapper;
|
private NcDataPushConfigMapper ncDataPushConfigMapper;
|
||||||
|
@Resource
|
||||||
|
private ThirdPartyServiceFeign thirdPartyServiceFeign;
|
||||||
|
@Resource
|
||||||
|
private BmsMakeOutInvoiceMapper bmsMakeOutInvoiceMapper;
|
||||||
|
@Resource
|
||||||
|
private BmsMakeOutInvoiceItemMapper bmsMakeOutInvoiceItemMapper;
|
||||||
/**
|
/**
|
||||||
* 查询账单管理列表
|
* 查询账单管理列表
|
||||||
*/
|
*/
|
||||||
@@ -138,72 +156,125 @@ public class BillManageImpl extends ServiceImpl<BillManageMapper, BillManage> im
|
|||||||
@Override
|
@Override
|
||||||
public boolean synchronousNc(String businessDocumentDetaliIds) {
|
public boolean synchronousNc(String businessDocumentDetaliIds) {
|
||||||
String [] businessDocumentDetaliIdArray=businessDocumentDetaliIds.split(",");
|
String [] businessDocumentDetaliIdArray=businessDocumentDetaliIds.split(",");
|
||||||
LoginUser loginUser= SecurityUtils.getLoginUser();
|
|
||||||
UserPo userPo=loginUser.getUserPo();
|
|
||||||
ObjectMapper mapper = new ObjectMapper();
|
|
||||||
for (String businessDocumentDetaliId:businessDocumentDetaliIdArray){
|
for (String businessDocumentDetaliId:businessDocumentDetaliIdArray){
|
||||||
BillManage reconciliation=billManageMapper.selectById(businessDocumentDetaliId);
|
BillManage billManage=billManageMapper.selectById(businessDocumentDetaliId);
|
||||||
if(reconciliation.getSynchronousStatus()==1){
|
if(billManage.getSynchronousStatus()==1){
|
||||||
throw new ServiceException("该记录已同步,不需要再次同步");
|
throw new ServiceException("该记录已同步,不需要再次同步");
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Date date = reconciliation.getCreateTime();
|
if(billManage.getOrganizationName().contains("通宇")){
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
boolean b = synchronousNc_TY(businessDocumentDetaliId);
|
||||||
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy");
|
}
|
||||||
SimpleDateFormat sdf2 = new SimpleDateFormat("MM");
|
} catch (Exception e) {
|
||||||
String dateString = sdf.format(date);
|
e.printStackTrace();
|
||||||
List<Ysitem> ysitemList=new ArrayList<Ysitem>();
|
}
|
||||||
// BillManageDTO reconciliationDTO=new BillManageDTO();
|
}
|
||||||
// reconciliationDTO.setBillNumber(reconciliation.getBillNumber());
|
return true;
|
||||||
// R<List<TmsOrder>> result=wlhyServiceFeign.getOrderListByReconciliation(reconciliationDTO);
|
}
|
||||||
String makerCodeNc="";
|
|
||||||
String invoiceNumber="";
|
|
||||||
|
|
||||||
//获取发票信息
|
|
||||||
String invoiceId = reconciliation.getInvoiceId();
|
public boolean synchronousNc_TY(String businessDocumentDetaliId) {
|
||||||
BmsInvoiceList bmsInvoiceList = bmsInvoiceListMapper.selectById(invoiceId);
|
BillManage reconciliation=billManageMapper.selectById(businessDocumentDetaliId);
|
||||||
invoiceNumber = bmsInvoiceList.getInvoiceNumber();
|
if(reconciliation.getSynchronousStatus()==1){
|
||||||
//关联不到订单暂时new
|
throw new ServiceException("该记录已同步,不需要再次同步");
|
||||||
List<TmsOrder> list=new ArrayList<>();
|
}
|
||||||
if(ObjectUtil.isNotNull(list) && list.size()>0){
|
try {
|
||||||
for(TmsOrder tmsOrder:list){
|
Date date = reconciliation.getCreateTime();
|
||||||
date=tmsOrder.getDocumentDate();
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
dateString = sdf.format(date);
|
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy");
|
||||||
makerCodeNc=tmsOrder.getMakerCodeNc();
|
SimpleDateFormat sdf2 = new SimpleDateFormat("MM");
|
||||||
Ysitem item=new Ysitem();
|
String dateString = sdf.format(date);
|
||||||
item.setSo_deptid("NG040104");
|
String invoiceId = reconciliation.getInvoiceId();
|
||||||
item.setPk_deptid("NG040104");
|
List<BmsMakeOutInvoice> bmsMakeOutInvoices = bmsMakeOutInvoiceMapper.selectList(new LambdaQueryWrapper<BmsMakeOutInvoice>().eq(BmsMakeOutInvoice::getInvoiceId, invoiceId));
|
||||||
item.setPk_psndoc(tmsOrder.getSalesmanCodeNc());
|
if (bmsMakeOutInvoices != null && bmsMakeOutInvoices.size() > 0){
|
||||||
item.setCustomer(tmsOrder.getCustomerCodeNc());
|
int count = 0;
|
||||||
item.setObjtype("0");
|
for (BmsMakeOutInvoice make : bmsMakeOutInvoices) {
|
||||||
item.setDirection("1");
|
count++;
|
||||||
item.setScomment(tmsOrder.getAppointShipper());
|
List<Ysitem> ysitemList=new ArrayList<Ysitem>();
|
||||||
// item.setPk_currtype("CNY");
|
String url = "";
|
||||||
item.setPk_currtype(tmsOrder.getSettlementCurrency());
|
SysDepartInterfaceInfoDTO query= new SysDepartInterfaceInfoDTO();
|
||||||
item.setPurchaseorder(tmsOrder.getGoodsNumber());
|
query.setOrganizationId(reconciliation.getOrganizationId());
|
||||||
item.setTaxrate("0");
|
query.setOrganizationName(reconciliation.getOrganizationName());
|
||||||
item.setQuantity_de("0");
|
query.setInterfaceType("nc");
|
||||||
item.setMoney_de(String.valueOf(tmsOrder.getDeliveryFreight()));
|
List<SysDepartInterfaceInfoPo> urlList = thirdPartyServiceFeign.queryList(query);
|
||||||
item.setMoney_bal(String.valueOf(tmsOrder.getDeliveryFreight()));
|
if (urlList != null && urlList.size() > 0) {
|
||||||
BigDecimal tax_de=tmsOrder.getDeliveryFreight().multiply(tmsOrder.getTaxRate().divide(BigDecimal.valueOf(100))).setScale(2,BigDecimal.ROUND_HALF_UP);
|
url = urlList.get(0).getInterfaceTypeValue();
|
||||||
BigDecimal notax_de=tmsOrder.getDeliveryFreight().subtract(tax_de);
|
} else {
|
||||||
item.setNotax_de(String.valueOf(notax_de));
|
throw new ServiceException("未找到该组织的推送地址!");
|
||||||
item.setLocal_tax_de(String.valueOf(notax_de));
|
|
||||||
item.setTax_de(String.valueOf(tax_de));
|
|
||||||
item.setPrice(String.valueOf(tmsOrder.getDeliveryFreight()));
|
|
||||||
item.setTaxprice(String.valueOf(tmsOrder.getDeliveryFreight()));
|
|
||||||
item.setDef75("T10");
|
|
||||||
item.setInvoiceno(invoiceNumber);
|
|
||||||
ysitemList.add(item);
|
|
||||||
}
|
}
|
||||||
|
String salesmanId = reconciliation.getSalesmanId();
|
||||||
|
String salespersonNcCode = billManageMapper.getsalespersonNcCode(salesmanId);
|
||||||
|
String salesmanCodeNc=salespersonNcCode;
|
||||||
|
String appointShipper=make.getActualInvoiceCustomerName();
|
||||||
|
String actualInvoiceCustomerId = make.getActualInvoiceCustomerId();
|
||||||
|
String customerCodeNc = billManageMapper.getCustomerCodeNc(actualInvoiceCustomerId);
|
||||||
|
String settlementCurrency=reconciliation.getSettlementCurrency();
|
||||||
|
|
||||||
|
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();
|
||||||
|
item.setSo_deptid("NG0408");
|
||||||
|
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<>();
|
||||||
|
if (invoiceItem != null && !invoiceItem.isEmpty()) {
|
||||||
|
String[] items = invoiceItem.split(",");
|
||||||
|
for (String s : items) {
|
||||||
|
String invoiceItemName1 = billManageMapper.getInvoiceItemName(s);
|
||||||
|
names.add(invoiceItemName1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
String invoiceItemName = String.join(",", names);
|
||||||
|
item.setDef29(invoiceItemName);
|
||||||
|
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");
|
||||||
|
}
|
||||||
|
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();
|
||||||
billhead.setPk_group("CNK");
|
billhead.setPk_group("CNK");
|
||||||
billhead.setPk_org("NG0401");
|
billhead.setPk_org("NG04");
|
||||||
billhead.setSett_org("NG0401");
|
billhead.setSett_org("NG04");
|
||||||
billhead.setBilldate(dateString);
|
billhead.setCreationtime(dateString);
|
||||||
billhead.setCreator(makerCodeNc);
|
billhead.setCreator(makerCodeNc);
|
||||||
billhead.setPk_billtype("F0");
|
billhead.setPk_billtype("F0");
|
||||||
billhead.setPk_tradetype("D0");
|
billhead.setPk_tradetype("D0");
|
||||||
@@ -211,7 +282,7 @@ public class BillManageImpl extends ServiceImpl<BillManageMapper, BillManage> im
|
|||||||
billhead.setIsinit("N");
|
billhead.setIsinit("N");
|
||||||
date=reconciliation.getCreateTime();
|
date=reconciliation.getCreateTime();
|
||||||
dateString = sdf.format(date);
|
dateString = sdf.format(date);
|
||||||
billhead.setCreationtime(dateString);
|
billhead.setBilldate(dateString);
|
||||||
billhead.setSyscode("0");
|
billhead.setSyscode("0");
|
||||||
billhead.setBillno("");
|
billhead.setBillno("");
|
||||||
billhead.setDef59("");
|
billhead.setDef59("");
|
||||||
@@ -226,7 +297,7 @@ public class BillManageImpl extends ServiceImpl<BillManageMapper, BillManage> im
|
|||||||
billhead.setDef29(reconciliation.getBillNumber());
|
billhead.setDef29(reconciliation.getBillNumber());
|
||||||
billhead.setBodys(bodys);
|
billhead.setBodys(bodys);
|
||||||
Ysbill bill=new Ysbill();
|
Ysbill bill=new Ysbill();
|
||||||
bill.setId("ys"+String.valueOf(reconciliation.getBillManageId()));
|
bill.setId("ys"+String.valueOf(reconciliation.getBillManageId())+"_"+count);
|
||||||
bill.setBillhead(billhead);
|
bill.setBillhead(billhead);
|
||||||
Ysufinterface ufinterface=new Ysufinterface();
|
Ysufinterface ufinterface=new Ysufinterface();
|
||||||
ufinterface.setAccount("NKNC");
|
ufinterface.setAccount("NKNC");
|
||||||
@@ -234,8 +305,8 @@ public class BillManageImpl extends ServiceImpl<BillManageMapper, BillManage> im
|
|||||||
ufinterface.setBusinessunitcode("");
|
ufinterface.setBusinessunitcode("");
|
||||||
ufinterface.setFilename("");
|
ufinterface.setFilename("");
|
||||||
ufinterface.setIsexchange("Y");
|
ufinterface.setIsexchange("Y");
|
||||||
ufinterface.setOrgcode("NG0401");
|
ufinterface.setOrgcode("NG04");
|
||||||
ufinterface.setReceiver("NG0401");
|
ufinterface.setReceiver("NG04");
|
||||||
ufinterface.setReplace("Y");
|
ufinterface.setReplace("Y");
|
||||||
ufinterface.setRoottag("");
|
ufinterface.setRoottag("");
|
||||||
ufinterface.setSender("nqyw");
|
ufinterface.setSender("nqyw");
|
||||||
@@ -260,17 +331,9 @@ public class BillManageImpl extends ServiceImpl<BillManageMapper, BillManage> im
|
|||||||
reconciliation.setSynchronousStatus(1);
|
reconciliation.setSynchronousStatus(1);
|
||||||
reconciliation.setSynchronousTime(new Date());
|
reconciliation.setSynchronousTime(new Date());
|
||||||
reconciliation.setNcId("ys"+String.valueOf(reconciliation.getBillManageId()));
|
reconciliation.setNcId("ys"+String.valueOf(reconciliation.getBillManageId()));
|
||||||
//billManageMapper.updateById(reconciliation);
|
//reconciliationMapper.updateById(reconciliation);
|
||||||
Long organizationId = reconciliation.getOrganizationId();
|
|
||||||
List<NcDataPushConfig> ncurl = ncDataPushConfigMapper.selectList(new QueryWrapper<NcDataPushConfig>().eq("organization_id", organizationId));
|
|
||||||
String zsurl = "";
|
|
||||||
if (ncurl != null && ncurl.size() > 0) {
|
|
||||||
zsurl = ncurl.get(0).getNcUrl();
|
|
||||||
} else {
|
|
||||||
throw new ServiceException("未找到对应的nc推送地址");
|
|
||||||
}
|
|
||||||
CloseableHttpClient httpClient = HttpClients.createDefault();
|
CloseableHttpClient httpClient = HttpClients.createDefault();
|
||||||
HttpPost httpPost = new HttpPost(zsurl);
|
HttpPost httpPost = new HttpPost(url);
|
||||||
StringEntity postingString = new StringEntity(xmlString, "UTF-8");
|
StringEntity postingString = new StringEntity(xmlString, "UTF-8");
|
||||||
httpPost.setEntity(postingString);
|
httpPost.setEntity(postingString);
|
||||||
httpPost.setHeader("Content-type", "application/xml");
|
httpPost.setHeader("Content-type", "application/xml");
|
||||||
@@ -325,9 +388,9 @@ public class BillManageImpl extends ServiceImpl<BillManageMapper, BillManage> im
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (JAXBException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
|
} catch (JAXBException e) {
|
||||||
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -335,8 +398,6 @@ public class BillManageImpl extends ServiceImpl<BillManageMapper, BillManage> im
|
|||||||
@Override
|
@Override
|
||||||
public boolean synchronousNcSK(String businessDocumentDetaliIds) {
|
public boolean synchronousNcSK(String businessDocumentDetaliIds) {
|
||||||
String [] businessDocumentDetaliIdArray=businessDocumentDetaliIds.split(",");
|
String [] businessDocumentDetaliIdArray=businessDocumentDetaliIds.split(",");
|
||||||
LoginUser loginUser= SecurityUtils.getLoginUser();
|
|
||||||
UserPo userPo=loginUser.getUserPo();
|
|
||||||
for (String businessDocumentDetaliId:businessDocumentDetaliIdArray){
|
for (String businessDocumentDetaliId:businessDocumentDetaliIdArray){
|
||||||
BillManage reconciliation=billManageMapper.selectById(businessDocumentDetaliId);
|
BillManage reconciliation=billManageMapper.selectById(businessDocumentDetaliId);
|
||||||
if(reconciliation.getSkSynchronousStatus()==1){
|
if(reconciliation.getSkSynchronousStatus()==1){
|
||||||
@@ -344,172 +405,211 @@ public class BillManageImpl extends ServiceImpl<BillManageMapper, BillManage> im
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Date date = reconciliation.getCreateTime();
|
if(reconciliation.getOrganizationName().contains("通宇")){
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
boolean b = synchronousNcSK_TY(businessDocumentDetaliId);
|
||||||
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy");
|
|
||||||
SimpleDateFormat sdf2 = new SimpleDateFormat("MM");
|
|
||||||
String dateString = sdf.format(date);
|
|
||||||
List<SKitem> ysitemList=new ArrayList<SKitem>();
|
|
||||||
BillManageDTO reconciliationDTO=new BillManageDTO();
|
|
||||||
reconciliationDTO.setBillNumber(reconciliation.getBillNumber());
|
|
||||||
|
|
||||||
String makerCodeNc="";
|
|
||||||
//关联不到订单暂时new
|
|
||||||
List<TmsOrder> list = new ArrayList<>();
|
|
||||||
if(ObjectUtil.isNotNull(list) && list.size()>0){
|
|
||||||
for(TmsOrder tmsOrder:list){
|
|
||||||
makerCodeNc=tmsOrder.getMakerCodeNc();
|
|
||||||
makerCodeNc="xiangna";
|
|
||||||
SKitem item=new SKitem();
|
|
||||||
item.setSo_deptid("NG040104");
|
|
||||||
item.setPk_deptid("NG040104");
|
|
||||||
item.setCheckdirection("ar");
|
|
||||||
item.setPk_psndoc(tmsOrder.getSalesmanCodeNc());
|
|
||||||
item.setCustomer(tmsOrder.getCustomerCodeNc());
|
|
||||||
item.setPurchaseorder(tmsOrder.getGoodsNumber());
|
|
||||||
item.setObjtype("0");
|
|
||||||
item.setDirection("1");
|
|
||||||
item.setScomment(tmsOrder.getAppointShipper());
|
|
||||||
item.setPk_currtype(tmsOrder.getSettlementCurrency());
|
|
||||||
item.setMoney_cr(String.valueOf(tmsOrder.getCollectedFreight()));
|
|
||||||
item.setMoney_bal(String.valueOf(tmsOrder.getCollectedFreight()));
|
|
||||||
ysitemList.add(item);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
SKbodys bodys=new SKbodys();
|
|
||||||
bodys.setItem(ysitemList);
|
|
||||||
SKbillhead billhead=new SKbillhead();
|
|
||||||
billhead.setPk_group("CNK");
|
|
||||||
billhead.setPk_org("NG0401");
|
|
||||||
billhead.setSett_org("NG0401");
|
|
||||||
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()));
|
|
||||||
bill.setBillhead(billhead);
|
|
||||||
SKufinterface ufinterface=new SKufinterface();
|
|
||||||
ufinterface.setAccount("NKNC");
|
|
||||||
ufinterface.setBilltype("F2");
|
|
||||||
ufinterface.setBusinessunitcode("");
|
|
||||||
ufinterface.setFilename("");
|
|
||||||
ufinterface.setIsexchange("Y");
|
|
||||||
ufinterface.setOrgcode("NG0401");
|
|
||||||
ufinterface.setReceiver("NG0401");
|
|
||||||
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.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()));
|
|
||||||
//billManageMapper.updateById(reconciliation);
|
|
||||||
CloseableHttpClient httpClient = HttpClients.createDefault();
|
|
||||||
Long organizationId = reconciliation.getOrganizationId();
|
|
||||||
List<NcDataPushConfig> ncurl = ncDataPushConfigMapper.selectList(new QueryWrapper<NcDataPushConfig>().eq("organization_id", organizationId));
|
|
||||||
String zsurl = "";
|
|
||||||
if (ncurl != null && ncurl.size() > 0) {
|
|
||||||
zsurl = ncurl.get(0).getNcUrl();
|
|
||||||
} else {
|
|
||||||
throw new ServiceException("未找到对应的nc推送地址");
|
|
||||||
}
|
|
||||||
HttpPost httpPost = new HttpPost(zsurl);
|
|
||||||
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) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} finally {
|
|
||||||
try {
|
|
||||||
httpClient.close();
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (JAXBException e) {
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
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 = "";
|
||||||
|
SysDepartInterfaceInfoDTO query= new SysDepartInterfaceInfoDTO();
|
||||||
|
query.setOrganizationId(reconciliation.getOrganizationId());
|
||||||
|
query.setOrganizationName(reconciliation.getOrganizationName());
|
||||||
|
query.setInterfaceType("nc");
|
||||||
|
List<SysDepartInterfaceInfoPo> urlList = thirdPartyServiceFeign.queryList(query);
|
||||||
|
if (urlList != null && urlList.size() > 0) {
|
||||||
|
url = urlList.get(0).getInterfaceTypeValue();
|
||||||
|
} else {
|
||||||
|
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);
|
||||||
|
String salesmanId = reconciliation.getSalesmanId();
|
||||||
|
String salespersonNcCode = billManageMapper.getsalespersonNcCode(salesmanId);
|
||||||
|
String salesmanCodeNc=salespersonNcCode;
|
||||||
|
String appointShipper=make.getActualInvoiceCustomerName();
|
||||||
|
String actualInvoiceCustomerId = make.getActualInvoiceCustomerId();
|
||||||
|
String customerCodeNc = billManageMapper.getCustomerCodeNc(actualInvoiceCustomerId);
|
||||||
|
String documentPreparerNcCode = billManageMapper.getDocumentPreparerNcCode(salesmanId);
|
||||||
|
String settlementCurrency=reconciliation.getSettlementCurrency();
|
||||||
|
String settlementCurrencyNcCode = settlementCurrency;
|
||||||
|
makerCodeNc=documentPreparerNcCode;
|
||||||
|
SKitem item=new SKitem();
|
||||||
|
item.setSo_deptid("NG0408");
|
||||||
|
item.setPk_deptid("NG0408");
|
||||||
|
item.setCheckdirection("ar");
|
||||||
|
item.setPk_psndoc(salesmanCodeNc);
|
||||||
|
item.setCustomer(customerCodeNc);
|
||||||
|
item.setPurchaseorder("");
|
||||||
|
item.setObjtype("0");
|
||||||
|
item.setDirection("1");
|
||||||
|
item.setScomment("业务部:"+appointShipper+"物流费");
|
||||||
|
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");
|
||||||
|
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");
|
||||||
|
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.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) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} finally {
|
||||||
|
try {
|
||||||
|
httpClient.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (JAXBException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
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) {
|
||||||
|
|||||||
@@ -128,6 +128,11 @@ public class BillDetailPO extends BaseVOEntity{
|
|||||||
private Double taxRate;
|
private Double taxRate;
|
||||||
@ApiModelProperty("结算币种")
|
@ApiModelProperty("结算币种")
|
||||||
private String settlementCurrency;
|
private String settlementCurrency;
|
||||||
|
@ApiModelProperty(value = "开票项目")
|
||||||
|
private String invoiceItem;
|
||||||
|
@ApiModelProperty(value = "开票项目名称")
|
||||||
|
private String invoiceItemName;
|
||||||
|
@ApiModelProperty(value = "费用类别")
|
||||||
|
private String feeType;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.mhd.bms.domain.billManage.repository.po;
|
package com.mhd.bms.domain.billManage.repository.po;
|
||||||
|
|
||||||
|
import com.mhd.bms.domain.billManage.entity.BillDetail;
|
||||||
import com.mhd.bms.domain.billingStatement.repository.po.BillingStatementPO;
|
import com.mhd.bms.domain.billingStatement.repository.po.BillingStatementPO;
|
||||||
import com.mhd.common.core.annotation.Excel;
|
import com.mhd.common.core.annotation.Excel;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -245,4 +246,10 @@ public class BillManagePO extends BaseVOEntity{
|
|||||||
private Double taxRate;
|
private Double taxRate;
|
||||||
@ApiModelProperty("结算币种")
|
@ApiModelProperty("结算币种")
|
||||||
private String settlementCurrency;
|
private String settlementCurrency;
|
||||||
|
@ApiModelProperty("业务员ID")
|
||||||
|
private String salesmanId;
|
||||||
|
|
||||||
|
@ApiModelProperty("业务员ID")
|
||||||
|
private String salesmanName;
|
||||||
|
private List<BillDetail> billDetailList;
|
||||||
}
|
}
|
||||||
@@ -87,4 +87,15 @@ public class BillDetailDO extends BaseVOEntity{
|
|||||||
private Double taxRate;
|
private Double taxRate;
|
||||||
@ApiModelProperty("结算币种")
|
@ApiModelProperty("结算币种")
|
||||||
private String settlementCurrency;
|
private String settlementCurrency;
|
||||||
|
@ApiModelProperty("业务员ID")
|
||||||
|
private String salesmanId;
|
||||||
|
|
||||||
|
@ApiModelProperty("业务员ID")
|
||||||
|
private String salesmanName;
|
||||||
|
@ApiModelProperty(value = "开票项目")
|
||||||
|
private String invoiceItem;
|
||||||
|
@ApiModelProperty(value = "开票项目名称")
|
||||||
|
private String invoiceItemName;
|
||||||
|
@ApiModelProperty(value = "费用类别")
|
||||||
|
private String feeType;
|
||||||
}
|
}
|
||||||
+44
-3
@@ -16,6 +16,8 @@ import com.mhd.bms.domain.billOperationLog.entity.BillOperationLog;
|
|||||||
import com.mhd.bms.domain.billOperationLog.repository.todo.BillOperationLogDO;
|
import com.mhd.bms.domain.billOperationLog.repository.todo.BillOperationLogDO;
|
||||||
import com.mhd.bms.domain.billOperationLog.service.BillOperationLogDomainService;
|
import com.mhd.bms.domain.billOperationLog.service.BillOperationLogDomainService;
|
||||||
import com.mhd.bms.domain.billingStatement.entity.BillingStatement;
|
import com.mhd.bms.domain.billingStatement.entity.BillingStatement;
|
||||||
|
import com.mhd.bms.domain.billingStatement.repository.mapper.BillingStatementMapper;
|
||||||
|
import com.mhd.bms.domain.billingStatement.repository.po.BillingStatementADDVO;
|
||||||
import com.mhd.bms.domain.billingStatement.repository.po.BillingStatementPO;
|
import com.mhd.bms.domain.billingStatement.repository.po.BillingStatementPO;
|
||||||
import com.mhd.bms.domain.billingStatement.repository.todo.BillingStatementDO;
|
import com.mhd.bms.domain.billingStatement.repository.todo.BillingStatementDO;
|
||||||
import com.mhd.bms.domain.billingStatement.service.BillingStatementDomainService;
|
import com.mhd.bms.domain.billingStatement.service.BillingStatementDomainService;
|
||||||
@@ -65,6 +67,8 @@ public class BillManageDomainService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private BillingStatementDomainService billingStatementDomainService;
|
private BillingStatementDomainService billingStatementDomainService;
|
||||||
@Autowired
|
@Autowired
|
||||||
|
private BillingStatementMapper billingStatementMapper;
|
||||||
|
@Autowired
|
||||||
private BillDetailDomainService billDetailDomainService;
|
private BillDetailDomainService billDetailDomainService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private SystemServiceFeign systemServiceFeign;
|
private SystemServiceFeign systemServiceFeign;
|
||||||
@@ -115,12 +119,20 @@ public class BillManageDomainService {
|
|||||||
/**
|
/**
|
||||||
* 保存账单
|
* 保存账单
|
||||||
*/
|
*/
|
||||||
public Boolean saveBill(List<BillingStatementPO> billingStatementPOS,String billingRemark,Date billCreateTime) {
|
public Boolean saveBill(List<BillingStatementPO> billingStatementPOS,String billingRemark,Date billCreateTime,BillingStatementDTO billingStatementDTO) {
|
||||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||||
if (ObjectUtil.isNull(loginUser)) {
|
if (ObjectUtil.isNull(loginUser)) {
|
||||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||||
}
|
}
|
||||||
|
BigDecimal taxAmount = billingStatementDTO.getTaxAmount(); // 获取税额
|
||||||
|
Double taxRate = billingStatementDTO.getTaxRate(); // 获取税率
|
||||||
|
BigDecimal taxFreeFee = billingStatementDTO.getTaxFreeFee(); // 获取税免金额
|
||||||
|
String settlementCurrency = billingStatementDTO.getSettlementCurrency(); // 获取结算币种
|
||||||
BillManage billManage = new BillManage();
|
BillManage billManage = new BillManage();
|
||||||
|
billManage.setTaxAmount(taxAmount);
|
||||||
|
billManage.setTaxRate(taxRate);
|
||||||
|
billManage.setTaxFreeFee(taxFreeFee);
|
||||||
|
billManage.setSettlementCurrency(settlementCurrency);
|
||||||
billManage.setCreateBy(loginUser.getUserPo().getUserId());
|
billManage.setCreateBy(loginUser.getUserPo().getUserId());
|
||||||
billManage.setCreateByName(loginUser.getUserPo().getUserName());
|
billManage.setCreateByName(loginUser.getUserPo().getUserName());
|
||||||
billManage.setCreateTime(billCreateTime==null ? new Date():billCreateTime);
|
billManage.setCreateTime(billCreateTime==null ? new Date():billCreateTime);
|
||||||
@@ -135,6 +147,8 @@ public class BillManageDomainService {
|
|||||||
billManage.setSettlementCustomersId(billingStatementPOS.get(0).getSettlementCustomersId());
|
billManage.setSettlementCustomersId(billingStatementPOS.get(0).getSettlementCustomersId());
|
||||||
billManage.setSettlementEntity(billingStatementPOS.get(0).getSettlementEntity());
|
billManage.setSettlementEntity(billingStatementPOS.get(0).getSettlementEntity());
|
||||||
billManage.setSettlementCustomersCode(billingStatementPOS.get(0).getSettlementCustomersCode());
|
billManage.setSettlementCustomersCode(billingStatementPOS.get(0).getSettlementCustomersCode());
|
||||||
|
billManage.setSalesmanId(billingStatementPOS.get(0).getSalesmanId());
|
||||||
|
billManage.setSalesmanName(billingStatementPOS.get(0).getSalesmanName());
|
||||||
billManage.setBillRemark(billingRemark);
|
billManage.setBillRemark(billingRemark);
|
||||||
//查询结算对象信息
|
//查询结算对象信息
|
||||||
SettlementCustomersPO settlementCustomersPO = settlementCustomersDomainService.getInfo(billingStatementPOS.get(0).getSettlementCustomersId());
|
SettlementCustomersPO settlementCustomersPO = settlementCustomersDomainService.getInfo(billingStatementPOS.get(0).getSettlementCustomersId());
|
||||||
@@ -181,6 +195,13 @@ public class BillManageDomainService {
|
|||||||
billDetail.setBillingTotalAmount(billingStatementPO.getBillingAmount());
|
billDetail.setBillingTotalAmount(billingStatementPO.getBillingAmount());
|
||||||
billDetail.setBillingAmount(billingStatementPO.getBillingAmount());
|
billDetail.setBillingAmount(billingStatementPO.getBillingAmount());
|
||||||
billDetail.setBillType(billingStatementPO.getAccountExpenseType());
|
billDetail.setBillType(billingStatementPO.getAccountExpenseType());
|
||||||
|
billDetail.setTaxAmount(billingStatementPO.getTaxAmount());
|
||||||
|
billDetail.setTaxRate(billingStatementPO.getTaxRate());
|
||||||
|
billDetail.setTaxFreeFee(billingStatementPO.getTaxFreeFee());
|
||||||
|
billDetail.setSettlementCurrency(billingStatementPO.getSettlementCurrency());
|
||||||
|
billDetail.setFeeType(billingStatementPO.getFeeType());
|
||||||
|
billDetail.setInvoiceItem(billingStatementPO.getInvoiceItem());
|
||||||
|
billDetail.setInvoiceItemName(billingStatementPO.getInvoiceItemName());
|
||||||
billDetailList.add(billDetail);
|
billDetailList.add(billDetail);
|
||||||
}
|
}
|
||||||
boolean flagTwo = billDetailDomainService.insertBatch(billDetailList);
|
boolean flagTwo = billDetailDomainService.insertBatch(billDetailList);
|
||||||
@@ -190,6 +211,15 @@ public class BillManageDomainService {
|
|||||||
billOperationLogDO.setOperationInfo(StringUtils.format(BillLogsConstants.create_bill_text, billManage.getBillNumber(), billManage.getBillTotalAmount()));
|
billOperationLogDO.setOperationInfo(StringUtils.format(BillLogsConstants.create_bill_text, billManage.getBillNumber(), billManage.getBillTotalAmount()));
|
||||||
billOperationLogDO.setOperationType(1);
|
billOperationLogDO.setOperationType(1);
|
||||||
boolean three = billOperationLogDomainService.saveBillOperationLog(billOperationLogDO);
|
boolean three = billOperationLogDomainService.saveBillOperationLog(billOperationLogDO);
|
||||||
|
//修改流水记录
|
||||||
|
billingStatementDTO.getBillingStatementList().forEach(billingStatementADDVO -> {
|
||||||
|
billingStatementMapper.update(null,
|
||||||
|
new LambdaUpdateWrapper<BillingStatement>().set(BillingStatement::getTaxAmount,billingStatementADDVO.getTaxAmount())
|
||||||
|
.set(BillingStatement::getTaxRate,billingStatementADDVO.getTaxRate())
|
||||||
|
.set(BillingStatement::getTaxFreeFee,billingStatementADDVO.getTaxFreeFee())
|
||||||
|
.set(BillingStatement::getSettlementCurrency,billingStatementADDVO.getSettlementCurrency())
|
||||||
|
.eq(BillingStatement::getBillingStatementId,billingStatementADDVO.getBillingStatementId()));
|
||||||
|
});
|
||||||
return flag && flagTwo && three;
|
return flag && flagTwo && three;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -208,11 +238,22 @@ public class BillManageDomainService {
|
|||||||
BillingStatementDO billingStatementDO = new BillingStatementDO();
|
BillingStatementDO billingStatementDO = new BillingStatementDO();
|
||||||
billingStatementDO.setBillingStatementIdSet(billingSet);
|
billingStatementDO.setBillingStatementIdSet(billingSet);
|
||||||
List<BillingStatementPO> billingStatementPOS = billingStatementDomainService.queryList(billingStatementDO);
|
List<BillingStatementPO> billingStatementPOS = billingStatementDomainService.queryList(billingStatementDO);
|
||||||
|
List<BillingStatementADDVO> billingStatementList = billingStatementDTO.getBillingStatementList();
|
||||||
|
for (BillingStatementPO billingStatementPO : billingStatementPOS) {
|
||||||
|
Long billingStatementId = billingStatementPO.getBillingStatementId();
|
||||||
|
BillingStatementADDVO billingStatementADDVO = billingStatementList.stream().filter(billingStatementADDVO1 -> billingStatementADDVO1.getBillingStatementId().equals(billingStatementId)).findFirst().orElse(null);
|
||||||
|
billingStatementPO.setTaxAmount(billingStatementADDVO.getTaxAmount()); // 设置税额
|
||||||
|
billingStatementPO.setTaxRate(billingStatementADDVO.getTaxRate()); // 设置税率
|
||||||
|
billingStatementPO.setTaxFreeFee(billingStatementADDVO.getTaxFreeFee()); // 设置税免金额
|
||||||
|
billingStatementPO.setSettlementCurrency(billingStatementADDVO.getSettlementCurrency());//设置结算币种
|
||||||
|
billingStatementPO.setFeeType(billingStatementADDVO.getFeeType());
|
||||||
|
billingStatementPO.setInvoiceItem(billingStatementADDVO.getInvoiceItem());
|
||||||
|
billingStatementPO.setInvoiceItemName(billingStatementADDVO.getInvoiceItemName());
|
||||||
|
}
|
||||||
if(billingStatementPOS==null || billingStatementPOS.size()==0){
|
if(billingStatementPOS==null || billingStatementPOS.size()==0){
|
||||||
throw new ServiceException("所选流水信息未找到");
|
throw new ServiceException("所选流水信息未找到");
|
||||||
}
|
}
|
||||||
return saveBill(billingStatementPOS,billingStatementDTO.getBillingRemark(),billingStatementDTO.getBillCreateTime());
|
return saveBill(billingStatementPOS,billingStatementDTO.getBillingRemark(),billingStatementDTO.getBillCreateTime(),billingStatementDTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+14
@@ -189,4 +189,18 @@ public class BillingStatement extends BaseVOEntity{
|
|||||||
|
|
||||||
@ApiModelProperty("业务单据记录id")
|
@ApiModelProperty("业务单据记录id")
|
||||||
private Long businessDocumentId;
|
private Long businessDocumentId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "无税费用")
|
||||||
|
private BigDecimal taxFreeFee;
|
||||||
|
@ApiModelProperty(value = "税额")
|
||||||
|
private BigDecimal taxAmount;
|
||||||
|
@ApiModelProperty(value = "税率")
|
||||||
|
private Double taxRate;
|
||||||
|
@ApiModelProperty("结算币种")
|
||||||
|
private String settlementCurrency;
|
||||||
|
@ApiModelProperty("业务员ID")
|
||||||
|
private String salesmanId;
|
||||||
|
|
||||||
|
@ApiModelProperty("业务员ID")
|
||||||
|
private String salesmanName;
|
||||||
}
|
}
|
||||||
+57
@@ -0,0 +1,57 @@
|
|||||||
|
package com.mhd.bms.domain.billingStatement.repository.po;
|
||||||
|
|
||||||
|
import com.mhd.common.core.annotation.Excel;
|
||||||
|
import lombok.Data;
|
||||||
|
import java.util.Date;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 计费流水对象 billing_statement
|
||||||
|
*
|
||||||
|
* @author gen
|
||||||
|
* @date 2024-06-26
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@ApiModel(value = "计费流水对象", description = "计费流水响应对象")
|
||||||
|
public class BillingStatementADDVO extends BaseVOEntity {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@ApiModelProperty("计费流水id")
|
||||||
|
private Long billingStatementId;
|
||||||
|
|
||||||
|
@ApiModelProperty("结算对象")
|
||||||
|
@Excel(name = "结算对象")
|
||||||
|
private String settlementEntity;
|
||||||
|
|
||||||
|
@ApiModelProperty("流水金额")
|
||||||
|
@Excel(name = "流水金额")
|
||||||
|
private BigDecimal billingAmount;
|
||||||
|
|
||||||
|
@ApiModelProperty("费用总额")
|
||||||
|
private BigDecimal billingTotalAmount;
|
||||||
|
|
||||||
|
@ApiModelProperty("账单优惠金额")
|
||||||
|
private BigDecimal billingDiscountAmount;
|
||||||
|
@ApiModelProperty(value = "无税费用")
|
||||||
|
private BigDecimal taxFreeFee;
|
||||||
|
@ApiModelProperty(value = "税额")
|
||||||
|
private BigDecimal taxAmount;
|
||||||
|
@ApiModelProperty(value = "税率")
|
||||||
|
private Double taxRate;
|
||||||
|
@ApiModelProperty("结算币种")
|
||||||
|
private String settlementCurrency;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "开票项目")
|
||||||
|
private String invoiceItem;
|
||||||
|
@ApiModelProperty(value = "开票项目名称")
|
||||||
|
private String invoiceItemName;
|
||||||
|
@ApiModelProperty(value = "费用类别")
|
||||||
|
private String feeType;
|
||||||
|
|
||||||
|
}
|
||||||
+19
@@ -194,6 +194,25 @@ public class BillingStatementPO extends BaseVOEntity{
|
|||||||
|
|
||||||
@ApiModelProperty("账单优惠金额")
|
@ApiModelProperty("账单优惠金额")
|
||||||
private BigDecimal billingDiscountAmount;
|
private BigDecimal billingDiscountAmount;
|
||||||
|
@ApiModelProperty(value = "无税费用")
|
||||||
|
private BigDecimal taxFreeFee;
|
||||||
|
@ApiModelProperty(value = "税额")
|
||||||
|
private BigDecimal taxAmount;
|
||||||
|
@ApiModelProperty(value = "税率")
|
||||||
|
private Double taxRate;
|
||||||
|
@ApiModelProperty("结算币种")
|
||||||
|
private String settlementCurrency;
|
||||||
|
@ApiModelProperty("业务员ID")
|
||||||
|
private String salesmanId;
|
||||||
|
|
||||||
|
@ApiModelProperty("业务员ID")
|
||||||
|
private String salesmanName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "开票项目")
|
||||||
|
private String invoiceItem;
|
||||||
|
@ApiModelProperty(value = "开票项目名称")
|
||||||
|
private String invoiceItemName;
|
||||||
|
@ApiModelProperty(value = "费用类别")
|
||||||
|
private String feeType;
|
||||||
|
|
||||||
}
|
}
|
||||||
+14
@@ -221,4 +221,18 @@ public class BillingStatementDO extends BaseVOEntity{
|
|||||||
|
|
||||||
@ApiModelProperty("业务单据记录id")
|
@ApiModelProperty("业务单据记录id")
|
||||||
private Long businessDocumentId;
|
private Long businessDocumentId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "无税费用")
|
||||||
|
private BigDecimal taxFreeFee;
|
||||||
|
@ApiModelProperty(value = "税额")
|
||||||
|
private BigDecimal taxAmount;
|
||||||
|
@ApiModelProperty(value = "税率")
|
||||||
|
private Double taxRate;
|
||||||
|
@ApiModelProperty("结算币种")
|
||||||
|
private String settlementCurrency;
|
||||||
|
@ApiModelProperty("业务员ID")
|
||||||
|
private String salesmanId;
|
||||||
|
|
||||||
|
@ApiModelProperty("业务员ID")
|
||||||
|
private String salesmanName;
|
||||||
}
|
}
|
||||||
+1
-1
@@ -351,7 +351,7 @@ public class BillingStatementDomainService {
|
|||||||
final Date billCreateTime = billingStatementDTO.getBillCreateTime();
|
final Date billCreateTime = billingStatementDTO.getBillCreateTime();
|
||||||
if(value.size()>0){
|
if(value.size()>0){
|
||||||
//生成账单
|
//生成账单
|
||||||
billManageDomainService.saveBill(value,billingRemark,billCreateTime);
|
billManageDomainService.saveBill(value,billingRemark,billCreateTime,billingStatementDTO);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
//修改流水状态
|
//修改流水状态
|
||||||
|
|||||||
+28
-14
@@ -150,10 +150,10 @@ public class BmsInvoiceListServiceImpl extends ServiceImpl<BmsInvoiceListMapper,
|
|||||||
if (null == sysUser) {
|
if (null == sysUser) {
|
||||||
throw new ServiceException("sysUser是空值!");
|
throw new ServiceException("sysUser是空值!");
|
||||||
}
|
}
|
||||||
if (StringUtils.isEmpty(bmsInvoiceListAddDTO.getInvoiceTitle())){
|
/*if (StringUtils.isEmpty(bmsInvoiceListAddDTO.getInvoiceTitle())){
|
||||||
throw new ServiceException("发票抬头不能为空!");
|
throw new ServiceException("发票抬头不能为空!");
|
||||||
}
|
}*/
|
||||||
|
bmsInvoiceListAddDTO.setInvoiceValue(bmsInvoiceListAddDTO.getBillAmount());
|
||||||
BmsInvoiceList bmsInvoiceList = new BmsInvoiceList(); // 销项发票表
|
BmsInvoiceList bmsInvoiceList = new BmsInvoiceList(); // 销项发票表
|
||||||
BeanUtils.copyProperties(bmsInvoiceListAddDTO, bmsInvoiceList);
|
BeanUtils.copyProperties(bmsInvoiceListAddDTO, bmsInvoiceList);
|
||||||
String createBy = sysUser.getId(); // 创建人ID
|
String createBy = sysUser.getId(); // 创建人ID
|
||||||
@@ -299,6 +299,11 @@ public class BmsInvoiceListServiceImpl extends ServiceImpl<BmsInvoiceListMapper,
|
|||||||
List<BmsMakeOutInvoice> bmsMakeOutInvoiceList=bmsMakeOutInvoiceMapper.selectList(new QueryWrapper<BmsMakeOutInvoice>().lambda()
|
List<BmsMakeOutInvoice> bmsMakeOutInvoiceList=bmsMakeOutInvoiceMapper.selectList(new QueryWrapper<BmsMakeOutInvoice>().lambda()
|
||||||
.eq(BmsMakeOutInvoice::getInvoiceId,id)
|
.eq(BmsMakeOutInvoice::getInvoiceId,id)
|
||||||
.eq(BmsMakeOutInvoice::getIsDelete,0));
|
.eq(BmsMakeOutInvoice::getIsDelete,0));
|
||||||
|
for (BmsMakeOutInvoice bmsMakeOutInvoice : bmsMakeOutInvoiceList) {
|
||||||
|
Long makeid = bmsMakeOutInvoice.getId();
|
||||||
|
List<BmsMakeOutInvoiceItem> bmsMakeOutInvoiceItemList = bmsMakeOutInvoiceItemMapper.selectList(new QueryWrapper<BmsMakeOutInvoiceItem>().lambda().eq(BmsMakeOutInvoiceItem::getMakeId, makeid));
|
||||||
|
bmsMakeOutInvoice.setBmsMakeOutInvoiceItems(bmsMakeOutInvoiceItemList);
|
||||||
|
}
|
||||||
bmsInvoiceListDetailsVO.setBmsMakeOutInvoices(bmsMakeOutInvoiceList);
|
bmsInvoiceListDetailsVO.setBmsMakeOutInvoices(bmsMakeOutInvoiceList);
|
||||||
return bmsInvoiceListDetailsVO;
|
return bmsInvoiceListDetailsVO;
|
||||||
}
|
}
|
||||||
@@ -337,25 +342,19 @@ public class BmsInvoiceListServiceImpl extends ServiceImpl<BmsInvoiceListMapper,
|
|||||||
//bmsInvoiceList.setUpdateBy(sysUser.getId());
|
//bmsInvoiceList.setUpdateBy(sysUser.getId());
|
||||||
bmsInvoiceList.setUpdateTime(date);
|
bmsInvoiceList.setUpdateTime(date);
|
||||||
bmsInvoiceList.setInvoiceMakeTime(date);
|
bmsInvoiceList.setInvoiceMakeTime(date);
|
||||||
List<BmsMakeOutInvoice> bmsMakeOutInvoices = bmsInvoiceListInvoiceStateDTO.getTmsMakeOutInvoices();
|
List<BmsMakeOutInvoice> bmsMakeOutInvoices = bmsInvoiceListInvoiceStateDTO.getBmsMakeOutInvoices();
|
||||||
if (bmsMakeOutInvoices == null) {
|
if (bmsMakeOutInvoices == null) {
|
||||||
throw new ServiceException("开票不得少于一张!");
|
throw new ServiceException("开票不得少于一张!");
|
||||||
}
|
}
|
||||||
bmsInvoiceList.setInvoiceState(2);
|
bmsInvoiceList.setInvoiceState(2);
|
||||||
|
|
||||||
for (BmsMakeOutInvoice bmsMakeOutInvoice : bmsMakeOutInvoices) {
|
for (BmsMakeOutInvoice bmsMakeOutInvoice : bmsMakeOutInvoices) {
|
||||||
/* if(StringUtils.isBlank(bmsMakeOutInvoice.getInvoiceCode())){
|
|
||||||
throw new ServiceException("所有发票的发票号码不得为空!");
|
|
||||||
}
|
|
||||||
if(StringUtils.isBlank(bmsMakeOutInvoice.getInvoiceNumber())){
|
|
||||||
throw new ServiceException("所有发票的发票号码不得为空!");
|
|
||||||
}*/
|
|
||||||
String invoiceNumber=bmsMakeOutInvoice.getInvoiceNumber();
|
String invoiceNumber=bmsMakeOutInvoice.getInvoiceNumber();
|
||||||
String invoiceCode=bmsMakeOutInvoice.getInvoiceCode();
|
String invoiceCode=bmsMakeOutInvoice.getInvoiceCode();
|
||||||
|
String invoiceAbstract=bmsMakeOutInvoice.getInvoiceAbstract();
|
||||||
BigDecimal invoiceValue=bmsMakeOutInvoice.getInvoiceValue();
|
BigDecimal invoiceValue=bmsMakeOutInvoice.getInvoiceValue();
|
||||||
BeanUtils.copyProperties(bmsInvoiceList, bmsMakeOutInvoice);
|
BeanUtils.copyProperties(bmsInvoiceList, bmsMakeOutInvoice,"id");
|
||||||
//bmsMakeOutInvoice.setId("");
|
|
||||||
//bmsMakeOutInvoice.setCreateBy(sysUser.getId());
|
|
||||||
bmsMakeOutInvoice.setCreateTime(date);
|
bmsMakeOutInvoice.setCreateTime(date);
|
||||||
bmsMakeOutInvoice.setInvoiceId(bmsInvoiceList.getId());
|
bmsMakeOutInvoice.setInvoiceId(bmsInvoiceList.getId());
|
||||||
bmsMakeOutInvoice.setMakeOutInvoiceId(sysUser.getId());
|
bmsMakeOutInvoice.setMakeOutInvoiceId(sysUser.getId());
|
||||||
@@ -363,7 +362,22 @@ public class BmsInvoiceListServiceImpl extends ServiceImpl<BmsInvoiceListMapper,
|
|||||||
bmsMakeOutInvoice.setInvoiceNumber(invoiceNumber);
|
bmsMakeOutInvoice.setInvoiceNumber(invoiceNumber);
|
||||||
bmsMakeOutInvoice.setInvoiceCode(invoiceCode);
|
bmsMakeOutInvoice.setInvoiceCode(invoiceCode);
|
||||||
bmsMakeOutInvoice.setInvoiceValue(invoiceValue);
|
bmsMakeOutInvoice.setInvoiceValue(invoiceValue);
|
||||||
bmsMakeOutInvoiceMapper.insert(bmsMakeOutInvoice);
|
bmsMakeOutInvoice.setInvoiceAbstract(invoiceAbstract);
|
||||||
|
if (bmsMakeOutInvoice.getId() == null) {
|
||||||
|
bmsMakeOutInvoiceMapper.insert(bmsMakeOutInvoice);
|
||||||
|
} else {
|
||||||
|
bmsMakeOutInvoiceMapper.updateById(bmsMakeOutInvoice);
|
||||||
|
}
|
||||||
|
List<BmsMakeOutInvoiceItem> bmsMakeOutInvoiceItems = bmsMakeOutInvoice.getBmsMakeOutInvoiceItems();
|
||||||
|
if (bmsMakeOutInvoiceItems != null && bmsMakeOutInvoiceItems.size() > 0) {
|
||||||
|
bmsMakeOutInvoiceItemMapper.delete(new QueryWrapper<BmsMakeOutInvoiceItem>().lambda().eq(BmsMakeOutInvoiceItem::getMakeId, bmsMakeOutInvoice.getId()));
|
||||||
|
for (BmsMakeOutInvoiceItem bmsMakeOutInvoiceItem : bmsMakeOutInvoiceItems) {
|
||||||
|
bmsMakeOutInvoiceItem.setMakeId(bmsMakeOutInvoice.getId());
|
||||||
|
//bmsMakeOutInvoiceItem.setCreateBy(sysUser.getId());
|
||||||
|
bmsMakeOutInvoiceItem.setCreateTime(date);
|
||||||
|
bmsMakeOutInvoiceItemMapper.insert(bmsMakeOutInvoiceItem);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Long id = bmsInvoiceList.getId();
|
Long id = bmsInvoiceList.getId();
|
||||||
List<BillManage> billManages = billManageMapper.selectList(new QueryWrapper<BillManage>().lambda().eq(BillManage::getInvoiceId, id.toString()));
|
List<BillManage> billManages = billManageMapper.selectList(new QueryWrapper<BillManage>().lambda().eq(BillManage::getInvoiceId, id.toString()));
|
||||||
|
|||||||
+4
@@ -66,6 +66,10 @@ public class BmsInvoiceListAddDTO implements Serializable {
|
|||||||
@Excel(name = "对账单id", width = 15)
|
@Excel(name = "对账单id", width = 15)
|
||||||
private Long billManageId;
|
private Long billManageId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "对账单金额")
|
||||||
|
@Excel(name = "对账单金额", width = 15)
|
||||||
|
private BigDecimal billAmount;
|
||||||
|
|
||||||
private List<BmsMakeOutInvoice> bmsMakeOutInvoices;
|
private List<BmsMakeOutInvoice> bmsMakeOutInvoices;
|
||||||
|
|
||||||
}
|
}
|
||||||
+1
-1
@@ -77,7 +77,7 @@ public class BmsInvoiceListInvoiceStateDTO implements Serializable {
|
|||||||
/**开票表集合*/
|
/**开票表集合*/
|
||||||
@ApiModelProperty(value = "开票表集合")
|
@ApiModelProperty(value = "开票表集合")
|
||||||
@Excel(name = "开票表集合", width = 15)
|
@Excel(name = "开票表集合", width = 15)
|
||||||
private List<BmsMakeOutInvoice> tmsMakeOutInvoices;
|
private List<BmsMakeOutInvoice> bmsMakeOutInvoices;
|
||||||
/**操作类型*/
|
/**操作类型*/
|
||||||
@ApiModelProperty(value = "操作类型(取消申请-0,驳回-1)")
|
@ApiModelProperty(value = "操作类型(取消申请-0,驳回-1)")
|
||||||
@Excel(name = "操作类型(取消申请-0,驳回-1)", width = 15)
|
@Excel(name = "操作类型(取消申请-0,驳回-1)", width = 15)
|
||||||
|
|||||||
@@ -133,4 +133,10 @@ public class BillDetailDTO extends BaseVOEntity{
|
|||||||
private Double taxRate;
|
private Double taxRate;
|
||||||
@ApiModelProperty("结算币种")
|
@ApiModelProperty("结算币种")
|
||||||
private String settlementCurrency;
|
private String settlementCurrency;
|
||||||
|
@ApiModelProperty(value = "开票项目")
|
||||||
|
private String invoiceItem;
|
||||||
|
@ApiModelProperty(value = "开票项目名称")
|
||||||
|
private String invoiceItemName;
|
||||||
|
@ApiModelProperty(value = "费用类别")
|
||||||
|
private String feeType;
|
||||||
}
|
}
|
||||||
@@ -262,4 +262,9 @@ public class BillManageDTO extends BaseVOEntity{
|
|||||||
private Double taxRate;
|
private Double taxRate;
|
||||||
@ApiModelProperty("结算币种")
|
@ApiModelProperty("结算币种")
|
||||||
private String settlementCurrency;
|
private String settlementCurrency;
|
||||||
|
@ApiModelProperty("业务员ID")
|
||||||
|
private String salesmanId;
|
||||||
|
|
||||||
|
@ApiModelProperty("业务员ID")
|
||||||
|
private String salesmanName;
|
||||||
}
|
}
|
||||||
+17
@@ -1,5 +1,6 @@
|
|||||||
package com.mhd.bms.interfaces.dto.billingStatement;
|
package com.mhd.bms.interfaces.dto.billingStatement;
|
||||||
|
|
||||||
|
import com.mhd.bms.domain.billingStatement.repository.po.BillingStatementADDVO;
|
||||||
import com.mhd.common.core.annotation.Excel;
|
import com.mhd.common.core.annotation.Excel;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
@@ -227,4 +228,20 @@ public class BillingStatementDTO extends BaseVOEntity{
|
|||||||
@ApiModelProperty("业务单据记录id")
|
@ApiModelProperty("业务单据记录id")
|
||||||
private Long businessDocumentId;
|
private Long businessDocumentId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "无税费用")
|
||||||
|
private BigDecimal taxFreeFee;
|
||||||
|
@ApiModelProperty(value = "税额")
|
||||||
|
private BigDecimal taxAmount;
|
||||||
|
@ApiModelProperty(value = "税率")
|
||||||
|
private Double taxRate;
|
||||||
|
@ApiModelProperty("结算币种")
|
||||||
|
private String settlementCurrency;
|
||||||
|
|
||||||
|
@ApiModelProperty("业务员ID")
|
||||||
|
private String salesmanId;
|
||||||
|
|
||||||
|
@ApiModelProperty("业务员ID")
|
||||||
|
private String salesmanName;
|
||||||
|
private List<BillingStatementADDVO> billingStatementList;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -298,10 +298,10 @@ public class BillManageApi extends BaseController{
|
|||||||
@Log(title = "应收账单应收单同步用户nc65", description = "应收账单应收单同步用户nc65", businessType = BusinessType.OTHER)
|
@Log(title = "应收账单应收单同步用户nc65", description = "应收账单应收单同步用户nc65", businessType = BusinessType.OTHER)
|
||||||
@ApiOperation("应收账单应收单同步用户nc65")
|
@ApiOperation("应收账单应收单同步用户nc65")
|
||||||
@GetMapping(value = "/synchronousNc")
|
@GetMapping(value = "/synchronousNc")
|
||||||
public AjaxResult synchronousNc(@RequestParam(name="reconciliationId") String reconciliationId)
|
public AjaxResult synchronousNc(@RequestParam(name="billManageId") String billManageId)
|
||||||
{
|
{
|
||||||
try{
|
try{
|
||||||
return AjaxResult.success(billManageApplicationService.synchronousNc(reconciliationId));}
|
return AjaxResult.success(billManageApplicationService.synchronousNc(billManageId));}
|
||||||
catch (Exception e){
|
catch (Exception e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return AjaxResult.error(e.getMessage());
|
return AjaxResult.error(e.getMessage());
|
||||||
@@ -314,10 +314,10 @@ public class BillManageApi extends BaseController{
|
|||||||
@Log(title = "应收账单收款单同步用户nc65", description = "应收账单收款单同步用户nc65", businessType = BusinessType.OTHER)
|
@Log(title = "应收账单收款单同步用户nc65", description = "应收账单收款单同步用户nc65", businessType = BusinessType.OTHER)
|
||||||
@ApiOperation("应收账单收款单同步用户nc65")
|
@ApiOperation("应收账单收款单同步用户nc65")
|
||||||
@GetMapping(value = "/synchronousNcSK")
|
@GetMapping(value = "/synchronousNcSK")
|
||||||
public AjaxResult synchronousNcSK(@RequestParam(name="reconciliationId") String reconciliationId)
|
public AjaxResult synchronousNcSK(@RequestParam(name="billManageId") String billManageId)
|
||||||
{
|
{
|
||||||
try{
|
try{
|
||||||
return AjaxResult.success(billManageApplicationService.synchronousNcSK(reconciliationId));
|
return AjaxResult.success(billManageApplicationService.synchronousNcSK(billManageId));
|
||||||
} catch (Exception e){
|
} catch (Exception e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return AjaxResult.error(e.getMessage());
|
return AjaxResult.error(e.getMessage());
|
||||||
|
|||||||
@@ -79,4 +79,29 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
|
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
|
|
||||||
|
<select id="getInvoiceItemName" parameterType="java.lang.String" resultType="java.lang.String">
|
||||||
|
select SUBJECT_NAME from "NGWL_TEST_SYSTEM".EXPENSE_ACCOUNT where status = 1 and SUBJECT_CODE = #{invoiceItemId} limit 1
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getCustomerCodeNc" parameterType="java.lang.String" resultType="java.lang.String">
|
||||||
|
SELECT CUSTOMER_NC_CODE FROM NGWL_TEST_USER."USER_SHIPPER" where del_flag = 1 and SHIPPER_ID = #{actualInvoiceCustomerId} limit 1
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getDocumentPreparerNcCode" parameterType="java.lang.String" resultType="java.lang.String">
|
||||||
|
SELECT DOCUMENT_PREPARER_NC_CODE FROM NGWL_TEST_USER."USER" where del_flag = 1 and user_id = #{salesmanId} limit 1
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getsalespersonNcCode" parameterType="java.lang.String" resultType="java.lang.String">
|
||||||
|
SELECT SALESPERSON_NC_CODE FROM NGWL_TEST_USER."USER" where del_flag = 1 and user_id = #{salesmanId} limit 1
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getSettlementCurrencyNcCode" parameterType="java.lang.String" resultType="java.lang.String">
|
||||||
|
SELECT NC_SYSTEM_CODE FROM NGWL_TEST_WLHY."TMS_SETTLEMENT_EXCHANGE_RATE" where IS_DELETE = '0' and ENGLISH_NAME = #{settlementCurrency} limit 1
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getServiceItemsCodeNc" parameterType="java.lang.String" resultType="java.lang.String">
|
||||||
|
SELECT SERVICE_ITEMS_CODE_NC FROM NGWL_TEST_SYSTEM."SERVICE_ITEMS_MANAGE" where DEL_FLAG = '0' and SERVICE_ITEMS_NAME = #{name} limit 1
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
+2
@@ -42,4 +42,6 @@ public interface ReconciliationMapper extends BaseMapper<Reconciliation>
|
|||||||
String getDocumentPreparerNcCode(@Param("salesmanId") String salesmanId);
|
String getDocumentPreparerNcCode(@Param("salesmanId") String salesmanId);
|
||||||
|
|
||||||
String getSettlementCurrencyNcCode(@Param("settlementCurrency") String settlementCurrency);
|
String getSettlementCurrencyNcCode(@Param("settlementCurrency") String settlementCurrency);
|
||||||
|
|
||||||
|
String getServiceItemsCodeNc(@Param("name") String name);
|
||||||
}
|
}
|
||||||
+9
-1
@@ -721,6 +721,7 @@ public class ReconciliationImpl extends ServiceImpl<ReconciliationMapper, Reconc
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
String invoiceItemName = String.join(",", names);
|
String invoiceItemName = String.join(",", names);
|
||||||
|
item.setDef29(invoiceItemName);
|
||||||
item.setScomment("业务部:应收"+appointShipper+invoiceItemName+invoiceNumber);
|
item.setScomment("业务部:应收"+appointShipper+invoiceItemName+invoiceNumber);
|
||||||
// item.setPk_currtype("CNY");
|
// item.setPk_currtype("CNY");
|
||||||
item.setPk_currtype(settlementCurrencyNcCode);
|
item.setPk_currtype(settlementCurrencyNcCode);
|
||||||
@@ -736,7 +737,14 @@ public class ReconciliationImpl extends ServiceImpl<ReconciliationMapper, Reconc
|
|||||||
item.setTax_de(String.valueOf(tax_de));
|
item.setTax_de(String.valueOf(tax_de));
|
||||||
item.setPrice(String.valueOf(item1.getInvoiceValue()));
|
item.setPrice(String.valueOf(item1.getInvoiceValue()));
|
||||||
item.setTaxprice(String.valueOf(item1.getInvoiceValue()));
|
item.setTaxprice(String.valueOf(item1.getInvoiceValue()));
|
||||||
item.setDef75("T10");
|
// 费用类别
|
||||||
|
String feeType = item1.getFeeType();
|
||||||
|
String serviceItemsCodeNc = reconciliationMapper.getServiceItemsCodeNc(feeType);
|
||||||
|
if (serviceItemsCodeNc != null && !serviceItemsCodeNc.isEmpty()) {
|
||||||
|
item.setDef75(serviceItemsCodeNc);
|
||||||
|
} else {
|
||||||
|
item.setDef75("T10");
|
||||||
|
}
|
||||||
item.setTaxcodeid("ZL01");
|
item.setTaxcodeid("ZL01");
|
||||||
item.setInvoiceno(invoiceNumber);
|
item.setInvoiceno(invoiceNumber);
|
||||||
ysitemList.add(item);
|
ysitemList.add(item);
|
||||||
|
|||||||
@@ -380,4 +380,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<select id="getSettlementCurrencyNcCode" parameterType="java.lang.String" resultType="java.lang.String">
|
<select id="getSettlementCurrencyNcCode" parameterType="java.lang.String" resultType="java.lang.String">
|
||||||
SELECT NC_SYSTEM_CODE FROM NGWL_TEST_WLHY."TMS_SETTLEMENT_EXCHANGE_RATE" where IS_DELETE = '0' and ENGLISH_NAME = #{settlementCurrency} limit 1
|
SELECT NC_SYSTEM_CODE FROM NGWL_TEST_WLHY."TMS_SETTLEMENT_EXCHANGE_RATE" where IS_DELETE = '0' and ENGLISH_NAME = #{settlementCurrency} limit 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getServiceItemsCodeNc" parameterType="java.lang.String" resultType="java.lang.String">
|
||||||
|
SELECT SERVICE_ITEMS_CODE_NC FROM NGWL_TEST_SYSTEM."SERVICE_ITEMS_MANAGE" where DEL_FLAG = '0' and SERVICE_ITEMS_NAME = #{name} limit 1
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
+33
-8
@@ -2,6 +2,7 @@ package com.mhd.wms.application.service.handoverTaskOrder;
|
|||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.conditions.update.LambdaUpdateChainWrapper;
|
import com.baomidou.mybatisplus.extension.conditions.update.LambdaUpdateChainWrapper;
|
||||||
@@ -32,6 +33,7 @@ import org.springframework.stereotype.Service;
|
|||||||
|
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 交接作业单ApplicationService
|
* 交接作业单ApplicationService
|
||||||
@@ -232,16 +234,39 @@ public class HandoverTaskOrderApplicationService {
|
|||||||
handoverTaskOrderDO.setOperatorsName(userPo.getUserName());
|
handoverTaskOrderDO.setOperatorsName(userPo.getUserName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PDA端上传图片并完成出库交接(参考PC端完成出库交接逻辑)
|
||||||
|
* 1. 保存图片到交接作业单、出库单
|
||||||
|
* 2. 执行库存扣减(xgkc)、交接单状态更新为已交接
|
||||||
|
*/
|
||||||
public void pictureApp(HandoverTaskOrderDO handoverTaskOrderDO) {
|
public void pictureApp(HandoverTaskOrderDO handoverTaskOrderDO) {
|
||||||
//pda上传图片插入交接作业单
|
String orderNumber = handoverTaskOrderDO.getOrderNumber();
|
||||||
|
if (orderNumber == null || orderNumber.trim().isEmpty()) {
|
||||||
|
throw new ServiceException("出库单号不能为空");
|
||||||
|
}
|
||||||
|
// 1. PDA上传图片插入交接作业单
|
||||||
handoverTaskOrderService.update(new LambdaUpdateWrapper<HandoverTaskOrder>()
|
handoverTaskOrderService.update(new LambdaUpdateWrapper<HandoverTaskOrder>()
|
||||||
.eq(HandoverTaskOrder::getOrderNumber,handoverTaskOrderDO.getOrderNumber())
|
.eq(HandoverTaskOrder::getOrderNumber, orderNumber)
|
||||||
.set(HandoverTaskOrder::getPictureApp,handoverTaskOrderDO.getPictureApp()));
|
.set(HandoverTaskOrder::getPictureApp, handoverTaskOrderDO.getPictureApp()));
|
||||||
//pda上传图片插入出库管理
|
// 2. PDA上传图片插入出库管理,状态改为已出库
|
||||||
stockOutOrderService.update(new LambdaUpdateWrapper<StockOutOrder>()
|
stockOutOrderService.update(new LambdaUpdateWrapper<StockOutOrder>()
|
||||||
.eq(StockOutOrder::getOutOrderNumber,handoverTaskOrderDO.getOrderNumber())
|
.eq(StockOutOrder::getOutOrderNumber, orderNumber)
|
||||||
.set(StockOutOrder::getStatus,"9")//设置为出库
|
.set(StockOutOrder::getStatus, "9")
|
||||||
.set(StockOutOrder::getPictureApp,handoverTaskOrderDO.getPictureApp())//多张图片以,逗号隔开
|
.set(StockOutOrder::getPictureApp, handoverTaskOrderDO.getPictureApp()));
|
||||||
);
|
// 3. 参考PC端完成交接:根据orderNumber查询交接单ID,执行库存扣减+交接状态更新
|
||||||
|
List<HandoverTaskOrder> handoverList = handoverTaskOrderService.list(
|
||||||
|
new LambdaQueryWrapper<HandoverTaskOrder>()
|
||||||
|
.eq(HandoverTaskOrder::getOrderNumber, orderNumber));
|
||||||
|
if (handoverList != null && !handoverList.isEmpty()) {
|
||||||
|
List<Long> handoverTaskOrderIds = handoverList.stream()
|
||||||
|
.map(HandoverTaskOrder::getHandoverTaskOrderId)
|
||||||
|
.filter(id -> id != null)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
if (!handoverTaskOrderIds.isEmpty()) {
|
||||||
|
HandoverTaskOrderDO completeDO = new HandoverTaskOrderDO();
|
||||||
|
completeDO.setHandoverTaskOrderIds(handoverTaskOrderIds);
|
||||||
|
handoverTaskOrderDomainService.completeHandover(completeDO);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user