|
|
|
@ -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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|