Merge branch 'dev' into hph

This commit is contained in:
牛叉闪闪 2024-07-17 11:11:11 +08:00
commit 35057b4ee7
4 changed files with 67 additions and 38 deletions

View File

@ -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")

View File

@ -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);
@ -45,4 +47,4 @@ public interface TbOrderInfoMapper {
Map<String,String> selectByOrderId(String orderId);
List<SkuInfoPo> selectSkuByOrderId(String orderId);
}
}

View File

@ -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));

View File

@ -51,11 +51,11 @@
</resultMap>
<sql id="Base_Column_List">
id, order_no, settlement_amount, pack_fee, origin_amount, product_amount, amount,
refund_amount, pay_type, pay_amount, order_amount, freight_amount, discount_ratio,
discount_amount, table_id, small_change, send_type, order_type, product_type, status,
billing_id, merchant_id, shop_id, is_vip, member_id, user_id, product_score, deduct_score,
user_coupon_id, user_coupon_amount, refund_able, paid_time, is_effect, is_group,
id, order_no, settlement_amount, pack_fee, origin_amount, product_amount, amount,
refund_amount, pay_type, pay_amount, order_amount, freight_amount, discount_ratio,
discount_amount, table_id, small_change, send_type, order_type, product_type, status,
billing_id, merchant_id, shop_id, is_vip, member_id, user_id, product_score, deduct_score,
user_coupon_id, user_coupon_amount, refund_able, paid_time, is_effect, is_group,
updated_at, `system_time`, created_at, is_accepted, pay_order_no,trade_day,`source`,remark,master_id,`table_name`,out_number
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
@ -83,6 +83,13 @@
WHERE
toi.shop_id = #{shopId}
<if test="startTime != null">
and created_at &gt;= #{startTime}
</if>
<if test="endTime != null">
and created_at &lt;= #{endTime}
</if>
<choose>
<when test="orderType == 'return'">
and toi.order_type = 'return' and toi.status in ('refund','closed')
@ -110,32 +117,32 @@
<insert id="insert" parameterType="com.chaozhanggui.system.cashierservice.entity.TbOrderInfo"
useGeneratedKeys="true" keyProperty="id">
insert into tb_order_info (id, order_no, settlement_amount,
pack_fee, origin_amount, product_amount,
amount, refund_amount, pay_type,
pay_amount, order_amount, freight_amount,
discount_ratio, discount_amount, table_id,
small_change, send_type, order_type,
product_type, status, billing_id,
merchant_id, shop_id, is_vip,
member_id, user_id, product_score,
deduct_score, user_coupon_id, user_coupon_amount,
refund_able, paid_time, is_effect,
is_group, updated_at, system_time,
insert into tb_order_info (id, order_no, settlement_amount,
pack_fee, origin_amount, product_amount,
amount, refund_amount, pay_type,
pay_amount, order_amount, freight_amount,
discount_ratio, discount_amount, table_id,
small_change, send_type, order_type,
product_type, status, billing_id,
merchant_id, shop_id, is_vip,
member_id, user_id, product_score,
deduct_score, user_coupon_id, user_coupon_amount,
refund_able, paid_time, is_effect,
is_group, updated_at, system_time,
created_at, is_accepted, pay_order_no,trade_day,source,remark,master_id,table_name,out_number
)
values (#{id,jdbcType=INTEGER}, #{orderNo,jdbcType=VARCHAR}, #{settlementAmount,jdbcType=DECIMAL},
#{packFee,jdbcType=DECIMAL}, #{originAmount,jdbcType=DECIMAL}, #{productAmount,jdbcType=DECIMAL},
#{amount,jdbcType=DECIMAL}, #{refundAmount,jdbcType=DECIMAL}, #{payType,jdbcType=VARCHAR},
#{payAmount,jdbcType=DECIMAL}, #{orderAmount,jdbcType=DECIMAL}, #{freightAmount,jdbcType=DECIMAL},
#{discountRatio,jdbcType=DECIMAL}, #{discountAmount,jdbcType=DECIMAL}, #{tableId,jdbcType=VARCHAR},
#{smallChange,jdbcType=DECIMAL}, #{sendType,jdbcType=VARCHAR}, #{orderType,jdbcType=VARCHAR},
#{productType,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{billingId,jdbcType=VARCHAR},
#{merchantId,jdbcType=VARCHAR}, #{shopId,jdbcType=VARCHAR}, #{isVip,jdbcType=TINYINT},
#{memberId,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR}, #{productScore,jdbcType=INTEGER},
#{deductScore,jdbcType=INTEGER}, #{userCouponId,jdbcType=VARCHAR}, #{userCouponAmount,jdbcType=DECIMAL},
#{refundAble,jdbcType=TINYINT}, #{paidTime,jdbcType=BIGINT}, #{isEffect,jdbcType=TINYINT},
#{isGroup,jdbcType=TINYINT}, #{updatedAt,jdbcType=BIGINT}, #{systemTime,jdbcType=BIGINT},
values (#{id,jdbcType=INTEGER}, #{orderNo,jdbcType=VARCHAR}, #{settlementAmount,jdbcType=DECIMAL},
#{packFee,jdbcType=DECIMAL}, #{originAmount,jdbcType=DECIMAL}, #{productAmount,jdbcType=DECIMAL},
#{amount,jdbcType=DECIMAL}, #{refundAmount,jdbcType=DECIMAL}, #{payType,jdbcType=VARCHAR},
#{payAmount,jdbcType=DECIMAL}, #{orderAmount,jdbcType=DECIMAL}, #{freightAmount,jdbcType=DECIMAL},
#{discountRatio,jdbcType=DECIMAL}, #{discountAmount,jdbcType=DECIMAL}, #{tableId,jdbcType=VARCHAR},
#{smallChange,jdbcType=DECIMAL}, #{sendType,jdbcType=VARCHAR}, #{orderType,jdbcType=VARCHAR},
#{productType,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{billingId,jdbcType=VARCHAR},
#{merchantId,jdbcType=VARCHAR}, #{shopId,jdbcType=VARCHAR}, #{isVip,jdbcType=TINYINT},
#{memberId,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR}, #{productScore,jdbcType=INTEGER},
#{deductScore,jdbcType=INTEGER}, #{userCouponId,jdbcType=VARCHAR}, #{userCouponAmount,jdbcType=DECIMAL},
#{refundAble,jdbcType=TINYINT}, #{paidTime,jdbcType=BIGINT}, #{isEffect,jdbcType=TINYINT},
#{isGroup,jdbcType=TINYINT}, #{updatedAt,jdbcType=BIGINT}, #{systemTime,jdbcType=BIGINT},
#{createdAt,jdbcType=BIGINT}, #{isAccepted,jdbcType=TINYINT}, #{payOrderNo,jdbcType=VARCHAR},
#{tradeDay,jdbcType=VARCHAR}, #{source,jdbcType=INTEGER}, #{remark,jdbcType=VARCHAR}, #{masterId,jdbcType=VARCHAR},#{tableName,jdbcType=VARCHAR},
#{outNumber,jdbcType=VARCHAR}
@ -592,4 +599,4 @@ select * from tb_order_info where trade_day = #{day} and table_id = #{masterId}
AND d.product_sku_id = c.sku_id
where c.order_id=#{orderId}
</select>
</mapper>
</mapper>