Authored by chenchao

finish batch publish prds

... ... @@ -11,6 +11,8 @@ public interface SellerOrderMapper {
int insert(SellerOrder record);
int insertBatch(@Param("records") Collection<SellerOrder> records);
int insertSelective(SellerOrder record);
SellerOrder selectByPrimaryKey(Integer id);
... ...
... ... @@ -3,6 +3,7 @@ package com.yohoufo.dal.order;
import com.yohoufo.dal.order.model.SellerOrderMeta;
import org.apache.ibatis.annotations.Param;
import java.util.Collection;
import java.util.List;
public interface SellerOrderMetaMapper {
... ... @@ -12,6 +13,8 @@ public interface SellerOrderMetaMapper {
int insertSelective(SellerOrderMeta record);
int insertBatch(@Param("records") Collection<SellerOrderMeta> records);
SellerOrderMeta selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(SellerOrderMeta record);
... ...
... ... @@ -114,7 +114,7 @@
color_id, color_name,
goods_price, status, batch_no)
values
<foreach collection="records" item="sog" open="(" close=")" separator=",">
<foreach collection="records" item="sog" separator=",">
(#{sog.productId,jdbcType=INTEGER}, #{sog.productName,jdbcType=VARCHAR}, #{sog.storageId,jdbcType=INTEGER},
#{sog.depotNo,jdbcType=INTEGER}, #{sog.sizeId,jdbcType=INTEGER}, #{sog.sizeName,jdbcType=VARCHAR},
#{sog.colorId,jdbcType=SMALLINT}, #{sog.colorName,jdbcType=VARCHAR},
... ...
... ... @@ -77,6 +77,22 @@
#{createTime,jdbcType=INTEGER}, #{updateTime,jdbcType=INTEGER})
</insert>
<insert id="insertBatch" >
insert into seller_order (order_code, skup, uid,
payment, income,
earnest_money, is_del, status,
create_time)
values
<foreach collection="records" item="record" separator=",">
(#{record.orderCode,jdbcType=BIGINT}, #{record.skup,jdbcType=INTEGER}, #{record.uid,jdbcType=INTEGER},
#{record.payment,jdbcType=TINYINT}, #{record.income,jdbcType=DECIMAL},
#{record.earnestMoney,jdbcType=DECIMAL}, #{record.isDel,jdbcType=TINYINT}, #{record.status,jdbcType=TINYINT},
#{record.createTime,jdbcType=INTEGER})
</foreach>
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.yohoufo.dal.order.model.SellerOrder" useGeneratedKeys="true">
insert into seller_order
<trim prefix="(" suffix=")" suffixOverrides=",">
... ...
... ... @@ -40,6 +40,17 @@
</select>
<insert id="insertBatch">
insert into seller_order_meta (skup, uid, meta_key,
meta_value)
values
<foreach collection="records" item="record" separator=",">
(#{record.skup,jdbcType=INTEGER}, #{record.uid,jdbcType=INTEGER}, #{record.metaKey,jdbcType=VARCHAR},
#{record.metaValue,jdbcType=VARCHAR})
</foreach>
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.yohoufo.dal.order.model.SellerOrderMeta" useGeneratedKeys="true">
insert into seller_order_meta
<trim prefix="(" suffix=")" suffixOverrides=",">
... ...
package com.yohoufo.order.event;
import com.yohoufo.common.alarm.Event;
import com.yohoufo.dal.order.model.SellerWallet;
import com.yohoufo.order.service.handler.SellerOrderSubmitHandler;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Builder;
/**
* Created by chao.chen on 2018/11/20.
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class BatchPublishTailEvent extends Event {
private SellerOrderSubmitHandler.ForkJoinResult fjr;
private SellerWallet sellerWallet;
}
... ...
package com.yohoufo.order.service.handler;
import com.google.common.eventbus.Subscribe;
import com.yohobuy.ufo.model.order.bo.OrderInfo;
import com.yohoufo.common.alarm.IEventHandler;
import com.yohoufo.dal.order.model.SellerWallet;
import com.yohoufo.order.event.BatchPublishTailEvent;
import com.yohoufo.order.service.MerchantOrderPaymentService;
import com.yohoufo.order.service.proxy.ProductProxyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.stream.Collectors;
/**
* Created by chao.chen on 2018/11/20.
*/
@Component
public class BatchPublishTailHandler implements IEventHandler<BatchPublishTailEvent> {
@Autowired
private MerchantOrderPaymentService merchantOrderPaymentService;
@Autowired
private ProductProxyService productProxyService;
@Override
@Subscribe
public void handle(BatchPublishTailEvent event) {
batchPublishTailProcess(event.getFjr(), event.getSellerWallet());
}
private void batchPublishTailProcess(SellerOrderSubmitHandler.ForkJoinResult fjr, SellerWallet sellerWallet){
// (异步实现)记录保证金流水
List<OrderInfo> orderList = fjr.getSellerOrderList().parallelStream().map(sellerOrder ->
OrderInfo.builder().orderCode(sellerOrder.getOrderCode())
.amount(sellerOrder.getEarnestMoney()).build()
).collect(Collectors.toList());
merchantOrderPaymentService.useEarnestAddWalletDetail(sellerWallet, orderList);
//(异步实现)同步数据到prd,记录支付,
productProxyService.batchCreateSkup(fjr.getSellerOrderGoodsList());
productProxyService.sellerBatchUpdateStatus(fjr.getSkupIds(), ProductProxyService.PrdShelvelStatus.on);
}
}
... ...
package com.yohoufo.order.service.handler;
import com.yoho.core.dal.datasource.annotation.Database;
import com.yohobuy.ufo.model.order.common.OrderCodeType;
import com.yohobuy.ufo.model.order.common.SkupStatus;
import com.yohoufo.common.exception.GatewayException;
import com.yohoufo.dal.order.model.SellerOrder;
import com.yohoufo.dal.order.model.SellerOrderGoods;
import com.yohobuy.ufo.model.order.bo.GoodsInfo;
import com.yohoufo.order.convert.GoodsInfoConvertor;
import com.yohoufo.order.model.SellerOrderContext;
import com.yohoufo.order.service.MerchantOrderPaymentService;
import com.yohoufo.order.service.impl.SkupService;
import com.yohoufo.order.service.impl.SellerAddressService;
import com.yohoufo.order.service.impl.SellerFeeService;
... ... @@ -42,6 +45,9 @@ public class SellerOrderSubmitHandler {
@Autowired
private SellerFeeService sellerFeeService;
@Autowired
private MerchantOrderPaymentService merchantOrderPaymentService;
@Transactional(propagation = Propagation.REQUIRES_NEW)
@Database(ForceMaster=true, DataSource="ufo_order")
public void submit(SellerOrderContext context) throws GatewayException {
... ... @@ -77,6 +83,7 @@ public class SellerOrderSubmitHandler {
List<SellerOrderGoods> sogList = new ArrayList<>(num);
for(int i=0; i<num; i++){
SellerOrderGoods sog = GoodsInfoConvertor.resp2Do4AddNew(goodsInfo);
sog.setStatus(SkupStatus.CAN_SELL.getCode());
sogList.add(sog);
}
int rows = skupService.batchAddSkup(sogList);
... ... @@ -100,13 +107,17 @@ public class SellerOrderSubmitHandler {
fjr.uid = uid;
fjr.storageId = storageId;
fjr.sellerOrderList = sellerOrders;
fjr.skupIds = skupIds;
fjr.sellerOrderGoodsList = sogList;
return fjr;
}
@Data
public static class ForkJoinResult{
int uid;
int storageId;
List<Integer> skupIds;
List<SellerOrder> sellerOrderList;
List<SellerOrderGoods> sellerOrderGoodsList;
}
}
... ...
... ... @@ -12,6 +12,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
/**
... ... @@ -49,21 +50,24 @@ public class SellerAddressService {
int result = 0;
String value = JSONObject.toJSONString(ctx.getBackAddress());
String hValue = JSONObject.toJSONString(ctx.getBackHiddenAddress());
List<SellerOrderMeta> list = new ArrayList<>( 2*skupIds.size() );
for(Integer skupId : skupIds){
SellerOrderMeta som = new SellerOrderMeta();
som.setUid(ctx.getUid());
som.setSkup(skupId);
som.setMetaKey(MetaKey.BACK_2_SELLER_DELIVERY_ADDRESS);
som.setMetaValue(value);
result = somMapper.insertSelective(som);
list.add(som);
//hidden
SellerOrderMeta hidddenSom = new SellerOrderMeta();
hidddenSom.setUid(ctx.getUid());
hidddenSom.setSkup(skupId);
hidddenSom.setMetaKey(MetaKey.BACK_2_SELLER_DELIVERY_HIDDEN_ADDRESS);
hidddenSom.setMetaValue(hValue);
result += somMapper.insertSelective(hidddenSom);
list.add(hidddenSom);
}
result = somMapper.insertBatch(list);
return result;
}
... ...
... ... @@ -3,7 +3,10 @@ package com.yohoufo.order.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.yoho.core.dal.datasource.annotation.Database;
import com.yohoufo.common.utils.BigDecimalHelper;
import com.yohoufo.dal.order.*;
import com.yohoufo.dal.order.BuyerOrderGoodsMapper;
import com.yohoufo.dal.order.BuyerOrderMapper;
import com.yohoufo.dal.order.SellerOrderMapper;
import com.yohoufo.dal.order.SellerOrderMetaMapper;
import com.yohoufo.dal.order.model.BuyerOrder;
import com.yohoufo.dal.order.model.BuyerOrderGoods;
import com.yohoufo.dal.order.model.SellerOrder;
... ... @@ -22,6 +25,7 @@ import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
/**
... ... @@ -45,12 +49,6 @@ public class SellerFeeService {
@Autowired
private SellerOrderMapper sellerOrderMapper;
@Autowired
private SellerOrderGoodsMapper sellerOrderGoodsMapper;
@Autowired
private SellerOrderMetaMapper sellerOrderMetaMapper;
@Transactional(propagation = Propagation.REQUIRED)
@Database(ForceMaster=true, DataSource="ufo_order")
public int saveFee(SellerOrderContext ctx){
... ... @@ -68,14 +66,16 @@ public class SellerFeeService {
logger.info("in seller saveBatchFee, uid {}, skupIds {}", ctx.getUid(), skupIds);
int result = 0;
String value = JSONObject.toJSONString(ctx.getSellerOrderComputeResult());
List<SellerOrderMeta> list = new ArrayList<>(skupIds.size());
for(Integer skupId : skupIds) {
SellerOrderMeta som = new SellerOrderMeta();
som.setUid(ctx.getUid());
som.setSkup(skupId);
som.setMetaKey(MetaKey.SELLER_FEE);
som.setMetaValue(value);
result += somMapper.insertSelective(som);
list.add(som);
}
result += somMapper.insertBatch(list);
return result;
}
... ...
... ... @@ -70,9 +70,13 @@ public class SellerOrderCreateService {
condition.setStatus(SellerOrderStatus.HAS_PAYED.getCode());
condition.setEarnestMoney(context.getSellerOrderComputeResult().getEarnestMoney().getEarnestMoney());
condition.setIncome(context.getSellerOrderComputeResult().getIncome());
sellerOrderMapper.insertSelective(condition);
condition.setPayment((int)OrderCodeType.SELLER_RECHARGE_EARNEST_TYPE.getType());
list.add(condition);
}
if (!list.isEmpty()){
sellerOrderMapper.insertBatch(list);
}
return list;
}
}
... ...
... ... @@ -22,9 +22,11 @@ import com.yohoufo.dal.order.SellerOrderMapper;
import com.yohoufo.dal.order.model.BuyerOrder;
import com.yohoufo.dal.order.model.SellerOrder;
import com.yohoufo.dal.order.model.SellerOrderGoods;
import com.yohoufo.dal.order.model.SellerWallet;
import com.yohoufo.order.common.ActionStatusHold;
import com.yohoufo.order.common.DelStatus;
import com.yohoufo.order.convert.SellerOrderConvertor;
import com.yohoufo.order.event.BatchPublishTailEvent;
import com.yohoufo.order.event.ErpCancelSellerOrderEvent;
import com.yohoufo.order.event.EventHandlerContainer;
import com.yohoufo.order.event.OrderCancelEvent;
... ... @@ -37,6 +39,7 @@ import com.yohoufo.order.model.response.OrderSubmitResp;
import com.yohoufo.order.model.response.OrderSummaryResp;
import com.yohoufo.order.service.IOrderDetailService;
import com.yohoufo.order.service.IOrderListService;
import com.yohoufo.order.service.MerchantOrderPaymentService;
import com.yohoufo.order.service.cache.CacheCleaner;
import com.yohoufo.order.service.cache.OrderCacheService;
import com.yohoufo.order.service.concurrent.ThreadPoolFactory;
... ... @@ -48,25 +51,30 @@ import com.yohoufo.order.service.impl.visitor.UserCancelCase;
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 lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.*;
import java.util.concurrent.Callable;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ForkJoinTask;
import java.util.stream.Collectors;
/**
* Created by chenchao on 2018/9/13.
*/
@Service
@Slf4j
public class SellerOrderService implements IOrderListService, IOrderDetailService {
private final Logger log = LoggerFactory.getLogger(getClass());
@Autowired
private SellerOrderMapper sellerOrderMapper;
... ... @@ -109,6 +117,12 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi
@Autowired
private SellerOrderPrepareProcessor sellerOrderPrepareProcessor;
@Autowired
private SkupBatchService skupBatchService;
@Autowired
private MerchantOrderPaymentService merchantOrderPaymentService;
public SoldPrdComputeBo computePublishPrd(SellerOrderComputeReq req) throws GatewayException {
log.info("in computePublishPrd, req {}", req);
... ... @@ -220,63 +234,39 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi
}
/**
* 卖家支付完成后调用
* @param uid
* @param orderCode
*/
public void processAfterPay(int uid, long orderCode){
//todo update order info, set payment status
//todo update skup status
//todo sync skup to prd service by rpc
}
/**
* 发货
* @param buyerOrderCode
* @param expressNum
*/
public void deliverGoods(int uid, long buyerOrderCode,String expressNum){
//
}
@Autowired
private SkupBatchService skupBatchService;
public OrderSubmitResp batchPublishPrds(SellerOrderContext ctx, SellerOrderSubmitReq req) throws GatewayException {
// 一串校验
//TODO 扣减保证金
//扣减保证金
final int num = req.getNum();
int uid = req.getUid();
SellerOrderComputeResult socr = ctx.getSellerOrderComputeResult();
BigDecimal singleEarestMoney = socr.getEarnestMoney().getEarnestMoney();
BigDecimal mEarestMoney = BigDecimalHelper.halfUp(new BigDecimal(num).multiply(singleEarestMoney));
boolean paySuccess = false;//TODO invoke pay by wallet
SellerWallet sellerWallet = merchantOrderPaymentService.useEarnest(uid, mEarestMoney);
// invoke pay by wallet
boolean paySuccess = Objects.nonNull(sellerWallet);
if (!paySuccess){
log.warn("batchPublishPrds pay fail, req {} mEarestMoney {}", req, mEarestMoney);
throw new ServiceException(ServiceError.WALLET_EARNESTMONEY_PAY_FAIL);
}
//TODO (异步实现)记录保证金流水
//TODO 生成批次号
// 生成批次号
long batchNo = skupBatchService.generateBatchNo(req.getUid(), req.getNum());
ctx.getSoldProduct().setBatchNo(batchNo);
int times = PageHelper.getPageTotal(num, MAX_DEAL);
CountDownLatch cdl = new CountDownLatch(times);
//TODO 批量生成订单(订单表,meta 地址,算费)--> 需要用到多线程并行处理
//TODO(异步实现)同步数据到prd,记录支付,
//批量生成订单(订单表,meta 地址,算费)--> 需要用到多线程并行处理
List<ForkJoinTask<SellerOrderSubmitHandler.ForkJoinResult>> taskList = new ArrayList<>(times);
for(int i = 1; i <= times; i++){
int forkNum = MAX_DEAL;
if (times == i){
forkNum = num - (i-1) * MAX_DEAL;
}
BatchProcessTask batchProcessTask = new BatchProcessTask(ctx, cdl, forkNum);
log.info("batch publish uid {} storageId {} forkNum {} num {}", uid, req.getStorageId(), forkNum, num);
BatchProcessTask batchProcessTask = new BatchProcessTask(ctx, cdl, forkNum, sellerWallet);
ForkJoinTask<SellerOrderSubmitHandler.ForkJoinResult> fjt = ThreadPoolFactory.getForkJoinPool().submit(batchProcessTask);
fjt.fork();
SellerOrderSubmitHandler.ForkJoinResult fjr = fjt.join();
log.info("in batch publish prd, ForkJoinResult {} " ,fjr);
taskList.add(fjt);
}
return OrderSubmitResp.builder().build();
}
... ... @@ -292,6 +282,11 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi
return true;
}
/**
* todo
* @param req
* @return
*/
public boolean batchCancel(SellerOrderBatchCancelReq req){
... ... @@ -391,20 +386,6 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi
}
}
/**
* 查物流详情
* 只查卖家自己填的物流单
* @param uid
* @param buyerOrderCode
* @param expressNum
* @return
*/
public Object queryLogistics(int uid, long buyerOrderCode, String expressNum){
return null;
}
private SoldPrdComputeBo buildSoldPrdComputeBo(int uid, int num, BigDecimal prdPrice){
SellerOrderComputeResult computeResult = computeHandler.compute(prdPrice);
/**
... ... @@ -476,7 +457,11 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi
.actor(orderRequest.getTabType()).build();
}
/**
* todo
* @param req
* @return
*/
public BatchChangePriceResp batchChangePrice(BatchChangePriceReq req){
BatchChangePriceResp resp = BatchChangePriceResp.builder().successCnt(1).failCnt(1)
.tips("变价成功1个,失败1个").build();
... ... @@ -485,8 +470,10 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi
}
private static final int MAX_DEAL = 10;
private class BatchProcessTask implements Callable<SellerOrderSubmitHandler.ForkJoinResult>{
private SellerOrderContext ctx;
... ... @@ -495,23 +482,29 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi
private int num;
public BatchProcessTask(SellerOrderContext ctx, CountDownLatch countDownLatch, int num) {
private SellerWallet sellerWallet;
public BatchProcessTask(SellerOrderContext ctx, CountDownLatch countDownLatch, int num, SellerWallet sellerWallet) {
this.ctx = ctx;
this.countDownLatch = countDownLatch;
this.num = num;
this.sellerWallet = sellerWallet;
}
@Override
public SellerOrderSubmitHandler.ForkJoinResult call() throws Exception {
int uid = ctx.getUid();
int storageId = ctx.getStorageId();
log.info("{}.compute, countDownLatch count {} uid {} storageId {}",
getClass().getSimpleName(),countDownLatch.getCount(), uid, storageId);
//TODO 批量生成订单(订单表,meta 地址,算费)--> 需要用到多线程并行处理
//TODO(异步实现)同步数据到prd,记录支付,
// 批量生成订单(订单表,meta 地址,算费)--> 需要用到多线程并行处理
SellerOrderSubmitHandler.ForkJoinResult fjr = null;
try {
orderSubmitHandler.submitMultiple(ctx, num);
fjr = orderSubmitHandler.submitMultiple(ctx, num);
// (异步实现)记录保证金流水
//(异步实现)同步数据到prd,记录支付,
BatchPublishTailEvent bpte = BatchPublishTailEvent.builder().fjr(fjr).sellerWallet(sellerWallet).build();
EventBusPublisher.publishEvent(bpte);
countDownLatch.countDown();
}catch (Exception ex){
countDownLatch.countDown();
... ... @@ -519,7 +512,7 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi
}
log.info("{}.compute, countDownLatch count {} uid {} storageId {}",
getClass().getSimpleName(), countDownLatch.getCount(), uid, storageId);
return null;
return fjr;
}
}
... ...
... ... @@ -5,6 +5,7 @@ import com.yohoufo.dal.order.SkupBatchMapper;
import com.yohoufo.dal.order.model.SkupBatch;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
... ... @@ -15,9 +16,11 @@ public class SkupBatchService {
private final Logger logger = LoggerFactory.getLogger(getClass());
@Autowired
private SkupBatchMapper skupBatchMapper;
public Long generateBatchNo(int uid, int num){
logger.info("in generateBatchNo uid {} num {}", uid, num);
SkupBatch record = new SkupBatch();
record.setUid(uid);
record.setNum(num);
... ...
... ... @@ -45,7 +45,11 @@ public class SkupService {
public int batchAddSkup(List<SellerOrderGoods> sogList){
logger.info("in batchAddSameSkup, storage id {} size {}", sogList.get(0).getStorageId(), sogList.size());
return sellerOrderGoodsMapper.insertBatch(sogList);
int result = 0;
for(SellerOrderGoods sog : sogList){
result += sellerOrderGoodsMapper.insertSelective(sog);
}
return result;
}
... ...
... ... @@ -10,12 +10,15 @@ import com.yohoufo.product.model.ProductInfo;
import com.yohoufo.product.request.StoragePriceBo;
import com.yohoufo.product.response.ProductDetailResp;
import com.yohoufo.product.response.StorageDataResp;
import io.protostuff.LimitedInputStream;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
/**
... ... @@ -43,9 +46,6 @@ public class ProductProxyService {
*/
private final static String RETURN_STORAGE = "ufo.product.cancelSaleSkup";
@Autowired
private SellerOrderGoodsMapper sogMapper;
public boolean subtractStorage(Integer productId, Integer skup){
... ... @@ -174,4 +174,50 @@ public class ProductProxyService {
ApiResponse resp = ufoServiceCaller.call(syncSkup, skupReq);
return (null == resp || null == resp.getData())? false : (boolean)resp.getData();
}
static String batchCreateSkup = "ufo.product.batchCreateSkup";
static String sellerBatchUpdateStatus = "ufo.product.sellerBatchUpdateStatus";
public boolean batchCreateSkup(List<SellerOrderGoods> sogList){
List<StoragePriceBo> skupBoList = new ArrayList<>(sogList.size());
List<Integer> skupList = new ArrayList<>(sogList.size());
for(SellerOrderGoods goods : sogList){
StoragePriceBo skupReq = new StoragePriceBo();
skupReq.setSkup(goods.getId());
skupReq.setProductId(goods.getProductId());
skupReq.setGoodsId(goods.getColorId());
skupReq.setStorageId(goods.getStorageId());
skupReq.setPrice(goods.getGoodsPrice());
skupReq.setSellerUid(goods.getUid());
skupBoList.add(skupReq);
skupList.add(goods.getId());
}
ApiResponse resp = ufoServiceCaller.call(batchCreateSkup, skupBoList);
logger.info("call {} resp {}", batchCreateSkup, resp);
return (null == resp || null == resp.getData())? false : (boolean)resp.getData();
}
public enum PrdShelvelStatus{
on(1),off(2);
int code;
PrdShelvelStatus(int code) {
this.code = code;
}
public int getCode() {
return code;
}
}
public boolean sellerBatchUpdateStatus(List<Integer> skupList, PrdShelvelStatus prdShelvelStatus){
ApiResponse resp = ufoServiceCaller.call(sellerBatchUpdateStatus, skupList, prdShelvelStatus.code);
logger.info("call {} skupList {} resp {}", sellerBatchUpdateStatus, skupList, resp);
return (null == resp || null == resp.getData())? false : (boolean)resp.getData();
}
}
... ...
... ... @@ -53,6 +53,8 @@ datasources:
- com.yohoufo.dal.order.ManualTransferMapper
- com.yohoufo.dal.order.MachineIdGenerateMapper
- com.yohoufo.dal.order.SkupBatchMapper
- com.yohoufo.dal.order.SellerWalletMapper
- com.yohoufo.dal.order.SellerWalletDetailMapper
ufo_promotion:
servers:
... ...
... ... @@ -53,6 +53,8 @@ datasources:
- com.yohoufo.dal.order.ManualTransferMapper
- com.yohoufo.dal.order.MachineIdGenerateMapper
- com.yohoufo.dal.order.SkupBatchMapper
- com.yohoufo.dal.order.SellerWalletMapper
- com.yohoufo.dal.order.SellerWalletDetailMapper
ufo_promotion:
servers:
... ...