Commit c27adb13 by 刘鹏

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

parent 2dc5f8aa
...@@ -6,7 +6,7 @@ ext { ...@@ -6,7 +6,7 @@ ext {
// -------------- 业务模块 -------------- // -------------- 业务模块 --------------
//第三步 若干 //第三步 若干
"m-confide" : "0.0.49.09", "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-fm" : "0.0.30.03",
"m-user" : "0.0.61.37", "m-user" : "0.0.61.37",
"m-home" : "0.0.22.65", "m-home" : "0.0.22.65",
...@@ -28,7 +28,7 @@ ext { ...@@ -28,7 +28,7 @@ ext {
"m-tests-api" : "0.0.2", "m-tests-api" : "0.0.2",
"m-user-api" : "0.0.10.17", "m-user-api" : "0.0.10.17",
"m-home-api" : "0.0.4.2", "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", "m-dynamic-api" : "0.0.3.71",
//-------------- 功能组件 -------------- //-------------- 功能组件 --------------
...@@ -89,7 +89,7 @@ ext { ...@@ -89,7 +89,7 @@ ext {
//第三步 若干 //第三步 若干
"m-confide" : "0.0.49.09", "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-fm" : "0.0.30.01",
"m-user" : "0.0.61.37", "m-user" : "0.0.61.37",
"m-home" : "0.0.22.65", "m-home" : "0.0.22.65",
...@@ -113,7 +113,7 @@ ext { ...@@ -113,7 +113,7 @@ ext {
"m-tests-api" : "0.0.2", "m-tests-api" : "0.0.2",
"m-user-api" : "0.0.10.17", "m-user-api" : "0.0.10.17",
"m-home-api" : "0.0.4.2", "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", "m-dynamic-api" : "0.0.3.71",
//-------------- 功能组件 -------------- //-------------- 功能组件 --------------
......
...@@ -13,7 +13,6 @@ import com.yidianling.consultant.model.bean.ExpertSearchBean ...@@ -13,7 +13,6 @@ import com.yidianling.consultant.model.bean.ExpertSearchBean
import com.yidianling.consultant.model.bean.HeadData import com.yidianling.consultant.model.bean.HeadData
import io.reactivex.Observable import io.reactivex.Observable
import retrofit2.http.* import retrofit2.http.*
import kotlin.reflect.jvm.internal.impl.load.kotlin.JvmType
/** /**
...@@ -64,20 +63,6 @@ interface SearchApi { ...@@ -64,20 +63,6 @@ interface SearchApi {
fun getConsultAssistantRequest(@Query("switchKey") switchKey: String): Observable<BaseAPIResponse<Boolean>> fun getConsultAssistantRequest(@Query("switchKey") switchKey: String): Observable<BaseAPIResponse<Boolean>>
//获取咨询助理uid //获取咨询助理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") @Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA, "Content-Type:application/json")
@POST("doctor/querySpecialTopic") @POST("doctor/querySpecialTopic")
fun getBigShotData(): Observable<BaseAPIResponse<ExpertSearchTopShowBean>> fun getBigShotData(): Observable<BaseAPIResponse<ExpertSearchTopShowBean>>
...@@ -94,4 +79,16 @@ interface SearchApi { ...@@ -94,4 +79,16 @@ interface SearchApi {
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA, "Content-Type:application/json") @Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA, "Content-Type:application/json")
@GET("consult/assistant/chat-time-setting") @GET("consult/assistant/chat-time-setting")
fun getJumpTypeRequest(): Observable<BaseAPIResponse<Int>> 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
...@@ -3,13 +3,12 @@ package com.yidianling.consultant.modular.singlton ...@@ -3,13 +3,12 @@ package com.yidianling.consultant.modular.singlton
import android.annotation.SuppressLint import android.annotation.SuppressLint
import android.app.Activity import android.app.Activity
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import com.alibaba.android.arouter.launcher.ARouter
import com.ydl.ydlcommon.data.http.ThrowableConsumer import com.ydl.ydlcommon.data.http.ThrowableConsumer
import com.ydl.ydlcommon.utils.ActivityManager import com.ydl.ydlcommon.utils.ActivityManager
import com.ydl.ydlcommon.utils.Utils
import com.ydl.ydlcommon.utils.YdlBuryPointUtil import com.ydl.ydlcommon.utils.YdlBuryPointUtil
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.yidianling.common.tools.LogUtil import com.ydl.ydlnet.YDLHttpUtils.Companion.obtainApi
import com.yidianling.common.tools.ToastUtil
import com.yidianling.consultant.ConsultAssistantCenterActivity import com.yidianling.consultant.ConsultAssistantCenterActivity
import com.yidianling.consultant.ExpertSearchActivity import com.yidianling.consultant.ExpertSearchActivity
import com.yidianling.consultant.constants.ConsultBIConstants import com.yidianling.consultant.constants.ConsultBIConstants
...@@ -29,8 +28,8 @@ class ConsultAssistantDialogUtils private constructor() { ...@@ -29,8 +28,8 @@ class ConsultAssistantDialogUtils private constructor() {
companion object { companion object {
val INSTANCE by lazy { ConsultAssistantDialogUtils() } val INSTANCE by lazy { ConsultAssistantDialogUtils() }
var isSHowDesc=true var isSHowDesc = true
var REALATION_EDUCATION=false//是否跳转亲子教育字段,接口加ffrom2="learning" var REALATION_EDUCATION = false//是否跳转亲子教育字段,接口加ffrom2="learning"
} }
var consultAssistantDialogFromHomePage: ConsultAssistantDialog? = null // 首页展示的dialog var consultAssistantDialogFromHomePage: ConsultAssistantDialog? = null // 首页展示的dialog
...@@ -40,9 +39,9 @@ class ConsultAssistantDialogUtils private constructor() { ...@@ -40,9 +39,9 @@ class ConsultAssistantDialogUtils private constructor() {
var consultAssistantActivityDialog: ConsultAssistantDialog? = null //咨询师列表activity页面展示的dialog var consultAssistantActivityDialog: ConsultAssistantDialog? = null //咨询师列表activity页面展示的dialog
var confideListDialog: ConsultAssistantDialog? = null //倾诉列表activity页面展示的dialog var confideListDialog: ConsultAssistantDialog? = null //倾诉列表activity页面展示的dialog
var expertSearchActivityPageHasShown: Boolean = false // 专家咨询列表activity页面是否已经展示 var expertSearchActivityPageHasShown: Boolean = false // 专家咨询列表activity页面是否已经展示
// var ASSISTANT_DIALOG_SP_TAG = "assistant_dialog_sp_tag" // 是否展示左侧文本的缓存key
var minWidth = 0 // 最小宽度
// var ASSISTANT_DIALOG_SP_TAG = "assistant_dialog_sp_tag" // 是否展示左侧文本的缓存key
var minWidth = 0 // 最小宽度
/** /**
...@@ -60,7 +59,9 @@ class ConsultAssistantDialogUtils private constructor() { ...@@ -60,7 +59,9 @@ class ConsultAssistantDialogUtils private constructor() {
} }
} }
"doctor_list" -> { "doctor_list" -> {
if (!ConsultantIn.isLogin() || (ConsultantIn.getUserImpl().getUserInfo()?.user_type == 1 && ConsultantIn.isLogin())) { if (!ConsultantIn.isLogin() || (ConsultantIn.getUserImpl()
.getUserInfo()?.user_type == 1 && ConsultantIn.isLogin())
) {
shouldShowDialog(activity, origin, fromActivity = fromActivity) shouldShowDialog(activity, origin, fromActivity = fromActivity)
} }
} }
...@@ -94,7 +95,7 @@ class ConsultAssistantDialogUtils private constructor() { ...@@ -94,7 +95,7 @@ class ConsultAssistantDialogUtils private constructor() {
if (origin == "home_index") { if (origin == "home_index") {
showFromYdlHome(activity) showFromYdlHome(activity)
} else if (origin == "doctor_list") { } else if (origin == "doctor_list") {
show(activity, origin,fromActivity) show(activity, origin, fromActivity)
} else if (origin == "mine_index") { } else if (origin == "mine_index") {
showFromMine(activity) showFromMine(activity)
} }
...@@ -114,11 +115,17 @@ class ConsultAssistantDialogUtils private constructor() { ...@@ -114,11 +115,17 @@ class ConsultAssistantDialogUtils private constructor() {
activity, activity,
object : ConsultAssistantDialog.OnConsultAssistantClickListener { object : ConsultAssistantDialog.OnConsultAssistantClickListener {
override fun onClickAction() { override fun onClickAction() {
if (Utils.isFastClick()) {
return onClickAction()
}
//获取用户uid //获取用户uid
ActionCountUtils.count("main_page|main_daoyi_entry_click") ActionCountUtils.count("main_page|main_daoyi_entry_click")
YdlBuryPointUtil.sendClick("home_page_assistant_click") YdlBuryPointUtil.sendClick("home_page_assistant_click")
ActionCountUtils.count(ConsultBIConstants.POSITION_DAOYI_ADVERTISEMENT_CLICK, "1") ActionCountUtils.count(
getConsultAssistantUid("",activity,1) ConsultBIConstants.POSITION_DAOYI_ADVERTISEMENT_CLICK,
"1"
)
getConsultAssistantUid("", activity, 1)
} }
}) })
...@@ -143,17 +150,23 @@ class ConsultAssistantDialogUtils private constructor() { ...@@ -143,17 +150,23 @@ class ConsultAssistantDialogUtils private constructor() {
fun showFromConfideListHome(activity: Activity) { fun showFromConfideListHome(activity: Activity) {
if (!activity.isFinishing) { if (!activity.isFinishing) {
confideListDialog = ConsultAssistantDialog( confideListDialog = ConsultAssistantDialog(
activity, activity,
object : ConsultAssistantDialog.OnConsultAssistantClickListener { object : ConsultAssistantDialog.OnConsultAssistantClickListener {
override fun onClickAction() { override fun onClickAction() {
if (!ConsultantIn.getUserImpl().loginByOneKeyLogin(activity,true)){ if (Utils.isFastClick()) {
return return onClickAction()
} }
ActionCountUtils.count(ConsultBIConstants.POSITION_DAOYI_ADVERTISEMENT_CLICK, "17") if (!ConsultantIn.getUserImpl().loginByOneKeyLogin(activity, true)) {
getConsultAssistantUid("",activity,17) return
} }
ActionCountUtils.count(
ConsultBIConstants.POSITION_DAOYI_ADVERTISEMENT_CLICK,
"17"
)
getConsultAssistantUid("", activity, 17)
}
}) })
confideListDialog?.show() confideListDialog?.show()
} }
} }
...@@ -179,9 +192,15 @@ class ConsultAssistantDialogUtils private constructor() { ...@@ -179,9 +192,15 @@ class ConsultAssistantDialogUtils private constructor() {
activity, activity,
object : ConsultAssistantDialog.OnConsultAssistantClickListener { object : ConsultAssistantDialog.OnConsultAssistantClickListener {
override fun onClickAction() { override fun onClickAction() {
if (Utils.isFastClick()) {
return onClickAction()
}
//获取用户uid //获取用户uid
ActionCountUtils.count(ConsultBIConstants.POSITION_DAOYI_ADVERTISEMENT_CLICK, "4") ActionCountUtils.count(
getConsultAssistantUid("",activity,4) ConsultBIConstants.POSITION_DAOYI_ADVERTISEMENT_CLICK,
"4"
)
getConsultAssistantUid("", activity, 4)
} }
}) })
...@@ -204,21 +223,21 @@ class ConsultAssistantDialogUtils private constructor() { ...@@ -204,21 +223,21 @@ class ConsultAssistantDialogUtils private constructor() {
/** /**
* 咨询师列表页展示 * 咨询师列表页展示
*/ */
fun show(activity: Activity, origin:String,fromActivity: Boolean = false) { fun show(activity: Activity, origin: String, fromActivity: Boolean = false) {
// 来自于fragment咨询师列表 // 来自于fragment咨询师列表
if (!fromActivity) { if (!fromActivity) {
if (!expertSearchPageHasShown) { if (!expertSearchPageHasShown) {
expertSearchPageHasShown = true expertSearchPageHasShown = true
showDialog(origin,activity) showDialog(origin, activity)
} else { } else {
showDialog(origin,activity) showDialog(origin, activity)
} }
} else {// 来自于activity咨询师列表 } else {// 来自于activity咨询师列表
if (!expertSearchActivityPageHasShown) { if (!expertSearchActivityPageHasShown) {
expertSearchActivityPageHasShown = true expertSearchActivityPageHasShown = true
showDialog(origin,activity, true) showDialog(origin, activity, true)
} else { } else {
showDialog(origin,activity, true) showDialog(origin, activity, true)
} }
} }
} }
...@@ -226,7 +245,7 @@ class ConsultAssistantDialogUtils private constructor() { ...@@ -226,7 +245,7 @@ class ConsultAssistantDialogUtils private constructor() {
/** /**
* 咨询师列表页展示浮层 * 咨询师列表页展示浮层
*/ */
fun showDialog(origin: String,activity: Activity, fromActivity: Boolean = false) { fun showDialog(origin: String, activity: Activity, fromActivity: Boolean = false) {
if (!fromActivity) { if (!fromActivity) {
if (!activity.isFinishing) { if (!activity.isFinishing) {
if (consultAssistantFragmentDialog == null) { if (consultAssistantFragmentDialog == null) {
...@@ -234,13 +253,19 @@ class ConsultAssistantDialogUtils private constructor() { ...@@ -234,13 +253,19 @@ class ConsultAssistantDialogUtils private constructor() {
activity, activity,
object : ConsultAssistantDialog.OnConsultAssistantClickListener { object : ConsultAssistantDialog.OnConsultAssistantClickListener {
override fun onClickAction() { override fun onClickAction() {
ActionCountUtils.count(ConsultBIConstants.POSITION_DAOYI_ADVERTISEMENT_CLICK, "6") if (Utils.isFastClick()) {
return onClickAction()
}
ActionCountUtils.count(
ConsultBIConstants.POSITION_DAOYI_ADVERTISEMENT_CLICK,
"6"
)
ActionCountUtils.count("app_consult_list_page|app_consult_list_daoyi_entry_click") ActionCountUtils.count("app_consult_list_page|app_consult_list_daoyi_entry_click")
YdlBuryPointUtil.sendClick("assistant_list_click") YdlBuryPointUtil.sendClick("assistant_list_click")
// 咨询师列表页面且未登录情况下,跳转登录页面 // 咨询师列表页面且未登录情况下,跳转登录页面
if (ConsultantIn.loginByOneKeyLogin(activity,true)) { if (ConsultantIn.loginByOneKeyLogin(activity, true)) {
//获取用户uid //获取用户uid
getConsultAssistantUid(origin,activity,6) getConsultAssistantUid(origin, activity, 6)
} }
} }
...@@ -255,12 +280,15 @@ class ConsultAssistantDialogUtils private constructor() { ...@@ -255,12 +280,15 @@ class ConsultAssistantDialogUtils private constructor() {
activity, activity,
object : ConsultAssistantDialog.OnConsultAssistantClickListener { object : ConsultAssistantDialog.OnConsultAssistantClickListener {
override fun onClickAction() { override fun onClickAction() {
if (Utils.isFastClick()) {
return onClickAction()
}
ActionCountUtils.count("app_consult_list_page|app_consult_list_daoyi_entry_click") ActionCountUtils.count("app_consult_list_page|app_consult_list_daoyi_entry_click")
YdlBuryPointUtil.sendClick("assistant_list_click") YdlBuryPointUtil.sendClick("assistant_list_click")
// 咨询师列表页面且未登录情况下,跳转登录页面 // 咨询师列表页面且未登录情况下,跳转登录页面
if (ConsultantIn.loginByOneKeyLogin(activity,true)) { if (ConsultantIn.loginByOneKeyLogin(activity, true)) {
//获取用户uid //获取用户uid
getConsultAssistantUid(origin,activity,6) getConsultAssistantUid(origin, activity, 6)
} }
} }
...@@ -310,7 +338,7 @@ class ConsultAssistantDialogUtils private constructor() { ...@@ -310,7 +338,7 @@ class ConsultAssistantDialogUtils private constructor() {
*/ */
fun expertSearchResetStatus() { fun expertSearchResetStatus() {
//页面关闭后重置亲子列表状态 //页面关闭后重置亲子列表状态
REALATION_EDUCATION=false REALATION_EDUCATION = false
consultAssistantActivityDialog?.dismiss() consultAssistantActivityDialog?.dismiss()
expertSearchActivityPageHasShown = false expertSearchActivityPageHasShown = false
...@@ -320,55 +348,63 @@ class ConsultAssistantDialogUtils private constructor() { ...@@ -320,55 +348,63 @@ class ConsultAssistantDialogUtils private constructor() {
////////////////////////////////////// 咨询师列表页面的展示隐藏逻辑 代码块end /////////////////////////////////////////////////// ////////////////////////////////////// 咨询师列表页面的展示隐藏逻辑 代码块end ///////////////////////////////////////////////////
@SuppressLint("CheckResult") @SuppressLint("CheckResult")
fun getConsultAssistantUid(origin: String,activity: Activity,location:Int) { fun getConsultAssistantUid(origin: String, activity: Activity, location: Int) {
if (origin=="doctor_list"){ if (origin == "doctor_list") {
// 请求接口获取咨询助理的uid // 请求接口获取咨询助理的uid
if (REALATION_EDUCATION){ if (REALATION_EDUCATION) {
getConsultAssistantUid(location, activity,"learning") getConsultAssistantUid(location, activity, "learning")
}else{ } else {
getConsultAssistantUid(location, activity,null) getConsultAssistantUid(location, activity, null)
} }
}else{ } else {
// 请求接口获取咨询助理的uid // 请求接口获取咨询助理的uid
getConsultAssistantUid(location, activity,null) getConsultAssistantUid(location, activity, null)
} }
ActionCountUtils.count(ConsultBIConstants.POSITION_DAOYI_ADVERTISEMENT_CLICK, location.toString()) ActionCountUtils.count(
ConsultBIConstants.POSITION_DAOYI_ADVERTISEMENT_CLICK,
location.toString()
)
} }
@SuppressLint("CheckResult") @SuppressLint("CheckResult")
private fun getConsultAssistantUid(location: Int, activity: Activity, ffrom:String?) { private fun getConsultAssistantUid(location: Int, activity: Activity, ffrom: String?) {
SearchApi.getSearchApi().getConsultAssistantUidRequest(location, ffrom)
obtainApi(SearchApi::class.java).getChatRouteConfig(location)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe(Consumer { .subscribe(Consumer {
if (it.data==100L&&(location<=17)){
if (it.data == 100L && (location <= 17)) {
//跳转咨询tab栏目 //跳转咨询tab栏目
if (location==1||location==4||location==6||location==3){ if (location == 1 || location == 4 || location == 6 || location == 3) {
if (activity is ExpertSearchActivity &&!activity.isFinishing){ if (activity is ExpertSearchActivity && !activity.isFinishing) {
activity.finish() activity.finish()
} }
EventBus.getDefault().post(HomeModuleTabEvent(2)) EventBus.getDefault().post(HomeModuleTabEvent(2))
}else{ } else {
if (activity.componentName.toString().contains("CourseListContainerActivity") ){ if (activity.componentName.toString()
.contains("CourseListContainerActivity")
) {
ActivityManager.getInstance() ActivityManager.getInstance()
.getSecondTaskActivity()?.finish() .getSecondTaskActivity()?.finish()
activity.finish() activity.finish()
}else{ } else {
if (null!=activity&&!activity.isFinishing){ if (null != activity && !activity.isFinishing) {
activity.finish() activity.finish()
} }
} }
EventBus.getDefault().post(HomeModuleTabEvent(2)) EventBus.getDefault().post(HomeModuleTabEvent(2))
} }
}else{ } else if (it.data == 0L) {
if (it.code == "200" && it.data != 0.toLong() && null != activity) { //去前置信息收集页
ConsultantIn.startP2PSession(activity as AppCompatActivity, it.data.toString()) ConsultantIn.startP2PSession(
} else { activity as AppCompatActivity,
ToastUtil.toastShort("咨询助理忙碌中,请稍后再试") location,
} ffrom
)
} }
if (null != activity && activity is ConsultAssistantCenterActivity && !activity.isFinishing) activity.finish() if (null != activity && activity is ConsultAssistantCenterActivity && !activity.isFinishing) activity.finish()
}, object : ThrowableConsumer() { }, object : ThrowableConsumer() {
......
...@@ -7,14 +7,13 @@ import com.ydl.ydl_router.manager.YDLRouterManager ...@@ -7,14 +7,13 @@ import com.ydl.ydl_router.manager.YDLRouterManager
import com.ydl.ydl_router.manager.YDLRouterParams import com.ydl.ydl_router.manager.YDLRouterParams
import com.ydl.ydlcommon.data.http.ThrowableConsumer import com.ydl.ydlcommon.data.http.ThrowableConsumer
import com.ydl.ydlcommon.router.IYDLRouterConstant 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.ActivityManager.Companion.getInstance
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.ydl.ydlnet.YDLHttpUtils
import com.yidianling.common.tools.LogUtil import com.yidianling.common.tools.LogUtil
import com.yidianling.common.tools.ToastUtil import com.yidianling.common.tools.ToastUtil
import com.yidianling.consultant.ConsultAssistantCenterActivity import com.yidianling.consultant.ConsultAssistantCenterActivity
import com.yidianling.consultant.ExpertSearchActivity import com.yidianling.consultant.ExpertSearchActivity
import com.yidianling.consultant.HotSearchActivity
import com.yidianling.consultant.constants.ConsultBIConstants import com.yidianling.consultant.constants.ConsultBIConstants
import com.yidianling.consultant.model.SearchApi import com.yidianling.consultant.model.SearchApi
import com.yidianling.consultant.router.ConsultantIn import com.yidianling.consultant.router.ConsultantIn
...@@ -27,15 +26,15 @@ import io.reactivex.schedulers.Schedulers ...@@ -27,15 +26,15 @@ import io.reactivex.schedulers.Schedulers
class ConsultAssistantEntryUtils { class ConsultAssistantEntryUtils {
companion object { companion object {
@SuppressLint("CheckResult") @SuppressLint("CheckResult")
fun jumpConsultAssistant(activity: Activity, location: Int,ffrom2:String?) { fun jumpConsultAssistant(activity: Activity, location: Int, ffrom2: String?) {
ActionCountUtils.count( ActionCountUtils.count(
ConsultBIConstants.POSITION_DAOYI_ADVERTISEMENT_CLICK, ConsultBIConstants.POSITION_DAOYI_ADVERTISEMENT_CLICK,
"$location" "$location"
) )
if (ConsultantIn.loginByOneKeyLogin(activity,true)) { if (ConsultantIn.loginByOneKeyLogin(activity, true)) {
// 请求接口获取咨询助理的uid // 请求接口获取咨询助理的uid
SearchApi.getSearchApi().getConsultAssistantUidRequest(location,ffrom2) YDLHttpUtils.obtainApi(SearchApi::class.java).getChatRouteConfig(location)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe(Consumer { .subscribe(Consumer {
...@@ -44,35 +43,35 @@ class ConsultAssistantEntryUtils { ...@@ -44,35 +43,35 @@ class ConsultAssistantEntryUtils {
* 7使用心理课进入,8使用心理课列表页进入,9测评解读页进入,10搜索页进入,11注册引导页 * 7使用心理课进入,8使用心理课列表页进入,9测评解读页进入,10搜索页进入,11注册引导页
* 0小壹点击前往 * 0小壹点击前往
* */ * */
if (it.data==100L&&(location<=11)){ if (it.data == 100L && (location <= 11)) {
//跳转咨询tab栏目 //跳转咨询tab栏目
if (location==1||location==4||location==6||location==3){ if (location == 1 || location == 4 || location == 6 || location == 3) {
if (activity is ExpertSearchActivity&&!activity.isFinishing){ 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){
activity.finish() activity.finish()
} }
}
EventBus.getDefault().post(HomeModuleTabEvent(2)) EventBus.getDefault().post(HomeModuleTabEvent(2))
}
}else{
if (it.code == "200" && it.data != 0.toLong() && null != activity) {
ConsultantIn.startP2PSession(
activity as AppCompatActivity,
it.data.toString()
)
} else { } 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() { }, object : ThrowableConsumer() {
override fun accept(msg: String) { override fun accept(msg: String) {
...@@ -84,31 +83,34 @@ class ConsultAssistantEntryUtils { ...@@ -84,31 +83,34 @@ class ConsultAssistantEntryUtils {
} }
/* /*
* 根据Type0,1跳自主,2跳导医 * 根据Type0,1跳自主,2跳导医
* 在跳自主的(type=1)情况下,点击item是跳专家详情页 * 在跳自主的(type=1)情况下,点击item是跳专家详情页
* *
* */ * */
@SuppressLint("CheckResult") @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() SearchApi.getSearchApi().getJumpTypeRequest()
.subscribeOn((Schedulers.io())) .subscribeOn((Schedulers.io()))
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe (Consumer { .subscribe(Consumer {
when(it.code){ when (it.code) {
"200"->{ "200" -> {
when(it.data){ when (it.data) {
0->{ 0 -> {
jumpToAutoTalk(activity, doctorUid) jumpToAutoTalk(activity, doctorUid)
} }
1->{ 1 -> {
if (url.isNullOrEmpty()){ if (url.isNullOrEmpty()) {
jumpToAutoTalk(activity, doctorUid) jumpToAutoTalk(activity, doctorUid)
}else{ } else {
if (url.startsWith("http")) { if (url.startsWith("http")) {
YDLRouterManager.router( YDLRouterManager.router(
IYDLRouterConstant.ROUTER_H5_H5, IYDLRouterConstant.ROUTER_H5_H5,
YDLRouterParams().putExtra(IYDLRouterConstant.EXTRA_URL, url), "" YDLRouterParams().putExtra(
IYDLRouterConstant.EXTRA_URL,
url
), ""
) )
} else { } else {
YDLRouterManager.router(url) YDLRouterManager.router(url)
...@@ -116,20 +118,20 @@ class ConsultAssistantEntryUtils { ...@@ -116,20 +118,20 @@ class ConsultAssistantEntryUtils {
} }
} }
2->{ 2 -> {
jumpConsultAssistant(activity,location,null) jumpConsultAssistant(activity, location, null)
} }
else->{ else -> {
jumpToAutoTalk(activity, doctorUid) jumpToAutoTalk(activity, doctorUid)
LogUtil.e(it.data.toString()) LogUtil.e(it.data.toString())
} }
} }
} }
else->{ else -> {
ToastUtil.toastShort(it.code) ToastUtil.toastShort(it.code)
} }
} }
},object:ThrowableConsumer(){ }, object : ThrowableConsumer() {
override fun accept(msg: String) { override fun accept(msg: String) {
ToastUtil.toastShort(msg) ToastUtil.toastShort(msg)
} }
......
...@@ -2,7 +2,6 @@ package com.yidianling.consultant.router ...@@ -2,7 +2,6 @@ package com.yidianling.consultant.router
import android.app.Activity import android.app.Activity
import android.content.Context import android.content.Context
import androidx.appcompat.app.AppCompatActivity
import com.ydl.ydlcommon.modular.ModularServiceManager import com.ydl.ydlcommon.modular.ModularServiceManager
import com.yidianling.im.api.service.IImService import com.yidianling.im.api.service.IImService
import com.yidianling.user.api.service.IAppService import com.yidianling.user.api.service.IAppService
...@@ -22,6 +21,7 @@ object ConsultantIn { ...@@ -22,6 +21,7 @@ object ConsultantIn {
fun getAppService(): IAppService { fun getAppService(): IAppService {
return ModularServiceManager.provide(IAppService::class.java) return ModularServiceManager.provide(IAppService::class.java)
} }
fun getUserService(): IUserService { fun getUserService(): IUserService {
return ModularServiceManager.provide(IUserService::class.java) return ModularServiceManager.provide(IUserService::class.java)
} }
...@@ -39,7 +39,14 @@ object ConsultantIn { ...@@ -39,7 +39,14 @@ object ConsultantIn {
getImService().startP2PSession(context, toUid) 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) getAppService().mainIntent(activity)
} }
...@@ -48,7 +55,9 @@ object ConsultantIn { ...@@ -48,7 +55,9 @@ object ConsultantIn {
} }
fun toLogin(activity: Activity) { 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 { ...@@ -56,7 +65,7 @@ object ConsultantIn {
* @param isOpenDialog true:一键登录使用弹窗展示 false:一键登录使用全屏模式 * @param isOpenDialog true:一键登录使用弹窗展示 false:一键登录使用全屏模式
* @return true:已登录,不触发登录跳转,false:未登录,优先一键登录 * @return true:已登录,不触发登录跳转,false:未登录,优先一键登录
* */ * */
fun loginByOneKeyLogin(context: Context, isOpenDialog: Boolean) :Boolean{ fun loginByOneKeyLogin(context: Context, isOpenDialog: Boolean): Boolean {
return getUserService().loginByOneKeyLogin(context,isOpenDialog) return getUserService().loginByOneKeyLogin(context, isOpenDialog)
} }
} }
\ No newline at end of file
package com.yidianling.im.helper package com.yidianling.im.helper
import android.annotation.SuppressLint import android.annotation.SuppressLint
import android.app.Activity
import android.content.Context import android.content.Context
import android.text.TextUtils import android.text.TextUtils
import android.view.View import android.view.View
...@@ -17,6 +18,7 @@ import com.ydl.ydlcommon.modular.ModularServiceManager ...@@ -17,6 +18,7 @@ import com.ydl.ydlcommon.modular.ModularServiceManager
import com.ydl.ydlcommon.ui.LoadingDialogFragment import com.ydl.ydlcommon.ui.LoadingDialogFragment
import com.ydl.ydlcommon.ui.LoadingDialogFragment.Companion.newInstance import com.ydl.ydlcommon.ui.LoadingDialogFragment.Companion.newInstance
import com.ydl.ydlcommon.utils.NetworkParamsUtils import com.ydl.ydlcommon.utils.NetworkParamsUtils
import com.ydl.ydlcommon.utils.SharedPreferencesEditor
import com.ydl.ydlcommon.utils.UserInfoCache import com.ydl.ydlcommon.utils.UserInfoCache
import com.ydl.ydlcommon.utils.log.AliYunLogConfig import com.ydl.ydlcommon.utils.log.AliYunLogConfig
import com.ydl.ydlcommon.utils.log.AliYunRichLogsHelper import com.ydl.ydlcommon.utils.log.AliYunRichLogsHelper
...@@ -49,6 +51,7 @@ import com.yidianling.uikit.custom.http.response.RecommendExpertBean ...@@ -49,6 +51,7 @@ import com.yidianling.uikit.custom.http.response.RecommendExpertBean
import com.yidianling.uikit.custom.widget.TitleBarBottom import com.yidianling.uikit.custom.widget.TitleBarBottom
import com.yidianling.user.api.service.IUserService import com.yidianling.user.api.service.IUserService
import io.reactivex.android.schedulers.AndroidSchedulers import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.functions.Consumer
import io.reactivex.schedulers.Schedulers import io.reactivex.schedulers.Schedulers
import retrofit2.HttpException import retrofit2.HttpException
import java.net.URLEncoder import java.net.URLEncoder
...@@ -84,6 +87,58 @@ object IMChatUtil { ...@@ -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 * @param context
...@@ -107,7 +162,11 @@ object IMChatUtil { ...@@ -107,7 +162,11 @@ object IMChatUtil {
.subscribe({ res: BaseResponse<UserTypeBean> -> .subscribe({ res: BaseResponse<UserTypeBean> ->
if (res.code == 200 && res.data != null) { 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( prepareAssistantChatData(
context, context,
...@@ -119,11 +178,12 @@ object IMChatUtil { ...@@ -119,11 +178,12 @@ object IMChatUtil {
.compose(RxUtils.resultJavaData()) .compose(RxUtils.resultJavaData())
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe{ .subscribe {
CmsExamQuestionPaperActivity.start( CmsExamQuestionPaperActivity.start(
context, chatItemBean.toUid.toString(), expertInfo, context, chatItemBean.toUid.toString(), expertInfo,
0, it.value1) 0, it.value1
)
} }
} }
}) })
...@@ -218,30 +278,12 @@ object IMChatUtil { ...@@ -218,30 +278,12 @@ object IMChatUtil {
}) { t: Throwable? -> }) { t: Throwable? ->
handleError(context, t!!) 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 { } else {
prepareAssistantChatData(context, toUid, object : ChatDataRequestListener { prepareAssistantChatData(context, toUid, object : ChatDataRequestListener {
override fun onSuccess(expertInfo: IMExpertBuild) { override fun onSuccess(expertInfo: IMExpertBuild) {
startChatSession(toUid, expertInfo, isFromQingShu, context) startChatSession(toUid, expertInfo, isFromQingShu, context)
} }
}) })
} }
} else { } else {
if (loadingDialog != null && loadingDialog!!.isVisible) { if (loadingDialog != null && loadingDialog!!.isVisible) {
...@@ -254,7 +296,8 @@ object IMChatUtil { ...@@ -254,7 +296,8 @@ object IMChatUtil {
loadingDialog?.dismissAllowingStateLoss() loadingDialog?.dismissAllowingStateLoss()
} }
handleError(context, throwable!!) handleError(context, throwable!!)
}) }
)
} }
......
...@@ -135,4 +135,22 @@ interface ImRetrofitApi { ...@@ -135,4 +135,22 @@ interface ImRetrofitApi {
@GET("systemconfig/getSystemConfigByKeyword") @GET("systemconfig/getSystemConfigByKeyword")
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA) @Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
fun getSystemConfigByKeyword( @Query("keyword") keyword: String): Observable<BaseAPIResponse<SystemConfigByKeywordBean>> 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 ...@@ -39,6 +39,7 @@ import com.yidianling.im.session.SessionHelper
import com.yidianling.im.session.extension.CustomAttachModifyTime import com.yidianling.im.session.extension.CustomAttachModifyTime
import com.yidianling.im.session.extension.CustomAttachSubScriptTime import com.yidianling.im.session.extension.CustomAttachSubScriptTime
import com.yidianling.im.session.extension.CustomAttachmentTest import com.yidianling.im.session.extension.CustomAttachmentTest
import com.yidianling.im.ui.activity.CmsExamQuestionPaperActivity
import com.yidianling.im.ui.page.NewMultiMessageFragment import com.yidianling.im.ui.page.NewMultiMessageFragment
import com.yidianling.nimbase.common.media.picker.PickImageHelper import com.yidianling.nimbase.common.media.picker.PickImageHelper
import com.yidianling.uikit.api.NimUIKit import com.yidianling.uikit.api.NimUIKit
...@@ -65,6 +66,10 @@ class IMServiceImpl : IImService { ...@@ -65,6 +66,10 @@ class IMServiceImpl : IImService {
IMChatUtil.startChat(context as AppCompatActivity, toUid, 0) 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) { override fun startP2PXiaoYi(context: Context) {
if (!ImIn.loginByOneKeyLogin(context,true)) { if (!ImIn.loginByOneKeyLogin(context,true)) {
return return
......
...@@ -19,9 +19,11 @@ import com.ydl.ydlcommon.base.BaseActivity ...@@ -19,9 +19,11 @@ import com.ydl.ydlcommon.base.BaseActivity
import com.ydl.ydlcommon.utils.SharedPreferencesEditor import com.ydl.ydlcommon.utils.SharedPreferencesEditor
import com.ydl.ydlcommon.utils.Utils import com.ydl.ydlcommon.utils.Utils
import com.ydl.ydlcommon.view.dialog.CommonDialog import com.ydl.ydlcommon.view.dialog.CommonDialog
import com.yidianling.common.tools.ToastUtil
import com.yidianling.im.R import com.yidianling.im.R
import com.yidianling.im.api.bean.IMExpertBuild import com.yidianling.im.api.bean.IMExpertBuild
import com.yidianling.im.helper.IMChatUtil import com.yidianling.im.helper.IMChatUtil
import com.yidianling.im.http.ImRetrofitApi
import com.yidianling.im.router.ImIn import com.yidianling.im.router.ImIn
import com.yidianling.listener.SoftKeyBoardListener import com.yidianling.listener.SoftKeyBoardListener
import com.yidianling.uikit.business.session.view.question.QuestionAdapter import com.yidianling.uikit.business.session.view.question.QuestionAdapter
...@@ -78,10 +80,13 @@ class CmsExamQuestionPaperActivity : BaseActivity() { ...@@ -78,10 +80,13 @@ class CmsExamQuestionPaperActivity : BaseActivity() {
companion object { companion object {
private lateinit var expertInfo: IMExpertBuild private lateinit var expertInfo: IMExpertBuild
private lateinit var toUid: String private var toUid: String? = null
private var isFromQingShu: Int = 0 private var isFromQingShu: Int = 0
private var skip_time: Long = 0 private var skip_time: Long = 0
private var location: Int = 0
private var ffrom2: String? = null
@JvmStatic @JvmStatic
fun start( fun start(
context: Context, toUid: String, expertInfo: IMExpertBuild, context: Context, toUid: String, expertInfo: IMExpertBuild,
...@@ -94,6 +99,14 @@ class CmsExamQuestionPaperActivity : BaseActivity() { ...@@ -94,6 +99,14 @@ class CmsExamQuestionPaperActivity : BaseActivity() {
this.skip_time = skip_time.toLong() this.skip_time = skip_time.toLong()
context.startActivity(starter) context.startActivity(starter)
} }
@JvmStatic
fun start(context: Context, location: Int, ffrom2: String?) {
val starter = Intent(context, CmsExamQuestionPaperActivity::class.java)
this.location = location
this.ffrom2 = ffrom2
context.startActivity(starter)
}
} }
override fun layoutResId(): Int { override fun layoutResId(): Int {
...@@ -103,11 +116,6 @@ class CmsExamQuestionPaperActivity : BaseActivity() { ...@@ -103,11 +116,6 @@ class CmsExamQuestionPaperActivity : BaseActivity() {
override fun initDataAndEvent() { override fun initDataAndEvent() {
mType70RequestList.clear() mType70RequestList.clear()
mType71RequestList.clear() mType71RequestList.clear()
if (isJumpToIm()) {
//如果今天答过题,跳转到聊天界面
skipToIm()
return
}
//初始化 //初始化
initRecycle() initRecycle()
//设置view事件 //设置view事件
...@@ -132,7 +140,14 @@ class CmsExamQuestionPaperActivity : BaseActivity() { ...@@ -132,7 +140,14 @@ class CmsExamQuestionPaperActivity : BaseActivity() {
mQuestionAdapter.setOneCheckListener(object : QuestionOneCheckListener { mQuestionAdapter.setOneCheckListener(object : QuestionOneCheckListener {
override fun itemClick(list: List<OptionsBean>, question: QuestionsBean) { override fun itemClick(list: List<OptionsBean>, question: QuestionsBean) {
answerItemClick(list, question, "") var otherInput = ""
list.forEachIndexed { index, optionsBean ->
if ("其他" == optionsBean.name) {
otherInput = et_input_problem.text.toString()
}
}
answerItemClick(list, question, otherInput)
hideInputAndKeyboark()
} }
override fun showOtherEdit(list: List<OptionsBean>, question: QuestionsBean) { override fun showOtherEdit(list: List<OptionsBean>, question: QuestionsBean) {
...@@ -165,15 +180,28 @@ class CmsExamQuestionPaperActivity : BaseActivity() { ...@@ -165,15 +180,28 @@ class CmsExamQuestionPaperActivity : BaseActivity() {
override fun hideOtherEdit() { override fun hideOtherEdit() {
//隐藏其他软键盘 //隐藏其他软键盘
et_input_problem.setText("") hideInputAndKeyboark()
cl_input.visibility = LinearLayout.GONE
hideInputMethod(et_input_problem)
} }
override fun zsItemClick(answer: String, postion: Int) { override fun zsItemClick(
//主诉 list: List<OptionsBean>,
addType71Request(answer) question: QuestionsBean,
mackType2(answer) postion: Int
) {
var otherInput = ""
list.forEachIndexed { index, optionsBean ->
if ("其他" == optionsBean.name) {
otherInput = et_input_problem.text.toString()
}
}
//发送回答问题信息
sendAnswerText(list, otherInput)
//回答问题参数创建
val answerQuestionRequestBean = answerQuestionRequestBean(question, list, "")
//灵犀消息 参数创建
addType70Request(answerQuestionRequestBean)
makeType6(postion + 1) makeType6(postion + 1)
} }
...@@ -225,9 +253,10 @@ class CmsExamQuestionPaperActivity : BaseActivity() { ...@@ -225,9 +253,10 @@ class CmsExamQuestionPaperActivity : BaseActivity() {
//最后一题 点击发送 //最后一题 点击发送
lastAnswer = et_input_problem.text.toString() lastAnswer = et_input_problem.text.toString()
addType71Request(et_input_problem.text.toString()) addType71Request(et_input_problem.text.toString())
tv_finish.visibility = View.VISIBLE tv_finish.visibility = View.VISIBLE
mackType2(lastAnswer) mackType2(lastAnswer)
setFirstAndLatQuestion("我们根据您的情况安排了一位高级咨询顾问,帮助您匹配最合适的咨询服务,点击按钮现在去沟通~")
//滑动到底部 //滑动到底部
recycle.scrollToPosition(mData.size - 1) recycle.scrollToPosition(mData.size - 1)
mData.forEachIndexed { index, _ -> mData.forEachIndexed { index, _ ->
...@@ -243,11 +272,7 @@ class CmsExamQuestionPaperActivity : BaseActivity() { ...@@ -243,11 +272,7 @@ class CmsExamQuestionPaperActivity : BaseActivity() {
) )
} }
} }
hideInputAndKeyboark()
et_input_problem.setText("")
hideInputMethod(et_input_problem)
//隐藏输入框
cl_input.visibility = LinearLayout.GONE
} }
tv_cur_problem.setOnClickListener { tv_cur_problem.setOnClickListener {
problemContent = et_input_problem.text.toString() problemContent = et_input_problem.text.toString()
...@@ -328,6 +353,13 @@ class CmsExamQuestionPaperActivity : BaseActivity() { ...@@ -328,6 +353,13 @@ class CmsExamQuestionPaperActivity : BaseActivity() {
} }
} }
private fun hideInputAndKeyboark() {
et_input_problem.setText("")
hideInputMethod(et_input_problem)
//隐藏输入框
cl_input.visibility = LinearLayout.GONE
}
/** /**
* 回答问题 * 回答问题
...@@ -429,9 +461,9 @@ class CmsExamQuestionPaperActivity : BaseActivity() { ...@@ -429,9 +461,9 @@ class CmsExamQuestionPaperActivity : BaseActivity() {
//设置数据,清空list数据 //设置数据,清空list数据
mData.clear() mData.clear()
//取到问候语 //取到问候语
getFirstQuestion() setFirstAndLatQuestion("你好,为了更好的帮助您我们需要了解些基本信息,我们将会严格保护你的隐私安全,请放心。")
//取出第二条消息 //取出第二条消息
if (resp.data.questions.size > 0) { if (resp.data.questionPaper != null) {
haveLingxiQuestion = true haveLingxiQuestion = true
setSecondQuestionByLx() setSecondQuestionByLx()
createExams() createExams()
...@@ -442,18 +474,16 @@ class CmsExamQuestionPaperActivity : BaseActivity() { ...@@ -442,18 +474,16 @@ class CmsExamQuestionPaperActivity : BaseActivity() {
} else { } else {
//无答题数据,跳转到聊天界面 //无答题数据,跳转到聊天界面
IMChatUtil.startChatSessionByCms( jumpToIm()
toUid, expertInfo, isFromQingShu, this@CmsExamQuestionPaperActivity
)
} }
}, { }, {
//接口请求报错,跳转到聊天页面 //接口请求报错,跳转到聊天页面
IMChatUtil.startChatSessionByCms( jumpToIm()
toUid, expertInfo, isFromQingShu, this@CmsExamQuestionPaperActivity
)
}) })
} }
@SuppressLint("CheckResult") @SuppressLint("CheckResult")
private fun createExams() { private fun createExams() {
val createExamsRequestBean = val createExamsRequestBean =
...@@ -482,9 +512,9 @@ class CmsExamQuestionPaperActivity : BaseActivity() { ...@@ -482,9 +512,9 @@ class CmsExamQuestionPaperActivity : BaseActivity() {
/*** /***
* 取到问候语 * 取到问候语
* */ * */
private fun getFirstQuestion() { private fun setFirstAndLatQuestion(str: String) {
val questionMultiItem = QuestionMultiItem() val questionMultiItem = QuestionMultiItem()
questionMultiItem.type1Text = "你好,为了更好的帮助您我们需要了解些基本信息,我们将会严格保护你的隐私安全,请放心。" questionMultiItem.type1Text = str
questionMultiItem.viewType = 1 questionMultiItem.viewType = 1
mData.add(questionMultiItem) mData.add(questionMultiItem)
mQuestionAdapter.notifyDataSetChanged() mQuestionAdapter.notifyDataSetChanged()
...@@ -510,10 +540,13 @@ class CmsExamQuestionPaperActivity : BaseActivity() { ...@@ -510,10 +540,13 @@ class CmsExamQuestionPaperActivity : BaseActivity() {
private fun sendAnswerText(list: List<OptionsBean>, otherInput: String) { private fun sendAnswerText(list: List<OptionsBean>, otherInput: String) {
var answerStr = "" var answerStr = ""
list.forEach { list.forEach {
answerStr = "$answerStr#${it.name}" answerStr = "$answerStr#${it.name} "
} }
if (otherInput.isNotEmpty()) { if (otherInput.isNotEmpty()) {
answerStr = "$answerStr \n \n otherInput" answerStr = "$answerStr \n \n $otherInput"
}
if (!answerStr.contains("其他")) {
answerStr = answerStr.substring(1).replace("#", "、")
} }
mackType2(answerStr) mackType2(answerStr)
...@@ -566,7 +599,6 @@ class CmsExamQuestionPaperActivity : BaseActivity() { ...@@ -566,7 +599,6 @@ class CmsExamQuestionPaperActivity : BaseActivity() {
//最后一提, //最后一提,
noMore = true noMore = true
//显示输入框 //显示输入框
cl_input.visibility = LinearLayout.VISIBLE cl_input.visibility = LinearLayout.VISIBLE
tv_problem.visibility = LinearLayout.GONE tv_problem.visibility = LinearLayout.GONE
...@@ -643,7 +675,9 @@ class CmsExamQuestionPaperActivity : BaseActivity() { ...@@ -643,7 +675,9 @@ class CmsExamQuestionPaperActivity : BaseActivity() {
type70RequestBean.data = answerQuestionRequestBean type70RequestBean.data = answerQuestionRequestBean
type70RequestBean.fromUid = ImIn.getUserInfo()?.uid type70RequestBean.fromUid = ImIn.getUserInfo()?.uid
type70RequestBean.toUid = toUid toUid.let {
type70RequestBean.toUid = toUid
}
//添加回答数据到 //添加回答数据到
mType70RequestList.add(type70RequestBean) mType70RequestList.add(type70RequestBean)
...@@ -658,30 +692,13 @@ class CmsExamQuestionPaperActivity : BaseActivity() { ...@@ -658,30 +692,13 @@ class CmsExamQuestionPaperActivity : BaseActivity() {
dataBean.answer = answer dataBean.answer = answer
answerQuestionType71RequestBean.data = dataBean answerQuestionType71RequestBean.data = dataBean
answerQuestionType71RequestBean.toUid = toUid toUid.let {
answerQuestionType71RequestBean.toUid = toUid
}
answerQuestionType71RequestBean.fromUid = ImIn.getUserInfo()?.uid answerQuestionType71RequestBean.fromUid = ImIn.getUserInfo()?.uid
mType71RequestList.add(answerQuestionType71RequestBean) mType71RequestList.add(answerQuestionType71RequestBean)
} }
/***
* 判断今天是否展示过
* */
private fun isJumpToIm(): Boolean {
val time = System.currentTimeMillis()
val skipTime = SharedPreferencesEditor.getString("skip_time_")
if (skipTime == null || skipTime.isEmpty()) {
return false
}
val timeDifference = (time - skipTime.toLong()) / 1000
val second = 1000
val minute = second * 60
val hour = minute * 60
val day = hour * 24
return timeDifference < skip_time
}
/** /**
* 跳过填写dialog * 跳过填写dialog
* */ * */
...@@ -706,29 +723,111 @@ class CmsExamQuestionPaperActivity : BaseActivity() { ...@@ -706,29 +723,111 @@ class CmsExamQuestionPaperActivity : BaseActivity() {
/** /**
* 跳过,直接取IM界面 * 跳过,直接取IM界面
* */ * */
@SuppressLint("CheckResult")
private fun skipToIm() { private fun skipToIm() {
SharedPreferencesEditor.putString("skip_time_", System.currentTimeMillis().toString()) SharedPreferencesEditor.putString("skip_time_", System.currentTimeMillis().toString())
mType70RequestList.forEach {
instance.lingxiAnswerQuestion(JSON.toJSONString(it))
.subscribeOn(Schedulers.io())
.observeOn(Schedulers.io())
.subscribe()
}
mType71RequestList.forEach { if (toUid != null) {
instance.lingxiAnswerQuestion(JSON.toJSONString(it)) //代表是聊天列表进来的
mType70RequestList.forEach {
instance.lingxiAnswerQuestion(JSON.toJSONString(it))
.subscribeOn(Schedulers.io())
.observeOn(Schedulers.io())
.subscribe()
}
mType71RequestList.forEach {
instance.lingxiAnswerQuestion(JSON.toJSONString(it))
.subscribeOn(Schedulers.io())
.observeOn(Schedulers.io())
.subscribe()
}
IMChatUtil.startChatSessionByCms(
toUid!!, expertInfo, isFromQingShu, this@CmsExamQuestionPaperActivity
)
Handler().postDelayed({
finish()
}, 1000L)
} else {
//代表是导医进来的 导医进来的需要获取导医后再发送消息
ImRetrofitApi.getImJavaApi()
.getConsultAssistantUidRequest(location, ffrom2)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.observeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread())
.subscribe() .subscribe({ uidBean ->
} if (uidBean.code == "200" && uidBean.data != 0.toLong()) {
mType70RequestList.forEach {
it.toUid = uidBean.data.toString()
instance.lingxiAnswerQuestion(JSON.toJSONString(it))
.subscribeOn(Schedulers.io())
.observeOn(Schedulers.io())
.subscribe()
}
mType71RequestList.forEach {
it.toUid = uidBean.data.toString()
instance.lingxiAnswerQuestion(JSON.toJSONString(it))
.subscribeOn(Schedulers.io())
.observeOn(Schedulers.io())
.subscribe()
}
IMChatUtil.startChat(
this@CmsExamQuestionPaperActivity,
uidBean.data.toString(),
0
)
Handler().postDelayed({
finish()
}, 1000L)
} else {
ToastUtil.toastShort("咨询助理忙碌中,请稍后再试")
}
}, {
ToastUtil.toastShort("咨询助理忙碌中,请稍后再试")
})
IMChatUtil.startChatSessionByCms( }
toUid, expertInfo, isFromQingShu, this@CmsExamQuestionPaperActivity
)
finish()
} }
/**
* 导医进来的跳转到咨询
* */
@SuppressLint("CheckResult")
private fun jumpToIm() {
if (toUid != null) {
IMChatUtil.startChatSessionByCms(
toUid!!, expertInfo, isFromQingShu, this@CmsExamQuestionPaperActivity
)
} else {
ImRetrofitApi.getImJavaApi()
.getConsultAssistantUidRequest(location, ffrom2)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe({ uidBean ->
if (uidBean.code == "200" && uidBean.data != 0.toLong()) {
IMChatUtil.startChat(
this@CmsExamQuestionPaperActivity,
uidBean.data.toString(),
0
)
finish()
} else {
ToastUtil.toastShort("咨询助理忙碌中,请稍后再试")
finish()
}
}, {
ToastUtil.toastShort("咨询助理忙碌中,请稍后再试")
finish()
})
}
}
// 隐藏键盘布局 // 隐藏键盘布局
private fun hideInputMethod(et: EditText) { private fun hideInputMethod(et: EditText) {
......
...@@ -123,7 +123,7 @@ public class QuestionAdapter extends BaseMultiItemQuickAdapter<QuestionMultiItem ...@@ -123,7 +123,7 @@ public class QuestionAdapter extends BaseMultiItemQuickAdapter<QuestionMultiItem
} }
oneCheckAdapter.getData().get(position).check = true; oneCheckAdapter.getData().get(position).check = true;
oneCheckAdapter.notifyDataSetChanged(); oneCheckAdapter.notifyDataSetChanged();
mOneCheckListener.zsItemClick(data.get(position).name, item.type6Position); mOneCheckListener.zsItemClick(getCheckOptionsBeans(oneCheckAdapter),item.questionsBean, item.type6Position);
} }
}); });
} }
......
...@@ -26,5 +26,5 @@ interface QuestionOneCheckListener { ...@@ -26,5 +26,5 @@ interface QuestionOneCheckListener {
/** /**
* 主诉单选点击 多选确定按钮点击获取item信息 * 主诉单选点击 多选确定按钮点击获取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 ...@@ -5,11 +5,7 @@ import android.app.Application
import android.content.Context import android.content.Context
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import com.alibaba.android.arouter.facade.template.IProvider import com.alibaba.android.arouter.facade.template.IProvider
import com.yidianling.im.api.bean.IMInitConfigBean import com.yidianling.im.api.bean.*
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.listener.ApiStringResponseCallback import com.yidianling.im.api.listener.ApiStringResponseCallback
/** /**
...@@ -25,6 +21,9 @@ interface IImService : IProvider { ...@@ -25,6 +21,9 @@ interface IImService : IProvider {
// 打开私聊界面 // 打开私聊界面
fun startP2PSession(context: Activity, toUid: String) fun startP2PSession(context: Activity, toUid: String)
// 打开信息前置收集页
fun startP2PSession(context: Activity, location: Int, ffrom2: String?)
fun setAccount(account: String) fun setAccount(account: String)
fun setChattingAccountAll() fun setChattingAccountAll()
...@@ -43,6 +42,7 @@ interface IImService : IProvider { ...@@ -43,6 +42,7 @@ interface IImService : IProvider {
fun logout() fun logout()
fun clear() fun clear()
/** /**
* 创建一条普通文本消息 * 创建一条普通文本消息
* @param sessionId 聊天对象ID * @param sessionId 聊天对象ID
...@@ -50,17 +50,37 @@ interface IImService : IProvider { ...@@ -50,17 +50,37 @@ interface IImService : IProvider {
*/ */
fun createTextMessage(sessionId: String?, content: String, callback: IMRequestCallback<Void>) 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 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)
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 { ...@@ -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 { ...@@ -112,7 +136,14 @@ interface IImService : IProvider {
fun startKefuChat(context: Context, toUid: String, flag: Int, canTalk: Int) 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?) fun updateUserHead(head: String?)
...@@ -136,11 +167,18 @@ interface IImService : IProvider { ...@@ -136,11 +167,18 @@ interface IImService : IProvider {
fun getChatUid(context: Context?, uid: String, callback: ApiStringResponseCallback) 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>)
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 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