Przeglądaj źródła

fix:减少判断分支

ly 10 miesięcy temu
rodzic
commit
cb79f5505c

+ 3 - 11
src/main/java/cn/ezhizao/project/business/order/controller/BizArchiveInputController.java

@@ -327,26 +327,18 @@ public class BizArchiveInputController extends BaseController {
                 if (one != null) {
                     list = workOrderRecordService.list(new LambdaQueryWrapper<BizWorkOrderRecord>()
                             .eq(BizWorkOrderRecord::getWorkOrderId, one.getWorkOrderId()));
-                    if (CollectionUtils.isNotEmpty(list)) {
-                        detail.setDisabled(true);
-                     } else {
-                        detail.setDisabled(false);
-                    }
+                    detail.setDisabled(CollectionUtils.isNotEmpty(list));
                 }
                 if (bizArchiveInput.getServiceType() == 1) {
                     TimeVo time = getTime(detail.getContractId(), detail.getId(), detail.getTaskTypeId(), detail.getCompanyId());
                     if (time != null) {
                         detail.setTimeVo(time);
-                        if (list != null &&
+                        detail.setMonthDisabled(list != null &&
                                 list.stream()
                                         .anyMatch(record ->
                                                 DateTime.of(detail.getTimeVo().getStartTime())
                                                         .toString("yyyyMM")
-                                                        .compareTo(record.getYear() + record.getMonth()) <= 0)) {
-                            detail.setMonthDisabled(true);
-                        }else{
-                            detail.setMonthDisabled(false);
-                        }
+                                                        .compareTo(record.getYear() + record.getMonth()) <= 0));
                     }
                 }
             }