|
@@ -7,10 +7,12 @@ import com.jpsoft.smart.modules.base.service.*;
|
|
import com.jpsoft.smart.modules.business.entity.WorkAttendance;
|
|
import com.jpsoft.smart.modules.business.entity.WorkAttendance;
|
|
import com.jpsoft.smart.modules.business.service.WorkAttendanceService;
|
|
import com.jpsoft.smart.modules.business.service.WorkAttendanceService;
|
|
import com.jpsoft.smart.modules.common.utils.OSSUtil;
|
|
import com.jpsoft.smart.modules.common.utils.OSSUtil;
|
|
|
|
+import com.jpsoft.smart.modules.common.utils.POIUtils;
|
|
import com.jpsoft.smart.modules.common.utils.WechatMessageUtil;
|
|
import com.jpsoft.smart.modules.common.utils.WechatMessageUtil;
|
|
import com.sun.corba.se.spi.orbutil.threadpool.Work;
|
|
import com.sun.corba.se.spi.orbutil.threadpool.Work;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
|
import org.apache.poi.ss.usermodel.Row;
|
|
import org.apache.poi.ss.usermodel.Row;
|
|
import org.apache.poi.ss.usermodel.Sheet;
|
|
import org.apache.poi.ss.usermodel.Sheet;
|
|
import org.apache.poi.ss.usermodel.Workbook;
|
|
import org.apache.poi.ss.usermodel.Workbook;
|
|
@@ -371,7 +373,7 @@ public class UnmeasureTemperatureAlarmTask {
|
|
&& pusher.getMissingNoticeEnabled()!=null && pusher.getMissingNoticeEnabled()) {
|
|
&& pusher.getMissingNoticeEnabled()!=null && pusher.getMissingNoticeEnabled()) {
|
|
String message = "尊敬的" + pusher.getName()
|
|
String message = "尊敬的" + pusher.getName()
|
|
+ ",当天时段" + startTime.toString("HH:mm") + "至" + endTime.toString("HH:mm")
|
|
+ ",当天时段" + startTime.toString("HH:mm") + "至" + endTime.toString("HH:mm")
|
|
- + ",有" + total + "人未测量体温,具体名单请点击下方链接查看。";
|
|
|
|
|
|
+ + ",有" + total + "人未测量体温,具体名单请点击下方【查看详情】下载人员名单";
|
|
|
|
|
|
//todo 生成未测量人员名单
|
|
//todo 生成未测量人员名单
|
|
|
|
|
|
@@ -387,7 +389,7 @@ public class UnmeasureTemperatureAlarmTask {
|
|
WechatMessageUtil.sendUnmeasureAlarmInfo(
|
|
WechatMessageUtil.sendUnmeasureAlarmInfo(
|
|
pusher.getOpenId(),
|
|
pusher.getOpenId(),
|
|
companyInfo.getName(),
|
|
companyInfo.getName(),
|
|
- message,
|
|
|
|
|
|
+ String.format(message,url),
|
|
url,
|
|
url,
|
|
wxConfig.getAppId(), wxConfig.getAppSecret());
|
|
wxConfig.getAppId(), wxConfig.getAppSecret());
|
|
}
|
|
}
|
|
@@ -395,81 +397,81 @@ public class UnmeasureTemperatureAlarmTask {
|
|
}
|
|
}
|
|
|
|
|
|
private String createUnMeasureReport(CompanyInfo companyInfo, List<PersonInfo> unmeasuredList, DateTime startTime, DateTime endTime) throws Exception{
|
|
private String createUnMeasureReport(CompanyInfo companyInfo, List<PersonInfo> unmeasuredList, DateTime startTime, DateTime endTime) throws Exception{
|
|
- ClassPathResource resource = new ClassPathResource("static/unMeasureReport.xlsx");
|
|
|
|
|
|
+ ClassPathResource resource = new ClassPathResource("static/unMeasureReport.xls");
|
|
|
|
|
|
- Workbook wb = WorkbookFactory.create(resource.getInputStream());
|
|
|
|
|
|
+ Workbook wb = WorkbookFactory.create(resource.getInputStream());
|
|
|
|
|
|
- Sheet sheet = wb.getSheetAt(0);
|
|
|
|
|
|
+ Sheet sheet = wb.getSheetAt(0);
|
|
|
|
|
|
- Row row1 = sheet.getRow(0);
|
|
|
|
- Row row2 = sheet.getRow(1);
|
|
|
|
- Row row3 = sheet.getRow(2);
|
|
|
|
|
|
+ Row row1 = sheet.getRow(0);
|
|
|
|
+ Row row2 = sheet.getRow(1);
|
|
|
|
+ Row row3 = sheet.getRow(2);
|
|
|
|
|
|
- String title = row1.getCell(0).getStringCellValue();
|
|
|
|
- String subTitle = row2.getCell(0).getStringCellValue();
|
|
|
|
|
|
+ String title = row1.getCell(0).getStringCellValue();
|
|
|
|
+ String subTitle = row2.getCell(0).getStringCellValue();
|
|
|
|
|
|
- row1.getCell(0).setCellValue(String.format(title, startTime.toString("HH:mm"), endTime.toString("HH:mm")));
|
|
|
|
- row2.getCell(0).setCellValue(String.format(subTitle, DateTime.now().toString("yyyy-MM-dd HH:mm")));
|
|
|
|
|
|
+ row1.getCell(0).setCellValue(String.format(title, startTime.toString("HH:mm"), endTime.toString("HH:mm")));
|
|
|
|
+ row2.getCell(0).setCellValue(String.format(subTitle, DateTime.now().toString("yyyy-MM-dd HH:mm")));
|
|
|
|
|
|
- //显示扩展字段
|
|
|
|
- List<CompanyPosition> companyPositions = companyPositionService.findByCompanyId(companyInfo.getId());
|
|
|
|
|
|
+ //显示扩展字段
|
|
|
|
+ List<CompanyPosition> companyPositions = companyPositionService.findByCompanyId(companyInfo.getId());
|
|
|
|
|
|
- if (companyPositions.size()>0){
|
|
|
|
- CompanyPosition companyPosition = companyPositions.get(0);
|
|
|
|
|
|
+ if (companyPositions.size()>0){
|
|
|
|
+ CompanyPosition companyPosition = companyPositions.get(0);
|
|
|
|
|
|
- if(StringUtils.isNotEmpty(companyPosition.getPosition1Name())) {
|
|
|
|
- row3.createCell(2).setCellValue(companyPosition.getPosition1Name());
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if(StringUtils.isNotEmpty(companyPosition.getPosition2Name())) {
|
|
|
|
- row3.createCell(3).setCellValue(companyPosition.getPosition2Name());
|
|
|
|
- }
|
|
|
|
|
|
+ if(StringUtils.isNotEmpty(companyPosition.getPosition1Name())) {
|
|
|
|
+ row3.createCell(3).setCellValue(companyPosition.getPosition1Name());
|
|
|
|
+ }
|
|
|
|
|
|
- if(StringUtils.isNotEmpty(companyPosition.getPosition3Name())) {
|
|
|
|
- row3.createCell(4).setCellValue(companyPosition.getPosition3Name());
|
|
|
|
- }
|
|
|
|
|
|
+ if(StringUtils.isNotEmpty(companyPosition.getPosition2Name())) {
|
|
|
|
+ row3.createCell(4).setCellValue(companyPosition.getPosition2Name());
|
|
|
|
+ }
|
|
|
|
|
|
- if(StringUtils.isNotEmpty(companyPosition.getPosition4Name())) {
|
|
|
|
- row3.createCell(5).setCellValue(companyPosition.getPosition4Name());
|
|
|
|
- }
|
|
|
|
|
|
+ if(StringUtils.isNotEmpty(companyPosition.getPosition3Name())) {
|
|
|
|
+ row3.createCell(5).setCellValue(companyPosition.getPosition3Name());
|
|
|
|
+ }
|
|
|
|
|
|
- if(StringUtils.isNotEmpty(companyPosition.getPosition5Name())) {
|
|
|
|
- row3.createCell(6).setCellValue(companyPosition.getPosition5Name());
|
|
|
|
- }
|
|
|
|
|
|
+ if(StringUtils.isNotEmpty(companyPosition.getPosition4Name())) {
|
|
|
|
+ row3.createCell(6).setCellValue(companyPosition.getPosition4Name());
|
|
}
|
|
}
|
|
|
|
|
|
- int rowIndex = 3;
|
|
|
|
|
|
+ if(StringUtils.isNotEmpty(companyPosition.getPosition5Name())) {
|
|
|
|
+ row3.createCell(7).setCellValue(companyPosition.getPosition5Name());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
- for (PersonInfo personInfo : unmeasuredList) {
|
|
|
|
- Row row = sheet.createRow(rowIndex);
|
|
|
|
- row.createCell(0).setCellValue(rowIndex-2);
|
|
|
|
- row.createCell(1).setCellValue(personInfo.getCompanyName());
|
|
|
|
- row.createCell(2).setCellValue(personInfo.getName());
|
|
|
|
- row.createCell(3).setCellValue(personInfo.getPosition1());
|
|
|
|
- row.createCell(4).setCellValue(personInfo.getPosition2());
|
|
|
|
- row.createCell(5).setCellValue(personInfo.getPosition3());
|
|
|
|
- row.createCell(6).setCellValue(personInfo.getPosition4());
|
|
|
|
- row.createCell(7).setCellValue(personInfo.getPosition4());
|
|
|
|
|
|
+ int rowIndex = 3;
|
|
|
|
|
|
- rowIndex++;
|
|
|
|
- }
|
|
|
|
|
|
+ for (PersonInfo personInfo : unmeasuredList) {
|
|
|
|
+ Row row = sheet.createRow(rowIndex);
|
|
|
|
+ row.createCell(0).setCellValue(rowIndex-2);
|
|
|
|
+ row.createCell(1).setCellValue(personInfo.getCompanyName());
|
|
|
|
+ row.createCell(2).setCellValue(personInfo.getName());
|
|
|
|
+ row.createCell(3).setCellValue(personInfo.getPosition1());
|
|
|
|
+ row.createCell(4).setCellValue(personInfo.getPosition2());
|
|
|
|
+ row.createCell(5).setCellValue(personInfo.getPosition3());
|
|
|
|
+ row.createCell(6).setCellValue(personInfo.getPosition4());
|
|
|
|
+ row.createCell(7).setCellValue(personInfo.getPosition4());
|
|
|
|
+
|
|
|
|
+ rowIndex++;
|
|
|
|
+ }
|
|
|
|
|
|
- //todo 将wb保存到oss
|
|
|
|
- ByteArrayOutputStream output = new ByteArrayOutputStream();
|
|
|
|
- wb.write(output);
|
|
|
|
|
|
+ //todo 将wb保存到oss
|
|
|
|
+ ByteArrayOutputStream output = new ByteArrayOutputStream();
|
|
|
|
+ wb.write(output);
|
|
|
|
+ byte[] buffer = output.toByteArray();
|
|
|
|
|
|
- byte[] buffer = output.toByteArray();
|
|
|
|
- ByteArrayInputStream input = new ByteArrayInputStream(buffer);
|
|
|
|
|
|
+ ByteArrayInputStream input = new ByteArrayInputStream(buffer);
|
|
|
|
|
|
- String fileName = "未测温统计表.xlsx";
|
|
|
|
|
|
+ String fileName = "未测温统计表.xls";
|
|
|
|
|
|
- String downloadUrl = OSSUtil.upload(ossConfig,"unmeasuredReport",fileName,input);
|
|
|
|
|
|
+ String downloadUrl = OSSUtil.upload(ossConfig, "unmeasuredReport", fileName, input);
|
|
|
|
|
|
- wb.write(output);
|
|
|
|
- wb.close();
|
|
|
|
- output.close();
|
|
|
|
|
|
+ wb.write(output);
|
|
|
|
+ wb.close();
|
|
|
|
+ output.close();
|
|
|
|
|
|
- return downloadUrl;
|
|
|
|
|
|
+ return downloadUrl;
|
|
}
|
|
}
|
|
|
|
|
|
public static void main(String[] args) {
|
|
public static void main(String[] args) {
|