Authored by mingdan.ge

预估收入

... ... @@ -3,6 +3,7 @@ package com.yoho.unions.dal;
import com.yoho.service.model.union.bo.UnionShareOrdersUidBo;
import com.yoho.service.model.union.request.UnionShareOrderReqBO;
import com.yoho.service.model.union.request.UnionShareOrderSearchReqBO;
import com.yoho.service.model.union.response.UnionShareStatisticsRspBO;
import com.yoho.unions.dal.model.UnionShareOrders;
import com.yoho.unions.dal.model.UnionShareOrdersMonth;
import org.apache.ibatis.annotations.MapKey;
... ... @@ -70,6 +71,7 @@ public interface UnionShareOrdersMapper {
Integer selectOrderListCount(@Param("params") UnionShareOrderReqBO unionShareOrderReqBO);
List<UnionShareOrders> selectListForStatistics(@Param("uid") int uid, @Param("beginTime") int beginTime, @Param("endTime") int endTime);
UnionShareStatisticsRspBO selectStatistics(@Param("uid") int uid, @Param("beginTime") int beginTime, @Param("endTime") int endTime);
List<UnionShareOrders> selectNewPromoteUidsOrder(@Param("promoteUids") Set<Integer> promoteUids, @Param("endTime") int endTime);
... ...
... ... @@ -570,6 +570,20 @@
and order_time &lt;#{endTime}
</if>
</select>
<select id="selectStatistics" resultType="com.yoho.service.model.union.response.UnionShareStatisticsRspBO">
select sum(extra_amount) extraAmountSum,sum(order_amount) orderAmountSum,count(order_code) orderNum
from union_share_orders
where status in (10,20,30,40)
<if test="uid!=null">
and promote_uid =#{uid}
</if>
<if test="beginTime != null and beginTime != 0" >
and order_time &gt; #{beginTime}
</if>
<if test="endTime != null and endTime != 0" >
and order_time &lt;#{endTime}
</if>
</select>
<select id="selectNewPromoteUidsOrder" resultMap="BaseResultMap">
select <include refid="Base_Column_List" />
from union_share_orders
... ...
... ... @@ -2453,22 +2453,28 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
Map<String, Integer> paramMap = getQueryParam(bo.getQueryTimeType());
Integer startTime = paramMap.get("startTime");
Integer endTime = paramMap.get("endTime");
List<UnionShareOrders> orderList = unionShareOrdersMapper.selectListForStatistics(bo.getUid(), startTime, endTime);
//预估订单收入
BigDecimal orderAmountSum = BigDecimal.valueOf(0);
//预估其它收入
BigDecimal extraAmountSum = BigDecimal.valueOf(0);
//订单数
int orderNum = 0;
for(UnionShareOrders order : orderList) {
orderAmountSum = orderAmountSum.add(order.getOrderAmount());
extraAmountSum = extraAmountSum.add(order.getExtraAmount());
orderNum += 1;
// List<UnionShareOrders> orderList = unionShareOrdersMapper.selectListForStatistics(bo.getUid(), startTime, endTime);
// //预估订单收入
// BigDecimal orderAmountSum = BigDecimal.valueOf(0);
// //预估其它收入
// BigDecimal extraAmountSum = BigDecimal.valueOf(0);
// //订单数
// int orderNum = 0;
// for(UnionShareOrders order : orderList) {
// orderAmountSum = orderAmountSum.add(order.getOrderAmount());
// extraAmountSum = extraAmountSum.add(order.getExtraAmount());
// orderNum += 1;
// }
// rspBo.setOrderAmountSum(orderAmountSum);
// rspBo.setExtraAmountSum(extraAmountSum);
// rspBo.setOrderNum(orderNum);
rspBo = unionShareOrdersMapper.selectStatistics(bo.getUid(), startTime, endTime);
if (rspBo.getExtraAmountSum() == null) {
rspBo.setExtraAmountSum(new BigDecimal(0));
}
if (rspBo.getOrderAmountSum() == null) {
rspBo.setOrderAmountSum(new BigDecimal(0));
}
rspBo.setOrderAmountSum(orderAmountSum);
rspBo.setExtraAmountSum(extraAmountSum);
rspBo.setOrderNum(orderNum);
rspBo.setClickNum(getClickNum(bo.getUid(), paramMap.get("startDate"), paramMap.get("endDate")));//点击数
logger.info("getStatisticsInfo ,req is {},paramMap is {},rspBo is {}.",bo,paramMap,rspBo);
//设置缓存
... ...