refactor(buildpackage): 更新TocofsReturngoods实体类和数据访问层

- 重构TocofsReturngoods和TocofsReturngoodsDetailed实体类,以符合最新项目需求。
- 更新数据访问层方法,以支持批量插入或更新操作。
- 重命名字段并添加新字段以增加功能和数据一致性。
- 删除过时的列表插入方法,以避免未来的错误和混淆。
This commit is contained in:
liuy 2024-09-14 11:15:52 +08:00
parent faa88f0683
commit 16650807f4
12 changed files with 3202 additions and 1777 deletions

View File

@ -9,14 +9,14 @@ import java.util.List;
* OFS售后入库单(tocofs_returngoods: table)表数据库访问层 * OFS售后入库单(tocofs_returngoods: table)表数据库访问层
* *
* @author makejava * @author makejava
* @since 2024-08-09 11:08:40 * @since 2024-09-13 11:58:10
*/ */
public interface ITocofsReturngoodsDao extends IBaseDao<TocofsReturngoodsEntity, String> { public interface ITocofsReturngoodsDao extends IBaseDao<TocofsReturngoodsEntity, String> {
/** /**
* 批量插入 * 批量保存或者更新数据行底表
* *
* @author liuyang * @author liuyang
*/ */
void entityInsertBatchV2(List<TocofsReturngoodsEntity> tocofsReturngoodsEntityList) throws Exception; void entityInsertOrUpdateBatch(List<TocofsReturngoodsEntity> tocofsReturngoodsEntityList) throws Exception;
} }

View File

@ -2,7 +2,6 @@ package com.hzya.frame.plugin.lets.ofs.dao;
import com.hzya.frame.plugin.lets.ofs.entity.TocofsReturngoodsDetailedEntity; import com.hzya.frame.plugin.lets.ofs.entity.TocofsReturngoodsDetailedEntity;
import com.hzya.frame.basedao.dao.IBaseDao; import com.hzya.frame.basedao.dao.IBaseDao;
import com.hzya.frame.plugin.lets.ofs.entity.TocofsReturngoodsEntity;
import java.util.List; import java.util.List;
@ -10,13 +9,41 @@ import java.util.List;
* root(tocofs_returngoods_detailed: table)表数据库访问层 * root(tocofs_returngoods_detailed: table)表数据库访问层
* *
* @author makejava * @author makejava
* @since 2024-08-09 13:45:47 * @since 2024-09-13 11:58:26
*/ */
public interface ITocofsReturngoodsDetailedDao extends IBaseDao<TocofsReturngoodsDetailedEntity, String> { public interface ITocofsReturngoodsDetailedDao extends IBaseDao<TocofsReturngoodsDetailedEntity, String> {
/** /**
* 批量插入 * 批量插入或更新到底表
* *
* @author liuyang * @author liuyang
*/ */
void entityInsertBatchV2(List<TocofsReturngoodsDetailedEntity> tocofsReturngoodsEntityList) throws Exception; void entityInsertOrUpdateBatch(List<TocofsReturngoodsDetailedEntity> tocofsReturngoodsDetailedEntityList) throws Exception;
/**
* 批量新增或者修改TOC退货-库存
*
* @author liuyang
*/
void entityInsertOrUpdateBatchByTocRerturnStock(List<TocofsReturngoodsDetailedEntity> tocofsReturngoodsDetailedEntityList) throws Exception;
/**
* 批量新增或者修改TOC退货-确认收入
*
* @author liuyang
*/
void entityInsertOrUpdateBatchByTocRerturnTran(List<TocofsReturngoodsDetailedEntity> tocofsReturngoodsDetailedEntityList) throws Exception;
/**
* 批量新增或者修改TOB退货-库存
*
* @author liuyang
*/
void entityInsertOrUpdateBatchByTobRerturnStock(List<TocofsReturngoodsDetailedEntity> tocofsReturngoodsDetailedEntityList) throws Exception;
/**
* 批量新增或者修改TOB退货-确认收入
*
* @author liuyang
*/
void entityInsertOrUpdateBatchByTobRerturnTran(List<TocofsReturngoodsDetailedEntity> tocofsReturngoodsDetailedEntityList) throws Exception;
} }

View File

@ -11,12 +11,11 @@ import java.util.List;
* OFS售后入库单(TocofsReturngoods)表数据库访问层 * OFS售后入库单(TocofsReturngoods)表数据库访问层
* *
* @author makejava * @author makejava
* @since 2024-08-09 11:08:40 * @since 2024-09-13 11:58:10
*/ */
public class TocofsReturngoodsDaoImpl extends MybatisGenericDao<TocofsReturngoodsEntity, String> implements ITocofsReturngoodsDao { public class TocofsReturngoodsDaoImpl extends MybatisGenericDao<TocofsReturngoodsEntity, String> implements ITocofsReturngoodsDao {
@Override @Override
public void entityInsertBatchV2(List<TocofsReturngoodsEntity> tocofsReturngoodsEntityList) throws Exception { public void entityInsertOrUpdateBatch(List<TocofsReturngoodsEntity> tocofsReturngoodsEntityList) throws Exception {
this.insert("com.hzya.frame.plugin.lets.ofs.dao.impl.TocofsReturngoodsDaoImpl.entityInsertBatchV2", tocofsReturngoodsEntityList); insert("com.hzya.frame.plugin.lets.ofs.dao.impl.TocofsReturngoodsDaoImpl.entityInsertOrUpdateBatch", tocofsReturngoodsEntityList);
} }
} }

View File

@ -2,7 +2,6 @@ package com.hzya.frame.plugin.lets.ofs.dao.impl;
import com.hzya.frame.plugin.lets.ofs.entity.TocofsReturngoodsDetailedEntity; import com.hzya.frame.plugin.lets.ofs.entity.TocofsReturngoodsDetailedEntity;
import com.hzya.frame.plugin.lets.ofs.dao.ITocofsReturngoodsDetailedDao; import com.hzya.frame.plugin.lets.ofs.dao.ITocofsReturngoodsDetailedDao;
import com.hzya.frame.plugin.lets.ofs.entity.TocofsReturngoodsEntity;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import com.hzya.frame.basedao.dao.MybatisGenericDao; import com.hzya.frame.basedao.dao.MybatisGenericDao;
@ -12,11 +11,33 @@ import java.util.List;
* root(TocofsReturngoodsDetailed)表数据库访问层 * root(TocofsReturngoodsDetailed)表数据库访问层
* *
* @author makejava * @author makejava
* @since 2024-08-09 13:45:47 * @since 2024-09-13 11:58:26
*/ */
public class TocofsReturngoodsDetailedDaoImpl extends MybatisGenericDao<TocofsReturngoodsDetailedEntity, String> implements ITocofsReturngoodsDetailedDao { public class TocofsReturngoodsDetailedDaoImpl extends MybatisGenericDao<TocofsReturngoodsDetailedEntity, String> implements ITocofsReturngoodsDetailedDao {
@Override @Override
public void entityInsertBatchV2(List<TocofsReturngoodsDetailedEntity> tocofsReturngoodsDetailedEntityList) throws Exception { public void entityInsertOrUpdateBatch(List<TocofsReturngoodsDetailedEntity> tocofsReturngoodsDetailedEntityList) throws Exception {
this.insert("com.hzya.frame.plugin.lets.ofs.dao.impl.TocofsReturngoodsDetailedDaoImpl.entityInsertBatchV2", tocofsReturngoodsDetailedEntityList); insert("com.hzya.frame.plugin.lets.ofs.dao.impl.TocofsReturngoodsDetailedDaoImpl.entityInsertOrUpdateBatch", tocofsReturngoodsDetailedEntityList);
} }
}
@Override
public void entityInsertOrUpdateBatchByTocRerturnStock(List<TocofsReturngoodsDetailedEntity> tocofsReturngoodsDetailedEntityList) throws Exception {
insert("com.hzya.frame.plugin.lets.ofs.dao.impl.TocofsReturngoodsDetailedDaoImpl.entityInsertOrUpdateBatchByTocRerturnStock", tocofsReturngoodsDetailedEntityList);
}
@Override
public void entityInsertOrUpdateBatchByTocRerturnTran(List<TocofsReturngoodsDetailedEntity> tocofsReturngoodsDetailedEntityList) throws Exception {
insert("com.hzya.frame.plugin.lets.ofs.dao.impl.TocofsReturngoodsDetailedDaoImpl.entityInsertOrUpdateBatchByTocRerturnTran", tocofsReturngoodsDetailedEntityList);
}
@Override
public void entityInsertOrUpdateBatchByTobRerturnStock(List<TocofsReturngoodsDetailedEntity> tocofsReturngoodsDetailedEntityList) throws Exception {
insert("com.hzya.frame.plugin.lets.ofs.dao.impl.TocofsReturngoodsDetailedDaoImpl.entityInsertOrUpdateBatchByTobRerturnStock", tocofsReturngoodsDetailedEntityList);
}
@Override
public void entityInsertOrUpdateBatchByTobRerturnTran(List<TocofsReturngoodsDetailedEntity> tocofsReturngoodsDetailedEntityList) throws Exception {
insert("com.hzya.frame.plugin.lets.ofs.dao.impl.TocofsReturngoodsDetailedDaoImpl.entityInsertOrUpdateBatchByTobRerturnTran", tocofsReturngoodsDetailedEntityList);
}
}

View File

