diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 1c66bc5..76a612d 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -100,6 +100,16 @@ android:usesCleartextTraffic="true" tools:replace="android:allowBackup"> + + + + () { val dialogBind by lazy { DialogTipNew(this,"温馨提示", "恭喜您成为中健三六五大家庭的一员,为了提供更好的信息服务,请完善您的基本信息。", "前往","取消",false,{ - RouteManager.goAct(ARouterUrl.BASE_INFO_CHANGE) - EventBus.getDefault().post(LoginOrRegisterEvent()) + RouteManager.goAct(ARouterUrl.FAMILY_RECORD_ACT) + finish() }){ - EventBus.getDefault().post(LoginOrRegisterEvent()) + finish() } } @@ -283,48 +283,16 @@ class LoginAct : BaseVmAct() { override fun liveObserver() { mViewModel.mLogin.observe(this) { loadingView.dismiss() + EventBus.getDefault().post(LoginOrRegisterEvent()) if (it.data.isPerfect == 0){ dialogBind.setContentNew("恭喜您成为中健三六五大家庭的医院,为了提供更好的信息服务,请完善您的基本信息。") dialogBind.show() }else{ - EventBus.getDefault().post(LoginOrRegisterEvent()) + // EventBus.getDefault().post(LoginOrRegisterEvent()) finish() } - // initTab() -// mViewModel.getImUserSig("user_${it.data.id}") - // RouteManager.goAct(ARouterUrl.MAIN_ACT) } -// mViewModel.loginWx.observe(this) { -// loadingView.dismiss() -// initTab() -// mViewModel.getImUserSig("user_${it.data}") -// } - /* mViewModel.setLoginWxId.observe(this) { - loadingView.dismiss() - initTab() - mViewModel.getImUserSig("user_${it}") - }*/ - /* mViewModel.getImUserSig.observe(this) { - Log.e("simon", "login"+it.data) - TUILogin.login( - applicationContext, - 1400807230, - it.paramsData, - it.data, - object : TUICallback() { - override fun onSuccess() { - Log.e("simon","onSuccess") - RouteManager.goAct(ARouterUrl.MAIN_ACT) - finish() - } - - override fun onError(errorCode: Int, errorMessage: String?) { - Log.e("simon","onError") - } - - }) - }*/ mViewModel.codeLive.observe(this) { timeStart() diff --git a/app/src/main/java/com/zj365/dc/activity/RegisterAct.kt b/app/src/main/java/com/zj365/dc/activity/RegisterAct.kt index db90f83..2f269b6 100644 --- a/app/src/main/java/com/zj365/dc/activity/RegisterAct.kt +++ b/app/src/main/java/com/zj365/dc/activity/RegisterAct.kt @@ -129,13 +129,8 @@ class RegisterAct : BaseVmAct() { override fun onClick(widget: View) { bundle.clear() bundle.putString("title", "用户协议") - bundle.putInt("type", Const.AGREEMENT_1) - RouteManager.goActRequest( - ARouterUrl.RICH_TEXT, - this@RegisterAct, - USER_AGREEMENT, - bundle - ) + bundle.putString("url", "https://dc.zhongjian365.com/agreement.html") + RouteManager.goAct(ARouterUrl.AGREEMNT_READ_WEB_ACT, bundle) } override fun updateDrawState(ds: TextPaint) { @@ -149,13 +144,8 @@ class RegisterAct : BaseVmAct() { override fun onClick(widget: View) { bundle.clear() bundle.putString("title", "隐私政策") - bundle.putString("url", "https://auprty.com/app/static/app/privacy.html") - RouteManager.goActRequest( - ARouterUrl.AGREEMNT_READ_WEB_ACT, - this@RegisterAct, - PRIVACY, - bundle - ) + bundle.putString("url", "https://dc.zhongjian365.com/privacy.html") + RouteManager.goAct(ARouterUrl.AGREEMNT_READ_WEB_ACT, bundle) } override fun updateDrawState(ds: TextPaint) { @@ -202,7 +192,7 @@ class RegisterAct : BaseVmAct() { mViewModel.mLogin.observe(this){ 4 - RouteManager.goAct(ARouterUrl.BASE_INFO_CHANGE) + RouteManager.goAct(ARouterUrl.FAMILY_RECORD_ACT) EventBus.getDefault().post(LoginOrRegisterEvent()) this@RegisterAct.finish() diff --git a/app/src/main/java/com/zj365/dc/activity/WelcomeAct.kt b/app/src/main/java/com/zj365/dc/activity/WelcomeAct.kt index 6a00ebd..d18efe4 100644 --- a/app/src/main/java/com/zj365/dc/activity/WelcomeAct.kt +++ b/app/src/main/java/com/zj365/dc/activity/WelcomeAct.kt @@ -28,6 +28,7 @@ import com.xty.common.bracelet.YCBBlueConnectHelper import com.xty.common.bracelet.checkBlueConnectPermission import com.xty.common.getImageUrl import com.xty.common.util.CommonUtils +import com.xty.network.utils.AppUtils import com.zj365.dc.BuildConfig import com.zj365.dc.databinding.ActWelcomeBinding @@ -83,6 +84,7 @@ class WelcomeAct : BaseVmAct() { .keyboardEnable(true) .fullScreen(true) .init() + getTaskAct() binding.mCard.setOnClickListener { job?.let { diff --git a/app/src/main/java/com/zj365/dc/activity/shop/CreateGoodsOrderAct.kt b/app/src/main/java/com/zj365/dc/activity/shop/CreateGoodsOrderAct.kt index 8be3e30..890f21a 100644 --- a/app/src/main/java/com/zj365/dc/activity/shop/CreateGoodsOrderAct.kt +++ b/app/src/main/java/com/zj365/dc/activity/shop/CreateGoodsOrderAct.kt @@ -2,9 +2,11 @@ package com.zj365.dc.activity.shop import android.content.Intent import android.view.View +import android.widget.Toast import com.alibaba.android.arouter.facade.annotation.Route import com.google.android.material.bottomsheet.BottomSheetDialog import com.tamsiree.rxkit.RxActivityTool +import com.tencent.mm.opensdk.modelbase.BaseResp import com.xty.base.act.BaseTenCentWebViewActivity import com.xty.base.act.BaseVmAct import com.xty.network.model.ChooseAddressBean @@ -14,10 +16,12 @@ import com.xty.base.utils.PayUtils import com.xty.common.arouter.ARouterUrl import com.xty.common.arouter.RouteManager import com.xty.common.event.ReChangeEvent +import com.xty.common.event.WxPayEvent import com.xty.common.setImage import com.zj365.dc.BuildConfig import com.zj365.dc.databinding.ActCreateGoodsOrderBinding import com.zj365.dc.vm.ShopMallVm +import org.greenrobot.eventbus.EventBus import org.greenrobot.eventbus.Subscribe import org.greenrobot.eventbus.ThreadMode @@ -34,6 +38,8 @@ class CreateGoodsOrderAct : BaseVmAct() { var hasCoup: Int = 2 + var couponBean:ChooseCouponBean? = null + companion object{ const val REQUEST_ADDRESS = 0x000011 const val REQUEST_COUP = 0x000012 @@ -59,6 +65,17 @@ class CreateGoodsOrderAct : BaseVmAct() { binding.tvChooseAddress.text = "${it.data.province}${it.data.city}${it.data.district}${it.data.address}" } + mViewModel.computeAmountLiveData.observe(this){ + binding.tvTotalPrice.text ="¥ ${it.data}" + + couponBean?.let { + binding.tvDiscounts.text = "可优惠¥ ${it.as_amount}" + // binding.tvPlatformDiscounts.text = "${(bean!!.ori_price * bean!!.skuNum) - (it.skuPrice * it.skuNum) - couponBean.as_amount}" + + } + + } + } override fun initView() { @@ -73,7 +90,10 @@ class CreateGoodsOrderAct : BaseVmAct() { onClickedListener() bean?.let { refreshUI(it) + mViewModel.computeAmount(it.skuId,it.skuNum,couponsId) } + + mViewModel.hasCoupon() } fun refreshUI(bean: CreateOrderBean){ @@ -82,8 +102,7 @@ class CreateGoodsOrderAct : BaseVmAct() { binding.tvSpec.text = bean.skuName binding.tvNum.text = "数量:${bean.skuNum}" binding.tvPrice.text = "商品原价:¥ ${bean.ori_price}" - binding.tvTotalPrice.text ="¥ ${bean.skuPrice * bean.skuNum}" - binding.tvPlatformDiscounts.text = "${(bean.ori_price * bean.skuNum) - (bean.skuPrice * bean.skuNum)}" + binding.tvPlatformDiscounts.text = "¥ ${(bean.ori_price * bean.skuNum) - (bean.skuPrice * bean.skuNum)}" if (bean.delivery_mode == 0){ //0,无需发货,1,需要发货 binding.rxAddress.visibility = View.GONE @@ -92,7 +111,7 @@ class CreateGoodsOrderAct : BaseVmAct() { mViewModel.getDefaultAddress() } - mViewModel.hasCoupon() + } @@ -132,8 +151,7 @@ class CreateGoodsOrderAct : BaseVmAct() { @Subscribe(threadMode = ThreadMode.MAIN) fun paySuccess(event: ReChangeEvent){ - RouteManager.goAct(ARouterUrl.SHOP_ORDER_LIST_ACT) - RxActivityTool.finishActivity(BaseTenCentWebViewActivity::class.java) + finish() } @@ -151,12 +169,13 @@ class CreateGoodsOrderAct : BaseVmAct() { } REQUEST_COUP ->{ - var couponBean = data?.extras!!.getParcelable("coupon") + couponBean = data?.extras!!.getParcelable("coupon") if (couponBean != null) { - couponsId = couponBean.id - binding.tvDiscounts.text = "可优惠${couponBean.as_amount}" + couponsId = couponBean!!.id + bean?.let { - binding.tvPlatformDiscounts.text = "${(it.ori_price * bean!!.skuNum) - (it.skuPrice * it.skuNum) - couponBean.as_amount}" + // binding.tvTotalPrice.text ="¥ ${it.skuPrice * it.skuNum - couponBean.as_amount}" + mViewModel.computeAmount(it.skuId,it.skuNum,couponsId) } } @@ -165,4 +184,36 @@ class CreateGoodsOrderAct : BaseVmAct() { } } + + @Subscribe(threadMode = ThreadMode.MAIN) + fun getWxPayResult(event: WxPayEvent) { + when (event.code) { + BaseResp.ErrCode.ERR_OK -> { + + RouteManager.goAct(ARouterUrl.SHOP_ORDER_LIST_ACT) + Toast.makeText( + this@CreateGoodsOrderAct, + "支付成功", + Toast.LENGTH_SHORT + ) + .show() + + finish() + + } + + BaseResp.ErrCode.ERR_USER_CANCEL -> { + } + + else -> { + + Toast.makeText( + this@CreateGoodsOrderAct, + "支付失败,请联系客服", + Toast.LENGTH_SHORT + ).show() + } + } + } + } \ No newline at end of file diff --git a/app/src/main/java/com/zj365/dc/activity/shop/ShopCategoryActivity.kt b/app/src/main/java/com/zj365/dc/activity/shop/ShopCategoryActivity.kt index 22a20f7..ac28c2f 100644 --- a/app/src/main/java/com/zj365/dc/activity/shop/ShopCategoryActivity.kt +++ b/app/src/main/java/com/zj365/dc/activity/shop/ShopCategoryActivity.kt @@ -146,10 +146,10 @@ class ShopCategoryActivity : BaseVmAct() { override fun onEditorAction(p0: TextView?, p1: Int, p2: KeyEvent?): Boolean { if(p1 == EditorInfo.IME_ACTION_SEARCH){ goodsName = binding.etSearch.text.toString().trim() - if(TextUtils.isEmpty(goodsName)){ + /* if(TextUtils.isEmpty(goodsName)){ CommonToastUtils.showToast("请输入搜索内容") return true - } + }*/ page = 1 mViewModel.getGoodsList(goodsName,categoryId,0,page) //mViewModel.getGoodsList(goodsName,0L,0,page) diff --git a/app/src/main/java/com/zj365/dc/fragment/DynamicManagementFrag.kt b/app/src/main/java/com/zj365/dc/fragment/DynamicManagementFrag.kt index ea19055..81b9fc8 100644 --- a/app/src/main/java/com/zj365/dc/fragment/DynamicManagementFrag.kt +++ b/app/src/main/java/com/zj365/dc/fragment/DynamicManagementFrag.kt @@ -831,7 +831,7 @@ class DynamicManagementFrag : BaseVmFrag() , EasyPermission MMkvHelper.put(Const.DEVICE_TYPE, deviceType) } - requestByDeviceModel() + // requestByDeviceModel() if (healthMonitoringListData.size > 9) { for ((index, healthMonitoringListBean) in healthMonitoringListData.withIndex()) { if (index < 9) { @@ -924,7 +924,7 @@ class DynamicManagementFrag : BaseVmFrag() , EasyPermission // mViewModel.getWelcomeInfo(settingBean.user.id) // mViewModel.getWarningMsg()//获取预警消息 - requestByDeviceModel() + // requestByDeviceModel() // 激活过才能开启定是我任务 //Log.e("worker", "定时任务开启") @@ -1217,45 +1217,54 @@ class DynamicManagementFrag : BaseVmFrag() , EasyPermission private var mDisposable: Disposable? = null fun startUpdateHealthInfoLive(){ - LogUtils.e("DynamicManagementFrag","刷新数据") - getHealthInfoJob = mainScope.launch (Dispatchers.IO){ - if(mDisposable == null){ - Observable.interval(1000 * 60,60*1000,TimeUnit.MILLISECONDS) - .observeOn(AndroidSchedulers.mainThread()).subscribe(object : Observer{ - override fun onSubscribe(d: Disposable) { - mDisposable = d - } + LogUtils.e("DynamicManagementFrag","刷新数据 ${getHealthInfoJob} disposable:${mDisposable}") - override fun onError(e: Throwable) { - cancelTimer() - } + if(mDisposable == null){ + Observable.interval(1000 * 60,60*1000,TimeUnit.MILLISECONDS) + .observeOn(AndroidSchedulers.mainThread()).subscribe(object : Observer{ + override fun onSubscribe(d: Disposable) { + mDisposable = d + } - override fun onComplete() { - cancelTimer() - } + override fun onError(e: Throwable) { + cancelTimer() + } - override fun onNext(t: Long) { - LogUtils.e("DynamicManagementFrag","刷新数据${t}s") - isJob = true - mViewModel.getAllInfo(showIdInfo, false,true) - } + override fun onComplete() { + cancelTimer() + } - }) - } + override fun onNext(t: Long) { + LogUtils.e("DynamicManagementFrag","刷新数据${t}s") + isJob = true + mViewModel.getAllInfo(showIdInfo, false,true) + } + }) } + /* if (getHealthInfoJob == null){ + getHealthInfoJob = mainScope.launch (Dispatchers.IO){ + + + } + }*/ + } fun cancelTimer(){ - getHealthInfoJob?.cancel() + LogUtils.e("DynamicManagementFrag","取消定时cancelTimer") + // getHealthInfoJob?.cancel() mDisposable?.let { - if(it.isDisposed){ + if(!it.isDisposed){ LogUtils.e("DynamicManagementFrag","取消定时") it.dispose() } } + + mDisposable = null + // getHealthInfoJob = null } override fun onDestroyView() { diff --git a/app/src/main/java/com/zj365/dc/fragment/MineFrag.kt b/app/src/main/java/com/zj365/dc/fragment/MineFrag.kt index d09896b..1a1ec37 100644 --- a/app/src/main/java/com/zj365/dc/fragment/MineFrag.kt +++ b/app/src/main/java/com/zj365/dc/fragment/MineFrag.kt @@ -470,10 +470,12 @@ class MineFrag : BaseVmFrag() , EasyPermissions.PermissionCallbacks{ private fun refresh() { refresh.setRefresh(binding.mRefresh) { - mViewModel.getMySetting() - mViewModel.getUserOtherInfo() - mViewModel.getAllInfo(showIdInfo,false) - mViewModel.searchInviteInfo() + if (!TextUtils.isEmpty(showIdInfo)) { + mViewModel.getMySetting() + mViewModel.getUserOtherInfo() + mViewModel.getAllInfo(showIdInfo, false) + mViewModel.searchInviteInfo() + } } } @@ -483,7 +485,6 @@ class MineFrag : BaseVmFrag() , EasyPermissions.PermissionCallbacks{ mViewModel.getMySetting() mViewModel.getAllInfo(showIdInfo,false) mViewModel.searchInviteInfo() - mViewModel.getUserOtherInfo() } @@ -594,9 +595,10 @@ class MineFrag : BaseVmFrag() , EasyPermissions.PermissionCallbacks{ } else { MMkvHelper.getLong(Const.USER_ID).toString() } - // mViewModel.getMySetting() -// mViewModel.getScore(1) + mViewModel.getMySetting() + mViewModel.getAllInfo(showIdInfo,false) mViewModel.searchInviteInfo() + mViewModel.getUserOtherInfo() } @Subscribe(threadMode = ThreadMode.MAIN) @@ -620,10 +622,10 @@ class MineFrag : BaseVmFrag() , EasyPermissions.PermissionCallbacks{ } @Subscribe(threadMode = ThreadMode.MAIN) fun refreshUI(event: MyInfoEvent){ - // mViewModel.getMySetting() + mViewModel.getMySetting() mViewModel.getAllInfo(showIdInfo,false) -// mViewModel.getScore(1) mViewModel.searchInviteInfo() + mViewModel.getUserOtherInfo() } diff --git a/app/src/main/java/com/zj365/dc/fragment/ShopFragment.kt b/app/src/main/java/com/zj365/dc/fragment/ShopFragment.kt index ce59b02..3245c0c 100644 --- a/app/src/main/java/com/zj365/dc/fragment/ShopFragment.kt +++ b/app/src/main/java/com/zj365/dc/fragment/ShopFragment.kt @@ -76,10 +76,10 @@ class ShopFragment: BaseFragList() { override fun onEditorAction(p0: TextView?, p1: Int, p2: KeyEvent?): Boolean { if(p1 == EditorInfo.IME_ACTION_SEARCH){ goodsName = binding.etSearch.text.toString().trim() - if(TextUtils.isEmpty(goodsName)){ + /*if(TextUtils.isEmpty(goodsName)){ CommonToastUtils.showToast("请输入搜索内容") return true - } + }*/ page = 1 mViewModel.getGoodsList(goodsName,0L,0,page) diff --git a/app/src/main/java/com/zj365/dc/vm/ShopMallVm.kt b/app/src/main/java/com/zj365/dc/vm/ShopMallVm.kt index f84019d..7f7c671 100644 --- a/app/src/main/java/com/zj365/dc/vm/ShopMallVm.kt +++ b/app/src/main/java/com/zj365/dc/vm/ShopMallVm.kt @@ -21,6 +21,8 @@ class ShopMallVm : BaseVm() { val hasCouponLiveData by lazy { MutableLiveData> ()} + val computeAmountLiveData by lazy { MutableLiveData>() } + fun getGoodsCategory(parentId:Long){ startHttp { var code = apiInterface().getGoodsCategory(parentId) @@ -75,4 +77,15 @@ class ShopMallVm : BaseVm() { } } + fun computeAmount(skuId:Long,num:Int,couponsId:Long?){ + startHttp { + var json = JSONObject() + json.put("skuId",skuId) + json.put("num",num) + json.put("couponsId",couponsId) + var code = apiInterface().computeAmount(retrofits.getRequestBody(json.toString())) + code.getCodeStatus(computeAmountLiveData,nowData) + } + } + } \ No newline at end of file diff --git a/app/src/main/res/xml/file_paths.xml b/app/src/main/res/xml/file_paths.xml new file mode 100644 index 0000000..c1cd9b7 --- /dev/null +++ b/app/src/main/res/xml/file_paths.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/base/src/main/java/com/xty/base/h5/CloudJSBridge.kt b/base/src/main/java/com/xty/base/h5/CloudJSBridge.kt index 85d368b..a97cb3f 100644 --- a/base/src/main/java/com/xty/base/h5/CloudJSBridge.kt +++ b/base/src/main/java/com/xty/base/h5/CloudJSBridge.kt @@ -179,10 +179,16 @@ open class CloudJSBridge(val context: Context, val listener: IJsBridge) { LogUtils.e("CloudJSBridge","questionFunction:${str}") str?.let { + listener.switchView("questionFunction",it) 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) + if (bean.type == 0){ + baseActivity.finish() + }else{ + baseActivity.bundle.clear() + baseActivity.bundle.putLong("answerId", bean.id) + RouteManager.goAct(ARouterUrl.PSYCHOLOGICAL_RESULT_ACT, baseActivity.bundle) + } + } } diff --git a/base/src/main/java/com/xty/base/model/PsyTestSuccessBean.kt b/base/src/main/java/com/xty/base/model/PsyTestSuccessBean.kt index e005dd5..c2ac359 100644 --- a/base/src/main/java/com/xty/base/model/PsyTestSuccessBean.kt +++ b/base/src/main/java/com/xty/base/model/PsyTestSuccessBean.kt @@ -1,5 +1,6 @@ package com.xty.base.model data class PsyTestSuccessBean( - var data:Long + var id:Long, + var type:Int //0:提交后关闭当前页 1:到下一页 ) diff --git a/base/src/main/java/com/xty/base/utils/PayUtils.kt b/base/src/main/java/com/xty/base/utils/PayUtils.kt index 68f8cf1..03093d2 100644 --- a/base/src/main/java/com/xty/base/utils/PayUtils.kt +++ b/base/src/main/java/com/xty/base/utils/PayUtils.kt @@ -250,32 +250,21 @@ open class PayUtils(var context: Context) { bundle.putString("orderType", "1") RouteManager.goAct(ARouterUrl.PAY_SUCCESS, bundle)*/ - if(isPayGoods){ - - }else{ - Toast.makeText( - context, - "支付成功", - Toast.LENGTH_SHORT - ) - .show() - - EventBus.getDefault().post(ReChangeEvent()) - } - - + Toast.makeText( + context, + "支付成功", + Toast.LENGTH_SHORT + ) + .show() + + EventBus.getDefault().post(ReChangeEvent()) } else { - if(isPayGoods){ - - }else{ - Toast.makeText( - context, - "支付失败,请联系客服", - Toast.LENGTH_SHORT - ) - .show() - } - + Toast.makeText( + context, + "支付失败,请联系客服", + Toast.LENGTH_SHORT + ) + .show() // 该笔订单真实的支付结果,需要依赖服务端的异步通知。 // com.alipay.sdk.pay.demo.PayDemoActivity.showAlert( @@ -293,18 +282,13 @@ open class PayUtils(var context: Context) { bundle.putString("orderNo", orderNo) bundle.putString("orderType", "1") RouteManager.goAct(ARouterUrl.PAY_SUCCESS, bundle)*/ - if(isPayGoods){ - - }else{ - EventBus.getDefault().post(ReChangeEvent()) - Toast.makeText( - context, - "支付成功", - Toast.LENGTH_SHORT - ) - .show() - } - + EventBus.getDefault().post(ReChangeEvent()) + Toast.makeText( + context, + "支付成功", + Toast.LENGTH_SHORT + ) + .show() } BaseResp.ErrCode.ERR_USER_CANCEL -> { @@ -312,16 +296,11 @@ open class PayUtils(var context: Context) { } else -> { - if(isPayGoods){ - - }else{ - Toast.makeText( - context, - "支付失败,请联系客服", - Toast.LENGTH_SHORT - ).show() - } - + Toast.makeText( + context, + "支付失败,请联系客服", + Toast.LENGTH_SHORT + ).show() } } } diff --git a/common/src/main/java/com/xty/common/Const.kt b/common/src/main/java/com/xty/common/Const.kt index 8c4f9c6..7bc3eaf 100644 --- a/common/src/main/java/com/xty/common/Const.kt +++ b/common/src/main/java/com/xty/common/Const.kt @@ -142,6 +142,9 @@ class Const { const val CONVERSATION_UNREAD_COUNT_ACTION = "conversation_unread_count_action" const val UNREAD_COUNT_EXTRA = "unread_count_extra" + + const val VERSION_NAME= "appVersion" + const val VERSION_CODES = "version_code" // const val userName = "User_Name" // const val userBean = "UserUser" } diff --git a/common/src/main/java/com/xty/common/Dateutils.java b/common/src/main/java/com/xty/common/Dateutils.java index dadfd9d..ab4b0e4 100644 --- a/common/src/main/java/com/xty/common/Dateutils.java +++ b/common/src/main/java/com/xty/common/Dateutils.java @@ -1,8 +1,10 @@ package com.xty.common; + import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; +import java.util.Calendar; import java.util.Date; public class Dateutils { @@ -25,7 +27,7 @@ public class Dateutils { return dateString; } -// 格式化日期对象为新的字符串 + // 格式化日期对象为新的字符串 DateFormat newFormatter = new SimpleDateFormat("MM-dd"); String newDateString = newFormatter.format(date); return newDateString; @@ -43,7 +45,7 @@ public class Dateutils { return dateString; } -// 格式化日期对象为新的字符串 + // 格式化日期对象为新的字符串 DateFormat newFormatter = new SimpleDateFormat("MM"); String newDateString = newFormatter.format(date); return newDateString+"月"; @@ -67,9 +69,92 @@ public class Dateutils { return dateString; } -// 格式化日期对象为新的字符串 + // 格式化日期对象为新的字符串 DateFormat newFormatter = new SimpleDateFormat(format); String newDateString = newFormatter.format(date); return newDateString; } + /** + * 将2013:10:08 11:48:07如此格式的时间 + * 转化为毫秒数 + * + * @param datetime 字符串时间 + * @return 毫秒数 + */ + public static long dateTimeToMSs(String datetime ,String format) { + if (android.text.TextUtils.isEmpty(datetime)) return 0; + SimpleDateFormat sdf = new SimpleDateFormat(format); + final Date parse; + try { + parse = sdf.parse(datetime); + } catch (ParseException e) { + e.printStackTrace(); + return 0; + } + return parse.getTime(); + } + + /** + * 方法名:getDateToString(long milSecond) + * 功 能:时间戳转成提示性日期格式(昨天、今天……) + * 参 数:long milSecond + * 返回值:String + */ + public static String getDateToString(String datetime) { + long milSecond = dateTimeToMSs(datetime,YYYY_MM_DD_HH_MM_SS); + //现在时间 + String now = new SimpleDateFormat("yyyy-MM-dd ").format(milSecond); + //昨天 + Calendar cal = Calendar.getInstance(); + cal.add(Calendar.DATE, -1); + String yday = new SimpleDateFormat("yyyy-MM-dd ").format(cal.getTime()); + + //今天 + Calendar c = Calendar.getInstance(); + c.add(Calendar.DATE, 0); + String today = new SimpleDateFormat("yyyy-MM-dd ").format(c.getTime()); + //其他时间段 + Date date = new Date(milSecond); + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm"); + + + if (now.equals(today)) { + return "今天 "+ formatTime(milSecond,HH_MM_Format); + } else if (now.equals(yday)) { + return "昨天 " + formatTime(milSecond,HH_MM_Format); + } else { + return format.format(date); + } + } + + /** + * 方法名:getDateToString(long milSecond) + * 功 能:时间戳转成提示性日期格式(昨天、今天……) + * 参 数:long milSecond + * 返回值:String + */ + public static String getDateToString(long milSecond) { + //现在时间 + String now = new SimpleDateFormat("yyyy-MM-dd ").format(milSecond); + //昨天 + Calendar cal = Calendar.getInstance(); + cal.add(Calendar.DATE, -1); + String yday = new SimpleDateFormat("yyyy-MM-dd ").format(cal.getTime()); + //今天 + Calendar c = Calendar.getInstance(); + c.add(Calendar.DATE, 0); + String today = new SimpleDateFormat("yyyy-MM-dd ").format(c.getTime()); + //其他时间段 + Date date = new Date(milSecond); + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm"); + + if (now.equals(today)) { + return "今天"; + } else if (now.equals(yday)) { + return "昨天"; + } else { + return format.format(date); + } + } + } diff --git a/common/src/main/java/com/xty/common/app/MyApp.kt b/common/src/main/java/com/xty/common/app/MyApp.kt index a97c0b4..56dd3c1 100644 --- a/common/src/main/java/com/xty/common/app/MyApp.kt +++ b/common/src/main/java/com/xty/common/app/MyApp.kt @@ -34,6 +34,7 @@ import com.xty.common.bracelet.checkBlueConnectPermission import com.xty.common.bracelet.getBluePermission import com.xty.common.event.BlueToothConnectEvent import com.xty.common.receiver.BluetoothMonitorReceiver +import com.xty.network.utils.AppUtils import com.yucheng.ycbtsdk.Constants import com.yucheng.ycbtsdk.YCBTClient import com.yucheng.ycbtsdk.response.BleConnectResponse @@ -103,6 +104,9 @@ class MyApp : Application() { ) ) .commit() + + MMkvHelper.put(Const.VERSION_NAME, AppUtils.getPackageVersionName(this)) + MMkvHelper.put(Const.VERSION_CODES, AppUtils.getVersionCode(this)) } // private fun forceStopApp(){ diff --git a/common/src/main/java/com/xty/common/arouter/ARouterUrl.kt b/common/src/main/java/com/xty/common/arouter/ARouterUrl.kt index 3d16b84..90960fc 100644 --- a/common/src/main/java/com/xty/common/arouter/ARouterUrl.kt +++ b/common/src/main/java/com/xty/common/arouter/ARouterUrl.kt @@ -27,6 +27,7 @@ class ARouterUrl { const val SHOP_ORDER_LIST_ACT = "/health/com/zj365/health/act/ShopOrderListAct" const val SHOP_ORDER_DETAIL_ACT = "/health/com/zj365/health/act/ShopOrderDetailAct" const val CREATE_SHOP_ORDER_ACT = "/com/zj365/dc/activity/shop/CreateGoodsOrderAct" + const val LOGISTICS_ACT = "/health/com/zj365/health/act/GoodsLogisticsAct" // const val FAMILY_INFO="/com/zj365/dc/act/FamilyMainAct" diff --git a/common/src/main/java/com/xty/common/util/OpenFilesUtils.java b/common/src/main/java/com/xty/common/util/OpenFilesUtils.java new file mode 100644 index 0000000..cf08dad --- /dev/null +++ b/common/src/main/java/com/xty/common/util/OpenFilesUtils.java @@ -0,0 +1,669 @@ +package com.xty.common.util; + +import android.content.Context; +import android.content.Intent; +import android.net.Uri; +import android.os.Build; + +import androidx.core.content.FileProvider; + +import com.xty.common.BuildConfig; +import com.xuexiang.xutil.app.AppUtils; + +import java.io.File; +import java.util.HashMap; + +public class OpenFilesUtils { + + //android获取一个用于打开HTML文件的intent + public static Intent getHtmlFileIntent(File file) + { + Uri uri = Uri.parse(file.toString()).buildUpon().encodedAuthority("com.android.htmlfileprovider").scheme("content").encodedPath(file.toString()).build(); + Intent intent = new Intent("android.intent.action.VIEW"); + intent.setDataAndType(uri, "text/html"); + return intent; + } + //android获取一个用于打开图片文件的intent + public static Intent getImageFileIntent(File file) + { + Intent intent = new Intent("android.intent.action.VIEW"); + intent.addCategory("android.intent.category.DEFAULT"); + intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + Uri uri = Uri.fromFile(file); + intent.setDataAndType(uri, "image/*"); + return intent; + } + //android获取一个用于打开PDF文件的intent + public static Intent getPdfFileIntent(File file) + { + Intent intent = new Intent("android.intent.action.VIEW"); + intent.addCategory("android.intent.category.DEFAULT"); + intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); + Uri uri = Uri.fromFile(file); + intent.setDataAndType(uri, "application/pdf"); + return intent; + } + //android获取一个用于打开文本文件的intent + public static Intent getTextFileIntent(Context context,String param) + { + Intent intent = new Intent("android.intent.action.VIEW"); + intent.addCategory("android.intent.category.DEFAULT"); + intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); + Uri uri = FileProvider.getUriForFile(context, "com.zj365.dc.fileProvider",new File(param)); + intent.setDataAndType(uri, "application/vnd.android.package-archive"); + return intent; + } + + //android获取一个用于打开音频文件的intent + public static Intent getAudioFileIntent(File file) + { + Intent intent = new Intent("android.intent.action.VIEW"); + intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); + intent.putExtra("oneshot", 0); + intent.putExtra("configchange", 0); + Uri uri = Uri.fromFile(file); + intent.setDataAndType(uri, "audio/*"); + return intent; + } + //android获取一个用于打开视频文件的intent + public static Intent getVideoFileIntent(File file) + { + Intent intent = new Intent("android.intent.action.VIEW"); + intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); + intent.putExtra("oneshot", 0); + intent.putExtra("configchange", 0); + Uri uri = Uri.fromFile(file); + intent.setDataAndType(uri, "video/*"); + return intent; + } + + + //android获取一个用于打开CHM文件的intent + public static Intent getChmFileIntent(File file) + { + Intent intent = new Intent("android.intent.action.VIEW"); + intent.addCategory("android.intent.category.DEFAULT"); + intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + Uri uri = Uri.fromFile(file); + intent.setDataAndType(uri, "application/x-chm"); + return intent; + } + + + //android获取一个用于打开Word文件的intent + public static Intent getWordFileIntent(File file) + { + Intent intent = new Intent("android.intent.action.VIEW"); + intent.addCategory("android.intent.category.DEFAULT"); + intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + Uri uri = Uri.fromFile(file); + intent.setDataAndType(uri, "application/msword"); + return intent; + } + //android获取一个用于打开Excel文件的intent + public static Intent getExcelFileIntent(File file) + { + Intent intent = new Intent("android.intent.action.VIEW"); + intent.addCategory("android.intent.category.DEFAULT"); + intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + Uri uri = Uri.fromFile(file); + intent.setDataAndType(uri, "application/vnd.ms-excel"); + return intent; + } + //android获取一个用于打开PPT文件的intent + public static Intent getPPTFileIntent(File file) + { + Intent intent = new Intent("android.intent.action.VIEW"); + intent.addCategory("android.intent.category.DEFAULT"); + intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + Uri uri = Uri.fromFile(file); + intent.setDataAndType(uri, "application/vnd.ms-powerpoint"); + return intent; + } + //android获取一个用于打开apk文件的intent + public static Intent getApkFileIntent(File file) + { + Intent intent = new Intent(); + intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + intent.setAction(android.content.Intent.ACTION_VIEW); + intent.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive"); + return intent; + } + + public static void openFile(Context context, File file) { + Intent intent = new Intent(); + intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + //设置intent的Action属性 + intent.setAction(Intent.ACTION_VIEW); + Uri uri = null; + //支持Android7.0,Android 7.0以后,用了Content Uri 替换了原本的File Uri + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { + uri = FileProvider.getUriForFile(context, AppUtils.getPackageName() + ".fileProvider", file); + intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION); + } else { + uri = Uri.fromFile(file); + } + + //获取文件file的MIME类型 + String type = GetFileMIME(file.getName()); + //设置intent的data和Type属性。 + intent.setDataAndType(uri, type); + //跳转 + try { + context.startActivity(intent); + } catch (Exception e) { + /* LogUtil.E("FileUtil", e.getMessage()); + Toast.makeText(context, "找不到打开此文件的应用!", Toast.LENGTH_SHORT).show();*/ + } + } + + /** + * 根据文件后缀回去MIME类型 + */ + public static String GetFileMIME(String path) { + String docType = ""; + if (path.contains(".")) { + docType = path.split("\\.")[path.split("\\.").length - 1]; + } + return getMimeType(docType); + } + + private static String getMimeType(String docType) { + String mime = ""; + HashMap h = new HashMap(); + h.put("", "application/octet-stream"); + h.put("323", "text/h323"); + h.put("3gp", "video/3gpp"); + h.put("aab", "application/x-authoware-bin"); + h.put("aam", "application/x-authoware-map"); + h.put("aas", "application/x-authoware-seg"); + h.put("acx", "application/internet-property-stream"); + h.put("ai", "application/postscript"); + h.put("aif", "audio/x-aiff"); + h.put("aifc", "audio/x-aiff"); + h.put("aiff", "audio/x-aiff"); + h.put("als", "audio/X-Alpha5"); + h.put("amc", "application/x-mpeg"); + h.put("ani", "application/octet-stream"); + h.put("apk", "application/vnd.android.package-archive"); + h.put("asc", "text/plain"); + h.put("asd", "application/astound"); + h.put("asf", "video/x-ms-asf"); + h.put("asn", "application/astound"); + h.put("asp", "application/x-asap"); + h.put("asr", "video/x-ms-asf"); + h.put("asx", "video/x-ms-asf"); + h.put("au", "audio/basic"); + h.put("avb", "application/octet-stream"); + h.put("avi", "video/x-msvideo"); + h.put("awb", "audio/amr-wb"); + h.put("axs", "application/olescript"); + h.put("bas", "text/plain"); + h.put("bcpio", "application/x-bcpio"); + h.put("bin ", "application/octet-stream"); + h.put("bld", "application/bld"); + h.put("bld2", "application/bld2"); + h.put("bmp", "image/bmp"); + h.put("bpk", "application/octet-stream"); + h.put("bz2", "application/x-bzip2"); + h.put("c", "text/plain"); + h.put("cal", "image/x-cals"); + h.put("cat", "application/vnd.ms-pkiseccat"); + h.put("ccn", "application/x-cnc"); + h.put("cco", "application/x-cocoa"); + h.put("cdf", "application/x-cdf"); + h.put("cer", "application/x-x509-ca-cert"); + h.put("cgi", "magnus-internal/cgi"); + h.put("chat", "application/x-chat"); + h.put("class", "application/octet-stream"); + h.put("clp", "application/x-msclip"); + h.put("cmx", "image/x-cmx"); + h.put("co", "application/x-cult3d-object"); + h.put("cod", "image/cis-cod"); + h.put("conf", "text/plain"); + h.put("cpio", "application/x-cpio"); + h.put("cpp", "text/plain"); + h.put("cpt", "application/mac-compactpro"); + h.put("crd", "application/x-mscardfile"); + h.put("crl", "application/pkix-crl"); + h.put("crt", "application/x-x509-ca-cert"); + h.put("csh", "application/x-csh"); + h.put("csm", "chemical/x-csml"); + h.put("csml", "chemical/x-csml"); + h.put("css", "text/css"); + h.put("cur", "application/octet-stream"); + h.put("dcm", "x-lml/x-evm"); + h.put("dcr", "application/x-director"); + h.put("dcx", "image/x-dcx"); + h.put("der", "application/x-x509-ca-cert"); + h.put("dhtml", "text/html"); + h.put("dir", "application/x-director"); + h.put("dll", "application/x-msdownload"); + h.put("dmg", "application/octet-stream"); + h.put("dms", "application/octet-stream"); + h.put("doc", "application/msword"); + h.put("docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document"); + h.put("dot", "application/msword"); + h.put("dvi", "application/x-dvi"); + h.put("dwf", "drawing/x-dwf"); + h.put("dwg", "application/x-autocad"); + h.put("dxf", "application/x-autocad"); + h.put("dxr", "application/x-director"); + h.put("ebk", "application/x-expandedbook"); + h.put("emb", "chemical/x-embl-dl-nucleotide"); + h.put("embl", "chemical/x-embl-dl-nucleotide"); + h.put("eps", "application/postscript"); + h.put("epub", "application/epub+zip"); + h.put("eri", "image/x-eri"); + h.put("es", "audio/echospeech"); + h.put("esl", "audio/echospeech"); + h.put("etc", "application/x-earthtime"); + h.put("etx", "text/x-setext"); + h.put("evm", "x-lml/x-evm"); + h.put("evy", "application/envoy"); + h.put("exe", "application/octet-stream"); + h.put("fh4", "image/x-freehand"); + h.put("fh5", "image/x-freehand"); + h.put("fhc", "image/x-freehand"); + h.put("fif", "application/fractals"); + h.put("flr", "x-world/x-vrml"); + h.put("flv", "video/octet-stream" /*"flv-application/octet-stream"*/); + h.put("fm", "application/x-maker"); + h.put("fpx", "image/x-fpx"); + h.put("fvi", "video/isivideo"); + h.put("gau", "chemical/x-gaussian-input"); + h.put("gca", "application/x-gca-compressed"); + h.put("gdb", "x-lml/x-gdb"); + h.put("gif", "image/gif"); + h.put("gps", "application/x-gps"); + h.put("gtar", "application/x-gtar"); + h.put("gz", "application/x-gzip"); + h.put("h", "text/plain"); + h.put("hdf", "application/x-hdf"); + h.put("hdm", "text/x-hdml"); + h.put("hdml", "text/x-hdml"); + h.put("hlp", "application/winhlp"); + h.put("hqx", "application/mac-binhex40"); + h.put("hta", "application/hta"); + h.put("htc", "text/x-component"); + h.put("htm", "text/html"); + h.put("html", "text/html"); + h.put("hts", "text/html"); + h.put("htt", "text/webviewhtml"); + h.put("ice", "x-conference/x-cooltalk"); + h.put("ico", "image/x-icon"); + h.put("ief", "image/ief"); + h.put("ifm", "image/gif"); + h.put("ifs", "image/ifs"); + h.put("iii", "application/x-iphone"); + h.put("imy", "audio/melody"); + h.put("ins", "application/x-internet-signup"); + h.put("ips", "application/x-ipscript"); + h.put("ipx", "application/x-ipix"); + h.put("isp", "application/x-internet-signup"); + h.put("it", "audio/x-mod"); + h.put("itz", "audio/x-mod"); + h.put("ivr", "i-world/i-vrml"); + h.put("j2k", "image/j2k"); + h.put("jad", "text/vnd.sun.j2me.app-descriptor"); + h.put("jam", "application/x-jam"); + h.put("jar", "application/java-archive"); + h.put("java", "text/plain"); + h.put("jfif", "image/pipeg"); + h.put("jnlp", "application/x-java-jnlp-file"); + h.put("jpe", "image/jpeg"); + h.put("jpeg", "image/jpeg"); + h.put("jpg", "image/jpeg"); + h.put("jpz", "image/jpeg"); + h.put("js", "application/x-javascript"); + h.put("json", "application/json"); + h.put("jwc", "application/jwc"); + h.put("kjx", "application/x-kjx"); + h.put("lak", "x-lml/x-lak"); + h.put("latex", "application/x-latex"); + h.put("lcc", "application/fastman"); + h.put("lcl", "application/x-digitalloca"); + h.put("lcr", "application/x-digitalloca"); + h.put("lgh", "application/lgh"); + h.put("lha", "application/octet-stream"); + h.put("lml", "x-lml/x-lml"); + h.put("lmlpack", "x-lml/x-lmlpack"); + h.put("log", "text/plain"); + h.put("lsf", "video/x-la-asf"); + h.put("lsx", "video/x-la-asf"); + h.put("lzh", "application/octet-stream"); + h.put("m13", "application/x-msmediaview"); + h.put("m14", "application/x-msmediaview"); + h.put("m15", "audio/x-mod"); + h.put("m3u", "audio/x-mpegurl"); + h.put("m3u8", "application/x-mpegURL");//XXX 待测 + h.put("m3url", "audio/x-mpegurl"); + h.put("m4a", "audio/mp4a-latm"); + h.put("m4b", "audio/mp4a-latm"); + h.put("m4p", "audio/mp4a-latm"); + h.put("m4u", "video/vnd.mpegurl"); + h.put("m4v", "video/x-m4v"); + h.put("ma1", "audio/ma1"); + h.put("ma2", "audio/ma2"); + h.put("ma3", "audio/ma3"); + h.put("ma5", "audio/ma5"); + h.put("man", "application/x-troff-man"); + h.put("map", "magnus-internal/imagemap"); + h.put("mbd", "application/mbedlet"); + h.put("mct", "application/x-mascot"); + h.put("mdb", "application/x-msaccess"); + h.put("mdz", "audio/x-mod"); + h.put("me", "application/x-troff-me"); + h.put("mel", "text/x-vmel"); + h.put("mht", "message/rfc822"); + h.put("mhtml", "message/rfc822"); + h.put("mi", "application/x-mif"); + h.put("mid", "audio/mid"); + h.put("midi", "audio/midi"); + h.put("mif", "application/x-mif"); + h.put("mil", "image/x-cals"); + h.put("mio", "audio/x-mio"); + h.put("mmf", "application/x-skt-lbs"); + h.put("mng", "video/x-mng"); + h.put("mny", "application/x-msmoney"); + h.put("moc", "application/x-mocha"); + h.put("mocha", "application/x-mocha"); + h.put("mod", "audio/x-mod"); + h.put("mof", "application/x-yumekara"); + h.put("mol", "chemical/x-mdl-molfile"); + h.put("mop", "chemical/x-mopac-input"); + h.put("mov", "video/quicktime"); + h.put("movie", "video/x-sgi-movie"); + h.put("mp2", "video/mpeg"); + h.put("mp3", "audio/mpeg"); + h.put("mp4", "video/mp4"); + h.put("mpa", "video/mpeg"); + h.put("mpc", "application/vnd.mpohun.certificate"); + h.put("mpe", "video/mpeg"); + h.put("mpeg", "video/mpeg"); + h.put("mpg", "video/mpeg"); + h.put("mpg4", "video/mp4"); + h.put("mpga", "audio/mpeg"); + h.put("mpn", "application/vnd.mophun.application"); + h.put("mpp", "application/vnd.ms-project"); + h.put("mps", "application/x-mapserver"); + h.put("mpv2", "video/mpeg"); + h.put("mrl", "text/x-mrml"); + h.put("mrm", "application/x-mrm"); + h.put("ms", "application/x-troff-ms"); + h.put("msg", "application/vnd.ms-outlook"); + h.put("mts", "application/metastream"); + h.put("mtx", "application/metastream"); + h.put("mtz", "application/metastream"); + h.put("mvb", "application/x-msmediaview"); + h.put("mzv", "application/metastream"); + h.put("nar", "application/zip"); + h.put("nbmp", "image/nbmp"); + h.put("nc", "application/x-netcdf"); + h.put("ndb", "x-lml/x-ndb"); + h.put("ndwn", "application/ndwn"); + h.put("nif", "application/x-nif"); + h.put("nmz", "application/x-scream"); + h.put("nokia-op-logo", "image/vnd.nok-oplogo-color"); + h.put("npx", "application/x-netfpx"); + h.put("nsnd", "audio/nsnd"); + h.put("nva", "application/x-neva1"); + h.put("nws", "message/rfc822"); + h.put("oda", "application/oda"); + h.put("ogg", "audio/ogg"); + h.put("oom", "application/x-AtlasMate-Plugin"); + h.put("p10", "application/pkcs10"); + h.put("p12", "application/x-pkcs12"); + h.put("p7b", "application/x-pkcs7-certificates"); + h.put("p7c", "application/x-pkcs7-mime"); + h.put("p7m", "application/x-pkcs7-mime"); + h.put("p7r", "application/x-pkcs7-certreqresp"); + h.put("p7s", "application/x-pkcs7-signature"); + h.put("pac", "audio/x-pac"); + h.put("pae", "audio/x-epac"); + h.put("pan", "application/x-pan"); + h.put("pbm", "image/x-portable-bitmap"); + h.put("pcx", "image/x-pcx"); + h.put("pda", "image/x-pda"); + h.put("pdb", "chemical/x-pdb"); + h.put("pdf", "application/pdf"); + h.put("pfr", "application/font-tdpfr"); + h.put("pfx", "application/x-pkcs12"); + h.put("pgm", "image/x-portable-graymap"); + h.put("pict", "image/x-pict"); + h.put("pko", "application/ynd.ms-pkipko"); + h.put("pm", "application/x-perl"); + h.put("pma", "application/x-perfmon"); + h.put("pmc", "application/x-perfmon"); + h.put("pmd", "application/x-pmd"); + h.put("pml", "application/x-perfmon"); + h.put("pmr", "application/x-perfmon"); + h.put("pmw", "application/x-perfmon"); + h.put("png", "image/png"); + h.put("pnm", "image/x-portable-anymap"); + h.put("pnz", "image/png"); + h.put("pot,", "application/vnd.ms-powerpoint"); + h.put("ppm", "image/x-portable-pixmap"); + h.put("pps", "application/vnd.ms-powerpoint"); + h.put("ppt", "application/vnd.ms-powerpoint"); + h.put("pptx", "application/vnd.openxmlformats-officedocument.presentationml.presentation"); + h.put("pqf", "application/x-cprplayer"); + h.put("pqi", "application/cprplayer"); + h.put("prc", "application/x-prc"); + h.put("prf", "application/pics-rules"); + h.put("prop", "text/plain"); + h.put("proxy", "application/x-ns-proxy-autoconfig"); + h.put("ps", "application/postscript"); + h.put("ptlk", "application/listenup"); + h.put("pub", "application/x-mspublisher"); + h.put("pvx", "video/x-pv-pvx"); + h.put("qcp", "audio/vnd.qcelp"); + h.put("qt", "video/quicktime"); + h.put("qti", "image/x-quicktime"); + h.put("qtif", "image/x-quicktime"); + h.put("r3t", "text/vnd.rn-realtext3d"); + h.put("ra", "audio/x-pn-realaudio"); + h.put("ram", "audio/x-pn-realaudio"); + h.put("rar", "application/octet-stream"); + h.put("ras", "image/x-cmu-raster"); + h.put("rc", "text/plain"); + h.put("rdf", "application/rdf+xml"); + h.put("rf", "image/vnd.rn-realflash"); + h.put("rgb", "image/x-rgb"); + h.put("rlf", "application/x-richlink"); + h.put("rm", "audio/x-pn-realaudio"); + h.put("rmf", "audio/x-rmf"); + h.put("rmi", "audio/mid"); + h.put("rmm", "audio/x-pn-realaudio"); + h.put("rmvb", "audio/x-pn-realaudio"); + h.put("rnx", "application/vnd.rn-realplayer"); + h.put("roff", "application/x-troff"); + h.put("rp", "image/vnd.rn-realpix"); + h.put("rpm", "audio/x-pn-realaudio-plugin"); + h.put("rt", "text/vnd.rn-realtext"); + h.put("rte", "x-lml/x-gps"); + h.put("rtf", "application/rtf"); + h.put("rtg", "application/metastream"); + h.put("rtx", "text/richtext"); + h.put("rv", "video/vnd.rn-realvideo"); + h.put("rwc", "application/x-rogerwilco"); + h.put("s3m", "audio/x-mod"); + h.put("s3z", "audio/x-mod"); + h.put("sca", "application/x-supercard"); + h.put("scd", "application/x-msschedule"); + h.put("sct", "text/scriptlet"); + h.put("sdf", "application/e-score"); + h.put("sea", "application/x-stuffit"); + h.put("setpay", "application/set-payment-initiation"); + h.put("setreg", "application/set-registration-initiation"); + h.put("sgm", "text/x-sgml"); + h.put("sgml", "text/x-sgml"); + h.put("sh", "application/x-sh"); + h.put("shar", "application/x-shar"); + h.put("shtml", "magnus-internal/parsed-html"); + h.put("shw", "application/presentations"); + h.put("si6", "image/si6"); + h.put("si7", "image/vnd.stiwap.sis"); + h.put("si9", "image/vnd.lgtwap.sis"); + h.put("sis", "application/vnd.symbian.install"); + h.put("sit", "application/x-stuffit"); + h.put("skd", "application/x-Koan"); + h.put("skm", "application/x-Koan"); + h.put("skp", "application/x-Koan"); + h.put("skt", "application/x-Koan"); + h.put("slc", "application/x-salsa"); + h.put("smd", "audio/x-smd"); + h.put("smi", "application/smil"); + h.put("smil", "application/smil"); + h.put("smp", "application/studiom"); + h.put("smz", "audio/x-smd"); + h.put("snd", "audio/basic"); + h.put("spc", "application/x-pkcs7-certificates"); + h.put("spl", "application/futuresplash"); + h.put("spr", "application/x-sprite"); + h.put("sprite", "application/x-sprite"); + h.put("sdp", "application/sdp"); + h.put("spt", "application/x-spt"); + h.put("src", "application/x-wais-source"); + h.put("sst", "application/vnd.ms-pkicertstore"); + h.put("stk", "application/hyperstudio"); + h.put("stl", "application/vnd.ms-pkistl"); + h.put("stm", "text/html"); + h.put("svg", "image/svg+xml"); + h.put("sv4cpio", "application/x-sv4cpio"); + h.put("sv4crc", "application/x-sv4crc"); + h.put("svf", "image/vnd"); + h.put("svh", "image/svh"); + h.put("svr", "x-world/x-svr"); + h.put("swf", "application/x-shockwave-flash"); + h.put("swfl", "application/x-shockwave-flash"); + h.put("t", "application/x-troff"); + h.put("tad", "application/octet-stream"); + h.put("talk", "text/x-speech"); + h.put("tar", "application/x-tar"); + h.put("taz", "application/x-tar"); + h.put("tbp", "application/x-timbuktu"); + h.put("tbt", "application/x-timbuktu"); + h.put("tcl", "application/x-tcl"); + h.put("tex", "application/x-tex"); + h.put("texi", "application/x-texinfo"); + h.put("texinfo", "application/x-texinfo"); + h.put("tgz", "application/x-compressed"); + h.put("thm", "application/vnd.eri.thm"); + h.put("tif", "image/tiff"); + h.put("tiff", "image/tiff"); + h.put("tki", "application/x-tkined"); + h.put("tkined", "application/x-tkined"); + h.put("toc", "application/toc"); + h.put("toy", "image/toy"); + h.put("tr", "application/x-troff"); + h.put("trk", "x-lml/x-gps"); + h.put("trm", "application/x-msterminal"); + h.put("tsi", "audio/tsplayer"); + h.put("tsp", "application/dsptype"); + h.put("tsv", "text/tab-separated-values"); + h.put("ttf", "application/octet-stream"); + h.put("ttz", "application/t-time"); + h.put("txt", "text/plain"); + h.put("uls", "text/iuls"); + h.put("ult", "audio/x-mod"); + h.put("ustar", "application/x-ustar"); + h.put("uu", "application/x-uuencode"); + h.put("uue", "application/x-uuencode"); + h.put("vcd", "application/x-cdlink"); + h.put("vcf", "text/x-vcard"); + h.put("vdo", "video/vdo"); + h.put("vib", "audio/vib"); + h.put("viv", "video/vivo"); + h.put("vivo", "video/vivo"); + h.put("vmd", "application/vocaltec-media-desc"); + h.put("vmf", "application/vocaltec-media-file"); + h.put("vmi", "application/x-dreamcast-vms-info"); + h.put("vms", "application/x-dreamcast-vms"); + h.put("vox", "audio/voxware"); + h.put("vqe", "audio/x-twinvq-plugin"); + h.put("vqf", "audio/x-twinvq"); + h.put("vql", "audio/x-twinvq"); + h.put("vre", "x-world/x-vream"); + h.put("vrml", "x-world/x-vrml"); + h.put("vrt", "x-world/x-vrt"); + h.put("vrw", "x-world/x-vream"); + h.put("vts", "workbook/formulaone"); + h.put("wav", "audio/x-wav"); + h.put("wax", "audio/x-ms-wax"); + h.put("wbmp", "image/vnd.wap.wbmp"); + h.put("wcm", "application/vnd.ms-works"); + h.put("wdb", "application/vnd.ms-works"); + h.put("web", "application/vnd.xara"); + h.put("wi", "image/wavelet"); + h.put("wis", "application/x-InstallShield"); + h.put("wks", "application/vnd.ms-works"); + h.put("wm", "video/x-ms-wm"); + h.put("wma", "audio/x-ms-wma"); + h.put("wmd", "application/x-ms-wmd"); + h.put("wmf", "application/x-msmetafile"); + h.put("wml", "text/vnd.wap.wml"); + h.put("wmlc", "application/vnd.wap.wmlc"); + h.put("wmls", "text/vnd.wap.wmlscript"); + h.put("wmlsc", "application/vnd.wap.wmlscriptc"); + h.put("wmlscript", "text/vnd.wap.wmlscript"); + h.put("wmv", "audio/x-ms-wmv"); + h.put("wmx", "video/x-ms-wmx"); + h.put("wmz", "application/x-ms-wmz"); + h.put("wpng", "image/x-up-wpng"); + h.put("wps", "application/vnd.ms-works"); + h.put("wpt", "x-lml/x-gps"); + h.put("wri", "application/x-mswrite"); + h.put("wrl", "x-world/x-vrml"); + h.put("wrz", "x-world/x-vrml"); + h.put("ws", "text/vnd.wap.wmlscript"); + h.put("wsc", "application/vnd.wap.wmlscriptc"); + h.put("wv", "video/wavelet"); + h.put("wvx", "video/x-ms-wvx"); + h.put("wxl", "application/x-wxl"); + h.put("x-gzip", "application/x-gzip"); + h.put("xaf", "x-world/x-vrml"); + h.put("xar", "application/vnd.xara"); + h.put("xbm", "image/x-xbitmap"); + h.put("xdm", "application/x-xdma"); + h.put("xdma", "application/x-xdma"); + h.put("xdw", "application/vnd.fujixerox.docuworks"); + h.put("xht", "application/xhtml+xml"); + h.put("xhtm", "application/xhtml+xml"); + h.put("xhtml", "application/xhtml+xml"); + h.put("xla", "application/vnd.ms-excel"); + h.put("xlc", "application/vnd.ms-excel"); + h.put("xll", "application/x-excel"); + h.put("xlm", "application/vnd.ms-excel"); + h.put("xls", "application/vnd.ms-excel"); + h.put("xlsx", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); + h.put("xlt", "application/vnd.ms-excel"); + h.put("xlw", "application/vnd.ms-excel"); + h.put("xm", "audio/x-mod"); + h.put("xml", "text/plain"); + h.put("xml", "application/xml"); + h.put("xmz", "audio/x-mod"); + h.put("xof", "x-world/x-vrml"); + h.put("xpi", "application/x-xpinstall"); + h.put("xpm", "image/x-xpixmap"); + h.put("xsit", "text/xml"); + h.put("xsl", "text/xml"); + h.put("xul", "text/xul"); + h.put("xwd", "image/x-xwindowdump"); + h.put("xyz", "chemical/x-pdb"); + h.put("yz1", "application/x-yz1"); + h.put("z", "application/x-compress"); + h.put("zac", "application/x-zaurus-zac"); + h.put("zip", "application/zip"); + + mime = h.get(docType); + if (mime == null) { + mime = "application/octet-stream"; + } + return mime; + } + + // public static void +} diff --git a/common/src/main/res/values/colors.xml b/common/src/main/res/values/colors.xml index 0ac1872..e7f9d88 100644 --- a/common/src/main/res/values/colors.xml +++ b/common/src/main/res/values/colors.xml @@ -207,4 +207,5 @@ #FFD04F #FFAC53 #F04D42 + #CBC8C8 \ No newline at end of file diff --git a/health/src/main/AndroidManifest.xml b/health/src/main/AndroidManifest.xml index 21e2666..74789a4 100644 --- a/health/src/main/AndroidManifest.xml +++ b/health/src/main/AndroidManifest.xml @@ -149,6 +149,11 @@ android:name="com.zj365.health.act.ShopOrderListAct" android:launchMode="singleTop" android:screenOrientation="portrait" /> + + () { + val binding by lazy { ActGoodsLogisticsBinding.inflate(layoutInflater) } + + val adapter by lazy { GoodsLogisticsAdapter() } + + var orderId:Long = 0 + + override fun liveObserver() { + + mViewModel.goodsLogisticsLiveData.observe(this){ + binding.tvTrackingNumber.text = "${it.data.express_name} ${it.data.express_sn}" + binding.tvShippingAddress.text = it.data.address + adapter.setNewInstance(it.data.data) + } + } + + override fun initView() { + super.initView() + statusBar(binding.title.mView) + binding.title.mTvTitle.text = "物流信息" + binding.title.mIvBack.setOnClickListener { + finish() + } + + orderId = intent.getLongExtra("orderId",0) + mViewModel.getShippingTracking(orderId) + + binding.recycler.layoutManager = LinearLayoutManager(this) + binding.recycler.addItemDecoration(object : RecyclerView.ItemDecoration(){ + override fun getItemOffsets(outRect: Rect, itemPosition: Int, parent: RecyclerView) { + super.getItemOffsets(outRect, itemPosition, parent) + } + }) + + binding.recycler.adapter = adapter + + + } + + + override fun setLayout() = binding.root +} \ No newline at end of file diff --git a/health/src/main/java/com/zj365/health/act/OpenOrRenewAct.kt b/health/src/main/java/com/zj365/health/act/OpenOrRenewAct.kt index efe5176..c20d3de 100644 --- a/health/src/main/java/com/zj365/health/act/OpenOrRenewAct.kt +++ b/health/src/main/java/com/zj365/health/act/OpenOrRenewAct.kt @@ -34,6 +34,7 @@ import com.zj365.health.databinding.ActXtangOpenOrRenewBinding import com.zj365.health.model.PayResult import com.zj365.health.vm.XTangVm import com.xty.network.model.OpenOrRenewBean +import com.zj365.health.weight.HealthDialog import org.greenrobot.eventbus.EventBus import org.greenrobot.eventbus.Subscribe import org.greenrobot.eventbus.ThreadMode @@ -58,6 +59,13 @@ class OpenOrRenewAct : BaseVmAct() { private val SDK_PAY_FLAG = 1 private val WEIXIN_PAY_FLAG = 2 + private var tips = "" + val tipDialog by lazy { + HealthDialog(this, true, tips) { + mViewModel.firstOpen(userId, pageType) + } + } + @SuppressLint("SimpleDateFormat") override fun initData() { super.initData() @@ -127,7 +135,28 @@ class OpenOrRenewAct : BaseVmAct() { if (!TextUtils.isEmpty(stringExtra)) { bottomSheetDialog?.show() } else { - mViewModel.firstOpen(userId, pageType) + if (pageType == 1) { + tips = "血糖建模出值重要提示:\n" + + "1、建模期间,累计有效佩戴满72小时;\n" + + "2、最少确保一天(0-24点)有完整佩戴数据;\n" + + "3、高血糖用户在建模完成之后须做个人血糖模型校准;\n" + + "4、APP所出血糖值为前一个小时血糖平均值。" + tipDialog.setContent(tips) + tipDialog.show() + }else if (pageType == 2){ + tips = "尿酸建模出值重要提示:\n" + + "1、建模期间,累计有效佩戴满72小时;\n" + + "2、建模完成后,每天18:00至第二天6:00期间,佩戴时长累计满6小时,APP出具尿酸值;\n" + + "3、尿酸值每天7:00出值。本次值为前一天18:00到当天早上6:00尿酸平均值。" + tipDialog.setContent(tips) + tipDialog.show() + } else { + tips = "1、建模期间,累计有效佩戴满72小时;\n" + + "2、建模完成后,每天18:00至第二天6:00期间,佩戴时长累计满6小时,APP出具血脂值;\n" + + "3、血脂值每天7:00出值。本次值为前一天18:00到当天早上6:00血脂平均值。" + tipDialog.setContent(tips) + tipDialog.show() + } } } diff --git a/health/src/main/java/com/zj365/health/act/ShopOrderListAct.kt b/health/src/main/java/com/zj365/health/act/ShopOrderListAct.kt index 9fb4eea..cf9735e 100644 --- a/health/src/main/java/com/zj365/health/act/ShopOrderListAct.kt +++ b/health/src/main/java/com/zj365/health/act/ShopOrderListAct.kt @@ -4,15 +4,18 @@ import android.Manifest import android.content.Intent import android.graphics.Rect import android.net.Uri +import android.widget.Toast import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView import com.alibaba.android.arouter.facade.annotation.Route import com.androidkun.xtablayout.XTabLayout +import com.tencent.mm.opensdk.modelbase.BaseResp import com.xty.base.act.BaseListAct import com.xty.base.utils.PayUtils import com.xty.common.arouter.ARouterUrl import com.xty.common.arouter.RouteManager import com.xty.common.event.ReChangeEvent +import com.xty.common.event.WxPayEvent import com.xty.network.model.ShopOrderListBean import com.zj365.health.R import com.zj365.health.adapter.GoodsOrderAdapter @@ -100,7 +103,9 @@ class ShopOrderListAct : BaseListAct() { dialogCancel.show() }else if(it.status == 3){ - + bundle.clear() + bundle.putLong("orderId",it.id) + RouteManager.goAct(ARouterUrl.LOGISTICS_ACT,bundle) }else{ if(EasyPermissions.hasPermissions(this, Manifest.permission.CALL_PHONE)){ @@ -113,7 +118,7 @@ class ShopOrderListAct : BaseListAct() { } } R.id.tv_refund ->{ - if (it.status == 3 || it.status == 2){ + if ( it.status == 2){ dialogReturn.setContentNew("您是否确认对此订单进行退款申请,申请完成" + "后会在1~3个工作日对订单进行审核,请及时" + "关注订单状态") @@ -121,6 +126,15 @@ class ShopOrderListAct : BaseListAct() { }else if (it.status == 1){ PayUtils(this).payForGoods(it.pay_price.toFloat(),it.order_no) + }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) + } } } } @@ -217,4 +231,34 @@ class ShopOrderListAct : BaseListAct() { page = 1 loadData() } + + @Subscribe(threadMode = ThreadMode.MAIN) + fun getWxPayResult(event: WxPayEvent) { + when (event.code) { + BaseResp.ErrCode.ERR_OK -> { + + Toast.makeText( + this@ShopOrderListAct, + "支付成功", + Toast.LENGTH_SHORT + ) + .show() + + page = 1 + loadData() + } + + BaseResp.ErrCode.ERR_USER_CANCEL -> { + } + + else -> { + + Toast.makeText( + this@ShopOrderListAct, + "支付失败,请联系客服", + Toast.LENGTH_SHORT + ).show() + } + } + } } \ No newline at end of file diff --git a/health/src/main/java/com/zj365/health/act/healthrecord/HealthRecordMainAct.kt b/health/src/main/java/com/zj365/health/act/healthrecord/HealthRecordMainAct.kt index 06a3f92..df468ff 100644 --- a/health/src/main/java/com/zj365/health/act/healthrecord/HealthRecordMainAct.kt +++ b/health/src/main/java/com/zj365/health/act/healthrecord/HealthRecordMainAct.kt @@ -19,7 +19,9 @@ import com.xty.common.arouter.ARouterUrl import com.xty.common.arouter.RouteManager import com.xty.common.onEventObject import com.xty.common.setImageUser +import com.xty.common.util.CommonUtils import com.xty.common.weight.HealthBodyView +import com.xty.network.model.HealthArchiveBean import com.zj365.health.BuildConfig import com.zj365.health.adapter.familyhealth.HealthFamilyTargetAdapter import com.zj365.health.databinding.ActHealthRecordMainBinding @@ -46,6 +48,8 @@ class HealthRecordMainAct : BaseVmAct() { private var isScrollTable = false private var launch: Job? = null + var mSurveysList = ArrayList() + override fun liveObserver() { @@ -66,7 +70,13 @@ class HealthRecordMainAct : BaseVmAct() { binding.tvBmiDesc.setTextColor(Color.parseColor("#02C191")) } binding.tvBmr.text = "${it.data.bmr}" + binding.tvBodyFat.text = if(it.data.bodyFat.isNullOrEmpty()) { "--"} else it.data.bodyFat + binding.mProgress.progress = it.data.userSchedule * 10 + binding.clBody.tvScore.text = "${it.data.surveys.score}" + mSurveysList = it.data.surveys.list + initSurvey(mSurveysList) mAdapter.setNewInstance(it.data.healData) + } } @@ -84,10 +94,23 @@ class HealthRecordMainAct : BaseVmAct() { mViewModel.getHealthArchive() initTab() - initSurvey() + // initSurvey() initAdapter() initClickListener() + Const.mainLiveData.observe(this){ + binding.tvName.text = it.user.name + if (it.user.avatarUrl.isNullOrEmpty()) { + binding.imgAvatar.setImageResource(R.mipmap.icon_default_avator) + } else { + binding.imgAvatar.setImageUser( + this, + it.user.avatarUrl, + it.user.sex.toString() + ) + } + } + Const.mainLiveData.value?.let { binding.tvName.text = it.user.name if (it.user.avatarUrl.isNullOrEmpty()) { @@ -145,8 +168,8 @@ class HealthRecordMainAct : BaseVmAct() { } } - fun initSurvey(){ - var surveyList = ArrayList() + fun initSurvey(surveysList: ArrayList){ + /* var surveyList = ArrayList() surveyList.add("免疫系统") surveyList.add("神经系统") @@ -156,13 +179,18 @@ class HealthRecordMainAct : BaseVmAct() { surveyList.add("运动系统") surveyList.add("心脑血管") surveyList.add("消化系统") - surveyList.add("呼吸系统") + surveyList.add("呼吸系统")*/ - binding.clBody.surveyView.setMenuItemTexts(surveyList) + binding.clBody.surveyView.setMenuItemTexts(surveysList) binding.clBody.surveyView.setOnClicklisteners(object : HealthSurveyView.onItemClicked{ override fun onPositionClicked(postion: Int) { - + var bean = mSurveysList[postion] + bundle.clear() + bundle.putString("web_site_url","${BuildConfig.url}shareApi/H5_question/${CommonUtils.getMyUserId()}/${bean.surveysId}/android/0") + bundle.putBoolean("isShowTitle",true) + bundle.putString("title",bean.name) + RouteManager.goAct(ARouterUrl.H5_ACT,bundle) } }) } diff --git a/health/src/main/java/com/zj365/health/act/psychological/PsychologicalTestMainAct.kt b/health/src/main/java/com/zj365/health/act/psychological/PsychologicalTestMainAct.kt index e020465..fd0c314 100644 --- a/health/src/main/java/com/zj365/health/act/psychological/PsychologicalTestMainAct.kt +++ b/health/src/main/java/com/zj365/health/act/psychological/PsychologicalTestMainAct.kt @@ -39,7 +39,7 @@ class PsychologicalTestMainAct : BaseListAct() { mAdapter.setOnItemClickListener { adapter, view, position -> var bean = adapter.data[position] as PsychologicalListBean.PsychologicalBean bundle.clear() - bundle.putString("web_site_url","${BuildConfig.url}shareApi/H5_question/${CommonUtils.getMyUserId()}/${bean.id}/android") + bundle.putString("web_site_url","${BuildConfig.url}shareApi/H5_question/${CommonUtils.getMyUserId()}/${bean.id}/android/1") bundle.putBoolean("isShowTitle",true) bundle.putString("title",bean.surveyName) RouteManager.goAct(ARouterUrl.H5_ACT,bundle) diff --git a/health/src/main/java/com/zj365/health/adapter/GoodsLogisticsAdapter.kt b/health/src/main/java/com/zj365/health/adapter/GoodsLogisticsAdapter.kt new file mode 100644 index 0000000..c787f8c --- /dev/null +++ b/health/src/main/java/com/zj365/health/adapter/GoodsLogisticsAdapter.kt @@ -0,0 +1,63 @@ +package com.zj365.health.adapter + +import com.chad.library.adapter.base.viewholder.BaseViewHolder +import com.xty.base.adapter.BaseAdapter +import com.xty.common.Dateutils +import com.xty.common.LogUtils +import com.xty.network.model.GoodsLogisticsBean +import com.zj365.health.R + +class GoodsLogisticsAdapter : BaseAdapter(R.layout.item_goods_logistics) { + override fun convert(holder: BaseViewHolder, item: GoodsLogisticsBean.LogisticsBean) { + var statusDesc = "" + when(item.status){ + 101->{ + statusDesc = "已揽件" + } + 102->{ + statusDesc = "在途中" + } + 103->{ + statusDesc = "派送中" + } + 104 ->{ + statusDesc = "已签收" + } + + 105->{ + statusDesc = "用户拒签" + } + 106->{ + statusDesc = "疑难件" + } + 107->{ + statusDesc = "无效单" + } + 108->{ + statusDesc = "超时单" + } + 109->{ + statusDesc = "签收失败" + } + 110->{ + statusDesc = "退回" + } + 111->{ + statusDesc = "转投" + } + + 112->{ + statusDesc = "待签" + } + } + holder.setText(R.id.tv_status_time,"${statusDesc} ${Dateutils.getDateToString(item.time)}") + holder.setText(R.id.tv_desc,item.context) + + LogUtils.e("GoodsLogisticsAdapter","size:${data.size} position:${holder.layoutPosition}") + if (data.size -1 == holder.layoutPosition){ + holder.setGone(R.id.line,true) + }else{ + holder.setGone(R.id.line,false) + } + } +} \ No newline at end of file diff --git a/health/src/main/java/com/zj365/health/adapter/GoodsOrderAdapter.kt b/health/src/main/java/com/zj365/health/adapter/GoodsOrderAdapter.kt index 2abfb33..acbbe4a 100644 --- a/health/src/main/java/com/zj365/health/adapter/GoodsOrderAdapter.kt +++ b/health/src/main/java/com/zj365/health/adapter/GoodsOrderAdapter.kt @@ -49,6 +49,7 @@ class GoodsOrderAdapter : BaseAdapter(R.layout. holder.setGone(R.id.tv_refund,false) } 2 ->{ + status.setTextColor(context.getColor(R.color.col_9BD)) holder.setGone(R.id.tv_confirm_receive_goods,true) holder.setText(R.id.tv_logistics,"联系客服") holder.setText(R.id.tv_refund,"申请退款") @@ -61,7 +62,7 @@ class GoodsOrderAdapter : BaseAdapter(R.layout. status.setTextColor(context.getColor(R.color.col_9BD)) holder.setGone(R.id.tv_confirm_receive_goods,false) holder.setText(R.id.tv_logistics,"查看物流") - holder.setText(R.id.tv_refund,"申请退款") + holder.setText(R.id.tv_refund,"联系客服") holder.setGone(R.id.tv_logistics,false) holder.setGone(R.id.tv_refund,false) diff --git a/health/src/main/java/com/zj365/health/vm/GoodsLogisticsVm.kt b/health/src/main/java/com/zj365/health/vm/GoodsLogisticsVm.kt new file mode 100644 index 0000000..52c396b --- /dev/null +++ b/health/src/main/java/com/zj365/health/vm/GoodsLogisticsVm.kt @@ -0,0 +1,17 @@ +package com.zj365.health.vm + +import androidx.lifecycle.MutableLiveData +import com.xty.base.vm.BaseVm +import com.xty.network.model.GoodsLogisticsBean +import com.xty.network.model.RespBody + +class GoodsLogisticsVm : BaseVm() { + + val goodsLogisticsLiveData by lazy { MutableLiveData> ()} + fun getShippingTracking(orderId:Long){ + startHttp { + val body = apiInterface().getLogistics(orderId) + body.getCodeStatus(goodsLogisticsLiveData, nowData) + } + } +} \ No newline at end of file diff --git a/health/src/main/java/com/zj365/health/weight/HealthSurveyView.kt b/health/src/main/java/com/zj365/health/weight/HealthSurveyView.kt index 76d0156..67da023 100644 --- a/health/src/main/java/com/zj365/health/weight/HealthSurveyView.kt +++ b/health/src/main/java/com/zj365/health/weight/HealthSurveyView.kt @@ -11,6 +11,7 @@ import android.widget.ImageView import android.widget.TextView import com.google.android.exoplayer2.util.ColorParser import com.xty.common.LogUtils +import com.xty.network.model.HealthArchiveBean import com.zj365.health.R import kotlin.math.cos import kotlin.math.roundToInt @@ -33,7 +34,7 @@ class HealthSurveyView(context: Context, attrs: AttributeSet?) : ViewGroup(conte var mStartAngle = 270.0 //文本 - var mSurveyText = ArrayList() + var mSurveyText = ArrayList() var colors = arrayOf("#20C387","#FD830B","#1ECAFC") @@ -44,7 +45,7 @@ class HealthSurveyView(context: Context, attrs: AttributeSet?) : ViewGroup(conte var mItemLayoutId: Int = R.layout.layout_health_survey_child var mOnClicklistener: onItemClicked? = null - fun setMenuItemTexts( texts: ArrayList) { + fun setMenuItemTexts( texts: ArrayList) { require(!( texts == null)) { "菜单文本和图标至少设置其一" } mSurveyText = texts //初始化mMenucount @@ -77,7 +78,7 @@ class HealthSurveyView(context: Context, attrs: AttributeSet?) : ViewGroup(conte private fun initMenuItem(itemView: View, index: Int) { val tv = itemView.findViewById(R.id.tv_survey) - tv.text = mSurveyText[index] + tv.text = mSurveyText[index].name when(index){ 0,2,4,6 ->{ tv.setTextColor(Color.parseColor(colors[0])) diff --git a/health/src/main/res/drawable/shape_oval_c9c9.xml b/health/src/main/res/drawable/shape_oval_c9c9.xml new file mode 100644 index 0000000..b9e62f0 --- /dev/null +++ b/health/src/main/res/drawable/shape_oval_c9c9.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/health/src/main/res/layout/act_ai_skin_measurement.xml b/health/src/main/res/layout/act_ai_skin_measurement.xml index 8a0907b..47ae41e 100644 --- a/health/src/main/res/layout/act_ai_skin_measurement.xml +++ b/health/src/main/res/layout/act_ai_skin_measurement.xml @@ -20,7 +20,7 @@ app:layout_constraintTop_toBottomOf="@id/title" app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintBottom_toTopOf="@+id/tvSubmit" > + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/health/src/main/res/layout/dialog_ai_icing.xml b/health/src/main/res/layout/dialog_ai_icing.xml index 35db2ea..e2d90b2 100644 --- a/health/src/main/res/layout/dialog_ai_icing.xml +++ b/health/src/main/res/layout/dialog_ai_icing.xml @@ -36,12 +36,14 @@ android:layout_marginRight="@dimen/dp_20" android:layout_marginTop="@dimen/dp_25"> + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/health/src/main/res/layout/item_health_family_target.xml b/health/src/main/res/layout/item_health_family_target.xml index d84637e..821b235 100644 --- a/health/src/main/res/layout/item_health_family_target.xml +++ b/health/src/main/res/layout/item_health_family_target.xml @@ -3,7 +3,7 @@ xmlns:tools="http://schemas.android.com/tools" android:orientation="vertical" android:gravity="center" - android:layout_width="@dimen/dp_80" + android:layout_width="@dimen/dp_82" android:layout_height="@dimen/dp_71"> diff --git a/health/src/main/res/layout/layout_health_record_test.xml b/health/src/main/res/layout/layout_health_record_test.xml index 33a7b4f..91080bd 100644 --- a/health/src/main/res/layout/layout_health_record_test.xml +++ b/health/src/main/res/layout/layout_health_record_test.xml @@ -14,6 +14,7 @@ android:background="@mipmap/bg_health_record_test"> () { @@ -16,10 +32,103 @@ class EnterpriseInformationForTypeAct : BaseListAct() { val mAdapter by lazy { EnterpriseInformationChildAdapter(1) } var type = 0 + + val audioUtils by lazy { RecordAudio() } + + var isAudioPlay = false + override fun initAdapter() { binding.mRecycle.adapter = mAdapter binding.mRecycle.layoutManager = LinearLayoutManager(this@EnterpriseInformationForTypeAct) + mAdapter.setOnItemClickListener { adapter, view, position -> + var bean = adapter.data[position] as EnterpriseInfoHomeBean.EnterpriseInfoChildBean + + when(bean.fileFormat){ // 格式1,word,2,pdf,3.文本,4.excel,5.音频。6.链接 + 1->{ + if (!TextUtils.isEmpty(bean.fileUrl)){ + var filePath = FileDownloadUtils.getDefaultSaveRootPath() + File.separator + "zj365" + File.separator + "${bean.title}.word" + var file = File(filePath) + if (file.exists()){ + file.delete() + } + + createDownloadTask(filePath,bean.fileUrl,bean.fileFormat)!!.start() + } + + } + + 2->{ + if (!TextUtils.isEmpty(bean.fileUrl)){ + var filePath = FileDownloadUtils.getDefaultSaveRootPath() + File.separator + "zj365" + File.separator + "${bean.title}.pdf" + var file = File(filePath) + if (file.exists()){ + file.delete() + } + + LogUtils.e("EnterpriseInformationForTypeAct","filePath${filePath}") + + createDownloadTask(filePath,bean.fileUrl,bean.fileFormat)!!.start() + } + } + 3 ->{ + if (!TextUtils.isEmpty(bean.fileUrl)){ + var filePath = FileDownloadUtils.getDefaultSaveRootPath() + File.separator + "zj365" + File.separator + "${bean.title}.txt" + var file = File(filePath) + if (file.exists()){ + file.delete() + } + + LogUtils.e("EnterpriseInformationForTypeAct","filePath${filePath}") + + createDownloadTask(filePath,bean.fileUrl,bean.fileFormat)!!.start() + } + + + } + 4->{ + if (!TextUtils.isEmpty(bean.fileUrl)){ + var filePath = FileDownloadUtils.getDefaultSaveRootPath() + File.separator + "zj365" + File.separator + "${bean.title}.xlsx" + var file = File(filePath) + if (file.exists()){ + file.delete() + } + + LogUtils.e("EnterpriseInformationForTypeAct","filePath${filePath}") + + createDownloadTask(filePath,bean.fileUrl,bean.fileFormat)!!.start() + } + } + 5->{ + if (!TextUtils.isEmpty(bean.fileUrl)){ + var filePath = FileDownloadUtils.getDefaultSaveRootPath() + File.separator + "zj365" + File.separator + "${bean.title}.mp3" + var file = File(filePath) + if (file.exists()){ + file.delete() + } + + LogUtils.e("EnterpriseInformationForTypeAct","filePath${filePath}") + + createDownloadTask(filePath,bean.fileUrl,bean.fileFormat)!!.start() + } + + } + + 6->{ + if (!TextUtils.isEmpty(bean.fileUrl)){ + bundle.clear() + bundle.putString( + "web_site_url", + "${bean.fileUrl}" + ) + bundle.putBoolean("isShowTitle",true) + bundle.putString("title",bean.title) + RouteManager.goAct(ARouterUrl.H5_ACT,bundle) + } + } + } + } + setRecycleRefresh(binding.mRecycle,binding.mRefresh,true) } @@ -31,8 +140,65 @@ class EnterpriseInformationForTypeAct : BaseListAct() { binding.title.mIvBack.setOnClickListener { finish() } + } + + + private fun createDownloadTask(filePath: String,url:String,fileFormat:Int): BaseDownloadTask? { + var isDir = false + return FileDownloader.getImpl().create(url) + .setPath(filePath, false) + .setCallbackProgressTimes(300) + .setMinIntervalUpdateSpeed(400) + .setTag(this) + .setListener(object : FileDownloadSampleListener() { + override fun pending(task: BaseDownloadTask, soFarBytes: Int, totalBytes: Int) { + super.pending(task, soFarBytes, totalBytes) + loadingView.show() + LogUtils.e("EnterpriseInformationForTypeAct","pending${soFarBytes}") + + } + override fun progress(task: BaseDownloadTask, soFarBytes: Int, totalBytes: Int) { + super.progress(task, soFarBytes, totalBytes) + + LogUtils.e("EnterpriseInformationForTypeAct","progress${soFarBytes}") + } + + override fun error(task: BaseDownloadTask, e: Throwable) { + super.error(task, e) + } + + override fun connected( + task: BaseDownloadTask, + etag: String, + isContinue: Boolean, + soFarBytes: Int, + totalBytes: Int + ) { + super.connected(task, etag, isContinue, soFarBytes, totalBytes) + LogUtils.e("EnterpriseInformationForTypeAct","connected${soFarBytes}") + + } + + override fun paused(task: BaseDownloadTask, soFarBytes: Int, totalBytes: Int) { + super.paused(task, soFarBytes, totalBytes) + } + + override fun completed(task: BaseDownloadTask) { + super.completed(task) + loadingView.dismiss() + OpenFilesUtils.openFile(this@EnterpriseInformationForTypeAct, File(filePath)) + } + + override fun warn(task: BaseDownloadTask) { + super.warn(task) + } + }) + } + override fun onDestroy() { + audioUtils.stopPlay() + super.onDestroy() } override fun loadData() { diff --git a/mine/src/main/java/com/zj365/mime/act/SettingNewAct.kt b/mine/src/main/java/com/zj365/mime/act/SettingNewAct.kt index f6f9646..db425be 100644 --- a/mine/src/main/java/com/zj365/mime/act/SettingNewAct.kt +++ b/mine/src/main/java/com/zj365/mime/act/SettingNewAct.kt @@ -137,9 +137,10 @@ class SettingNewAct: BaseVmAct() { // stopService(noneIntent) MyWorkManger.cancelWork() - Const.mainLiveData?.value?.apply { + Const.mainLiveData.value = null + /* Const.mainLiveData?.value?.apply { user?.bluetooth = ""//将蓝牙信息清空 - } + }*/ MMkvHelper.remove(Const.Watch_Device_Type)//清除手表型号 Const.watchType = -1//将手表型号恢复初始值 diff --git a/mine/src/main/java/com/zj365/mime/act/electronicfence/ElectronicAddOrModifyAct.kt b/mine/src/main/java/com/zj365/mime/act/electronicfence/ElectronicAddOrModifyAct.kt index 6f62f2a..b68474c 100644 --- a/mine/src/main/java/com/zj365/mime/act/electronicfence/ElectronicAddOrModifyAct.kt +++ b/mine/src/main/java/com/zj365/mime/act/electronicfence/ElectronicAddOrModifyAct.kt @@ -96,12 +96,14 @@ class ElectronicAddOrModifyAct : BaseVmAct() { binding.llData.visibility = View.GONE binding.llSetting.visibility = View.VISIBLE binding.tvCancel.visibility = View.VISIBLE + binding.tvConfirm.text = "确定" initSettingData() }else { binding.llData.visibility = View.GONE binding.llSetting.visibility = View.VISIBLE binding.tvCancel.visibility = View.VISIBLE binding.tvCancel.text = "删除" + binding.tvConfirm.text = "确定" initModifyData() } @@ -129,7 +131,7 @@ class ElectronicAddOrModifyAct : BaseVmAct() { bean?.let { mViewModel.deleteBtFence(it.id) } - } + }.show() }else{ finish() diff --git a/mine/src/main/java/com/zj365/mime/act/electronicfence/ElectronicFenceSettingAct.kt b/mine/src/main/java/com/zj365/mime/act/electronicfence/ElectronicFenceSettingAct.kt index 70343a5..e88b1f3 100644 --- a/mine/src/main/java/com/zj365/mime/act/electronicfence/ElectronicFenceSettingAct.kt +++ b/mine/src/main/java/com/zj365/mime/act/electronicfence/ElectronicFenceSettingAct.kt @@ -62,6 +62,7 @@ class ElectronicFenceSettingAct : BaseVmAct() { mAdapter.setNewInstance(it.data.list) total = it.data.count binding.tvCount.text ="${it.data.count}/5" + aMap?.clear() var boundsBuilder = LatLngBounds.Builder() it.data.list.forEach { @@ -97,7 +98,7 @@ class ElectronicFenceSettingAct : BaseVmAct() { } } - aMap?.animateCamera(CameraUpdateFactory.newLatLngBounds(boundsBuilder.build(),50)) + aMap?.animateCamera(CameraUpdateFactory.newLatLngBounds(boundsBuilder.build(),300)) } } diff --git a/mine/src/main/java/com/zj365/mime/adapter/EnterpriseInformationAdapter.kt b/mine/src/main/java/com/zj365/mime/adapter/EnterpriseInformationAdapter.kt index ac11f82..ec638f7 100644 --- a/mine/src/main/java/com/zj365/mime/adapter/EnterpriseInformationAdapter.kt +++ b/mine/src/main/java/com/zj365/mime/adapter/EnterpriseInformationAdapter.kt @@ -1,11 +1,23 @@ package com.zj365.mime.adapter +import android.graphics.Rect +import android.os.Bundle +import android.text.TextUtils import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView import com.chad.library.adapter.base.viewholder.BaseViewHolder +import com.liulishuo.filedownloader.BaseDownloadTask +import com.liulishuo.filedownloader.FileDownloadSampleListener +import com.liulishuo.filedownloader.FileDownloader +import com.liulishuo.filedownloader.util.FileDownloadUtils import com.xty.base.adapter.BaseAdapter +import com.xty.common.LogUtils +import com.xty.common.arouter.ARouterUrl +import com.xty.common.arouter.RouteManager +import com.xty.common.util.OpenFilesUtils import com.xty.network.model.EnterpriseInfoHomeBean import com.zj365.mime.R +import java.io.File class EnterpriseInformationAdapter : BaseAdapter(R.layout.item_enterprise_info) { @@ -18,8 +30,158 @@ class EnterpriseInformationAdapter : BaseAdapter(R.layou recyclerView.layoutManager = LinearLayoutManager(context) recyclerView.adapter = mAdapter + + recyclerView.addItemDecoration(object : RecyclerView.ItemDecoration() { + override fun getItemOffsets(outRect: Rect, itemPosition: Int, parent: RecyclerView) { + super.getItemOffsets(outRect, itemPosition, parent) + outRect.bottom = 12 + } + }) + + mAdapter.setOnItemClickListener { adapter, view, position -> + LogUtils.e("EnterpriseInformationAdapter","position:${position}") + + var bean = adapter.data[position] as EnterpriseInfoHomeBean.EnterpriseInfoChildBean + var filePath: String? = null + + when(bean.fileFormat){ // 格式1,word,2,pdf,3.文本,4.excel,5.音频。6.链接 + 1->{ + + if (!TextUtils.isEmpty(bean.fileUrl)){ + filePath = FileDownloadUtils.getDefaultSaveRootPath() + File.separator + "zj365" + File.separator + "${bean.title}.word" + var file = File(filePath) + if (file.exists()){ + file.delete() + } + + createDownloadTask(filePath,bean.fileUrl,bean.fileFormat)!!.start() + } + + } + + 2->{ + + if (!TextUtils.isEmpty(bean.fileUrl)){ + filePath = FileDownloadUtils.getDefaultSaveRootPath() + File.separator + "zj365" + File.separator + "${bean.title}.pdf" + var file = File(filePath) + if (file.exists()){ + file.delete() + } + + LogUtils.e("EnterpriseInformationForTypeAct","filePath${filePath}") + + createDownloadTask(filePath,bean.fileUrl,bean.fileFormat)!!.start() + } + } + 3 ->{ + + if (!TextUtils.isEmpty(bean.fileUrl)){ + filePath = FileDownloadUtils.getDefaultSaveRootPath() + File.separator + "zj365" + File.separator + "${bean.title}.txt" + var file = File(filePath) + if (file.exists()){ + file.delete() + } + + LogUtils.e("EnterpriseInformationForTypeAct","filePath${filePath}") + + createDownloadTask(filePath,bean.fileUrl,bean.fileFormat)!!.start() + } + + + } + 4->{ + if (!TextUtils.isEmpty(bean.fileUrl)){ + filePath = FileDownloadUtils.getDefaultSaveRootPath() + File.separator + "zj365" + File.separator + "${bean.title}.xlsx" + var file = File(filePath) + if (file.exists()){ + file.delete() + } + + LogUtils.e("EnterpriseInformationForTypeAct","filePath${filePath}") + + createDownloadTask(filePath,bean.fileUrl,bean.fileFormat)!!.start() + } + } + 5->{ + if (!TextUtils.isEmpty(bean.fileUrl)){ + filePath = FileDownloadUtils.getDefaultSaveRootPath() + File.separator + "zj365" + File.separator + "${bean.title}.mp3" + var file = File(filePath) + if (file.exists()){ + file.delete() + } + + LogUtils.e("EnterpriseInformationForTypeAct","filePath${filePath}") + + createDownloadTask(filePath,bean.fileUrl,bean.fileFormat)!!.start() + } + + } + + 6->{ + if (!TextUtils.isEmpty(bean.fileUrl)){ + var bundle = Bundle() + bundle.putString( + "web_site_url", + "${bean.fileUrl}" + ) + RouteManager.goAct(ARouterUrl.H5_ACT,bundle) + } + } + } + } + mAdapter.setNewInstance(item.list) + } + + + private fun createDownloadTask(filePath: String,url:String,fileFormat:Int): BaseDownloadTask? { + var isDir = false + return FileDownloader.getImpl().create(url) + .setPath(filePath, false) + .setCallbackProgressTimes(300) + .setMinIntervalUpdateSpeed(400) + .setTag(this) + .setListener(object : FileDownloadSampleListener() { + override fun pending(task: BaseDownloadTask, soFarBytes: Int, totalBytes: Int) { + super.pending(task, soFarBytes, totalBytes) + LogUtils.e("EnterpriseInformationForTypeAct","pending${soFarBytes}") + + } + + override fun progress(task: BaseDownloadTask, soFarBytes: Int, totalBytes: Int) { + super.progress(task, soFarBytes, totalBytes) + + LogUtils.e("EnterpriseInformationForTypeAct","progress${soFarBytes}") + } + + override fun error(task: BaseDownloadTask, e: Throwable) { + super.error(task, e) + } + + override fun connected( + task: BaseDownloadTask, + etag: String, + isContinue: Boolean, + soFarBytes: Int, + totalBytes: Int + ) { + super.connected(task, etag, isContinue, soFarBytes, totalBytes) + LogUtils.e("EnterpriseInformationForTypeAct","connected${soFarBytes}") + + } + + override fun paused(task: BaseDownloadTask, soFarBytes: Int, totalBytes: Int) { + super.paused(task, soFarBytes, totalBytes) + } + override fun completed(task: BaseDownloadTask) { + super.completed(task) + OpenFilesUtils.openFile(context, File(filePath)) + } + override fun warn(task: BaseDownloadTask) { + super.warn(task) + } + }) } } \ No newline at end of file diff --git a/mine/src/main/res/layout/act_enterprise_information_type.xml b/mine/src/main/res/layout/act_enterprise_information_type.xml index 1e504bd..e8dd3f4 100644 --- a/mine/src/main/res/layout/act_enterprise_information_type.xml +++ b/mine/src/main/res/layout/act_enterprise_information_type.xml @@ -24,8 +24,9 @@ android:layout_marginTop="@dimen/dp_10" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginLeft="@dimen/dp_20" - android:layout_marginRight="@dimen/dp_20" + android:layout_marginLeft="@dimen/dp_15" + android:background="@drawable/shape_round_white" + android:layout_marginRight="@dimen/dp_15" android:overScrollMode="never" /> /** @@ -1947,4 +1947,16 @@ interface ApiInterface { */ @POST("customer/user/getIsCoupons") suspend fun hasCoupons() : RespBody + + /** + * 订单物流 + */ + @GET("customer/mall/order/experss") + suspend fun getLogistics(@Query ("orderId") orderId:Long): RespBody + + /** + * 计算订单金额 + */ + @POST("customer/mall/order/computeAmount") + suspend fun computeAmount(@Body rb: RequestBody): RespBody } \ No newline at end of file diff --git a/network/src/main/java/com/xty/network/TokenIntercept.kt b/network/src/main/java/com/xty/network/TokenIntercept.kt index 953834d..24bddfa 100644 --- a/network/src/main/java/com/xty/network/TokenIntercept.kt +++ b/network/src/main/java/com/xty/network/TokenIntercept.kt @@ -1,7 +1,9 @@ package com.xty.network +import android.os.Build import android.util.Log import com.tencent.mmkv.MMKV +import com.xty.network.utils.AppUtils import com.xty.network.utils.NetWorkLogUtils import com.youth.banner.util.LogUtils import okhttp3.Interceptor @@ -22,7 +24,12 @@ class TokenIntercept:Interceptor { newBuilder.header("auth-token",mmkv!!.decodeString("Auth-Token")!!) newBuilder.header("auth-id",mmkv!!.decodeString("Auth-Id")!!) newBuilder.header("mark",MyRetrofit.get().BLUETOOTH_MAC) + newBuilder.header("appVersion", "${mmkv!!.decodeString("appVersion")!!}") + newBuilder.header("versionCode", "${mmkv!!.decodeInt("version_code")!!}") + } + + newBuilder.header("sourceBazaar","Android") //newBuilder.header("company", Const.COMPANY) newBuilder.addHeader("Content-Type", "application/json; charset=utf-8") val build = newBuilder.build() diff --git a/network/src/main/java/com/xty/network/model/EnterpriseInfoHomeBean.kt b/network/src/main/java/com/xty/network/model/EnterpriseInfoHomeBean.kt index 5e93677..08d5006 100644 --- a/network/src/main/java/com/xty/network/model/EnterpriseInfoHomeBean.kt +++ b/network/src/main/java/com/xty/network/model/EnterpriseInfoHomeBean.kt @@ -12,10 +12,10 @@ data class EnterpriseInfoHomeBean( data class EnterpriseInfoChildBean( var title:String, var id:Long, - var fileFormat:Int, + var fileFormat:Int,// 格式1,word,2,pdf,3.文本,4.excel,5.音频。6.链接 var type:Int, var pic:String, - var fileUrl:String, + var fileUrl:String,//附件地址或链接 var contentText:String, var createTime:String ) diff --git a/network/src/main/java/com/xty/network/model/GoodsLogisticsBean.kt b/network/src/main/java/com/xty/network/model/GoodsLogisticsBean.kt new file mode 100644 index 0000000..554d20e --- /dev/null +++ b/network/src/main/java/com/xty/network/model/GoodsLogisticsBean.kt @@ -0,0 +1,19 @@ +package com.xty.network.model + +data class GoodsLogisticsBean ( + var express_sn:String, + var address:String, + var express_name:String, + var data:ArrayList + +){ + + data class LogisticsBean( + var address:String, + var context:String, + var location:String, + var time:String, + var status:Int + ) + +} \ No newline at end of file diff --git a/network/src/main/java/com/xty/network/model/HealthArchiveBean.kt b/network/src/main/java/com/xty/network/model/HealthArchiveBean.kt index 831cd79..68edf9d 100644 --- a/network/src/main/java/com/xty/network/model/HealthArchiveBean.kt +++ b/network/src/main/java/com/xty/network/model/HealthArchiveBean.kt @@ -3,8 +3,20 @@ package com.xty.network.model data class HealthArchiveBean( var bmiInfo:BMIInfo, var healData:ArrayList, - var bmr:String, - var bmi:String){ + var bmr:String, //bmr值 + + var bmi:String, + var userSchedule:Int,//完善进度 + var bodyFat:String, //体脂率 + var surveys:SurveysBean + +){ data class BMIInfo(var levelName:String,var bmi:Float) + + data class SurveysBean( + var score:Int, + var list:ArrayList) + + data class SurveysInfoBean(var id:Long,var type:Int,var surveysId:Long,var name:String,var status:Int) } diff --git a/network/src/main/java/com/xty/network/utils/AppUtils.kt b/network/src/main/java/com/xty/network/utils/AppUtils.kt new file mode 100644 index 0000000..90ec2c4 --- /dev/null +++ b/network/src/main/java/com/xty/network/utils/AppUtils.kt @@ -0,0 +1,37 @@ +package com.xty.network.utils + +import android.content.Context +import android.content.pm.PackageInfo +import android.content.pm.PackageManager + +object AppUtils { + + fun getVersionCode( context: Context) :Int{ + var packageInfo = getPackagesInfo(context) + if (packageInfo != null){ + return packageInfo!!.versionCode + }else{ + return -1 + } + } + + fun getPackagesInfo( context:Context) : PackageInfo ?{ + try { + return context.packageManager.getPackageInfo(context.packageName, 0); + } catch ( e: PackageManager.NameNotFoundException) { + e.printStackTrace(); + } + return null; + } + + + fun getPackageVersionName(context:Context):String { + var packageInfo = getPackagesInfo(context) + if (packageInfo != null){ + return packageInfo!!.versionName + }else{ + return "" + } + } + +} \ No newline at end of file