...
|
...
|
@@ -60,6 +60,7 @@ import com.yohoufo.order.service.proxy.ProductProxyService; |
|
|
import com.yohoufo.order.service.support.codegenerator.OrderCodeGenerator;
|
|
|
import com.yohoufo.order.service.support.codegenerator.bean.CodeMeta;
|
|
|
import com.yohoufo.order.utils.PaymentHelper;
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
...
|
...
|
@@ -365,15 +366,11 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi |
|
|
CacheKeyBuilder.sellerOrderDetailKey(sellerOrderGoods)
|
|
|
));
|
|
|
}
|
|
|
|
|
|
result = true;
|
|
|
}else {
|
|
|
|
|
|
//1.2 商品下架失败后
|
|
|
result = false;
|
|
|
}
|
|
|
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
...
|
...
|
@@ -394,7 +391,11 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi |
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 删除
|
|
|
* @param req
|
|
|
* @return
|
|
|
*/
|
|
|
public boolean delete(SellerOrderCancelReq req){
|
|
|
log.info("seller self delete order,req {}", req);
|
|
|
int uid = req.getUid();
|
...
|
...
|
@@ -423,23 +424,28 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi |
|
|
log.warn("not exist skup in delete action, req {}", req);
|
|
|
return false;
|
|
|
}
|
|
|
boolean isDelFlag = sellerOrderGoods.getIsDel() != null && DelStatus.IS_DEL.getCode() == sellerOrderGoods.getIsDel();
|
|
|
if (isDelFlag){
|
|
|
SellerOrderGoods sogc = new SellerOrderGoods();
|
|
|
sogc.setUid(uid);
|
|
|
sogc.setGoodsPrice(sellerOrderGoods.getGoodsPrice());
|
|
|
sogc.setBatchNo(sellerOrderGoods.getBatchNo());
|
|
|
sogc.setStatus(sellerOrderGoods.getStatus());
|
|
|
List<SellerOrderGoods> sogList = sellerOrderGoodsMapper.selectGPByBNStatusPrice(sogc);
|
|
|
Set<Integer> skups = sogList.parallelStream()
|
|
|
.filter(csog -> csog.getIsDel() == null || DelStatus.NOT_DEL.getCode() ==csog.getIsDel())
|
|
|
.map(SellerOrderGoods::getId).collect(Collectors.toSet());
|
|
|
|
|
|
if (CollectionUtils.isEmpty(skups)){
|
|
|
log.warn("in seller delete not exist skups, req {}", req);
|
|
|
return false;
|
|
|
}
|
|
|
//判断状态后更新
|
|
|
checkSellCanDelStatus(sellerOrder.getStatus());
|
|
|
|
|
|
SellerOrder target = new SellerOrder();
|
|
|
target.setId(sellerOrder.getId());
|
|
|
target.setIsDel(DelStatus.IS_DEL.getCode());
|
|
|
target.setUpdateTime(DateUtil.getCurrentTimeSecond());
|
|
|
sellerOrderMapper.updateByPrimaryKeySelective(target);
|
|
|
|
|
|
SellerOrderGoods tsog = new SellerOrderGoods();
|
|
|
tsog.setId(sellerOrder.getSkup());
|
|
|
tsog.setIsDel(DelStatus.IS_DEL.getCode());
|
|
|
sellerOrderGoodsMapper.updateByPrimaryKeySelective(tsog);
|
|
|
List<SellerOrder> soList = sellerOrderMapper.selectBySkups(skups);
|
|
|
for(SellerOrder so : soList){
|
|
|
checkSellCanDelStatus(so.getStatus());
|
|
|
}
|
|
|
sellerOrderMapper.batchDelete(skups);
|
|
|
sellerOrderGoodsMapper.batchDelete(skups);
|
|
|
}
|
|
|
|
|
|
|
...
|
...
|
@@ -552,21 +558,19 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi |
|
|
*/
|
|
|
public BatchChangePriceResp batchChangePrice(BatchChangePriceReq req) throws GatewayException {
|
|
|
ChangePricePrepareDTO cppDto = changePricePrepareProcessor.checkAndAcquire(req);
|
|
|
BigDecimal diffEarnestMoney = cppDto.getDiffEarnestMoney();
|
|
|
if (diffEarnestMoney.compareTo(BigDecimal.ZERO) == 0){
|
|
|
throw new UfoServiceException(401, "前后价格没有变化");
|
|
|
}
|
|
|
BigDecimal preSalePrice = cppDto.getPreSalePrice(),
|
|
|
salePrice = cppDto.getSalePrice();
|
|
|
int uid = req.getUid();
|
|
|
Map<Integer, SkupDto> skupMap = cppDto.getSkupMap();
|
|
|
SellerOrderComputeResult computeResult = cppDto.getComputeResult();
|
|
|
//1 划账
|
|
|
|
|
|
BigDecimal diffEarnestMoney = cppDto.getDiffEarnestMoney();
|
|
|
BigDecimal totalDiffMoney = diffEarnestMoney.multiply(new BigDecimal(skupMap.size()));
|
|
|
SellerWalletDetail.Type swdType = SellerWalletDetail.Type.ADD_PRICE;
|
|
|
MerchantOrderAttachInfo moai = MerchantOrderAttachInfo.builder().uid(req.getUid())
|
|
|
.afterProductPrice(cppDto.getSalePrice())
|
|
|
.afterProductPrice(salePrice)
|
|
|
.beforeEarnestMoney(cppDto.getPreEarnestMoney().toPlainString())
|
|
|
.beforeProductPrice(cppDto.getPreSalePrice())
|
|
|
.beforeProductPrice(preSalePrice)
|
|
|
.afterEarnestMoney(computeResult.getEarnestMoney().getEarnestMoney().toPlainString())
|
|
|
.earnestMoney(totalDiffMoney).productCount(skupMap.size())
|
|
|
.seriNo(String.valueOf(req.getBatchNo()))
|
...
|
...
|
@@ -578,7 +582,6 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi |
|
|
if(Objects.nonNull(sellerWallet)) {
|
|
|
//1.1 划账成功后
|
|
|
//TODO 2 商品变价(同步价格到商品)
|
|
|
BigDecimal salePrice = cppDto.getSalePrice();
|
|
|
|
|
|
Set<Integer> skupSet = skupMap.keySet();
|
|
|
productProxyService.batchUpdatePrice(skupSet, salePrice);
|
...
|
...
|
|