Sfoglia il codice sorgente

功能增强: 把控制生成快照的功能移到后台运行

Li Yuan 2 anni fa
parent
commit
89aa43e26e

+ 1 - 1
ibps-bpmn-root/modules/bpmn-biz/src/main/java/com/lc/ibps/bpmn/helper/BpmInstBuilder.java

@@ -45,7 +45,7 @@ public class BpmInstBuilder {
 			BpmApproveRepository bpmApproveRepository = AppUtil.getBean(BpmApproveRepository.class);
 			List<BpmApprovePo> approveList = bpmApproveRepository.getByInstId(bpmInst.getId());
 			if(BeanUtils.isEmpty(approveList)) {
-				LOGGER.warn("流程实例不存在任务及审批意见,有可能数据出了问题,请检查数据");
+				LOGGER.warn("流程实例不存在任务及审批意见,有可能数据出了问题,请检查数据。 InstID=" + bpmInst.getId());
 				return;
 			}
 			String curNodeName = "";

+ 2 - 2
ibps-provider-root/modules/provider-platform/src/main/java/com/lc/ibps/config/InitialConfigure.java

@@ -11,7 +11,7 @@ import com.lc.ibps.cloud.config.AbstractInitialConfigure;
 @Configuration("platformInitialConfigure")
 public class InitialConfigure extends AbstractInitialConfigure {
 	@Bean
-	public IQueueConsumer<DefaultMessage<String>> rabbitSnapshotMessageQueueConsumer() {
-		return new RabbitSnapshotMessageQueueConsumer<DefaultMessage<String>>();
+	public RabbitSnapshotMessageQueueConsumer rabbitSnapshotMessageQueueConsumer() {
+		return new RabbitSnapshotMessageQueueConsumer();
 	}
 }

+ 10 - 21
ibps-provider-root/modules/provider-platform/src/main/java/com/lc/ibps/mq/consumer/rabbit/RabbitSnapshotMessageQueueConsumer.java

@@ -35,7 +35,7 @@ import java.util.Map;
                 value = @Queue(value = QueueConstants.Message.QUEUE_NAME_SNAPSHOT)
         )
 })
-public class RabbitSnapshotMessageQueueConsumer <M extends Message<String>> implements IQueueConsumer<M> {
+public class RabbitSnapshotMessageQueueConsumer   {
 
     private static Logger LOGGER = LoggerFactory.getLogger(RabbitSnapshotMessageQueueConsumer.class);
     @Autowired
@@ -56,16 +56,12 @@ public class RabbitSnapshotMessageQueueConsumer <M extends Message<String>> impl
     @Value("${runqian.base-path}")
     protected String runqianBasePath;
 
-//    @Resource
-//    private BpmInstHisRepository bpmInstHisRepository;
-
     @RabbitHandler
-    @Override
-    public void popup(M message) {
-        LOGGER.warn(message.toString());
+    public void popup(Message<String> message) throws Exception {
         String instId = message.getVariables().get("instId").toString();
         String userId = message.getVariables().get("userId").toString();
-
+        LOGGER.warn("processing snapshot with instId= " + instId);
+        Thread.sleep(10000);
 
         /*
         Step 1: fetch below sql by instId. if record returned, goto step 2,otherwise goto step 3.
@@ -85,12 +81,11 @@ public class RabbitSnapshotMessageQueueConsumer <M extends Message<String>> impl
             and then update table t_tsclb with field: "shi_fou_guo_shen"="已完成"  "kuai_zhao_": "1166694051567632384"
         Step 2.2: update table t_tsclb with field: "shi_fou_guo_shen"="已完成"
 
-        Step 3: waiting 30s and try it again.
+        Step 3: waiting 10s and try it again.
 
          */
 
         Map<String, Object> hisMap = commonDao.queryOne("SELECT PROC_DEF_KEY_,BIZ_KEY_,PROC_DEF_NAME_ FROM ibps_bpm_inst_his WHERE id_ = '" + instId + "' ");
-        //BpmInstHisPo instHis = bpmInstHisRepository.get(superProcInstId);
 
         if (BeanUtils.isNotEmpty(hisMap)){
 
@@ -106,21 +101,11 @@ public class RabbitSnapshotMessageQueueConsumer <M extends Message<String>> impl
                 String reportPath = "金通医学实验室管理系统/" + kzMap.get("bao_biao_lu_jing_");
 
                 String baseUrl = runqianServer + runqianBasePath + "/reportServlet?action=6&file=";
-                //  目前可用type    6:生成报表的pdf文件【默认】   7:生成报表的word文件   3:生成报表的excel文件
-                //            return `${BASE_URL}demo/reportServlet?action=${type}&file=${encodeURIComponent(reportPath + '/' + src)}
-                //            &print=1&srcType=file&paramString=${getParams(where)}`
-
-                try {
-                    reportPath = URLEncoder.encode(reportPath, "UTF-8");
-                } catch (UnsupportedEncodingException e) {
-                    e.printStackTrace();
-                }
+                reportPath = URLEncoder.encode(reportPath, "UTF-8");
                 String url = baseUrl + reportPath + "&print=1&srcType=file&paramString=id_%3D" + hisMap.get("BIZ_KEY_") + "&org_=" + org;
-
                 String formattedTime = new SimpleDateFormat("yyyyMMddHHmm").format(new Date());
                 String name = hisMap.get("PROC_DEF_NAME_") + formattedTime ;
 
-
                 DefaultPartyUserPo user = new DefaultPartyUserPo();
                 user.setUserId(userId);
                 user.setFullname(employeePo.getName());
@@ -135,11 +120,15 @@ public class RabbitSnapshotMessageQueueConsumer <M extends Message<String>> impl
                 sql.append("update t_").append(kzMap.get("tablekey_")).append(" set shi_fou_guo_shen_ = '已完成' ");
                 if (result.getState() == 200 && BeanUtils.isNotEmpty(result.getData())) {
                     sql.append(" , kuai_zhao_ = '").append(result.getData().getId()).append("' ");
+                    LOGGER.warn("Generated Snapshot ID=" + result.getData().getId());
                 }
                 sql.append(" where id_ = '").append(hisMap.get("BIZ_KEY_")).append("' ");
                 commonDao.execute(sql.toString());
             }
 
+        } else{
+            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.");
         }