| | |
| | | public CommonPage selectProductFlowList(HzProductFlow productFlow) { |
| | | SysUser currentUser = SecurityUtils.getLoginUser().getUser(); |
| | | checkUserAllowed(null,currentUser); |
| | | //设置分表id |
| | | IdTableNameHandler.setCurrentId(currentUser.getCompanyId()); |
| | | productFlow.setCompanyId(currentUser.getCompanyId()); |
| | | if (currentUser.getUserType().equals(UserTypeEnum.CHECK_USER.getCode())){ |
| | | IdTableNameHandler.setCurrentId(productFlow.getCompanyId()); |
| | | }else { |
| | | //设置分表id |
| | | //todo |
| | | IdTableNameHandler.setCurrentId(currentUser.getCompanyId()); |
| | | productFlow.setCompanyId(currentUser.getCompanyId()); |
| | | } |
| | | PageUtils.startPage(); |
| | | List<HzProductFlow> flowList = baseMapper.selectProductFlowList(productFlow); |
| | | IdTableNameHandler.removeCurrentId(); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<HzProductFlow> selectAllProductFlowByCode(String code) { |
| | | public List<HzProductFlow> selectAllProductFlowByCode(String code,Long companyId) { |
| | | SysUser currentUser=SecurityUtils.getLoginUser().getUser(); |
| | | checkUserAllowed(null,currentUser); |
| | | if(!code.startsWith(CodePrexEnum.GOOD.getCode())){ |
| | | throw new ApiException("条码格式不正确"); |
| | | } |
| | | //设置分表id |
| | | IdTableNameHandler.setCurrentId(currentUser.getCompanyId()); |
| | | HzProduct product=productMapper.selectProductByCode(code,currentUser.getCompanyId()); |
| | | if (currentUser.getUserType().equals(UserTypeEnum.CHECK_USER.getCode())){ |
| | | IdTableNameHandler.setCurrentId(companyId); |
| | | }else { |
| | | //设置分表id |
| | | IdTableNameHandler.setCurrentId(currentUser.getCompanyId()); |
| | | } |
| | | |
| | | HzProduct product=productMapper.selectProductByCode(code,currentUser.getUserType().equals(UserTypeEnum.CHECK_USER.getCode())?companyId:currentUser.getCompanyId()); |
| | | if(product==null){ |
| | | throw new ApiException("成品条码数据不存在"); |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<HzProductFlow> getAllProductFlowByProductId(Long productId) { |
| | | public List<HzProductFlow> getAllProductFlowByProductId(Long productId,Long companyId) { |
| | | SysUser currentUser=SecurityUtils.getLoginUser().getUser(); |
| | | checkUserAllowed(null,currentUser); |
| | | //设置分表id |
| | | IdTableNameHandler.setCurrentId(currentUser.getCompanyId()); |
| | | if (currentUser.getUserType().equals(UserTypeEnum.CHECK_USER.getCode())){ |
| | | IdTableNameHandler.setCurrentId(companyId); |
| | | }else { |
| | | //设置分表id |
| | | IdTableNameHandler.setCurrentId(currentUser.getCompanyId()); |
| | | } |
| | | HzProduct product=productMapper.selectById(productId); |
| | | if(product==null){ |
| | | throw new ApiException("成品数据不存在"); |
| | |
| | | throw new ApiException("管理员不能操作"); |
| | | } |
| | | if(productFlow!=null){ |
| | | if(!Objects.equals(user.getCompanyId(), productFlow.getCompanyId())){ |
| | | throw new ApiException("无权限操作其他企业数据"); |
| | | if (!user.getUserType().equals(UserTypeEnum.CHECK_USER.getCode())) { |
| | | if (!Objects.equals(user.getCompanyId(), productFlow.getCompanyId())) { |
| | | throw new ApiException("无权限操作其他企业数据"); |
| | | } |
| | | } |
| | | } |
| | | } |