feat: bug-905 设备二维码移除设备机型信息

This commit is contained in:
曹鹏飞 2025-11-12 15:36:12 +08:00
parent 0bca14aa1a
commit 8fe17faca6
3 changed files with 7 additions and 8 deletions

View File

@ -709,7 +709,7 @@ public class DeviceController extends ControllerBase {
devices.forEach(device -> {
try {
DeviceQRCodeVO vo=new DeviceQRCodeVO();
byte[] bytes=deviceQRCodeService.generate(device.getDeviceNo(),device.getModelNo());
byte[] bytes = deviceQRCodeService.generate(device.getDeviceNo());
vo.setDeviceNo(device.getDeviceNo());
vo.setUrl(fileUploadService.upload("temp/qrcode/device/"+IdUtil.fastUUID()+".png",new ByteArrayInputStream(bytes)));
vos.add(vo);
@ -731,7 +731,7 @@ public class DeviceController extends ControllerBase {
try {
if (devices.size()==1){
Device device=devices.get(0);
byte[] bytes=deviceQRCodeService.generate(device.getDeviceNo(),device.getModelNo());
byte[] bytes = deviceQRCodeService.generate(device.getDeviceNo());
HttpHeaders headers = new HttpHeaders();
headers.add(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename="+ device.getDeviceNo()+".jpg");
return ResponseEntity.ok()
@ -750,7 +750,7 @@ public class DeviceController extends ControllerBase {
tds.add(device);
ZipEntry zipEntry = new ZipEntry(device.getDeviceNo()+".jpg");
zos.putNextEntry(zipEntry);
byte[] bytes=deviceQRCodeService.generate(device.getDeviceNo(),device.getModelNo());
byte[] bytes = deviceQRCodeService.generate(device.getDeviceNo());
zos.write(bytes, 0, bytes.length);
zos.closeEntry();
}

View File

@ -33,10 +33,9 @@ public class TestController extends ControllerBase{
*/
@GetMapping("showDeviceQRCode")
public void showDeviceQRCode(HttpServletResponse response
, @RequestParam(defaultValue = "dsadwe3d3cdsd") String deviceNo
, @RequestParam(defaultValue = "sadasd") String modelNo){
, @RequestParam(defaultValue = "dsadwe3d3cdsd") String deviceNo) {
try {
byte[] bytes=deviceQRCodeService.generate(deviceNo,modelNo);
byte[] bytes = deviceQRCodeService.generate(deviceNo);
response.setContentType("image/png");
response.setHeader("Content-Disposition", "attachment;filename=qrcode.png");
try (OutputStream outputStream = response.getOutputStream()) {

View File

@ -16,8 +16,8 @@ public class DeviceQRCodeService {
@Resource
private IParamConfigService paramConfigService;
public byte[] generate(String deviceNo, String modelNo) throws Exception {
public byte[] generate(String deviceNo) throws Exception {
ParamConfig config = paramConfigService.lambdaQuery().eq(ParamConfig::getCode, "DeviceQRCodeHost").one();
return QRCodeUtil.generateDeviceQRCode(deviceNo, StrUtil.format(config.getValue(), deviceNo, modelNo), 550, 550);
return QRCodeUtil.generateDeviceQRCode(deviceNo, StrUtil.format(config.getValue(), deviceNo), 550, 550);
}
}