|
@@ -14,6 +14,7 @@ import com.lc.ibps.cloud.message.util.MessageQueueProductorUtil;
|
|
|
import com.lc.ibps.org.party.persistence.dao.PartyUserCalendarDao;
|
|
import com.lc.ibps.org.party.persistence.dao.PartyUserCalendarDao;
|
|
|
import com.lc.ibps.org.party.persistence.entity.PartyUserCalendarPo;
|
|
import com.lc.ibps.org.party.persistence.entity.PartyUserCalendarPo;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
+import org.codehaus.jackson.map.ObjectMapper;
|
|
|
import org.jetbrains.annotations.NotNull;
|
|
import org.jetbrains.annotations.NotNull;
|
|
|
import org.quartz.JobDataMap;
|
|
import org.quartz.JobDataMap;
|
|
|
import org.quartz.JobExecutionContext;
|
|
import org.quartz.JobExecutionContext;
|
|
@@ -35,6 +36,7 @@ public class EquipmentMaintenancePlanJob extends AbstractJob {
|
|
|
private final PartyUserCalendarDao calendarDao = AppUtil.getBean(PartyUserCalendarDao.class);
|
|
private final PartyUserCalendarDao calendarDao = AppUtil.getBean(PartyUserCalendarDao.class);
|
|
|
public static final String HS_DAY1 = "日保养";
|
|
public static final String HS_DAY1 = "日保养";
|
|
|
public static final String HS_DAY2 = "每天";
|
|
public static final String HS_DAY2 = "每天";
|
|
|
|
|
+ private static final int DEFAULT_ADVANCE_DAYS = 30;
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public void executeJob(JobExecutionContext context) throws Exception {
|
|
public void executeJob(JobExecutionContext context) throws Exception {
|
|
@@ -404,13 +406,14 @@ public class EquipmentMaintenancePlanJob extends AbstractJob {
|
|
|
"WHERE b.shi_fou_guo_shen_ = '已完成' and a.ji_hua_ri_qi_<>'' and a.ji_hua_ri_qi_ is not null " +
|
|
"WHERE b.shi_fou_guo_shen_ = '已完成' and a.ji_hua_ri_qi_<>'' and a.ji_hua_ri_qi_ is not null " +
|
|
|
"AND a.ji_hua_ri_qi_ <= DATE_ADD(CURDATE(), INTERVAL 30 DAY) AND a.ji_hua_ri_qi_>= CURRENT_DATE AND a.shi_fou_guo_shen_='待处理' " +
|
|
"AND a.ji_hua_ri_qi_ <= DATE_ADD(CURDATE(), INTERVAL 30 DAY) AND a.ji_hua_ri_qi_>= CURRENT_DATE AND a.shi_fou_guo_shen_='待处理' " +
|
|
|
"AND (a.dsrw_ is null or a.dsrw_ ='') ";*/
|
|
"AND (a.dsrw_ is null or a.dsrw_ ='') ";*/
|
|
|
|
|
+ int advanceDays = getAdvanceDays();//华创启德提前90天推送
|
|
|
String sql = "UPDATE t_mjsbjdxzjhzb a " +
|
|
String sql = "UPDATE t_mjsbjdxzjhzb a " +
|
|
|
"JOIN t_mjsbjdxzjh b ON a.parent_id_ = b.id_ " +
|
|
"JOIN t_mjsbjdxzjh b ON a.parent_id_ = b.id_ " +
|
|
|
"JOIN t_sbdj d ON a.she_bei_bian_hao_ = d.id_ " +
|
|
"JOIN t_sbdj d ON a.she_bei_bian_hao_ = d.id_ " +
|
|
|
"SET a.marks_ = 'record' " +
|
|
"SET a.marks_ = 'record' " +
|
|
|
"WHERE b.shi_fou_guo_shen_ = '已完成' " +
|
|
"WHERE b.shi_fou_guo_shen_ = '已完成' " +
|
|
|
" AND a.ji_hua_ri_qi_ <> '' AND a.ji_hua_ri_qi_ IS NOT NULL " +
|
|
" AND a.ji_hua_ri_qi_ <> '' AND a.ji_hua_ri_qi_ IS NOT NULL " +
|
|
|
- " AND a.ji_hua_ri_qi_ <= DATE_ADD(CURDATE(), INTERVAL 30 DAY) " +
|
|
|
|
|
|
|
+ " AND a.ji_hua_ri_qi_ <= DATE_ADD(CURDATE(), INTERVAL "+advanceDays+" DAY) " +
|
|
|
" AND a.ji_hua_ri_qi_ >= CURRENT_DATE " +
|
|
" AND a.ji_hua_ri_qi_ >= CURRENT_DATE " +
|
|
|
" AND a.shi_fou_guo_shen_ = '待处理' " +
|
|
" AND a.shi_fou_guo_shen_ = '待处理' " +
|
|
|
" AND (a.dsrw_ IS NULL OR a.dsrw_ = '') " +
|
|
" AND (a.dsrw_ IS NULL OR a.dsrw_ = '') " +
|
|
@@ -597,6 +600,7 @@ public class EquipmentMaintenancePlanJob extends AbstractJob {
|
|
|
"where b.shi_fou_guo_shen_='已完成' and a.marks_ = 'record' and a.ji_hua_ri_qi_<>'' and a.ji_hua_ri_qi_ is not null " +
|
|
"where b.shi_fou_guo_shen_='已完成' and a.marks_ = 'record' and a.ji_hua_ri_qi_<>'' and a.ji_hua_ri_qi_ is not null " +
|
|
|
" and a.ji_hua_ri_qi_<=DATE_ADD(CURDATE(),INTERVAL 30 DAY) and a.ji_hua_ri_qi_>=CURRENT_DATE and a.shi_fou_guo_shen_='待处理' " +
|
|
" and a.ji_hua_ri_qi_<=DATE_ADD(CURDATE(),INTERVAL 30 DAY) and a.ji_hua_ri_qi_>=CURRENT_DATE and a.shi_fou_guo_shen_='待处理' " +
|
|
|
" AND (a.dsrw_ is null or a.dsrw_ ='') ";*/
|
|
" AND (a.dsrw_ is null or a.dsrw_ ='') ";*/
|
|
|
|
|
+ int advanceDays = getAdvanceDays();
|
|
|
String fetchSql = "SELECT a.id_ id_ " +
|
|
String fetchSql = "SELECT a.id_ id_ " +
|
|
|
"FROM t_mjsbjdxzjhzb a " +
|
|
"FROM t_mjsbjdxzjhzb a " +
|
|
|
"INNER JOIN t_mjsbjdxzjh b ON a.parent_id_ = b.id_ " +
|
|
"INNER JOIN t_mjsbjdxzjh b ON a.parent_id_ = b.id_ " +
|
|
@@ -604,7 +608,7 @@ public class EquipmentMaintenancePlanJob extends AbstractJob {
|
|
|
"WHERE b.shi_fou_guo_shen_ = '已完成' " +
|
|
"WHERE b.shi_fou_guo_shen_ = '已完成' " +
|
|
|
" AND a.marks_ = 'record' " +
|
|
" AND a.marks_ = 'record' " +
|
|
|
" AND a.ji_hua_ri_qi_ <> '' AND a.ji_hua_ri_qi_ IS NOT NULL " +
|
|
" AND a.ji_hua_ri_qi_ <> '' AND a.ji_hua_ri_qi_ IS NOT NULL " +
|
|
|
- " AND a.ji_hua_ri_qi_ <= DATE_ADD(CURDATE(), INTERVAL 30 DAY) " +
|
|
|
|
|
|
|
+ " AND a.ji_hua_ri_qi_ <= DATE_ADD(CURDATE(), INTERVAL "+advanceDays+" DAY) " +
|
|
|
" AND a.ji_hua_ri_qi_ >= CURRENT_DATE " +
|
|
" AND a.ji_hua_ri_qi_ >= CURRENT_DATE " +
|
|
|
" AND a.shi_fou_guo_shen_ = '待处理' " +
|
|
" AND a.shi_fou_guo_shen_ = '待处理' " +
|
|
|
" AND (a.dsrw_ IS NULL OR a.dsrw_ = '') " +
|
|
" AND (a.dsrw_ IS NULL OR a.dsrw_ = '') " +
|
|
@@ -638,6 +642,22 @@ public class EquipmentMaintenancePlanJob extends AbstractJob {
|
|
|
}
|
|
}
|
|
|
return danWeiMingChen;
|
|
return danWeiMingChen;
|
|
|
}
|
|
}
|
|
|
|
|
+ private int getAdvanceDays() {
|
|
|
|
|
+ try {
|
|
|
|
|
+ String setting = ContextUtil.getSetting();
|
|
|
|
|
+ if (StringUtils.isNotEmpty(setting)) {
|
|
|
|
|
+ ObjectMapper objectMapper = new ObjectMapper();
|
|
|
|
|
+ Map<String, Object> map = objectMapper.readValue(setting, Map.class);
|
|
|
|
|
+ if (map != null && map.containsKey(ADVANCE_DAYS)) {
|
|
|
|
|
+ return Integer.parseInt(map.get(ADVANCE_DAYS).toString());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ logger.warn("从setting中读取advance_days失败,使用默认值{}天", DEFAULT_ADVANCE_DAYS, e);
|
|
|
|
|
+ }
|
|
|
|
|
+ return DEFAULT_ADVANCE_DAYS;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
public String convertToSqlInFormat(String input) {
|
|
public String convertToSqlInFormat(String input) {
|
|
|
String[] parts = input.split(",");
|
|
String[] parts = input.split(",");
|
|
|
String quoted = String.join("','", parts); // 用 ',' 连接
|
|
String quoted = String.join("','", parts); // 用 ',' 连接
|