Authored by mali

订单总数

... ... @@ -44,4 +44,7 @@ public interface BuyerOrderMapper {
// 修改订单状态
int updateStatusByOrderCode(@Param("orderCode")long orderCode, @Param("uid")int uid, @Param("status")int status, @Param("targetStatus")int targetStatus, @Param("currentTime")int currentTime);
// 根据uid查询订单总数
Integer selectOrderNumByUid(@Param("uid")int uid);
}
\ No newline at end of file
... ...
... ... @@ -30,4 +30,11 @@ public interface SellerOrderMapper {
List<SellerOrder> selectBySkups(@Param("skupList") Collection<Integer> skups);
/**
* 根据用户id查询卖的单数
* @param uid
* @return
*/
Integer selectOrderNumByUid(@Param("uid") int uid);
}
\ No newline at end of file
... ...
... ... @@ -337,4 +337,11 @@
update_time = #{currentTime,jdbcType=INTEGER}
where uid = #{uid,jdbcType=INTEGER} and order_code = #{orderCode,jdbcType=BIGINT} and status = #{status, jdbcType=INTEGER}
</update>
<select id="selectOrderNumByUid" resultType="java.lang.Integer">
select
count(id)
from buyer_order
where uid = #{uid,jdbcType=INTEGER}
</select>
</mapper>
\ No newline at end of file
... ...
... ... @@ -217,4 +217,10 @@
</update>
<select id="selectOrderNumByUid" resultType="java.lang.Integer">
select
count(id)
from seller_order
where uid = #{uid,jdbcType=INTEGER}
</select>
</mapper>
\ No newline at end of file
... ...
package com.yohoufo.order.controller;
import com.google.common.collect.Lists;
import com.yohoufo.common.ApiResponse;
import com.yohoufo.order.model.request.ShoppingRequest;
import com.yohoufo.order.model.response.OrderSubmitResponse;
import com.yohoufo.order.model.response.OrderSummaryResp;
import com.yohoufo.order.model.response.PaymentResponse;
import com.yohoufo.order.service.IBuyerOrderService;
import com.yohoufo.order.service.IShoppingService;
import com.yohoufo.order.service.impl.SellerOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
... ... @@ -18,6 +22,13 @@ public class ShoppingController {
IShoppingService buyerOrderService;
@Autowired
SellerOrderService sellerOrderService;
@Autowired
IBuyerOrderService ibuyerOrderService;
/**
* 结算
* @return
... ... @@ -56,8 +67,10 @@ public class ShoppingController {
@RequestMapping(params = "method=ufo.order.summary")
public ApiResponse submit(@RequestParam(name = "uid") int uid,
@RequestParam(name = "client_type", required = false) String clientType){
OrderSummaryResp orderSummaryResp1 = sellerOrderService.selectOrderNumByUid(uid);
OrderSummaryResp orderSummaryResp2 = ibuyerOrderService.selectOrderNumByUid(uid);
// OrderSubmitResponse paymentResponse = buyerOrderService.submit(request);
return new ApiResponse.ApiResponseBuilder().code(200).data(null).message("提交订单SUCCESS").build();
return new ApiResponse.ApiResponseBuilder().code(200).data(Lists.newArrayList(orderSummaryResp1, orderSummaryResp2)).message("查询成功").build();
}
}
... ...
... ... @@ -6,8 +6,33 @@ import com.alibaba.fastjson.annotation.JSONField;
* Created by li.ma on 2018/9/27.
*/
public class OrderSummaryResp {
@JSONField()
@JSONField(name = "actor")
private String actor;
private Integer sumNum;
@JSONField(name = "sum")
private Integer sum;
public OrderSummaryResp() {
}
public OrderSummaryResp(String actor, Integer sum) {
this.actor = actor;
this.sum = sum;
}
public String getActor() {
return actor;
}
public void setActor(String actor) {
this.actor = actor;
}
public Integer getSum() {
return sum;
}
public void setSum(Integer sum) {
this.sum = sum;
}
}
... ...
... ... @@ -2,6 +2,7 @@ package com.yohoufo.order.service;
import com.yohoufo.order.model.request.OrderRequest;
import com.yohoufo.order.model.response.OrderDetailInfo;
import com.yohoufo.order.model.response.OrderSummaryResp;
public interface IBuyerOrderService extends IOrderListService, IOrderDetailService{
... ... @@ -21,4 +22,11 @@ public interface IBuyerOrderService extends IOrderListService, IOrderDetailServi
* @param orderRequest
*/
void confirm(OrderRequest orderRequest);
/**
* 根据uid查询购买的订单数目
* @param uid
* @return
*/
OrderSummaryResp selectOrderNumByUid(int uid);
}
... ...
... ... @@ -13,6 +13,7 @@ import com.yohoufo.order.common.OrderStatus;
import com.yohoufo.order.model.request.OrderListRequest;
import com.yohoufo.order.model.request.OrderRequest;
import com.yohoufo.order.model.response.OrderDetailInfo;
import com.yohoufo.order.model.response.OrderSummaryResp;
import com.yohoufo.order.service.IBuyerOrderService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
... ... @@ -122,4 +123,15 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
public PageResp getOrderList(OrderListRequest request) {
return buyerOrderListService.getOrderList(request);
}
/**
* 根据uid查询购买的订单数目
* @param uid
* @return
*/
public OrderSummaryResp selectOrderNumByUid(int uid) {
Integer num = buyerOrderMapper.selectOrderNumByUid(uid);
return null == num ? new OrderSummaryResp("sell", 0) : new OrderSummaryResp("sell", num);
}
}
... ...
... ... @@ -310,6 +310,12 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
* @return
*/
public AppraiseAddressResp queryAppraiseAddress(Integer uid) {
// TODO 根据用户id查询默认地址的省份
// TODO 根据产品给的哪些用户的省份匹配到对应的鉴定中心地址
// TODO 匹配不了,给个娄底的
return new AppraiseAddressResp("南京新与力文化传播有限公司", "18914495959", "江苏省 南京市 建邺区 嘉陵江东街国家广告园5栋楼17层");
}
}
... ...
... ... @@ -30,6 +30,7 @@ import com.yohoufo.order.model.request.OrderListRequest;
import com.yohoufo.order.model.request.OrderRequest;
import com.yohoufo.order.model.response.OrderDetailInfo;
import com.yohoufo.order.model.response.OrderListInfo;
import com.yohoufo.order.model.response.OrderSummaryResp;
import com.yohoufo.order.service.IOrderDetailService;
import com.yohoufo.order.service.IOrderListService;
import com.yohoufo.order.service.handler.SellerOrderComputeHandler;
... ... @@ -44,6 +45,7 @@ import com.yohoufo.product.model.GoodsSize;
import com.yohoufo.product.response.StorageDataResp;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
... ... @@ -406,4 +408,14 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi
return sellerOrderDetailService.getOrderDetail(orderRequest);
}
/**
* 根据用户id查询卖的单数
* @param uid
* @return
*/
public OrderSummaryResp selectOrderNumByUid(int uid) {
Integer num = sellerOrderMapper.selectOrderNumByUid(uid);
return null == num ? new OrderSummaryResp("sell", 0) : new OrderSummaryResp("sell", num);
}
}
... ...