| | |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.domain.ZHealthHabit; |
| | | import com.ruoyi.domain.ZHealthNote; |
| | | import com.ruoyi.domain.ZInfoUser; |
| | | import com.ruoyi.mapper.ZHealthNoteMapper; |
| | | import com.ruoyi.service.ZHealthNoteService; |
| | | 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; |
| | | |
| | | /** |
| | | * @Author Jinquan_Ou |
| | |
| | | **/ |
| | | @Service |
| | | public class ZHealthNoteServiceImpl extends ServiceImpl<ZHealthNoteMapper, ZHealthNote> implements ZHealthNoteService { |
| | | @Autowired |
| | | ZInfoUserService zInfoUserService; |
| | | @Override |
| | | public AjaxResult listAll() { |
| | | SysUser user = SecurityUtils.getLoginUser().getUser(); |
| | |
| | | LambdaQueryWrapper<ZHealthNote> lqw = new LambdaQueryWrapper<>(); |
| | | lqw.eq(ZHealthNote::getUid,userId); |
| | | ZHealthNote result = getOne(lqw); |
| | | if(result==null) |
| | | { |
| | | //根据userId查询到infouser的uaid |
| | | ZInfoUser zInfoUser = zInfoUserService.getInfoBysysId(userId); |
| | | System.out.println("sdfsdf999000550"); |
| | | |
| | | //拿到所有的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(ZHealthNote::getUid, id); |
| | | result = getOne(lqw); |
| | | break; |
| | | } |
| | | } |
| | | System.out.println("sdfsdf9990000"); |
| | | } |
| | | if(result == null){ |
| | | throw new RuntimeException("请先填写好生活习惯数据!"); |
| | | } |