|
|
|
@@ -7,6 +7,7 @@ import com.iformall.annotation.UserDataRuleAnnotation; |
|
|
|
import com.iformall.domain.po.MallUserInfo; |
|
|
|
import com.iformall.domain.po.WxUserDataRule; |
|
|
|
import com.iformall.domain.po.base.BaseEntity; |
|
|
|
import com.iformall.enums.EnumUserDataRuleType; |
|
|
|
import com.iformall.mapper.WxRentContractMapper; |
|
|
|
import com.iformall.service.WxUserDataRuleService; |
|
|
|
import com.iformall.shiro.UserSession; |
|
|
|
@@ -60,6 +61,11 @@ public class UserDataRuleAspect { |
|
|
|
logger.info("用户的数据权限未配置"); |
|
|
|
return; |
|
|
|
} |
|
|
|
//如果是全部 |
|
|
|
if (EnumUserDataRuleType.ALL.getCode().intValue() == byUserId.getType().intValue()) { |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
String buildingFloor = byUserId.getBuildingFloor(); |
|
|
|
if (StringUtils.isNotEmpty(buildingFloor)) { |
|
|
|
Object[] data = JSONArray.parseArray(buildingFloor).toArray(); |
|
|
|
@@ -72,37 +78,37 @@ public class UserDataRuleAspect { |
|
|
|
businessForRule = StringUtils.join(data, ","); |
|
|
|
} |
|
|
|
|
|
|
|
HashSet<String> targetSet = new HashSet(); |
|
|
|
String target = byUserId.getTarget(); |
|
|
|
if (StringUtils.isNotEmpty(target)) { |
|
|
|
JSONArray objects = JSONArray.parseArray(target); |
|
|
|
for (int i = 0; i < objects.size(); i++) { |
|
|
|
JSONObject jsonObject = objects.getJSONObject(i); |
|
|
|
targetSet.add(jsonObject.getString("tag")); |
|
|
|
} |
|
|
|
} |
|
|
|
// HashSet<String> targetSet = new HashSet(); |
|
|
|
// String target = byUserId.getTarget(); |
|
|
|
// if (StringUtils.isNotEmpty(target)) { |
|
|
|
// JSONArray objects = JSONArray.parseArray(target); |
|
|
|
// for (int i = 0; i < objects.size(); i++) { |
|
|
|
// JSONObject jsonObject = objects.getJSONObject(i); |
|
|
|
// targetSet.add(jsonObject.getString("tag")); |
|
|
|
// } |
|
|
|
// } |
|
|
|
|
|
|
|
//得到注释的名称 |
|
|
|
MethodSignature signature = (MethodSignature) joinPoint.getSignature(); |
|
|
|
//判断tag是否在用户权限中 如果存在加入参数查询 |
|
|
|
Method method = signature.getMethod(); |
|
|
|
String value = method.getAnnotation(UserDataRuleAnnotation.class).value(); |
|
|
|
if (targetSet.contains(value)) { |
|
|
|
//得到方法的参数 |
|
|
|
// //得到注释的名称 |
|
|
|
// MethodSignature signature = (MethodSignature) joinPoint.getSignature(); |
|
|
|
// //判断tag是否在用户权限中 如果存在加入参数查询 |
|
|
|
// Method method = signature.getMethod(); |
|
|
|
// //String value = method.getAnnotation(UserDataRuleAnnotation.class).value(); |
|
|
|
// if (targetSet.contains(value)) { |
|
|
|
// //得到方法的参数 |
|
|
|
Object[] args = joinPoint.getArgs(); |
|
|
|
if (args[0] instanceof BaseEntity) { |
|
|
|
BaseEntity baseEntity = (BaseEntity) args[0]; |
|
|
|
baseEntity.setFloorForRule(buildingFloor); |
|
|
|
baseEntity.setBusinessForRule(businessForRule); |
|
|
|
String contract = "contract"; |
|
|
|
if (StringUtils.isNotEmpty(buildingFloor) && value.contains(contract)) { |
|
|
|
int count = wxRentContractMapper.getShopCountMax(); |
|
|
|
String[] tempShop = new String[count]; |
|
|
|
baseEntity.setTempShop(tempShop); |
|
|
|
} |
|
|
|
// String contract = "contract"; |
|
|
|
// if (StringUtils.isNotEmpty(buildingFloor) && value.contains(contract)) { |
|
|
|
// int count = wxRentContractMapper.getShopCountMax(); |
|
|
|
// String[] tempShop = new String[count]; |
|
|
|
// baseEntity.setTempShop(tempShop); |
|
|
|
// } |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
// |
|
|
|
// } |
|
|
|
} |
|
|
|
|
|
|
|
} |