From 156e141e55a8abf486157d1fa89d25e23f4a06a3 Mon Sep 17 00:00:00 2001 From: jiangqs <jiangqs> Date: 星期五, 25 八月 2023 19:32:30 +0800 Subject: [PATCH] bug --- ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/task/ShopTaskServiceImpl.java | 83 +++++++++++++++++++++++++++++++---------- 1 files changed, 62 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 7e77dca..aa2828b 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); @@ -231,6 +232,7 @@ shopTaskRecord.setCallPhone(staffFollowShopTaskDto.getCallPhone()); shopTaskRecord.setFollowContent(followPhoneDto.getFollowContent()); shopTaskRecord.setCallTime(followPhoneDto.getCallTime()); + shopTaskRecord.setCreateTime(new Date()); // 保存或更新会员任务记录 shopTaskRecordService.saveOrUpdate(shopTaskRecord); } @@ -243,53 +245,57 @@ shopTaskRecord.setUserId(staffFollowShopTaskDto.getUserId()); shopTaskRecord.setFollowType(staffFollowShopTaskDto.getFollowType()); shopTaskRecord.setFollowContent(staffFollowShopTaskDto.getFollowContent()); + 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); } } // 判断下一个任务日期是否为空,并处理 @@ -301,9 +307,44 @@ shopTask.setShopId(oldShopTask.getShopId()); shopTask.setTaskDate(staffFollowShopTaskDto.getNextTaskDate()); shopTask.setFollowContent(staffFollowShopTaskDto.getNextTaskContent()); - shopTask.setTaskStatus(2); + String nowTimeStr = DateUtils.getDate(); + int i = staffFollowShopTaskDto.getNextTaskDate().compareTo(nowTimeStr); + if(i>0){ + shopTask.setTaskStatus(0); + }else if(i==0){ + shopTask.setTaskStatus(1); + }else{ + shopTask.setTaskStatus(3); + } + shopTask.setEmergencyState(staffFollowShopTaskDto.getEmergencyState()); shopTask.setCreateTime(new Date()); this.saveOrUpdate(shopTask); } } + + /** + * @description 检查任务时间状态 + * @author jqs + * @date 2023/7/19 18:01 + * @param + * @return void + */ + @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