|
@@ -20,7 +20,7 @@ import java.text.SimpleDateFormat;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
|
|
|
-@Component
|
|
|
+@Component("trainingRegularTask")
|
|
|
public class TrainingRegularTask extends BaseController {
|
|
|
|
|
|
@Autowired
|
|
@@ -35,12 +35,12 @@ public class TrainingRegularTask extends BaseController {
|
|
|
@Autowired
|
|
|
private ITAlarmPrincipalService alarmPrincipalService;
|
|
|
|
|
|
- public void execute() {
|
|
|
+ public void execute(Long deptId) {
|
|
|
try {
|
|
|
TTrainingRegular tTrainingRegular = new TTrainingRegular();
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
|
|
|
tTrainingRegular.setPlanDate(sdf.format(new Date()));
|
|
|
- tTrainingRegular.setDeptId(10010l);
|
|
|
+ tTrainingRegular.setDeptId(deptId);
|
|
|
List<TTrainingRegular> list = tTrainingRegularService.selectTTrainingRegularByPlanDate(tTrainingRegular);
|
|
|
IMailService mailService = (IMailService) SpringContextUtils.getBean("mailService");
|
|
|
logger.info("=====================本次装置培训计划清单:{}", list);
|
|
@@ -97,8 +97,12 @@ public class TrainingRegularTask extends BaseController {
|
|
|
//拼接html
|
|
|
String html = start + result + end;
|
|
|
logger.info("html:" + html);
|
|
|
- String emailCc = alarmPrincipal.getPrincipalEmail();
|
|
|
- mailService.sendHtmlMail(email, "您本月有装置培训计划 You have a device training plan for this month", html,emailCc);
|
|
|
+ if (deptId == 10010) {
|
|
|
+ String emailCc = alarmPrincipals.get(0).getPrincipalEmail();
|
|
|
+ mailService.sendHtmlMail(email, "您本月有装置培训计划 You have a device training plan for this month", html,emailCc);
|
|
|
+ }else if (deptId == 1003){
|
|
|
+ mailService.sendHtmlMail(email, "您本月有装置培训计划 You have a device training plan for this month", html);
|
|
|
+ }
|
|
|
} catch (Exception e) {
|
|
|
logger.error(e.getMessage(), e);
|
|
|
}
|