feat: bug-905 设备二维码移除设备机型信息
This commit is contained in:
parent
0bca14aa1a
commit
8fe17faca6
|
|
@ -709,7 +709,7 @@ public class DeviceController extends ControllerBase {
|
||||||
devices.forEach(device -> {
|
devices.forEach(device -> {
|
||||||
try {
|
try {
|
||||||
DeviceQRCodeVO vo=new DeviceQRCodeVO();
|
DeviceQRCodeVO vo=new DeviceQRCodeVO();
|
||||||
byte[] bytes=deviceQRCodeService.generate(device.getDeviceNo(),device.getModelNo());
|
byte[] bytes = deviceQRCodeService.generate(device.getDeviceNo());
|
||||||
vo.setDeviceNo(device.getDeviceNo());
|
vo.setDeviceNo(device.getDeviceNo());
|
||||||
vo.setUrl(fileUploadService.upload("temp/qrcode/device/"+IdUtil.fastUUID()+".png",new ByteArrayInputStream(bytes)));
|
vo.setUrl(fileUploadService.upload("temp/qrcode/device/"+IdUtil.fastUUID()+".png",new ByteArrayInputStream(bytes)));
|
||||||
vos.add(vo);
|
vos.add(vo);
|
||||||
|
|
@ -731,7 +731,7 @@ public class DeviceController extends ControllerBase {
|
||||||
try {
|
try {
|
||||||
if (devices.size()==1){
|
if (devices.size()==1){
|
||||||
Device device=devices.get(0);
|
Device device=devices.get(0);
|
||||||
byte[] bytes=deviceQRCodeService.generate(device.getDeviceNo(),device.getModelNo());
|
byte[] bytes = deviceQRCodeService.generate(device.getDeviceNo());
|
||||||
HttpHeaders headers = new HttpHeaders();
|
HttpHeaders headers = new HttpHeaders();
|
||||||
headers.add(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename="+ device.getDeviceNo()+".jpg");
|
headers.add(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename="+ device.getDeviceNo()+".jpg");
|
||||||
return ResponseEntity.ok()
|
return ResponseEntity.ok()
|
||||||
|
|
@ -750,7 +750,7 @@ public class DeviceController extends ControllerBase {
|
||||||
tds.add(device);
|
tds.add(device);
|
||||||
ZipEntry zipEntry = new ZipEntry(device.getDeviceNo()+".jpg");
|
ZipEntry zipEntry = new ZipEntry(device.getDeviceNo()+".jpg");
|
||||||
zos.putNextEntry(zipEntry);
|
zos.putNextEntry(zipEntry);
|
||||||
byte[] bytes=deviceQRCodeService.generate(device.getDeviceNo(),device.getModelNo());
|
byte[] bytes = deviceQRCodeService.generate(device.getDeviceNo());
|
||||||
zos.write(bytes, 0, bytes.length);
|
zos.write(bytes, 0, bytes.length);
|
||||||
zos.closeEntry();
|
zos.closeEntry();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,10 +33,9 @@ public class TestController extends ControllerBase{
|
||||||
*/
|
*/
|
||||||
@GetMapping("showDeviceQRCode")
|
@GetMapping("showDeviceQRCode")
|
||||||
public void showDeviceQRCode(HttpServletResponse response
|
public void showDeviceQRCode(HttpServletResponse response
|
||||||
, @RequestParam(defaultValue = "dsadwe3d3cdsd") String deviceNo
|
, @RequestParam(defaultValue = "dsadwe3d3cdsd") String deviceNo) {
|
||||||
, @RequestParam(defaultValue = "sadasd") String modelNo){
|
|
||||||
try {
|
try {
|
||||||
byte[] bytes=deviceQRCodeService.generate(deviceNo,modelNo);
|
byte[] bytes = deviceQRCodeService.generate(deviceNo);
|
||||||
response.setContentType("image/png");
|
response.setContentType("image/png");
|
||||||
response.setHeader("Content-Disposition", "attachment;filename=qrcode.png");
|
response.setHeader("Content-Disposition", "attachment;filename=qrcode.png");
|
||||||
try (OutputStream outputStream = response.getOutputStream()) {
|
try (OutputStream outputStream = response.getOutputStream()) {
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,8 @@ public class DeviceQRCodeService {
|
||||||
@Resource
|
@Resource
|
||||||
private IParamConfigService paramConfigService;
|
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();
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue