chenrui
2025-04-09 00c23dd7d4a8f229d5c7fbe3439c6ea230fa7f48
inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderPlanServiceImpl.java
@@ -55,6 +55,7 @@
import com.ruoyi.system.service.InformationNotificationService;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.xwpf.usermodel.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.ClassPathResource;
import org.springframework.mock.web.MockMultipartFile;
@@ -154,28 +155,18 @@
    @Override
    public IPage<InsOrderPlanVO> selectInsOrderPlanList(Page page, InsOrderPlanDTO insOrderPlanDTO) {
        // todo: 仅看自己或者实验室
        //获取当前人所属实验室id
        String laboratory = null;
        String userName = null;
        Integer userId = null;
        if (ObjectUtil.isNotEmpty(insOrderPlanDTO.getUserId())) {
            userId = SecurityUtils.getUserId().intValue();
            userName = userMapper.selectById(userId).getName();
        // 检测管理人员全查,非检测管理人员只查看自己的
        InsOrderPlanQueryDto insOrderPlanQueryDto = new InsOrderPlanQueryDto();
        insOrderPlanQueryDto.setCheckUserFlag(SecurityUtils.hasRole("inspector"));
        insOrderPlanQueryDto.setTestAdminFlag(SecurityUtils.hasRole("testadmin"));
        // 判断是否触发只查看自己
        if(null != insOrderPlanDTO.getUserId()){
            insOrderPlanQueryDto.setViewMySelfFlag(true);
            insOrderPlanDTO.setUserId(null);
        }
        Integer isCheck = insOrderPlanDTO.getIsCheck();
        insOrderPlanDTO.setIsCheck(null);
        String sonLaboratory = insOrderPlanDTO.getSonLaboratory();//试验室
        insOrderPlanQueryDto.setUserId(SecurityUtils.getUserId().intValue());
        IPage<InsOrderPlanVO> insOrderPage = insSampleMapper.findInsSampleAndOrder(page,
                QueryWrappers.queryWrappers(insOrderPlanDTO),
                userName,
                userId,
                sonLaboratory,
                laboratory,
                isCheck);
                QueryWrappers.queryWrappers(insOrderPlanDTO),insOrderPlanQueryDto);
        return insOrderPage;
    }