第三方仓库,分库同步问题

fengcang
anthonyywj2 3 years ago
parent 5b244815ba
commit 3e52f7c95f

@ -99,6 +99,7 @@ public class ThrInvWarehouseController {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
}
thrInvWarehouseEntity.setPid(null); // 不能修改父级 pid
thrInvWarehouseEntity.setUpdateTime(new Date());
boolean b = thrInvWarehouseService.updateInvWarehouse(thrInvWarehouseEntity);
if (!b) {
return ResultVOUtils.error(ResultEnum.NOT_NETWORK);

@ -11,6 +11,7 @@ import com.glxp.api.admin.req.inventory.FilterInvSubWarehouseRequest;
import com.glxp.api.admin.req.thrsys.FilterThrInvWarehouseRequest;
import com.glxp.api.admin.req.thrsys.FilterThrSubInvWarehouseRequest;
import com.glxp.api.admin.res.PageSimpleResponse;
import com.glxp.api.admin.service.thrsys.ThrInvWarehouseService;
import com.glxp.api.admin.service.thrsys.ThrSubInvWarehouseService;
import com.glxp.api.common.enums.ResultEnum;
import com.glxp.api.common.res.BaseResponse;
@ -23,6 +24,7 @@ import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.Date;
import java.util.List;
@RestController
@ -30,6 +32,8 @@ public class ThrSubInvWarehouseController {
@Resource
ThrSubInvWarehouseService thrSubInvWarehouseService;
@Resource
ThrInvWarehouseService thrInvWarehouseService;
@GetMapping("/thirdSys/sub/inv/warehouse/filter")
public BaseResponse filterInvWarehouse(FilterThrSubInvWarehouseRequest filterThrSubInvWarehouseRequest) {
@ -59,6 +63,10 @@ public class ThrSubInvWarehouseController {
}
invSubWarehouseEntity.setId(IdUtil.getSnowflake(6, 1).nextId() + "");
boolean b = thrSubInvWarehouseService.insertThrInvWarehouse(invSubWarehouseEntity);
ThrInvWarehouseEntity thrInvWarehouseEntity = thrInvWarehouseService.selectByCode(invSubWarehouseEntity.getParentId(), invSubWarehouseEntity.getThirdSysFk());
thrInvWarehouseEntity.setUpdateTime(new Date());
thrInvWarehouseService.updateInvWarehouse(thrInvWarehouseEntity);
if (!b) {
return ResultVOUtils.error(ResultEnum.NOT_NETWORK);
}
@ -81,6 +89,11 @@ public class ThrSubInvWarehouseController {
return ResultVOUtils.error(ResultEnum.NOT_NETWORK);
}
ThrInvWarehouseEntity thrInvWarehouseEntity = thrInvWarehouseService.selectByCode(invSubWarehouseEntity.getParentId(), invSubWarehouseEntity.getThirdSysFk());
thrInvWarehouseEntity.setUpdateTime(new Date());
thrInvWarehouseService.updateInvWarehouse(thrInvWarehouseEntity);
return ResultVOUtils.success("修改成功!");
}
@ -92,6 +105,12 @@ public class ThrSubInvWarehouseController {
if (deleteRequest.getId() == null) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
}
ThrSubInvWarehouseEntity thrSubInvWarehouseEntity = thrSubInvWarehouseService.selectById(deleteRequest.getId());
ThrInvWarehouseEntity thrInvWarehouseEntity = thrInvWarehouseService.selectByCode(thrSubInvWarehouseEntity.getParentId(), thrSubInvWarehouseEntity.getThirdSysFk());
thrInvWarehouseEntity.setUpdateTime(new Date());
thrInvWarehouseService.updateInvWarehouse(thrInvWarehouseEntity);
boolean b = thrSubInvWarehouseService.deleteById(deleteRequest.getId());
if (!b) {
return ResultVOUtils.error(ResultEnum.NOT_NETWORK);

@ -16,7 +16,7 @@ public interface ThrSubInvWarehouseDao {
boolean insertThrInvWarehouse(ThrSubInvWarehouseEntity thrInvWarehouseEntity);
boolean insertInvWarehouses(@Param("thrInvWarehouseEntitys") List<ThrSubInvWarehouseEntity> thrInvWarehouseEntitys);
boolean insertThrInvWarehouses(@Param("thrInvWarehouseEntitys") List<ThrSubInvWarehouseEntity> thrInvWarehouseEntitys);
boolean updateThrInvWarehouse(ThrSubInvWarehouseEntity thrInvWarehouseEntity);

@ -23,6 +23,7 @@ public class SpsSyncDataResponse {
List<UdiInfoEntity> udiInfoEntities;
List<BasicUnitMaintainEntity> basicUnitMaintainEntities;
List<ThrInvWarehouseEntity> thrInvWarehouseEntities;
List<ThrSubInvWarehouseEntity> thrSubInvWarehouseEntities;
List<ThrCorpEntity> thrCorpEntities;
List<ThrProductsEntity> thrProductsEntities;
List<ThrOrderDetailEntity> thrOrderDetailEntities;

@ -8,6 +8,7 @@ import java.util.List;
public interface ThrSubInvWarehouseService {
ThrSubInvWarehouseEntity selectById(String id);
ThrSubInvWarehouseEntity selectByThrCode(String thirdSys, String thirdId);

@ -1,6 +1,7 @@
package com.glxp.api.admin.service.thrsys.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.github.pagehelper.PageHelper;
import com.glxp.api.admin.dao.thrsys.ThrSubInvWarehouseDao;
import com.glxp.api.admin.entity.thrsys.ThrSubInvWarehouseEntity;
@ -19,6 +20,20 @@ public class ThrSubInvWarehouseServiceImpl implements ThrSubInvWarehouseService
ThrSubInvWarehouseDao thrSubInvWarehouseDao;
@Override
public ThrSubInvWarehouseEntity selectById(String id) {
if (StrUtil.isEmpty(id)) {
return null;
}
FilterThrSubInvWarehouseRequest filterThrSubInvWarehouseRequest = new FilterThrSubInvWarehouseRequest();
filterThrSubInvWarehouseRequest.setId(id);
List<ThrSubInvWarehouseEntity> thrSubInvWarehouseEntities = thrSubInvWarehouseDao.filterThrInvWarehouse(filterThrSubInvWarehouseRequest);
if (CollUtil.isNotEmpty(thrSubInvWarehouseEntities)) {
return thrSubInvWarehouseEntities.get(0);
}
return null;
}
@Override
public ThrSubInvWarehouseEntity selectByThrCode(String thirdSys, String thirdId) {
FilterThrSubInvWarehouseRequest filterThrSubInvWarehouseRequest = new FilterThrSubInvWarehouseRequest();
@ -49,7 +64,7 @@ public class ThrSubInvWarehouseServiceImpl implements ThrSubInvWarehouseService
@Override
public boolean insertInvWarehouses(List<ThrSubInvWarehouseEntity> thrInvWarehouseEntitys) {
return thrSubInvWarehouseDao.insertInvWarehouses(thrInvWarehouseEntitys);
return thrSubInvWarehouseDao.insertThrInvWarehouses(thrInvWarehouseEntitys);
}
@Override

@ -94,7 +94,7 @@ public class HeartService {
return ResultVOUtils.success();
}
public BaseResponse uploadAllBus(String syncTime) {
public BaseResponse uploadAllBus(String syncTime) {
SpsSyncDataRequest spsSyncDataRequest = new SpsSyncDataRequest();
if (syncTime == null) {
BasicExportStatusTimeEntity basicExportStatusTimeEntity = basicExportTimeService.findByKey(ConstantStatus.SYNC_BUS_TYPE);
@ -226,6 +226,8 @@ public class HeartService {
logs = logs + "分库信息:" + syncDataResponse.getInvSubWarehouseEntities().size() + "条\n";
if (CollUtil.isNotEmpty(syncDataResponse.getThrInvWarehouseEntities()))
logs = logs + "第三方仓库字典:" + syncDataResponse.getThrInvWarehouseEntities().size() + "条\n";
if (CollUtil.isNotEmpty(syncDataResponse.getThrSubInvWarehouseEntities()))
logs = logs + "第三方仓库分库字典:" + syncDataResponse.getThrSubInvWarehouseEntities().size() + "条\n";
if (CollUtil.isNotEmpty(syncDataResponse.getThrOrderEntities()))
logs = logs + "第三方业务单据:" + syncDataResponse.getThrOrderEntities().size() + "条\n";
if (CollUtil.isNotEmpty(syncDataResponse.getThrProductsEntities()))

@ -58,6 +58,8 @@ public class UpBasicService {
@Resource
ThrInvWarehouseService thrInvWarehouseService;
@Resource
ThrSubInvWarehouseService thrSubInvWarehouseService;
@Resource
ThrCorpService thrCorpService;
@Resource
ThrProductsService thrProductsService;
@ -92,7 +94,6 @@ public class UpBasicService {
//仓库字典
if (syncDataSetEntity.isBasicInv()) {
//仓库字典
FilterInvWarehouseRequest filterInvWarehouseRequest = new FilterInvWarehouseRequest();
BeanUtils.copyProperties(spsSyncDataRequest, filterInvWarehouseRequest);
@ -170,6 +171,22 @@ public class UpBasicService {
BeanUtils.copyProperties(spsSyncDataRequest, filterThrInvWarehouseRequest);
List<ThrInvWarehouseEntity> thrInvWarehouseEntities = thrInvWarehouseService.filterThrInvWarehouse(filterThrInvWarehouseRequest);
syncDataResponse.setThrInvWarehouseEntities(thrInvWarehouseEntities);
List<ThrSubInvWarehouseEntity> resultThrSubInvWarehouseEntities = new ArrayList<>();
if (CollUtil.isNotEmpty(thrInvWarehouseEntities)) {
for (ThrInvWarehouseEntity thrInvWarehouseEntity : thrInvWarehouseEntities) {
FilterThrSubInvWarehouseRequest filterThrSubInvWarehouseRequest = new FilterThrSubInvWarehouseRequest();
filterThrSubInvWarehouseRequest.setParentId(thrInvWarehouseEntity.getCode());
filterThrInvWarehouseRequest.setThirdSysFk(thrInvWarehouseEntity.getThirdSysFk());
List<ThrSubInvWarehouseEntity> thrSubInvWarehouseEntities = thrSubInvWarehouseService.filterThrInvWarehouse(filterThrSubInvWarehouseRequest);
if (CollUtil.isNotEmpty(thrSubInvWarehouseEntities))
resultThrSubInvWarehouseEntities.addAll(thrSubInvWarehouseEntities);
}
}
syncDataResponse.setThrSubInvWarehouseEntities(resultThrSubInvWarehouseEntities);
}
//第三方往来单位

@ -55,8 +55,8 @@
<foreach collection="thrInvWarehouseEntitys" item="item" index="index"
separator=",">
(
#{id}, #{item.code},
#{item.name}, #{parentId}
#{item.id}, #{item.code},
#{item.name}, #{item.parentId},
#{item.remark}, #{item.thirdSysFk})
</foreach>
</insert>

Loading…
Cancel
Save