Browse Source

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

‘linchangsheng’ 4 months ago
parent
commit
edec13e700

+ 1 - 1
mall-server-api/src/main/java/com/gree/mall/manager/controller/workerorder/AppraiseApplyController.java

@@ -129,7 +129,7 @@ public class AppraiseApplyController {
     }
 
     @PostMapping("/apply/count")
-    @ApiOperation(value = "评价申诉-列表")
+    @ApiOperation(value = "评价申诉-统计")
     public ResponseHelper<PgAppraiseApplyCountBean> applyCount() {
         PgAppraiseApplyCountBean count = appraiseRelaLogic.applyCount();
         return ResponseHelper.success(count);

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

@@ -266,7 +266,7 @@ public class AppraiseRelaLogic {
         final PgAppraiseApply beforeApply = pgAppraiseApplyService.lambdaQuery()
                 .eq(PgAppraiseApply::getIsSecond, false)
                 .eq(PgAppraiseApply::getOrderBaseId, bean.getOrderBaseId())
-                .orderByDesc(PgAppraiseApply::getApplyTime)
+                .orderByDesc(PgAppraiseApply::getCreateTime)
                 .last("limit 1")
                 .one();
 
@@ -461,11 +461,18 @@ public class AppraiseRelaLogic {
             // 首次申诉:判定网点【全责】的,审核结果为【驳回】,触发二次可申诉
             // 二次申诉:判定网点【全责】的,审核结果为【驳回】,维护原评价
             apply.setExamineResult(orderBase.getAppraiseStatus());
-            PgAppraiseApply copy = new PgAppraiseApply();
-            this.copyApply(copy, apply);
-            copy.setIsSecond(true);
-            copy.setSecondCreateTime(DateUtil.dateSecond());
-            copy.insert();
+            final Integer supCount = pgAppraiseApplyService.lambdaQuery()
+                    .eq(PgAppraiseApply::getIsSecond, false)
+                    .eq(PgAppraiseApply::getOrderBaseId, bean.getOrderBaseId())
+                    .isNotNull(PgAppraiseApply::getRejectTime)
+                    .count();
+            if (!apply.getIsSecond() && supCount == 0) {
+                PgAppraiseApply copy = new PgAppraiseApply();
+                this.copyApply(copy, apply);
+                copy.setIsSecond(true);
+                copy.setSecondCreateTime(DateUtil.dateSecond());
+                copy.insert();
+            }
         }
 
         apply.updateById();
@@ -496,6 +503,24 @@ public class AppraiseRelaLogic {
                 .in(PgAppraiseApply::getId, ids)
                 .list();
 
+        Integer count = pgAppraiseApplyService.lambdaQuery()
+                .in(PgAppraiseApply::getStatus, AppraiseApplyStatusEnum.WAIT.getKey(), AppraiseApplyStatusEnum.WAIT_CENTER.getKey())
+                .in(PgAppraiseApply::getId, ids)
+                .count();
+
+        if (count > 0) {
+            throw new RemoteServiceException("有“待申诉”或“待中心审核”申诉记录,不能操作“驳回可再申诉”");
+        }
+
+        count = pgAppraiseApplyService.lambdaQuery()
+                .isNotNull(PgAppraiseApply::getCloseTime)
+                .in(PgAppraiseApply::getId, ids)
+                .count();
+
+        if (count > 0) {
+            throw new RemoteServiceException("有“驳回不可再申诉信息”申诉记录,不能操作“驳回可再申诉”");
+        }
+
         for (PgAppraiseApply apply : applyList) {
             if (Objects.nonNull(apply.getRejectTime())) {
                 throw new RemoteServiceException(apply.getOrderBaseId() + "工单编号的申诉记录有“驳回可重申诉信息”,不能操作“驳回可再申诉”");
@@ -576,27 +601,29 @@ public class AppraiseRelaLogic {
                 .orderByAsc(PgAppraiseApply::getApplyTime)
                 .list();
 
-        if (CollectionUtil.isNotEmpty(applyList)) {
-            final List<String> orderIds = applyList.stream().map(PgAppraiseApply::getOrderBaseId).collect(Collectors.toList());
-            final Map<String, PgAppraiseApply> applyMap = applyList.stream().collect(Collectors.toMap(PgAppraiseApply::getOrderBaseId, Function.identity(), (key1, key2) -> key2));
-            for (PgAppraiseApply apply : applyList) {
-                if (!(apply.getStatus().equals(AppraiseApplyStatusEnum.OK.getKey())
-                        || apply.getStatus().equals(AppraiseApplyStatusEnum.OVER.getKey())
-                        || apply.getStatus().equals(AppraiseApplyStatusEnum.OVER_APPLY.getKey()))) {
-                    throw new RemoteServiceException(apply.getOrderBaseId() + "工单编号的申诉记录非“审核通过”或“超时未审核”或“超时未申诉”,不能操作“驳回不可再申诉”");
-                }
-                apply.setExamineResult(apply.getAppraiseStatus());
+        if (CollectionUtil.isEmpty(applyList)) {
+            throw new RemoteServiceException("未找到申诉记录为“审核通过”或“超时未审核”或“超时未申诉”,不能操作“驳回不可再申诉”");
+        }
+
+        final List<String> orderIds = applyList.stream().map(PgAppraiseApply::getOrderBaseId).collect(Collectors.toList());
+        final Map<String, PgAppraiseApply> applyMap = applyList.stream().collect(Collectors.toMap(PgAppraiseApply::getOrderBaseId, Function.identity(), (key1, key2) -> key2));
+        for (PgAppraiseApply apply : applyList) {
+            if (!(apply.getStatus().equals(AppraiseApplyStatusEnum.OK.getKey())
+                    || apply.getStatus().equals(AppraiseApplyStatusEnum.OVER.getKey())
+                    || apply.getStatus().equals(AppraiseApplyStatusEnum.OVER_APPLY.getKey()))) {
+                throw new RemoteServiceException(apply.getOrderBaseId() + "工单编号的申诉记录非“审核通过”或“超时未审核”或“超时未申诉”,不能操作“驳回不可再申诉”");
             }
-            pgAppraiseApplyService.saveBatch(applyList);
-
-            for (String orderId : orderIds) {
-                final PgAppraiseApply apply = applyMap.get(orderId);
-                if (Objects.nonNull(apply)) {
-                    pgOrderBaseService.lambdaUpdate()
-                            .set(PgOrderBase::getAppraiseApplyResult, apply.getAppraiseStatus())
-                            .eq(PgOrderBase::getId, orderId)
-                            .update();
-                }
+            apply.setExamineResult(apply.getAppraiseStatus());
+        }
+        pgAppraiseApplyService.saveOrUpdateBatch(applyList);
+
+        for (String orderId : orderIds) {
+            final PgAppraiseApply apply = applyMap.get(orderId);
+            if (Objects.nonNull(apply)) {
+                pgOrderBaseService.lambdaUpdate()
+                        .set(PgOrderBase::getAppraiseApplyResult, apply.getAppraiseStatus())
+                        .eq(PgOrderBase::getId, orderId)
+                        .update();
             }
         }
 

+ 2 - 0
mall-server-api/src/main/java/com/gree/mall/manager/logic/workorder/OrderBaseLogic.java

@@ -230,6 +230,8 @@ public class OrderBaseLogic {
                     continue;
                 }
                 if (!(record.getOrderStatus().getKey().equals(OrderBaseStatusEnum.YWG.getKey())
+                        || record.getOrderStatus().getKey().equals(OrderBaseStatusEnum.GCSZX.getKey())
+                        || record.getOrderStatus().getKey().equals(OrderBaseStatusEnum.WDWG.getKey())
                         || record.getOrderStatus().getKey().equals(OrderBaseStatusEnum.YJS.getKey()))) {
                     record.setAppraiseApplyId("1");
                     continue;

+ 1 - 1
mall-server-api/src/main/resources/mapper/CommonMapper.xml

@@ -1599,7 +1599,7 @@
             </foreach>
         </if>
         <if test="ex.orderBy == null or ex.orderBy ==''">
-            ORDER BY a.apply_time DESC
+            ORDER BY a.update_time DESC
         </if>
         ${ex.orderBy}
     </select>