| | |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.bean.BeanUtils; |
| | | import com.ruoyi.domain.Physcial; |
| | | import com.ruoyi.domain.ZHealthHabit; |
| | | import com.ruoyi.domain.ZHealthHabit; |
| | | import com.ruoyi.domain.ZInfoUser; |
| | | import com.ruoyi.domain.dto.ZHealthHabitDto; |
| | | import com.ruoyi.domain.dto.ZHealthHabitDto; |
| | | import com.ruoyi.domain.health.*; |
| | | import com.ruoyi.mapper.ZHealthHabitMapper; |
| | | import com.ruoyi.service.ZHealthHabitService; |
| | | import com.ruoyi.service.ZInfoUserService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | @Service |
| | | public class ZHealthHabitServiceImpl extends ServiceImpl<ZHealthHabitMapper, ZHealthHabit> implements ZHealthHabitService { |
| | | |
| | | @Autowired |
| | | ZInfoUserService zInfoUserService; |
| | | @Override |
| | | public AjaxResult selectData() { |
| | | SysUser user = SecurityUtils.getLoginUser().getUser(); |
| | |
| | | LambdaQueryWrapper<ZHealthHabit> lqw = new LambdaQueryWrapper<>(); |
| | | lqw.eq(ZHealthHabit::getUid,userId); |
| | | ZHealthHabit zHealthHabit = getOne(lqw); |
| | | |
| | | if(zHealthHabit==null) |
| | | { |
| | | //根据userId查询到infouser的uaid |
| | | ZInfoUser zInfoUser = zInfoUserService.getInfoBysysId(userId); |
| | | //拿到所有的sysid |
| | | List<Long> fms = zInfoUserService.findByUaidToFaid(zInfoUser.getUaid()).stream().map(ZInfoUser::getSysId).collect(Collectors.toList()); |
| | | for(Long id:fms) |
| | | { |
| | | if(!id.equals(userId)) |
| | | { |
| | | lqw.eq(ZHealthHabit::getUid, id); |
| | | zHealthHabit = getOne(lqw); |
| | | break; |
| | | } |
| | | } |
| | | System.out.println("sdfsdf9990000"); |
| | | } |
| | | //如果是第一次进来,之前没有这个用户的数据,抛异常让用户先插入数据 |
| | | if(zHealthHabit == null){ |
| | | throw new RuntimeException("第一次进来,请先填写好数据"); |