|
@ -2,6 +2,7 @@ package com.yihu.wlyy.web.third.gateway.controller;
|
|
|
|
|
|
import com.yihu.wlyy.entity.doctor.profile.Doctor;
|
|
|
import com.yihu.wlyy.entity.login.LoginLog;
|
|
|
import com.yihu.wlyy.entity.organization.Hospital;
|
|
|
import com.yihu.wlyy.entity.security.Token;
|
|
|
import com.yihu.wlyy.service.common.SMSService;
|
|
|
import com.yihu.wlyy.service.common.account.DoctorService;
|
|
@ -10,19 +11,24 @@ import com.yihu.wlyy.service.common.account.TokenService;
|
|
|
import com.yihu.wlyy.service.common.login.LoginLogService;
|
|
|
import com.yihu.wlyy.util.MD5;
|
|
|
import com.yihu.wlyy.util.RSAUtils;
|
|
|
import com.yihu.wlyy.web.WeixinBaseController;
|
|
|
import com.yihu.wlyy.web.third.gateway.vo.HospitalModel;
|
|
|
import com.yihu.wlyy.web.third.gateway.vo.LoginModel;
|
|
|
import com.yihu.wlyy.web.third.gateway.vo.base.BaseResultModel;
|
|
|
import com.yihu.wlyy.web.third.gateway.vo.base.ResultOneModel;
|
|
|
import com.yihu.wlyy.web.third.gateway.vo.base.ResultPageListModel;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import io.swagger.annotations.ApiParam;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.json.JSONObject;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.http.MediaType;
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
@ -34,7 +40,7 @@ import java.util.Map;
|
|
|
@RequestMapping(value = "/wlyygc", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
|
|
@ResponseBody
|
|
|
@Api(description = "用户登陆服务")
|
|
|
public class GcLoginController {
|
|
|
public class GcLoginController extends WeixinBaseController {
|
|
|
@Autowired
|
|
|
private DoctorService doctorService;
|
|
|
@Autowired
|
|
@ -47,19 +53,20 @@ public class GcLoginController {
|
|
|
private RoleService roleService;
|
|
|
@Autowired
|
|
|
private RSAUtils rsaUtils;
|
|
|
|
|
|
/**
|
|
|
* 公钥生成并返回接口
|
|
|
*
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping(value = "public_key", method = RequestMethod.GET)
|
|
|
@RequestMapping(value = "public_key", method = RequestMethod.GET)
|
|
|
@ApiOperation("获取公钥")
|
|
|
public ResultOneModel publicKey() {
|
|
|
try {
|
|
|
String modulus = RSAUtils.getInstance(smsService).getModulus();
|
|
|
String exponent = RSAUtils.getInstance(smsService).getExponent();
|
|
|
if (StringUtils.isEmpty(modulus) || StringUtils.isEmpty(exponent)) {
|
|
|
return new ResultOneModel(BaseResultModel.statusEm.login_publickey_error.getCode(),BaseResultModel.statusEm.login_publickey_error.getMessage());
|
|
|
return new ResultOneModel(BaseResultModel.statusEm.login_publickey_error.getCode(), BaseResultModel.statusEm.login_publickey_error.getMessage());
|
|
|
} else {
|
|
|
JSONObject json = new JSONObject();
|
|
|
json.put("modulus", modulus); //加密指数
|
|
@ -67,7 +74,7 @@ public class GcLoginController {
|
|
|
return new ResultOneModel(json);
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
return new ResultOneModel(BaseResultModel.statusEm.login_publickey_error.getCode(),BaseResultModel.statusEm.login_publickey_error.getMessage());
|
|
|
return new ResultOneModel(BaseResultModel.statusEm.login_publickey_error.getCode(), BaseResultModel.statusEm.login_publickey_error.getMessage());
|
|
|
}
|
|
|
}
|
|
|
|
|
@ -163,4 +170,16 @@ public class GcLoginController {
|
|
|
return new ResultOneModel<>(BaseResultModel.statusEm.login_system_error.getCode(), BaseResultModel.statusEm.login_system_error.getMessage());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "/wx_jsapi_ticket", method = RequestMethod.GET)
|
|
|
@ApiOperation("获取微信的jsapi_ticket")
|
|
|
public ResultOneModel<String> wx_jsapi_ticket() {
|
|
|
return new ResultOneModel(super.getJsapi_ticketByToken());
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "/wx_accesstoken", method = RequestMethod.GET)
|
|
|
@ApiOperation("获取微信的accesstoken")
|
|
|
public ResultOneModel<String> wx_accesstoken() {
|
|
|
return new ResultOneModel(super.getAccessToken());
|
|
|
}
|
|
|
}
|