Authored by chenchao

fix seller order detail data sql

... ... @@ -57,4 +57,5 @@ public interface SellerOrderGoodsMapper {
int insertBatch(@Param("records") Collection<SellerOrderGoods> records);
SellerOrderGoods selectByUidStatusGBBN(SellerOrderGoods record);
}
\ No newline at end of file
... ...
... ... @@ -339,4 +339,14 @@
order by id desc
limit #{offset, jdbcType=INTEGER}, #{limit, jdbcType=INTEGER}
</select>
<select id="selectByUidStatusGBBN" parameterType="com.yohoufo.dal.order.model.SellerOrderGoods" resultMap="BaseResultMap">
select <include refid="Base_Column_List" />,count(*) num,GROUP_CONCAT(id) skup_list from seller_order_goods
where uid = #{uid,jdbcType=INTEGER} and is_del = 1
and batch_no = #{batchNo,jdbcType=BIGINT}
and goods_price = #{goodsPrice,jdbcType=DECIMAL}
and status = #{status,jdbcType=TINYINT}
group by batch_no , goods_price ,`status`
limit 1
</select>
</mapper>
\ No newline at end of file
... ...
... ... @@ -10,16 +10,19 @@ import com.yohoufo.order.model.response.GoodsInfo;
*/
public class GoodsInfoConvertor {
public static GoodsInfo SellerOrderGoods2GoodsInfo(SellerOrderGoods sellerOrderGoods) {
public static GoodsInfo SellerOrderGoods2GoodsInfo(SellerOrderGoods sog) {
GoodsInfo goodsInfo = new GoodsInfo();
goodsInfo.setSkup(sellerOrderGoods.getId());
goodsInfo.setProductName(sellerOrderGoods.getProductName());
goodsInfo.setColorName(sellerOrderGoods.getColorName());
goodsInfo.setSizeName(sellerOrderGoods.getSizeName());
goodsInfo.setGoodImg(ImageUrlAssist.getAllProductPicUrl(sellerOrderGoods.getImageUrl(), "goodsimg", "center", "d2hpdGU="));
goodsInfo.setGoodPrice(sellerOrderGoods.getGoodsPrice().toPlainString());
goodsInfo.setProductId(sellerOrderGoods.getProductId());
goodsInfo.setStorageId(sellerOrderGoods.getStorageId());
goodsInfo.setSkup(sog.getId());
goodsInfo.setProductName(sog.getProductName());
goodsInfo.setColorName(sog.getColorName());
goodsInfo.setSizeName(sog.getSizeName());
goodsInfo.setGoodImg(ImageUrlAssist.getAllProductPicUrl(sog.getImageUrl(), "goodsimg", "center", "d2hpdGU="));
goodsInfo.setGoodPrice(sog.getGoodsPrice().toPlainString());
goodsInfo.setProductId(sog.getProductId());
goodsInfo.setStorageId(sog.getStorageId());
goodsInfo.setStorageNum(sog.getNum());
goodsInfo.setSkupList(sog.getSkupList());
goodsInfo.setBatchNo(sog.getBatchNo());
return goodsInfo;
}
... ...
... ... @@ -8,6 +8,13 @@ public class GoodsInfo {
int skup;
/**
* 批次号
*/
private Long batchNo;
private String skupList;
private Integer storageId;
private Integer productId;
/**
... ... @@ -32,4 +39,9 @@ public class GoodsInfo {
* 商品价格
*/
String goodPrice;
/**
* 同一个批次的数量
*/
private Integer storageNum;
}
... ...
... ... @@ -7,11 +7,16 @@ import com.yohoufo.common.utils.DateUtil;
import com.yohoufo.dal.order.BuyerOrderMapper;
import com.yohoufo.dal.order.OrderCouponMapper;
import com.yohoufo.dal.order.SellerOrderGoodsMapper;
import com.yohoufo.dal.order.SellerOrderMapper;
import com.yohoufo.dal.order.model.OrderCoupon;
import com.yohoufo.dal.order.model.SellerOrder;
import com.yohoufo.dal.order.model.SellerOrderGoods;
import com.yohoufo.order.common.RefundCase;
import com.yohoufo.order.event.BeforeDepotReceiveEvent;
import com.yohoufo.order.event.BeforeSellerDeliverEvent;
import com.yohoufo.order.event.BillLogEvent;
import com.yohoufo.order.model.bo.CouponBo;
import com.yohoufo.order.model.request.PaymentRequest;
import com.yohoufo.order.service.IPaymentService;
import com.yohoufo.order.service.concurrent.ThreadPoolFactory;
import com.yohoufo.order.service.proxy.CouponProxyService;
... ... @@ -24,6 +29,7 @@ import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestParam;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.concurrent.*;
/**
... ... @@ -52,6 +58,11 @@ public class BuyerOrderCancelService {
private IPaymentService paymentService;
@Autowired
private SellerOrderMapper sellerOrderMapper;
@Autowired
private PayRefundService payRefundService;
public void cancel(BeforeSellerDeliverEvent bsdEvent){
... ... @@ -74,6 +85,18 @@ public class BuyerOrderCancelService {
//TODO 整个过程异步去执行(考虑退费依赖订单状态)
//(退费)退保证金给卖家
SellerOrder sellerOrder = sellerOrderMapper.selectByOrderCode(orderCode);
int sellerUid = sellerOrder.getUid();
long sellerOrderCode = sellerOrder.getOrderCode();
BigDecimal earnestMoney = sellerOrder.getEarnestMoney();
PaymentRequest req = PaymentRequest.builder().uid(sellerUid)
.orderCode(sellerOrderCode).refundAmount(earnestMoney.doubleValue())
.build();
BillLogEvent.BillLogEventBuilder bleb = BillLogEvent.builder()
.buyerUid(buyerUid).sellerUid(sellerUid).orderCode(sellerOrder.getOrderCode())
.payType(sellerOrder.getPayment()).refundCase(RefundCase.SELLER_EARNEST_MONEY)
.skup(skup);
payRefundService.refund(req, bleb);
//(转账)瓜分指定赔偿款给卖家和平台
//(退费)扣除赔偿款,计算剩余的货款,退给买家
... ... @@ -103,6 +126,7 @@ public class BuyerOrderCancelService {
//TODO 整个过程异步去执行(考虑退费依赖订单状态)
//(退费)退保证金给卖家
//(转账)瓜分指定赔偿款给卖家和平台
//(退费)扣除赔偿款,计算剩余的货款,退给买家
}
... ...
... ... @@ -121,11 +121,21 @@ public class SellerOrderDetailService extends AbsOrderDetailService implements I
&& OrderCodeType.SELLER_RECHARGE_EARNEST_TYPE.getType() == sellerOrder.getPayment();
SellerType sellerType = isEntry ? SellerType.ENTRY : SellerType.COMMON;
Integer skup = sellerOrder.getSkup();
SellerOrderGoods sellerOrderGoods = sellerOrderGoodsMapper.selectByPrimaryKey(skup);
Integer skupStatusCode = sellerOrderGoods.getStatus();
SellerOrderGoods sogc = new SellerOrderGoods();
sogc.setUid(uid);
sogc.setGoodsPrice(sellerOrderGoods.getGoodsPrice());
sogc.setBatchNo(sellerOrderGoods.getBatchNo());
sogc.setStatus(skupStatusCode);
SellerOrderGoods tsog = sellerOrderGoodsMapper.selectByUidStatusGBBN(sogc);
SkupStatus skupStatus = SkupStatus.getSkupStatus(skupStatusCode);
AddressInfo addressInfo = sellerAddressService.getHiddenAddressInfo(uid, skup);
orderDetailInfo = buildOrderDetail(sellerOrder, skupStatus, sellerOrderGoods, addressInfo, sellerType);
orderDetailInfo = buildOrderDetail(sellerOrder, skupStatus, tsog, addressInfo, sellerType);
}else{
orderDetailInfo = super.getOrderDetail(orderRequest);
}
... ...