Merge remote-tracking branch 'refs/remotes/origin/dev' into nanguangmall
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
package com.linke.finance.domain.ncLog.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.mhd.common.core.annotation.Excel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
import java.math.BigDecimal;
|
||||
import lombok.Data;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
|
||||
/**
|
||||
* 【请填写功能名称】对象 nc_log
|
||||
*
|
||||
* @author gen
|
||||
* @date 2025-12-04
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class NcLog extends BaseVOEntity{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("nc日志id")
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long ncLogId;
|
||||
|
||||
@ApiModelProperty("类型 0-应收单 1-收款单")
|
||||
@Excel(name = "类型 0-应收单 1-收款单")
|
||||
private Long type;
|
||||
|
||||
@ApiModelProperty("数据源id")
|
||||
@Excel(name = "数据源id")
|
||||
private Long orderId;
|
||||
|
||||
@ApiModelProperty("请求报文")
|
||||
@Excel(name = "请求报文")
|
||||
private String requestBody;
|
||||
|
||||
@ApiModelProperty("请求报文")
|
||||
@Excel(name = "请求报文")
|
||||
private String responeBody;
|
||||
|
||||
@ApiModelProperty("组织ID")
|
||||
@Excel(name = "组织ID")
|
||||
private Long organizationId;
|
||||
|
||||
@ApiModelProperty("一级组织ID")
|
||||
@Excel(name = "一级组织ID")
|
||||
private Long topOrganizationId;
|
||||
|
||||
@ApiModelProperty("组织名称")
|
||||
@Excel(name = "组织名称")
|
||||
private String organizationName;
|
||||
|
||||
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
package com.linke.finance.domain.ncLog.repository.facade;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.linke.finance.domain.ncLog.entity.NcLog;
|
||||
import com.linke.finance.domain.ncLog.repository.po.NcLogPO;
|
||||
import com.linke.finance.domain.ncLog.repository.todo.NcLogDO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 【请填写功能名称】Service接口
|
||||
*
|
||||
* @author gen
|
||||
* @date 2025-12-04
|
||||
*/
|
||||
public interface INcLogService extends IService<NcLog>
|
||||
{
|
||||
/**
|
||||
* 分页查询【请填写功能名称】列表
|
||||
*/
|
||||
public List<NcLogPO> queryList(NcLogDO ncLogDO);
|
||||
|
||||
/**
|
||||
* 新增【请填写功能名称】
|
||||
*/
|
||||
public Boolean insert(NcLogDO ncLogDO);
|
||||
|
||||
/**
|
||||
* 修改【请填写功能名称】
|
||||
*/
|
||||
public Boolean update(NcLogDO ncLogDO);
|
||||
|
||||
/**
|
||||
* 批量删除【请填写功能名称】
|
||||
*/
|
||||
public Boolean delete(Long[] ncLogIds);
|
||||
|
||||
|
||||
/**
|
||||
* 查询【请填写功能名称】
|
||||
*/
|
||||
public NcLogPO getInfo(Long ncLogId);
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
package com.linke.finance.domain.ncLog.repository.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.linke.finance.domain.ncLog.entity.NcLog;
|
||||
import com.linke.finance.domain.ncLog.repository.po.NcLogPO;
|
||||
import com.linke.finance.domain.ncLog.repository.todo.NcLogDO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
/**
|
||||
* 【请填写功能名称】Mapper接口
|
||||
*
|
||||
* @author gen
|
||||
* @date 2025-12-04
|
||||
*/
|
||||
public interface NcLogMapper extends BaseMapper<NcLog>
|
||||
{
|
||||
/**
|
||||
* 查询【请填写功能名称】列表
|
||||
*/
|
||||
public List<NcLogPO> queryList(NcLogDO ncLogDO);
|
||||
|
||||
}
|
||||
+81
@@ -0,0 +1,81 @@
|
||||
package com.linke.finance.domain.ncLog.repository.persistence;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.linke.finance.domain.ncLog.entity.NcLog;
|
||||
import com.linke.finance.domain.ncLog.repository.facade.INcLogService;
|
||||
import com.linke.finance.domain.ncLog.repository.mapper.NcLogMapper;
|
||||
import com.linke.finance.domain.ncLog.repository.po.NcLogPO;
|
||||
import com.linke.finance.domain.ncLog.repository.todo.NcLogDO;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 【请填写功能名称】Service业务层处理
|
||||
*
|
||||
* @author gen
|
||||
* @date 2025-12-04
|
||||
*/
|
||||
@Service
|
||||
public class NcLogImpl extends ServiceImpl<NcLogMapper, NcLog> implements INcLogService{
|
||||
@Autowired
|
||||
private NcLogMapper ncLogMapper;
|
||||
|
||||
/**
|
||||
* 查询【请填写功能名称】列表
|
||||
*/
|
||||
@Override
|
||||
public List<NcLogPO> queryList(NcLogDO ncLogDO)
|
||||
{
|
||||
return ncLogMapper.queryList(ncLogDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增【请填写功能名称】
|
||||
*/
|
||||
@Override
|
||||
public Boolean insert(NcLogDO ncLogDO) {
|
||||
NcLog ncLog = new NcLog();
|
||||
BeanUtils.copyProperties(ncLogDO,ncLog);
|
||||
return this.save(ncLog);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改【请填写功能名称】
|
||||
*/
|
||||
@Override
|
||||
public Boolean update(NcLogDO ncLogDO) {
|
||||
NcLog ncLog = new NcLog();
|
||||
BeanUtils.copyProperties(ncLogDO,ncLog);
|
||||
return this.updateById(ncLog);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除【请填写功能名称】
|
||||
*/
|
||||
@Override
|
||||
public Boolean delete(Long[] ncLogIds ) {
|
||||
List<NcLog> list = new ArrayList<>();
|
||||
for (Long id : ncLogIds) {
|
||||
NcLog ncLog = new NcLog();
|
||||
ncLog.setNcLogId(id);
|
||||
ncLog.setDelFlag(2);
|
||||
list.add(ncLog);
|
||||
}
|
||||
return this.updateBatchById(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改【请填写功能名称】
|
||||
*/
|
||||
@Override
|
||||
public NcLogPO getInfo(Long ncLogId) {
|
||||
NcLog ncLog = this.getById(ncLogId);
|
||||
NcLogPO ncLogPO = new NcLogPO();
|
||||
BeanUtils.copyProperties(ncLog,ncLogPO);
|
||||
return ncLogPO;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.linke.finance.domain.ncLog.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;
|
||||
|
||||
|
||||
/**
|
||||
* 【请填写功能名称】对象 nc_log
|
||||
*
|
||||
* @author gen
|
||||
* @date 2025-12-04
|
||||
*/
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "【请填写功能名称】对象", description = "【请填写功能名称】响应对象")
|
||||
public class NcLogPO extends BaseVOEntity{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("nc日志id")
|
||||
private Long ncLogId;
|
||||
|
||||
@ApiModelProperty("类型 0-应收单 1-收款单")
|
||||
@Excel(name = "类型 0-应收单 1-收款单")
|
||||
private Long type;
|
||||
|
||||
@ApiModelProperty("数据源id")
|
||||
@Excel(name = "数据源id")
|
||||
private Long orderId;
|
||||
|
||||
@ApiModelProperty("请求报文")
|
||||
@Excel(name = "请求报文")
|
||||
private String requestBody;
|
||||
|
||||
@ApiModelProperty("请求报文")
|
||||
@Excel(name = "请求报文")
|
||||
private String responeBody;
|
||||
|
||||
@ApiModelProperty("组织ID")
|
||||
@Excel(name = "组织ID")
|
||||
private Long organizationId;
|
||||
|
||||
@ApiModelProperty("一级组织ID")
|
||||
@Excel(name = "一级组织ID")
|
||||
private Long topOrganizationId;
|
||||
|
||||
@ApiModelProperty("组织名称")
|
||||
@Excel(name = "组织名称")
|
||||
private String organizationName;
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.linke.finance.domain.ncLog.repository.todo;
|
||||
|
||||
import com.mhd.common.core.annotation.Excel;
|
||||
import lombok.Data;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import java.math.BigDecimal;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 【请填写功能名称】对象 nc_log
|
||||
*
|
||||
* @author gen
|
||||
* @date 2025-12-04
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class NcLogDO extends BaseVOEntity{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("nc日志id")
|
||||
private Long ncLogId;
|
||||
|
||||
@ApiModelProperty("类型 0-应收单 1-收款单")
|
||||
@Excel(name = "类型 0-应收单 1-收款单")
|
||||
private Long type;
|
||||
|
||||
@ApiModelProperty("数据源id")
|
||||
@Excel(name = "数据源id")
|
||||
private Long orderId;
|
||||
|
||||
@ApiModelProperty("请求报文")
|
||||
@Excel(name = "请求报文")
|
||||
private String requestBody;
|
||||
|
||||
@ApiModelProperty("请求报文")
|
||||
@Excel(name = "请求报文")
|
||||
private String responeBody;
|
||||
|
||||
@ApiModelProperty("组织ID")
|
||||
@Excel(name = "组织ID")
|
||||
private Long organizationId;
|
||||
|
||||
@ApiModelProperty("一级组织ID")
|
||||
@Excel(name = "一级组织ID")
|
||||
private Long topOrganizationId;
|
||||
|
||||
@ApiModelProperty("组织名称")
|
||||
@Excel(name = "组织名称")
|
||||
private String organizationName;
|
||||
|
||||
@ApiModelProperty(name = "组织ID集合")
|
||||
private List<Long> organizationIdList;
|
||||
|
||||
@ApiModelProperty(name = "权限菜单ID")
|
||||
private Long permissionMenuId;
|
||||
}
|
||||
+64
@@ -0,0 +1,64 @@
|
||||
package com.linke.finance.domain.ncLog.service;
|
||||
|
||||
import com.linke.finance.domain.ncLog.repository.facade.INcLogService;
|
||||
import com.linke.finance.domain.ncLog.repository.po.NcLogPO;
|
||||
import com.linke.finance.domain.ncLog.repository.todo.NcLogDO;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
/**
|
||||
* 【请填写功能名称】
|
||||
*
|
||||
* @author gen
|
||||
* @date 2025-12-04
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class NcLogDomainService {
|
||||
|
||||
@Autowired
|
||||
private INcLogService ncLogService;
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询【请填写功能名称】列表
|
||||
*/
|
||||
public List<NcLogPO> queryList(NcLogDO ncLogDO) {
|
||||
return ncLogService.queryList(ncLogDO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增【请填写功能名称】
|
||||
*/
|
||||
public Boolean insert(NcLogDO ncLogDO) {
|
||||
|
||||
return ncLogService.insert(ncLogDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改【请填写功能名称】
|
||||
*/
|
||||
public Boolean update(NcLogDO ncLogDO) {
|
||||
return ncLogService.update(ncLogDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除【请填写功能名称】
|
||||
*/
|
||||
public Boolean delete(Long[] ncLogIds) {
|
||||
return ncLogService.delete(ncLogIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取【请填写功能名称】详细信息
|
||||
*/
|
||||
public NcLogPO getInfo(Long ncLogId)
|
||||
{
|
||||
return ncLogService.getInfo(ncLogId);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+24
@@ -218,4 +218,28 @@ public class Reconciliation extends BaseVOEntity{
|
||||
|
||||
@ApiModelProperty(value = "申请发票单号")
|
||||
private String applyNumber;
|
||||
|
||||
@ApiModelProperty("nc同步状态 0-未同步 1-已同步")
|
||||
private Integer synchronousStatus;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "nc同步时间")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private java.util.Date synchronousTime;
|
||||
|
||||
@ApiModelProperty(value = "nc唯一标识")
|
||||
private String ncId;
|
||||
|
||||
@ApiModelProperty("nc同步状态 0-未同步 1-已同步")
|
||||
private Integer skSynchronousStatus;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "nc同步时间")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private java.util.Date skSynchronousTime;
|
||||
|
||||
@ApiModelProperty(value = "nc唯一标识")
|
||||
private String skNcId;
|
||||
}
|
||||
|
||||
+4
@@ -62,5 +62,9 @@ public interface IReconciliationService extends IService<Reconciliation>
|
||||
|
||||
public StartProcessInstanceResponse workflowProcessInstances(String businessDocumentDetaliIds);
|
||||
|
||||
public boolean synchronousNc(String businessDocumentDetaliIds);
|
||||
|
||||
public boolean synchronousNcSK(String businessDocumentDetaliIds);
|
||||
|
||||
public int editIsInvoice(String innerNumber, Integer isInvoice, String invoiceId, String invoiceMakeTime,String applyNumber);
|
||||
}
|
||||
|
||||
+394
@@ -14,13 +14,20 @@ import com.linke.finance.domain.approvalDocument.repository.mapper.ApprovalDocum
|
||||
import com.linke.finance.domain.approvalDocument.service.ApprovalDocumentDomainService;
|
||||
import com.linke.finance.domain.businessDocument.entity.BusinessDocument;
|
||||
import com.linke.finance.domain.businessDocumentDetali.entity.BusinessDocumentDetali;
|
||||
import com.linke.finance.domain.ncLog.entity.NcLog;
|
||||
import com.linke.finance.domain.ncLog.repository.mapper.NcLogMapper;
|
||||
import com.linke.finance.domain.reconciliation.entity.Reconciliation;
|
||||
import com.linke.finance.domain.reconciliation.entity.ReconciliationBusinessDocument;
|
||||
import com.linke.finance.domain.reconciliation.repository.facade.IReconciliationService;
|
||||
import com.linke.finance.domain.reconciliation.repository.mapper.ReconciliationMapper;
|
||||
import com.linke.finance.domain.reconciliation.repository.po.ReconciliationPO;
|
||||
import com.linke.finance.domain.reconciliation.repository.todo.ReconciliationDO;
|
||||
import com.mhd.common.core.domain.dto.ReconciliationDTO;
|
||||
import com.mhd.common.core.domain.dto.nc.*;
|
||||
import com.mhd.common.core.domain.entity.R;
|
||||
import com.mhd.common.core.domain.entity.TmsOrder;
|
||||
import com.mhd.common.core.domain.po.UserPo;
|
||||
import com.mhd.common.core.domain.po.UserShipperPo;
|
||||
import com.mhd.common.core.domain.thirdparty.dingtalk.DetailsDTO;
|
||||
import com.mhd.common.core.domain.thirdparty.dingtalk.FormComponentValuesDTO;
|
||||
import com.mhd.common.core.domain.thirdparty.dingtalk.WorkflowProcessInstancesDTO;
|
||||
@@ -30,12 +37,26 @@ import com.mhd.common.core.utils.StringUtils;
|
||||
import com.mhd.common.core.web.domain.AjaxResult;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.UserServiceFeign;
|
||||
import com.mhd.system.api.WlhyServiceFeign;
|
||||
import com.mhd.system.api.domain.TmsTransportNote;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import org.apache.http.client.methods.CloseableHttpResponse;
|
||||
import org.apache.http.client.methods.HttpPost;
|
||||
import org.apache.http.entity.StringEntity;
|
||||
import org.apache.http.impl.client.CloseableHttpClient;
|
||||
import org.apache.http.impl.client.HttpClients;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.xml.bind.JAXBContext;
|
||||
import javax.xml.bind.JAXBException;
|
||||
import javax.xml.bind.Marshaller;
|
||||
import java.io.IOException;
|
||||
import java.io.StringWriter;
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.NClob;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
@@ -53,15 +74,22 @@ import java.util.Map;
|
||||
public class ReconciliationImpl extends ServiceImpl<ReconciliationMapper, Reconciliation> implements IReconciliationService{
|
||||
@Autowired
|
||||
private ReconciliationMapper reconciliationMapper;
|
||||
|
||||
@Autowired
|
||||
private NcLogMapper ncLogMapper;
|
||||
@Autowired
|
||||
private UserServiceFeign userServiceFeign;
|
||||
@Autowired
|
||||
private ThirdPartyServiceFeign thirdPartyServiceFeign;
|
||||
|
||||
@Autowired
|
||||
private WlhyServiceFeign wlhyServiceFeign;
|
||||
|
||||
@Autowired
|
||||
private ApprovalDocumentMapper approvalDocumentMapper;
|
||||
@Autowired
|
||||
private ApprovalDocumentDomainService approvalDocumentDomainService;
|
||||
private String url="http://10.0.0.212/service/XChangeServlet?account=NKNC&groupcode=CNK";
|
||||
/**
|
||||
* 查询对账单列表
|
||||
*/
|
||||
@@ -354,4 +382,370 @@ public class ReconciliationImpl extends ServiceImpl<ReconciliationMapper, Reconc
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean synchronousNc(String businessDocumentDetaliIds) {
|
||||
String [] businessDocumentDetaliIdArray=businessDocumentDetaliIds.split(",");
|
||||
LoginUser loginUser= SecurityUtils.getLoginUser();
|
||||
UserPo userPo=loginUser.getUserPo();
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
AjaxResult ajaxResult5=userServiceFeign.getInfo(loginUser.getUserid());
|
||||
if(ajaxResult5.get("code").toString().equals("200")){
|
||||
Object userShipperPo= ajaxResult5.get("data");
|
||||
JSONObject jsonObject = new JSONObject((Map) userShipperPo);
|
||||
|
||||
try {
|
||||
String jsonString = mapper.writeValueAsString(jsonObject);
|
||||
userPo = mapper.readValue(jsonString, UserPo.class);
|
||||
} catch (JsonProcessingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}else{
|
||||
throw new ServiceException("查询当前登录人用户信息失败");
|
||||
}
|
||||
if (org.apache.commons.lang.StringUtils.isBlank(userPo.getSalespersonNcCode())) {
|
||||
throw new ServiceException("请先维护业务员编码");
|
||||
}
|
||||
if (org.apache.commons.lang.StringUtils.isBlank(userPo.getDocumentPreparerNcCode())) {
|
||||
throw new ServiceException("请先维护制单员编码");
|
||||
}
|
||||
for (String businessDocumentDetaliId:businessDocumentDetaliIdArray){
|
||||
Reconciliation reconciliation=reconciliationMapper.selectById(businessDocumentDetaliId);
|
||||
if(reconciliation.getSynchronousStatus()==1){
|
||||
throw new ServiceException("该记录已同步,不需要再次同步");
|
||||
}
|
||||
|
||||
|
||||
/* if(reconciliation.getIsInvoice()!=2){
|
||||
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);
|
||||
List<Ysitem> ysitemList=new ArrayList<Ysitem>();
|
||||
ReconciliationDTO reconciliationDTO=new ReconciliationDTO();
|
||||
reconciliationDTO.setInnerNumber(reconciliation.getInnerNumber());
|
||||
R<List<TmsOrder>> result=wlhyServiceFeign.getOrderListByReconciliation(reconciliationDTO);
|
||||
if(result.getCode()==200){
|
||||
List<TmsOrder> list=result.getData();
|
||||
if(ObjectUtil.isNotNull(list)){
|
||||
for(TmsOrder tmsOrder:list){
|
||||
R<TmsTransportNote> ajaxResult1=wlhyServiceFeign.selectByOrderNum(tmsOrder.getGoodsNumber());
|
||||
if(ajaxResult1.getCode()==200){
|
||||
TmsTransportNote tmsTransportNote= ajaxResult1.getData();
|
||||
if(ObjectUtil.isNotNull(tmsTransportNote.getIsPaper())){
|
||||
date=tmsTransportNote.getConfirmReceiptTime();
|
||||
dateString = sdf.format(date);
|
||||
}else{
|
||||
throw new ServiceException("运单还没签收, 先签收");
|
||||
}
|
||||
}
|
||||
if(null==reconciliation.getSettlementPartyId()){
|
||||
throw new ServiceException("没有结算方,请核对");
|
||||
}
|
||||
AjaxResult ajaxResult=userServiceFeign.getShipperSummaryData(Long.valueOf(reconciliation.getSettlementPartyId()));
|
||||
if(ajaxResult.get("code").toString().equals("200")){
|
||||
Object userShipperPo= ajaxResult.get("data");
|
||||
JSONObject jsonObject = new JSONObject((Map) userShipperPo);
|
||||
if(org.apache.commons.lang.StringUtils.isBlank(jsonObject.get("customerNcCode").toString())){
|
||||
throw new ServiceException("请先维护客户编码");
|
||||
}
|
||||
Ysitem item=new Ysitem();
|
||||
item.setSo_deptid("NG040104");
|
||||
item.setPk_deptid("NG040104");
|
||||
item.setPk_psndoc(userPo.getSalespersonNcCode());
|
||||
item.setCustomer(jsonObject.get("customerNcCode").toString());
|
||||
item.setObjtype("0");
|
||||
item.setDirection("1");
|
||||
item.setScomment(jsonObject.get("shipperEnterpriseName").toString());
|
||||
item.setPk_currtype("CNY");
|
||||
item.setPurchaseorder(tmsOrder.getGoodsNumber());
|
||||
item.setTaxrate("0");
|
||||
item.setQuantity_de("0");
|
||||
item.setMoney_de(String.valueOf(tmsOrder.getDeliveryFreight()));
|
||||
item.setMoney_bal(String.valueOf(tmsOrder.getDeliveryFreight()));
|
||||
item.setNotax_de(String.valueOf(tmsOrder.getDeliveryFreight()));
|
||||
item.setLocal_tax_de(String.valueOf(tmsOrder.getDeliveryFreight()));
|
||||
item.setTax_de(String.valueOf(tmsOrder.getDeliveryFreight()));
|
||||
item.setPrice(String.valueOf(tmsOrder.getDeliveryFreight()));
|
||||
item.setTaxprice(String.valueOf(tmsOrder.getDeliveryFreight()));
|
||||
item.setDef75("T10");
|
||||
item.setInvoiceno("");
|
||||
ysitemList.add(item);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Ysbodys bodys=new Ysbodys();
|
||||
bodys.setItem(ysitemList);
|
||||
Ysbillhead billhead=new Ysbillhead();
|
||||
billhead.setPk_group("CNK");
|
||||
billhead.setPk_org("NG0401");
|
||||
billhead.setSett_org("NG0401");
|
||||
billhead.setCreationtime(dateString);
|
||||
billhead.setCreator(userPo.getDocumentPreparerNcCode());
|
||||
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(userPo.getDocumentPreparerNcCode());
|
||||
billhead.setPk_busitype("");
|
||||
billhead.setBillyear(sdf1.format(date));
|
||||
billhead.setBillperiod(sdf2.format(date));
|
||||
billhead.setEffectstatus("0");
|
||||
billhead.setDef28("nqyw");
|
||||
billhead.setDef29(reconciliation.getInnerNumber());
|
||||
billhead.setBodys(bodys);
|
||||
Ysbill bill=new Ysbill();
|
||||
bill.setId("ys"+String.valueOf(reconciliation.getReconciliationId()));
|
||||
bill.setBillhead(billhead);
|
||||
Ysufinterface ufinterface=new Ysufinterface();
|
||||
ufinterface.setAccount("NKNC");
|
||||
ufinterface.setBilltype("F0");
|
||||
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 = 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.getReconciliationId());
|
||||
ncLog.setRequestBody(xmlString);
|
||||
ncLog.setResponeBody("");
|
||||
ncLog.setType(0L);
|
||||
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.getReconciliationId()));
|
||||
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);
|
||||
response.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
try {
|
||||
httpClient.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
} catch (JAXBException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean synchronousNcSK(String businessDocumentDetaliIds) {
|
||||
String [] businessDocumentDetaliIdArray=businessDocumentDetaliIds.split(",");
|
||||
LoginUser loginUser= SecurityUtils.getLoginUser();
|
||||
UserPo userPo=loginUser.getUserPo();
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
AjaxResult ajaxResult5=userServiceFeign.getInfo(loginUser.getUserid());
|
||||
if(ajaxResult5.get("code").toString().equals("200")){
|
||||
Object userShipperPo= ajaxResult5.get("data");
|
||||
JSONObject jsonObject = new JSONObject((Map) userShipperPo);
|
||||
|
||||
try {
|
||||
String jsonString = mapper.writeValueAsString(jsonObject);
|
||||
userPo = mapper.readValue(jsonString, UserPo.class);
|
||||
} catch (JsonProcessingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}else{
|
||||
throw new ServiceException("查询当前登录人用户信息失败");
|
||||
}
|
||||
if (org.apache.commons.lang.StringUtils.isBlank(userPo.getSalespersonNcCode())) {
|
||||
throw new ServiceException("请先维护业务员编码");
|
||||
}
|
||||
if (org.apache.commons.lang.StringUtils.isBlank(userPo.getDocumentPreparerNcCode())) {
|
||||
throw new ServiceException("请先维护制单员编码");
|
||||
}
|
||||
for (String businessDocumentDetaliId:businessDocumentDetaliIdArray){
|
||||
Reconciliation reconciliation=reconciliationMapper.selectById(businessDocumentDetaliId);
|
||||
if(reconciliation.getSkSynchronousStatus()==1){
|
||||
throw new ServiceException("该记录已同步,不需要再次同步");
|
||||
}
|
||||
/* if(reconciliation.getIsInvoice()!=2){
|
||||
throw new ServiceException("该记录还未开票,不允许同步");
|
||||
}*/
|
||||
if(reconciliation.getCollectionState()!=2){
|
||||
throw new ServiceException("该记录还未结算完成,不允许同步");
|
||||
}
|
||||
/* if(org.apache.commons.lang.StringUtils.isBlank(userPo.getSalespersonNcCode())){
|
||||
throw new ServiceException("请先维护业务员编码");
|
||||
}
|
||||
if(org.apache.commons.lang.StringUtils.isBlank(userPo.getDocumentPreparerNcCode())){
|
||||
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);
|
||||
List<SKitem> ysitemList=new ArrayList<SKitem>();
|
||||
ReconciliationDTO reconciliationDTO=new ReconciliationDTO();
|
||||
reconciliationDTO.setInnerNumber(reconciliation.getInnerNumber());
|
||||
R<List<TmsOrder>> result=wlhyServiceFeign.getOrderListByReconciliation(reconciliationDTO);
|
||||
if(result.getCode()==200){
|
||||
List<TmsOrder> list=result.getData();
|
||||
if(ObjectUtil.isNotNull(list)){
|
||||
for(TmsOrder tmsOrder:list){
|
||||
if(null==reconciliation.getSettlementPartyId()){
|
||||
throw new ServiceException("没有结算方,请核对");
|
||||
}
|
||||
AjaxResult ajaxResult=userServiceFeign.getShipperSummaryData(Long.valueOf(reconciliation.getSettlementPartyId()));
|
||||
if(ajaxResult.get("code").toString().equals("200")){
|
||||
Object userShipperPo= ajaxResult.get("data");
|
||||
JSONObject jsonObject = new JSONObject((Map) userShipperPo);
|
||||
if(org.apache.commons.lang.StringUtils.isBlank(jsonObject.get("customerNcCode").toString())){
|
||||
throw new ServiceException("请先维护客户编码");
|
||||
}
|
||||
SKitem item=new SKitem();
|
||||
item.setSo_deptid("NG040104");
|
||||
item.setPk_deptid("NG040104");
|
||||
item.setCheckdirection("ar");
|
||||
item.setPk_psndoc(userPo.getSalespersonNcCode());
|
||||
item.setCustomer(jsonObject.get("customerNcCode").toString());
|
||||
item.setPurchaseorder(tmsOrder.getGoodsNumber());
|
||||
item.setObjtype("0");
|
||||
item.setDirection("1");
|
||||
item.setScomment(jsonObject.get("shipperEnterpriseName").toString());
|
||||
item.setPk_currtype("CNY");
|
||||
item.setMoney_cr(String.valueOf(tmsOrder.getCollectedFreight()));
|
||||
item.setMoney_bal(String.valueOf(tmsOrder.getCollectedFreight()));
|
||||
ysitemList.add(item);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
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(userPo.getDocumentPreparerNcCode());
|
||||
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(userPo.getDocumentPreparerNcCode());
|
||||
billhead.setPk_busitype("");
|
||||
billhead.setBillyear(sdf1.format(date));
|
||||
billhead.setBillperiod(sdf2.format(date));
|
||||
billhead.setEffectstatus("0");
|
||||
billhead.setDef28("nqyw");
|
||||
billhead.setDef29(reconciliation.getInnerNumber());
|
||||
billhead.setBodys(bodys);
|
||||
SKbill bill=new SKbill();
|
||||
bill.setId("sk"+String.valueOf(reconciliation.getReconciliationId()));
|
||||
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.getReconciliationId());
|
||||
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.getReconciliationId()));
|
||||
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);
|
||||
response.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
try {
|
||||
httpClient.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
} catch (JAXBException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
+23
@@ -214,5 +214,28 @@ public class ReconciliationPO extends BaseVOEntity{
|
||||
|
||||
@ApiModelProperty(value = "申请发票单号")
|
||||
private String applyNumber;
|
||||
@ApiModelProperty("nc同步状态 0-未同步 1-已同步")
|
||||
private Integer synchronousStatus;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "nc同步时间")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private java.util.Date synchronousTime;
|
||||
|
||||
@ApiModelProperty(value = "nc唯一标识")
|
||||
private String ncId;
|
||||
|
||||
@ApiModelProperty("nc同步状态 0-未同步 1-已同步")
|
||||
private Integer skSynchronousStatus;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "nc同步时间")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private java.util.Date skSynchronousTime;
|
||||
|
||||
@ApiModelProperty(value = "nc唯一标识")
|
||||
private String skNcId;
|
||||
|
||||
}
|
||||
|
||||
+24
@@ -246,4 +246,28 @@ public class ReconciliationDO extends BaseVOEntity{
|
||||
|
||||
@ApiModelProperty(value = "申请发票单号")
|
||||
private String applyNumber;
|
||||
|
||||
@ApiModelProperty("nc同步状态 0-未同步 1-已同步")
|
||||
private Integer synchronousStatus;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "nc同步时间")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private java.util.Date synchronousTime;
|
||||
|
||||
@ApiModelProperty(value = "nc唯一标识")
|
||||
private String ncId;
|
||||
|
||||
@ApiModelProperty("nc同步状态 0-未同步 1-已同步")
|
||||
private Integer skSynchronousStatus;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "nc同步时间")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private java.util.Date skSynchronousTime;
|
||||
|
||||
@ApiModelProperty(value = "nc唯一标识")
|
||||
private String skNcId;
|
||||
}
|
||||
|
||||
+10
@@ -157,6 +157,16 @@ public class ReconciliationDomainService {
|
||||
return reconciliationService.workflowProcessInstances(businessDocumentDetaliIds);
|
||||
}
|
||||
|
||||
public boolean synchronousNc(String businessDocumentDetaliIds)
|
||||
{
|
||||
return reconciliationService.synchronousNc(businessDocumentDetaliIds);
|
||||
}
|
||||
|
||||
public boolean synchronousNcSK(String businessDocumentDetaliIds)
|
||||
{
|
||||
return reconciliationService.synchronousNcSK(businessDocumentDetaliIds);
|
||||
}
|
||||
|
||||
public int editIsInvoice(String innerNumber, Integer isInvoice, String invoiceId, String invoiceMakeTime,String applyNumber)
|
||||
{
|
||||
return reconciliationService.editIsInvoice(innerNumber,isInvoice,invoiceId,invoiceMakeTime,applyNumber);
|
||||
|
||||
+11
-1
@@ -9,11 +9,12 @@ import java.math.BigDecimal;
|
||||
import lombok.Data;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
|
||||
/**
|
||||
* 收款单对象 tms_receipt
|
||||
*
|
||||
*
|
||||
* @author gen
|
||||
* @date 2025-04-28
|
||||
*/
|
||||
@@ -105,4 +106,13 @@ public class TmsReceipt extends BaseVOEntity{
|
||||
private Integer delFlag;
|
||||
|
||||
|
||||
@ApiModelProperty("nc同步状态 0-未同步 1-已同步")
|
||||
private Integer synchronousStatus;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "nc同步时间")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private java.util.Date synchronousTime;
|
||||
|
||||
}
|
||||
|
||||
+3
-1
@@ -9,7 +9,7 @@ import java.util.List;
|
||||
|
||||
/**
|
||||
* 收款单Service接口
|
||||
*
|
||||
*
|
||||
* @author gen
|
||||
* @date 2025-04-28
|
||||
*/
|
||||
@@ -42,4 +42,6 @@ public interface ITmsReceiptService extends IService<TmsReceipt>
|
||||
public TmsReceiptPO getInfo(Long id);
|
||||
|
||||
public int updateAssignableAmount(TmsReceiptPO receiptPo);
|
||||
|
||||
public boolean synchronousNc(String businessDocumentDetaliIds);
|
||||
}
|
||||
|
||||
+117
-1
@@ -1,23 +1,35 @@
|
||||
package com.linke.finance.domain.tmsReceipt.repository.persistence;
|
||||
|
||||
import com.aliyun.oss.ServiceException;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.linke.finance.domain.ncLog.entity.NcLog;
|
||||
import com.linke.finance.domain.ncLog.repository.mapper.NcLogMapper;
|
||||
import com.linke.finance.domain.reconciliation.entity.Reconciliation;
|
||||
import com.linke.finance.domain.tmsReceipt.entity.TmsReceipt;
|
||||
import com.linke.finance.domain.tmsReceipt.repository.facade.ITmsReceiptService;
|
||||
import com.linke.finance.domain.tmsReceipt.repository.mapper.TmsReceiptMapper;
|
||||
import com.linke.finance.domain.tmsReceipt.repository.po.TmsReceiptPO;
|
||||
import com.linke.finance.domain.tmsReceipt.repository.todo.TmsReceiptDO;
|
||||
import com.mhd.common.core.domain.dto.nc.*;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.xml.bind.JAXBContext;
|
||||
import javax.xml.bind.JAXBException;
|
||||
import javax.xml.bind.Marshaller;
|
||||
import java.io.StringWriter;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 收款单Service业务层处理
|
||||
*
|
||||
*
|
||||
* @author gen
|
||||
* @date 2025-04-28
|
||||
*/
|
||||
@@ -26,6 +38,9 @@ public class TmsReceiptImpl extends ServiceImpl<TmsReceiptMapper, TmsReceipt> im
|
||||
@Autowired
|
||||
private TmsReceiptMapper tmsReceiptMapper;
|
||||
|
||||
@Autowired
|
||||
private NcLogMapper ncLogMapper;
|
||||
|
||||
/**
|
||||
* 查询收款单列表
|
||||
*/
|
||||
@@ -88,4 +103,105 @@ public class TmsReceiptImpl extends ServiceImpl<TmsReceiptMapper, TmsReceipt> im
|
||||
.set(TmsReceipt::getAssignmentStatus, receiptPo.getAssignmentStatus())
|
||||
.eq(TmsReceipt::getId, receiptPo.getId()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean synchronousNc(String businessDocumentDetaliIds) {
|
||||
String [] businessDocumentDetaliIdArray=businessDocumentDetaliIds.split(",");
|
||||
LoginUser loginUser= SecurityUtils.getLoginUser();
|
||||
for (String businessDocumentDetaliId:businessDocumentDetaliIdArray){
|
||||
TmsReceipt tmsReceipt = this.getById(businessDocumentDetaliId);
|
||||
/* if(reconciliation.getSynchronousStatus()==1){
|
||||
throw new ServiceException("该记录已同步,不需要再次同步");
|
||||
}
|
||||
if(reconciliation.getIsInvoice()!=2){
|
||||
throw new ServiceException("该记录还未开票,不允许同步");
|
||||
}*/
|
||||
try {
|
||||
Date date = tmsReceipt.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);
|
||||
List<SKitem> ysitemList=new ArrayList<SKitem>();
|
||||
SKitem item=new SKitem();
|
||||
item.setSo_deptid("NG040104");
|
||||
item.setPk_deptid("NG040104");
|
||||
item.setCheckdirection("ar");
|
||||
item.setPk_psndoc("111");
|
||||
item.setCustomer("25849");
|
||||
item.setPurchaseorder(tmsReceipt.getReceivePaymentNumber());
|
||||
item.setObjtype("0");
|
||||
item.setDirection("1");
|
||||
item.setScomment("新永鸿工业气体有限公司");
|
||||
item.setPk_currtype("CMY");
|
||||
item.setMoney_cr(String.valueOf(tmsReceipt.getReceivePaymentAmount()));
|
||||
item.setMoney_bal(String.valueOf(tmsReceipt.getReceivePaymentAmount()));
|
||||
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("zhanghongming");
|
||||
billhead.setPk_tradetype("D2");
|
||||
billhead.setBillclass("sk");
|
||||
billhead.setBilldate(dateString);
|
||||
billhead.setSyscode("0");
|
||||
billhead.setBillno("");
|
||||
billhead.setDef59(tmsReceipt.getReceivePaymentNumber());
|
||||
billhead.setSrc_syscode("0");
|
||||
billhead.setBillstatus("0");
|
||||
billhead.setBillmaker("zhanghongming");
|
||||
billhead.setPk_busitype("");
|
||||
billhead.setBillyear("2025");
|
||||
billhead.setBillperiod("12");
|
||||
billhead.setEffectstatus("0");
|
||||
billhead.setDef28("nqyw");
|
||||
billhead.setDef29(tmsReceipt.getReceivePaymentNumber());
|
||||
billhead.setBodys(bodys);
|
||||
SKbill bill=new SKbill();
|
||||
bill.setId(String.valueOf(tmsReceipt.getId()));
|
||||
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(tmsReceipt.getOrganizationId());
|
||||
ncLog.setRequestBody(xmlString);
|
||||
ncLog.setResponeBody("");
|
||||
ncLog.setType(0L);
|
||||
ncLog.setOrganizationId(tmsReceipt.getOrganizationId());
|
||||
ncLog.setOrganizationName(tmsReceipt.getOrganizationName());
|
||||
ncLog.setTopOrganizationId(tmsReceipt.getTopOrganizationId());
|
||||
ncLogMapper.insert(ncLog);
|
||||
tmsReceipt.setSynchronousStatus(1);
|
||||
tmsReceipt.setSynchronousTime(new Date());
|
||||
tmsReceiptMapper.updateById(tmsReceipt);
|
||||
} catch (JAXBException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
+7
-1
@@ -30,7 +30,7 @@ import java.util.Date;
|
||||
import java.util.List;
|
||||
/**
|
||||
* 收款单
|
||||
*
|
||||
*
|
||||
* @author gen
|
||||
* @date 2025-04-28
|
||||
*/
|
||||
@@ -285,4 +285,10 @@ public class TmsReceiptDomainService {
|
||||
public int updateAssignableAmount(TmsReceiptPO receiptPo) {
|
||||
return tmsReceiptService.updateAssignableAmount(receiptPo);
|
||||
}
|
||||
|
||||
|
||||
public boolean synchronousNc(String businessDocumentDetaliIds)
|
||||
{
|
||||
return tmsReceiptService.synchronousNc(businessDocumentDetaliIds);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user