支付宝授权

master
胡锐 2 weeks ago
parent 2c881b7615
commit ef722e04b1
  1. 35
      cweb/src/main/java/com/hfkj/controller/UserAuthController.java
  2. 15
      service/src/main/java/com/hfkj/sysenum/user/UserAuthorizePlatformEnum.java

@ -26,10 +26,7 @@ import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource; import javax.annotation.Resource;
@ -88,4 +85,34 @@ public class UserAuthController {
} }
} }
@RequestMapping(value="/getUserAuthDetail",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "支付宝授权详情")
public ResponseData getUserAuthDetail(@RequestParam(value = "platform" , required = true) Integer platform) {
try {
UserSessionObject session = userCenter.getSessionModel(UserSessionObject.class);
UserAuthorizePlatformEnum platformEnum = UserAuthorizePlatformEnum.getDataByType(platform);
if (platformEnum == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知平台");
}
return ResponseMsgUtil.success( userPlatformAuthorizeService.getUserAuth(session.getUser().getId(), platformEnum));
} catch (Exception e) {
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/getUserAuthList",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "用户授权列表")
public ResponseData getUserAuthList() {
try {
UserSessionObject session = userCenter.getSessionModel(UserSessionObject.class);
return ResponseMsgUtil.success( userPlatformAuthorizeService.getUserAuth(session.getUser().getId()));
} catch (Exception e) {
return ResponseMsgUtil.exception(e);
}
}
} }

@ -2,6 +2,8 @@ package com.hfkj.sysenum.user;
import lombok.Getter; import lombok.Getter;
import java.util.Objects;
/** /**
* 用户账户记录来源 * 用户账户记录来源
* @author hurui * @author hurui
@ -26,4 +28,17 @@ public enum UserAuthorizePlatformEnum {
this.name = name; this.name = name;
} }
/**
* 查询数据
* @param code
* @return
*/
public static UserAuthorizePlatformEnum getDataByType(Integer code) {
for (UserAuthorizePlatformEnum ele : values()) {
if (Objects.equals(code,ele.getType())) return ele;
}
return null;
}
} }

Loading…
Cancel
Save