parent
49dc552120
commit
2afe0d9c23
@ -0,0 +1,212 @@
|
||||
package com.glxp.sale.admin.controller.basic;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.db.sql.Order;
|
||||
import com.glxp.sale.admin.constant.ConstantStatus;
|
||||
import com.glxp.sale.admin.dao.basic.UdiInfoDao;
|
||||
import com.glxp.sale.admin.entity.basic.*;
|
||||
import com.glxp.sale.admin.entity.info.CompanyProductRelevanceEntity;
|
||||
import com.glxp.sale.admin.entity.inout.ErpOrderEntity;
|
||||
import com.glxp.sale.admin.entity.inout.OrderEntity;
|
||||
import com.glxp.sale.admin.entity.inout.WarehouseEntity;
|
||||
import com.glxp.sale.admin.entity.inventory.InvWarehouseEntity;
|
||||
import com.glxp.sale.admin.entity.thrsys.*;
|
||||
import com.glxp.sale.admin.req.basic.*;
|
||||
import com.glxp.sale.admin.req.info.FilterCompanyProductRelevanceRequest;
|
||||
import com.glxp.sale.admin.req.inout.OrderFilterRequest;
|
||||
import com.glxp.sale.admin.req.inventory.FilterInvWarehouseRequest;
|
||||
import com.glxp.sale.admin.req.receipt.ProductInfoFilterRequest;
|
||||
import com.glxp.sale.admin.req.thrsys.*;
|
||||
import com.glxp.sale.admin.res.basic.SpsSyncBusResponse;
|
||||
import com.glxp.sale.admin.res.basic.SpsSyncDataResponse;
|
||||
import com.glxp.sale.admin.res.basic.SpsSyncOrderResponse;
|
||||
import com.glxp.sale.admin.res.inout.DlOrderResponse;
|
||||
import com.glxp.sale.admin.res.inout.ErpOrderResponse;
|
||||
import com.glxp.sale.admin.service.basic.*;
|
||||
import com.glxp.sale.admin.service.info.CompanyProductRelevanceService;
|
||||
import com.glxp.sale.admin.service.inout.CodesService;
|
||||
import com.glxp.sale.admin.service.inout.OrderDetailService;
|
||||
import com.glxp.sale.admin.service.inout.OrderService;
|
||||
import com.glxp.sale.admin.service.inventory.InvWarehouseService;
|
||||
import com.glxp.sale.admin.service.thrsys.*;
|
||||
import com.glxp.sale.admin.util.BeanUtils;
|
||||
import com.glxp.sale.common.res.BaseResponse;
|
||||
import com.glxp.sale.common.util.ResultVOUtils;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
public class SpsSyncDownloadController {
|
||||
|
||||
|
||||
//基础信息
|
||||
@Resource
|
||||
InvWarehouseService invWarehouseService;
|
||||
@Resource
|
||||
UdiRelevanceService udiRelevanceService;
|
||||
@Resource
|
||||
UdiInfoDao udiInfoDao;
|
||||
@Resource
|
||||
BasicUnitMaintainService basicUnitMaintainService;
|
||||
@Resource
|
||||
ThrInvWarehouseService thrInvWarehouseService;
|
||||
@Resource
|
||||
ThrCorpService thrCorpService;
|
||||
@Resource
|
||||
ThrProductsService thrProductsService;
|
||||
@Resource
|
||||
ThrOrderService thrOrderService;
|
||||
@Resource
|
||||
ThrOrderDetailService thrOrderDetailService;
|
||||
@Resource
|
||||
private CompanyProductRelevanceService companyProductRelevanceService;
|
||||
|
||||
@GetMapping("sps/sync/basic")
|
||||
public BaseResponse findProductInfo(SpsSyncDataRequest spsSyncDataRequest) {
|
||||
|
||||
//仓库字典
|
||||
FilterInvWarehouseRequest filterInvWarehouseRequest = new FilterInvWarehouseRequest();
|
||||
filterInvWarehouseRequest.setLastUpdateTime(spsSyncDataRequest.getLastUpdateTime());
|
||||
List<InvWarehouseEntity> invWarehouseEntities = invWarehouseService.filterGroupInvWarehouse(filterInvWarehouseRequest);
|
||||
|
||||
//耗材字典
|
||||
FilterUdiInfoRequest filterUdiInfoRequest = new FilterUdiInfoRequest();
|
||||
filterUdiInfoRequest.setLastUpdateTime(spsSyncDataRequest.getLastUpdateTime());
|
||||
List<UdiRelevanceEntity> udiRelevanceEntities = udiRelevanceService.filterUdiEntity(filterUdiInfoRequest);
|
||||
List<String> results = new ArrayList<>();
|
||||
udiRelevanceEntities.forEach(
|
||||
item -> {
|
||||
results.add(item.getUuid() + "");
|
||||
}
|
||||
);
|
||||
List<UdiInfoEntity> udiInfoEntities = new ArrayList<>();
|
||||
if (results.size() > 0)
|
||||
udiInfoEntities = udiInfoDao.batchSelectByUuid(results);
|
||||
|
||||
|
||||
//往来单位字典
|
||||
BasicUnitMaintainFilterRequest basicUnitMaintainFilterRequest = new BasicUnitMaintainFilterRequest();
|
||||
basicUnitMaintainFilterRequest.setLastUpdateTime(spsSyncDataRequest.getLastUpdateTime());
|
||||
List<BasicUnitMaintainEntity> basicUnitMaintainEntities = basicUnitMaintainService.filterList(basicUnitMaintainFilterRequest);
|
||||
|
||||
|
||||
//第三方仓库信息
|
||||
FilterThrInvWarehouseRequest filterThrInvWarehouseRequest = new FilterThrInvWarehouseRequest();
|
||||
filterThrInvWarehouseRequest.setLastUpdateTime(spsSyncDataRequest.getLastUpdateTime());
|
||||
List<ThrInvWarehouseEntity> thrInvWarehouseEntities = thrInvWarehouseService.filterThrInvWarehouse(filterThrInvWarehouseRequest);
|
||||
|
||||
|
||||
//第三方往来单位
|
||||
FilterThrCorpRequest filterThrCorpRequest = new FilterThrCorpRequest();
|
||||
BeanUtils.copyProperties(spsSyncDataRequest, filterThrCorpRequest);
|
||||
List<ThrCorpEntity> thrCorpEntities = thrCorpService.filterThrCorps(filterThrCorpRequest);
|
||||
|
||||
//第三方产品信息
|
||||
FilterThrProductsRequest filterThrProductsRequest = new FilterThrProductsRequest();
|
||||
BeanUtils.copyProperties(spsSyncDataRequest, filterThrProductsRequest);
|
||||
List<ThrProductsEntity> thrProductsEntities = thrProductsService.filterThrProductsRequest(filterThrProductsRequest);
|
||||
|
||||
//第三方业务单据
|
||||
FilterThrOrderRequest filterThrOrderRequest = new FilterThrOrderRequest();
|
||||
BeanUtils.copyProperties(spsSyncDataRequest, filterThrOrderRequest);
|
||||
List<ThrOrderDetailEntity> allOrderDetailEntities = new ArrayList<>();
|
||||
List<ThrOrderEntity> thrOrderEntities = thrOrderService.filterThrOrder(filterThrOrderRequest);
|
||||
for (ThrOrderEntity thrOrderEntity : thrOrderEntities) {
|
||||
FilterThrOrderDetailRequest filterThrOrderDetailRequest = new FilterThrOrderDetailRequest();
|
||||
filterThrOrderDetailRequest.setOrderIdFk(thrOrderEntity.getId() + "");
|
||||
List<ThrOrderDetailEntity> thrOrderDetailEntities = thrOrderDetailService.filterThrOrderDetailDetail(filterThrOrderDetailRequest);
|
||||
if (!thrOrderDetailEntities.isEmpty()) {
|
||||
allOrderDetailEntities.addAll(thrOrderDetailEntities);
|
||||
}
|
||||
}
|
||||
|
||||
//供应商产品信息关联表
|
||||
FilterCompanyProductRelevanceRequest filterCompanyProductRelevanceRequest = new FilterCompanyProductRelevanceRequest();
|
||||
BeanUtils.copyProperties(spsSyncDataRequest, filterCompanyProductRelevanceRequest);
|
||||
List<CompanyProductRelevanceEntity> companyProductRelevanceEntities = companyProductRelevanceService.filterCompanyProductRelevance(filterCompanyProductRelevanceRequest);
|
||||
|
||||
SpsSyncDataResponse syncDataResponse = new SpsSyncDataResponse();
|
||||
syncDataResponse.setCompanyProductRelevanceEntities(companyProductRelevanceEntities);
|
||||
syncDataResponse.setInvWarehouseEntities(invWarehouseEntities);
|
||||
syncDataResponse.setBasicUnitMaintainEntities(basicUnitMaintainEntities);
|
||||
syncDataResponse.setThrCorpEntities(thrCorpEntities);
|
||||
syncDataResponse.setThrInvWarehouseEntities(thrInvWarehouseEntities);
|
||||
syncDataResponse.setThrOrderDetailEntities(allOrderDetailEntities);
|
||||
syncDataResponse.setThrOrderEntities(thrOrderEntities);
|
||||
syncDataResponse.setUdiInfoEntities(udiInfoEntities);
|
||||
syncDataResponse.setThrProductsEntities(thrProductsEntities);
|
||||
syncDataResponse.setUdiRelevanceEntities(udiRelevanceEntities);
|
||||
return ResultVOUtils.success(syncDataResponse);
|
||||
}
|
||||
|
||||
//单据类型
|
||||
@Resource
|
||||
BussinessTypeService bussinessTypeService;
|
||||
@Resource
|
||||
BussinessLocalTypeService bussinessLocalTypeService;
|
||||
@Resource
|
||||
BussinessOriginTypeService bussinessOriginTypeService;
|
||||
|
||||
|
||||
@GetMapping("sps/sync/busType")
|
||||
public BaseResponse findBusType(SpsSyncDataRequest spsSyncDataRequest) {
|
||||
BussinessTypeFilterRequest bussinessTypeFilterRequest = new BussinessTypeFilterRequest();
|
||||
BeanUtils.copyProperties(spsSyncDataRequest,bussinessTypeFilterRequest);
|
||||
List<BussinessTypeEntity> bussinessTypeEntities = bussinessTypeService.filterAllList(bussinessTypeFilterRequest);
|
||||
BussinessLocalTypeFilterRequest bussinessLocalTypeFilterRequest = new BussinessLocalTypeFilterRequest();
|
||||
BeanUtils.copyProperties(spsSyncDataRequest,bussinessLocalTypeFilterRequest);
|
||||
List<BussinessLocalTypeEntity> bussinessLocalTypeEntities = bussinessLocalTypeService.filterAllList(bussinessLocalTypeFilterRequest);
|
||||
BussinessOriginTypeFilterRequest bussinessOriginTypeFilterRequest = new BussinessOriginTypeFilterRequest();
|
||||
BeanUtils.copyProperties(spsSyncDataRequest,bussinessOriginTypeFilterRequest);
|
||||
List<BussinessOriginTypeEntity> bussinessOriginTypeEntities = bussinessOriginTypeService.filterList(bussinessOriginTypeFilterRequest);
|
||||
SpsSyncBusResponse spsSyncBusResponse = new SpsSyncBusResponse();
|
||||
spsSyncBusResponse.setBussinessTypeEntities(bussinessTypeEntities);
|
||||
spsSyncBusResponse.setBussinessLocalTypeEntities(bussinessLocalTypeEntities);
|
||||
spsSyncBusResponse.setBussinessOriginTypeEntities(bussinessOriginTypeEntities);
|
||||
return ResultVOUtils.success(spsSyncBusResponse);
|
||||
}
|
||||
|
||||
|
||||
//已完成扫码单据
|
||||
@Resource
|
||||
OrderService orderService;
|
||||
@Resource
|
||||
CodesService codesService;
|
||||
@Resource
|
||||
OrderDetailService orderDetailService;
|
||||
|
||||
|
||||
@GetMapping("sps/sync/order")
|
||||
public BaseResponse findOrder(SpsSyncDataRequest spsSyncDataRequest) {
|
||||
OrderFilterRequest orderFilterRequest = new OrderFilterRequest();
|
||||
BeanUtils.copyProperties(spsSyncDataRequest, orderFilterRequest);
|
||||
orderFilterRequest.setStatus(ConstantStatus.ORDER_STATUS_SUCCESS);
|
||||
// orderFilterRequest.setReceiveStatus(ConstantStatus.RECEIVE_ED);
|
||||
List<OrderEntity> orderEntities = orderService.findAllByTime(orderFilterRequest);
|
||||
List<ErpOrderEntity> allOrderDetailEntityList = new ArrayList<>();
|
||||
List<WarehouseEntity> warehouseEntityList = new ArrayList<>();
|
||||
if (CollUtil.isNotEmpty(orderEntities)) {
|
||||
for (OrderEntity orderEntity : orderEntities) {
|
||||
List<ErpOrderEntity> orderDetailEntityList = orderDetailService.filterAllByOrderIdFk(orderEntity.getId());
|
||||
if (CollUtil.isNotEmpty(orderDetailEntityList)) {
|
||||
allOrderDetailEntityList.addAll(orderDetailEntityList);
|
||||
}
|
||||
List<WarehouseEntity> codes = codesService.findByReceiptId(orderEntity.getId());
|
||||
if (CollUtil.isNotEmpty(codes)) {
|
||||
warehouseEntityList.addAll(codes);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SpsSyncOrderResponse syncOrderResponse = new SpsSyncOrderResponse();
|
||||
syncOrderResponse.setOrderEntities(orderEntities);
|
||||
syncOrderResponse.setOrderDetailEntityList(allOrderDetailEntityList);
|
||||
syncOrderResponse.setWarehouseEntityList(warehouseEntityList);
|
||||
return ResultVOUtils.success(syncOrderResponse);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,91 @@
|
||||
package com.glxp.sale.admin.controller.basic;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson.TypeReference;
|
||||
import com.glxp.sale.admin.constant.BasicProcessStatus;
|
||||
import com.glxp.sale.admin.entity.basic.BasicExportStatusEntity;
|
||||
import com.glxp.sale.admin.entity.basic.BasicExportStatusTimeEntity;
|
||||
import com.glxp.sale.admin.req.basic.BasicExportStatusRequest;
|
||||
import com.glxp.sale.admin.req.basic.BasicExportTimeRequest;
|
||||
import com.glxp.sale.admin.req.info.DeleteRequest;
|
||||
import com.glxp.sale.admin.res.basic.BasicUnitMaintainExportResponse;
|
||||
import com.glxp.sale.admin.res.basic.SpsSyncDataResponse;
|
||||
import com.glxp.sale.admin.res.basic.UdiRelevanceExportJsonResponse;
|
||||
import com.glxp.sale.admin.res.inventory.InvWarehouseExportResponse;
|
||||
import com.glxp.sale.admin.service.basic.BasicExportService;
|
||||
import com.glxp.sale.admin.service.basic.BasicExportTimeService;
|
||||
import com.glxp.sale.admin.util.RedisUtil;
|
||||
import com.glxp.sale.common.res.BaseResponse;
|
||||
import com.glxp.sale.common.util.ResultVOUtils;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
public class SpsSyncExportStatusController {
|
||||
|
||||
|
||||
@Resource
|
||||
BasicExportService basicExportService;
|
||||
@Resource
|
||||
BasicExportTimeService basicExportTimeService;
|
||||
@Resource
|
||||
RedisUtil redisUtil;
|
||||
|
||||
|
||||
@GetMapping("/spssync/basic/udiinfo/getStatus")
|
||||
public BaseResponse getStatus(BasicExportStatusRequest basicExportStatusRequest) {
|
||||
List<BasicExportStatusEntity> basicExportStatusEntities = basicExportService.filterExportStatus(basicExportStatusRequest);
|
||||
return ResultVOUtils.success(basicExportStatusEntities);
|
||||
}
|
||||
|
||||
@PostMapping("/spssync/basic/udiinfo/deleteByStatus")
|
||||
public BaseResponse deleteByStatus(@RequestBody DeleteRequest deleteRequest) {
|
||||
|
||||
boolean b = basicExportService.deleteById(deleteRequest.getId());
|
||||
redisUtil.del(deleteRequest.getId());
|
||||
if (b)
|
||||
return ResultVOUtils.success("删除成功!");
|
||||
else
|
||||
return ResultVOUtils.error(500, "删除失败!");
|
||||
}
|
||||
|
||||
@PostMapping("/spssync/basic/udiinfo/updateStatus")
|
||||
public BaseResponse updateStatus(@RequestBody BasicExportStatusEntity basicExportStatusEntity) {
|
||||
|
||||
basicExportStatusEntity.setEndTime(new Date());
|
||||
basicExportStatusEntity.setUpdateTime(new Date());
|
||||
boolean b = basicExportService.updateExportStatus(basicExportStatusEntity);
|
||||
if (b)
|
||||
return ResultVOUtils.success("更新成功!");
|
||||
else
|
||||
return ResultVOUtils.error(500, "更新成功!");
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/spssync/basic/schedule/lastTime")
|
||||
public BaseResponse getLastUpdateTime(BasicExportTimeRequest basicExportTimeRequest) {
|
||||
List<BasicExportStatusTimeEntity> basicExportStatusEntities = basicExportTimeService.filterExportStatus(basicExportTimeRequest);
|
||||
if (CollUtil.isNotEmpty(basicExportStatusEntities)) {
|
||||
return ResultVOUtils.success(basicExportStatusEntities.get(0).getLastUpdateTime());
|
||||
} else {
|
||||
return ResultVOUtils.success("1949-01-01 00:00:00");
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/spssync/basic/schedule/updateLastTime")
|
||||
public BaseResponse updateLastTime(@RequestBody BasicExportStatusTimeEntity basicExportStatusTimeEntity) {
|
||||
|
||||
boolean b = basicExportTimeService.insertExportStatus(basicExportStatusTimeEntity);
|
||||
if (b)
|
||||
return ResultVOUtils.success("更新成功!");
|
||||
else
|
||||
return ResultVOUtils.error(500, "更新失败!");
|
||||
}
|
||||
}
|
@ -0,0 +1,290 @@
|
||||
package com.glxp.sale.admin.controller.basic;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson.TypeReference;
|
||||
import com.glxp.sale.admin.constant.BasicProcessStatus;
|
||||
import com.glxp.sale.admin.dao.basic.*;
|
||||
import com.glxp.sale.admin.dao.info.CompanyProductRelevanceDao;
|
||||
import com.glxp.sale.admin.dao.inout.CodesDao;
|
||||
import com.glxp.sale.admin.dao.inout.OrderDao;
|
||||
import com.glxp.sale.admin.dao.inout.OrderDetailDao;
|
||||
import com.glxp.sale.admin.dao.thrsys.ThrCorpDao;
|
||||
import com.glxp.sale.admin.dao.thrsys.ThrOrderDao;
|
||||
import com.glxp.sale.admin.dao.thrsys.ThrOrderDetailDao;
|
||||
import com.glxp.sale.admin.dao.thrsys.ThrProductsDao;
|
||||
import com.glxp.sale.admin.entity.basic.*;
|
||||
import com.glxp.sale.admin.entity.info.CompanyProductRelevanceEntity;
|
||||
import com.glxp.sale.admin.entity.inout.ErpOrderEntity;
|
||||
import com.glxp.sale.admin.entity.inout.OrderEntity;
|
||||
import com.glxp.sale.admin.entity.inout.WarehouseEntity;
|
||||
import com.glxp.sale.admin.entity.thrsys.ThrCorpEntity;
|
||||
import com.glxp.sale.admin.entity.thrsys.ThrOrderDetailEntity;
|
||||
import com.glxp.sale.admin.entity.thrsys.ThrOrderEntity;
|
||||
import com.glxp.sale.admin.entity.thrsys.ThrProductsEntity;
|
||||
import com.glxp.sale.admin.req.basic.SpsSyncDataRequest;
|
||||
import com.glxp.sale.admin.res.basic.SpsSyncBusResponse;
|
||||
import com.glxp.sale.admin.res.basic.SpsSyncDataResponse;
|
||||
import com.glxp.sale.admin.res.basic.SpsSyncOrderResponse;
|
||||
import com.glxp.sale.admin.service.basic.BasicUnitMaintainService;
|
||||
import com.glxp.sale.admin.service.basic.UdiRelevanceService;
|
||||
import com.glxp.sale.admin.service.info.CompanyProductRelevanceService;
|
||||
import com.glxp.sale.admin.service.inout.OrderService;
|
||||
import com.glxp.sale.admin.service.inventory.InvWarehouseService;
|
||||
import com.glxp.sale.admin.service.thrsys.*;
|
||||
import com.glxp.sale.common.res.BaseResponse;
|
||||
import com.glxp.sale.common.util.ResultVOUtils;
|
||||
import org.apache.ibatis.session.ExecutorType;
|
||||
import org.apache.ibatis.session.SqlSession;
|
||||
import org.apache.ibatis.session.SqlSessionFactory;
|
||||
import org.apache.ibatis.session.TransactionIsolationLevel;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
public class SpsSyncUploadController {
|
||||
|
||||
@Resource
|
||||
SqlSessionFactory sqlSessionFactory;
|
||||
|
||||
@Resource
|
||||
InvWarehouseService invWarehouseService;
|
||||
@Resource
|
||||
OrderService orderService;
|
||||
|
||||
@PostMapping("sps/sync/basic/upload")
|
||||
public BaseResponse findProductInfo(@RequestBody SpsSyncDataResponse syncDataResponse) {
|
||||
if (syncDataResponse != null) {
|
||||
dlAllData(syncDataResponse);
|
||||
}
|
||||
return ResultVOUtils.success("上传成功!");
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("sps/sync/busType/upload")
|
||||
public BaseResponse findBusType(@RequestBody SpsSyncBusResponse syncDataResponse) {
|
||||
if (syncDataResponse != null) {
|
||||
dlAllBus(syncDataResponse);
|
||||
}
|
||||
return ResultVOUtils.success("上传成功!");
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("sps/sync/order/upload")
|
||||
public BaseResponse findOrder(@RequestBody SpsSyncOrderResponse syncDataResponse) {
|
||||
if (syncDataResponse != null) {
|
||||
dlAllOrder(syncDataResponse);
|
||||
}
|
||||
return ResultVOUtils.success("上传成功!");
|
||||
}
|
||||
|
||||
@PostMapping("sps/sync/schedule/upload")
|
||||
public BaseResponse dealSchedule(@RequestBody BasicExportStatusEntity basicExportStatusEntity) {
|
||||
//todo
|
||||
//处理下游上传过来的任务
|
||||
return ResultVOUtils.success("上传成功!");
|
||||
}
|
||||
|
||||
|
||||
public void dlAllData(SpsSyncDataResponse syncDataResponse) {
|
||||
SqlSession batchSession = sqlSessionFactory.openSession(ExecutorType.BATCH, TransactionIsolationLevel.READ_COMMITTED);
|
||||
//仓库字典导入
|
||||
if (CollUtil.isNotEmpty(syncDataResponse.getInvWarehouseEntities())) {
|
||||
invWarehouseService.importInvWarehouse(syncDataResponse.getInvWarehouseEntities());
|
||||
}
|
||||
|
||||
//关联表导入
|
||||
if (CollUtil.isNotEmpty(syncDataResponse.getUdiRelevanceEntities())) {
|
||||
try {
|
||||
List<UdiRelevanceEntity> corpList = syncDataResponse.getUdiRelevanceEntities();
|
||||
UdiRelevanceDao mapper = batchSession.getMapper(UdiRelevanceDao.class);
|
||||
for (UdiRelevanceEntity basicUnitMaintainEntity : corpList) {
|
||||
mapper.insertUdiRelevance(basicUnitMaintainEntity);
|
||||
}
|
||||
batchSession.commit();
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
//耗材字典导入
|
||||
if (CollUtil.isNotEmpty(syncDataResponse.getUdiInfoEntities())) {
|
||||
if (CollUtil.isNotEmpty(syncDataResponse.getUdiInfoEntities())) {
|
||||
try {
|
||||
List<UdiInfoEntity> corpList = syncDataResponse.getUdiInfoEntities();
|
||||
UdiInfoDao mapper = batchSession.getMapper(UdiInfoDao.class);
|
||||
for (UdiInfoEntity basicUnitMaintainEntity : corpList) {
|
||||
mapper.insertUdiInfo(basicUnitMaintainEntity);
|
||||
}
|
||||
batchSession.commit();
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//往来单位信息导入
|
||||
if (CollUtil.isNotEmpty(syncDataResponse.getBasicUnitMaintainEntities())) {
|
||||
try {
|
||||
List<BasicUnitMaintainEntity> corpList = syncDataResponse.getBasicUnitMaintainEntities();
|
||||
BasicUnitMaintainDao mapper = batchSession.getMapper(BasicUnitMaintainDao.class);
|
||||
for (BasicUnitMaintainEntity basicUnitMaintainEntity : corpList) {
|
||||
mapper.importBasicUnitMaintain(basicUnitMaintainEntity);
|
||||
}
|
||||
batchSession.commit();
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
|
||||
//供应商关联表导入
|
||||
if (CollUtil.isNotEmpty(syncDataResponse.getCompanyProductRelevanceEntities())) {
|
||||
try {
|
||||
List<CompanyProductRelevanceEntity> companyProductRelevanceEntities = syncDataResponse.getCompanyProductRelevanceEntities();
|
||||
CompanyProductRelevanceDao mapper = batchSession.getMapper(CompanyProductRelevanceDao.class);
|
||||
for (CompanyProductRelevanceEntity companyProductRelevanceEntity : companyProductRelevanceEntities) {
|
||||
mapper.importCompanyProductRelevance(companyProductRelevanceEntity);
|
||||
}
|
||||
batchSession.commit();
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//第三方产品信息导入
|
||||
if (CollUtil.isNotEmpty(syncDataResponse.getThrProductsEntities())) {
|
||||
|
||||
try {
|
||||
List<ThrProductsEntity> thrProductsEntities = syncDataResponse.getThrProductsEntities();
|
||||
ThrProductsDao mapper = batchSession.getMapper(ThrProductsDao.class);
|
||||
for (ThrProductsEntity thrProductsEntity : thrProductsEntities) {
|
||||
mapper.insertThrProducts(thrProductsEntity);
|
||||
}
|
||||
batchSession.commit();
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//第三方往来单位信息导入
|
||||
if (CollUtil.isNotEmpty(syncDataResponse.getThrCorpEntities())) {
|
||||
try {
|
||||
List<ThrCorpEntity> thrCorpEntities = syncDataResponse.getThrCorpEntities();
|
||||
ThrCorpDao mapper = batchSession.getMapper(ThrCorpDao.class);
|
||||
thrCorpEntities.forEach(thrCorpEntity -> {
|
||||
mapper.importThrCorp(thrCorpEntity);
|
||||
});
|
||||
batchSession.commit();
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
|
||||
//第三方业务单据导入
|
||||
if (CollUtil.isNotEmpty(syncDataResponse.getThrOrderEntities())) {
|
||||
try {
|
||||
List<ThrOrderEntity> thrOrderEntities = syncDataResponse.getThrOrderEntities();
|
||||
ThrOrderDao mapper = batchSession.getMapper(ThrOrderDao.class);
|
||||
thrOrderEntities.forEach(thrCorpEntity -> {
|
||||
mapper.importThrOrder(thrCorpEntity);
|
||||
});
|
||||
batchSession.commit();
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
|
||||
//第三方业务单据详情
|
||||
if (CollUtil.isNotEmpty(syncDataResponse.getThrOrderDetailEntities())) {
|
||||
try {
|
||||
List<ThrOrderDetailEntity> thrOrderDetailEntities = syncDataResponse.getThrOrderDetailEntities();
|
||||
ThrOrderDetailDao mapper = batchSession.getMapper(ThrOrderDetailDao.class);
|
||||
thrOrderDetailEntities.forEach(thrOrderDetailEntity -> {
|
||||
mapper.importThrOrderDetail(thrOrderDetailEntity);
|
||||
});
|
||||
batchSession.commit();
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void dlAllBus(SpsSyncBusResponse syncDataResponse) {
|
||||
SqlSession batchSession = sqlSessionFactory.openSession(ExecutorType.BATCH, TransactionIsolationLevel.READ_COMMITTED);
|
||||
|
||||
if (CollUtil.isNotEmpty(syncDataResponse.getBussinessTypeEntities())) {
|
||||
try {
|
||||
List<BussinessTypeEntity> bussinessTypeEntities = syncDataResponse.getBussinessTypeEntities();
|
||||
BussinessTypeDao mapper = batchSession.getMapper(BussinessTypeDao.class);
|
||||
for (BussinessTypeEntity bussinessTypeEntity : bussinessTypeEntities) {
|
||||
mapper.insertBussinessType(bussinessTypeEntity);
|
||||
}
|
||||
batchSession.commit();
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
//业务单据
|
||||
if (CollUtil.isNotEmpty(syncDataResponse.getBussinessLocalTypeEntities())) {
|
||||
try {
|
||||
List<BussinessLocalTypeEntity> bussinessLocalTypeEntities = syncDataResponse.getBussinessLocalTypeEntities();
|
||||
BussinessLocalTypeDao mapper = batchSession.getMapper(BussinessLocalTypeDao.class);
|
||||
for (BussinessLocalTypeEntity bussinessTypeEntity : bussinessLocalTypeEntities) {
|
||||
mapper.insertBussinessType(bussinessTypeEntity);
|
||||
}
|
||||
batchSession.commit();
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
//原始单据
|
||||
if (CollUtil.isNotEmpty(syncDataResponse.getBussinessOriginTypeEntities())) {
|
||||
try {
|
||||
List<BussinessOriginTypeEntity> bussinessTypeEntities = syncDataResponse.getBussinessOriginTypeEntities();
|
||||
BussinessOriginTypeDao mapper = batchSession.getMapper(BussinessOriginTypeDao.class);
|
||||
for (BussinessOriginTypeEntity bussinessTypeEntity : bussinessTypeEntities) {
|
||||
mapper.insertBusOriginType(bussinessTypeEntity);
|
||||
}
|
||||
batchSession.commit();
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void dlAllOrder(SpsSyncOrderResponse syncDataResponse) {
|
||||
SqlSession batchSession = sqlSessionFactory.openSession(ExecutorType.BATCH, TransactionIsolationLevel.READ_COMMITTED);
|
||||
|
||||
if (CollUtil.isNotEmpty(syncDataResponse.getOrderEntities())) {
|
||||
try {
|
||||
List<OrderEntity> orderEntities = syncDataResponse.getOrderEntities();
|
||||
OrderDao mapper = batchSession.getMapper(OrderDao.class);
|
||||
for (OrderEntity orderEntity : orderEntities) {
|
||||
orderService.deleteByOrderId(orderEntity.getId());
|
||||
mapper.importOrder(orderEntity);
|
||||
}
|
||||
batchSession.commit();
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
if (CollUtil.isNotEmpty(syncDataResponse.getOrderDetailEntityList())) {
|
||||
try {
|
||||
List<ErpOrderEntity> erpOrderEntities = syncDataResponse.getOrderDetailEntityList();
|
||||
OrderDetailDao mapper = batchSession.getMapper(OrderDetailDao.class);
|
||||
for (ErpOrderEntity erpOrderEntity : erpOrderEntities) {
|
||||
mapper.insertErpOrder(erpOrderEntity);
|
||||
}
|
||||
batchSession.commit();
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
if (CollUtil.isNotEmpty(syncDataResponse.getWarehouseEntityList())) {
|
||||
try {
|
||||
List<WarehouseEntity> warehouseEntityList = syncDataResponse.getWarehouseEntityList();
|
||||
CodesDao mapper = batchSession.getMapper(CodesDao.class);
|
||||
for (WarehouseEntity warehouseEntity : warehouseEntityList) {
|
||||
mapper.insertWarehouse(warehouseEntity);
|
||||
}
|
||||
batchSession.commit();
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package com.glxp.sale.admin.dao.basic;
|
||||
|
||||
import com.glxp.sale.admin.entity.basic.BasicExportStatusEntity;
|
||||
import com.glxp.sale.admin.entity.basic.BasicExportStatusTimeEntity;
|
||||
import com.glxp.sale.admin.req.basic.BasicExportStatusRequest;
|
||||
import com.glxp.sale.admin.req.basic.BasicExportTimeRequest;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface BasicExportTimeDao {
|
||||
|
||||
|
||||
List<BasicExportStatusTimeEntity> filterExportStatus(BasicExportTimeRequest basicExportStatusRequest);
|
||||
|
||||
boolean insertExportStatus(BasicExportStatusTimeEntity basicExportStatusTimeEntity);
|
||||
|
||||
boolean deleteById(String id);
|
||||
|
||||
boolean updateExportStatus(BasicExportStatusTimeEntity basicExportStatusTimeEntity);
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package com.glxp.sale.admin.entity.basic;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class BasicExportStatusTimeEntity {
|
||||
|
||||
private Integer id;
|
||||
private String lastUpdateTime;
|
||||
private String key;
|
||||
private String remark;
|
||||
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
package com.glxp.sale.admin.req.basic;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class BasicExportTimeRequest {
|
||||
|
||||
private Integer id;
|
||||
private String key;
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package com.glxp.sale.admin.req.basic;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class SpsSyncDataRequest {
|
||||
|
||||
private String lastUpdateTime;
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package com.glxp.sale.admin.req.inventory;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class FilterInvUserRequest {
|
||||
|
||||
private Integer id;
|
||||
|
||||
private String code;
|
||||
|
||||
private Long userid;
|
||||
|
||||
private String username;
|
||||
|
||||
private Boolean isDirector;
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package com.glxp.sale.admin.res.basic;
|
||||
|
||||
import com.glxp.sale.admin.entity.basic.BussinessLocalTypeEntity;
|
||||
import com.glxp.sale.admin.entity.basic.BussinessOriginTypeEntity;
|
||||
import com.glxp.sale.admin.entity.basic.BussinessTypeEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class SpsSyncBusResponse {
|
||||
|
||||
private List<BussinessTypeEntity> bussinessTypeEntities;
|
||||
private List<BussinessOriginTypeEntity> bussinessOriginTypeEntities;
|
||||
private List<BussinessLocalTypeEntity> bussinessLocalTypeEntities;
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package com.glxp.sale.admin.res.basic;
|
||||
|
||||
import com.glxp.sale.admin.entity.basic.BasicUnitMaintainEntity;
|
||||
import com.glxp.sale.admin.entity.basic.UdiInfoEntity;
|
||||
import com.glxp.sale.admin.entity.basic.UdiRelevanceEntity;
|
||||
import com.glxp.sale.admin.entity.info.CompanyProductRelevanceEntity;
|
||||
import com.glxp.sale.admin.entity.inventory.InvWarehouseEntity;
|
||||
import com.glxp.sale.admin.entity.thrsys.*;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class SpsSyncDataResponse {
|
||||
|
||||
List<InvWarehouseEntity> invWarehouseEntities;
|
||||
List<UdiInfoEntity> udiInfoEntities;
|
||||
List<BasicUnitMaintainEntity> basicUnitMaintainEntities;
|
||||
List<ThrInvWarehouseEntity> thrInvWarehouseEntities;
|
||||
List<ThrCorpEntity> thrCorpEntities;
|
||||
List<ThrProductsEntity> thrProductsEntities;
|
||||
List<ThrOrderDetailEntity> thrOrderDetailEntities;
|
||||
List<ThrOrderEntity> thrOrderEntities;
|
||||
List<CompanyProductRelevanceEntity> companyProductRelevanceEntities;
|
||||
List<UdiRelevanceEntity> udiRelevanceEntities;
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package com.glxp.sale.admin.res.basic;
|
||||
|
||||
import com.glxp.sale.admin.entity.inout.ErpOrderEntity;
|
||||
import com.glxp.sale.admin.entity.inout.OrderEntity;
|
||||
import com.glxp.sale.admin.entity.inout.WarehouseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class SpsSyncOrderResponse {
|
||||
|
||||
List<OrderEntity> orderEntities;
|
||||
List<ErpOrderEntity> orderDetailEntityList;
|
||||
List<WarehouseEntity> warehouseEntityList;
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package com.glxp.sale.admin.service.basic;
|
||||
|
||||
import com.glxp.sale.admin.entity.basic.BasicExportStatusTimeEntity;
|
||||
import com.glxp.sale.admin.req.basic.BasicExportTimeRequest;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface BasicExportTimeService {
|
||||
|
||||
List<BasicExportStatusTimeEntity> filterExportStatus(BasicExportTimeRequest basicExportStatusRequest);
|
||||
|
||||
boolean insertExportStatus(BasicExportStatusTimeEntity basicExportStatusTimeEntity);
|
||||
|
||||
boolean deleteById(String id);
|
||||
|
||||
boolean updateExportStatus(BasicExportStatusTimeEntity basicExportStatusTimeEntity);
|
||||
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
package com.glxp.sale.admin.service.basic.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.glxp.sale.admin.dao.basic.BasicExportDao;
|
||||
import com.glxp.sale.admin.dao.basic.BasicExportTimeDao;
|
||||
import com.glxp.sale.admin.entity.basic.BasicExportStatusEntity;
|
||||
import com.glxp.sale.admin.entity.basic.BasicExportStatusTimeEntity;
|
||||
import com.glxp.sale.admin.req.basic.BasicExportStatusRequest;
|
||||
import com.glxp.sale.admin.req.basic.BasicExportTimeRequest;
|
||||
import com.glxp.sale.admin.service.basic.BasicExportTimeService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class BasicExportTimeServiceImpl implements BasicExportTimeService {
|
||||
|
||||
@Resource
|
||||
BasicExportTimeDao basicExportTimeDao;
|
||||
|
||||
@Override
|
||||
public List<BasicExportStatusTimeEntity> filterExportStatus(BasicExportTimeRequest basicExportStatusRequest) {
|
||||
if (basicExportStatusRequest == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return basicExportTimeDao.filterExportStatus(basicExportStatusRequest);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean insertExportStatus(BasicExportStatusTimeEntity basicExportStatusTimeEntity) {
|
||||
return basicExportTimeDao.insertExportStatus(basicExportStatusTimeEntity);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteById(String id) {
|
||||
return basicExportTimeDao.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateExportStatus(BasicExportStatusTimeEntity basicExportStatusTimeEntity) {
|
||||
return basicExportTimeDao.updateExportStatus(basicExportStatusTimeEntity);
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,128 @@
|
||||
package com.glxp.sale.admin.thread;
|
||||
|
||||
import com.glxp.sale.admin.constant.BasicProcessStatus;
|
||||
import com.glxp.sale.admin.dao.info.ScheduledDao;
|
||||
import com.glxp.sale.admin.entity.basic.BasicExportStatusEntity;
|
||||
import com.glxp.sale.admin.entity.info.ScheduledEntity;
|
||||
import com.glxp.sale.admin.entity.param.SystemParamConfigEntity;
|
||||
import com.glxp.sale.admin.req.udid.ScheduledRequest;
|
||||
import com.glxp.sale.admin.service.basic.BasicExportService;
|
||||
import com.glxp.sale.admin.service.param.SystemParamConfigService;
|
||||
import com.glxp.sale.admin.util.CustomUtil;
|
||||
import com.glxp.sale.admin.util.RedisUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.scheduling.annotation.SchedulingConfigurer;
|
||||
import org.springframework.scheduling.config.ScheduledTaskRegistrar;
|
||||
import org.springframework.scheduling.support.CronTrigger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
@Component
|
||||
@EnableScheduling
|
||||
public class AsyncHeartTask implements SchedulingConfigurer {
|
||||
|
||||
final Logger logger = LoggerFactory.getLogger(AsyncHeartTask.class);
|
||||
@Resource
|
||||
protected ScheduledDao scheduledDao;
|
||||
@Resource
|
||||
SystemParamConfigService systemParamConfigService;
|
||||
@Resource
|
||||
RedisUtil redisUtil;
|
||||
@Resource
|
||||
BasicExportService basicExportService;
|
||||
|
||||
@Override
|
||||
public void configureTasks(ScheduledTaskRegistrar scheduledTaskRegistrar) {
|
||||
|
||||
scheduledTaskRegistrar.addTriggerTask(() -> process(),
|
||||
triggerContext -> {
|
||||
ScheduledRequest scheduledRequest = new ScheduledRequest();
|
||||
scheduledRequest.setCronName("heartTask");
|
||||
ScheduledEntity scheduledEntity = scheduledDao.findScheduled(scheduledRequest);
|
||||
String cron = scheduledEntity.getCron();
|
||||
if (cron.isEmpty()) {
|
||||
logger.error("cron is null");
|
||||
}
|
||||
return new CronTrigger(cron).nextExecutionTime(triggerContext);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private void process() {
|
||||
|
||||
|
||||
SystemParamConfigEntity downConnect = systemParamConfigService.selectByParamKey("sync_downstream_enable");
|
||||
if (downConnect.getParamValue().equals("1")) {
|
||||
|
||||
//定时同步最近更新数据至任务表,等待下载
|
||||
SystemParamConfigEntity systemParamConfigEntity = systemParamConfigService.selectByParamKey("sps_sync_gen_data");
|
||||
long timeInterval = Long.parseLong(systemParamConfigEntity.getParamValue()) * 60 * 1000;
|
||||
long curTime = System.currentTimeMillis();
|
||||
Long lastTime = (Long) redisUtil.get("SPS_SYNC_GEN_DATA");
|
||||
if (lastTime == null) {
|
||||
lastTime = System.currentTimeMillis();
|
||||
redisUtil.set("SPS_SYNC_GEN_DATA", lastTime);
|
||||
}
|
||||
if (curTime - lastTime > timeInterval) {
|
||||
|
||||
//自动创建要求被下载已完成单据任务
|
||||
BasicExportStatusEntity basicExportStatusEntity1 = basicExportService.findByData("AutoDownloadOrder", 0);
|
||||
if (basicExportStatusEntity1 == null) {
|
||||
BasicExportStatusEntity orderStatusEntity = new BasicExportStatusEntity();
|
||||
orderStatusEntity.setId(CustomUtil.getId());
|
||||
orderStatusEntity.setIdDatas("AutoDownloadOrder");
|
||||
orderStatusEntity.setType(BasicProcessStatus.NEW_ALL_ORDER);
|
||||
orderStatusEntity.setUpdateTime(new Date());
|
||||
orderStatusEntity.setStatus(0);
|
||||
orderStatusEntity.setStartTime(new Date());
|
||||
orderStatusEntity.setScheduleType(BasicProcessStatus.SCHEDULE_NORMAL);
|
||||
basicExportService.insertExportStatus(orderStatusEntity);
|
||||
}
|
||||
|
||||
|
||||
//自动创建要求被下载单据类型任务
|
||||
BasicExportStatusEntity basicExportStatusEntity2 = basicExportService.findByData("AutoDownloadBusType", 0);
|
||||
if (basicExportStatusEntity2 == null) {
|
||||
BasicExportStatusEntity busTypetatusEntity = new BasicExportStatusEntity();
|
||||
busTypetatusEntity.setId(CustomUtil.getId());
|
||||
busTypetatusEntity.setIdDatas("AutoDownloadBusType");
|
||||
busTypetatusEntity.setType(BasicProcessStatus.NEW_ALL_BUS);
|
||||
busTypetatusEntity.setUpdateTime(new Date());
|
||||
busTypetatusEntity.setStatus(0);
|
||||
busTypetatusEntity.setStartTime(new Date());
|
||||
busTypetatusEntity.setScheduleType(BasicProcessStatus.SCHEDULE_NORMAL);
|
||||
basicExportService.insertExportStatus(busTypetatusEntity);
|
||||
}
|
||||
|
||||
|
||||
//自动创建要求被下载基础信息任务
|
||||
BasicExportStatusEntity basicExportStatusEntity3 = basicExportService.findByData("AutoDownloadAllData", 0);
|
||||
if (basicExportStatusEntity3 == null) {
|
||||
BasicExportStatusEntity basicExportStatusEntity = new BasicExportStatusEntity();
|
||||
basicExportStatusEntity.setId(CustomUtil.getId());
|
||||
basicExportStatusEntity.setIdDatas("AutoDownloadAllData");
|
||||
basicExportStatusEntity.setType(BasicProcessStatus.NEW_ALL_DATA);
|
||||
basicExportStatusEntity.setUpdateTime(new Date());
|
||||
basicExportStatusEntity.setStatus(0);
|
||||
basicExportStatusEntity.setStartTime(new Date());
|
||||
basicExportStatusEntity.setScheduleType(BasicProcessStatus.SCHEDULE_NORMAL);
|
||||
basicExportService.insertExportStatus(basicExportStatusEntity);
|
||||
}
|
||||
|
||||
|
||||
redisUtil.set("SPS_SYNC_GEN_DATA", curTime);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
package com.glxp.sale.admin.thread;
|
||||
|
||||
import com.glxp.sale.admin.constant.BasicProcessStatus;
|
||||
import com.glxp.sale.admin.dao.info.ScheduledDao;
|
||||
import com.glxp.sale.admin.entity.basic.BasicExportStatusEntity;
|
||||
import com.glxp.sale.admin.entity.info.ScheduledEntity;
|
||||
import com.glxp.sale.admin.req.udid.ScheduledRequest;
|
||||
import com.glxp.sale.admin.service.basic.BasicExportService;
|
||||
import com.glxp.sale.admin.util.CustomUtil;
|
||||
import com.glxp.sale.admin.util.DateUtil;
|
||||
import com.glxp.sale.admin.util.RedisUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.scheduling.annotation.SchedulingConfigurer;
|
||||
import org.springframework.scheduling.config.ScheduledTaskRegistrar;
|
||||
import org.springframework.scheduling.support.CronTrigger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
|
||||
@Component
|
||||
@EnableScheduling
|
||||
public class AsyncSpsDataTask implements SchedulingConfigurer {
|
||||
|
||||
|
||||
final Logger logger = LoggerFactory.getLogger(AsyncSpsDataTask.class);
|
||||
|
||||
@Resource
|
||||
private ScheduledDao scheduledDao;
|
||||
@Resource
|
||||
BasicExportService basicExportService;
|
||||
|
||||
@Override
|
||||
public void configureTasks(ScheduledTaskRegistrar scheduledTaskRegistrar) {
|
||||
scheduledTaskRegistrar.addTriggerTask(() -> process(),
|
||||
triggerContext -> {
|
||||
ScheduledRequest scheduledRequest = new ScheduledRequest();
|
||||
scheduledRequest.setCronName("syncSpsData");
|
||||
ScheduledEntity scheduledEntity = scheduledDao.findScheduled(scheduledRequest);
|
||||
String cron = scheduledEntity.getCron();//"0 55 5 * * ?";
|
||||
if (cron.isEmpty()) {
|
||||
logger.error("cron is null");
|
||||
}
|
||||
return new CronTrigger(cron).nextExecutionTime(triggerContext);
|
||||
});
|
||||
}
|
||||
|
||||
private void process() {
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
|
||||
<mapper namespace="com.glxp.sale.admin.dao.basic.BasicExportTimeDao">
|
||||
|
||||
<select id="filterExportStatus" parameterType="com.glxp.sale.admin.req.basic.BasicExportTimeRequest"
|
||||
resultType="com.glxp.sale.admin.entity.basic.BasicExportStatusTimeEntity">
|
||||
select * from basic_export_status_time
|
||||
<where>
|
||||
<if test="id != '' and id!=null">
|
||||
and id = #{id}
|
||||
</if>
|
||||
<if test="key != '' and key!=null">
|
||||
and `key` = #{key}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
<insert id="insertExportStatus" keyProperty="id"
|
||||
parameterType="com.glxp.sale.admin.entity.basic.BasicExportStatusTimeEntity">
|
||||
replace
|
||||
INTO basic_export_status_time(`key`,lastUpdateTime,remark)
|
||||
values(
|
||||
#{key},
|
||||
#{lastUpdateTime},
|
||||
#{remark}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="updateExportStatus" parameterType="com.glxp.sale.admin.entity.basic.BasicExportStatusTimeEntity">
|
||||
UPDATE basic_export_status_time
|
||||
<trim prefix="set" suffixOverrides=",">
|
||||
<if test="lastUpdateTime != null">lastUpdateTime=#{lastUpdateTime},</if>
|
||||
<if test="remark != null">remark=#{remark},</if>
|
||||
</trim>
|
||||
WHERE key = #{key}
|
||||
</update>
|
||||
<delete id="deleteById" parameterType="Map">
|
||||
DELETE
|
||||
FROM basic_export_status_time
|
||||
WHERE id = #{id}
|
||||
</delete>
|
||||
|
||||
</mapper>
|
Loading…
Reference in New Issue