Pu Zhibing
2024-09-26 35601b1455ec05ece1414bd288fa38944c03bfdd
ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TChargingGunController.java
@@ -14,6 +14,7 @@
import com.ruoyi.chargingPile.api.vo.GunStatusStatisticsVO;
import com.ruoyi.chargingPile.api.vo.SiteNameVO;
import com.ruoyi.chargingPile.api.vo.TChargingGunVO;
import com.ruoyi.chargingPile.config.FileUploadConfig;
import com.ruoyi.chargingPile.service.ISiteService;
import com.ruoyi.chargingPile.service.TChargingGunService;
import com.ruoyi.chargingPile.service.TChargingPileService;
@@ -63,13 +64,16 @@
    @Autowired
    private TChargingGunService chargingGunService;
    @Autowired
    @Resource
    private ChargingOrderClient chargingOrderClient;
    @Resource
    private TChargingPileService chargingPileService;
    @Resource
    private ISiteService siteService;
    @Autowired
    private FileUploadConfig fileUploadConfig;
    /**
     * 查询充电枪列表
@@ -152,11 +156,13 @@
    public void downloadQRCode(@PathVariable Integer id, HttpServletResponse response){
        try {
            TChargingGun chargingGun = chargingGunService.getById(id);
            String fileName = URLEncoder.encode(chargingGun.getCode(), "UTF-8") + ".jpg";
            TChargingPile chargingPile = chargingPileService.getById(chargingGun.getId());
            String code = chargingPile.getCode() + chargingGun.getCode();
            String fileName = URLEncoder.encode(code, "UTF-8") + ".jpg";
            response.setContentType("application/force-download");
            response.addHeader("Content-Disposition", "attachment;fileName=" + fileName);
            String url = "https://www.baidu.com?id=" + id;
            String filePath = "D:/Program Files/nginx-1.20.2/html";
            String url = "https://mxcd.zhinenganguan.com?No=" + code;
            String filePath = fileUploadConfig.getLocation();
            QRCodeUtils.encode(url, filePath);
            FileInputStream inputStream = new FileInputStream(filePath);
            ServletOutputStream out = response.getOutputStream();