优化TOC、TOB的日志存储
This commit is contained in:
parent
149b43bdd0
commit
3860651162
|
@ -1,6 +1,7 @@
|
|||
package com.hzya.frame.plugin.lets.entity;
|
||||
|
||||
import com.hzya.frame.web.entity.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* (BdRdcl)实体类
|
||||
|
@ -8,8 +9,8 @@ import com.hzya.frame.web.entity.BaseEntity;
|
|||
* @author makejava
|
||||
* @since 2023-12-04 13:49:11
|
||||
*/
|
||||
@Data
|
||||
public class BdRdclEntity extends BaseEntity {
|
||||
|
||||
private Integer dr;
|
||||
private Integer iflag;
|
||||
private String pkCorp;
|
||||
|
@ -20,87 +21,4 @@ public class BdRdclEntity extends BaseEntity {
|
|||
private String rdname;
|
||||
private String sealflag;
|
||||
private String ts;
|
||||
|
||||
|
||||
public Integer getDr() {
|
||||
return dr;
|
||||
}
|
||||
|
||||
public void setDr(Integer dr) {
|
||||
this.dr = dr;
|
||||
}
|
||||
|
||||
public Integer getIflag() {
|
||||
return iflag;
|
||||
}
|
||||
|
||||
public void setIflag(Integer iflag) {
|
||||
this.iflag = iflag;
|
||||
}
|
||||
|
||||
public String getPkCorp() {
|
||||
return pkCorp;
|
||||
}
|
||||
|
||||
public void setPkCorp(String pkCorp) {
|
||||
this.pkCorp = pkCorp;
|
||||
}
|
||||
|
||||
public String getPkFrdcl() {
|
||||
return pkFrdcl;
|
||||
}
|
||||
|
||||
public void setPkFrdcl(String pkFrdcl) {
|
||||
this.pkFrdcl = pkFrdcl;
|
||||
}
|
||||
|
||||
public String getPkRdcl() {
|
||||
return pkRdcl;
|
||||
}
|
||||
|
||||
public void setPkRdcl(String pkRdcl) {
|
||||
this.pkRdcl = pkRdcl;
|
||||
}
|
||||
|
||||
public String getRdcode() {
|
||||
return rdcode;
|
||||
}
|
||||
|
||||
public void setRdcode(String rdcode) {
|
||||
this.rdcode = rdcode;
|
||||
}
|
||||
|
||||
public Integer getRdflag() {
|
||||
return rdflag;
|
||||
}
|
||||
|
||||
public void setRdflag(Integer rdflag) {
|
||||
this.rdflag = rdflag;
|
||||
}
|
||||
|
||||
public String getRdname() {
|
||||
return rdname;
|
||||
}
|
||||
|
||||
public void setRdname(String rdname) {
|
||||
this.rdname = rdname;
|
||||
}
|
||||
|
||||
public String getSealflag() {
|
||||
return sealflag;
|
||||
}
|
||||
|
||||
public void setSealflag(String sealflag) {
|
||||
this.sealflag = sealflag;
|
||||
}
|
||||
|
||||
public String getTs() {
|
||||
return ts;
|
||||
}
|
||||
|
||||
public void setTs(String ts) {
|
||||
this.ts = ts;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -46,5 +46,33 @@ public interface ITocofsSaleoutDetailedDao extends IBaseDao<TocofsSaleoutDetaile
|
|||
* @author liuyang
|
||||
*/
|
||||
void entityInsertOrUpdateBatchStock4(List<TocofsSaleoutDetailedEntity> tocofsSaleoutDetailedEntities) throws Exception;
|
||||
|
||||
/**
|
||||
* 更新出库状态的日志(适用TOB交易成功)
|
||||
*
|
||||
* @author liuyang
|
||||
*/
|
||||
void entityInsertOrUpdateBatchStock5(List<TocofsSaleoutDetailedEntity> tocofsSaleoutDetailedEntities) throws Exception;
|
||||
|
||||
/**
|
||||
* 更新出库状态的日志(适用TOB库存推送)
|
||||
*
|
||||
* @author liuyang
|
||||
*/
|
||||
void entityInsertOrUpdateBatchStock6(List<TocofsSaleoutDetailedEntity> tocofsSaleoutDetailedEntities) throws Exception;
|
||||
|
||||
/**
|
||||
* 更新出库状态的日志(适用TOB确认收入推送)
|
||||
*
|
||||
* @author liuyang
|
||||
*/
|
||||
void entityInsertOrUpdateBatchStock7(List<TocofsSaleoutDetailedEntity> tocofsSaleoutDetailedEntities) throws Exception;
|
||||
|
||||
/**
|
||||
* 更新出库状态的日志(适用TOB确认收入推送)
|
||||
*
|
||||
* @author liuyang
|
||||
*/
|
||||
void entityInsertOrUpdateBatchStock8(List<TocofsSaleoutDetailedEntity> tocofsSaleoutDetailedEntities) throws Exception;
|
||||
}
|
||||
|
||||
|
|
|
@ -38,4 +38,24 @@ public class TocofsSaleoutDetailedDaoImpl extends MybatisGenericDao<TocofsSaleou
|
|||
public void entityInsertOrUpdateBatchStock4(List<TocofsSaleoutDetailedEntity> tocofsSaleoutDetailedEntities) throws Exception {
|
||||
insert("com.hzya.frame.plugin.lets.ofs.dao.impl.TocofsSaleoutDetailedDaoImpl.entityInsertOrUpdateBatchStock4", tocofsSaleoutDetailedEntities);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void entityInsertOrUpdateBatchStock5(List<TocofsSaleoutDetailedEntity> tocofsSaleoutDetailedEntities) throws Exception {
|
||||
insert("com.hzya.frame.plugin.lets.ofs.dao.impl.TocofsSaleoutDetailedDaoImpl.entityInsertOrUpdateBatchStock5", tocofsSaleoutDetailedEntities);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void entityInsertOrUpdateBatchStock6(List<TocofsSaleoutDetailedEntity> tocofsSaleoutDetailedEntities) throws Exception {
|
||||
insert("com.hzya.frame.plugin.lets.ofs.dao.impl.TocofsSaleoutDetailedDaoImpl.entityInsertOrUpdateBatchStock6", tocofsSaleoutDetailedEntities);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void entityInsertOrUpdateBatchStock7(List<TocofsSaleoutDetailedEntity> tocofsSaleoutDetailedEntities) throws Exception {
|
||||
insert("com.hzya.frame.plugin.lets.ofs.dao.impl.TocofsSaleoutDetailedDaoImpl.entityInsertOrUpdateBatchStock7", tocofsSaleoutDetailedEntities);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void entityInsertOrUpdateBatchStock8(List<TocofsSaleoutDetailedEntity> tocofsSaleoutDetailedEntities) throws Exception {
|
||||
insert("com.hzya.frame.plugin.lets.ofs.dao.impl.TocofsSaleoutDetailedDaoImpl.entityInsertOrUpdateBatchStock8", tocofsSaleoutDetailedEntities);
|
||||
}
|
||||
}
|
|
@ -979,6 +979,98 @@
|
|||
</insert>
|
||||
|
||||
|
||||
|
||||
<!-- TOB更新推送状态(适合确认收入蓝字)-->
|
||||
<insert id="entityInsertOrUpdateBatchStock5" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into tocofs_saleout_detailed(id,newPushDate,newTransmitInfo,newState4,newSystemNumber,newSystemPrimary)
|
||||
values
|
||||
<foreach collection="list" item="entity" separator=",">
|
||||
(
|
||||
#{entity.id},
|
||||
#{entity.newPushDate},
|
||||
#{entity.newTransmitInfo},
|
||||
#{entity.newState4},
|
||||
#{entity.newSystemNumber},
|
||||
#{entity.newSystemPrimary}
|
||||
)
|
||||
</foreach>
|
||||
on duplicate key update
|
||||
id = values(id),
|
||||
newPushDate = values(newPushDate),
|
||||
newTransmitInfo = values(newTransmitInfo),
|
||||
newState4 = values(newState4),
|
||||
newSystemNumber = values(newSystemNumber),
|
||||
newSystemPrimary = values(newSystemPrimary)
|
||||
</insert>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- TOB更新推送状态(适合确认收入蓝字)-->
|
||||
<insert id="entityInsertOrUpdateBatchStock6" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into tocofs_saleout_detailed(id,newPushDate,newTransmitInfo,newState,newSystemNumber,newSystemPrimary)
|
||||
values
|
||||
<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),
|
||||
newPushDate = values(newPushDate),
|
||||
newTransmitInfo = values(newTransmitInfo),
|
||||
newState = values(newState),
|
||||
newSystemNumber = values(newSystemNumber),
|
||||
newSystemPrimary = values(newSystemPrimary)
|
||||
</insert>
|
||||
|
||||
<!-- TOB更新推送状态(适合确认收入蓝字)-->
|
||||
<insert id="entityInsertOrUpdateBatchStock7" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into tocofs_saleout_detailed(id,def5,def6,newstate4)
|
||||
values
|
||||
<foreach collection="list" item="entity" separator=",">
|
||||
(
|
||||
#{entity.id},
|
||||
#{entity.def5},
|
||||
#{entity.def6},
|
||||
#{entity.newstate4}
|
||||
)
|
||||
</foreach>
|
||||
on duplicate key update
|
||||
id = values(id),
|
||||
def5 = values(def5),
|
||||
def6 = values(def6),
|
||||
newstate4 = values(newstate4)
|
||||
</insert>
|
||||
|
||||
<!-- TOB更新推送状态(适合确认收入蓝字)-->
|
||||
<insert id="entityInsertOrUpdateBatchStock8" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into tocofs_saleout_detailed(id,def5,def6,newState4,newSystemNumber4,newSystemPrimary4)
|
||||
values
|
||||
<foreach collection="list" item="entity" separator=",">
|
||||
(
|
||||
#{entity.id},
|
||||
#{entity.def5},
|
||||
#{entity.def6},
|
||||
#{entity.newstate4},
|
||||
#{entity.newsystemnumber4},
|
||||
#{entity.newsystemprimary4}
|
||||
)
|
||||
</foreach>
|
||||
on duplicate key update
|
||||
id = values(id),
|
||||
def5 = values(def5),
|
||||
def6 = values(def6),
|
||||
newState4 = values(newState4),
|
||||
newSystemNumber4 = values(newSystemNumber4),
|
||||
newSystemPrimary4 = values(newSystemPrimary4)
|
||||
</insert>
|
||||
|
||||
<!--通过主键修改方法-->
|
||||
<update id="entity_update" parameterType = "com.hzya.frame.plugin.lets.ofs.entity.TocofsSaleoutDetailedEntity" >
|
||||
update tocofs_saleout_detailed set
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -28,6 +28,8 @@ import com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.DetailsDto;
|
|||
import com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDetailsDto;
|
||||
import com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDto;
|
||||
import com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.SaleOutReturnMessageDto;
|
||||
import com.hzya.frame.ttxofs.dto.ofssalesordersearch.SaleOrderMessageDto;
|
||||
import com.hzya.frame.ttxofs.dto.stock.StockinOrderSearchResponse;
|
||||
import com.hzya.frame.ttxofs.service.OfsUnifiedService;
|
||||
import com.hzya.frame.u8c.ax.entity.Ass;
|
||||
import com.hzya.frame.web.entity.JsonResultEntity;
|
||||
|
@ -57,6 +59,9 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
|
|||
private static final ReentrantLock LOCK = new ReentrantLock(true);
|
||||
|
||||
private static final String PROD_FILED = "prod";
|
||||
//
|
||||
// @Autowired
|
||||
// private SoSaleOutPluginInitializerToC soSaleOutPluginInitializerToC;
|
||||
|
||||
@Override
|
||||
public void initialize() {
|
||||
|
@ -964,12 +969,19 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
|
|||
try {
|
||||
//初始化档案缓存
|
||||
CacheTocMapVo cacheTocMapVo = basicArchivesCacheUtil.initCache();
|
||||
//查询对应的OFS销售订单
|
||||
List<com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDetailsDto> headerDetailsDtos = queryOfsOrder(headerDetailsDtoList);
|
||||
findMatchingOfsOrder(headerDetailsDtos, headerDetailsDtoList);
|
||||
|
||||
for (int i = 0; i < headerDetailsDtoList.size(); i++) {
|
||||
HeaderDetailsDto headerDetailsDto = headerDetailsDtoList.get(i);
|
||||
HeaderDto header = headerDetailsDto.getHeader();
|
||||
List<com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.DetailsDto> details = headerDetailsDto.getDetails();
|
||||
try {
|
||||
com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDetailsDto headerDetailsDto1 = header.getHeaderDetailsDto();
|
||||
com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDto header1 = headerDetailsDto1.getHeader();
|
||||
List<com.hzya.frame.ttxofs.dto.ofssalesordersearch.DetailsDto> details1 = headerDetailsDto1.getDetails();
|
||||
|
||||
//表头公司:通过名称匹配U8C公司
|
||||
// String corpName = "上海丽知品牌管理有限公司";
|
||||
String companyCode = header.getCompanyCode();
|
||||
|
@ -1025,6 +1037,8 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
|
|||
BdDefdocEntity bdDefdocEntity1 = cacheTocMapVo.getStringBdDefdocShopEntityMap().get(header.getStoreCode());
|
||||
Assert.notNull(bdDefdocEntity1, "根据O店铺编码({})无法匹配到U8C店铺自定义档案", header.getStoreCode());
|
||||
|
||||
// TODO 查询该单据的收发类别-取销售订单对应的单据类型名称
|
||||
|
||||
//字段拷贝
|
||||
for (int j = 0; j < details.size(); j++) {
|
||||
DetailsDto detailsDto = details.get(j);
|
||||
|
@ -1058,6 +1072,7 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
|
|||
sonDetailsDto.setBdInvmandocEntity(bdInvmandocEntity);
|
||||
sonDetailsDto.setBdInvbasdocEntity(bdInvbasdocEntity);
|
||||
sonDetailsDto.setBdTaxitemsEntity(bdTaxitemsEntity);
|
||||
sonDetailsDto.setHeaderDetailsDto(headerDetailsDto1);
|
||||
|
||||
BeanUtil.copyPropertiesV2(detailsDto, sonDetailsDto);
|
||||
sonDetailsDtoList.add(sonDetailsDto);
|
||||
|
@ -1759,6 +1774,7 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
|
|||
* @author liuyang
|
||||
*/
|
||||
private void updateFailOrSuccessTocofsSaleoutDetailedArchiveInquiry(List<ErrorHeaderDetailsDtoDto> errorHeaderDetailsDtoDtoList) {
|
||||
Assert.notNull(errorHeaderDetailsDtoDtoList, "errorHeaderDetailsDtoDtoList不能为空!");
|
||||
|
||||
Thread thread = new Thread(new Runnable() {
|
||||
@Override
|
||||
|
@ -2150,4 +2166,75 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
|
|||
logger.error("记录splitDateAndPush方法抛出的异常", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过OFS销售出库单,联查OFS销售订单
|
||||
*
|
||||
* @param headerDetailsDtoList OFS销售出库单
|
||||
*/
|
||||
private List<com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDetailsDto> queryOfsOrder(List<com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDetailsDto> headerDetailsDtoList) throws Exception {
|
||||
List<com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDetailsDto> allHeaderDetailsDtoArrayList = new ArrayList<>();
|
||||
try {
|
||||
if (headerDetailsDtoList != null && headerDetailsDtoList.size() > 0) {
|
||||
List<List<HeaderDetailsDto>> splitListByCount = SplitListByCountUtil.splitListByCount(headerDetailsDtoList, 100);
|
||||
for (int i = 0; i < splitListByCount.size(); i++) {
|
||||
List<HeaderDetailsDto> headerDetailsDtos = splitListByCount.get(i);
|
||||
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
if (headerDetailsDtos != null && headerDetailsDtos.size() > 0) {
|
||||
for (int j = 0; j < headerDetailsDtos.size(); j++) {
|
||||
HeaderDetailsDto headerDetailsDto = headerDetailsDtos.get(j);
|
||||
HeaderDto header = headerDetailsDto.getHeader();
|
||||
// List<DetailsDto> details = headerDetailsDto.getDetails();
|
||||
// stringBuffer.append("'");
|
||||
stringBuffer.append(header.getRefOrderCode());
|
||||
// stringBuffer.append("'");
|
||||
stringBuffer.append(",");
|
||||
}
|
||||
}
|
||||
String substring = stringBuffer.substring(0, stringBuffer.length());
|
||||
|
||||
List<com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDetailsDto> headerDetailsDtoArrayList = new ArrayList<>();
|
||||
QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo();
|
||||
queryOfsSoSaleOutVo.setCode(substring);
|
||||
ofsStandardUtil.getOfsSaleOrder(queryOfsSoSaleOutVo, headerDetailsDtoArrayList, 1L);
|
||||
allHeaderDetailsDtoArrayList.addAll(headerDetailsDtoArrayList);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("queryOfsOrder方法抛出异常", e);
|
||||
}
|
||||
return allHeaderDetailsDtoArrayList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 代码匹配销售订单
|
||||
*
|
||||
* @param ofsSaleOrder ofs销售订单集合
|
||||
* @param ofsSaleOutOrder ofs销售出库单集合
|
||||
* @author liuyang
|
||||
*/
|
||||
private void findMatchingOfsOrder(List<com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDetailsDto> ofsSaleOrder, List<com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDetailsDto> ofsSaleOutOrder) throws Exception {
|
||||
if (ofsSaleOrder != null && ofsSaleOutOrder != null && ofsSaleOrder.size() > 0 && ofsSaleOutOrder.size() > 0) {
|
||||
try {
|
||||
for (int i = 0; i < ofsSaleOutOrder.size(); i++) {
|
||||
HeaderDetailsDto headerDetailsDto = ofsSaleOutOrder.get(i);
|
||||
HeaderDto header = headerDetailsDto.getHeader();
|
||||
List<DetailsDto> details = headerDetailsDto.getDetails();
|
||||
|
||||
String targetRefOrderCode = header.getRefOrderCode();
|
||||
for (int j = 0; j < ofsSaleOrder.size(); j++) {
|
||||
com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDetailsDto headerDetailsDto1 = ofsSaleOrder.get(j);
|
||||
com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDto header1 = headerDetailsDto1.getHeader();
|
||||
List<com.hzya.frame.ttxofs.dto.ofssalesordersearch.DetailsDto> details1 = headerDetailsDto1.getDetails();
|
||||
if (header1.getCode().equals(targetRefOrderCode)) {
|
||||
header.setHeaderDetailsDto(headerDetailsDto1);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("findMatchingOfsOrder方法抛出异常", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -39,7 +39,10 @@ import org.slf4j.LoggerFactory;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* OFS售后入库单(TOB)生成U8C红字销售订单
|
||||
|
@ -90,6 +93,38 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
|
|||
|
||||
@Override
|
||||
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
|
||||
long startMillis = System.currentTimeMillis();
|
||||
logger.info("executeBusiness方法调用开始:" + getPluginName() + "-插件");
|
||||
|
||||
try {
|
||||
String param = String.valueOf(requestJson.get("param"));
|
||||
String sceneType = String.valueOf(requestJson.get("sceneType"));//sceneType:stock、tran
|
||||
if (ProfilesActiveConstant.TYPE_VBILLCODE.equals(requestJson.get("type"))) {
|
||||
//按单号
|
||||
if (param != null && !"".equals(param)) {
|
||||
startImplementByCode(param);
|
||||
}
|
||||
} else if (ProfilesActiveConstant.TYPE_TIME_FRAME.equals(requestJson.get("type"))) {
|
||||
//前台页面功能日期推送,或者接口调用也行
|
||||
Assert.notNull(sceneType, "sceneType参数不能为空");
|
||||
Assert.notNull(!"".equals(sceneType), "sceneType参数不能为空");
|
||||
String craeteDateStr = computingTime(param);
|
||||
if (craeteDateStr != null && !"".equals(craeteDateStr)) {
|
||||
splitDateAndPush(craeteDateStr, sceneType);
|
||||
}
|
||||
} else {
|
||||
if (ProfilesActiveConstant.LETS_PROFILES_ACTIVE.equals(PROD_FILED)) {
|
||||
//实时执行,每1分钟调度一次
|
||||
StartAndEndVo startAndEndVo = offsetTimeTime.offsetTime();
|
||||
startImplementByStockTime(startAndEndVo.getStart_time(), startAndEndVo.getEnd_time());
|
||||
startImplementByTradeTime(startAndEndVo.getStart_time(), startAndEndVo.getEnd_time());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("executeBusiness方法异常", e);
|
||||
}
|
||||
long endMillis = System.currentTimeMillis();
|
||||
logger.info("executeBusiness方法调用结束:" + getPluginName() + "-插件 执行耗时:{}", (endMillis - startMillis));
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -162,6 +197,12 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
|
|||
@Autowired
|
||||
private ISoSaleinvoiceDao iSoSaleinvoiceDao;
|
||||
|
||||
private static final String STOCK = "stock";
|
||||
|
||||
private static final String TRAN = "tran";
|
||||
|
||||
private static final String PROD_FILED = "prod";
|
||||
|
||||
private static final String VNOTETYPE = "RETURN";
|
||||
|
||||
/**
|
||||
|
@ -1710,4 +1751,98 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算时间间隔
|
||||
*
|
||||
* @author liuyang
|
||||
*/
|
||||
public String computingTime(String param) {
|
||||
if (param != null && !"".equals(param)) {
|
||||
String[] split = param.split("/");
|
||||
if (!(split.length == 2)) {
|
||||
Assert.state(false, "传递的日期格式不完整 格式参考:2024-04-01/2024-04-30");
|
||||
}
|
||||
|
||||
LocalDate startDate = LocalDate.parse(split[0]);
|
||||
LocalDate endDate = LocalDate.parse(split[1]);
|
||||
|
||||
List<String> stringArrayList = new ArrayList<>();
|
||||
List<String> dateRange = getDateRange(startDate, endDate);
|
||||
if (dateRange != null && dateRange.size() > 0) {
|
||||
for (int i = 0; i < dateRange.size(); i++) {
|
||||
String dateStr = dateRange.get(i);
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
stringBuffer.append(dateStr);
|
||||
stringBuffer.append(" 00:00:00");
|
||||
stringBuffer.append(",");
|
||||
stringBuffer.append(dateStr);
|
||||
stringBuffer.append(" 23:59:59");
|
||||
stringArrayList.add(stringBuffer.toString());
|
||||
}
|
||||
}
|
||||
String collectDateStr = stringArrayList.stream().collect(Collectors.joining("*"));
|
||||
logger.info("类型:time_frame 生成的日期范围:" + collectDateStr);
|
||||
return collectDateStr;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算日期范围
|
||||
*
|
||||
* @author liuyang
|
||||
*/
|
||||
private List<String> getDateRange(LocalDate startDate, LocalDate endDate) {
|
||||
List<String> dateRange = new ArrayList<>();
|
||||
LocalDate currentDate = startDate;
|
||||
while (!currentDate.isAfter(endDate)) {
|
||||
dateRange.add(currentDate.format(DateTimeFormatter.ISO_DATE));
|
||||
currentDate = currentDate.plusDays(1);
|
||||
}
|
||||
return dateRange;
|
||||
}
|
||||
|
||||
/**
|
||||
* 分割日期之后,再进行推送
|
||||
*
|
||||
* @param param 日期参数
|
||||
* @param sceneType 场景类型 TOB库存、TOB确认收入
|
||||
* @author liuyang
|
||||
*/
|
||||
public void splitDateAndPush(String param, String sceneType) throws Exception {
|
||||
try {
|
||||
Assert.notNull(param, "param不能为空!");
|
||||
Assert.state(!"".equals(param), "param不能为空!");
|
||||
|
||||
Assert.notNull(sceneType, "sceneType不能为空!");
|
||||
Assert.state(!"".equals(sceneType), "sceneType不能为空!");
|
||||
|
||||
if (param.contains("*")) {
|
||||
String[] params = param.split("\\*");
|
||||
if (params.length > 0) {
|
||||
for (int i = 0; i < params.length; i++) {
|
||||
String indexStr = params[i];
|
||||
String[] split = indexStr.split(",");
|
||||
logger.info("splitDateAndPush方法正在执行主要的逻辑 开始时间:{} 结束时间:{}", split[0], split[1]);
|
||||
if (sceneType.equals(STOCK)) {
|
||||
startImplementByStockTime(split[0], split[1]);
|
||||
} else if (sceneType.equals(TRAN)) {
|
||||
startImplementByTradeTime(split[0], split[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
String[] split = param.split(",");
|
||||
logger.info("splitDateAndPush方法正在执行主要的逻辑 开始时间:{} 结束时间:{}", split[0], split[1]);
|
||||
if (sceneType.equals(STOCK)) {
|
||||
startImplementByStockTime(split[0], split[1]);
|
||||
} else if (sceneType.equals(TRAN)) {
|
||||
startImplementByTradeTime(split[0], split[1]);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("记录splitDateAndPush方法抛出的异常", e);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -19,4 +19,14 @@ public class ErrorHeaderDetailsDtoDto extends HeaderDetailsDto {
|
|||
private String newTransmitInfo;
|
||||
//(销售)出库同步是否成功
|
||||
private String newstate;
|
||||
//推送时间
|
||||
private String def5;
|
||||
//报错详情
|
||||
private String def6;
|
||||
//(销售)交易成功(TOB发票)是否成功
|
||||
private String newstate4;
|
||||
//下游单号
|
||||
private String newSystemNumber4;
|
||||
//下游主键
|
||||
private String newSystemPrimary4;
|
||||
}
|
||||
|
|
|
@ -73,4 +73,7 @@ public class SonDetailsDto extends DetailsDto {
|
|||
|
||||
//存货税率
|
||||
private BdTaxitemsEntity bdTaxitemsEntity;
|
||||
|
||||
//对应的OFS销售订单
|
||||
private com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDetailsDto headerDetailsDto;
|
||||
}
|
|
@ -12,6 +12,7 @@ import com.hzya.frame.ttxofs.dto.ofspurchasereturnorder.PurchaseReturnOrder;
|
|||
import com.hzya.frame.ttxofs.dto.ofspurchasereturnorder.PurchaseReturnOrderBean;
|
||||
import com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDetailsDto;
|
||||
import com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.SaleOutReturnMessageDto;
|
||||
import com.hzya.frame.ttxofs.dto.ofssalesordersearch.SaleOrderMessageDto;
|
||||
import com.hzya.frame.ttxofs.dto.stock.StockinOrderSearchResponse;
|
||||
import com.hzya.frame.ttxofs.service.OfsUnifiedService;
|
||||
import org.slf4j.Logger;
|
||||
|
@ -195,4 +196,46 @@ public class OfsStandardUtil {
|
|||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询OFS销售订单
|
||||
*
|
||||
* @param queryOfsSoSaleOutVo 查询条件
|
||||
* @param headerDetailsDtoList 需要填充原始的数组集合
|
||||
* @param pageNo 从第几页开始查询
|
||||
* @author liuyang
|
||||
*/
|
||||
public void getOfsSaleOrder(QueryOfsSoSaleOutVo queryOfsSoSaleOutVo, List<com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDetailsDto> headerDetailsDtoList, Long pageNo) throws Exception {
|
||||
Assert.notNull(queryOfsSoSaleOutVo, "queryOfsSoSaleOutVo不能为空!");
|
||||
Assert.notNull(headerDetailsDtoList, "saleOrderMessageDtoList不能为空!");
|
||||
Assert.notNull(pageNo, "pageNo不能为空!");
|
||||
|
||||
Long pageSize = 200L;
|
||||
// Long pageNo = 1L;
|
||||
queryOfsSoSaleOutVo.setPageNo(pageNo);
|
||||
queryOfsSoSaleOutVo.setPageSize(pageSize);
|
||||
|
||||
// QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo();
|
||||
// queryOfsSoSaleOutVo.setPageNo(pageNo);
|
||||
// queryOfsSoSaleOutVo.setPageSize(pageSize);
|
||||
// queryOfsSoSaleOutVo.setCode(code);
|
||||
|
||||
InterfaceParamDto interfaceParamDto = new InterfaceParamDto();
|
||||
interfaceParamDto.setApi("ofs.salesOrder.search");
|
||||
interfaceParamDto.setData(JSON.toJSONString(queryOfsSoSaleOutVo));
|
||||
SaleOrderMessageDto saleOrderMessageDto = (SaleOrderMessageDto) ofsUnifiedService.unified(interfaceParamDto);
|
||||
if (saleOrderMessageDto != null) {
|
||||
if ("false".equals(saleOrderMessageDto.getError()) && "0".equals(saleOrderMessageDto.getCode()) && "Success".equals(saleOrderMessageDto.getMsg())) {
|
||||
List<com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDetailsDto> data = saleOrderMessageDto.getData();
|
||||
if (data != null && data.size() > 0) {
|
||||
headerDetailsDtoList.addAll(data);
|
||||
getOfsSaleOrder(queryOfsSoSaleOutVo, headerDetailsDtoList, ++pageNo);
|
||||
}
|
||||
} else {
|
||||
logger.error("查询失败,失败原因:{}", JSON.toJSON(saleOrderMessageDto));
|
||||
}
|
||||
} else {
|
||||
logger.error("getOfsSaleOrder为空!interfaceParamDto对象的结果集json:{}", JSON.toJSON(interfaceParamDto));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -74,7 +74,11 @@ class SoSaleOutPluginInitializerToCTest {
|
|||
// System.out.println(aaa.length());
|
||||
|
||||
|
||||
String computingTime = soSaleOutPluginInitializerToC.computingTime("2024-01-01/2024-01-01");
|
||||
soSaleOutPluginInitializerToC.splitDateAndPush(computingTime, "tran");
|
||||
// String computingTime = soSaleOutPluginInitializerToC.computingTime("2024-01-01/2024-01-01");
|
||||
// soSaleOutPluginInitializerToC.splitDateAndPush(computingTime, "tran");
|
||||
|
||||
|
||||
String s = "LETS-SH2024081900000001";
|
||||
soSaleOutPluginInitializerToC.startImplementStockByCode(s);
|
||||
}
|
||||
}
|
|
@ -49,4 +49,22 @@ public class OfsStandardUtilTest {
|
|||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试销售订单
|
||||
*/
|
||||
@Test
|
||||
public void getOfsOrder() {
|
||||
try {
|
||||
List<com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDetailsDto> headerDetailsDtoList = new ArrayList<>();
|
||||
|
||||
QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo();
|
||||
queryOfsSoSaleOutVo.setCode("LETS-SO2024082300021950,LETS-SO2024082300021944");
|
||||
ofsStandardUtil.getOfsSaleOrder(queryOfsSoSaleOutVo, headerDetailsDtoList, 1L);
|
||||
|
||||
System.out.println(headerDetailsDtoList.size());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -49,4 +49,8 @@ public class DetailsDto {
|
|||
* 额外参数:(销售)交易成功(蓝)是否成功
|
||||
*/
|
||||
private String newState3;
|
||||
/**
|
||||
* (销售)交易成功(TOB发票)是否成功
|
||||
*/
|
||||
private String newState4;
|
||||
}
|
|
@ -73,4 +73,7 @@ public class HeaderDto {
|
|||
|
||||
//出库类型
|
||||
private String shipmentType;
|
||||
|
||||
//OFS销售订单
|
||||
private com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDetailsDto headerDetailsDto;
|
||||
}
|
Loading…
Reference in New Issue