Explorar el Código

解决循环依赖

wks hace 3 años
padre
commit
049220ef5b

+ 7 - 24
src/main/java/com/ydtech/modules/order/service/impl/InsCrawlerOrderServiceImpl.java

@@ -30,7 +30,6 @@ import com.ydtech.modules.protocol.utils.AssertionUtils;
 import com.ydtech.utils.CalculateUtils;
 import com.ydtech.utils.idgen.IdGenerate;
 import org.springframework.beans.BeanUtils;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.util.ObjectUtils;
 
@@ -43,41 +42,25 @@ import java.util.Map;
 @Service
 public class InsCrawlerOrderServiceImpl implements InsCrawlerOrderService {
 
-    private PtlCrawlerApiService ptlCrawlerApiService;
+    private final PtlCrawlerApiService ptlCrawlerApiService;
 
-    private InsCrawlerOrderComponents insCrawlerOrderComponents;
+    private final InsCrawlerOrderComponents insCrawlerOrderComponents;
 
-    private PtlAgreementAttributionService ptlAgreementAttributionService;
+    private final PtlAgreementAttributionService ptlAgreementAttributionService;
 
-    private InsAreaCompanyService insAreaCompanyService;
+    private final InsAreaCompanyService insAreaCompanyService;
 
-    private InsTaskImagesService insTaskImagesService;
+    private final InsTaskImagesService insTaskImagesService;
 
-    @Autowired
-    public void setPtlCrawlerApiService(PtlCrawlerApiService ptlCrawlerApiService) {
+    public InsCrawlerOrderServiceImpl(PtlCrawlerApiService ptlCrawlerApiService, InsCrawlerOrderComponents insCrawlerOrderComponents, PtlAgreementAttributionService ptlAgreementAttributionService, InsAreaCompanyService insAreaCompanyService, InsTaskImagesService insTaskImagesService) {
         this.ptlCrawlerApiService = ptlCrawlerApiService;
-    }
-
-    @Autowired
-    public void setInsCrawlerOrderComponents(InsCrawlerOrderComponents insCrawlerOrderComponents) {
         this.insCrawlerOrderComponents = insCrawlerOrderComponents;
-    }
-
-    @Autowired
-    public void setPtlAgreementAttributionService(PtlAgreementAttributionService ptlAgreementAttributionService) {
         this.ptlAgreementAttributionService = ptlAgreementAttributionService;
-    }
-
-    @Autowired
-    public void setInsAreaCompanyService(InsAreaCompanyService insAreaCompanyService) {
         this.insAreaCompanyService = insAreaCompanyService;
-    }
-
-    @Autowired
-    public void setInsTaskImagesService(InsTaskImagesService insTaskImagesService) {
         this.insTaskImagesService = insTaskImagesService;
     }
 
+
     @Override
     public void isLogin(PtlAgreementAttributionDto attribution, String insCompanyName) {
         String apiUrl = ptlCrawlerApiService.getByTemplateId(attribution.getTemplateId(), PtlCrawlerApiType.API_1);

+ 12 - 8
src/main/java/com/ydtech/modules/protocol/service/impl/PtlAgreementServiceImpl.java

@@ -54,16 +54,25 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
 
     private final EsmInsCompanyService esmInsCompanyService;
 
-    private final InsCrawlerOrderService insCrawlerOrderController;
+    private InsCrawlerOrderService insCrawlerOrderController;
 
     private PtlAgreementService proxyObject;
 
-    public PtlAgreementServiceImpl(PtlAgreementProductCostsService ptlAgreementProductCostsService, PtlAgreementUnderwritingRulesService ptlAgreementUnderwritingRulesService, PtlAgreementAttributionService ptlAgreementAttributionService, PtlAgreementDeptService ptlAgreementDeptService, EsmInsCompanyService esmInsCompanyService, InsCrawlerOrderService insCrawlerOrderController) {
+    public PtlAgreementServiceImpl(PtlAgreementProductCostsService ptlAgreementProductCostsService, PtlAgreementUnderwritingRulesService ptlAgreementUnderwritingRulesService, PtlAgreementAttributionService ptlAgreementAttributionService, PtlAgreementDeptService ptlAgreementDeptService, EsmInsCompanyService esmInsCompanyService) {
         this.ptlAgreementProductCostsService = ptlAgreementProductCostsService;
         this.ptlAgreementUnderwritingRulesService = ptlAgreementUnderwritingRulesService;
         this.ptlAgreementAttributionService = ptlAgreementAttributionService;
         this.ptlAgreementDeptService = ptlAgreementDeptService;
         this.esmInsCompanyService = esmInsCompanyService;
+    }
+
+    @Autowired
+    public void setProxyObject(PtlAgreementService proxyObject) {
+        this.proxyObject = proxyObject;
+    }
+
+    @Autowired
+    public void setInsCrawlerOrderController(InsCrawlerOrderService insCrawlerOrderController) {
         this.insCrawlerOrderController = insCrawlerOrderController;
     }
 
@@ -85,10 +94,6 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
         return agreementCompany;
     }
 
-    @Autowired
-    public void setProxyObject(PtlAgreementService proxyObject) {
-        this.proxyObject = proxyObject;
-    }
 
     @Override
     public PtlAgreement ifExistsById(String agreementId) {
@@ -212,7 +217,7 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
     }
 
     @Override
-    public EsmInsCompany verifyLogin(PtlAgreement ptlAgreement, PtlAgreementSaveDto agreementSaveDto, PtlAgreementAttributionDto attribution){
+    public EsmInsCompany verifyLogin(PtlAgreement ptlAgreement, PtlAgreementSaveDto agreementSaveDto, PtlAgreementAttributionDto attribution) {
         EsmInsCompany esmInsCompany;
 
         // 获取保险公司
@@ -238,7 +243,6 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
     }
 
 
-
     @Override
     public HttpResult<Object> auditAgreement(String agreementId, PtlAgreementAuditVo ptlAgreementAuditVo) {
         PtlAgreement ptlAgreement = proxyObject.ifExistsById(agreementId);