数据库交互优化及代码清理
- 优化数据库批量插入或更新逻辑,使用`list`代替`entities`集合属性。 - 在`SoSaleOutPluginInitializerToB`和`SoSaleOutPluginInitializerToC`中,改进数据行状态检查逻辑,提高代码可读性及性能。 - 移除不必要的`if`条件检查,使代码更加简洁有效。 - 更新`TocofsReturngoodsDetailedDaoImpl`及`ITocofsReturngoodsDetailedDao`接口,添加V2版本方法以支持新的批量操作。 - 在XML配置中添加新的批量插入或更新语句,对应新添加的V2版本方法。
This commit is contained in:
parent
b16d708566
commit
781c646d85
|
@ -40,10 +40,24 @@ public interface ITocofsReturngoodsDetailedDao extends IBaseDao<TocofsReturngood
|
|||
*/
|
||||
void entityInsertOrUpdateBatchByTobRerturnStock(List<TocofsReturngoodsDetailedEntity> tocofsReturngoodsDetailedEntityList) throws Exception;
|
||||
|
||||
/**
|
||||
* 批量新增或者修改,TOB退货-库存
|
||||
*
|
||||
* @author liuyang
|
||||
*/
|
||||
void entityInsertOrUpdateBatchByTobRerturnStockV2(List<TocofsReturngoodsDetailedEntity> tocofsReturngoodsDetailedEntityList) throws Exception;
|
||||
|
||||
/**
|
||||
* 批量新增或者修改,TOB退货-确认收入
|
||||
*
|
||||
* @author liuyang
|
||||
*/
|
||||
void entityInsertOrUpdateBatchByTobRerturnTran(List<TocofsReturngoodsDetailedEntity> tocofsReturngoodsDetailedEntityList) throws Exception;
|
||||
|
||||
/**
|
||||
* 批量新增或者修改,TOB退货-确认收入
|
||||
*
|
||||
* @author liuyang
|
||||
*/
|
||||
void entityInsertOrUpdateBatchByTobRerturnTranV2(List<TocofsReturngoodsDetailedEntity> tocofsReturngoodsDetailedEntityList) throws Exception;
|
||||
}
|
|
@ -35,9 +35,19 @@ public class TocofsReturngoodsDetailedDaoImpl extends MybatisGenericDao<TocofsRe
|
|||
insert("com.hzya.frame.plugin.lets.ofs.dao.impl.TocofsReturngoodsDetailedDaoImpl.entityInsertOrUpdateBatchByTobRerturnStock", tocofsReturngoodsDetailedEntityList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void entityInsertOrUpdateBatchByTobRerturnStockV2(List<TocofsReturngoodsDetailedEntity> tocofsReturngoodsDetailedEntityList) throws Exception {
|
||||
insert("com.hzya.frame.plugin.lets.ofs.dao.impl.TocofsReturngoodsDetailedDaoImpl.entityInsertOrUpdateBatchByTobRerturnStockV2", tocofsReturngoodsDetailedEntityList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void entityInsertOrUpdateBatchByTobRerturnTran(List<TocofsReturngoodsDetailedEntity> tocofsReturngoodsDetailedEntityList) throws Exception {
|
||||
insert("com.hzya.frame.plugin.lets.ofs.dao.impl.TocofsReturngoodsDetailedDaoImpl.entityInsertOrUpdateBatchByTobRerturnTran", tocofsReturngoodsDetailedEntityList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void entityInsertOrUpdateBatchByTobRerturnTranV2(List<TocofsReturngoodsDetailedEntity> tocofsReturngoodsDetailedEntityList) throws Exception {
|
||||
insert("com.hzya.frame.plugin.lets.ofs.dao.impl.TocofsReturngoodsDetailedDaoImpl.entityInsertOrUpdateBatchByTobRerturnTranV2", tocofsReturngoodsDetailedEntityList);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -828,7 +828,7 @@
|
|||
<insert id="entityInsertBatch" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into tocofs_returngoods_detailed(receiptId, receiptCode, refOrderId, refOrderDetailId, sourceOrderCode, sourceLineNum, clientCode, companyCode, facilityCode, skuCode, skuName, requestQty, receivedQty, openQty, quantityUM, totalWeight, totalVolume, totalVolumeWeight, totalAmount, weightUM, volumeUM, inventorySts, inTransInvId, closed, created, createdBy, lastUpdated, lastUpdatedBy, discountPrice, mainTableId, newTransmitInfo, newPushDate, newState, newSystemNumber, newSystemPrimary, newTransmitInfo2, newPushDate2, newState2, newSystemNumber2, newSystemPrimary2, newTransmitInfo3, newPushDate3, newState3, newSystemNumber3, newSystemPrimary3, newTransmitInfo4, newPushDate4, newState4, newSystemNumber4, newSystemPrimary4, businessDate, refundedAt, businessType, def1, def2, def3, def4, def5, def6, def7, def8, def9, def10, def11, def12, def13, def14, def15, def16, def17, def18, def19, def20, def21, def22, def23, def24, def25, def26, def27, def28, def29, def30, def31, def32, def33, def34, def35, def36, def37, def38, def39, def40)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
<foreach collection="list" item="entity" separator=",">
|
||||
(#{entity.receiptid},#{entity.receiptcode},#{entity.reforderid},#{entity.reforderdetailid},#{entity.sourceordercode},#{entity.sourcelinenum},#{entity.clientcode},#{entity.companycode},#{entity.facilitycode},#{entity.skucode},#{entity.skuname},#{entity.requestqty},#{entity.receivedqty},#{entity.openqty},#{entity.quantityum},#{entity.totalweight},#{entity.totalvolume},#{entity.totalvolumeweight},#{entity.totalamount},#{entity.weightum},#{entity.volumeum},#{entity.inventorysts},#{entity.intransinvid},#{entity.closed},#{entity.created},#{entity.createdby},#{entity.lastupdated},#{entity.lastupdatedby},#{entity.discountprice},#{entity.maintableid},#{entity.newtransmitinfo},#{entity.newpushdate},#{entity.newstate},#{entity.newsystemnumber},#{entity.newsystemprimary},#{entity.newtransmitinfo2},#{entity.newpushdate2},#{entity.newstate2},#{entity.newsystemnumber2},#{entity.newsystemprimary2},#{entity.newtransmitinfo3},#{entity.newpushdate3},#{entity.newstate3},#{entity.newsystemnumber3},#{entity.newsystemprimary3},#{entity.newtransmitinfo4},#{entity.newpushdate4},#{entity.newstate4},#{entity.newsystemnumber4},#{entity.newsystemprimary4},#{entity.businessdate},#{entity.refundedat},#{entity.businesstype},#{entity.def1},#{entity.def2},#{entity.def3},#{entity.def4},#{entity.def5},#{entity.def6},#{entity.def7},#{entity.def8},#{entity.def9},#{entity.def10},#{entity.def11},#{entity.def12},#{entity.def13},#{entity.def14},#{entity.def15},#{entity.def16},#{entity.def17},#{entity.def18},#{entity.def19},#{entity.def20},#{entity.def21},#{entity.def22},#{entity.def23},#{entity.def24},#{entity.def25},#{entity.def26},#{entity.def27},#{entity.def28},#{entity.def29},#{entity.def30},#{entity.def31},#{entity.def32},#{entity.def33},#{entity.def34},#{entity.def35},#{entity.def36},#{entity.def37},#{entity.def38},#{entity.def39},#{entity.def40})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
@ -881,8 +881,8 @@
|
|||
<insert id="entityInsertOrUpdateBatchByTocRerturnStock" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into tocofs_returngoods_detailed(id,newPushDate3,newTransmitInfo3,newState3,newSystemNumber3,newSystemPrimary3)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.id},#{entity.newpushdate3},#{entity.newtransmitinfo3},#{newstate3},#{newsystemnumber3},#{newSystemPrimary3})
|
||||
<foreach collection="list" item="entity" separator=",">
|
||||
(#{entity.id},#{entity.newpushdate3},#{entity.newtransmitinfo3},#{entity.newstate3},#{entity.newsystemnumber3},#{entity.newSystemPrimary3})
|
||||
</foreach>
|
||||
on duplicate key update
|
||||
id = values(id),
|
||||
|
@ -897,8 +897,8 @@
|
|||
<insert id="entityInsertOrUpdateBatchByTocRerturnTran" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into tocofs_returngoods_detailed(id,newPushDate4,newTransmitInfo4,newState4,newSystemNumber4,newSystemPrimary4)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.id},#{entity.newpushdate4},#{entity.newtransmitinfo4},#{newstate4},#{newsystemnumber4},#{newsystemprimary4})
|
||||
<foreach collection="list" item="entity" separator=",">
|
||||
(#{entity.id},#{entity.newpushdate4},#{entity.newtransmitinfo4},#{entity.newstate4},#{entity.newsystemnumber4},#{entity.newsystemprimary4})
|
||||
</foreach>
|
||||
on duplicate key update
|
||||
id = values(id),
|
||||
|
@ -913,8 +913,8 @@
|
|||
<insert id="entityInsertOrUpdateBatchByTobRerturnStock" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into tocofs_returngoods_detailed(id,newPushDate,newTransmitInfo,newState,newSystemNumber,newSystemPrimary)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.id},#{entity.newpushdate},#{entity.newtransmitinfo},#{newstate},#{newsystemnumber},#{newSystemPrimary})
|
||||
<foreach collection="list" item="entity" separator=",">
|
||||
(#{entity.id},#{entity.newpushdate},#{entity.newtransmitinfo},#{entity.newstate},#{entity.newsystemnumber},#{entity.newsystemprimary})
|
||||
</foreach>
|
||||
on duplicate key update
|
||||
id = values(id),
|
||||
|
@ -925,12 +925,26 @@
|
|||
newSystemPrimary = values(newSystemPrimary)
|
||||
</insert>
|
||||
|
||||
<!-- 批量新增或者修改,TOB退货-库存-->
|
||||
<insert id="entityInsertOrUpdateBatchByTobRerturnStockV2" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into tocofs_returngoods_detailed(id,newPushDate,newTransmitInfo,newState)
|
||||
values
|
||||
<foreach collection="list" item="entity" separator=",">
|
||||
(#{entity.id},#{entity.newpushdate},#{entity.newtransmitinfo},#{entity.newstate})
|
||||
</foreach>
|
||||
on duplicate key update
|
||||
id = values(id),
|
||||
newPushDate = values(newPushDate),
|
||||
newTransmitInfo = values(newTransmitInfo),
|
||||
newState = values(newState)
|
||||
</insert>
|
||||
|
||||
<!-- 批量新增或者修改,TOB退货-确认收入-->
|
||||
<insert id="entityInsertOrUpdateBatchByTobRerturnTran" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into tocofs_returngoods_detailed(id,newPushDate2,newTransmitInfo2,newState2,newSystemNumber2,newSystemPrimary2)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.id},#{entity.newpushdate2},#{entity.newtransmitinfo2},#{newstate2},#{newsystemnumber2},#{newsystemprimary2})
|
||||
<foreach collection="list" item="entity" separator=",">
|
||||
(#{entity.id},#{entity.newpushdate2},#{entity.newtransmitinfo2},#{entity.newstate2},#{entity.newsystemnumber2},#{entity.newsystemprimary2})
|
||||
</foreach>
|
||||
on duplicate key update
|
||||
id = values(id),
|
||||
|
@ -941,6 +955,19 @@
|
|||
newSystemPrimary2 = values(newSystemPrimary2)
|
||||
</insert>
|
||||
|
||||
<!-- 批量新增或者修改,TOB退货-确认收入-->
|
||||
<insert id="entityInsertOrUpdateBatchByTobRerturnTranV2" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into tocofs_returngoods_detailed(id,newPushDate2,newTransmitInfo2,newState2)
|
||||
values
|
||||
<foreach collection="list" item="entity" separator=",">
|
||||
(#{entity.id},#{entity.newpushdate2},#{entity.newtransmitinfo2},#{entity.newstate2})
|
||||
</foreach>
|
||||
on duplicate key update
|
||||
id = values(id),
|
||||
newPushDate2 = values(newPushDate2),
|
||||
newTransmitInfo2 = values(newTransmitInfo2),
|
||||
newState2 = values(newState2)
|
||||
</insert>
|
||||
|
||||
|
||||
<!--通过主键修改方法-->
|
||||
|
|
|
@ -466,7 +466,7 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
|
|||
*/
|
||||
private List<com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDetailsDto> filterDataRowsAsPushOrFailedStock(List<TocofsSaleoutDetailedEntity> allTocofsSaleoutDetailedEntityList, List<com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDetailsDto> headerDetailsDtoList) throws Exception {
|
||||
List<com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDetailsDto> targetHeaderDetailsDtoList = new ArrayList<>();
|
||||
if (allTocofsSaleoutDetailedEntityList != null && allTocofsSaleoutDetailedEntityList.size() > 0 && headerDetailsDtoList != null && headerDetailsDtoList.size() > 0) {
|
||||
if (headerDetailsDtoList != null && headerDetailsDtoList.size() > 0) {
|
||||
//字段Y(成功)或者为H(待处理)可以视为成功,完成了小段业务闭环的数据行
|
||||
String succeseeY = "Y";
|
||||
String succeseeH = "H";
|
||||
|
@ -480,6 +480,7 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
|
|||
DetailsDto detailsDto = details.get(j);
|
||||
Boolean isSuccess = false;
|
||||
String newstate = null;
|
||||
if (allTocofsSaleoutDetailedEntityList != null && allTocofsSaleoutDetailedEntityList.size() > 0) {
|
||||
for (int k = 0; k < allTocofsSaleoutDetailedEntityList.size(); k++) {
|
||||
TocofsSaleoutDetailedEntity tocofsSaleoutDetailedEntity = allTocofsSaleoutDetailedEntityList.get(k);
|
||||
if (tocofsSaleoutDetailedEntity.getId().equals(detailsDto.getId())) {
|
||||
|
@ -489,6 +490,7 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!isSuccess) {
|
||||
detailsDto.setNewState(newstate);
|
||||
targetDetails.add(detailsDto);
|
||||
|
@ -532,7 +534,7 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
|
|||
*/
|
||||
private List<com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDetailsDto> filterDataRowsAsPushOrFailedTran(List<TocofsSaleoutDetailedEntity> allTocofsSaleoutDetailedEntityList, List<com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDetailsDto> headerDetailsDtoList) throws Exception {
|
||||
List<com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDetailsDto> targetHeaderDetailsDtoList = new ArrayList<>();
|
||||
if (allTocofsSaleoutDetailedEntityList != null && allTocofsSaleoutDetailedEntityList.size() > 0 && headerDetailsDtoList != null && headerDetailsDtoList.size() > 0) {
|
||||
if (headerDetailsDtoList != null && headerDetailsDtoList.size() > 0) {
|
||||
//字段Y(成功)或者为H(待处理)可以视为成功,完成了小段业务闭环的数据行
|
||||
String succeseeY = "Y";
|
||||
String succeseeH = "H";
|
||||
|
@ -547,6 +549,7 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
|
|||
|
||||
Boolean isSuccess = false;
|
||||
String newstate4 = null;
|
||||
if (allTocofsSaleoutDetailedEntityList != null && allTocofsSaleoutDetailedEntityList.size() > 0) {
|
||||
for (int k = 0; k < allTocofsSaleoutDetailedEntityList.size(); k++) {
|
||||
TocofsSaleoutDetailedEntity tocofsSaleoutDetailedEntity = allTocofsSaleoutDetailedEntityList.get(k);
|
||||
if (tocofsSaleoutDetailedEntity.getId().equals(detailsDto.getId())) {
|
||||
|
@ -558,6 +561,7 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!isSuccess) {
|
||||
//拷贝推送状态参数,方便推送是进行判断
|
||||
detailsDto.setNewState4(newstate4);
|
||||
|
|
|
@ -483,7 +483,7 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
|
|||
*/
|
||||
private List<com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDetailsDto> filterDataRowsAsPushOrFailedStock(List<TocofsSaleoutDetailedEntity> allTocofsSaleoutDetailedEntityList, List<com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDetailsDto> headerDetailsDtoList) throws Exception {
|
||||
List<com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDetailsDto> targetHeaderDetailsDtoList = new ArrayList<>();
|
||||
if (allTocofsSaleoutDetailedEntityList != null && allTocofsSaleoutDetailedEntityList.size() > 0 && headerDetailsDtoList != null && headerDetailsDtoList.size() > 0) {
|
||||
if (headerDetailsDtoList != null && headerDetailsDtoList.size() > 0) {
|
||||
//字段Y(成功)或者为H(待处理)可以视为成功,完成了小段业务闭环的数据行
|
||||
String succeseeY = "Y";
|
||||
String succeseeH = "H";
|
||||
|
@ -497,6 +497,7 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
|
|||
DetailsDto detailsDto = details.get(j);
|
||||
Boolean isSuccess = false;
|
||||
String newstate = null;
|
||||
if (allTocofsSaleoutDetailedEntityList.size() > 0) {
|
||||
for (int k = 0; k < allTocofsSaleoutDetailedEntityList.size(); k++) {
|
||||
TocofsSaleoutDetailedEntity tocofsSaleoutDetailedEntity = allTocofsSaleoutDetailedEntityList.get(k);
|
||||
if (tocofsSaleoutDetailedEntity.getId().equals(detailsDto.getId())) {
|
||||
|
@ -506,6 +507,7 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!isSuccess) {
|
||||
detailsDto.setNewState(newstate);
|
||||
targetDetails.add(detailsDto);
|
||||
|
@ -530,7 +532,7 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
|
|||
*/
|
||||
private List<com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDetailsDto> filterDataRowsAsPushOrFailedTran(List<TocofsSaleoutDetailedEntity> allTocofsSaleoutDetailedEntityList, List<com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDetailsDto> headerDetailsDtoList) throws Exception {
|
||||
List<com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDetailsDto> targetHeaderDetailsDtoList = new ArrayList<>();
|
||||
if (allTocofsSaleoutDetailedEntityList != null && allTocofsSaleoutDetailedEntityList.size() > 0 && headerDetailsDtoList != null && headerDetailsDtoList.size() > 0) {
|
||||
if (headerDetailsDtoList != null && headerDetailsDtoList.size() > 0) {
|
||||
//字段Y(成功)或者为H(待处理)可以视为成功,完成了小段业务闭环的数据行
|
||||
String succeseeY = "Y";
|
||||
String succeseeH = "H";
|
||||
|
@ -547,6 +549,7 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
|
|||
String newstate2 = null;
|
||||
String newstate3 = null;
|
||||
// TocofsSaleoutDetailedEntity targetTocofsSaleoutDetailedEntity = null;
|
||||
if (allTocofsSaleoutDetailedEntityList != null && allTocofsSaleoutDetailedEntityList.size() > 0) {
|
||||
for (int k = 0; k < allTocofsSaleoutDetailedEntityList.size(); k++) {
|
||||
TocofsSaleoutDetailedEntity tocofsSaleoutDetailedEntity = allTocofsSaleoutDetailedEntityList.get(k);
|
||||
if (tocofsSaleoutDetailedEntity.getId().equals(detailsDto.getId())) {
|
||||
|
@ -560,6 +563,7 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!isSuccess) {
|
||||
//拷贝推送状态参数,方便推送是进行判断
|
||||
detailsDto.setNewState2(newstate2);
|
||||
|
|
|
@ -17,6 +17,7 @@ import com.hzya.frame.plugin.lets.ofs.dao.ITocofsReturngoodsDao;
|
|||
import com.hzya.frame.plugin.lets.ofs.dao.ITocofsReturngoodsDetailedDao;
|
||||
import com.hzya.frame.plugin.lets.ofs.entity.TocofsReturngoodsDetailedEntity;
|
||||
import com.hzya.frame.plugin.lets.ofs.entity.TocofsReturngoodsEntity;
|
||||
import com.hzya.frame.plugin.lets.ofs.entity.TocofsSaleoutDetailedEntity;
|
||||
import com.hzya.frame.plugin.lets.ofsvo.QueryOfsSoSaleOutVo;
|
||||
import com.hzya.frame.plugin.lets.queryvo.ExtIntegrationTaskLivingDetailsQueryVo;
|
||||
import com.hzya.frame.plugin.lets.queryvo.StartAndEndVo;
|
||||
|
@ -25,7 +26,7 @@ import com.hzya.frame.plugin.lets.u8cdto.*;
|
|||
import com.hzya.frame.plugin.lets.util.*;
|
||||
import com.hzya.frame.split.SplitListByCountUtil;
|
||||
import com.hzya.frame.ttxofs.dto.InterfaceParamDto;
|
||||
import com.hzya.frame.ttxofs.dto.ofssalesordersearch.DetailsDto;
|
||||
import com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.DetailsDto;
|
||||
import com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDetailsDto;
|
||||
import com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDto;
|
||||
import com.hzya.frame.ttxofs.dto.ofssalesordersearch.SaleOrderMessageDto;
|
||||
|
@ -104,7 +105,7 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
|
|||
if (ProfilesActiveConstant.TYPE_VBILLCODE.equals(requestJson.get("type"))) {
|
||||
//按单号
|
||||
if (param != null && !"".equals(param)) {
|
||||
startImplementByCode(param);
|
||||
startImplementByCode(param, sceneType);
|
||||
}
|
||||
} else if (ProfilesActiveConstant.TYPE_TIME_FRAME.equals(requestJson.get("type"))) {
|
||||
//前台页面功能日期推送,或者接口调用也行
|
||||
|
@ -322,7 +323,7 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
|
|||
*
|
||||
* @author liuyang
|
||||
*/
|
||||
public void startImplementByCode(String code) {
|
||||
public void startImplementByCode(String code, String sceneType) {
|
||||
long startMillis = System.currentTimeMillis();
|
||||
String threadNameStrStart = StrUtil.format("OFS售后入库(TOB)同步U8C销售订单(库存同步) 售后入库单号:{}", code);
|
||||
logger.info(threadNameStrStart);
|
||||
|
@ -351,7 +352,11 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
|
|||
ofsStandardUtil.queryOfsReturnGoods(queryOfsSoSaleOutVo, returnGoodHeaderDetailsDataDtoArrayList, 1L, "ofs.receipt.search");
|
||||
logger.info("数据返回行数:{}", returnGoodHeaderDetailsDataDtoArrayList.size());
|
||||
if (returnGoodHeaderDetailsDataDtoArrayList.size() > 0) {
|
||||
if (sceneType.equals("stock")) {
|
||||
getSetStock(returnGoodHeaderDetailsDataDtoArrayList);
|
||||
} else if (sceneType.equals("tran")) {
|
||||
getSetTrade(returnGoodHeaderDetailsDataDtoArrayList);
|
||||
}
|
||||
} else {
|
||||
logger.info("没有查询到任何数据!不需要同步");
|
||||
}
|
||||
|
@ -422,14 +427,14 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
|
|||
/**
|
||||
* 筛选出未推送、或者失败的数据行,过滤库存同步业务
|
||||
*
|
||||
* @param tocofsReturngoodsDetailedEntityList 日志行状态
|
||||
* @param tocofsReturngoodsDetailedEntityList 日志行状态,可能为0
|
||||
* @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) {
|
||||
if (returnGoodHeaderDetailsDataDtoArrayList != null && returnGoodHeaderDetailsDataDtoArrayList.size() > 0) {
|
||||
//字段Y(成功)或者为H(待处理)可以视为成功,完成了小段业务闭环的数据行
|
||||
String succeseeY = "Y";
|
||||
String succeseeH = "H";
|
||||
|
@ -443,6 +448,57 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
|
|||
StockinOrderSearchResponse.StockinOrder.StockinB stockinB = details.get(j);
|
||||
Boolean isSuccess = false;
|
||||
String newstate = null;
|
||||
if (tocofsReturngoodsDetailedEntityList != null && tocofsReturngoodsDetailedEntityList.size() > 0) {
|
||||
for (int k = 0; k < tocofsReturngoodsDetailedEntityList.size(); k++) {
|
||||
TocofsReturngoodsDetailedEntity tocofsReturngoodsDetailedEntity = tocofsReturngoodsDetailedEntityList.get(k);
|
||||
if (tocofsReturngoodsDetailedEntity.getId().equals(stockinB.getId())) {
|
||||
newstate = tocofsReturngoodsDetailedEntity.getNewstate();
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 筛选出未推送、或者失败的数据行,过滤库存同步业务
|
||||
*
|
||||
* @param tocofsReturngoodsDetailedEntityList 日志行状态
|
||||
* @param returnGoodHeaderDetailsDataDtoArrayList 返回结果
|
||||
* @author liuyang
|
||||
*/
|
||||
private List<StockinOrderSearchResponse.StockinOrder> filterDataRowsAsPushOrFailedTran(List<TocofsReturngoodsDetailedEntity> tocofsReturngoodsDetailedEntityList, List<StockinOrderSearchResponse.StockinOrder> returnGoodHeaderDetailsDataDtoArrayList) throws Exception {
|
||||
List<StockinOrderSearchResponse.StockinOrder> targetHeaderDetailsDtoList = new ArrayList<>();
|
||||
|
||||
if (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;
|
||||
if (tocofsReturngoodsDetailedEntityList != null && tocofsReturngoodsDetailedEntityList.size() > 0) {
|
||||
for (int k = 0; k < tocofsReturngoodsDetailedEntityList.size(); k++) {
|
||||
TocofsReturngoodsDetailedEntity tocofsReturngoodsDetailedEntity = tocofsReturngoodsDetailedEntityList.get(k);
|
||||
if (tocofsReturngoodsDetailedEntity.getId().equals(stockinB.getId())) {
|
||||
|
@ -452,6 +508,7 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!isSuccess) {
|
||||
stockinB.setNewstate(newstate);
|
||||
targetDetails.add(stockinB);
|
||||
|
@ -528,7 +585,7 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
|
|||
tocofsReturngoodsDetailedEntityList.addAll(tocofsReturngoodsDetailedEntities);
|
||||
}
|
||||
}
|
||||
return filterDataRowsAsPushOrFailedStock(tocofsReturngoodsDetailedEntityList, returnGoodHeaderDetailsDataDtoArrayList);
|
||||
return filterDataRowsAsPushOrFailedTran(tocofsReturngoodsDetailedEntityList, returnGoodHeaderDetailsDataDtoArrayList);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -594,6 +651,7 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
|
|||
if (returnGoodHeaderDetailsDataDtoList != null && returnGoodHeaderDetailsDataDtoList.size() > 0) {
|
||||
try {
|
||||
// 查询基本档案
|
||||
// String sceneType = "stock";
|
||||
List<OrderToBHeaderDto> orderToBHeaderDtos = queryBasicArchivesStock(returnGoodHeaderDetailsDataDtoList);
|
||||
// 查询U8C业务流程
|
||||
BdBusitypeEntity bdBusitypeEntity = u8cOperationFlow();
|
||||
|
@ -819,18 +877,20 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
|
|||
*
|
||||
* @author liuyang
|
||||
*/
|
||||
private List<OrderToBHeaderDto> queryBasicArchivesStock(List<StockinOrderSearchResponse.StockinOrder> returnGoodHeaderDetailsDataDtoList) {
|
||||
private List<OrderToBHeaderDto> queryBasicArchivesStock(List<StockinOrderSearchResponse.StockinOrder> returnGoodHeaderDetailsDataDtoList) throws Exception {
|
||||
if (returnGoodHeaderDetailsDataDtoList != null) {
|
||||
logger.info("库存同步:需要把OFS档案转换为U8C档案的O数据条数:{}", returnGoodHeaderDetailsDataDtoList.size());
|
||||
}
|
||||
List<OrderToBHeaderDto> orderToBHeaderDtoArrayList = new ArrayList<>();
|
||||
List<ErrorHeaderDetailsDtoDtoV2> errorHeaderDetailsDtoDtoList = new ArrayList<>();
|
||||
|
||||
if (returnGoodHeaderDetailsDataDtoList != null && returnGoodHeaderDetailsDataDtoList.size() > 0) {
|
||||
try {
|
||||
for (int i = 0; i < returnGoodHeaderDetailsDataDtoList.size(); i++) {
|
||||
StockinOrderSearchResponse.StockinOrder stockinOrder = returnGoodHeaderDetailsDataDtoList.get(i);
|
||||
StockinOrderSearchResponse.StockinOrder.StockinH header = stockinOrder.getHeader();
|
||||
List<StockinOrderSearchResponse.StockinOrder.StockinB> details = stockinOrder.getDetails();
|
||||
|
||||
try {
|
||||
//查询售后订单
|
||||
RerturnGoodsOrderSearchData ofsRertunOrder = afterSalesOrderUtil.getOfsRertunOrder(header.getRefOrderCode());
|
||||
Assert.notNull(ofsRertunOrder, "无法查询到OFS售后订单 编码:{}", header.getRefOrderCode());
|
||||
|
@ -849,6 +909,8 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
|
|||
}
|
||||
HeaderDto header1 = saleOrderMessageDto.getData().get(0).getHeader();
|
||||
String memberId = header1.getMemberId();
|
||||
//TODO 会员id
|
||||
memberId = "GYS00002";
|
||||
Assert.notNull(memberId, "TOB销售订单(OFS)表头会员id不能为空,否则无法匹配U8C客商档案!");
|
||||
Assert.state(!"".equals(memberId.trim()), "TOB销售订单(OFS)表头会员id不能为空,否则无法匹配U8C客商档案!");
|
||||
|
||||
|
@ -861,6 +923,8 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
|
|||
|
||||
// 销售公司、发货公司
|
||||
String companyCode = header.getCompanyCode();
|
||||
//TODO 测试
|
||||
companyCode = "SHLZ";
|
||||
Assert.notNull(companyCode, "O表头公司不能为空");
|
||||
BdCorpEntity bdCorpEntity = new BdCorpEntity();
|
||||
bdCorpEntity.setDr(0);
|
||||
|
@ -954,7 +1018,8 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
|
|||
}
|
||||
|
||||
//查找平台
|
||||
String platformZdyId = "0001A210000000000JUD";
|
||||
// String platformZdyId = "0001A210000000000JUD";
|
||||
String platformZdyId = OverallConstant.getOverAllValue("u8c自定义项档案-平台主键");
|
||||
String sourcePlatformCode = header.getSourcePlatformCode();
|
||||
BdDefdocEntity bdDefdocEntity = new BdDefdocEntity();
|
||||
bdDefdocEntity.setPkDefdoclist(platformZdyId);
|
||||
|
@ -969,7 +1034,8 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
|
|||
}
|
||||
|
||||
//查询U8C店铺档案
|
||||
String platformZdyId2 = "0001A210000000000XZX";
|
||||
// String platformZdyId2 = "0001A210000000000XZX";
|
||||
String platformZdyId2 = OverallConstant.getOverAllValue("u8c自定义项档案-店铺主键");
|
||||
String ofsStoreCode = header.getStoreCode();
|
||||
BdDefdocEntity bdDefdocEntity2 = new BdDefdocEntity();
|
||||
bdDefdocEntity2.setPkDefdoclist(platformZdyId2);
|
||||
|
@ -1002,21 +1068,37 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
|
|||
orderOutTobHeaderDto.setDetails(details);
|
||||
|
||||
orderToBHeaderDtoArrayList.add(orderOutTobHeaderDto);
|
||||
} catch (Exception e) {
|
||||
logger.error("档案转换失败", e);
|
||||
|
||||
//失败
|
||||
String message = e.getMessage();
|
||||
if (message == null) {
|
||||
message = "未知错误";
|
||||
}
|
||||
ErrorHeaderDetailsDtoDtoV2 errorHeaderDetailsDtoDto = new ErrorHeaderDetailsDtoDtoV2();
|
||||
errorHeaderDetailsDtoDto.setNewPushDate(getNewDateStr());
|
||||
errorHeaderDetailsDtoDto.setNewTransmitInfo(message);
|
||||
errorHeaderDetailsDtoDto.setNewstate("N");
|
||||
errorHeaderDetailsDtoDto.setHeader(header);
|
||||
errorHeaderDetailsDtoDto.setDetails(details);
|
||||
errorHeaderDetailsDtoDtoList.add(errorHeaderDetailsDtoDto);
|
||||
}
|
||||
}
|
||||
//成功
|
||||
} catch (Exception e) {
|
||||
logger.error("OFS销售出库单关联查询U8C档案失败", e);
|
||||
//失败
|
||||
}
|
||||
} else {
|
||||
logger.info("queryBasicArchives方法对应的returnGoodHeaderDetailsDataDtoList.size为0");
|
||||
}
|
||||
if (errorHeaderDetailsDtoDtoList.size() > 0) {
|
||||
updateFailOrSuccessTocofsSaleoutDetailedArchiveInquiryStock(errorHeaderDetailsDtoDtoList);
|
||||
}
|
||||
return orderToBHeaderDtoArrayList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 交易成功档案查询,档案转换
|
||||
*
|
||||
* @param returnGoodHeaderDetailsDataDtoList 查询出来的售后入库单数据
|
||||
* @author liuyang
|
||||
*/
|
||||
private List<OrderToBHeaderDto> queryBasicArchivesTran(List<StockinOrderSearchResponse.StockinOrder> returnGoodHeaderDetailsDataDtoList) {
|
||||
|
@ -1024,13 +1106,15 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
|
|||
logger.info("确认收入:需要把OFS档案转换为U8C档案的O数据条数:{}", returnGoodHeaderDetailsDataDtoList.size());
|
||||
}
|
||||
List<OrderToBHeaderDto> orderToBHeaderDtoArrayList = new ArrayList<>();
|
||||
List<ErrorHeaderDetailsDtoDtoV2> errorHeaderDetailsDtoDtoList = new ArrayList<>();
|
||||
|
||||
if (returnGoodHeaderDetailsDataDtoList != null && returnGoodHeaderDetailsDataDtoList.size() > 0) {
|
||||
try {
|
||||
for (int i = 0; i < returnGoodHeaderDetailsDataDtoList.size(); i++) {
|
||||
StockinOrderSearchResponse.StockinOrder stockinOrder = returnGoodHeaderDetailsDataDtoList.get(i);
|
||||
StockinOrderSearchResponse.StockinOrder.StockinH header = stockinOrder.getHeader();
|
||||
List<StockinOrderSearchResponse.StockinOrder.StockinB> details = stockinOrder.getDetails();
|
||||
|
||||
try {
|
||||
//查询OFS售后订单
|
||||
RerturnGoodsOrderSearchData ofsRertunOrder = afterSalesOrderUtil.getOfsRertunOrder(header.getRefOrderCode());
|
||||
Assert.notNull(ofsRertunOrder, "无法查询到OFS售后订单 编码:{}", header.getRefOrderCode());
|
||||
|
@ -1049,6 +1133,8 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
|
|||
}
|
||||
HeaderDto header1 = saleOrderMessageDto.getData().get(0).getHeader();
|
||||
String memberId = header1.getMemberId();
|
||||
//TODO 测试
|
||||
memberId = "GYS00002";
|
||||
Assert.notNull(memberId, "TOB销售订单(OFS)表头会员id不能为空,否则无法匹配U8C客商档案!");
|
||||
Assert.state(!"".equals(memberId.trim()), "TOB销售订单(OFS)表头会员id不能为空,否则无法匹配U8C客商档案!");
|
||||
|
||||
|
@ -1117,6 +1203,8 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
|
|||
|
||||
// 销售公司、发货公司
|
||||
String companyCode = header.getCompanyCode();
|
||||
//TODO 测试
|
||||
companyCode = "SHLZ";
|
||||
Assert.notNull(companyCode, "O表头公司不能为空");
|
||||
BdCorpEntity bdCorpEntity = new BdCorpEntity();
|
||||
bdCorpEntity.setDr(0);
|
||||
|
@ -1209,7 +1297,8 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
|
|||
}
|
||||
|
||||
//查找平台
|
||||
String platformZdyId = "0001A210000000000JUD";
|
||||
// String platformZdyId = "0001A210000000000JUD";
|
||||
String platformZdyId = OverallConstant.getOverAllValue("u8c自定义项档案-平台主键");
|
||||
String sourcePlatformCode = header.getSourcePlatformCode();
|
||||
BdDefdocEntity bdDefdocEntity = new BdDefdocEntity();
|
||||
bdDefdocEntity.setPkDefdoclist(platformZdyId);
|
||||
|
@ -1224,7 +1313,8 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
|
|||
}
|
||||
|
||||
//查询U8C店铺档案
|
||||
String platformZdyId2 = "0001A210000000000XZX";
|
||||
// String platformZdyId2 = "0001A210000000000XZX";
|
||||
String platformZdyId2 = OverallConstant.getOverAllValue("u8c自定义项档案-店铺主键");
|
||||
String ofsStoreCode = header.getStoreCode();
|
||||
BdDefdocEntity bdDefdocEntity2 = new BdDefdocEntity();
|
||||
bdDefdocEntity2.setPkDefdoclist(platformZdyId2);
|
||||
|
@ -1276,15 +1366,29 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
|
|||
|
||||
BeanUtil.copyPropertiesV2(header, orderOutTobHeaderDto);
|
||||
orderToBHeaderDtoArrayList.add(orderOutTobHeaderDto);
|
||||
}
|
||||
//成功,记录到日志表
|
||||
} catch (Exception e) {
|
||||
logger.error("OFS销售出库单关联查询U8C档案失败", e);
|
||||
//失败,记录到日志表
|
||||
logger.error("TOB退货确认收入", e);
|
||||
|
||||
//失败
|
||||
String message = e.getMessage();
|
||||
if (message == null) {
|
||||
message = "未知错误";
|
||||
}
|
||||
ErrorHeaderDetailsDtoDtoV2 errorHeaderDetailsDtoDto = new ErrorHeaderDetailsDtoDtoV2();
|
||||
errorHeaderDetailsDtoDto.setNewPushDate2(getNewDateStr());
|
||||
errorHeaderDetailsDtoDto.setNewTransmitInfo2(message);
|
||||
errorHeaderDetailsDtoDto.setNewstate2("N");
|
||||
errorHeaderDetailsDtoDto.setHeader(header);
|
||||
errorHeaderDetailsDtoDto.setDetails(details);
|
||||
errorHeaderDetailsDtoDtoList.add(errorHeaderDetailsDtoDto);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
logger.info("queryBasicArchives方法对应的returnGoodHeaderDetailsDataDtoList.size为0");
|
||||
}
|
||||
if (errorHeaderDetailsDtoDtoList.size() > 0) {
|
||||
updateFailOrSuccessTocofsSaleoutDetailedArchiveInquiryTran(errorHeaderDetailsDtoDtoList);
|
||||
}
|
||||
return orderToBHeaderDtoArrayList;
|
||||
}
|
||||
|
||||
|
@ -1323,9 +1427,9 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
|
|||
|
||||
TocofsReturngoodsDetailedEntity tocofsReturngoodsDetailedEntity = new TocofsReturngoodsDetailedEntity();
|
||||
// tocofsReturngoodsDetailedEntity.setBusinessType("TOB_RETURN");
|
||||
BeanUtil.copyPropertiesV2(returnGoodSearchHeaderDto, tocofsReturngoodsDetailedEntity);
|
||||
//处理填充额外字段
|
||||
BeanUtil.copyPropertiesV2(stockinB, tocofsReturngoodsDetailedEntity);
|
||||
createPrimaryKeyAndBusinessDateAndBusinessType(tocofsReturngoodsDetailedEntity, returnGoodSearchHeaderDto);
|
||||
|
||||
tocofsSaleoutDetailedEntityArrayList.add(tocofsReturngoodsDetailedEntity);
|
||||
}
|
||||
} else {
|
||||
|
@ -1502,8 +1606,8 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
|
|||
private void createPrimaryKeyAndBusinessDateAndBusinessType(TocofsReturngoodsDetailedEntity tocofsReturngoodsDetailedEntity, StockinOrderSearchResponse.StockinOrder.StockinH returnGoodSearchHeaderDto) {
|
||||
if (tocofsReturngoodsDetailedEntity != null && returnGoodSearchHeaderDto != null) {
|
||||
//主表主键
|
||||
if (tocofsReturngoodsDetailedEntity.getId() != null) {
|
||||
tocofsReturngoodsDetailedEntity.setMaintableid(tocofsReturngoodsDetailedEntity.getId());
|
||||
if (returnGoodSearchHeaderDto.getId() != null) {
|
||||
tocofsReturngoodsDetailedEntity.setMaintableid(returnGoodSearchHeaderDto.getId());
|
||||
}
|
||||
//业务日期-入库时间
|
||||
if (returnGoodSearchHeaderDto.getCheckInFrom() != null) {
|
||||
|
@ -1531,6 +1635,7 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
|
|||
if (returnGoodHeaderDetailsDataDtoList != null && returnGoodHeaderDetailsDataDtoList.size() > 0) {
|
||||
try {
|
||||
//转换基本档案
|
||||
// String sceneType = "tran";
|
||||
List<OrderToBHeaderDto> orderToBHeaderDtos = queryBasicArchivesTran(returnGoodHeaderDetailsDataDtoList);
|
||||
//查询U8C业务流程
|
||||
BdBusitypeEntity bdBusitypeEntity = u8cOperationFlow();
|
||||
|
@ -2151,4 +2256,135 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
|
|||
logger.error("updateSuccessOrFail2方法现场抛出异常", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量修改成功、或者失败,适合档案查询的部分
|
||||
*
|
||||
* @author liuyang
|
||||
*/
|
||||
private void updateFailOrSuccessTocofsSaleoutDetailedArchiveInquiryStock(List<ErrorHeaderDetailsDtoDtoV2> errorHeaderDetailsDtoDtoList) throws Exception {
|
||||
Assert.notNull(errorHeaderDetailsDtoDtoList, "errorHeaderDetailsDtoDtoList不能为空!");
|
||||
|
||||
Thread thread = new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
if (errorHeaderDetailsDtoDtoList != null && errorHeaderDetailsDtoDtoList.size() > 0) {
|
||||
List<TocofsReturngoodsDetailedEntity> tocofsReturngoodsDetailedEntityList = new ArrayList<>();
|
||||
for (int i = 0; i < errorHeaderDetailsDtoDtoList.size(); i++) {
|
||||
ErrorHeaderDetailsDtoDtoV2 errorHeaderDetailsDtoDtoV2 = errorHeaderDetailsDtoDtoList.get(i);
|
||||
StockinOrderSearchResponse.StockinOrder.StockinH header = errorHeaderDetailsDtoDtoV2.getHeader();
|
||||
List<StockinOrderSearchResponse.StockinOrder.StockinB> details = errorHeaderDetailsDtoDtoV2.getDetails();
|
||||
|
||||
String newstate = errorHeaderDetailsDtoDtoV2.getNewstate();
|
||||
String newPushDate = errorHeaderDetailsDtoDtoV2.getNewPushDate();
|
||||
String newTransmitInfo = errorHeaderDetailsDtoDtoV2.getNewTransmitInfo();
|
||||
|
||||
//如果报错内容太长了,则仅保留500个长度
|
||||
if (newTransmitInfo != null && !"".equals(newTransmitInfo.trim()) && newTransmitInfo.length() >= 400) {
|
||||
newTransmitInfo = newTransmitInfo.substring(0, 400);
|
||||
}
|
||||
|
||||
for (int j = 0; j < details.size(); j++) {
|
||||
StockinOrderSearchResponse.StockinOrder.StockinB stockinB = details.get(j);
|
||||
|
||||
TocofsReturngoodsDetailedEntity tocofsSaleoutDetailedEntity = new TocofsReturngoodsDetailedEntity();
|
||||
tocofsSaleoutDetailedEntity.setId(stockinB.getId());
|
||||
tocofsSaleoutDetailedEntity.setNewpushdate(newPushDate);
|
||||
tocofsSaleoutDetailedEntity.setNewtransmitinfo(newTransmitInfo);
|
||||
tocofsSaleoutDetailedEntity.setNewstate(newstate);
|
||||
tocofsSaleoutDetailedEntity.setNewsystemnumber(null);
|
||||
tocofsSaleoutDetailedEntity.setNewsystemprimary(null);
|
||||
tocofsReturngoodsDetailedEntityList.add(tocofsSaleoutDetailedEntity);
|
||||
}
|
||||
}
|
||||
|
||||
//以50行为一个批次更新状态
|
||||
if (tocofsReturngoodsDetailedEntityList.size() > 0) {
|
||||
List<List<TocofsReturngoodsDetailedEntity>> splitListByCount = SplitListByCountUtil.splitListByCount(tocofsReturngoodsDetailedEntityList, 50);
|
||||
for (int i = 0; i < splitListByCount.size(); i++) {
|
||||
List<TocofsReturngoodsDetailedEntity> tocofsReturngoodsDetailedEntityList1 = splitListByCount.get(i);
|
||||
iTocofsReturngoodsDetailedDao.entityInsertOrUpdateBatchByTobRerturnStockV2(tocofsReturngoodsDetailedEntityList1);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("TOB填充出库明细日志抛出异常", e);
|
||||
}
|
||||
}
|
||||
});
|
||||
thread.start();
|
||||
try {
|
||||
thread.join();
|
||||
} catch (Exception e) {
|
||||
logger.error("updateFailOrSuccessTocofsSaleoutDetailedArchiveInquiry方法现场抛出异常", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 批量修改成功、或者失败,适合档案查询的部分
|
||||
*
|
||||
* @author liuyang
|
||||
*/
|
||||
private void updateFailOrSuccessTocofsSaleoutDetailedArchiveInquiryTran(List<ErrorHeaderDetailsDtoDtoV2> errorHeaderDetailsDtoDtoList) {
|
||||
Assert.notNull(errorHeaderDetailsDtoDtoList, "errorHeaderDetailsDtoDtoList不能为空!");
|
||||
|
||||
Thread thread = new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
if (errorHeaderDetailsDtoDtoList != null && errorHeaderDetailsDtoDtoList.size() > 0) {
|
||||
List<TocofsReturngoodsDetailedEntity> tocofsReturngoodsDetailedEntityList = new ArrayList<>();
|
||||
for (int i = 0; i < errorHeaderDetailsDtoDtoList.size(); i++) {
|
||||
ErrorHeaderDetailsDtoDtoV2 errorHeaderDetailsDtoDtoV2 = errorHeaderDetailsDtoDtoList.get(i);
|
||||
StockinOrderSearchResponse.StockinOrder.StockinH header = errorHeaderDetailsDtoDtoV2.getHeader();
|
||||
List<StockinOrderSearchResponse.StockinOrder.StockinB> details = errorHeaderDetailsDtoDtoV2.getDetails();
|
||||
|
||||
String newstate = errorHeaderDetailsDtoDtoV2.getNewstate2();
|
||||
String newPushDate = errorHeaderDetailsDtoDtoV2.getNewPushDate2();
|
||||
String newTransmitInfo = errorHeaderDetailsDtoDtoV2.getNewTransmitInfo2();
|
||||
|
||||
//如果报错内容太长了,则仅保留500个长度
|
||||
if (newTransmitInfo != null && !"".equals(newTransmitInfo.trim()) && newTransmitInfo.length() >= 400) {
|
||||
newTransmitInfo = newTransmitInfo.substring(0, 400);
|
||||
}
|
||||
|
||||
for (int j = 0; j < details.size(); j++) {
|
||||
StockinOrderSearchResponse.StockinOrder.StockinB stockinB = details.get(j);
|
||||
|
||||
TocofsReturngoodsDetailedEntity tocofsSaleoutDetailedEntity = new TocofsReturngoodsDetailedEntity();
|
||||
tocofsSaleoutDetailedEntity.setId(stockinB.getId());
|
||||
tocofsSaleoutDetailedEntity.setNewpushdate2(newPushDate);
|
||||
tocofsSaleoutDetailedEntity.setNewtransmitinfo2(newTransmitInfo);
|
||||
tocofsSaleoutDetailedEntity.setNewstate2(newstate);
|
||||
tocofsSaleoutDetailedEntity.setNewsystemnumber2(null);
|
||||
tocofsSaleoutDetailedEntity.setNewsystemprimary2(null);
|
||||
tocofsReturngoodsDetailedEntityList.add(tocofsSaleoutDetailedEntity);
|
||||
}
|
||||
}
|
||||
|
||||
//以50行为一个批次更新状态
|
||||
if (tocofsReturngoodsDetailedEntityList.size() > 0) {
|
||||
List<List<TocofsReturngoodsDetailedEntity>> splitListByCount = SplitListByCountUtil.splitListByCount(tocofsReturngoodsDetailedEntityList, 50);
|
||||
for (int i = 0; i < splitListByCount.size(); i++) {
|
||||
List<TocofsReturngoodsDetailedEntity> tocofsReturngoodsDetailedEntityList1 = splitListByCount.get(i);
|
||||
iTocofsReturngoodsDetailedDao.entityInsertOrUpdateBatchByTobRerturnTranV2(tocofsReturngoodsDetailedEntityList1);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("TOB填充出库明细日志抛出异常", e);
|
||||
}
|
||||
}
|
||||
});
|
||||
thread.start();
|
||||
try {
|
||||
thread.join();
|
||||
} catch (Exception e) {
|
||||
logger.error("updateFailOrSuccessTocofsSaleoutDetailedArchiveInquiry方法现场抛出异常", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1445,8 +1445,8 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
|
|||
private void createPrimaryKeyAndBusinessDateAndBusinessType(TocofsReturngoodsDetailedEntity tocofsReturngoodsDetailedEntity, StockinOrderSearchResponse.StockinOrder.StockinH returnGoodSearchHeaderDto) {
|
||||
if (tocofsReturngoodsDetailedEntity != null && returnGoodSearchHeaderDto != null) {
|
||||
//主表主键
|
||||
if (tocofsReturngoodsDetailedEntity.getId() != null) {
|
||||
tocofsReturngoodsDetailedEntity.setMaintableid(tocofsReturngoodsDetailedEntity.getId());
|
||||
if (returnGoodSearchHeaderDto.getId() != null) {
|
||||
tocofsReturngoodsDetailedEntity.setMaintableid(returnGoodSearchHeaderDto.getId());
|
||||
}
|
||||
//业务日期-入库时间
|
||||
if (returnGoodSearchHeaderDto.getCheckInFrom() != null) {
|
||||
|
@ -1877,7 +1877,7 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
|
|||
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) {
|
||||
if (returnGoodHeaderDetailsDataDtoArrayList != null && returnGoodHeaderDetailsDataDtoArrayList.size() > 0) {
|
||||
//字段Y(成功)或者为H(待处理)可以视为成功,完成了小段业务闭环的数据行
|
||||
String succeseeY = "Y";
|
||||
String succeseeH = "H";
|
||||
|
@ -1891,6 +1891,7 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
|
|||
StockinOrderSearchResponse.StockinOrder.StockinB stockinB = details.get(j);
|
||||
Boolean isSuccess = false;
|
||||
String newstate = null;
|
||||
if (tocofsReturngoodsDetailedEntityList != null && tocofsReturngoodsDetailedEntityList.size() > 0) {
|
||||
for (int k = 0; k < tocofsReturngoodsDetailedEntityList.size(); k++) {
|
||||
TocofsReturngoodsDetailedEntity tocofsReturngoodsDetailedEntity = tocofsReturngoodsDetailedEntityList.get(k);
|
||||
if (tocofsReturngoodsDetailedEntity.getId().equals(stockinB.getId())) {
|
||||
|
@ -1900,6 +1901,7 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!isSuccess) {
|
||||
stockinB.setNewstate3(newstate);
|
||||
targetDetails.add(stockinB);
|
||||
|
|
|
@ -30,4 +30,10 @@ public class ErrorHeaderDetailsDtoDtoV2 extends StockinOrderSearchResponse.Stock
|
|||
private String newSystemNumber4;
|
||||
//下游主键
|
||||
private String newSystemPrimary4;
|
||||
//(销售)推送时间
|
||||
private String newPushDate2;
|
||||
//(销售)报错详情
|
||||
private String newTransmitInfo2;
|
||||
//(销售)出库同步是否成功
|
||||
private String newstate2;
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ public class SoSaleReturnPluginInitializerToBTest {
|
|||
// soSaleReturnPluginInitializerToB.startImplementByTradeTime("2024-08-30 15:54:41", "2024-08-30 15:54:43");
|
||||
|
||||
|
||||
soSaleReturnPluginInitializerToB.startImplementByCode("LETS-RE2024091400000001");
|
||||
soSaleReturnPluginInitializerToB.startImplementByCode("LETS-RE2024091400000001", "tran");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue