|
|
@@ -11,6 +11,7 @@ import com.lc.ibps.common.system.persistence.entity.NewsPo;
|
|
|
import com.lc.ibps.components.quartz.BaseJob2;
|
|
|
import com.lc.ibps.org.party.persistence.dao.PartyUserCalendarDao;
|
|
|
import com.lc.ibps.org.party.persistence.entity.PartyUserCalendarPo;
|
|
|
+import com.lc.ibps.org.party.repository.PartyEmployeeRepository;
|
|
|
import org.quartz.JobDataMap;
|
|
|
import org.quartz.JobExecutionContext;
|
|
|
import org.slf4j.Logger;
|
|
|
@@ -34,6 +35,7 @@ public class PersonnelTrainJob extends BaseJob2 {
|
|
|
private final ICommonDao<?> commonDao = AppUtil.getBean(ICommonDao.class);
|
|
|
private final INewsMgrService newsMgrService = AppUtil.getBean(INewsMgrService.class);
|
|
|
private final PartyUserCalendarDao calendarDao = AppUtil.getBean(PartyUserCalendarDao.class);
|
|
|
+ private final PartyEmployeeRepository partyEmployeeRepository = AppUtil.getBean(PartyEmployeeRepository.class);
|
|
|
|
|
|
@Override
|
|
|
public void executeJob(JobExecutionContext context) throws Exception {
|
|
|
@@ -50,7 +52,9 @@ public class PersonnelTrainJob extends BaseJob2 {
|
|
|
}
|
|
|
String planDate = localDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
|
|
|
|
|
- String sql = "select p.id_,p.bian_zhi_ren_,e.name_,p.bian_zhi_bu_men_,d.name_ as dept_name_,p.pei_xun_shi_jian_ from t_rypxcjb p " +
|
|
|
+ String sql = "select p.id_,p.bian_zhi_ren_,e.name_,p.bian_zhi_bu_men_,d.name_ as dept_name_,p.pei_xun_nei_rong_," +
|
|
|
+ "date_format(p.pei_xun_shi_jian_,'%Y-%m-%d') pei_xun_shi_jian_,date_format(p.pei_xun_jie_shu_s,'%Y-%m-%d') " +
|
|
|
+ " pei_xun_jie_shu_s,p.pei_xun_ren_yuan_,p.pei_xun_di_dian_ from t_rypxcjb p " +
|
|
|
"left join ibps_party_employee e on e.id_=p.bian_zhi_ren_ " +
|
|
|
"left join ibps_party_position d on d.id_=p.bian_zhi_bu_men_ " +
|
|
|
"where shi_fou_guo_shen_ ='未发布' and pei_xun_shi_jian_ >=now() and pei_xun_shi_jian_<=date_add(now(), interval 1 week)";
|
|
|
@@ -58,7 +62,6 @@ public class PersonnelTrainJob extends BaseJob2 {
|
|
|
List<Map<String, Object>> pxList = (List<Map<String, Object>>) commonDao.query(sql);
|
|
|
|
|
|
if (BeanUtils.isNotEmpty(pxList)){
|
|
|
- String currentDateStr = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
|
|
for (Map<String, Object> train : pxList) {
|
|
|
String id = train.get("id_").toString();
|
|
|
String userId = train.get("bian_zhi_ren_").toString();
|
|
|
@@ -69,13 +72,39 @@ public class PersonnelTrainJob extends BaseJob2 {
|
|
|
|
|
|
NewsPo newsPo = new NewsPo();
|
|
|
newsPo.setAuthor(userName);
|
|
|
- newsPo.setContent("<p>关于参加全国两会培训的通知</p>");
|
|
|
+ String peiXunNeiRong = train.get("pei_xun_nei_rong_").toString();
|
|
|
+ String starDate = train.get("pei_xun_shi_jian_").toString();
|
|
|
+ String endDate = train.get("pei_xun_jie_shu_s").toString();
|
|
|
+ String didian = train.get("pei_xun_jie_shu_s").toString();
|
|
|
+
|
|
|
+ String nameIds = train.get("pei_xun_ren_yuan_").toString();
|
|
|
+ StringBuilder nameStr = new StringBuilder();
|
|
|
+ String[] ids = nameIds.split(",");
|
|
|
+ if (ids.length>1){
|
|
|
+ for (String str : ids){
|
|
|
+ String name = partyEmployeeRepository.get(str).getName();
|
|
|
+ nameStr.append(name).append(",");
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ nameStr = new StringBuilder(partyEmployeeRepository.get(nameIds).getName());
|
|
|
+ }
|
|
|
+
|
|
|
+ String content = "<p> " +
|
|
|
+ " " +
|
|
|
+ " <strong> "+peiXunNeiRong+"培训通知</strong></p >" +
|
|
|
+ "<p> <br/></p ><p><strong>一、培训主题:</strong></p ><p> ${pei_xun_nei_rong_}</p >" +
|
|
|
+ "<p><strong>二、时间安排:</strong></p ><p> 开始时间:"+starDate+" </p >" +
|
|
|
+ "<p> 结束时间:"+endDate+"</p ><p><strong>三、培训地点:</strong></p >" +
|
|
|
+ "<p> "+didian+"</p ><p><strong>四、参加人员:</strong></p >" +
|
|
|
+ "<p> "+nameStr+"</p ><p><br style=\"text-wrap: wrap;\"/></p ><p><br/></p >";
|
|
|
+
|
|
|
+ newsPo.setContent(content);
|
|
|
newsPo.setDepId(train.get("bian_zhi_bu_men_").toString());
|
|
|
newsPo.setDepName(deptName);
|
|
|
newsPo.setPublicDate(new Date());
|
|
|
newsPo.setPublicItem("notices");
|
|
|
newsPo.setStatus("publish");
|
|
|
- newsPo.setTitle("关于培训计划通知");
|
|
|
+ newsPo.setTitle("培训通知");
|
|
|
newsPo.setUserId(userId);
|
|
|
newsPo.setUserName(userName);
|
|
|
newsMgrService.save(newsPo);
|
|
|
@@ -84,9 +113,17 @@ public class PersonnelTrainJob extends BaseJob2 {
|
|
|
calendarPo.setUserId(userId);
|
|
|
calendarPo.setUserName(userName);
|
|
|
calendarPo.setTitle("关于培训计划通知");
|
|
|
- calendarPo.setContent("关于参加全国两会培训的通知");
|
|
|
- calendarPo.setStartTime(currentDateStr);
|
|
|
- calendarPo.setEmergencyState("3");
|
|
|
+
|
|
|
+ String neiRong = peiXunNeiRong+"培训通知:\n" +
|
|
|
+ " 1.培训主题: "+peiXunNeiRong+"\n" +
|
|
|
+ " 2.时间安排: 开始时间:"+starDate+" 结束时间:"+endDate+"\n" +
|
|
|
+ " 3.培训地点: "+didian+" \n" +
|
|
|
+ " 4.参加人员: "+nameStr;
|
|
|
+
|
|
|
+ calendarPo.setContent(neiRong);
|
|
|
+ calendarPo.setStartTime(starDate);
|
|
|
+ calendarPo.setEndTime(endDate);
|
|
|
+ calendarPo.setEmergencyState("2");
|
|
|
calendarPo.setId(UniqueIdUtil.getId());
|
|
|
calendarPo.setCreateBy(userId);
|
|
|
calendarDao.create(calendarPo);
|