Authored by chenchao

add statistic 4 all sub order of one order

@@ -60,4 +60,6 @@ public interface AppraiseOrderMapper { @@ -60,4 +60,6 @@ public interface AppraiseOrderMapper {
60 * @return 60 * @return
61 */ 61 */
62 List<AppraiseOrder> selectByOrderCodeList(@Param("orderList")List<Long> orderList); 62 List<AppraiseOrder> selectByOrderCodeList(@Param("orderList")List<Long> orderList);
  63 +
  64 + List<AppraiseOrder> selectSubOrderStatistic(@Param("parentOrderCode")long parentOrderCode);
63 } 65 }
@@ -35,4 +35,8 @@ public class AppraiseOrder { @@ -35,4 +35,8 @@ public class AppraiseOrder {
35 private Integer attributes; 35 private Integer attributes;
36 36
37 private Byte platformDeliveryStatus; 37 private Byte platformDeliveryStatus;
  38 + /**
  39 + * 状态分组统计
  40 + */
  41 + private Integer statusCnt;
38 } 42 }
@@ -17,6 +17,7 @@ @@ -17,6 +17,7 @@
17 <result column="channel_no" jdbcType="VARCHAR" property="channelNo" /> 17 <result column="channel_no" jdbcType="VARCHAR" property="channelNo" />
18 <result column="attributes" jdbcType="INTEGER" property="attributes" /> 18 <result column="attributes" jdbcType="INTEGER" property="attributes" />
19 <result column="platform_delivery_status" jdbcType="TINYINT" property="platformDeliveryStatus" /> 19 <result column="platform_delivery_status" jdbcType="TINYINT" property="platformDeliveryStatus" />
  20 + <result column="status_cnt" jdbcType="INTEGER" property="statusCnt"/>
20 </resultMap> 21 </resultMap>
21 <sql id="Base_Column_List"> 22 <sql id="Base_Column_List">
22 id, uid, parent_order_code, order_code, client_type, payment, amount, ship_fee, status, 23 id, uid, parent_order_code, order_code, client_type, payment, amount, ship_fee, status,
@@ -272,4 +273,10 @@ @@ -272,4 +273,10 @@
272 #{orderCode,jdbcType=BIGINT} 273 #{orderCode,jdbcType=BIGINT}
273 </foreach> 274 </foreach>
274 </select> 275 </select>
  276 +
  277 + <select id="selectSubOrderStatistic" resultMap="BaseResultMap">
  278 + select parent_order_code,status, count(*) status_cnt from ufo_order.appraise_order
  279 + where parent_order_code = #{parentOrderCode,jdbcType=BIGINT}
  280 + group by status
  281 + </select>
275 </mapper> 282 </mapper>
@@ -3,6 +3,7 @@ package com.yohoufo.order.service.seller.deposit; @@ -3,6 +3,7 @@ package com.yohoufo.order.service.seller.deposit;
3 import com.alibaba.fastjson.JSONObject; 3 import com.alibaba.fastjson.JSONObject;
4 import com.yoho.error.ServiceError; 4 import com.yoho.error.ServiceError;
5 import com.yoho.error.exception.ServiceException; 5 import com.yoho.error.exception.ServiceException;
  6 +import com.yohobuy.ufo.model.order.bo.AppraiseOrderBo;
6 import com.yohobuy.ufo.model.order.bo.OrderInfo; 7 import com.yohobuy.ufo.model.order.bo.OrderInfo;
7 import com.yohobuy.ufo.model.order.common.AppraiseOrderStatus; 8 import com.yohobuy.ufo.model.order.common.AppraiseOrderStatus;
8 import com.yohobuy.ufo.model.order.common.OrderAttributes; 9 import com.yohobuy.ufo.model.order.common.OrderAttributes;
@@ -54,6 +55,8 @@ import org.springframework.stereotype.Service; @@ -54,6 +55,8 @@ import org.springframework.stereotype.Service;
54 import java.math.BigDecimal; 55 import java.math.BigDecimal;
55 import java.util.List; 56 import java.util.List;
56 import java.util.Map; 57 import java.util.Map;
  58 +import java.util.Objects;
  59 +import java.util.stream.Collectors;
57 60
58 @Service 61 @Service
59 public class SellerDepositOrderService extends AbsGoodsServiceOrderService implements IGoodsService { 62 public class SellerDepositOrderService extends AbsGoodsServiceOrderService implements IGoodsService {
@@ -587,4 +590,21 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple @@ -587,4 +590,21 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple
587 logger.info("processAfterPay seller deposit order , SellerDepositOrderCancelAsyncEvent send out, event {}", event); 590 logger.info("processAfterPay seller deposit order , SellerDepositOrderCancelAsyncEvent send out, event {}", event);
588 591
589 } 592 }
  593 +
  594 +
  595 +
  596 + public List<AppraiseOrderBo> getSubOrderStatistic(long orderCode){
  597 + AppraiseOrder appraiseOrder = appraiseOrderMapper.selectByOrderCode(orderCode);
  598 + if (Objects.isNull(appraiseOrder)){
  599 + logger.warn("in getSubOrderStatistic selectByOrderCode null, orderCode {}", orderCode);
  600 + return null;
  601 + }
  602 + long occ = appraiseOrder.getParentOrderCode()==null ? orderCode : appraiseOrder.getParentOrderCode();
  603 + List<AppraiseOrder> paoList = appraiseOrderMapper.selectSubOrderStatistic(occ);
  604 + logger.info("getSubOrderStatistic orderCode {} ParentOrderCode {} AppraiseOrder list {}", orderCode, occ, paoList);
  605 + return paoList.parallelStream().map(pao->AppraiseOrderBo.builder()
  606 + .parentOrderCode(pao.getParentOrderCode())
  607 + .orderCode(orderCode).status(pao.getStatus()).statusCnt(pao.getStatusCnt()).build())
  608 + .collect(Collectors.toList());
  609 + }
