Commit cf689cc6 by 刘鹏

feat : 系统消息列表接口调试完毕,跳转待后续调试

parent 59d2fcbc
......@@ -31,6 +31,8 @@ import com.yidianling.consultant.api.IConsultantService
import com.yidianling.fm.api.service.IFMService
import com.yidianling.medical.GraphicConsultationFlow1Activity
import com.yidianling.medical.archives.MedicalArchivesListActivity
import com.yidianling.medical.im.MedicalSystemListActivity
import com.yidianling.medical.im.adapter.MedicalSystemListAdapter
import com.yidianling.tests.home.NewTestHomeActivity
import com.yidianling.user.StatusUtils
import com.yidianling.user.ui.collect.CollectSexAndBirthActivity
......@@ -92,6 +94,10 @@ class MainActivity : BaseLceActivity<DemoContract.View, DemoContract.Presenter>(
tv_user.setOnClickListener {
reLoadData()
}
system_list.setOnClickListener {
//系统消息列表
MedicalSystemListActivity.start(this@MainActivity)
}
test_ts.setOnClickListener {
// val alipay: PayTask = PayTask(this@MainActivity)
// val orderInfo = "{\n" +
......
......@@ -11,7 +11,7 @@ ext {
"m-user" : "0.0.61.90",
"m-user-medical" : "0.0.61.99",
"m-home" : "0.0.22.70",
"m-im-medical" : "0.0.20.86",
"m-im-medical" : "0.0.20.87",
"m-im" : "0.0.20.76",
"m-dynamic" : "0.0.7.28",
"m-article" : "0.0.0.10",
......@@ -97,7 +97,7 @@ ext {
"m-user" : "0.0.61.90",
"m-user-medical" : "0.0.61.99",
"m-home" : "0.0.22.70",
"m-im-medical" : "0.0.20.86",
"m-im-medical" : "0.0.20.87",
"m-im" : "0.0.20.76",
"m-dynamic" : "0.0.7.28",
"m-article" : "0.0.0.8",
......
......@@ -299,7 +299,7 @@
<!--医疗系统消息-->
<activity
android:name="com.yidianling.medical.im.SystemMessageListActivity"
android:name="com.yidianling.medical.im.MedicalSystemListActivity"
android:screenOrientation="portrait"
android:theme="@style/platform_NoTitleTheme" />
</application>
......
......@@ -60,6 +60,11 @@ public class TimeUtil {
return (formatter.format(new Date()));
}
public static String getTimeStringForDate( long milliseconds) {
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.getDefault());
return (formatter.format(milliseconds));
}
public static int getNow() {
return (int) ((new Date()).getTime() / 1000);
}
......
......@@ -29,7 +29,7 @@ class MedicalArchivesListActivity : BaseActivity(), SwipeRefreshLayout.OnRefresh
companion object {
private var currPage: Int = 1
private val pageSize: Int = 20
private const val pageSize: Int = 20
private lateinit var mEmptyView: View
private lateinit var mAdapter: MedicalUserArchivesAdapter
private var isFirstLoadData = true
......
package com.yidianling.medical.im
import android.annotation.SuppressLint
import android.content.Context
import android.content.Intent
import android.view.LayoutInflater
import android.view.View
import android.widget.TextView
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
......@@ -14,8 +16,10 @@ import com.ydl.ydlcommon.utils.Utils
import com.yidianling.im.R
import com.yidianling.medical.im.adapter.MedicalSystemListAdapter
import com.yidianling.medical.widgets.LoadMoreView
import com.yidianling.uikit.custom.http.ServiceImpl
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers
import kotlinx.android.synthetic.main.medical_system_list_activity.*
import kotlinx.coroutines.*
import java.util.*
......@@ -23,20 +27,18 @@ import java.util.*
* 系统消息列表
* @author liupeng
* */
class SystemMessageListActivity : BaseActivity(), SwipeRefreshLayout.OnRefreshListener,
class MedicalSystemListActivity : BaseActivity(), SwipeRefreshLayout.OnRefreshListener,
BaseQuickAdapter.RequestLoadMoreListener {
private lateinit var mEmptyView: View
private lateinit var mAdapter: MedicalSystemListAdapter
companion object {
private lateinit var mDoctorId: String
private lateinit var mDoctorUid: String
private var currPage: Int = 1
private const val pageSize: Int = 20
@JvmStatic
fun start(context: Context, doctorId: String, doctorUid: String) {
val starter = Intent(context, SystemMessageListActivity::class.java)
.putExtra("doctorId", doctorId)
.putExtra("doctorUid", doctorUid)
fun start(context: Context) {
val starter = Intent(context, MedicalSystemListActivity::class.java)
context.startActivity(starter)
}
}
......@@ -47,11 +49,11 @@ class SystemMessageListActivity : BaseActivity(), SwipeRefreshLayout.OnRefreshLi
override fun initDataAndEvent() {
initStatus()
mEmptyView = LayoutInflater.from(this@SystemMessageListActivity)
mEmptyView = LayoutInflater.from(this@MedicalSystemListActivity)
.inflate(R.layout.platform_list_empty_view, null, false)
mAdapter = MedicalSystemListAdapter()
system_list.layoutManager =
LinearLayoutManager(this@SystemMessageListActivity, LinearLayoutManager.VERTICAL, false)
LinearLayoutManager(this@MedicalSystemListActivity, LinearLayoutManager.VERTICAL, false)
system_list.adapter = mAdapter
mAdapter.setOnItemClickListener { adapter, view, position ->
......@@ -61,31 +63,103 @@ class SystemMessageListActivity : BaseActivity(), SwipeRefreshLayout.OnRefreshLi
}
}
mAdapter.setLoadMoreView(LoadMoreView())
mAdapter.setOnLoadMoreListener(this@SystemMessageListActivity, system_list)
mAdapter.setOnLoadMoreListener(this@MedicalSystemListActivity, system_list)
system_swipe_refresh_layout?.setOnRefreshListener(this)
system_swipe_refresh_layout?.setColorSchemeColors(
ContextCompat.getColor(this@SystemMessageListActivity, R.color.platform_main_theme)
ContextCompat.getColor(this@MedicalSystemListActivity, R.color.platform_main_theme)
)
system_swipe_refresh_layout?.setProgressViewOffset(false, 0, 200)
currPage = 1
getSystemList()
}
@SuppressLint("CheckResult")
private fun getSystemList() {
ServiceImpl.instance.getSystemPageList(currPage, pageSize, null)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe({ response ->
if ("200" == response.code) {
system_swipe_refresh_layout.isRefreshing = false
var list = response.data.rows
if (currPage == 1) {
//第一页数据
if (list != null && list.isNotEmpty()) {
if (list.size < pageSize) {
mAdapter.setNewData(list)
mAdapter.removeAllFooterView()
mAdapter.loadMoreEnd(false)
} else {
currPage++
mAdapter.setNewData(list)
mAdapter.removeAllFooterView()
mAdapter.loadMoreComplete()
}
} else {
mAdapter.loadMoreEnd(false)
mAdapter.setNewData(list)
var net_error = mEmptyView.findViewById<TextView>(R.id.net_error)
net_error.text = "暂无系统消息~"
mAdapter.emptyView =
mEmptyView
}
} else {
//非第一页数据
if (list != null && list.isEmpty()) {
mAdapter.loadMoreEnd(false)
} else {
if (list.size < pageSize) {
mAdapter.addData(list)
mAdapter.loadMoreEnd(false)
} else {
mAdapter.addData(list)
if (currPage == response.data.totalPage) {
mAdapter.loadMoreEnd(false)
} else {
currPage++
mAdapter.loadMoreComplete()
}
}
}
}
} else {
system_swipe_refresh_layout.isRefreshing = false
mAdapter.loadMoreFail()
mAdapter.emptyView =
mEmptyView
}
}, { e ->
system_swipe_refresh_layout.isRefreshing = false
mAdapter.loadMoreFail()
var net_error = mEmptyView.findViewById<TextView>(R.id.net_error)
var reLoad = mEmptyView.findViewById<TextView>(R.id.reLoad)
net_error.text = "网络异常,请稍后再试"
reLoad.visibility = View.VISIBLE
mAdapter.emptyView =
mEmptyView
})
}
override fun onRefresh() {
currPage = 1
getSystemList()
}
override fun onLoadMoreRequested() {
getSystemList()
}
private fun initStatus() {
StatusBarUtils.setTransparentForImageView(this@SystemMessageListActivity, null)
StatusBarUtils.statusBarLightMode(this@SystemMessageListActivity)
StatusBarUtils.setTransparentForImageView(this@MedicalSystemListActivity, null)
StatusBarUtils.statusBarLightMode(this@MedicalSystemListActivity)
}
......
......@@ -2,15 +2,27 @@ package com.yidianling.medical.im.adapter
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.yidianling.avchatkit.common.util.TimeUtil
import com.yidianling.im.R
import com.yidianling.im.bean.SystemMsgBean
import com.yidianling.medical.im.bean.SystemItemBean
/**
* 医生系统消息item adapter
*/
class MedicalSystemListAdapter : BaseQuickAdapter<SystemMsgBean.SystemMBean?, BaseViewHolder>(R.layout.medical_item_system_list) {
class MedicalSystemListAdapter :
BaseQuickAdapter<SystemItemBean, BaseViewHolder>(R.layout.medical_item_system_list) {
override fun convert(helper: BaseViewHolder, item: SystemMsgBean.SystemMBean?) {
override fun convert(helper: BaseViewHolder, item: SystemItemBean) {
//时间
helper.setText(R.id.time_text, TimeUtil.getTimeStringForDate(item.createTime))
//标题
item.title?.let { title ->
helper.setText(R.id.system_title, title)
}
//内容
item.content?.let { content ->
helper.setText(R.id.system_dec, content)
}
}
......
package com.yidianling.medical.im.bean
/**
* 系统消息item
* */
data class SystemItemBean(
var content: String,
var createTime: Long,
var msgId: String,
var read: Boolean,
var readTime: String,
var title: String
)
package com.yidianling.medical.im.bean
/**
* 系统消息返回数据
* */
data class SystemListRespose(
var pageNum: Int,
var pageSize: Int,
var rows: List<SystemItemBean>,
var totalCount: Int,
var totalPage: Int
)
......@@ -8,13 +8,13 @@ import com.yidianling.medical.MedicalFileBeanRespose
import com.yidianling.medical.archives.bean.CreateArchivesRespose
import com.yidianling.medical.archives.bean.MedicalArchivesListBean
import com.yidianling.medical.archives.bean.MedicalUserArchivesBean
import com.yidianling.medical.im.bean.SystemListRespose
import com.yidianling.uikit.custom.http.response.*
import com.yidianling.uikit.custom.http.response.question.QuestionsInfoBean
import io.reactivex.Observable
import okhttp3.RequestBody
import retrofit2.http.*
import java.util.*
import kotlin.collections.ArrayList
/**
* Created by xj on 2019/6/26.
......@@ -164,5 +164,12 @@ interface ServiceApi {
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA_URL)
fun upload(@PartMap params: TreeMap<String, RequestBody>): Observable<BaseAPIResponse<MedicalFileBeanRespose>>
//医疗 系统消息列表
@GET("api/client/message/v1/getPageList")
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA_URL)
fun getSystemPageList(
@Query("pageNum") pageNum: Int,
@Query("pageSize") pageSize: Int,
@Query("read") read: String?
): Observable<BaseAPIResponse<SystemListRespose>>
}
\ No newline at end of file
......@@ -6,6 +6,7 @@ import com.ydl.ydlnet.YDLHttpUtils
import com.yidianling.im.http.ImRetrofitApi
import com.yidianling.medical.MedicalFileBeanRespose
import com.yidianling.medical.archives.bean.*
import com.yidianling.medical.im.bean.SystemListRespose
import com.yidianling.uikit.custom.http.response.*
import com.yidianling.uikit.custom.http.response.question.QuestionsInfoBean
import io.reactivex.Observable
......@@ -274,6 +275,14 @@ class ServiceImpl private constructor() {
return YDLHttpUtils.obtainApi(ServiceApi::class.java).deleteArchives(body)
}
/**
* 医疗 系统消息列表
* @param read 是否阅读 0-未读 1-已读 空-全部
* */
fun getSystemPageList(pageNum: Int,pageSize: Int,read:String?):Observable<BaseAPIResponse<SystemListRespose>>{
return YDLHttpUtils.obtainApi(ServiceApi::class.java).getSystemPageList(pageNum,pageSize,read)
}
fun uploadBatch( map :TreeMap<String, RequestBody>): Observable<BaseAPIResponse<List<MedicalFileBeanRespose>>> {
......
......@@ -9,6 +9,7 @@
android:paddingRight="16dp">
<TextView
android:id="@+id/time_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
......@@ -21,10 +22,12 @@
tools:text="2022-02-18" />
<androidx.cardview.widget.CardView
android:layout_marginTop="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/medical_bg_ffffff_8dp"
android:elevation="0dp"
app:cardCornerRadius="8dp"
app:cardElevation="0dp">
<androidx.constraintlayout.widget.ConstraintLayout
......
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