| | |
| | | import cn.hutool.core.img.ImgUtil; |
| | | import cn.hutool.core.io.FileUtil; |
| | | import com.ruoyi.chargingPile.api.dto.TChargingGunDTO; |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | | import com.ruoyi.chargingPile.api.model.TChargingGun; |
| | | import com.ruoyi.chargingPile.api.model.TChargingPile; |
| | | import com.ruoyi.chargingPile.api.query.TChargingGunQuery; |
| | | import com.ruoyi.chargingPile.api.vo.SiteNameVO; |
| | | import com.ruoyi.chargingPile.api.vo.TChargingGunVO; |
| | | import com.ruoyi.chargingPile.service.ISiteService; |
| | | import com.ruoyi.chargingPile.service.TChargingGunService; |
| | | import com.ruoyi.chargingPile.service.TChargingPileService; |
| | | import com.ruoyi.chargingPile.util.QRCodeUtils; |
| | |
| | | |
| | | @Resource |
| | | private TChargingPileService chargingPileService; |
| | | @Resource |
| | | private ISiteService siteService; |
| | | |
| | | @Autowired |
| | | public TChargingGunController(TChargingGunService chargingGunService) { |
| | |
| | | response.setContentType("application/force-download"); |
| | | response.addHeader("Content-Disposition", "attachment;fileName=" + fileName); |
| | | String url = "https://www.baidu.com?id=" + id; |
| | | String filePath = "D://" + fileName; |
| | | String filePath = "D:/Program Files/nginx-1.20.2/html"; |
| | | QRCodeUtils.encode(url, filePath); |
| | | FileInputStream inputStream = new FileInputStream(filePath); |
| | | ServletOutputStream out = response.getOutputStream(); |
| | |
| | | TChargingGun chargingGun = chargingGunService.getById(id); |
| | | return R.ok(chargingGun); |
| | | } |
| | | /** |
| | | * 根据id获取充电枪详情 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping(value = "/getAllInfoById/{id}") |
| | | public R<SiteNameVO> getAllInfoById(@PathVariable Integer id){ |
| | | SiteNameVO siteNameVO = new SiteNameVO(); |
| | | TChargingGun chargingGun = chargingGunService.getById(id); |
| | | siteNameVO.setGunName(chargingGun.getName()); |
| | | siteNameVO.setGunNumber(chargingGun.getCode()); |
| | | TChargingPile chargingPile = chargingPileService.getById(id); |
| | | siteNameVO.setPileName(chargingPile.getName()); |
| | | siteNameVO.setPileNumber(chargingPile.getNumber()); |
| | | Site site = siteService.getById(id); |
| | | siteNameVO.setSiteName(site.getName()); |
| | | return R.ok(siteNameVO); |
| | | } |
| | | } |
| | | |