小程序订单统计接口
This commit is contained in:
parent
46541296bf
commit
f4f37ee068
|
|
@ -27,8 +27,11 @@ import com.ghy.payment.domain.FinancialDetail;
|
||||||
import com.ghy.payment.domain.FinancialMaster;
|
import com.ghy.payment.domain.FinancialMaster;
|
||||||
import com.ghy.payment.service.FinancialDetailService;
|
import com.ghy.payment.service.FinancialDetailService;
|
||||||
import com.ghy.payment.service.FinancialMasterService;
|
import com.ghy.payment.service.FinancialMasterService;
|
||||||
|
import com.ghy.web.pojo.vo.OrderStatisticsRequest;
|
||||||
|
import com.ghy.web.pojo.vo.OrderStatisticsResponse;
|
||||||
import com.ghy.worker.domain.Worker;
|
import com.ghy.worker.domain.Worker;
|
||||||
import com.ghy.worker.service.WorkerService;
|
import com.ghy.worker.service.WorkerService;
|
||||||
|
import org.apache.commons.lang3.exception.ExceptionUtils;
|
||||||
import org.apache.commons.lang3.time.DateUtils;
|
import org.apache.commons.lang3.time.DateUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
|
|
@ -353,4 +356,30 @@ public class OrderController extends BaseController {
|
||||||
financialDetailService.insertFinancialDetail(financialDetail);
|
financialDetailService.insertFinancialDetail(financialDetail);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单统计
|
||||||
|
* */
|
||||||
|
@PostMapping("/app/statistics")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult orderStatistics(@RequestBody OrderStatisticsRequest request) {
|
||||||
|
OrderStatisticsResponse response = new OrderStatisticsResponse();
|
||||||
|
|
||||||
|
try {
|
||||||
|
OrderMaster orderMaster = new OrderMaster();
|
||||||
|
orderMaster.setOrderStatus(OrderStatus.RECEIVE.code());
|
||||||
|
orderMaster.setWorkerId(request.getWorkerId());
|
||||||
|
// 统计新订单的单量
|
||||||
|
response.setNewOrderNum(orderMasterService.countOrderMasterList(orderMaster));
|
||||||
|
// 统计未排的单量
|
||||||
|
orderMaster.setOrderStatus(OrderStatus.PLAIN.code());
|
||||||
|
response.setPlanOrderNum(orderMasterService.countOrderMasterList(orderMaster));
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
logger.error(ExceptionUtils.getStackTrace(e));
|
||||||
|
return AjaxResult.error(e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
return AjaxResult.success(response);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
package com.ghy.web.pojo.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单统计请求对象
|
||||||
|
*
|
||||||
|
* @author ydq
|
||||||
|
* @date : 2022-07-12 22:59
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class OrderStatisticsRequest {
|
||||||
|
private Long workerId;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
package com.ghy.web.pojo.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单统计响应对象
|
||||||
|
*
|
||||||
|
* @author ydq
|
||||||
|
* @date : 2022-07-12 22:59
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class OrderStatisticsResponse {
|
||||||
|
private long planOrderNum;
|
||||||
|
private long newOrderNum;
|
||||||
|
}
|
||||||
|
|
@ -31,6 +31,12 @@ public interface OrderMasterMapper {
|
||||||
*/
|
*/
|
||||||
List<OrderMaster> selectOrderMasterList(OrderMaster orderMaster);
|
List<OrderMaster> selectOrderMasterList(OrderMaster orderMaster);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param orderMaster 主订单入参
|
||||||
|
* @return 满足条件的主单单量
|
||||||
|
* */
|
||||||
|
Long countOrderMasterList(OrderMaster orderMaster);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param orderMasterId 主订单id
|
* @param orderMasterId 主订单id
|
||||||
* @return 主订单
|
* @return 主订单
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,11 @@ public interface OrderMasterService {
|
||||||
*/
|
*/
|
||||||
List<OrderMaster> selectOrderMasterList(OrderMaster orderMaster);
|
List<OrderMaster> selectOrderMasterList(OrderMaster orderMaster);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param orderMaster 主订单入参
|
||||||
|
* @return 满足条件的主单单量
|
||||||
|
* */
|
||||||
|
Long countOrderMasterList(OrderMaster orderMaster);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param orderMasterId 主订单id
|
* @param orderMasterId 主订单id
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,11 @@ public class OrderMasterServiceImpl implements OrderMasterService {
|
||||||
return orderMasterMapper.selectOrderMasterList(orderMaster);
|
return orderMasterMapper.selectOrderMasterList(orderMaster);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long countOrderMasterList(OrderMaster orderMaster) {
|
||||||
|
return orderMasterMapper.countOrderMasterList(orderMaster);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public OrderMaster selectById(Long orderMasterId) {
|
public OrderMaster selectById(Long orderMasterId) {
|
||||||
return orderMasterMapper.selectById(orderMasterId);
|
return orderMasterMapper.selectById(orderMasterId);
|
||||||
|
|
|
||||||
|
|
@ -127,6 +127,42 @@
|
||||||
</trim>
|
</trim>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="countOrderMasterList" parameterType="com.ghy.order.domain.OrderMaster" resultType="Long">
|
||||||
|
SELECT COUNT(*) FROM order_master om
|
||||||
|
<where>
|
||||||
|
<if test="deptId != null and deptId != 0">
|
||||||
|
AND om.dept_id = #{deptId}
|
||||||
|
</if>
|
||||||
|
<if test="code != null and code != ''">
|
||||||
|
AND om.code LIKE concat('%', #{code}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="customerId != null and customerId != 0">
|
||||||
|
AND om.customer_id = #{customerId}
|
||||||
|
</if>
|
||||||
|
<if test="orderType != null">
|
||||||
|
AND om.order_type = #{orderType}
|
||||||
|
</if>
|
||||||
|
<if test="orderStatus != null">
|
||||||
|
AND om.order_status = #{orderStatus}
|
||||||
|
</if>
|
||||||
|
<if test="payType != null">
|
||||||
|
AND om.pay_type = #{payType}
|
||||||
|
</if>
|
||||||
|
<if test="payStatus != null">
|
||||||
|
AND om.pay_status = #{payStatus}
|
||||||
|
</if>
|
||||||
|
<if test="workerId != null and workerId > 0">
|
||||||
|
AND om.worker_id = #{workerId}
|
||||||
|
</if>
|
||||||
|
<if test="workerId == -1">
|
||||||
|
AND om.worker_id IS NULL
|
||||||
|
</if>
|
||||||
|
<if test="exceptOrderStatus != null">
|
||||||
|
AND om.order_status != #{exceptOrderStatus}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
<select id="selectById" parameterType="long" resultMap="OrderMasterResult">
|
<select id="selectById" parameterType="long" resultMap="OrderMasterResult">
|
||||||
<include refid="selectOrderMaster"/>
|
<include refid="selectOrderMaster"/>
|
||||||
<where>
|
<where>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue