| | |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.domain.Physcial; |
| | | import com.ruoyi.domain.ZInfoUser; |
| | | import com.ruoyi.domain.ZYearInfo; |
| | | import com.ruoyi.mapper.PhyscialMapper; |
| | | import com.ruoyi.service.PhyscialService; |
| | | import com.ruoyi.service.ZInfoUserService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | import java.util.Arrays; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | public class PhyscialServiceImpl extends ServiceImpl<PhyscialMapper, Physcial> implements PhyscialService { |
| | | @Autowired |
| | | PhyscialServiceImpl physcialService; |
| | | |
| | | @Autowired |
| | | ZInfoUserService zInfoUserService; |
| | | private LambdaQueryWrapper<Physcial> uniqueCondition(Physcial physcial) { |
| | | LambdaQueryWrapper<Physcial> lqw = new LambdaQueryWrapper<>(); |
| | | lqw.eq(StringUtils.isNotEmpty(physcial.getReport()), Physcial::getReport, physcial.getReport()) |
| | |
| | | .orderByDesc(Physcial::getCreateTime); |
| | | return lqw; |
| | | } |
| | | |
| | | private LambdaQueryWrapper<Physcial> buildConditionSec(Physcial physcial, List<Long> userId) { |
| | | LambdaQueryWrapper<Physcial> lqw = new LambdaQueryWrapper<>(); |
| | | lqw.in(Physcial::getUid, userId) |
| | | .like(StringUtils.isNotEmpty(physcial.getReport()), Physcial::getReport, physcial.getReport()) |
| | | .between(physcial.getHappenStartTime() != null && physcial.getHappenEndTime() != null, Physcial::getHappenTime, physcial.getHappenStartTime(), physcial.getHappenEndTime()) |
| | | .orderByDesc(Physcial::getCreateTime); |
| | | return lqw; |
| | | } |
| | | /** |
| | | * 分页查找 |
| | | */ |
| | |
| | | public AjaxResult selectDataList(Physcial physcial, Integer pageNum, Integer pageSize) { |
| | | SysUser user = SecurityUtils.getLoginUser().getUser(); |
| | | Long userId = user.getUserId(); |
| | | LambdaQueryWrapper<Physcial> lqw = buildCondition(physcial, userId); |
| | | |
| | | //根据userId查询到infouser的uaid |
| | | ZInfoUser zInfoUser = zInfoUserService.getInfoBysysId(userId); |
| | | //拿到所有的sysid |
| | | List<Long> fms = zInfoUserService.findByUaidToFaid(zInfoUser.getUaid()).stream().map(ZInfoUser::getSysId).collect(Collectors.toList()); |
| | | LambdaQueryWrapper<Physcial> lqw; |
| | | if(!fms.isEmpty()) |
| | | lqw = buildConditionSec(physcial, fms); |
| | | else |
| | | lqw = buildCondition(physcial, userId); |
| | | Page<Physcial> pageBean = new Page<>(pageNum, pageSize); |
| | | Page<Physcial> pageResult = page(pageBean, lqw); |
| | | |