供应商列表
This commit is contained in:
		
							parent
							
								
									85a8e290f5
								
							
						
					
					
						commit
						a305147524
					
				| 
						 | 
				
			
			@ -5,10 +5,6 @@ package com.bonus.common.houqin.constant;
 | 
			
		|||
 * @author bns_han
 | 
			
		||||
 */
 | 
			
		||||
public class GlobalConstants {
 | 
			
		||||
    /**
 | 
			
		||||
     * super admin role key
 | 
			
		||||
     */
 | 
			
		||||
    public static final String SUPER_ADMIN_ROLE_KEY = "admin";
 | 
			
		||||
    /**
 | 
			
		||||
     * 字符串 MSIE
 | 
			
		||||
     */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -28,6 +28,7 @@ import com.bonus.common.houqin.constant.GlobalConstants;
 | 
			
		|||
import com.bonus.common.houqin.constant.LeConstants;
 | 
			
		||||
import com.bonus.common.houqin.i18n.I18n;
 | 
			
		||||
import com.bonus.common.security.utils.SecurityUtils;
 | 
			
		||||
import com.bonus.system.api.domain.SysUser;
 | 
			
		||||
import com.bonus.system.api.model.LoginUser;
 | 
			
		||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
			
		||||
import org.springframework.context.annotation.Lazy;
 | 
			
