| | |
| | | @Value("${custom.upload.network-path}") |
| | | private String networkPath; |
| | | |
| | | @Value("${custom.driver.template1}") |
| | | private String template1; |
| | | |
| | | @Value("${custom.driver.template2}") |
| | | private String template2; |
| | | @Value("${custom.driver.font}") |
| | | private String fontPath; |
| | | @Autowired |
| | | private ISysUserService userService; |
| | | |
| | | @Autowired |
| | | private ITmsDriverService tmsDriverService; |
| | | |
| | | /** |
| | | * 登录方法[pda] |
| | |
| | | * 上传行程 |
| | | */ |
| | | @PostMapping("/uploadTrip") |
| | | public AjaxResult uploadTrip(@RequestBody TmsTrip tmsTrip){ |
| | | public AjaxResult uploadTrip(@RequestBody TmsTrip tmsTrip) throws Exception { |
| | | tmsTrip.setDataSource("1"); |
| | | return AjaxResult.success(tmsTripService.insertTmsTrip(tmsTrip)); |
| | | } |
| | |
| | | } |
| | | return AjaxResult.success(data); |
| | | } |
| | | @GetMapping("/resource/jkcns") |
| | | public void jkcns( HttpServletResponse response) throws Exception { |
| | | |
| | | Integer deviceId = userService.getDeviceId(SecurityUtils.getUserId()); |
| | | if (deviceId == null){ |
| | | return; |
| | | } |
| | | TmsDriver byId = tmsDriverService.getById(deviceId); |
| | | if (byId != null){ |
| | | HashMap<String, String> objectObjectHashMap = new HashMap<>(); |
| | | objectObjectHashMap.put("date", DateUtils.getDate()); |
| | | objectObjectHashMap.put("name", byId.getDriverName()); |
| | | objectObjectHashMap.put("idCard", byId.getLicenseNumber()); |
| | | |
| | | // 下载名称 |
| | | response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE); |
| | | FileUtils.setAttachmentResponseHeader(response, "货车司机出车前健康承诺书_"+byId.getDriverName()+"pdf"); |
| | | FileUtils.writeBytes(template1, response.getOutputStream()); |
| | | PdfTemplateUtil.fillPdf(template2, response.getOutputStream(),objectObjectHashMap , fontPath); |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | @GetMapping("/resource/zjsfcns") |
| | | public void zjsfcns( HttpServletResponse response) throws Exception { |
| | | // 下载名称 |
| | | |
| | | Integer deviceId = userService.getDeviceId(SecurityUtils.getUserId()); |
| | | if (deviceId == null){ |
| | | return; |
| | | } |
| | | TmsDriver byId = tmsDriverService.getById(deviceId); |
| | | if (byId != null){ |
| | | HashMap<String, String> objectObjectHashMap = new HashMap<>(); |
| | | objectObjectHashMap.put("date", DateUtils.getDate()); |
| | | // 下载名称 |
| | | response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE); |
| | | FileUtils.setAttachmentResponseHeader(response, "遵纪守法承诺书_"+byId.getDriverName()+"pdf"); |
| | | PdfTemplateUtil.fillPdf(template2, response.getOutputStream(),objectObjectHashMap , fontPath); |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | } |