...
|
...
|
@@ -4,6 +4,7 @@ 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.DepositOrderStatisticInfo;
|
|
|
import com.yohobuy.ufo.model.order.bo.OrderInfo;
|
|
|
import com.yohobuy.ufo.model.order.common.AppraiseOrderStatus;
|
|
|
import com.yohobuy.ufo.model.order.common.OrderAttributes;
|
...
|
...
|
@@ -53,6 +54,7 @@ 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.Map;
|
|
|
import java.util.Objects;
|
...
|
...
|
@@ -594,17 +596,77 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple |
|
|
|
|
|
|
|
|
public List<AppraiseOrderBo> getSubOrderStatistic(long orderCode){
|
|
|
List<AppraiseOrder> paoList = buildSubOrderStatisticList(orderCode);
|
|
|
return paoList.parallelStream().map(pao->AppraiseOrderBo.builder()
|
|
|
.parentOrderCode(pao.getParentOrderCode())
|
|
|
.orderCode(orderCode).status(pao.getStatus()).statusCnt(pao.getStatusCnt()).build())
|
|
|
.collect(Collectors.toList());
|
|
|
}
|
|
|
|
|
|
private List<AppraiseOrder> buildSubOrderStatisticList(long orderCode){
|
|
|
AppraiseOrder appraiseOrder = appraiseOrderMapper.selectByOrderCode(orderCode);
|
|
|
if (Objects.isNull(appraiseOrder)){
|
|
|
logger.warn("in getSubOrderStatistic selectByOrderCode null, orderCode {}", orderCode);
|
|
|
return null;
|
|
|
return new ArrayList<>(0);
|
|
|
}
|
|
|
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());
|
|
|
return paoList;
|
|
|
}
|
|
|
|
|
|
public DepositOrderStatisticInfo getAppraiseProgress(int uid, long orderCode){
|
|
|
List<AppraiseOrder> paoList = buildSubOrderStatisticList(orderCode);
|
|
|
|
|
|
//申请
|
|
|
int applyTotal = 0;
|
|
|
int shamNum = 0;
|
|
|
//鉴定为假
|
|
|
Integer fakeNum = 0;
|
|
|
//无法鉴定
|
|
|
Integer unsureNum = 0;
|
|
|
//鉴定通过
|
|
|
Integer passNum = 0;
|
|
|
//鉴定瑕疵
|
|
|
Integer flawNum = 0;
|
|
|
int waitingAppraiseNum = 0;
|
|
|
for (AppraiseOrder pao : paoList){
|
|
|
int cnt = pao.getStatusCnt();
|
|
|
AppraiseOrderStatus orderStatus = AppraiseOrderStatus.getByCode(pao.getStatus());
|
|
|
switch (orderStatus){
|
|
|
case SHAM_SEND_OUT:
|
|
|
shamNum = cnt;
|
|
|
break;
|
|
|
case PLATFORM_APPRAISE_UNSURE:
|
|
|
unsureNum = cnt;
|
|
|
break;
|
|
|
case JUDGE_PASS:
|
|
|
passNum = cnt;
|
|
|
break;
|
|
|
case CHECKING_FAKE:
|
|
|
fakeNum = cnt;
|
|
|
break;
|
|
|
case QUALITY_CHECK_FAKE:
|
|
|
flawNum = cnt;
|
|
|
break;
|
|
|
case PLATFORM_RECEIVE:
|
|
|
waitingAppraiseNum = cnt;
|
|
|
break;
|
|
|
}
|
|
|
applyTotal += cnt;
|
|
|
}
|
|
|
//实收
|
|
|
Integer receiveTotal = applyTotal - shamNum;
|
|
|
DepositOrderStatisticInfo dosi = DepositOrderStatisticInfo.builder()
|
|
|
.applyTotal(applyTotal)
|
|
|
.unsureNum(unsureNum)
|
|
|
.passNum(passNum)
|
|
|
.fakeNum(fakeNum)
|
|
|
.flawNum(flawNum)
|
|
|
.receiveTotal(receiveTotal)
|
|
|
.waitingAppraiseNum(waitingAppraiseNum)
|
|
|
.build();
|
|
|
|
|
|
return dosi;
|
|
|
}
|
|
|
} |
...
|
...
|
|