		||||
| 
						 | 
				
			
			@ -77,6 +78,12 @@ public class MgrAuthApi {
 | 
			
		|||
//      return this.getTenantOrg(excludeMiddle, DelFlagEnum.DEL_FALSE.key());
 | 
			
		||||
//   }
 | 
			
		||||
 | 
			
		||||
   public boolean isSuperAdmin() {
 | 
			
		||||
      MgrUserAuthPO authPO = this.getUserAuthPO();
 | 
			
		||||
      String roleCode = authPO.getRoleCode();
 | 
			
		||||
      return SysUser.isAdmin(SecurityUtils.getUserId()); // || roleCode.startsWith(RoleCodeV2Enum.ROLE_ADMIN.key()) && roleCode.split("&&").length <= 1;
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
   public MgrUserAuthPO getUserAuthPO() {
 | 
			
		||||
      MgrUserAuthPO userAuthPO = new MgrUserAuthPO();
 | 
			
		||||
      LoginUser user = SecurityUtils.getLoginUser();
 | 
			
		||||
| 
						 | 
				
			
			@ -90,7 +97,7 @@ public class MgrAuthApi {
 | 
			
		|||
      String roleCodeResult = null;
 | 
			
		||||
      for (String roleCode : roleSet) {
 | 
			
		||||
         roleCodeResult = roleCode;
 | 
			
		||||
         if (roleCode.startsWith(RoleCodeV2Enum.ROLE_ADMIN.key()) || GlobalConstants.SUPER_ADMIN_ROLE_KEY.equals(roleCode)) {
 | 
			
		||||
         if (roleCode.startsWith(RoleCodeV2Enum.ROLE_ADMIN.key()) || SysUser.isAdmin(SecurityUtils.getUserId())) {
 | 
			
		||||
            roleType = MgrRoleTypeV2Enum.ROLE_ADMIN.getKey();
 | 
			
		||||
//            if (CharSequenceUtil.split(roleCode, "&&").size() > 1) {
 | 
			
		||||
//               roleType = MgrRoleTypeV2Enum.ROLE_ADMIN.getKey();
 | 
			
		||||
| 
						 | 
				
			
			@ -132,7 +139,8 @@ public class MgrAuthApi {
 | 
			
		|||
      if (!filterOtherRole) {
 | 
			
		||||
         return CollUtil.newArrayList(new AllocCanteenTreeVO[0]);
 | 
			
		||||
      } else if (!ObjectUtil.equal(mgrUserAuthPO.getRoleType(), MgrRoleTypeV2Enum.ROLE_ADMIN.getKey())
 | 
			
		||||
              && !ObjectUtil.equal(mgrUserAuthPO.getRoleCode(), GlobalConstants.SUPER_ADMIN_ROLE_KEY)
 | 
			
		||||
              //&& !ObjectUtil.equal(mgrUserAuthPO.getRoleCode(), GlobalConstants.SUPER_ADMIN_ROLE_KEY)
 | 
			
		||||
              && !SysUser.isAdmin(SecurityUtils.getUserId())
 | 
			
		||||
              && !ObjectUtil.equal(mgrUserAuthPO.getRoleType(), MgrRoleTypeV2Enum.ROLE_ORG.getKey())) {
 | 
			
		||||
         return this.mgrRoleCanteenMapper.getTenantCanteen(excludeMiddle, tenantId, mgrUserAuthPO, delFlag);
 | 
			
		||||
      } else {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,6 +6,7 @@ import com.bonus.canteen.core.auth.enums.RoleCodeV2Enum;
 | 
			
		|||
import com.bonus.common.core.exception.ServiceException;
 | 
			
		||||
import com.bonus.common.houqin.constant.GlobalConstants;
 | 
			
		||||
import com.bonus.common.security.utils.SecurityUtils;
 | 
			
		||||
import com.bonus.system.api.domain.SysUser;
 | 
			
		||||
import net.sf.jsqlparser.expression.Expression;
 | 
			
		||||
import net.sf.jsqlparser.expression.HexValue;
 | 
			
		||||
import net.sf.jsqlparser.expression.operators.conditional.AndExpression;
 | 
			
		||||
| 
						 | 
				
			
			@ -88,7 +89,7 @@ public class LeNiuDataPermissionHandler {
 | 
			
		|||
   private String getSqlByAliasAndPermissionType(Long userId, String roleCode, DataPermissionTypeEnum permissionType, String alias) {
 | 
			
		||||
      StringBuilder sb = new StringBuilder();
 | 
			
		||||
 | 
			
		||||
      if (roleCode.startsWith(RoleCodeV2Enum.ROLE_ADMIN.key()) || GlobalConstants.SUPER_ADMIN_ROLE_KEY.equals(roleCode)) {
 | 
			
		||||
      if (roleCode.startsWith(RoleCodeV2Enum.ROLE_ADMIN.key()) || SysUser.isAdmin(SecurityUtils.getUserId())) {
 | 
			
		||||
         return "";
 | 
			
		||||
      } else {
 | 
			
		||||
           if (ObjectUtil.equal(DataPermissionTypeEnum.PERMISSION_ORG, permissionType)) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,5 +1,6 @@
 | 
			
		|||
package com.bonus.canteen.core.drp.api;
 | 
			
		||||
 | 
			
		||||
import cn.hutool.core.collection.CollUtil;
 | 
			
		||||
import cn.hutool.core.util.ObjectUtil;
 | 
			
		||||
import com.bonus.canteen.core.auth.api.MgrAuthApi;
 | 
			
		||||
import com.bonus.canteen.core.drp.mapper.DrpSupplierMapper;
 | 
			
		||||
| 
						 | 
				
			
			@ -46,21 +47,21 @@ public class DrpAuthorityApi {
 | 
			
		|||
//   public MgrUserAuthPO getUserAuthPO() {
 | 
			
		||||
//      return this.mgrAuthApi.getUserAuthPO();
 | 
			
		||||
//   }
 | 
			
		||||
//
 | 
			
		||||
//   public List<Long> authAreaList(List<Long> areaIdList) {
 | 
			
		||||
//      if (this.mgrAuthApi.isSuperAdmin()) {
 | 
			
		||||
//         return areaIdList;
 | 
			
		||||
//      } else {
 | 
			
		||||
//         List<Long> authArea = this.mgrAuthApi.getTenantAreaIdList();
 | 
			
		||||
//         if (CollUtil.isEmpty(areaIdList)) {
 | 
			
		||||
//            return authArea;
 | 
			
		||||
//         } else {
 | 
			
		||||
//            authArea.retainAll(areaIdList);
 | 
			
		||||
//            return (List)(CollUtil.isEmpty(authArea) ? CollUtil.newArrayList(new Long[]{-1L}) : authArea);
 | 
			
		||||
//         }
 | 
			
		||||
//      }
 | 
			
		||||
//   }
 | 
			
		||||
//
 | 
			
		||||
 | 
			
		||||
   public List<Long> authAreaList(List<Long> areaIdList) {
 | 
			
		||||
      if (this.mgrAuthApi.isSuperAdmin()) {
 | 
			
		||||
         return areaIdList;
 | 
			
		||||
      } else {
 | 
			
		||||
         List<Long> authArea = this.mgrAuthApi.getTenantAreaIdList();
 | 
			
		||||
         if (CollUtil.isEmpty(areaIdList)) {
 | 
			
		||||
            return authArea;
 | 
			
		||||
         } else {
 | 
			
		||||
            authArea.retainAll(areaIdList);
 | 
			
		||||
            return (List)(CollUtil.isEmpty(authArea) ? CollUtil.newArrayList(new Long[]{-1L}) : authArea);
 | 
			
		||||
         }
 | 
			
		||||
      }
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
//   public Long getAreaByDeviceSn(String machineSn) {
 | 
			
		||||
//      try {
 | 
			
		||||
//         return ((DeviceBind)this.deviceApi.listBindByDeviceSn(machineSn).get(0)).getAreaId();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,7 @@
 | 
			
		|||
package com.bonus.canteen.core.drp.service;
 | 
			
		||||
 | 
			
		||||
import com.baomidou.mybatisplus.extension.service.IService;
 | 
			
		||||
import com.bonus.canteen.core.drp.model.DrpSupplierCategory;
 | 
			
		||||
 | 
			
		||||
public interface DrpSupplierCategoryService extends IService<DrpSupplierCategory> {
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,11 @@
 | 
			
		|||
package com.bonus.canteen.core.drp.service.impl;
 | 
			
		||||
 | 
			
		||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 | 
			
		||||
import com.bonus.canteen.core.drp.mapper.DrpSupplierCategoryMapper;
 | 
			
		||||
import com.bonus.canteen.core.drp.model.DrpSupplierCategory;
 | 
			
		||||
import com.bonus.canteen.core.drp.service.DrpSupplierCategoryService;
 | 
			
		||||
import org.springframework.stereotype.Service;
 | 
			
		||||
 | 
			
		||||
@Service
 | 
			
		||||
public class DrpSupplierCategoryServiceImpl extends ServiceImpl<DrpSupplierCategoryMapper, DrpSupplierCategory> implements DrpSupplierCategoryService {
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -28,6 +28,7 @@ import com.bonus.canteen.core.drp.model.DrpSupplierCategory;
 | 
			
		|||
import com.bonus.canteen.core.drp.model.DrpSupplierDeliver;
 | 
			
		||||
import com.bonus.canteen.core.drp.model.DrpSupplierQualification;
 | 
			
		||||
import com.bonus.canteen.core.drp.po.CategoryModel;
 | 
			
		||||
import com.bonus.canteen.core.drp.service.DrpSupplierCategoryService;
 | 
			
		||||
import com.bonus.canteen.core.drp.service.DrpSupplierDeliverService;
 | 
			
		||||
import com.bonus.canteen.core.drp.service.DrpSupplierQualificationService;
 | 
			
		||||
import com.bonus.canteen.core.drp.service.DrpSupplierService;
 | 
			
		||||
| 
						 | 
				
			
			@ -65,9 +66,9 @@ public class DrpSupplierServiceImpl extends ServiceImpl<DrpSupplierMapper, DrpSu
 | 
			
		|||
   @Autowired
 | 
			
		||||
   @Lazy
 | 
			
		||||
   private DrpSupplierCategoryMapper drpSupplierCategoryMapper;
 | 
			
		||||
//   @Autowired
 | 
			
		||||
//   @Lazy
 | 
			
		||||
//   private DrpSupplierCategoryService drpSupplierCategoryService;
 | 
			
		||||
   @Autowired
 | 
			
		||||
   @Lazy
 | 
			
		||||
   private DrpSupplierCategoryService drpSupplierCategoryService;
 | 
			
		||||
   @Autowired
 | 
			
		||||
   @Lazy
 | 
			
		||||
   private DrpSupplierQualificationMapper drpSupplierQualificationMapper;
 | 
			
		||||
| 
						 | 
				
			
			@ -454,22 +455,22 @@ public class DrpSupplierServiceImpl extends ServiceImpl<DrpSupplierMapper, DrpSu
 | 
			
		|||
//      }
 | 
			
		||||
//
 | 
			
		||||
//   }
 | 
			
		||||
//
 | 
			
		||||
//   protected void insertSupplierCategoryBatch(List<Long> categoryIdList, Long supplierId) {
 | 
			
		||||
//      List<DrpSupplierCategory> supplierCategoryList = new ArrayList();
 | 
			
		||||
//      Iterator var4 = categoryIdList.iterator();
 | 
			
		||||
//
 | 
			
		||||
//      while(var4.hasNext()) {
 | 
			
		||||
//         Long categoryId = (Long)var4.next();
 | 
			
		||||
//         DrpSupplierCategory supplierCategory = new DrpSupplierCategory();
 | 
			
		||||
//         supplierCategory.setSupplierId(supplierId);
 | 
			
		||||
//         supplierCategory.setCategoryId(categoryId);
 | 
			
		||||
//         supplierCategoryList.add(supplierCategory);
 | 
			
		||||
//      }
 | 
			
		||||
//
 | 
			
		||||
//      this.drpSupplierCategoryService.saveBatch(supplierCategoryList);
 | 
			
		||||
//   }
 | 
			
		||||
//
 | 
			
		||||
 | 
			
		||||
   protected void insertSupplierCategoryBatch(List<Long> categoryIdList, Long supplierId) {
 | 
			
		||||
      List<DrpSupplierCategory> supplierCategoryList = new ArrayList();
 | 
			
		||||
      Iterator var4 = categoryIdList.iterator();
 | 
			
		||||
 | 
			
		||||
      while(var4.hasNext()) {
 | 
			
		||||
         Long categoryId = (Long)var4.next();
 | 
			
		||||
         DrpSupplierCategory supplierCategory = new DrpSupplierCategory();
 | 
			
		||||
         supplierCategory.setSupplierId(supplierId);
 | 
			
		||||
         supplierCategory.setCategoryId(categoryId);
 | 
			
		||||
         supplierCategoryList.add(supplierCategory);
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      this.drpSupplierCategoryService.saveBatch(supplierCategoryList);
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
//   public List<DrpMaterialSupplierVO> getMaterialSupplier(DrpMaterialInfoDTO content) {
 | 
			
		||||
//      List drpMaterialSupplierList;
 | 
			
		||||
//      if (!ObjectUtil.isNull(content.getConfigType()) && !ObjectUtil.equal(content.getConfigType(), 1)) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue