|
@@ -1,331 +1,332 @@
|
|
|
-//package com.huimv.secure.common.utils;
|
|
|
-//
|
|
|
-//
|
|
|
-//import com.huimv.secure.entity.*;
|
|
|
-//import com.huimv.secure.entity.dto.PrintAdmissionDto;
|
|
|
-//import com.huimv.secure.entity.dto.PrintLuggageDto;
|
|
|
-//import com.huimv.secure.entity.vo.AccountVo;
|
|
|
-//import com.huimv.secure.entity.vo.DeviceVo;
|
|
|
-//import com.huimv.secure.entity.vo.SysUserVo;
|
|
|
-//import org.jxls.common.Context;
|
|
|
-//import org.jxls.util.JxlsHelper;
|
|
|
-//
|
|
|
-//import java.io.FileInputStream;
|
|
|
-//import java.io.FileOutputStream;
|
|
|
-//import java.io.InputStream;
|
|
|
-//import java.io.OutputStream;
|
|
|
-//import java.text.SimpleDateFormat;
|
|
|
-//import java.time.LocalDateTime;
|
|
|
-//import java.time.format.DateTimeFormatter;
|
|
|
-//import java.util.ArrayList;
|
|
|
-//import java.util.Date;
|
|
|
-//import java.util.List;
|
|
|
-//
|
|
|
-//public class Print {
|
|
|
-// /**
|
|
|
-// * 打印方法 不插入图片
|
|
|
-// *
|
|
|
-// * @return
|
|
|
-// * @throws Exception
|
|
|
-// */
|
|
|
-// public static void printAdmission(List<BillPersonnelAdmission> admissionList) throws Exception {
|
|
|
-//
|
|
|
-// //准备数据
|
|
|
-// String path = "/opt/huatong/admission.xls";
|
|
|
-// //获取模板文件,你自己当前模板的位置 我这里为当前项目下
|
|
|
-// InputStream is = new FileInputStream("/opt/huatong/admission.xlsx");
|
|
|
-// //根据模板生成的文件保存路径 我这里保存在本地D盘
|
|
|
-// OutputStream os = new FileOutputStream(path);
|
|
|
-// //绑定数据
|
|
|
-// Context context = new Context();
|
|
|
-// List<PrintAdmissionDto> list = new ArrayList<>();
|
|
|
-// for (BillPersonnelAdmission admission : admissionList) {
|
|
|
-// PrintAdmissionDto dto = new PrintAdmissionDto();
|
|
|
-// dto.setUserName(admission.getAdmissionUserName());
|
|
|
-// dto.setCarNum(admission.getCarNum());
|
|
|
-// dto.setPhone(admission.getPhone());
|
|
|
-// dto.setDestName(admission.getDestName());
|
|
|
-// LocalDateTime date = admission.getVistitDate();
|
|
|
-// DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
-// dto.setVistitDate(dtf.format(date));
|
|
|
-// dto.setVistitReason(admission.getVistitReson());
|
|
|
-// if (admission.getBillStatus() == 0) {
|
|
|
-// dto.setBillStatus("待审核");
|
|
|
-// } else if (admission.getBillStatus() == 1) {
|
|
|
-// dto.setBillStatus("通过");
|
|
|
-// } else if (admission.getBillStatus() == 2) {
|
|
|
-// dto.setBillStatus("拒绝");
|
|
|
-// }
|
|
|
-//
|
|
|
-// if (admission.getVistitType() == 0) {
|
|
|
-// dto.setVistitType("人员");
|
|
|
-// } else if (admission.getVistitType() == 1) {
|
|
|
-// dto.setVistitType("环保车");
|
|
|
-// } else if (admission.getVistitType() == 2) {
|
|
|
-// dto.setVistitType("拉猪车");
|
|
|
-// } else if (admission.getVistitType() == 3) {
|
|
|
-// dto.setVistitType("饲料车");
|
|
|
-// } else if (admission.getVistitType() == 4) {
|
|
|
-// dto.setVistitType("送猪车");
|
|
|
-// } else if (admission.getVistitType() == 5) {
|
|
|
-// dto.setVistitType("物资车");
|
|
|
-// }
|
|
|
-// list.add(dto);
|
|
|
-// }
|
|
|
-// context.putVar("list", list);
|
|
|
-// //生成
|
|
|
-// JxlsHelper.getInstance().processTemplate(is, os, context);
|
|
|
-// }
|
|
|
-//
|
|
|
-//// public static void printIsolate(List<BillIsolate> isolateList) throws Exception {
|
|
|
-////
|
|
|
-//// //准备数据
|
|
|
-//// String path = "/opt/huatong/isolate.xls";
|
|
|
-//// //获取模板文件,你自己当前模板的位置 我这里为当前项目下
|
|
|
-//// InputStream is = new FileInputStream("/opt/huatong/isolate.xlsx");
|
|
|
-//// //根据模板生成的文件保存路径 我这里保存在本地D盘
|
|
|
-//// OutputStream os = new FileOutputStream(path);
|
|
|
-//// //绑定数据
|
|
|
-//// Context context = new Context();
|
|
|
-//// List<PrintIsolateDto> list = new ArrayList<>();
|
|
|
-//// for (BillIsolate billIsolate : isolateList) {
|
|
|
-//// PrintIsolateDto dto = new PrintIsolateDto();
|
|
|
-//// dto.setDestName(billIsolate.getDestName());
|
|
|
-//// dto.setPhone(billIsolate.getPhone());
|
|
|
-//// dto.setUserName(billIsolate.getAdmissionUserName());
|
|
|
-//// if (billIsolate.getBillStatus() == 0) {
|
|
|
-//// dto.setStatus("待隔离");
|
|
|
-//// } else if (billIsolate.getBillStatus() == 1) {
|
|
|
-//// dto.setStatus("隔离中");
|
|
|
-//// } else if (billIsolate.getBillStatus() == 2) {
|
|
|
-//// dto.setStatus("已完成");
|
|
|
-//// } else if (billIsolate.getBillStatus() == 3) {
|
|
|
-//// dto.setStatus("提前解除");
|
|
|
-//// }
|
|
|
-//// dto.setLocation(billIsolate.getIsolateLocation());
|
|
|
-//// dto.setNum(billIsolate.getIsolateDayNum());
|
|
|
-//// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
-//// dto.setStartTime(sdf.format(billIsolate.getIsolateStartDate()));
|
|
|
-//// dto.setEndTime(sdf.format(billIsolate.getIsolateEndDate()));
|
|
|
-//// list.add(dto);
|
|
|
-//// }
|
|
|
-//// context.putVar("list", list);
|
|
|
-//// //生成
|
|
|
-//// JxlsHelper.getInstance().processTemplate(is, os, context);
|
|
|
-//// }
|
|
|
-//
|
|
|
-// public static void printPcr(List<BillPcr> admissionList) throws Exception {
|
|
|
-//
|
|
|
-// //准备数据
|
|
|
-// String path = "/opt/huatong/pcr.xls";
|
|
|
-// //获取模板文件,你自己当前模板的位置 我这里为当前项目下
|
|
|
-// InputStream is = new FileInputStream("/opt/huatong/pcr.xlsx");
|
|
|
-// //根据模板生成的文件保存路径 我这里保存在本地D盘
|
|
|
-// OutputStream os = new FileOutputStream(path);
|
|
|
-// //绑定数据
|
|
|
-// Context context = new Context();
|
|
|
-// List<PrintAdmissionDto> list = new ArrayList<>();
|
|
|
-// for (BillPcr admission : admissionList) {
|
|
|
-// PrintAdmissionDto dto = new PrintAdmissionDto();
|
|
|
-// dto.setUserName(admission.getAdmissionUserName());
|
|
|
-// dto.setCarNum(admission.getCarNum());
|
|
|
-// dto.setPhone(admission.getPhone());
|
|
|
-// dto.setDestName(admission.getDestName());
|
|
|
-// Date date = admission.getCheckDate();
|
|
|
-// SimpleDateFormat dtf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
-// dto.setVistitDate(dtf.format(date));
|
|
|
-// dto.setVistitReason(admission.getTestLocation());
|
|
|
-// if (admission.getBillStatus() == 0) {
|
|
|
-// dto.setBillStatus("待审核");
|
|
|
-// } else if (admission.getBillStatus() == 1) {
|
|
|
-// dto.setBillStatus("合格");
|
|
|
-// } else if (admission.getBillStatus() == 2) {
|
|
|
-// dto.setBillStatus("异常");
|
|
|
-// } else if (admission.getBillStatus() == 3) {
|
|
|
-// dto.setBillStatus("失效");
|
|
|
-// }
|
|
|
-//
|
|
|
-// if (admission.getVistitType() == 0) {
|
|
|
-// dto.setVistitType("人员");
|
|
|
-// } else if (admission.getVistitType() == 1) {
|
|
|
-// dto.setVistitType("环保车");
|
|
|
-// } else if (admission.getVistitType() == 2) {
|
|
|
-// dto.setVistitType("拉猪车");
|
|
|
-// } else if (admission.getVistitType() == 3) {
|
|
|
-// dto.setVistitType("饲料车");
|
|
|
-// } else if (admission.getVistitType() == 4) {
|
|
|
-// dto.setVistitType("送猪车");
|
|
|
-// } else if (admission.getVistitType() == 5) {
|
|
|
-// dto.setVistitType("物资车");
|
|
|
-// }
|
|
|
-// list.add(dto);
|
|
|
-// }
|
|
|
-// context.putVar("list", list);
|
|
|
-// //生成
|
|
|
-// JxlsHelper.getInstance().processTemplate(is, os, context);
|
|
|
-// }
|
|
|
-//
|
|
|
-// public static void printClean(List<BillClean> admissionList) throws Exception {
|
|
|
-//
|
|
|
-// //准备数据
|
|
|
-// String path = "/opt/huatong/clean.xls";
|
|
|
-// //获取模板文件,你自己当前模板的位置 我这里为当前项目下
|
|
|
-// InputStream is = new FileInputStream("/opt/huatong/clean.xlsx");
|
|
|
-// //根据模板生成的文件保存路径 我这里保存在本地D盘
|
|
|
-// OutputStream os = new FileOutputStream(path);
|
|
|
-// //绑定数据
|
|
|
-// Context context = new Context();
|
|
|
-// List<PrintAdmissionDto> list = new ArrayList<>();
|
|
|
-// for (BillClean admission : admissionList) {
|
|
|
-// PrintAdmissionDto dto = new PrintAdmissionDto();
|
|
|
-// dto.setUserName(admission.getAdmissionUserName());
|
|
|
-// dto.setCarNum(admission.getCarNum());
|
|
|
-// dto.setPhone(admission.getPhone());
|
|
|
-// dto.setDestName(admission.getDestName());
|
|
|
-// Date date = admission.getCheckDate();
|
|
|
-// SimpleDateFormat dtf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
-// dto.setVistitDate(dtf.format(date));
|
|
|
-// dto.setVistitReason(admission.getTestLocation());
|
|
|
-// if (admission.getBillStatus() == 0) {
|
|
|
-// dto.setBillStatus("待审核");
|
|
|
-// } else if (admission.getBillStatus() == 1) {
|
|
|
-// dto.setBillStatus("合格");
|
|
|
-// } else if (admission.getBillStatus() == 2) {
|
|
|
-// dto.setBillStatus("异常");
|
|
|
-// } else if (admission.getBillStatus() == 3) {
|
|
|
-// dto.setBillStatus("失效");
|
|
|
-// }
|
|
|
-//
|
|
|
-// if (admission.getVistitType() == 0) {
|
|
|
-// dto.setVistitType("人员");
|
|
|
-// } else if (admission.getVistitType() == 1) {
|
|
|
-// dto.setVistitType("环保车");
|
|
|
-// } else if (admission.getVistitType() == 2) {
|
|
|
-// dto.setVistitType("拉猪车");
|
|
|
-// } else if (admission.getVistitType() == 3) {
|
|
|
-// dto.setVistitType("饲料车");
|
|
|
-// } else if (admission.getVistitType() == 4) {
|
|
|
-// dto.setVistitType("送猪车");
|
|
|
-// } else if (admission.getVistitType() == 5) {
|
|
|
-// dto.setVistitType("物资车");
|
|
|
-// }
|
|
|
-// list.add(dto);
|
|
|
-// }
|
|
|
-// context.putVar("list", list);
|
|
|
-// //生成
|
|
|
-// JxlsHelper.getInstance().processTemplate(is, os, context);
|
|
|
-// }
|
|
|
-//
|
|
|
-// public static void printLuggage(List<BillLuggage> admissionList) throws Exception {
|
|
|
-//
|
|
|
-// //准备数据
|
|
|
-// String path = "/opt/huatong/luggage.xls";
|
|
|
-// //获取模板文件,你自己当前模板的位置 我这里为当前项目下
|
|
|
-// InputStream is = new FileInputStream("/opt/huatong/luggage.xlsx");
|
|
|
-// //根据模板生成的文件保存路径 我这里保存在本地D盘
|
|
|
-// OutputStream os = new FileOutputStream(path);
|
|
|
-// //绑定数据
|
|
|
-// Context context = new Context();
|
|
|
-// List<PrintLuggageDto> list = new ArrayList<>();
|
|
|
-// for (BillLuggage admission : admissionList) {
|
|
|
-// PrintLuggageDto dto = new PrintLuggageDto();
|
|
|
-// dto.setUserName(admission.getUserName());
|
|
|
-// dto.setPhone(admission.getPhone());
|
|
|
-// LocalDateTime date = admission.getLuggageDate();
|
|
|
-// DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
-// dto.setVistitDate(dtf.format(date));
|
|
|
-// dto.setVistitReason(admission.getLuggageLocation());
|
|
|
-// dto.setBillStatus(admission.getLuggageNum().toString());
|
|
|
-// list.add(dto);
|
|
|
-// }
|
|
|
-// context.putVar("list", list);
|
|
|
-// //生成
|
|
|
-// JxlsHelper.getInstance().processTemplate(is, os, context);
|
|
|
-// }
|
|
|
-//
|
|
|
-// public static void printUser(List<SysUser> users) throws Exception {
|
|
|
-//
|
|
|
-// //准备数据
|
|
|
-// String path = "/opt/huatong/user.xls";
|
|
|
-// //获取模板文件,你自己当前模板的位置 我这里为当前项目下
|
|
|
-// InputStream is = new FileInputStream("/opt/huatong/user.xlsx");
|
|
|
-// //根据模板生成的文件保存路径 我这里保存在本地D盘
|
|
|
-// OutputStream os = new FileOutputStream(path);
|
|
|
-// //绑定数据
|
|
|
-// Context context = new Context();
|
|
|
-// List<SysUserVo> list = new ArrayList<>();
|
|
|
-// for (SysUser user : users) {
|
|
|
-// SysUserVo userVo = new SysUserVo();
|
|
|
-// userVo.setPhone(user.getUserPhone());
|
|
|
-// userVo.setUserName(user.getUserName());
|
|
|
-// userVo.setUserNum(user.getUserId());
|
|
|
-// if (user.getJob().equals("1")) {
|
|
|
-// userVo.setWorkName("场长");
|
|
|
-// } else if (user.getJob().equals("3")) {
|
|
|
-// userVo.setWorkName("生物安全负责人");
|
|
|
-// } else if (user.getJob().equals("4")) {
|
|
|
-// userVo.setWorkName("pcr检测人员");
|
|
|
-// } else if (user.getJob().equals("5")) {
|
|
|
-// userVo.setWorkName("洗消点工作人员");
|
|
|
-// }
|
|
|
-// if (user.getGender() == 0) {
|
|
|
-// userVo.setSex("男");
|
|
|
-// } else {
|
|
|
-// userVo.setSex("女");
|
|
|
-// }
|
|
|
-// userVo.setWorkLocation(user.getWorkLocation());
|
|
|
-// list.add(userVo);
|
|
|
-// }
|
|
|
-//
|
|
|
-// context.putVar("list", list);
|
|
|
-// //生成
|
|
|
-// JxlsHelper.getInstance().processTemplate(is, os, context);
|
|
|
-// }
|
|
|
-//
|
|
|
-// public static void printAccount(List<AccountVo> accountVos) throws Exception {
|
|
|
-//
|
|
|
-// //准备数据
|
|
|
-// String path = "/opt/huatong/account.xls";
|
|
|
-// //获取模板文件,你自己当前模板的位置 我这里为当前项目下
|
|
|
-// InputStream is = new FileInputStream("/opt/huatong/account.xlsx");
|
|
|
-// //根据模板生成的文件保存路径 我这里保存在本地D盘
|
|
|
-// OutputStream os = new FileOutputStream(path);
|
|
|
-// //绑定数据
|
|
|
-// Context context = new Context();
|
|
|
-//
|
|
|
-// context.putVar("list", accountVos);
|
|
|
-// //生成
|
|
|
-// JxlsHelper.getInstance().processTemplate(is, os, context);
|
|
|
-// }
|
|
|
-//
|
|
|
-// public static void printDevice(List<BaseDevice> devices) throws Exception {
|
|
|
-//
|
|
|
-// //准备数据
|
|
|
-// String path = "/opt/huatong/device.xls";
|
|
|
-// //获取模板文件,你自己当前模板的位置 我这里为当前项目下
|
|
|
-// InputStream is = new FileInputStream("/opt/huatong/device.xlsx");
|
|
|
-// //根据模板生成的文件保存路径 我这里保存在本地D盘
|
|
|
-// OutputStream os = new FileOutputStream(path);
|
|
|
-// //绑定数据
|
|
|
-// Context context = new Context();
|
|
|
-// List<DeviceVo> deviceVos = new ArrayList<>();
|
|
|
-//
|
|
|
-// for (BaseDevice device : devices) {
|
|
|
-// DeviceVo deviceVo = new DeviceVo();
|
|
|
-// deviceVo.setDeviceName(device.getDeviceName());
|
|
|
-// deviceVo.setDeviceNum(device.getDeviceCode());
|
|
|
-// deviceVo.setLocation(device.getWorkLocation());
|
|
|
-// deviceVo.setUserName(device.getUserName());
|
|
|
-// if (device.getDeviceStatus() == 0) {
|
|
|
-// deviceVo.setStatus("离线");
|
|
|
-// } else {
|
|
|
-// deviceVo.setStatus("在线");
|
|
|
-// }
|
|
|
-// deviceVos.add(deviceVo);
|
|
|
-// }
|
|
|
-// context.putVar("list", deviceVos);
|
|
|
-// //生成
|
|
|
-// JxlsHelper.getInstance().processTemplate(is, os, context);
|
|
|
-// }
|
|
|
-//
|
|
|
-//}
|
|
|
+package com.huimv.secure.common.utils;
|
|
|
+
|
|
|
+
|
|
|
+import com.huimv.secure.entity.*;
|
|
|
+import com.huimv.secure.entity.dto.PrintAdmissionDto;
|
|
|
+import com.huimv.secure.entity.dto.PrintIsolateDto;
|
|
|
+import com.huimv.secure.entity.dto.PrintLuggageDto;
|
|
|
+import com.huimv.secure.entity.vo.AccountVo;
|
|
|
+import com.huimv.secure.entity.vo.DeviceVo;
|
|
|
+import com.huimv.secure.entity.vo.SysUserVo;
|
|
|
+import org.jxls.common.Context;
|
|
|
+import org.jxls.util.JxlsHelper;
|
|
|
+
|
|
|
+import java.io.FileInputStream;
|
|
|
+import java.io.FileOutputStream;
|
|
|
+import java.io.InputStream;
|
|
|
+import java.io.OutputStream;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
+import java.time.LocalDateTime;
|
|
|
+import java.time.format.DateTimeFormatter;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Date;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+public class Print {
|
|
|
+ /**
|
|
|
+ * 打印方法 不插入图片
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ * @throws Exception
|
|
|
+ */
|
|
|
+ public static void printAdmission(List<BillPersonnelAdmission> admissionList) throws Exception {
|
|
|
+
|
|
|
+ //准备数据
|
|
|
+ String path = "/opt/huatong/admission.xls";
|
|
|
+ //获取模板文件,你自己当前模板的位置 我这里为当前项目下
|
|
|
+ InputStream is = new FileInputStream("/opt/huatong/admission.xlsx");
|
|
|
+ //根据模板生成的文件保存路径 我这里保存在本地D盘
|
|
|
+ OutputStream os = new FileOutputStream(path);
|
|
|
+ //绑定数据
|
|
|
+ Context context = new Context();
|
|
|
+ List<PrintAdmissionDto> list = new ArrayList<>();
|
|
|
+ for (BillPersonnelAdmission admission : admissionList) {
|
|
|
+ PrintAdmissionDto dto = new PrintAdmissionDto();
|
|
|
+ dto.setUserName(admission.getAdmissionUserName());
|
|
|
+ dto.setCarNum(admission.getCarNum());
|
|
|
+ dto.setPhone(admission.getPhone());
|
|
|
+ dto.setDestName(admission.getDestName());
|
|
|
+ LocalDateTime date = admission.getVistitDate();
|
|
|
+ DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
+ dto.setVistitDate(dtf.format(date));
|
|
|
+ dto.setVistitReason(admission.getVistitReson());
|
|
|
+ if (admission.getBillStatus() == 0) {
|
|
|
+ dto.setBillStatus("待审核");
|
|
|
+ } else if (admission.getBillStatus() == 1) {
|
|
|
+ dto.setBillStatus("通过");
|
|
|
+ } else if (admission.getBillStatus() == 2) {
|
|
|
+ dto.setBillStatus("拒绝");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (admission.getVistitType() == 0) {
|
|
|
+ dto.setVistitType("人员");
|
|
|
+ } else if (admission.getVistitType() == 1) {
|
|
|
+ dto.setVistitType("环保车");
|
|
|
+ } else if (admission.getVistitType() == 2) {
|
|
|
+ dto.setVistitType("拉猪车");
|
|
|
+ } else if (admission.getVistitType() == 3) {
|
|
|
+ dto.setVistitType("饲料车");
|
|
|
+ } else if (admission.getVistitType() == 4) {
|
|
|
+ dto.setVistitType("送猪车");
|
|
|
+ } else if (admission.getVistitType() == 5) {
|
|
|
+ dto.setVistitType("物资车");
|
|
|
+ }
|
|
|
+ list.add(dto);
|
|
|
+ }
|
|
|
+ context.putVar("list", list);
|
|
|
+ //生成
|
|
|
+ JxlsHelper.getInstance().processTemplate(is, os, context);
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void printIsolate(List<BillIsolate> isolateList) throws Exception {
|
|
|
+
|
|
|
+ //准备数据
|
|
|
+ String path = "/opt/huatong/isolate.xls";
|
|
|
+ //获取模板文件,你自己当前模板的位置 我这里为当前项目下
|
|
|
+ InputStream is = new FileInputStream("/opt/huatong/isolate.xlsx");
|
|
|
+ //根据模板生成的文件保存路径 我这里保存在本地D盘
|
|
|
+ OutputStream os = new FileOutputStream(path);
|
|
|
+ //绑定数据
|
|
|
+ Context context = new Context();
|
|
|
+ List<PrintIsolateDto> list = new ArrayList<>();
|
|
|
+ for (BillIsolate billIsolate : isolateList) {
|
|
|
+ PrintIsolateDto dto = new PrintIsolateDto();
|
|
|
+ dto.setDestName(billIsolate.getDestName());
|
|
|
+ dto.setPhone(billIsolate.getPhone());
|
|
|
+ dto.setUserName(billIsolate.getAdmissionUserName());
|
|
|
+ if (billIsolate.getBillStatus() == 0) {
|
|
|
+ dto.setStatus("待隔离");
|
|
|
+ } else if (billIsolate.getBillStatus() == 1) {
|
|
|
+ dto.setStatus("隔离中");
|
|
|
+ } else if (billIsolate.getBillStatus() == 2) {
|
|
|
+ dto.setStatus("已完成");
|
|
|
+ } else if (billIsolate.getBillStatus() == 3) {
|
|
|
+ dto.setStatus("提前解除");
|
|
|
+ }
|
|
|
+ dto.setLocation(billIsolate.getIsolateLocation());
|
|
|
+ dto.setNum(billIsolate.getIsolateDayNum());
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+ dto.setStartTime(sdf.format(billIsolate.getIsolateStartDate()));
|
|
|
+ dto.setEndTime(sdf.format(billIsolate.getIsolateEndDate()));
|
|
|
+ list.add(dto);
|
|
|
+ }
|
|
|
+ context.putVar("list", list);
|
|
|
+ //生成
|
|
|
+ JxlsHelper.getInstance().processTemplate(is, os, context);
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void printPcr(List<BillPcr> admissionList) throws Exception {
|
|
|
+
|
|
|
+ //准备数据
|
|
|
+ String path = "/opt/huatong/pcr.xls";
|
|
|
+ //获取模板文件,你自己当前模板的位置 我这里为当前项目下
|
|
|
+ InputStream is = new FileInputStream("/opt/huatong/pcr.xlsx");
|
|
|
+ //根据模板生成的文件保存路径 我这里保存在本地D盘
|
|
|
+ OutputStream os = new FileOutputStream(path);
|
|
|
+ //绑定数据
|
|
|
+ Context context = new Context();
|
|
|
+ List<PrintAdmissionDto> list = new ArrayList<>();
|
|
|
+ for (BillPcr admission : admissionList) {
|
|
|
+ PrintAdmissionDto dto = new PrintAdmissionDto();
|
|
|
+ dto.setUserName(admission.getAdmissionUserName());
|
|
|
+ dto.setCarNum(admission.getCarNum());
|
|
|
+ dto.setPhone(admission.getPhone());
|
|
|
+ dto.setDestName(admission.getDestName());
|
|
|
+ Date date = admission.getCheckDate();
|
|
|
+ SimpleDateFormat dtf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+ dto.setVistitDate(dtf.format(date));
|
|
|
+ dto.setVistitReason(admission.getTestLocation());
|
|
|
+ if (admission.getBillStatus() == 0) {
|
|
|
+ dto.setBillStatus("待审核");
|
|
|
+ } else if (admission.getBillStatus() == 1) {
|
|
|
+ dto.setBillStatus("合格");
|
|
|
+ } else if (admission.getBillStatus() == 2) {
|
|
|
+ dto.setBillStatus("异常");
|
|
|
+ } else if (admission.getBillStatus() == 3) {
|
|
|
+ dto.setBillStatus("失效");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (admission.getVistitType() == 0) {
|
|
|
+ dto.setVistitType("人员");
|
|
|
+ } else if (admission.getVistitType() == 1) {
|
|
|
+ dto.setVistitType("环保车");
|
|
|
+ } else if (admission.getVistitType() == 2) {
|
|
|
+ dto.setVistitType("拉猪车");
|
|
|
+ } else if (admission.getVistitType() == 3) {
|
|
|
+ dto.setVistitType("饲料车");
|
|
|
+ } else if (admission.getVistitType() == 4) {
|
|
|
+ dto.setVistitType("送猪车");
|
|
|
+ } else if (admission.getVistitType() == 5) {
|
|
|
+ dto.setVistitType("物资车");
|
|
|
+ }
|
|
|
+ list.add(dto);
|
|
|
+ }
|
|
|
+ context.putVar("list", list);
|
|
|
+ //生成
|
|
|
+ JxlsHelper.getInstance().processTemplate(is, os, context);
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void printClean(List<BillClean> admissionList) throws Exception {
|
|
|
+
|
|
|
+ //准备数据
|
|
|
+ String path = "/opt/huatong/clean.xls";
|
|
|
+ //获取模板文件,你自己当前模板的位置 我这里为当前项目下
|
|
|
+ InputStream is = new FileInputStream("/opt/huatong/clean.xlsx");
|
|
|
+ //根据模板生成的文件保存路径 我这里保存在本地D盘
|
|
|
+ OutputStream os = new FileOutputStream(path);
|
|
|
+ //绑定数据
|
|
|
+ Context context = new Context();
|
|
|
+ List<PrintAdmissionDto> list = new ArrayList<>();
|
|
|
+ for (BillClean admission : admissionList) {
|
|
|
+ PrintAdmissionDto dto = new PrintAdmissionDto();
|
|
|
+ dto.setUserName(admission.getAdmissionUserName());
|
|
|
+ dto.setCarNum(admission.getCarNum());
|
|
|
+ dto.setPhone(admission.getPhone());
|
|
|
+ dto.setDestName(admission.getDestName());
|
|
|
+ Date date = admission.getCheckDate();
|
|
|
+ SimpleDateFormat dtf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+ dto.setVistitDate(dtf.format(date));
|
|
|
+ dto.setVistitReason(admission.getTestLocation());
|
|
|
+ if (admission.getBillStatus() == 0) {
|
|
|
+ dto.setBillStatus("待审核");
|
|
|
+ } else if (admission.getBillStatus() == 1) {
|
|
|
+ dto.setBillStatus("合格");
|
|
|
+ } else if (admission.getBillStatus() == 2) {
|
|
|
+ dto.setBillStatus("异常");
|
|
|
+ } else if (admission.getBillStatus() == 3) {
|
|
|
+ dto.setBillStatus("失效");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (admission.getVistitType() == 0) {
|
|
|
+ dto.setVistitType("人员");
|
|
|
+ } else if (admission.getVistitType() == 1) {
|
|
|
+ dto.setVistitType("环保车");
|
|
|
+ } else if (admission.getVistitType() == 2) {
|
|
|
+ dto.setVistitType("拉猪车");
|
|
|
+ } else if (admission.getVistitType() == 3) {
|
|
|
+ dto.setVistitType("饲料车");
|
|
|
+ } else if (admission.getVistitType() == 4) {
|
|
|
+ dto.setVistitType("送猪车");
|
|
|
+ } else if (admission.getVistitType() == 5) {
|
|
|
+ dto.setVistitType("物资车");
|
|
|
+ }
|
|
|
+ list.add(dto);
|
|
|
+ }
|
|
|
+ context.putVar("list", list);
|
|
|
+ //生成
|
|
|
+ JxlsHelper.getInstance().processTemplate(is, os, context);
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void printLuggage(List<BillLuggage> admissionList) throws Exception {
|
|
|
+
|
|
|
+ //准备数据
|
|
|
+ String path = "/opt/huatong/luggage.xls";
|
|
|
+ //获取模板文件,你自己当前模板的位置 我这里为当前项目下
|
|
|
+ InputStream is = new FileInputStream("/opt/huatong/luggage.xlsx");
|
|
|
+ //根据模板生成的文件保存路径 我这里保存在本地D盘
|
|
|
+ OutputStream os = new FileOutputStream(path);
|
|
|
+ //绑定数据
|
|
|
+ Context context = new Context();
|
|
|
+ List<PrintLuggageDto> list = new ArrayList<>();
|
|
|
+ for (BillLuggage admission : admissionList) {
|
|
|
+ PrintLuggageDto dto = new PrintLuggageDto();
|
|
|
+ dto.setUserName(admission.getUserName());
|
|
|
+ dto.setPhone(admission.getPhone());
|
|
|
+ LocalDateTime date = admission.getLuggageDate();
|
|
|
+ DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
+ dto.setVistitDate(dtf.format(date));
|
|
|
+ dto.setVistitReason(admission.getLuggageLocation());
|
|
|
+ dto.setBillStatus(admission.getLuggageNum().toString());
|
|
|
+ list.add(dto);
|
|
|
+ }
|
|
|
+ context.putVar("list", list);
|
|
|
+ //生成
|
|
|
+ JxlsHelper.getInstance().processTemplate(is, os, context);
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void printUser(List<SysUser> users) throws Exception {
|
|
|
+
|
|
|
+ //准备数据
|
|
|
+ String path = "/opt/huatong/user.xls";
|
|
|
+ //获取模板文件,你自己当前模板的位置 我这里为当前项目下
|
|
|
+ InputStream is = new FileInputStream("/opt/huatong/user.xlsx");
|
|
|
+ //根据模板生成的文件保存路径 我这里保存在本地D盘
|
|
|
+ OutputStream os = new FileOutputStream(path);
|
|
|
+ //绑定数据
|
|
|
+ Context context = new Context();
|
|
|
+ List<SysUserVo> list = new ArrayList<>();
|
|
|
+ for (SysUser user : users) {
|
|
|
+ SysUserVo userVo = new SysUserVo();
|
|
|
+ userVo.setPhone(user.getUserPhone());
|
|
|
+ userVo.setUserName(user.getUserName());
|
|
|
+ userVo.setUserNum(user.getUserId());
|
|
|
+ if (user.getJob().equals("1")) {
|
|
|
+ userVo.setWorkName("场长");
|
|
|
+ } else if (user.getJob().equals("3")) {
|
|
|
+ userVo.setWorkName("生物安全负责人");
|
|
|
+ } else if (user.getJob().equals("4")) {
|
|
|
+ userVo.setWorkName("pcr检测人员");
|
|
|
+ } else if (user.getJob().equals("5")) {
|
|
|
+ userVo.setWorkName("洗消点工作人员");
|
|
|
+ }
|
|
|
+ if (user.getGender() == 0) {
|
|
|
+ userVo.setSex("男");
|
|
|
+ } else {
|
|
|
+ userVo.setSex("女");
|
|
|
+ }
|
|
|
+ userVo.setWorkLocation(user.getWorkLocation());
|
|
|
+ list.add(userVo);
|
|
|
+ }
|
|
|
+
|
|
|
+ context.putVar("list", list);
|
|
|
+ //生成
|
|
|
+ JxlsHelper.getInstance().processTemplate(is, os, context);
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void printAccount(List<AccountVo> accountVos) throws Exception {
|
|
|
+
|
|
|
+ //准备数据
|
|
|
+ String path = "/opt/huatong/account.xls";
|
|
|
+ //获取模板文件,你自己当前模板的位置 我这里为当前项目下
|
|
|
+ InputStream is = new FileInputStream("/opt/huatong/account.xlsx");
|
|
|
+ //根据模板生成的文件保存路径 我这里保存在本地D盘
|
|
|
+ OutputStream os = new FileOutputStream(path);
|
|
|
+ //绑定数据
|
|
|
+ Context context = new Context();
|
|
|
+
|
|
|
+ context.putVar("list", accountVos);
|
|
|
+ //生成
|
|
|
+ JxlsHelper.getInstance().processTemplate(is, os, context);
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void printDevice(List<BaseDevice> devices) throws Exception {
|
|
|
+
|
|
|
+ //准备数据
|
|
|
+ String path = "/opt/huatong/device.xls";
|
|
|
+ //获取模板文件,你自己当前模板的位置 我这里为当前项目下
|
|
|
+ InputStream is = new FileInputStream("/opt/huatong/device.xlsx");
|
|
|
+ //根据模板生成的文件保存路径 我这里保存在本地D盘
|
|
|
+ OutputStream os = new FileOutputStream(path);
|
|
|
+ //绑定数据
|
|
|
+ Context context = new Context();
|
|
|
+ List<DeviceVo> deviceVos = new ArrayList<>();
|
|
|
+
|
|
|
+ for (BaseDevice device : devices) {
|
|
|
+ DeviceVo deviceVo = new DeviceVo();
|
|
|
+ deviceVo.setDeviceName(device.getDeviceName());
|
|
|
+ deviceVo.setDeviceNum(device.getDeviceCode());
|
|
|
+ deviceVo.setLocation(device.getWorkLocation());
|
|
|
+ deviceVo.setUserName(device.getUserName());
|
|
|
+ if (device.getDeviceStatus() == 0) {
|
|
|
+ deviceVo.setStatus("离线");
|
|
|
+ } else {
|
|
|
+ deviceVo.setStatus("在线");
|
|
|
+ }
|
|
|
+ deviceVos.add(deviceVo);
|
|
|
+ }
|
|
|
+ context.putVar("list", deviceVos);
|
|
|
+ //生成
|
|
|
+ JxlsHelper.getInstance().processTemplate(is, os, context);
|
|
|
+ }
|
|
|
+
|
|
|
+}
|