Merge remote-tracking branch 'origin/dev' into dev

pro
郑明梁 2 years ago
commit de32494a78

@ -1,5 +1,6 @@
package com.glxp.api.controller.thrsys; package com.glxp.api.controller.thrsys;
import cn.hutool.core.thread.ThreadUtil;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.glxp.api.annotation.AuthRuleAnnotation; import com.glxp.api.annotation.AuthRuleAnnotation;
import com.glxp.api.common.enums.ResultEnum; import com.glxp.api.common.enums.ResultEnum;
@ -23,6 +24,7 @@ import com.glxp.api.service.thrsys.ThrCorpsDlService;
import com.glxp.api.service.thrsys.ThrSystemDetailService; import com.glxp.api.service.thrsys.ThrSystemDetailService;
import com.glxp.api.util.CustomUtil; import com.glxp.api.util.CustomUtil;
import com.glxp.api.util.RedisUtil; import com.glxp.api.util.RedisUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.validation.BindingResult; import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -32,6 +34,7 @@ import java.util.Date;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@Slf4j
@RestController @RestController
public class ThrCorpsController { public class ThrCorpsController {
@Resource @Resource
@ -137,7 +140,7 @@ public class ThrCorpsController {
thrCorpImportLogEntity.setUpdateTime(new Date()); thrCorpImportLogEntity.setUpdateTime(new Date());
thrCorpImportLogEntity.setThirdSysFk(filterThrProductsRequest.getThirdSysFk()); thrCorpImportLogEntity.setThirdSysFk(filterThrProductsRequest.getThirdSysFk());
thrCorpImportLogService.insertImportLog(thrCorpImportLogEntity); thrCorpImportLogService.insertImportLog(thrCorpImportLogEntity);
thrCorpsDlService.importCorps(genKey,null, filterThrProductsRequest.getThirdSysFk()); thrCorpsDlService.importCorps(genKey, null, filterThrProductsRequest.getThirdSysFk());
return ResultVOUtils.success("后台开始下载更新,请稍后刷新查看"); return ResultVOUtils.success("后台开始下载更新,请稍后刷新查看");
} }
} }
@ -146,33 +149,19 @@ public class ThrCorpsController {
@AuthRuleAnnotation("") @AuthRuleAnnotation("")
@PostMapping("/udiwms/thrsys/corp/corpsDlAll") @PostMapping("/udiwms/thrsys/corp/corpsDlAll")
public BaseResponse corpsDlAll(@RequestBody ThrUnitMaintainFilterRequest thrUnitMaintainFilterRequest) { public BaseResponse corpsDlAll(@RequestBody ThrUnitMaintainFilterRequest thrUnitMaintainFilterRequest) {
thrUnitMaintainFilterRequest.setThirdSysFk(thrUnitMaintainFilterRequest.getThirdSys()); if (null == thrUnitMaintainFilterRequest) {
String data = (String) redisUtil.get(Constant.dlThrProducts); return ResultVOUtils.error(500, "参数不能为空");
if (data != null && data.equals("true")) { }
return ResultVOUtils.error(500, "当前任务正在下载更新产品信息,请稍后重试!"); ThreadUtil.execAsync(() -> {
} else { try {
redisUtil.set(Constant.dlThrCorps, "true", 30); thrCorpService.downloadByRequest(thrUnitMaintainFilterRequest);
if (thrUnitMaintainFilterRequest.getThirdSysFk() == null) { } catch (Exception e) {
return ResultVOUtils.error(500, "未选择第三方系统!"); log.error("下载异常", e);
} e.printStackTrace();
ThrCorpImportLogEntity thrCorpImportLogEntity = new ThrCorpImportLogEntity();
String genKey = CustomUtil.getId();
thrCorpImportLogEntity.setGenKey(genKey);
thrCorpImportLogEntity.setFromType("第三方系统获取");
thrCorpImportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_PROCESS);
thrCorpImportLogEntity.setUpdateTime(new Date());
thrCorpImportLogEntity.setThirdSysFk(thrUnitMaintainFilterRequest.getThirdSysFk());
thrCorpImportLogService.insertImportLog(thrCorpImportLogEntity);
if (thrUnitMaintainFilterRequest.getThrCorpEntities() != null && thrUnitMaintainFilterRequest.getThrCorpEntities().size() > 0) {//选中导出
thrCorpsDlService.importSelectCorps(genKey, thrUnitMaintainFilterRequest.getThrCorpEntities(), thrUnitMaintainFilterRequest.getThirdSysFk());
} else { //结果导出
thrCorpsDlService.importCorps(genKey,thrUnitMaintainFilterRequest, thrUnitMaintainFilterRequest.getThirdSysFk());
} }
// thrCorpsDlService.importCorps(genKey, filterThrCorpRequest.getThirdSysFk()); });
return ResultVOUtils.success("后台开始下载更新,请稍后刷新查看"); return ResultVOUtils.success("后台正在下载,请稍后刷新查看!");
}
} }
//查询ERP往来单位 //查询ERP往来单位

@ -1,6 +1,8 @@
package com.glxp.api.controller.thrsys; package com.glxp.api.controller.thrsys;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.thread.ThreadUtil; import cn.hutool.core.thread.ThreadUtil;
import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.IdUtil;
@ -16,17 +18,20 @@ import com.glxp.api.http.ErpBasicClient;
import com.glxp.api.req.system.DeleteRequest; import com.glxp.api.req.system.DeleteRequest;
import com.glxp.api.req.thrsys.FilterThrProductsRequest; import com.glxp.api.req.thrsys.FilterThrProductsRequest;
import com.glxp.api.req.thrsys.PostThrProductsRequest; import com.glxp.api.req.thrsys.PostThrProductsRequest;
import com.glxp.api.req.thrsys.ThrOnhandRequest;
import com.glxp.api.res.PageSimpleResponse; import com.glxp.api.res.PageSimpleResponse;
import com.glxp.api.res.thrsys.ThrProductsResponse; import com.glxp.api.res.thrsys.ThrProductsResponse;
import com.glxp.api.service.auth.CustomerService; import com.glxp.api.service.auth.CustomerService;
import com.glxp.api.service.thrsys.ThrProductsService; import com.glxp.api.service.thrsys.ThrProductsService;
import com.glxp.api.service.thrsys.ThrSystemDetailService; import com.glxp.api.service.thrsys.ThrSystemDetailService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.validation.BindingResult; import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.io.IOException;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@ -38,6 +43,7 @@ import java.util.List;
* @author ${author} * @author ${author}
* @since 2023-01-10 * @since 2023-01-10
*/ */
@Slf4j
@RestController @RestController
public class ThrProductsController { public class ThrProductsController {
@ -71,35 +77,9 @@ public class ThrProductsController {
if (thrSystemDetailEntity.getEnabled()) { if (thrSystemDetailEntity.getEnabled()) {
if (thrSystemDetailEntity.getFromType() == 0 || (filterThrProductsRequest.getIsDownThrSys() != null && filterThrProductsRequest.getIsDownThrSys())) { if (thrSystemDetailEntity.getFromType() == 0 || (filterThrProductsRequest.getIsDownThrSys() != null && filterThrProductsRequest.getIsDownThrSys())) {
BaseResponse<PageSimpleResponse<ThrProductsResponse>> udiDlDeviceResponse = erpBasicClient.getErpProducts(filterThrProductsRequest); BaseResponse<PageSimpleResponse<ThrProductsResponse>> udiDlDeviceResponse = erpBasicClient.getErpProducts(filterThrProductsRequest);
if (udiDlDeviceResponse.getCode() == 20000) {
List<ThrProductsResponse> invmandocResponses = udiDlDeviceResponse.getData().getList();
//todo 耗材字典未确认数据库
// if (invmandocResponses != null) {
// for (ThrProductsResponse invmandocResponse : invmandocResponses) {
// UdiRelevanceEntity udiRelevanceEntity = udiRelevanceService.selectByThirdId(invmandocResponse.getCode(), filterErpGoodsRequest.getThirdSys());
// invmandocResponse.setThirdSys(thrProductsRequest.getThirdSys());
// if (udiRelevanceEntity != null) {
// invmandocResponse.setChecked(true);
// } else {
// invmandocResponse.setChecked(false);
// }
// }
// }
}
return udiDlDeviceResponse; return udiDlDeviceResponse;
} else { } else {
List<ThrProductsResponse> thrCorpEntities = thrProductsService.filterJoinThrProducts(filterThrProductsRequest); List<ThrProductsResponse> thrCorpEntities = thrProductsService.filterJoinThrProducts(filterThrProductsRequest);
//todo 耗材字典未确认数据库
// for (ThrProductsEntity thrProductsEntity : thrCorpEntities) {
// UdiRelevanceEntity udiRelevanceEntity = udiRelevanceService.selectByThirdId(thrProductsEntity.getCode(), thrProductsEntity.getThirdSysFk());
// if (udiRelevanceEntity != null) {
// thrProductsEntity.setChecked(true);
// } else {
// thrProductsEntity.setChecked(false);
// }
// }
PageInfo<ThrProductsResponse> pageInfo; PageInfo<ThrProductsResponse> pageInfo;
pageInfo = new PageInfo<>(thrCorpEntities); pageInfo = new PageInfo<>(thrCorpEntities);
PageSimpleResponse<ThrProductsResponse> pageSimpleResponse = new PageSimpleResponse<>(); PageSimpleResponse<ThrProductsResponse> pageSimpleResponse = new PageSimpleResponse<>();
@ -215,7 +195,11 @@ public class ThrProductsController {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, "每次只能上传一个文件!"); return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, "每次只能上传一个文件!");
} }
ThreadUtil.execAsync(() -> { ThreadUtil.execAsync(() -> {
thrProductsService.uploadPi(files, thirdSys); try {
thrProductsService.uploadPi(files.get(0).getBytes(), files.get(0).getName(), thirdSys);
} catch (IOException e) {
e.printStackTrace();
}
}); });
return ResultVOUtils.success("正在导入中,稍后请刷新页面查看"); return ResultVOUtils.success("正在导入中,稍后请刷新页面查看");
} }
@ -237,4 +221,29 @@ public class ThrProductsController {
return ResultVOUtils.success(); return ResultVOUtils.success();
} }
} /**
*
*
* @param filterThrProductsRequest
* @return
*/
@PostMapping("/udiwms/thrsys/products/productsDlAll")
public BaseResponse productsDlAll(@RequestBody FilterThrProductsRequest filterThrProductsRequest) {
if (null == filterThrProductsRequest) {
return ResultVOUtils.error(500, "参数不能为空");
}
ThreadUtil.execAsync(() -> {
try {
thrProductsService.downloadByRequest(filterThrProductsRequest);
} catch (Exception e) {
log.error("下载异常", e);
e.printStackTrace();
}
});
return ResultVOUtils.success("后台正在下载,请稍后刷新查看!");
}
}

@ -18,10 +18,7 @@ import org.apache.ibatis.logging.Log;
import org.apache.ibatis.logging.LogFactory; import org.apache.ibatis.logging.LogFactory;
import java.io.Serializable; import java.io.Serializable;
import java.util.Collection; import java.util.*;
import java.util.List;
import java.util.Map;
import java.util.Objects;
/** /**
* Mapper , * Mapper ,
@ -242,8 +239,39 @@ public interface BaseMapperPlus<M, T, V> extends BaseMapper<T> {
* @param entityList * @param entityList
* @return * @return
*/ */
default boolean insertIgnoreBatchs(List<T> entityList) {
return insertIgnoreBatchs(entityList, DEFAULT_BATCH_SIZE);
}
default boolean insertIgnoreBatchs(List<T> entityList, int batchSize) {
try {
int size = entityList.size();
int idxLimit = Math.min(DEFAULT_BATCH_SIZE, size);
int i = 1;
//保存单批提交的数据集合
List<T> oneBatchList = new ArrayList<>();
for (Iterator<T> var7 = entityList.iterator(); var7.hasNext(); ++i) {
T element = var7.next();
oneBatchList.add(element);
if (i == idxLimit) {
this.insertIgnoreBatch(oneBatchList);
//每次提交后需要清空集合数据
oneBatchList.clear();
idxLimit = Math.min(idxLimit + batchSize, size);
}
}
} catch (Exception e) {
log.error("insertIgnoreBatch fail", e);
return false;
}
return true;
}
int insertIgnoreBatch(List<T> entityList); int insertIgnoreBatch(List<T> entityList);
/** /**
* *
* replace intoPrimaryKeyuniqueinsert into * replace intoPrimaryKeyuniqueinsert into
@ -262,5 +290,36 @@ public interface BaseMapperPlus<M, T, V> extends BaseMapper<T> {
* @param entityList * @param entityList
* @return * @return
*/ */
default boolean replaceBatchs(List<T> entityList) {
return this.replaceBatchs(entityList, DEFAULT_BATCH_SIZE);
}
default boolean replaceBatchs(List<T> entityList, int batchSize) {
try {
int size = entityList.size();
int idxLimit = Math.min(DEFAULT_BATCH_SIZE, size);
int i = 1;
//保存单批提交的数据集合
List<T> oneBatchList = new ArrayList<>();
for (Iterator<T> var7 = entityList.iterator(); var7.hasNext(); ++i) {
T element = var7.next();
oneBatchList.add(element);
if (i == idxLimit) {
this.replaceBatch(oneBatchList);
//每次提交后需要清空集合数据
oneBatchList.clear();
idxLimit = Math.min(idxLimit + batchSize, size);
}
}
} catch (Exception e) {
log.error("insertIgnoreBatch fail", e);
return false;
}
return true;
}
int replaceBatch(List<T> entityList); int replaceBatch(List<T> entityList);
} }

@ -22,6 +22,7 @@ import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.io.File;
import java.util.List; import java.util.List;
/** /**
@ -43,8 +44,7 @@ public class ErpBasicClient {
UdiwmsUnitRequest udiwmsUnitRequest = new UdiwmsUnitRequest(); UdiwmsUnitRequest udiwmsUnitRequest = new UdiwmsUnitRequest();
BeanUtils.copyProperties(thrUnitMaintainFilterRequest, udiwmsUnitRequest); BeanUtils.copyProperties(thrUnitMaintainFilterRequest, udiwmsUnitRequest);
udiwmsUnitRequest.setUnitId(thrUnitMaintainFilterRequest.getErpId()); udiwmsUnitRequest.setUnitId(thrUnitMaintainFilterRequest.getErpId());
ThrSystemEntity thrSystemEntity = basicThirdSysService.selectByThirdId(thrUnitMaintainFilterRequest.getThirdSys()); ThrSystemEntity thrSystemEntity = basicThirdSysService.selectByThirdId(thrUnitMaintainFilterRequest.getThirdSysFk());
try { try {
String url = thrSystemEntity.getThridUrl() + "/udiwms/erp/getUnits"; String url = thrSystemEntity.getThridUrl() + "/udiwms/erp/getUnits";
String response = httpOkClient.uCloudPost(url, udiwmsUnitRequest, thrSystemEntity); String response = httpOkClient.uCloudPost(url, udiwmsUnitRequest, thrSystemEntity);
@ -64,9 +64,8 @@ public class ErpBasicClient {
//获取产品信息 //获取产品信息
public BaseResponse<PageSimpleResponse<ThrProductsResponse>> getErpProducts(FilterThrProductsRequest filterThrProductsRequest) { public BaseResponse<PageSimpleResponse<ThrProductsResponse>> getErpProducts(FilterThrProductsRequest filterThrProductsRequest) {
ThrSystemEntity basicThirdSysEntity = basicThirdSysService.selectByThirdId(filterThrProductsRequest.getThirdSys()); ThrSystemEntity basicThirdSysEntity = basicThirdSysService.selectByThirdId(filterThrProductsRequest.getThirdSysFk());
String url = basicThirdSysEntity.getThridUrl() + "/udiwms/erp/getProducts"; String url = basicThirdSysEntity.getThridUrl() + "/udiwms/erp/getProducts";
try { try {
String response = httpOkClient.uCloudPost(url, filterThrProductsRequest, basicThirdSysEntity); String response = httpOkClient.uCloudPost(url, filterThrProductsRequest, basicThirdSysEntity);
if (StrUtil.isBlank(response)) { if (StrUtil.isBlank(response)) {
@ -159,16 +158,14 @@ public class ErpBasicClient {
* @param thirdSys * @param thirdSys
* @return * @return
*/ */
public BaseResponse<PostThrProductsRequest> uploadPi(List<MultipartFile> files, String thirdSys) { public BaseResponse<PostThrProductsRequest> uploadPi(byte[] bytes, String fileName, String thirdSys) {
ThrSystemEntity thrSystemEntity = basicThirdSysService.selectByThirdId(thirdSys); ThrSystemEntity thrSystemEntity = basicThirdSysService.selectByThirdId(thirdSys);
String url = thrSystemEntity.getThridUrl() + "/udiwms/erp/pi/upload"; String url = thrSystemEntity.getThridUrl() + "/udiwms/erp/pi/upload";
try { try {
MultipartBody.Builder builder = new MultipartBody.Builder() MultipartBody.Builder builder = new MultipartBody.Builder()
.setType(MultipartBody.FORM); .setType(MultipartBody.FORM);
for (MultipartFile file : files) { builder.addFormDataPart("file", fileName, RequestBody.create(MediaType.parse("application/vnd.ms-excel"), bytes));
builder.addFormDataPart("file", file.getOriginalFilename(), RequestBody.create(MediaType.parse("application/vnd.ms-excel"), file.getBytes()));
}
builder.addFormDataPart("thirdSys", thirdSys); builder.addFormDataPart("thirdSys", thirdSys);
MultipartBody multipartBody = builder.build(); MultipartBody multipartBody = builder.build();

@ -1,6 +1,7 @@
package com.glxp.api.req.thrsys; package com.glxp.api.req.thrsys;
import cn.hutool.core.util.StrUtil;
import com.glxp.api.entity.thrsys.ThrProductsEntity; import com.glxp.api.entity.thrsys.ThrProductsEntity;
import com.glxp.api.util.page.ListPageRequest; import com.glxp.api.util.page.ListPageRequest;
import lombok.Data; import lombok.Data;
@ -34,5 +35,20 @@ public class FilterThrProductsRequest extends ListPageRequest {
private String uuid; private String uuid;
private Integer diType; private Integer diType;
public List<ThrProductsEntity> getThrProductsEntities() {
return thrProductsEntities;
}
public String getThirdSys() {
if (StrUtil.isEmpty(thirdSys))
return thirdSysFk;
return thirdSys;
}
public String getThirdSysFk() {
if (StrUtil.isEmpty(thirdSysFk))
return thirdSys;
return thirdSysFk;
}
} }

@ -1,6 +1,7 @@
package com.glxp.api.req.thrsys; package com.glxp.api.req.thrsys;
import cn.hutool.core.util.StrUtil;
import com.glxp.api.util.page.ListPageRequest; import com.glxp.api.util.page.ListPageRequest;
import com.glxp.api.res.thrsys.ThrCorpsResponse; import com.glxp.api.res.thrsys.ThrCorpsResponse;
import lombok.Data; import lombok.Data;
@ -28,4 +29,18 @@ public class ThrUnitMaintainFilterRequest extends ListPageRequest {
private Boolean isDownThrSys; private Boolean isDownThrSys;
private String lastUpdateTime; private String lastUpdateTime;
List<ThrCorpsResponse> thrCorpEntities; List<ThrCorpsResponse> thrCorpEntities;
public String getThirdSys() {
if (StrUtil.isEmpty(thirdSys))
return thirdSysFk;
return thirdSys;
}
public String getThirdSysFk() {
if (StrUtil.isEmpty(thirdSysFk))
return thirdSys;
return thirdSysFk;
}
} }

@ -6,7 +6,7 @@ import java.util.List;
public interface CustomService<T> extends IService<T> { public interface CustomService<T> extends IService<T> {
int insertIgnore(T entity); int insertIgnore(T entity);
int insertIgnoreBatch(List<T> entityList); boolean insertIgnoreBatch(List<T> entityList);
int replace(T entity); int replace(T entity);
int replaceBatch(List<T> entityList); boolean replaceBatch(List<T> entityList);
} }

@ -13,8 +13,8 @@ public class CustomServiceImpl<M extends BaseMapper<T>, T> extends ServiceImpl<B
} }
@Override @Override
public int insertIgnoreBatch(List<T> entityList) { public boolean insertIgnoreBatch(List<T> entityList) {
return baseMapper.insertIgnoreBatch(entityList); return baseMapper.insertIgnoreBatchs(entityList);
} }
@Override @Override
@ -23,7 +23,7 @@ public class CustomServiceImpl<M extends BaseMapper<T>, T> extends ServiceImpl<B
} }
@Override @Override
public int replaceBatch(List<T> entityList) { public boolean replaceBatch(List<T> entityList) {
return baseMapper.replaceBatch(entityList); return baseMapper.replaceBatchs(entityList);
} }
} }

@ -31,6 +31,7 @@ import com.glxp.api.http.sync.SpGetHttpClient;
import com.glxp.api.idc.service.FileService; import com.glxp.api.idc.service.FileService;
import com.glxp.api.idc.service.IdcService; import com.glxp.api.idc.service.IdcService;
import com.glxp.api.req.sync.SpsSyncDataRequest; import com.glxp.api.req.sync.SpsSyncDataRequest;
import com.glxp.api.res.inv.InnerOrderPrintResponse;
import com.glxp.api.res.sync.*; import com.glxp.api.res.sync.*;
import com.glxp.api.service.auth.*; import com.glxp.api.service.auth.*;
import com.glxp.api.service.basic.EntrustReceService; import com.glxp.api.service.basic.EntrustReceService;
@ -1614,7 +1615,13 @@ public class HeartService {
supManufacturerDao.replaceBatch(supManufacturerList); supManufacturerDao.replaceBatch(supManufacturerList);
} }
if (CollectionUtil.isNotEmpty(supProductList)) { if (CollectionUtil.isNotEmpty(supProductList)) {
supProductDao.replaceBatch(supProductList); List<List<SupProductEntity>> splits = CustomUtil.splitList(supProductList, 100);
if (CollUtil.isNotEmpty(splits)) {
for (List<SupProductEntity> items : splits) {
supProductDao.replaceBatch(items);
}
}
} }
if (CollUtil.isNotEmpty(syncFiles)) { if (CollUtil.isNotEmpty(syncFiles)) {
// fileService.download(syncFiles); // fileService.download(syncFiles);

@ -6,6 +6,7 @@ import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.entity.thrsys.ThrCorpEntity; import com.glxp.api.entity.thrsys.ThrCorpEntity;
import com.glxp.api.entity.thrsys.ThrSystemDetailEntity; import com.glxp.api.entity.thrsys.ThrSystemDetailEntity;
import com.glxp.api.req.thrsys.FilterThrCorpRequest; import com.glxp.api.req.thrsys.FilterThrCorpRequest;
import com.glxp.api.req.thrsys.ThrUnitMaintainFilterRequest;
import com.glxp.api.res.thrsys.ThrCorpsResponse; import com.glxp.api.res.thrsys.ThrCorpsResponse;
import com.glxp.api.res.thrsys.ThrUnitMaintainResponse; import com.glxp.api.res.thrsys.ThrUnitMaintainResponse;
@ -42,4 +43,5 @@ public interface ThrCorpService extends IService<ThrCorpEntity> {
*/ */
BaseResponse downloadThrCorp(ThrSystemDetailEntity thrSystemDetailEntity); BaseResponse downloadThrCorp(ThrSystemDetailEntity thrSystemDetailEntity);
public BaseResponse downloadByRequest(ThrUnitMaintainFilterRequest request);
} }

@ -45,7 +45,7 @@ public class ThrCorpsDlService {
ThrCorpExportLogService thrCorpExportLogService; ThrCorpExportLogService thrCorpExportLogService;
@Resource @Resource
private ThrCorpImportDetailService thrCorpImportDetailService; private ThrCorpImportDetailService thrCorpImportDetailService;
// @Value("${SPSYNC_IP}") // @Value("${SPSYNC_IP}")
// private String spsSyncUrl; // private String spsSyncUrl;
@Resource @Resource
ErpBasicClient erpBasicClient; ErpBasicClient erpBasicClient;
@ -353,9 +353,9 @@ public class ThrCorpsDlService {
public List<List<String>> genExcelData(FilterThrCorpRequest filterThrOrderRequest) { public List<List<String>> genExcelData(FilterThrCorpRequest filterThrOrderRequest) {
List<List<String>> excelData = new ArrayList<>(); List<List<String>> excelData = new ArrayList<>();
List<ThrCorpEntity> thrCorpEntityList=new ArrayList<>(); List<ThrCorpEntity> thrCorpEntityList = new ArrayList<>();
List<ThrCorpsResponse> thrCorpsResponseList = thrCorpService.filterThrCorps(filterThrOrderRequest); List<ThrCorpsResponse> thrCorpsResponseList = thrCorpService.filterThrCorps(filterThrOrderRequest);
if(thrCorpsResponseList.size()>0){ if (thrCorpsResponseList.size() > 0) {
thrCorpEntityList = thrCorpsResponseList.stream().map( thrCorpEntityList = thrCorpsResponseList.stream().map(
item -> { item -> {
ThrCorpEntity thrCorpEntity = new ThrCorpEntity(); ThrCorpEntity thrCorpEntity = new ThrCorpEntity();
@ -419,12 +419,12 @@ public class ThrCorpsDlService {
exportData.addAll(thrCorpEntities); exportData.addAll(thrCorpEntities);
} else { } else {
//根据查询条件一键导出数据库往来单位 //根据查询条件一键导出数据库往来单位
List<ThrCorpEntity> thrCorpEntityList=new ArrayList<>(); List<ThrCorpEntity> thrCorpEntityList = new ArrayList<>();
FilterThrCorpRequest filterThrCorpRequest = new FilterThrCorpRequest(); FilterThrCorpRequest filterThrCorpRequest = new FilterThrCorpRequest();
BeanUtils.copyProperties(thrCorpExportRequest, filterThrCorpRequest); BeanUtils.copyProperties(thrCorpExportRequest, filterThrCorpRequest);
filterThrCorpRequest.setPage(null); filterThrCorpRequest.setPage(null);
List<ThrCorpsResponse> thrCorpsResponseList = thrCorpService.filterThrCorps(filterThrCorpRequest); List<ThrCorpsResponse> thrCorpsResponseList = thrCorpService.filterThrCorps(filterThrCorpRequest);
if(thrCorpsResponseList.size()>0){ if (thrCorpsResponseList.size() > 0) {
thrCorpEntityList = thrCorpsResponseList.stream().map( thrCorpEntityList = thrCorpsResponseList.stream().map(
item -> { item -> {
ThrCorpEntity thrCorpEntity = new ThrCorpEntity(); ThrCorpEntity thrCorpEntity = new ThrCorpEntity();
@ -476,12 +476,12 @@ public class ThrCorpsDlService {
exportData.addAll(thrCorpEntities); exportData.addAll(thrCorpEntities);
} else { } else {
//根据查询条件一键导出数据库往来单位 //根据查询条件一键导出数据库往来单位
List<ThrCorpEntity> thrCorpEntityList=new ArrayList<>(); List<ThrCorpEntity> thrCorpEntityList = new ArrayList<>();
FilterThrCorpRequest filterThrCorpRequest = new FilterThrCorpRequest(); FilterThrCorpRequest filterThrCorpRequest = new FilterThrCorpRequest();
BeanUtils.copyProperties(thrCorpExportRequest, filterThrCorpRequest); BeanUtils.copyProperties(thrCorpExportRequest, filterThrCorpRequest);
filterThrCorpRequest.setPage(null); filterThrCorpRequest.setPage(null);
List<ThrCorpsResponse> thrCorpsResponseList = thrCorpService.filterThrCorps(filterThrCorpRequest); List<ThrCorpsResponse> thrCorpsResponseList = thrCorpService.filterThrCorps(filterThrCorpRequest);
if(thrCorpsResponseList.size()>0){ if (thrCorpsResponseList.size() > 0) {
thrCorpEntityList = thrCorpsResponseList.stream().map( thrCorpEntityList = thrCorpsResponseList.stream().map(
item -> { item -> {
ThrCorpEntity thrCorpEntity = new ThrCorpEntity(); ThrCorpEntity thrCorpEntity = new ThrCorpEntity();

@ -49,7 +49,7 @@ public interface ThrProductsService extends IService<ThrProductsEntity> {
* @param thirdSys * @param thirdSys
* @return * @return
*/ */
BaseResponse uploadPi(List<MultipartFile> files, String thirdSys); BaseResponse uploadPi(byte[] bytes, String fileName, String thirdSys);
/** /**
* *
@ -66,4 +66,12 @@ public interface ThrProductsService extends IService<ThrProductsEntity> {
* @return * @return
*/ */
BaseResponse downloadThrPi(ThrSystemDetailEntity thrSystemDetailEntity); BaseResponse downloadThrPi(ThrSystemDetailEntity thrSystemDetailEntity);
/**
*
*
* @param filterThrProductsRequest
* @return
*/
BaseResponse downloadByRequest(FilterThrProductsRequest filterThrProductsRequest);
} }

@ -34,7 +34,7 @@ import java.util.List;
@Slf4j @Slf4j
@Service @Service
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public class ThrBusTypeOriginServiceImpl extends ServiceImpl<ThrBusTypeOriginDao,ThrBusTypeOriginEntity> implements IThrBusTypeOriginService { public class ThrBusTypeOriginServiceImpl extends ServiceImpl<ThrBusTypeOriginDao, ThrBusTypeOriginEntity> implements IThrBusTypeOriginService {
@Resource @Resource
private CustomerService customerService; private CustomerService customerService;
@ -180,7 +180,7 @@ public class ThrBusTypeOriginServiceImpl extends ServiceImpl<ThrBusTypeOriginDao
if (baseResponse.getCode() == 20000) { if (baseResponse.getCode() == 20000) {
List<ThrSystemBusApiEntity> list = baseResponse.getData().getList(); List<ThrSystemBusApiEntity> list = baseResponse.getData().getList();
list.forEach(item -> { list.forEach(item -> {
ThrBusTypeOriginEntity thrBusTypeOriginEntity = thrBusTypeOriginDao.selectOne(new QueryWrapper<ThrBusTypeOriginEntity>().eq("code", item.getCode()).eq("thirdSys", thrSystemDetailEntity.getThirdSysFk())); ThrBusTypeOriginEntity thrBusTypeOriginEntity = thrBusTypeOriginDao.selectOne(new QueryWrapper<ThrBusTypeOriginEntity>().eq("action", item.getCode()).eq("thirdSys", thrSystemDetailEntity.getThirdSysFk()));
if (null == thrBusTypeOriginEntity) { if (null == thrBusTypeOriginEntity) {
thrBusTypeOriginEntity = new ThrBusTypeOriginEntity(); thrBusTypeOriginEntity = new ThrBusTypeOriginEntity();
BeanUtil.copyProperties(item, thrBusTypeOriginEntity); BeanUtil.copyProperties(item, thrBusTypeOriginEntity);

@ -1,6 +1,7 @@
package com.glxp.api.service.thrsys.impl; package com.glxp.api.service.thrsys.impl;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.IdUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.glxp.api.common.res.BaseResponse; import com.glxp.api.common.res.BaseResponse;
@ -47,11 +48,19 @@ public class ThrCorpServiceImpl extends ServiceImpl<ThrCorpDao, ThrCorpEntity> i
@Override @Override
public boolean insertThrCorps(ThrCorpEntity thrCorpEntity) { public boolean insertThrCorps(ThrCorpEntity thrCorpEntity) {
if (thrCorpEntity.getId() == null) {
thrCorpEntity.setId(IdUtil.getSnowflakeNextId());
}
return thrCorpDao.insertThrCorps(thrCorpEntity); return thrCorpDao.insertThrCorps(thrCorpEntity);
} }
@Override @Override
public boolean insertThrCorpss(List<ThrCorpEntity> thrCorpEntitys) { public boolean insertThrCorpss(List<ThrCorpEntity> thrCorpEntitys) {
for (ThrCorpEntity thrCorpEntity : thrCorpEntitys) {
if (thrCorpEntity.getId() == null) {
thrCorpEntity.setId(IdUtil.getSnowflakeNextId());
}
}
return thrCorpDao.insertThrCorpss(thrCorpEntitys); return thrCorpDao.insertThrCorpss(thrCorpEntitys);
} }
@ -125,7 +134,51 @@ public class ThrCorpServiceImpl extends ServiceImpl<ThrCorpDao, ThrCorpEntity> i
BeanUtil.copyProperties(thrCorpsResponse, thrCorpEntity); BeanUtil.copyProperties(thrCorpsResponse, thrCorpEntity);
thrCorpEntity.setCreateTime(new Date()); thrCorpEntity.setCreateTime(new Date());
thrCorpEntity.setUpdateTime(new Date()); thrCorpEntity.setUpdateTime(new Date());
thrCorpEntity.setId(null); thrCorpEntity.setId(IdUtil.getSnowflakeNextId());
thrCorpEntity.setThirdSysFk(thrSystemDetailEntity.getThirdSysFk());
thrCorpDao.insertThrCorps(thrCorpEntity);
} else {
boolean isChange = verifyDataChange(thrCorpEntity, thrCorpsResponse);
if (isChange) {
thrCorpEntity.setUpdateTime(new Date());
thrCorpDao.updateThrCorps(thrCorpEntity);
}
}
});
if (list.size() >= limit) {
page++;
} else {
break;
}
} else {
return baseResponse;
}
}
return ResultVOUtils.success("下载完成");
}
@Override
public BaseResponse downloadByRequest(ThrUnitMaintainFilterRequest request) {
int page = 1;
int limit = 100;
while (true) {
request.setPage(page);
request.setLimit(limit);
request.setThirdSysFk(request.getThirdSys());
BaseResponse<PageSimpleResponse<ThrCorpsResponse>> baseResponse = erpBasicClient.getErpCrop(request);
if (baseResponse.getCode() == 20000) {
List<ThrCorpsResponse> list = baseResponse.getData().getList();
list.forEach(thrCorpsResponse -> {
ThrCorpEntity thrCorpEntity = thrCorpDao.selectByUnitIdAndThirdId(thrCorpsResponse.getUnitId(), request.getThirdSys());
if (null == thrCorpEntity) {
thrCorpEntity = new ThrCorpEntity();
BeanUtil.copyProperties(thrCorpsResponse, thrCorpEntity);
thrCorpEntity.setCreateTime(new Date());
thrCorpEntity.setUpdateTime(new Date());
thrCorpEntity.setThirdSysFk(request.getThirdSys());
thrCorpEntity.setId(IdUtil.getSnowflakeNextId());
thrCorpDao.insertThrCorps(thrCorpEntity); thrCorpDao.insertThrCorps(thrCorpEntity);
} else { } else {
boolean isChange = verifyDataChange(thrCorpEntity, thrCorpsResponse); boolean isChange = verifyDataChange(thrCorpEntity, thrCorpsResponse);

@ -29,7 +29,7 @@ import java.util.List;
@Slf4j @Slf4j
@Service @Service
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public class ThrInvWarehouseServiceImpl extends ServiceImpl<ThrInvWarehouseDao,ThrInvWarehouseEntity> implements ThrInvWarehouseService { public class ThrInvWarehouseServiceImpl extends ServiceImpl<ThrInvWarehouseDao, ThrInvWarehouseEntity> implements ThrInvWarehouseService {
@Resource @Resource
private ThrInvWarehouseDao thrInvWarehouseDao; private ThrInvWarehouseDao thrInvWarehouseDao;

@ -130,8 +130,8 @@ public class ThrProductsServiceImpl extends ServiceImpl<ThrProductsDao, ThrProdu
} }
@Override @Override
public BaseResponse uploadPi(List<MultipartFile> files, String thirdSys) { public BaseResponse uploadPi(byte[] bytes, String fileName, String thirdSys) {
BaseResponse<PostThrProductsRequest> baseResponse = erpBasicClient.uploadPi(files, thirdSys); BaseResponse<PostThrProductsRequest> baseResponse = erpBasicClient.uploadPi(bytes, fileName, thirdSys);
if (baseResponse.getCode() == 20000) { if (baseResponse.getCode() == 20000) {
return ResultVOUtils.success("导入成功"); return ResultVOUtils.success("导入成功");
} else { } else {
@ -153,10 +153,11 @@ public class ThrProductsServiceImpl extends ServiceImpl<ThrProductsDao, ThrProdu
thrProductsEntity.setThirdSysFk(postThrProductsRequest.getThirdSys()); thrProductsEntity.setThirdSysFk(postThrProductsRequest.getThirdSys());
thrProductsEntity.setCreateTime(DateUtil.date(new Date())); thrProductsEntity.setCreateTime(DateUtil.date(new Date()));
thrProductsEntity.setUpdateTime(DateUtil.date(new Date())); thrProductsEntity.setUpdateTime(DateUtil.date(new Date()));
thrProductsEntity.setId(IdUtil.getSnowflakeNextId());
try { try {
mapper.insertThrProducts(thrProductsEntity); mapper.insertThrProducts(thrProductsEntity);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace();
log.error("", e); log.error("", e);
} }
}); });
@ -176,7 +177,6 @@ public class ThrProductsServiceImpl extends ServiceImpl<ThrProductsDao, ThrProdu
request.setLimit(limit); request.setLimit(limit);
while (true) { while (true) {
request.setPage(page); request.setPage(page);
BaseResponse<PageSimpleResponse<ThrProductsResponse>> baseResponse = erpBasicClient.getErpProducts(request); BaseResponse<PageSimpleResponse<ThrProductsResponse>> baseResponse = erpBasicClient.getErpProducts(request);
if (baseResponse.getCode() == 20000) { if (baseResponse.getCode() == 20000) {
List<ThrProductsResponse> list = baseResponse.getData().getList(); List<ThrProductsResponse> list = baseResponse.getData().getList();
@ -188,11 +188,12 @@ public class ThrProductsServiceImpl extends ServiceImpl<ThrProductsDao, ThrProdu
thrProductsEntity.setCreateTime(new Date()); thrProductsEntity.setCreateTime(new Date());
thrProductsEntity.setUpdateTime(new Date()); thrProductsEntity.setUpdateTime(new Date());
thrProductsEntity.setId(IdUtil.getSnowflakeNextId()); thrProductsEntity.setId(IdUtil.getSnowflakeNextId());
thrProductsEntity.setThirdSysFk(thrSystemDetailEntity.getThirdSysFk());
thrProductsDao.insertThrProducts(thrProductsEntity); thrProductsDao.insertThrProducts(thrProductsEntity);
} else { } else {
boolean isChange = verifyDataChange(thrProductsEntity, item); boolean isChange = verifyDataChange(thrProductsEntity, item);
if (isChange) { if (isChange) {
BeanUtil.copyProperties(item,thrProductsEntity,new CopyOptions().setIgnoreNullValue(true)); BeanUtil.copyProperties(item, thrProductsEntity, new CopyOptions().setIgnoreNullValue(true));
thrProductsEntity.setUpdateTime(new Date()); thrProductsEntity.setUpdateTime(new Date());
thrProductsDao.updateEntityById(thrProductsEntity); thrProductsDao.updateEntityById(thrProductsEntity);
} }
@ -212,6 +213,51 @@ public class ThrProductsServiceImpl extends ServiceImpl<ThrProductsDao, ThrProdu
return ResultVOUtils.success("下载成功"); return ResultVOUtils.success("下载成功");
} }
@Override
public BaseResponse downloadByRequest(FilterThrProductsRequest filterThrProductsRequest) {
int page = 1;
int limit = 200;
filterThrProductsRequest.setThirdSysFk(filterThrProductsRequest.getThirdSys());
filterThrProductsRequest.setLimit(limit);
log.error("开始下载-------");
while (true) {
log.error("下载分页-------" + page);
filterThrProductsRequest.setPage(page);
BaseResponse<PageSimpleResponse<ThrProductsResponse>> baseResponse = erpBasicClient.getErpProducts(filterThrProductsRequest);
if (baseResponse.getCode() == 20000) {
List<ThrProductsResponse> list = baseResponse.getData().getList();
list.forEach(item -> {
ThrProductsEntity thrProductsEntity = thrProductsDao.selectByCodeAndThird(item.getCode(), item.getThirdSys());
if (null == thrProductsEntity) {
thrProductsEntity = new ThrProductsEntity();
BeanUtil.copyProperties(item, thrProductsEntity);
thrProductsEntity.setCreateTime(new Date());
thrProductsEntity.setUpdateTime(new Date());
thrProductsEntity.setId(IdUtil.getSnowflakeNextId());
thrProductsEntity.setThirdSysFk(filterThrProductsRequest.getThirdSys());
thrProductsDao.insertThrProducts(thrProductsEntity);
} else {
boolean isChange = verifyDataChange(thrProductsEntity, item);
if (isChange) {
BeanUtil.copyProperties(item, thrProductsEntity, new CopyOptions().setIgnoreNullValue(true));
thrProductsEntity.setUpdateTime(new Date());
thrProductsDao.updateEntityById(thrProductsEntity);
}
}
});
if (list.size() >= limit) {
page++;
} else {
break;
}
} else {
return ResultVOUtils.error(500, "下载第三方系统产品信息异常");
}
}
log.error("下载结束-------");
return ResultVOUtils.success("下载成功");
}
/** /**
* *
* *

@ -6,8 +6,12 @@ import cn.hutool.core.thread.ThreadUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
import com.glxp.api.constant.ThirdSysConstant; import com.glxp.api.constant.ThirdSysConstant;
import com.glxp.api.dao.schedule.ScheduledDao;
import com.glxp.api.dao.system.SyncDataSetDao;
import com.glxp.api.dao.thrsys.ThrSystemDetailDao; import com.glxp.api.dao.thrsys.ThrSystemDetailDao;
import com.glxp.api.entity.system.ScheduledEntity;
import com.glxp.api.entity.thrsys.ThrSystemDetailEntity; import com.glxp.api.entity.thrsys.ThrSystemDetailEntity;
import com.glxp.api.req.system.ScheduledRequest;
import com.glxp.api.res.thrsys.ThirdSysInterfaceExecuteVo; import com.glxp.api.res.thrsys.ThirdSysInterfaceExecuteVo;
import com.glxp.api.service.inout.IoOrderService; import com.glxp.api.service.inout.IoOrderService;
import com.glxp.api.service.thrsys.IThrBusTypeOriginService; import com.glxp.api.service.thrsys.IThrBusTypeOriginService;
@ -16,7 +20,12 @@ import com.glxp.api.service.thrsys.ThrInvWarehouseService;
import com.glxp.api.service.thrsys.ThrProductsService; import com.glxp.api.service.thrsys.ThrProductsService;
import com.glxp.api.util.RedisUtil; import com.glxp.api.util.RedisUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled; 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 org.springframework.stereotype.Component;
import javax.annotation.Resource; import javax.annotation.Resource;
@ -24,13 +33,10 @@ import java.util.*;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
/**
*
* 线
*/
@Slf4j
@Component @Component
public class ThirdSysInterfaceTask { @EnableScheduling
@Slf4j
public class SyncThirdSysTask implements SchedulingConfigurer {
/** /**
* redis key * redis key
@ -39,21 +45,6 @@ public class ThirdSysInterfaceTask {
private volatile ExecutorService executor; private volatile ExecutorService executor;
/**
* 线
*
* @return
*/
private ExecutorService getExecutor() {
if (null == executor) {
synchronized (this) {
log.info("初始化第三方系统接口执行线程池");
executor = ThreadUtil.newExecutor(10, 100, Integer.MAX_VALUE);
}
}
return executor;
}
@Resource @Resource
private RedisUtil redisUtil; private RedisUtil redisUtil;
@Resource @Resource
@ -69,8 +60,46 @@ public class ThirdSysInterfaceTask {
@Resource @Resource
private IoOrderService orderService; private IoOrderService orderService;
@Scheduled(fixedRate = 20 * 1000, initialDelay = 60 * 1000)
public void scanInterface() { final Logger logger = LoggerFactory.getLogger(SyncHeartTask.class);
@Resource
protected ScheduledDao scheduledDao;
@Resource
private SyncDataSetDao syncDataSetDao;
@Override
public void configureTasks(ScheduledTaskRegistrar scheduledTaskRegistrar) {
scheduledTaskRegistrar.addTriggerTask(() -> process(),
triggerContext -> {
ScheduledRequest scheduledRequest = new ScheduledRequest();
scheduledRequest.setCronName("dlThrSysHeartTask");
ScheduledEntity scheduledEntity = scheduledDao.findScheduled(scheduledRequest);
if (scheduledEntity != null) {
String cron = scheduledEntity.getCron();
if (cron.isEmpty()) {
logger.error("cron is null");
}
return new CronTrigger(cron).nextExecutionTime(triggerContext);
} else
return null;
});
}
private ExecutorService getExecutor() {
if (null == executor) {
synchronized (this) {
log.info("初始化第三方系统接口执行线程池");
executor = ThreadUtil.newExecutor(10, 100, Integer.MAX_VALUE);
}
}
return executor;
}
private void process() {
log.info("开始扫描自动执行的第三方接口列表"); log.info("开始扫描自动执行的第三方接口列表");
List<ThrSystemDetailEntity> list = thrSystemDetailDao.selectAutoExecuteList(); List<ThrSystemDetailEntity> list = thrSystemDetailDao.selectAutoExecuteList();
if (CollUtil.isNotEmpty(list)) { if (CollUtil.isNotEmpty(list)) {
@ -107,6 +136,7 @@ public class ThirdSysInterfaceTask {
} }
} }
/** /**
* *
* *
@ -243,11 +273,20 @@ public class ThirdSysInterfaceTask {
return false; return false;
} }
long nextTime = DateUtil.offsetMonth(new Date(), thrSystemDetailEntity.getTime()).getTime(); long nextTime = DateUtil.offsetMonth(new Date(), thrSystemDetailEntity.getTime()).getTime();
vo = Optional.ofNullable(vo).orElse(new ThirdSysInterfaceExecuteVo()); if (vo != null) {
vo.setKey(taskKey); if (vo.getNextTime() - new Date().getTime() > thrSystemDetailEntity.getTime() * 1000 * 60) {
vo.setNextTime(nextTime); log.info("定时任务时间未到", taskKey);
vo.setFinished(false); return false;
redisUtil.set(taskKey, vo); } else {
return true;
}
} else {
vo = Optional.ofNullable(vo).orElse(new ThirdSysInterfaceExecuteVo());
vo.setKey(taskKey);
vo.setNextTime(nextTime);
vo.setFinished(false);
redisUtil.set(taskKey, vo);
}
return true; return true;
} }
@ -288,4 +327,5 @@ public class ThirdSysInterfaceTask {
return key; return key;
} }
} }

@ -26,12 +26,12 @@
</select> </select>
<insert id="insertThrCorps" keyProperty="id" parameterType="com.glxp.api.entity.thrsys.ThrCorpEntity"> <insert id="insertThrCorps" parameterType="com.glxp.api.entity.thrsys.ThrCorpEntity">
replace replace
INTO thr_corp INTO thr_corp
(unitId, name, spell, addr, creditNo, (id, unitId, name, spell, addr, creditNo,
contact, mobile, thirdSysFk, updateTime, createUser, createTime, updateUser, remark) contact, mobile, thirdSysFk, updateTime, createUser, createTime, updateUser, remark)
values (#{unitId}, values (#{id}, #{unitId},
#{name}, #{name},
#{spell}, #{spell},
#{addr}, #{addr},
@ -48,13 +48,13 @@
<insert id="insertThrCorpss" keyProperty="id" parameterType="java.util.List"> <insert id="insertThrCorpss" keyProperty="id" parameterType="java.util.List">
replace INTO thr_corp replace INTO thr_corp
(unitId, name, spell, addr, creditNo, (id, unitId, name, spell, addr, creditNo,
contact, mobile, thirdSysFk, updateTime, createUser, createTime, updateUser, remark) contact, mobile, thirdSysFk, updateTime, createUser, createTime, updateUser, remark)
values values
<foreach collection="thrCorpEntitys" item="item" index="index" <foreach collection="thrCorpEntitys" item="item" index="index"
separator=","> separator=",">
(#{item.unitId}, (#{item.id}, #{item.unitId},
#{item.name}, #{item.name},
#{item.spell}, #{item.spell},
#{item.addr}, #{item.addr},
@ -134,8 +134,8 @@
<insert id="importThrCorp" parameterType="com.glxp.api.entity.thrsys.ThrCorpEntity"> <insert id="importThrCorp" parameterType="com.glxp.api.entity.thrsys.ThrCorpEntity">
replace replace
into thr_corp (unitId, spell, addr, creditNo, contact, mobile, thirdSysFk, name, updateTime, createUser, into thr_corp (unitId, spell, addr, creditNo, contact, mobile, thirdSysFk, name, updateTime, createUser,
createTime, updateUser, remark) createTime, updateUser, remark)
values (#{unitId}, values (#{unitId},
#{spell}, #{spell},
#{addr}, #{addr},
@ -183,7 +183,7 @@
resultType="com.glxp.api.entity.thrsys.ThrSystemDetailEntity"> resultType="com.glxp.api.entity.thrsys.ThrSystemDetailEntity">
select basic_third_sys_detail.*, basic_third_sys.thridUrl select basic_third_sys_detail.*, basic_third_sys.thridUrl
FROM basic_third_sys_detail FROM basic_third_sys_detail
inner join basic_third_sys on basic_third_sys_detail.thirdSysFk = basic_third_sys.thirdId inner join basic_third_sys on basic_third_sys_detail.thirdSysFk = basic_third_sys.thirdId
WHERE basic_third_sys_detail.key = #{key} WHERE basic_third_sys_detail.key = #{key}
and basic_third_sys_detail.thirdSysFk = #{thirdSys} and basic_third_sys_detail.thirdSysFk = #{thirdSys}
and basic_third_sys.enabled = 1 and basic_third_sys.enabled = 1
@ -214,4 +214,4 @@
</if> </if>
</where> </where>
</select> </select>
</mapper> </mapper>

@ -41,27 +41,33 @@
<select id="selectByThrDeptCode" parameterType="com.glxp.api.req.thrsys.FilterThrSubInvWarehouseRequest" <select id="selectByThrDeptCode" parameterType="com.glxp.api.req.thrsys.FilterThrSubInvWarehouseRequest"
resultType="com.glxp.api.entity.thrsys.ThrInvWarehouseEntity"> resultType="com.glxp.api.entity.thrsys.ThrInvWarehouseEntity">
select * from thr_inv_warehouse select *
<where> from thr_inv_warehouse
parentId not in (SELECT code FROM thr_dept <where>
where status=#{status} and thirdSysFk=#{thirdSysFk}) and thirdSysFk=#{thirdSysFk} parentId not in (SELECT code
<if test=" name != '' and name != null"> FROM thr_dept
and name like concat('%',#{name},'%') where status = #{status}
</if> and thirdSysFk = #{thirdSysFk})
</where> and thirdSysFk = #{thirdSysFk}
<if test="name != '' and name != null">
and name like concat('%', #{name}, '%')
</if>
</where>
</select> </select>
<select id="countSubInvByParentInvId" resultType="java.lang.Integer"> <select id="countSubInvByParentInvId" resultType="java.lang.Integer">
select count(*) from thr_inv_warehouse where select count(*)
parentId = (select code from thr_dept where id = #{parentInvId}) from thr_inv_warehouse
where parentId = (select code from thr_dept where id = #{parentInvId})
</select> </select>
<select id="filterThrInvWarehouseResponse" <select id="filterThrInvWarehouseResponse"
resultType="com.glxp.api.res.thrsys.ThrInvWarehouseResponse"> resultType="com.glxp.api.res.thrsys.ThrInvWarehouseResponse">
select t1.*, t2.name as parentName from thr_inv_warehouse t1 select t1.*, t2.name as parentName
left join thr_dept t2 from thr_inv_warehouse t1
on t2.code =t1.parentId left join thr_dept t2
on t2.code = t1.parentId
<where> <where>
<if test="id != '' and id != null"> <if test="id != '' and id != null">
AND t1.id = #{id} AND t1.id = #{id}
@ -84,29 +90,26 @@
<insert id="insertThrInvWarehouse" keyProperty="id" <insert id="insertThrInvWarehouse" keyProperty="id"
parameterType="com.glxp.api.entity.thrsys.ThrInvWarehouseEntity"> parameterType="com.glxp.api.entity.thrsys.ThrInvWarehouseEntity">
replace replace
INTO thr_inv_warehouse INTO thr_inv_warehouse
(id, code, `name`, parentId, remark, thirdSysFk, updateTime) (id, code, `name`, parentId, remark, thirdSysFk, updateTime)
values ( values (#{id},
#{id}, #{code},
#{code}, #{name},
#{name}, #{parentId},
#{parentId}, #{remark},
#{remark}, #{thirdSysFk},
#{thirdSysFk}, #{updateTime})
#{updateTime}
)
</insert> </insert>
<insert id="insertThrInvWarehouses" parameterType="java.util.List"> <insert id="insertThrInvWarehouses" parameterType="java.util.List">
replace INTO thr_inv_warehouse replace INTO thr_inv_warehouse
(id, code, `name`, parentId, remark, thirdSysFk,updateTime) (id, code, `name`, parentId, remark, thirdSysFk, updateTime)
VALUES VALUES
<foreach collection="thrInvWarehouseEntitys" item="item" index="index" <foreach collection="thrInvWarehouseEntitys" item="item" index="index"
separator=","> separator=",">
( (#{item.id}, #{item.code},
#{item.id}, #{item.code}, #{item.name}, #{item.parentId},
#{item.name}, #{item.parentId}, #{item.remark}, #{item.thirdSysFk}, #{item.updateTime})
#{item.remark}, #{item.thirdSysFk}, #{item.updateTime})
</foreach> </foreach>
</insert> </insert>
@ -119,18 +122,32 @@
<update id="updateThrInvWarehouse" parameterType="com.glxp.api.entity.thrsys.ThrInvWarehouseEntity"> <update id="updateThrInvWarehouse" parameterType="com.glxp.api.entity.thrsys.ThrInvWarehouseEntity">
UPDATE thr_inv_warehouse UPDATE thr_inv_warehouse
<trim prefix="set" suffixOverrides=","> <trim prefix="set" suffixOverrides=",">
<if test="name != null">`name`=#{name},</if> <if test="name != null">
<if test="code != null">code=#{code},</if> `name`=#{name},
<if test="parentId != null">parentId=#{parentId},</if> </if>
<if test="remark != null">remark=#{remark},</if> <if test="code != null">
<if test="thirdSysFk != null">thirdSysFk=#{thirdSysFk},</if> code=#{code},
<if test="updateTime != null">updateTime=#{updateTime},</if> </if>
<if test="parentId != null">
parentId=#{parentId},
</if>
<if test="remark != null">
remark=#{remark},
</if>
<if test="thirdSysFk != null">
thirdSysFk=#{thirdSysFk},
</if>
<if test="updateTime != null">
updateTime=#{updateTime},
</if>
</trim> </trim>
WHERE id = #{id} WHERE id = #{id}
</update> </update>
<select id="selectByLastTime" resultType="com.glxp.api.entity.thrsys.ThrInvWarehouseEntity"> <select id="selectByLastTime" resultType="com.glxp.api.entity.thrsys.ThrInvWarehouseEntity">
select * from thr_inv_warehouse where updateTime >= #{lastUpdateTime} select *
from thr_inv_warehouse
where updateTime >= #{lastUpdateTime}
</select> </select>
<select id="selectByCodeAndThirdId" resultType="com.glxp.api.entity.thrsys.ThrInvWarehouseEntity"> <select id="selectByCodeAndThirdId" resultType="com.glxp.api.entity.thrsys.ThrInvWarehouseEntity">
@ -144,5 +161,6 @@
AND thirdSysFk = #{thirdId} AND thirdSysFk = #{thirdId}
</if> </if>
</where> </where>
limit 1
</select> </select>
</mapper> </mapper>

@ -444,9 +444,31 @@ CALL Pro_Temp_ColumnWork('io_code', 'preInSpaceCode', 'varchar(255)', 1);
CALL Pro_Temp_ColumnWork('pur_order_detail', 'price', 'decimal(10, 2)', 1); CALL Pro_Temp_ColumnWork('pur_order_detail', 'price', 'decimal(10, 2)', 1);
INSERT ignore INTO `sys_pdf_template_relevance_label`(`id`, `templateId`, `customerId`, `adminId`, `moduleId`, `localAction`, `remark1`, `remark2`, `remark3`, `printType`, `modelKey`) VALUES (1, 30, 110, 0, 9, '内部码打印', NULL, NULL, NULL, NULL, 'lable'); INSERT ignore INTO `sys_pdf_template_relevance_label`(`id`, `templateId`, `customerId`, `adminId`, `moduleId`,
INSERT ignore INTO `sys_pdf_template_relevance_statemen`(`id`, `templateId`, `customerId`, `adminId`, `moduleId`, `localAction`, `remark1`, `remark2`, `remark3`, `printType`, `modelKey`) VALUES (1, 31, 110, 0, NULL, '配送企业资质打印', NULL, NULL, NULL, NULL, 'reportForms'); `localAction`, `remark1`, `remark2`, `remark3`, `printType`,
INSERT ignore INTO `sys_pdf_template_relevance_statemen`(`id`, `templateId`, `customerId`, `adminId`, `moduleId`, `localAction`, `remark1`, `remark2`, `remark3`, `printType`, `modelKey`) VALUES (2, 32, 110, 0, NULL, '生产企业资质打印', NULL, NULL, NULL, NULL, 'reportForms'); `modelKey`)
INSERT ignore INTO `sys_pdf_template_relevance_statemen`(`id`, `templateId`, `customerId`, `adminId`, `moduleId`, `localAction`, `remark1`, `remark2`, `remark3`, `printType`, `modelKey`) VALUES (3, 33, 110, 0, NULL, '配送产品资质打印', NULL, NULL, NULL, NULL, 'reportForms'); VALUES (1, 30, 110, 0, 9, '内部码打印', NULL, NULL, NULL, NULL, 'lable');
INSERT ignore INTO `sys_pdf_template_relevance_statemen`(`id`, `templateId`, `customerId`, `adminId`, `moduleId`, `localAction`, `remark1`, `remark2`, `remark3`, `printType`, `modelKey`) VALUES (4, 33, 110, 0, NULL, '库存报表打印', NULL, NULL, NULL, NULL, 'reportForms'); INSERT ignore INTO `sys_pdf_template_relevance_statemen`(`id`, `templateId`, `customerId`, `adminId`, `moduleId`,
INSERT ignore INTO `sys_pdf_template_relevance_statemen`(`id`, `templateId`, `customerId`, `adminId`, `moduleId`, `localAction`, `remark1`, `remark2`, `remark3`, `printType`, `modelKey`) VALUES (5, 33, 110, 0, NULL, '内部码报表打印', NULL, NULL, NULL, NULL, 'reportForms'); `localAction`, `remark1`, `remark2`, `remark3`, `printType`,
`modelKey`)
VALUES (1, 31, 110, 0, NULL, '配送企业资质打印', NULL, NULL, NULL, NULL, 'reportForms');
INSERT ignore INTO `sys_pdf_template_relevance_statemen`(`id`, `templateId`, `customerId`, `adminId`, `moduleId`,
`localAction`, `remark1`, `remark2`, `remark3`, `printType`,
`modelKey`)
VALUES (2, 32, 110, 0, NULL, '生产企业资质打印', NULL, NULL, NULL, NULL, 'reportForms');
INSERT ignore INTO `sys_pdf_template_relevance_statemen`(`id`, `templateId`, `customerId`, `adminId`, `moduleId`,
`localAction`, `remark1`, `remark2`, `remark3`, `printType`,
`modelKey`)
VALUES (3, 33, 110, 0, NULL, '配送产品资质打印', NULL, NULL, NULL, NULL, 'reportForms');
INSERT ignore INTO `sys_pdf_template_relevance_statemen`(`id`, `templateId`, `customerId`, `adminId`, `moduleId`,
`localAction`, `remark1`, `remark2`, `remark3`, `printType`,
`modelKey`)
VALUES (4, 33, 110, 0, NULL, '库存报表打印', NULL, NULL, NULL, NULL, 'reportForms');
INSERT ignore INTO `sys_pdf_template_relevance_statemen`(`id`, `templateId`, `customerId`, `adminId`, `moduleId`,
`localAction`, `remark1`, `remark2`, `remark3`, `printType`,
`modelKey`)
VALUES (5, 33, 110, 0, NULL, '内部码报表打印', NULL, NULL, NULL, NULL, 'reportForms');
INSERT ignore INTO `sys_scheduled`(`id`, `cronName`, `cron`, `customerId`, `remark`)
VALUES (140, 'dlThrSysHeartTask', '0 0/1 * * * ?', NULL, '第三方接口同步心跳');

Loading…
Cancel
Save