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

fengcang
anthonyywj2 3 years ago
parent 5b244815ba
commit 3e52f7c95f

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

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

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

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

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

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

@ -58,6 +58,8 @@ public class UpBasicService {
@Resource @Resource
ThrInvWarehouseService thrInvWarehouseService; ThrInvWarehouseService thrInvWarehouseService;
@Resource @Resource
ThrSubInvWarehouseService thrSubInvWarehouseService;
@Resource
ThrCorpService thrCorpService; ThrCorpService thrCorpService;
@Resource @Resource
ThrProductsService thrProductsService; ThrProductsService thrProductsService;
@ -92,7 +94,6 @@ public class UpBasicService {
//仓库字典 //仓库字典
if (syncDataSetEntity.isBasicInv()) { if (syncDataSetEntity.isBasicInv()) {
//仓库字典 //仓库字典
FilterInvWarehouseRequest filterInvWarehouseRequest = new FilterInvWarehouseRequest(); FilterInvWarehouseRequest filterInvWarehouseRequest = new FilterInvWarehouseRequest();
BeanUtils.copyProperties(spsSyncDataRequest, filterInvWarehouseRequest); BeanUtils.copyProperties(spsSyncDataRequest, filterInvWarehouseRequest);
@ -170,6 +171,22 @@ public class UpBasicService {
BeanUtils.copyProperties(spsSyncDataRequest, filterThrInvWarehouseRequest); BeanUtils.copyProperties(spsSyncDataRequest, filterThrInvWarehouseRequest);
List<ThrInvWarehouseEntity> thrInvWarehouseEntities = thrInvWarehouseService.filterThrInvWarehouse(filterThrInvWarehouseRequest); List<ThrInvWarehouseEntity> thrInvWarehouseEntities = thrInvWarehouseService.filterThrInvWarehouse(filterThrInvWarehouseRequest);
syncDataResponse.setThrInvWarehouseEntities(thrInvWarehouseEntities); 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" <foreach collection="thrInvWarehouseEntitys" item="item" index="index"
separator=","> separator=",">
( (
#{id}, #{item.code}, #{item.id}, #{item.code},
#{item.name}, #{parentId} #{item.name}, #{item.parentId},
#{item.remark}, #{item.thirdSysFk}) #{item.remark}, #{item.thirdSysFk})
</foreach> </foreach>
</insert> </insert>

Loading…
Cancel
Save