From a72c96ff5657493575e08166849e1cba1d3db12a Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Wed, 3 Jul 2024 15:37:30 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bweb/controller/BsDeviceController.java | 2 + .../java/com/hfkj/dao/BsDeviceMapper.java | 29 ++++---- .../com/hfkj/dao/BsDeviceSqlProvider.java | 14 ++++ .../main/java/com/hfkj/entity/BsDevice.java | 16 +++++ .../java/com/hfkj/entity/BsDeviceExample.java | 60 +++++++++++++++++ .../service/impl/BsDeviceServiceImpl.java | 66 +++++++++++-------- .../sysenum/DeviceReceiptOutContentEnum.java | 54 +++++++++++++++ 7 files changed, 201 insertions(+), 40 deletions(-) create mode 100644 service/src/main/java/com/hfkj/sysenum/DeviceReceiptOutContentEnum.java diff --git a/bweb/src/main/java/com/bweb/controller/BsDeviceController.java b/bweb/src/main/java/com/bweb/controller/BsDeviceController.java index f0d3452..10de992 100644 --- a/bweb/src/main/java/com/bweb/controller/BsDeviceController.java +++ b/bweb/src/main/java/com/bweb/controller/BsDeviceController.java @@ -14,6 +14,7 @@ import com.hfkj.model.ResponseData; import com.hfkj.model.SecUserSessionObject; import com.hfkj.service.BsDeviceService; import com.hfkj.service.merchant.BsMerchantService; +import com.hfkj.sysenum.DeviceReceiptOutContentEnum; import com.hfkj.sysenum.DeviceTypeEnum; import com.hfkj.sysenum.SecUserObjectTypeEnum; import io.swagger.annotations.Api; @@ -102,6 +103,7 @@ public class BsDeviceController { device.setDeviceKey(body.getDeviceKey()); device.setDeviceImei(body.getDeviceImei()); device.setDeviceIccid(body.getDeviceIccid()); + device.setReceiptOutContent(body.getReceiptOutContent()==null?DeviceReceiptOutContentEnum.content2.getType():body.getReceiptOutContent()); device.setReceiptTop(body.getReceiptTop()); device.setReceiptSource(body.getReceiptSource()); device.setReceiptBottom(body.getReceiptBottom()); diff --git a/service/src/main/java/com/hfkj/dao/BsDeviceMapper.java b/service/src/main/java/com/hfkj/dao/BsDeviceMapper.java index 4158fe6..438ed28 100644 --- a/service/src/main/java/com/hfkj/dao/BsDeviceMapper.java +++ b/service/src/main/java/com/hfkj/dao/BsDeviceMapper.java @@ -45,22 +45,22 @@ public interface BsDeviceMapper extends BsDeviceMapperExt { "mer_no, mer_name, ", "device_name, device_sn, ", "device_key, device_imei, ", - "device_iccid, receipt_top, ", - "receipt_source, receipt_bottom, ", - "`status`, create_time, ", - "update_time, ext_1, ", - "ext_2, ext_3)", + "device_iccid, receipt_out_content, ", + "receipt_top, receipt_source, ", + "receipt_bottom, `status`, ", + "create_time, update_time, ", + "ext_1, ext_2, ext_3)", "values (#{type,jdbcType=INTEGER}, #{companyId,jdbcType=BIGINT}, ", "#{companyName,jdbcType=VARCHAR}, #{agentId,jdbcType=BIGINT}, ", "#{agentName,jdbcType=VARCHAR}, #{merId,jdbcType=BIGINT}, ", "#{merNo,jdbcType=VARCHAR}, #{merName,jdbcType=VARCHAR}, ", "#{deviceName,jdbcType=VARCHAR}, #{deviceSn,jdbcType=VARCHAR}, ", "#{deviceKey,jdbcType=VARCHAR}, #{deviceImei,jdbcType=VARCHAR}, ", - "#{deviceIccid,jdbcType=VARCHAR}, #{receiptTop,jdbcType=VARCHAR}, ", - "#{receiptSource,jdbcType=VARCHAR}, #{receiptBottom,jdbcType=VARCHAR}, ", - "#{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, ", - "#{updateTime,jdbcType=TIMESTAMP}, #{ext1,jdbcType=VARCHAR}, ", - "#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})" + "#{deviceIccid,jdbcType=VARCHAR}, #{receiptOutContent,jdbcType=INTEGER}, ", + "#{receiptTop,jdbcType=VARCHAR}, #{receiptSource,jdbcType=VARCHAR}, ", + "#{receiptBottom,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, ", + "#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, ", + "#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})" }) @Options(useGeneratedKeys=true,keyProperty="id") int insert(BsDevice record); @@ -85,6 +85,7 @@ public interface BsDeviceMapper extends BsDeviceMapperExt { @Result(column="device_key", property="deviceKey", jdbcType=JdbcType.VARCHAR), @Result(column="device_imei", property="deviceImei", jdbcType=JdbcType.VARCHAR), @Result(column="device_iccid", property="deviceIccid", jdbcType=JdbcType.VARCHAR), + @Result(column="receipt_out_content", property="receiptOutContent", jdbcType=JdbcType.INTEGER), @Result(column="receipt_top", property="receiptTop", jdbcType=JdbcType.VARCHAR), @Result(column="receipt_source", property="receiptSource", jdbcType=JdbcType.VARCHAR), @Result(column="receipt_bottom", property="receiptBottom", jdbcType=JdbcType.VARCHAR), @@ -100,9 +101,9 @@ public interface BsDeviceMapper extends BsDeviceMapperExt { @Select({ "select", "id, `type`, company_id, company_name, agent_id, agent_name, mer_id, mer_no, ", - "mer_name, device_name, device_sn, device_key, device_imei, device_iccid, receipt_top, ", - "receipt_source, receipt_bottom, `status`, create_time, update_time, ext_1, ext_2, ", - "ext_3", + "mer_name, device_name, device_sn, device_key, device_imei, device_iccid, receipt_out_content, ", + "receipt_top, receipt_source, receipt_bottom, `status`, create_time, update_time, ", + "ext_1, ext_2, ext_3", "from bs_device", "where id = #{id,jdbcType=BIGINT}" }) @@ -121,6 +122,7 @@ public interface BsDeviceMapper extends BsDeviceMapperExt { @Result(column="device_key", property="deviceKey", jdbcType=JdbcType.VARCHAR), @Result(column="device_imei", property="deviceImei", jdbcType=JdbcType.VARCHAR), @Result(column="device_iccid", property="deviceIccid", jdbcType=JdbcType.VARCHAR), + @Result(column="receipt_out_content", property="receiptOutContent", jdbcType=JdbcType.INTEGER), @Result(column="receipt_top", property="receiptTop", jdbcType=JdbcType.VARCHAR), @Result(column="receipt_source", property="receiptSource", jdbcType=JdbcType.VARCHAR), @Result(column="receipt_bottom", property="receiptBottom", jdbcType=JdbcType.VARCHAR), @@ -157,6 +159,7 @@ public interface BsDeviceMapper extends BsDeviceMapperExt { "device_key = #{deviceKey,jdbcType=VARCHAR},", "device_imei = #{deviceImei,jdbcType=VARCHAR},", "device_iccid = #{deviceIccid,jdbcType=VARCHAR},", + "receipt_out_content = #{receiptOutContent,jdbcType=INTEGER},", "receipt_top = #{receiptTop,jdbcType=VARCHAR},", "receipt_source = #{receiptSource,jdbcType=VARCHAR},", "receipt_bottom = #{receiptBottom,jdbcType=VARCHAR},", diff --git a/service/src/main/java/com/hfkj/dao/BsDeviceSqlProvider.java b/service/src/main/java/com/hfkj/dao/BsDeviceSqlProvider.java index 6737cff..86b5eef 100644 --- a/service/src/main/java/com/hfkj/dao/BsDeviceSqlProvider.java +++ b/service/src/main/java/com/hfkj/dao/BsDeviceSqlProvider.java @@ -80,6 +80,10 @@ public class BsDeviceSqlProvider { sql.VALUES("device_iccid", "#{deviceIccid,jdbcType=VARCHAR}"); } + if (record.getReceiptOutContent() != null) { + sql.VALUES("receipt_out_content", "#{receiptOutContent,jdbcType=INTEGER}"); + } + if (record.getReceiptTop() != null) { sql.VALUES("receipt_top", "#{receiptTop,jdbcType=VARCHAR}"); } @@ -139,6 +143,7 @@ public class BsDeviceSqlProvider { sql.SELECT("device_key"); sql.SELECT("device_imei"); sql.SELECT("device_iccid"); + sql.SELECT("receipt_out_content"); sql.SELECT("receipt_top"); sql.SELECT("receipt_source"); sql.SELECT("receipt_bottom"); @@ -221,6 +226,10 @@ public class BsDeviceSqlProvider { sql.SET("device_iccid = #{record.deviceIccid,jdbcType=VARCHAR}"); } + if (record.getReceiptOutContent() != null) { + sql.SET("receipt_out_content = #{record.receiptOutContent,jdbcType=INTEGER}"); + } + if (record.getReceiptTop() != null) { sql.SET("receipt_top = #{record.receiptTop,jdbcType=VARCHAR}"); } @@ -279,6 +288,7 @@ public class BsDeviceSqlProvider { sql.SET("device_key = #{record.deviceKey,jdbcType=VARCHAR}"); sql.SET("device_imei = #{record.deviceImei,jdbcType=VARCHAR}"); sql.SET("device_iccid = #{record.deviceIccid,jdbcType=VARCHAR}"); + sql.SET("receipt_out_content = #{record.receiptOutContent,jdbcType=INTEGER}"); sql.SET("receipt_top = #{record.receiptTop,jdbcType=VARCHAR}"); sql.SET("receipt_source = #{record.receiptSource,jdbcType=VARCHAR}"); sql.SET("receipt_bottom = #{record.receiptBottom,jdbcType=VARCHAR}"); @@ -350,6 +360,10 @@ public class BsDeviceSqlProvider { sql.SET("device_iccid = #{deviceIccid,jdbcType=VARCHAR}"); } + if (record.getReceiptOutContent() != null) { + sql.SET("receipt_out_content = #{receiptOutContent,jdbcType=INTEGER}"); + } + if (record.getReceiptTop() != null) { sql.SET("receipt_top = #{receiptTop,jdbcType=VARCHAR}"); } diff --git a/service/src/main/java/com/hfkj/entity/BsDevice.java b/service/src/main/java/com/hfkj/entity/BsDevice.java index f657931..74ef6bc 100644 --- a/service/src/main/java/com/hfkj/entity/BsDevice.java +++ b/service/src/main/java/com/hfkj/entity/BsDevice.java @@ -83,6 +83,11 @@ public class BsDevice implements Serializable { */ private String deviceIccid; + /** + * 小票打印内容 1:全部 2:油站存根 3:客户存根 + */ + private Integer receiptOutContent; + /** * 小票顶部显示 */ @@ -233,6 +238,14 @@ public class BsDevice implements Serializable { this.deviceIccid = deviceIccid; } + public Integer getReceiptOutContent() { + return receiptOutContent; + } + + public void setReceiptOutContent(Integer receiptOutContent) { + this.receiptOutContent = receiptOutContent; + } + public String getReceiptTop() { return receiptTop; } @@ -331,6 +344,7 @@ public class BsDevice implements Serializable { && (this.getDeviceKey() == null ? other.getDeviceKey() == null : this.getDeviceKey().equals(other.getDeviceKey())) && (this.getDeviceImei() == null ? other.getDeviceImei() == null : this.getDeviceImei().equals(other.getDeviceImei())) && (this.getDeviceIccid() == null ? other.getDeviceIccid() == null : this.getDeviceIccid().equals(other.getDeviceIccid())) + && (this.getReceiptOutContent() == null ? other.getReceiptOutContent() == null : this.getReceiptOutContent().equals(other.getReceiptOutContent())) && (this.getReceiptTop() == null ? other.getReceiptTop() == null : this.getReceiptTop().equals(other.getReceiptTop())) && (this.getReceiptSource() == null ? other.getReceiptSource() == null : this.getReceiptSource().equals(other.getReceiptSource())) && (this.getReceiptBottom() == null ? other.getReceiptBottom() == null : this.getReceiptBottom().equals(other.getReceiptBottom())) @@ -360,6 +374,7 @@ public class BsDevice implements Serializable { result = prime * result + ((getDeviceKey() == null) ? 0 : getDeviceKey().hashCode()); result = prime * result + ((getDeviceImei() == null) ? 0 : getDeviceImei().hashCode()); result = prime * result + ((getDeviceIccid() == null) ? 0 : getDeviceIccid().hashCode()); + result = prime * result + ((getReceiptOutContent() == null) ? 0 : getReceiptOutContent().hashCode()); result = prime * result + ((getReceiptTop() == null) ? 0 : getReceiptTop().hashCode()); result = prime * result + ((getReceiptSource() == null) ? 0 : getReceiptSource().hashCode()); result = prime * result + ((getReceiptBottom() == null) ? 0 : getReceiptBottom().hashCode()); @@ -392,6 +407,7 @@ public class BsDevice implements Serializable { sb.append(", deviceKey=").append(deviceKey); sb.append(", deviceImei=").append(deviceImei); sb.append(", deviceIccid=").append(deviceIccid); + sb.append(", receiptOutContent=").append(receiptOutContent); sb.append(", receiptTop=").append(receiptTop); sb.append(", receiptSource=").append(receiptSource); sb.append(", receiptBottom=").append(receiptBottom); diff --git a/service/src/main/java/com/hfkj/entity/BsDeviceExample.java b/service/src/main/java/com/hfkj/entity/BsDeviceExample.java index c81dbeb..29564d8 100644 --- a/service/src/main/java/com/hfkj/entity/BsDeviceExample.java +++ b/service/src/main/java/com/hfkj/entity/BsDeviceExample.java @@ -1055,6 +1055,66 @@ public class BsDeviceExample { return (Criteria) this; } + public Criteria andReceiptOutContentIsNull() { + addCriterion("receipt_out_content is null"); + return (Criteria) this; + } + + public Criteria andReceiptOutContentIsNotNull() { + addCriterion("receipt_out_content is not null"); + return (Criteria) this; + } + + public Criteria andReceiptOutContentEqualTo(Integer value) { + addCriterion("receipt_out_content =", value, "receiptOutContent"); + return (Criteria) this; + } + + public Criteria andReceiptOutContentNotEqualTo(Integer value) { + addCriterion("receipt_out_content <>", value, "receiptOutContent"); + return (Criteria) this; + } + + public Criteria andReceiptOutContentGreaterThan(Integer value) { + addCriterion("receipt_out_content >", value, "receiptOutContent"); + return (Criteria) this; + } + + public Criteria andReceiptOutContentGreaterThanOrEqualTo(Integer value) { + addCriterion("receipt_out_content >=", value, "receiptOutContent"); + return (Criteria) this; + } + + public Criteria andReceiptOutContentLessThan(Integer value) { + addCriterion("receipt_out_content <", value, "receiptOutContent"); + return (Criteria) this; + } + + public Criteria andReceiptOutContentLessThanOrEqualTo(Integer value) { + addCriterion("receipt_out_content <=", value, "receiptOutContent"); + return (Criteria) this; + } + + public Criteria andReceiptOutContentIn(List values) { + addCriterion("receipt_out_content in", values, "receiptOutContent"); + return (Criteria) this; + } + + public Criteria andReceiptOutContentNotIn(List values) { + addCriterion("receipt_out_content not in", values, "receiptOutContent"); + return (Criteria) this; + } + + public Criteria andReceiptOutContentBetween(Integer value1, Integer value2) { + addCriterion("receipt_out_content between", value1, value2, "receiptOutContent"); + return (Criteria) this; + } + + public Criteria andReceiptOutContentNotBetween(Integer value1, Integer value2) { + addCriterion("receipt_out_content not between", value1, value2, "receiptOutContent"); + return (Criteria) this; + } + public Criteria andReceiptTopIsNull() { addCriterion("receipt_top is null"); return (Criteria) this; diff --git a/service/src/main/java/com/hfkj/service/impl/BsDeviceServiceImpl.java b/service/src/main/java/com/hfkj/service/impl/BsDeviceServiceImpl.java index 7093a78..73f570a 100644 --- a/service/src/main/java/com/hfkj/service/impl/BsDeviceServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/impl/BsDeviceServiceImpl.java @@ -8,6 +8,7 @@ import com.hfkj.entity.BsDevice; import com.hfkj.entity.BsDeviceExample; import com.hfkj.entity.BsGasOrder; import com.hfkj.service.BsDeviceService; +import com.hfkj.sysenum.DeviceReceiptOutContentEnum; import com.hfkj.sysenum.DeviceTypeEnum; import org.apache.commons.collections4.MapUtils; import org.apache.commons.lang3.StringUtils; @@ -90,33 +91,44 @@ public class BsDeviceServiceImpl implements BsDeviceService { new Thread(() -> { try { SpPrinterConfig sp = new SpPrinterConfig(); - sp.print(device.getDeviceSn(), - SpPrinterTemplate.oilCashierStubTemp( - gasOrder.getMerName(), - gasOrder.getOrderNo(), - DateUtil.date2String(gasOrder.getPayTime(), "yyyy-MM-dd HH:mm:ss"), - gasOrder.getUserPhone(), - gasOrder.getGasGunNo(), - gasOrder.getGasOilNo(), - gasOrder.getGasOilLiters().toString(), - gasOrder.getGasRefuelPrice().toString(), - receiptMap, - makeUp - ), 1); - - sp.print(device.getDeviceSn(), - SpPrinterTemplate.oilClientStubTemp( - gasOrder.getMerName(), - gasOrder.getOrderNo(), - DateUtil.date2String(gasOrder.getPayTime(), "yyyy-MM-dd HH:mm:ss"), - gasOrder.getUserPhone(), - gasOrder.getGasGunNo(), - gasOrder.getGasOilNo(), - gasOrder.getGasOilLiters().toString(), - gasOrder.getGasRefuelPrice().toString(), - receiptMap, - makeUp - ), 1); + + if (device.getReceiptOutContent().equals(DeviceReceiptOutContentEnum.content1.getType()) + || device.getReceiptOutContent().equals(DeviceReceiptOutContentEnum.content2.getType())) { + // 加油站存根 + sp.print(device.getDeviceSn(), + SpPrinterTemplate.oilCashierStubTemp( + gasOrder.getMerName(), + gasOrder.getOrderNo(), + DateUtil.date2String(gasOrder.getPayTime(), "yyyy-MM-dd HH:mm:ss"), + gasOrder.getUserPhone(), + gasOrder.getGasGunNo(), + gasOrder.getGasOilNo(), + gasOrder.getGasOilLiters().toString(), + gasOrder.getGasRefuelPrice().toString(), + receiptMap, + makeUp + ), 1); + } + + if (device.getReceiptOutContent().equals(DeviceReceiptOutContentEnum.content1.getType()) + || device.getReceiptOutContent().equals(DeviceReceiptOutContentEnum.content3.getType())) { + // 客户存根 + sp.print(device.getDeviceSn(), + SpPrinterTemplate.oilClientStubTemp( + gasOrder.getMerName(), + gasOrder.getOrderNo(), + DateUtil.date2String(gasOrder.getPayTime(), "yyyy-MM-dd HH:mm:ss"), + gasOrder.getUserPhone(), + gasOrder.getGasGunNo(), + gasOrder.getGasOilNo(), + gasOrder.getGasOilLiters().toString(), + gasOrder.getGasRefuelPrice().toString(), + receiptMap, + makeUp + ), 1); + } + + } catch (Exception e) { e.printStackTrace(); diff --git a/service/src/main/java/com/hfkj/sysenum/DeviceReceiptOutContentEnum.java b/service/src/main/java/com/hfkj/sysenum/DeviceReceiptOutContentEnum.java new file mode 100644 index 0000000..1a405dd --- /dev/null +++ b/service/src/main/java/com/hfkj/sysenum/DeviceReceiptOutContentEnum.java @@ -0,0 +1,54 @@ +package com.hfkj.sysenum; + +import java.util.Objects; + +/** + * 设备类型 + * @author hurui + */ +public enum DeviceReceiptOutContentEnum { + /** + * 全部 + */ + content1(1 , "全部"), + /** + * 油站存根 + */ + content2(2 , "油站存根"), + /** + * 客户存根 + */ + content3(3 , "客户存根"), + ; + + private Integer type; + private String name; + + DeviceReceiptOutContentEnum(int type , String name) { + this.type = type; + this.name = name; + } + + public static String getNameByType(Integer type) { + for (DeviceReceiptOutContentEnum ele : values()) { + if(Objects.equals(type,ele.getType())) return ele.getName(); + } + return null; + } + + public Integer getType() { + return type; + } + + public void setType(Integer type) { + this.type = type; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } +}