|
@@ -5,9 +5,13 @@ import cn.hutool.json.JSONObject;
|
|
|
import cn.hutool.json.JSONUtil;
|
|
import cn.hutool.json.JSONUtil;
|
|
|
import com.lc.ibps.api.form.sql.util.BeanUtils;
|
|
import com.lc.ibps.api.form.sql.util.BeanUtils;
|
|
|
import com.lc.ibps.base.core.constants.StringPool;
|
|
import com.lc.ibps.base.core.constants.StringPool;
|
|
|
|
|
+import com.lc.ibps.base.core.util.AppUtil;
|
|
|
|
|
+import com.lc.ibps.base.core.util.Collections;
|
|
|
import com.lc.ibps.base.framework.id.UniqueIdUtil;
|
|
import com.lc.ibps.base.framework.id.UniqueIdUtil;
|
|
|
import com.lc.ibps.base.framework.table.ICommonDao;
|
|
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.base.web.context.ContextUtil;
|
|
|
|
|
+import com.lc.ibps.bpmn.api.IBpmInstService;
|
|
|
import com.lc.ibps.business.service.AuditService;
|
|
import com.lc.ibps.business.service.AuditService;
|
|
|
import com.lc.ibps.cloud.entity.APIResult;
|
|
import com.lc.ibps.cloud.entity.APIResult;
|
|
|
import com.lc.ibps.cloud.message.util.MessageQueueProductorUtil;
|
|
import com.lc.ibps.cloud.message.util.MessageQueueProductorUtil;
|
|
@@ -24,6 +28,7 @@ import java.text.SimpleDateFormat;
|
|
|
import java.time.LocalDate;
|
|
import java.time.LocalDate;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
import java.time.format.DateTimeFormatter;
|
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* @author Administrator
|
|
* @author Administrator
|
|
@@ -524,4 +529,70 @@ public class AuditServiceImpl implements AuditService {
|
|
|
return sql.toString();
|
|
return sql.toString();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public APIResult<Map<String, Object>> Approval(String id) throws Exception {
|
|
|
|
|
+ APIResult<Map<String,Object>> result = new APIResult<>();
|
|
|
|
|
+ String sql = "select t_rksbjhbzb.*,t_rksbjhb.id_ as zhuId,t_rksbjhb.di_dian_ as zhuDiDian ,t_rksbjhb.ping_shen_lei_xin as pslx ,t_rksbjhb.shen_bao_shi_jian as sbsj "+
|
|
|
|
|
+ " t_rksbjhb.ping_shen_shi_jia as xcpssj,t_rksbjhb.nian_du_ as nd "+
|
|
|
|
|
+ " from t_rksbjhbzb join t_rksbjhb on t_rksbjhbzb.parent_id_ = t_rksbjhb.id_ where t_rksbjhb.id_ = '" + id +"'";
|
|
|
|
|
+ List<Map<String,Object>> query = (List<Map<String,Object>>) commonDao.query(sql);
|
|
|
|
|
+ if(Collections.isNotEmpty(query)){
|
|
|
|
|
+ //封装流程的数据
|
|
|
|
|
+ IBpmInstService bpmInstService = AppUtil.getBean(IBpmInstService.class);
|
|
|
|
|
+ if (StringUtils.isBlank(ContextUtil.getCurrentAccessToken())) {
|
|
|
|
|
+ ITenantTokenService tenantTokenService = AppUtil.getBean(ITenantTokenService.class);
|
|
|
|
|
+ String accessToken = tenantTokenService.getAccessToken();
|
|
|
|
|
+ ContextUtil.setCurrentAccessToken(accessToken);
|
|
|
|
|
+ }
|
|
|
|
|
+ //封装bo
|
|
|
|
|
+ List<String> idArr = new ArrayList<>();
|
|
|
|
|
+ List<String> oldIds = new ArrayList<>();
|
|
|
|
|
+ for (Map<String,Object> item :query) {
|
|
|
|
|
+ oldIds.add(item.get("id_").toString());
|
|
|
|
|
+ String use = item.get("fu_ze_ren_").toString();
|
|
|
|
|
+ String[] userIds = use.split(",");
|
|
|
|
|
+ for (String uid: userIds) {
|
|
|
|
|
+ Map<String, Object> itemMap = new HashMap<>();
|
|
|
|
|
+ String boId = UniqueIdUtil.getId();
|
|
|
|
|
+ itemMap.put("id_",boId);
|
|
|
|
|
+ idArr.add(boId);
|
|
|
|
|
+ itemMap.put("create_time_", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
|
|
|
|
|
+ itemMap.put("create_by_",'1');
|
|
|
|
|
+ itemMap.put("update_time_",new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
|
|
|
|
|
+ itemMap.put("di_dian_",item.get("zhuDiDian").toString());
|
|
|
|
|
+ itemMap.put("bian_zhi_ren_",uid);
|
|
|
|
|
+ itemMap.put("ping_shen_lei_xin",BeanUtils.isNotEmpty(item.get("pslx")) ? item.get("pslx").toString():"");
|
|
|
|
|
+ itemMap.put("shen_bao_shi_jian",BeanUtils.isNotEmpty(item.get("sbsj")) ? item.get("sbsj").toString():"");
|
|
|
|
|
+ itemMap.put("ping_shen_shi_jia",BeanUtils.isNotEmpty(item.get("xcpssj")) ? item.get("xcpssj").toString():"");
|
|
|
|
|
+ itemMap.put("nian_du_",BeanUtils.isNotEmpty(item.get("nd")) ? item.get("nd").toString():"");
|
|
|
|
|
+ itemMap.put("pai_xu_hao_",item.get("pai_xu_hao_").toString());
|
|
|
|
|
+ itemMap.put("wen_jian_ming_che",item.get("wen_jian_ming_che").toString());
|
|
|
|
|
+ itemMap.put("wen_jian_shuo_min",item.get("wen_jian_shuo_min").toString());
|
|
|
|
|
+ itemMap.put("tian_xie_shuo_min",BeanUtils.isNotEmpty(item.get("tian_xie_shuo_min"))?item.get("tian_xie_shuo_min").toString():"");
|
|
|
|
|
+ itemMap.put("zhu_yi_shi_xiang_",BeanUtils.isNotEmpty(item.get("zhu_yi_shi_xiang_"))?item.get("zhu_yi_shi_xiang_").toString():"");
|
|
|
|
|
+ itemMap.put("fu_ze_ren_",uid);
|
|
|
|
|
+ itemMap.put("wan_cheng_qi_xian",item.get("wan_cheng_qi_xian").toString());
|
|
|
|
|
+ itemMap.put("ji_hua_zhu_biao_i",item.get("zhuId").toString());
|
|
|
|
|
+ itemMap.put("ji_hua_zi_biao_id",item.get("id_").toString());
|
|
|
|
|
+ commonDao.execute(this.buildInsertSql(itemMap, "t_rksbclb"));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ String[] strings = idArr.toArray(new String[0]);
|
|
|
|
|
+ APIResult<String> apiResult = bpmInstService.startFlowFromList(strings, "rksbclb", "Process_0d1f058");
|
|
|
|
|
+ int state = apiResult.getState();
|
|
|
|
|
+ if("200".equals(String.valueOf(state))){
|
|
|
|
|
+ //已经推送过流程的数据防止重复推送,yi_tui_song_=1 表示数据是yi_tui_song_推送的数据
|
|
|
|
|
+ String join = String.join(",", oldIds);
|
|
|
|
|
+ String upSql = "UPDATE t_rksbjhbzb SET yi_tui_song_ = '1' where find_in_set(id_,'"+ join + "') ";
|
|
|
|
|
+ commonDao.execute(upSql);
|
|
|
|
|
+ }
|
|
|
|
|
+ result.setState(200);
|
|
|
|
|
+ result.setMessage("请求成功");
|
|
|
|
|
+ }else{
|
|
|
|
|
+ result.setState(404);
|
|
|
|
|
+ log.warn("当前id查询不到对应的数据,id是" + id);
|
|
|
|
|
+ result.setMessage("数据为空,请确认后再操作");
|
|
|
|
|
+ }
|
|
|
|
|
+ return result;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|