|
|
@@ -6,9 +6,13 @@ import com.lc.ibps.base.core.util.JacksonUtil;
|
|
|
import com.lc.ibps.base.core.util.string.StringUtil;
|
|
|
import com.lc.ibps.base.framework.id.UniqueIdUtil;
|
|
|
import com.lc.ibps.base.framework.table.ICommonDao;
|
|
|
-import com.lc.ibps.cloud.message.util.MessageQueueProductorUtil;
|
|
|
+import com.lc.ibps.base.saas.token.ITenantTokenService;
|
|
|
+import com.lc.ibps.base.web.context.ContextUtil;
|
|
|
+import com.lc.ibps.bpmn.api.IBpmInstService;
|
|
|
+import com.lc.ibps.cloud.entity.APIResult;
|
|
|
import com.lc.ibps.org.party.persistence.dao.PartyUserCalendarDao;
|
|
|
import com.lc.ibps.org.party.persistence.entity.PartyUserCalendarPo;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.jetbrains.annotations.NotNull;
|
|
|
import org.quartz.JobDataMap;
|
|
|
import org.quartz.JobExecutionContext;
|
|
|
@@ -18,7 +22,6 @@ import org.slf4j.LoggerFactory;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.time.LocalDate;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
-import java.time.format.DateTimeParseException;
|
|
|
import java.util.*;
|
|
|
|
|
|
public class EquipmentMaintenancePlanJob extends AbstractJob {
|
|
|
@@ -160,10 +163,16 @@ public class EquipmentMaintenancePlanJob extends AbstractJob {
|
|
|
// 开流程推送到负责人(设备档案卡t_sbdj中的保管人guan_li_ren_)
|
|
|
// 根据主表流程结束的数据查询子表 当前日期加30天==子表计划日期即开启检定校准记录流程
|
|
|
// 1917 设备检定校准改进
|
|
|
- insertRecordsFromTemplate("sbjdjzjl");
|
|
|
+ // insertRecordsFromTemplate("sbjdjzjl");
|
|
|
+
|
|
|
+ // 2025-03-31 修改 不再新增校准记录,用计划记录开流程
|
|
|
+ String sql = "UPDATE t_mjsbjdxzjhzb a JOIN t_mjsbjdxzjh b ON a.parent_id_ = b.id_ SET a.marks_ = 'record' " +
|
|
|
+ "WHERE b.shi_fou_guo_shen_ = '已完成' AND a.ji_hua_ri_qi_ <= DATE_ADD(CURDATE(), INTERVAL 30 DAY) " +
|
|
|
+ "AND a.ji_hua_ri_qi_ >= CURRENT_DATE";
|
|
|
+ commonDao.execute(sql);
|
|
|
|
|
|
// 检定/校准计划与实施记录表_子表
|
|
|
- startWorkflow("t_mjsbjdxzjhzb","jdxzjlb","Process_1drpy0r","");
|
|
|
+ this.startWorkflow("t_mjsbjdxzjhzb","jdxzjlb","Process_1drpy0r");
|
|
|
}
|
|
|
|
|
|
// 设备档案增加使用年限字段,并且到期提前1年提醒设备保管人到期,需要进行报废的消息
|
|
|
@@ -228,4 +237,27 @@ public class EquipmentMaintenancePlanJob extends AbstractJob {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ protected void startWorkflow(String tableName, String formKey, String defKey) {
|
|
|
+ String fetchSql = "SELECT a.id_ id_ FROM t_mjsbjdxzjhzb a " +
|
|
|
+ "inner join t_mjsbjdxzjh b on a.parent_id_=b.id_ " +
|
|
|
+ "where b.shi_fou_guo_shen_='已完成' and a.marks_ = 'record' " +
|
|
|
+ "and a.ji_hua_ri_qi_<=DATE_ADD(CURDATE(), INTERVAL 30 DAY) " +
|
|
|
+ "and a.ji_hua_ri_qi_>=CURRENT_DATE and a.update_time_ is null ";
|
|
|
+ fetchSql = String.format(fetchSql,tableName);
|
|
|
+ List<Map<String, Object>> list = (List<Map<String, Object>>) commonDao.query(fetchSql);
|
|
|
+ if (BeanUtils.isEmpty(list)) return;
|
|
|
+ IBpmInstService bpmInstService = AppUtil.getBean(IBpmInstService.class);
|
|
|
+ if (StringUtils.isBlank(ContextUtil.getCurrentAccessToken())) {
|
|
|
+ ITenantTokenService tenantTokenService = AppUtil.getBean(ITenantTokenService.class);
|
|
|
+ String accessToken = tenantTokenService.getAccessToken();
|
|
|
+ ContextUtil.setCurrentAccessToken(accessToken);
|
|
|
+ }
|
|
|
+ for (Map<String, Object> objectMap : list) {
|
|
|
+ APIResult<String> result = bpmInstService.startFlowFromList(new String[]{(String) objectMap.get("id_")}, formKey, defKey,"");
|
|
|
+ result.getState();
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
}
|