From 137a5f87ce43d6c2b40a82b8d781b39d3489caee Mon Sep 17 00:00:00 2001 From: limqhz <540344226@qq.com> Date: Wed, 6 Dec 2023 10:00:43 +0800 Subject: [PATCH] =?UTF-8?q?=E9=97=A8=E7=A6=81=E5=BC=80=E9=97=A8=E8=AE=A1?= =?UTF-8?q?=E8=B4=B9=E9=80=BB=E8=BE=91=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/AdminNettyController.java | 14 +- .../java/com/sv/netty/netty/BootService.java | 2 +- .../com/sv/netty/netty/ServerHandler.java | 13 +- .../impl/ServerMessageHandlerAdapter.java | 15 +- .../config/application-development.yml | 6 +- .../config/application-production.yml | 2 +- .../resources/config/application-test.yml | 2 +- api/src/main/resources/config/application.yml | 2 +- api/src/main/resources/logback.xml | 3 +- .../src/main/java/com/enums/PayStyleEnum.java | 42 +++++ .../main/java/com/sv/dto/api/VenueDTO.java | 26 +++ .../java/com/sv/entity/BarcodeOrderTime.java | 89 ++++++++++ entity/src/main/java/com/sv/entity/Venue.java | 26 ++- .../java/com/sv/barcode/ListenKeyFrame.java | 2 +- .../java/com/sv/netty/MessageHandler.java | 2 +- .../java/com/sv/service/ClientService.java | 5 +- .../sv/oms/controller/DeviceController.java | 58 ------- .../oms/controller/VenuePriceController.java | 8 +- .../com/ydd/oms/util/VenueBarcodeUtil.java | 109 ------------- .../config/application-development.yml | 4 +- .../config/application-production.yml | 2 +- .../resources/config/application-test.yml | 4 +- other/sql/202312.sql | 5 + .../com/sv/mapper/BarcodeEnterLogMapper.java | 4 +- .../com/sv/mapper/BarcodeOrderTimeMapper.java | 17 ++ .../api/MemberEnterVenueLogService.java | 2 +- .../java/com/sv/service/api/VenueService.java | 92 ++++++++--- .../com/sv/service/api/util/DateUtilCard.java | 26 +++ .../com/sv/service/oms/DeviceService.java | 1 + .../sv/service/utils/VenueBarcodeUtil.java | 3 +- .../mapper/sv/BarcodeOfflineMapper.xml | 152 ------------------ .../mapper/sv/BarcodeOrderTimeMapper.xml | 119 ++++++++++++++ .../mapper/sv/MemberEnterVenueLogMapper.xml | 2 +- .../mybatis/mapper/sv/VenueMapper.xml | 40 ++++- .../main/resources/tools/generatorConfig.xml | 2 +- 35 files changed, 509 insertions(+), 392 deletions(-) create mode 100644 entity/src/main/java/com/enums/PayStyleEnum.java create mode 100644 entity/src/main/java/com/sv/entity/BarcodeOrderTime.java delete mode 100644 oms/src/main/java/com/ydd/oms/util/VenueBarcodeUtil.java create mode 100644 other/sql/202312.sql create mode 100644 service/src/main/java/com/sv/mapper/BarcodeOrderTimeMapper.java create mode 100644 service/src/main/resources/mybatis/mapper/sv/BarcodeOrderTimeMapper.xml diff --git a/api/src/main/java/com/sv/netty/controller/AdminNettyController.java b/api/src/main/java/com/sv/netty/controller/AdminNettyController.java index b460eb2..462f5eb 100644 --- a/api/src/main/java/com/sv/netty/controller/AdminNettyController.java +++ b/api/src/main/java/com/sv/netty/controller/AdminNettyController.java @@ -28,7 +28,7 @@ import java.io.*; @RestController public class AdminNettyController extends BaseApiController { - private final Logger logger = LoggerFactory.getLogger(AdminNettyController.class); + private final Logger logger = LoggerFactory.getLogger("NETTY-LOG-NAME"); @Resource DeviceService deviceService; @Resource @@ -139,7 +139,7 @@ public class AdminNettyController extends BaseApiController { String barcode = MakeCode.makeOfflineCode(barcodeSn); deviceService.makeDeviceBarcode(device.getName(),device.getVenueId(),barcode); - String documentPath = getDocument(barcodeSn); + String documentPath = getDocument(barcode,barcodeSn); response.setHeader("Content-disposition","attachment; filename=" + barcodeSn + ".docx"); response.setContentType("application/vnd.openxmlformats-officedocument.wordprocessingml.document"); response.setCharacterEncoding("UTF-8"); @@ -163,8 +163,9 @@ public class AdminNettyController extends BaseApiController { } } - private static String getDocument(String barcodeSn) throws IOException, InvalidFormatException { - String newFilePath = "/Users/limqhz/home/test/document.docx"; + private static String getDocument(String barcode, String barcodeSn) throws IOException, InvalidFormatException { + String newFilePath = "/home/test/" + barcodeSn + ".docx"; +// String newFilePath = "/Users/limqhz/home/test/" + barcodeSn + ".docx"; XWPFDocument document = new XWPFDocument(); XWPFParagraph paragraph = document.createParagraph(); paragraph.setAlignment(ParagraphAlignment.CENTER); @@ -173,7 +174,10 @@ public class AdminNettyController extends BaseApiController { // 入场二维码 run.setText("订单号:" + barcodeSn); run.addBreak(); - String imgFile = VenueBarcodeUtil.generateBarcode("jdoiawjdoiawioe1","202311161.jpg"); + // 入场二维码 + run.setText("二维码使用有效期为2小时,请及时离场!"); + run.addBreak(); + String imgFile = VenueBarcodeUtil.generateBarcode(barcode,barcodeSn + ".jpg"); int imgFormat = XWPFDocument.PICTURE_TYPE_JPEG; run.addPicture(new FileInputStream(imgFile), imgFormat, "image description", Units.toEMU(200), Units.toEMU(200)); diff --git a/api/src/main/java/com/sv/netty/netty/BootService.java b/api/src/main/java/com/sv/netty/netty/BootService.java index 8a3b2b1..c5a6766 100644 --- a/api/src/main/java/com/sv/netty/netty/BootService.java +++ b/api/src/main/java/com/sv/netty/netty/BootService.java @@ -26,7 +26,7 @@ import java.util.concurrent.Executors; @Component public class BootService { - private Logger logger = LoggerFactory.getLogger(BootService.class); + private Logger logger = LoggerFactory.getLogger("NETTY-LOG-NAME"); private volatile EventLoopGroup workerGroup; private volatile EventLoopGroup bossGroup; diff --git a/api/src/main/java/com/sv/netty/netty/ServerHandler.java b/api/src/main/java/com/sv/netty/netty/ServerHandler.java index 9ea123d..29a88f9 100644 --- a/api/src/main/java/com/sv/netty/netty/ServerHandler.java +++ b/api/src/main/java/com/sv/netty/netty/ServerHandler.java @@ -24,7 +24,7 @@ import java.util.Set; @ChannelHandler.Sharable public class ServerHandler extends SimpleChannelInboundHandler { - private static Logger logger = LoggerFactory.getLogger(ServerHandler.class); + private static Logger logger = LoggerFactory.getLogger("NETTY-LOG-NAME"); private MessageService messageService; @@ -67,12 +67,13 @@ public class ServerHandler extends SimpleChannelInboundHandler { if (offline.startsWith("venue-")) { // 这是线下开门的逻辑 messageService.offlineOpenDoor(message.getMessage()); - } - VenueBarCode venueBarCode = MakeCode.decodeCode(message.getMessage()); - if (EnterEnum.ENTER.getValue() == venueBarCode.getDirection()) { - messageService.enterVenue(message.getMessage()); } else { - messageService.outVenue(message.getMessage()); + VenueBarCode venueBarCode = MakeCode.decodeCode(message.getMessage()); + if (EnterEnum.ENTER.getValue() == venueBarCode.getDirection()) { + messageService.enterVenue(message.getMessage()); + } else { + messageService.outVenue(message.getMessage()); + } } break; default: diff --git a/api/src/main/java/com/sv/netty/netty/service/impl/ServerMessageHandlerAdapter.java b/api/src/main/java/com/sv/netty/netty/service/impl/ServerMessageHandlerAdapter.java index 5cbeed8..a85c506 100644 --- a/api/src/main/java/com/sv/netty/netty/service/impl/ServerMessageHandlerAdapter.java +++ b/api/src/main/java/com/sv/netty/netty/service/impl/ServerMessageHandlerAdapter.java @@ -37,7 +37,7 @@ import java.util.concurrent.ConcurrentMap; @Service("messageService") public class ServerMessageHandlerAdapter implements MessageService { - private Logger logger = LoggerFactory.getLogger(ServerMessageHandlerAdapter.class); + private Logger logger = LoggerFactory.getLogger("NETTY-LOG-NAME"); /** * 存储设备通道类型 @@ -120,10 +120,12 @@ public class ServerMessageHandlerAdapter implements MessageService { String doorSn = venueBarCode.getDeviceName(); boolean lockStat = doorLockUtil.checkDoorLock(doorSn); if (lockStat) { + logger.error("有人正在操作,请稍后再出场!!!"); throw new ServiceException("有人正在操作,请稍后再试"); } barcode = MakeCode.reWriteBarcode(barcode); if (!checkBarcode(barcode)){ + logger.error("二维码已经使用,无法出场"); throw new ServiceException("二维码已经使用"); } Channel channel = getCurrentChannel(doorSn,venueBarCode.getVenueId()); @@ -158,10 +160,12 @@ public class ServerMessageHandlerAdapter implements MessageService { String doorSn = venueBarCode.getDeviceName(); boolean lockStat = doorLockUtil.checkDoorLock(doorSn); if (lockStat) { + logger.error("有人正在操作,请稍后再试"); throw new ServiceException("有人正在操作,请稍后再试"); } barcode = MakeCode.reWriteBarcode(barcode); if (!checkBarcode(barcode)){ + logger.error("二维码已经使用,无法入场"); throw new ServiceException("二维码已经使用"); } Channel channel = getCurrentChannel(doorSn, venueBarCode.getVenueId()); @@ -189,6 +193,7 @@ public class ServerMessageHandlerAdapter implements MessageService { private boolean checkBarcode(String barcode) { Barcode code = barcodeMapper.checkCodeStatus(barcode); if (code == null) { + logger.error("二维码不存在或者已经被使用!!!"); throw new ServiceException("二维码不存在或者已经被使用"); } if (BarCodeStatusEnum.INIT.getValue()==code.getStatus()){ @@ -233,11 +238,13 @@ public class ServerMessageHandlerAdapter implements MessageService { Date endTime = barcodeOffline.getEndTime(); if (endTime.before(new Date())) { // 二维码已经失效了 - throw new ServiceException("二维码已经失效,无法继续使用"); + logger.error("二维码已经失效,无法继续使用"); + throw new ServiceException("二维码已经失效,无法继续使用"); } boolean lockStat = doorLockUtil.checkDoorLock(doorSn); if (lockStat) { - throw new ServiceException("有人正在操作,请稍后再试"); + logger.error("有人正在操作,请稍后再试!!!"); + throw new ServiceException("有人正在操作,请稍后再试!!!"); } BarcodeEnterLog lastByBarcode = barcodeEnterLogMapper.findLastByBarcode(barcode); Integer venueId = barcodeOffline.getVenueId(); @@ -248,6 +255,7 @@ public class ServerMessageHandlerAdapter implements MessageService { barcodeEnterLog.setBarcode(barcode); barcodeEnterLog.setType(EnterEnum.OUT.getValue()); barcodeEnterLog.setVenueId(venueId); + barcodeEnterLog.setPlatformId(1); barcodeEnterLogMapper.insert(barcodeEnterLog); doorLockUtil.lockDoor(doorSn); ServerMessageUtils.INSTANCE.sendMsg(channel,new VenueMessage(MessageType.OUT_DOOR,"OK")); @@ -257,6 +265,7 @@ public class ServerMessageHandlerAdapter implements MessageService { barcodeEnterLog.setBarcode(barcode); barcodeEnterLog.setType(EnterEnum.ENTER.getValue()); barcodeEnterLog.setVenueId(venueId); + barcodeEnterLog.setPlatformId(1); barcodeEnterLogMapper.insert(barcodeEnterLog); doorLockUtil.lockDoor(doorSn); ServerMessageUtils.INSTANCE.sendMsg(channel,new VenueMessage(MessageType.ENTER_DOOR,"OK")); diff --git a/api/src/main/resources/config/application-development.yml b/api/src/main/resources/config/application-development.yml index 9be52dd..d6471d0 100644 --- a/api/src/main/resources/config/application-development.yml +++ b/api/src/main/resources/config/application-development.yml @@ -1,12 +1,12 @@ spring: datasource: -# url: jdbc:mysql://yingdiandian.mysql.rds.aliyuncs.com:3306/smart_venue?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&serverTimezone=GMT%2b8&useAffectedRows=true&useSSL=false +# url: jdbc:mysql://yingdiandian.mysql.rds.aliyuncs.com:3306/smart_venue?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&serverTimezone=GMT%2b8&useAffectedRows=true&useSSL=false # username: yingdd # password: Yingdd2015 - url: jdbc:mysql://127.0.0.1:3306/smart_venue?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&serverTimezone=GMT%2b8&useAffectedRows=true&useSSL=false + url: jdbc:mysql://127.0.0.1:3306/smart_venue?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&serverTimezone=GMT%2b8&useAffectedRows=true&useSSL=false username: root password: 123456 -# url: jdbc:mysql://120.27.209.4:3306/smart_venue?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&serverTimezone=GMT%2b8&useAffectedRows=true&useSSL=false +# url: jdbc:mysql://120.27.209.4:3306/smart_venue?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&serverTimezone=GMT%2b8&useAffectedRows=true&useSSL=false # username: root # password: hyty1234 diff --git a/api/src/main/resources/config/application-production.yml b/api/src/main/resources/config/application-production.yml index fb26c22..de2ae3e 100644 --- a/api/src/main/resources/config/application-production.yml +++ b/api/src/main/resources/config/application-production.yml @@ -1,6 +1,6 @@ spring: datasource: - url: jdbc:mysql://127.0.0.1:3306/smart_venue?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&serverTimezone=GMT%2b8&useAffectedRows=true&useSSL=false + url: jdbc:mysql://127.0.0.1:3306/smart_venue?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&serverTimezone=GMT%2b8&useAffectedRows=true&useSSL=false username: root password: hyty1234 redis: diff --git a/api/src/main/resources/config/application-test.yml b/api/src/main/resources/config/application-test.yml index c215019..e70b27c 100644 --- a/api/src/main/resources/config/application-test.yml +++ b/api/src/main/resources/config/application-test.yml @@ -1,6 +1,6 @@ spring: datasource: - url: jdbc:mysql://yingdiandian.mysql.rds.aliyuncs.com:3306/smart_venue?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&serverTimezone=GMT%2b8 + url: jdbc:mysql://yingdiandian.mysql.rds.aliyuncs.com:3306/smart_venue?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&serverTimezone=GMT%2b8 username: yingdd password: Yingdd2015 redis: diff --git a/api/src/main/resources/config/application.yml b/api/src/main/resources/config/application.yml index 74fc73c..5a93740 100644 --- a/api/src/main/resources/config/application.yml +++ b/api/src/main/resources/config/application.yml @@ -95,7 +95,7 @@ logging: #netty服务器配置 netty: - port: 56792 + port: 56791 boss: thread: count: 1 diff --git a/api/src/main/resources/logback.xml b/api/src/main/resources/logback.xml index 87627da..fa64b74 100644 --- a/api/src/main/resources/logback.xml +++ b/api/src/main/resources/logback.xml @@ -52,14 +52,13 @@ - + - diff --git a/entity/src/main/java/com/enums/PayStyleEnum.java b/entity/src/main/java/com/enums/PayStyleEnum.java new file mode 100644 index 0000000..c7af1f7 --- /dev/null +++ b/entity/src/main/java/com/enums/PayStyleEnum.java @@ -0,0 +1,42 @@ +package com.enums; + +/** + * Enum - 篮球场结算方式 + * + */ +public enum PayStyleEnum { + TIME(0, "按次"), + HOUR(1, "按时"); + public Integer value; + public String name; + + PayStyleEnum(Integer value, String name) { + this.value = value; + this.name = name; + } + + public Integer getValue() { + return value; + } + + public void setValue(Integer value) { + this.value = value; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public static PayStyleEnum getByValue(Integer value) { + for (PayStyleEnum type : PayStyleEnum.values()) { + if (type.value.equals(value)) { + return type; + } + } + return null; + } +} diff --git a/entity/src/main/java/com/sv/dto/api/VenueDTO.java b/entity/src/main/java/com/sv/dto/api/VenueDTO.java index 26c649f..d5509e6 100644 --- a/entity/src/main/java/com/sv/dto/api/VenueDTO.java +++ b/entity/src/main/java/com/sv/dto/api/VenueDTO.java @@ -168,6 +168,16 @@ public class VenueDTO implements Serializable { */ private Integer copyControl; + /** + * 0- 按次 + * 1- 按时 + */ + private Integer payStyle; + /** + * 按次,几小时内可以免费进出 + */ + private Integer timePayHour; + /** * 场馆图片列表 */ @@ -660,4 +670,20 @@ public class VenueDTO implements Serializable { public void setEnterFlag(Integer enterFlag) { this.enterFlag = enterFlag; } + + public Integer getPayStyle() { + return payStyle; + } + + public void setPayStyle(Integer payStyle) { + this.payStyle = payStyle; + } + + public Integer getTimePayHour() { + return timePayHour; + } + + public void setTimePayHour(Integer timePayHour) { + this.timePayHour = timePayHour; + } } diff --git a/entity/src/main/java/com/sv/entity/BarcodeOrderTime.java b/entity/src/main/java/com/sv/entity/BarcodeOrderTime.java new file mode 100644 index 0000000..1cde2b7 --- /dev/null +++ b/entity/src/main/java/com/sv/entity/BarcodeOrderTime.java @@ -0,0 +1,89 @@ +package com.sv.entity; + +import java.util.Date; + +public class BarcodeOrderTime { + private Integer id; + + private Integer memberId; + + private Integer venueId; + + private Date createdTime; + + private Date modifiedTime; + + private Date orderStart; + + private Date orderEnd; + + public BarcodeOrderTime(Integer id, Integer memberId, Integer venueId, Date createdTime, Date modifiedTime, Date orderStart, Date orderEnd) { + this.id = id; + this.memberId = memberId; + this.venueId = venueId; + this.createdTime = createdTime; + this.modifiedTime = modifiedTime; + this.orderStart = orderStart; + this.orderEnd = orderEnd; + } + + public BarcodeOrderTime() { + super(); + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Integer getMemberId() { + return memberId; + } + + public void setMemberId(Integer memberId) { + this.memberId = memberId; + } + + public Integer getVenueId() { + return venueId; + } + + public void setVenueId(Integer venueId) { + this.venueId = venueId; + } + + public Date getCreatedTime() { + return createdTime; + } + + public void setCreatedTime(Date createdTime) { + this.createdTime = createdTime; + } + + public Date getModifiedTime() { + return modifiedTime; + } + + public void setModifiedTime(Date modifiedTime) { + this.modifiedTime = modifiedTime; + } + + public Date getOrderStart() { + return orderStart; + } + + public void setOrderStart(Date orderStart) { + this.orderStart = orderStart; + } + + public Date getOrderEnd() { + return orderEnd; + } + + public void setOrderEnd(Date orderEnd) { + this.orderEnd = orderEnd; + } +} \ No newline at end of file diff --git a/entity/src/main/java/com/sv/entity/Venue.java b/entity/src/main/java/com/sv/entity/Venue.java index 4b999a4..e505b68 100644 --- a/entity/src/main/java/com/sv/entity/Venue.java +++ b/entity/src/main/java/com/sv/entity/Venue.java @@ -194,7 +194,15 @@ public class Venue implements Serializable { */ private Integer limitNoWeek; - + /** + * 0- 按次 + * 1- 按时 + */ + private Integer payStyle; + /** + * 按次,几小时内可以免费进出 + */ + private Integer timePayHour; /** * 设置 * @@ -681,4 +689,20 @@ public class Venue implements Serializable { public void setCopyControl(Integer copyControl) { this.copyControl = copyControl; } + + public Integer getPayStyle() { + return payStyle; + } + + public void setPayStyle(Integer payStyle) { + this.payStyle = payStyle; + } + + public Integer getTimePayHour() { + return timePayHour; + } + + public void setTimePayHour(Integer timePayHour) { + this.timePayHour = timePayHour; + } } diff --git a/netty-client/src/main/java/com/sv/barcode/ListenKeyFrame.java b/netty-client/src/main/java/com/sv/barcode/ListenKeyFrame.java index f141d3e..c6c0991 100644 --- a/netty-client/src/main/java/com/sv/barcode/ListenKeyFrame.java +++ b/netty-client/src/main/java/com/sv/barcode/ListenKeyFrame.java @@ -12,7 +12,7 @@ public class ListenKeyFrame extends Thread{ Frame frame; public void newFrame (String title) { - frame = new Frame("智慧云馆门禁" + title); + frame = new Frame("智慧云馆门禁new" + title); frame.setBounds(300,100,600,500); frame.setLayout(new FlowLayout(FlowLayout.CENTER,20,50));//设计布局 JLabel label = new JLabel("请保持该界面被选中,否则将无法监听二维码扫描!"); diff --git a/netty-client/src/main/java/com/sv/netty/MessageHandler.java b/netty-client/src/main/java/com/sv/netty/MessageHandler.java index 0d94b90..29a48a5 100644 --- a/netty-client/src/main/java/com/sv/netty/MessageHandler.java +++ b/netty-client/src/main/java/com/sv/netty/MessageHandler.java @@ -31,7 +31,7 @@ public class MessageHandler { String decrypt = AesUtil.decrypt(barcode); // 这个二维码是线下的二维码 if (!decrypt.startsWith("venue-")){ - VenueBarCode venueBarCode = MakeCode.decodeCode(barcode); + VenueBarCode venueBarCode = MakeCode.decodeCode(barcode); if (venueBarCode == null) { logger.error("二维码不合法" + barcode); return null; diff --git a/netty-client/src/main/java/com/sv/service/ClientService.java b/netty-client/src/main/java/com/sv/service/ClientService.java index ff00a80..2893c23 100644 --- a/netty-client/src/main/java/com/sv/service/ClientService.java +++ b/netty-client/src/main/java/com/sv/service/ClientService.java @@ -48,11 +48,12 @@ public class ClientService { Thread.sleep(3000); listenKeyFrame1.close(); ListenKeyFrame listenKeyFrame2 = new ListenKeyFrame(); - listenKeyFrame2.newFrame("-加载中53%"); + listenKeyFrame2.newFrame("-加载中94%"); Thread.sleep(3000); listenKeyFrame2.close(); ListenKeyFrame listenKeyFrame3 = new ListenKeyFrame(); - listenKeyFrame3.newFrame(""); + listenKeyFrame3.newFrame("aaa"); + listenKeyFrame3.focus(); } diff --git a/oms/src/main/java/com/sv/oms/controller/DeviceController.java b/oms/src/main/java/com/sv/oms/controller/DeviceController.java index 805e2e1..593cfe3 100644 --- a/oms/src/main/java/com/sv/oms/controller/DeviceController.java +++ b/oms/src/main/java/com/sv/oms/controller/DeviceController.java @@ -8,18 +8,11 @@ import com.ydd.framework.core.exception.ServiceException; import com.ydd.oms.controller.OmsController; import com.sv.entity.Device; -import com.ydd.oms.util.VenueBarcodeUtil; -import org.apache.poi.openxml4j.exceptions.InvalidFormatException; -import org.apache.poi.util.Units; -import org.apache.poi.xwpf.usermodel.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; -import javax.servlet.http.HttpServletResponse; -import java.io.*; - /** * Controller - 门禁设备 * @@ -120,55 +113,4 @@ public class DeviceController extends OmsController { return ResponseDTO.ok(); } - @RequestMapping(value = "/qrcode/print/{id}") - public void print(@PathVariable("id") Integer id, HttpServletResponse response) throws IOException, InvalidFormatException { - String documentPath = getDocument(); - response.setHeader("Content-disposition","attachment; filename=venue.docx"); - response.setContentType("application/vnd.ms-excel"); - response.setCharacterEncoding("UTF-8"); - OutputStream out = response.getOutputStream(); - BufferedInputStream fin = new BufferedInputStream(new FileInputStream(documentPath)); - try { - byte[] content = new byte[1024]; - int length; - while ((length = fin.read(content, 0, content.length)) != -1) { - out.write(content, 0, length); - } - } catch (Exception e) { - logger.error(e.getMessage(), e); - logger.info("文件下载失败", e.getMessage()); - throw e; - } finally { - fin.close(); - out.flush(); - out.close(); - } - } - - private static String getDocument() throws IOException, InvalidFormatException { - String newFilePath = "/Users/limqhz/home/test/document.docx"; - XWPFDocument document = new XWPFDocument(); - XWPFParagraph paragraph = document.createParagraph(); - paragraph.setAlignment(ParagraphAlignment.CENTER); - XWPFRun run = paragraph.createRun(); - // 入场二维码 - run.setText("入场二维码"); - run.addBreak(); - String imgFile = VenueBarcodeUtil.generateBarcode("jdoiawjdoiawioe1","202311161.jpg"); - int imgFormat = XWPFDocument.PICTURE_TYPE_JPEG; - run.addPicture(new FileInputStream(imgFile), imgFormat, "image description", - Units.toEMU(200), Units.toEMU(200)); - run.addBreak(BreakType.PAGE); - // 出场二维码 - run.setText("出场二维码"); - run.addBreak(); - String imgFile2 = VenueBarcodeUtil.generateBarcode("jdoiawjdoiawioe2","202311162.jpg"); - run.addPicture(new FileInputStream(imgFile2), imgFormat, "image description", - Units.toEMU(200), Units.toEMU(200)); - // 保存文件 - document.write(new FileOutputStream(newFilePath)); - document.close(); - return newFilePath; - } - } diff --git a/oms/src/main/java/com/sv/oms/controller/VenuePriceController.java b/oms/src/main/java/com/sv/oms/controller/VenuePriceController.java index fddaba4..cc64340 100644 --- a/oms/src/main/java/com/sv/oms/controller/VenuePriceController.java +++ b/oms/src/main/java/com/sv/oms/controller/VenuePriceController.java @@ -11,6 +11,7 @@ import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.text.ParseException; +import java.util.List; /** * Controller - 场馆对应价格表 @@ -22,7 +23,7 @@ import java.text.ParseException; public class VenuePriceController extends OmsController { private final Logger logger = LoggerFactory.getLogger(VenuePriceController.class); - + @Resource private VenuePriceService venuePriceService; @@ -67,8 +68,9 @@ public class VenuePriceController extends OmsController { */ @RequestMapping(value = "/venue/findPrice", method = RequestMethod.GET) public ResponseDTO findPrice(@RequestParam("venueId") Integer venueId) { - venuePriceService.findPrice(venueId); - return ResponseDTO.ok().addAttribute("price",venuePriceService.findPrice(venueId)); + List price = venuePriceService.findPrice(venueId); + System.out.println(price); + return ResponseDTO.ok().addAttribute("price", price); } } diff --git a/oms/src/main/java/com/ydd/oms/util/VenueBarcodeUtil.java b/oms/src/main/java/com/ydd/oms/util/VenueBarcodeUtil.java deleted file mode 100644 index df79af3..0000000 --- a/oms/src/main/java/com/ydd/oms/util/VenueBarcodeUtil.java +++ /dev/null @@ -1,109 +0,0 @@ -package com.ydd.oms.util; - -import com.google.zxing.BarcodeFormat; -import com.google.zxing.EncodeHintType; -import com.google.zxing.MultiFormatWriter; -import com.google.zxing.WriterException; -import com.google.zxing.common.BitMatrix; -import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel; -import com.ydd.framework.core.exception.ServiceException; - -import javax.imageio.ImageIO; -import java.awt.image.BufferedImage; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.OutputStream; -import java.util.Hashtable; - -public class VenueBarcodeUtil { - - private static final int BLACK = 0xFF000000; - private static final int WHITE = 0xFFFFFFFF; - private static final int margin = 0; - - public static String generateBarcode(String barcodeValue,String fileName) { - try { - String geneFilePath = "/Users/limqhz/home/test/" + fileName; - makeBarcode(geneFilePath,barcodeValue); - return geneFilePath; - }catch (WriterException e) { - throw new ServiceException("生成二维码图片文件有问题"); - } - } - - private static void makeBarcode(String path, String barcodeValue) throws WriterException { - //二维码内容 - String content = barcodeValue; - String format = "jpg"; - int width = 200; // 二维码宽度 - int height = 200;// 二维码高度 - // 设置二维码矩阵的信息 - BitMatrix bitMatrix = setBitMatrix(content, width, height); - // 设置输出流 - OutputStream outStream = null; - try { - outStream = new FileOutputStream(new File(path)); - // 目前 针对容错等级为H reduceWhiteArea 二维码空白区域的大小 根据实际情况设置,如果二维码内容长度不固定的话 需要自己根据实际情况计算reduceWhiteArea的大小 - writeToFile(bitMatrix, format, outStream, 5); - outStream.close(); - } catch (Exception e) { - e.printStackTrace(); - }finally { - try { - outStream.close(); - } catch (IOException e) { - e.printStackTrace(); - } - } - } - - /** - * 设置生成二维码矩阵信息 - * @param content 二维码图片内容 - * @param width 二维码图片宽度 - * @param height 二维码图片高度 - * @throws WriterException - */ - private static BitMatrix setBitMatrix(String content, int width, int height) throws WriterException { - BitMatrix bitMatrix = null; - Hashtable hints = new Hashtable(); - hints.put(EncodeHintType.CHARACTER_SET, "UTF-8"); // 指定编码方式,避免中文乱码 - hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.H); // 指定纠错等级 如果二维码里面的内容比较多的话推荐使用H 容错率30%, 这样可以避免一些扫描不出来的问题 - hints.put(EncodeHintType.MARGIN, margin); // 指定二维码四周白色区域大小 官方的这个方法目前没有没有作用默认设置为0 - bitMatrix = new MultiFormatWriter().encode(content, BarcodeFormat.QR_CODE, width, height, hints); - return bitMatrix; - } - - /** - * @param matrix - * @param format - * @param outStream - * @param reduceWhiteArea 二维码空白区域设置 - * @throws IOException - */ - - private static void writeToFile(BitMatrix matrix, String format, OutputStream outStream, int reduceWhiteArea) throws IOException { - BufferedImage image = toBufferedImage(matrix, reduceWhiteArea); - ImageIO.write(image, format, outStream); - } - - /** - * - * @param matrix - * @param reduceWhiteArea - * @return - */ - private static BufferedImage toBufferedImage(BitMatrix matrix, int reduceWhiteArea) { - int width = matrix.getWidth(); - int height = matrix.getHeight(); - BufferedImage image = new BufferedImage(width - 2 * reduceWhiteArea, height - 2 * reduceWhiteArea, BufferedImage.TYPE_3BYTE_BGR); - for (int x = reduceWhiteArea; x < width - reduceWhiteArea; x++) { - for (int y = reduceWhiteArea; y < height - reduceWhiteArea; y++) { - image.setRGB(x - reduceWhiteArea, y - reduceWhiteArea, matrix.get(x, y) ? BLACK : WHITE); - } - } - return image; - } - -} diff --git a/oms/src/main/resources/config/application-development.yml b/oms/src/main/resources/config/application-development.yml index 872f427..01ae16a 100644 --- a/oms/src/main/resources/config/application-development.yml +++ b/oms/src/main/resources/config/application-development.yml @@ -1,9 +1,9 @@ spring: datasource: -# url: jdbc:mysql://yingdiandian.mysql.rds.aliyuncs.com:3306/smart_venue?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&serverTimezone=GMT%2b8 +# url: jdbc:mysql://yingdiandian.mysql.rds.aliyuncs.com:3306/smart_venue?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&serverTimezone=GMT%2b8 # username: yingdd # password: Yingdd2015 - url: jdbc:mysql://127.0.0.1:3306/smart_venue?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&serverTimezone=GMT%2b8&useAffectedRows=true&useSSL=false + url: jdbc:mysql://127.0.0.1:3306/smart_venue?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&serverTimezone=GMT%2b8&useAffectedRows=true&useSSL=false username: root password: 123456 redis: diff --git a/oms/src/main/resources/config/application-production.yml b/oms/src/main/resources/config/application-production.yml index eea8392..e529537 100644 --- a/oms/src/main/resources/config/application-production.yml +++ b/oms/src/main/resources/config/application-production.yml @@ -1,6 +1,6 @@ spring: datasource: - url: jdbc:mysql://127.0.0.1:3306/smart_venue?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&serverTimezone=GMT%2b8&useAffectedRows=true + url: jdbc:mysql://127.0.0.1:3306/smart_venue?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&serverTimezone=GMT%2b8&useAffectedRows=true username: root password: hyty1234 redis: diff --git a/oms/src/main/resources/config/application-test.yml b/oms/src/main/resources/config/application-test.yml index 9189dd1..f742179 100644 --- a/oms/src/main/resources/config/application-test.yml +++ b/oms/src/main/resources/config/application-test.yml @@ -1,9 +1,9 @@ spring: datasource: - # url: jdbc:mysql://yingdiandian.mysql.rds.aliyuncs.com:3306/smart_venue?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&serverTimezone=GMT%2b8 + # url: jdbc:mysql://yingdiandian.mysql.rds.aliyuncs.com:3306/smart_venue?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&serverTimezone=GMT%2b8 # username: yingdd # password: Yingdd2015 - url: jdbc:mysql://127.0.0.1:3306/smart_venue?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&serverTimezone=GMT%2b8&useAffectedRows=true + url: jdbc:mysql://127.0.0.1:3306/smart_venue?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&serverTimezone=GMT%2b8&useAffectedRows=true username: root password: 123456 redis: diff --git a/other/sql/202312.sql b/other/sql/202312.sql new file mode 100644 index 0000000..05ab4b5 --- /dev/null +++ b/other/sql/202312.sql @@ -0,0 +1,5 @@ +ALTER TABLE `smart_venue`.`sv_venue` +ADD COLUMN `pay_style` int(11) NULL DEFAULT 0 COMMENT '计费方式 0-按次收费、1-按时收费' AFTER `copy_control`; + +ALTER TABLE `smart_venue`.`sv_venue` +ADD COLUMN `time_pay_hours` int(11) NULL COMMENT '按次收费几小时内免费' AFTER `pay_style`; diff --git a/service/src/main/java/com/sv/mapper/BarcodeEnterLogMapper.java b/service/src/main/java/com/sv/mapper/BarcodeEnterLogMapper.java index 783b06d..12e0246 100644 --- a/service/src/main/java/com/sv/mapper/BarcodeEnterLogMapper.java +++ b/service/src/main/java/com/sv/mapper/BarcodeEnterLogMapper.java @@ -1,11 +1,12 @@ package com.sv.mapper; +import com.sv.annotation.NoPlatform; import com.sv.entity.BarcodeEnterLog; -import com.sv.entity.BarcodeOffline; public interface BarcodeEnterLogMapper { int deleteByPrimaryKey(Integer id); + @NoPlatform int insert(BarcodeEnterLog record); int insertSelective(BarcodeEnterLog record); @@ -16,6 +17,7 @@ public interface BarcodeEnterLogMapper { int updateByPrimaryKey(BarcodeEnterLog record); + @NoPlatform BarcodeEnterLog findLastByBarcode(String barcode); } diff --git a/service/src/main/java/com/sv/mapper/BarcodeOrderTimeMapper.java b/service/src/main/java/com/sv/mapper/BarcodeOrderTimeMapper.java new file mode 100644 index 0000000..3f0eee9 --- /dev/null +++ b/service/src/main/java/com/sv/mapper/BarcodeOrderTimeMapper.java @@ -0,0 +1,17 @@ +package com.sv.mapper; + +import com.sv.entity.BarcodeOrderTime; + +public interface BarcodeOrderTimeMapper { + int deleteByPrimaryKey(Integer id); + + int insert(BarcodeOrderTime record); + + int insertSelective(BarcodeOrderTime record); + + BarcodeOrderTime selectByPrimaryKey(Integer id); + + int updateByPrimaryKeySelective(BarcodeOrderTime record); + + int updateByPrimaryKey(BarcodeOrderTime record); +} \ No newline at end of file diff --git a/service/src/main/java/com/sv/service/api/MemberEnterVenueLogService.java b/service/src/main/java/com/sv/service/api/MemberEnterVenueLogService.java index 5bb66b4..56be6e5 100644 --- a/service/src/main/java/com/sv/service/api/MemberEnterVenueLogService.java +++ b/service/src/main/java/com/sv/service/api/MemberEnterVenueLogService.java @@ -30,7 +30,7 @@ public class MemberEnterVenueLogService extends BaseServiceImpl { private MemberEnterVenueLogMapper memberEnterVenueLogMapper; /** - * 获取用户最后的进场记录 + * 获取用户最后的出入场记录 * * @param memberId * @return diff --git a/service/src/main/java/com/sv/service/api/VenueService.java b/service/src/main/java/com/sv/service/api/VenueService.java index 5b70866..b4c310e 100644 --- a/service/src/main/java/com/sv/service/api/VenueService.java +++ b/service/src/main/java/com/sv/service/api/VenueService.java @@ -8,6 +8,7 @@ import com.sv.dto.api.MemberCardVenuesDTO; import com.sv.dto.api.VenueDTO; import com.sv.entity.*; import com.sv.exception.api.ExceptionCodeTemplate; +import com.sv.mapper.BarcodeMapper; import com.sv.mapper.VenueMapper; import com.sv.service.api.util.DateUtilCard; import com.sv.service.api.util.GeoHashUtils; @@ -57,6 +58,8 @@ public class VenueService extends BaseServiceImpl { private MemberMoneyLogService memberMoneyLogService; @Resource private VenuePriceService venuePriceService; + @Resource + BarcodeMapper barcodeMapper; /** * 更新场馆 @@ -220,28 +223,46 @@ public class VenueService extends BaseServiceImpl { } //参数校验 ValidationUtils.assertNotNull(venueId); - // 1.判断用户有没有该馆的会员卡(有效期内,如果有免费卡和别的卡,优先使用别的卡),有不判断余额 - List memberCards = memberCardService.findByMemberId(venueId, memberId); - // 2. 查询该场馆需要的费用,并比较用户余额是否足够 - // 查询当前时间内,场馆对应的价格 - String time = DateUtilCard.nowTime().toString(); - VenuePrice venuePrice = venuePriceService.findPrice(venueId, time); - if (venuePrice == null) { - throw new ServiceException(ExceptionCodeTemplate.VENUE_ERROR); - } - if (memberCards.size() == 0) { - Member member = memberService.findById(memberId); - if (member.getMoney().compareTo(venuePrice.getPrice()) == -1) { - flag = 2; + synchronized (("scancode-in" + memberId).intern()) { + // 1.判断用户有没有该馆的会员卡(有效期内,如果有免费卡和别的卡,优先使用别的卡),有不判断余额 + List memberCards = memberCardService.findByMemberId(venueId, memberId); + // 2. 查询该场馆需要的费用,并比较用户余额是否足够 + // 查询当前时间内,场馆对应的价格 + String time = DateUtilCard.nowTime().toString(); + Venue venue = venueMapper.findById(venueId); + VenuePrice venuePrice = venuePriceService.findPrice(venueId, time); + BigDecimal price = venuePrice.getPrice(); + if(PayStyleEnum.TIME.getValue() == venue.getPayStyle()){ + // 按次入场先收钱,且多久之后不收钱,出场不收钱 + Integer timePayHour = venue.getTimePayHour(); + // 进过场,判断订单是否超时 + Barcode res = barcodeMapper.findBarcode(venueId, memberId); + if (res != null) { + // 已经生成了二维码,而且二维码有效 + res.getCreatedTime(); +// DateUtilCard.getTimeFromDate(memberLastLog.getCreatedTime()); + } + }else { + // 按时入场余额需要包含两个小时的场地费 + price = price.multiply(new BigDecimal(2)); } + if (venuePrice == null) { + throw new ServiceException(ExceptionCodeTemplate.VENUE_ERROR); + } + if (memberCards.size() == 0) { + Member member = memberService.findById(memberId); + if (member.getMoney().compareTo(price) == -1) { + flag = 2; + } + } + barCodeResult.setFlg(flag); + // 3.判断用户有没有人脸识别的图像,根据用户ID查找,一个用户只能有一条 + // MemberFaceInfo memberFaceInfo = memberFaceInfoService.findByMemberId(memberId); + // if (memberFaceInfo == null) { + // flag = 1; + // return flag; + // } } - barCodeResult.setFlg(flag); - // 3.判断用户有没有人脸识别的图像,根据用户ID查找,一个用户只能有一条 -// MemberFaceInfo memberFaceInfo = memberFaceInfoService.findByMemberId(memberId); -// if (memberFaceInfo == null) { -// flag = 1; -// return flag; -// } return barCodeResult; } @@ -261,7 +282,7 @@ public class VenueService extends BaseServiceImpl { //参数校验 ValidationUtils.assertNotNull(venueId); Venue venue = venueMapper.findById(venueId); - synchronized (("scancode" + memberId).intern()) { + synchronized (("scancode-out" + memberId).intern()) { // 查询当前时间内,场馆对应的价格(健身房没有价格) Member member = memberService.findByMember(memberId); memberService.verify(member); @@ -310,18 +331,37 @@ public class VenueService extends BaseServiceImpl { result.setMsg("未查询到会员卡,请先购买会员卡"); } }else { + /** + * 篮球出场核心逻辑 + */ //判断余额是否够 - String time = DateUtilCard.nowTime().toString(); - VenuePrice venuePrice = venuePriceService.findPrice(venueId, time); - if (memberService.isMoneyEnough(member.getId(), venuePrice.getPrice())) { + // 1、找到入场时间 + MemberEnterVenueLog memberLastLog = memberEnterVenueLogService.findMemberLastLog(memberId, venueId); + String enterTime = DateUtilCard.getTimeFromDate(memberLastLog.getCreatedTime()); + String outTime = DateUtilCard.nowTime().toString(); + BigDecimal price = BigDecimal.ZERO; + if(PayStyleEnum.TIME.getValue() == venue.getPayStyle()){ + // 按次出场不扣钱 + // 取入场的价格 + VenuePrice venuePriceEnter = venuePriceService.findPrice(venueId, enterTime); +// VenuePrice venuePriceOut = venuePriceService.findPrice(venueId, outTime); + price = venuePriceEnter.getPrice(); + }else { + // 按时出场选择按照分钟四舍五入到角扣款 + VenuePrice venuePriceEnter = venuePriceService.findPrice(venueId, enterTime); + price = venuePriceEnter.getPrice(); + int hours = DateUtilCard.diffHours(enterTime, outTime); + price = price.multiply(new BigDecimal(hours)); + } + if (memberService.isMoneyEnough(member.getId(), price)) { logger.info("用户" + member.getNickname() + "使用余额核销订单"); - createMemberMoneyLog(MoneyLogEnum.JOIN.value, venuePrice.getPrice(), member.getId(), member.getPlatformId(), PayTypeEnum.BALANCE.value, null, + createMemberMoneyLog(MoneyLogEnum.JOIN.value, price, member.getId(), member.getPlatformId(), PayTypeEnum.BALANCE.value, null, venue.getId(), venue.getType()); } else { //余额不足 logger.error("用户" + member.getNickname() + "余额不足核销失败"); result.setFlg(1); - result.setMsg("余额不足,请先充值"); + result.setMsg("此次订单金额为:" + price + "元,余额不足,请先充值"); } } } diff --git a/service/src/main/java/com/sv/service/api/util/DateUtilCard.java b/service/src/main/java/com/sv/service/api/util/DateUtilCard.java index 6e7b696..b248bbe 100644 --- a/service/src/main/java/com/sv/service/api/util/DateUtilCard.java +++ b/service/src/main/java/com/sv/service/api/util/DateUtilCard.java @@ -1,6 +1,7 @@ package com.sv.service.api.util; import com.enums.VipTypeEnum; +import org.springframework.util.StringUtils; import java.text.ParseException; import java.text.SimpleDateFormat; @@ -12,6 +13,7 @@ import java.util.GregorianCalendar; public class DateUtilCard { private final static SimpleDateFormat sdf = new SimpleDateFormat( "yyyy-MM-dd"); + private final static SimpleDateFormat sdfTime = new SimpleDateFormat( "HH:mm:ss"); public static Date getYear(Date date){ Calendar calendar = Calendar.getInstance(); @@ -145,6 +147,10 @@ public class DateUtilCard { } } + public static String getTimeFromDate(Date date){ + return sdfTime.format(date); + } + public static String getStrFromDate(Date date){ return sdf.format(date); } @@ -163,4 +169,24 @@ public class DateUtilCard { return calendar.getTime(); //这个时间就是日期往后推一天的结果 } + public static int diffHours(String startTime,String endTime){ + if (StringUtils.isEmpty(startTime) || StringUtils.isEmpty(endTime)){ + return 1; + } + try { + String[] split1 = startTime.split(":"); + String[] split2 = startTime.split(":"); + int t1 = 0; + int t2 = 0; + t1 = (Integer.parseInt(split1[0]) * 3600) + + (Integer.parseInt(split1[1]) * 60) + Integer.parseInt(split1[2]); + t2 = (Integer.parseInt(split2[0]) * 3600) + + (Integer.parseInt(split2[1]) * 60) + Integer.parseInt(split2[2]); + int diff = t2 - t1 - 600; + return (diff / 3600) + 1; + }catch (Exception e){ + return 1; + } + } + } diff --git a/service/src/main/java/com/sv/service/oms/DeviceService.java b/service/src/main/java/com/sv/service/oms/DeviceService.java index f66c3d4..01aa2e6 100644 --- a/service/src/main/java/com/sv/service/oms/DeviceService.java +++ b/service/src/main/java/com/sv/service/oms/DeviceService.java @@ -221,6 +221,7 @@ public class DeviceService extends BaseServiceImpl { return deviceMapper.findByDevice(venueId); } + @Transactional public void makeDeviceBarcode(String deviceName, Integer venueId, String barcode) { BarcodeOffline barcodeOffline = new BarcodeOffline(); Date startTime = new Date(); diff --git a/service/src/main/java/com/sv/service/utils/VenueBarcodeUtil.java b/service/src/main/java/com/sv/service/utils/VenueBarcodeUtil.java index eb81757..74ddd71 100644 --- a/service/src/main/java/com/sv/service/utils/VenueBarcodeUtil.java +++ b/service/src/main/java/com/sv/service/utils/VenueBarcodeUtil.java @@ -24,7 +24,8 @@ public class VenueBarcodeUtil { public static String generateBarcode(String barcodeValue,String fileName) { try { - String geneFilePath = "/Users/limqhz/home/test/" + fileName; + String geneFilePath = "/home/test/" + fileName; +// String geneFilePath = "/Users/limqhz/home/test/" + fileName; makeBarcode(geneFilePath,barcodeValue); return geneFilePath; }catch (WriterException e) { diff --git a/service/src/main/resources/mybatis/mapper/sv/BarcodeOfflineMapper.xml b/service/src/main/resources/mybatis/mapper/sv/BarcodeOfflineMapper.xml index bfda4ca..fd03fbe 100644 --- a/service/src/main/resources/mybatis/mapper/sv/BarcodeOfflineMapper.xml +++ b/service/src/main/resources/mybatis/mapper/sv/BarcodeOfflineMapper.xml @@ -152,158 +152,6 @@ device_name = #{deviceName,jdbcType=VARCHAR} where id = #{id,jdbcType=INTEGER} - - - - - - - - - - - - - - - - id, barcode, start_time, end_time, venue_id, created_id, modified_id, created_time, - modified_time, device_name - - - - delete from sv_barcode_offline - where id = #{id,jdbcType=INTEGER} - - - insert into sv_barcode_offline (id, barcode, start_time, - end_time, venue_id, created_id, - modified_id, created_time, modified_time, - device_name) - values (#{id,jdbcType=INTEGER}, #{barcode,jdbcType=VARCHAR}, #{startTime,jdbcType=TIMESTAMP}, - #{endTime,jdbcType=TIMESTAMP}, #{venueId,jdbcType=INTEGER}, #{createdId,jdbcType=INTEGER}, - #{modifiedId,jdbcType=INTEGER}, #{createdTime,jdbcType=TIMESTAMP}, #{modifiedTime,jdbcType=TIMESTAMP}, - #{deviceName,jdbcType=VARCHAR}) - - - insert into sv_barcode_offline - - - id, - - - barcode, - - - start_time, - - - end_time, - - - venue_id, - - - created_id, - - - modified_id, - - - created_time, - - - modified_time, - - - device_name, - - - - - #{id,jdbcType=INTEGER}, - - - #{barcode,jdbcType=VARCHAR}, - - - #{startTime,jdbcType=TIMESTAMP}, - - - #{endTime,jdbcType=TIMESTAMP}, - - - #{venueId,jdbcType=INTEGER}, - - - #{createdId,jdbcType=INTEGER}, - - - #{modifiedId,jdbcType=INTEGER}, - - - #{createdTime,jdbcType=TIMESTAMP}, - - - #{modifiedTime,jdbcType=TIMESTAMP}, - - - #{deviceName,jdbcType=VARCHAR}, - - - - - update sv_barcode_offline - - - barcode = #{barcode,jdbcType=VARCHAR}, - - - start_time = #{startTime,jdbcType=TIMESTAMP}, - - - end_time = #{endTime,jdbcType=TIMESTAMP}, - - - venue_id = #{venueId,jdbcType=INTEGER}, - - - created_id = #{createdId,jdbcType=INTEGER}, - - - modified_id = #{modifiedId,jdbcType=INTEGER}, - - - created_time = #{createdTime,jdbcType=TIMESTAMP}, - - - modified_time = #{modifiedTime,jdbcType=TIMESTAMP}, - - - device_name = #{deviceName,jdbcType=VARCHAR}, - - - where id = #{id,jdbcType=INTEGER} - - - update sv_barcode_offline - set barcode = #{barcode,jdbcType=VARCHAR}, - start_time = #{startTime,jdbcType=TIMESTAMP}, - end_time = #{endTime,jdbcType=TIMESTAMP}, - venue_id = #{venueId,jdbcType=INTEGER}, - created_id = #{createdId,jdbcType=INTEGER}, - modified_id = #{modifiedId,jdbcType=INTEGER}, - created_time = #{createdTime,jdbcType=TIMESTAMP}, - modified_time = #{modifiedTime,jdbcType=TIMESTAMP}, - device_name = #{deviceName,jdbcType=VARCHAR} - where id = #{id,jdbcType=INTEGER} - - + select + + from sv_barcode_order_time + where id = #{id,jdbcType=INTEGER} + + + delete from sv_barcode_order_time + where id = #{id,jdbcType=INTEGER} + + + insert into sv_barcode_order_time (id, member_id, venue_id, + created_time, modified_time, order_start, + order_end) + values (#{id,jdbcType=INTEGER}, #{memberId,jdbcType=INTEGER}, #{venueId,jdbcType=INTEGER}, + #{createdTime,jdbcType=TIMESTAMP}, #{modifiedTime,jdbcType=TIMESTAMP}, #{orderStart,jdbcType=TIMESTAMP}, + #{orderEnd,jdbcType=TIMESTAMP}) + + + insert into sv_barcode_order_time + + + id, + + + member_id, + + + venue_id, + + + created_time, + + + modified_time, + + + order_start, + + + order_end, + + + + + #{id,jdbcType=INTEGER}, + + + #{memberId,jdbcType=INTEGER}, + + + #{venueId,jdbcType=INTEGER}, + + + #{createdTime,jdbcType=TIMESTAMP}, + + + #{modifiedTime,jdbcType=TIMESTAMP}, + + + #{orderStart,jdbcType=TIMESTAMP}, + + + #{orderEnd,jdbcType=TIMESTAMP}, + + + + + update sv_barcode_order_time + + + member_id = #{memberId,jdbcType=INTEGER}, + + + venue_id = #{venueId,jdbcType=INTEGER}, + + + created_time = #{createdTime,jdbcType=TIMESTAMP}, + + + modified_time = #{modifiedTime,jdbcType=TIMESTAMP}, + + + order_start = #{orderStart,jdbcType=TIMESTAMP}, + + + order_end = #{orderEnd,jdbcType=TIMESTAMP}, + + + where id = #{id,jdbcType=INTEGER} + + + update sv_barcode_order_time + set member_id = #{memberId,jdbcType=INTEGER}, + venue_id = #{venueId,jdbcType=INTEGER}, + created_time = #{createdTime,jdbcType=TIMESTAMP}, + modified_time = #{modifiedTime,jdbcType=TIMESTAMP}, + order_start = #{orderStart,jdbcType=TIMESTAMP}, + order_end = #{orderEnd,jdbcType=TIMESTAMP} + where id = #{id,jdbcType=INTEGER} + + \ No newline at end of file diff --git a/service/src/main/resources/mybatis/mapper/sv/MemberEnterVenueLogMapper.xml b/service/src/main/resources/mybatis/mapper/sv/MemberEnterVenueLogMapper.xml index bd0051d..94e502c 100644 --- a/service/src/main/resources/mybatis/mapper/sv/MemberEnterVenueLogMapper.xml +++ b/service/src/main/resources/mybatis/mapper/sv/MemberEnterVenueLogMapper.xml @@ -337,7 +337,7 @@ - + update sv_venue set number = number + #{number} where id = #{venueId} - + - + update sv_venue set number = #{number} where id = #{venueId} - + INSERT INTO sv_venue_member (`member_id`, `venue_id`) VALUES (#{memberId},#{venueId}) diff --git a/service/src/main/resources/tools/generatorConfig.xml b/service/src/main/resources/tools/generatorConfig.xml index 3739ca5..580d78c 100644 --- a/service/src/main/resources/tools/generatorConfig.xml +++ b/service/src/main/resources/tools/generatorConfig.xml @@ -90,7 +90,7 @@ domainObjectName 给表对应的 model 起名字 注意:大小写敏感问题。 --> -