修复 redis存时间的问题
This commit is contained in:
@ -45,7 +45,7 @@ public class YxStoreCombinationController {
|
||||
@PutMapping(value = "/yxStoreCombination")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','YXSTORECOMBINATION_ALL','YXSTORECOMBINATION_EDIT')")
|
||||
public ResponseEntity update(@Validated @RequestBody YxStoreCombination resources){
|
||||
//if(ObjectUtil.isNotNull(resources)) throw new BadRequestException("演示环境禁止操作");
|
||||
if(ObjectUtil.isNotNull(resources)) throw new BadRequestException("演示环境禁止操作");
|
||||
if(ObjectUtil.isNotNull(resources.getStartTimeDate())){
|
||||
resources.setStartTime(OrderUtil.
|
||||
dateToTimestamp(resources.getStartTimeDate()));
|
||||
@ -67,7 +67,7 @@ public class YxStoreCombinationController {
|
||||
@ApiOperation(value = "开启关闭")
|
||||
@PostMapping(value = "/yxStoreCombination/onsale/{id}")
|
||||
public ResponseEntity onSale(@PathVariable Integer id,@RequestBody String jsonStr){
|
||||
//if(id > 0) throw new BadRequestException("演示环境禁止操作");
|
||||
if(id > 0) throw new BadRequestException("演示环境禁止操作");
|
||||
JSONObject jsonObject = JSON.parseObject(jsonStr);
|
||||
int status = Integer.valueOf(jsonObject.get("status").toString());
|
||||
//System.out.println(status);
|
||||
@ -80,7 +80,7 @@ public class YxStoreCombinationController {
|
||||
@DeleteMapping(value = "/yxStoreCombination/{id}")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','YXSTORECOMBINATION_ALL','YXSTORECOMBINATION_DELETE')")
|
||||
public ResponseEntity delete(@PathVariable Integer id){
|
||||
//if(id > 0) throw new BadRequestException("演示环境禁止操作");
|
||||
if(id > 0) throw new BadRequestException("演示环境禁止操作");
|
||||
YxStoreCombination combination = new YxStoreCombination();
|
||||
combination.setIsDel(1);
|
||||
yxStoreCombinationService.update(combination);
|
||||
|
@ -36,11 +36,13 @@ public class RedisServiceImpl implements RedisService {
|
||||
}
|
||||
for (Object s : redisTemplate.keys(key)) {
|
||||
// 过滤掉权限的缓存
|
||||
if (s.toString().indexOf("role::loadPermissionByUser") != -1 || s.toString().indexOf("user::loadUserByUsername") != -1) {
|
||||
if (s.toString().indexOf("role::loadPermissionByUser") != -1
|
||||
|| s.toString().indexOf("user::loadUserByUsername") != -1
|
||||
|| s.toString().indexOf("wechat") != -1 || s.toString().indexOf("wxpay") != -1) {
|
||||
continue;
|
||||
}
|
||||
DataType dataType = redisTemplate.type(s.toString());
|
||||
if(dataType.code().equals("hash")) continue;
|
||||
if(!dataType.code().equals("string")) continue;
|
||||
RedisVo redisVo = new RedisVo(s.toString(),redisTemplate.opsForValue().get(s.toString()).toString());
|
||||
redisVos.add(redisVo);
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ public class QuartzJobController {
|
||||
@PostMapping(value = "/jobs")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','JOB_ALL','JOB_CREATE')")
|
||||
public ResponseEntity create(@Validated @RequestBody QuartzJob resources){
|
||||
//if(ObjectUtil.isNotNull(resources)) throw new BadRequestException("演示环境禁止操作");
|
||||
if(ObjectUtil.isNotNull(resources)) throw new BadRequestException("演示环境禁止操作");
|
||||
if (resources.getId() != null) {
|
||||
throw new BadRequestException("A new "+ ENTITY_NAME +" cannot already have an ID");
|
||||
}
|
||||
@ -57,7 +57,7 @@ public class QuartzJobController {
|
||||
@PutMapping(value = "/jobs")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','JOB_ALL','JOB_EDIT')")
|
||||
public ResponseEntity update(@Validated(QuartzJob.Update.class) @RequestBody QuartzJob resources){
|
||||
//if(ObjectUtil.isNotNull(resources)) throw new BadRequestException("演示环境禁止操作");
|
||||
if(ObjectUtil.isNotNull(resources)) throw new BadRequestException("演示环境禁止操作");
|
||||
quartzJobService.update(resources);
|
||||
return new ResponseEntity(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
@ -66,7 +66,7 @@ public class QuartzJobController {
|
||||
@PutMapping(value = "/jobs/{id}")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','JOB_ALL','JOB_EDIT')")
|
||||
public ResponseEntity updateIsPause(@PathVariable Long id){
|
||||
//if(id > 0) throw new BadRequestException("演示环境禁止操作");
|
||||
if(id > 0) throw new BadRequestException("演示环境禁止操作");
|
||||
quartzJobService.updateIsPause(quartzJobService.findById(id));
|
||||
return new ResponseEntity(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
@ -75,7 +75,7 @@ public class QuartzJobController {
|
||||
@PutMapping(value = "/jobs/exec/{id}")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','JOB_ALL','JOB_EDIT')")
|
||||
public ResponseEntity execution(@PathVariable Long id){
|
||||
//if(id > 0) throw new BadRequestException("演示环境禁止操作");
|
||||
if(id > 0) throw new BadRequestException("演示环境禁止操作");
|
||||
quartzJobService.execution(quartzJobService.findById(id));
|
||||
return new ResponseEntity(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
@ -84,7 +84,7 @@ public class QuartzJobController {
|
||||
@DeleteMapping(value = "/jobs/{id}")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','JOB_ALL','JOB_DELETE')")
|
||||
public ResponseEntity delete(@PathVariable Long id){
|
||||
//if(id > 0) throw new BadRequestException("演示环境禁止操作");
|
||||
if(id > 0) throw new BadRequestException("演示环境禁止操作");
|
||||
quartzJobService.delete(quartzJobService.findById(id));
|
||||
return new ResponseEntity(HttpStatus.OK);
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ public class YxStoreCategoryController {
|
||||
@PostMapping(value = "/yxStoreCategory")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','YXSTORECATEGORY_ALL','YXSTORECATEGORY_CREATE')")
|
||||
public ResponseEntity create(@Validated @RequestBody YxStoreCategory resources){
|
||||
//if(ObjectUtil.isNotNull(resources)) throw new BadRequestException("演示环境禁止操作");
|
||||
if(ObjectUtil.isNotNull(resources)) throw new BadRequestException("演示环境禁止操作");
|
||||
resources.setAddTime(OrderUtil.getSecondTimestampTwo());
|
||||
return new ResponseEntity(yxStoreCategoryService.create(resources),HttpStatus.CREATED);
|
||||
}
|
||||
@ -57,7 +57,7 @@ public class YxStoreCategoryController {
|
||||
@PutMapping(value = "/yxStoreCategory")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','YXSTORECATEGORY_ALL','YXSTORECATEGORY_EDIT')")
|
||||
public ResponseEntity update(@Validated @RequestBody YxStoreCategory resources){
|
||||
//if(ObjectUtil.isNotNull(resources)) throw new BadRequestException("演示环境禁止操作");
|
||||
if(ObjectUtil.isNotNull(resources)) throw new BadRequestException("演示环境禁止操作");
|
||||
yxStoreCategoryService.update(resources);
|
||||
return new ResponseEntity(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
@ -67,7 +67,7 @@ public class YxStoreCategoryController {
|
||||
@DeleteMapping(value = "/yxStoreCategory/{id}")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','YXSTORECATEGORY_ALL','YXSTORECATEGORY_DELETE')")
|
||||
public ResponseEntity delete(@PathVariable Integer id){
|
||||
//if(id > 0) throw new BadRequestException("演示环境禁止操作");
|
||||
if(id > 0) throw new BadRequestException("演示环境禁止操作");
|
||||
yxStoreCategoryService.delete(id);
|
||||
return new ResponseEntity(HttpStatus.OK);
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ public class YxStoreProductController {
|
||||
@PostMapping(value = "/yxStoreProduct")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','YXSTOREPRODUCT_ALL','YXSTOREPRODUCT_CREATE')")
|
||||
public ResponseEntity create(@Validated @RequestBody YxStoreProduct resources){
|
||||
//if(ObjectUtil.isNotNull(resources)) throw new BadRequestException("演示环境禁止操作");
|
||||
if(ObjectUtil.isNotNull(resources)) throw new BadRequestException("演示环境禁止操作");
|
||||
resources.setAddTime(OrderUtil.getSecondTimestampTwo());
|
||||
if(ObjectUtil.isEmpty(resources.getGiveIntegral())) resources.setGiveIntegral(BigDecimal.ZERO);
|
||||
if(ObjectUtil.isEmpty(resources.getCost())) resources.setCost(BigDecimal.ZERO);
|
||||
@ -58,7 +58,7 @@ public class YxStoreProductController {
|
||||
@PutMapping(value = "/yxStoreProduct")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','YXSTOREPRODUCT_ALL','YXSTOREPRODUCT_EDIT')")
|
||||
public ResponseEntity update(@Validated @RequestBody YxStoreProduct resources){
|
||||
//if(ObjectUtil.isNotNull(resources)) throw new BadRequestException("演示环境禁止操作");
|
||||
if(ObjectUtil.isNotNull(resources)) throw new BadRequestException("演示环境禁止操作");
|
||||
yxStoreProductService.update(resources);
|
||||
return new ResponseEntity(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
@ -68,7 +68,7 @@ public class YxStoreProductController {
|
||||
@DeleteMapping(value = "/yxStoreProduct/{id}")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','YXSTOREPRODUCT_ALL','YXSTOREPRODUCT_DELETE')")
|
||||
public ResponseEntity delete(@PathVariable Integer id){
|
||||
//if(id > 0) throw new BadRequestException("演示环境禁止操作");
|
||||
if(id > 0) throw new BadRequestException("演示环境禁止操作");
|
||||
yxStoreProductService.delete(id);
|
||||
return new ResponseEntity(HttpStatus.OK);
|
||||
}
|
||||
@ -107,7 +107,6 @@ public class YxStoreProductController {
|
||||
@ApiOperation(value = "清除属性")
|
||||
@PostMapping(value = "/yxStoreProduct/clearAttr/{id}")
|
||||
public ResponseEntity clearAttr(@PathVariable Integer id){
|
||||
//if(id > 0) throw new BadRequestException("演示环境禁止操作");
|
||||
yxStoreProductService.clearProductAttr(id,true);
|
||||
return new ResponseEntity(HttpStatus.OK);
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ public class YxSystemGroupDataController {
|
||||
@PostMapping(value = "/yxSystemGroupData")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','YXSYSTEMGROUPDATA_ALL','YXSYSTEMGROUPDATA_CREATE')")
|
||||
public ResponseEntity create(@RequestBody String jsonStr){
|
||||
//if(StrUtil.isNotEmpty(jsonStr)) throw new BadRequestException("演示环境禁止操作");
|
||||
if(StrUtil.isNotEmpty(jsonStr)) throw new BadRequestException("演示环境禁止操作");
|
||||
JSONObject jsonObject = JSON.parseObject(jsonStr);
|
||||
|
||||
if(ObjectUtil.isNotNull(jsonObject.get("name"))){
|
||||
@ -88,7 +88,7 @@ public class YxSystemGroupDataController {
|
||||
@PutMapping(value = "/yxSystemGroupData")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','YXSYSTEMGROUPDATA_ALL','YXSYSTEMGROUPDATA_EDIT')")
|
||||
public ResponseEntity update(@RequestBody String jsonStr){
|
||||
//if(StrUtil.isNotEmpty(jsonStr)) throw new BadRequestException("演示环境禁止操作");
|
||||
if(StrUtil.isNotEmpty(jsonStr)) throw new BadRequestException("演示环境禁止操作");
|
||||
JSONObject jsonObject = JSON.parseObject(jsonStr);
|
||||
if(ObjectUtil.isNotNull(jsonObject.get("name"))){
|
||||
if(StrUtil.isEmpty(jsonObject.get("name").toString())){
|
||||
@ -123,7 +123,7 @@ public class YxSystemGroupDataController {
|
||||
@DeleteMapping(value = "/yxSystemGroupData/{id}")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','YXSYSTEMGROUPDATA_ALL','YXSYSTEMGROUPDATA_DELETE')")
|
||||
public ResponseEntity delete(@PathVariable Integer id){
|
||||
//if(id > 0) throw new BadRequestException("演示环境禁止操作");
|
||||
if(id > 0) throw new BadRequestException("演示环境禁止操作");
|
||||
yxSystemGroupDataService.delete(id);
|
||||
return new ResponseEntity(HttpStatus.OK);
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ public class MenuController {
|
||||
@PostMapping(value = "/menus")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','MENU_ALL','MENU_CREATE')")
|
||||
public ResponseEntity create(@Validated @RequestBody Menu resources){
|
||||
//if(ObjectUtil.isNotNull(resources)) throw new BadRequestException("演示环境禁止操作");
|
||||
if(ObjectUtil.isNotNull(resources)) throw new BadRequestException("演示环境禁止操作");
|
||||
if (resources.getId() != null) {
|
||||
throw new BadRequestException("A new "+ ENTITY_NAME +" cannot already have an ID");
|
||||
}
|
||||
@ -85,7 +85,7 @@ public class MenuController {
|
||||
@PutMapping(value = "/menus")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','MENU_ALL','MENU_EDIT')")
|
||||
public ResponseEntity update(@Validated(Menu.Update.class) @RequestBody Menu resources){
|
||||
//if(ObjectUtil.isNotNull(resources)) throw new BadRequestException("演示环境禁止操作");
|
||||
if(ObjectUtil.isNotNull(resources)) throw new BadRequestException("演示环境禁止操作");
|
||||
menuService.update(resources);
|
||||
return new ResponseEntity(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
@ -94,7 +94,7 @@ public class MenuController {
|
||||
@DeleteMapping(value = "/menus/{id}")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','MENU_ALL','MENU_DELETE')")
|
||||
public ResponseEntity delete(@PathVariable Long id){
|
||||
//if(id>0) throw new BadRequestException("演示环境禁止操作");
|
||||
if(id>0) throw new BadRequestException("演示环境禁止操作");
|
||||
List<Menu> menuList = menuService.findByPid(id);
|
||||
Set<Menu> menuSet = new HashSet<>();
|
||||
menuSet.add(menuService.findOne(id));
|
||||
|
@ -67,7 +67,7 @@ public class PermissionController {
|
||||
@PutMapping(value = "/permissions")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','PERMISSION_ALL','PERMISSION_EDIT')")
|
||||
public ResponseEntity update(@Validated(Permission.Update.class) @RequestBody Permission resources){
|
||||
//if(ObjectUtil.isNotNull(resources)) throw new BadRequestException("演示环境禁止操作");
|
||||
if(ObjectUtil.isNotNull(resources)) throw new BadRequestException("演示环境禁止操作");
|
||||
permissionService.update(resources);
|
||||
return new ResponseEntity(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
@ -76,7 +76,7 @@ public class PermissionController {
|
||||
@DeleteMapping(value = "/permissions/{id}")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','PERMISSION_ALL','PERMISSION_DELETE')")
|
||||
public ResponseEntity delete(@PathVariable Long id){
|
||||
//if(id > 0) throw new BadRequestException("演示环境禁止操作");
|
||||
if(id > 0) throw new BadRequestException("演示环境禁止操作");
|
||||
List<Permission> permissions = permissionService.findByPid(id);
|
||||
Set<Permission> permissionSet = new HashSet<>();
|
||||
permissionSet.add(permissionMapper.toEntity(permissionService.findById(id)));
|
||||
|
@ -84,7 +84,7 @@ public class RoleController {
|
||||
@PutMapping(value = "/roles")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','ROLES_ALL','ROLES_EDIT')")
|
||||
public ResponseEntity update(@Validated(Role.Update.class) @RequestBody Role resources){
|
||||
//if(ObjectUtil.isNotNull(resources)) throw new BadRequestException("演示环境禁止操作");
|
||||
if(ObjectUtil.isNotNull(resources)) throw new BadRequestException("演示环境禁止操作");
|
||||
roleService.update(resources);
|
||||
return new ResponseEntity(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
@ -93,7 +93,7 @@ public class RoleController {
|
||||
@PutMapping(value = "/roles/permission")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','ROLES_ALL','ROLES_EDIT')")
|
||||
public ResponseEntity updatePermission(@RequestBody Role resources){
|
||||
//if(ObjectUtil.isNotNull(resources)) throw new BadRequestException("演示环境禁止操作");
|
||||
if(ObjectUtil.isNotNull(resources)) throw new BadRequestException("演示环境禁止操作");
|
||||
roleService.updatePermission(resources,roleService.findById(resources.getId()));
|
||||
return new ResponseEntity(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
@ -111,7 +111,7 @@ public class RoleController {
|
||||
@DeleteMapping(value = "/roles/{id}")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','ROLES_ALL','ROLES_DELETE')")
|
||||
public ResponseEntity delete(@PathVariable Long id){
|
||||
// if(id > 0) throw new BadRequestException("演示环境禁止操作");
|
||||
if(id > 0) throw new BadRequestException("演示环境禁止操作");
|
||||
try {
|
||||
roleService.delete(id);
|
||||
}catch (Throwable e){
|
||||
|
@ -125,7 +125,7 @@ public class UserController {
|
||||
@DeleteMapping(value = "/users/{id}")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','USER_ALL','USER_DELETE')")
|
||||
public ResponseEntity delete(@PathVariable Long id){
|
||||
//if(id > 0) throw new BadRequestException("演示环境禁止操作");
|
||||
if(id > 0) throw new BadRequestException("演示环境禁止操作");
|
||||
Integer currentLevel = Collections.min(roleService.findByUsers_Id(SecurityUtils.getUserId()).stream().map(RoleSmallDTO::getLevel).collect(Collectors.toList()));
|
||||
Integer optLevel = Collections.min(roleService.findByUsers_Id(id).stream().map(RoleSmallDTO::getLevel).collect(Collectors.toList()));
|
||||
|
||||
@ -143,7 +143,7 @@ public class UserController {
|
||||
*/
|
||||
@PostMapping(value = "/users/updatePass")
|
||||
public ResponseEntity updatePass(@RequestBody UserPassVo user){
|
||||
//if(ObjectUtil.isNotNull(user)) throw new BadRequestException("演示环境禁止操作");
|
||||
if(ObjectUtil.isNotNull(user)) throw new BadRequestException("演示环境禁止操作");
|
||||
UserDetails userDetails = SecurityUtils.getUserDetails();
|
||||
if(!userDetails.getPassword().equals(EncryptUtils.encryptPassword(user.getOldPass()))){
|
||||
throw new BadRequestException("修改失败,旧密码错误");
|
||||
@ -162,7 +162,7 @@ public class UserController {
|
||||
*/
|
||||
@PostMapping(value = "/users/updateAvatar")
|
||||
public ResponseEntity updateAvatar(@RequestParam MultipartFile file){
|
||||
//if(ObjectUtil.isNotNull(file)) throw new BadRequestException("演示环境禁止操作");
|
||||
if(ObjectUtil.isNotNull(file)) throw new BadRequestException("演示环境禁止操作");
|
||||
userService.updateAvatar(file);
|
||||
return new ResponseEntity(HttpStatus.OK);
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ public class YxSystemConfigController {
|
||||
@PostMapping(value = "/yxSystemConfig")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','YXSYSTEMCONFIG_ALL','YXSYSTEMCONFIG_CREATE')")
|
||||
public ResponseEntity create(@RequestBody String jsonStr){
|
||||
//if(StrUtil.isNotEmpty(jsonStr)) throw new BadRequestException("演示环境禁止操作");
|
||||
if(StrUtil.isNotEmpty(jsonStr)) throw new BadRequestException("演示环境禁止操作");
|
||||
JSONObject jsonObject = JSON.parseObject(jsonStr);
|
||||
jsonObject.forEach(
|
||||
(key,value)->{
|
||||
@ -52,7 +52,7 @@ public class YxSystemConfigController {
|
||||
YxSystemConfig yxSystemConfigModel = new YxSystemConfig();
|
||||
yxSystemConfigModel.setMenuName(key);
|
||||
yxSystemConfigModel.setValue(value.toString());
|
||||
RedisUtil.set(key,value.toString());
|
||||
RedisUtil.set(key,value.toString(),0);
|
||||
if(ObjectUtil.isNull(yxSystemConfig)){
|
||||
yxSystemConfigService.create(yxSystemConfigModel);
|
||||
}else{
|
||||
|
Reference in New Issue
Block a user