|
@ -5,6 +5,7 @@ import java.net.http.HttpResponse; |
|
|
import java.util.List; |
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
import cn.hutool.core.date.DateUtil; |
|
|
import cn.hutool.core.date.DateUtil; |
|
|
|
|
|
import cn.hutool.core.io.FileUtil; |
|
|
import cn.hutool.core.io.IoUtil; |
|
|
import cn.hutool.core.io.IoUtil; |
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
import cn.hutool.http.HttpRequest; |
|
|
import cn.hutool.http.HttpRequest; |
|
@ -51,10 +52,14 @@ import javax.print.attribute.PrintRequestAttributeSet; |
|
|
@RequestMapping("/print/logmanager") |
|
|
@RequestMapping("/print/logmanager") |
|
|
public class WinPrintTasksLogsController extends BaseController { |
|
|
public class WinPrintTasksLogsController extends BaseController { |
|
|
private String prefix = "print/logmanager"; |
|
|
private String prefix = "print/logmanager"; |
|
|
|
|
|
// @Resource
|
|
|
|
|
|
// IWinPrintSettingsService iSettingsService;
|
|
|
@Resource |
|
|
@Resource |
|
|
IWinPrintSettingsService iSettingsService; |
|
|
|
|
|
@Autowired |
|
|
|
|
|
private IWinPrintTasksLogsService winPrintTasksLogsService; |
|
|
private IWinPrintTasksLogsService winPrintTasksLogsService; |
|
|
|
|
|
@Value("${win.path.print}") |
|
|
|
|
|
private String printFilepath; //生成的打印文件存储路径
|
|
|
|
|
|
@Value("${win.file.print.delSync}") |
|
|
|
|
|
private Boolean delSync; //删除日志记录时是否删除文件
|
|
|
|
|
|
|
|
|
@RequiresPermissions("print:logmanager:view") |
|
|
@RequiresPermissions("print:logmanager:view") |
|
|
@GetMapping() |
|
|
@GetMapping() |
|
@ -116,10 +121,10 @@ public class WinPrintTasksLogsController extends BaseController { |
|
|
mmap.put("winPrintTasksLogs", winPrintTasksLogs); |
|
|
mmap.put("winPrintTasksLogs", winPrintTasksLogs); |
|
|
return prefix + "/edit"; |
|
|
return prefix + "/edit"; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@RequiresPermissions("print:logmanager:edit") |
|
|
@RequiresPermissions("print:logmanager:edit") |
|
|
@GetMapping("/detail/{id}") |
|
|
@GetMapping("/detail/{id}") |
|
|
public String detail(@PathVariable("id") Long id, ModelMap mmap) |
|
|
public String detail(@PathVariable("id") Long id, ModelMap mmap) { |
|
|
{ |
|
|
|
|
|
mmap.put("name", "printLog"); |
|
|
mmap.put("name", "printLog"); |
|
|
mmap.put("printLog", winPrintTasksLogsService.selectWinPrintTasksLogsById(id)); |
|
|
mmap.put("printLog", winPrintTasksLogsService.selectWinPrintTasksLogsById(id)); |
|
|
return prefix + "/detail"; |
|
|
return prefix + "/detail"; |
|
@ -127,21 +132,20 @@ public class WinPrintTasksLogsController extends BaseController { |
|
|
|
|
|
|
|
|
@RequiresPermissions("print:logmanager:edit") |
|
|
@RequiresPermissions("print:logmanager:edit") |
|
|
@GetMapping("/printChange/{id}") |
|
|
@GetMapping("/printChange/{id}") |
|
|
public String printChange(@PathVariable("id") Long id, ModelMap mmap) |
|
|
public String printChange(@PathVariable("id") Long id, ModelMap mmap) { |
|
|
{ |
|
|
|
|
|
//mmap.put("name", "printer");
|
|
|
//mmap.put("name", "printer");
|
|
|
mmap.put("winPrintTasksLogs", winPrintTasksLogsService.selectWinPrintTasksLogsById(id)); |
|
|
mmap.put("winPrintTasksLogs", winPrintTasksLogsService.selectWinPrintTasksLogsById(id)); |
|
|
return prefix + "/printChange"; |
|
|
return prefix + "/printChange"; |
|
|
} |
|
|
} |
|
|
@Value("${win.path.print}") |
|
|
|
|
|
private String printFilepath; //生成的打印文件存储路径
|
|
|
|
|
|
|
|
|
|
|
|
@RequiresPermissions("print:logmanager:edit") |
|
|
@RequiresPermissions("print:logmanager:edit") |
|
|
@GetMapping("/print/{id}") |
|
|
@GetMapping("/print/{id}") |
|
|
@ResponseBody |
|
|
@ResponseBody |
|
|
public AjaxResult print(@PathVariable("id") Long id) { |
|
|
public AjaxResult print(@PathVariable("id") Long id) { |
|
|
WinPrintTasksLogs tasksLog = winPrintTasksLogsService.selectWinPrintTasksLogsById(id); |
|
|
WinPrintTasksLogs tasksLog = winPrintTasksLogsService.selectWinPrintTasksLogsById(id); |
|
|
if (null!=tasksLog) { |
|
|
if (null != tasksLog) { |
|
|
tasksLog.setPrintTime(DateUtil.date()); |
|
|
tasksLog.setPrintTime(DateUtil.date()); |
|
|
tasksLog.setTaskStatus("0"); |
|
|
tasksLog.setTaskStatus("0"); |
|
|
winPrintTasksLogsService.updateWinPrintTasksLogs(tasksLog); |
|
|
winPrintTasksLogsService.updateWinPrintTasksLogs(tasksLog); |
|
@ -151,10 +155,11 @@ public class WinPrintTasksLogsController extends BaseController { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@RequiresPermissions("print:logmanager:edit") |
|
|
@RequiresPermissions("print:logmanager:edit") |
|
|
@GetMapping("/doprint/{id}") |
|
|
@GetMapping("/doprint/{id}") |
|
|
@ResponseBody |
|
|
@ResponseBody |
|
|
public AjaxResult doprint(@RequestParam("id") Long id,@RequestParam("printer") String printer) { |
|
|
public AjaxResult doprint(@RequestParam("id") Long id, @RequestParam("printer") String printer) { |
|
|
WinPrintTasksLogs tasksLog = winPrintTasksLogsService.selectWinPrintTasksLogsById(id); |
|
|
WinPrintTasksLogs tasksLog = winPrintTasksLogsService.selectWinPrintTasksLogsById(id); |
|
|
if (ObjectUtil.isNotEmpty(tasksLog)) { |
|
|
if (ObjectUtil.isNotEmpty(tasksLog)) { |
|
|
// try {
|
|
|
// try {
|
|
@ -201,6 +206,15 @@ public class WinPrintTasksLogsController extends BaseController { |
|
|
@PostMapping("/remove") |
|
|
@PostMapping("/remove") |
|
|
@ResponseBody |
|
|
@ResponseBody |
|
|
public AjaxResult remove(String ids) { |
|
|
public AjaxResult remove(String ids) { |
|
|
return toAjax(winPrintTasksLogsService.deleteWinPrintTasksLogsByIds(ids)); |
|
|
List<WinPrintTasksLogs> winPrintTasksLogs = winPrintTasksLogsService.selectWinPrintTasksLogsByIds(ids); |
|
|
|
|
|
int i = winPrintTasksLogsService.deleteWinPrintTasksLogsByIds(ids); |
|
|
|
|
|
if (delSync) { |
|
|
|
|
|
if (i > 0 && winPrintTasksLogs.size() > 0) { |
|
|
|
|
|
winPrintTasksLogs.forEach(item -> { |
|
|
|
|
|
FileUtil.del(DataUnitl.getWorkingDir(printFilepath) + "/" + item.getDataFile()); |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
return toAjax(i); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|