...
|
...
|
@@ -8,25 +8,38 @@ import java.util.concurrent.ExecutorService; |
|
|
import java.util.concurrent.Executors;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.elasticsearch.common.collect.Maps;
|
|
|
import org.slf4j.helpers.MessageFormatter;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.google.common.collect.Lists;
|
|
|
import com.yoho.core.rabbitmq.YhProducer;
|
|
|
import com.yoho.error.exception.ServiceException;
|
|
|
import com.yoho.order.dal.OrderOperateRecordMapper;
|
|
|
import com.yoho.order.dal.SellerOrderGoodsMapper;
|
|
|
import com.yoho.order.dal.StorageDepositMapper;
|
|
|
import com.yoho.order.model.SellerOrderGoods;
|
|
|
import com.yoho.order.model.StorageDeposit;
|
|
|
import com.yoho.order.model.StorageDepositPickRsp;
|
|
|
import com.yoho.order.model.StorageDepositReq;
|
|
|
import com.yoho.order.model.StorageDepositRsp;
|
|
|
import com.yoho.ufo.dal.ProductMapper;
|
|
|
import com.yoho.ufo.dal.model.Product;
|
|
|
import com.yoho.ufo.order.request.OrderOperateTask;
|
|
|
import com.yoho.ufo.order.service.IStorageDepositService;
|
|
|
import com.yoho.ufo.service.impl.InboxServiceImpl;
|
|
|
import com.yoho.ufo.service.impl.UserHelper;
|
|
|
import com.yoho.ufo.service.impl.UserProxyService;
|
|
|
import com.yoho.ufo.service.model.PageResponseBO;
|
|
|
import com.yoho.ufo.util.DateUtil;
|
|
|
import com.yohobuy.ufo.model.enums.InboxBusinessTypeEnum;
|
|
|
import com.yohobuy.ufo.model.message.SmsMessageReq;
|
|
|
import com.yohobuy.ufo.model.order.common.OperateTypeEnum;
|
|
|
import com.yohobuy.ufo.model.order.constants.StorageDepositStatusEnum;
|
|
|
|
...
|
...
|
@@ -42,6 +55,21 @@ public class StorageDepositServiceImpl implements IStorageDepositService{ |
|
|
|
|
|
@Autowired
|
|
|
private OrderOperateRecordMapper orderOperateRecordMapper;
|
|
|
|
|
|
@Autowired
|
|
|
private InboxServiceImpl inboxService;
|
|
|
|
|
|
@Autowired
|
|
|
private UserProxyService userProxyService;
|
|
|
|
|
|
@Autowired
|
|
|
private SellerOrderGoodsMapper sellerOrderGoodsMapper;
|
|
|
|
|
|
@Autowired
|
|
|
private ProductMapper productMapper;
|
|
|
|
|
|
@Resource(name = "yhProducer")
|
|
|
private YhProducer yhProducer;
|
|
|
|
|
|
@Override
|
|
|
public Map<String, Integer> getCountByStatus(StorageDepositReq req){
|
...
|
...
|
@@ -147,10 +175,31 @@ public class StorageDepositServiceImpl implements IStorageDepositService{ |
|
|
num = storageDepositMapper.batchUpdateStatusByDepositCodeList(StorageDepositStatusEnum.HAS_IN.getCode(), depositCodeList);
|
|
|
}
|
|
|
|
|
|
//记录操作日志
|
|
|
int operateType =OperateTypeEnum.DEPOIST_ALEADY_IN.getCode();
|
|
|
List<Integer> skupList = depositList.stream().map(StorageDeposit::getSkup).collect(Collectors.toList());
|
|
|
List<Integer> productIdList = depositList.stream().map(StorageDeposit::getProductId).collect(Collectors.toList());
|
|
|
List<SellerOrderGoods> sellerGoodsList = sellerOrderGoodsMapper.selectByIds(skupList);
|
|
|
List<Product> productList = productMapper.selectProductListByIds(productIdList);
|
|
|
Map<Integer, SellerOrderGoods> sellerGoodsMap = sellerGoodsList.stream().collect(Collectors.toMap(SellerOrderGoods::getId, s->s));
|
|
|
Map<Integer, Product> productMap = productList.stream().collect(Collectors.toMap(Product::getId, p->p));
|
|
|
int operateType =OperateTypeEnum.DEPOIST_ALEADY_IN.getCode();
|
|
|
UserHelper userHelper = new UserHelper();
|
|
|
for(StorageDeposit item : depositList) {
|
|
|
//调用前台接口设置订单状态为已完成
|
|
|
JSONObject param = new JSONObject();
|
|
|
param.put("uid", userHelper.getUserId());
|
|
|
param.put("orderCode", item.getOrderCode());
|
|
|
yhProducer.send("buyerOrder.autoConfirm", param, null);
|
|
|
//给买家发信息
|
|
|
inboxService.addInboxForPlatform(item.getOwnerUid(), InboxBusinessTypeEnum.NOTICE_SELLER_DEPOSIT_IN_STORAGE.getType(),
|
|
|
InboxBusinessTypeEnum.NOTICE_SELLER_DEPOSIT_IN_STORAGE.getBusinessType(), item.getOrderCode());
|
|
|
|
|
|
SmsMessageReq smsReq = new SmsMessageReq(); //发送短信
|
|
|
String mobile = userProxyService.getMobile(item.getOwnerUid()); //获取手机号
|
|
|
smsReq.setMobileList(Lists.newArrayList(mobile));
|
|
|
smsReq.setContent(getReplacedContent(InboxBusinessTypeEnum.SMS_NOTIFY_SELLER_DEPOSIT_IN_STORAGE.getContent(), sellerGoodsMap.get(item.getSkup()).getProductName(),
|
|
|
sellerGoodsMap.get(item.getSkup()).getSizeName(), productMap.get(item.getProductId()).getProductCode(), item.getOrderCode()));
|
|
|
inboxService.sendSmsMessage(new SmsMessageReq());
|
|
|
//记录操作日志
|
|
|
saveOrderOperateRecord(item.getOrderCode(), userHelper, operateType, "");
|
|
|
}
|
|
|
|
...
|
...
|
@@ -356,4 +405,8 @@ public class StorageDepositServiceImpl implements IStorageDepositService{ |
|
|
return list;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private String getReplacedContent(String content ,Object... params) {
|
|
|
return MessageFormatter.arrayFormat(content, params).getMessage();
|
|
|
}
|
|
|
} |
...
|
...
|
|