Commit b558724e authored by hezhen's avatar hezhen

Merge branch 'dev-chw' of http://113.105.137.151:22280/youjj/cloud-platform into dev-chw

parents 147fabd7 22eec2e9
...@@ -52,6 +52,25 @@ public class AuthController { ...@@ -52,6 +52,25 @@ public class AuthController {
return new ObjectRestResponse<String>().data(token); return new ObjectRestResponse<String>().data(token);
} }
@RequestMapping(value = "/chw/token", method = RequestMethod.POST)
public ObjectRestResponse<String> chwCreateAuthenticationToken(
@RequestBody JwtAuthenticationRequest authenticationRequest,
HttpServletRequest request) throws Exception {
log.info(authenticationRequest.getUsername()+" require logging...");
// keliii 分请求类型处理token
String requestType = request.getHeader(RequestTypeConstants.HEADER_KEY);
if (requestType == null || requestType.trim().equals("")) {
requestType = RequestTypeConstants.BASE;
}
final String token;
if (RequestTypeConstants.APP.equals(requestType)) {
token = appAuthService.login(authenticationRequest);
} else {
token = authService.login(authenticationRequest);
}
return new ObjectRestResponse<String>().data(token);
}
@RequestMapping(value = "token/small", method = RequestMethod.POST) @RequestMapping(value = "token/small", method = RequestMethod.POST)
public ObjectRestResponse<String> createAuthenticationTokenSmall( public ObjectRestResponse<String> createAuthenticationTokenSmall(
@RequestBody JwtAuthenticationRequest authenticationRequest, @RequestBody JwtAuthenticationRequest authenticationRequest,
......
...@@ -31,6 +31,7 @@ import java.util.List; ...@@ -31,6 +31,7 @@ import java.util.List;
import static com.github.wxiaoqi.security.admin.entity.User.BIZ_TYPE_OPERATE; import static com.github.wxiaoqi.security.admin.entity.User.BIZ_TYPE_OPERATE;
import static com.github.wxiaoqi.security.auth.common.constatns.CommonConstants.DATA_ALL_FALSE; import static com.github.wxiaoqi.security.auth.common.constatns.CommonConstants.DATA_ALL_FALSE;
import static com.github.wxiaoqi.security.auth.common.constatns.CommonConstants.DATA_ALL_TRUE; import static com.github.wxiaoqi.security.auth.common.constatns.CommonConstants.DATA_ALL_TRUE;
import static com.github.wxiaoqi.security.common.constant.CommonConstants.SYS_TRUE;
/** /**
* ${DESCRIPTION} * ${DESCRIPTION}
...@@ -40,7 +41,7 @@ import static com.github.wxiaoqi.security.auth.common.constatns.CommonConstants. ...@@ -40,7 +41,7 @@ import static com.github.wxiaoqi.security.auth.common.constatns.CommonConstants.
*/ */
@Slf4j @Slf4j
@RestController @RestController
@RequestMapping("user") @RequestMapping("/chw/user")
public class ChwUserController extends CommonBaseController implements UserRestInterface { public class ChwUserController extends CommonBaseController implements UserRestInterface {
public final static Integer CURRENT_COMPANY = 1; public final static Integer CURRENT_COMPANY = 1;
...@@ -98,6 +99,8 @@ public class ChwUserController extends CommonBaseController implements UserRestI ...@@ -98,6 +99,8 @@ public class ChwUserController extends CommonBaseController implements UserRestI
@IgnoreClientToken @IgnoreClientToken
public ObjectRestResponse<User> add(@RequestBody UserController.UserVO vo) { public ObjectRestResponse<User> add(@RequestBody UserController.UserVO vo) {
String username = vo.getUsername(); String username = vo.getUsername();
vo.setBizType(BIZ_TYPE_OPERATE);
vo.setStatus(SYS_TRUE);
if (StringUtils.isNotBlank(username)) { if (StringUtils.isNotBlank(username)) {
List<User> list = userBiz.getCountByUsername(username); List<User> list = userBiz.getCountByUsername(username);
if (list.size() > 0) { if (list.size() > 0) {
...@@ -110,6 +113,36 @@ public class ChwUserController extends CommonBaseController implements UserRestI ...@@ -110,6 +113,36 @@ public class ChwUserController extends CommonBaseController implements UserRestI
return ObjectRestResponse.succ(); return ObjectRestResponse.succ();
} }
@RequestMapping(value = "/operate/{id}", method = RequestMethod.PUT)
@ResponseBody
public ObjectRestResponse<User> update(@RequestBody UserController.UserVO vo) {
handleDataLimit(vo);
String username = vo.getUsername();
if (StringUtils.isNotBlank(username)) {
List<User> list = userBiz.getCountByUsername(username);
if (list.size() > 1) {
return ObjectRestResponse.createFailedResult(ResCode.USER_IS_EXIST.getCode(), ResCode.USER_IS_EXIST.getDesc());
}
if (list.size() == 1) {
User user = list.get(0);
if (!user.getId().equals(vo.getId())) {
return ObjectRestResponse.createFailedResult(ResCode.USER_IS_EXIST.getCode(), ResCode.USER_IS_EXIST.getDesc());
}
}
}
userBiz.updateSelectiveById(vo);
//添加权限关系
groupBiz.modifyUserGroups(vo.getId(), vo.getMembers());
return new ObjectRestResponse<User>();
}
@RequestMapping(value = "/operate/{id}", method = RequestMethod.DELETE)
@ResponseBody
public ObjectRestResponse<User> remove(@PathVariable int id) {
userBiz.deleteById(id);
return new ObjectRestResponse<User>();
}
private void handleDataLimit(@RequestBody UserController.UserVO dto) { private void handleDataLimit(@RequestBody UserController.UserVO dto) {
if (null != dto.getDataLimit()) { if (null != dto.getDataLimit()) {
dto.setDataCompany(""); dto.setDataCompany("");
......
...@@ -40,6 +40,12 @@ public class UserRest { ...@@ -40,6 +40,12 @@ public class UserRest {
public @ResponseBody UserInfo validate(@RequestBody Map<String,String> body){ public @ResponseBody UserInfo validate(@RequestBody Map<String,String> body){
return permissionService.validate(body.get("username"),body.get("password")); return permissionService.validate(body.get("username"),body.get("password"));
} }
@RequestMapping(value = "/user/chw/validate", method = RequestMethod.POST)
public @ResponseBody UserInfo chwValidate(@RequestBody Map<String,String> body){
return permissionService.validate(body.get("username"),body.get("password"));
}
@RequestMapping(value = "/user/validate/small", method = RequestMethod.POST) @RequestMapping(value = "/user/validate/small", method = RequestMethod.POST)
public @ResponseBody UserInfo validateSmall(@RequestBody Map<String,String> body){ public @ResponseBody UserInfo validateSmall(@RequestBody Map<String,String> body){
return permissionService.validateSmall(body.get("username"),body.get("password")); return permissionService.validateSmall(body.get("username"),body.get("password"));
......
...@@ -71,6 +71,9 @@ ...@@ -71,6 +71,9 @@
LEFT JOIN company_info i ON c.company_id=i.id LEFT JOIN company_info i ON c.company_id=i.id
LEFT JOIN company_info ci ON u.corporation_id=ci.id LEFT JOIN company_info ci ON u.corporation_id=ci.id
<where> <where>
<if test="bizType != null">
and u.biz_type = #{bizType}
</if>
<if test="companyId != null and companyId > 0"> <if test="companyId != null and companyId > 0">
and u.company_id = #{companyId} and u.company_id = #{companyId}
</if> </if>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment