| | |
| | | import com.qianwen.core.tool.utils.Func; |
| | | import com.qianwen.smartman.common.utils.MessageUtils; |
| | | import com.qianwen.smartman.modules.auth.utils.TokenUtil; |
| | | import com.qianwen.smartman.modules.cps.entity.Employee; |
| | | import com.qianwen.smartman.modules.cps.service.IEmployeeService; |
| | | import com.qianwen.smartman.modules.smis.entity.Employee; |
| | | import com.qianwen.smartman.modules.smis.service.IEmployeeService; |
| | | import com.qianwen.smartman.modules.sync.constant.DingConstant; |
| | | import com.qianwen.smartman.modules.sync.constant.QyWechatConstant; |
| | | import com.qianwen.smartman.modules.sync.entity.QyUser; |
| | | import com.qianwen.smartman.modules.sync.enums.SseEventEnum; |
| | | import com.qianwen.smartman.modules.sync.message.sse.SseEmitterServer; |
| | | import com.qianwen.smartman.modules.sync.service.impl.WechatSyncServiceImpl; |
| | | //import com.qianwen.smartman.modules.sync.service.impl.WechatSyncServiceImpl; |
| | | import com.qianwen.smartman.modules.sync.util.CodeUtil; |
| | | import com.qianwen.smartman.modules.system.entity.UserInfo; |
| | | import com.qianwen.smartman.modules.system.entity.UserOauth; |
| | |
| | | private final IUserOauthService userOauthService; |
| | | private final IEmployeeService employeeService; |
| | | private final IUserService userServices; |
| | | private final WechatSyncServiceImpl wechatSyncService; |
| | | //private final WechatSyncServiceImpl wechatSyncService; |
| | | private final SseEmitterServer sseEmitterServer; |
| | | |
| | | |
| | | public OuterAppScanService(IUserOauthService userOauthService, IEmployeeService employeeService, IUserService userServices, WechatSyncServiceImpl wechatSyncService, SseEmitterServer sseEmitterServer) { |
| | | //WechatSyncServiceImpl wechatSyncService, |
| | | public OuterAppScanService(IUserOauthService userOauthService, IEmployeeService employeeService, IUserService userServices, SseEmitterServer sseEmitterServer) { |
| | | this.userOauthService = userOauthService; |
| | | this.employeeService = employeeService; |
| | | this.userServices = userServices; |
| | | this.wechatSyncService = wechatSyncService; |
| | | //this.wechatSyncService = wechatSyncService; |
| | | this.sseEmitterServer = sseEmitterServer; |
| | | } |
| | | |
| | |
| | | return R.data(TokenUtil.createAuthInfo(userInfo)); |
| | | */ |
| | | } |
| | | |
| | | /* |
| | | public R<Kv> qyScanLogin(String clientId, String code) { |
| | | |
| | | if (CodeUtil.verifyLoginCodeExpire(clientId).booleanValue()) { |
| | |
| | | } |
| | | QyUser scanUser = this.wechatSyncService.getScanUser(code, clientId); |
| | | String appUserMsg = MessageUtils.message("sys.outer.user.not.exist", new Object[0]); |
| | | |
| | | if (Objects.isNull(scanUser)) { |
| | | this.sseEmitterServer.sendMsg(clientId, appUserMsg, SseEventEnum.ERROR_MSG_ID.getEventId()); |
| | | throw new ServiceException(appUserMsg); |
| | | } |
| | | }* |
| | | UserOauth userOauth = this.userOauthService.getOne(Wrappers.<UserOauth>lambdaQuery().eq(UserOauth::getUuid, scanUser.getUserid()).eq(UserOauth::getSource,QyWechatConstant.QY_SOURCE)); |
| | | |
| | | if (Func.isEmpty(userOauth)) { |
| | | this.sseEmitterServer.sendMsg(clientId, appUserMsg, SseEventEnum.ERROR_MSG_ID.getEventId()); |
| | | throw new ServiceException(appUserMsg); |
| | | } |
| | | Employee employee = this.wechatSyncService.createOrModifyEmployee(scanUser, userOauth); |
| | | //Employee employee = this.wechatSyncService.createOrModifyEmployee(scanUser, userOauth); |
| | | String userBingMsg = MessageUtils.message("sys.outer.user.not.bind.account", new Object[0]); |
| | | if (StrUtil.isEmpty(employee.getUserId())) { |
| | | this.sseEmitterServer.sendMsg(clientId, userBingMsg, SseEventEnum.ERROR_MSG_ID.getEventId()); |
| | |
| | | CodeUtil.failureCode(cacheKey); |
| | | return R.data(authInfo); |
| | | } |
| | | */ |
| | | } |