pay 修改
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
package co.yixiang.modules.quartz.rest;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import co.yixiang.exception.BadRequestException;
|
||||
import co.yixiang.modules.quartz.domain.QuartzJob;
|
||||
import co.yixiang.modules.quartz.service.QuartzJobService;
|
||||
@ -45,6 +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 (resources.getId() != null) {
|
||||
throw new BadRequestException("A new "+ ENTITY_NAME +" cannot already have an ID");
|
||||
}
|
||||
@ -55,6 +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("演示环境禁止操作");
|
||||
quartzJobService.update(resources);
|
||||
return new ResponseEntity(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
@ -63,6 +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("演示环境禁止操作");
|
||||
quartzJobService.updateIsPause(quartzJobService.findById(id));
|
||||
return new ResponseEntity(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
@ -71,6 +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("演示环境禁止操作");
|
||||
quartzJobService.execution(quartzJobService.findById(id));
|
||||
return new ResponseEntity(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
@ -79,6 +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("演示环境禁止操作");
|
||||
quartzJobService.delete(quartzJobService.findById(id));
|
||||
return new ResponseEntity(HttpStatus.OK);
|
||||
}
|
||||
|
@ -71,6 +71,10 @@ public class AuthenticationController {
|
||||
}
|
||||
final JwtUser jwtUser = (JwtUser) userDetailsService.loadUserByUsername(authorizationUser.getUsername());
|
||||
|
||||
// System.out.println(jwtUser.getUsername());
|
||||
// System.out.println(jwtUser.getPassword());
|
||||
//System.out.println(EncryptUtils.encryptPassword(authorizationUser.getPassword()));
|
||||
//System.out.println(authorizationUser.getPassword());
|
||||
if(!jwtUser.getPassword().equals(EncryptUtils.encryptPassword(authorizationUser.getPassword()))){
|
||||
throw new AccountExpiredException("密码错误");
|
||||
}
|
||||
|
@ -36,6 +36,9 @@ public class JwtAuthorizationTokenFilter extends OncePerRequestFilter {
|
||||
|
||||
final String requestHeader = request.getHeader(this.tokenHeader);
|
||||
|
||||
String m = request.getMethod();
|
||||
|
||||
|
||||
String username = null;
|
||||
String authToken = null;
|
||||
if (requestHeader != null && requestHeader.startsWith("Bearer ")) {
|
||||
|
@ -4,6 +4,7 @@ import lombok.Data;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.bean.copier.CopyOptions;
|
||||
import javax.persistence.*;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
@ -27,6 +28,7 @@ public class YxStoreCategory implements Serializable {
|
||||
|
||||
// 分类名称
|
||||
@Column(name = "cate_name",nullable = false)
|
||||
@NotBlank(message = "分类名称不能为空")
|
||||
private String cateName;
|
||||
|
||||
// 排序
|
||||
@ -35,6 +37,7 @@ public class YxStoreCategory implements Serializable {
|
||||
|
||||
// 图标
|
||||
@Column(name = "pic",nullable = false)
|
||||
@NotBlank(message = "请上传分类图片")
|
||||
private String pic;
|
||||
|
||||
// 是否推荐
|
||||
|
@ -4,6 +4,8 @@ import lombok.Data;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.bean.copier.CopyOptions;
|
||||
import javax.persistence.*;
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.math.BigDecimal;
|
||||
import java.io.Serializable;
|
||||
|
||||
@ -28,22 +30,27 @@ public class YxStoreProduct implements Serializable {
|
||||
|
||||
// 商品图片
|
||||
@Column(name = "image",nullable = false)
|
||||
@NotBlank(message = "请上传商品图片")
|
||||
private String image;
|
||||
|
||||
// 轮播图
|
||||
@Column(name = "slider_image",nullable = false)
|
||||
@NotBlank(message = "请上传轮播图")
|
||||
private String sliderImage;
|
||||
|
||||
// 商品名称
|
||||
@Column(name = "store_name",nullable = false)
|
||||
@NotBlank(message = "请填写商品名称")
|
||||
private String storeName;
|
||||
|
||||
// 商品简介
|
||||
@Column(name = "store_info",nullable = false)
|
||||
@NotBlank(message = "请填写商品简介")
|
||||
private String storeInfo;
|
||||
|
||||
// 关键字
|
||||
@Column(name = "keyword",nullable = false)
|
||||
@NotBlank(message = "请填写关键字")
|
||||
private String keyword;
|
||||
|
||||
// 产品条码(一维码)
|
||||
@ -52,62 +59,72 @@ public class YxStoreProduct implements Serializable {
|
||||
|
||||
// 分类id
|
||||
@Column(name = "cate_id",nullable = false)
|
||||
@NotBlank(message = "请选择分类")
|
||||
private String cateId;
|
||||
|
||||
// 商品价格
|
||||
@Column(name = "price",nullable = false)
|
||||
@Min(value = 0)
|
||||
private BigDecimal price;
|
||||
|
||||
// 会员价格
|
||||
@Column(name = "vip_price",nullable = false)
|
||||
@Min(value = 0)
|
||||
private BigDecimal vipPrice;
|
||||
|
||||
// 市场价
|
||||
@Column(name = "ot_price",nullable = false)
|
||||
@Min(value = 0)
|
||||
private BigDecimal otPrice;
|
||||
|
||||
// 邮费
|
||||
@Column(name = "postage",nullable = false)
|
||||
@Min(value = 0)
|
||||
private BigDecimal postage;
|
||||
|
||||
// 单位名
|
||||
@Column(name = "unit_name",nullable = false)
|
||||
@NotBlank(message = "请填写单位")
|
||||
private String unitName;
|
||||
|
||||
// 排序
|
||||
@Column(name = "sort",nullable = false)
|
||||
@Min(value = 0)
|
||||
private Integer sort;
|
||||
|
||||
// 销量
|
||||
@Column(name = "sales",nullable = false)
|
||||
@Min(value = 0)
|
||||
private Integer sales;
|
||||
|
||||
// 库存
|
||||
@Column(name = "stock",nullable = false)
|
||||
@Min(value = 0)
|
||||
private Integer stock;
|
||||
|
||||
// 状态(0:未上架,1:上架)
|
||||
@Column(name = "is_show",nullable = false)
|
||||
@Column(name = "is_show",columnDefinition="int default 1")
|
||||
private Integer isShow;
|
||||
|
||||
// 是否热卖
|
||||
@Column(name = "is_hot",nullable = false)
|
||||
@Column(name = "is_hot",columnDefinition="int default 0")
|
||||
private Integer isHot;
|
||||
|
||||
// 是否优惠
|
||||
@Column(name = "is_benefit",nullable = false)
|
||||
@Column(name = "is_benefit",columnDefinition="int default 0")
|
||||
private Integer isBenefit;
|
||||
|
||||
// 是否精品
|
||||
@Column(name = "is_best",nullable = false)
|
||||
@Column(name = "is_best",columnDefinition="int default 0")
|
||||
private Integer isBest;
|
||||
|
||||
// 是否新品
|
||||
@Column(name = "is_new",nullable = false)
|
||||
@Column(name = "is_new",columnDefinition="int default 0")
|
||||
private Integer isNew;
|
||||
|
||||
// 产品描述
|
||||
@Column(name = "description",nullable = false)
|
||||
@NotBlank(message = "产品描述")
|
||||
private String description;
|
||||
|
||||
// 添加时间
|
||||
@ -115,11 +132,11 @@ public class YxStoreProduct implements Serializable {
|
||||
private Integer addTime;
|
||||
|
||||
// 是否包邮
|
||||
@Column(name = "is_postage",nullable = false)
|
||||
@Column(name = "is_postage",columnDefinition="int default 0")
|
||||
private Integer isPostage;
|
||||
|
||||
// 是否删除
|
||||
@Column(name = "is_del",nullable = false)
|
||||
@Column(name = "is_del",columnDefinition="int default 0")
|
||||
private Integer isDel;
|
||||
|
||||
// 商户是否代理 0不可代理1可代理
|
||||
@ -127,31 +144,33 @@ public class YxStoreProduct implements Serializable {
|
||||
private Integer merUse;
|
||||
|
||||
// 获得积分
|
||||
@Column(name = "give_integral",nullable = false)
|
||||
@Column(name = "give_integral",columnDefinition="int default 0")
|
||||
@Min(value = 0)
|
||||
private BigDecimal giveIntegral;
|
||||
|
||||
// 成本价
|
||||
@Column(name = "cost",nullable = false)
|
||||
@Column(name = "cost",columnDefinition="int default 0")
|
||||
@Min(value = 0)
|
||||
private BigDecimal cost;
|
||||
|
||||
// 秒杀状态 0 未开启 1已开启
|
||||
@Column(name = "is_seckill",nullable = false)
|
||||
@Column(name = "is_seckill",columnDefinition="int default 0")
|
||||
private Integer isSeckill;
|
||||
|
||||
// 砍价状态 0未开启 1开启
|
||||
@Column(name = "is_bargain")
|
||||
@Column(name = "is_bargain",columnDefinition="int default 0")
|
||||
private Integer isBargain;
|
||||
|
||||
// 是否优品推荐
|
||||
@Column(name = "is_good",nullable = false)
|
||||
@Column(name = "is_good",columnDefinition="int default 0")
|
||||
private Integer isGood;
|
||||
|
||||
// 虚拟销量
|
||||
@Column(name = "ficti")
|
||||
@Column(name = "ficti",columnDefinition="int default 0")
|
||||
private Integer ficti;
|
||||
|
||||
// 浏览量
|
||||
@Column(name = "browse")
|
||||
@Column(name = "browse",columnDefinition="int default 0")
|
||||
private Integer browse;
|
||||
|
||||
// 产品二维码地址(用户小程序海报)
|
||||
|
@ -1,10 +1,13 @@
|
||||
package co.yixiang.modules.shop.rest;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import co.yixiang.aop.log.Log;
|
||||
import co.yixiang.exception.BadRequestException;
|
||||
import co.yixiang.modules.shop.domain.YxStoreCategory;
|
||||
import co.yixiang.modules.shop.service.YxStoreCategoryService;
|
||||
import co.yixiang.modules.shop.service.dto.YxStoreCategoryDTO;
|
||||
import co.yixiang.modules.shop.service.dto.YxStoreCategoryQueryCriteria;
|
||||
import co.yixiang.utils.OrderUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus;
|
||||
@ -42,6 +45,8 @@ 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("演示环境禁止操作");
|
||||
resources.setAddTime(OrderUtil.getSecondTimestampTwo());
|
||||
return new ResponseEntity(yxStoreCategoryService.create(resources),HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@ -50,6 +55,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("演示环境禁止操作");
|
||||
yxStoreCategoryService.update(resources);
|
||||
return new ResponseEntity(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
@ -59,6 +65,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("演示环境禁止操作");
|
||||
yxStoreCategoryService.delete(id);
|
||||
return new ResponseEntity(HttpStatus.OK);
|
||||
}
|
||||
|
@ -1,6 +1,9 @@
|
||||
package co.yixiang.modules.shop.rest;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import co.yixiang.exception.BadRequestException;
|
||||
import co.yixiang.utils.OrderUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import co.yixiang.aop.log.Log;
|
||||
@ -16,6 +19,8 @@ import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import io.swagger.annotations.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @author hupeng
|
||||
* @date 2019-10-04
|
||||
@ -41,6 +46,14 @@ 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("演示环境禁止操作");
|
||||
resources.setAddTime(OrderUtil.getSecondTimestampTwo());
|
||||
if(ObjectUtil.isEmpty(resources.getGiveIntegral())) resources.setGiveIntegral(BigDecimal.ZERO);
|
||||
if(ObjectUtil.isEmpty(resources.getCost())) resources.setCost(BigDecimal.ZERO);
|
||||
//resources.setIsBargain(0);
|
||||
//resources.setIsSeckill(0);
|
||||
//resources.setIsDel(0);
|
||||
//resources.setIsShow(1);
|
||||
return new ResponseEntity(yxStoreProductService.create(resources),HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@ -58,6 +71,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("演示环境禁止操作");
|
||||
yxStoreProductService.delete(id);
|
||||
return new ResponseEntity(HttpStatus.OK);
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package co.yixiang.modules.shop.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import co.yixiang.modules.shop.domain.YxStoreCategory;
|
||||
import co.yixiang.modules.shop.service.YxStoreCategoryService;
|
||||
import co.yixiang.utils.ValidationUtil;
|
||||
@ -56,6 +57,8 @@ public class YxStoreCategoryServiceImpl implements YxStoreCategoryService {
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public YxStoreCategoryDTO create(YxStoreCategory resources) {
|
||||
if(ObjectUtil.isNull(resources.getPid())) resources.setPid(0);
|
||||
if(ObjectUtil.isNull(resources.getSort())) resources.setSort(1);
|
||||
return yxStoreCategoryMapper.toDto(yxStoreCategoryRepository.save(resources));
|
||||
}
|
||||
|
||||
@ -82,6 +85,8 @@ public class YxStoreCategoryServiceImpl implements YxStoreCategoryService {
|
||||
Set<YxStoreCategoryDTO> cates= new LinkedHashSet<>();
|
||||
List<String> deptNames = categoryDTOS.stream().map(YxStoreCategoryDTO::getCateName)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
YxStoreCategoryDTO categoryDTO = new YxStoreCategoryDTO();
|
||||
Boolean isChild;
|
||||
for (YxStoreCategoryDTO deptDTO : categoryDTOS) {
|
||||
isChild = false;
|
||||
@ -103,10 +108,14 @@ public class YxStoreCategoryServiceImpl implements YxStoreCategoryService {
|
||||
cates.add(deptDTO);
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (CollectionUtils.isEmpty(trees)) {
|
||||
trees = cates;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Integer totalElements = categoryDTOS!=null?categoryDTOS.size():0;
|
||||
|
||||
Map map = new HashMap();
|
||||
|
@ -1,5 +1,6 @@
|
||||
package co.yixiang.modules.system.rest;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import co.yixiang.exception.BadRequestException;
|
||||
import co.yixiang.utils.SecurityUtils;
|
||||
import co.yixiang.aop.log.Log;
|
||||
@ -73,6 +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 (resources.getId() != null) {
|
||||
throw new BadRequestException("A new "+ ENTITY_NAME +" cannot already have an ID");
|
||||
}
|
||||
@ -83,6 +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("演示环境禁止操作");
|
||||
menuService.update(resources);
|
||||
return new ResponseEntity(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
@ -91,6 +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("演示环境禁止操作");
|
||||
List<Menu> menuList = menuService.findByPid(id);
|
||||
Set<Menu> menuSet = new HashSet<>();
|
||||
menuSet.add(menuService.findOne(id));
|
||||
|
@ -1,5 +1,6 @@
|
||||
package co.yixiang.modules.system.rest;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import co.yixiang.exception.BadRequestException;
|
||||
import co.yixiang.aop.log.Log;
|
||||
import co.yixiang.modules.system.domain.Permission;
|
||||
@ -66,6 +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("演示环境禁止操作");
|
||||
permissionService.update(resources);
|
||||
return new ResponseEntity(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
@ -74,6 +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("演示环境禁止操作");
|
||||
List<Permission> permissions = permissionService.findByPid(id);
|
||||
Set<Permission> permissionSet = new HashSet<>();
|
||||
permissionSet.add(permissionMapper.toEntity(permissionService.findById(id)));
|
||||
|
@ -1,6 +1,7 @@
|
||||
package co.yixiang.modules.system.rest;
|
||||
|
||||
import cn.hutool.core.lang.Dict;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import co.yixiang.exception.BadRequestException;
|
||||
import co.yixiang.utils.SecurityUtils;
|
||||
import co.yixiang.utils.ThrowableUtil;
|
||||
@ -83,6 +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("演示环境禁止操作");
|
||||
roleService.update(resources);
|
||||
return new ResponseEntity(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
@ -91,6 +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("演示环境禁止操作");
|
||||
roleService.updatePermission(resources,roleService.findById(resources.getId()));
|
||||
return new ResponseEntity(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
@ -99,6 +102,7 @@ public class RoleController {
|
||||
@PutMapping(value = "/roles/menu")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','ROLES_ALL','ROLES_EDIT')")
|
||||
public ResponseEntity updateMenu(@RequestBody Role resources){
|
||||
//if(ObjectUtil.isNotNull(resources)) throw new BadRequestException("演示环境禁止操作");
|
||||
roleService.updateMenu(resources,roleService.findById(resources.getId()));
|
||||
return new ResponseEntity(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
@ -107,6 +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("演示环境禁止操作");
|
||||
try {
|
||||
roleService.delete(id);
|
||||
}catch (Throwable e){
|
||||
|
@ -1,5 +1,6 @@
|
||||
package co.yixiang.modules.system.rest;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import co.yixiang.config.DataScope;
|
||||
import co.yixiang.domain.VerificationCode;
|
||||
import co.yixiang.exception.BadRequestException;
|
||||
@ -124,6 +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("演示环境禁止操作");
|
||||
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()));
|
||||
|
||||
@ -141,6 +143,7 @@ public class UserController {
|
||||
*/
|
||||
@PostMapping(value = "/users/updatePass")
|
||||
public ResponseEntity updatePass(@RequestBody UserPassVo user){
|
||||
//if(ObjectUtil.isNotNull(user)) throw new BadRequestException("演示环境禁止操作");
|
||||
UserDetails userDetails = SecurityUtils.getUserDetails();
|
||||
if(!userDetails.getPassword().equals(EncryptUtils.encryptPassword(user.getOldPass()))){
|
||||
throw new BadRequestException("修改失败,旧密码错误");
|
||||
|
@ -41,6 +41,15 @@ spring:
|
||||
# 生产环境设置成 none,避免程序运行时自动更新数据库结构
|
||||
ddl-auto: update
|
||||
|
||||
redis:
|
||||
#数据库索引
|
||||
database: 0
|
||||
host: 127.0.0.1
|
||||
port: 6379
|
||||
password:
|
||||
#连接超时时间
|
||||
timeout: 5000
|
||||
|
||||
#jwt
|
||||
jwt:
|
||||
header: Authorization
|
||||
|
@ -4,9 +4,9 @@ spring:
|
||||
druid:
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
||||
url: jdbc:log4jdbc:mysql://localhost:3306/eladmin?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false
|
||||
username: root
|
||||
password: 123456
|
||||
url: jdbc:log4jdbc:mysql://localhost:3306/yshop?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false
|
||||
username: yshop
|
||||
password:
|
||||
|
||||
# 初始化配置
|
||||
initial-size: 3
|
||||
@ -42,6 +42,14 @@ spring:
|
||||
hibernate:
|
||||
# 生产环境设置成 none,避免程序运行时自动更新数据库结构
|
||||
ddl-auto: none
|
||||
redis:
|
||||
#数据库索引
|
||||
database: 0
|
||||
host: 127.0.0.1
|
||||
port: 6379
|
||||
password:
|
||||
#连接超时时间
|
||||
timeout: 5000
|
||||
|
||||
#jwt
|
||||
jwt:
|
||||
@ -72,8 +80,8 @@ swagger:
|
||||
|
||||
# 文件存储路径
|
||||
file:
|
||||
path: /home/eladmin/file/
|
||||
avatar: /home/eladmin/avatar/
|
||||
path: /home/yshop/file/
|
||||
avatar: /home/yshop/avatar/
|
||||
# 文件大小 /M
|
||||
maxSize: 100
|
||||
avatarMaxSize: 5
|
@ -20,14 +20,6 @@ spring:
|
||||
dialect: org.hibernate.dialect.MySQL5InnoDBDialect
|
||||
open-in-view: true
|
||||
|
||||
redis:
|
||||
#数据库索引
|
||||
database: 0
|
||||
host: 127.0.0.1
|
||||
port: 6379
|
||||
password:
|
||||
#连接超时时间
|
||||
timeout: 5000
|
||||
|
||||
#七牛云
|
||||
qiniu:
|
||||
|
Reference in New Issue
Block a user