Commit c27adb13 by 刘鹏

feat :分配导医后置,时间判断前置

parent 2dc5f8aa
......@@ -6,7 +6,7 @@ ext {
// -------------- 业务模块 --------------
//第三步 若干
"m-confide" : "0.0.49.09",
"m-consultant" : "0.0.59.79",
"m-consultant" : "0.0.59.89",
"m-fm" : "0.0.30.03",
"m-user" : "0.0.61.37",
"m-home" : "0.0.22.65",
......@@ -28,7 +28,7 @@ ext {
"m-tests-api" : "0.0.2",
"m-user-api" : "0.0.10.17",
"m-home-api" : "0.0.4.2",
"m-im-api" : "0.0.12.22",
"m-im-api" : "0.0.12.23",
"m-dynamic-api" : "0.0.3.71",
//-------------- 功能组件 --------------
......@@ -89,7 +89,7 @@ ext {
//第三步 若干
"m-confide" : "0.0.49.09",
"m-consultant" : "0.0.59.79",
"m-consultant" : "0.0.59.89",
"m-fm" : "0.0.30.01",
"m-user" : "0.0.61.37",
"m-home" : "0.0.22.65",
......@@ -113,7 +113,7 @@ ext {
"m-tests-api" : "0.0.2",
"m-user-api" : "0.0.10.17",
"m-home-api" : "0.0.4.2",
"m-im-api" : "0.0.12.22",
"m-im-api" : "0.0.12.23",
"m-dynamic-api" : "0.0.3.71",
//-------------- 功能组件 --------------
......
......@@ -13,7 +13,6 @@ import com.yidianling.consultant.model.bean.ExpertSearchBean
import com.yidianling.consultant.model.bean.HeadData
import io.reactivex.Observable
import retrofit2.http.*
import kotlin.reflect.jvm.internal.impl.load.kotlin.JvmType
/**
......@@ -64,20 +63,6 @@ interface SearchApi {
fun getConsultAssistantRequest(@Query("switchKey") switchKey: String): Observable<BaseAPIResponse<Boolean>>
//获取咨询助理uid
/*
* location字段说明(sign1存储页面位置,1:首页导医入口进入2:M站入口进入3:问答列表页进入4:我的入口进入
* 5:情绪疏导在线咨询入口进入6:咨询列表页导医入口进入7:实用心理课入口进入8:实用心理课课程列表页进入9:测评解读页进入
* 10:搜索页面进入11:首页咨询列表进入12:厌学的真相在线咨询入口,0是小壹意向客户传0)
*
* ffrom_2 亲子教育添加字段
*naviType = "1";导医配置开关,返100跳转咨询tab,如果返其他则维持原有逻辑。
* */
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA, "Content-Type:application/json")
@GET("consult/assistant/chat-distribute")
fun getConsultAssistantUidRequest(@Query("location")location: Int,@Query("ffrom_2")ffrom:String?,@Query("naviType")naviType:String="1"): Observable<BaseAPIResponse<Long>>
//获取咨询助理uid
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA, "Content-Type:application/json")
@POST("doctor/querySpecialTopic")
fun getBigShotData(): Observable<BaseAPIResponse<ExpertSearchTopShowBean>>
......@@ -94,4 +79,16 @@ interface SearchApi {
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA, "Content-Type:application/json")
@GET("consult/assistant/chat-time-setting")
fun getJumpTypeRequest(): Observable<BaseAPIResponse<Int>>
/**
* 100 有配置接口
* */
@GET("consult/assistant/chat-route-config")
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA,"Content-Type:application/json")
fun getChatRouteConfig(
@Query("location") location: Int,
@Query("naviType") naviType: String = "1"
): Observable<BaseAPIResponse<Long>>
}
\ No newline at end of file
......@@ -7,14 +7,13 @@ import com.ydl.ydl_router.manager.YDLRouterManager
import com.ydl.ydl_router.manager.YDLRouterParams
import com.ydl.ydlcommon.data.http.ThrowableConsumer
import com.ydl.ydlcommon.router.IYDLRouterConstant
import com.ydl.ydlcommon.utils.ActivityManager
import com.ydl.ydlcommon.utils.ActivityManager.Companion.getInstance
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.ydl.ydlnet.YDLHttpUtils
import com.yidianling.common.tools.LogUtil
import com.yidianling.common.tools.ToastUtil
import com.yidianling.consultant.ConsultAssistantCenterActivity
import com.yidianling.consultant.ExpertSearchActivity
import com.yidianling.consultant.HotSearchActivity
import com.yidianling.consultant.constants.ConsultBIConstants
import com.yidianling.consultant.model.SearchApi
import com.yidianling.consultant.router.ConsultantIn
......@@ -27,15 +26,15 @@ import io.reactivex.schedulers.Schedulers
class ConsultAssistantEntryUtils {
companion object {
@SuppressLint("CheckResult")
fun jumpConsultAssistant(activity: Activity, location: Int,ffrom2:String?) {
fun jumpConsultAssistant(activity: Activity, location: Int, ffrom2: String?) {
ActionCountUtils.count(
ConsultBIConstants.POSITION_DAOYI_ADVERTISEMENT_CLICK,
"$location"
)
if (ConsultantIn.loginByOneKeyLogin(activity,true)) {
if (ConsultantIn.loginByOneKeyLogin(activity, true)) {
// 请求接口获取咨询助理的uid
SearchApi.getSearchApi().getConsultAssistantUidRequest(location,ffrom2)
YDLHttpUtils.obtainApi(SearchApi::class.java).getChatRouteConfig(location)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(Consumer {
......@@ -44,35 +43,35 @@ class ConsultAssistantEntryUtils {
* 7使用心理课进入,8使用心理课列表页进入,9测评解读页进入,10搜索页进入,11注册引导页
* 0小壹点击前往
* */
if (it.data==100L&&(location<=11)){
//跳转咨询tab栏目
if (location==1||location==4||location==6||location==3){
if (activity is ExpertSearchActivity&&!activity.isFinishing){
activity.finish()
}
EventBus.getDefault().post(HomeModuleTabEvent(2))
}else{
if (activity.componentName.toString().contains("CourseListContainerActivity") ){
getInstance()
.getSecondTaskActivity()?.finish()
activity.finish()
}else{
if (null!=activity&&!activity.isFinishing){
if (it.data == 100L && (location <= 11)) {
//跳转咨询tab栏目
if (location == 1 || location == 4 || location == 6 || location == 3) {
if (activity is ExpertSearchActivity && !activity.isFinishing) {
activity.finish()
}
}
EventBus.getDefault().post(HomeModuleTabEvent(2))
}
}else{
if (it.code == "200" && it.data != 0.toLong() && null != activity) {
ConsultantIn.startP2PSession(
activity as AppCompatActivity,
it.data.toString()
)
EventBus.getDefault().post(HomeModuleTabEvent(2))
} else {
ToastUtil.toastShort("咨询助理忙碌中,请稍后再试")
if (activity.componentName.toString()
.contains("CourseListContainerActivity")
) {
getInstance()
.getSecondTaskActivity()?.finish()
activity.finish()
} else {
if (null != activity && !activity.isFinishing) {
activity.finish()
}
}
EventBus.getDefault().post(HomeModuleTabEvent(2))
}
} else if (it.data == 0L) {
//去前置信息收集页
ConsultantIn.startP2PSession(
activity as AppCompatActivity,
location,
ffrom2
)
}
}, object : ThrowableConsumer() {
override fun accept(msg: String) {
......@@ -84,31 +83,34 @@ class ConsultAssistantEntryUtils {
}
/*
* 根据Type0,1跳自主,2跳导医
* 在跳自主的(type=1)情况下,点击item是跳专家详情页
*
* */
/*
* 根据Type0,1跳自主,2跳导医
* 在跳自主的(type=1)情况下,点击item是跳专家详情页
*
* */
@SuppressLint("CheckResult")
fun getTypeJump(activity: Activity, location: Int,doctorUid:Int,url:String?){
fun getTypeJump(activity: Activity, location: Int, doctorUid: Int, url: String?) {
SearchApi.getSearchApi().getJumpTypeRequest()
.subscribeOn((Schedulers.io()))
.observeOn(AndroidSchedulers.mainThread())
.subscribe (Consumer {
when(it.code){
"200"->{
when(it.data){
0->{
.subscribe(Consumer {
when (it.code) {
"200" -> {
when (it.data) {
0 -> {
jumpToAutoTalk(activity, doctorUid)
}
1->{
if (url.isNullOrEmpty()){
1 -> {
if (url.isNullOrEmpty()) {
jumpToAutoTalk(activity, doctorUid)
}else{
} else {
if (url.startsWith("http")) {
YDLRouterManager.router(
IYDLRouterConstant.ROUTER_H5_H5,
YDLRouterParams().putExtra(IYDLRouterConstant.EXTRA_URL, url), ""
YDLRouterParams().putExtra(
IYDLRouterConstant.EXTRA_URL,
url
), ""
)
} else {
YDLRouterManager.router(url)
......@@ -116,20 +118,20 @@ class ConsultAssistantEntryUtils {
}
}
2->{
jumpConsultAssistant(activity,location,null)
2 -> {
jumpConsultAssistant(activity, location, null)
}
else->{
else -> {
jumpToAutoTalk(activity, doctorUid)
LogUtil.e(it.data.toString())
}
}
}
else->{
else -> {
ToastUtil.toastShort(it.code)
}
}
},object:ThrowableConsumer(){
}, object : ThrowableConsumer() {
override fun accept(msg: String) {
ToastUtil.toastShort(msg)
}
......
......@@ -2,7 +2,6 @@ package com.yidianling.consultant.router
import android.app.Activity
import android.content.Context
import androidx.appcompat.app.AppCompatActivity
import com.ydl.ydlcommon.modular.ModularServiceManager
import com.yidianling.im.api.service.IImService
import com.yidianling.user.api.service.IAppService
......@@ -22,6 +21,7 @@ object ConsultantIn {
fun getAppService(): IAppService {
return ModularServiceManager.provide(IAppService::class.java)
}
fun getUserService(): IUserService {
return ModularServiceManager.provide(IUserService::class.java)
}
......@@ -39,7 +39,14 @@ object ConsultantIn {
getImService().startP2PSession(context, toUid)
}
fun mainIntent(activity: Activity){
/**
* 去前置信息收集页
* */
fun startP2PSession(context: Activity, location: Int, ffrom2: String?) {
getImService().startP2PSession(context, location, ffrom2)
}
fun mainIntent(activity: Activity) {
getAppService().mainIntent(activity)
}
......@@ -48,7 +55,9 @@ object ConsultantIn {
}
fun toLogin(activity: Activity) {
activity.startActivity(ModularServiceManager.provide(IUserService::class.java).loginWayIntent(activity))
activity.startActivity(
ModularServiceManager.provide(IUserService::class.java).loginWayIntent(activity)
)
}
/**
......@@ -56,7 +65,7 @@ object ConsultantIn {
* @param isOpenDialog true:一键登录使用弹窗展示 false:一键登录使用全屏模式
* @return true:已登录,不触发登录跳转,false:未登录,优先一键登录
* */
fun loginByOneKeyLogin(context: Context, isOpenDialog: Boolean) :Boolean{
return getUserService().loginByOneKeyLogin(context,isOpenDialog)
fun loginByOneKeyLogin(context: Context, isOpenDialog: Boolean): Boolean {
return getUserService().loginByOneKeyLogin(context, isOpenDialog)
}
}
\ No newline at end of file
package com.yidianling.im.helper
import android.annotation.SuppressLint
import android.app.Activity
import android.content.Context
import android.text.TextUtils
import android.view.View
......@@ -17,6 +18,7 @@ import com.ydl.ydlcommon.modular.ModularServiceManager
import com.ydl.ydlcommon.ui.LoadingDialogFragment
import com.ydl.ydlcommon.ui.LoadingDialogFragment.Companion.newInstance
import com.ydl.ydlcommon.utils.NetworkParamsUtils
import com.ydl.ydlcommon.utils.SharedPreferencesEditor
import com.ydl.ydlcommon.utils.UserInfoCache
import com.ydl.ydlcommon.utils.log.AliYunLogConfig
import com.ydl.ydlcommon.utils.log.AliYunRichLogsHelper
......@@ -49,6 +51,7 @@ import com.yidianling.uikit.custom.http.response.RecommendExpertBean
import com.yidianling.uikit.custom.widget.TitleBarBottom
import com.yidianling.user.api.service.IUserService
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.functions.Consumer
import io.reactivex.schedulers.Schedulers
import retrofit2.HttpException
import java.net.URLEncoder
......@@ -84,6 +87,58 @@ object IMChatUtil {
}
/**
* 跳转前置信息收集页
* */
@SuppressLint("CheckResult")
fun startCms(context: Activity, location: Int, ffrom2: String?) {
ImRetrofitApi.Companion.getImRetrofitApi()
.getSystemConfigByKeyword("lx_collect_card_config")
.compose(RxUtils.resultJavaData())
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe {
val skipTime = it.value1.toLong()
if (isJumpToIm(skipTime)) {
// 请求接口获取咨询助理的uid
getImJavaApi().getConsultAssistantUidRequest(location, ffrom2)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe { uidBean ->
/*
* location=1首页,3问答列表页,4我的入口,5亲子在线咨询入口,6咨询列表页导医入口,
* 7使用心理课进入,8使用心理课列表页进入,9测评解读页进入,10搜索页进入,11注册引导页
* 0小壹点击前往
* */
if (uidBean.code == "200" && uidBean.data != 0.toLong()) {
startChat(context as AppCompatActivity, uidBean.data.toString(), 0)
} else {
ToastUtil.toastShort("咨询助理忙碌中,请稍后再试")
}
}
} else {
//没有时间限制,跳转到前置信息收集
CmsExamQuestionPaperActivity.start(context, location, ffrom2)
}
}
}
/***
* 判断今天是否展示过
* */
private fun isJumpToIm(skip_time: Long): Boolean {
val time = System.currentTimeMillis()
val skipTime = SharedPreferencesEditor.getString("skip_time_")
if (skipTime == null || skipTime.isEmpty()) {
return false
}
val timeDifference = (time - skipTime.toLong()) / 1000
return timeDifference < skip_time
}
/**
* 私聊列表进入,后置数据请求
*
* @param context
......@@ -107,7 +162,11 @@ object IMChatUtil {
.subscribe({ res: BaseResponse<UserTypeBean> ->
if (res.code == 200 && res.data != null) {
if (res.data!!.collectEvent &&TextUtils.equals(res.data!!.userType, USER_TYPE_ASSISTANT.toString())) {
if (res.data!!.collectEvent && TextUtils.equals(
res.data!!.userType,
USER_TYPE_ASSISTANT.toString()
)
) {
//和助理私聊需要打开信息采集弹窗
prepareAssistantChatData(
context,
......@@ -119,11 +178,12 @@ object IMChatUtil {
.compose(RxUtils.resultJavaData())
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe{
.subscribe {
CmsExamQuestionPaperActivity.start(
context, chatItemBean.toUid.toString(), expertInfo,
0, it.value1)
0, it.value1
)
}
}
})
......@@ -218,30 +278,12 @@ object IMChatUtil {
}) { t: Throwable? ->
handleError(context, t!!)
}
} else if (TextUtils.equals(res.data!!.userType, USER_TYPE_ASSISTANT.toString())) {//助理
prepareAssistantChatData(context, toUid, object : ChatDataRequestListener {
override fun onSuccess(expertInfo: IMExpertBuild) { //新前置信息收集入口
ImRetrofitApi.Companion.getImRetrofitApi()
.getSystemConfigByKeyword("lx_collect_card_config")
.compose(RxUtils.resultJavaData())
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe{
CmsExamQuestionPaperActivity.start(
context, toUid, expertInfo,
isFromQingShu, it.value1
)
}
}
})
} else {
prepareAssistantChatData(context, toUid, object : ChatDataRequestListener {
override fun onSuccess(expertInfo: IMExpertBuild) {
startChatSession(toUid, expertInfo, isFromQingShu, context)
}
})
}
} else {
if (loadingDialog != null && loadingDialog!!.isVisible) {
......@@ -254,7 +296,8 @@ object IMChatUtil {
loadingDialog?.dismissAllowingStateLoss()
}
handleError(context, throwable!!)
})
}
)
}
......
......@@ -135,4 +135,22 @@ interface ImRetrofitApi {
@GET("systemconfig/getSystemConfigByKeyword")
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
fun getSystemConfigByKeyword( @Query("keyword") keyword: String): Observable<BaseAPIResponse<SystemConfigByKeywordBean>>
//获取咨询助理uid
/*
* location字段说明(sign1存储页面位置,1:首页导医入口进入2:M站入口进入3:问答列表页进入4:我的入口进入
* 5:情绪疏导在线咨询入口进入6:咨询列表页导医入口进入7:实用心理课入口进入8:实用心理课课程列表页进入9:测评解读页进入
* 10:搜索页面进入11:首页咨询列表进入12:厌学的真相在线咨询入口,0是小壹意向客户传0)
*
* ffrom_2 亲子教育添加字段
*naviType = "1";导医配置开关,返100跳转咨询tab,如果返其他则维持原有逻辑。
* */
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA, "Content-Type:application/json")
@GET("consult/assistant/chat-distribute")
fun getConsultAssistantUidRequest(
@Query("location") location: Int,
@Query("ffrom_2") ffrom: String?,
@Query("naviType") naviType: String = "1"
): Observable<BaseAPIResponse<Long>>
}
\ No newline at end of file
......@@ -39,6 +39,7 @@ import com.yidianling.im.session.SessionHelper
import com.yidianling.im.session.extension.CustomAttachModifyTime
import com.yidianling.im.session.extension.CustomAttachSubScriptTime
import com.yidianling.im.session.extension.CustomAttachmentTest
import com.yidianling.im.ui.activity.CmsExamQuestionPaperActivity
import com.yidianling.im.ui.page.NewMultiMessageFragment
import com.yidianling.nimbase.common.media.picker.PickImageHelper
import com.yidianling.uikit.api.NimUIKit
......@@ -65,6 +66,10 @@ class IMServiceImpl : IImService {
IMChatUtil.startChat(context as AppCompatActivity, toUid, 0)
}
override fun startP2PSession(context: Activity, location: Int, ffrom2: String?) {
IMChatUtil.startCms(context,location,ffrom2)
}
override fun startP2PXiaoYi(context: Context) {
if (!ImIn.loginByOneKeyLogin(context,true)) {
return
......
......@@ -123,7 +123,7 @@ public class QuestionAdapter extends BaseMultiItemQuickAdapter<QuestionMultiItem
}
oneCheckAdapter.getData().get(position).check = true;
oneCheckAdapter.notifyDataSetChanged();
mOneCheckListener.zsItemClick(data.get(position).name, item.type6Position);
mOneCheckListener.zsItemClick(getCheckOptionsBeans(oneCheckAdapter),item.questionsBean, item.type6Position);
}
});
}
......
......@@ -26,5 +26,5 @@ interface QuestionOneCheckListener {
/**
* 主诉单选点击 多选确定按钮点击获取item信息
*/
fun zsItemClick(answer: String, postion: Int)
fun zsItemClick(list: List<OptionsBean>,question: QuestionsBean, postion: Int)
}
\ No newline at end of file
......@@ -5,11 +5,7 @@ import android.app.Application
import android.content.Context
import androidx.fragment.app.Fragment
import com.alibaba.android.arouter.facade.template.IProvider
import com.yidianling.im.api.bean.IMInitConfigBean
import com.yidianling.im.api.bean.IMLoginInfo
import com.yidianling.im.api.bean.IMRegisterObserverCustomNotificationCallBack
import com.yidianling.im.api.bean.IMRequestCallback
import com.yidianling.im.api.bean.IMSendCustomNotificationResultCallBack
import com.yidianling.im.api.bean.*
import com.yidianling.im.api.listener.ApiStringResponseCallback
/**
......@@ -25,6 +21,9 @@ interface IImService : IProvider {
// 打开私聊界面
fun startP2PSession(context: Activity, toUid: String)
// 打开信息前置收集页
fun startP2PSession(context: Activity, location: Int, ffrom2: String?)
fun setAccount(account: String)
fun setChattingAccountAll()
......@@ -43,6 +42,7 @@ interface IImService : IProvider {
fun logout()
fun clear()
/**
* 创建一条普通文本消息
* @param sessionId 聊天对象ID
......@@ -50,17 +50,37 @@ interface IImService : IProvider {
*/
fun createTextMessage(sessionId: String?, content: String, callback: IMRequestCallback<Void>)
fun sendSubscriptionTimeMessage(sessionId: String?, content: String, callback: IMRequestCallback<Void>)
fun sendSubscriptionTimeMessage(
sessionId: String?,
content: String,
callback: IMRequestCallback<Void>
)
fun showSelector(activity: Activity, requestCode: Int)
fun sendTestResultMessage(uid: String, content: String, title: String?, head: String?, url: String?, id: Int, share_url: String?, callback: IMRequestCallback<Void>)
fun sendTestResultMessage(
uid: String,
content: String,
title: String?,
head: String?,
url: String?,
id: Int,
share_url: String?,
callback: IMRequestCallback<Void>
)
fun startChat(context: Activity, toUid: String, flag: Int, canTalk: Int)
fun startChat(context : Activity ,toUid : String ,flag : Int , canTalk : Int, isFramQingsu: Int, isFromMessageList: Boolean)
fun startChat(
context: Activity,
toUid: String,
flag: Int,
canTalk: Int,
isFramQingsu: Int,
isFromMessageList: Boolean
)
fun startChatCloseReplaceChat(context : Activity ,toUid : String)
fun startChatCloseReplaceChat(context: Activity, toUid: String)
/**
......@@ -77,7 +97,11 @@ interface IImService : IProvider {
/**
* 发送自定义通知
*/
fun sendCustomNotification(toUid: String, content: String, callback: IMSendCustomNotificationResultCallBack)
fun sendCustomNotification(
toUid: String,
content: String,
callback: IMSendCustomNotificationResultCallBack
)
/**
* 注册自定通知接收器
......@@ -112,7 +136,14 @@ interface IImService : IProvider {
fun startKefuChat(context: Context, toUid: String, flag: Int, canTalk: Int)
//
fun startP2PSession(mContext: Context, userType: Int, account: String, toChatUsername: String, toName: String, head: String)
fun startP2PSession(
mContext: Context,
userType: Int,
account: String,
toChatUsername: String,
toName: String,
head: String
)
fun updateUserHead(head: String?)
......@@ -136,11 +167,18 @@ interface IImService : IProvider {
fun getChatUid(context: Context?, uid: String, callback: ApiStringResponseCallback)
fun chatScheule(context: Activity, userUrl: String, docUrl: String, dsmId: Int, title: String, toUid: Int)
fun chatScheule(
context: Activity,
userUrl: String,
docUrl: String,
dsmId: Int,
title: String,
toUid: Int
)
fun initIm(app: Application, activity: Class<out Activity>)
fun initIm(app: Application, activity: Class<out Activity>,imInitBean: IMInitConfigBean)
fun initIm(app: Application, activity: Class<out Activity>, imInitBean: IMInitConfigBean)
fun isWifiOr3G(activity: Activity): Boolean
}
\ No newline at end of file
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