Authored by chenchao

add statistic 4 all sub order of one order

... ... @@ -60,4 +60,6 @@ public interface AppraiseOrderMapper {
* @return
*/
List<AppraiseOrder> selectByOrderCodeList(@Param("orderList")List<Long> orderList);
List<AppraiseOrder> selectSubOrderStatistic(@Param("parentOrderCode")long parentOrderCode);
}
\ No newline at end of file
... ...
... ... @@ -35,4 +35,8 @@ public class AppraiseOrder {
private Integer attributes;
private Byte platformDeliveryStatus;
/**
* 状态分组统计
*/
private Integer statusCnt;
}
\ No newline at end of file
... ...
... ... @@ -17,6 +17,7 @@
<result column="channel_no" jdbcType="VARCHAR" property="channelNo" />
<result column="attributes" jdbcType="INTEGER" property="attributes" />
<result column="platform_delivery_status" jdbcType="TINYINT" property="platformDeliveryStatus" />
<result column="status_cnt" jdbcType="INTEGER" property="statusCnt"/>
</resultMap>
<sql id="Base_Column_List">
id, uid, parent_order_code, order_code, client_type, payment, amount, ship_fee, status,
... ... @@ -272,4 +273,10 @@
#{orderCode,jdbcType=BIGINT}
</foreach>
</select>
<select id="selectSubOrderStatistic" resultMap="BaseResultMap">
select parent_order_code,status, count(*) status_cnt from ufo_order.appraise_order
where parent_order_code = #{parentOrderCode,jdbcType=BIGINT}
group by status
</select>
</mapper>
\ No newline at end of file
... ...
... ... @@ -3,6 +3,7 @@ package com.yohoufo.order.service.seller.deposit;
import com.alibaba.fastjson.JSONObject;
import com.yoho.error.ServiceError;
import com.yoho.error.exception.ServiceException;
import com.yohobuy.ufo.model.order.bo.AppraiseOrderBo;
import com.yohobuy.ufo.model.order.bo.OrderInfo;
import com.yohobuy.ufo.model.order.common.AppraiseOrderStatus;
import com.yohobuy.ufo.model.order.common.OrderAttributes;
... ... @@ -54,6 +55,8 @@ import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
@Service
public class SellerDepositOrderService extends AbsGoodsServiceOrderService implements IGoodsService {
... ... @@ -587,4 +590,21 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple
logger.info("processAfterPay seller deposit order , SellerDepositOrderCancelAsyncEvent send out, event {}", event);
}
public List<AppraiseOrderBo> getSubOrderStatistic(long orderCode){
AppraiseOrder appraiseOrder = appraiseOrderMapper.selectByOrderCode(orderCode);
if (Objects.isNull(appraiseOrder)){
logger.warn("in getSubOrderStatistic selectByOrderCode null, orderCode {}", orderCode);
return null;
}
long occ = appraiseOrder.getParentOrderCode()==null ? orderCode : appraiseOrder.getParentOrderCode();
List<AppraiseOrder> paoList = appraiseOrderMapper.selectSubOrderStatistic(occ);
logger.info("getSubOrderStatistic orderCode {} ParentOrderCode {} AppraiseOrder list {}", orderCode, occ, paoList);
return paoList.parallelStream().map(pao->AppraiseOrderBo.builder()
.parentOrderCode(pao.getParentOrderCode())
.orderCode(orderCode).status(pao.getStatus()).statusCnt(pao.getStatusCnt()).build())
.collect(Collectors.toList());
}
}
... ...
package com.yohoufo.order.service.seller.deposit;
import com.alibaba.fastjson.JSONObject;
import com.yohobuy.ufo.model.order.bo.AppraiseOrderBo;
import com.yohoufo.order.BaseWebTest;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
public class SellerDepositOrderServiceTest extends BaseWebTest {
@Autowired
private SellerDepositOrderService sellerDepositOrderService;
@Test
public void testGetSubOrderStatistic(){
//sub 36378862305176
//parent 36378836393815L
long orderCode = 36378862305176L;//
List<AppraiseOrderBo> list = sellerDepositOrderService.getSubOrderStatistic(orderCode);
System.out.println("in testGetSubOrderStatistic result" + JSONObject.toJSONString(list));
}
}
... ...
... ... @@ -35,6 +35,20 @@ datasources:
- com.yohoufo.dal.product.PriceTrendMonthMapper
- com.yohoufo.dal.product.PriceTrendHalfYearMapper
- com.yohoufo.dal.product.PriceTrendDayMapper
- com.yohoufo.dal.product.ProductImportTranItemMapper
- com.yohoufo.dal.product.TransferRecordsMapper
- com.yohoufo.dal.product.TransferRecordsHistoryMapper
- com.yohoufo.dal.product.ProductSalesMapper
- com.yohoufo.dal.product.ProductLimitSaleMapper
- com.yohoufo.dal.product.ProductSelfShelvesMapper
- com.yohoufo.dal.product.ProductSelfShelvesPicMapper
- com.yohoufo.dal.product.SecondhandFlawMapper
- com.yohoufo.dal.product.SecondhandImagesMapper
- com.yohoufo.dal.product.SecondhandInfoMapper
- com.yohoufo.dal.product.SelfSizeMapper
- com.yohoufo.dal.product.SelfSizeUidMapper
- com.yohoufo.dal.product.ProductProfitMapper
ufo_order:
servers:
... ... @@ -79,9 +93,31 @@ datasources:
- com.yohoufo.dal.order.SellerEnterApplyMapper
- com.yohoufo.dal.order.SellerFuncMapper
- com.yohoufo.dal.order.SellerLevelFuncMapper
- com.yohoufo.dal.order.OrderOverTimeMapper
- com.yohoufo.dal.order.BuyerOrderViewMapper
- com.yohoufo.dal.order.SellerJoinHistoryMapper
- com.yohoufo.dal.order.SellerChangePriceRecordMapper
- com.yohoufo.dal.order.InviteActivityMapper
- com.yohoufo.dal.order.InviteRecordMapper
- com.yohoufo.dal.order.InviterMapper
- com.yohoufo.dal.order.InviteSettlementItemMapper
- com.yohoufo.dal.order.InviteSettlementMapper
- com.yohoufo.dal.order.InviteCodeSequenceMapper
- com.yohoufo.dal.order.InviteCodeSequenceRandomMapper
- com.yohoufo.dal.order.SellerGoodsStatusFlowMapper
- com.yohoufo.dal.order.CmsPayMapper
- com.yohoufo.dal.order.OrdersPayHbfqMapper
- com.yohoufo.dal.order.BlackUserMapper
- com.yohoufo.dal.order.StorageDepositMapper
- com.yohoufo.dal.order.DepositOrderMapper
- com.yohoufo.dal.order.SellerOrderStatsConfigMapper
- com.yohoufo.dal.order.SellerOrderStatsResultMapper
- com.yohoufo.dal.order.AlipayBlackUserMapper
- com.yohoufo.dal.order.AppraiseOrderMapper
- com.yohoufo.dal.order.AppraiseOrderGoodsMapper
- com.yohoufo.dal.order.AppraiseOrderMetaMapper
- com.yohoufo.dal.order.AppraiseOrderStorageMapper
- com.yohoufo.dal.order.DepositCodeMapper
- com.yohoufo.dal.order.SellerServiceFeeRuleMapper
ufo_promotion:
... ...