Merge branch 'refs/heads/dev'
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
package com.chaozhanggui.system.cashierservice.controller;
|
package com.chaozhanggui.system.cashierservice.controller;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.chaozhanggui.system.cashierservice.entity.OrderVo;
|
import com.chaozhanggui.system.cashierservice.entity.OrderVo;
|
||||||
import com.chaozhanggui.system.cashierservice.entity.vo.CartVo;
|
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.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.sql.Timestamp;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
@CrossOrigin(origins = "*")
|
@CrossOrigin(origins = "*")
|
||||||
@RestController
|
@RestController
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@@ -113,9 +117,13 @@ public class OrderController {
|
|||||||
@GetMapping("/findOrder")
|
@GetMapping("/findOrder")
|
||||||
public Result findOrder(@RequestHeader("token") String token, @RequestHeader("loginName") String loginName,
|
public Result findOrder(@RequestHeader("token") String token, @RequestHeader("loginName") String loginName,
|
||||||
@RequestHeader("clientType") String clientType, @RequestParam("shopId") Integer shopId,
|
@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){
|
@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")
|
@GetMapping("/orderDetail")
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ import org.apache.ibatis.annotations.Mapper;
|
|||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.sql.Timestamp;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -31,7 +33,7 @@ public interface TbOrderInfoMapper {
|
|||||||
List<TbOrderInfo> selectAllByStatus(String status);
|
List<TbOrderInfo> selectAllByStatus(String status);
|
||||||
|
|
||||||
List<OrderPo> selectAllByShop(@Param("shopId") Integer shopId, @Param("orderType") String orderType,
|
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);
|
TbOrderInfo selectByTradeAndMasterId(@Param("day")String day, @Param("masterId")String masterId, @Param("shopId")Integer shopId);
|
||||||
|
|
||||||
|
|||||||
@@ -119,10 +119,6 @@ public class ConsMsgConsumer {
|
|||||||
|
|
||||||
List<TbUserShopMsg> tbUserShopMsgs = tbUserShopMsgMapper.selectAllByShopId(tbConsInfo.getShopId());
|
List<TbUserShopMsg> tbUserShopMsgs = tbUserShopMsgMapper.selectAllByShopId(tbConsInfo.getShopId());
|
||||||
if (Objects.nonNull(tbUserShopMsgs) && tbUserShopMsgs.size()>0) {
|
if (Objects.nonNull(tbUserShopMsgs) && tbUserShopMsgs.size()>0) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
tbUserShopMsgs.parallelStream().forEach(tbUserShopMsg->{
|
tbUserShopMsgs.parallelStream().forEach(tbUserShopMsg->{
|
||||||
String key=RedisCst.ORDER_MESSAGE.concat(tbConsInfo.getShopId().toString()).concat("#").concat(tbConsInfo.getId().toString()).concat("#").concat(tbUserShopMsg.getOpenId());
|
String key=RedisCst.ORDER_MESSAGE.concat(tbConsInfo.getShopId().toString()).concat("#").concat(tbConsInfo.getId().toString()).concat("#").concat(tbUserShopMsg.getOpenId());
|
||||||
String value = redisUtil.getMessage(key);
|
String value = redisUtil.getMessage(key);
|
||||||
@@ -150,7 +146,7 @@ public class ConsMsgConsumer {
|
|||||||
|
|
||||||
|
|
||||||
JSONObject thing7 = new JSONObject();
|
JSONObject thing7 = new JSONObject();
|
||||||
thing7.put("value", tbConsInfo.getStockNumber().subtract(tbConsInfo.getStockConsume()).toPlainString());
|
thing7.put("value", tbConsInfo.getStockNumber().subtract(tbConsInfo.getStockConsume()).setScale(2,BigDecimal.ROUND_DOWN).toPlainString());
|
||||||
|
|
||||||
data.put("thing1", thing1);
|
data.put("thing1", thing1);
|
||||||
data.put("thing6", thing6);
|
data.put("thing6", thing6);
|
||||||
@@ -163,7 +159,7 @@ public class ConsMsgConsumer {
|
|||||||
object1.put("lang", "zh_CN");
|
object1.put("lang", "zh_CN");
|
||||||
|
|
||||||
String response = HttpRequest.post("https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token=".concat(accessToken)).body(object1.toString()).execute().body();
|
String response = HttpRequest.post("https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token=".concat(accessToken)).body(object1.toString()).execute().body();
|
||||||
log.info("openId:{},返回结果:{}",tbUserShopMsg.getOpenId(), response);
|
log.info("openId:{},请求参数:{},返回结果:{}",tbUserShopMsg.getOpenId(),object1.toString(), response);
|
||||||
JSONObject resObj = JSONObject.parseObject(response);
|
JSONObject resObj = JSONObject.parseObject(response);
|
||||||
if (ObjectUtil.isNotEmpty(resObj) && ObjectUtil.isNotNull(resObj) && "0".equals(String.valueOf(resObj.get("errcode")))) {
|
if (ObjectUtil.isNotEmpty(resObj) && ObjectUtil.isNotNull(resObj) && "0".equals(String.valueOf(resObj.get("errcode")))) {
|
||||||
log.info("写入redis:{}",key);
|
log.info("写入redis:{}",key);
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package com.chaozhanggui.system.cashierservice.service;
|
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.core.util.ObjectUtil;
|
||||||
import cn.hutool.http.HttpRequest;
|
import cn.hutool.http.HttpRequest;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
@@ -22,6 +24,7 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.sql.Timestamp;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
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) {
|
public Result findOrder(Integer shopId, String status, Integer page, Integer size, String orderNo,
|
||||||
String day = DateUtils.getDay();
|
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);
|
PageHelperUtil.startPage(page, size);
|
||||||
String orderType = "";
|
String orderType = "";
|
||||||
if (StringUtils.isNotEmpty(status)) {
|
if (StringUtils.isNotEmpty(status)) {
|
||||||
@@ -881,7 +892,8 @@ public class OrderService {
|
|||||||
}
|
}
|
||||||
log.info("orderType:" + orderType);
|
log.info("orderType:" + orderType);
|
||||||
log.info("status:" + status);
|
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) {
|
for (OrderPo orderInfo : list) {
|
||||||
if (StringUtils.isEmpty(orderInfo.getImgUrl())) {
|
if (StringUtils.isEmpty(orderInfo.getImgUrl())) {
|
||||||
@@ -894,7 +906,7 @@ public class OrderService {
|
|||||||
}
|
}
|
||||||
orderInfo.setSkuInfos(skuInfoPos);
|
orderInfo.setSkuInfos(skuInfoPos);
|
||||||
orderInfo.setZdNo("POS");
|
orderInfo.setZdNo("POS");
|
||||||
orderInfo.setNames(orderInfo.getProductName().split(","));
|
orderInfo.setNames(orderInfo.getProductName() == null ? new String[]{""} : orderInfo.getProductName().split(","));
|
||||||
}
|
}
|
||||||
PageInfo pageInfo = new PageInfo(list);
|
PageInfo pageInfo = new PageInfo(list);
|
||||||
log.info("获取订单:{}", JSONUtil.toJSONString(pageInfo));
|
log.info("获取订单:{}", JSONUtil.toJSONString(pageInfo));
|
||||||
|
|||||||
@@ -83,6 +83,13 @@
|
|||||||
|
|
||||||
WHERE
|
WHERE
|
||||||
toi.shop_id = #{shopId}
|
toi.shop_id = #{shopId}
|
||||||
|
<if test="startTime != null">
|
||||||
|
and created_at >= #{startTime}
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<if test="endTime != null">
|
||||||
|
and created_at <= #{endTime}
|
||||||
|
</if>
|
||||||
<choose>
|
<choose>
|
||||||
<when test="orderType == 'return'">
|
<when test="orderType == 'return'">
|
||||||
and toi.order_type = 'return' and toi.status in ('refund','closed')
|
and toi.order_type = 'return' and toi.status in ('refund','closed')
|
||||||
|
|||||||
Reference in New Issue
Block a user