中建365-二期开发-商城开发/电子围栏

develop
wlh 1 year ago
parent 52075ffabc
commit dbd348d099

@ -3,22 +3,18 @@ package com.zj365.dc.fragment
import android.Manifest
import android.annotation.SuppressLint
import android.content.Intent
import android.graphics.Color
import android.graphics.drawable.Drawable
import android.os.Build
import android.provider.Settings
import android.text.Spannable
import android.text.SpannableString
import android.text.TextUtils
import android.text.method.KeyListener
import android.view.View
import android.view.ViewGroup
import androidx.core.content.ContextCompat
import androidx.core.view.isVisible
import androidx.lifecycle.MutableLiveData
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import cn.jpush.android.api.JPushInterface
import com.gyf.immersionbar.ImmersionBar
import com.tamsiree.rxkit.RxTimeTool
import com.xty.base.fragment.BaseVmFrag
import com.xty.base.utils.UserInfoDefin
@ -53,23 +49,23 @@ import com.xty.common.util.CommonToastUtils
import com.xty.common.util.CommonUtils
import com.xty.common.weight.CenterImageSpan
import com.xty.common.work.MyWorkManger
import com.xty.common.xqr_code.XQRCodeAct
import com.zj365.mime.weight.NoticeSettingDialog
import com.xty.network.MyRetrofit
import com.xty.network.model.DeviceFunctionBean
import com.xty.network.model.FamilyBean
import com.xty.network.model.HealthMonitoringListBean
import com.xty.network.model.MainBean
import com.xty.network.model.MessageBean
import com.xty.network.model.ReportBean
import com.zj365.dc.BuildConfig
import com.zj365.dc.R
import com.zj365.dc.adapter.HealthMonitoringAdapter
import com.zj365.dc.databinding.FragDynamicManagementBinding
import com.zj365.dc.vm.DynamicManagementVm
import com.zj365.health.vm.ReportVm
import com.zj365.health.weight.DialogTip
import com.zj365.mime.weight.NoticeSettingDialog
import io.reactivex.Observable
import io.reactivex.Observer
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.Disposable
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Job
import kotlinx.coroutines.delay
@ -80,8 +76,7 @@ import org.json.JSONArray
import org.json.JSONObject
import pub.devrel.easypermissions.EasyPermissions
import java.text.SimpleDateFormat
import java.util.regex.Matcher
import java.util.regex.Pattern
import java.util.concurrent.TimeUnit
import kotlin.math.max
import kotlin.math.min
@ -150,6 +145,8 @@ class DynamicManagementFrag : BaseVmFrag<DynamicManagementVm>() , EasyPermission
"心率", "血氧", "呼吸率", "体温", "步数", "睡眠", "血压", "血糖", "心电", "尿酸", "血脂"
)
private var getHealthInfoJob: Job? = null
@SuppressLint("ResourceType")
override fun initView() {
super.initView()
@ -477,6 +474,8 @@ class DynamicManagementFrag : BaseVmFrag<DynamicManagementVm>() , EasyPermission
// mViewModel.getMySetting()
mViewModel.getTips()
mViewModel.getRank(2)
get24HourReportInfo(showIdInfo)// 这里调用一次接口防止首次进入App不会刷新评估状态
if(MMkvHelper.contains(Const.LATITUDE) && MMkvHelper.contains(Const.LONGITUDE)){
mViewModel.getWeather()
}else{
@ -733,7 +732,7 @@ class DynamicManagementFrag : BaseVmFrag<DynamicManagementVm>() , EasyPermission
Const.functionListDate.value = functionList
}
startUpdateHealthInfoLive()
}
//获取首页所有信息返回
@ -790,7 +789,7 @@ class DynamicManagementFrag : BaseVmFrag<DynamicManagementVm>() , EasyPermission
} else {*/
if (showIdInfo == MMkvHelper.getLong(Const.USER_ID).toString()) { //自己
val localBlueMac = MMkvHelper.getString(Const.Blue_Tooth)
if (YCBBlueConnectHelper.getBleNowStatus() == YCBBlueConnectHelper.BLEConnectState.DisConnect) {//如果本地有蓝牙信息且属于未连接状态,则直接连接
/*if (YCBBlueConnectHelper.getBleNowStatus() == YCBBlueConnectHelper.BLEConnectState.DisConnect) {//如果本地有蓝牙信息且属于未连接状态,则直接连接
LogUtils.d("startConnect::${localBlueMac}")
if (localBlueMac.isNullOrEmpty()) {
mainUIUpdate(YCBBlueConnectHelper.BLEConnectState.DisConnect)//刷新蓝牙连接状态
@ -800,13 +799,14 @@ class DynamicManagementFrag : BaseVmFrag<DynamicManagementVm>() , EasyPermission
}
} else if (YCBBlueConnectHelper.getBleNowStatus() == YCBBlueConnectHelper.BLEConnectState.Connected) {
getConnectStatus()
}
}*/
} else {
}
// }
get24HourReportInfo(showIdInfo)// 这里调用一次接口防止首次进入App不会刷新评估状态
//设置健康监测按钮列表数据
healthMonitoringList.clear()
@ -1209,6 +1209,52 @@ class DynamicManagementFrag : BaseVmFrag<DynamicManagementVm>() , EasyPermission
}
}
private var mDisposable: Disposable? = null
fun startUpdateHealthInfoLive(){
LogUtils.e("DynamicManagementFrag","刷新数据")
getHealthInfoJob = mainScope.launch (Dispatchers.IO){
if(mDisposable == null){
Observable.interval(1000 * 60,60*60*1000,TimeUnit.MILLISECONDS)
.observeOn(AndroidSchedulers.mainThread()).subscribe(object : Observer<Long>{
override fun onSubscribe(d: Disposable) {
mDisposable = d
}
override fun onError(e: Throwable) {
cancelTimer()
}
override fun onComplete() {
cancelTimer()
}
override fun onNext(t: Long) {
LogUtils.e("DynamicManagementFrag","刷新数据${t}s")
mViewModel.getAllInfo(showIdInfo, false,true)
}
})
}
}
}
fun cancelTimer(){
mDisposable?.let {
if(it.isDisposed){
it.dispose()
}
}
}
override fun onDestroyView() {
cancelTimer()
super.onDestroyView()
}
private fun mainUIUpdate(connectState: YCBBlueConnectHelper.BLEConnectState) {
mainScope.launch(Dispatchers.Main) {
when (connectState) {

@ -62,7 +62,7 @@ class ShopFragment: BaseFragList<ShopMallVm>() {
}
override fun refresh() {
mViewModel.getGoodsList(null,0L,1,page)
mViewModel.getGoodsList(null,0L,0,page)
}
override fun initView() {

@ -63,9 +63,15 @@ class DynamicManagementVm : BaseVm() {
/**
* 获取所有信息
*/
fun getAllInfo(id: String, isShowDialog: Boolean) {
fun getAllInfo(id: String, isShowDialog: Boolean,isTimer:Boolean = false) {
startHttp(isShowDialog) {
withContext(Dispatchers.IO){
if(isTimer){
val json = JSONObject()
json.put("id", id)
val body = apiInterface().getMainInfo(retrofits.getRequestBody(json.toString()))
body.getCodeStatus(allData, nowData)
}else{
val list = async { getDeviceFunctionLists(id) }.await()
if (list){
@ -79,6 +85,8 @@ class DynamicManagementVm : BaseVm() {
}
}
}
}
fun uploadAllInfo(array: JSONArray) {

@ -40,6 +40,7 @@ import org.json.JSONObject
val cloudJSBridge by lazy { CloudJSBridge(this@BaseTenCentWebViewActivity,this) }
var isShowTitle= false
var title:String = ""
companion object{
@ -84,10 +85,14 @@ import org.json.JSONObject
isShowTitle = intent.getBooleanExtra("isShowTitle",false)
}
if(intent.hasExtra("title")){
title = intent.getStringExtra("title").toString()
}
if(isShowTitle){
binding.title.root.visibility = View.VISIBLE
statusBar(binding.title.mView)
binding.title.mTvTitle.text = title
binding.title.mIvBack.setOnClickListener {
finish()
}

@ -16,6 +16,7 @@ import com.xty.base.model.ChooseAddressBean
import com.xty.base.model.ChooseCouponBean
import com.xty.base.model.CreateOrderBean
import com.xty.base.model.OpenWXBean
import com.xty.base.model.PsyTestSuccessBean
import com.xty.base.model.ScienceDetailBean
import com.xty.base.model.WatchReChangeBean
import com.xty.base.utils.PayUtils
@ -175,4 +176,16 @@ open class CloudJSBridge(val context: Context, val listener: IJsBridge) {
}
}
@JavascriptInterface
fun questionFunction(str: String?){
LogUtils.e("CloudJSBridge","questionFunction:${str}")
str?.let {
var bean = GsonUtils.fromJson(it, PsyTestSuccessBean::class.java)
baseActivity.bundle.clear()
baseActivity.bundle.putLong("answerId", bean.data)
RouteManager.goAct(ARouterUrl.PSYCHOLOGICAL_RESULT_ACT, baseActivity.bundle)
}
}
}

@ -0,0 +1,5 @@
package com.xty.base.model
data class PsyTestSuccessBean(
var data:Long
)

@ -149,6 +149,7 @@ class ARouterUrl {
//心理测试
const val PSYCHOLOGICAL_TEST_LIST_ACT = "/health/com/zj365/health/act/psychological/PsychologicalTestMainAct"
const val PSYCHOLOGICAL_QUESTION_ACT = "/health/com/zj365/health/act/psychological/PsychologicalQuestionnaireAct"
const val PSYCHOLOGICAL_RESULT_ACT ="/health/com/zj365/health/act/psychological/PsychologicalResultAct"
//设备绑定相关

@ -313,6 +313,10 @@
android:launchMode="singleTop"
android:screenOrientation="portrait" />
<activity android:name=".act.psychological.PsychologicalResultAct"
android:launchMode="singleTop"
android:screenOrientation="portrait" />
<activity android:name=".act.psychological.PsychologicalQuestionnaireAct"
android:launchMode="singleTop"
android:screenOrientation="portrait" />
@ -339,6 +343,7 @@
android:launchMode="singleTop"
android:screenOrientation="portrait" />
</application>
</manifest>

@ -1,6 +1,9 @@
package com.zj365.health.act
import android.Manifest
import android.content.Intent
import android.graphics.Rect
import android.net.Uri
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.alibaba.android.arouter.facade.annotation.Route
@ -18,6 +21,7 @@ import com.zj365.health.vm.ShopOrderVm
import com.zj365.health.weight.DialogTipNew
import org.greenrobot.eventbus.Subscribe
import org.greenrobot.eventbus.ThreadMode
import pub.devrel.easypermissions.EasyPermissions
@Route(path = ARouterUrl.SHOP_ORDER_LIST_ACT)
class ShopOrderListAct : BaseListAct<ShopOrderVm>() {
@ -95,8 +99,17 @@ class ShopOrderListAct : BaseListAct<ShopOrderVm>() {
",请注意查收")
dialogCancel.show()
}else{
}else if(it.status == 3){
}else{
if(EasyPermissions.hasPermissions(this,
Manifest.permission.CALL_PHONE)){
startActivity(Intent(Intent.ACTION_CALL, Uri.parse("tel:4000063365")))
}else{
EasyPermissions.requestPermissions(this,"",
0x00011,
Manifest.permission.CALL_PHONE)
}
}
}
R.id.tv_refund ->{

@ -1,12 +1,16 @@
package com.zj365.health.act.psychological
import android.graphics.Rect
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.alibaba.android.arouter.facade.annotation.Route
import com.xty.base.act.BaseVmAct
import com.xty.base.vm.BaseVm
import com.xty.common.arouter.ARouterUrl
import com.zj365.health.adapter.psychological.PsychologicalRecommendAdapter
import com.zj365.health.databinding.ActPsychologicalResultBinding
import com.zj365.health.vm.PsychologicalResultVm
@Route(path = ARouterUrl.PSYCHOLOGICAL_RESULT_ACT)
class PsychologicalResultAct: BaseVmAct<PsychologicalResultVm>() {
val binding by lazy { ActPsychologicalResultBinding.inflate(layoutInflater) }
@ -17,6 +21,7 @@ class PsychologicalResultAct: BaseVmAct<PsychologicalResultVm>() {
override fun initView() {
super.initView()
statusBar(binding.title.mView)
binding.title.mTvTitle.text ="性格测试总结"
binding.title.mIvBack.setOnClickListener {
finish()
}
@ -26,14 +31,22 @@ class PsychologicalResultAct: BaseVmAct<PsychologicalResultVm>() {
binding.recycler.layoutManager = LinearLayoutManager(this)
binding.recycler.adapter = mAdapter
binding.recycler.addItemDecoration(object : RecyclerView.ItemDecoration() {
override fun getItemOffsets(outRect: Rect, itemPosition: Int, parent: RecyclerView) {
super.getItemOffsets(outRect, itemPosition, parent)
outRect.bottom = 12
}
})
}
override fun liveObserver() {
mViewModel.psychologicalResultData.observe(this){
binding.title.mTvTitle.text = "${it.data.surveyName}"
binding.tvSummaryContent.text = "${it.data.conclusionText}"
mAdapter.setNewInstance(it.data.recList)
}
}

@ -41,6 +41,7 @@ class PsychologicalTestMainAct : BaseListAct<PsychologicalTestMainVm>() {
bundle.clear()
bundle.putString("web_site_url","${BuildConfig.url}shareApi/H5_question/${CommonUtils.getMyUserId()}/${bean.id}/android")
bundle.putBoolean("isShowTitle",true)
bundle.putString("title",bean.surveyName)
RouteManager.goAct(ARouterUrl.H5_ACT,bundle)

@ -48,6 +48,15 @@ class GoodsOrderAdapter : BaseAdapter<ShopOrderListBean.ShopOrderBean>(R.layout.
holder.setGone(R.id.tv_refund,false)
}
2 ->{
holder.setGone(R.id.tv_confirm_receive_goods,true)
holder.setText(R.id.tv_logistics,"联系客服")
holder.setText(R.id.tv_refund,"申请退款")
holder.setGone(R.id.tv_logistics,false)
holder.setGone(R.id.tv_refund,false)
}
3->{
status.setTextColor(context.getColor(R.color.col_9BD))
holder.setGone(R.id.tv_confirm_receive_goods,false)
@ -58,10 +67,11 @@ class GoodsOrderAdapter : BaseAdapter<ShopOrderListBean.ShopOrderBean>(R.layout.
holder.setGone(R.id.tv_refund,false)
}
4->{
4 ,8->{
status.setTextColor(context.getColor(R.color.col_02c))
holder.setText(R.id.tv_logistics,"联系客服")
holder.setGone(R.id.tv_confirm_receive_goods,true)
holder.setGone(R.id.tv_logistics,true)
holder.setGone(R.id.tv_logistics,false)
holder.setGone(R.id.tv_refund,true)
holder.setGone(R.id.line,true)

@ -1,11 +1,16 @@
package com.zj365.health.adapter.psychological
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.ruffian.library.widget.RImageView
import com.xty.base.adapter.BaseAdapter
import com.xty.common.setImage
import com.xty.network.model.PsychologicalResultBean
import com.zj365.health.R
class PsychologicalRecommendAdapter : BaseAdapter<Any>(R.layout.item_psychological_recommend) {
override fun convert(holder: BaseViewHolder, item: Any) {
class PsychologicalRecommendAdapter : BaseAdapter<PsychologicalResultBean.RecommendPsychologicalBean>(R.layout.item_psychological_recommend) {
override fun convert(holder: BaseViewHolder, item: PsychologicalResultBean.RecommendPsychologicalBean) {
holder.setText(R.id.tv_title,item.surveyName)
holder.setText(R.id.tv_person_num,"${item.totalNum}")
holder.getView<RImageView>(R.id.img_recommend).setImage(context,item.imageUrl)
}
}

@ -8,7 +8,7 @@
<com.ruffian.library.widget.RImageView
android:layout_width="@dimen/dp_100"
android:layout_height="@dimen/dp_77"
app:is_circle="true"
app:is_circle="false"
app:corner_radius="@dimen/dp_8"
android:id="@+id/img_recommend"/>

@ -151,7 +151,7 @@
android:layout_width="@dimen/dp_68"
android:layout_height="@dimen/dp_24"
android:background="@drawable/shape_r25_02c"
android:text="确认收货"
android:text="完成订单"
android:gravity="center"
android:textSize="@dimen/sp_12"
android:layout_marginLeft="@dimen/dp_8"

@ -42,6 +42,39 @@
android:progressDrawable="@drawable/seek_bar"
android:thumb="@mipmap/icon_seekbar_drawer"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="@dimen/dp_11">
<TextView
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:textSize="@dimen/sp_12"
android:textColor="#80333333"
android:text="10米"/>
<TextView
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:textSize="@dimen/sp_12"
android:textColor="#333333"
android:gravity="center"
android:text="500米"/>
<TextView
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:textSize="@dimen/sp_12"
android:textColor="#80333333"
android:gravity="right"
android:text="1000米"/>
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"

@ -801,9 +801,9 @@ interface ApiInterface {
suspend fun getPsychologicalList(@Body rb: RequestBody):RespBody<PsychologicalListBean>
/**
* 答题详情
* 问卷结论
*/
@GET("customer/surveys/answerDetail")
@GET("customer/surveys/answerSummarize")
suspend fun getPsychologicalResult(@Query("answerId") answerId:String):RespBody<PsychologicalResultBean>
/**
* 设备解绑

@ -1,10 +1,18 @@
package com.xty.network.model
data class PsychologicalResultBean(
var surveyName:String,
var surveyDesc:String,
var conclusionText:String,
var answerId:Long,
var score:String
var recList:ArrayList<RecommendPsychologicalBean>
) {
data class RecommendPsychologicalBean(
var id:Long,
var surveyName:String,
var surveyDesc:String,
var totalNum:Int,
var imageUrl:String,
var createTime:String,
var answerNum:Int
)
}
Loading…
Cancel
Save