|
@@ -2,13 +2,10 @@ package com.lc.ibps.platform.plan.job;
|
|
|
|
|
|
|
|
import com.lc.ibps.base.core.util.AppUtil;
|
|
import com.lc.ibps.base.core.util.AppUtil;
|
|
|
import com.lc.ibps.base.core.util.BeanUtils;
|
|
import com.lc.ibps.base.core.util.BeanUtils;
|
|
|
-import com.lc.ibps.base.framework.id.UniqueIdUtil;
|
|
|
|
|
-import com.lc.ibps.base.framework.table.ICommonDao;
|
|
|
|
|
import com.lc.ibps.base.saas.token.ITenantTokenService;
|
|
import com.lc.ibps.base.saas.token.ITenantTokenService;
|
|
|
import com.lc.ibps.base.web.context.ContextUtil;
|
|
import com.lc.ibps.base.web.context.ContextUtil;
|
|
|
import com.lc.ibps.bpmn.api.IBpmInstService;
|
|
import com.lc.ibps.bpmn.api.IBpmInstService;
|
|
|
import com.lc.ibps.cloud.entity.APIResult;
|
|
import com.lc.ibps.cloud.entity.APIResult;
|
|
|
-import com.lc.ibps.components.quartz.BaseJob2;
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.quartz.JobExecutionContext;
|
|
import org.quartz.JobExecutionContext;
|
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
@@ -19,102 +16,46 @@ import java.util.Map;
|
|
|
|
|
|
|
|
public class RiskIdentificationJob extends AbstractJob {
|
|
public class RiskIdentificationJob extends AbstractJob {
|
|
|
|
|
|
|
|
- private static final Logger logger = LoggerFactory.getLogger(RiskIdentificationJob.class);
|
|
|
|
|
-
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public void executeJob(JobExecutionContext context) throws Exception {
|
|
public void executeJob(JobExecutionContext context) throws Exception {
|
|
|
//step1: update status to 识别中
|
|
//step1: update status to 识别中
|
|
|
updateStatusToShibieStep();
|
|
updateStatusToShibieStep();
|
|
|
//step2. add data to 降低风险项目登记表_子表(djbzb)
|
|
//step2. add data to 降低风险项目登记表_子表(djbzb)
|
|
|
- addDataToDjbzbStep();
|
|
|
|
|
|
|
+ insertRecordsFromTemplate("fxkz_step2");
|
|
|
//step3. 风险改进记录表(bmfxgjjl)
|
|
//step3. 风险改进记录表(bmfxgjjl)
|
|
|
- addDataToBmfxgjjlStep();
|
|
|
|
|
|
|
+ insertRecordsFromTemplate("fxkz_step3");
|
|
|
//step4. update status to 改进中
|
|
//step4. update status to 改进中
|
|
|
updateStatusToGaijingStep();
|
|
updateStatusToGaijingStep();
|
|
|
//step5. start flow by djbzb id
|
|
//step5. start flow by djbzb id
|
|
|
- startFlowStep();
|
|
|
|
|
|
|
+ startWorkflow("t_bmfxgjjl","bmfxgjjl", "Process_0jl7e02");
|
|
|
|
|
+
|
|
|
|
|
+ //step 6.1 创建风险报告
|
|
|
|
|
+ insertRecordsFromTemplate("fxkz_step6");
|
|
|
|
|
+ //step 6.2 启动风险报告流程
|
|
|
|
|
+ startWorkflow("t_fxkzbg","fxbg", "Process_0mrlsj7");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private void updateStatusToGaijingStep() {
|
|
private void updateStatusToGaijingStep() {
|
|
|
|
|
|
|
|
String fetchSql = "SELECT zong_id_ FROM t_fxssb WHERE zhuang_tai_='已识别'";
|
|
String fetchSql = "SELECT zong_id_ FROM t_fxssb WHERE zhuang_tai_='已识别'";
|
|
|
-
|
|
|
|
|
- String fetchSql2 = "SELECT a.zong_id_ FROM t_fxssb a,t_fxsbpgb b,t_fxsbpgbzb c " +
|
|
|
|
|
- " WHERE a.zong_id_= #{p0} AND a.zong_id_=b.zong_id_ AND a.zhuang_tai_='已识别' AND b.id_=c.parent_id_ " +
|
|
|
|
|
- " AND feng_xian_ying_du='风险降低' AND c.id_ NOT IN (SELECT parent_id_ FROM t_bmfxgjjl)";
|
|
|
|
|
String execSql = "UPDATE t_fxssb SET zhuang_tai_='改进中' WHERE zong_id_=#{p0}";
|
|
String execSql = "UPDATE t_fxssb SET zhuang_tai_='改进中' WHERE zong_id_=#{p0}";
|
|
|
-
|
|
|
|
|
List<Map<String, Object>> list = (List<Map<String, Object>>) commonDao.query(fetchSql);
|
|
List<Map<String, Object>> list = (List<Map<String, Object>>) commonDao.query(fetchSql);
|
|
|
if (BeanUtils.isEmpty(list)) return;
|
|
if (BeanUtils.isEmpty(list)) return;
|
|
|
for (Map<String, Object> map : list) {
|
|
for (Map<String, Object> map : list) {
|
|
|
- String[] zongIdS = {(String)map.get("zong_id_")};
|
|
|
|
|
- List zong_id_ = (List<Map<String, Object>>)commonDao.query(fetchSql2, zongIdS);
|
|
|
|
|
- if(BeanUtils.isEmpty(zong_id_)){
|
|
|
|
|
- commonDao.execute(execSql,zongIdS);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- private void startFlowStep() {
|
|
|
|
|
- String fetchSql = "SELECT id_ FROM t_bmfxgjjl WHERE shi_fou_guo_shen_ IS NULL";
|
|
|
|
|
- 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_")}, "bmfxgjjl", "Process_0jl7e02");
|
|
|
|
|
- result.getState();
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ String[] zongIdS = {(String) map.get("zong_id_")};
|
|
|
|
|
+ List zong_id_ = fetchRecords("fxkz_step4_fetch", zongIdS);
|
|
|
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- private void addDataToDjbzbStep() throws Exception {
|
|
|
|
|
- //降低风险项目登记表_子表(djbzb)
|
|
|
|
|
- String fetchSql = "SELECT c.id_ AS parent_id_,a.zong_id_,c.di_dian_,b.bian_zhi_ren_,b.bian_zhi_bu_men_,c.yao_su_tiao_kuan_, NOW() AS bian_zhi_shi_jian," +
|
|
|
|
|
- " c.gong_zuo_huan_jie,c.gong_zuo_miao_shu,c.feng_xian_miao_sh,c.feng_xian_zhi_shu, b.bian_zhi_ren_ AS create_by_, NOW() AS create_time_" +
|
|
|
|
|
- " FROM t_fxssb a,t_fxsbpgb b,t_fxsbpgbzb c " +
|
|
|
|
|
- " WHERE a.zong_id_=b.zong_id_ AND a.zhuang_tai_='已识别' AND b.id_=c.parent_id_ AND feng_xian_ying_du='风险降低' " +
|
|
|
|
|
- " AND c.id_ NOT IN (SELECT parent_id_ FROM t_Djbzb)";
|
|
|
|
|
- List<Map<String, Object>> list = (List<Map<String, Object>>) commonDao.query(fetchSql);
|
|
|
|
|
- if (BeanUtils.isEmpty(list)) return;
|
|
|
|
|
- for (Map<String, Object> map : list) {
|
|
|
|
|
- map.put("id_", UniqueIdUtil.getId());
|
|
|
|
|
- }
|
|
|
|
|
- generateRecords(list, "t_Djbzb");
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- private void addDataToBmfxgjjlStep() throws Exception {
|
|
|
|
|
- //风险改进记录表(bmfxgjjl)
|
|
|
|
|
-
|
|
|
|
|
- String fetchSql = "SELECT c.id_ AS parent_id_,a.zong_id_,a.shi_wu_shuo_ming_,c.di_dian_,b.bian_zhi_ren_,b.bian_zhi_bu_men_,c.yao_su_tiao_kuan_,b.zu_chang_,b.zu_chang_id_, NOW() AS bian_zhi_shi_jian," +
|
|
|
|
|
- " c.gong_zuo_huan_jie,c.gong_zuo_miao_shu,c.feng_xian_miao_sh,c.feng_xian_zhi_shu as yuan_zhi_shu_, b.bian_zhi_ren_ AS create_by_, NOW() AS create_time_" +
|
|
|
|
|
- " FROM t_fxssb a,t_fxsbpgb b,t_fxsbpgbzb c " +
|
|
|
|
|
- " WHERE a.zong_id_=b.zong_id_ AND a.zhuang_tai_='已识别' AND b.id_=c.parent_id_ AND feng_xian_ying_du='风险降低' " +
|
|
|
|
|
- " AND c.id_ NOT IN (SELECT parent_id_ FROM t_bmfxgjjl)";
|
|
|
|
|
- List<Map<String, Object>> list = (List<Map<String, Object>>) commonDao.query(fetchSql);
|
|
|
|
|
- if (BeanUtils.isEmpty(list)) return ;
|
|
|
|
|
- for (Map<String, Object> map : list) {
|
|
|
|
|
- map.put("id_", UniqueIdUtil.getId());
|
|
|
|
|
|
|
+ if (BeanUtils.isEmpty(zong_id_)) {
|
|
|
|
|
+ commonDao.execute(execSql, zongIdS);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- generateRecords(list, "t_bmfxgjjl");
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
private void updateStatusToShibieStep() {
|
|
private void updateStatusToShibieStep() {
|
|
|
- String fetchSql = "SELECT id_ FROM t_fxssb a " +
|
|
|
|
|
- " WHERE shi_fou_guo_shen_ = '已完成' AND (zhuang_tai_ = '识别中' OR zhuang_tai_ = '') AND zong_id_ NOT IN (" +
|
|
|
|
|
- " SELECT zong_id_ FROM t_fxsbpgb WHERE shi_fou_guo_shen_ <>'已完成' )";
|
|
|
|
|
-
|
|
|
|
|
String execSql = "UPDATE t_fxssb SET zhuang_tai_='已识别' WHERE id_=#{id_}";
|
|
String execSql = "UPDATE t_fxssb SET zhuang_tai_='已识别' WHERE id_=#{id_}";
|
|
|
- List<Map<String, Object>> list = (List<Map<String, Object>>) commonDao.query(fetchSql);
|
|
|
|
|
- commonDao.executeOfMaps(execSql, list);
|
|
|
|
|
-
|
|
|
|
|
|
|
+ List<Map<String, Object>> list = fetchRecords("fxkz_step1_fetch");
|
|
|
|
|
+ if (list != null) {
|
|
|
|
|
+ commonDao.executeOfMaps(execSql, list);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|