Browse Source

Merge remote-tracking branch 'origin/dev_qr_code' into develop

dev
yinzuomei 3 years ago
parent
commit
914b3e8c82
  1. 4
      epmet-commons/epmet-commons-tools/pom.xml
  2. 30
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/BarcodeUtils.java
  3. 12
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/AgencyController.java
  4. 16
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcResiCollectMemFormDTO.java

4
epmet-commons/epmet-commons-tools/pom.xml

@ -169,13 +169,13 @@
<dependency> <dependency>
<groupId>com.google.zxing</groupId> <groupId>com.google.zxing</groupId>
<artifactId>core</artifactId> <artifactId>core</artifactId>
<version>3.3.2</version> <version>3.4.1</version>
</dependency> </dependency>
<!-- https://mvnrepository.com/artifact/com.google.zxing/javase --> <!-- https://mvnrepository.com/artifact/com.google.zxing/javase -->
<dependency> <dependency>
<groupId>com.google.zxing</groupId> <groupId>com.google.zxing</groupId>
<artifactId>javase</artifactId> <artifactId>javase</artifactId>
<version>3.3.2</version> <version>3.4.1</version>
</dependency> </dependency>
</dependencies> </dependencies>

30
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/BarcodeUtils.java

@ -1,13 +1,5 @@
package com.epmet.commons.tools.utils; package com.epmet.commons.tools.utils;
/**
* desc:
*
* @author: LiuJanJun
* @date: 2022/3/18 11:57 上午
* @version: 1.0
*/
import com.google.zxing.BarcodeFormat; import com.google.zxing.BarcodeFormat;
import com.google.zxing.EncodeHintType; import com.google.zxing.EncodeHintType;
@ -28,7 +20,6 @@ import java.io.IOException;
import java.util.HashMap; import java.util.HashMap;
/** /**
* Author 程鹏
* Date 2021/08/27 16:01 * Date 2021/08/27 16:01
* Description:二维码生成工具类 * Description:二维码生成工具类
*/ */
@ -95,7 +86,7 @@ public class BarcodeUtils {
//x开始的位置:(图片宽度-字体大小*字的个数)/2 //x开始的位置:(图片宽度-字体大小*字的个数)/2
int startX = (WIDTH - (FONTSIZE * pressText.length())) / 2; int startX = (WIDTH - (FONTSIZE * pressText.length())) / 2;
//y开始的位置:图片高度-(图片高度-图片宽度)/2 //y开始的位置:图片高度-(图片高度-图片宽度)/2
int startY = HEIGHT - (HEIGHT - WIDTH) / 2; int startY = HEIGHT - (HEIGHT - WIDTH) / 2 + FONTSIZE;
int imageW = outImage.getWidth(); int imageW = outImage.getWidth();
int imageH = outImage.getHeight(); int imageH = outImage.getHeight();
@ -169,9 +160,24 @@ public class BarcodeUtils {
} else { } else {
return new String(btf, 0, len - 1, "GBK"); return new String(btf, 0, len - 1, "GBK");
} }
} }
/*public static void main(String[] args) {
try {
BufferedImage image = BarcodeUtils.drawQRImage("小崽子社区中国国歌过过过过过所多对方水电费是的发生的", "https://epmet-cloud.elinkservice.cn/epmet-oper-gov/#/caiji/b058eb82d65d922fec9dc84f0348fc6a?name=%E5%B0%8F%E5%AF%A8%E5%AD%90%E7%A4%BE%E5%8C%BA&customerId=3fdd0380deff5b30f45376cdf995d1c1&type=community&userId=72d331139a5012b6bba18b40029a2755&123123123111");
//BufferedImage image = BarcodeUtils.drawQRImage("小崽子社区", "erId=72d331139a5012b6bba18b40029a2755&123123123111");
//BufferedImage image2 = BarcodeUtils.getQRCode("小崽子社区", "https://epmet-cloud.elinkservice.cn/epmet-oper-gov/#/caiji/b058eb82d65d922fec9dc84f0348fc6a?name=%E5%B0%8F%E5%AF%A8%E5%AD%90%E7%A4%BE%E5%8C%BA&customerId=3fdd0380deff5b30f45376cdf995d1c1&type=community&userId=72d331139a5012b6bba18b40029a2755&123123123111");
//BufferedImage 转 InputStream
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
ImageOutputStream imageOutput = ImageIO.createImageOutputStream(byteArrayOutputStream);
ImageIO.write(image, "png", imageOutput);
InputStream inputStream = new ByteArrayInputStream(byteArrayOutputStream.toByteArray());
String s = "/Users/liujianjun/Downloads/t.png";
File file= new File(s);
FileUtils.copyInputStreamToFile(inputStream, file);
} catch (Exception e) {
e.printStackTrace();
}
}*/
} }

12
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/AgencyController.java

@ -17,7 +17,6 @@
package com.epmet.controller; package com.epmet.controller;
import com.alibaba.fastjson.JSONObject;
import com.epmet.commons.rocketmq.messages.OrgOrStaffMQMsg; import com.epmet.commons.rocketmq.messages.OrgOrStaffMQMsg;
import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.annotation.RequirePermission; import com.epmet.commons.tools.annotation.RequirePermission;
@ -43,12 +42,7 @@ import com.epmet.send.SendMqMsgUtil;
import com.epmet.service.AgencyService; import com.epmet.service.AgencyService;
import com.epmet.service.CustomerAgencyService; import com.epmet.service.CustomerAgencyService;
import com.epmet.service.IcNeighborHoodService; import com.epmet.service.IcNeighborHoodService;
import com.google.zxing.BarcodeFormat; import org.apache.commons.io.FileUtils;
import com.google.zxing.EncodeHintType;
import com.google.zxing.MultiFormatWriter;
import com.google.zxing.WriterException;
import com.google.zxing.client.j2se.MatrixToImageWriter;
import com.google.zxing.common.BitMatrix;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -60,8 +54,6 @@ import javax.servlet.http.HttpServletResponse;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.io.*; import java.io.*;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.nio.file.FileSystems;
import java.nio.file.Path;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.ZoneOffset; import java.time.ZoneOffset;
import java.util.HashMap; import java.util.HashMap;
@ -450,4 +442,6 @@ public class AgencyController {
} }
} }
} }

16
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcResiCollectMemFormDTO.java

@ -2,10 +2,12 @@ package com.epmet.dto.form;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable; import java.io.Serializable;
/**
* 家庭成员信息
* 前端做校验
*/
@Data @Data
public class IcResiCollectMemFormDTO implements Serializable { public class IcResiCollectMemFormDTO implements Serializable {
/** /**
@ -15,30 +17,30 @@ public class IcResiCollectMemFormDTO implements Serializable {
/** /**
* 居住成员1姓名 * 居住成员1姓名
*/ */
@NotBlank(message = "姓名不能为空", groups = {IcResiCollectFormDTO.InternalShowGroup.class, IcResiCollectFormDTO.ExternalShowGroup.class}) // @NotBlank(message = "姓名不能为空", groups = {IcResiCollectFormDTO.InternalShowGroup.class, IcResiCollectFormDTO.ExternalShowGroup.class})
private String name; private String name;
/** /**
* 居住成员1身份证号 * 居住成员1身份证号
*/ */
@NotBlank(message = "身份证号不能为空", groups = {IcResiCollectFormDTO.InternalShowGroup.class, IcResiCollectFormDTO.ExternalShowGroup.class}) // @NotBlank(message = "身份证号不能为空", groups = {IcResiCollectFormDTO.InternalShowGroup.class, IcResiCollectFormDTO.ExternalShowGroup.class})
private String idNum; private String idNum;
/** /**
* 居住成员1手机号 * 居住成员1手机号
*/ */
@NotBlank(message = "手机号不能为空", groups = {IcResiCollectFormDTO.InternalShowGroup.class, IcResiCollectFormDTO.ExternalShowGroup.class}) // @NotBlank(message = "手机号不能为空", groups = {IcResiCollectFormDTO.InternalShowGroup.class, IcResiCollectFormDTO.ExternalShowGroup.class})
private String mobile; private String mobile;
/** /**
* 居住成员1是否参加几轮全员核算检测数字1-10 * 居住成员1是否参加几轮全员核算检测数字1-10
*/ */
@NotBlank(message = "核算检测情况不能为空", groups = {IcResiCollectFormDTO.InternalShowGroup.class, IcResiCollectFormDTO.ExternalShowGroup.class}) // @NotBlank(message = "核算检测情况不能为空", groups = {IcResiCollectFormDTO.InternalShowGroup.class, IcResiCollectFormDTO.ExternalShowGroup.class})
private String heSuanCount; private String heSuanCount;
/** /**
* 居住成员1新冠疫苗接种情况;1:已全程接种2未全程接种0未接种 * 居住成员1新冠疫苗接种情况;1:已全程接种2未全程接种0未接种
*/ */
@NotNull(message = "疫苗接种情况不能为空", groups = {IcResiCollectFormDTO.InternalShowGroup.class, IcResiCollectFormDTO.ExternalShowGroup.class}) // @NotNull(message = "疫苗接种情况不能为空", groups = {IcResiCollectFormDTO.InternalShowGroup.class, IcResiCollectFormDTO.ExternalShowGroup.class})
private Integer ymjz; private Integer ymjz;
} }

Loading…
Cancel
Save