Merge branch 'baotou-signup' of e.coding.net:tsteam/btsaqscksfwpt/system-examination-signup into baotou-signup
This commit is contained in:
commit
e9789aa4da
16
pom.xml
16
pom.xml
@ -126,6 +126,22 @@
|
|||||||
<groupId>cn.com.tenlion</groupId>
|
<groupId>cn.com.tenlion</groupId>
|
||||||
<version>1.0-SNAPSHOT</version>
|
<version>1.0-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
<!--二维码start-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.zxing</groupId>
|
||||||
|
<artifactId>core</artifactId>
|
||||||
|
<version>3.1.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.zxing</groupId>
|
||||||
|
<artifactId>javase</artifactId>
|
||||||
|
<version>3.1.0</version>
|
||||||
|
</dependency>
|
||||||
|
<!--二维码end-->
|
||||||
|
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
@ -55,7 +55,7 @@ public class ApplyAppController extends DefaultBaseController {
|
|||||||
public SuccessResultList<List<ApplyWorkTypeInstitutionDTO>> listPageApplyWorkType(@RequestHeader("token") String token, ListPage page) throws Exception{
|
public SuccessResultList<List<ApplyWorkTypeInstitutionDTO>> listPageApplyWorkType(@RequestHeader("token") String token, ListPage page) throws Exception{
|
||||||
Map<String, Object> params = requestParams();
|
Map<String, Object> params = requestParams();
|
||||||
page.setParams(params);
|
page.setParams(params);
|
||||||
return applyService.listPageApplyWorkType(page);
|
return applyService.listPageApplyWorkType(token,page);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -0,0 +1,26 @@
|
|||||||
|
package cn.com.tenlion.controller.app.route.trainingInstitution;
|
||||||
|
|
||||||
|
import ink.wgink.interfaces.consts.ISystemConstant;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
|
||||||
|
@Api(tags = ISystemConstant.API_TAGS_APP_ROUTE_PREFIX + "培训机构信息接口")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping(ISystemConstant.APP_ROUTE_PREFIX + "/trainingInstitution")
|
||||||
|
public class TrainingInstitutionController {
|
||||||
|
|
||||||
|
|
||||||
|
@ApiOperation(value = "角色统计页面", notes = "角色统计页面接口")
|
||||||
|
@GetMapping("get-qrcode-view/{institutionId}")
|
||||||
|
public ModelAndView getqrCodeView(@PathVariable("institutionId") String institutionId){
|
||||||
|
ModelAndView mv = new ModelAndView("trainingInstitution/qrcode-view");
|
||||||
|
mv.addObject("institutionId",institutionId);
|
||||||
|
return mv;
|
||||||
|
}
|
||||||
|
}
|
@ -24,6 +24,8 @@ public class ApplyDTO {
|
|||||||
private String applyClassName;
|
private String applyClassName;
|
||||||
@ApiModelProperty(name = "applyWorkTypeId", value = "报名工种ID")
|
@ApiModelProperty(name = "applyWorkTypeId", value = "报名工种ID")
|
||||||
private String applyWorkTypeId;
|
private String applyWorkTypeId;
|
||||||
|
@ApiModelProperty(name = "applyWorkTypeName", value = "报名工种中文名称")
|
||||||
|
private String applyWorkTypeName;
|
||||||
@ApiModelProperty(name = "applyName", value = "报名人姓名")
|
@ApiModelProperty(name = "applyName", value = "报名人姓名")
|
||||||
private String applyName;
|
private String applyName;
|
||||||
@ApiModelProperty(name = "applySex", value = "报名人性别 1男 2女【数据字典】")
|
@ApiModelProperty(name = "applySex", value = "报名人性别 1男 2女【数据字典】")
|
||||||
@ -334,4 +336,12 @@ public class ApplyDTO {
|
|||||||
public void setApplyWorkTypeId(String applyWorkTypeId) {
|
public void setApplyWorkTypeId(String applyWorkTypeId) {
|
||||||
this.applyWorkTypeId = applyWorkTypeId;
|
this.applyWorkTypeId = applyWorkTypeId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getApplyWorkTypeName() {
|
||||||
|
return applyWorkTypeName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setApplyWorkTypeName(String applyWorkTypeName) {
|
||||||
|
this.applyWorkTypeName = applyWorkTypeName;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ public interface IApplyService {
|
|||||||
* @return
|
* @return
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
SuccessResultList<List<ApplyWorkTypeInstitutionDTO>> listPageApplyWorkType(ListPage page) throws Exception;
|
SuccessResultList<List<ApplyWorkTypeInstitutionDTO>> listPageApplyWorkType(String token,ListPage page) throws Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 报名信息审核
|
* 报名信息审核
|
||||||
|
@ -34,6 +34,7 @@ import ink.wgink.pojo.dtos.user.UserDTO;
|
|||||||
import ink.wgink.pojo.result.SuccessResultList;
|
import ink.wgink.pojo.result.SuccessResultList;
|
||||||
import ink.wgink.service.user.pojo.vos.UserVO;
|
import ink.wgink.service.user.pojo.vos.UserVO;
|
||||||
import ink.wgink.service.user.service.IUserService;
|
import ink.wgink.service.user.service.IUserService;
|
||||||
|
import ink.wgink.util.QRCodeUtil;
|
||||||
import ink.wgink.util.UUIDUtil;
|
import ink.wgink.util.UUIDUtil;
|
||||||
import ink.wgink.util.date.DateUtil;
|
import ink.wgink.util.date.DateUtil;
|
||||||
import ink.wgink.util.map.HashMapUtil;
|
import ink.wgink.util.map.HashMapUtil;
|
||||||
@ -42,7 +43,7 @@ import org.apache.commons.lang3.StringUtils;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.apache.commons.codec.binary.Base64;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@ -207,7 +208,8 @@ public class ApplyServiceImpl extends DefaultBaseService implements IApplyServic
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
public SuccessResultList<List<ApplyWorkTypeInstitutionDTO>> listPageApplyWorkType(ListPage page) throws Exception{
|
public SuccessResultList<List<ApplyWorkTypeInstitutionDTO>> listPageApplyWorkType(String token,ListPage page) throws Exception{
|
||||||
|
AppTokenUser appTokenUser = getAppTokenUser(token);
|
||||||
List<ApplyWorkTypeInstitutionDTO> list= new ArrayList<>();
|
List<ApplyWorkTypeInstitutionDTO> list= new ArrayList<>();
|
||||||
String workTypeId = page.getParams().get("workTypeId").toString();
|
String workTypeId = page.getParams().get("workTypeId").toString();
|
||||||
if(StringUtils.isBlank(workTypeId)){
|
if(StringUtils.isBlank(workTypeId)){
|
||||||
@ -234,12 +236,29 @@ public class ApplyServiceImpl extends DefaultBaseService implements IApplyServic
|
|||||||
trainingInstitutionWorkTypeDTO.setApplyUserNum2(num2);
|
trainingInstitutionWorkTypeDTO.setApplyUserNum2(num2);
|
||||||
trainingInstitutionWorkTypeDTO.setApplyUserNum3(num3);
|
trainingInstitutionWorkTypeDTO.setApplyUserNum3(num3);
|
||||||
//判断当前机构是否可以报名
|
//判断当前机构是否可以报名
|
||||||
trainingInstitutionWorkTypeDTO.setApplyStatus(examCheckService.getExamCheck(workTypeId,row.getInstitutionId()));
|
if(checkApplyIsFirst(appTokenUser.getId(),workTypeId,row.getInstitutionId()) != 0){
|
||||||
|
trainingInstitutionWorkTypeDTO.setApplyStatus(false);
|
||||||
|
}else{
|
||||||
|
trainingInstitutionWorkTypeDTO.setApplyStatus(examCheckService.getExamCheck(workTypeId,row.getInstitutionId()));
|
||||||
|
}
|
||||||
|
trainingInstitutionWorkTypeDTO.setQrCode("123");
|
||||||
|
|
||||||
list.add(trainingInstitutionWorkTypeDTO);
|
list.add(trainingInstitutionWorkTypeDTO);
|
||||||
}
|
}
|
||||||
return new SuccessResultList<>(list, trainingInstitutionWorkTypeList.getPage(), trainingInstitutionWorkTypeList.getTotal());
|
return new SuccessResultList<>(list, trainingInstitutionWorkTypeList.getPage(), trainingInstitutionWorkTypeList.getTotal());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String createQrCode(String iId){
|
||||||
|
//QRCodeUtil.createQrCode()
|
||||||
|
//
|
||||||
|
// ByteArrayOutputStream stream = new ByteArrayOutputStream();
|
||||||
|
// ImageIO.write(image, "png", stream);
|
||||||
|
// // 对字节数组Base64编码
|
||||||
|
// Base64 base = new Base64();
|
||||||
|
// String base64 = base.encodeToString(stream.toByteArray());
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -300,12 +319,12 @@ public class ApplyServiceImpl extends DefaultBaseService implements IApplyServic
|
|||||||
// if(countApplyCardNumber(applyCardNumber,ApplyClassId) != 0){
|
// if(countApplyCardNumber(applyCardNumber,ApplyClassId) != 0){
|
||||||
// throw new SaveException("您以报名过该项目");
|
// throw new SaveException("您以报名过该项目");
|
||||||
// }
|
// }
|
||||||
if(checkApplyIsFirst(creator,applyWorkTypeId,null) != 0){
|
|
||||||
throw new SaveException("您选择的工种以报名过其他培训机构");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(checkApplyIsFirst(creator,applyWorkTypeId,applyInstitutionId) != 0){
|
if(checkApplyIsFirst(creator,applyWorkTypeId,applyInstitutionId) != 0){
|
||||||
throw new SaveException("您以报名过该机构");
|
throw new SaveException("您已报名过该机构");
|
||||||
|
}
|
||||||
|
if(checkApplyIsFirst(creator,applyWorkTypeId,null) != 0){
|
||||||
|
throw new SaveException("您选择的工种已报名过其他培训机构");
|
||||||
}
|
}
|
||||||
if(!examCheckService.getExamCheck(applyWorkTypeId,applyInstitutionId)){
|
if(!examCheckService.getExamCheck(applyWorkTypeId,applyInstitutionId)){
|
||||||
throw new SaveException("该机构咱不能报名");
|
throw new SaveException("该机构咱不能报名");
|
||||||
@ -355,7 +374,7 @@ public class ApplyServiceImpl extends DefaultBaseService implements IApplyServic
|
|||||||
throw new SearchException("暂不能修改信息");
|
throw new SearchException("暂不能修改信息");
|
||||||
}
|
}
|
||||||
if(checkApplyIsFirst(creator,applyWorkTypeId,null) != 0){
|
if(checkApplyIsFirst(creator,applyWorkTypeId,null) != 0){
|
||||||
throw new SaveException("您选择的工种以报名过其他培训机构");
|
throw new SaveException("您选择的工种已报名过其他培训机构");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!examCheckService.getExamCheck(applyWorkTypeId,applyInstitutionId)){
|
if(!examCheckService.getExamCheck(applyWorkTypeId,applyInstitutionId)){
|
||||||
|
279
src/main/java/cn/com/tenlion/util/QRCodeUtil.java
Normal file
279
src/main/java/cn/com/tenlion/util/QRCodeUtil.java
Normal file
@ -0,0 +1,279 @@
|
|||||||
|
package cn.com.tenlion.util;
|
||||||
|
|
||||||
|
import com.google.zxing.*;
|
||||||
|
import com.google.zxing.client.j2se.BufferedImageLuminanceSource;
|
||||||
|
import com.google.zxing.common.BitMatrix;
|
||||||
|
import com.google.zxing.common.HybridBinarizer;
|
||||||
|
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
|
||||||
|
import ink.wgink.module.file.pojo.vos.FileVO;
|
||||||
|
import ink.wgink.module.file.service.IFileService;
|
||||||
|
import ink.wgink.properties.FileProperties;
|
||||||
|
import ink.wgink.util.UUIDUtil;
|
||||||
|
import ink.wgink.util.date.DateUtil;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
|
import javax.imageio.ImageIO;
|
||||||
|
import java.awt.*;
|
||||||
|
import java.awt.geom.RoundRectangle2D;
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.OutputStream;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Hashtable;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 二维码生成工具类
|
||||||
|
* ClassName: QRCodeUtil
|
||||||
|
* @Description: TODO
|
||||||
|
* 创建工具: IDEA
|
||||||
|
* 运行环境: [Tomcat7以上,MySql5.6以上,JDK7以上]
|
||||||
|
* @author 崔宝铖
|
||||||
|
* @date 2021年3月19日
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
public class QRCodeUtil {
|
||||||
|
|
||||||
|
private static final String CHARSET = "utf-8";
|
||||||
|
|
||||||
|
private static final String FORMAT_NAME = "JPG";
|
||||||
|
|
||||||
|
// 二维码尺寸
|
||||||
|
private static final int QRCODE_SIZE = 300;
|
||||||
|
// LOGO宽度
|
||||||
|
private static final int WIDTH = 60;
|
||||||
|
// LOGO高度
|
||||||
|
private static final int HEIGHT = 60;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private FileProperties fileProperties;
|
||||||
|
private static FileProperties fileStaticProperties;
|
||||||
|
@Autowired
|
||||||
|
private IFileService iFileService;
|
||||||
|
private static IFileService iFileStaticService;
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
public void init() {
|
||||||
|
fileStaticProperties = fileProperties;
|
||||||
|
iFileStaticService = iFileService;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static BufferedImage createImage(String content, String imgPath, boolean needCompress) throws Exception {
|
||||||
|
Hashtable<EncodeHintType, Object> hints = new Hashtable<EncodeHintType, Object>();
|
||||||
|
hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.H);
|
||||||
|
hints.put(EncodeHintType.CHARACTER_SET, CHARSET);
|
||||||
|
hints.put(EncodeHintType.MARGIN, 1);
|
||||||
|
BitMatrix bitMatrix = new MultiFormatWriter().encode(content, BarcodeFormat.QR_CODE, QRCODE_SIZE, QRCODE_SIZE, hints);
|
||||||
|
int width = bitMatrix.getWidth();
|
||||||
|
int height = bitMatrix.getHeight();
|
||||||
|
BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
|
||||||
|
for (int x = 0; x < width; x++) {
|
||||||
|
for (int y = 0; y < height; y++) {// 0xFF0000FF
|
||||||
|
image.setRGB(x, y, bitMatrix.get(x, y) ? 0xFF000000 : 0xFFFFFFFF);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (imgPath == null || "".equals(imgPath)) {
|
||||||
|
return image;
|
||||||
|
}
|
||||||
|
// 插入图片
|
||||||
|
QRCodeUtil.insertImage(image, imgPath, needCompress);
|
||||||
|
return image;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 插入LOGO
|
||||||
|
* @param source 二维码图片
|
||||||
|
* @param imgPath LOGO图片地址
|
||||||
|
* @param needCompress 是否压缩
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
private static void insertImage(BufferedImage source, String imgPath, boolean needCompress) throws Exception {
|
||||||
|
File file = new File(imgPath);
|
||||||
|
if (!file.exists()) {
|
||||||
|
System.err.println("" + imgPath + "该文件不存在!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Image src = ImageIO.read(new File(imgPath));
|
||||||
|
int width = src.getWidth(null);
|
||||||
|
int height = src.getHeight(null);
|
||||||
|
if (needCompress) { // 压缩LOGO
|
||||||
|
if (width > WIDTH) {
|
||||||
|
width = WIDTH;
|
||||||
|
}
|
||||||
|
if (height > HEIGHT) {
|
||||||
|
height = HEIGHT;
|
||||||
|
}
|
||||||
|
Image image = src.getScaledInstance(width, height, Image.SCALE_SMOOTH);
|
||||||
|
BufferedImage tag = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
|
||||||
|
Graphics g = tag.getGraphics();
|
||||||
|
g.drawImage(image, 0, 0, null); // 绘制缩小后的图
|
||||||
|
g.dispose();
|
||||||
|
src = image;
|
||||||
|
}
|
||||||
|
// 插入LOGO
|
||||||
|
Graphics2D graph = source.createGraphics();
|
||||||
|
int x = (QRCODE_SIZE - width) / 2;
|
||||||
|
int y = (QRCODE_SIZE - height) / 2;
|
||||||
|
graph.drawImage(src, x, y, width, height, null);
|
||||||
|
Shape shape = new RoundRectangle2D.Float(x, y, width, width, 6, 6);
|
||||||
|
graph.setStroke(new BasicStroke(3f));
|
||||||
|
graph.draw(shape);
|
||||||
|
graph.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成二维码(内嵌LOGO)
|
||||||
|
* @param content 内容
|
||||||
|
* @param imgPath LOGO地址
|
||||||
|
* @param destPath 存放目录
|
||||||
|
* @param needCompress 是否压缩LOGO
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public static String encode(String content, String imgPath, String destPath, boolean needCompress) throws Exception {
|
||||||
|
BufferedImage image = QRCodeUtil.createImage(content, imgPath, needCompress);
|
||||||
|
mkdirs(destPath);
|
||||||
|
String file = UUIDUtil.getUUID() + ".jpg";
|
||||||
|
ImageIO.write(image, FORMAT_NAME, new File(destPath + "/" + file));
|
||||||
|
return file;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 当文件夹不存在时,mkdirs会自动创建多层目录,区别于mkdir.(mkdir如果父目录不存在则会抛出异常)
|
||||||
|
* @param destPath 存放目录
|
||||||
|
* @date 2013-12-11 上午10:16:36
|
||||||
|
*/
|
||||||
|
public static void mkdirs(String destPath) {
|
||||||
|
File file = new File(destPath);
|
||||||
|
//当文件夹不存在时,mkdirs会自动创建多层目录,区别于mkdir.(mkdir如果父目录不存在则会抛出异常)
|
||||||
|
if (!file.exists() && !file.isDirectory()) {
|
||||||
|
file.mkdirs();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成二维码(内嵌LOGO)
|
||||||
|
* @param content 内容
|
||||||
|
* @param imgPath LOGO地址
|
||||||
|
* @param destPath 存储地址
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public static void encode(String content, String imgPath, String destPath) throws Exception {
|
||||||
|
QRCodeUtil.encode(content, imgPath, destPath, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成二维码
|
||||||
|
* @param content 内容
|
||||||
|
* @param destPath 存储地址
|
||||||
|
* @param needCompress 是否压缩LOGO
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public static void encode(String content, String destPath, boolean needCompress) throws Exception {
|
||||||
|
QRCodeUtil.encode(content, null, destPath, needCompress);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成二维码
|
||||||
|
* @param content 内容
|
||||||
|
* @param destPath 存储地址
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public static void encode(String content, String destPath) throws Exception {
|
||||||
|
QRCodeUtil.encode(content, null, destPath, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成二维码(内嵌LOGO)
|
||||||
|
* @param content 内容
|
||||||
|
* @param imgPath LOGO地址
|
||||||
|
* @param output 输出流
|
||||||
|
* @param needCompress 是否压缩LOGO
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public static void encode(String content, String imgPath, OutputStream output, boolean needCompress) throws Exception {
|
||||||
|
BufferedImage image = QRCodeUtil.createImage(content, imgPath, needCompress);
|
||||||
|
ImageIO.write(image, FORMAT_NAME, output);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成二维码
|
||||||
|
* @param content 内容
|
||||||
|
* @param output 输出流
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public static void encode(String content, OutputStream output) throws Exception {
|
||||||
|
QRCodeUtil.encode(content, null, output, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 解析二维码
|
||||||
|
* @param file 二维码图片
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public static String decode(File file) throws Exception {
|
||||||
|
BufferedImage image;
|
||||||
|
image = ImageIO.read(file);
|
||||||
|
if (image == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
BufferedImageLuminanceSource source = new BufferedImageLuminanceSource(image);
|
||||||
|
BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));
|
||||||
|
Result result;
|
||||||
|
Hashtable<DecodeHintType, Object> hints = new Hashtable<DecodeHintType, Object>();
|
||||||
|
hints.put(DecodeHintType.CHARACTER_SET, CHARSET);
|
||||||
|
result = new MultiFormatReader().decode(bitmap, hints);
|
||||||
|
String resultStr = result.getText();
|
||||||
|
return resultStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 解析二维码
|
||||||
|
* @param path 二维码图片地址
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public static String decode(String path) throws Exception {
|
||||||
|
return QRCodeUtil.decode(new File(path));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 二维码默认样式
|
||||||
|
* @param content
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public static String deStyle1(String userId, String content) throws Exception {
|
||||||
|
StringBuilder filePath = new StringBuilder();
|
||||||
|
String baseUploadPath = fileStaticProperties.getUploadPath();
|
||||||
|
if (!baseUploadPath.endsWith(File.separator)) {
|
||||||
|
filePath.append(baseUploadPath).append(File.separator);
|
||||||
|
} else {
|
||||||
|
filePath.append(baseUploadPath);
|
||||||
|
}
|
||||||
|
filePath.append("images").append(File.separator).append(DateUtil.getDays());
|
||||||
|
// 生成
|
||||||
|
String fileName = QRCodeUtil.encode(content, null, filePath.toString(), false);
|
||||||
|
// 保存
|
||||||
|
File qrCodeFile = new File(filePath.toString() +"\\"+ fileName);
|
||||||
|
FileVO fileVO = new FileVO();
|
||||||
|
fileVO.setFileName(fileName);
|
||||||
|
fileVO.setFileUrl("files\\"+filePath.substring(filePath.indexOf("images"), filePath.length())+"\\"+ fileName);
|
||||||
|
fileVO.setFilePath(filePath.toString() +"\\"+ fileName);
|
||||||
|
fileVO.setFileType("jpg");
|
||||||
|
fileVO.setFileSize(qrCodeFile.length());
|
||||||
|
return iFileStaticService.saveFileByUserId(userId,fileVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) throws Exception {
|
||||||
|
// String text = "http://www.baidu.com"; //这里设置自定义网站url
|
||||||
|
// String logoPath = "D:\\2020\\10\\10";
|
||||||
|
// //String destPath = "C:\\Users\\admin\\Desktop\\test\\";
|
||||||
|
// QRCodeUtil.encode(text, logoPath);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -414,7 +414,7 @@
|
|||||||
t1.apply_class_id,
|
t1.apply_class_id,
|
||||||
t1.apply_class_name,
|
t1.apply_class_name,
|
||||||
t1.apply_work_type_id,
|
t1.apply_work_type_id,
|
||||||
e1.work_type_name AS Sapply_work_type_name,
|
e1.work_type_name AS apply_work_type_name,
|
||||||
t1.apply_name,
|
t1.apply_name,
|
||||||
t1.apply_sex,
|
t1.apply_sex,
|
||||||
t1.apply_data_birth,
|
t1.apply_data_birth,
|
||||||
|
@ -0,0 +1 @@
|
|||||||
|
@charset "utf-8";a,body,dd,div,dl,dt,em,form,h1,h2,h3,h4,h5,h6,img,input,li,ol,option,p,select,span,strong,table,td,textarea,th,ul,var{margin:0;padding:0}body,html{font:400 100% "微软雅黑",Arail,Tabhoma;text-align:left;color:#535353;-webkit-font-smoothing:antialiased;line-height:normal}ol,ul{list-style:none}img{border:0;vertical-align:top}input,select,textarea{outline:0}textarea{resize:none}table{border-collapse:collapse;border-spacing:0}em,strong,th,var{font-weight:400;font-style:normal}a{text-decoration:none;color:#555}a,input{-webkit-tap-highlight-color:transparent}[v-cloak]{display: none}
|
@ -0,0 +1,8 @@
|
|||||||
|
.main{
|
||||||
|
padding: .25rem;
|
||||||
|
}
|
||||||
|
p{
|
||||||
|
font-size: .32rem;
|
||||||
|
color: #000;
|
||||||
|
line-height: .6rem;
|
||||||
|
}
|
88
src/main/resources/static/assets/qrcodeview/js/ajax.js
Normal file
88
src/main/resources/static/assets/qrcodeview/js/ajax.js
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
function ObjToForm(obj) {
|
||||||
|
var formStr;
|
||||||
|
for (var name in obj) {
|
||||||
|
if (formStr == undefined || formStr == null) {
|
||||||
|
formStr = name + '=' + obj[name];
|
||||||
|
} else {
|
||||||
|
formStr += '&' + name + '=' + obj[name];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return formStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发起get请求,普通form表单格式
|
||||||
|
* @param url 地址
|
||||||
|
* @param dataObj 请求对象
|
||||||
|
* @param successCallback 请求成功回调
|
||||||
|
* @param errorCallback 请求失败回调
|
||||||
|
* @param beforeSendCallback 发送前执行
|
||||||
|
* @param completeCallback 发送后执行
|
||||||
|
*/
|
||||||
|
function doGetForm(url, dataObj, args, successCallback, errorCallback, beforeCallback, completeCallback) {
|
||||||
|
dataObj.tm = new Date().getTime();
|
||||||
|
$.ajax({
|
||||||
|
url: url,
|
||||||
|
type: 'GET',
|
||||||
|
contentType: "application/json;charset=utf-8",
|
||||||
|
data: (dataObj == undefined || dataObj == null) ? {} : ObjToForm(dataObj),
|
||||||
|
success: function(data, status, XMLHttpRequest) {
|
||||||
|
var responseCode = XMLHttpRequest.status;
|
||||||
|
successCallback(responseCode, data, args);
|
||||||
|
},
|
||||||
|
error: function(XMLHttpRequest) {
|
||||||
|
var responseCode = XMLHttpRequest.status;
|
||||||
|
if (errorCallback != undefined && errorCallback != null && typeof(errorCallback) == 'function') {
|
||||||
|
errorCallback(responseCode);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
beforeSend: function(XMLHttpRequest) {
|
||||||
|
if (beforeCallback != undefined && beforeCallback != null && typeof(beforeCallback) == 'function') {
|
||||||
|
beforeCallback(XMLHttpRequest);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
complete: function(XMLHttpRequest, status) {
|
||||||
|
if (completeCallback != undefined && completeCallback != null && typeof(completeCallback) == 'function') {
|
||||||
|
completeCallback(XMLHttpRequest, status);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发起post请求
|
||||||
|
* @param url 请求地址
|
||||||
|
* @param dataObj 请求对象
|
||||||
|
* @param successCallback 请求成功回调
|
||||||
|
* @param errorCallback 请求失败回调
|
||||||
|
* @param beforeSendCallback 发送前执行
|
||||||
|
* @param completeCallback 发送后执行
|
||||||
|
*/
|
||||||
|
function doPostJson(url, dataObj, args, successCallback, errorCallback, beforeCallback, completeCallback, isJson) {
|
||||||
|
$.ajax({
|
||||||
|
url: url,
|
||||||
|
type: 'POST',
|
||||||
|
contentType: "application/json;charset=utf-8",
|
||||||
|
data: (dataObj == undefined || dataObj == null) ? {} : JSON.stringify(dataObj),
|
||||||
|
success: function(data, status, XMLHttpRequest) {
|
||||||
|
var responseCode = XMLHttpRequest.status;
|
||||||
|
successCallback(responseCode, data, args);
|
||||||
|
},
|
||||||
|
error: function(XMLHttpRequest) {
|
||||||
|
var responseCode = XMLHttpRequest.status;
|
||||||
|
if (errorCallback != undefined && errorCallback != null && typeof(errorCallback) == 'function') {
|
||||||
|
errorCallback(responseCode);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
beforeSend: function(XMLHttpRequest) {
|
||||||
|
if (beforeCallback != undefined && beforeCallback != null && typeof(beforeCallback) == 'function') {
|
||||||
|
beforeCallback(XMLHttpRequest);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
complete: function(XMLHttpRequest, status) {
|
||||||
|
if (completeCallback != undefined && completeCallback != null && typeof(completeCallback) == 'function') {
|
||||||
|
completeCallback(XMLHttpRequest, status);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
3
src/main/resources/static/assets/qrcodeview/js/jquery-2.1.4.min.js
vendored
Normal file
3
src/main/resources/static/assets/qrcodeview/js/jquery-2.1.4.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
12
src/main/resources/static/assets/qrcodeview/js/rem.js
Normal file
12
src/main/resources/static/assets/qrcodeview/js/rem.js
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
function setPage() {
|
||||||
|
var html = document.getElementsByTagName('html')[0];
|
||||||
|
var deviceWidth = document.documentElement.clientWidth;
|
||||||
|
var scale = deviceWidth / 750;//psd图上的宽度
|
||||||
|
html.style.fontSize = scale * 100 + 'px';
|
||||||
|
}
|
||||||
|
|
||||||
|
setPage();
|
||||||
|
|
||||||
|
window.onresize = function () {
|
||||||
|
setPage();
|
||||||
|
}
|
10947
src/main/resources/static/assets/qrcodeview/js/vue.js
Normal file
10947
src/main/resources/static/assets/qrcodeview/js/vue.js
Normal file
File diff suppressed because it is too large
Load Diff
@ -103,7 +103,7 @@
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{field: 'applyClassName', width: 180, title: '报名计划', align:'center',
|
{field: 'applyWorkTypeName', width: 180, title: '报名工种', align:'center',
|
||||||
templet: function(row) {
|
templet: function(row) {
|
||||||
var rowData = row[this.field];
|
var rowData = row[this.field];
|
||||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||||
|
@ -44,7 +44,7 @@
|
|||||||
var laytpl = layui.laytpl;
|
var laytpl = layui.laytpl;
|
||||||
var laydate = layui.laydate;
|
var laydate = layui.laydate;
|
||||||
var applyId = top.restAjax.params(window.location.href).applyId;
|
var applyId = top.restAjax.params(window.location.href).applyId;
|
||||||
|
var fileIdViewer = "";
|
||||||
|
|
||||||
function closeBox() {
|
function closeBox() {
|
||||||
parent.layer.close(parent.layer.getFrameIndex(window.name));
|
parent.layer.close(parent.layer.getFrameIndex(window.name));
|
||||||
@ -57,7 +57,7 @@
|
|||||||
top.restAjax.get(top.restAjax.path('api/applyauditlog/list', []), {applyId:applyId}, null, function(code, data) {
|
top.restAjax.get(top.restAjax.path('api/applyauditlog/list', []), {applyId:applyId}, null, function(code, data) {
|
||||||
var dataFormData = "";
|
var dataFormData = "";
|
||||||
for(var i in data) {
|
for(var i in data) {
|
||||||
dataFormData +=initLineData(data[i].applyAuditTime,data[i].applyAuditUserName,data[i].applyAuditState,data[i].applyAuditExplain)
|
dataFormData +=initLineData(data[i].applyAuditTime,data[i].applyAuditUserName,data[i].applyAuditState,data[i].applyAuditExplain,data[i].applyAuditFileId)
|
||||||
}
|
}
|
||||||
$("#logData").append(dataFormData);
|
$("#logData").append(dataFormData);
|
||||||
}, function(code, data) {
|
}, function(code, data) {
|
||||||
@ -70,7 +70,7 @@
|
|||||||
}
|
}
|
||||||
initData();
|
initData();
|
||||||
|
|
||||||
function initLineData(data,user,status,result){
|
function initLineData(dataTime,user,status,result,fileId){
|
||||||
var sName = "";
|
var sName = "";
|
||||||
if(status == 0){
|
if(status == 0){
|
||||||
sName = "用户申请报名"
|
sName = "用户申请报名"
|
||||||
@ -90,40 +90,54 @@
|
|||||||
if(status == 4){
|
if(status == 4){
|
||||||
sName = "报名完成"
|
sName = "报名完成"
|
||||||
}
|
}
|
||||||
var data =
|
var data = "";
|
||||||
'<li class="layui-timeline-item">'+
|
data +='<li class="layui-timeline-item">'
|
||||||
'<i class="layui-icon layui-timeline-axis"></i>'+
|
data +='<i class="layui-icon layui-timeline-axis"></i>'
|
||||||
'<div class="layui-timeline-content layui-text">'+
|
data += '<div class="layui-timeline-content layui-text">'
|
||||||
'<h3 class="layui-timeline-title">'+data+'</h3>'+
|
data +='<h3 class="layui-timeline-title">'+dataTime+'</h3>'
|
||||||
'<p>'+
|
data +='<p>'
|
||||||
'<table class="layui-table">'+
|
data +='<table class="layui-table">'
|
||||||
'<colgroup>'+
|
data +='<colgroup>'
|
||||||
'<col width="150">'+
|
data +='<col width="150">'
|
||||||
' <col width="200">'+
|
data +=' <col width="200">'
|
||||||
' <col>'+
|
data +=' <col>'
|
||||||
' </colgroup>'+
|
data +=' </colgroup>'
|
||||||
'<thead>'+
|
data +='<thead>'
|
||||||
'<tr>'+
|
data +='<tr>'
|
||||||
'<th>操作人</th>'+
|
data +='<th>操作人</th>'
|
||||||
'<th>操作结果</th>'+
|
data +='<th>操作结果</th>'
|
||||||
'<th>操作说明</th>'+
|
data +='<th>操作说明</th>'
|
||||||
'</tr>'+
|
if(status == 2){
|
||||||
'</thead>'+
|
data += '<th>交费凭证</th>'
|
||||||
'<tbody>'+
|
}
|
||||||
'<tr>'+
|
|
||||||
'<td>'+user+'</td>'+
|
data += '</tr>'
|
||||||
'<td>'+sName+'</td>'+
|
data +='</thead>'
|
||||||
'<td>'+result+'</td>'+
|
data +='<tbody>'
|
||||||
'</tr>'+
|
data +='<tr>'
|
||||||
'</tbody>'+
|
data +='<td>'+user+'</td>'
|
||||||
'</table>'+
|
data +='<td>'+sName+'</td>'
|
||||||
'</p>'+
|
data +='<td>'+result+'</td>'
|
||||||
'</div>'+
|
if(status == 2){
|
||||||
'</li>';
|
fileIdViewer = fileId;
|
||||||
|
var image = '<ul style="height: 100%" id="'+fileId+'">'
|
||||||
|
image +='<p style="height: 100%;display"><img style="height: 85px;cursor:pointer;" src="route/file/download/false/'+ fileId +'" alt="暂无"></p>';
|
||||||
|
image += '</ul>';
|
||||||
|
data += '<td>'+image+'</td>'
|
||||||
|
}
|
||||||
|
data +='</tr>'
|
||||||
|
data +='</tbody>'
|
||||||
|
data +='</table>'
|
||||||
|
data +='</p>'
|
||||||
|
data +='</div>'
|
||||||
|
data +='</li>';
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setTimeout(function() {
|
||||||
|
new Viewer(document.getElementById(fileIdViewer),{
|
||||||
|
});
|
||||||
|
}, 50);
|
||||||
|
|
||||||
$('.close').on('click', function() {
|
$('.close').on('click', function() {
|
||||||
closeBox();
|
closeBox();
|
||||||
|
@ -0,0 +1,46 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html xmlns:th="http://www.thymeleaf.org">
|
||||||
|
<head>
|
||||||
|
<base th:href="${#request.getContextPath() + '/'}">
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>安全生产三项人员考试服务平台</title>
|
||||||
|
<link rel="stylesheet" href="assets/qrcodeview/css/reset.css">
|
||||||
|
<link rel="stylesheet" href="assets/qrcodeview/css/style.css">
|
||||||
|
<script src="assets/qrcodeview/js/rem.js"></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="app">
|
||||||
|
<div class="main" v-cloak>
|
||||||
|
<p>机构名称:{{orgInfo.institutionName}}</p>
|
||||||
|
<p>机构地址:{{orgInfo.institutionAddress}}</p>
|
||||||
|
<p>机构简介:{{orgInfo.institutionDesc}}</p>
|
||||||
|
<p>负责人:{{orgInfo.institutionPrincipal}}</p>
|
||||||
|
<p>联系方式:{{orgInfo.institutionContact}}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script src="js/jquery-2.1.4.min.js"></script>
|
||||||
|
<script src="js/vue.js"></script>
|
||||||
|
<script src="js/ajax.js"></script>
|
||||||
|
<script>
|
||||||
|
var vue = new Vue({
|
||||||
|
el: '#app',
|
||||||
|
data: {
|
||||||
|
url: 'http://192.168.0.120:7009/signup/',
|
||||||
|
orgInfo: {},
|
||||||
|
orgId: '${institutionId}'
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getOrgDetail: function () {
|
||||||
|
var self = this
|
||||||
|
doGetForm(self.url + 'app/traininginstitution/get/release/' + self.orgId, {}, null, function (code, data) {
|
||||||
|
self.orgInfo = data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted: function () {
|
||||||
|
this.getOrgDetail()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
Reference in New Issue
Block a user