| | |
| | | import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel; |
| | | import com.thhy.general.common.BasicResult; |
| | | import com.thhy.materials.modules.biz.rebarprint.service.TSteelPrintService; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | |
| | | @Resource |
| | | private TSteelPrintService steelPrintService; |
| | | |
| | | @Value("${pipePrint.baseUrl}") |
| | | private String baseUrl; |
| | | |
| | | @Value("${pipePrint.deviceInfoUrl}") |
| | | private String deviceInfoUrl; |
| | | |
| | | @Value("${pipePrint.pipeHistoryInfoUrl}") |
| | | private String pipeHistoryInfoUrl; |
| | | |
| | | @Value("${pipePrint.modelUrl}") |
| | | private String modelUrl; |
| | | |
| | | @Value("${pipePrint.steelInfoUrl}") |
| | | private String steelInfoUrl; |
| | | |
| | | //钢筋笼打印添加 |
| | | @PostMapping("/steelPrintInsert") |
| | |
| | | String content = num; |
| | | if (type != null){ |
| | | if(type == 1){ |
| | | // content = "http://111.30.93.212:8089/pipe/#/scanDetail?num="+num; |
| | | content = "https://pipe.thhy-tj.com/pipe/#/scanDetail?bigDeviceId="+bigDeviceId; |
| | | //content = "http://192.168.0.99:8080/#/scanDetail?num="+num; |
| | | content = baseUrl + deviceInfoUrl + bigDeviceId; |
| | | }else if (type == 2){ |
| | | //content = "http://111.30.93.212:8089/pipe/#/ScanBear?num="+num; |
| | | content = "https://pipe.thhy-tj.com/pipe/#/ScanBear?num="+num; |
| | | //content = "http://192.168.0.99:8080/#/ScanBear?num="+num; |
| | | content = baseUrl + pipeHistoryInfoUrl + num; |
| | | }else if(type == 3){ |
| | | //content = "http://111.30.93.212:8089/pipe/#/massInfo?mouldId="+mouldId; |
| | | content = "https://pipe.thhy-tj.com/pipe/#/massInfo?mouldId="+mouldId; |
| | | //content = "http://192.168.0.99:8080/#/massInfo?mouldId="+mouldId; |
| | | content = baseUrl + modelUrl + mouldId; |
| | | }else if(type == 4){ |
| | | //content = "http://111.30.93.212:8089/pipe/#/reinInfo?num="+num; |
| | | content = "https://pipe.thhy-tj.com/pipe/#/reinInfo?num="+num; |
| | | //content = "http://192.168.0.99:8080/#/reinInfo?num="+num; |
| | | content = baseUrl + steelInfoUrl + num; |
| | | } |
| | | } |
| | | System.out.println("steelProduceId=============="+steelProduceId); |
| | | // Map<EncodeHintType, Object> hints = new HashMap<EncodeHintType, Object>(); |
| | | // // 指定编码格式 |
| | | // hints.put(EncodeHintType.CHARACTER_SET, "UTF-8"); |
| | | // // 指定纠错级别(L--7%,M--15%,Q--25%,H--30%) |
| | | // hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.H); |
| | | // // 编码内容,编码类型(这里指定为二维码),生成图片宽度,生成图片高度,设置参数 |
| | | // BitMatrix bitMatrix = new MultiFormatWriter().encode(content, BarcodeFormat.QR_CODE, 200, 200, hints); |
| | | // //设置请求头 |
| | | // response.setHeader("Content-Type","application/octet-stream"); |
| | | // response.setHeader("Content-Disposition", "attachment;filename=" + "编码.png"); |
| | | // OutputStream outputStream = response.getOutputStream(); |
| | | // MatrixToImageWriter.writeToStream(bitMatrix, "png", outputStream); |
| | | // outputStream.flush(); |
| | | // outputStream.close(); |
| | | |
| | | BufferedImage bufferedImage = ImageUtils.createQr(content); |
| | | |
| | | OutputStream outputStream = null; |