|
|
@@ -3,11 +3,17 @@ package com.lc.ibps.platform.plan.job;
|
|
|
import com.lc.ibps.base.core.util.AppUtil;
|
|
|
import com.lc.ibps.base.core.util.Collections;
|
|
|
import com.lc.ibps.base.framework.table.ICommonDao;
|
|
|
+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 org.apache.commons.lang3.StringUtils;
|
|
|
import org.quartz.JobExecutionContext;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
|
import java.time.Year;
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
@@ -19,17 +25,15 @@ public class ApprovalDeclarationJob extends AbstractJob{
|
|
|
|
|
|
@Override
|
|
|
public void executeJob(JobExecutionContext context) throws Exception {
|
|
|
- //查询当前年度的计划子表中带推送的数据
|
|
|
+ //查询材料表中带推送的数据
|
|
|
List<Map<String, Object>> all = selectAll();
|
|
|
|
|
|
- //根据时间筛选今天需要推送的数据(待明确需求后补充补充)
|
|
|
-
|
|
|
+ startBpm(all);
|
|
|
}
|
|
|
|
|
|
public List<Map<String,Object>> selectAll(){
|
|
|
//查询当前年度已完成的计划对应的子表的未推送的数据
|
|
|
- String sql = " select t_rksbjhbzb.*,t_rksbjhb.id_ as zhuId from t_rksbjhbzb join t_rksbjhb on t_rksbjhbzb.parent_id_ = t_rksbjhb.id_ where t_rksbjhb.nian_du_ = '"
|
|
|
- + CURRENT_YEAR +"' and t_rksbjhb.shi_fou_guo_shen_ = '已完成' and t_rksbjhbzb.yi_tui_song_ <> '1'";
|
|
|
+ String sql = " select * from t_rksbclb where shi_fou_tui_song_ = '0' ";
|
|
|
List<Map<String,Object>> query = (List<Map<String,Object>>) commonDao.query(sql);
|
|
|
if(Collections.isNotEmpty(query)){
|
|
|
logger.warn("查询到待推送的认可计划数据:",query);
|
|
|
@@ -37,4 +41,27 @@ public class ApprovalDeclarationJob extends AbstractJob{
|
|
|
}
|
|
|
return null;
|
|
|
}
|
|
|
+
|
|
|
+ public void startBpm(List<Map<String,Object>> all){
|
|
|
+ if(Collections.isNotEmpty(all)){
|
|
|
+ IBpmInstService bpmInstService = AppUtil.getBean(IBpmInstService.class);
|
|
|
+ if (StringUtils.isBlank(ContextUtil.getCurrentAccessToken())) {
|
|
|
+ ITenantTokenService tenantTokenService = AppUtil.getBean(ITenantTokenService.class);
|
|
|
+ String accessToken = tenantTokenService.getAccessToken();
|
|
|
+ ContextUtil.setCurrentAccessToken(accessToken);
|
|
|
+ }
|
|
|
+ List<String> list = new ArrayList<>();
|
|
|
+ for (Map<String,Object> item : all) {
|
|
|
+ list.add(item.get("id_").toString());
|
|
|
+ }
|
|
|
+ String join = String.join(",", list);
|
|
|
+ String[] strings = list.toArray(new String[0]);
|
|
|
+ APIResult<String> apiResult = bpmInstService.startFlowFromList(strings, "rksbclb", "Process_0d1f058");
|
|
|
+ if("200".equals(String.valueOf(apiResult.getState()))){
|
|
|
+ String upSql = "UPDATE t_rksbclb SET shi_fou_tui_song_ = '1' where find_in_set(id_,'"+ join + "') ";
|
|
|
+ commonDao.execute(upSql);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
}
|