Authored by caoyan

Merge branch 'test6.9.8' of http://git.yoho.cn/ufo/ufo-platform into test6.9.8

... ... @@ -27,7 +27,7 @@
<sql id="Base_Column_List">
id, product_id, goods_id, storage_id, deposit_code, shelf_code, owner_uid, order_code,
skup, status, order_status, update_time, create_time, deposit_start_time,
deposit_end_time, edit_pid, out_type, del_status, remind_status
deposit_end_time, edit_pid, out_type, del_status, remind_status,new_skup
</sql>
<insert id="insert" parameterType="com.yoho.order.model.StorageDeposit">
... ...
package com.yoho.ufo.order.service.scheduled;
import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Lists;
import com.yoho.core.rest.client.ServiceCaller;
import com.yoho.order.model.SellerOrder;
import com.yoho.order.model.StorageDeposit;
import com.yoho.quartz.annotation.JobType;
import com.yoho.quartz.annotation.MisfiredPolicy;
... ... @@ -16,8 +18,10 @@ import com.yoho.ufo.service.impl.UserProxyService;
import com.yohobuy.ufo.model.common.ApiResponse;
import com.yohobuy.ufo.model.enums.InboxBusinessTypeEnum;
import com.yohobuy.ufo.model.message.SmsMessageReq;
import com.yohobuy.ufo.model.order.bo.DepositDetailBo;
import com.yohobuy.ufo.model.order.constants.DepositOutTypeEnum;
import com.yohobuy.ufo.model.order.constants.StorageDepositStatusEnum;
import com.yohobuy.ufo.model.order.req.DepositOrderComputeReq;
import com.yohobuy.ufo.model.resp.product.ProductResponceBo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
... ... @@ -26,6 +30,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.concurrent.TimeUnit;
/**
* Created by li.ma on 2019/7/8.
... ... @@ -75,6 +80,8 @@ public class StorageDepositAutoDown implements YhJob {
if (downResult > 0) {
notifyOwnerUid(item); // 修改成功之后,调用发通知
clearOrderInfoCache(item);
} else {
LOGGER.error("storageDepositService.updateStatus find wrong, item is {}", item);
}
... ... @@ -86,26 +93,39 @@ public class StorageDepositAutoDown implements YhJob {
}
private void notifyOwnerUid(StorageDeposit item) {
ProductResponceBo productResponceBo = ufoServiceCaller.call("ufo.product.storageDetial", ProductResponceBo.class, item.getStorageId());
inboxService.addInboxForPlatformEx(item.getOwnerUid(), InboxBusinessTypeEnum.NOTICE_SELLER_DEPOSIT_SEND_BACK.getType(),
InboxBusinessTypeEnum.NOTICE_SELLER_DEPOSIT_SEND_BACK.getBusinessType(),
productResponceBo.getProductName(), productResponceBo.getSizeName(), productResponceBo.getProductCode());
SmsMessageReq smsReq = new SmsMessageReq(); //发送短信
String mobile = userProxyService.getMobile(item.getOwnerUid()); //获取手机号
smsReq.setMobileList(Lists.newArrayList(mobile));
smsReq.setContent(getReplacedContent(InboxBusinessTypeEnum.SMS_NOTIFY_SELLER_DEPOSIT_SEND_BACK.getContent(), productResponceBo.getProductName(),
productResponceBo.getSizeName(), productResponceBo.getProductCode()));
inboxService.sendSmsMessage(smsReq);
try {
ProductResponceBo productResponceBo = ufoServiceCaller.call("ufo.product.storageDetial", ProductResponceBo.class, item.getStorageId());
inboxService.addInboxForPlatformEx(item.getOwnerUid(), InboxBusinessTypeEnum.NOTICE_SELLER_DEPOSIT_SEND_BACK.getType(),
InboxBusinessTypeEnum.NOTICE_SELLER_DEPOSIT_SEND_BACK.getBusinessType(),
productResponceBo.getProductName(), productResponceBo.getSizeName(), productResponceBo.getProductCode());
SmsMessageReq smsReq = new SmsMessageReq(); //发送短信
String mobile = userProxyService.getMobile(item.getOwnerUid()); //获取手机号
smsReq.setMobileList(Lists.newArrayList(mobile));
smsReq.setContent(getReplacedContent(InboxBusinessTypeEnum.SMS_NOTIFY_SELLER_DEPOSIT_SEND_BACK.getContent(), productResponceBo.getProductName(),
productResponceBo.getSizeName(), productResponceBo.getProductCode()));
inboxService.sendSmsMessage(smsReq);
} catch (Exception e) {
LOGGER.error("StorageDepositAutoDown.notifyOwnerUid find wrong; StorageDeposit is " + item, e);
}
}
private void clearOrderInfoCache(StorageDeposit item) {
LOGGER.info("clearDepositOrderCache call ufo-gateway enter StorageDeposit {}", item);
DepositOrderComputeReq bo = DepositOrderComputeReq.builder().uid(item.getOwnerUid()).depositCode(item.getDepositCode()).build();
serviceCaller.asyncCall("ufo-gateway.clearDepositOrderCache", bo, JSONObject.class);
}
private boolean offShelveByErp (StorageDeposit storageDeposit) {
LOGGER.info("method StorageDepositAutoDown.offShelveByErp storageDeposit is {}", storageDeposit);
try {
ApiResponse apiResponse = serviceCaller.call("ufo-gateway.offShelveByErp", storageDeposit, ApiResponse.class, 10); // 下架订单
SellerOrder sellerOrder = new SellerOrder();
sellerOrder.setSkup(storageDeposit.getNewSkup());
ApiResponse apiResponse = serviceCaller.call("ufo-gateway.offShelveByErp", sellerOrder, ApiResponse.class, 10); // 下架订单
if (apiResponse.getCode() == 200) {
LOGGER.info("method StorageDepositAutoDown.offShelveByErp storageDeposit is {}, apiResponse is {}", storageDeposit, apiResponse);
LOGGER.info("method StorageDepositAutoDown.offShelveByErp sellerOrder is {}, apiResponse is {}", sellerOrder, apiResponse);
return true;
}
} catch (Exception e) {
... ...