From dbff53150cdc807faa56c0d1a947d24b69f372b9 Mon Sep 17 00:00:00 2001
From: jiangqs <jiangqs>
Date: 星期四, 31 八月 2023 18:43:20 +0800
Subject: [PATCH] bug

---
 ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/task/ShopTaskServiceImpl.java |   62 ++++++++++++++++++++----------
 1 files changed, 41 insertions(+), 21 deletions(-)

diff --git a/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/task/ShopTaskServiceImpl.java b/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/task/ShopTaskServiceImpl.java
index 997f468..3e01141 100644
--- a/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/task/ShopTaskServiceImpl.java
+++ b/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/task/ShopTaskServiceImpl.java
@@ -19,6 +19,7 @@
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 
@@ -71,7 +72,7 @@
         shopTaskRecord.setTaskId(taskId);
         shopTaskRecord.setUserId(mgtFollowShopTaskDto.getUserId());
         shopTaskRecord.setFollowType(2);
-        shopTaskRecord.setCustomFollowType(mgtFollowShopTaskDto.getFollowType());
+        shopTaskRecord.setCustomeFollowType(mgtFollowShopTaskDto.getFollowType());
         shopTaskRecord.setFollowContent(mgtFollowShopTaskDto.getFollowContent());
         shopTaskRecord.setCreateTime(nowTime);
         shopTaskRecordService.saveOrUpdate(shopTaskRecord);
@@ -188,6 +189,7 @@
         shopTask.setEmergencyState(staffAddTaskDto.getEmergencyState());
         shopTask.setCreateTime(new Date());
         shopTask.setTaskDate(staffAddTaskDto.getTaskDate());
+        //任务状态
         int i = staffAddTaskDto.getTaskDate().compareTo(nowTimeStr);
         if(i>0){
             shopTask.setTaskStatus(0);
@@ -244,54 +246,57 @@
             shopTaskRecord.setUserId(staffFollowShopTaskDto.getUserId());
             shopTaskRecord.setFollowType(staffFollowShopTaskDto.getFollowType());
             shopTaskRecord.setFollowContent(staffFollowShopTaskDto.getFollowContent());
-            shopTaskRecord.setCustomFollowType(staffFollowShopTaskDto.getCustomFollowType());
+            shopTaskRecord.setCustomeFollowType(staffFollowShopTaskDto.getCustomeFollowType());
             shopTaskRecord.setCreateTime(new Date());
             // 保存或更新会员任务记录
             shopTaskRecordService.saveOrUpdate(shopTaskRecord);
             // 获取图片、视频和音频
-            String picture = staffFollowShopTaskDto.getPicture();
-            String video = staffFollowShopTaskDto.getVideo();
-            String audio = staffFollowShopTaskDto.getAudio();
-            String[] strArr;
+            List<FileDto> picture = staffFollowShopTaskDto.getPicture();
+            List<FileDto> video = staffFollowShopTaskDto.getVideo();
+            List<FileDto> audio = staffFollowShopTaskDto.getAudio();
             TaskFile taskFile;
+            List<TaskFile> taskFileList = new ArrayList<>();
             // 判断图片是否为空,并处理
-            if (StringUtils.isNotBlank(picture)) {
-                strArr = picture.split(",");
-                for (String str : strArr) {
+            if (picture!=null&&!picture.isEmpty()) {
+                for (FileDto fileDto : picture) {
                     taskFile = new TaskFile();
                     taskFile.setDelFlag(0);
                     taskFile.setFollowId(shopTaskRecord.getId());
                     taskFile.setFollowFrom(4);
-                    taskFile.setFileUrl(str);
+                    taskFile.setFileName(fileDto.getFileName());
+                    taskFile.setFileUrl(fileDto.getFileUrl());
                     taskFile.setFileType(1);
-                    taskFileService.saveOrUpdate(taskFile);
+                    taskFileList.add(taskFile);
                 }
             }
             // 判断视频是否为空,并处理
-            if (StringUtils.isNotBlank(video)) {
-                strArr = picture.split(",");
-                for (String str : strArr) {
+            if (video!=null&&!video.isEmpty()) {
+                for (FileDto fileDto : video) {
                     taskFile = new TaskFile();
                     taskFile.setDelFlag(0);
                     taskFile.setFollowId(shopTaskRecord.getId());
                     taskFile.setFollowFrom(4);
-                    taskFile.setFileUrl(str);
+                    taskFile.setFileName(fileDto.getFileName());
+                    taskFile.setFileUrl(fileDto.getFileUrl());
                     taskFile.setFileType(2);
-                    taskFileService.saveOrUpdate(taskFile);
+                    taskFileList.add(taskFile);
                 }
             }
             // 判断音频是否为空,并处理
-            if (StringUtils.isNotBlank(audio)) {
-                strArr = picture.split(",");
-                for (String str : strArr) {
+            if (audio!=null&&!audio.isEmpty()) {
+                for (FileDto fileDto : audio) {
                     taskFile = new TaskFile();
                     taskFile.setDelFlag(0);
                     taskFile.setFollowId(shopTaskRecord.getId());
                     taskFile.setFollowFrom(4);
-                    taskFile.setFileUrl(str);
+                    taskFile.setFileName(fileDto.getFileName());
+                    taskFile.setFileUrl(fileDto.getFileUrl());
                     taskFile.setFileType(3);
-                    taskFileService.saveOrUpdate(taskFile);
+                    taskFileList.add(taskFile);
                 }
+            }
+            if(taskFileList!=null&&!taskFileList.isEmpty()){
+                taskFileService.saveBatch(taskFileList);
             }
         }
         // 判断下一个任务日期是否为空,并处理
@@ -327,8 +332,23 @@
      */
     @Override
     public void checkTaskDateStatus(){
+        //平台-商户任务状态
         shopTaskMapper.checkShopTaskStatus();
+        //商户-代理商任务状态
         shopTaskMapper.checkAgencyTaskStatus();
+        //商户-会员任务状态
         shopTaskMapper.checkMemberTaskStatus();
     }
+
+    /**
+     * @description  获取商户最近任务
+     * @author  jqs
+     * @date    2023/8/22 17:27
+     * @param shopId
+     * @return  ShopTask
+     */
+    @Override
+    public ShopTask getLastTask(Long shopId){
+        return shopTaskMapper.getLastTask(shopId);
+    }
 }

--
Gitblit v1.7.1