Quellcode durchsuchen

Merge remote-tracking branch 'origin/develop' into develop

‘linchangsheng’ vor 4 Monaten
Ursprung
Commit
caa13d2e0c

+ 17 - 15
mall-server-api/src/main/java/com/gree/mall/manager/logic/workorder/AppraiseRelaLogic.java

@@ -269,7 +269,9 @@ public class AppraiseRelaLogic {
                 .orderByDesc(PgAppraiseApply::getApplyTime)
                 .one();
 
-        final int applyCount = Objects.isNull(beforeApply) ? 0 : 1;
+        final Integer applyCount = pgAppraiseApplyService.lambdaQuery()
+                .eq(PgAppraiseApply::getOrderBaseId, bean.getOrderBaseId())
+                .count();
 
         // 查询有没有驳回不可申诉人
         final Integer superEndCount = pgAppraiseApplyService.lambdaQuery()
@@ -289,13 +291,24 @@ public class AppraiseRelaLogic {
 
         // 有驳回可重诉人忽略申诉配置
         if (superCount == 0) {
+            if (isAdd) {
+                // 新增时判断是否已申诉过
+                Integer count = pgAppraiseApplyService.lambdaQuery()
+                        .eq(PgAppraiseApply::getIsSecond, false)
+                        .eq(PgAppraiseApply::getOrderBaseId, bean.getOrderBaseId())
+                        .count();
+                if (count > 0) {
+                    throw new RemoteServiceException("已申诉, 提交失败");
+                }
+            }
+
             Date overTime = Objects.nonNull(orderBase.getOverTime()) ? orderBase.getOverTime() : orderBase.getWebsitOverTime();
             DateTime endTime;
             // 1、完工时间超过配置时间的,不可再提交;
             // 申诉配置
             final PgAppraiseConfig config = pgAppraiseConfigService.lambdaQuery()
                     .eq(PgAppraiseConfig::getCompanyWechatId, orderBase.getCompanyWechatId())
-                    .eq(PgAppraiseConfig::getType, applyCount == 0 ? AppraiseConfigTypeEnum.FIRST_A.getKey() : AppraiseConfigTypeEnum.SECOND_A.getKey())
+                    .eq(PgAppraiseConfig::getType, applyCount <= 1 ? AppraiseConfigTypeEnum.FIRST_A.getKey() : AppraiseConfigTypeEnum.SECOND_A.getKey())
                     .one();
 
             if (config.getType().equals(AppraiseConfigTypeEnum.SECOND_A.getKey())) {
@@ -306,23 +319,12 @@ public class AppraiseRelaLogic {
             final int val = Integer.parseInt(config.getVal());
             endTime = DateUtil.offsetHour(overTime, val);
 
-            String str = applyCount == 0 ? "首次" : "二次";
+            String str = applyCount <= 1 ? "首次" : "二次";
             if (DateUtil.date().after(endTime)) {
                 throw new RemoteServiceException("已超" + str + "申诉时间, 提交失败");
             }
-
-            if (isAdd) {
-                // 新增时判断是否已申诉过
-                Integer count = pgAppraiseApplyService.lambdaQuery()
-                        .eq(PgAppraiseApply::getIsSecond, false)
-                        .eq(PgAppraiseApply::getOrderBaseId, bean.getOrderBaseId())
-                        .count();
-                if (count > 0) {
-                    throw new RemoteServiceException("已申诉, 提交失败");
-                }
-            }
         }
-        bean.setIsSecond(applyCount > 0);
+        bean.setIsSecond(applyCount > 1);
 
         //2、该工单已有中差评申诉数据的,不可再提交;(已申诉、待审核状态的,均不可再创建申诉)
         Integer waitCount = pgAppraiseApplyService.lambdaQuery()