时间修改
This commit is contained in:
@ -24,6 +24,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ -118,9 +119,10 @@ public class MemberUserController {
|
||||
@Operation(summary = "获得会员热量分析")
|
||||
@PreAuthorize("@ss.hasPermission('member:user:query')")
|
||||
public CommonResult<List<Map>> getUserHeat(@RequestParam(value = "userId",required = false) Long userId,
|
||||
@RequestParam(value = "days",required = false)Integer days,
|
||||
@RequestParam(value = "startDate",required = false) LocalDateTime startDate,
|
||||
@RequestParam(value = "endDate",required = false) LocalDateTime endDate,
|
||||
@RequestParam(value = "orderId",required = false)Long orderId){
|
||||
return success(memberUserService.getUserHeat(userId,days,orderId));
|
||||
return success(memberUserService.getUserHeat(userId,startDate,endDate,orderId));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -15,6 +15,7 @@ import cn.iocoder.yudao.module.member.controller.app.user.vo.AppNutritionWeekVO;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -208,7 +209,7 @@ public interface MemberUserService {
|
||||
*/
|
||||
List<AppNutritionWeekVO> NutritionWeek(String start, String end);
|
||||
|
||||
List<Map> getUserHeat(Long userId,Integer days,Long orderId);
|
||||
List<Map> getUserHeat(Long userId, LocalDateTime startDate,LocalDateTime endDate, Long orderId);
|
||||
|
||||
|
||||
}
|
||||
|
@ -544,20 +544,11 @@ public class MemberUserServiceImpl implements MemberUserService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map> getUserHeat(Long userId, Integer days,Long orderId) {
|
||||
public List<Map> getUserHeat(Long userId, LocalDateTime startDate,LocalDateTime endDate,Long orderId) {
|
||||
if(ObjectUtil.isNotEmpty(orderId)){
|
||||
return suggestion(userId,null,null,Boolean.FALSE,orderId);
|
||||
}
|
||||
//判断是一天与一周
|
||||
if(days==7){
|
||||
LocalDateTime endDate = LocalDateTimeUtil.now();
|
||||
LocalDateTime offset = LocalDateTimeUtil.offset(endDate, -7, ChronoUnit.DAYS);
|
||||
LocalDateTime startDate = LocalDateTimeUtil.beginOfDay(offset);
|
||||
return suggestion(userId,startDate,endDate,Boolean.TRUE,null);
|
||||
}else{
|
||||
LocalDateTime endDate = LocalDateTimeUtil.now();
|
||||
LocalDateTime startDate = LocalDateTimeUtil.beginOfDay(endDate);
|
||||
return suggestion(userId,startDate,endDate,Boolean.FALSE,null);
|
||||
return suggestion(userId,startDate,endDate,Boolean.TRUE,null);
|
||||
}
|
||||
}
|
||||
public List<Map> suggestion(Long userId,LocalDateTime startDate,LocalDateTime endDate,Boolean bol,Long orderId) {
|
||||
|
Reference in New Issue
Block a user