Browse Source

删除无用代码

dev
zxc 3 years ago
parent
commit
d65f3c2372
  1. 44
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/AgencyController.java

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

@ -370,48 +370,4 @@ public class AgencyController {
return new Result<List<SonOrgResultDTO>>().ok(agencyService.getSonAgencyId(orgId,type));
}
@PostMapping("qr")
public void qr(){
try {
write();
} catch (IOException e) {
e.printStackTrace();
} catch (WriterException e) {
e.printStackTrace();
}
}
public static void write() throws IOException, WriterException {
String filePath = "/Users/liujianjun/Downloads";
String fileName = "qr.png";
//二维码内容场景一:json数据
JSONObject json = new JSONObject();
json.put("baidu","http://www.baidu.com");//二维码一般就是存储链接
// json.put("author", "lzz");//还可存储值(员工工号,员工姓名,年会二维码门票)
String content = json.toJSONString();//json 内容
//二维码内容场景二:直接某个超链接
// content="http://www.baidu.com";//直接某个超链接
int width = 200; // 图像宽度
int height = 200; // 图像高度
String format = "png";// 图像类型
Map<EncodeHintType, Object> hints = new HashMap<EncodeHintType, Object>();
hints.put(EncodeHintType.CHARACTER_SET, "UTF-8");
BitMatrix bitMatrix = new MultiFormatWriter().encode(content,
BarcodeFormat.QR_CODE, width, height, hints);// 生成矩阵
Path path = FileSystems.getDefault().getPath(filePath, fileName);
MatrixToImageWriter.writeToPath(bitMatrix, format, path);// 输出图像
System.out.println("输出成功.");
}
public static void main(String[] args) {
try {
write();
} catch (IOException e) {
e.printStackTrace();
} catch (WriterException e) {
e.printStackTrace();
}
}
}

Loading…
Cancel
Save