|
|
@@ -10,6 +10,7 @@ import com.github.microservice.auth.security.model.AuthDetails;
|
|
|
import com.github.microservice.auth.security.type.AuthType;
|
|
|
import com.github.microservice.components.data.mongo.mongo.helper.DBHelper;
|
|
|
import com.github.microservice.core.util.net.IPUtil;
|
|
|
+import com.zhongshu.card.client.model.login.LoginBusModel;
|
|
|
import com.zhongshu.card.client.model.login.LoginCommonModel;
|
|
|
import com.zhongshu.card.client.model.org.*;
|
|
|
import com.zhongshu.card.client.model.setting.PlatFormLoginConfig;
|
|
|
@@ -153,6 +154,53 @@ public class IndexService {
|
|
|
return ResultContent.buildSuccess(commonModel);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 商户小程序登录
|
|
|
+ *
|
|
|
+ * @param param
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public ResultContent<LoginBusModel> busLogin(LoginParam param) {
|
|
|
+ StopWatch stopWatch = new StopWatch();
|
|
|
+ stopWatch.start("1");
|
|
|
+
|
|
|
+ UserAuthLoginModel userAuthLoginModel = new UserAuthLoginModel();
|
|
|
+ BeanUtils.copyProperties(param, userAuthLoginModel);
|
|
|
+ // 登录
|
|
|
+ ResultContent<LoginTokenModel> resultContent = commonLogin(userAuthLoginModel);
|
|
|
+ if (resultContent.isFailed()) {
|
|
|
+ return ResultContent.buildFail(resultContent.getMsg());
|
|
|
+ }
|
|
|
+
|
|
|
+ String phone = param.getLoginValue();
|
|
|
+ UserAccount userAccount = userCountDao.findTopByLoginName(phone);
|
|
|
+ UserCountModel userCountModel = userAccountService.toModel(userAccount);
|
|
|
+
|
|
|
+ // 用户加入的商户列表
|
|
|
+ List<UserJoinBusOrgModel> busModels = organizationService.getUserAboutShopList(userAccount.getUserId());
|
|
|
+ if (ObjectUtils.isEmpty(busModels)) {
|
|
|
+ return ResultContent.buildFail("用户未关联商户,登录失败");
|
|
|
+ }
|
|
|
+
|
|
|
+ LoginBusModel commonModel = new LoginBusModel();
|
|
|
+ LoginTokenModel loginTokenModel = resultContent.getContent();
|
|
|
+ com.zhongshu.card.server.core.util.BeanUtils.copyProperties(loginTokenModel, commonModel);
|
|
|
+ stopWatch.stop();
|
|
|
+ commonModel.setBusList(busModels);
|
|
|
+
|
|
|
+ stopWatch.start("2");
|
|
|
+ commonModel.setUserInfo(userCountModel);
|
|
|
+ stopWatch.stop();
|
|
|
+
|
|
|
+ stopWatch.start("3");
|
|
|
+ // 用户所有的权限
|
|
|
+// Set<String> auth = roleServiceImpl.getUserAllAuths(userAccount.getUserId());
|
|
|
+// commonModel.setAuths(auth);
|
|
|
+ stopWatch.stop();
|
|
|
+ log.info(stopWatch.prettyPrint());
|
|
|
+ return ResultContent.buildSuccess(commonModel);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 通用用户登录(返回所有权限数据)
|
|
|
*
|