|
@@ -8,6 +8,7 @@ import java.util.stream.Collectors;
|
|
|
import java.util.stream.Stream;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
+import javax.transaction.Transactional;
|
|
|
|
|
|
import org.apache.commons.lang.StringEscapeUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
@@ -58,6 +59,7 @@ import io.swagger.annotations.ApiOperation;
|
|
|
/**
|
|
|
* 用户服务API Created by songyue on 17/1/13.
|
|
|
*/
|
|
|
+@Transactional
|
|
|
@RestController
|
|
|
@RequestMapping("${$rmp.ctr.basic}/user")
|
|
|
public class UserController extends ControllerSupport {
|
|
@@ -274,30 +276,34 @@ public class UserController extends ControllerSupport {
|
|
|
|
|
|
@ApiOperation(value = "启用用户", notes = "启用用户")
|
|
|
@PutMapping("/enable/{ids}")
|
|
|
- public ResponseEntity enableUser(@PathVariable String ids) {
|
|
|
+ public List<String> enableUser(@PathVariable String ids) {
|
|
|
List<Long> userIds = Stream.of(ids.split(",")).map(s -> Long.parseLong(s.trim()))
|
|
|
.collect(Collectors.toList());
|
|
|
+ List<String> ret = Lists.newArrayList();
|
|
|
for (Long userId : userIds) {
|
|
|
UserEntity user = userRepo.findOne(userId);
|
|
|
user.setEnable(true);
|
|
|
user.setUpdateTime(new Date());
|
|
|
userRepo.save(user);
|
|
|
+ ret.add(user.getId() + ":" + user.getName());
|
|
|
}
|
|
|
- return new ResponseEntity(HttpStatus.OK);
|
|
|
+ return ret;
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "禁用用户", notes = "禁用用户")
|
|
|
@PutMapping("/disable/{ids}")
|
|
|
- public ResponseEntity disableUser(@PathVariable String ids) {
|
|
|
+ public List<String> disableUser(@PathVariable String ids) {
|
|
|
List<Long> userIds = Stream.of(ids.split(",")).map(s -> Long.parseLong(s.trim()))
|
|
|
.collect(Collectors.toList());
|
|
|
+ List<String> ret = Lists.newArrayList();
|
|
|
for (Long userId : userIds) {
|
|
|
UserEntity user = userRepo.findOne(userId);
|
|
|
user.setEnable(false);
|
|
|
user.setUpdateTime(new Date());
|
|
|
userRepo.save(user);
|
|
|
+ ret.add(user.getId() + ":" + user.getName());
|
|
|
}
|
|
|
- return new ResponseEntity(HttpStatus.OK);
|
|
|
+ return ret;
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "修改用户密码", notes = "修改密码")
|