package cn.com.taiji.ias.config; | |||||
import org.springframework.cloud.client.loadbalancer.LoadBalanced; | |||||
import org.springframework.context.annotation.Bean; | |||||
import org.springframework.context.annotation.Configuration; | |||||
import org.springframework.web.client.RestTemplate; | |||||
@Configuration | |||||
public class RestTemplateConfig { | |||||
@Bean | |||||
@LoadBalanced | |||||
public RestTemplate restTemplate() { | |||||
return new RestTemplate(); | |||||
} | |||||
} |
import cn.com.taiji.core.model.comm.protocol.ias.IasServiceSystem; | import cn.com.taiji.core.model.comm.protocol.ias.IasServiceSystem; | ||||
import cn.com.taiji.core.model.comm.protocol.ias.IasServiceType; | import cn.com.taiji.core.model.comm.protocol.ias.IasServiceType; | ||||
import cn.com.taiji.ias.manager.handler.BillServiceHandler; | import cn.com.taiji.ias.manager.handler.BillServiceHandler; | ||||
import cn.com.taiji.ias.manager.handler.PortalServiceHandler; | |||||
import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
public class MyCommHandleManager extends AbstractCommHandleManager { | public class MyCommHandleManager extends AbstractCommHandleManager { | ||||
@Autowired | @Autowired | ||||
private BillServiceHandler billServiceHandler; | private BillServiceHandler billServiceHandler; | ||||
@Autowired | |||||
private PortalServiceHandler portalServiceHandler; | |||||
public MyCommHandleManager() { | public MyCommHandleManager() { | ||||
super(IasServiceSystem.ISSUES); | super(IasServiceSystem.ISSUES); | ||||
@PostConstruct | @PostConstruct | ||||
public void init() { | public void init() { | ||||
registerJsonService(billServiceHandler); | registerJsonService(billServiceHandler); | ||||
registerJsonService(portalServiceHandler); | |||||
} | } | ||||
@Override | @Override |
if (!hasText(openId)) throw GlyServiceError.BUSINESS_VALIDATE_ERR.toHandleException("code已失效"); | if (!hasText(openId)) throw GlyServiceError.BUSINESS_VALIDATE_ERR.toHandleException("code已失效"); | ||||
AccountInfo accountInfo = accountInfoRepo.findByOpenId(openId); | AccountInfo accountInfo = accountInfoRepo.findByOpenId(openId); | ||||
if (accountInfo == null) throw GlyServiceError.BUSINESS_VALIDATE_ERR.toHandleException("账号不存在"); | if (accountInfo == null) throw GlyServiceError.BUSINESS_VALIDATE_ERR.toHandleException("账号不存在"); | ||||
Staff staff = findAndValidStaff(accountInfo.getMobile(), request.getLoginSource()); | |||||
Staff staff = findAndValidStaff(accountInfo.getOpenId(), request.getLoginSource()); | |||||
accountInfoRepo.save(handleAccountInfo(accountInfo, request)); | accountInfoRepo.save(handleAccountInfo(accountInfo, request)); | ||||
String accessToken = UUID.randomUUID().toString().replaceAll("-", ""); | String accessToken = UUID.randomUUID().toString().replaceAll("-", ""); | ||||
setTokenCache(accountInfo, accessToken); | setTokenCache(accountInfo, accessToken); |