|
@@ -44,11 +44,13 @@ public class QrCodeController {
|
|
String userId = Blank.isNotEmpty(token) ? MiniTokenUtil.getId(token).asString() : null;
|
|
String userId = Blank.isNotEmpty(token) ? MiniTokenUtil.getId(token).asString() : null;
|
|
if (StrUtil.isEmpty(userId)) {
|
|
if (StrUtil.isEmpty(userId)) {
|
|
response.setStatus(401);
|
|
response.setStatus(401);
|
|
|
|
+ return;
|
|
}
|
|
}
|
|
//根据二维码标记和用户id判断用户此次活动二维码是否已经核销
|
|
//根据二维码标记和用户id判断用户此次活动二维码是否已经核销
|
|
QrcodeWriteoff qrcodeWriteoff = qrcodeWriteoffService.queryOneByQrcodeSignAndUserId(userId, qrcodeSign);
|
|
QrcodeWriteoff qrcodeWriteoff = qrcodeWriteoffService.queryOneByQrcodeSignAndUserId(userId, qrcodeSign);
|
|
if (qrcodeWriteoff != null && qrcodeWriteoff.getWriteoffStatus() == 2) {
|
|
if (qrcodeWriteoff != null && qrcodeWriteoff.getWriteoffStatus() == 2) {
|
|
response.setStatus(400);
|
|
response.setStatus(400);
|
|
|
|
+ return;
|
|
}
|
|
}
|
|
if (qrcodeWriteoff == null) {
|
|
if (qrcodeWriteoff == null) {
|
|
qrcodeWriteoff = new QrcodeWriteoff();
|
|
qrcodeWriteoff = new QrcodeWriteoff();
|
|
@@ -63,7 +65,6 @@ public class QrCodeController {
|
|
BarcodeFormat.QR_CODE, 350, 350
|
|
BarcodeFormat.QR_CODE, 350, 350
|
|
);
|
|
);
|
|
MatrixToImageWriter.writeToStream(bitMatrix, "PNG", response.getOutputStream());
|
|
MatrixToImageWriter.writeToStream(bitMatrix, "PNG", response.getOutputStream());
|
|
- response.setStatus(200);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -79,12 +80,12 @@ public class QrCodeController {
|
|
return SendUtil.send(false, ConstStr.REQUEST_WRONGPARAMS);
|
|
return SendUtil.send(false, ConstStr.REQUEST_WRONGPARAMS);
|
|
}
|
|
}
|
|
if (qrcodeWriteoff.getWriteoffStatus() == 2) {
|
|
if (qrcodeWriteoff.getWriteoffStatus() == 2) {
|
|
- response.sendRedirect("https://www.cqna.gov.cn/mnazw/applet/writeOff-fail.png" );
|
|
|
|
|
|
+ response.sendRedirect("https://www.cqna.gov.cn/mnazw/writeOff/index.html?result=fail" );
|
|
return SendUtil.send(false, "该二维码已核销:" + recordId);
|
|
return SendUtil.send(false, "该二维码已核销:" + recordId);
|
|
}
|
|
}
|
|
|
|
|
|
Boolean result = qrcodeWriteoffService.writeoff(recordId);
|
|
Boolean result = qrcodeWriteoffService.writeoff(recordId);
|
|
- response.sendRedirect(result ? "https://www.cqna.gov.cn/mnazw/applet/writeOff-success.png" : "https://www.cqna.gov.cn/mnazw/applet/writeOff-fail.png");
|
|
|
|
|
|
+ response.sendRedirect(result ? "https://www.cqna.gov.cn/mnazw/writeOff/index.html?result=success" : "https://www.cqna.gov.cn/mnazw/writeOff/index.html?result=fail");
|
|
return SendUtil.send(result, result ? "二维码核销成" : "二维码核销失败");
|
|
return SendUtil.send(result, result ? "二维码核销成" : "二维码核销失败");
|
|
}
|
|
}
|
|
}
|
|
}
|