Browse Source

no message

FengChaoYu 4 tháng trước cách đây
mục cha
commit
e4473b7ece

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

@@ -208,6 +208,17 @@ public class AppraiseRelaLogic {
     public void applySubmit(PgAppraiseApplyBean bean) {
         AdminUserCom adminUser = commonLogic.getAdminUser();
         boolean isAdd = StringUtils.isBlank(bean.getId());
+
+        if (!isAdd) {
+            // 有id查询是否有记录
+            final PgAppraiseApply apply = pgAppraiseApplyService.getById(bean.getId());
+            if (Objects.isNull(apply)) {
+                // 没有记录置空新建
+                bean.setId(null);
+                isAdd = true;
+            }
+        }
+
         if (StringUtils.isBlank(bean.getOrderBaseId())) {
             throw new RemoteServiceException("工单编号不能为空");
         }
@@ -291,24 +302,30 @@ public class AppraiseRelaLogic {
             throw new RemoteServiceException("已有中差评申诉记录, 提交失败");
         }
 
-        waitCount = pgAppraiseApplyService.lambdaQuery()
-                .eq(PgAppraiseApply::getOrderBaseId, bean.getOrderBaseId())
-                .eq(PgAppraiseApply::getStatus, AppraiseApplyStatusEnum.OK.getKey())
-                .ne(!isAdd, PgAppraiseApply::getId, bean.getId())
-                .count();
-        if (waitCount > 0) {
-            throw new RemoteServiceException("已有中差评申诉“审核通过”记录, 提交失败");
-        }
+//        waitCount = pgAppraiseApplyService.lambdaQuery()
+//                .eq(PgAppraiseApply::getOrderBaseId, bean.getOrderBaseId())
+//                .eq(PgAppraiseApply::getStatus, AppraiseApplyStatusEnum.OK.getKey())
+//                .ne(!isAdd, PgAppraiseApply::getId, bean.getId())
+//                .count();
+//        if (waitCount > 0) {
+//            throw new RemoteServiceException("已有中差评申诉“审核通过”记录, 提交失败");
+//        }
 
         bean.setAppraiseStatus(orderBase.getAppraiseStatus());
         bean.setAppraiseSource(orderBase.getAppraiseSource());
+        bean.setAddress(orderBase.getAddress());
         bean.setStatus(AppraiseApplyStatusEnum.WAIT_CENTER.getKey());
         bean.setApplyTime(DateUtil.date());
         bean.setApplyBy(adminUser.getNickName());
         bean.setCompanyWechatId(orderBase.getCompanyWechatId());
         bean.setCompanyWechatName(orderBase.getCompanyWechatName());
+        bean.setOverTime(orderBase.getWebsitOverTime());
+
+        if (Objects.isNull(bean.getOverTime())) {
+            // 网点报完工时间为空取师傅报完工时间
+            bean.setOverTime(orderBase.getOverTime());
+        }
         if (isAdd) {
-            bean.setOverTime(Objects.isNull(orderBase.getOverTime()) ? orderBase.getOverTime() : orderBase.getWebsitOverTime());
             bean.insert();
             orderBaseLogic.dow(orderBase.getId());
         } else {
@@ -516,6 +533,9 @@ 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())) {
+                    throw new RemoteServiceException(apply.getOrderBaseId() + "工单编号的申诉记录非“审核通过”,不能操作“驳回不可再申诉”");
+                }
                 apply.setExamineResult(apply.getAppraiseStatus());
             }
             pgAppraiseApplyService.saveBatch(applyList);