进一步优化方法入口的多场景判断
This commit is contained in:
parent
4083c58dda
commit
149b43bdd0
|
@ -13,6 +13,7 @@ import com.hzya.frame.plugin.lets.dao.*;
|
||||||
import com.hzya.frame.plugin.lets.entity.*;
|
import com.hzya.frame.plugin.lets.entity.*;
|
||||||
import com.hzya.frame.plugin.lets.ofsvo.QueryOfsSoSaleOutVo;
|
import com.hzya.frame.plugin.lets.ofsvo.QueryOfsSoSaleOutVo;
|
||||||
import com.hzya.frame.plugin.lets.queryvo.QueryIntegrationTaskLivingDetails;
|
import com.hzya.frame.plugin.lets.queryvo.QueryIntegrationTaskLivingDetails;
|
||||||
|
import com.hzya.frame.plugin.lets.queryvo.StartAndEndVo;
|
||||||
import com.hzya.frame.plugin.lets.u8cdto.*;
|
import com.hzya.frame.plugin.lets.u8cdto.*;
|
||||||
import com.hzya.frame.plugin.lets.util.*;
|
import com.hzya.frame.plugin.lets.util.*;
|
||||||
import com.hzya.frame.split.SplitListByCountUtil;
|
import com.hzya.frame.split.SplitListByCountUtil;
|
||||||
|
@ -98,6 +99,11 @@ public class ConsignmachiningIn extends PluginBaseEntity {
|
||||||
@Autowired
|
@Autowired
|
||||||
private IntegrationTaskLivingDetailsUtil integrationTaskLivingDetailsUtil;
|
private IntegrationTaskLivingDetailsUtil integrationTaskLivingDetailsUtil;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private OffsetTimeTime offsetTimeTime;
|
||||||
|
|
||||||
|
private static final String PROD_FILED = "prod";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
logger.info(getPluginLabel() + "執行初始化方法initialize()");
|
logger.info(getPluginLabel() + "執行初始化方法initialize()");
|
||||||
|
@ -130,6 +136,34 @@ public class ConsignmachiningIn extends PluginBaseEntity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
|
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
|
||||||
|
long startMillis = System.currentTimeMillis();
|
||||||
|
logger.info("executeBusiness方法调用开始:" + getPluginName() + "-插件");
|
||||||
|
|
||||||
|
try {
|
||||||
|
String param = String.valueOf(requestJson.get("param"));
|
||||||
|
if (ProfilesActiveConstant.TYPE_VBILLCODE.equals(requestJson.get("type"))) {
|
||||||
|
//按单号推送
|
||||||
|
if (param != null && !"".equals(param)) {
|
||||||
|
startImplement(param);
|
||||||
|
}
|
||||||
|
} else if (ProfilesActiveConstant.TYPE_TIME_FRAME.equals(requestJson.get("type"))) {
|
||||||
|
//前台页面功能日期推送,或者接口调用也行
|
||||||
|
String craeteDateStr = offsetTimeTime.computingTime(param);
|
||||||
|
if (craeteDateStr != null && !"".equals(craeteDateStr)) {
|
||||||
|
splitDateAndPush(craeteDateStr);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (ProfilesActiveConstant.LETS_PROFILES_ACTIVE.equals(PROD_FILED)) {
|
||||||
|
//默认被定时器执行,实时执行,计算时间偏移量
|
||||||
|
StartAndEndVo startAndEndVo = offsetTimeTime.offsetTime();
|
||||||
|
startImplement(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;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -941,4 +975,32 @@ public class ConsignmachiningIn extends PluginBaseEntity {
|
||||||
}
|
}
|
||||||
return bdInvbasdocEntity2.get(0);
|
return bdInvbasdocEntity2.get(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分割日期之后,再进行推送
|
||||||
|
*
|
||||||
|
* @author liuyang
|
||||||
|
*/
|
||||||
|
private void splitDateAndPush(String param) throws Exception {
|
||||||
|
try {
|
||||||
|
Assert.notNull(param, "param不能为空!");
|
||||||
|
Assert.state(!"".equals(param), "param不能为空!");
|
||||||
|
|
||||||
|
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(",");
|
||||||
|
startImplement(split[0], split[1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
String[] split = param.split(",");
|
||||||
|
startImplement(split[0], split[1]);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("记录splitDateAndPush方法抛出的异常", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -13,6 +13,7 @@ import com.hzya.frame.plugin.lets.dao.*;
|
||||||
import com.hzya.frame.plugin.lets.entity.*;
|
import com.hzya.frame.plugin.lets.entity.*;
|
||||||
import com.hzya.frame.plugin.lets.ofsvo.QueryOfsSoSaleOutVo;
|
import com.hzya.frame.plugin.lets.ofsvo.QueryOfsSoSaleOutVo;
|
||||||
import com.hzya.frame.plugin.lets.queryvo.QueryIntegrationTaskLivingDetails;
|
import com.hzya.frame.plugin.lets.queryvo.QueryIntegrationTaskLivingDetails;
|
||||||
|
import com.hzya.frame.plugin.lets.queryvo.StartAndEndVo;
|
||||||
import com.hzya.frame.plugin.lets.u8cdto.*;
|
import com.hzya.frame.plugin.lets.u8cdto.*;
|
||||||
import com.hzya.frame.plugin.lets.util.*;
|
import com.hzya.frame.plugin.lets.util.*;
|
||||||
import com.hzya.frame.split.SplitListByCountUtil;
|
import com.hzya.frame.split.SplitListByCountUtil;
|
||||||
|
@ -94,6 +95,11 @@ public class ConsignmachiningInReturn extends PluginBaseEntity {
|
||||||
@Autowired
|
@Autowired
|
||||||
private IntegrationTaskLivingDetailsUtil integrationTaskLivingDetailsUtil;
|
private IntegrationTaskLivingDetailsUtil integrationTaskLivingDetailsUtil;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private OffsetTimeTime offsetTimeTime;
|
||||||
|
|
||||||
|
private static final String PROD_FILED = "prod";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
logger.info(getPluginLabel() + "執行初始化方法initialize()");
|
logger.info(getPluginLabel() + "執行初始化方法initialize()");
|
||||||
|
@ -126,6 +132,34 @@ public class ConsignmachiningInReturn extends PluginBaseEntity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
|
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
|
||||||
|
long startMillis = System.currentTimeMillis();
|
||||||
|
logger.info("executeBusiness方法调用开始:" + getPluginName() + "-插件");
|
||||||
|
|
||||||
|
try {
|
||||||
|
String param = String.valueOf(requestJson.get("param"));
|
||||||
|
if (ProfilesActiveConstant.TYPE_VBILLCODE.equals(requestJson.get("type"))) {
|
||||||
|
//按单号推送
|
||||||
|
if (param != null && !"".equals(param)) {
|
||||||
|
startImplement(param);
|
||||||
|
}
|
||||||
|
} else if (ProfilesActiveConstant.TYPE_TIME_FRAME.equals(requestJson.get("type"))) {
|
||||||
|
//前台页面功能日期推送,或者接口调用也行
|
||||||
|
String craeteDateStr = offsetTimeTime.computingTime(param);
|
||||||
|
if (craeteDateStr != null && !"".equals(craeteDateStr)) {
|
||||||
|
splitDateAndPush(craeteDateStr);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (ProfilesActiveConstant.LETS_PROFILES_ACTIVE.equals(PROD_FILED)) {
|
||||||
|
//默认被定时器执行,实时执行,计算时间偏移量
|
||||||
|
StartAndEndVo startAndEndVo = offsetTimeTime.offsetTime();
|
||||||
|
startImplementByTime(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;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1075,4 +1109,33 @@ public class ConsignmachiningInReturn extends PluginBaseEntity {
|
||||||
Assert.state(false, "通过OFS采退出库单,无法匹配到OFS采退订单明细行! 目标主键:{}", detailsDto.getRefOrderDetailId());
|
Assert.state(false, "通过OFS采退出库单,无法匹配到OFS采退订单明细行! 目标主键:{}", detailsDto.getRefOrderDetailId());
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分割日期之后,再进行推送
|
||||||
|
*
|
||||||
|
* @author liuyang
|
||||||
|
*/
|
||||||
|
private void splitDateAndPush(String param) throws Exception {
|
||||||
|
try {
|
||||||
|
Assert.notNull(param, "param不能为空!");
|
||||||
|
Assert.state(!"".equals(param), "param不能为空!");
|
||||||
|
|
||||||
|
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(",");
|
||||||
|
startImplementByTime(split[0], split[1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
String[] split = param.split(",");
|
||||||
|
startImplementByTime(split[0], split[1]);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("记录splitDateAndPush方法抛出的异常", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -12,6 +12,7 @@ import com.hzya.frame.plugin.lets.constant.ProfilesActiveConstant;
|
||||||
import com.hzya.frame.plugin.lets.dao.*;
|
import com.hzya.frame.plugin.lets.dao.*;
|
||||||
import com.hzya.frame.plugin.lets.entity.*;
|
import com.hzya.frame.plugin.lets.entity.*;
|
||||||
import com.hzya.frame.plugin.lets.ofsvo.QueryOfsSoSaleOutVo;
|
import com.hzya.frame.plugin.lets.ofsvo.QueryOfsSoSaleOutVo;
|
||||||
|
import com.hzya.frame.plugin.lets.queryvo.StartAndEndVo;
|
||||||
import com.hzya.frame.plugin.lets.u8cdto.*;
|
import com.hzya.frame.plugin.lets.u8cdto.*;
|
||||||
import com.hzya.frame.plugin.lets.util.*;
|
import com.hzya.frame.plugin.lets.util.*;
|
||||||
import com.hzya.frame.split.SplitListByCountUtil;
|
import com.hzya.frame.split.SplitListByCountUtil;
|
||||||
|
@ -28,12 +29,15 @@ import com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDto;
|
||||||
import com.hzya.frame.ttxofs.dto.stock.StockinOrderSearchResponse;
|
import com.hzya.frame.ttxofs.dto.stock.StockinOrderSearchResponse;
|
||||||
import com.hzya.frame.ttxofs.service.OfsUnifiedService;
|
import com.hzya.frame.ttxofs.service.OfsUnifiedService;
|
||||||
import com.hzya.frame.web.entity.JsonResultEntity;
|
import com.hzya.frame.web.entity.JsonResultEntity;
|
||||||
|
import com.hzya.frame.web.exception.BaseSystemException;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 代理品牌采购退货业务:(代理品牌采购退货)OFS销退出库单生成U8C红字采购订单
|
* 代理品牌采购退货业务:(代理品牌采购退货)OFS销退出库单生成U8C红字采购订单
|
||||||
|
@ -94,6 +98,11 @@ public class ProxyPurchaseReturn extends PluginBaseEntity {
|
||||||
@Autowired
|
@Autowired
|
||||||
private IntegrationTaskLivingDetailsUtil integrationTaskLivingDetailsUtil;
|
private IntegrationTaskLivingDetailsUtil integrationTaskLivingDetailsUtil;
|
||||||
|
|
||||||
|
private static final String PROD_FILED = "prod";
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private OffsetTimeTime offsetTimeTime;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
logger.info(getPluginLabel() + "執行初始化方法initialize()");
|
logger.info(getPluginLabel() + "執行初始化方法initialize()");
|
||||||
|
@ -126,11 +135,39 @@ public class ProxyPurchaseReturn extends PluginBaseEntity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
|
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
|
||||||
|
long startMillis = System.currentTimeMillis();
|
||||||
|
logger.info("executeBusiness方法调用开始:" + getPluginName() + "-插件");
|
||||||
|
|
||||||
|
try {
|
||||||
|
String param = String.valueOf(requestJson.get("param"));
|
||||||
|
if (ProfilesActiveConstant.TYPE_VBILLCODE.equals(requestJson.get("type"))) {
|
||||||
|
//按单号推送
|
||||||
|
if (param != null && !"".equals(param)) {
|
||||||
|
startImplement(param);
|
||||||
|
}
|
||||||
|
} else if (ProfilesActiveConstant.TYPE_TIME_FRAME.equals(requestJson.get("type"))) {
|
||||||
|
//前台页面功能日期推送,或者接口调用也行
|
||||||
|
String craeteDateStr = offsetTimeTime.computingTime(param);
|
||||||
|
if (craeteDateStr != null && !"".equals(craeteDateStr)) {
|
||||||
|
splitDateAndPush(craeteDateStr);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (ProfilesActiveConstant.LETS_PROFILES_ACTIVE.equals(PROD_FILED)) {
|
||||||
|
//默认被定时器执行,实时执行,计算时间偏移量
|
||||||
|
StartAndEndVo startAndEndVo = offsetTimeTime.offsetTime();
|
||||||
|
startImplement(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;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据单号查询
|
* 根据时间范围查询
|
||||||
*
|
*
|
||||||
* @author liuyang
|
* @author liuyang
|
||||||
*/
|
*/
|
||||||
|
@ -913,4 +950,32 @@ public class ProxyPurchaseReturn extends PluginBaseEntity {
|
||||||
// }
|
// }
|
||||||
// return headerDetailsDtos;
|
// return headerDetailsDtos;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分割日期之后,再进行推送
|
||||||
|
*
|
||||||
|
* @author liuyang
|
||||||
|
*/
|
||||||
|
private void splitDateAndPush(String param) throws Exception {
|
||||||
|
try {
|
||||||
|
Assert.notNull(param, "param不能为空!");
|
||||||
|
Assert.state(!"".equals(param), "param不能为空!");
|
||||||
|
|
||||||
|
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(",");
|
||||||
|
startImplement(split[0], split[1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
String[] split = param.split(",");
|
||||||
|
startImplement(split[0], split[1]);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.info("记录splitDateAndPush方法抛出的异常", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -12,6 +12,7 @@ import com.hzya.frame.plugin.lets.constant.ProfilesActiveConstant;
|
||||||
import com.hzya.frame.plugin.lets.dao.*;
|
import com.hzya.frame.plugin.lets.dao.*;
|
||||||
import com.hzya.frame.plugin.lets.entity.*;
|
import com.hzya.frame.plugin.lets.entity.*;
|
||||||
import com.hzya.frame.plugin.lets.ofsvo.QueryOfsSoSaleOutVo;
|
import com.hzya.frame.plugin.lets.ofsvo.QueryOfsSoSaleOutVo;
|
||||||
|
import com.hzya.frame.plugin.lets.queryvo.StartAndEndVo;
|
||||||
import com.hzya.frame.plugin.lets.u8cdto.*;
|
import com.hzya.frame.plugin.lets.u8cdto.*;
|
||||||
import com.hzya.frame.plugin.lets.util.*;
|
import com.hzya.frame.plugin.lets.util.*;
|
||||||
import com.hzya.frame.split.SplitListByCountUtil;
|
import com.hzya.frame.split.SplitListByCountUtil;
|
||||||
|
@ -92,6 +93,11 @@ public class ProxyPurchaseWarehous extends PluginBaseEntity {
|
||||||
@Autowired
|
@Autowired
|
||||||
private IntegrationTaskLivingDetailsUtil integrationTaskLivingDetailsUtil;
|
private IntegrationTaskLivingDetailsUtil integrationTaskLivingDetailsUtil;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private OffsetTimeTime offsetTimeTime;
|
||||||
|
|
||||||
|
private static final String PROD_FILED = "prod";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
logger.info(getPluginLabel() + "執行初始化方法initialize()");
|
logger.info(getPluginLabel() + "執行初始化方法initialize()");
|
||||||
|
@ -124,6 +130,34 @@ public class ProxyPurchaseWarehous extends PluginBaseEntity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
|
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
|
||||||
|
long startMillis = System.currentTimeMillis();
|
||||||
|
logger.info("executeBusiness方法调用开始:" + getPluginName() + "-插件");
|
||||||
|
|
||||||
|
try {
|
||||||
|
String param = String.valueOf(requestJson.get("param"));
|
||||||
|
if (ProfilesActiveConstant.TYPE_VBILLCODE.equals(requestJson.get("type"))) {
|
||||||
|
//按单号推送
|
||||||
|
if (param != null && !"".equals(param)) {
|
||||||
|
startImplement(param);
|
||||||
|
}
|
||||||
|
} else if (ProfilesActiveConstant.TYPE_TIME_FRAME.equals(requestJson.get("type"))) {
|
||||||
|
//前台页面功能日期推送,或者接口调用也行
|
||||||
|
String craeteDateStr = offsetTimeTime.computingTime(param);
|
||||||
|
if (craeteDateStr != null && !"".equals(craeteDateStr)) {
|
||||||
|
splitDateAndPush(craeteDateStr);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (ProfilesActiveConstant.LETS_PROFILES_ACTIVE.equals(PROD_FILED)) {
|
||||||
|
//默认被定时器执行,实时执行,计算时间偏移量
|
||||||
|
StartAndEndVo startAndEndVo = offsetTimeTime.offsetTime();
|
||||||
|
startImplement(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;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -840,4 +874,32 @@ public class ProxyPurchaseWarehous extends PluginBaseEntity {
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分割日期之后,再进行推送
|
||||||
|
*
|
||||||
|
* @author liuyang
|
||||||
|
*/
|
||||||
|
private void splitDateAndPush(String param) throws Exception {
|
||||||
|
try {
|
||||||
|
Assert.notNull(param, "param不能为空!");
|
||||||
|
Assert.state(!"".equals(param), "param不能为空!");
|
||||||
|
|
||||||
|
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(",");
|
||||||
|
startImplement(split[0], split[1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
String[] split = param.split(",");
|
||||||
|
startImplement(split[0], split[1]);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.info("记录splitDateAndPush方法抛出的异常", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -29,6 +29,7 @@ import com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDetailsDto;
|
||||||
import com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDto;
|
import com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDto;
|
||||||
import com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.SaleOutReturnMessageDto;
|
import com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.SaleOutReturnMessageDto;
|
||||||
import com.hzya.frame.ttxofs.service.OfsUnifiedService;
|
import com.hzya.frame.ttxofs.service.OfsUnifiedService;
|
||||||
|
import com.hzya.frame.u8c.ax.entity.Ass;
|
||||||
import com.hzya.frame.web.entity.JsonResultEntity;
|
import com.hzya.frame.web.entity.JsonResultEntity;
|
||||||
import com.hzya.frame.web.exception.BaseSystemException;
|
import com.hzya.frame.web.exception.BaseSystemException;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
@ -87,17 +88,22 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
|
||||||
return "3";
|
return "3";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static final String STOCK = "stock";
|
||||||
|
|
||||||
|
private static final String TRAN = "tran";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
|
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
|
||||||
long startMillis = System.currentTimeMillis();
|
long startMillis = System.currentTimeMillis();
|
||||||
logger.info("executeBusiness方法调用开始:" + getPluginName() + "-插件");
|
logger.info("executeBusiness方法调用开始:" + getPluginName() + "-插件");
|
||||||
|
|
||||||
if (ProfilesActiveConstant.TYPE_DETAIL_ERROR.equals(requestJson.get("type"))) {
|
// if (ProfilesActiveConstant.TYPE_DETAIL_ERROR.equals(requestJson.get("type"))) {
|
||||||
throw new BaseSystemException("TOC退货业务,无法按单行推送!需要根据天的维度推送");
|
// throw new BaseSystemException("TOC退货业务,无法按单行推送!需要根据天的维度推送");
|
||||||
}
|
// }
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String param = String.valueOf(requestJson.get("param"));
|
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 (ProfilesActiveConstant.TYPE_VBILLCODE.equals(requestJson.get("type"))) {
|
||||||
//按单号
|
//按单号
|
||||||
if (param != null && !"".equals(param)) {
|
if (param != null && !"".equals(param)) {
|
||||||
|
@ -107,13 +113,16 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
|
||||||
//前台页面功能日期推送,或者接口调用也行
|
//前台页面功能日期推送,或者接口调用也行
|
||||||
String craeteDateStr = computingTime(param);
|
String craeteDateStr = computingTime(param);
|
||||||
if (craeteDateStr != null && !"".equals(craeteDateStr)) {
|
if (craeteDateStr != null && !"".equals(craeteDateStr)) {
|
||||||
splitDateAndPush(craeteDateStr);
|
splitDateAndPush(craeteDateStr, sceneType);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (ProfilesActiveConstant.LETS_PROFILES_ACTIVE.equals(PROD_FILED)) {
|
||||||
|
//默认被定时器执行,每天晚上凌晨0点5分
|
||||||
|
//暂定先同步TOC销售库存、再推送TOC销售确认收入
|
||||||
|
List<StartAndEndVo> startAndEndVos = calculateCalculateEntireDayPeriod(null);
|
||||||
|
startImplementStockByTime(startAndEndVos.get(0).getStart_time(), startAndEndVos.get(0).getEnd_time());
|
||||||
|
startImplementTranByTime(startAndEndVos.get(0).getStart_time(), startAndEndVos.get(0).getEnd_time());
|
||||||
}
|
}
|
||||||
} else if (ProfilesActiveConstant.LETS_PROFILES_ACTIVE.equals(PROD_FILED)) {
|
|
||||||
//默认被定时器执行,每天晚上凌晨0点5分
|
|
||||||
List<StartAndEndVo> startAndEndVos = calculateCalculateEntireDayPeriod(null);
|
|
||||||
startImplementStockByTime(startAndEndVos.get(0).getStart_time(), startAndEndVos.get(0).getEnd_time());
|
|
||||||
startImplementTranByTime(startAndEndVos.get(0).getStart_time(), startAndEndVos.get(0).getEnd_time());
|
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("executeBusiness方法异常", e);
|
logger.error("executeBusiness方法异常", e);
|
||||||
|
@ -2106,22 +2115,39 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
|
||||||
*
|
*
|
||||||
* @author liuyang
|
* @author liuyang
|
||||||
*/
|
*/
|
||||||
private void splitDateAndPush(String param) throws Exception {
|
public void splitDateAndPush(String param, String sceneType) throws Exception {
|
||||||
Assert.notNull(param, "param不能为空!");
|
try {
|
||||||
Assert.state(!"".equals(param), "param不能为空!");
|
Assert.notNull(param, "param不能为空!");
|
||||||
|
Assert.state(!"".equals(param), "param不能为空!");
|
||||||
|
|
||||||
if (param.contains("*")) {
|
Assert.notNull(sceneType, "sceneType不能为空!");
|
||||||
String[] params = param.split("\\*");
|
Assert.state(!"".equals(sceneType), "sceneType不能为空!");
|
||||||
if (params.length > 0) {
|
|
||||||
for (int i = 0; i < params.length; i++) {
|
if (param.contains("*")) {
|
||||||
String indexStr = params[i];
|
String[] params = param.split("\\*");
|
||||||
String[] split = indexStr.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)) {
|
||||||
|
startImplementStockByTime(split[0], split[1]);
|
||||||
|
} else if (sceneType.equals(TRAN)) {
|
||||||
|
startImplementTranByTime(split[0], split[1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
String[] split = param.split(",");
|
||||||
|
logger.info("splitDateAndPush方法正在执行主要的逻辑 开始时间:{} 结束时间:{}", split[0], split[1]);
|
||||||
|
if (sceneType.equals(STOCK)) {
|
||||||
startImplementStockByTime(split[0], split[1]);
|
startImplementStockByTime(split[0], split[1]);
|
||||||
|
} else if (sceneType.equals(TRAN)) {
|
||||||
|
startImplementTranByTime(split[0], split[1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} catch (Exception e) {
|
||||||
String[] split = param.split(",");
|
logger.error("记录splitDateAndPush方法抛出的异常", e);
|
||||||
startImplementStockByTime(split[0], split[1]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -2,10 +2,18 @@ package com.hzya.frame.plugin.lets.util;
|
||||||
|
|
||||||
import cn.hutool.core.date.DateField;
|
import cn.hutool.core.date.DateField;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.lang.Assert;
|
||||||
import com.hzya.frame.plugin.lets.queryvo.StartAndEndVo;
|
import com.hzya.frame.plugin.lets.queryvo.StartAndEndVo;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author:liuyang
|
* @Author:liuyang
|
||||||
|
@ -17,6 +25,9 @@ import java.util.Date;
|
||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
public class OffsetTimeTime {
|
public class OffsetTimeTime {
|
||||||
|
|
||||||
|
Logger logger = LoggerFactory.getLogger(OffsetTimeTime.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 实时执行,计算时间
|
* 实时执行,计算时间
|
||||||
*
|
*
|
||||||
|
@ -36,4 +47,53 @@ public class OffsetTimeTime {
|
||||||
|
|
||||||
return startAndEndVo;
|
return startAndEndVo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 计算时间间隔
|
||||||
|
*
|
||||||
|
* @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;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成范围
|
||||||
|
*/
|
||||||
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
package com.hzya.frame.plugin.lets.util;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author:liuyang
|
|
||||||
* @Package:com.hzya.frame.plugin.lets.util
|
|
||||||
* @Project:kangarooDataCenterV3
|
|
||||||
* @name:OfsStandardUti
|
|
||||||
* @Date:2024/8/22 15:01
|
|
||||||
* @Filename:OfsStandardUti
|
|
||||||
*/
|
|
||||||
public class OfsStandardUti {
|
|
||||||
}
|
|
|
@ -74,6 +74,7 @@ class SoSaleOutPluginInitializerToCTest {
|
||||||
// System.out.println(aaa.length());
|
// System.out.println(aaa.length());
|
||||||
|
|
||||||
|
|
||||||
soSaleOutPluginInitializerToC.computingTime("2024-01-01/2024-01-25");
|
String computingTime = soSaleOutPluginInitializerToC.computingTime("2024-01-01/2024-01-01");
|
||||||
|
soSaleOutPluginInitializerToC.splitDateAndPush(computingTime, "tran");
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue