1.添加下载第三方单据类型逻辑

master
x_z 2 years ago
parent ec9c295e03
commit 2d98bd3651

@ -1,5 +1,6 @@
package com.glxp.api.service.thrsys.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@ -8,9 +9,12 @@ import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.common.util.ResultVOUtils;
import com.glxp.api.dao.thrsys.ThrBusTypeOriginDao;
import com.glxp.api.entity.thrsys.ThrBusTypeOriginEntity;
import com.glxp.api.entity.thrsys.ThrSystemBusApiEntity;
import com.glxp.api.entity.thrsys.ThrSystemDetailEntity;
import com.glxp.api.http.ErpBasicClient;
import com.glxp.api.req.thrsys.FilterBasicThirdSysDetailRequest;
import com.glxp.api.req.thrsys.FilterThrBusTypeOriginRequest;
import com.glxp.api.res.PageSimpleResponse;
import com.glxp.api.res.thrsys.ThrBusTypeOriginResponse;
import com.glxp.api.service.auth.CustomerService;
import com.glxp.api.service.thrsys.IThrBusTypeOriginService;
@ -163,14 +167,52 @@ public class ThrBusTypeOriginServiceImpl implements IThrBusTypeOriginService {
public BaseResponse downloadThrBusType(ThrSystemDetailEntity thrSystemDetailEntity) {
int page = 1;
int limit = 100;
/*while (true) {
while (true) {
FilterBasicThirdSysDetailRequest request = new FilterBasicThirdSysDetailRequest();
request.setPage(page);
request.setLimit(limit);
request.setThirdSysFk(thrSystemDetailEntity.getThirdSysFk());
erpBasicClient.getBusTypes(request);
}*/
BaseResponse<PageSimpleResponse<ThrSystemBusApiEntity>> baseResponse = erpBasicClient.getBusTypes(request);
if (baseResponse.getCode() == 20000) {
List<ThrSystemBusApiEntity> list = baseResponse.getData().getList();
list.forEach(item -> {
ThrBusTypeOriginEntity thrBusTypeOriginEntity = thrBusTypeOriginDao.selectOne(new QueryWrapper<ThrBusTypeOriginEntity>().eq("code", item.getCode()).eq("thirdSys", thrSystemDetailEntity.getThirdSysFk()));
if (null == thrBusTypeOriginEntity) {
thrBusTypeOriginEntity = new ThrBusTypeOriginEntity();
BeanUtil.copyProperties(item, thrBusTypeOriginEntity);
thrBusTypeOriginEntity.setUpdateTime(new Date());
thrBusTypeOriginEntity.setThirdSys(thrBusTypeOriginEntity.getThirdSys());
thrBusTypeOriginDao.insertBusOriginType(thrBusTypeOriginEntity);
} else {
boolean isChange = verifyDataChange(thrBusTypeOriginEntity, item);
if (isChange) {
thrBusTypeOriginDao.updateById(thrBusTypeOriginEntity);
}
}
});
if (list.size() >= limit) {
page++;
} else {
break;
}
} else {
log.error("下载第三方系统单据类型异常", baseResponse.getMessage());
return ResultVOUtils.error(500, "下载第三方系统单据类型异常");
}
}
return ResultVOUtils.success("下载完成");
}
/**
*
*
* @param thrBusTypeOriginEntity
* @param thrSystemBusApi
* @return
*/
private boolean verifyDataChange(ThrBusTypeOriginEntity thrBusTypeOriginEntity, ThrSystemBusApiEntity thrSystemBusApi) {
return false;
}
}

@ -118,7 +118,7 @@ public class ThrCorpServiceImpl implements ThrCorpService {
if (baseResponse.getCode() == 20000) {
List<ThrCorpsResponse> list = baseResponse.getData().getList();
list.parallelStream().forEach(thrCorpsResponse -> {
list.forEach(thrCorpsResponse -> {
ThrCorpEntity thrCorpEntity = thrCorpDao.selectByUnitIdAndThirdId(thrCorpsResponse.getUnitId(), thrSystemDetailEntity.getThirdSysFk());
if (null == thrCorpEntity) {
thrCorpEntity = new ThrCorpEntity();

@ -142,7 +142,7 @@ public class ThrInvWarehouseServiceImpl implements ThrInvWarehouseService {
BaseResponse<PageSimpleResponse<UdiwmsWarehouseDetail>> baseResponse = erpBasicClient.getWarehouse(udiwmsWarehouseRequest);
if (baseResponse.getCode() == 20000) {
List<UdiwmsWarehouseDetail> list = baseResponse.getData().getList();
list.parallelStream().forEach(udiwmsWarehouseDetail -> {
list.forEach(udiwmsWarehouseDetail -> {
//查询此编码对应的仓库是否存在,若不存在,则直接插入,存在则判断数据是否有更新,有更新则更新此数据
ThrInvWarehouseEntity thrInvWarehouseEntity = thrInvWarehouseDao.selectByCodeAndThirdId(udiwmsWarehouseDetail.getCode(), thrSystemDetailEntity.getThirdSysFk());
if (null == thrInvWarehouseEntity) {

@ -139,6 +139,7 @@ public class ThrProductsServiceImpl implements ThrProductsService {
list.forEach(item -> {
ThrProductsEntity thrProductsEntity = new ThrProductsEntity();
BeanUtil.copyProperties(item, thrProductsEntity);
thrProductsEntity.setSpec(thrProductsEntity.getStandard()); //复制规格型号值
thrProductsEntity.setThirdSysFk(postThrProductsRequest.getThirdSys());
thrProductsEntity.setCreateTime(DateUtil.date(new Date()));
thrProductsEntity.setUpdateTime(DateUtil.date(new Date()));

Loading…
Cancel
Save