...
|
...
|
@@ -49,7 +49,9 @@ public class DepositServiceImpl implements DepositService { |
|
|
return new ArrayList<>();
|
|
|
}
|
|
|
List<Integer> productIdList = storageDepositMapper.queryUserDepositProductId(uid, (page - 1) * limit, limit);
|
|
|
LOGGER.info("productIdList is {}", productIdList);
|
|
|
List<StorageDepositCount> countInfoList = storageDepositMapper.queryUserDepositProduct(uid, productIdList);
|
|
|
LOGGER.info("countInfoList is {}", countInfoList);
|
|
|
List<Integer> skupList = countInfoList.stream().map(StorageDepositCount::getSkup).collect(Collectors.toList());
|
|
|
List<SellerOrderGoods> goodsList = sellerOrderGoodsMapper.selectBySkups(skupList);
|
|
|
Map<Integer, StorageDepositCount> countInfoMap = countInfoList.stream().map(Function.identity()).collect(Collectors.toMap(StorageDepositCount::getProductId, Function.identity()));
|
...
|
...
|
@@ -164,23 +166,57 @@ public class DepositServiceImpl implements DepositService { |
|
|
// 上架
|
|
|
@Override
|
|
|
public boolean changeSaleStatusOn(Integer uid, String depositCode, Integer skup) {
|
|
|
LOGGER.info("changeSaleStatusOn uid {}, depositCode is {}, skup is {}", uid, depositCode, skup);
|
|
|
return storageDepositMapper.changeSaleStatusOn(uid, depositCode, skup) == 1;
|
|
|
}
|
|
|
// 下架
|
|
|
@Override
|
|
|
public boolean changeSaleStatusOff(Integer uid, Integer skup) {
|
|
|
LOGGER.info("changeSaleStatusOff uid {}, skup is {}", uid, skup);
|
|
|
return storageDepositMapper.changeSaleStatusOff(uid, skup) == 1;
|
|
|
}
|
|
|
|
|
|
|
|
|
// 批量上架
|
|
|
public List<StorageDeposit> changeSaleStatusOnBatch(Integer uid, Integer storageId, List<Integer> skupList) {
|
|
|
int count = skupList.size();
|
|
|
List<StorageDeposit> sdList = storageDepositMapper.getDepositOffs(uid, storageId, count);
|
|
|
List<StorageDeposit> successList = new ArrayList<>();
|
|
|
for (int i = 0; i < sdList.size(); i++) {
|
|
|
StorageDeposit sd = sdList.get(i);
|
|
|
if (changeSaleStatusOn(uid, sd.getDepositCode(), skupList.get(i))) {
|
|
|
LOGGER.info("changeSaleStatusOn success! uid {},depositeCode is {}, skup is {}", uid, sd.getDepositCode(), skupList.get(i));
|
|
|
sd.setNewSkup(skupList.get(i));
|
|
|
successList.add(sd);
|
|
|
}
|
|
|
}
|
|
|
return successList;
|
|
|
}
|
|
|
|
|
|
// 批量下架
|
|
|
public List<Integer> changeSaleStatusOffBatch(Integer uid, List<Integer> skupList) {
|
|
|
List<Integer> successList = new ArrayList<>();
|
|
|
for (Integer skup : skupList) {
|
|
|
if (changeSaleStatusOff(uid, skup)) {
|
|
|
LOGGER.info("changeSaleStatusOff success! uid {}, skup is {}", uid, skup);
|
|
|
successList.add(skup);
|
|
|
}
|
|
|
}
|
|
|
return successList;
|
|
|
}
|
|
|
|
|
|
// 转卖
|
|
|
@Override
|
|
|
public boolean changeOwner(Integer uid, Integer skup, long buyOrderCode, Integer newUid) {
|
|
|
LOGGER.info("changeOwner success! uid {}, skup is {}, buyOrderCode is {}, newUid is {}", uid, skup, buyOrderCode, newUid);
|
|
|
StorageDeposit sd = storageDepositMapper.queryByOwnerSkup(uid, skup);
|
|
|
if(sd==null) {
|
|
|
if (sd == null) {
|
|
|
return false;
|
|
|
}
|
|
|
if(storageDepositMapper.sale(uid, skup, buyOrderCode) == 0) {
|
|
|
if (storageDepositMapper.sale(uid, skup, buyOrderCode) == 0) {
|
|
|
return false;
|
|
|
}
|
|
|
LOGGER.info("sale success! uid {}, skup is {}, buyOrderCode is {}, newUid is {}", uid, skup, buyOrderCode, newUid);
|
|
|
sd.setId(null);
|
|
|
sd.setOwnerUid(newUid);
|
|
|
sd.setOrderCode(buyOrderCode);
|
...
|
...
|
@@ -188,10 +224,11 @@ public class DepositServiceImpl implements DepositService { |
|
|
sd.setStatus(1);
|
|
|
sd.setOrderStatus(0);
|
|
|
sd.setUpdateTime(0);
|
|
|
int now = (int) (System.currentTimeMillis()/1000);
|
|
|
int now = (int) (System.currentTimeMillis() / 1000);
|
|
|
sd.setCreateTime(now);
|
|
|
sd.setDepositStartTime(now);
|
|
|
sd.setDepositEndTime(now + DEPOSIT_MAX_TIME);
|
|
|
LOGGER.info("new owner record is sd", sd);
|
|
|
storageDepositMapper.insert(sd);
|
|
|
return true;
|
|
|
}
|
...
|
...
|
|