该设备类型下已有设备,无法修改设备类型名称!!!
This commit is contained in:
81
fys-admin/src/main/java/com/fuyuanshen/SimpleQR.java
Normal file
81
fys-admin/src/main/java/com/fuyuanshen/SimpleQR.java
Normal file
@ -0,0 +1,81 @@
|
||||
package com.fuyuanshen;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.File;
|
||||
|
||||
public class SimpleQR {
|
||||
public static void main(String[] args) throws Exception {
|
||||
String text = "HELLO";
|
||||
int size = 21; // 版本1的大小
|
||||
boolean[][] qr = new boolean[size][size];
|
||||
|
||||
// 1. 三个定位标记
|
||||
for (int i = 0; i < 7; i++)
|
||||
for (int j = 0; j < 7; j++) {
|
||||
boolean black = i == 0 || i == 6 || j == 0 || j == 6 || (i > 1 && i < 5 && j > 1 && j < 5);
|
||||
qr[i][j] = qr[i][size - 1 - j] = qr[size - 1 - i][j] = black;
|
||||
}
|
||||
|
||||
// 2. 定时图案(简化)
|
||||
for (int i = 8; i < 13; i++) qr[i][6] = qr[6][i] = (i % 2 == 0);
|
||||
|
||||
// 3. 编码数据(极简编码)
|
||||
byte[] data = text.getBytes();
|
||||
int x = 20, y = 20, up = 1; // 从右下角开始
|
||||
for (byte b : data)
|
||||
for (int bit = 7; bit >= 0; bit--) {
|
||||
while (qr[x][y] || (x == 6 && y < 9) || (y == 6 && x < 9) || (x < 9 && y < 9) ||
|
||||
(x < 9 && y > size - 10) || (y < 9 && x > size - 10)) {
|
||||
if (up > 0) {
|
||||
if (--y < 0) {
|
||||
y = 0;
|
||||
x -= 2;
|
||||
up = -1;
|
||||
}
|
||||
} else {
|
||||
if (++y >= size) {
|
||||
y = size - 1;
|
||||
x -= 2;
|
||||
up = 1;
|
||||
}
|
||||
}
|
||||
if (x == 6) x--;
|
||||
}
|
||||
qr[x][y] = ((b >> bit) & 1) == 1;
|
||||
if (up > 0) {
|
||||
if (--y < 0) {
|
||||
y = 0;
|
||||
x -= 2;
|
||||
up = -1;
|
||||
}
|
||||
} else {
|
||||
if (++y >= size) {
|
||||
y = size - 1;
|
||||
x -= 2;
|
||||
up = 1;
|
||||
}
|
||||
}
|
||||
if (x == 6) x--;
|
||||
}
|
||||
|
||||
// 4. 保存图像
|
||||
int scale = 10, margin = 4;
|
||||
BufferedImage img = new BufferedImage(
|
||||
size * scale + margin * 2, size * scale + margin * 2, BufferedImage.TYPE_INT_RGB);
|
||||
for (int i = 0; i < img.getWidth(); i++)
|
||||
for (int j = 0; j < img.getHeight(); j++)
|
||||
img.setRGB(i, j, 0xFFFFFF); // 白色背景
|
||||
|
||||
for (int i = 0; i < size; i++)
|
||||
for (int j = 0; j < size; j++)
|
||||
if (qr[i][j])
|
||||
for (int di = 0; di < scale; di++)
|
||||
for (int dj = 0; dj < scale; dj++)
|
||||
img.setRGB(margin + i * scale + di, margin + j * scale + dj, 0x000000);
|
||||
|
||||
ImageIO.write(img, "PNG", new File("qr.png"));
|
||||
System.out.println("二维码已生成");
|
||||
}
|
||||
|
||||
}
|
||||
@ -39,8 +39,8 @@ public class EncryptUtilsTest {
|
||||
loginBody.setClientId("e5cd7e4891bf95d1d19206ce24a7b32e");
|
||||
loginBody.setGrantType("password");
|
||||
loginBody.setTenantId("894078");
|
||||
loginBody.setCode("15");
|
||||
loginBody.setUuid("28ecf3d396ce4e6db8eb414992235fad");
|
||||
loginBody.setCode("6");
|
||||
loginBody.setUuid("399d45194f3d4c7e9cbfb3294b198a9b");
|
||||
// loginBody.setUsername("admin");
|
||||
// loginBody.setPassword("admin123");
|
||||
loginBody.setUsername("dyf");
|
||||
|
||||
@ -10,32 +10,36 @@ import lombok.EqualsAndHashCode;
|
||||
/**
|
||||
* 设备维修图片对象 device_repair_images
|
||||
*
|
||||
*
|
||||
* @date 2025-09-02
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("device_repair_images")
|
||||
public class DeviceRepairImages extends TenantEntity {
|
||||
|
||||
/**
|
||||
* 维修图片ID
|
||||
*/
|
||||
@TableId(value = "image_id", type = IdType.AUTO)
|
||||
@TableField(insertStrategy = FieldStrategy.NEVER)
|
||||
private Long imageId;
|
||||
|
||||
/**
|
||||
* 维修记录ID
|
||||
*/
|
||||
@Schema(title = "维修记录ID")
|
||||
private Long recordId;
|
||||
|
||||
/**
|
||||
* 图片类型(维修前/维修后)
|
||||
*/
|
||||
@Schema(title = "图片类型(维修前/维修后)")
|
||||
private RepairImageType imageType;
|
||||
|
||||
/**
|
||||
* 图片存储路径
|
||||
*/
|
||||
@Schema(title = "图片存储路径")
|
||||
private String imageUrl;
|
||||
|
||||
}
|
||||
|
||||
@ -244,10 +244,10 @@ public class DeviceTypeServiceImpl extends ServiceImpl<DeviceTypeMapper, DeviceT
|
||||
throw new RuntimeException("设备类型不存在");
|
||||
}
|
||||
|
||||
if (!deviceType.getTypeName().equals(resources.getTypeName())) {
|
||||
if (!deviceType.getTypeName().equals(resources.getTypeName()) || !deviceType.getAppModelDictionary().equals(resources.getAppModelDictionary())) {
|
||||
int count = deviceMapper.countByDeviceTypeId(deviceType.getId());
|
||||
if (count > 0) {
|
||||
throw new RuntimeException("该设备类型下已有设备,无法修改设备类型名称!!!");
|
||||
throw new RuntimeException("该设备类型下已有设备,无法修改设备类型名称和路由跳转!!!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BIN
qrcode.png
Normal file
BIN
qrcode.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 8.2 KiB |
Reference in New Issue
Block a user