FengChaoYu před 4 měsíci
rodič
revize
297ff65684

+ 17 - 0
mall-server-api/src/main/java/com/gree/mall/manager/bean/workorder/PgAppraiseApplyCountBean.java

@@ -0,0 +1,17 @@
+package com.gree.mall.manager.bean.workorder;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@Data
+@ApiModel
+public class PgAppraiseApplyCountBean {
+
+    @ApiModelProperty(value = "待申诉数量")
+    private Integer waitCount;
+
+    @ApiModelProperty(value = "待审核数量")
+    private Integer centerCount;
+
+}

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

@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.gree.mall.manager.annotation.ZfireList;
 import com.gree.mall.manager.bean.admin.AdminUserCom;
 import com.gree.mall.manager.bean.workorder.PgAppraiseApplyBean;
+import com.gree.mall.manager.bean.workorder.PgAppraiseApplyCountBean;
 import com.gree.mall.manager.bean.workorder.PgAppraiseApplyVO;
 import com.gree.mall.manager.bean.workorder.PgAppraiseCategoryVO;
 import com.gree.mall.manager.constant.Constant;
@@ -127,6 +128,13 @@ public class AppraiseApplyController {
         FieldUtils.exportData(page.getRecords(), zfireParamBean.getExportFields(), request, response);
     }
 
+    @PostMapping("/apply/count")
+    @ApiOperation(value = "评价申诉-列表")
+    public ResponseHelper<PgAppraiseApplyCountBean> applyCount() {
+        PgAppraiseApplyCountBean count = appraiseRelaLogic.applyCount();
+        return ResponseHelper.success(count);
+    }
+
     @PostMapping("/apply/detail")
     @ApiOperation(value = "评价申诉-详情")
     public ResponseHelper<PgAppraiseApplyBean> applyDetail(String id) {

+ 1 - 0
mall-server-api/src/main/java/com/gree/mall/manager/enums/workorder/AppraiseApplyStatusEnum.java

@@ -15,6 +15,7 @@ public enum AppraiseApplyStatusEnum implements BaseEnum {
     WAIT_CENTER("WAIT_CENTER","待中心审核"),
     OK("OK","已审核"),
     OVER("OVER","中心超时未审核"),
+    OVER_APPLY("OVER_APPLY","超时未申诉"),
     ;
 
     @JsonValue

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

@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.gree.mall.manager.bean.admin.AdminUserCom;
 import com.gree.mall.manager.bean.workorder.PgAppraiseApplyBean;
+import com.gree.mall.manager.bean.workorder.PgAppraiseApplyCountBean;
 import com.gree.mall.manager.bean.workorder.PgAppraiseApplyVO;
 import com.gree.mall.manager.bean.workorder.PgAppraiseCategoryVO;
 import com.gree.mall.manager.commonmapper.CommonMapper;
@@ -487,8 +488,10 @@ public class AppraiseRelaLogic {
             if (Objects.nonNull(apply.getCloseTime())) {
                 throw new RemoteServiceException(apply.getOrderBaseId() + "工单编号的申诉记录有“驳回不可再申诉信息”,不能操作“驳回可再申诉”");
             }
-            if (!(apply.getStatus().equals(AppraiseApplyStatusEnum.OK.getKey()) || apply.getStatus().equals(AppraiseApplyStatusEnum.OVER.getKey()))) {
-                throw new RemoteServiceException(apply.getOrderBaseId() + "工单编号的申诉记录非“审核通过”或“超时未审核”,不能操作“驳回可再申诉”");
+            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() + "工单编号的申诉记录非“审核通过”或“超时未审核”或“超时未申诉”,不能操作“驳回可再申诉”");
             }
         }
 
@@ -554,7 +557,7 @@ public class AppraiseRelaLogic {
 
         final List<PgAppraiseApply> applyList = pgAppraiseApplyService.lambdaQuery()
                 .in(PgAppraiseApply::getId, ids)
-                .eq(PgAppraiseApply::getStatus, AppraiseApplyStatusEnum.OK.getKey())
+                .in(PgAppraiseApply::getStatus, AppraiseApplyStatusEnum.OK.getKey(), AppraiseApplyStatusEnum.OVER.getKey(), AppraiseApplyStatusEnum.OVER_APPLY.getKey())
                 .orderByAsc(PgAppraiseApply::getApplyTime)
                 .list();
 
@@ -562,8 +565,10 @@ public class AppraiseRelaLogic {
             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()))) {
-                    throw new RemoteServiceException(apply.getOrderBaseId() + "工单编号的申诉记录非“审核通过”或“超时未审核”,不能操作“驳回不可再申诉”");
+                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());
             }
@@ -590,4 +595,20 @@ public class AppraiseRelaLogic {
     }
 
 
+    public PgAppraiseApplyCountBean applyCount() {
+        AdminUserCom adminUser = commonLogic.getAdminUser();
+        PgAppraiseApplyCountBean bean = new PgAppraiseApplyCountBean();
+
+        final Integer count = pgAppraiseApplyService.lambdaQuery()
+                .in(CollectionUtil.isNotEmpty(adminUser.getAdminWebsitIds()), PgAppraiseApply::getWebsitId, adminUser.getAdminWebsitIds())
+                .eq(PgAppraiseApply::getStatus, AppraiseApplyStatusEnum.WAIT.getKey())
+                .count();
+        final Integer centerCount = pgAppraiseApplyService.lambdaQuery()
+                .in(CollectionUtil.isNotEmpty(adminUser.getAdminWebsitIds()), PgAppraiseApply::getWebsitId, adminUser.getAdminWebsitIds())
+                .eq(PgAppraiseApply::getStatus, AppraiseApplyStatusEnum.WAIT_CENTER.getKey())
+                .count();
+        bean.setWaitCount(count);
+        bean.setCenterCount(centerCount);
+        return bean;
+    }
 }

+ 55 - 3
mall-server-api/src/main/java/com/gree/mall/manager/schedule/AppraiseApplySchedule.java

@@ -8,8 +8,10 @@ import com.gree.mall.manager.enums.workorder.AppraiseOnusEnum;
 import com.gree.mall.manager.enums.workorder.AppraiseStatusEnum;
 import com.gree.mall.manager.plus.entity.PgAppraiseApply;
 import com.gree.mall.manager.plus.entity.PgAppraiseConfig;
+import com.gree.mall.manager.plus.entity.PgOrderBase;
 import com.gree.mall.manager.plus.service.PgAppraiseApplyService;
 import com.gree.mall.manager.plus.service.PgAppraiseConfigService;
+import com.gree.mall.manager.plus.service.PgOrderBaseService;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
@@ -31,14 +33,16 @@ public class AppraiseApplySchedule {
     PgAppraiseApplyService pgAppraiseApplyService;
     @Resource
     PgAppraiseConfigService pgAppraiseConfigService;
+    @Resource
+    PgOrderBaseService pgOrderBaseService;
     @Value("${spring.profiles.active}")
     private String env;
 
     /**
-     * 发送模板通知
+     * 待中心审核检查超时
      */
-    @Scheduled(fixedDelay = 5 * 1000)
-    public void task2(){
+    @Scheduled(fixedDelay = 2 * 1000)
+    public void task1(){
         if(env.equals("test") || env.equals("prd")) {
             final List<PgAppraiseApply> applyList = pgAppraiseApplyService.lambdaQuery()
                     .eq(PgAppraiseApply::getStatus, AppraiseApplyStatusEnum.WAIT_CENTER.getKey())
@@ -71,10 +75,58 @@ public class AppraiseApplySchedule {
                                 .set(PgAppraiseApply::getSettleConfirmTime, null)
                                 .eq(PgAppraiseApply::getId, apply.getId())
                                 .update();
+                        pgOrderBaseService.lambdaUpdate()
+                                .eq(PgOrderBase::getAppraiseApplyResult, AppraiseStatusEnum.A.getKey())
+                                .eq(PgOrderBase::getId, apply.getId())
+                                .update();
                     }
                 }
             }
         }
     }
 
+    /**
+     * 二次申诉检查超时
+     */
+    @Scheduled(fixedDelay = 2 * 1000)
+    public void task2(){
+        if(env.equals("test") || env.equals("prd")) {
+            final List<PgAppraiseApply> applyList = pgAppraiseApplyService.lambdaQuery()
+                    .eq(PgAppraiseApply::getStatus, AppraiseApplyStatusEnum.WAIT.getKey())
+                    .eq(PgAppraiseApply::getIsSecond, true)
+                    .isNotNull(PgAppraiseApply::getSettleConfirmTime)
+                    .list();
+            if (CollectionUtil.isNotEmpty(applyList)) {
+                // 二次申诉时间不能超时,从中心首次审核时间开始计算
+                final PgAppraiseConfig config = pgAppraiseConfigService.lambdaQuery()
+                        .eq(PgAppraiseConfig::getCompanyWechatId, applyList.get(0).getCompanyWechatId())
+                        .eq(PgAppraiseConfig::getType, AppraiseConfigTypeEnum.SECOND_A.getKey())
+                        .one();
+
+                for (PgAppraiseApply apply : applyList) {
+                    String value = config.getVal();
+                    final int val = Integer.parseInt(value);
+                    Date endTime = DateUtil.offsetHour(apply.getApplyTime(), val);
+                    if (DateUtil.date().after(endTime)) {
+                        pgAppraiseApplyService.lambdaUpdate()
+                                .set(PgAppraiseApply::getExamineResult, apply.getAppraiseStatus())
+                                .set(PgAppraiseApply::getStatus, AppraiseApplyStatusEnum.OVER_APPLY.getKey())
+                                .set(PgAppraiseApply::getWebsitResult, AppraiseOnusEnum.ALL.getKey())
+                                .set(PgAppraiseApply::getCategoryId, null)
+                                .set(PgAppraiseApply::getParentCategoryId, null)
+                                .set(PgAppraiseApply::getCategoryName, null)
+                                .set(PgAppraiseApply::getParentCategoryName, null)
+                                .set(PgAppraiseApply::getIsWebsitCall, null)
+                                .set(PgAppraiseApply::getConfirmBy, "超时未申诉")
+                                .eq(PgAppraiseApply::getId, apply.getId())
+                                .update();
+                        pgOrderBaseService.lambdaUpdate()
+                                .eq(PgOrderBase::getAppraiseApplyResult, apply.getAppraiseStatus())
+                                .eq(PgOrderBase::getId, apply.getId())
+                                .update();
+                    }
+                }
+            }
+        }
+    }
 }