|
@@ -3,12 +3,22 @@ package com.ruoyi.project.production.service.impl;
|
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
|
import java.math.RoundingMode;
|
|
import java.math.RoundingMode;
|
|
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
+import com.ruoyi.common.sendEmail.IMailService;
|
|
|
|
|
+import com.ruoyi.common.thread.dailyProductionReport.DailyProductionReportMailThread;
|
|
|
|
|
+import com.ruoyi.project.plant.domain.TStaffmgr;
|
|
|
|
|
+import com.ruoyi.project.plant.service.ITStaffmgrService;
|
|
|
import com.ruoyi.project.production.controller.vo.DailyAnalysisDataVO;
|
|
import com.ruoyi.project.production.controller.vo.DailyAnalysisDataVO;
|
|
|
import com.ruoyi.project.production.mapper.TMonthlyProductionReportMapper;
|
|
import com.ruoyi.project.production.mapper.TMonthlyProductionReportMapper;
|
|
|
import com.ruoyi.project.production.service.impl.thread.SyncAfterDailyUpdateThread;
|
|
import com.ruoyi.project.production.service.impl.thread.SyncAfterDailyUpdateThread;
|
|
|
|
|
+import com.ruoyi.project.system.domain.SysDictData;
|
|
|
|
|
+import com.ruoyi.project.system.domain.SysUser;
|
|
|
|
|
+import com.ruoyi.project.system.service.ISysDictTypeService;
|
|
|
|
|
+import com.ruoyi.project.system.service.ISysMessageService;
|
|
|
|
|
+import com.ruoyi.project.system.service.ISysUserService;
|
|
|
import org.apache.poi.ss.usermodel.*;
|
|
import org.apache.poi.ss.usermodel.*;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
@@ -32,6 +42,18 @@ public class TDailyProductionReportServiceImpl implements ITDailyProductionRepor
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private TMonthlyProductionReportMapper tMonthlyProductionReportMapper;
|
|
private TMonthlyProductionReportMapper tMonthlyProductionReportMapper;
|
|
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private ISysDictTypeService iSysDictTypeService;
|
|
|
|
|
+
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private ITStaffmgrService staffmgrService;
|
|
|
|
|
+
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private ISysUserService userService;
|
|
|
|
|
+
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private IMailService mailService;
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 查询日期最新的每日生产报告
|
|
* 查询日期最新的每日生产报告
|
|
|
*
|
|
*
|
|
@@ -829,6 +851,27 @@ public class TDailyProductionReportServiceImpl implements ITDailyProductionRepor
|
|
|
this.tMonthlyProductionReportMapper
|
|
this.tMonthlyProductionReportMapper
|
|
|
);
|
|
);
|
|
|
syncAfterDailyUpdateThread.run();
|
|
syncAfterDailyUpdateThread.run();
|
|
|
|
|
+
|
|
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
|
|
|
|
|
+ if (sdf.format(new Date()).equals(sdf.format(reportDate))) {// 如果上传的文件是当天的
|
|
|
|
|
+ // 邮件提醒相关人员日报已更新
|
|
|
|
|
+ List<SysDictData> dictDataList = iSysDictTypeService.selectDictDataByType("DAILY_PRODUCTION_MAIL");
|
|
|
|
|
+ for (SysDictData sysDictData : dictDataList) {
|
|
|
|
|
+ String userId = sysDictData.getDictValue();
|
|
|
|
|
+ SysUser sysUser = userService.selectUserById(Long.parseLong(userId));
|
|
|
|
|
+ String staffId = sysUser.getStaffId();
|
|
|
|
|
+ String loginName = sysUser.getUserName();
|
|
|
|
|
+ TStaffmgr staffmgr = staffmgrService.selectTStaffmgrByStaffId(staffId);
|
|
|
|
|
+ String staffName = staffmgr.getName();
|
|
|
|
|
+ String email = sysUser.getEmail();
|
|
|
|
|
+ if (email != null) {
|
|
|
|
|
+ // 发送邮件
|
|
|
|
|
+ DailyProductionReportMailThread mailThread = new DailyProductionReportMailThread(mailService, email, staffName, loginName);
|
|
|
|
|
+ Thread thread = new Thread(mailThread);
|
|
|
|
|
+ thread.start();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
|
message = "导入失败,请联系管理员!";
|
|
message = "导入失败,请联系管理员!";
|