@ -1,6 +1,5 @@
package com.hzya.frame.plugin.lets.ofs.entity; package com.hzya.frame.plugin.lets.ofs.entity;
import com.hzya.frame.ttxofs.dto.returngoodsearch.ReturnGoodSearchHeaderDto;
import com.hzya.frame.web.entity.BaseEntity; import com.hzya.frame.web.entity.BaseEntity;
import lombok.Data; import lombok.Data;
@ -8,98 +7,100 @@ import lombok.Data;
* root(TocofsReturngoodsDetailed)实体类 * root(TocofsReturngoodsDetailed)实体类
* *
* @author makejava * @author makejava
* @since 2024-08-09 13:45:47 * @since 2024-09-13 11:58:26
*/ */
@Data @Data
public class TocofsReturngoodsDetailedEntity extends BaseEntity { public class TocofsReturngoodsDetailedEntity extends BaseEntity {
/** /**
* 81159 * 81159
*/ */
private String receiptId; private String receiptid;
/** /**
* LETS-RE2024071600000001 * LETS-RE2024071600000001
*/ */
private String receiptCode; private String receiptcode;
/** /**
* 128 * 128
*/ */
private String refOrderId; private String reforderid;
/** /**
* 299 * 299
*/ */
private String refOrderDetailId; private String reforderdetailid;
/** /**
* LETS-SO2024070500000001 * LETS-SO2024070500000001
*/ */
private String sourceOrderCode; private String sourceordercode;
private String sourcelinenum;
/** /**
* LETS * LETS
*/ */
private String clientCode; private String clientcode;
/** /**
* SHLZ * SHLZ
*/ */
private String companyCode; private String companycode;
/** /**
* intoyou-tmxs * intoyou-tmxs
*/ */
private String facilityCode; private String facilitycode;
/** /**
* 6973391730617 * 6973391730617
*/ */
private String skuCode; private String skucode;
/** /**
* INTOYOU心慕与你水感裸雾唇釉W01 * INTOYOU心慕与你水感裸雾唇釉W01
*/ */
private String skuName; private String skuname;
/** /**
* 2 * 2
*/ */
private String requestQty; private String requestqty;
/** /**
* 2 * 2
*/ */
private String receivedQty; private String receivedqty;
/** /**
* 0 * 0
*/ */
private String openQty; private String openqty;
/** /**
* EA * EA
*/ */
private String quantityUM; private String quantityum;
/** /**
* 0 * 0
*/ */
private String totalWeight; private String totalweight;
/** /**
* 0 * 0
*/ */
private String totalVolume; private String totalvolume;
/** /**
* 0 * 0
*/ */
private String totalVolumeWeight; private String totalvolumeweight;
/** /**
* 118 * 118
*/ */
private String totalAmount; private String totalamount;
/** /**
* G * G
*/ */
private String weightUM; private String weightum;
/** /**
* CM3 * CM3
*/ */
private String volumeUM; private String volumeum;
/** /**
* AVAILABLE * AVAILABLE
*/ */
private String inventorySts; private String inventorysts;
/** /**
* 30796 * 30796
*/ */
private String inTransInvId; private String intransinvid;
/** /**
* 0 * 0
*/ */
@ -111,52 +112,278 @@ public class TocofsReturngoodsDetailedEntity extends BaseEntity {
/** /**
* admin * admin
*/ */
private String createdBy; private String createdby;
/** /**
* 2024-07-16 16:44:01 * 2024-07-16 16:44:01
*/ */
private String lastUpdated; private String lastupdated;
/** /**
* api * api
*/ */
private String lastUpdatedBy; private String lastupdatedby;
/** /**
* 59 * 59
*/ */
private String discountPrice; private String discountprice;
/**
* 主表主键
*/
private String maintableid;
/** /**
* 报错内容 * 报错内容
*/ */
private String newTransmitinfo; private String newtransmitinfo;
/** /**
* 推送时间 * 推送时间
*/ */
private String newPushdate; private String newpushdate;
/** /**
* 是否成功 * 是否成功
*/ */
private String newState; private String newstate;
/** /**
* 下游系统编码 * 下游系统编码
*/ */
private String newSystemNumber; private String newsystemnumber;
/** /**
* 下游系统主键 * 下游系统主键
*/ */
private String newSystemPrimary; private String newsystemprimary;
/** /**
* 主表主键 * 报错内容
*/ */
private String primaryKey; private String newtransmitinfo2;
/** /**
* 业务日期 * 推送时间
*/ */
private String businessDate; private String newpushdate2;
/**
* 是否成功
*/
private String newstate2;
/**
* 下游系统编码
*/
private String newsystemnumber2;
/**
* 下游系统主键
*/
private String newsystemprimary2;
/**
* 报错内容
*/
private String newtransmitinfo3;
/**
* 推送时间
*/
private String newpushdate3;
/**
* 是否成功
*/
private String newstate3;
/**
* 下游系统编码
*/
private String newsystemnumber3;
/**
* 下游系统主键
*/
private String newsystemprimary3;
/**
* 报错内容
*/
private String newtransmitinfo4;
/**
* 推送时间
*/
private String newpushdate4;
/**
* 是否成功
*/
private String newstate4;
/**
* 下游系统编码
*/
private String newsystemnumber4;
/**
* 下游系统主键
*/
private String newsystemprimary4;
/**
* 业务日期-入库时间
*/
private String businessdate;
/**
* 业务日期-退款完成时间
*/
private String refundedat;
/**
* 业务类型(TOC退货orTOB退货)
*/
private String businesstype;
/**
* 自定义项
*/
private String def1;
/**
* 自定义项
*/
private String def2;
/**
* 自定义项
*/
private String def3;
/**
* 自定义项
*/
private String def4;
/**
* 自定义项
*/
private String def5;
/**
* 自定义项
*/
private String def6;
/**
* 自定义项
*/
private String def7;
/**
* 自定义项
*/
private String def8;
/**
* 自定义项
*/
private String def9;
/**
* 自定义项
*/
private String def10;
/**
* 自定义项
*/
private String def11;
/**
* 自定义项
*/
private String def12;
/**
* 自定义项
*/
private String def13;
/**
* 自定义项
*/
private String def14;
/**
* 自定义项
*/
private String def15;
/**
* 自定义项
*/
private String def16;
/**
* 自定义项
*/
private String def17;
/**
* 自定义项
*/
private String def18;
/**
* 自定义项
*/
private String def19;
/**
* 自定义项
*/
private String def20;
/**
* 自定义项
*/
private String def21;
/**
* 自定义项
*/
private String def22;
/**
* 自定义项
*/
private String def23;
/**
* 自定义项
*/
private String def24;
/**
* 自定义项
*/
private String def25;
/**
* 自定义项
*/
private String def26;
/**
* 自定义项
*/
private String def27;
/**
* 自定义项
*/
private String def28;
/**
* 自定义项
*/
private String def29;
/**
* 自定义项
*/
private String def30;
/**
* 自定义项
*/
private String def31;
/**
* 自定义项
*/
private String def32;
/**
* 自定义项
*/
private String def33;
/**
* 自定义项
*/
private String def34;
/**
* 自定义项
*/
private String def35;
/**
* 自定义项
*/
private String def36;
/**
* 自定义项
*/
private String def37;
/**
* 自定义项
*/
private String def38;
/**
* 自定义项
*/
private String def39;
/**
* 自定义项
*/
private String def40;
/**
* 补充的查询条件
*/
private String ids;
}
/**
* 主表主键
*/
// private String returngoodsId;
private String businessType;
}

View File

@ -1,30 +1,32 @@
package com.hzya.frame.plugin.lets.ofs.entity; package com.hzya.frame.plugin.lets.ofs.entity;
import com.hzya.frame.web.entity.BaseEntity; import com.hzya.frame.web.entity.BaseEntity;
import lombok.Data;
/** /**
* OFS售后入库单(TocofsReturngoods)实体类 * OFS售后入库单(TocofsReturngoods)实体类
* *
* @author makejava * @author makejava
* @since 2024-08-09 11:08:40 * @since 2024-09-13 11:58:10
*/ */
@Data
public class TocofsReturngoodsEntity extends BaseEntity { public class TocofsReturngoodsEntity extends BaseEntity {
/** /**
* LETS * LETS
*/ */
private String clientCode; private String clientcode;
/** /**
* SHLZ * SHLZ
*/ */
private String companyCode; private String companycode;
/** /**
* tm-intoyou * tm-intoyou
*/ */
private String storeCode; private String storecode;
/** /**
* intoyou-tmxs * intoyou-tmxs
*/ */
private String facilityCode; private String facilitycode;
/** /**
* LETS-RE2024071600000001 * LETS-RE2024071600000001
*/ */
@ -32,23 +34,23 @@ public class TocofsReturngoodsEntity extends BaseEntity {
/** /**
* RETURN * RETURN
*/ */
private String internalInstructionType; private String internalinstructiontype;
/** /**
* B2C * B2C
*/ */
private String bizChannel; private String bizchannel;
/** /**
* 128 * 128
*/ */
private String refOrderId; private String reforderid;
/** /**
* LETS-RO2024071600000001 * LETS-RO2024071600000001
*/ */
private String refOrderCode; private String refordercode;
/** /**
* RETURN * RETURN
*/ */
private String refOrderType; private String refordertype;
/** /**
* 1 * 1
*/ */
@ -56,7 +58,7 @@ public class TocofsReturngoodsEntity extends BaseEntity {
/** /**
* api * api
*/ */
private String closedBy; private String closedby;
/** /**
* 900 * 900
*/ */
@ -64,540 +66,69 @@ public class TocofsReturngoodsEntity extends BaseEntity {
/** /**
* 0 * 0
*/ */
private String allowOverReceive; private String allowoverreceive;
/** /**
* 张三 * 张三
*/ */
private String shipFromAttentionTo; private String shipfromattentionto;
/** /**
* 测试售后流程 * 测试售后流程
*/ */
private String shipFromAddress; private String shipfromaddress;
/** /**
* 中国 * 中国
*/ */
private String shipFromCountry; private String shipfromcountry;
/** /**
* 上海市 * 上海市
*/ */
private String shipFromState; private String shipfromstate;
/** /**
* 上海市 * 上海市
*/ */
private String shipFromCity; private String shipfromcity;
/** /**
* 金山区 * 金山区
*/ */
private String shipFromDistrict; private String shipfromdistrict;
/** /**
* 17878787878 * 17878787878
*/ */
private String shipFromMobile; private String shipfrompostalcode;
/** private String shipfrommobile;
* 2 private String shipfromemail;
*/ private String totallines;
private String totalLines; private String totalqty;
/** private String totalamount;
* 4 private String totalweight;
*/ private String totalvolume;
private String totalQty; private String totalvolumeweight;
/** private String totalfulfillamount;
* 236 private String totalfulfillweight;
*/ private String totalfulfillvolume;
private String totalAmount; private String totalfulfillvolumeweight;
/** private String totalfulfillqty;
* 0 private String totalcases;
*/ private String totalcontainers;
private String totalWeight; private String closeatqty;
/** private String quantityum;
* 0 private String weightum;
*/ private String volumeum;
private String totalVolume; private String checkinfrom;
/** private String checkinto;
* 0 private String closedat;
*/ private String sourceplatformcode;
private String totalVolumeWeight; private String sourceordercode;
/**
* 236
*/
private String totalFulfillAmount;
/**
* 0
*/
private String totalFulfillWeight;
/**
* 0
*/
private String totalFulfillVolume;
/**
* 0
*/
private String totalFulfillVolumeWeight;
/**
* 4
*/
private String totalFulfillQty;
/**
* 0
*/
private String totalCases;
/**
* 0
*/
private String totalContainers;
/**
* 0
*/
private String closeAtQty;
/**
* EA
*/
private String quantityUM;
/**
* G
*/
private String weightUM;
/**
* CM3
*/
private String volumeUM;
/**
* 2024-07-16 16:44:00
*/
private String checkInFrom;
/**
* 2024-07-16 16:44:01
*/
private String checkInTo;
/**
* 2024-07-16 16:44:01
*/
private String closedAt;
/**
* OFS
*/
private String sourcePlatformCode;
/**
* LETS-SO2024070500000001
*/
private String sourceOrderCode;
/** /**
* 2024-07-16 15:35:36 * 2024-07-16 15:35:36
*/ */
private String created; private String created;
/** private String createdby;
* admin private String lastupdated;
*/ private String lastupdatedby;
private String createdBy; private String returnwaybillcode;
/** private String returncarrier;
* 2024-07-16 16:44:01 private String refundedat;
*/ private String refundstatus;
private String lastUpdated;
/**
* api
*/
private String lastUpdatedBy;
/**
* YT7478903028607
*/
private String returnWaybillCode;
/**
* YTO
*/
private String returnCarrier;
public String getClientCode() {
return clientCode;
}
public void setClientCode(String clientCode) {
this.clientCode = clientCode;
}
public String getCompanyCode() {
return companyCode;
}
public void setCompanyCode(String companyCode) {
this.companyCode = companyCode;
}
public String getStoreCode() {
return storeCode;
}
public void setStoreCode(String storeCode) {
this.storeCode = storeCode;
}
public String getFacilityCode() {
return facilityCode;
}
public void setFacilityCode(String facilityCode) {
this.facilityCode = facilityCode;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getInternalInstructionType() {
return internalInstructionType;
}
public void setInternalInstructionType(String internalInstructionType) {
this.internalInstructionType = internalInstructionType;
}
public String getBizChannel() {
return bizChannel;
}
public void setBizChannel(String bizChannel) {
this.bizChannel = bizChannel;
}
public String getRefOrderId() {
return refOrderId;
}
public void setRefOrderId(String refOrderId) {
this.refOrderId = refOrderId;
}
public String getRefOrderCode() {
return refOrderCode;
}
public void setRefOrderCode(String refOrderCode) {
this.refOrderCode = refOrderCode;
}
public String getRefOrderType() {
return refOrderType;
}
public void setRefOrderType(String refOrderType) {
this.refOrderType = refOrderType;
}
public String getClosed() {
return closed;
}
public void setClosed(String closed) {
this.closed = closed;
}
public String getClosedBy() {
return closedBy;
}
public void setClosedBy(String closedBy) {
this.closedBy = closedBy;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getAllowOverReceive() {
return allowOverReceive;
}
public void setAllowOverReceive(String allowOverReceive) {
this.allowOverReceive = allowOverReceive;
}
public String getShipFromAttentionTo() {
return shipFromAttentionTo;
}
public void setShipFromAttentionTo(String shipFromAttentionTo) {
this.shipFromAttentionTo = shipFromAttentionTo;
}
public String getShipFromAddress() {
return shipFromAddress;
}
public void setShipFromAddress(String shipFromAddress) {
this.shipFromAddress = shipFromAddress;
}
public String getShipFromCountry() {
return shipFromCountry;
}
public void setShipFromCountry(String shipFromCountry) {
this.shipFromCountry = shipFromCountry;
}
public String getShipFromState() {
return shipFromState;
}
public void setShipFromState(String shipFromState) {
this.shipFromState = shipFromState;
}
public String getShipFromCity() {
return shipFromCity;
}
public void setShipFromCity(String shipFromCity) {
this.shipFromCity = shipFromCity;
}
public String getShipFromDistrict() {
return shipFromDistrict;
}
public void setShipFromDistrict(String shipFromDistrict) {
this.shipFromDistrict = shipFromDistrict;
}
public String getShipFromMobile() {
return shipFromMobile;
}
public void setShipFromMobile(String shipFromMobile) {
this.shipFromMobile = shipFromMobile;
}
public String getTotalLines() {
return totalLines;
}
public void setTotalLines(String totalLines) {
this.totalLines = totalLines;
}
public String getTotalQty() {
return totalQty;
}
public void setTotalQty(String totalQty) {
this.totalQty = totalQty;
}
public String getTotalAmount() {
return totalAmount;
}
public void setTotalAmount(String totalAmount) {
this.totalAmount = totalAmount;
}
public String getTotalWeight() {
return totalWeight;
}
public void setTotalWeight(String totalWeight) {
this.totalWeight = totalWeight;
}
public String getTotalVolume() {
return totalVolume;
}
public void setTotalVolume(String totalVolume) {
this.totalVolume = totalVolume;
}
public String getTotalVolumeWeight() {
return totalVolumeWeight;
}
public void setTotalVolumeWeight(String totalVolumeWeight) {
this.totalVolumeWeight = totalVolumeWeight;
}
public String getTotalFulfillAmount() {
return totalFulfillAmount;
}
public void setTotalFulfillAmount(String totalFulfillAmount) {
this.totalFulfillAmount = totalFulfillAmount;
}
public String getTotalFulfillWeight() {
return totalFulfillWeight;
}
public void setTotalFulfillWeight(String totalFulfillWeight) {
this.totalFulfillWeight = totalFulfillWeight;
}
public String getTotalFulfillVolume() {
return totalFulfillVolume;
}
public void setTotalFulfillVolume(String totalFulfillVolume) {
this.totalFulfillVolume = totalFulfillVolume;
}
public String getTotalFulfillVolumeWeight() {
return totalFulfillVolumeWeight;
}
public void setTotalFulfillVolumeWeight(String totalFulfillVolumeWeight) {
this.totalFulfillVolumeWeight = totalFulfillVolumeWeight;
}
public String getTotalFulfillQty() {
return totalFulfillQty;
}
public void setTotalFulfillQty(String totalFulfillQty) {
this.totalFulfillQty = totalFulfillQty;
}
public String getTotalCases() {
return totalCases;
}
public void setTotalCases(String totalCases) {
this.totalCases = totalCases;
}
public String getTotalContainers() {
return totalContainers;
}
public void setTotalContainers(String totalContainers) {
this.totalContainers = totalContainers;
}
public String getCloseAtQty() {
return closeAtQty;
}
public void setCloseAtQty(String closeAtQty) {
this.closeAtQty = closeAtQty;
}
public String getQuantityUM() {
return quantityUM;
}
public void setQuantityUM(String quantityUM) {
this.quantityUM = quantityUM;
}
public String getWeightUM() {
return weightUM;
}
public void setWeightUM(String weightUM) {
this.weightUM = weightUM;
}
public String getVolumeUM() {
return volumeUM;
}
public void setVolumeUM(String volumeUM) {
this.volumeUM = volumeUM;
}
public String getCheckInFrom() {
return checkInFrom;
}
public void setCheckInFrom(String checkInFrom) {
this.checkInFrom = checkInFrom;
}
public String getCheckInTo() {
return checkInTo;
}
public void setCheckInTo(String checkInTo) {
this.checkInTo = checkInTo;
}
public String getClosedAt() {
return closedAt;
}
public void setClosedAt(String closedAt) {
this.closedAt = closedAt;
}
public String getSourcePlatformCode() {
return sourcePlatformCode;
}
public void setSourcePlatformCode(String sourcePlatformCode) {
this.sourcePlatformCode = sourcePlatformCode;
}
public String getSourceOrderCode() {
return sourceOrderCode;
}
public void setSourceOrderCode(String sourceOrderCode) {
this.sourceOrderCode = sourceOrderCode;
}
public String getCreated() {
return created;
}
public void setCreated(String created) {
this.created = created;
}
public String getCreatedBy() {
return createdBy;
}
public void setCreatedBy(String createdBy) {
this.createdBy = createdBy;
}
public String getLastUpdated() {
return lastUpdated;
}
public void setLastUpdated(String lastUpdated) {
this.lastUpdated = lastUpdated;
}
public String getLastUpdatedBy() {
return lastUpdatedBy;
}
public void setLastUpdatedBy(String lastUpdatedBy) {
this.lastUpdatedBy = lastUpdatedBy;
}
public String getReturnWaybillCode() {
return returnWaybillCode;
}
public void setReturnWaybillCode(String returnWaybillCode) {
this.returnWaybillCode = returnWaybillCode;
}
public String getReturnCarrier() {
return returnCarrier;
}
public void setReturnCarrier(String returnCarrier) {
this.returnCarrier = returnCarrier;
}
} }

View File

@ -41,6 +41,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -220,6 +221,8 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
@Override @Override
public void run() { public void run() {
try { try {
Assert.notNull(startTime, "startTime不能为空");
Assert.notNull(endTime, "endTime不能为空");
//生成一个时间范围 //生成一个时间范围
// StartAndEndVo startAndEndVo = offsetTimeTime.offsetTime(); // StartAndEndVo startAndEndVo = offsetTimeTime.offsetTime();
//2024年8月19日 15:47:51 查询出U8C里标记的店铺TOB属性 //2024年8月19日 15:47:51 查询出U8C里标记的店铺TOB属性
@ -273,7 +276,7 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
public void run() { public void run() {
try { try {
Assert.notNull(startTime, "startTime不能为空"); Assert.notNull(startTime, "startTime不能为空");
Assert.notNull(endTime, "end不能为空"); Assert.notNull(endTime, "endTime不能为空");
//生成一个时间范围 //生成一个时间范围
// StartAndEndVo startAndEndVo = offsetTimeTime.offsetTime(); // StartAndEndVo startAndEndVo = offsetTimeTime.offsetTime();
@ -328,6 +331,7 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
@Override @Override
public void run() { public void run() {
try { try {
Assert.notNull(code, "code不能为空");
//生成一个时间范围 //生成一个时间范围
// StartAndEndVo startAndEndVo = offsetTimeTime.offsetTime(); // StartAndEndVo startAndEndVo = offsetTimeTime.offsetTime();
//2024年8月19日 15:47:51 查询出U8C里标记的店铺TOB属性 //2024年8月19日 15:47:51 查询出U8C里标记的店铺TOB属性
@ -375,7 +379,7 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
//保存到mysql //保存到mysql
batchInsert(returnGoodHeaderDetailsDataDtoArrayList); batchInsert(returnGoodHeaderDetailsDataDtoArrayList);
//过滤成功的数据 //过滤成功的数据
List<StockinOrderSearchResponse.StockinOrder> stockinOrderList = filterData(returnGoodHeaderDetailsDataDtoArrayList); List<StockinOrderSearchResponse.StockinOrder> stockinOrderList = filterDataStock(returnGoodHeaderDetailsDataDtoArrayList);
//执行推送主逻辑 //执行推送主逻辑
implementStock(stockinOrderList); implementStock(stockinOrderList);
} }
@ -389,23 +393,147 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
//保存到mysql //保存到mysql
batchInsert(returnGoodHeaderDetailsDataDtoArrayList); batchInsert(returnGoodHeaderDetailsDataDtoArrayList);
//过滤成功的数据 //过滤成功的数据
List<StockinOrderSearchResponse.StockinOrder> stockinOrderList = filterData(returnGoodHeaderDetailsDataDtoArrayList); List<StockinOrderSearchResponse.StockinOrder> stockinOrderList = filterDataTran(returnGoodHeaderDetailsDataDtoArrayList);
//执行推送主逻辑 //执行推送主逻辑
implementSuccessfulTrade(stockinOrderList); implementSuccessfulTrade(stockinOrderList);
} }
/** /**
* 过滤掉成功的数据 * 库存过滤掉成功的数据
* *
* @author liuyang * @author liuyang
*/ */
private List<StockinOrderSearchResponse.StockinOrder> filterData(List<StockinOrderSearchResponse.StockinOrder> returnGoodHeaderDetailsDataDtoArrayList) { private List<StockinOrderSearchResponse.StockinOrder> filterDataStock(List<StockinOrderSearchResponse.StockinOrder> returnGoodHeaderDetailsDataDtoArrayList) throws Exception {
List<StockinOrderSearchResponse.StockinOrder> headerDetailsDtoList1 = new ArrayList<>(); // List<StockinOrderSearchResponse.StockinOrder> headerDetailsDtoList1 = new ArrayList<>();
List<TocofsReturngoodsDetailedEntity> tocofsReturngoodsDetailedEntityList = new ArrayList<>();
if (returnGoodHeaderDetailsDataDtoArrayList != null && returnGoodHeaderDetailsDataDtoArrayList.size() > 0) { if (returnGoodHeaderDetailsDataDtoArrayList != null && returnGoodHeaderDetailsDataDtoArrayList.size() > 0) {
//TODO 出库单明细主键需要O返回目前没有已经提需求 List<List<StockinOrderSearchResponse.StockinOrder>> splitListByCount = SplitListByCountUtil.splitListByCount(returnGoodHeaderDetailsDataDtoArrayList, 100);
headerDetailsDtoList1.addAll(returnGoodHeaderDetailsDataDtoArrayList); for (int i = 0; i < splitListByCount.size(); i++) {
List<StockinOrderSearchResponse.StockinOrder> stockinOrderList = splitListByCount.get(i);
String idStr = commaConcatenatedPrimaryKeyStock(stockinOrderList);
List<TocofsReturngoodsDetailedEntity> tocofsReturngoodsDetailedEntities = queryStockTocOutLog(idStr);
tocofsReturngoodsDetailedEntityList.addAll(tocofsReturngoodsDetailedEntities);
}
} }
return headerDetailsDtoList1; if (tocofsReturngoodsDetailedEntityList.size() > 0) {
return filterDataRowsAsPushOrFailedStock(tocofsReturngoodsDetailedEntityList, returnGoodHeaderDetailsDataDtoArrayList);
}
return null;
}
/**
* 筛选出未推送或者失败的数据行过滤库存同步业务
*
* @param tocofsReturngoodsDetailedEntityList 日志行状态
* @param returnGoodHeaderDetailsDataDtoArrayList 返回结果
* @author liuyang
*/
private List<StockinOrderSearchResponse.StockinOrder> filterDataRowsAsPushOrFailedStock(List<TocofsReturngoodsDetailedEntity> tocofsReturngoodsDetailedEntityList, List<StockinOrderSearchResponse.StockinOrder> returnGoodHeaderDetailsDataDtoArrayList) throws Exception {
List<StockinOrderSearchResponse.StockinOrder> targetHeaderDetailsDtoList = new ArrayList<>();
if (tocofsReturngoodsDetailedEntityList != null && tocofsReturngoodsDetailedEntityList.size() > 0 && returnGoodHeaderDetailsDataDtoArrayList != null && returnGoodHeaderDetailsDataDtoArrayList.size() > 0) {
//字段Y(成功)或者为H(待处理)可以视为成功完成了小段业务闭环的数据行
String succeseeY = "Y";
String succeseeH = "H";
for (int i = 0; i < returnGoodHeaderDetailsDataDtoArrayList.size(); i++) {
StockinOrderSearchResponse.StockinOrder stockinOrder = returnGoodHeaderDetailsDataDtoArrayList.get(i);
StockinOrderSearchResponse.StockinOrder.StockinH header = stockinOrder.getHeader();
List<StockinOrderSearchResponse.StockinOrder.StockinB> details = stockinOrder.getDetails();
List<StockinOrderSearchResponse.StockinOrder.StockinB> targetDetails = new ArrayList<>();
for (int j = 0; j < details.size(); j++) {
StockinOrderSearchResponse.StockinOrder.StockinB stockinB = details.get(j);
Boolean isSuccess = false;
String newstate = null;
for (int k = 0; k < tocofsReturngoodsDetailedEntityList.size(); k++) {
TocofsReturngoodsDetailedEntity tocofsReturngoodsDetailedEntity = tocofsReturngoodsDetailedEntityList.get(k);
if (tocofsReturngoodsDetailedEntity.getId().equals(stockinB.getId())) {
newstate = tocofsReturngoodsDetailedEntity.getNewstate2();
if (succeseeY.equals(newstate) || succeseeH.equals(newstate)) {
isSuccess = true;
}
}
}
if (!isSuccess) {
stockinB.setNewstate(newstate);
targetDetails.add(stockinB);
}
}
if (targetDetails.size() > 0) {
//如果明细行中还存在未推送或者失败的数据则需要更新明细行
stockinOrder.setDetails(targetDetails);
targetHeaderDetailsDtoList.add(stockinOrder);
}
}
}
return targetHeaderDetailsDtoList;
}
/**
* 批查询toc退货入库日志查询的量由splitListByCount方法控制
*
* @author liuyang
*/
private List<TocofsReturngoodsDetailedEntity> queryStockTocOutLog(String idStr) throws Exception {
List<TocofsReturngoodsDetailedEntity> tocofsReturngoodsDetailedEntities = null;
if (idStr != null && !"".equals(idStr.trim())) {
TocofsReturngoodsDetailedEntity tocofsReturngoodsDetailedEntity = new TocofsReturngoodsDetailedEntity();
tocofsReturngoodsDetailedEntity.setIds(idStr);
tocofsReturngoodsDetailedEntities = iTocofsReturngoodsDetailedDao.query(tocofsReturngoodsDetailedEntity);
} else {
logger.error("idStr为空无法查询数据");
}
return tocofsReturngoodsDetailedEntities;
}
/**
* 逗号拼接字符串主键作为批处理的一部分方便下一步的批量查询操作
*
* @author liuyang
*/
private String commaConcatenatedPrimaryKeyStock(List<StockinOrderSearchResponse.StockinOrder> headerDetailsDtoList2) throws Exception {
StringBuffer idStr = new StringBuffer();
if (headerDetailsDtoList2 != null && headerDetailsDtoList2.size() > 0) {
for (int i = 0; i < headerDetailsDtoList2.size(); i++) {
StockinOrderSearchResponse.StockinOrder stockinOrder = headerDetailsDtoList2.get(i);
StockinOrderSearchResponse.StockinOrder.StockinH header = stockinOrder.getHeader();
List<StockinOrderSearchResponse.StockinOrder.StockinB> details = stockinOrder.getDetails();
for (int j = 0; j < details.size(); j++) {
StockinOrderSearchResponse.StockinOrder.StockinB stockinB = details.get(j);
Assert.notNull(stockinB.getId(), "O明细主键不能为空");
Assert.state(!"".equals(stockinB.getId()), "O明细主键不能为空");
idStr.append(stockinB.getId());
idStr.append(",");
}
}
}
if (idStr.length() > 0) {
return idStr.substring(0, idStr.length());
}
return null;
}
/**
* 确认收入过滤掉成功的数据
*
* @author liuyang
*/
private List<StockinOrderSearchResponse.StockinOrder> filterDataTran(List<StockinOrderSearchResponse.StockinOrder> returnGoodHeaderDetailsDataDtoArrayList) throws Exception {
// List<StockinOrderSearchResponse.StockinOrder> headerDetailsDtoList1 = new ArrayList<>();
List<TocofsReturngoodsDetailedEntity> tocofsReturngoodsDetailedEntityList = new ArrayList<>();
if (returnGoodHeaderDetailsDataDtoArrayList != null && returnGoodHeaderDetailsDataDtoArrayList.size() > 0) {
List<List<StockinOrderSearchResponse.StockinOrder>> splitListByCount = SplitListByCountUtil.splitListByCount(returnGoodHeaderDetailsDataDtoArrayList, 100);
for (int i = 0; i < splitListByCount.size(); i++) {
List<StockinOrderSearchResponse.StockinOrder> stockinOrderList = splitListByCount.get(i);
String idStr = commaConcatenatedPrimaryKeyStock(stockinOrderList);
List<TocofsReturngoodsDetailedEntity> tocofsReturngoodsDetailedEntities = queryStockTocOutLog(idStr);
tocofsReturngoodsDetailedEntityList.addAll(tocofsReturngoodsDetailedEntities);
}
}
if (tocofsReturngoodsDetailedEntityList.size() > 0) {
return filterDataRowsAsPushOrFailedStock(tocofsReturngoodsDetailedEntityList, returnGoodHeaderDetailsDataDtoArrayList);
}
return null;
} }
/** /**
@ -417,16 +545,13 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
if (returnGoodHeaderDetailsDataDtoArrayList != null && returnGoodHeaderDetailsDataDtoArrayList.size() > 0) { if (returnGoodHeaderDetailsDataDtoArrayList != null && returnGoodHeaderDetailsDataDtoArrayList.size() > 0) {
List<StockinOrderSearchResponse.StockinOrder.StockinH> headerDetailsDtoList1 = new ArrayList<>(); List<StockinOrderSearchResponse.StockinOrder.StockinH> headerDetailsDtoList1 = new ArrayList<>();
List<StockinOrderSearchResponse.StockinOrder.StockinB> headerDetailsDtoList2 = new ArrayList<>(); List<StockinOrderSearchResponse.StockinOrder.StockinB> headerDetailsDtoList2 = new ArrayList<>();
for (StockinOrderSearchResponse.StockinOrder index : returnGoodHeaderDetailsDataDtoArrayList) { for (StockinOrderSearchResponse.StockinOrder index : returnGoodHeaderDetailsDataDtoArrayList) {
StockinOrderSearchResponse.StockinOrder.StockinH header = index.getHeader();// 主表 StockinOrderSearchResponse.StockinOrder.StockinH header = index.getHeader();// 主表
List<StockinOrderSearchResponse.StockinOrder.StockinB> details = index.getDetails();//明细表 List<StockinOrderSearchResponse.StockinOrder.StockinB> details = index.getDetails();//明细表
for (int i = 0; i < details.size(); i++) { for (int i = 0; i < details.size(); i++) {
StockinOrderSearchResponse.StockinOrder.StockinB stockinB = details.get(i); StockinOrderSearchResponse.StockinOrder.StockinB stockinB = details.get(i);
stockinB.setReturnGoodSearchHeaderDto(header); stockinB.setReturnGoodSearchHeaderDto(header);
} }
headerDetailsDtoList1.add(header); headerDetailsDtoList1.add(header);
headerDetailsDtoList2.addAll(details); headerDetailsDtoList2.addAll(details);
} }
@ -438,7 +563,7 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
List<TocofsReturngoodsEntity> tocofsReturngoodsEntities = copyHeaderDto(stockinHS); List<TocofsReturngoodsEntity> tocofsReturngoodsEntities = copyHeaderDto(stockinHS);
if (tocofsReturngoodsEntities.size() > 0) { if (tocofsReturngoodsEntities.size() > 0) {
logger.info("TocofsReturngoodsEntity插入底表{}个对象(表头)", tocofsReturngoodsEntities.size()); logger.info("TocofsReturngoodsEntity插入底表{}个对象(表头)", tocofsReturngoodsEntities.size());
iTocofsReturngoodsDao.entityInsertBatchV2(tocofsReturngoodsEntities); iTocofsReturngoodsDao.entityInsertOrUpdateBatch(tocofsReturngoodsEntities);
} else { } else {
logger.info("TocofsReturngoodsEntity没有对象被插入表头底表"); logger.info("TocofsReturngoodsEntity没有对象被插入表头底表");
} }
@ -451,11 +576,13 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
List<TocofsReturngoodsDetailedEntity> tocofsReturngoodsDetailedEntities = copyDetailsDto(stockinBS); List<TocofsReturngoodsDetailedEntity> tocofsReturngoodsDetailedEntities = copyDetailsDto(stockinBS);
if (tocofsReturngoodsDetailedEntities.size() > 0) { if (tocofsReturngoodsDetailedEntities.size() > 0) {
logger.info("TocofsReturngoodsDetailedEntity插入底表{}个对象(表体)", tocofsReturngoodsDetailedEntities.size()); logger.info("TocofsReturngoodsDetailedEntity插入底表{}个对象(表体)", tocofsReturngoodsDetailedEntities.size());
iTocofsReturngoodsDetailedDao.entityInsertBatchV2(tocofsReturngoodsDetailedEntities); iTocofsReturngoodsDetailedDao.entityInsertOrUpdateBatch(tocofsReturngoodsDetailedEntities);
} else { } else {
logger.info("TocofsReturngoodsDetailedEntity没有对象被插入表头底表"); logger.info("TocofsReturngoodsDetailedEntity没有对象被插入表头底表");
} }
} }
} else {
logger.info("returnGoodHeaderDetailsDataDtoArrayList为空或者原始为零!");
} }
} }
@ -467,7 +594,7 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
*/ */
private void implementStock(List<StockinOrderSearchResponse.StockinOrder> returnGoodHeaderDetailsDataDtoList) throws Exception { private void implementStock(List<StockinOrderSearchResponse.StockinOrder> returnGoodHeaderDetailsDataDtoList) throws Exception {
if (returnGoodHeaderDetailsDataDtoList != null) { if (returnGoodHeaderDetailsDataDtoList != null) {
logger.info("TOB退货业务出库成功{}行需要进行数据转换", returnGoodHeaderDetailsDataDtoList.size()); logger.info("TOB售后入库{}行需要进行数据转换", returnGoodHeaderDetailsDataDtoList.size());
} }
if (returnGoodHeaderDetailsDataDtoList != null && returnGoodHeaderDetailsDataDtoList.size() > 0) { if (returnGoodHeaderDetailsDataDtoList != null && returnGoodHeaderDetailsDataDtoList.size() > 0) {
try { try {
@ -478,12 +605,11 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
// 查询销售收发类别 // 查询销售收发类别
// BdRdclEntity bdRdclEntity = rdclUtil.queryRdClObject("201"); // BdRdclEntity bdRdclEntity = rdclUtil.queryRdClObject("201");
try { for (int i = 0; i < orderToBHeaderDtos.size(); i++) {
for (int i = 0; i < orderToBHeaderDtos.size(); i++) { OrderToBHeaderDto orderOutTobHeaderDto = orderToBHeaderDtos.get(i);
OrderToBHeaderDto orderOutTobHeaderDto = orderToBHeaderDtos.get(i); StockinOrderSearchResponse.StockinOrder.StockinH header = orderOutTobHeaderDto.getHeader();
StockinOrderSearchResponse.StockinOrder.StockinH header = orderOutTobHeaderDto.getHeader(); List<StockinOrderSearchResponse.StockinOrder.StockinB> details = orderOutTobHeaderDto.getDetails();
List<StockinOrderSearchResponse.StockinOrder.StockinB> details = orderOutTobHeaderDto.getDetails(); try {
//销售公司发货公司 //销售公司发货公司
BdCorpEntity bdCorpEntity = orderOutTobHeaderDto.getBdCorpEntity(); BdCorpEntity bdCorpEntity = orderOutTobHeaderDto.getBdCorpEntity();
//发货库存组织 //发货库存组织
@ -636,22 +762,34 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
Map<String, List<SaleorderRequestDto>> stringStringMap = new HashMap<>(); Map<String, List<SaleorderRequestDto>> stringStringMap = new HashMap<>();
stringStringMap.put("saleorder", saleorderRequestDtoList); stringStringMap.put("saleorder", saleorderRequestDtoList);
SoSaleResultRootDto soSaleResultRootDto = sendU8CTOCOrder(JSON.toJSONString(stringStringMap)); SoSaleResultRootDto soSaleResultRootDto = sendU8CTOCOrder(JSON.toJSONString(stringStringMap));
String vreceiptcode = null;
String csaleid = null;
String pk_corp = null;
if (soSaleResultRootDto != null) { if (soSaleResultRootDto != null) {
SoSaleResultHeadDto parentvo = soSaleResultRootDto.getParentvo(); SoSaleResultHeadDto parentvo = soSaleResultRootDto.getParentvo();
List<SoSaleResultBodyDto> childrenvo = soSaleResultRootDto.getChildrenvo(); List<SoSaleResultBodyDto> childrenvo = soSaleResultRootDto.getChildrenvo();
logger.info("TOB红字销售订单编号{} 主键:{} 销售公司:{}", parentvo.getVreceiptcode(), parentvo.getCsaleid(), parentvo.getPk_corp()); vreceiptcode = parentvo.getVreceiptcode();
csaleid = parentvo.getCsaleid();
pk_corp = parentvo.getPk_corp();
} }
logger.info("TOB红字销售订单编号{} 销售订单主键:{} 销售公司:{}", vreceiptcode, csaleid, pk_corp);
//记录成功
updateSuccessOrFail1(details, "Y", "success", vreceiptcode, csaleid);
} else { } else {
logger.error("经过SQL查询判断在U8C(红字)销售订单存在OFS入库单号为{} OFS入库主键为{}的单据为了避免造成单据重复不推送到U8C", header.getCode(), header.getId()); logger.error("经过SQL查询判断在U8C(红字)销售订单存在OFS入库单号为{} OFS入库主键为{}的单据为了避免造成单据重复不推送到U8C", header.getCode(), header.getId());
} }
} catch (Exception e) {
logger.error("TOB售后收入推送U8C失败", e);
//记录失败
String message = e.getMessage();
if (message == null) {
message = "未知错误";
}
updateSuccessOrFail1(details, "N", message, null, null);
} }
} catch (Exception e) {
logger.error("TOB业务转换成U8C对象过程中、或者单据推送到U8C出现异常", e);
//记录失败
} }
} catch (Exception e) { } catch (Exception e) {
logger.error("TOB外层转换逻辑抛出异常", e); logger.error("TOB外层转换逻辑抛出异常", e);
// 记录失败
} }
} }
} }
@ -1368,9 +1506,20 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
*/ */
private void createPrimaryKeyAndBusinessDateAndBusinessType(TocofsReturngoodsDetailedEntity tocofsReturngoodsDetailedEntity, StockinOrderSearchResponse.StockinOrder.StockinH returnGoodSearchHeaderDto) { private void createPrimaryKeyAndBusinessDateAndBusinessType(TocofsReturngoodsDetailedEntity tocofsReturngoodsDetailedEntity, StockinOrderSearchResponse.StockinOrder.StockinH returnGoodSearchHeaderDto) {
if (tocofsReturngoodsDetailedEntity != null && returnGoodSearchHeaderDto != null) { if (tocofsReturngoodsDetailedEntity != null && returnGoodSearchHeaderDto != null) {
tocofsReturngoodsDetailedEntity.setPrimaryKey(returnGoodSearchHeaderDto.getId());//主表主键 //主表主键
tocofsReturngoodsDetailedEntity.setBusinessDate(returnGoodSearchHeaderDto.getCheckInFrom());//业务日期 if (tocofsReturngoodsDetailedEntity.getId() != null) {
tocofsReturngoodsDetailedEntity.setBusinessType("TOB_RETURN");//业务类型 tocofsReturngoodsDetailedEntity.setMaintableid(tocofsReturngoodsDetailedEntity.getId());
}
//业务日期-入库时间
if (returnGoodSearchHeaderDto.getCheckInFrom() != null) {
tocofsReturngoodsDetailedEntity.setBusinessdate(returnGoodSearchHeaderDto.getCheckInFrom());
}
//业务日期-退款完成时间
if (returnGoodSearchHeaderDto.getRefundedAt() != null) {
tocofsReturngoodsDetailedEntity.setRefundedat(returnGoodSearchHeaderDto.getRefundedAt());
}
//业务类型
tocofsReturngoodsDetailedEntity.setBusinesstype("TOB_RETURN");
} }
} }
@ -1382,7 +1531,7 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
*/ */
private void implementSuccessfulTrade(List<StockinOrderSearchResponse.StockinOrder> returnGoodHeaderDetailsDataDtoList) throws Exception { private void implementSuccessfulTrade(List<StockinOrderSearchResponse.StockinOrder> returnGoodHeaderDetailsDataDtoList) throws Exception {
if (returnGoodHeaderDetailsDataDtoList != null) { if (returnGoodHeaderDetailsDataDtoList != null) {
logger.info("TOB退货业务交易成功{}行需要进行数据转换", returnGoodHeaderDetailsDataDtoList.size()); logger.info("TOB售后入库退货到账完成{}行需要进行数据转换", returnGoodHeaderDetailsDataDtoList.size());
} }
if (returnGoodHeaderDetailsDataDtoList != null && returnGoodHeaderDetailsDataDtoList.size() > 0) { if (returnGoodHeaderDetailsDataDtoList != null && returnGoodHeaderDetailsDataDtoList.size() > 0) {
try { try {
@ -1400,146 +1549,163 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
StockinOrderSearchResponse.StockinOrder.StockinH header = orderOutTobHeaderDto.getHeader(); StockinOrderSearchResponse.StockinOrder.StockinH header = orderOutTobHeaderDto.getHeader();
List<StockinOrderSearchResponse.StockinOrder.StockinB> details = orderOutTobHeaderDto.getDetails(); List<StockinOrderSearchResponse.StockinOrder.StockinB> details = orderOutTobHeaderDto.getDetails();
//销售公司发货公司 try {
BdCorpEntity bdCorpEntity = orderOutTobHeaderDto.getBdCorpEntity(); //销售公司发货公司
//发货库存组织 BdCorpEntity bdCorpEntity = orderOutTobHeaderDto.getBdCorpEntity();
BdCalbodyEntity bdCalbodyEntity = orderOutTobHeaderDto.getBdCalbodyEntity(); //发货库存组织
//入库仓库 BdCalbodyEntity bdCalbodyEntity = orderOutTobHeaderDto.getBdCalbodyEntity();
BdStordocEntity bdStordocEntity = orderOutTobHeaderDto.getBdStordocEntity(); //入库仓库
//销售组织 BdStordocEntity bdStordocEntity = orderOutTobHeaderDto.getBdStordocEntity();
BdSalestruEntity bdSalestruEntity = orderOutTobHeaderDto.getBdSalestruEntity(); //销售组织
//业务部门 BdSalestruEntity bdSalestruEntity = orderOutTobHeaderDto.getBdSalestruEntity();
BdDeptdocEntity bdDeptdocEntity = orderOutTobHeaderDto.getBdDeptdocEntity(); //业务部门
//客商基本档案 BdDeptdocEntity bdDeptdocEntity = orderOutTobHeaderDto.getBdDeptdocEntity();
BdCubasdocEntity bdCubasdocEntity = orderOutTobHeaderDto.getBdCubasdocEntity(); //客商基本档案
//客商管理档案 BdCubasdocEntity bdCubasdocEntity = orderOutTobHeaderDto.getBdCubasdocEntity();
BdCumandocEntity bdCumandocEntity = orderOutTobHeaderDto.getBdCumandocEntity(); //客商管理档案
//发货公司 BdCumandocEntity bdCumandocEntity = orderOutTobHeaderDto.getBdCumandocEntity();
BdCorpEntity deliverGoodsCorp = orderOutTobHeaderDto.getDeliverGoodsCorp(); //发货公司
//平台档案 BdCorpEntity deliverGoodsCorp = orderOutTobHeaderDto.getDeliverGoodsCorp();
BdDefdocEntity platformArchives = orderOutTobHeaderDto.getPlatformArchives(); //平台档案
//生成业务日期 BdDefdocEntity platformArchives = orderOutTobHeaderDto.getPlatformArchives();
String successfulTradeDate = createSuccessFulTradeDate(orderOutTobHeaderDto); //生成业务日期
//店铺 String successfulTradeDate = createSuccessFulTradeDate(orderOutTobHeaderDto);
BdDefdocEntity shopArchives = orderOutTobHeaderDto.getShopArchives(); //店铺
//U8C销售订单 BdDefdocEntity shopArchives = orderOutTobHeaderDto.getShopArchives();
SoSaleEntity soSaleEntity = orderOutTobHeaderDto.getSoSaleEntity(); //U8C销售订单
//U8C销售订单明细行 SoSaleEntity soSaleEntity = orderOutTobHeaderDto.getSoSaleEntity();
List<SoSaleorderBEntity> soSaleorderBEntityList = orderOutTobHeaderDto.getSoSaleorderBEntityList(); //U8C销售订单明细行
//U8C销售出库单 List<SoSaleorderBEntity> soSaleorderBEntityList = orderOutTobHeaderDto.getSoSaleorderBEntityList();
IcGeneralHEntity icGeneralHEntity = orderOutTobHeaderDto.getIcGeneralHEntity(); //U8C销售出库单
//U8C销售出库单明细行 IcGeneralHEntity icGeneralHEntity = orderOutTobHeaderDto.getIcGeneralHEntity();
List<IcGeneralBEntity> icGeneralBEntityList = orderOutTobHeaderDto.getIcGeneralBEntityList(); //U8C销售出库单明细行
//U8C销售订单执行情况明细表 List<IcGeneralBEntity> icGeneralBEntityList = orderOutTobHeaderDto.getIcGeneralBEntityList();
List<ExtIntegrationTaskLivingDetailsQueryVo> extIntegrationTaskLivingDetailsQueryVos = orderOutTobHeaderDto.getExtIntegrationTaskLivingDetailsQueryVos(); //U8C销售订单执行情况明细表
//OFS销售订单 List<ExtIntegrationTaskLivingDetailsQueryVo> extIntegrationTaskLivingDetailsQueryVos = orderOutTobHeaderDto.getExtIntegrationTaskLivingDetailsQueryVos();
SaleOrderMessageDto saleOrderMessageDto = orderOutTobHeaderDto.getSaleOrderMessageDto(); //OFS销售订单
//OFS售后订单 SaleOrderMessageDto saleOrderMessageDto = orderOutTobHeaderDto.getSaleOrderMessageDto();
RerturnGoodsOrderSearchData ofsRertunOrder = orderOutTobHeaderDto.getOfsRertunOrder(); //OFS售后订单
//OFS收发类别 RerturnGoodsOrderSearchData ofsRertunOrder = orderOutTobHeaderDto.getOfsRertunOrder();
BdRdclEntity bdRdclEntity = orderOutTobHeaderDto.getBdRdclEntity(); //OFS收发类别
BdRdclEntity bdRdclEntity = orderOutTobHeaderDto.getBdRdclEntity();
//红字销售发票表头 //红字销售发票表头
SalesInvoiceHeadDto salesInvoiceHeadDto = new SalesInvoiceHeadDto(); SalesInvoiceHeadDto salesInvoiceHeadDto = new SalesInvoiceHeadDto();
salesInvoiceHeadDto.setCbiztype(bdBusitypeEntity.getPkBusitype()); salesInvoiceHeadDto.setCbiztype(bdBusitypeEntity.getPkBusitype());
salesInvoiceHeadDto.setCcalbodyid(bdCalbodyEntity.getPkCalbody()); salesInvoiceHeadDto.setCcalbodyid(bdCalbodyEntity.getPkCalbody());
salesInvoiceHeadDto.setCoperatorid(OverallConstant.getOverAllValue("u8cApiZdrPK"));//制单人 salesInvoiceHeadDto.setCoperatorid(OverallConstant.getOverAllValue("u8cApiZdrPK"));//制单人
salesInvoiceHeadDto.setCreceiptcorpid(bdCumandocEntity.getPkCumandoc()); salesInvoiceHeadDto.setCreceiptcorpid(bdCumandocEntity.getPkCumandoc());
salesInvoiceHeadDto.setCsalecorpid(bdSalestruEntity.getCsalestruid()); salesInvoiceHeadDto.setCsalecorpid(bdSalestruEntity.getCsalestruid());
salesInvoiceHeadDto.setPk_corp(bdCorpEntity.getPkCorp()); salesInvoiceHeadDto.setPk_corp(bdCorpEntity.getPkCorp());
salesInvoiceHeadDto.setDbilldate(successfulTradeDate); salesInvoiceHeadDto.setDbilldate(successfulTradeDate);
salesInvoiceHeadDto.setFinvoicetype("1");//不传默认为1 salesInvoiceHeadDto.setFinvoicetype("1");//不传默认为1
salesInvoiceHeadDto.setCdeptid(bdDeptdocEntity.getPkDeptdoc());//部门 salesInvoiceHeadDto.setCdeptid(bdDeptdocEntity.getPkDeptdoc());//部门
salesInvoiceHeadDto.setCwarehouseid(bdStordocEntity.getPkStordoc());//仓库 salesInvoiceHeadDto.setCwarehouseid(bdStordocEntity.getPkStordoc());//仓库
salesInvoiceHeadDto.setCdispatcherid(bdRdclEntity.getPkRdcl());//收发类别 salesInvoiceHeadDto.setCdispatcherid(bdRdclEntity.getPkRdcl());//收发类别
salesInvoiceHeadDto.setCreceiptcustomerid(bdCumandocEntity.getPkCumandoc());//收货单位 salesInvoiceHeadDto.setCreceiptcustomerid(bdCumandocEntity.getPkCumandoc());//收货单位
salesInvoiceHeadDto.setCreceipttype("32");//单据类型 salesInvoiceHeadDto.setCreceipttype("32");//单据类型
salesInvoiceHeadDto.setDmakedate(successfulTradeDate);//制单日期 salesInvoiceHeadDto.setDmakedate(successfulTradeDate);//制单日期
salesInvoiceHeadDto.setNdiscountrate("100");//整单折扣 salesInvoiceHeadDto.setNdiscountrate("100");//整单折扣
salesInvoiceHeadDto.setDapprovedate(successfulTradeDate);//审批日期 salesInvoiceHeadDto.setDapprovedate(successfulTradeDate);//审批日期
salesInvoiceHeadDto.setVnote(VNOTETYPE); salesInvoiceHeadDto.setVnote(VNOTETYPE);
salesInvoiceHeadDto.setVdef17(ProfilesActiveConstant.sourceSystem1); salesInvoiceHeadDto.setVdef17(ProfilesActiveConstant.sourceSystem1);
salesInvoiceHeadDto.setVdef19(header.getCode()); salesInvoiceHeadDto.setVdef19(header.getCode());
salesInvoiceHeadDto.setVdef20(header.getId()); salesInvoiceHeadDto.setVdef20(header.getId());
//平台 //平台
salesInvoiceHeadDto.setPk_defdoc2(platformArchives.getPkDefdoc()); salesInvoiceHeadDto.setPk_defdoc2(platformArchives.getPkDefdoc());
salesInvoiceHeadDto.setVdef2(platformArchives.getDocname()); salesInvoiceHeadDto.setVdef2(platformArchives.getDocname());
//店铺 //店铺
salesInvoiceHeadDto.setPk_defdoc1(shopArchives.getPkDefdoc()); salesInvoiceHeadDto.setPk_defdoc1(shopArchives.getPkDefdoc());
salesInvoiceHeadDto.setVdef1(shopArchives.getDocname()); salesInvoiceHeadDto.setVdef1(shopArchives.getDocname());
List<SalesInvoiceBodyDto> salesInvoiceBodyDtoList = new ArrayList<>(); List<SalesInvoiceBodyDto> salesInvoiceBodyDtoList = new ArrayList<>();
for (int j = 0; j < details.size(); j++) { for (int j = 0; j < details.size(); j++) {
StockinOrderSearchResponse.StockinOrder.StockinB stockinB = details.get(j); StockinOrderSearchResponse.StockinOrder.StockinB stockinB = details.get(j);
//存货管理档案取发货公司的存货管理档案 //存货管理档案取发货公司的存货管理档案
BdInvmandocEntity bdInvmandocEntity = queryInventoryMan(stockinB, bdCalbodyEntity.getPkCorp()); BdInvmandocEntity bdInvmandocEntity = queryInventoryMan(stockinB, bdCalbodyEntity.getPkCorp());
//存货基础档案 //存货基础档案
BdInvbasdocEntity bdInvbasdocEntity = queryStockBasicArchives(bdInvmandocEntity.getPkInvmandoc(), deliverGoodsCorp.getPkCorp()); BdInvbasdocEntity bdInvbasdocEntity = queryStockBasicArchives(bdInvmandocEntity.getPkInvmandoc(), deliverGoodsCorp.getPkCorp());
//根据存货基础档案编码查询当前存货的税率 //根据存货基础档案编码查询当前存货的税率
BdTaxitemsEntity bdTaxitemsEntity1 = queryBdTaxitems(bdInvbasdocEntity.getInvcode()); BdTaxitemsEntity bdTaxitemsEntity1 = queryBdTaxitems(bdInvbasdocEntity.getInvcode());
//2024年8月30日 11:20:08 查找对应的售后订单的明细行主要取价格 //2024年8月30日 11:20:08 查找对应的售后订单的明细行主要取价格
RerturnGoodsOrderSearchDetails afterSalesOrder = findAfterSalesOrder(stockinB, ofsRertunOrder); RerturnGoodsOrderSearchDetails afterSalesOrder = findAfterSalesOrder(stockinB, ofsRertunOrder);
//查找来源单据销售发票的来源单据为销售出库单 //查找来源单据销售发票的来源单据为销售出库单
IcGeneralBEntity sourceDocuments = findSourceDocuments(header, stockinB, soSaleorderBEntityList, icGeneralBEntityList, extIntegrationTaskLivingDetailsQueryVos); IcGeneralBEntity sourceDocuments = findSourceDocuments(header, stockinB, soSaleorderBEntityList, icGeneralBEntityList, extIntegrationTaskLivingDetailsQueryVos);
//查找来源销售订单明细行 //查找来源销售订单明细行
SoSaleorderBEntity sourceDocumentsV2 = findSourceDocumentsV2(header, stockinB, soSaleorderBEntityList, extIntegrationTaskLivingDetailsQueryVos); SoSaleorderBEntity sourceDocumentsV2 = findSourceDocumentsV2(header, stockinB, soSaleorderBEntityList, extIntegrationTaskLivingDetailsQueryVos);
BigDecimal noriginalcurtaxprice = null;//含税单价 BigDecimal noriginalcurtaxprice = null;//含税单价
try { try {
noriginalcurtaxprice = new BigDecimal(afterSalesOrder.getTotalAmount()).divide(new BigDecimal(stockinB.getReceivedQty()), 20, BigDecimal.ROUND_HALF_UP).setScale(4, BigDecimal.ROUND_HALF_UP); noriginalcurtaxprice = new BigDecimal(afterSalesOrder.getTotalAmount()).divide(new BigDecimal(stockinB.getReceivedQty()), 20, BigDecimal.ROUND_HALF_UP).setScale(4, BigDecimal.ROUND_HALF_UP);
} catch (Exception e) { } catch (Exception e) {
logger.error("含税单价金额计算失败!", e); logger.error("含税单价金额计算失败!", e);
Assert.state(false, "含税单价金额计算失败 原因:{}", e.getMessage()); Assert.state(false, "含税单价金额计算失败 原因:{}", e.getMessage());
}
Boolean isblargessflag = false;
if (noriginalcurtaxprice == null) {
isblargessflag = true;
}
SalesInvoiceBodyDto salesInvoiceBodyDto = new SalesInvoiceBodyDto();
salesInvoiceBodyDto.setCinventoryid(bdInvmandocEntity.getPkInvmandoc());
salesInvoiceBodyDto.setCupreceipttype("4C");
salesInvoiceBodyDto.setCupsourcebillcode(soSaleEntity.getVreceiptcode());
salesInvoiceBodyDto.setNnumber("-" + stockinB.getReceivedQty());
salesInvoiceBodyDto.setNoriginalcurtaxprice(noriginalcurtaxprice.stripTrailingZeros().toPlainString());//含税单价
salesInvoiceBodyDto.setNtaxrate(new BigDecimal(bdTaxitemsEntity1.getTaxratio()).stripTrailingZeros().toPlainString());//税率
salesInvoiceBodyDto.setBlargessflag(isblargessflag);
salesInvoiceBodyDto.setCoriginalbillcode(soSaleEntity.getVreceiptcode());//源头单据号
salesInvoiceBodyDto.setCsourcebillbodyid(sourceDocumentsV2.getCorderBid());//源头单据明细行主键 (数据字典上是来源单据明细行主键实际上是源头)
salesInvoiceBodyDto.setCsourcebillid(soSaleEntity.getCsaleid());//源头单据主表主键数据字典上是来源单据主表主键实际上是源头
salesInvoiceBodyDto.setCupsourcebillbodyid(sourceDocuments.getCgeneralbid());//上层来源明细行主键
salesInvoiceBodyDto.setCupsourcebillcode(icGeneralHEntity.getVbillcode());//直接来源单据号
salesInvoiceBodyDto.setCupsourcebillid(icGeneralHEntity.getCgeneralhid());//来源主表主键
salesInvoiceBodyDtoList.add(salesInvoiceBodyDto);
} }
SalesInvoiceDto salesInvoiceDto = new SalesInvoiceDto();
salesInvoiceDto.setParentvo(salesInvoiceHeadDto);
salesInvoiceDto.setChildrenvo(salesInvoiceBodyDtoList);
Boolean isblargessflag = false; List<SalesInvoiceDto> salesInvoiceDtoList = new ArrayList<>();
if (noriginalcurtaxprice == null) { salesInvoiceDtoList.add(salesInvoiceDto);
isblargessflag = true;
Map<String, List<SalesInvoiceDto>> stringListMap = new HashMap<>();
stringListMap.put("billvos", salesInvoiceDtoList);
//推送到U8C生成销售发票
Boolean aBoolean = checkTobSalesInvoice(header.getId(), header.getCode());
if (!aBoolean) {
logger.error("经过SQL查询判断在U8C红字销售发票中不存在OFS入库单号为{} OFS入库主键为{}的单据将调用U8C接口执行推送", header.getCode(), header.getId());
SaleinvoiceDto saleinvoiceDto = sendU8CTOCSoSaleinvoiceB(JSON.toJSONString(stringListMap));
String vreceiptcode = null;
String csaleid = null;
String pk_corp = null;
if (saleinvoiceDto != null && saleinvoiceDto.getParentvo() != null && saleinvoiceDto.getChildrenvo() != null) {
SaleinvoiceHeadDto parentvo = saleinvoiceDto.getParentvo();
List<SaleinvoiceBodyDto> childrenvo = saleinvoiceDto.getChildrenvo();
vreceiptcode = parentvo.getVreceiptcode();
csaleid = parentvo.getCsaleid();
pk_corp = parentvo.getPk_corp();
}
logger.info("TOB销售发票(红字)生成成功 编码:{} 主键:{} 发票公司:{}", vreceiptcode, csaleid, pk_corp);
//记录成功
updateSuccessOrFail2(details, "Y", "success", vreceiptcode, csaleid);
} else {
logger.error("经过SQL查询判断在U8C红字销售发票中已经存在OFS入库单号为{} OFS入库主键为{}的单据为了避免造成单据重复不推送到U8C", header.getCode(), header.getId());
} }
} catch (Exception e) {
SalesInvoiceBodyDto salesInvoiceBodyDto = new SalesInvoiceBodyDto(); logger.error("TOB售后到账完成推送U8C抛出异常", e);
salesInvoiceBodyDto.setCinventoryid(bdInvmandocEntity.getPkInvmandoc()); // 记录失败
salesInvoiceBodyDto.setCupreceipttype("4C"); String message = e.getMessage();
salesInvoiceBodyDto.setCupsourcebillcode(soSaleEntity.getVreceiptcode()); if (message == null) {
salesInvoiceBodyDto.setNnumber("-" + stockinB.getReceivedQty()); message = "未知错误";
salesInvoiceBodyDto.setNoriginalcurtaxprice(noriginalcurtaxprice.stripTrailingZeros().toPlainString());//含税单价
salesInvoiceBodyDto.setNtaxrate(new BigDecimal(bdTaxitemsEntity1.getTaxratio()).stripTrailingZeros().toPlainString());//税率
salesInvoiceBodyDto.setBlargessflag(isblargessflag);
salesInvoiceBodyDto.setCoriginalbillcode(soSaleEntity.getVreceiptcode());//源头单据号
salesInvoiceBodyDto.setCsourcebillbodyid(sourceDocumentsV2.getCorderBid());//源头单据明细行主键 (数据字典上是来源单据明细行主键实际上是源头)
salesInvoiceBodyDto.setCsourcebillid(soSaleEntity.getCsaleid());//源头单据主表主键数据字典上是来源单据主表主键实际上是源头
salesInvoiceBodyDto.setCupsourcebillbodyid(sourceDocuments.getCgeneralbid());//上层来源明细行主键
salesInvoiceBodyDto.setCupsourcebillcode(icGeneralHEntity.getVbillcode());//直接来源单据号
salesInvoiceBodyDto.setCupsourcebillid(icGeneralHEntity.getCgeneralhid());//来源主表主键
salesInvoiceBodyDtoList.add(salesInvoiceBodyDto);
}
SalesInvoiceDto salesInvoiceDto = new SalesInvoiceDto();
salesInvoiceDto.setParentvo(salesInvoiceHeadDto);
salesInvoiceDto.setChildrenvo(salesInvoiceBodyDtoList);
List<SalesInvoiceDto> salesInvoiceDtoList = new ArrayList<>();
salesInvoiceDtoList.add(salesInvoiceDto);
Map<String, List<SalesInvoiceDto>> stringListMap = new HashMap<>();
stringListMap.put("billvos", salesInvoiceDtoList);
//推送到U8C生成销售发票
Boolean aBoolean = checkTobSalesInvoice(header.getId(), header.getCode());
if (!aBoolean) {
logger.error("经过SQL查询判断在U8C红字销售发票中不存在OFS入库单号为{} OFS入库主键为{}的单据将调用U8C接口执行推送", header.getCode(), header.getId());
SaleinvoiceDto saleinvoiceDto = sendU8CTOCSoSaleinvoiceB(JSON.toJSONString(stringListMap));
if (saleinvoiceDto != null && saleinvoiceDto.getParentvo() != null && saleinvoiceDto.getChildrenvo() != null) {
SaleinvoiceHeadDto parentvo = saleinvoiceDto.getParentvo();
List<SaleinvoiceBodyDto> childrenvo = saleinvoiceDto.getChildrenvo();
logger.info("TOB销售发票(红字)生成成功 编码:{} 主键:{} 发票公司:{}", parentvo.getVreceiptcode(), parentvo.getCsaleid(), parentvo.getPk_corp());
} }
} else { updateSuccessOrFail2(details, "N", message, null, null);
logger.error("经过SQL查询判断在U8C红字销售发票中已经存在OFS入库单号为{} OFS入库主键为{}的单据为了避免造成单据重复不推送到U8C", header.getCode(), header.getId());
} }
} }
} catch (Exception e) { } catch (Exception e) {
logger.error("TOB外层转换逻辑抛出异常", e); logger.error("TOB外层转换逻辑抛出异常", e);
// 记录失败
} }
} }
} }
@ -1869,4 +2035,125 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
logger.error("记录splitDateAndPush方法抛出的异常", e); logger.error("记录splitDateAndPush方法抛出的异常", e);
} }
} }
/**
* 处理TOC-库存同步的成功失败错误逻辑
*
* @author liuyang
*/
private void updateSuccessOrFail1(List<StockinOrderSearchResponse.StockinOrder.StockinB> sonDetailsDtoList, String newstate, String newTransmitInfo, String newsystemnumber, String newsystemprimary) {
if (newTransmitInfo != null && !"".equals(newTransmitInfo.trim()) && newTransmitInfo.length() >= 400) {
newTransmitInfo = newTransmitInfo.substring(0, 400);
}
String finalNewTransmitInfo = newTransmitInfo;
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
try {
String successY = "Y";
if (sonDetailsDtoList != null && sonDetailsDtoList.size() > 0) {
List<TocofsReturngoodsDetailedEntity> tocofsReturngoodsDetailedEntityArrayList = new ArrayList<>();
for (int i = 0; i < sonDetailsDtoList.size(); i++) {
StockinOrderSearchResponse.StockinOrder.StockinB stockinB = sonDetailsDtoList.get(i);
TocofsReturngoodsDetailedEntity tocofsReturngoodsDetailedEntity = new TocofsReturngoodsDetailedEntity();
tocofsReturngoodsDetailedEntity.setId(stockinB.getId());
tocofsReturngoodsDetailedEntity.setNewpushdate(getNewDateStr());
tocofsReturngoodsDetailedEntity.setNewtransmitinfo(finalNewTransmitInfo);
tocofsReturngoodsDetailedEntity.setNewstate(newstate);
if (successY.equals(newstate)) {
tocofsReturngoodsDetailedEntity.setNewsystemnumber(newsystemnumber);
tocofsReturngoodsDetailedEntity.setNewsystemprimary(newsystemprimary);
}
tocofsReturngoodsDetailedEntityArrayList.add(tocofsReturngoodsDetailedEntity);
}
//以50行为一个批次推送到Mysql
if (tocofsReturngoodsDetailedEntityArrayList.size() > 0) {
List<List<TocofsReturngoodsDetailedEntity>> splitListByCount = SplitListByCountUtil.splitListByCount(tocofsReturngoodsDetailedEntityArrayList, 50);
for (int i = 0; i < splitListByCount.size(); i++) {
List<TocofsReturngoodsDetailedEntity> tocofsReturngoodsDetailedEntities = splitListByCount.get(i);
iTocofsReturngoodsDetailedDao.entityInsertOrUpdateBatchByTobRerturnStock(tocofsReturngoodsDetailedEntities);
}
}
}
} catch (Exception e) {
logger.error("TOC库存同步日志抛出异常", e);
}
}
});
thread.start();
try {
thread.join();
} catch (Exception e) {
logger.error("updateSuccessOrFail1方法现场抛出异常", e);
}
}
/**
* 生成当前日期
*
* @author liuyang
*/
private String getNewDateStr() {
LocalDateTime now = LocalDateTime.now();
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
return now.format(formatter);
}
/**
* 处理TOC-库存同步的成功失败错误逻辑
*
* @author liuyang
*/
private void updateSuccessOrFail2(List<StockinOrderSearchResponse.StockinOrder.StockinB> sonDetailsDtoList, String newstate, String newTransmitInfo, String newsystemnumber, String newsystemprimary) {
if (newTransmitInfo != null && !"".equals(newTransmitInfo.trim()) && newTransmitInfo.length() >= 400) {
newTransmitInfo = newTransmitInfo.substring(0, 400);
}
String finalNewTransmitInfo = newTransmitInfo;
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
try {
String successY = "Y";
if (sonDetailsDtoList != null && sonDetailsDtoList.size() > 0) {
List<TocofsReturngoodsDetailedEntity> tocofsReturngoodsDetailedEntityArrayList = new ArrayList<>();
for (int i = 0; i < sonDetailsDtoList.size(); i++) {
StockinOrderSearchResponse.StockinOrder.StockinB stockinB = sonDetailsDtoList.get(i);
TocofsReturngoodsDetailedEntity tocofsReturngoodsDetailedEntity = new TocofsReturngoodsDetailedEntity();
tocofsReturngoodsDetailedEntity.setId(stockinB.getId());
tocofsReturngoodsDetailedEntity.setNewpushdate2(getNewDateStr());
tocofsReturngoodsDetailedEntity.setNewtransmitinfo2(finalNewTransmitInfo);
tocofsReturngoodsDetailedEntity.setNewstate2(newstate);
if (successY.equals(newstate)) {
tocofsReturngoodsDetailedEntity.setNewsystemnumber2(newsystemnumber);
tocofsReturngoodsDetailedEntity.setNewsystemprimary2(newsystemprimary);
}
tocofsReturngoodsDetailedEntityArrayList.add(tocofsReturngoodsDetailedEntity);
}
//以50行为一个批次推送到Mysql
if (tocofsReturngoodsDetailedEntityArrayList.size() > 0) {
List<List<TocofsReturngoodsDetailedEntity>> splitListByCount = SplitListByCountUtil.splitListByCount(tocofsReturngoodsDetailedEntityArrayList, 50);
for (int i = 0; i < splitListByCount.size(); i++) {
List<TocofsReturngoodsDetailedEntity> tocofsReturngoodsDetailedEntities = splitListByCount.get(i);
iTocofsReturngoodsDetailedDao.entityInsertOrUpdateBatchByTobRerturnTran(tocofsReturngoodsDetailedEntities);
}
}
}
} catch (Exception e) {
logger.error("TOC库存同步日志抛出异常", e);
}
}
});
thread.start();
try {
thread.join();
} catch (Exception e) {
logger.error("updateSuccessOrFail2方法现场抛出异常", e);
}
}
} }

