商品的校验
This commit is contained in:
parent
b1ba27aa1e
commit
2830d1d948
|
|
@ -61,12 +61,14 @@ public class TbShopSyncInfoController {
|
|||
TbShopSyncInfoQueryCriteria criteria = new TbShopSyncInfoQueryCriteria();
|
||||
criteria.setPointShopId(tbShopSyncInfo.getPointShopId());
|
||||
TbShopSyncInfo tbShopSyncInfo1 = tbShopSyncInfoService.queryByShopId(criteria);
|
||||
if(tbShopSyncInfo1 != null){
|
||||
long between = DateUtil.between(new Date(), tbShopSyncInfo1.getSyncTime(), DateUnit.HOUR);
|
||||
if(between > 24){
|
||||
throw new RuntimeException("数据同步已超过一天 无法清除");
|
||||
}
|
||||
tbShopSyncInfoService.clear(tbShopSyncInfo);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -299,7 +299,9 @@ public class TbShopSyncInfoServiceImpl extends ServiceImpl<TbShopSyncInfoMapper,
|
|||
Map<Integer, Integer> specs, Map<Integer, Integer> cateGorys) {
|
||||
CompletableFuture<Map<Integer, Integer>> future = new CompletableFuture<>();
|
||||
Map<Integer, Integer> proMap = new HashMap<>();
|
||||
productRepository.findByShopId(sourceShopId.toString()).forEach(tbProduct -> {
|
||||
List<TbProduct> products = productRepository.findByShopId(sourceShopId.toString());
|
||||
if(CollectionUtil.isNotEmpty(products)){
|
||||
products.forEach(tbProduct -> {
|
||||
Integer sourceSpecId = tbProduct.getId();
|
||||
tbProduct.setId(null);
|
||||
tbProduct.setShopId(pointShopId.toString());
|
||||
|
|
@ -311,6 +313,7 @@ public class TbShopSyncInfoServiceImpl extends ServiceImpl<TbShopSyncInfoMapper,
|
|||
productRepository.save(tbProduct);
|
||||
proMap.put(sourceSpecId, tbProduct.getId());
|
||||
});
|
||||
}
|
||||
future.complete(proMap);
|
||||
return future;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue