|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.genersoft.iot.vmp.conf.security.SecurityUtils; | 
|---|
|  |  |  | import com.genersoft.iot.vmp.service.IRoleService; | 
|---|
|  |  |  | import com.genersoft.iot.vmp.service.IUserService; | 
|---|
|  |  |  | import com.genersoft.iot.vmp.storager.dao.dto.Role; | 
|---|
|  |  |  | import com.genersoft.iot.vmp.storager.dao.dto.User; | 
|---|
|  |  |  | import com.genersoft.iot.vmp.utils.DateUtil; | 
|---|
|  |  |  | import com.genersoft.iot.vmp.vmanager.bean.WVPResult; | 
|---|
|  |  |  | import io.swagger.annotations.Api; | 
|---|
|  |  |  | import io.swagger.annotations.ApiImplicitParam; | 
|---|
|  |  |  | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.http.HttpStatus; | 
|---|
|  |  |  | import org.springframework.http.ResponseEntity; | 
|---|
|  |  |  | import org.springframework.security.authentication.AuthenticationManager; | 
|---|
|  |  |  | import org.springframework.util.DigestUtils; | 
|---|
|  |  |  | import org.springframework.util.StringUtils; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.*; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.text.SimpleDateFormat; | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Api(tags = "角色管理") | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private IRoleService roleService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private final SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation("添加角色") | 
|---|
|  |  |  | @ApiImplicitParams({ | 
|---|
|  |  |  | 
|---|
|  |  |  | Role role = new Role(); | 
|---|
|  |  |  | role.setName(name); | 
|---|
|  |  |  | role.setAuthority(authority); | 
|---|
|  |  |  | role.setCreateTime(format.format(System.currentTimeMillis())); | 
|---|
|  |  |  | role.setUpdateTime(format.format(System.currentTimeMillis())); | 
|---|
|  |  |  | role.setCreateTime(DateUtil.getNow()); | 
|---|
|  |  |  | role.setUpdateTime(DateUtil.getNow()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | int addResult = roleService.add(role); | 
|---|
|  |  |  |  | 
|---|