1、开放api权限,admin模块权限设置后续会更新
2、修复优惠券领取时间不限制导致不显示的bug 3、更新了一些config配置数据
This commit is contained in:
@@ -28,11 +28,10 @@ public class AdminAuthInterceptor implements HandlerInterceptor {
|
||||
|
||||
Boolean result = systemRoleService.checkAuth(uri);
|
||||
|
||||
//TODO 此处暂时放开
|
||||
// if(!result){
|
||||
// response.getWriter().write(JSONObject.toJSONString(CommonResult.forbidden()));
|
||||
// return false;
|
||||
// }
|
||||
if(!result){
|
||||
response.getWriter().write(JSONObject.toJSONString(CommonResult.forbidden()));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -122,7 +122,7 @@ public class RestTemplateUtil {
|
||||
|
||||
public String postFormData(String url, MultiValueMap<String, String> map) {
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.setContentType(MediaType.MULTIPART_FORM_DATA);
|
||||
// headers.setContentType(MediaType.MULTIPART_FORM_DATA);
|
||||
HttpEntity<MultiValueMap<String, String>> requests = new HttpEntity<MultiValueMap<String, String>>(map, headers);
|
||||
String body = restTemplate.postForEntity(url, requests, String.class).getBody();
|
||||
return body;
|
||||
|
||||
@@ -38,4 +38,6 @@ public interface CategoryService extends IService<Category> {
|
||||
List<Category> getChildVoListByPid(Integer pid);
|
||||
|
||||
int checkName(String name, Integer type);
|
||||
|
||||
boolean checkUrl(String uri);
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ public class CategoryServiceImpl extends ServiceImpl<CategoryDao, Category> impl
|
||||
@Override
|
||||
public Boolean checkAuth(List<Integer> pathIdList, String uri) {
|
||||
LambdaQueryWrapper<Category> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.in(Category::getId, pathIdList).eq(Category::getStatus, 1).eq(Category::getUrl, uri);
|
||||
lambdaQueryWrapper.in(Category::getId, pathIdList).eq(Category::getUrl, uri);
|
||||
List<Category> categoryList = dao.selectList(lambdaQueryWrapper);
|
||||
if(categoryList.size() < 1){
|
||||
return false;
|
||||
@@ -343,7 +343,7 @@ public class CategoryServiceImpl extends ServiceImpl<CategoryDao, Category> impl
|
||||
}
|
||||
|
||||
/**
|
||||
* 检测分类码是否存在
|
||||
* 检测分类名称是否存在
|
||||
* @param name String 分类名
|
||||
* @param type int 类型
|
||||
* @author Mr.Zhang
|
||||
@@ -357,5 +357,19 @@ public class CategoryServiceImpl extends ServiceImpl<CategoryDao, Category> impl
|
||||
.eq(Category::getType, type);
|
||||
return dao.selectCount(lambdaQueryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 检测url是否存在
|
||||
* @param uri String url
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-04-16
|
||||
* @return int
|
||||
*/
|
||||
@Override
|
||||
public boolean checkUrl(String uri) {
|
||||
LambdaQueryWrapper<Category> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(Category::getUrl, uri);
|
||||
return dao.selectCount(lambdaQueryWrapper) > 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -286,6 +286,11 @@ public class StoreCouponServiceImpl extends ServiceImpl<StoreCouponDao, StoreCou
|
||||
if(null != couponUserMap && couponUserMap.containsKey(storeCoupon.getId())){
|
||||
response.setIsUse(true);
|
||||
}
|
||||
|
||||
if(response.getReceiveEndTime() == null){
|
||||
response.setReceiveStartTime(null);
|
||||
}
|
||||
|
||||
storeCouponFrontResponseArrayList.add(response);
|
||||
}
|
||||
|
||||
@@ -320,9 +325,8 @@ public class StoreCouponServiceImpl extends ServiceImpl<StoreCouponDao, StoreCou
|
||||
.eq(StoreCoupon::getStatus, 1)
|
||||
//剩余数量大于0 或者不设置上限
|
||||
.and(i -> i.gt(StoreCoupon::getLastTotal, 0).or().eq(StoreCoupon::getIsLimited, false))
|
||||
//领取时间范围
|
||||
.lt(StoreCoupon::getReceiveStartTime, date)
|
||||
.gt(StoreCoupon::getReceiveEndTime, date);
|
||||
//领取时间范围, 结束时间为null则是不限时
|
||||
.and(i -> i.isNull(StoreCoupon::getReceiveEndTime).or( p -> p.lt(StoreCoupon::getReceiveStartTime, date).gt(StoreCoupon::getReceiveEndTime, date)));
|
||||
if(productId > 0){
|
||||
//有商品id 通用券可以领取,商品券可以领取,分类券可以领取
|
||||
getPrimaryKeySql(lambdaQueryWrapper, productId.toString());
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -84,6 +84,11 @@ public class SystemRoleServiceImpl extends ServiceImpl<SystemRoleDao, SystemRole
|
||||
*/
|
||||
@Override
|
||||
public Boolean checkAuth(String uri) {
|
||||
//查询当前路由是否配置了权限,如果没有配置则直接通过
|
||||
if(!categoryService.checkUrl(uri)){
|
||||
return true;
|
||||
}
|
||||
|
||||
List<Integer> categoryIdList = getRoleListInRoleId();
|
||||
if(categoryIdList.size() < 1){
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user