添加打印日志

This commit is contained in:
牛叉闪闪 2024-07-25 15:49:44 +08:00
parent e91ae3bd8d
commit 1bf12d880c
4 changed files with 570 additions and 5 deletions

View File

@ -0,0 +1,21 @@
package com.chaozhanggui.system.cashierservice.dao;
import com.chaozhanggui.system.cashierservice.entity.tbHandover;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Component;
@Component
@Mapper
public interface tbHandoverMapper {
int deleteByPrimaryKey(Integer id);
int insert(tbHandover record);
int insertSelective(tbHandover record);
tbHandover selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(tbHandover record);
int updateByPrimaryKey(tbHandover record);
}

View File

@ -0,0 +1,238 @@
package com.chaozhanggui.system.cashierservice.entity;
import java.io.Serializable;
import java.util.Date;
public class tbHandover implements Serializable {
private Integer id;
private String tradeDay;
private String printNo;
private Integer dutyId;
private Integer shopId;
private String merchantName;
private String startTime;
private String endTime;
private Integer staffId;
private String staffName;
private String payInfos;
private String memberData;
private String productCategories;
private String totalAmount;
private String imprest;
private String payable;
private String handIn;
private String returnAmount;
private String orderNum;
private String quickAmount;
private String productInfoPos;
private String productInfos;
private Date createTime;
private static final long serialVersionUID = 1L;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getTradeDay() {
return tradeDay;
}
public void setTradeDay(String tradeDay) {
this.tradeDay = tradeDay == null ? null : tradeDay.trim();
}
public String getPrintNo() {
return printNo;
}
public void setPrintNo(String printNo) {
this.printNo = printNo == null ? null : printNo.trim();
}
public Integer getDutyId() {
return dutyId;
}
public void setDutyId(Integer dutyId) {
this.dutyId = dutyId;
}
public Integer getShopId() {
return shopId;
}
public void setShopId(Integer shopId) {
this.shopId = shopId;
}
public String getMerchantName() {
return merchantName;
}
public void setMerchantName(String merchantName) {
this.merchantName = merchantName == null ? null : merchantName.trim();
}
public String getStartTime() {
return startTime;
}
public void setStartTime(String startTime) {
this.startTime = startTime == null ? null : startTime.trim();
}
public String getEndTime() {
return endTime;
}
public void setEndTime(String endTime) {
this.endTime = endTime == null ? null : endTime.trim();
}
public Integer getStaffId() {
return staffId;
}
public void setStaffId(Integer staffId) {
this.staffId = staffId;
}
public String getStaffName() {
return staffName;
}
public void setStaffName(String staffName) {
this.staffName = staffName == null ? null : staffName.trim();
}
public String getPayInfos() {
return payInfos;
}
public void setPayInfos(String payInfos) {
this.payInfos = payInfos == null ? null : payInfos.trim();
}
public String getMemberData() {
return memberData;
}
public void setMemberData(String memberData) {
this.memberData = memberData == null ? null : memberData.trim();
}
public String getProductCategories() {
return productCategories;
}
public void setProductCategories(String productCategories) {
this.productCategories = productCategories == null ? null : productCategories.trim();
}
public String getTotalAmount() {
return totalAmount;
}
public void setTotalAmount(String totalAmount) {
this.totalAmount = totalAmount == null ? null : totalAmount.trim();
}
public String getImprest() {
return imprest;
}
public void setImprest(String imprest) {
this.imprest = imprest == null ? null : imprest.trim();
}
public String getPayable() {
return payable;
}
public void setPayable(String payable) {
this.payable = payable == null ? null : payable.trim();
}
public String getHandIn() {
return handIn;
}
public void setHandIn(String handIn) {
this.handIn = handIn == null ? null : handIn.trim();
}
public String getReturnAmount() {
return returnAmount;
}
public void setReturnAmount(String returnAmount) {
this.returnAmount = returnAmount == null ? null : returnAmount.trim();
}
public String getOrderNum() {
return orderNum;
}
public void setOrderNum(String orderNum) {
this.orderNum = orderNum == null ? null : orderNum.trim();
}
public String getQuickAmount() {
return quickAmount;
}
public void setQuickAmount(String quickAmount) {
this.quickAmount = quickAmount == null ? null : quickAmount.trim();
}
public String getProductInfoPos() {
return productInfoPos;
}
public void setProductInfoPos(String productInfoPos) {
this.productInfoPos = productInfoPos == null ? null : productInfoPos.trim();
}
public String getProductInfos() {
return productInfos;
}
public void setProductInfos(String productInfos) {
this.productInfos = productInfos == null ? null : productInfos.trim();
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
}

View File

@ -197,18 +197,18 @@ public class PrinterUtils {
char paddingCharacter = ' ';
sb.append("<S> "+String.format("%-18s","品名").replace(' ', paddingCharacter)+String.format("%-4s","数量").replace(' ', paddingCharacter)+"</S><BR>");
sb.append("<S> 品名"+String.format("%22s","数量").replace(' ', paddingCharacter)+"</S><BR>");
for (ProductInfo productInfo : handoverInfo.getProductInfos()) {
if(productInfo.getProductName().length()>=16){
if(productInfo.getProductName().length()>=14){
sb.append("<S> "+productInfo.getProductName()+"</S><BR>");
sb.append("<S> "+String.format("%22s",productInfo.getNum()).replace(' ', paddingCharacter)+"</S><BR>");
sb.append("<S> "+String.format("%27s",productInfo.getNum()).replace(' ', paddingCharacter)+"</S><BR>");
}else {
int tt=21-productInfo.getProductName().length();
sb.append("<S> "+String.format("%-"+tt+"s",productInfo.getProductName()).replace(' ', paddingCharacter)+String.format("%-4s",productInfo.getNum()).replace(' ', paddingCharacter)+"</S><BR>");
int tt=22-productInfo.getProductName().length();
sb.append("<S> "+productInfo.getProductName()+String.format("%"+tt+"s",productInfo.getNum()).replace(' ', paddingCharacter)+"</S><BR>");
}
sb.append("<BR>");
}

View File

@ -0,0 +1,306 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.chaozhanggui.system.cashierservice.dao.tbHandoverMapper">
<resultMap id="BaseResultMap" type="com.chaozhanggui.system.cashierservice.entity.tbHandover">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="trade_day" jdbcType="VARCHAR" property="tradeDay" />
<result column="print_no" jdbcType="VARCHAR" property="printNo" />
<result column="duty_id" jdbcType="INTEGER" property="dutyId" />
<result column="shop_id" jdbcType="INTEGER" property="shopId" />
<result column="merchant_name" jdbcType="VARCHAR" property="merchantName" />
<result column="start_time" jdbcType="VARCHAR" property="startTime" />
<result column="end_time" jdbcType="VARCHAR" property="endTime" />
<result column="staff_id" jdbcType="INTEGER" property="staffId" />
<result column="staff_name" jdbcType="VARCHAR" property="staffName" />
<result column="pay_infos" jdbcType="VARCHAR" property="payInfos" />
<result column="member_data" jdbcType="VARCHAR" property="memberData" />
<result column="product_categories" jdbcType="VARCHAR" property="productCategories" />
<result column="total_amount" jdbcType="VARCHAR" property="totalAmount" />
<result column="imprest" jdbcType="VARCHAR" property="imprest" />
<result column="payable" jdbcType="VARCHAR" property="payable" />
<result column="hand_in" jdbcType="VARCHAR" property="handIn" />
<result column="return_amount" jdbcType="VARCHAR" property="returnAmount" />
<result column="order_num" jdbcType="VARCHAR" property="orderNum" />
<result column="quick_amount" jdbcType="VARCHAR" property="quickAmount" />
<result column="product_info_pos" jdbcType="VARCHAR" property="productInfoPos" />
<result column="product_infos" jdbcType="VARCHAR" property="productInfos" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
</resultMap>
<sql id="Base_Column_List">
id, trade_day, print_no, duty_id, shop_id, merchant_name, start_time, end_time, staff_id,
staff_name, pay_infos, member_data, product_categories, total_amount, imprest, payable,
hand_in, return_amount, order_num, quick_amount, product_info_pos, product_infos,
create_time
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from tb_handover
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from tb_handover
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.chaozhanggui.system.cashierservice.entity.tbHandover">
insert into tb_handover (id, trade_day, print_no,
duty_id, shop_id, merchant_name,
start_time, end_time, staff_id,
staff_name, pay_infos, member_data,
product_categories, total_amount, imprest,
payable, hand_in, return_amount,
order_num, quick_amount, product_info_pos,
product_infos, create_time)
values (#{id,jdbcType=INTEGER}, #{tradeDay,jdbcType=VARCHAR}, #{printNo,jdbcType=VARCHAR},
#{dutyId,jdbcType=INTEGER}, #{shopId,jdbcType=INTEGER}, #{merchantName,jdbcType=VARCHAR},
#{startTime,jdbcType=VARCHAR}, #{endTime,jdbcType=VARCHAR}, #{staffId,jdbcType=INTEGER},
#{staffName,jdbcType=VARCHAR}, #{payInfos,jdbcType=VARCHAR}, #{memberData,jdbcType=VARCHAR},
#{productCategories,jdbcType=VARCHAR}, #{totalAmount,jdbcType=VARCHAR}, #{imprest,jdbcType=VARCHAR},
#{payable,jdbcType=VARCHAR}, #{handIn,jdbcType=VARCHAR}, #{returnAmount,jdbcType=VARCHAR},
#{orderNum,jdbcType=VARCHAR}, #{quickAmount,jdbcType=VARCHAR}, #{productInfoPos,jdbcType=VARCHAR},
#{productInfos,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" parameterType="com.chaozhanggui.system.cashierservice.entity.tbHandover">
insert into tb_handover
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="tradeDay != null">
trade_day,
</if>
<if test="printNo != null">
print_no,
</if>
<if test="dutyId != null">
duty_id,
</if>
<if test="shopId != null">
shop_id,
</if>
<if test="merchantName != null">
merchant_name,
</if>
<if test="startTime != null">
start_time,
</if>
<if test="endTime != null">
end_time,
</if>
<if test="staffId != null">
staff_id,
</if>
<if test="staffName != null">
staff_name,
</if>
<if test="payInfos != null">
pay_infos,
</if>
<if test="memberData != null">
member_data,
</if>
<if test="productCategories != null">
product_categories,
</if>
<if test="totalAmount != null">
total_amount,
</if>
<if test="imprest != null">
imprest,
</if>
<if test="payable != null">
payable,
</if>
<if test="handIn != null">
hand_in,
</if>
<if test="returnAmount != null">
return_amount,
</if>
<if test="orderNum != null">
order_num,
</if>
<if test="quickAmount != null">
quick_amount,
</if>
<if test="productInfoPos != null">
product_info_pos,
</if>
<if test="productInfos != null">
product_infos,
</if>
<if test="createTime != null">
create_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=INTEGER},
</if>
<if test="tradeDay != null">
#{tradeDay,jdbcType=VARCHAR},
</if>
<if test="printNo != null">
#{printNo,jdbcType=VARCHAR},
</if>
<if test="dutyId != null">
#{dutyId,jdbcType=INTEGER},
</if>
<if test="shopId != null">
#{shopId,jdbcType=INTEGER},
</if>
<if test="merchantName != null">
#{merchantName,jdbcType=VARCHAR},
</if>
<if test="startTime != null">
#{startTime,jdbcType=VARCHAR},
</if>
<if test="endTime != null">
#{endTime,jdbcType=VARCHAR},
</if>
<if test="staffId != null">
#{staffId,jdbcType=INTEGER},
</if>
<if test="staffName != null">
#{staffName,jdbcType=VARCHAR},
</if>
<if test="payInfos != null">
#{payInfos,jdbcType=VARCHAR},
</if>
<if test="memberData != null">
#{memberData,jdbcType=VARCHAR},
</if>
<if test="productCategories != null">
#{productCategories,jdbcType=VARCHAR},
</if>
<if test="totalAmount != null">
#{totalAmount,jdbcType=VARCHAR},
</if>
<if test="imprest != null">
#{imprest,jdbcType=VARCHAR},
</if>
<if test="payable != null">
#{payable,jdbcType=VARCHAR},
</if>
<if test="handIn != null">
#{handIn,jdbcType=VARCHAR},
</if>
<if test="returnAmount != null">
#{returnAmount,jdbcType=VARCHAR},
</if>
<if test="orderNum != null">
#{orderNum,jdbcType=VARCHAR},
</if>
<if test="quickAmount != null">
#{quickAmount,jdbcType=VARCHAR},
</if>
<if test="productInfoPos != null">
#{productInfoPos,jdbcType=VARCHAR},
</if>
<if test="productInfos != null">
#{productInfos,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.chaozhanggui.system.cashierservice.entity.tbHandover">
update tb_handover
<set>
<if test="tradeDay != null">
trade_day = #{tradeDay,jdbcType=VARCHAR},
</if>
<if test="printNo != null">
print_no = #{printNo,jdbcType=VARCHAR},
</if>
<if test="dutyId != null">
duty_id = #{dutyId,jdbcType=INTEGER},
</if>
<if test="shopId != null">
shop_id = #{shopId,jdbcType=INTEGER},
</if>
<if test="merchantName != null">
merchant_name = #{merchantName,jdbcType=VARCHAR},
</if>
<if test="startTime != null">
start_time = #{startTime,jdbcType=VARCHAR},
</if>
<if test="endTime != null">
end_time = #{endTime,jdbcType=VARCHAR},
</if>
<if test="staffId != null">
staff_id = #{staffId,jdbcType=INTEGER},
</if>
<if test="staffName != null">
staff_name = #{staffName,jdbcType=VARCHAR},
</if>
<if test="payInfos != null">
pay_infos = #{payInfos,jdbcType=VARCHAR},
</if>
<if test="memberData != null">
member_data = #{memberData,jdbcType=VARCHAR},
</if>
<if test="productCategories != null">
product_categories = #{productCategories,jdbcType=VARCHAR},
</if>
<if test="totalAmount != null">
total_amount = #{totalAmount,jdbcType=VARCHAR},
</if>
<if test="imprest != null">
imprest = #{imprest,jdbcType=VARCHAR},
</if>
<if test="payable != null">
payable = #{payable,jdbcType=VARCHAR},
</if>
<if test="handIn != null">
hand_in = #{handIn,jdbcType=VARCHAR},
</if>
<if test="returnAmount != null">
return_amount = #{returnAmount,jdbcType=VARCHAR},
</if>
<if test="orderNum != null">
order_num = #{orderNum,jdbcType=VARCHAR},
</if>
<if test="quickAmount != null">
quick_amount = #{quickAmount,jdbcType=VARCHAR},
</if>
<if test="productInfoPos != null">
product_info_pos = #{productInfoPos,jdbcType=VARCHAR},
</if>
<if test="productInfos != null">
product_infos = #{productInfos,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.chaozhanggui.system.cashierservice.entity.tbHandover">
update tb_handover
set trade_day = #{tradeDay,jdbcType=VARCHAR},
print_no = #{printNo,jdbcType=VARCHAR},
duty_id = #{dutyId,jdbcType=INTEGER},
shop_id = #{shopId,jdbcType=INTEGER},
merchant_name = #{merchantName,jdbcType=VARCHAR},
start_time = #{startTime,jdbcType=VARCHAR},
end_time = #{endTime,jdbcType=VARCHAR},
staff_id = #{staffId,jdbcType=INTEGER},
staff_name = #{staffName,jdbcType=VARCHAR},
pay_infos = #{payInfos,jdbcType=VARCHAR},
member_data = #{memberData,jdbcType=VARCHAR},
product_categories = #{productCategories,jdbcType=VARCHAR},
total_amount = #{totalAmount,jdbcType=VARCHAR},
imprest = #{imprest,jdbcType=VARCHAR},
payable = #{payable,jdbcType=VARCHAR},
hand_in = #{handIn,jdbcType=VARCHAR},
return_amount = #{returnAmount,jdbcType=VARCHAR},
order_num = #{orderNum,jdbcType=VARCHAR},
quick_amount = #{quickAmount,jdbcType=VARCHAR},
product_info_pos = #{productInfoPos,jdbcType=VARCHAR},
product_infos = #{productInfos,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>