590 } 610 }
  1 +package com.yohoufo.order.service.seller.deposit;
  2 +
  3 +import com.alibaba.fastjson.JSONObject;
  4 +import com.yohobuy.ufo.model.order.bo.AppraiseOrderBo;
  5 +import com.yohoufo.order.BaseWebTest;
  6 +import org.junit.Test;
  7 +import org.springframework.beans.factory.annotation.Autowired;
  8 +
  9 +import java.util.List;
  10 +
  11 +public class SellerDepositOrderServiceTest extends BaseWebTest {
  12 + @Autowired
  13 + private SellerDepositOrderService sellerDepositOrderService;
  14 +
  15 + @Test
  16 + public void testGetSubOrderStatistic(){
  17 + //sub 36378862305176
  18 + //parent 36378836393815L
  19 + long orderCode = 36378862305176L;//
  20 + List<AppraiseOrderBo> list = sellerDepositOrderService.getSubOrderStatistic(orderCode);
  21 + System.out.println("in testGetSubOrderStatistic result" + JSONObject.toJSONString(list));
  22 + }
  23 +}
@@ -35,6 +35,20 @@ datasources: @@ -35,6 +35,20 @@ datasources:
35 - com.yohoufo.dal.product.PriceTrendMonthMapper 35 - com.yohoufo.dal.product.PriceTrendMonthMapper
36 - com.yohoufo.dal.product.PriceTrendHalfYearMapper 36 - com.yohoufo.dal.product.PriceTrendHalfYearMapper
37 - com.yohoufo.dal.product.PriceTrendDayMapper 37 - com.yohoufo.dal.product.PriceTrendDayMapper
  38 + - com.yohoufo.dal.product.ProductImportTranItemMapper
  39 + - com.yohoufo.dal.product.TransferRecordsMapper
  40 + - com.yohoufo.dal.product.TransferRecordsHistoryMapper
  41 + - com.yohoufo.dal.product.ProductSalesMapper
  42 + - com.yohoufo.dal.product.ProductLimitSaleMapper
  43 + - com.yohoufo.dal.product.ProductSelfShelvesMapper
  44 + - com.yohoufo.dal.product.ProductSelfShelvesPicMapper
  45 + - com.yohoufo.dal.product.SecondhandFlawMapper
  46 + - com.yohoufo.dal.product.SecondhandImagesMapper
  47 + - com.yohoufo.dal.product.SecondhandInfoMapper
  48 + - com.yohoufo.dal.product.SelfSizeMapper
  49 + - com.yohoufo.dal.product.SelfSizeUidMapper
  50 + - com.yohoufo.dal.product.ProductProfitMapper
  51 +
38 52
39 ufo_order: 53 ufo_order:
40 servers: 54 servers:
@@ -79,9 +93,31 @@ datasources: @@ -79,9 +93,31 @@ datasources:
79 - com.yohoufo.dal.order.SellerEnterApplyMapper 93 - com.yohoufo.dal.order.SellerEnterApplyMapper
80 - com.yohoufo.dal.order.SellerFuncMapper 94 - com.yohoufo.dal.order.SellerFuncMapper
81 - com.yohoufo.dal.order.SellerLevelFuncMapper 95 - com.yohoufo.dal.order.SellerLevelFuncMapper
  96 + - com.yohoufo.dal.order.OrderOverTimeMapper
  97 + - com.yohoufo.dal.order.BuyerOrderViewMapper
  98 + - com.yohoufo.dal.order.SellerJoinHistoryMapper
  99 + - com.yohoufo.dal.order.SellerChangePriceRecordMapper
  100 + - com.yohoufo.dal.order.InviteActivityMapper
  101 + - com.yohoufo.dal.order.InviteRecordMapper
  102 + - com.yohoufo.dal.order.InviterMapper
  103 + - com.yohoufo.dal.order.InviteSettlementItemMapper
  104 + - com.yohoufo.dal.order.InviteSettlementMapper
  105 + - com.yohoufo.dal.order.InviteCodeSequenceMapper
  106 + - com.yohoufo.dal.order.InviteCodeSequenceRandomMapper
  107 + - com.yohoufo.dal.order.SellerGoodsStatusFlowMapper
  108 + - com.yohoufo.dal.order.CmsPayMapper
  109 + - com.yohoufo.dal.order.OrdersPayHbfqMapper
  110 + - com.yohoufo.dal.order.BlackUserMapper
  111 + - com.yohoufo.dal.order.StorageDepositMapper
  112 + - com.yohoufo.dal.order.DepositOrderMapper
82 - com.yohoufo.dal.order.SellerOrderStatsConfigMapper 113 - com.yohoufo.dal.order.SellerOrderStatsConfigMapper
83 - com.yohoufo.dal.order.SellerOrderStatsResultMapper 114 - com.yohoufo.dal.order.SellerOrderStatsResultMapper
84 - com.yohoufo.dal.order.AlipayBlackUserMapper 115 - com.yohoufo.dal.order.AlipayBlackUserMapper
  116 + - com.yohoufo.dal.order.AppraiseOrderMapper
  117 + - com.yohoufo.dal.order.AppraiseOrderGoodsMapper
  118 + - com.yohoufo.dal.order.AppraiseOrderMetaMapper
  119 + - com.yohoufo.dal.order.AppraiseOrderStorageMapper
  120 + - com.yohoufo.dal.order.DepositCodeMapper
85 - com.yohoufo.dal.order.SellerServiceFeeRuleMapper 121 - com.yohoufo.dal.order.SellerServiceFeeRuleMapper
86 122
87 ufo_promotion: 123 ufo_promotion: