Merge branch 'dev' into hph
This commit is contained in:
commit
35057b4ee7
|
|
@ -1,5 +1,6 @@
|
|||
package com.chaozhanggui.system.cashierservice.controller;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.chaozhanggui.system.cashierservice.entity.OrderVo;
|
||||
import com.chaozhanggui.system.cashierservice.entity.vo.CartVo;
|
||||
|
|
@ -10,6 +11,9 @@ import lombok.extern.slf4j.Slf4j;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Date;
|
||||
|
||||
@CrossOrigin(origins = "*")
|
||||
@RestController
|
||||
@Slf4j
|
||||
|
|
@ -113,9 +117,13 @@ public class OrderController {
|
|||
@GetMapping("/findOrder")
|
||||
public Result findOrder(@RequestHeader("token") String token, @RequestHeader("loginName") String loginName,
|
||||
@RequestHeader("clientType") String clientType, @RequestParam("shopId") Integer shopId,
|
||||
@RequestParam("status") String status,@RequestParam("orderNo") String orderNo,@RequestParam(value = "page", required = false, defaultValue = "1") Integer page,
|
||||
@RequestParam("status") String status,
|
||||
@RequestParam(value = "orderNo", required = false) String orderNo,
|
||||
@RequestParam(value = "startTime", required = false) String startTime,
|
||||
@RequestParam(value = "endTime", required = false) String endTime,
|
||||
@RequestParam(value = "page", required = false, defaultValue = "1") Integer page,
|
||||
@RequestParam(value = "size", required = false, defaultValue = "1") Integer size){
|
||||
return orderService.findOrder(shopId,status,page,size,orderNo);
|
||||
return orderService.findOrder(shopId,status,page,size,orderNo, DateUtil.parse(startTime), DateUtil.parse(endTime));
|
||||
}
|
||||
|
||||
@GetMapping("/orderDetail")
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@ import org.apache.ibatis.annotations.Mapper;
|
|||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
|
@ -31,7 +33,7 @@ public interface TbOrderInfoMapper {
|
|||
List<TbOrderInfo> selectAllByStatus(String status);
|
||||
|
||||
List<OrderPo> selectAllByShop(@Param("shopId") Integer shopId, @Param("orderType") String orderType,
|
||||
@Param("day") String day, @Param("orderNo") String orderNo);
|
||||
@Param("day") String day, @Param("orderNo") String orderNo, Long startTime, Long endTime);
|
||||
|
||||
TbOrderInfo selectByTradeAndMasterId(@Param("day")String day, @Param("masterId")String masterId, @Param("shopId")Integer shopId);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
package com.chaozhanggui.system.cashierservice.service;
|
||||
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
|
|
@ -22,6 +24,7 @@ import org.springframework.stereotype.Service;
|
|||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
|
@ -868,8 +871,16 @@ public class OrderService {
|
|||
}
|
||||
|
||||
|
||||
public Result findOrder(Integer shopId, String status, Integer page, Integer size, String orderNo) {
|
||||
String day = DateUtils.getDay();
|
||||
public Result findOrder(Integer shopId, String status, Integer page, Integer size, String orderNo,
|
||||
Date startTime, Date endTime) {
|
||||
|
||||
String day = null;
|
||||
if (startTime == null && endTime == null) {
|
||||
startTime = DateUtil.beginOfDay(DateUtil.date());
|
||||
endTime = DateUtil.endOfDay(DateUtil.date());
|
||||
day = DateUtils.getDay();
|
||||
}
|
||||
|
||||
PageHelperUtil.startPage(page, size);
|
||||
String orderType = "";
|
||||
if (StringUtils.isNotEmpty(status)) {
|
||||
|
|
@ -881,7 +892,8 @@ public class OrderService {
|
|||
}
|
||||
log.info("orderType:" + orderType);
|
||||
log.info("status:" + status);
|
||||
List<OrderPo> list = tbOrderInfoMapper.selectAllByShop(shopId, orderType, day, orderNo);
|
||||
List<OrderPo> list = tbOrderInfoMapper.selectAllByShop(shopId, orderType, day, orderNo,
|
||||
startTime == null ? null : startTime.getTime(), endTime == null ? null : endTime.getTime());
|
||||
|
||||
for (OrderPo orderInfo : list) {
|
||||
if (StringUtils.isEmpty(orderInfo.getImgUrl())) {
|
||||
|
|
@ -894,7 +906,7 @@ public class OrderService {
|
|||
}
|
||||
orderInfo.setSkuInfos(skuInfoPos);
|
||||
orderInfo.setZdNo("POS");
|
||||
orderInfo.setNames(orderInfo.getProductName().split(","));
|
||||
orderInfo.setNames(orderInfo.getProductName() == null ? new String[]{""} : orderInfo.getProductName().split(","));
|
||||
}
|
||||
PageInfo pageInfo = new PageInfo(list);
|
||||
log.info("获取订单:{}", JSONUtil.toJSONString(pageInfo));
|
||||
|
|
|
|||
|
|
@ -83,6 +83,13 @@
|
|||
|
||||
WHERE
|
||||
toi.shop_id = #{shopId}
|
||||
<if test="startTime != null">
|
||||
and created_at >= #{startTime}
|
||||
</if>
|
||||
|
||||
<if test="endTime != null">
|
||||
and created_at <= #{endTime}
|
||||
</if>
|
||||
<choose>
|
||||
<when test="orderType == 'return'">
|
||||
and toi.order_type = 'return' and toi.status in ('refund','closed')
|
||||
|
|
|
|||
Loading…
Reference in New Issue