Переглянути джерело

益寿缘-解决循环依赖的问题

cgp 3 тижнів тому
батько
коміт
c19bdb4bea

+ 3 - 0
fs-service/src/main/java/com/fs/his/service/IFsPrescribeService.java

@@ -116,6 +116,9 @@ public interface IFsPrescribeService
 
     void confirmPrescribe(FsPrescribeParam param);
 
+    //手动生成带医生签名的处方图片
+    public void createDoctorSignImg(FsPrescribe fsPrescribe);
+
     void collectionPrescribe(Long prescribeId);
 
     void delUrl(Long prescribeId);

+ 8 - 3
fs-service/src/main/java/com/fs/his/service/impl/FsPrescribeServiceImpl.java

@@ -41,6 +41,7 @@ import org.apache.http.util.Asserts;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.ApplicationContext;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
@@ -129,7 +130,11 @@ public class FsPrescribeServiceImpl implements IFsPrescribeService
     private IFsUserInformationCollectionService fsUserInformationCollectionService;
 
     @Autowired
-    private FsPrescribeServiceImpl currentProxy;//注入自身,避免使用this.调用本类方法事务失效
+    private ApplicationContext applicationContext;
+
+    private IFsPrescribeService self() {
+        return applicationContext.getBean(IFsPrescribeService.class);
+    }
 
     /**
      * 查询处方
@@ -1402,13 +1407,13 @@ public class FsPrescribeServiceImpl implements IFsPrescribeService
             }
         }
         //医生确认处方后立即生成处方图片
-        currentProxy.createDoctorSignImg(fsPrescribe);
+        self().createDoctorSignImg(fsPrescribe);
     }
 
     //手动生成带医生签名的处方图片
     public void createDoctorSignImg(FsPrescribe fsPrescribe) {
         if(fsPrescribe != null&& fsPrescribe.getPrescribeId() != null) {
-            String prescribeImgUrl = currentProxy.prescribeImgYsyTask(fsPrescribe.getPrescribeId(),1);//1:只生成有医生签名的处方
+            String prescribeImgUrl = self().prescribeImgYsyTask(fsPrescribe.getPrescribeId(),1);//1:只生成有医生签名的处方
             fsPrescribe.setPrescribeImgUrl(prescribeImgUrl);
             fsPrescribeMapper.updateFsPrescribe(fsPrescribe);
         }