|
@@ -26,6 +26,7 @@ import java.io.UnsupportedEncodingException;
|
|
|
import java.net.URLEncoder;
|
|
import java.net.URLEncoder;
|
|
|
import java.text.SimpleDateFormat;
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
|
|
|
+import java.util.List;
|
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
@RabbitListener(bindings = {
|
|
@RabbitListener(bindings = {
|
|
@@ -87,53 +88,72 @@ public class RabbitSnapshotMessageQueueConsumer {
|
|
|
Map<String, Object> hisMap = commonDao.queryOne("SELECT PROC_DEF_KEY_,BIZ_KEY_,PROC_DEF_NAME_ FROM ibps_bpm_inst_his WHERE id_ = '" + instId + "' ");
|
|
Map<String, Object> hisMap = commonDao.queryOne("SELECT PROC_DEF_KEY_,BIZ_KEY_,PROC_DEF_NAME_ FROM ibps_bpm_inst_his WHERE id_ = '" + instId + "' ");
|
|
|
|
|
|
|
|
if (BeanUtils.isNotEmpty(hisMap)){
|
|
if (BeanUtils.isNotEmpty(hisMap)){
|
|
|
-
|
|
|
|
|
|
|
+ String procDefKey = hisMap.get("PROC_DEF_KEY_").toString();
|
|
|
|
|
+ String bizKey = hisMap.get("BIZ_KEY_").toString();
|
|
|
|
|
+ String procDefName = hisMap.get("PROC_DEF_NAME_").toString();
|
|
|
Map<String, Object> kzMap = commonDao.queryOne(" SELECT ti_jiao_kuai_zhao,bao_biao_lu_jing_,tablekey_ FROM t_lcidglbdbb " +
|
|
Map<String, Object> kzMap = commonDao.queryOne(" SELECT ti_jiao_kuai_zhao,bao_biao_lu_jing_,tablekey_ FROM t_lcidglbdbb " +
|
|
|
- "where liu_cheng_xuan_ze = '" + hisMap.get("PROC_DEF_KEY_") + "' AND gui_dang_lei_xing = 'process' limit 1");
|
|
|
|
|
- APIResult<AttachmentPo> result = new APIResult<>();
|
|
|
|
|
|
|
+ "where liu_cheng_xuan_ze = '"+procDefKey+"' AND gui_dang_lei_xing = 'process' limit 1");
|
|
|
|
|
|
|
|
if (BeanUtils.isNotEmpty(kzMap) && kzMap.containsKey("ti_jiao_kuai_zhao") &&
|
|
if (BeanUtils.isNotEmpty(kzMap) && kzMap.containsKey("ti_jiao_kuai_zhao") &&
|
|
|
BeanUtils.isNotEmpty(kzMap.get("ti_jiao_kuai_zhao")) && "是".equals(kzMap.get("ti_jiao_kuai_zhao")) ) {
|
|
BeanUtils.isNotEmpty(kzMap.get("ti_jiao_kuai_zhao")) && "是".equals(kzMap.get("ti_jiao_kuai_zhao")) ) {
|
|
|
LOGGER.warn("processing snapshot with instId= " + instId);
|
|
LOGGER.warn("processing snapshot with instId= " + instId);
|
|
|
PartyEmployeePo employeePo = partyEmployeeRepository.get(userId);
|
|
PartyEmployeePo employeePo = partyEmployeeRepository.get(userId);
|
|
|
- String position = employeePo.getPositions().split(",")[0];
|
|
|
|
|
|
|
+ String position = employeePo.getPositions().split(StringPool.COMMA)[0];
|
|
|
PartyEntityPo entityPo = partyEntityRepository.get(position);
|
|
PartyEntityPo entityPo = partyEntityRepository.get(position);
|
|
|
- String org = entityPo.getPath().split("\\.")[0];
|
|
|
|
|
|
|
+ String org = entityPo.getPath().split(StringPool.BACK_SLASH+StringPool.DOT)[0];
|
|
|
String reportPath = "金通医学实验室管理系统/" + kzMap.get("bao_biao_lu_jing_");
|
|
String reportPath = "金通医学实验室管理系统/" + kzMap.get("bao_biao_lu_jing_");
|
|
|
-
|
|
|
|
|
- String baseUrl = runqianServer + runqianBasePath + "/reportServlet?action=6&file=";
|
|
|
|
|
reportPath = URLEncoder.encode(reportPath, "UTF-8");
|
|
reportPath = URLEncoder.encode(reportPath, "UTF-8");
|
|
|
- String url = baseUrl + reportPath + "&print=1&srcType=file¶mString=id_%3D" + hisMap.get("BIZ_KEY_") + "&org_=" + org;
|
|
|
|
|
- String formattedTime = new SimpleDateFormat("yyyyMMddHHmm").format(new Date());
|
|
|
|
|
- String name = hisMap.get("PROC_DEF_NAME_") + formattedTime ;
|
|
|
|
|
-
|
|
|
|
|
|
|
+ String baseUrl = runqianServer + runqianBasePath + "/reportServlet?action=6&file=";
|
|
|
DefaultPartyUserPo user = new DefaultPartyUserPo();
|
|
DefaultPartyUserPo user = new DefaultPartyUserPo();
|
|
|
user.setUserId(userId);
|
|
user.setUserId(userId);
|
|
|
user.setFullname(employeePo.getName());
|
|
user.setFullname(employeePo.getName());
|
|
|
user.setAccount(employeePo.getAccount());
|
|
user.setAccount(employeePo.getAccount());
|
|
|
ContextUtil.setCurrentUser(user);
|
|
ContextUtil.setCurrentUser(user);
|
|
|
|
|
|
|
|
- result = uploadFile.runQianUpload(url , name , StringPool.FileType.Office.PDF );
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- Map<String, Object> defMap = commonDao.queryOne("select BO_CODE_ from ibps_bpm_def where DEF_KEY_ = '" + hisMap.get("PROC_DEF_KEY_") + "' ");
|
|
|
|
|
- if (BeanUtils.isNotEmpty(defMap)) {
|
|
|
|
|
- if (result.getState() == 200 && BeanUtils.isNotEmpty(result.getData())) {
|
|
|
|
|
- String sql = "update t_" + defMap.get("BO_CODE_") + " set kuai_zhao_ = '" + result.getData().getId() + "' where id_ = '" + hisMap.get("BIZ_KEY_") + "' ";
|
|
|
|
|
- commonDao.execute(sql);
|
|
|
|
|
- LOGGER.warn("Generated Snapshot ID=" + result.getData().getId());
|
|
|
|
|
|
|
+ // 文件批量新增修订记录表 需要根据子表(t_wjxzxdjlb)生成各自的快照 流程绑定的是主表(t_wjxdzb)
|
|
|
|
|
+ // 生成的快照文件名 取文件修订子表 xiu_ding_wen_jian 字段值 ,若该字段值为空则取 wen_jian_ming_che 字段
|
|
|
|
|
+ if ("Process_1ek5omy_2".equals(procDefKey)){
|
|
|
|
|
+ String fileSql = "select id_,parent_id_,xiu_ding_wen_jian,wen_jian_ming_che from t_wjxzxdjlb where parent_id_ = '"+bizKey+"'";
|
|
|
|
|
+ List<Map<String,Object>> list = (List<Map<String, Object>>) commonDao.query(fileSql);
|
|
|
|
|
+ if (BeanUtils.isNotEmpty(list)){
|
|
|
|
|
+ for (Map<String,Object> map : list){
|
|
|
|
|
+ procDefName = (String) (BeanUtils.isNotEmpty(map.get("xiu_ding_wen_jian"))?map.get("xiu_ding_wen_jian"):map.get("wen_jian_ming_che"));
|
|
|
|
|
+ bizKey = (String) map.get("id_");
|
|
|
|
|
+ updateKuaiZhao(procDefKey,procDefName,bizKey,baseUrl,reportPath,org);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }else {
|
|
|
|
|
+ updateKuaiZhao(procDefKey,procDefName,bizKey,baseUrl,reportPath,org);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
} else{
|
|
} else{
|
|
|
LOGGER.warn("can't find any record. it will be tried it again. instId=" +instId);
|
|
LOGGER.warn("can't find any record. it will be tried it again. instId=" +instId);
|
|
|
throw new Exception("can't find any record. it will be tried it again.");
|
|
throw new Exception("can't find any record. it will be tried it again.");
|
|
|
}
|
|
}
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 把生成的快照附件id 回填到对应的业务表快照字段
|
|
|
|
|
+ */
|
|
|
|
|
+ private void updateKuaiZhao(String procDefKey,String procDefName,String bizKey,String baseUrl,String reportPath,String org){
|
|
|
|
|
+ String url = baseUrl + reportPath + "&print=1&srcType=file¶mString=id_%3D"+bizKey+"&org_="+org;
|
|
|
|
|
+ String name = procDefName + new SimpleDateFormat("yyyyMMddHHmm").format(new Date());
|
|
|
|
|
+ APIResult<AttachmentPo> result = uploadFile.runQianUpload(url , name , StringPool.FileType.Office.PDF );
|
|
|
|
|
+ Map<String, Object> defMap = commonDao.queryOne("select BO_CODE_ from ibps_bpm_def where DEF_KEY_ = '"+procDefKey+"' ");
|
|
|
|
|
+ if (BeanUtils.isNotEmpty(defMap)) {
|
|
|
|
|
+ if (result.getState() == 200 && BeanUtils.isNotEmpty(result.getData())) {
|
|
|
|
|
+ String sql = "";
|
|
|
|
|
+ if ("Process_1ek5omy_2".equals(procDefKey)){
|
|
|
|
|
+ sql = "update t_wjxzxdjlb set kuai_zhao_='"+result.getData().getId()+"' where id_='"+bizKey+"'";
|
|
|
|
|
+ }else {
|
|
|
|
|
+ sql = "update t_" + defMap.get("BO_CODE_") + " set kuai_zhao_ = '" + result.getData().getId() + "' where id_ = '"+bizKey+"'";
|
|
|
|
|
+ }
|
|
|
|
|
+ commonDao.execute(sql);
|
|
|
|
|
+ LOGGER.warn("Generated Snapshot ID=" + result.getData().getId());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
}
|
|
}
|