| | |
| | | import com.ruoyi.production.pojo.ProductWorkOrder; |
| | | import com.ruoyi.production.pojo.ProductWorkOrderFile; |
| | | import com.ruoyi.production.service.ProductWorkOrderService; |
| | | import com.ruoyi.project.system.domain.SysPost; |
| | | import com.ruoyi.project.system.domain.SysUser; |
| | | import com.ruoyi.project.system.mapper.SysPostMapper; |
| | | import com.ruoyi.project.system.mapper.SysUserMapper; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | |
| | | @Autowired |
| | | private SysUserMapper sysUserMapper; |
| | | |
| | | @Autowired |
| | | private SysPostMapper sysPostMapper; |
| | | |
| | | @Override |
| | | public IPage<ProductWorkOrderDto> listPage(Page<ProductWorkOrderDto> page, ProductWorkOrderDto productWorkOrder) { |
| | | Long userId = SecurityUtils.getUserId(); |
| | | if (!SecurityUtils.isAdmin(userId) && !SecurityUtils.hasRole(Constants.WORKSHOP_DEPUTY_DIRECTOR)) { |
| | | productWorkOrder.setCurrentUserId(userId); |
| | | List<SysPost> posts = sysPostMapper.selectPostsByUserName(SecurityUtils.getUsername()); |
| | | boolean isWorkshopDirector = CollectionUtils.isNotEmpty(posts) |
| | | && posts.stream().anyMatch(post -> Constants.WORKSHOP_DIRECTOR_POST.equals(post.getPostCode())); |
| | | if (!isWorkshopDirector) { |
| | | productWorkOrder.setCurrentUserId(userId); |
| | | } |
| | | } |
| | | return productWorkOrdermapper.pageProductWorkOrder(page, productWorkOrder); |
| | | } |