Browse Source

自动上传优化

lihong 2 years ago
parent
commit
4204ed4522
1 changed files with 14 additions and 9 deletions
  1. 14 9
      src/main/java/thyyxxk/webserver/scheduled/UploadBillingList.java

+ 14 - 9
src/main/java/thyyxxk/webserver/scheduled/UploadBillingList.java

@@ -1,6 +1,7 @@
 package thyyxxk.webserver.scheduled;
 
 import cn.hutool.core.date.DateUtil;
+import cn.hutool.extra.spring.SpringUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.scheduling.annotation.Scheduled;
@@ -13,6 +14,7 @@ import thyyxxk.webserver.service.medicalinsurance.SetlListUpldService;
 import thyyxxk.webserver.utils.ListUtil;
 import thyyxxk.webserver.utils.StringUtil;
 
+import javax.annotation.PostConstruct;
 import java.util.Date;
 import java.util.List;
 
@@ -22,16 +24,17 @@ import java.util.List;
 @Component
 @Slf4j
 public class UploadBillingList {
-    private final SetlListUpldService service;
-    private final UpIdCollectionDao dao;
+    private  SetlListUpldService service;
+    private  UpIdCollectionDao dao;
 
     @Value("${execute-scheduled}")
     private Boolean executeScheduled;
-
-    public UploadBillingList(SetlListUpldService service, UpIdCollectionDao dao) {
-        this.service = service;
-        this.dao = dao;
-    }
+    //Scheduled 注解优先级高于资源注入,会报错
+    @PostConstruct
+   public void init(){
+       this.service = SpringUtil.getBean(SetlListUpldService.class);
+       this.dao = SpringUtil.getBean(UpIdCollectionDao.class);
+   }
 
     @Scheduled(cron = "0 30 21 * * ?")
     public void uploadStatement() {
@@ -44,9 +47,11 @@ public class UploadBillingList {
         //审核通过的数据
         log.info("结算单上传定时任务开启");
         List<SiSetlinfoTemp> qualityPassData = dao.getQualityPass(firstDate);
+        log.info("本次自动上传审核通过的数据有{}条",qualityPassData.size());
         uploadSetLData(qualityPassData);
         //上传大于6天的数据
         List<SiSetlinfoTemp> list = dao.getBillingPatientsToday(firstDate);
+        log.info("本次自动上传大于6天的数据数据有{}条",list.size());
         uploadSetLData(list);
         log.info("上传结束");
     }
@@ -59,9 +64,9 @@ public class UploadBillingList {
                     log.info("正在上传 ==> 住院号:{},住院次数:{},账页号:{}", item.getPatNo(), item.getTimes(), item.getLedgerSn());
                     ResultVo<String> resultVo = service.upldSetlList(item.getPatNo(), item.getTimes(), item.getLedgerSn(),false);
                    Integer flag =  resultVo.getCode()==200 ? AutoUploadBill.FLAG.UPLOAD_SUCCESS.getCode() : AutoUploadBill.FLAG.UPLOAD_FAIL.getCode();
-                    dao.insertAutoLongPassError(item.getPatNo(), item.getTimes(), item.getLedgerSn(), resultVo.getMessage(), AutoUploadBill.TypeFlag.AUTO_UPLOAD.getCode(),flag ,uploadDate,item.getSetlTime());
+                    dao.insertAutoLongPassError(item.getPatNo(), item.getTimes(), item.getLedgerSn(), resultVo.getMessage()==null?"":resultVo.getMessage(), AutoUploadBill.TypeFlag.AUTO_UPLOAD.getCode(),flag ,uploadDate,item.getSetlTime());
                 } catch (Exception e) {
-                    dao.insertAutoLongPassError(item.getPatNo(), item.getTimes(), item.getLedgerSn(), e.getMessage(),AutoUploadBill.TypeFlag.AUTO_UPLOAD.getCode(),AutoUploadBill.FLAG.UPLOAD_FAIL.getCode(), uploadDate,item.getSetlTime());
+                    dao.insertAutoLongPassError(item.getPatNo(), item.getTimes(), item.getLedgerSn(), e.getMessage()==null?"":e.getMessage(),AutoUploadBill.TypeFlag.AUTO_UPLOAD.getCode(),AutoUploadBill.FLAG.UPLOAD_FAIL.getCode(), uploadDate,item.getSetlTime());
                     log.info("上传错误", e);
                 }
             }