View File

@ -0,0 +1,33 @@
package com.hzya.frame.plugin.lets.u8cdto;
import com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDetailsDto;
import com.hzya.frame.ttxofs.dto.stock.StockinOrderSearchResponse;
import lombok.Data;
/**
* @Authorliuyang
* @Packagecom.hzya.frame.plugin.lets.u8cdto
* @ProjectkangarooDataCenterV3
* @nameErrorHeaderDetailsDtoDto
* @Date2024/9/5 15:48
* @FilenameErrorHeaderDetailsDtoDto
*/
@Data
public class ErrorHeaderDetailsDtoDtoV2 extends StockinOrderSearchResponse.StockinOrder {
//(销售)推送时间
private String newPushDate;
//(销售)报错详情
private String newTransmitInfo;
//(销售)出库同步是否成功
private String newstate;
//推送时间
private String def5;
//报错详情
private String def6;
//(销售)交易成功(TOB发票)是否成功
private String newstate4;
//下游单号
private String newSystemNumber4;
//下游主键
private String newSystemPrimary4;
}

View File

@ -102,6 +102,9 @@ public class StockinOrderSearchResponse extends ReturnMessageBasics {
private String lastUpdated; private String lastUpdated;
private String lastUpdatedBy; private String lastUpdatedBy;
private String discountPrice; private String discountPrice;
private String newstate;
private String newstate3;
private String newstate4;
//表头对象 //表头对象
private StockinH returnGoodSearchHeaderDto; private StockinH returnGoodSearchHeaderDto;
} }