门禁开门计费逻辑调整
This commit is contained in:
@@ -28,7 +28,7 @@ import java.io.*;
|
|||||||
@RestController
|
@RestController
|
||||||
public class AdminNettyController extends BaseApiController {
|
public class AdminNettyController extends BaseApiController {
|
||||||
|
|
||||||
private final Logger logger = LoggerFactory.getLogger(AdminNettyController.class);
|
private final Logger logger = LoggerFactory.getLogger("NETTY-LOG-NAME");
|
||||||
@Resource
|
@Resource
|
||||||
DeviceService deviceService;
|
DeviceService deviceService;
|
||||||
@Resource
|
@Resource
|
||||||
@@ -139,7 +139,7 @@ public class AdminNettyController extends BaseApiController {
|
|||||||
String barcode = MakeCode.makeOfflineCode(barcodeSn);
|
String barcode = MakeCode.makeOfflineCode(barcodeSn);
|
||||||
deviceService.makeDeviceBarcode(device.getName(),device.getVenueId(),barcode);
|
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.setHeader("Content-disposition","attachment; filename=" + barcodeSn + ".docx");
|
||||||
response.setContentType("application/vnd.openxmlformats-officedocument.wordprocessingml.document");
|
response.setContentType("application/vnd.openxmlformats-officedocument.wordprocessingml.document");
|
||||||
response.setCharacterEncoding("UTF-8");
|
response.setCharacterEncoding("UTF-8");
|
||||||
@@ -163,8 +163,9 @@ public class AdminNettyController extends BaseApiController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String getDocument(String barcodeSn) throws IOException, InvalidFormatException {
|
private static String getDocument(String barcode, String barcodeSn) throws IOException, InvalidFormatException {
|
||||||
String newFilePath = "/Users/limqhz/home/test/document.docx";
|
String newFilePath = "/home/test/" + barcodeSn + ".docx";
|
||||||
|
// String newFilePath = "/Users/limqhz/home/test/" + barcodeSn + ".docx";
|
||||||
XWPFDocument document = new XWPFDocument();
|
XWPFDocument document = new XWPFDocument();
|
||||||
XWPFParagraph paragraph = document.createParagraph();
|
XWPFParagraph paragraph = document.createParagraph();
|
||||||
paragraph.setAlignment(ParagraphAlignment.CENTER);
|
paragraph.setAlignment(ParagraphAlignment.CENTER);
|
||||||
@@ -173,7 +174,10 @@ public class AdminNettyController extends BaseApiController {
|
|||||||
// 入场二维码
|
// 入场二维码
|
||||||
run.setText("订单号:" + barcodeSn);
|
run.setText("订单号:" + barcodeSn);
|
||||||
run.addBreak();
|
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;
|
int imgFormat = XWPFDocument.PICTURE_TYPE_JPEG;
|
||||||
run.addPicture(new FileInputStream(imgFile), imgFormat, "image description",
|
run.addPicture(new FileInputStream(imgFile), imgFormat, "image description",
|
||||||
Units.toEMU(200), Units.toEMU(200));
|
Units.toEMU(200), Units.toEMU(200));
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ import java.util.concurrent.Executors;
|
|||||||
@Component
|
@Component
|
||||||
public class BootService {
|
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 workerGroup;
|
||||||
private volatile EventLoopGroup bossGroup;
|
private volatile EventLoopGroup bossGroup;
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import java.util.Set;
|
|||||||
@ChannelHandler.Sharable
|
@ChannelHandler.Sharable
|
||||||
public class ServerHandler extends SimpleChannelInboundHandler<String> {
|
public class ServerHandler extends SimpleChannelInboundHandler<String> {
|
||||||
|
|
||||||
private static Logger logger = LoggerFactory.getLogger(ServerHandler.class);
|
private static Logger logger = LoggerFactory.getLogger("NETTY-LOG-NAME");
|
||||||
|
|
||||||
private MessageService messageService;
|
private MessageService messageService;
|
||||||
|
|
||||||
@@ -67,13 +67,14 @@ public class ServerHandler extends SimpleChannelInboundHandler<String> {
|
|||||||
if (offline.startsWith("venue-")) {
|
if (offline.startsWith("venue-")) {
|
||||||
// 这是线下开门的逻辑
|
// 这是线下开门的逻辑
|
||||||
messageService.offlineOpenDoor(message.getMessage());
|
messageService.offlineOpenDoor(message.getMessage());
|
||||||
}
|
} else {
|
||||||
VenueBarCode venueBarCode = MakeCode.decodeCode(message.getMessage());
|
VenueBarCode venueBarCode = MakeCode.decodeCode(message.getMessage());
|
||||||
if (EnterEnum.ENTER.getValue() == venueBarCode.getDirection()) {
|
if (EnterEnum.ENTER.getValue() == venueBarCode.getDirection()) {
|
||||||
messageService.enterVenue(message.getMessage());
|
messageService.enterVenue(message.getMessage());
|
||||||
} else {
|
} else {
|
||||||
messageService.outVenue(message.getMessage());
|
messageService.outVenue(message.getMessage());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
logger.info( "default");
|
logger.info( "default");
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ import java.util.concurrent.ConcurrentMap;
|
|||||||
@Service("messageService")
|
@Service("messageService")
|
||||||
public class ServerMessageHandlerAdapter implements 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();
|
String doorSn = venueBarCode.getDeviceName();
|
||||||
boolean lockStat = doorLockUtil.checkDoorLock(doorSn);
|
boolean lockStat = doorLockUtil.checkDoorLock(doorSn);
|
||||||
if (lockStat) {
|
if (lockStat) {
|
||||||
|
logger.error("有人正在操作,请稍后再出场!!!");
|
||||||
throw new ServiceException("有人正在操作,请稍后再试");
|
throw new ServiceException("有人正在操作,请稍后再试");
|
||||||
}
|
}
|
||||||
barcode = MakeCode.reWriteBarcode(barcode);
|
barcode = MakeCode.reWriteBarcode(barcode);
|
||||||
if (!checkBarcode(barcode)){
|
if (!checkBarcode(barcode)){
|
||||||
|
logger.error("二维码已经使用,无法出场");
|
||||||
throw new ServiceException("二维码已经使用");
|
throw new ServiceException("二维码已经使用");
|
||||||
}
|
}
|
||||||
Channel channel = getCurrentChannel(doorSn,venueBarCode.getVenueId());
|
Channel channel = getCurrentChannel(doorSn,venueBarCode.getVenueId());
|
||||||
@@ -158,10 +160,12 @@ public class ServerMessageHandlerAdapter implements MessageService {
|
|||||||
String doorSn = venueBarCode.getDeviceName();
|
String doorSn = venueBarCode.getDeviceName();
|
||||||
boolean lockStat = doorLockUtil.checkDoorLock(doorSn);
|
boolean lockStat = doorLockUtil.checkDoorLock(doorSn);
|
||||||
if (lockStat) {
|
if (lockStat) {
|
||||||
|
logger.error("有人正在操作,请稍后再试");
|
||||||
throw new ServiceException("有人正在操作,请稍后再试");
|
throw new ServiceException("有人正在操作,请稍后再试");
|
||||||
}
|
}
|
||||||
barcode = MakeCode.reWriteBarcode(barcode);
|
barcode = MakeCode.reWriteBarcode(barcode);
|
||||||
if (!checkBarcode(barcode)){
|
if (!checkBarcode(barcode)){
|
||||||
|
logger.error("二维码已经使用,无法入场");
|
||||||
throw new ServiceException("二维码已经使用");
|
throw new ServiceException("二维码已经使用");
|
||||||
}
|
}
|
||||||
Channel channel = getCurrentChannel(doorSn, venueBarCode.getVenueId());
|
Channel channel = getCurrentChannel(doorSn, venueBarCode.getVenueId());
|
||||||
@@ -189,6 +193,7 @@ public class ServerMessageHandlerAdapter implements MessageService {
|
|||||||
private boolean checkBarcode(String barcode) {
|
private boolean checkBarcode(String barcode) {
|
||||||
Barcode code = barcodeMapper.checkCodeStatus(barcode);
|
Barcode code = barcodeMapper.checkCodeStatus(barcode);
|
||||||
if (code == null) {
|
if (code == null) {
|
||||||
|
logger.error("二维码不存在或者已经被使用!!!");
|
||||||
throw new ServiceException("二维码不存在或者已经被使用");
|
throw new ServiceException("二维码不存在或者已经被使用");
|
||||||
}
|
}
|
||||||
if (BarCodeStatusEnum.INIT.getValue()==code.getStatus()){
|
if (BarCodeStatusEnum.INIT.getValue()==code.getStatus()){
|
||||||
@@ -233,11 +238,13 @@ public class ServerMessageHandlerAdapter implements MessageService {
|
|||||||
Date endTime = barcodeOffline.getEndTime();
|
Date endTime = barcodeOffline.getEndTime();
|
||||||
if (endTime.before(new Date())) {
|
if (endTime.before(new Date())) {
|
||||||
// 二维码已经失效了
|
// 二维码已经失效了
|
||||||
|
logger.error("二维码已经失效,无法继续使用");
|
||||||
throw new ServiceException("二维码已经失效,无法继续使用");
|
throw new ServiceException("二维码已经失效,无法继续使用");
|
||||||
}
|
}
|
||||||
boolean lockStat = doorLockUtil.checkDoorLock(doorSn);
|
boolean lockStat = doorLockUtil.checkDoorLock(doorSn);
|
||||||
if (lockStat) {
|
if (lockStat) {
|
||||||
throw new ServiceException("有人正在操作,请稍后再试");
|
logger.error("有人正在操作,请稍后再试!!!");
|
||||||
|
throw new ServiceException("有人正在操作,请稍后再试!!!");
|
||||||
}
|
}
|
||||||
BarcodeEnterLog lastByBarcode = barcodeEnterLogMapper.findLastByBarcode(barcode);
|
BarcodeEnterLog lastByBarcode = barcodeEnterLogMapper.findLastByBarcode(barcode);
|
||||||
Integer venueId = barcodeOffline.getVenueId();
|
Integer venueId = barcodeOffline.getVenueId();
|
||||||
@@ -248,6 +255,7 @@ public class ServerMessageHandlerAdapter implements MessageService {
|
|||||||
barcodeEnterLog.setBarcode(barcode);
|
barcodeEnterLog.setBarcode(barcode);
|
||||||
barcodeEnterLog.setType(EnterEnum.OUT.getValue());
|
barcodeEnterLog.setType(EnterEnum.OUT.getValue());
|
||||||
barcodeEnterLog.setVenueId(venueId);
|
barcodeEnterLog.setVenueId(venueId);
|
||||||
|
barcodeEnterLog.setPlatformId(1);
|
||||||
barcodeEnterLogMapper.insert(barcodeEnterLog);
|
barcodeEnterLogMapper.insert(barcodeEnterLog);
|
||||||
doorLockUtil.lockDoor(doorSn);
|
doorLockUtil.lockDoor(doorSn);
|
||||||
ServerMessageUtils.INSTANCE.sendMsg(channel,new VenueMessage(MessageType.OUT_DOOR,"OK"));
|
ServerMessageUtils.INSTANCE.sendMsg(channel,new VenueMessage(MessageType.OUT_DOOR,"OK"));
|
||||||
@@ -257,6 +265,7 @@ public class ServerMessageHandlerAdapter implements MessageService {
|
|||||||
barcodeEnterLog.setBarcode(barcode);
|
barcodeEnterLog.setBarcode(barcode);
|
||||||
barcodeEnterLog.setType(EnterEnum.ENTER.getValue());
|
barcodeEnterLog.setType(EnterEnum.ENTER.getValue());
|
||||||
barcodeEnterLog.setVenueId(venueId);
|
barcodeEnterLog.setVenueId(venueId);
|
||||||
|
barcodeEnterLog.setPlatformId(1);
|
||||||
barcodeEnterLogMapper.insert(barcodeEnterLog);
|
barcodeEnterLogMapper.insert(barcodeEnterLog);
|
||||||
doorLockUtil.lockDoor(doorSn);
|
doorLockUtil.lockDoor(doorSn);
|
||||||
ServerMessageUtils.INSTANCE.sendMsg(channel,new VenueMessage(MessageType.ENTER_DOOR,"OK"));
|
ServerMessageUtils.INSTANCE.sendMsg(channel,new VenueMessage(MessageType.ENTER_DOOR,"OK"));
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
spring:
|
spring:
|
||||||
datasource:
|
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
|
# username: yingdd
|
||||||
# password: Yingdd2015
|
# 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
|
username: root
|
||||||
password: 123456
|
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
|
# username: root
|
||||||
# password: hyty1234
|
# password: hyty1234
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
spring:
|
spring:
|
||||||
datasource:
|
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
|
username: root
|
||||||
password: hyty1234
|
password: hyty1234
|
||||||
redis:
|
redis:
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
spring:
|
spring:
|
||||||
datasource:
|
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
|
username: yingdd
|
||||||
password: Yingdd2015
|
password: Yingdd2015
|
||||||
redis:
|
redis:
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ logging:
|
|||||||
|
|
||||||
#netty服务器配置
|
#netty服务器配置
|
||||||
netty:
|
netty:
|
||||||
port: 56792
|
port: 56791
|
||||||
boss:
|
boss:
|
||||||
thread:
|
thread:
|
||||||
count: 1
|
count: 1
|
||||||
|
|||||||
@@ -52,14 +52,13 @@
|
|||||||
</encoder>
|
</encoder>
|
||||||
</appender>
|
</appender>
|
||||||
|
|
||||||
<logger name="com.sv.netty" level="debug" additivity="false">
|
<logger name="NETTY-LOG-NAME" level="debug" additivity="false">
|
||||||
<appender-ref ref="NETTY-LOG"/>
|
<appender-ref ref="NETTY-LOG"/>
|
||||||
</logger>
|
</logger>
|
||||||
|
|
||||||
<!-- root -->
|
<!-- root -->
|
||||||
<root level="info">
|
<root level="info">
|
||||||
<appender-ref ref="STDOUT" />
|
<appender-ref ref="STDOUT" />
|
||||||
<appender-ref ref="NETTY-LOG" />
|
|
||||||
<appender-ref ref="COMMON-DEFAULT" />
|
<appender-ref ref="COMMON-DEFAULT" />
|
||||||
<appender-ref ref="COMMON-ERROR" />
|
<appender-ref ref="COMMON-ERROR" />
|
||||||
</root>
|
</root>
|
||||||
|
|||||||
42
entity/src/main/java/com/enums/PayStyleEnum.java
Normal file
42
entity/src/main/java/com/enums/PayStyleEnum.java
Normal file
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -168,6 +168,16 @@ public class VenueDTO implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private Integer copyControl;
|
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) {
|
public void setEnterFlag(Integer enterFlag) {
|
||||||
this.enterFlag = 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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
89
entity/src/main/java/com/sv/entity/BarcodeOrderTime.java
Normal file
89
entity/src/main/java/com/sv/entity/BarcodeOrderTime.java
Normal file
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -194,7 +194,15 @@ public class Venue implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private Integer limitNoWeek;
|
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) {
|
public void setCopyControl(Integer copyControl) {
|
||||||
this.copyControl = 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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ public class ListenKeyFrame extends Thread{
|
|||||||
Frame frame;
|
Frame frame;
|
||||||
|
|
||||||
public void newFrame (String title) {
|
public void newFrame (String title) {
|
||||||
frame = new Frame("智慧云馆门禁" + title);
|
frame = new Frame("智慧云馆门禁new" + title);
|
||||||
frame.setBounds(300,100,600,500);
|
frame.setBounds(300,100,600,500);
|
||||||
frame.setLayout(new FlowLayout(FlowLayout.CENTER,20,50));//设计布局
|
frame.setLayout(new FlowLayout(FlowLayout.CENTER,20,50));//设计布局
|
||||||
JLabel label = new JLabel("请保持该界面被选中,否则将无法监听二维码扫描!");
|
JLabel label = new JLabel("请保持该界面被选中,否则将无法监听二维码扫描!");
|
||||||
|
|||||||
@@ -48,11 +48,12 @@ public class ClientService {
|
|||||||
Thread.sleep(3000);
|
Thread.sleep(3000);
|
||||||
listenKeyFrame1.close();
|
listenKeyFrame1.close();
|
||||||
ListenKeyFrame listenKeyFrame2 = new ListenKeyFrame();
|
ListenKeyFrame listenKeyFrame2 = new ListenKeyFrame();
|
||||||
listenKeyFrame2.newFrame("-加载中53%");
|
listenKeyFrame2.newFrame("-加载中94%");
|
||||||
Thread.sleep(3000);
|
Thread.sleep(3000);
|
||||||
listenKeyFrame2.close();
|
listenKeyFrame2.close();
|
||||||
ListenKeyFrame listenKeyFrame3 = new ListenKeyFrame();
|
ListenKeyFrame listenKeyFrame3 = new ListenKeyFrame();
|
||||||
listenKeyFrame3.newFrame("");
|
listenKeyFrame3.newFrame("aaa");
|
||||||
|
listenKeyFrame3.focus();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,18 +8,11 @@ import com.ydd.framework.core.exception.ServiceException;
|
|||||||
import com.ydd.oms.controller.OmsController;
|
import com.ydd.oms.controller.OmsController;
|
||||||
import com.sv.entity.Device;
|
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.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import java.io.*;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Controller - 门禁设备
|
* Controller - 门禁设备
|
||||||
*
|
*
|
||||||
@@ -120,55 +113,4 @@ public class DeviceController extends OmsController {
|
|||||||
return ResponseDTO.ok();
|
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Controller - 场馆对应价格表
|
* Controller - 场馆对应价格表
|
||||||
@@ -67,8 +68,9 @@ public class VenuePriceController extends OmsController {
|
|||||||
*/
|
*/
|
||||||
@RequestMapping(value = "/venue/findPrice", method = RequestMethod.GET)
|
@RequestMapping(value = "/venue/findPrice", method = RequestMethod.GET)
|
||||||
public ResponseDTO findPrice(@RequestParam("venueId") Integer venueId) {
|
public ResponseDTO findPrice(@RequestParam("venueId") Integer venueId) {
|
||||||
venuePriceService.findPrice(venueId);
|
List<VenuePrice> price = venuePriceService.findPrice(venueId);
|
||||||
return ResponseDTO.ok().addAttribute("price",venuePriceService.findPrice(venueId));
|
System.out.println(price);
|
||||||
|
return ResponseDTO.ok().addAttribute("price", price);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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<EncodeHintType, Object> hints = new Hashtable<EncodeHintType, Object>();
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
spring:
|
spring:
|
||||||
datasource:
|
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
|
# username: yingdd
|
||||||
# password: Yingdd2015
|
# 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
|
username: root
|
||||||
password: 123456
|
password: 123456
|
||||||
redis:
|
redis:
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
spring:
|
spring:
|
||||||
datasource:
|
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
|
username: root
|
||||||
password: hyty1234
|
password: hyty1234
|
||||||
redis:
|
redis:
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
spring:
|
spring:
|
||||||
datasource:
|
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
|
# username: yingdd
|
||||||
# password: Yingdd2015
|
# 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
|
username: root
|
||||||
password: 123456
|
password: 123456
|
||||||
redis:
|
redis:
|
||||||
|
|||||||
5
other/sql/202312.sql
Normal file
5
other/sql/202312.sql
Normal file
@@ -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`;
|
||||||
@@ -1,11 +1,12 @@
|
|||||||
package com.sv.mapper;
|
package com.sv.mapper;
|
||||||
|
|
||||||
|
import com.sv.annotation.NoPlatform;
|
||||||
import com.sv.entity.BarcodeEnterLog;
|
import com.sv.entity.BarcodeEnterLog;
|
||||||
import com.sv.entity.BarcodeOffline;
|
|
||||||
|
|
||||||
public interface BarcodeEnterLogMapper {
|
public interface BarcodeEnterLogMapper {
|
||||||
int deleteByPrimaryKey(Integer id);
|
int deleteByPrimaryKey(Integer id);
|
||||||
|
|
||||||
|
@NoPlatform
|
||||||
int insert(BarcodeEnterLog record);
|
int insert(BarcodeEnterLog record);
|
||||||
|
|
||||||
int insertSelective(BarcodeEnterLog record);
|
int insertSelective(BarcodeEnterLog record);
|
||||||
@@ -16,6 +17,7 @@ public interface BarcodeEnterLogMapper {
|
|||||||
|
|
||||||
int updateByPrimaryKey(BarcodeEnterLog record);
|
int updateByPrimaryKey(BarcodeEnterLog record);
|
||||||
|
|
||||||
|
@NoPlatform
|
||||||
BarcodeEnterLog findLastByBarcode(String barcode);
|
BarcodeEnterLog findLastByBarcode(String barcode);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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);
|
||||||
|
}
|
||||||
@@ -30,7 +30,7 @@ public class MemberEnterVenueLogService extends BaseServiceImpl {
|
|||||||
private MemberEnterVenueLogMapper memberEnterVenueLogMapper;
|
private MemberEnterVenueLogMapper memberEnterVenueLogMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取用户最后的进场记录
|
* 获取用户最后的出入场记录
|
||||||
*
|
*
|
||||||
* @param memberId
|
* @param memberId
|
||||||
* @return
|
* @return
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import com.sv.dto.api.MemberCardVenuesDTO;
|
|||||||
import com.sv.dto.api.VenueDTO;
|
import com.sv.dto.api.VenueDTO;
|
||||||
import com.sv.entity.*;
|
import com.sv.entity.*;
|
||||||
import com.sv.exception.api.ExceptionCodeTemplate;
|
import com.sv.exception.api.ExceptionCodeTemplate;
|
||||||
|
import com.sv.mapper.BarcodeMapper;
|
||||||
import com.sv.mapper.VenueMapper;
|
import com.sv.mapper.VenueMapper;
|
||||||
import com.sv.service.api.util.DateUtilCard;
|
import com.sv.service.api.util.DateUtilCard;
|
||||||
import com.sv.service.api.util.GeoHashUtils;
|
import com.sv.service.api.util.GeoHashUtils;
|
||||||
@@ -57,6 +58,8 @@ public class VenueService extends BaseServiceImpl {
|
|||||||
private MemberMoneyLogService memberMoneyLogService;
|
private MemberMoneyLogService memberMoneyLogService;
|
||||||
@Resource
|
@Resource
|
||||||
private VenuePriceService venuePriceService;
|
private VenuePriceService venuePriceService;
|
||||||
|
@Resource
|
||||||
|
BarcodeMapper barcodeMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新场馆
|
* 更新场馆
|
||||||
@@ -220,18 +223,35 @@ public class VenueService extends BaseServiceImpl {
|
|||||||
}
|
}
|
||||||
//参数校验
|
//参数校验
|
||||||
ValidationUtils.assertNotNull(venueId);
|
ValidationUtils.assertNotNull(venueId);
|
||||||
|
synchronized (("scancode-in" + memberId).intern()) {
|
||||||
// 1.判断用户有没有该馆的会员卡(有效期内,如果有免费卡和别的卡,优先使用别的卡),有不判断余额
|
// 1.判断用户有没有该馆的会员卡(有效期内,如果有免费卡和别的卡,优先使用别的卡),有不判断余额
|
||||||
List<MemberCard> memberCards = memberCardService.findByMemberId(venueId, memberId);
|
List<MemberCard> memberCards = memberCardService.findByMemberId(venueId, memberId);
|
||||||
// 2. 查询该场馆需要的费用,并比较用户余额是否足够
|
// 2. 查询该场馆需要的费用,并比较用户余额是否足够
|
||||||
// 查询当前时间内,场馆对应的价格
|
// 查询当前时间内,场馆对应的价格
|
||||||
String time = DateUtilCard.nowTime().toString();
|
String time = DateUtilCard.nowTime().toString();
|
||||||
|
Venue venue = venueMapper.findById(venueId);
|
||||||
VenuePrice venuePrice = venuePriceService.findPrice(venueId, time);
|
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) {
|
if (venuePrice == null) {
|
||||||
throw new ServiceException(ExceptionCodeTemplate.VENUE_ERROR);
|
throw new ServiceException(ExceptionCodeTemplate.VENUE_ERROR);
|
||||||
}
|
}
|
||||||
if (memberCards.size() == 0) {
|
if (memberCards.size() == 0) {
|
||||||
Member member = memberService.findById(memberId);
|
Member member = memberService.findById(memberId);
|
||||||
if (member.getMoney().compareTo(venuePrice.getPrice()) == -1) {
|
if (member.getMoney().compareTo(price) == -1) {
|
||||||
flag = 2;
|
flag = 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -242,6 +262,7 @@ public class VenueService extends BaseServiceImpl {
|
|||||||
// flag = 1;
|
// flag = 1;
|
||||||
// return flag;
|
// return flag;
|
||||||
// }
|
// }
|
||||||
|
}
|
||||||
return barCodeResult;
|
return barCodeResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -261,7 +282,7 @@ public class VenueService extends BaseServiceImpl {
|
|||||||
//参数校验
|
//参数校验
|
||||||
ValidationUtils.assertNotNull(venueId);
|
ValidationUtils.assertNotNull(venueId);
|
||||||
Venue venue = venueMapper.findById(venueId);
|
Venue venue = venueMapper.findById(venueId);
|
||||||
synchronized (("scancode" + memberId).intern()) {
|
synchronized (("scancode-out" + memberId).intern()) {
|
||||||
// 查询当前时间内,场馆对应的价格(健身房没有价格)
|
// 查询当前时间内,场馆对应的价格(健身房没有价格)
|
||||||
Member member = memberService.findByMember(memberId);
|
Member member = memberService.findByMember(memberId);
|
||||||
memberService.verify(member);
|
memberService.verify(member);
|
||||||
@@ -310,18 +331,37 @@ public class VenueService extends BaseServiceImpl {
|
|||||||
result.setMsg("未查询到会员卡,请先购买会员卡");
|
result.setMsg("未查询到会员卡,请先购买会员卡");
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
|
/**
|
||||||
|
* 篮球出场核心逻辑
|
||||||
|
*/
|
||||||
//判断余额是否够
|
//判断余额是否够
|
||||||
String time = DateUtilCard.nowTime().toString();
|
// 1、找到入场时间
|
||||||
VenuePrice venuePrice = venuePriceService.findPrice(venueId, time);
|
MemberEnterVenueLog memberLastLog = memberEnterVenueLogService.findMemberLastLog(memberId, venueId);
|
||||||
if (memberService.isMoneyEnough(member.getId(), venuePrice.getPrice())) {
|
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() + "使用余额核销订单");
|
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());
|
venue.getId(), venue.getType());
|
||||||
} else {
|
} else {
|
||||||
//余额不足
|
//余额不足
|
||||||
logger.error("用户" + member.getNickname() + "余额不足核销失败");
|
logger.error("用户" + member.getNickname() + "余额不足核销失败");
|
||||||
result.setFlg(1);
|
result.setFlg(1);
|
||||||
result.setMsg("余额不足,请先充值");
|
result.setMsg("此次订单金额为:" + price + "元,余额不足,请先充值");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.sv.service.api.util;
|
package com.sv.service.api.util;
|
||||||
|
|
||||||
import com.enums.VipTypeEnum;
|
import com.enums.VipTypeEnum;
|
||||||
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
@@ -12,6 +13,7 @@ import java.util.GregorianCalendar;
|
|||||||
public class DateUtilCard {
|
public class DateUtilCard {
|
||||||
|
|
||||||
private final static SimpleDateFormat sdf = new SimpleDateFormat( "yyyy-MM-dd");
|
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){
|
public static Date getYear(Date date){
|
||||||
Calendar calendar = Calendar.getInstance();
|
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){
|
public static String getStrFromDate(Date date){
|
||||||
return sdf.format(date);
|
return sdf.format(date);
|
||||||
}
|
}
|
||||||
@@ -163,4 +169,24 @@ public class DateUtilCard {
|
|||||||
return calendar.getTime(); //这个时间就是日期往后推一天的结果
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -221,6 +221,7 @@ public class DeviceService extends BaseServiceImpl {
|
|||||||
return deviceMapper.findByDevice(venueId);
|
return deviceMapper.findByDevice(venueId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
public void makeDeviceBarcode(String deviceName, Integer venueId, String barcode) {
|
public void makeDeviceBarcode(String deviceName, Integer venueId, String barcode) {
|
||||||
BarcodeOffline barcodeOffline = new BarcodeOffline();
|
BarcodeOffline barcodeOffline = new BarcodeOffline();
|
||||||
Date startTime = new Date();
|
Date startTime = new Date();
|
||||||
|
|||||||
@@ -24,7 +24,8 @@ public class VenueBarcodeUtil {
|
|||||||
|
|
||||||
public static String generateBarcode(String barcodeValue,String fileName) {
|
public static String generateBarcode(String barcodeValue,String fileName) {
|
||||||
try {
|
try {
|
||||||
String geneFilePath = "/Users/limqhz/home/test/" + fileName;
|
String geneFilePath = "/home/test/" + fileName;
|
||||||
|
// String geneFilePath = "/Users/limqhz/home/test/" + fileName;
|
||||||
makeBarcode(geneFilePath,barcodeValue);
|
makeBarcode(geneFilePath,barcodeValue);
|
||||||
return geneFilePath;
|
return geneFilePath;
|
||||||
}catch (WriterException e) {
|
}catch (WriterException e) {
|
||||||
|
|||||||
@@ -152,158 +152,6 @@
|
|||||||
device_name = #{deviceName,jdbcType=VARCHAR}
|
device_name = #{deviceName,jdbcType=VARCHAR}
|
||||||
where id = #{id,jdbcType=INTEGER}
|
where id = #{id,jdbcType=INTEGER}
|
||||||
</update>
|
</update>
|
||||||
<resultMap id="BaseResultMap" type="com.sv.entity.BarcodeOffline">
|
|
||||||
<constructor>
|
|
||||||
<idArg column="id" javaType="java.lang.Integer" jdbcType="INTEGER" />
|
|
||||||
<arg column="barcode" javaType="java.lang.String" jdbcType="VARCHAR" />
|
|
||||||
<arg column="start_time" javaType="java.util.Date" jdbcType="TIMESTAMP" />
|
|
||||||
<arg column="end_time" javaType="java.util.Date" jdbcType="TIMESTAMP" />
|
|
||||||
<arg column="venue_id" javaType="java.lang.Integer" jdbcType="INTEGER" />
|
|
||||||
<arg column="created_id" javaType="java.lang.Integer" jdbcType="INTEGER" />
|
|
||||||
<arg column="modified_id" javaType="java.lang.Integer" jdbcType="INTEGER" />
|
|
||||||
<arg column="created_time" javaType="java.util.Date" jdbcType="TIMESTAMP" />
|
|
||||||
<arg column="modified_time" javaType="java.util.Date" jdbcType="TIMESTAMP" />
|
|
||||||
<arg column="device_name" javaType="java.lang.String" jdbcType="VARCHAR" />
|
|
||||||
</constructor>
|
|
||||||
</resultMap>
|
|
||||||
<sql id="Base_Column_List">
|
|
||||||
id, barcode, start_time, end_time, venue_id, created_id, modified_id, created_time,
|
|
||||||
modified_time, device_name
|
|
||||||
</sql>
|
|
||||||
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
|
||||||
select
|
|
||||||
<include refid="Base_Column_List" />
|
|
||||||
from sv_barcode_offline
|
|
||||||
where id = #{id,jdbcType=INTEGER}
|
|
||||||
</select>
|
|
||||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
|
|
||||||
delete from sv_barcode_offline
|
|
||||||
where id = #{id,jdbcType=INTEGER}
|
|
||||||
</delete>
|
|
||||||
<insert id="insert" parameterType="com.sv.entity.BarcodeOffline">
|
|
||||||
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>
|
|
||||||
<insert id="insertSelective" parameterType="com.sv.entity.BarcodeOffline">
|
|
||||||
insert into sv_barcode_offline
|
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
||||||
<if test="id != null">
|
|
||||||
id,
|
|
||||||
</if>
|
|
||||||
<if test="barcode != null">
|
|
||||||
barcode,
|
|
||||||
</if>
|
|
||||||
<if test="startTime != null">
|
|
||||||
start_time,
|
|
||||||
</if>
|
|
||||||
<if test="endTime != null">
|
|
||||||
end_time,
|
|
||||||
</if>
|
|
||||||
<if test="venueId != null">
|
|
||||||
venue_id,
|
|
||||||
</if>
|
|
||||||
<if test="createdId != null">
|
|
||||||
created_id,
|
|
||||||
</if>
|
|
||||||
<if test="modifiedId != null">
|
|
||||||
modified_id,
|
|
||||||
</if>
|
|
||||||
<if test="createdTime != null">
|
|
||||||
created_time,
|
|
||||||
</if>
|
|
||||||
<if test="modifiedTime != null">
|
|
||||||
modified_time,
|
|
||||||
</if>
|
|
||||||
<if test="deviceName != null">
|
|
||||||
device_name,
|
|
||||||
</if>
|
|
||||||
</trim>
|
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
||||||
<if test="id != null">
|
|
||||||
#{id,jdbcType=INTEGER},
|
|
||||||
</if>
|
|
||||||
<if test="barcode != null">
|
|
||||||
#{barcode,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="startTime != null">
|
|
||||||
#{startTime,jdbcType=TIMESTAMP},
|
|
||||||
</if>
|
|
||||||
<if test="endTime != null">
|
|
||||||
#{endTime,jdbcType=TIMESTAMP},
|
|
||||||
</if>
|
|
||||||
<if test="venueId != null">
|
|
||||||
#{venueId,jdbcType=INTEGER},
|
|
||||||
</if>
|
|
||||||
<if test="createdId != null">
|
|
||||||
#{createdId,jdbcType=INTEGER},
|
|
||||||
</if>
|
|
||||||
<if test="modifiedId != null">
|
|
||||||
#{modifiedId,jdbcType=INTEGER},
|
|
||||||
</if>
|
|
||||||
<if test="createdTime != null">
|
|
||||||
#{createdTime,jdbcType=TIMESTAMP},
|
|
||||||
</if>
|
|
||||||
<if test="modifiedTime != null">
|
|
||||||
#{modifiedTime,jdbcType=TIMESTAMP},
|
|
||||||
</if>
|
|
||||||
<if test="deviceName != null">
|
|
||||||
#{deviceName,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
</trim>
|
|
||||||
</insert>
|
|
||||||
<update id="updateByPrimaryKeySelective" parameterType="com.sv.entity.BarcodeOffline">
|
|
||||||
update sv_barcode_offline
|
|
||||||
<set>
|
|
||||||
<if test="barcode != null">
|
|
||||||
barcode = #{barcode,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="startTime != null">
|
|
||||||
start_time = #{startTime,jdbcType=TIMESTAMP},
|
|
||||||
</if>
|
|
||||||
<if test="endTime != null">
|
|
||||||
end_time = #{endTime,jdbcType=TIMESTAMP},
|
|
||||||
</if>
|
|
||||||
<if test="venueId != null">
|
|
||||||
venue_id = #{venueId,jdbcType=INTEGER},
|
|
||||||
</if>
|
|
||||||
<if test="createdId != null">
|
|
||||||
created_id = #{createdId,jdbcType=INTEGER},
|
|
||||||
</if>
|
|
||||||
<if test="modifiedId != null">
|
|
||||||
modified_id = #{modifiedId,jdbcType=INTEGER},
|
|
||||||
</if>
|
|
||||||
<if test="createdTime != null">
|
|
||||||
created_time = #{createdTime,jdbcType=TIMESTAMP},
|
|
||||||
</if>
|
|
||||||
<if test="modifiedTime != null">
|
|
||||||
modified_time = #{modifiedTime,jdbcType=TIMESTAMP},
|
|
||||||
</if>
|
|
||||||
<if test="deviceName != null">
|
|
||||||
device_name = #{deviceName,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
</set>
|
|
||||||
where id = #{id,jdbcType=INTEGER}
|
|
||||||
</update>
|
|
||||||
<update id="updateByPrimaryKey" parameterType="com.sv.entity.BarcodeOffline">
|
|
||||||
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}
|
|
||||||
</update>
|
|
||||||
|
|
||||||
<select id="selectByBarcode" resultMap="BaseResultMap">
|
<select id="selectByBarcode" resultMap="BaseResultMap">
|
||||||
select
|
select
|
||||||
<include refid="Base_Column_List" />
|
<include refid="Base_Column_List" />
|
||||||
|
|||||||
@@ -0,0 +1,119 @@
|
|||||||
|
<?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.sv.mapper.BarcodeOrderTimeMapper" >
|
||||||
|
<resultMap id="BaseResultMap" type="com.sv.entity.BarcodeOrderTime" >
|
||||||
|
<constructor >
|
||||||
|
<idArg column="id" jdbcType="INTEGER" javaType="java.lang.Integer" />
|
||||||
|
<arg column="member_id" jdbcType="INTEGER" javaType="java.lang.Integer" />
|
||||||
|
<arg column="venue_id" jdbcType="INTEGER" javaType="java.lang.Integer" />
|
||||||
|
<arg column="created_time" jdbcType="TIMESTAMP" javaType="java.util.Date" />
|
||||||
|
<arg column="modified_time" jdbcType="TIMESTAMP" javaType="java.util.Date" />
|
||||||
|
<arg column="order_start" jdbcType="TIMESTAMP" javaType="java.util.Date" />
|
||||||
|
<arg column="order_end" jdbcType="TIMESTAMP" javaType="java.util.Date" />
|
||||||
|
</constructor>
|
||||||
|
</resultMap>
|
||||||
|
<sql id="Base_Column_List" >
|
||||||
|
id, member_id, venue_id, created_time, modified_time, order_start, order_end
|
||||||
|
</sql>
|
||||||
|
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
|
||||||
|
select
|
||||||
|
<include refid="Base_Column_List" />
|
||||||
|
from sv_barcode_order_time
|
||||||
|
where id = #{id,jdbcType=INTEGER}
|
||||||
|
</select>
|
||||||
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
|
||||||
|
delete from sv_barcode_order_time
|
||||||
|
where id = #{id,jdbcType=INTEGER}
|
||||||
|
</delete>
|
||||||
|
<insert id="insert" parameterType="com.sv.entity.BarcodeOrderTime" >
|
||||||
|
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>
|
||||||
|
<insert id="insertSelective" parameterType="com.sv.entity.BarcodeOrderTime" >
|
||||||
|
insert into sv_barcode_order_time
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides="," >
|
||||||
|
<if test="id != null" >
|
||||||
|
id,
|
||||||
|
</if>
|
||||||
|
<if test="memberId != null" >
|
||||||
|
member_id,
|
||||||
|
</if>
|
||||||
|
<if test="venueId != null" >
|
||||||
|
venue_id,
|
||||||
|
</if>
|
||||||
|
<if test="createdTime != null" >
|
||||||
|
created_time,
|
||||||
|
</if>
|
||||||
|
<if test="modifiedTime != null" >
|
||||||
|
modified_time,
|
||||||
|
</if>
|
||||||
|
<if test="orderStart != null" >
|
||||||
|
order_start,
|
||||||
|
</if>
|
||||||
|
<if test="orderEnd != null" >
|
||||||
|
order_end,
|
||||||
|
</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides="," >
|
||||||
|
<if test="id != null" >
|
||||||
|
#{id,jdbcType=INTEGER},
|
||||||
|
</if>
|
||||||
|
<if test="memberId != null" >
|
||||||
|
#{memberId,jdbcType=INTEGER},
|
||||||
|
</if>
|
||||||
|
<if test="venueId != null" >
|
||||||
|
#{venueId,jdbcType=INTEGER},
|
||||||
|
</if>
|
||||||
|
<if test="createdTime != null" >
|
||||||
|
#{createdTime,jdbcType=TIMESTAMP},
|
||||||
|
</if>
|
||||||
|
<if test="modifiedTime != null" >
|
||||||
|
#{modifiedTime,jdbcType=TIMESTAMP},
|
||||||
|
</if>
|
||||||
|
<if test="orderStart != null" >
|
||||||
|
#{orderStart,jdbcType=TIMESTAMP},
|
||||||
|
</if>
|
||||||
|
<if test="orderEnd != null" >
|
||||||
|
#{orderEnd,jdbcType=TIMESTAMP},
|
||||||
|
</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
<update id="updateByPrimaryKeySelective" parameterType="com.sv.entity.BarcodeOrderTime" >
|
||||||
|
update sv_barcode_order_time
|
||||||
|
<set >
|
||||||
|
<if test="memberId != null" >
|
||||||
|
member_id = #{memberId,jdbcType=INTEGER},
|
||||||
|
</if>
|
||||||
|
<if test="venueId != null" >
|
||||||
|
venue_id = #{venueId,jdbcType=INTEGER},
|
||||||
|
</if>
|
||||||
|
<if test="createdTime != null" >
|
||||||
|
created_time = #{createdTime,jdbcType=TIMESTAMP},
|
||||||
|
</if>
|
||||||
|
<if test="modifiedTime != null" >
|
||||||
|
modified_time = #{modifiedTime,jdbcType=TIMESTAMP},
|
||||||
|
</if>
|
||||||
|
<if test="orderStart != null" >
|
||||||
|
order_start = #{orderStart,jdbcType=TIMESTAMP},
|
||||||
|
</if>
|
||||||
|
<if test="orderEnd != null" >
|
||||||
|
order_end = #{orderEnd,jdbcType=TIMESTAMP},
|
||||||
|
</if>
|
||||||
|
</set>
|
||||||
|
where id = #{id,jdbcType=INTEGER}
|
||||||
|
</update>
|
||||||
|
<update id="updateByPrimaryKey" parameterType="com.sv.entity.BarcodeOrderTime" >
|
||||||
|
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}
|
||||||
|
</update>
|
||||||
|
</mapper>
|
||||||
@@ -337,7 +337,7 @@
|
|||||||
<select id="findLastNoTypeByMember" resultMap="MemberEnterVeneuLogMap">
|
<select id="findLastNoTypeByMember" resultMap="MemberEnterVeneuLogMap">
|
||||||
SELECT id,member_id,venue_id,created_time,member_card_id,type
|
SELECT id,member_id,venue_id,created_time,member_card_id,type
|
||||||
FROM sv_member_enter_veneu_log
|
FROM sv_member_enter_veneu_log
|
||||||
WHERE member_id = #{memberId} and venue_id = #{venueId} and deleted = 0 order by created_time desc LIMIT 1
|
WHERE member_id = #{memberId} and venue_id = #{venueId} and deleted = 0 and type = 0 order by created_time desc LIMIT 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="findMemberEnterLogByDate" resultMap="MemberEnterVeneuLogMap">
|
<select id="findMemberEnterLogByDate" resultMap="MemberEnterVeneuLogMap">
|
||||||
|
|||||||
@@ -36,6 +36,8 @@
|
|||||||
<result column="copy_time" property="copyTime"/>
|
<result column="copy_time" property="copyTime"/>
|
||||||
<result column="copy_target" property="copyTarget"/>
|
<result column="copy_target" property="copyTarget"/>
|
||||||
<result column="copy_control" property="copyControl"/>
|
<result column="copy_control" property="copyControl"/>
|
||||||
|
<result column="pay_style" property="payStyle"/>
|
||||||
|
<result column="time_pay_hour" property="timePayHour"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<resultMap id="VenueDtoMap" type="com.sv.dto.api.VenueDTO">
|
<resultMap id="VenueDtoMap" type="com.sv.dto.api.VenueDTO">
|
||||||
@@ -67,6 +69,8 @@
|
|||||||
<result column="copy_time" property="copyTime"/>
|
<result column="copy_time" property="copyTime"/>
|
||||||
<result column="copy_target" property="copyTarget"/>
|
<result column="copy_target" property="copyTarget"/>
|
||||||
<result column="copy_control" property="copyControl"/>
|
<result column="copy_control" property="copyControl"/>
|
||||||
|
<result column="pay_style" property="payStyle"/>
|
||||||
|
<result column="time_pay_hour" property="timePayHour"/>
|
||||||
<result column="code_url" property="codeUrl"></result>
|
<result column="code_url" property="codeUrl"></result>
|
||||||
<association property="cards" select="com.sv.mapper.VenueCardMapper.findByVenueId"
|
<association property="cards" select="com.sv.mapper.VenueCardMapper.findByVenueId"
|
||||||
column="{venueId = id,venueType=type}"></association>
|
column="{venueId = id,venueType=type}"></association>
|
||||||
@@ -130,7 +134,9 @@
|
|||||||
copy_week,
|
copy_week,
|
||||||
copy_time,
|
copy_time,
|
||||||
copy_target,
|
copy_target,
|
||||||
copy_control
|
copy_control,
|
||||||
|
pay_style,
|
||||||
|
time_pay_hour
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<!-- 字段值 -->
|
<!-- 字段值 -->
|
||||||
@@ -162,6 +168,8 @@
|
|||||||
#{copy_time, jdbcType=TIMESTAMP},
|
#{copy_time, jdbcType=TIMESTAMP},
|
||||||
#{copy_target, jdbcType=TINYINT},
|
#{copy_target, jdbcType=TINYINT},
|
||||||
#{copy_control, jdbcType=TINYINT}
|
#{copy_control, jdbcType=TINYINT}
|
||||||
|
#{pay_style, jdbcType=TINYINT}
|
||||||
|
#{time_pay_hour, jdbcType=TINYINT}
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<!-- 查询全部记录 -->
|
<!-- 查询全部记录 -->
|
||||||
@@ -308,6 +316,12 @@
|
|||||||
<if test="copyControl != null">
|
<if test="copyControl != null">
|
||||||
copy_control,
|
copy_control,
|
||||||
</if>
|
</if>
|
||||||
|
<if test="payStyle != null">
|
||||||
|
pay_style,
|
||||||
|
</if>
|
||||||
|
<if test="timePayHour != null">
|
||||||
|
time_pay_hour,
|
||||||
|
</if>
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="id != null">
|
<if test="id != null">
|
||||||
@@ -406,6 +420,12 @@
|
|||||||
<if test="copyControl != null">
|
<if test="copyControl != null">
|
||||||
#{copyControl},
|
#{copyControl},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="payStyle != null">
|
||||||
|
#{payStyle},
|
||||||
|
</if>
|
||||||
|
<if test="timePayHour != null">
|
||||||
|
#{timePayHour},
|
||||||
|
</if>
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
@@ -535,6 +555,12 @@
|
|||||||
<if test="copyControl != null">
|
<if test="copyControl != null">
|
||||||
copy_control = #{copyControl},
|
copy_control = #{copyControl},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="payStyle != null">
|
||||||
|
pay_style = #{payStyle},
|
||||||
|
</if>
|
||||||
|
<if test="timePayHour != null">
|
||||||
|
time_pay_hour = #{timePayHour},
|
||||||
|
</if>
|
||||||
</set>
|
</set>
|
||||||
WHERE id = #{id}
|
WHERE id = #{id}
|
||||||
</update>
|
</update>
|
||||||
@@ -579,7 +605,9 @@
|
|||||||
copy_time,
|
copy_time,
|
||||||
copy_target,
|
copy_target,
|
||||||
copy_control,
|
copy_control,
|
||||||
status
|
status,
|
||||||
|
pay_style,
|
||||||
|
time_pay_hour
|
||||||
FROM
|
FROM
|
||||||
sv_venue
|
sv_venue
|
||||||
WHERE
|
WHERE
|
||||||
@@ -634,13 +662,13 @@
|
|||||||
select count(0) from sv_venue_member where member_id = #{memberId} and venue_id = #{venueId}
|
select count(0) from sv_venue_member where member_id = #{memberId} and venue_id = #{venueId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<insert id="addNumber">
|
<update id="addNumber">
|
||||||
update sv_venue set number = number + #{number} where id = #{venueId}
|
update sv_venue set number = number + #{number} where id = #{venueId}
|
||||||
</insert>
|
</update>
|
||||||
|
|
||||||
<insert id="updateNumber">
|
<update id="updateNumber">
|
||||||
update sv_venue set number = #{number} where id = #{venueId}
|
update sv_venue set number = #{number} where id = #{venueId}
|
||||||
</insert>
|
</update>
|
||||||
|
|
||||||
<insert id="addMember">
|
<insert id="addMember">
|
||||||
INSERT INTO sv_venue_member (`member_id`, `venue_id`) VALUES (#{memberId},#{venueId})
|
INSERT INTO sv_venue_member (`member_id`, `venue_id`) VALUES (#{memberId},#{venueId})
|
||||||
|
|||||||
@@ -90,7 +90,7 @@
|
|||||||
domainObjectName 给表对应的 model 起名字
|
domainObjectName 给表对应的 model 起名字
|
||||||
注意:大小写敏感问题。
|
注意:大小写敏感问题。
|
||||||
-->
|
-->
|
||||||
<table tableName="sv_barcode_enter_venue_log" domainObjectName="BarcodeEnterLog"
|
<table tableName="sv_barcode_order_time" domainObjectName="BarcodeOrderTime"
|
||||||
enableInsert="true"
|
enableInsert="true"
|
||||||
enableDeleteByPrimaryKey="true"
|
enableDeleteByPrimaryKey="true"
|
||||||
enableSelectByPrimaryKey="true"
|
enableSelectByPrimaryKey="true"
|
||||||
|
|||||||
Reference in New Issue
Block a user