|
@@ -5,6 +5,9 @@ import com.huimv.receive.entity.*;
|
|
|
import com.huimv.receive.entity.dto.PrintAdmissionDto;
|
|
|
import com.huimv.receive.entity.dto.PrintIsolateDto;
|
|
|
import com.huimv.receive.entity.dto.PrintLuggageDto;
|
|
|
+import com.huimv.receive.entity.vo.AccountVo;
|
|
|
+import com.huimv.receive.entity.vo.DeviceVo;
|
|
|
+import com.huimv.receive.entity.vo.SysUserVo;
|
|
|
import org.jxls.util.JxlsHelper;
|
|
|
import org.jxls.common.Context;
|
|
|
|
|
@@ -79,9 +82,9 @@ public class Print {
|
|
|
public static void printIsolate(List<BillIsolate> isolateList) throws Exception {
|
|
|
|
|
|
//准备数据
|
|
|
- String path = "G://isolate.xls";
|
|
|
+ String path = "/opt/huatong/isolate.xls";
|
|
|
//获取模板文件,你自己当前模板的位置 我这里为当前项目下
|
|
|
- InputStream is = new FileInputStream("G://isolate.xlsx");
|
|
|
+ InputStream is = new FileInputStream("/opt/huatong/isolate.xlsx");
|
|
|
//根据模板生成的文件保存路径 我这里保存在本地D盘
|
|
|
OutputStream os = new FileOutputStream(path);
|
|
|
//绑定数据
|
|
@@ -96,7 +99,7 @@ public class Print {
|
|
|
dto.setStatus("待隔离");
|
|
|
} else if (billIsolate.getBillStatus() == 1) {
|
|
|
dto.setStatus("隔离中");
|
|
|
- } else if (billIsolate.getBillStatus()==2) {
|
|
|
+ } else if (billIsolate.getBillStatus() == 2) {
|
|
|
dto.setStatus("已完成");
|
|
|
} else if (billIsolate.getBillStatus() == 3) {
|
|
|
dto.setStatus("提前解除");
|
|
@@ -116,9 +119,9 @@ public class Print {
|
|
|
public static void printPcr(List<BillPcr> admissionList) throws Exception {
|
|
|
|
|
|
//准备数据
|
|
|
- String path = "G://pcr.xls";
|
|
|
+ String path = "/opt/huatong/pcr.xls";
|
|
|
//获取模板文件,你自己当前模板的位置 我这里为当前项目下
|
|
|
- InputStream is = new FileInputStream("G://pcr.xlsx");
|
|
|
+ InputStream is = new FileInputStream("/opt/huatong/pcr.xlsx");
|
|
|
//根据模板生成的文件保存路径 我这里保存在本地D盘
|
|
|
OutputStream os = new FileOutputStream(path);
|
|
|
//绑定数据
|
|
@@ -140,8 +143,7 @@ public class Print {
|
|
|
dto.setBillStatus("合格");
|
|
|
} else if (admission.getBillStatus() == 2) {
|
|
|
dto.setBillStatus("异常");
|
|
|
- }
|
|
|
- else if (admission.getBillStatus() == 3) {
|
|
|
+ } else if (admission.getBillStatus() == 3) {
|
|
|
dto.setBillStatus("失效");
|
|
|
}
|
|
|
|
|
@@ -168,9 +170,9 @@ public class Print {
|
|
|
public static void printClean(List<BillClean> admissionList) throws Exception {
|
|
|
|
|
|
//准备数据
|
|
|
- String path = "G://clean.xls";
|
|
|
+ String path = "/opt/huatong/clean.xls";
|
|
|
//获取模板文件,你自己当前模板的位置 我这里为当前项目下
|
|
|
- InputStream is = new FileInputStream("G://clean.xlsx");
|
|
|
+ InputStream is = new FileInputStream("/opt/huatong/clean.xlsx");
|
|
|
//根据模板生成的文件保存路径 我这里保存在本地D盘
|
|
|
OutputStream os = new FileOutputStream(path);
|
|
|
//绑定数据
|
|
@@ -192,8 +194,7 @@ public class Print {
|
|
|
dto.setBillStatus("合格");
|
|
|
} else if (admission.getBillStatus() == 2) {
|
|
|
dto.setBillStatus("异常");
|
|
|
- }
|
|
|
- else if (admission.getBillStatus() == 3) {
|
|
|
+ } else if (admission.getBillStatus() == 3) {
|
|
|
dto.setBillStatus("失效");
|
|
|
}
|
|
|
|
|
@@ -220,9 +221,9 @@ public class Print {
|
|
|
public static void printLuggage(List<BillLuggage> admissionList) throws Exception {
|
|
|
|
|
|
//准备数据
|
|
|
- String path = "G://luggage.xls";
|
|
|
+ String path = "/opt/huatong/luggage.xls";
|
|
|
//获取模板文件,你自己当前模板的位置 我这里为当前项目下
|
|
|
- InputStream is = new FileInputStream("G://luggage.xlsx");
|
|
|
+ InputStream is = new FileInputStream("/opt/huatong/luggage.xlsx");
|
|
|
//根据模板生成的文件保存路径 我这里保存在本地D盘
|
|
|
OutputStream os = new FileOutputStream(path);
|
|
|
//绑定数据
|
|
@@ -244,4 +245,84 @@ public class Print {
|
|
|
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() == 1) {
|
|
|
+ userVo.setWorkName("场长");
|
|
|
+ } else if (user.getJob() == 3) {
|
|
|
+ userVo.setWorkName("生物安全负责人");
|
|
|
+ } else if (user.getJob() == 4) {
|
|
|
+ userVo.setWorkName("pcr检测人员");
|
|
|
+ } else if (user.getJob() == 5) {
|
|
|
+ userVo.setWorkName("洗消点工作人员");
|
|
|
+ }
|
|
|
+ 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);
|
|
|
+ }
|
|
|
+
|
|
|
}
|