...
|
...
|
@@ -15,12 +15,14 @@ import com.yohoufo.dal.order.SellerTaskDetailMapper; |
|
|
import com.yohoufo.dal.order.model.*;
|
|
|
import com.yohoufo.order.model.dto.SellerTaskDTO;
|
|
|
import com.yohoufo.order.model.dto.SellerTaskResult;
|
|
|
import com.yohoufo.order.model.dto.SkupDownShelfPrepareDto;
|
|
|
import com.yohoufo.order.model.dto.SkupDto;
|
|
|
import com.yohoufo.order.service.MerchantOrderPaymentService;
|
|
|
import com.yohoufo.order.service.cache.CacheKeyBuilder;
|
|
|
import com.yohoufo.order.service.seller.setting.SellerService;
|
|
|
import com.yohoufo.order.service.proxy.ProductProxyService;
|
|
|
import com.yohoufo.order.service.seller.SellerGoodsStatusFlowService;
|
|
|
import com.yohoufo.order.utils.SellerGoodsHelper;
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
...
|
...
|
@@ -36,7 +38,7 @@ import java.util.stream.Collectors; |
|
|
* Created by jiexiang.wu on 2018/12/21.
|
|
|
*/
|
|
|
@Component
|
|
|
public class SellerDownShelfTaskHandler extends AbstractSellerTaskHandler<Map<Integer, SkupDto>> {
|
|
|
public class SellerDownShelfTaskHandler extends AbstractSellerTaskHandler<SkupDownShelfPrepareDto> {
|
|
|
|
|
|
@Autowired
|
|
|
private SellerOrderMapper sellerOrderMapper;
|
...
|
...
|
@@ -54,8 +56,9 @@ public class SellerDownShelfTaskHandler extends AbstractSellerTaskHandler<Map<In |
|
|
private MerchantOrderPaymentService merchantOrderPaymentService;
|
|
|
|
|
|
@Override
|
|
|
protected boolean preHandle(SellerTaskResult result, SellerTaskDTO<Map<Integer, SkupDto>> taskDto) {
|
|
|
Map<Integer, SkupDto> skupDtoMap = taskDto.getProcessData();
|
|
|
protected boolean preHandle(SellerTaskResult result, SellerTaskDTO<SkupDownShelfPrepareDto> taskDto) {
|
|
|
SkupDownShelfPrepareDto sdspDto = taskDto.getProcessData();
|
|
|
Map<Integer, SkupDto> skupDtoMap = sdspDto.getIdSkupMap();
|
|
|
Set<Integer> skupSets = skupDtoMap.keySet();
|
|
|
List<SellerOrder> soList = sellerOrderMapper.selectBySkups(skupSets);
|
|
|
for (SellerOrder so : soList) {
|
...
|
...
|
@@ -69,8 +72,9 @@ public class SellerDownShelfTaskHandler extends AbstractSellerTaskHandler<Map<In |
|
|
}
|
|
|
|
|
|
@Override
|
|
|
protected List<FutureTask> getFutureTasks(SellerTaskResult result, SellerTaskDTO<Map<Integer, SkupDto>> taskDto) {
|
|
|
Map<Integer, SkupDto> skupDtoMap = taskDto.getProcessData();
|
|
|
protected List<FutureTask> getFutureTasks(SellerTaskResult result, SellerTaskDTO<SkupDownShelfPrepareDto> taskDto) {
|
|
|
SkupDownShelfPrepareDto sdspDto = taskDto.getProcessData();
|
|
|
Map<Integer, SkupDto> skupDtoMap = sdspDto.getIdSkupMap();
|
|
|
List<FutureTask> futureTasks = Lists.newArrayList();
|
|
|
for (Map.Entry<Integer, SkupDto> entry : skupDtoMap.entrySet()) {
|
|
|
FutureTask<Integer> futureTask = new FutureTask<>(new DownShelfTask(taskDto.getUid(), taskDto.getTaskId(), entry.getValue()));
|
...
|
...
|
@@ -80,11 +84,12 @@ public class SellerDownShelfTaskHandler extends AbstractSellerTaskHandler<Map<In |
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void postHandle(SellerTaskResult result, SellerTaskDTO<Map<Integer, SkupDto>> taskDto) {
|
|
|
public void postHandle(SellerTaskResult result, SellerTaskDTO<SkupDownShelfPrepareDto> taskDto) {
|
|
|
if (result.successCnt > 0) {
|
|
|
SkupDownShelfPrepareDto sdspDto = taskDto.getProcessData();
|
|
|
Map<Integer, SkupDto> skupDtoMap = sdspDto.getIdSkupMap();
|
|
|
int uid = taskDto.getUid();
|
|
|
long taskId = taskDto.getTaskId();
|
|
|
Map<Integer, SkupDto> skupDtoMap = taskDto.getProcessData();
|
|
|
//下架成功的订单
|
|
|
List<SellerOrder> successOrders = Lists.newArrayList();
|
|
|
for (Integer skup : result.successSkups) {
|
...
|
...
|
@@ -92,10 +97,13 @@ public class SellerDownShelfTaskHandler extends AbstractSellerTaskHandler<Map<In |
|
|
}
|
|
|
try {
|
|
|
boolean isSuper = sellerService.isSuperEntrySeller(uid);
|
|
|
//退保证金
|
|
|
SellerWallet sellerWallet = postRefundEarnest(uid, taskId, isSuper, result, successOrders);
|
|
|
//明细
|
|
|
addWalletDetail(uid, taskId, isSuper, sellerWallet, successOrders);
|
|
|
boolean isQuickDeliver = SellerGoodsHelper.isQuickDeliver(sdspDto.getSkupType());
|
|
|
if (!isQuickDeliver) {
|
|
|
//退保证金
|
|
|
SellerWallet sellerWallet = postRefundEarnest(uid, taskId, isSuper, result, successOrders);
|
|
|
//明细
|
|
|
addWalletDetail(uid, taskId, isSuper, sellerWallet, successOrders);
|
|
|
}
|
|
|
//消息盒子
|
|
|
inboxNotify(uid, skupDtoMap);
|
|
|
|
...
|
...
|
|