Commit 73260440 authored by 李健华's avatar 李健华

修改租户类型

parent 97834f89
...@@ -482,7 +482,7 @@ public class UserController implements IBaseController { ...@@ -482,7 +482,7 @@ public class UserController implements IBaseController {
brief.setSex(Optional.ofNullable(userDetail.getGender()).orElse(cn.quantgroup.xyqb.model.Gender.UNKNOWN).ordinal() + ""); brief.setSex(Optional.ofNullable(userDetail.getGender()).orElse(cn.quantgroup.xyqb.model.Gender.UNKNOWN).ordinal() + "");
brief.setPhoneNo(userDetail.getPhoneNo().substring(0, 3) + "****" + userDetail.getPhoneNo().substring(7, 11)); brief.setPhoneNo(userDetail.getPhoneNo().substring(0, 3) + "****" + userDetail.getPhoneNo().substring(7, 11));
} }
String tenantId = getCurrentTenantIdRedis(); Integer tenantId = Integer.parseInt(getCurrentTenantIdRedis());
if (tenantId != null) { if (tenantId != null) {
brief = tenantService.getTenantCustomerInfo(userDetail, tenantId); brief = tenantService.getTenantCustomerInfo(userDetail, tenantId);
} }
......
...@@ -133,7 +133,7 @@ public class InnerController implements IBaseController { ...@@ -133,7 +133,7 @@ public class InnerController implements IBaseController {
*/ */
@RequestMapping("/user/search/phoneNo") @RequestMapping("/user/search/phoneNo")
@ApiOperation(httpMethod = "GET", value = "根据手机号查询用户信息") @ApiOperation(httpMethod = "GET", value = "根据手机号查询用户信息")
public JsonResult findByPhoneNo(String phoneNo, String tenantId) { public JsonResult findByPhoneNo(String phoneNo, Integer tenantId) {
User user = userService.findByPhoneInDb(phoneNo); User user = userService.findByPhoneInDb(phoneNo);
if (user == null) { if (user == null) {
return JsonResult.buildErrorStateResult("", null); return JsonResult.buildErrorStateResult("", null);
...@@ -154,7 +154,7 @@ public class InnerController implements IBaseController { ...@@ -154,7 +154,7 @@ public class InnerController implements IBaseController {
*/ */
@RequestMapping("/user/search/uuid") @RequestMapping("/user/search/uuid")
@ApiOperation(httpMethod = "POST", value = "根据UUID查询用户信息") @ApiOperation(httpMethod = "POST", value = "根据UUID查询用户信息")
public JsonResult findByUuid(String uuid, String tenantId) { public JsonResult findByUuidInfo(String uuid, Integer tenantId) {
User user = userService.findByUuidWithCache(uuid); User user = userService.findByUuidWithCache(uuid);
if (user == null) { if (user == null) {
return JsonResult.buildErrorStateResult("", null); return JsonResult.buildErrorStateResult("", null);
...@@ -393,7 +393,7 @@ public class InnerController implements IBaseController { ...@@ -393,7 +393,7 @@ public class InnerController implements IBaseController {
*/ */
@RequestMapping("/user_detail/search/userId") @RequestMapping("/user_detail/search/userId")
@ApiOperation(httpMethod = "POST", value = "查询用户详情") @ApiOperation(httpMethod = "POST", value = "查询用户详情")
public JsonResult findUserDetailByUserId(Long userId, String tenantId) { public JsonResult findUserDetailByUserId(Long userId, Integer tenantId) {
UserDetail userDetail = null; UserDetail userDetail = null;
// 增加容错性,防备DB中存在的脏数据触发异常 // 增加容错性,防备DB中存在的脏数据触发异常
if (userId != null && userId > 0) { if (userId != null && userId > 0) {
...@@ -417,7 +417,7 @@ public class InnerController implements IBaseController { ...@@ -417,7 +417,7 @@ public class InnerController implements IBaseController {
*/ */
@RequestMapping("/user/search/userId") @RequestMapping("/user/search/userId")
@ApiOperation(httpMethod = "POST", value = "查询用户基本信息") @ApiOperation(httpMethod = "POST", value = "查询用户基本信息")
public JsonResult findUserByUserId(Long userId, String tenantId) { public JsonResult findUserByUserId(Long userId, Integer tenantId) {
User user = userService.findById(userId); User user = userService.findById(userId);
if (user != null) { if (user != null) {
if (tenantId != null) { if (tenantId != null) {
...@@ -438,7 +438,7 @@ public class InnerController implements IBaseController { ...@@ -438,7 +438,7 @@ public class InnerController implements IBaseController {
*/ */
@RequestMapping("/user_detail/search/phone") @RequestMapping("/user_detail/search/phone")
@ApiOperation(httpMethod = "POST", value = "查询用户详情") @ApiOperation(httpMethod = "POST", value = "查询用户详情")
public JsonResult findUserDetailByPhone(String phoneNo, String tenantId) { public JsonResult findUserDetailByPhone(String phoneNo, Integer tenantId) {
UserDetail userDetail = null; UserDetail userDetail = null;
userDetail = userDetailService.findSlaveByPhoneNo(phoneNo); userDetail = userDetailService.findSlaveByPhoneNo(phoneNo);
if (userDetail != null) { if (userDetail != null) {
......
package cn.quantgroup.xyqb.controller.internal.user.center; package cn.quantgroup.xyqb.controller.internal.user.center;
import cn.quantgroup.xyqb.entity.OauthClientDetailsEntity;
import cn.quantgroup.xyqb.entity.User;
import cn.quantgroup.xyqb.model.JsonResult;
import cn.quantgroup.xyqb.service.user.IOauthClientDetailsService; import cn.quantgroup.xyqb.service.user.IOauthClientDetailsService;
import cn.quantgroup.xyqb.service.user.IOauthLoginInfoService; import cn.quantgroup.xyqb.service.user.IOauthLoginInfoService;
import cn.quantgroup.xyqb.service.user.ISmsService; import cn.quantgroup.xyqb.service.user.ISmsService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
...@@ -28,25 +24,6 @@ public class OauthClientDetailsController { ...@@ -28,25 +24,6 @@ public class OauthClientDetailsController {
@Autowired @Autowired
private ISmsService smsService; private ISmsService smsService;
@PostMapping("/getOauthClient")
public JsonResult getOauthClient(String clientId) {
OauthClientDetailsEntity oauthClientDetailsEntity = oauthClientDetailsService.findFirstByClientId(clientId);
return JsonResult.buildSuccessResultGeneric(oauthClientDetailsEntity);
}
@PostMapping("/addLoginInfo")
public JsonResult addLoginInfo(String tenantId, String phoneNo) {
User user = new User();
user.setPhoneNo(phoneNo);
user.setId(new Long("111111"));
oauthLoginInfoService.addLoginInfo(user, tenantId);
return JsonResult.buildSuccessResultGeneric("12");
}
@PostMapping("/sendSms")
public JsonResult sendSms(Long tenantId, String phoneNo) {
String code = smsService.sendSms(tenantId, "login", phoneNo);
return JsonResult.buildSuccessResultGeneric(code);
}
} }
...@@ -28,7 +28,7 @@ public class OauthClientDetailsEntity extends OptimisticEntity implements Serial ...@@ -28,7 +28,7 @@ public class OauthClientDetailsEntity extends OptimisticEntity implements Serial
@Id @Id
@Column(name = "CLIENT_ID", nullable = false) @Column(name = "CLIENT_ID", nullable = false)
private String clientId; private Long clientId;
@Column(name = "INSTITUTION_ID", nullable = false, length = 4) @Column(name = "INSTITUTION_ID", nullable = false, length = 4)
private String institutionId; private String institutionId;
...@@ -76,11 +76,11 @@ public class OauthClientDetailsEntity extends OptimisticEntity implements Serial ...@@ -76,11 +76,11 @@ public class OauthClientDetailsEntity extends OptimisticEntity implements Serial
private String smsRegisterTemplate; private String smsRegisterTemplate;
public String getClientId() { public Long getClientId() {
return clientId; return clientId;
} }
public void setClientId(String clientId) { public void setClientId(Long clientId) {
this.clientId = clientId; this.clientId = clientId;
} }
......
...@@ -9,8 +9,8 @@ import org.springframework.stereotype.Repository; ...@@ -9,8 +9,8 @@ import org.springframework.stereotype.Repository;
* Created by hechao on 2020/2/17. * Created by hechao on 2020/2/17.
*/ */
@Repository @Repository
public interface IOauthClientDetailsRepository extends JpaRepository<OauthClientDetailsEntity, String> { public interface IOauthClientDetailsRepository extends JpaRepository<OauthClientDetailsEntity, Long> {
OauthClientDetailsEntity findFirstByClientId(String clientID); OauthClientDetailsEntity findFirstByClientId(Integer clientID);
OauthClientDetailsEntity findFirstByInstitutionIdAndProductId(String institutionId, String productId); OauthClientDetailsEntity findFirstByInstitutionIdAndProductId(String institutionId, String productId);
} }
\ No newline at end of file
...@@ -7,5 +7,5 @@ import cn.quantgroup.xyqb.entity.OauthClientDetailsEntity; ...@@ -7,5 +7,5 @@ import cn.quantgroup.xyqb.entity.OauthClientDetailsEntity;
*/ */
public interface IOauthClientDetailsService { public interface IOauthClientDetailsService {
OauthClientDetailsEntity findFirstByClientId(String clientId); OauthClientDetailsEntity findFirstByClientId(Integer clientId);
} }
...@@ -6,5 +6,5 @@ import cn.quantgroup.xyqb.entity.User; ...@@ -6,5 +6,5 @@ import cn.quantgroup.xyqb.entity.User;
* Created by Li Jianhua on 2017/1/3. * Created by Li Jianhua on 2017/1/3.
*/ */
public interface IOauthLoginInfoService { public interface IOauthLoginInfoService {
void addLoginInfo(User user, String tenantId); void addLoginInfo(User user, Integer tenantId);
} }
...@@ -9,9 +9,9 @@ import cn.quantgroup.xyqb.model.UserBrief; ...@@ -9,9 +9,9 @@ import cn.quantgroup.xyqb.model.UserBrief;
*/ */
public interface ITenantService { public interface ITenantService {
User getTenantUser(User user, String tenantId); User getTenantUser(User user, Integer tenantId);
UserDetail getTenantUserDetail(UserDetail userDetail, String tenantId); UserDetail getTenantUserDetail(UserDetail userDetail, Integer tenantId);
UserBrief getTenantCustomerInfo(UserDetail userDetail, String tenantId); UserBrief getTenantCustomerInfo(UserDetail userDetail, Integer tenantId);
} }
...@@ -18,7 +18,7 @@ public class OauthClientDetailsServiceImpl implements IOauthClientDetailsService ...@@ -18,7 +18,7 @@ public class OauthClientDetailsServiceImpl implements IOauthClientDetailsService
@Override @Override
public OauthClientDetailsEntity findFirstByClientId(String clientId) { public OauthClientDetailsEntity findFirstByClientId(Integer clientId) {
OauthClientDetailsEntity oauthClientDetailsEntity = oauthClientDetailsRepository.findFirstByClientId(clientId); OauthClientDetailsEntity oauthClientDetailsEntity = oauthClientDetailsRepository.findFirstByClientId(clientId);
return oauthClientDetailsEntity; return oauthClientDetailsEntity;
} }
......
...@@ -39,7 +39,7 @@ public class OauthLoginInfoServiceImpl implements IOauthLoginInfoService { ...@@ -39,7 +39,7 @@ public class OauthLoginInfoServiceImpl implements IOauthLoginInfoService {
@Override @Override
@Transactional(propagation = Propagation.REQUIRES_NEW) @Transactional(propagation = Propagation.REQUIRES_NEW)
public void addLoginInfo(User user, String tenantId) { public void addLoginInfo(User user, Integer tenantId) {
System.out.println(atomicSequencer.nextId()); System.out.println(atomicSequencer.nextId());
OauthClientDetailsEntity oauthClientDetailsEntity = oauthClientDetailsRepository.findFirstByClientId(tenantId); OauthClientDetailsEntity oauthClientDetailsEntity = oauthClientDetailsRepository.findFirstByClientId(tenantId);
if (oauthClientDetailsEntity != null) { if (oauthClientDetailsEntity != null) {
......
...@@ -29,7 +29,7 @@ public class TenantServiceImpl implements ITenantService { ...@@ -29,7 +29,7 @@ public class TenantServiceImpl implements ITenantService {
private IOauthClientDetailsService oauthClientDetailsService; private IOauthClientDetailsService oauthClientDetailsService;
@Override @Override
public User getTenantUser(User user, String tenantId) { public User getTenantUser(User user, Integer tenantId) {
OauthClientDetailsEntity oauthClientDetails = oauthClientDetailsService.findFirstByClientId(tenantId); OauthClientDetailsEntity oauthClientDetails = oauthClientDetailsService.findFirstByClientId(tenantId);
if (oauthClientDetails != null) { if (oauthClientDetails != null) {
ProductLoginEntity productLogin = productLoginService.findSlaveByPloginInfo(oauthClientDetails.getInstitutionId(), oauthClientDetails.getProductId(), user.getId()); ProductLoginEntity productLogin = productLoginService.findSlaveByPloginInfo(oauthClientDetails.getInstitutionId(), oauthClientDetails.getProductId(), user.getId());
...@@ -45,7 +45,7 @@ public class TenantServiceImpl implements ITenantService { ...@@ -45,7 +45,7 @@ public class TenantServiceImpl implements ITenantService {
} }
@Override @Override
public UserDetail getTenantUserDetail(UserDetail userDetail, String tenantId) { public UserDetail getTenantUserDetail(UserDetail userDetail, Integer tenantId) {
OauthClientDetailsEntity oauthClientDetails = oauthClientDetailsService.findFirstByClientId(tenantId); OauthClientDetailsEntity oauthClientDetails = oauthClientDetailsService.findFirstByClientId(tenantId);
if (oauthClientDetails != null) { if (oauthClientDetails != null) {
ProductLoginEntity productLogin = productLoginService.findSlaveByPloginInfo(oauthClientDetails.getInstitutionId(), oauthClientDetails.getProductId(), userDetail.getUserId()); ProductLoginEntity productLogin = productLoginService.findSlaveByPloginInfo(oauthClientDetails.getInstitutionId(), oauthClientDetails.getProductId(), userDetail.getUserId());
...@@ -73,7 +73,7 @@ public class TenantServiceImpl implements ITenantService { ...@@ -73,7 +73,7 @@ public class TenantServiceImpl implements ITenantService {
} }
@Override @Override
public UserBrief getTenantCustomerInfo(UserDetail userDetail, String tenantId) { public UserBrief getTenantCustomerInfo(UserDetail userDetail, Integer tenantId) {
OauthClientDetailsEntity oauthClientDetails = oauthClientDetailsService.findFirstByClientId(tenantId); OauthClientDetailsEntity oauthClientDetails = oauthClientDetailsService.findFirstByClientId(tenantId);
if (oauthClientDetails != null) { if (oauthClientDetails != null) {
ProductLoginEntity productLogin = productLoginService.findSlaveByPloginInfo(oauthClientDetails.getInstitutionId(), oauthClientDetails.getProductId(), userDetail.getUserId()); ProductLoginEntity productLogin = productLoginService.findSlaveByPloginInfo(oauthClientDetails.getInstitutionId(), oauthClientDetails.getProductId(), userDetail.getUserId());
......
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