| | |
| | | |
| | | import cn.hutool.core.img.ImgUtil; |
| | | import cn.hutool.core.io.FileUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.chargingPile.api.dto.GetSiteListDTO; |
| | | import com.ruoyi.chargingPile.api.dto.TChargingGunDTO; |
| | |
| | | import com.ruoyi.chargingPile.api.model.TChargingPile; |
| | | import com.ruoyi.chargingPile.api.model.TFaultMessage; |
| | | import com.ruoyi.chargingPile.api.query.TChargingGunQuery; |
| | | import com.ruoyi.chargingPile.api.vo.GetChargingGunByCode; |
| | | import com.ruoyi.chargingPile.api.vo.GunStatusStatisticsVO; |
| | | import com.ruoyi.chargingPile.api.vo.SiteNameVO; |
| | | import com.ruoyi.chargingPile.api.vo.TChargingGunVO; |
| | |
| | | public void downloadQRCode(@PathVariable Integer id, HttpServletResponse response){ |
| | | try { |
| | | TChargingGun chargingGun = chargingGunService.getById(id); |
| | | TChargingPile chargingPile = chargingPileService.getById(chargingGun.getId()); |
| | | TChargingPile chargingPile = chargingPileService.getById(chargingGun.getChargingPileId()); |
| | | String code = chargingPile.getCode() + chargingGun.getCode(); |
| | | String fileName = URLEncoder.encode(code, "UTF-8") + ".jpg"; |
| | | response.setContentType("application/force-download"); |
| | |
| | | inputStream.close(); |
| | | |
| | | //清楚服务器上的文件 |
| | | Process process = null; |
| | | try { |
| | | process = Runtime.getRuntime().exec("sudo rm -rf " + filePath); |
| | | } catch (IOException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | if (process != null) { |
| | | process.destroy(); |
| | | } |
| | | // Process process = null; |
| | | // try { |
| | | // process = Runtime.getRuntime().exec("sudo rm -rf " + filePath); |
| | | // } catch (IOException e) { |
| | | // throw new RuntimeException(e); |
| | | // } |
| | | // if (process != null) { |
| | | // process.destroy(); |
| | | // } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | * @param code |
| | | * @return |
| | | */ |
| | | @PostMapping("/getChargingGunByCode/{code}") |
| | | public R<TChargingGun> getChargingGunByCode(@PathVariable("code") String code){ |
| | | @PostMapping("/getChargingGunByCode") |
| | | public R<TChargingGun> getChargingGunByCode(@RequestBody GetChargingGunByCode code){ |
| | | TChargingPile chargingPile = chargingPileService.getOne(new LambdaQueryWrapper<TChargingPile>().eq(TChargingPile::getCode, code.getCharging_pile_code()).eq(TChargingPile::getDelFlag, 0)); |
| | | return R.ok(chargingGunService.getOne(Wrappers.lambdaQuery(TChargingGun.class) |
| | | .eq(TChargingGun::getCode, code) |
| | | .last("LIMIT 1"))); |
| | | .eq(TChargingGun::getChargingPileId, chargingPile.getId()) |
| | | .eq(TChargingGun::getCode, code.getCharging_gun_code()) |
| | | .eq(TChargingGun::getDelFlag, 0) |
| | | .last("LIMIT 1"))); |
| | | } |
| | | /** |
| | | * 根据枪编号获取充电枪 |