You've already forked FrameTour-BE
refactor(task): 重构任务拍摄时间获取逻辑
- 将 getTaskShotDate 方法从 TaskTaskServiceImpl 移至 VideoTaskRepository - 删除对 TaskService 和 TaskTaskServiceImpl 的依赖注入 - 更新 LyCompatibleController 和 GoodsServiceImpl 中的调用方式 - 简化日期解析逻辑,提高代码可读性 - 移除冗余的 VideoMapper 和 TaskService 接口方法声明 - 统一使用 VideoTaskRepository 处理任务相关数据查询
This commit is contained in:
@@ -46,7 +46,6 @@ import com.ycwl.basic.service.mobile.GoodsService;
|
||||
import com.ycwl.basic.repository.TemplateRepository;
|
||||
import com.ycwl.basic.config.VideoUpdateConfig;
|
||||
import com.ycwl.basic.model.repository.TaskUpdateResult;
|
||||
import com.ycwl.basic.service.task.TaskService;
|
||||
import com.ycwl.basic.storage.StorageFactory;
|
||||
import com.ycwl.basic.storage.adapters.IStorageAdapter;
|
||||
import com.ycwl.basic.storage.enums.StorageAcl;
|
||||
@@ -88,8 +87,6 @@ public class GoodsServiceImpl implements GoodsService {
|
||||
@Autowired
|
||||
private VideoTaskRepository videoTaskRepository;
|
||||
@Autowired
|
||||
private TaskService taskTaskService;
|
||||
@Autowired
|
||||
private ScenicRepository scenicRepository;
|
||||
@Autowired
|
||||
private OrderBiz orderBiz;
|
||||
@@ -244,7 +241,7 @@ public class GoodsServiceImpl implements GoodsService {
|
||||
goodsDetailVO.setIsBuy(1);
|
||||
}
|
||||
}
|
||||
goodsDetailVO.setShotTime(taskTaskService.getTaskShotDate(video.getTaskId()));
|
||||
goodsDetailVO.setShotTime(videoTaskRepository.getTaskShotDate(video.getTaskId()));
|
||||
goodsDetailVO.setLensNum(videoTaskRepository.getTaskLensNum(video.getTaskId()));
|
||||
goodsDetailVO.setDevicesNum(videoTaskRepository.getTaskDeviceNum(video.getTaskId()));
|
||||
CouponRecordQueryResp couponRecord = couponBiz.queryUserCouponRecord(video.getScenicId(), userId, video.getFaceId(), video.getTemplateId().toString());
|
||||
|
||||
@@ -7,8 +7,6 @@ import com.ycwl.basic.model.task.req.TaskSuccessReqVo;
|
||||
import com.ycwl.basic.model.task.req.WorkerAuthReqVo;
|
||||
import com.ycwl.basic.model.task.resp.TaskSyncRespVo;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public interface TaskService {
|
||||
TaskSyncRespVo handleSyncTask(TaskReqVo req);
|
||||
|
||||
@@ -28,8 +26,6 @@ public interface TaskService {
|
||||
|
||||
void autoCreateTaskByFaceId(Long faceId);
|
||||
|
||||
Date getTaskShotDate(Long taskId);
|
||||
|
||||
void sendVideoGeneratedServiceNotification(Long taskId, Long memberId);
|
||||
|
||||
TaskRespVO taskInfo(Long taskId);
|
||||
|
||||
@@ -591,33 +591,6 @@ public class TaskTaskServiceImpl implements TaskService {
|
||||
memberVideo.forEach(item -> sendVideoGeneratedServiceNotification(taskId, item.getMemberId()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Date getTaskShotDate(Long taskId) {
|
||||
TaskRespVO taskRespVO = taskMapper.getById(taskId);
|
||||
if (taskRespVO == null) {
|
||||
return null;
|
||||
}
|
||||
Date shotTime = taskRespVO.getCreateTime();
|
||||
Map<String, Object> paramJson = JacksonUtil.parseObject(taskRespVO.getTaskParams(), Map.class);
|
||||
if (paramJson != null) {
|
||||
Optional<String> any = paramJson.keySet().stream().filter(StringUtils::isNumeric).findAny();
|
||||
if (any.isPresent()) {
|
||||
@SuppressWarnings("unchecked")
|
||||
List<Map<String, Object>> jsonArray = (List<Map<String, Object>>) paramJson.get(any.get());
|
||||
if (jsonArray != null && !jsonArray.isEmpty()) {
|
||||
Map<String, Object> jsonObject = jsonArray.get(0);
|
||||
if (jsonObject.containsKey("createTime")) {
|
||||
Object createTimeObj = jsonObject.get("createTime");
|
||||
if (createTimeObj instanceof Number) {
|
||||
shotTime = new Date(((Number) createTimeObj).longValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return shotTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendVideoGeneratedServiceNotification(Long taskId, Long memberId) {
|
||||
MemberVideoEntity item = videoMapper.queryRelationByMemberTask(memberId, taskId);
|
||||
|
||||
Reference in New Issue
Block a user