代码备份
parent
9bca7f4729
commit
0409c47ca6
@ -0,0 +1,14 @@
|
||||
package com.glxp.sale.admin.res.sync;
|
||||
|
||||
import com.glxp.sale.admin.entity.sync.ProductInfoEntity;
|
||||
import com.glxp.sale.admin.entity.sync.UdiCompanyEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class SpSyncUdiResponse {
|
||||
|
||||
List<ProductInfoEntity> productInfoEntityList;
|
||||
List<UdiCompanyEntity> udiCompanyEntities;
|
||||
}
|
@ -1,215 +0,0 @@
|
||||
package com.glxp.sale.admin.thread;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.glxp.sale.admin.constant.BasicProcessStatus;
|
||||
import com.glxp.sale.admin.constant.FileConstant;
|
||||
import com.glxp.sale.admin.entity.param.SystemParamConfigEntity;
|
||||
import com.glxp.sale.admin.entity.sync.*;
|
||||
import com.glxp.sale.admin.http.SpGetHttp;
|
||||
import com.glxp.sale.admin.res.PageSimpleResponse;
|
||||
import com.glxp.sale.admin.res.sync.DlOrderResponse;
|
||||
import com.glxp.sale.admin.res.sync.UdiRelevanceExportJsonResponse;
|
||||
import com.glxp.sale.admin.service.param.SystemParamConfigService;
|
||||
import com.glxp.sale.admin.service.sync.*;
|
||||
import com.glxp.sale.admin.util.CustomUtil;
|
||||
import com.glxp.sale.admin.util.DateUtil;
|
||||
import com.glxp.sale.admin.util.FileUtils;
|
||||
import com.glxp.sale.admin.util.RedisUtil;
|
||||
import com.glxp.sale.common.res.BaseResponse;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class DlBasicService {
|
||||
|
||||
|
||||
@Resource
|
||||
SpGetHttp spGetHttp;
|
||||
@Resource
|
||||
SystemParamConfigService systemParamConfigService;
|
||||
@Resource
|
||||
private ThrImportLogService thrImportLogService;
|
||||
@Resource
|
||||
RedisUtil redisUtil;
|
||||
@Resource
|
||||
BasicExportService basicExportService;
|
||||
|
||||
public String getPath() {
|
||||
SystemParamConfigEntity systemParamConfigEntity = systemParamConfigService.selectByParamKey("share_folder");
|
||||
String filePath = systemParamConfigEntity.getParamValue();
|
||||
return filePath;
|
||||
}
|
||||
|
||||
@Async
|
||||
public void dlBasicUdiInfo() {
|
||||
SystemParamConfigEntity systemParamConfigEntity = systemParamConfigService.selectByParamKey("sync_upstream_enable");
|
||||
if (systemParamConfigEntity.getParamValue().equals("1")) {
|
||||
BaseResponse<List<BasicExportStatusEntity>> baseResponse = spGetHttp.getBasicStatus(BasicProcessStatus.BASIC_UDI + "");
|
||||
SystemParamConfigEntity downstream = systemParamConfigService.selectByParamKey("sync_downstream_enable");
|
||||
List<BasicExportStatusEntity> pageSimpleResponse = baseResponse.getData();
|
||||
if (pageSimpleResponse != null) {
|
||||
List<BasicExportStatusEntity> basicExportStatusEntities = pageSimpleResponse;
|
||||
if (basicExportStatusEntities != null && basicExportStatusEntities.size() > 0) {
|
||||
for (BasicExportStatusEntity basicExportStatusEntity : basicExportStatusEntities) {
|
||||
if (!StrUtil.isEmpty(basicExportStatusEntity.getIdDatas())) {
|
||||
if (basicExportStatusEntity.getType() == BasicProcessStatus.BASIC_UDI) {
|
||||
List<String> ids = JSON.parseArray(basicExportStatusEntity.getIdDatas(), String.class);
|
||||
String datas = spGetHttp.getBasicUdiInfo(ids);
|
||||
String key = basicExportStatusEntity.getId() + "";
|
||||
if (downstream.getParamValue().equals("1")) {
|
||||
redisUtil.set(key, datas);
|
||||
BasicExportStatusEntity myEntity = new BasicExportStatusEntity();
|
||||
BeanUtils.copyProperties(basicExportStatusEntity, myEntity);
|
||||
myEntity.setId(key);
|
||||
basicExportService.insertExportStatus(myEntity);
|
||||
spGetHttp.postDeleteBasicStatus(basicExportStatusEntity.getId());
|
||||
} else {
|
||||
String path = getPath();
|
||||
// String fileName = path + FileConstant.upWaitCopy_products + "耗材字典" + key + ".udi";
|
||||
// String backFileName = path + FileConstant.upWaitCopy_products_back + "耗材字典" + key + ".udi";
|
||||
|
||||
String fileName = path + FileConstant.upWaitCopy_products + "BaseProduct" + DateUtil.formatDate(new Date(), "yyyyMMddHHmmss") + ".LowerIn";
|
||||
String backFileName = path + FileConstant.upWaitCopy_products_back + "BaseProduct" + DateUtil.formatDate(new Date(), "yyyyMMddHHmmss") + ".LowerIn";
|
||||
|
||||
|
||||
// FileUtils.makeDirectory(path);
|
||||
// FileUtils.makeDirectory(path + "/备份/");
|
||||
FileUtils.SaveFileAs(datas, fileName);
|
||||
FileUtils.SaveFileAs(datas, backFileName);
|
||||
ThrImportLogEntity thrImportLogEntity = new ThrImportLogEntity();
|
||||
thrImportLogEntity.setGenKey(CustomUtil.getUUId());
|
||||
thrImportLogEntity.setImportType(BasicProcessStatus.IMPORT_LOG_TYPE_UDIINFO);
|
||||
thrImportLogEntity.setUpdateTime(new Date());
|
||||
thrImportLogEntity.setFilePath(fileName);
|
||||
thrImportLogEntity.setBackFilePath(backFileName);
|
||||
thrImportLogService.insertImportLog(thrImportLogEntity);
|
||||
spGetHttp.postDeleteBasicStatus(basicExportStatusEntity.getId());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Async
|
||||
public void dlBasicCorp() {
|
||||
SystemParamConfigEntity systemParamConfigEntity = systemParamConfigService.selectByParamKey("sync_upstream_enable");
|
||||
if (systemParamConfigEntity.getParamValue().equals("1")) {
|
||||
|
||||
SystemParamConfigEntity downstream = systemParamConfigService.selectByParamKey("sync_downstream_enable");
|
||||
|
||||
BaseResponse<List<BasicExportStatusEntity>> baseResponse = spGetHttp.getBasicStatus(BasicProcessStatus.BASIC_CORP + "");
|
||||
List<BasicExportStatusEntity> pageSimpleResponse = baseResponse.getData();
|
||||
if (pageSimpleResponse != null) {
|
||||
List<BasicExportStatusEntity> basicExportStatusEntities = pageSimpleResponse;
|
||||
if (basicExportStatusEntities != null && basicExportStatusEntities.size() > 0) {
|
||||
for (BasicExportStatusEntity basicExportStatusEntity : basicExportStatusEntities) {
|
||||
if (!StrUtil.isEmpty(basicExportStatusEntity.getIdDatas())) {
|
||||
List<String> ids = JSON.parseArray(basicExportStatusEntity.getIdDatas(), String.class);
|
||||
String datas = spGetHttp.getBasicCorps(ids);
|
||||
String key = basicExportStatusEntity.getId() + "";
|
||||
if (downstream.getParamValue().equals("1")) {
|
||||
redisUtil.set(key, datas);
|
||||
BasicExportStatusEntity myEntity = new BasicExportStatusEntity();
|
||||
BeanUtils.copyProperties(basicExportStatusEntity, myEntity);
|
||||
myEntity.setId(key);
|
||||
basicExportService.insertExportStatus(myEntity);
|
||||
spGetHttp.postDeleteBasicStatus(basicExportStatusEntity.getId());
|
||||
} else {
|
||||
String path = getPath();
|
||||
// String fileName = path + FileConstant.upWaitCopy_products + "往来单位" + key + ".udi";
|
||||
// String backFileName = path + FileConstant.upWaitCopy_products_back + "往来单位" + key + ".udi";
|
||||
|
||||
String fileName = path + FileConstant.upWaitCopy_products + "BaseCorp" + DateUtil.formatDate(new Date(), "yyyyMMddHHmmss") + ".LowerIn";
|
||||
String backFileName = path + FileConstant.upWaitCopy_products_back + "BaseCorp" + DateUtil.formatDate(new Date(), "yyyyMMddHHmmss") + ".LowerIn";
|
||||
|
||||
// FileUtils.makeDirectory(path);
|
||||
// FileUtils.makeDirectory(path + "备份");
|
||||
FileUtils.SaveFileAs(datas, fileName);
|
||||
FileUtils.SaveFileAs(datas, backFileName);
|
||||
ThrImportLogEntity thrImportLogEntity = new ThrImportLogEntity();
|
||||
thrImportLogEntity.setGenKey(CustomUtil.getUUId());
|
||||
thrImportLogEntity.setImportType(BasicProcessStatus.IMPORT_LOG_TYPE_CORP);
|
||||
thrImportLogEntity.setUpdateTime(new Date());
|
||||
thrImportLogEntity.setFilePath(fileName);
|
||||
thrImportLogEntity.setBackFilePath(backFileName);
|
||||
thrImportLogService.insertImportLog(thrImportLogEntity);
|
||||
spGetHttp.postDeleteBasicStatus(basicExportStatusEntity.getId());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Async
|
||||
public void dlBasicInv() {
|
||||
SystemParamConfigEntity systemParamConfigEntity = systemParamConfigService.selectByParamKey("sync_upstream_enable");
|
||||
if (systemParamConfigEntity.getParamValue().equals("1")) {
|
||||
BaseResponse<List<BasicExportStatusEntity>> baseResponse = spGetHttp.getBasicStatus(BasicProcessStatus.BASIC_INV + "");
|
||||
SystemParamConfigEntity downstream = systemParamConfigService.selectByParamKey("sync_downstream_enable");
|
||||
List<BasicExportStatusEntity> pageSimpleResponse = baseResponse.getData();
|
||||
if (pageSimpleResponse != null) {
|
||||
List<BasicExportStatusEntity> basicExportStatusEntities = pageSimpleResponse;
|
||||
if (basicExportStatusEntities != null && basicExportStatusEntities.size() > 0) {
|
||||
for (BasicExportStatusEntity basicExportStatusEntity : basicExportStatusEntities) {
|
||||
if (!StrUtil.isEmpty(basicExportStatusEntity.getIdDatas())) {
|
||||
List<String> ids = JSON.parseArray(basicExportStatusEntity.getIdDatas(), String.class);
|
||||
String datas = spGetHttp.getBasicInv(ids);
|
||||
String key = basicExportStatusEntity.getId() + "";
|
||||
if (downstream.getParamValue().equals("1")) {
|
||||
redisUtil.set(key, datas);
|
||||
BasicExportStatusEntity myEntity = new BasicExportStatusEntity();
|
||||
BeanUtils.copyProperties(basicExportStatusEntity, myEntity);
|
||||
myEntity.setId(key);
|
||||
basicExportService.insertExportStatus(myEntity);
|
||||
spGetHttp.postDeleteBasicStatus(basicExportStatusEntity.getId());
|
||||
} else {
|
||||
String path = getPath();
|
||||
// String fileName = path + FileConstant.upWaitCopy_products + "仓库字典" + key + ".udi";
|
||||
// String backFileName = path + FileConstant.upWaitCopy_products_back + "仓库字典" + key + ".udi";
|
||||
|
||||
String fileName = path + FileConstant.upWaitCopy_products + "BaseWarehouse" + DateUtil.formatDate(new Date(), "yyyyMMddHHmmss") + ".LowerIn";
|
||||
String backFileName = path + FileConstant.upWaitCopy_products_back + "BaseWarehouse" + DateUtil.formatDate(new Date(), "yyyyMMddHHmmss") + ".LowerIn";
|
||||
|
||||
// FileUtils.makeDirectory(path);
|
||||
// FileUtils.makeDirectory(path + "/备份/");
|
||||
FileUtils.SaveFileAs(datas, fileName);
|
||||
FileUtils.SaveFileAs(datas, backFileName);
|
||||
ThrImportLogEntity thrImportLogEntity = new ThrImportLogEntity();
|
||||
thrImportLogEntity.setGenKey(CustomUtil.getUUId());
|
||||
thrImportLogEntity.setImportType(BasicProcessStatus.IMPORT_LOG_TYPE_INV);
|
||||
thrImportLogEntity.setUpdateTime(new Date());
|
||||
thrImportLogEntity.setFilePath(fileName);
|
||||
thrImportLogEntity.setBackFilePath(backFileName);
|
||||
thrImportLogService.insertImportLog(thrImportLogEntity);
|
||||
spGetHttp.postDeleteBasicStatus(basicExportStatusEntity.getId());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,127 +0,0 @@
|
||||
package com.glxp.sale.admin.thread;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.glxp.sale.admin.constant.FileConstant;
|
||||
import com.glxp.sale.admin.entity.param.SystemParamConfigEntity;
|
||||
import com.glxp.sale.admin.entity.sync.*;
|
||||
import com.glxp.sale.admin.http.SpGetHttp;
|
||||
import com.glxp.sale.admin.res.PageSimpleResponse;
|
||||
import com.glxp.sale.admin.res.sync.DlOrderResponse;
|
||||
import com.glxp.sale.admin.service.param.SystemParamConfigService;
|
||||
import com.glxp.sale.admin.service.sync.CodesService;
|
||||
import com.glxp.sale.admin.service.sync.IOOrderStatusService;
|
||||
import com.glxp.sale.admin.service.sync.OrderService;
|
||||
import com.glxp.sale.admin.service.sync.ThrImportLogService;
|
||||
import com.glxp.sale.admin.util.CustomUtil;
|
||||
import com.glxp.sale.admin.util.DateUtil;
|
||||
import com.glxp.sale.admin.util.FileUtils;
|
||||
import com.glxp.sale.common.res.BaseResponse;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class DlSpOrderService {
|
||||
@Resource
|
||||
SpGetHttp spGetHttp;
|
||||
@Resource
|
||||
CodesService codesService;
|
||||
@Resource
|
||||
OrderService orderService;
|
||||
@Resource
|
||||
SystemParamConfigService systemParamConfigService;
|
||||
@Resource
|
||||
IOOrderStatusService ioOrderStatusService;
|
||||
@Resource
|
||||
private ThrImportLogService thrImportLogService;
|
||||
|
||||
public String getPath() {
|
||||
SystemParamConfigEntity systemParamConfigEntity = systemParamConfigService.selectByParamKey("share_folder");
|
||||
String filePath = systemParamConfigEntity.getParamValue();
|
||||
return filePath;
|
||||
}
|
||||
|
||||
@Async
|
||||
public void dlOrdedrs() {
|
||||
|
||||
SystemParamConfigEntity systemParamConfigEntity = systemParamConfigService.selectByParamKey("sync_upstream_enable");
|
||||
if (systemParamConfigEntity.getParamValue().equals("1")) {
|
||||
String path = getPath();
|
||||
SystemParamConfigEntity downstream = systemParamConfigService.selectByParamKey("sync_downstream_enable");
|
||||
BaseResponse<PageSimpleResponse<IOOrderStatusEntity>> baseResponse = spGetHttp.getOrderStatus();
|
||||
PageSimpleResponse<IOOrderStatusEntity> pageSimpleResponse = baseResponse.getData();
|
||||
// SystemParamConfigEntity folderConfig = systemParamConfigService.selectByParamKey("gen_order_folder");
|
||||
// SystemParamConfigEntity stausConfig = systemParamConfigService.selectByParamKey("gen_order_status");
|
||||
|
||||
|
||||
if (pageSimpleResponse != null) {
|
||||
List<IOOrderStatusEntity> ioOrderStatusEntityList = pageSimpleResponse.getList();
|
||||
if (ioOrderStatusEntityList != null && ioOrderStatusEntityList.size() > 0) {
|
||||
for (IOOrderStatusEntity ioOrderStatusEntity : ioOrderStatusEntityList) {
|
||||
BaseResponse<List<DlOrderResponse>> ordersRes = spGetHttp.getOrders(ioOrderStatusEntity.getOrderId());
|
||||
List<DlOrderResponse> dlOrderResponses = ordersRes.getData();
|
||||
if (dlOrderResponses != null && dlOrderResponses.size() > 0) {
|
||||
for (DlOrderResponse dlOrderResponse : dlOrderResponses) {
|
||||
OrderEntity orderEntity = dlOrderResponse.getOrderEntity();
|
||||
if (orderEntity != null) {
|
||||
IOOrderStatusEntity temp = ioOrderStatusService.findByOrderId(orderEntity.getId());
|
||||
if (temp == null) {//避免重复操作插入
|
||||
if (Integer.parseInt(downstream.getParamValue()) == 1) {
|
||||
IOOrderStatusEntity orderStatusEntity = new IOOrderStatusEntity();
|
||||
orderStatusEntity.setOrderId(orderEntity.getId());
|
||||
orderStatusEntity.setUpdateTime(new Date());
|
||||
orderStatusEntity.setStatus(1);
|
||||
ioOrderStatusService.insertOrderStatus(orderStatusEntity);
|
||||
List<WarehouseEntity> codes = dlOrderResponse.getCodes();
|
||||
orderService.insertOrder(orderEntity);
|
||||
codesService.insertWarehouses(codes);
|
||||
} else {
|
||||
|
||||
String fileName = path + FileConstant.upWaitCopy_order + "Order" + orderEntity.getId() + DateUtil.formatDate(new Date(), "yyyyMMddHHmmss") + ".LowerIn";
|
||||
String backFileName = path + FileConstant.upWaitCopy_order_back + "Order" + orderEntity.getId() + DateUtil.formatDate(new Date(), "yyyyMMddHHmmss") + ".LowerIn";
|
||||
List<PostOrderRequest.PostOrder> postOrders = new ArrayList<>();
|
||||
PostOrderRequest postOrderRequest = new PostOrderRequest();
|
||||
List<WarehouseEntity> warehouseEntityList = dlOrderResponse.getCodes();
|
||||
PostOrderRequest.PostOrder postOrder = new PostOrderRequest.PostOrder();
|
||||
postOrder.setCodes(warehouseEntityList);
|
||||
postOrder.setBillType(orderEntity.getAction());
|
||||
postOrders.add(postOrder);
|
||||
postOrderRequest.setPostOrders(postOrders);
|
||||
String json = JSONObject.toJSON(postOrderRequest).toString();
|
||||
// FileUtils.makeDirectory(path);
|
||||
// FileUtils.makeDirectory(path + "/备份/");
|
||||
FileUtils.SaveFileAs(json, fileName);
|
||||
FileUtils.SaveFileAs(json, backFileName);
|
||||
ThrImportLogEntity thrImportLogEntity = new ThrImportLogEntity();
|
||||
thrImportLogEntity.setGenKey(CustomUtil.getUUId());
|
||||
thrImportLogEntity.setImportType(1);
|
||||
thrImportLogEntity.setUpdateTime(new Date());
|
||||
thrImportLogEntity.setFilePath(fileName);
|
||||
thrImportLogEntity.setBackFilePath(backFileName);
|
||||
thrImportLogEntity.setOrderId(orderEntity.getId());
|
||||
thrImportLogService.insertImportLog(thrImportLogEntity);
|
||||
}
|
||||
|
||||
spGetHttp.postOrder(orderEntity.getId());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,132 +0,0 @@
|
||||
package com.glxp.sale.admin.thread;
|
||||
|
||||
import com.glxp.sale.admin.entity.param.SystemParamConfigEntity;
|
||||
import com.glxp.sale.admin.service.param.SystemParamConfigService;
|
||||
import com.glxp.sale.admin.util.RedisUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@Service
|
||||
public class DlUploadService {
|
||||
@Resource
|
||||
RedisUtil redisUtil;
|
||||
@Resource
|
||||
SystemParamConfigService systemParamConfigService;
|
||||
@Resource
|
||||
DlSpOrderService dlSpOrderService;
|
||||
@Resource
|
||||
DlBasicService dlBasicService;
|
||||
|
||||
final Logger logger = LoggerFactory.getLogger(DlUploadService.class);
|
||||
|
||||
//定时从上游下载数据----下载单据
|
||||
public void dlOrder() {
|
||||
SystemParamConfigEntity systemParamConfigEntity = systemParamConfigService.selectByParamKey("dl_order_status");
|
||||
long timeInterval = Long.parseLong(systemParamConfigEntity.getParamValue()) * 60 * 1000;
|
||||
long curTime = System.currentTimeMillis();
|
||||
//任务一,定时下载供应商平台已完成单据
|
||||
Long lastTime = (Long) redisUtil.get("DL_ORDER_STATUS");
|
||||
if (lastTime == null) {
|
||||
lastTime = System.currentTimeMillis();
|
||||
redisUtil.set("DL_ORDER_STATUS", lastTime);
|
||||
}
|
||||
if (curTime - lastTime > timeInterval) {
|
||||
logger.info("每分钟执行一次单据下载");
|
||||
redisUtil.set("DL_ORDER_STATUS", curTime);
|
||||
dlSpOrderService.dlOrdedrs();
|
||||
}
|
||||
}
|
||||
|
||||
//定时从上游下载数据----下载基础信息
|
||||
public void dlBasicUdiInfo() {
|
||||
SystemParamConfigEntity systemParamConfigEntity = systemParamConfigService.selectByParamKey("dl_basic_udiinfo_status");
|
||||
long timeInterval = Long.parseLong(systemParamConfigEntity.getParamValue()) * 60 * 1000;
|
||||
long curTime = System.currentTimeMillis();
|
||||
Long lastTime = (Long) redisUtil.get("DL_BASIC_UDIINFO_STATUS");
|
||||
if (lastTime == null) {
|
||||
lastTime = System.currentTimeMillis();
|
||||
redisUtil.set("DL_BASIC_UDIINFO_STATUS", lastTime);
|
||||
} else if (curTime - lastTime > timeInterval) {
|
||||
logger.info("每分钟执行一次基础信息下载");
|
||||
redisUtil.set("DL_BASIC_UDIINFO_STATUS", curTime);
|
||||
dlBasicService.dlBasicUdiInfo();
|
||||
dlBasicService.dlBasicCorp();
|
||||
dlBasicService.dlBasicInv();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//定时扫描本地共享文件夹---上传到上游
|
||||
public void scanFolderUpload() {
|
||||
SystemParamConfigEntity upConnect = systemParamConfigService.selectByParamKey("sync_upstream_enable");
|
||||
if (upConnect.getParamValue().equals("1")) {
|
||||
SystemParamConfigEntity systemParamConfigEntity = systemParamConfigService.selectByParamKey("dl_basic_udiinfo_status");
|
||||
long timeInterval = Long.parseLong(systemParamConfigEntity.getParamValue()) * 60 * 1000;
|
||||
long curTime = System.currentTimeMillis();
|
||||
Long lastTime = (Long) redisUtil.get("DL_BASIC_UDIINFO_STATUS");
|
||||
if (lastTime == null) {
|
||||
redisUtil.set("DL_BASIC_UDIINFO_STATUS", System.currentTimeMillis());
|
||||
} else if (curTime - lastTime > timeInterval) {
|
||||
logger.info("每分钟执行一次基础信息下载");
|
||||
redisUtil.set("DL_BASIC_UDIINFO_STATUS", curTime);
|
||||
dlBasicService.dlBasicUdiInfo();
|
||||
dlBasicService.dlBasicCorp();
|
||||
dlBasicService.dlBasicInv();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//定时扫描本地共享文件夹---上传到上游
|
||||
public void scanFolderDown() {
|
||||
SystemParamConfigEntity upConnect = systemParamConfigService.selectByParamKey("sync_upstream_enable");
|
||||
if (upConnect.getParamValue().equals("1")) {
|
||||
SystemParamConfigEntity systemParamConfigEntity = systemParamConfigService.selectByParamKey("dl_basic_udiinfo_status");
|
||||
long timeInterval = Long.parseLong(systemParamConfigEntity.getParamValue()) * 60 * 1000;
|
||||
long curTime = System.currentTimeMillis();
|
||||
Long lastTime = (Long) redisUtil.get("DL_BASIC_UDIINFO_STATUS");
|
||||
if (lastTime == null) {
|
||||
redisUtil.set("DL_BASIC_UDIINFO_STATUS", System.currentTimeMillis());
|
||||
} else if (curTime - lastTime > timeInterval) {
|
||||
logger.info("每分钟执行一次基础信息下载");
|
||||
redisUtil.set("DL_BASIC_UDIINFO_STATUS", curTime);
|
||||
dlBasicService.dlBasicUdiInfo();
|
||||
dlBasicService.dlBasicCorp();
|
||||
dlBasicService.dlBasicInv();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void dlBasicCorp() {
|
||||
SystemParamConfigEntity systemParamConfigEntity = systemParamConfigService.selectByParamKey("dl_basic_corp_status");
|
||||
long timeInterval = Long.parseLong(systemParamConfigEntity.getParamValue()) * 60 * 1000;
|
||||
long curTime = System.currentTimeMillis();
|
||||
//任务一,定时下载供应商平台已完成单据
|
||||
Long lastTime = (Long) redisUtil.get("DL_BASIC_CORP_STATUS");
|
||||
if (lastTime == null) {
|
||||
redisUtil.set("DL_BASIC_CORP_STATUS", System.currentTimeMillis());
|
||||
} else if (curTime - lastTime > timeInterval) {
|
||||
logger.info("每分钟执行一次单据下载");
|
||||
redisUtil.set("DL_BASIC_CORP_STATUS", curTime);
|
||||
dlBasicService.dlBasicCorp();
|
||||
}
|
||||
}
|
||||
|
||||
public void dlBasicInv() {
|
||||
SystemParamConfigEntity systemParamConfigEntity = systemParamConfigService.selectByParamKey("dl_basic_inv_status");
|
||||
long timeInterval = Long.parseLong(systemParamConfigEntity.getParamValue()) * 60 * 1000;
|
||||
long curTime = System.currentTimeMillis();
|
||||
//任务一,定时下载供应商平台已完成单据
|
||||
Long lastTime = (Long) redisUtil.get("DL_BASIC_INV_STATUS");
|
||||
if (lastTime == null) {
|
||||
redisUtil.set("DL_BASIC_INV_STATUS", System.currentTimeMillis());
|
||||
} else if (curTime - lastTime > timeInterval) {
|
||||
logger.info("每分钟执行一次单据下载");
|
||||
redisUtil.set("DL_BASIC_INV_STATUS", curTime);
|
||||
dlBasicService.dlBasicInv();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue