| | |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.domain.entity.SysDictData; |
| | | import com.ruoyi.common.core.domain.model.LoginBody; |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.ruoyi.common.utils.PdfTemplateUtil; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.*; |
| | | import com.ruoyi.common.utils.file.FileUploadUtils; |
| | | import com.ruoyi.common.utils.file.FileUtils; |
| | | import com.ruoyi.framework.config.ServerConfig; |
| | |
| | | @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; |
| | | OssUtils ossUtils; |
| | | |
| | | @Autowired |
| | | private ITmsDriverService tmsDriverService; |
| | | |
| | | /** |
| | | * 登录方法[pda] |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/assignedItineraryLogList") |
| | | public AjaxResult assignedItineraryLogList(){ |
| | | public AjaxResult assignedItineraryLogList(Integer pageNum, Integer pageSize){ |
| | | if (pageNum != null && pageSize != null) { |
| | | return AjaxResult.success(tmsDispatchOrderService.assignedItineraryLogListPage(pageNum, pageSize)); |
| | | } |
| | | return tmsDispatchOrderService.assignedItineraryLogList(); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | /** |
| | | * 行程历史 |
| | | * 行程历史(旧接口,保持兼容) |
| | | */ |
| | | @GetMapping("/tmsTripList/{dispatchId}") |
| | | public AjaxResult tmsTripList(@PathVariable Integer dispatchId){ |
| | |
| | | } |
| | | |
| | | /** |
| | | * 行程历史(分页,按时间倒序,dispatchId 可选 - 不传查全部) |
| | | */ |
| | | @GetMapping("/tmsTripListPage") |
| | | public AjaxResult tmsTripListPage(Integer dispatchId, Integer pageNum, Integer pageSize){ |
| | | if (pageNum == null) pageNum = 1; |
| | | if (pageSize == null) pageSize = 10; |
| | | return AjaxResult.success(tmsTripService.tmsTripListPage(dispatchId, pageNum, pageSize)); |
| | | } |
| | | |
| | | /** |
| | | * 获取垫付列表 |
| | | * @return |
| | | */ |
| | | @GetMapping("/getTmsFinanceDetailList") |
| | | public AjaxResult getTmsFinanceDetailList(Integer dispatchId){ |
| | | public AjaxResult getTmsFinanceDetailList(Integer dispatchId, Integer pageNum, Integer pageSize){ |
| | | // 传了分页参数走分页,否则兼容旧逻辑 |
| | | if (pageNum != null && pageSize != null) { |
| | | return AjaxResult.success(tmsFinanceDetailService.getTmsFinanceDetailListPage(dispatchId, pageNum, pageSize)); |
| | | } |
| | | return AjaxResult.success(tmsFinanceDetailService.getTmsFinanceDetailList(dispatchId)); |
| | | } |
| | | |
| | |
| | | * 上传行程 |
| | | */ |
| | | @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); |
| | | |
| | | } |
| | | |
| | | @GetMapping("/getOssToken") |
| | | public AjaxResult getOssToken(){ |
| | | return AjaxResult.success(ossUtils.getToken()); |
| | | } |
| | | |
| | | } |