修改打印

This commit is contained in:
韩鹏辉 2024-06-26 11:12:28 +08:00
parent 82935827f5
commit 3668252207
5 changed files with 61 additions and 10 deletions

View File

@ -2,6 +2,7 @@ package com.chaozhanggui.system.cashierservice.dao;
import com.chaozhanggui.system.cashierservice.entity.TbOrderInfo;
import com.chaozhanggui.system.cashierservice.entity.po.OrderPo;
import com.chaozhanggui.system.cashierservice.entity.po.SkuInfoPo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;
@ -42,4 +43,6 @@ public interface TbOrderInfoMapper {
Map<String,String> selectByOrderId(String orderId);
List<SkuInfoPo> selectSkuByOrderId(String orderId);
}

View File

@ -4,6 +4,7 @@ import com.chaozhanggui.system.cashierservice.entity.TbOrderDetail;
import lombok.Data;
import java.math.BigDecimal;
import java.util.List;
@Data
public class OrderPo {
@ -21,5 +22,9 @@ public class OrderPo {
private Integer productNum;
private BigDecimal orderAmount;
private TbOrderDetail orderDetail;
private String outNumber;
private String tableName;
private List<SkuInfoPo> skuInfos;
}

View File

@ -0,0 +1,12 @@
package com.chaozhanggui.system.cashierservice.entity.po;
import lombok.Data;
@Data
public class SkuInfoPo {
private String productName;
private String productSkuName;
private Integer num;
private String categoryId;
}

View File

@ -6,10 +6,7 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.chaozhanggui.system.cashierservice.dao.*;
import com.chaozhanggui.system.cashierservice.entity.*;
import com.chaozhanggui.system.cashierservice.entity.po.CartPo;
import com.chaozhanggui.system.cashierservice.entity.po.OrderPo;
import com.chaozhanggui.system.cashierservice.entity.po.ProductSkuPo;
import com.chaozhanggui.system.cashierservice.entity.po.QueryCartPo;
import com.chaozhanggui.system.cashierservice.entity.po.*;
import com.chaozhanggui.system.cashierservice.entity.vo.CartVo;
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
import com.chaozhanggui.system.cashierservice.sign.Result;
@ -718,6 +715,14 @@ public class OrderService {
if (StringUtils.isEmpty(orderInfo.getImgUrl())) {
orderInfo.setImgUrl("https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/20240223/a04e0d3beef74d099ebd0fd1f7c41873.jpg");
}
List<SkuInfoPo> skuInfoPos=tbOrderInfoMapper.selectSkuByOrderId(orderInfo.getId().toString());
if(Objects.isNull(skuInfoPos)||skuInfoPos.size()<0){
skuInfoPos=new ArrayList<>();
}
orderInfo.setSkuInfos(skuInfoPos);
orderInfo.setZdNo("POS");
orderInfo.setNames(orderInfo.getProductName().split(","));
}

View File

@ -65,11 +65,24 @@
where id = #{id,jdbcType=INTEGER}
</select>
<select id="selectAllByShop" resultType="com.chaozhanggui.system.cashierservice.entity.po.OrderPo">
select toi.created_at as createAt,toi.id,toi.order_no as orderNo,toi.order_amount as orderAmount,count(*) as
productNum,toi.order_type as orderType,
ifnull(TRIM(TRAILING ', ' FROM GROUP_CONCAT(tod.product_name ORDER BY tod.id SEPARATOR ', ')),'') AS productName,
toi.status from tb_order_info toi left join tb_order_detail tod on tod.order_id = toi.id
where toi.shop_id = #{shopId}
SELECT
toi.created_at AS createAt,
toi.id,
toi.order_no AS orderNo,
toi.order_amount AS orderAmount,
count(*) AS productNum,
toi.order_type AS orderType,
GROUP_CONCAT(tod.product_name) AS productName,
toi.STATUS,
toi.out_number AS outNumber,
toi.table_name AS tableName
FROM
tb_order_info toi
LEFT JOIN tb_order_detail tod ON tod.order_id = toi.id
WHERE
toi.shop_id = #{shopId}
<choose>
<when test="orderType == 'return'">
and toi.order_type = 'return' and toi.status in ('refund','closed')
@ -87,7 +100,7 @@
<if test="orderNo != null and orderNo != ''">
and toi.order_no = #{orderNo}
</if>
group by toi.shop_id,toi.order_no
group by toi.id,toi.shop_id
order by toi.id desc
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
@ -566,4 +579,17 @@ select * from tb_order_info where trade_day = #{day} and table_id = #{masterId}
GROUP BY
d.order_id
</select>
<select id="selectSkuByOrderId" resultType="com.chaozhanggui.system.cashierservice.entity.po.SkuInfoPo">
SELECT
d.product_name as productName,
d.num ,
d.product_sku_name as productSkuName,
c.category_id as categoryId
FROM
tb_order_detail d
left join tb_cashier_cart c on d.order_id=c.order_id and d.product_id=c.product_id
where c.order_id=#{orderId}
</select>
</mapper>