785834757 преди 1 година
родител
ревизия
855dd0ad9e
променени са 1 файла, в които са добавени 15 реда и са изтрити 0 реда
  1. 15 0
      src/main/java/com/ydtech/modules/order/controller/QuoteController.java

+ 15 - 0
src/main/java/com/ydtech/modules/order/controller/QuoteController.java

@@ -31,7 +31,9 @@ import com.ydtech.modules.protocol.entity.constants.PtlApiType;
 import com.ydtech.modules.protocol.entity.dto.TaxSourceExcludeDto;
 import com.ydtech.modules.protocol.entity.po.PtlAgreementAttribution;
 import com.ydtech.modules.protocol.entity.po.PtlTaxSourceNew;
+import com.ydtech.modules.protocol.entity.vo.PtlAgreementQueryVo;
 import com.ydtech.modules.protocol.service.PtlAgreementAttributionService;
+import com.ydtech.modules.protocol.service.PtlAgreementService;
 import com.ydtech.modules.protocol.service.PtlTaxSourceNewService;
 import com.ydtech.modules.protocol.service.impl.TaxSourceExcludeServiceImpl;
 import com.ydtech.utils.StringUtils;
@@ -45,6 +47,8 @@ import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.time.LocalDate;
+import java.time.format.DateTimeFormatter;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Objects;
@@ -106,6 +110,9 @@ public class QuoteController extends BaseController {
     @Autowired
     YongAnOrderService yongAnOrderService;
 
+    @Autowired
+    PtlAgreementService ptlAgreementService;
+
     @QuoteVerification("报价授权")
     @PostMapping(value = "/quote")
     public HttpResult<QuoteRespVo> quote(@RequestBody BaseQuoteVo<Object> quoteVo) throws Exception {
@@ -151,6 +158,14 @@ public class QuoteController extends BaseController {
         }
 
         HttpResult<QuoteRespVo> respVo = null;
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+        HttpResult<PtlAgreementQueryVo> byAgreementId = ptlAgreementService.getByAgreementId(quoteVo.getAgreementId());
+        LocalDate currentDate = LocalDate.now();
+        if(byAgreementId.getData().getAgreement().getIsValid().equals("0")  //是否有效
+                || byAgreementId.getData().getAgreement().getValidStatus().equals("0")  //是否有效
+                || !(currentDate.isAfter(byAgreementId.getData().getAgreement().getStartDate()) && currentDate.isBefore(byAgreementId.getData().getAgreement().getEndDate()))){
+            throw new SystemException("协议失效,请检查调度");
+        }
 
         PtlAgreementAttribution ptlAgreementAttribution = ptlAgreementAttributionService.getById(quoteVo.getAgreementId());