diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/dao/ITocofsSaleoutDao.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/dao/ITocofsSaleoutDao.java index 73a2a0a4..4dfb3e30 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/dao/ITocofsSaleoutDao.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/dao/ITocofsSaleoutDao.java @@ -1,7 +1,9 @@ package com.hzya.frame.plugin.lets.ofs.dao; import com.hzya.frame.plugin.lets.ofs.entity.TocofsSaleoutEntity; -import com.hzya.frame.basedao.dao.IBaseDao; +import com.hzya.frame.basedao.dao.IBaseDao; + +import java.util.List; /** * root(tocofs_saleout: table)表数据库访问层 @@ -10,6 +12,10 @@ import com.hzya.frame.basedao.dao.IBaseDao; * @since 2024-08-01 17:01:32 */ public interface ITocofsSaleoutDao extends IBaseDao { - -} - + /** + * 批量插入主表信息 + * + * @author liuyang + */ + void entityInsertBatchV2(List tocofsSaleoutEntityList) throws Exception; +} \ No newline at end of file diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/dao/ITocofsSaleoutDetailedDao.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/dao/ITocofsSaleoutDetailedDao.java index 608352d4..4c7b4fdc 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/dao/ITocofsSaleoutDetailedDao.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/dao/ITocofsSaleoutDetailedDao.java @@ -1,7 +1,9 @@ package com.hzya.frame.plugin.lets.ofs.dao; import com.hzya.frame.plugin.lets.ofs.entity.TocofsSaleoutDetailedEntity; -import com.hzya.frame.basedao.dao.IBaseDao; +import com.hzya.frame.basedao.dao.IBaseDao; + +import java.util.List; /** * tocofs_saleout_detailed(tocofs_saleout_detailed: table)表数据库访问层 @@ -11,5 +13,11 @@ import com.hzya.frame.basedao.dao.IBaseDao; */ public interface ITocofsSaleoutDetailedDao extends IBaseDao { + /** + * 批量查询明细信息 + * + * @author liuyang + */ + void entityInsertBatchV2(List tocofsSaleoutDetailedEntity) throws Exception; } diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/dao/impl/TocofsSaleoutDaoImpl.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/dao/impl/TocofsSaleoutDaoImpl.java index ee9cb98d..333997ab 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/dao/impl/TocofsSaleoutDaoImpl.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/dao/impl/TocofsSaleoutDaoImpl.java @@ -4,13 +4,18 @@ import com.hzya.frame.plugin.lets.ofs.entity.TocofsSaleoutEntity; import com.hzya.frame.plugin.lets.ofs.dao.ITocofsSaleoutDao; import org.springframework.stereotype.Repository; import com.hzya.frame.basedao.dao.MybatisGenericDao; + +import java.util.List; + /** * root(TocofsSaleout)表数据库访问层 * * @author makejava * @since 2024-08-01 17:01:32 */ -public class TocofsSaleoutDaoImpl extends MybatisGenericDao implements ITocofsSaleoutDao{ - -} - +public class TocofsSaleoutDaoImpl extends MybatisGenericDao implements ITocofsSaleoutDao { + @Override + public void entityInsertBatchV2(List tocofsSaleoutEntityList) throws Exception { + this.insert("com.hzya.frame.plugin.lets.ofs.dao.impl.TocofsSaleoutDaoImpl.entityInsertBatchV2", tocofsSaleoutEntityList); + } +} \ No newline at end of file diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/dao/impl/TocofsSaleoutDetailedDaoImpl.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/dao/impl/TocofsSaleoutDetailedDaoImpl.java index 55926238..b7313308 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/dao/impl/TocofsSaleoutDetailedDaoImpl.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/dao/impl/TocofsSaleoutDetailedDaoImpl.java @@ -4,13 +4,18 @@ import com.hzya.frame.plugin.lets.ofs.entity.TocofsSaleoutDetailedEntity; import com.hzya.frame.plugin.lets.ofs.dao.ITocofsSaleoutDetailedDao; import org.springframework.stereotype.Repository; import com.hzya.frame.basedao.dao.MybatisGenericDao; + +import java.util.List; + /** * tocofs_saleout_detailed(TocofsSaleoutDetailed)表数据库访问层 * * @author makejava * @since 2024-08-01 17:01:53 */ -public class TocofsSaleoutDetailedDaoImpl extends MybatisGenericDao implements ITocofsSaleoutDetailedDao{ - -} - +public class TocofsSaleoutDetailedDaoImpl extends MybatisGenericDao implements ITocofsSaleoutDetailedDao { + @Override + public void entityInsertBatchV2(List tocofsSaleoutDetailedEntity) throws Exception { + this.insert("com.hzya.frame.plugin.lets.ofs.dao.impl.TocofsSaleoutDetailedDaoImpl.entityInsertBatchV2", tocofsSaleoutDetailedEntity); + } +} \ No newline at end of file diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/entity/TocofsSaleoutDetailedEntity.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/entity/TocofsSaleoutDetailedEntity.java index c5449778..a11c6eba 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/entity/TocofsSaleoutDetailedEntity.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/entity/TocofsSaleoutDetailedEntity.java @@ -12,7 +12,7 @@ public class TocofsSaleoutDetailedEntity extends BaseEntity { /** * rootId */ - private Long rootid; +// private Long rootid; /** * LETS */ @@ -126,14 +126,13 @@ public class TocofsSaleoutDetailedEntity extends BaseEntity { */ private String lastupdatedby; - - public Long getRootid() { - return rootid; - } - - public void setRootid(Long rootid) { - this.rootid = rootid; - } +// public Long getRootid() { +// return rootid; +// } +// +// public void setRootid(Long rootid) { +// this.rootid = rootid; +// } public String getClientcode() { return clientcode; diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/entity/TocofsSaleoutDetailedEntity.xml b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/entity/TocofsSaleoutDetailedEntity.xml index d6aec2b4..5971c618 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/entity/TocofsSaleoutDetailedEntity.xml +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/entity/TocofsSaleoutDetailedEntity.xml @@ -3,7 +3,7 @@ - + @@ -35,8 +35,7 @@ - rootId - ,clientCode + clientCode ,companyCode ,facilityCode ,shipmentCode @@ -71,7 +70,7 @@ from tocofs_saleout_detailed - and rootId = #{rootid} +-- and rootId = #{rootid} and clientCode = #{clientcode} and companyCode = #{companycode} and facilityCode = #{facilitycode} @@ -110,7 +109,7 @@ select @@ -547,6 +549,7 @@ ) + insert into tocofs_saleout(clientCode, companyCode, storeCode, facilityCode, code, refOrderId, refOrderCode, refOrderType, status, consolidated, internalInstructionType, bizChannel, sourcePlatformCode, processType, sourceOrderId, sourceOrderCode, sourceUserAccount, shipToAttentionTo, shipToAddress, shipToCountry, shipToState, shipToCity, shipToDistrict, shipToMobile, totalLines, totalQty, totalContainers, totalCases, totalWeight, totalVolume, totalVolumeWeight, weightUM, volumeUM, totalAmount, totalPayAmount, postageAmount, itemTotalAmount, carrierCode, paymentStatus, codRequired, invoiceRequired, paidAt, shipFromAttentionTo, shipFromAddress, shipFromDistrict, shipFromCity, shipFromState, shipFromCountry, shipFromPostalCode, shipFromPhone, shipFromMobile, shipFromFax, shipFromEmail, codAmount, tax, taxPaid, shipToStateName, shipToCityName, shipToDistrictName, sts) @@ -555,6 +558,16 @@ (#{entity.clientcode},#{entity.companycode},#{entity.storecode},#{entity.facilitycode},#{entity.code},#{entity.reforderid},#{entity.refordercode},#{entity.refordertype},#{entity.status},#{entity.consolidated},#{entity.internalinstructiontype},#{entity.bizchannel},#{entity.sourceplatformcode},#{entity.processtype},#{entity.sourceorderid},#{entity.sourceordercode},#{entity.sourceuseraccount},#{entity.shiptoattentionto},#{entity.shiptoaddress},#{entity.shiptocountry},#{entity.shiptostate},#{entity.shiptocity},#{entity.shiptodistrict},#{entity.shiptomobile},#{entity.totallines},#{entity.totalqty},#{entity.totalcontainers},#{entity.totalcases},#{entity.totalweight},#{entity.totalvolume},#{entity.totalvolumeweight},#{entity.weightum},#{entity.volumeum},#{entity.totalamount},#{entity.totalpayamount},#{entity.postageamount},#{entity.itemtotalamount},#{entity.carriercode},#{entity.paymentstatus},#{entity.codrequired},#{entity.invoicerequired},#{entity.paidat},#{entity.shipfromattentionto},#{entity.shipfromaddress},#{entity.shipfromdistrict},#{entity.shipfromcity},#{entity.shipfromstate},#{entity.shipfromcountry},#{entity.shipfrompostalcode},#{entity.shipfromphone},#{entity.shipfrommobile},#{entity.shipfromfax},#{entity.shipfromemail},#{entity.codamount},#{entity.tax},#{entity.taxpaid},#{entity.shiptostatename},#{entity.shiptocityname},#{entity.shiptodistrictname}, 'Y') + + + + insert IGNORE into tocofs_saleout(id,clientCode, companyCode, storeCode, facilityCode, code, refOrderId, refOrderCode, refOrderType, status, consolidated, internalInstructionType, bizChannel, sourcePlatformCode, processType, sourceOrderId, sourceOrderCode, sourceUserAccount, shipToAttentionTo, shipToAddress, shipToCountry, shipToState, shipToCity, shipToDistrict, shipToMobile, totalLines, totalQty, totalContainers, totalCases, totalWeight, totalVolume, totalVolumeWeight, weightUM, volumeUM, totalAmount, totalPayAmount, postageAmount, itemTotalAmount, carrierCode, paymentStatus, codRequired, invoiceRequired, paidAt, shipFromAttentionTo, shipFromAddress, shipFromDistrict, shipFromCity, shipFromState, shipFromCountry, shipFromPostalCode, shipFromPhone, shipFromMobile, shipFromFax, shipFromEmail, codAmount, tax, taxPaid, shipToStateName, shipToCityName, shipToDistrictName) + values + + (#{entity.id},#{entity.clientcode},#{entity.companycode},#{entity.storecode},#{entity.facilitycode},#{entity.code},#{entity.reforderid},#{entity.refordercode},#{entity.refordertype},#{entity.status},#{entity.consolidated},#{entity.internalinstructiontype},#{entity.bizchannel},#{entity.sourceplatformcode},#{entity.processtype},#{entity.sourceorderid},#{entity.sourceordercode},#{entity.sourceuseraccount},#{entity.shiptoattentionto},#{entity.shiptoaddress},#{entity.shiptocountry},#{entity.shiptostate},#{entity.shiptocity},#{entity.shiptodistrict},#{entity.shiptomobile},#{entity.totallines},#{entity.totalqty},#{entity.totalcontainers},#{entity.totalcases},#{entity.totalweight},#{entity.totalvolume},#{entity.totalvolumeweight},#{entity.weightum},#{entity.volumeum},#{entity.totalamount},#{entity.totalpayamount},#{entity.postageamount},#{entity.itemtotalamount},#{entity.carriercode},#{entity.paymentstatus},#{entity.codrequired},#{entity.invoicerequired},#{entity.paidat},#{entity.shipfromattentionto},#{entity.shipfromaddress},#{entity.shipfromdistrict},#{entity.shipfromcity},#{entity.shipfromstate},#{entity.shipfromcountry},#{entity.shipfrompostalcode},#{entity.shipfromphone},#{entity.shipfrommobile},#{entity.shipfromfax},#{entity.shipfromemail},#{entity.codamount},#{entity.tax},#{entity.taxpaid},#{entity.shiptostatename},#{entity.shiptocityname},#{entity.shiptodistrictname}) + + + insert into tocofs_saleout(clientCode, companyCode, storeCode, facilityCode, code, refOrderId, refOrderCode, refOrderType, status, consolidated, internalInstructionType, bizChannel, sourcePlatformCode, processType, sourceOrderId, sourceOrderCode, sourceUserAccount, shipToAttentionTo, shipToAddress, shipToCountry, shipToState, shipToCity, shipToDistrict, shipToMobile, totalLines, totalQty, totalContainers, totalCases, totalWeight, totalVolume, totalVolumeWeight, weightUM, volumeUM, totalAmount, totalPayAmount, postageAmount, itemTotalAmount, carrierCode, paymentStatus, codRequired, invoiceRequired, paidAt, shipFromAttentionTo, shipFromAddress, shipFromDistrict, shipFromCity, shipFromState, shipFromCountry, shipFromPostalCode, shipFromPhone, shipFromMobile, shipFromFax, shipFromEmail, codAmount, tax, taxPaid, shipToStateName, shipToCityName, shipToDistrictName) @@ -622,6 +635,7 @@ shipToStateName = values(shipToStateName), shipToCityName = values(shipToCityName), shipToDistrictName = values(shipToDistrictName) + update tocofs_saleout set @@ -688,16 +702,18 @@ update tocofs_saleout set where id = #{id} + update tocofs_saleout set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} where id = #{id} + update tocofs_saleout set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} - - and id = #{id} + + and id = #{id} and clientCode = #{clientcode} and companyCode = #{companycode} and storeCode = #{storecode} @@ -760,6 +776,7 @@ update tocofs_saleout set sts= 'N' ,modify_time = #{modify_time},modify_user_id and sts='Y' + delete from tocofs_saleout where id = #{id} diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/service/ITocofsSaleoutService.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/service/ITocofsSaleoutService.java index 9546770a..588cb57f 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/service/ITocofsSaleoutService.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/service/ITocofsSaleoutService.java @@ -2,11 +2,14 @@ package com.hzya.frame.plugin.lets.ofs.service; import com.hzya.frame.plugin.lets.ofs.entity.TocofsSaleoutEntity; import com.hzya.frame.basedao.service.IBaseService; + /** * root(TocofsSaleout)表服务接口 * * @author makejava * @since 2024-08-01 17:01:32 */ -public interface ITocofsSaleoutService extends IBaseService{ +public interface ITocofsSaleoutService extends IBaseService { + + } diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToC.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToC.java index de9f3042..c4325660 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToC.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToC.java @@ -6,12 +6,19 @@ import cn.hutool.core.util.StrUtil; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.hzya.frame.base.PluginBaseEntity; +import com.hzya.frame.beanutil.BeanUtil; import com.hzya.frame.plugin.lets.entity.*; +import com.hzya.frame.plugin.lets.ofs.dao.ITocofsSaleoutDao; +import com.hzya.frame.plugin.lets.ofs.dao.ITocofsSaleoutDetailedDao; +import com.hzya.frame.plugin.lets.ofs.entity.TocofsSaleoutDetailedEntity; +import com.hzya.frame.plugin.lets.ofs.entity.TocofsSaleoutEntity; +import com.hzya.frame.plugin.lets.ofs.service.ITocofsSaleoutService; import com.hzya.frame.plugin.lets.ofsvo.QueryOfsSoSaleOutVo; import com.hzya.frame.plugin.lets.ofsvo.QueryOfsSoSaleVo; import com.hzya.frame.plugin.lets.resultvo.CalculateDateVo; import com.hzya.frame.plugin.lets.util.BasicArchivesCacheUtil; import com.hzya.frame.plugin.lets.util.DateStrUtil; +import com.hzya.frame.split.SplitListByCountUtil; import com.hzya.frame.ttxofs.dto.InterfaceParamDto; import com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.SaleOutReturnMessageDto; import com.hzya.frame.ttxofs.dto.ofssalesordersearch.DetailsDto; @@ -22,6 +29,7 @@ import com.hzya.frame.ttxofs.service.OfsUnifiedService; import com.hzya.frame.web.entity.JsonResultEntity; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import java.util.*; @@ -80,6 +88,15 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity { @Autowired private BasicArchivesCacheUtil basicArchivesCacheUtil; + @Autowired + private ITocofsSaleoutService iTocofsSaleoutService; + + @Autowired + private ITocofsSaleoutDao iTocofsSaleoutDao; + + @Autowired + private ITocofsSaleoutDetailedDao iTocofsSaleoutDetailedDao; + /** * 按指定时间拉取 * @@ -97,18 +114,23 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity { // TODO 注意过滤TOC店铺 CalculateDateVo calculateDateVo = DateStrUtil.calculateCalculateEntireDayPeriod(dateStr); - List headerDetailsDtoList = new ArrayList<>(); - QueryOfsSoSaleVo queryOfsSoSaleOutVo = new QueryOfsSoSaleVo(); - queryOfsSoSaleOutVo.setCreated_start(calculateDateVo.getStart_time()); - queryOfsSoSaleOutVo.setCreated_end(calculateDateVo.getEnd_time()); + List headerDetailsDtoList = new ArrayList<>(); + QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo(); + queryOfsSoSaleOutVo.setCreated_start("2024-03-27 12:03:30"); + queryOfsSoSaleOutVo.setCreated_end("2024-03-27 12:04:00"); queryOfsSoSaleOutVo.setClientCode("LETS"); - queryOfsSoSaleOutVo.setCompanyCode("SHLZ"); - queryOfsSoSaleOutVo.setStatus(900L); + // queryOfsSoSaleOutVo.setInternalInstructionType("SALES"); + queryOfsSoSaleOutVo.setCompanyCode("LETS"); + // queryOfsSoSaleOutVo.setStatus(900L); + queryOfsSoSaleOutVo.setPageNo(1L); + queryOfsSoSaleOutVo.setPageSize(50L); queryOfsSaleOrder(queryOfsSoSaleOutVo, headerDetailsDtoList, 1L); logger.info("数据返回行数:{}", headerDetailsDtoList.size()); - if (headerDetailsDtoList.size() > 0) { - + //保存到mysql + batchInsert(headerDetailsDtoList); + //过滤成功的数据 + //执行推送主逻辑 } else { logger.info("没有查询到任何数据!不需要同步"); } @@ -123,11 +145,50 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity { try { thread.join(); } catch (Exception e) { - e.printStackTrace(); logger.error("thread.join()异常", e); } } + /** + * 保存抓取到的数据到mysql底表 + * + * @param headerDetailsDtoList 数据行 + */ + private void batchInsert(List headerDetailsDtoList) throws Exception { + if (headerDetailsDtoList != null && headerDetailsDtoList.size() > 0) { + List headerDetailsDtoList1 = new ArrayList<>(); + List headerDetailsDtoList2 = new ArrayList<>(); + + for (com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDetailsDto index : headerDetailsDtoList) { + com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDto header = index.getHeader();// 主表 + List details = index.getDetails();//明细表 + + headerDetailsDtoList1.add(header); + headerDetailsDtoList2.addAll(details); + } + + //每250作为一个批次插入主表,根据主键(id)判断是否重复,如果重复的,则不进行插入 + List> ofssaleorderoutsearchList = SplitListByCountUtil.splitListByCount(headerDetailsDtoList1, 250); + for (int i = 0; i < ofssaleorderoutsearchList.size(); i++) { + List headerDtoList = ofssaleorderoutsearchList.get(i); + List tocofsSaleoutEntityList = copyHeaderDto(headerDtoList); + if (tocofsSaleoutEntityList.size() > 0) { + iTocofsSaleoutDao.entityInsertBatchV2(tocofsSaleoutEntityList); + } + } + + //插入明细表 + List> detailsDtoList = SplitListByCountUtil.splitListByCount(headerDetailsDtoList2, 250); + for (int i = 0; i < detailsDtoList.size(); i++) { + List detailsDtos = detailsDtoList.get(i); + List tocofsSaleoutDetailedEntities = copyDetailsDto(detailsDtos); + if (tocofsSaleoutDetailedEntities.size() > 0) { + iTocofsSaleoutDetailedDao.entityInsertBatchV2(tocofsSaleoutDetailedEntities); + } + } + } + } + /** * 查询OFS结果集 * @@ -135,19 +196,19 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity { * @param headerDetailsDtoList 查询结果集 * @param pageNo 从第pageNo页开始查询 */ - private void queryOfsSaleOrder(QueryOfsSoSaleVo queryOfsSoSaleOutVo, List headerDetailsDtoList, Long pageNo) throws Exception { + private void queryOfsSaleOrder(QueryOfsSoSaleOutVo queryOfsSoSaleOutVo, List headerDetailsDtoList, Long pageNo) throws Exception { Long pageSize = 200L; queryOfsSoSaleOutVo.setPageNo(pageNo); queryOfsSoSaleOutVo.setPageSize(pageSize); InterfaceParamDto interfaceParamDto = new InterfaceParamDto(); - interfaceParamDto.setApi("ofs.salesOrder.search"); + interfaceParamDto.setApi("ofs.shipment.search"); interfaceParamDto.setData(JSON.toJSONString(queryOfsSoSaleOutVo)); - SaleReturnMessageDto returnMessageBasics = (SaleReturnMessageDto) ofsUnifiedService.unified(interfaceParamDto); - if (returnMessageBasics != null) { - if ("false".equals(returnMessageBasics.getError()) && "0".equals(returnMessageBasics.getCode()) && "Success".equals(returnMessageBasics.getMsg())) { - List headerDetailsDtoList1 = returnMessageBasics.getData(); + SaleOutReturnMessageDto saleOutReturnMessageDto = (SaleOutReturnMessageDto) ofsUnifiedService.unified(interfaceParamDto); + if (saleOutReturnMessageDto != null) { + if ("false".equals(saleOutReturnMessageDto.getError()) && "0".equals(saleOutReturnMessageDto.getCode()) && "Success".equals(saleOutReturnMessageDto.getMsg())) { + List headerDetailsDtoList1 = saleOutReturnMessageDto.getData(); if (headerDetailsDtoList1 != null && headerDetailsDtoList1.size() > 0) { headerDetailsDtoList.addAll(headerDetailsDtoList1); @@ -155,7 +216,7 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity { } } else { //2024年7月30日 13:47:04 查询失败 - logger.error("查询失败,失败原因:{}", JSON.toJSON(returnMessageBasics)); + logger.error("查询失败,失败原因:{}", JSON.toJSON(saleOutReturnMessageDto)); } } else { logger.error("returnMessageBasics为空!queryOfsSoSaleOutVo对象结果:{}", JSON.toJSON(queryOfsSoSaleOutVo)); @@ -271,4 +332,40 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity { logger.info("queryBasicArchives方法headerDetailsDtoList.size为0"); } } + + /** + * bean copy + * 2024年7月31日 10:34:09 + */ + private List copyHeaderDto(List headerDtoList) { + List tocofsSaleoutEntityList = new ArrayList<>(); + if (headerDtoList != null && headerDtoList.size() > 0) { + for (int i = 0; i < headerDtoList.size(); i++) { + com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDto headerDto = headerDtoList.get(i); + TocofsSaleoutEntity tocofsSaleoutEntity = new TocofsSaleoutEntity(); +// BeanUtils.copyProperties(headerDto, tocofsSaleoutEntity); + BeanUtil.copyPropertiesV2(headerDto, tocofsSaleoutEntity); + tocofsSaleoutEntityList.add(tocofsSaleoutEntity); + } + } + return tocofsSaleoutEntityList; + } + + /** + * bean copy + * 2024年8月2日 16:04:11 + */ + private List copyDetailsDto(List detailsDtos) { + List tocofsSaleoutDetailedEntityArrayList = new ArrayList<>(); + if (detailsDtos != null && detailsDtos.size() > 0) { + for (int i = 0; i < detailsDtos.size(); i++) { + com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.DetailsDto detailsDto = detailsDtos.get(i); + TocofsSaleoutDetailedEntity tocofsSaleoutDetailedEntity = new TocofsSaleoutDetailedEntity(); +// BeanUtils.copyProperties(detailsDto, tocofsSaleoutDetailedEntity); + BeanUtil.copyPropertiesV2(detailsDto, tocofsSaleoutDetailedEntity); + tocofsSaleoutDetailedEntityArrayList.add(tocofsSaleoutDetailedEntity); + } + } + return tocofsSaleoutDetailedEntityArrayList; + } } \ No newline at end of file diff --git a/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToCTest.java b/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToCTest.java index 7cf0544d..6fc4d192 100644 --- a/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToCTest.java +++ b/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToCTest.java @@ -26,7 +26,7 @@ class SoSaleOutPluginInitializerToCTest { @Test void startImplement() throws Exception { -// soSaleOutPluginInitializerToC.startImplement("2024-07-05", null); - soSaleOutPluginInitializerToC.queryOfsSaleOrder(); + soSaleOutPluginInitializerToC.startImplement(null, null); +// soSaleOutPluginInitializerToC.queryOfsSaleOrder(); } } \ No newline at end of file