diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 3892b5a..02160cd 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -34,16 +34,18 @@ - - - - - - - + + + + + + + + + - - - - - - - + + + + + + + + + +) : RecyclerView.Adapter() { + + private var layoutInflater: LayoutInflater = LayoutInflater.from(context) + + override fun getItemCount(): Int = dataRows.size + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = ItemViewHolder( + layoutInflater.inflate(R.layout.item_equipment_rv_l, parent, false) + ) + + override fun onBindViewHolder(holder: ItemViewHolder, position: Int) { + //绑定数据 + val rowsBean = dataRows[position] + holder.equipmentNameView.text = rowsBean.equipmentName + holder.equipmentCodeView.text = rowsBean.equipmentNo + holder.equipmentDateView.text = rowsBean.enableDate + holder.equipmentLibView.text = rowsBean.useDeptName + + //绑定事件 + holder.itemView.setOnClickListener { + listener?.onItemClicked(position) + } + } + + inner class ItemViewHolder(view: View) : RecyclerView.ViewHolder(view) { + var equipmentNameView: TextView = view.findViewById(R.id.equipmentNameView) + var equipmentCodeView: TextView = view.findViewById(R.id.equipmentCodeView) + var equipmentDateView: TextView = view.findViewById(R.id.equipmentDateView) + var equipmentLibView: TextView = view.findViewById(R.id.equipmentLibView) + } + + private var listener: OnItemClickListener? = null + + interface OnItemClickListener { + fun onItemClicked(position: Int) + } + + fun setOnItemClickListener(onClickListener: OnItemClickListener?) { + this.listener = onClickListener + } +} \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 3892b5a..02160cd 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -34,16 +34,18 @@ - - - - - - - + + + + + + + + + +) : RecyclerView.Adapter() { + + private var layoutInflater: LayoutInflater = LayoutInflater.from(context) + + override fun getItemCount(): Int = dataRows.size + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = ItemViewHolder( + layoutInflater.inflate(R.layout.item_equipment_rv_l, parent, false) + ) + + override fun onBindViewHolder(holder: ItemViewHolder, position: Int) { + //绑定数据 + val rowsBean = dataRows[position] + holder.equipmentNameView.text = rowsBean.equipmentName + holder.equipmentCodeView.text = rowsBean.equipmentNo + holder.equipmentDateView.text = rowsBean.enableDate + holder.equipmentLibView.text = rowsBean.useDeptName + + //绑定事件 + holder.itemView.setOnClickListener { + listener?.onItemClicked(position) + } + } + + inner class ItemViewHolder(view: View) : RecyclerView.ViewHolder(view) { + var equipmentNameView: TextView = view.findViewById(R.id.equipmentNameView) + var equipmentCodeView: TextView = view.findViewById(R.id.equipmentCodeView) + var equipmentDateView: TextView = view.findViewById(R.id.equipmentDateView) + var equipmentLibView: TextView = view.findViewById(R.id.equipmentLibView) + } + + private var listener: OnItemClickListener? = null + + interface OnItemClickListener { + fun onItemClicked(position: Int) + } + + fun setOnItemClickListener(onClickListener: OnItemClickListener?) { + this.listener = onClickListener + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt index b4628f3..d970b55 100644 --- a/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt +++ b/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt @@ -5,7 +5,8 @@ import com.casic.xz.meterage.R import com.casic.xz.meterage.adapter.HomeGridAdapter import com.casic.xz.meterage.utils.LocaleConstant -import com.casic.xz.meterage.view.NoticeListActivity +import com.casic.xz.meterage.view.home.EquipmentActivity +import com.casic.xz.meterage.view.notice.NoticeListActivity import com.casic.xz.meterage.vm.NoticeViewModel import com.pengxh.kt.lite.base.KotlinBaseFragment import com.pengxh.kt.lite.extensions.navigatePageTo @@ -36,8 +37,19 @@ homeFuncRecyclerView.adapter = homeAdapter homeAdapter.setOnGridItemClickListener(object : HomeGridAdapter.OnGridItemClickListener { override fun onItemClick(position: Int) { - when (position) { - + when (LocaleConstant.HOME_FUNC_OPERATE[position]) { + "仪器设备" -> requireContext().navigatePageTo() +// "标准装置" -> requireContext().navigatePageTo() +// "证书报告" -> requireContext().navigatePageTo() +// "委托需求" -> requireContext().navigatePageTo() +// "访客" -> requireContext().navigatePageTo() +// "标准规范" -> requireContext().navigatePageTo() +// "能力列表" -> requireContext().navigatePageTo() +// "计量培训" -> requireContext().navigatePageTo() +// "合同发票" -> requireContext().navigatePageTo() +// "业务统计" -> requireContext().navigatePageTo() +// "客户列表" -> requireContext().navigatePageTo() +// "外场检测" -> requireContext().navigatePageTo() } } }) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 3892b5a..02160cd 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -34,16 +34,18 @@ - - - - - - - + + + + + + + + + +) : RecyclerView.Adapter() { + + private var layoutInflater: LayoutInflater = LayoutInflater.from(context) + + override fun getItemCount(): Int = dataRows.size + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = ItemViewHolder( + layoutInflater.inflate(R.layout.item_equipment_rv_l, parent, false) + ) + + override fun onBindViewHolder(holder: ItemViewHolder, position: Int) { + //绑定数据 + val rowsBean = dataRows[position] + holder.equipmentNameView.text = rowsBean.equipmentName + holder.equipmentCodeView.text = rowsBean.equipmentNo + holder.equipmentDateView.text = rowsBean.enableDate + holder.equipmentLibView.text = rowsBean.useDeptName + + //绑定事件 + holder.itemView.setOnClickListener { + listener?.onItemClicked(position) + } + } + + inner class ItemViewHolder(view: View) : RecyclerView.ViewHolder(view) { + var equipmentNameView: TextView = view.findViewById(R.id.equipmentNameView) + var equipmentCodeView: TextView = view.findViewById(R.id.equipmentCodeView) + var equipmentDateView: TextView = view.findViewById(R.id.equipmentDateView) + var equipmentLibView: TextView = view.findViewById(R.id.equipmentLibView) + } + + private var listener: OnItemClickListener? = null + + interface OnItemClickListener { + fun onItemClicked(position: Int) + } + + fun setOnItemClickListener(onClickListener: OnItemClickListener?) { + this.listener = onClickListener + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt index b4628f3..d970b55 100644 --- a/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt +++ b/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt @@ -5,7 +5,8 @@ import com.casic.xz.meterage.R import com.casic.xz.meterage.adapter.HomeGridAdapter import com.casic.xz.meterage.utils.LocaleConstant -import com.casic.xz.meterage.view.NoticeListActivity +import com.casic.xz.meterage.view.home.EquipmentActivity +import com.casic.xz.meterage.view.notice.NoticeListActivity import com.casic.xz.meterage.vm.NoticeViewModel import com.pengxh.kt.lite.base.KotlinBaseFragment import com.pengxh.kt.lite.extensions.navigatePageTo @@ -36,8 +37,19 @@ homeFuncRecyclerView.adapter = homeAdapter homeAdapter.setOnGridItemClickListener(object : HomeGridAdapter.OnGridItemClickListener { override fun onItemClick(position: Int) { - when (position) { - + when (LocaleConstant.HOME_FUNC_OPERATE[position]) { + "仪器设备" -> requireContext().navigatePageTo() +// "标准装置" -> requireContext().navigatePageTo() +// "证书报告" -> requireContext().navigatePageTo() +// "委托需求" -> requireContext().navigatePageTo() +// "访客" -> requireContext().navigatePageTo() +// "标准规范" -> requireContext().navigatePageTo() +// "能力列表" -> requireContext().navigatePageTo() +// "计量培训" -> requireContext().navigatePageTo() +// "合同发票" -> requireContext().navigatePageTo() +// "业务统计" -> requireContext().navigatePageTo() +// "客户列表" -> requireContext().navigatePageTo() +// "外场检测" -> requireContext().navigatePageTo() } } }) diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt index 7e75abe..56dc5ec 100644 --- a/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt +++ b/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt @@ -2,9 +2,11 @@ import android.view.View import androidx.lifecycle.ViewModelProvider +import com.bumptech.glide.Glide +import com.bumptech.glide.request.RequestOptions import com.casic.xz.meterage.R import com.casic.xz.meterage.utils.LocaleConstant -import com.casic.xz.meterage.view.NoticeListActivity +import com.casic.xz.meterage.view.notice.NoticeListActivity import com.casic.xz.meterage.vm.NoticeViewModel import com.casic.xz.meterage.vm.UserViewModel import com.pengxh.kt.lite.base.KotlinBaseFragment @@ -23,6 +25,12 @@ val data = it.data userNameView.text = data.name userUnitView.text = data.deptName + +// Glide.with(requireContext()) +// .load(R.mipmap.default_avatar) +// .apply(RequestOptions.circleCropTransform()) +// .placeholder(R.mipmap.load_image_error) +// .into(userAvatarView) } }) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 3892b5a..02160cd 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -34,16 +34,18 @@ - - - - - - - + + + + + + + + + +) : RecyclerView.Adapter() { + + private var layoutInflater: LayoutInflater = LayoutInflater.from(context) + + override fun getItemCount(): Int = dataRows.size + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = ItemViewHolder( + layoutInflater.inflate(R.layout.item_equipment_rv_l, parent, false) + ) + + override fun onBindViewHolder(holder: ItemViewHolder, position: Int) { + //绑定数据 + val rowsBean = dataRows[position] + holder.equipmentNameView.text = rowsBean.equipmentName + holder.equipmentCodeView.text = rowsBean.equipmentNo + holder.equipmentDateView.text = rowsBean.enableDate + holder.equipmentLibView.text = rowsBean.useDeptName + + //绑定事件 + holder.itemView.setOnClickListener { + listener?.onItemClicked(position) + } + } + + inner class ItemViewHolder(view: View) : RecyclerView.ViewHolder(view) { + var equipmentNameView: TextView = view.findViewById(R.id.equipmentNameView) + var equipmentCodeView: TextView = view.findViewById(R.id.equipmentCodeView) + var equipmentDateView: TextView = view.findViewById(R.id.equipmentDateView) + var equipmentLibView: TextView = view.findViewById(R.id.equipmentLibView) + } + + private var listener: OnItemClickListener? = null + + interface OnItemClickListener { + fun onItemClicked(position: Int) + } + + fun setOnItemClickListener(onClickListener: OnItemClickListener?) { + this.listener = onClickListener + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt index b4628f3..d970b55 100644 --- a/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt +++ b/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt @@ -5,7 +5,8 @@ import com.casic.xz.meterage.R import com.casic.xz.meterage.adapter.HomeGridAdapter import com.casic.xz.meterage.utils.LocaleConstant -import com.casic.xz.meterage.view.NoticeListActivity +import com.casic.xz.meterage.view.home.EquipmentActivity +import com.casic.xz.meterage.view.notice.NoticeListActivity import com.casic.xz.meterage.vm.NoticeViewModel import com.pengxh.kt.lite.base.KotlinBaseFragment import com.pengxh.kt.lite.extensions.navigatePageTo @@ -36,8 +37,19 @@ homeFuncRecyclerView.adapter = homeAdapter homeAdapter.setOnGridItemClickListener(object : HomeGridAdapter.OnGridItemClickListener { override fun onItemClick(position: Int) { - when (position) { - + when (LocaleConstant.HOME_FUNC_OPERATE[position]) { + "仪器设备" -> requireContext().navigatePageTo() +// "标准装置" -> requireContext().navigatePageTo() +// "证书报告" -> requireContext().navigatePageTo() +// "委托需求" -> requireContext().navigatePageTo() +// "访客" -> requireContext().navigatePageTo() +// "标准规范" -> requireContext().navigatePageTo() +// "能力列表" -> requireContext().navigatePageTo() +// "计量培训" -> requireContext().navigatePageTo() +// "合同发票" -> requireContext().navigatePageTo() +// "业务统计" -> requireContext().navigatePageTo() +// "客户列表" -> requireContext().navigatePageTo() +// "外场检测" -> requireContext().navigatePageTo() } } }) diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt index 7e75abe..56dc5ec 100644 --- a/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt +++ b/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt @@ -2,9 +2,11 @@ import android.view.View import androidx.lifecycle.ViewModelProvider +import com.bumptech.glide.Glide +import com.bumptech.glide.request.RequestOptions import com.casic.xz.meterage.R import com.casic.xz.meterage.utils.LocaleConstant -import com.casic.xz.meterage.view.NoticeListActivity +import com.casic.xz.meterage.view.notice.NoticeListActivity import com.casic.xz.meterage.vm.NoticeViewModel import com.casic.xz.meterage.vm.UserViewModel import com.pengxh.kt.lite.base.KotlinBaseFragment @@ -23,6 +25,12 @@ val data = it.data userNameView.text = data.name userUnitView.text = data.deptName + +// Glide.with(requireContext()) +// .load(R.mipmap.default_avatar) +// .apply(RequestOptions.circleCropTransform()) +// .placeholder(R.mipmap.load_image_error) +// .into(userAvatarView) } }) diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt new file mode 100644 index 0000000..cf22646 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt @@ -0,0 +1,103 @@ +package com.casic.xz.meterage.fragment.equipment + +import android.graphics.Paint +import androidx.lifecycle.ViewModelProvider +import com.casic.xz.meterage.R +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.casic.xz.meterage.vm.EquipmentViewModel +import com.pengxh.kt.lite.base.KotlinBaseFragment +import com.pengxh.kt.lite.extensions.convertColor +import com.pengxh.kt.lite.vm.LoadState +import kotlinx.android.synthetic.main.fragment_basic_information.* + +class BasicInformationFragment(private val id: String) : KotlinBaseFragment() { + + private lateinit var equipmentViewModel: EquipmentViewModel + + override fun initData() { + equipmentViewModel = ViewModelProvider(this)[EquipmentViewModel::class.java] + equipmentViewModel.getEquipmentDetail(id) + equipmentViewModel.equipmentDetailResult.observe(this, { + if (it.code == 200) { + val data = it.data!! + + equipmentCodeView.text = data.equipmentNo + equipmentNameView.text = data.equipmentName + manufacturerView.text = data.manufacturer + factoryNumberView.text = data.manufacturingNo + modelView.text = data.modelNo + verificationMethodView.text = data.mesureTypeName + measuringRangeView.text = data.mesureRange + uncertaintyView.text = data.uncertainty + firstUseView.text = data.createTime + originalValueView.text = data.originValue + usageDeptView.text = data.useDeptName + userView.text = data.usePersonName + managementStatusView.text = data.managerStateName + verificationDeptView.text = data.useDeptName +// nextVerificationDeptView.text = data. + verificationPeriodView.text = data.mesureCycle + verificationDateView.text = data.mesureDate + effectiveDateView.text = data.validDate + verificationResultsView.text = data.mesureResultName + abcView.text = data.abcName + isNeedTechnicalView.text = if ( + data.isCalibrationTestEquipment.isNullOrBlank() || data.isCalibrationTestEquipment == "0" + ) { + "否" + } else { + "是" + } + + isStandingBook.text = if ( + data.isMeasureAccount.isNullOrBlank() || data.isMeasureAccount == "0" + ) { + "否" + } else { + "是" + } + + isStandardView.text = if ( + data.isStandardSupportEquipment.isNullOrBlank() || data.isStandardSupportEquipment == "0" + ) { + "否" + } else { + "是" + } + remarkView.text = data.remark + if (data.fileList.size == 0) { + instructionsView.text = "暂无" + } else { + instructionsView.text = "查看附件列表" + val textPaint = instructionsView.paint + textPaint.flags = Paint.UNDERLINE_TEXT_FLAG + textPaint.isAntiAlias = true + instructionsView.setTextColor(R.color.themeColor.convertColor(requireContext())) + + instructionsView.setOnClickListener { + + } + } + } + }) + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_basic_information + + override fun observeRequestState() { + equipmentViewModel.loadState.observe(this, { + when (it) { + LoadState.Loading -> LoadingDialogHub.show(requireActivity(), "数据加载中...") + else -> LoadingDialogHub.dismiss() + } + }) + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 3892b5a..02160cd 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -34,16 +34,18 @@ - - - - - - - + + + + + + + + + +) : RecyclerView.Adapter() { + + private var layoutInflater: LayoutInflater = LayoutInflater.from(context) + + override fun getItemCount(): Int = dataRows.size + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = ItemViewHolder( + layoutInflater.inflate(R.layout.item_equipment_rv_l, parent, false) + ) + + override fun onBindViewHolder(holder: ItemViewHolder, position: Int) { + //绑定数据 + val rowsBean = dataRows[position] + holder.equipmentNameView.text = rowsBean.equipmentName + holder.equipmentCodeView.text = rowsBean.equipmentNo + holder.equipmentDateView.text = rowsBean.enableDate + holder.equipmentLibView.text = rowsBean.useDeptName + + //绑定事件 + holder.itemView.setOnClickListener { + listener?.onItemClicked(position) + } + } + + inner class ItemViewHolder(view: View) : RecyclerView.ViewHolder(view) { + var equipmentNameView: TextView = view.findViewById(R.id.equipmentNameView) + var equipmentCodeView: TextView = view.findViewById(R.id.equipmentCodeView) + var equipmentDateView: TextView = view.findViewById(R.id.equipmentDateView) + var equipmentLibView: TextView = view.findViewById(R.id.equipmentLibView) + } + + private var listener: OnItemClickListener? = null + + interface OnItemClickListener { + fun onItemClicked(position: Int) + } + + fun setOnItemClickListener(onClickListener: OnItemClickListener?) { + this.listener = onClickListener + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt index b4628f3..d970b55 100644 --- a/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt +++ b/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt @@ -5,7 +5,8 @@ import com.casic.xz.meterage.R import com.casic.xz.meterage.adapter.HomeGridAdapter import com.casic.xz.meterage.utils.LocaleConstant -import com.casic.xz.meterage.view.NoticeListActivity +import com.casic.xz.meterage.view.home.EquipmentActivity +import com.casic.xz.meterage.view.notice.NoticeListActivity import com.casic.xz.meterage.vm.NoticeViewModel import com.pengxh.kt.lite.base.KotlinBaseFragment import com.pengxh.kt.lite.extensions.navigatePageTo @@ -36,8 +37,19 @@ homeFuncRecyclerView.adapter = homeAdapter homeAdapter.setOnGridItemClickListener(object : HomeGridAdapter.OnGridItemClickListener { override fun onItemClick(position: Int) { - when (position) { - + when (LocaleConstant.HOME_FUNC_OPERATE[position]) { + "仪器设备" -> requireContext().navigatePageTo() +// "标准装置" -> requireContext().navigatePageTo() +// "证书报告" -> requireContext().navigatePageTo() +// "委托需求" -> requireContext().navigatePageTo() +// "访客" -> requireContext().navigatePageTo() +// "标准规范" -> requireContext().navigatePageTo() +// "能力列表" -> requireContext().navigatePageTo() +// "计量培训" -> requireContext().navigatePageTo() +// "合同发票" -> requireContext().navigatePageTo() +// "业务统计" -> requireContext().navigatePageTo() +// "客户列表" -> requireContext().navigatePageTo() +// "外场检测" -> requireContext().navigatePageTo() } } }) diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt index 7e75abe..56dc5ec 100644 --- a/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt +++ b/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt @@ -2,9 +2,11 @@ import android.view.View import androidx.lifecycle.ViewModelProvider +import com.bumptech.glide.Glide +import com.bumptech.glide.request.RequestOptions import com.casic.xz.meterage.R import com.casic.xz.meterage.utils.LocaleConstant -import com.casic.xz.meterage.view.NoticeListActivity +import com.casic.xz.meterage.view.notice.NoticeListActivity import com.casic.xz.meterage.vm.NoticeViewModel import com.casic.xz.meterage.vm.UserViewModel import com.pengxh.kt.lite.base.KotlinBaseFragment @@ -23,6 +25,12 @@ val data = it.data userNameView.text = data.name userUnitView.text = data.deptName + +// Glide.with(requireContext()) +// .load(R.mipmap.default_avatar) +// .apply(RequestOptions.circleCropTransform()) +// .placeholder(R.mipmap.load_image_error) +// .into(userAvatarView) } }) diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt new file mode 100644 index 0000000..cf22646 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt @@ -0,0 +1,103 @@ +package com.casic.xz.meterage.fragment.equipment + +import android.graphics.Paint +import androidx.lifecycle.ViewModelProvider +import com.casic.xz.meterage.R +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.casic.xz.meterage.vm.EquipmentViewModel +import com.pengxh.kt.lite.base.KotlinBaseFragment +import com.pengxh.kt.lite.extensions.convertColor +import com.pengxh.kt.lite.vm.LoadState +import kotlinx.android.synthetic.main.fragment_basic_information.* + +class BasicInformationFragment(private val id: String) : KotlinBaseFragment() { + + private lateinit var equipmentViewModel: EquipmentViewModel + + override fun initData() { + equipmentViewModel = ViewModelProvider(this)[EquipmentViewModel::class.java] + equipmentViewModel.getEquipmentDetail(id) + equipmentViewModel.equipmentDetailResult.observe(this, { + if (it.code == 200) { + val data = it.data!! + + equipmentCodeView.text = data.equipmentNo + equipmentNameView.text = data.equipmentName + manufacturerView.text = data.manufacturer + factoryNumberView.text = data.manufacturingNo + modelView.text = data.modelNo + verificationMethodView.text = data.mesureTypeName + measuringRangeView.text = data.mesureRange + uncertaintyView.text = data.uncertainty + firstUseView.text = data.createTime + originalValueView.text = data.originValue + usageDeptView.text = data.useDeptName + userView.text = data.usePersonName + managementStatusView.text = data.managerStateName + verificationDeptView.text = data.useDeptName +// nextVerificationDeptView.text = data. + verificationPeriodView.text = data.mesureCycle + verificationDateView.text = data.mesureDate + effectiveDateView.text = data.validDate + verificationResultsView.text = data.mesureResultName + abcView.text = data.abcName + isNeedTechnicalView.text = if ( + data.isCalibrationTestEquipment.isNullOrBlank() || data.isCalibrationTestEquipment == "0" + ) { + "否" + } else { + "是" + } + + isStandingBook.text = if ( + data.isMeasureAccount.isNullOrBlank() || data.isMeasureAccount == "0" + ) { + "否" + } else { + "是" + } + + isStandardView.text = if ( + data.isStandardSupportEquipment.isNullOrBlank() || data.isStandardSupportEquipment == "0" + ) { + "否" + } else { + "是" + } + remarkView.text = data.remark + if (data.fileList.size == 0) { + instructionsView.text = "暂无" + } else { + instructionsView.text = "查看附件列表" + val textPaint = instructionsView.paint + textPaint.flags = Paint.UNDERLINE_TEXT_FLAG + textPaint.isAntiAlias = true + instructionsView.setTextColor(R.color.themeColor.convertColor(requireContext())) + + instructionsView.setOnClickListener { + + } + } + } + }) + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_basic_information + + override fun observeRequestState() { + equipmentViewModel.loadState.observe(this, { + when (it) { + LoadState.Loading -> LoadingDialogHub.show(requireActivity(), "数据加载中...") + else -> LoadingDialogHub.dismiss() + } + }) + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt new file mode 100644 index 0000000..0b4a747 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class CertificateFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_certificate + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 3892b5a..02160cd 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -34,16 +34,18 @@ - - - - - - - + + + + + + + + + +) : RecyclerView.Adapter() { + + private var layoutInflater: LayoutInflater = LayoutInflater.from(context) + + override fun getItemCount(): Int = dataRows.size + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = ItemViewHolder( + layoutInflater.inflate(R.layout.item_equipment_rv_l, parent, false) + ) + + override fun onBindViewHolder(holder: ItemViewHolder, position: Int) { + //绑定数据 + val rowsBean = dataRows[position] + holder.equipmentNameView.text = rowsBean.equipmentName + holder.equipmentCodeView.text = rowsBean.equipmentNo + holder.equipmentDateView.text = rowsBean.enableDate + holder.equipmentLibView.text = rowsBean.useDeptName + + //绑定事件 + holder.itemView.setOnClickListener { + listener?.onItemClicked(position) + } + } + + inner class ItemViewHolder(view: View) : RecyclerView.ViewHolder(view) { + var equipmentNameView: TextView = view.findViewById(R.id.equipmentNameView) + var equipmentCodeView: TextView = view.findViewById(R.id.equipmentCodeView) + var equipmentDateView: TextView = view.findViewById(R.id.equipmentDateView) + var equipmentLibView: TextView = view.findViewById(R.id.equipmentLibView) + } + + private var listener: OnItemClickListener? = null + + interface OnItemClickListener { + fun onItemClicked(position: Int) + } + + fun setOnItemClickListener(onClickListener: OnItemClickListener?) { + this.listener = onClickListener + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt index b4628f3..d970b55 100644 --- a/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt +++ b/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt @@ -5,7 +5,8 @@ import com.casic.xz.meterage.R import com.casic.xz.meterage.adapter.HomeGridAdapter import com.casic.xz.meterage.utils.LocaleConstant -import com.casic.xz.meterage.view.NoticeListActivity +import com.casic.xz.meterage.view.home.EquipmentActivity +import com.casic.xz.meterage.view.notice.NoticeListActivity import com.casic.xz.meterage.vm.NoticeViewModel import com.pengxh.kt.lite.base.KotlinBaseFragment import com.pengxh.kt.lite.extensions.navigatePageTo @@ -36,8 +37,19 @@ homeFuncRecyclerView.adapter = homeAdapter homeAdapter.setOnGridItemClickListener(object : HomeGridAdapter.OnGridItemClickListener { override fun onItemClick(position: Int) { - when (position) { - + when (LocaleConstant.HOME_FUNC_OPERATE[position]) { + "仪器设备" -> requireContext().navigatePageTo() +// "标准装置" -> requireContext().navigatePageTo() +// "证书报告" -> requireContext().navigatePageTo() +// "委托需求" -> requireContext().navigatePageTo() +// "访客" -> requireContext().navigatePageTo() +// "标准规范" -> requireContext().navigatePageTo() +// "能力列表" -> requireContext().navigatePageTo() +// "计量培训" -> requireContext().navigatePageTo() +// "合同发票" -> requireContext().navigatePageTo() +// "业务统计" -> requireContext().navigatePageTo() +// "客户列表" -> requireContext().navigatePageTo() +// "外场检测" -> requireContext().navigatePageTo() } } }) diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt index 7e75abe..56dc5ec 100644 --- a/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt +++ b/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt @@ -2,9 +2,11 @@ import android.view.View import androidx.lifecycle.ViewModelProvider +import com.bumptech.glide.Glide +import com.bumptech.glide.request.RequestOptions import com.casic.xz.meterage.R import com.casic.xz.meterage.utils.LocaleConstant -import com.casic.xz.meterage.view.NoticeListActivity +import com.casic.xz.meterage.view.notice.NoticeListActivity import com.casic.xz.meterage.vm.NoticeViewModel import com.casic.xz.meterage.vm.UserViewModel import com.pengxh.kt.lite.base.KotlinBaseFragment @@ -23,6 +25,12 @@ val data = it.data userNameView.text = data.name userUnitView.text = data.deptName + +// Glide.with(requireContext()) +// .load(R.mipmap.default_avatar) +// .apply(RequestOptions.circleCropTransform()) +// .placeholder(R.mipmap.load_image_error) +// .into(userAvatarView) } }) diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt new file mode 100644 index 0000000..cf22646 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt @@ -0,0 +1,103 @@ +package com.casic.xz.meterage.fragment.equipment + +import android.graphics.Paint +import androidx.lifecycle.ViewModelProvider +import com.casic.xz.meterage.R +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.casic.xz.meterage.vm.EquipmentViewModel +import com.pengxh.kt.lite.base.KotlinBaseFragment +import com.pengxh.kt.lite.extensions.convertColor +import com.pengxh.kt.lite.vm.LoadState +import kotlinx.android.synthetic.main.fragment_basic_information.* + +class BasicInformationFragment(private val id: String) : KotlinBaseFragment() { + + private lateinit var equipmentViewModel: EquipmentViewModel + + override fun initData() { + equipmentViewModel = ViewModelProvider(this)[EquipmentViewModel::class.java] + equipmentViewModel.getEquipmentDetail(id) + equipmentViewModel.equipmentDetailResult.observe(this, { + if (it.code == 200) { + val data = it.data!! + + equipmentCodeView.text = data.equipmentNo + equipmentNameView.text = data.equipmentName + manufacturerView.text = data.manufacturer + factoryNumberView.text = data.manufacturingNo + modelView.text = data.modelNo + verificationMethodView.text = data.mesureTypeName + measuringRangeView.text = data.mesureRange + uncertaintyView.text = data.uncertainty + firstUseView.text = data.createTime + originalValueView.text = data.originValue + usageDeptView.text = data.useDeptName + userView.text = data.usePersonName + managementStatusView.text = data.managerStateName + verificationDeptView.text = data.useDeptName +// nextVerificationDeptView.text = data. + verificationPeriodView.text = data.mesureCycle + verificationDateView.text = data.mesureDate + effectiveDateView.text = data.validDate + verificationResultsView.text = data.mesureResultName + abcView.text = data.abcName + isNeedTechnicalView.text = if ( + data.isCalibrationTestEquipment.isNullOrBlank() || data.isCalibrationTestEquipment == "0" + ) { + "否" + } else { + "是" + } + + isStandingBook.text = if ( + data.isMeasureAccount.isNullOrBlank() || data.isMeasureAccount == "0" + ) { + "否" + } else { + "是" + } + + isStandardView.text = if ( + data.isStandardSupportEquipment.isNullOrBlank() || data.isStandardSupportEquipment == "0" + ) { + "否" + } else { + "是" + } + remarkView.text = data.remark + if (data.fileList.size == 0) { + instructionsView.text = "暂无" + } else { + instructionsView.text = "查看附件列表" + val textPaint = instructionsView.paint + textPaint.flags = Paint.UNDERLINE_TEXT_FLAG + textPaint.isAntiAlias = true + instructionsView.setTextColor(R.color.themeColor.convertColor(requireContext())) + + instructionsView.setOnClickListener { + + } + } + } + }) + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_basic_information + + override fun observeRequestState() { + equipmentViewModel.loadState.observe(this, { + when (it) { + LoadState.Loading -> LoadingDialogHub.show(requireActivity(), "数据加载中...") + else -> LoadingDialogHub.dismiss() + } + }) + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt new file mode 100644 index 0000000..0b4a747 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class CertificateFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_certificate + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt new file mode 100644 index 0000000..f05c491 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class ChangeRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_change_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 3892b5a..02160cd 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -34,16 +34,18 @@ - - - - - - - + + + + + + + + + +) : RecyclerView.Adapter() { + + private var layoutInflater: LayoutInflater = LayoutInflater.from(context) + + override fun getItemCount(): Int = dataRows.size + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = ItemViewHolder( + layoutInflater.inflate(R.layout.item_equipment_rv_l, parent, false) + ) + + override fun onBindViewHolder(holder: ItemViewHolder, position: Int) { + //绑定数据 + val rowsBean = dataRows[position] + holder.equipmentNameView.text = rowsBean.equipmentName + holder.equipmentCodeView.text = rowsBean.equipmentNo + holder.equipmentDateView.text = rowsBean.enableDate + holder.equipmentLibView.text = rowsBean.useDeptName + + //绑定事件 + holder.itemView.setOnClickListener { + listener?.onItemClicked(position) + } + } + + inner class ItemViewHolder(view: View) : RecyclerView.ViewHolder(view) { + var equipmentNameView: TextView = view.findViewById(R.id.equipmentNameView) + var equipmentCodeView: TextView = view.findViewById(R.id.equipmentCodeView) + var equipmentDateView: TextView = view.findViewById(R.id.equipmentDateView) + var equipmentLibView: TextView = view.findViewById(R.id.equipmentLibView) + } + + private var listener: OnItemClickListener? = null + + interface OnItemClickListener { + fun onItemClicked(position: Int) + } + + fun setOnItemClickListener(onClickListener: OnItemClickListener?) { + this.listener = onClickListener + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt index b4628f3..d970b55 100644 --- a/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt +++ b/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt @@ -5,7 +5,8 @@ import com.casic.xz.meterage.R import com.casic.xz.meterage.adapter.HomeGridAdapter import com.casic.xz.meterage.utils.LocaleConstant -import com.casic.xz.meterage.view.NoticeListActivity +import com.casic.xz.meterage.view.home.EquipmentActivity +import com.casic.xz.meterage.view.notice.NoticeListActivity import com.casic.xz.meterage.vm.NoticeViewModel import com.pengxh.kt.lite.base.KotlinBaseFragment import com.pengxh.kt.lite.extensions.navigatePageTo @@ -36,8 +37,19 @@ homeFuncRecyclerView.adapter = homeAdapter homeAdapter.setOnGridItemClickListener(object : HomeGridAdapter.OnGridItemClickListener { override fun onItemClick(position: Int) { - when (position) { - + when (LocaleConstant.HOME_FUNC_OPERATE[position]) { + "仪器设备" -> requireContext().navigatePageTo() +// "标准装置" -> requireContext().navigatePageTo() +// "证书报告" -> requireContext().navigatePageTo() +// "委托需求" -> requireContext().navigatePageTo() +// "访客" -> requireContext().navigatePageTo() +// "标准规范" -> requireContext().navigatePageTo() +// "能力列表" -> requireContext().navigatePageTo() +// "计量培训" -> requireContext().navigatePageTo() +// "合同发票" -> requireContext().navigatePageTo() +// "业务统计" -> requireContext().navigatePageTo() +// "客户列表" -> requireContext().navigatePageTo() +// "外场检测" -> requireContext().navigatePageTo() } } }) diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt index 7e75abe..56dc5ec 100644 --- a/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt +++ b/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt @@ -2,9 +2,11 @@ import android.view.View import androidx.lifecycle.ViewModelProvider +import com.bumptech.glide.Glide +import com.bumptech.glide.request.RequestOptions import com.casic.xz.meterage.R import com.casic.xz.meterage.utils.LocaleConstant -import com.casic.xz.meterage.view.NoticeListActivity +import com.casic.xz.meterage.view.notice.NoticeListActivity import com.casic.xz.meterage.vm.NoticeViewModel import com.casic.xz.meterage.vm.UserViewModel import com.pengxh.kt.lite.base.KotlinBaseFragment @@ -23,6 +25,12 @@ val data = it.data userNameView.text = data.name userUnitView.text = data.deptName + +// Glide.with(requireContext()) +// .load(R.mipmap.default_avatar) +// .apply(RequestOptions.circleCropTransform()) +// .placeholder(R.mipmap.load_image_error) +// .into(userAvatarView) } }) diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt new file mode 100644 index 0000000..cf22646 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt @@ -0,0 +1,103 @@ +package com.casic.xz.meterage.fragment.equipment + +import android.graphics.Paint +import androidx.lifecycle.ViewModelProvider +import com.casic.xz.meterage.R +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.casic.xz.meterage.vm.EquipmentViewModel +import com.pengxh.kt.lite.base.KotlinBaseFragment +import com.pengxh.kt.lite.extensions.convertColor +import com.pengxh.kt.lite.vm.LoadState +import kotlinx.android.synthetic.main.fragment_basic_information.* + +class BasicInformationFragment(private val id: String) : KotlinBaseFragment() { + + private lateinit var equipmentViewModel: EquipmentViewModel + + override fun initData() { + equipmentViewModel = ViewModelProvider(this)[EquipmentViewModel::class.java] + equipmentViewModel.getEquipmentDetail(id) + equipmentViewModel.equipmentDetailResult.observe(this, { + if (it.code == 200) { + val data = it.data!! + + equipmentCodeView.text = data.equipmentNo + equipmentNameView.text = data.equipmentName + manufacturerView.text = data.manufacturer + factoryNumberView.text = data.manufacturingNo + modelView.text = data.modelNo + verificationMethodView.text = data.mesureTypeName + measuringRangeView.text = data.mesureRange + uncertaintyView.text = data.uncertainty + firstUseView.text = data.createTime + originalValueView.text = data.originValue + usageDeptView.text = data.useDeptName + userView.text = data.usePersonName + managementStatusView.text = data.managerStateName + verificationDeptView.text = data.useDeptName +// nextVerificationDeptView.text = data. + verificationPeriodView.text = data.mesureCycle + verificationDateView.text = data.mesureDate + effectiveDateView.text = data.validDate + verificationResultsView.text = data.mesureResultName + abcView.text = data.abcName + isNeedTechnicalView.text = if ( + data.isCalibrationTestEquipment.isNullOrBlank() || data.isCalibrationTestEquipment == "0" + ) { + "否" + } else { + "是" + } + + isStandingBook.text = if ( + data.isMeasureAccount.isNullOrBlank() || data.isMeasureAccount == "0" + ) { + "否" + } else { + "是" + } + + isStandardView.text = if ( + data.isStandardSupportEquipment.isNullOrBlank() || data.isStandardSupportEquipment == "0" + ) { + "否" + } else { + "是" + } + remarkView.text = data.remark + if (data.fileList.size == 0) { + instructionsView.text = "暂无" + } else { + instructionsView.text = "查看附件列表" + val textPaint = instructionsView.paint + textPaint.flags = Paint.UNDERLINE_TEXT_FLAG + textPaint.isAntiAlias = true + instructionsView.setTextColor(R.color.themeColor.convertColor(requireContext())) + + instructionsView.setOnClickListener { + + } + } + } + }) + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_basic_information + + override fun observeRequestState() { + equipmentViewModel.loadState.observe(this, { + when (it) { + LoadState.Loading -> LoadingDialogHub.show(requireActivity(), "数据加载中...") + else -> LoadingDialogHub.dismiss() + } + }) + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt new file mode 100644 index 0000000..0b4a747 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class CertificateFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_certificate + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt new file mode 100644 index 0000000..f05c491 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class ChangeRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_change_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt new file mode 100644 index 0000000..849ffa5 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class InspectionRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_inspection_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 3892b5a..02160cd 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -34,16 +34,18 @@ - - - - - - - + + + + + + + + + +) : RecyclerView.Adapter() { + + private var layoutInflater: LayoutInflater = LayoutInflater.from(context) + + override fun getItemCount(): Int = dataRows.size + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = ItemViewHolder( + layoutInflater.inflate(R.layout.item_equipment_rv_l, parent, false) + ) + + override fun onBindViewHolder(holder: ItemViewHolder, position: Int) { + //绑定数据 + val rowsBean = dataRows[position] + holder.equipmentNameView.text = rowsBean.equipmentName + holder.equipmentCodeView.text = rowsBean.equipmentNo + holder.equipmentDateView.text = rowsBean.enableDate + holder.equipmentLibView.text = rowsBean.useDeptName + + //绑定事件 + holder.itemView.setOnClickListener { + listener?.onItemClicked(position) + } + } + + inner class ItemViewHolder(view: View) : RecyclerView.ViewHolder(view) { + var equipmentNameView: TextView = view.findViewById(R.id.equipmentNameView) + var equipmentCodeView: TextView = view.findViewById(R.id.equipmentCodeView) + var equipmentDateView: TextView = view.findViewById(R.id.equipmentDateView) + var equipmentLibView: TextView = view.findViewById(R.id.equipmentLibView) + } + + private var listener: OnItemClickListener? = null + + interface OnItemClickListener { + fun onItemClicked(position: Int) + } + + fun setOnItemClickListener(onClickListener: OnItemClickListener?) { + this.listener = onClickListener + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt index b4628f3..d970b55 100644 --- a/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt +++ b/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt @@ -5,7 +5,8 @@ import com.casic.xz.meterage.R import com.casic.xz.meterage.adapter.HomeGridAdapter import com.casic.xz.meterage.utils.LocaleConstant -import com.casic.xz.meterage.view.NoticeListActivity +import com.casic.xz.meterage.view.home.EquipmentActivity +import com.casic.xz.meterage.view.notice.NoticeListActivity import com.casic.xz.meterage.vm.NoticeViewModel import com.pengxh.kt.lite.base.KotlinBaseFragment import com.pengxh.kt.lite.extensions.navigatePageTo @@ -36,8 +37,19 @@ homeFuncRecyclerView.adapter = homeAdapter homeAdapter.setOnGridItemClickListener(object : HomeGridAdapter.OnGridItemClickListener { override fun onItemClick(position: Int) { - when (position) { - + when (LocaleConstant.HOME_FUNC_OPERATE[position]) { + "仪器设备" -> requireContext().navigatePageTo() +// "标准装置" -> requireContext().navigatePageTo() +// "证书报告" -> requireContext().navigatePageTo() +// "委托需求" -> requireContext().navigatePageTo() +// "访客" -> requireContext().navigatePageTo() +// "标准规范" -> requireContext().navigatePageTo() +// "能力列表" -> requireContext().navigatePageTo() +// "计量培训" -> requireContext().navigatePageTo() +// "合同发票" -> requireContext().navigatePageTo() +// "业务统计" -> requireContext().navigatePageTo() +// "客户列表" -> requireContext().navigatePageTo() +// "外场检测" -> requireContext().navigatePageTo() } } }) diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt index 7e75abe..56dc5ec 100644 --- a/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt +++ b/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt @@ -2,9 +2,11 @@ import android.view.View import androidx.lifecycle.ViewModelProvider +import com.bumptech.glide.Glide +import com.bumptech.glide.request.RequestOptions import com.casic.xz.meterage.R import com.casic.xz.meterage.utils.LocaleConstant -import com.casic.xz.meterage.view.NoticeListActivity +import com.casic.xz.meterage.view.notice.NoticeListActivity import com.casic.xz.meterage.vm.NoticeViewModel import com.casic.xz.meterage.vm.UserViewModel import com.pengxh.kt.lite.base.KotlinBaseFragment @@ -23,6 +25,12 @@ val data = it.data userNameView.text = data.name userUnitView.text = data.deptName + +// Glide.with(requireContext()) +// .load(R.mipmap.default_avatar) +// .apply(RequestOptions.circleCropTransform()) +// .placeholder(R.mipmap.load_image_error) +// .into(userAvatarView) } }) diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt new file mode 100644 index 0000000..cf22646 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt @@ -0,0 +1,103 @@ +package com.casic.xz.meterage.fragment.equipment + +import android.graphics.Paint +import androidx.lifecycle.ViewModelProvider +import com.casic.xz.meterage.R +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.casic.xz.meterage.vm.EquipmentViewModel +import com.pengxh.kt.lite.base.KotlinBaseFragment +import com.pengxh.kt.lite.extensions.convertColor +import com.pengxh.kt.lite.vm.LoadState +import kotlinx.android.synthetic.main.fragment_basic_information.* + +class BasicInformationFragment(private val id: String) : KotlinBaseFragment() { + + private lateinit var equipmentViewModel: EquipmentViewModel + + override fun initData() { + equipmentViewModel = ViewModelProvider(this)[EquipmentViewModel::class.java] + equipmentViewModel.getEquipmentDetail(id) + equipmentViewModel.equipmentDetailResult.observe(this, { + if (it.code == 200) { + val data = it.data!! + + equipmentCodeView.text = data.equipmentNo + equipmentNameView.text = data.equipmentName + manufacturerView.text = data.manufacturer + factoryNumberView.text = data.manufacturingNo + modelView.text = data.modelNo + verificationMethodView.text = data.mesureTypeName + measuringRangeView.text = data.mesureRange + uncertaintyView.text = data.uncertainty + firstUseView.text = data.createTime + originalValueView.text = data.originValue + usageDeptView.text = data.useDeptName + userView.text = data.usePersonName + managementStatusView.text = data.managerStateName + verificationDeptView.text = data.useDeptName +// nextVerificationDeptView.text = data. + verificationPeriodView.text = data.mesureCycle + verificationDateView.text = data.mesureDate + effectiveDateView.text = data.validDate + verificationResultsView.text = data.mesureResultName + abcView.text = data.abcName + isNeedTechnicalView.text = if ( + data.isCalibrationTestEquipment.isNullOrBlank() || data.isCalibrationTestEquipment == "0" + ) { + "否" + } else { + "是" + } + + isStandingBook.text = if ( + data.isMeasureAccount.isNullOrBlank() || data.isMeasureAccount == "0" + ) { + "否" + } else { + "是" + } + + isStandardView.text = if ( + data.isStandardSupportEquipment.isNullOrBlank() || data.isStandardSupportEquipment == "0" + ) { + "否" + } else { + "是" + } + remarkView.text = data.remark + if (data.fileList.size == 0) { + instructionsView.text = "暂无" + } else { + instructionsView.text = "查看附件列表" + val textPaint = instructionsView.paint + textPaint.flags = Paint.UNDERLINE_TEXT_FLAG + textPaint.isAntiAlias = true + instructionsView.setTextColor(R.color.themeColor.convertColor(requireContext())) + + instructionsView.setOnClickListener { + + } + } + } + }) + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_basic_information + + override fun observeRequestState() { + equipmentViewModel.loadState.observe(this, { + when (it) { + LoadState.Loading -> LoadingDialogHub.show(requireActivity(), "数据加载中...") + else -> LoadingDialogHub.dismiss() + } + }) + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt new file mode 100644 index 0000000..0b4a747 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class CertificateFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_certificate + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt new file mode 100644 index 0000000..f05c491 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class ChangeRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_change_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt new file mode 100644 index 0000000..849ffa5 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class InspectionRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_inspection_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt new file mode 100644 index 0000000..aa4edd9 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class UsageRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_usage_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 3892b5a..02160cd 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -34,16 +34,18 @@ - - - - - - - + + + + + + + + + +) : RecyclerView.Adapter() { + + private var layoutInflater: LayoutInflater = LayoutInflater.from(context) + + override fun getItemCount(): Int = dataRows.size + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = ItemViewHolder( + layoutInflater.inflate(R.layout.item_equipment_rv_l, parent, false) + ) + + override fun onBindViewHolder(holder: ItemViewHolder, position: Int) { + //绑定数据 + val rowsBean = dataRows[position] + holder.equipmentNameView.text = rowsBean.equipmentName + holder.equipmentCodeView.text = rowsBean.equipmentNo + holder.equipmentDateView.text = rowsBean.enableDate + holder.equipmentLibView.text = rowsBean.useDeptName + + //绑定事件 + holder.itemView.setOnClickListener { + listener?.onItemClicked(position) + } + } + + inner class ItemViewHolder(view: View) : RecyclerView.ViewHolder(view) { + var equipmentNameView: TextView = view.findViewById(R.id.equipmentNameView) + var equipmentCodeView: TextView = view.findViewById(R.id.equipmentCodeView) + var equipmentDateView: TextView = view.findViewById(R.id.equipmentDateView) + var equipmentLibView: TextView = view.findViewById(R.id.equipmentLibView) + } + + private var listener: OnItemClickListener? = null + + interface OnItemClickListener { + fun onItemClicked(position: Int) + } + + fun setOnItemClickListener(onClickListener: OnItemClickListener?) { + this.listener = onClickListener + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt index b4628f3..d970b55 100644 --- a/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt +++ b/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt @@ -5,7 +5,8 @@ import com.casic.xz.meterage.R import com.casic.xz.meterage.adapter.HomeGridAdapter import com.casic.xz.meterage.utils.LocaleConstant -import com.casic.xz.meterage.view.NoticeListActivity +import com.casic.xz.meterage.view.home.EquipmentActivity +import com.casic.xz.meterage.view.notice.NoticeListActivity import com.casic.xz.meterage.vm.NoticeViewModel import com.pengxh.kt.lite.base.KotlinBaseFragment import com.pengxh.kt.lite.extensions.navigatePageTo @@ -36,8 +37,19 @@ homeFuncRecyclerView.adapter = homeAdapter homeAdapter.setOnGridItemClickListener(object : HomeGridAdapter.OnGridItemClickListener { override fun onItemClick(position: Int) { - when (position) { - + when (LocaleConstant.HOME_FUNC_OPERATE[position]) { + "仪器设备" -> requireContext().navigatePageTo() +// "标准装置" -> requireContext().navigatePageTo() +// "证书报告" -> requireContext().navigatePageTo() +// "委托需求" -> requireContext().navigatePageTo() +// "访客" -> requireContext().navigatePageTo() +// "标准规范" -> requireContext().navigatePageTo() +// "能力列表" -> requireContext().navigatePageTo() +// "计量培训" -> requireContext().navigatePageTo() +// "合同发票" -> requireContext().navigatePageTo() +// "业务统计" -> requireContext().navigatePageTo() +// "客户列表" -> requireContext().navigatePageTo() +// "外场检测" -> requireContext().navigatePageTo() } } }) diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt index 7e75abe..56dc5ec 100644 --- a/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt +++ b/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt @@ -2,9 +2,11 @@ import android.view.View import androidx.lifecycle.ViewModelProvider +import com.bumptech.glide.Glide +import com.bumptech.glide.request.RequestOptions import com.casic.xz.meterage.R import com.casic.xz.meterage.utils.LocaleConstant -import com.casic.xz.meterage.view.NoticeListActivity +import com.casic.xz.meterage.view.notice.NoticeListActivity import com.casic.xz.meterage.vm.NoticeViewModel import com.casic.xz.meterage.vm.UserViewModel import com.pengxh.kt.lite.base.KotlinBaseFragment @@ -23,6 +25,12 @@ val data = it.data userNameView.text = data.name userUnitView.text = data.deptName + +// Glide.with(requireContext()) +// .load(R.mipmap.default_avatar) +// .apply(RequestOptions.circleCropTransform()) +// .placeholder(R.mipmap.load_image_error) +// .into(userAvatarView) } }) diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt new file mode 100644 index 0000000..cf22646 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt @@ -0,0 +1,103 @@ +package com.casic.xz.meterage.fragment.equipment + +import android.graphics.Paint +import androidx.lifecycle.ViewModelProvider +import com.casic.xz.meterage.R +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.casic.xz.meterage.vm.EquipmentViewModel +import com.pengxh.kt.lite.base.KotlinBaseFragment +import com.pengxh.kt.lite.extensions.convertColor +import com.pengxh.kt.lite.vm.LoadState +import kotlinx.android.synthetic.main.fragment_basic_information.* + +class BasicInformationFragment(private val id: String) : KotlinBaseFragment() { + + private lateinit var equipmentViewModel: EquipmentViewModel + + override fun initData() { + equipmentViewModel = ViewModelProvider(this)[EquipmentViewModel::class.java] + equipmentViewModel.getEquipmentDetail(id) + equipmentViewModel.equipmentDetailResult.observe(this, { + if (it.code == 200) { + val data = it.data!! + + equipmentCodeView.text = data.equipmentNo + equipmentNameView.text = data.equipmentName + manufacturerView.text = data.manufacturer + factoryNumberView.text = data.manufacturingNo + modelView.text = data.modelNo + verificationMethodView.text = data.mesureTypeName + measuringRangeView.text = data.mesureRange + uncertaintyView.text = data.uncertainty + firstUseView.text = data.createTime + originalValueView.text = data.originValue + usageDeptView.text = data.useDeptName + userView.text = data.usePersonName + managementStatusView.text = data.managerStateName + verificationDeptView.text = data.useDeptName +// nextVerificationDeptView.text = data. + verificationPeriodView.text = data.mesureCycle + verificationDateView.text = data.mesureDate + effectiveDateView.text = data.validDate + verificationResultsView.text = data.mesureResultName + abcView.text = data.abcName + isNeedTechnicalView.text = if ( + data.isCalibrationTestEquipment.isNullOrBlank() || data.isCalibrationTestEquipment == "0" + ) { + "否" + } else { + "是" + } + + isStandingBook.text = if ( + data.isMeasureAccount.isNullOrBlank() || data.isMeasureAccount == "0" + ) { + "否" + } else { + "是" + } + + isStandardView.text = if ( + data.isStandardSupportEquipment.isNullOrBlank() || data.isStandardSupportEquipment == "0" + ) { + "否" + } else { + "是" + } + remarkView.text = data.remark + if (data.fileList.size == 0) { + instructionsView.text = "暂无" + } else { + instructionsView.text = "查看附件列表" + val textPaint = instructionsView.paint + textPaint.flags = Paint.UNDERLINE_TEXT_FLAG + textPaint.isAntiAlias = true + instructionsView.setTextColor(R.color.themeColor.convertColor(requireContext())) + + instructionsView.setOnClickListener { + + } + } + } + }) + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_basic_information + + override fun observeRequestState() { + equipmentViewModel.loadState.observe(this, { + when (it) { + LoadState.Loading -> LoadingDialogHub.show(requireActivity(), "数据加载中...") + else -> LoadingDialogHub.dismiss() + } + }) + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt new file mode 100644 index 0000000..0b4a747 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class CertificateFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_certificate + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt new file mode 100644 index 0000000..f05c491 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class ChangeRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_change_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt new file mode 100644 index 0000000..849ffa5 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class InspectionRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_inspection_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt new file mode 100644 index 0000000..aa4edd9 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class UsageRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_usage_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java b/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java new file mode 100644 index 0000000..0b9124e --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java @@ -0,0 +1,760 @@ +package com.casic.xz.meterage.model; + +import java.util.List; + +public class EquipmentDetailModel { + + private int code; + private DataModel data; + private String message; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataModel getData() { + return data; + } + + public void setData(DataModel data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public static class DataModel { + private String abc; + private String abcName; + private String assetNo; + private String assetSource; + private String assetType; + private String assetTypeName; + private String attribute; + private String capitalSource; + private String capitalSourceName; + private String cardEstablishmentDate; + private String createTime; + private String createUser; + private String depreciationMethod; + private String depreciationMethodName; + private String depreciationPeriod; + private String enableDate; + private String equipmentCategory; + private String equipmentCategoryName; + private String equipmentName; + private String equipmentNo; + private String equipmentSpecifications; + private String equipmentType; + private String equipmentTypeName; + private List fileList; + private String id; + private String installIncidentalExpenses; + private String installPlace; + private String intactState; + private String isCalibrationTestEquipment; + private int isDel; + private String isFixedAssets; + private String isMeasureAccount; + private String isStandardSupportEquipment; + private String labelBind; + private String majorCategory; + private String majorCategoryName; + private String managerLevel; + private String managerLevelName; + private String managerState; + private String managerStateName; + private String manufacturer; + private String manufacturerCountry; + private String manufacturingDate; + private String manufacturingNo; + private String mesureCycle; + private String mesureDate; + private String mesureDept; + private String mesureRange; + private String mesureResult; + private String mesureResultName; + private String mesureType; + private String mesureTypeName; + private String modelNo; + private String originValue; + private String overallDimension; + private String presentOriginValue; + private String purpose; + private String remark; + private String singlePrice; + private String supportStandardEquipmentName; + private String supportStandardEquipmentNo; + private String technicalLevel; + private String uncertainty; + private String updateTime; + private String useDept; + private String useDeptName; + private String usePerson; + private String usePersonName; + private String validDate; + private int version; + private String weight; + + public String getAbc() { + return abc; + } + + public void setAbc(String abc) { + this.abc = abc; + } + + public String getAbcName() { + return abcName; + } + + public void setAbcName(String abcName) { + this.abcName = abcName; + } + + public String getAssetNo() { + return assetNo; + } + + public void setAssetNo(String assetNo) { + this.assetNo = assetNo; + } + + public String getAssetSource() { + return assetSource; + } + + public void setAssetSource(String assetSource) { + this.assetSource = assetSource; + } + + public String getAssetType() { + return assetType; + } + + public void setAssetType(String assetType) { + this.assetType = assetType; + } + + public String getAssetTypeName() { + return assetTypeName; + } + + public void setAssetTypeName(String assetTypeName) { + this.assetTypeName = assetTypeName; + } + + public String getAttribute() { + return attribute; + } + + public void setAttribute(String attribute) { + this.attribute = attribute; + } + + public String getCapitalSource() { + return capitalSource; + } + + public void setCapitalSource(String capitalSource) { + this.capitalSource = capitalSource; + } + + public String getCapitalSourceName() { + return capitalSourceName; + } + + public void setCapitalSourceName(String capitalSourceName) { + this.capitalSourceName = capitalSourceName; + } + + public String getCardEstablishmentDate() { + return cardEstablishmentDate; + } + + public void setCardEstablishmentDate(String cardEstablishmentDate) { + this.cardEstablishmentDate = cardEstablishmentDate; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getDepreciationMethod() { + return depreciationMethod; + } + + public void setDepreciationMethod(String depreciationMethod) { + this.depreciationMethod = depreciationMethod; + } + + public String getDepreciationMethodName() { + return depreciationMethodName; + } + + public void setDepreciationMethodName(String depreciationMethodName) { + this.depreciationMethodName = depreciationMethodName; + } + + public String getDepreciationPeriod() { + return depreciationPeriod; + } + + public void setDepreciationPeriod(String depreciationPeriod) { + this.depreciationPeriod = depreciationPeriod; + } + + public String getEnableDate() { + return enableDate; + } + + public void setEnableDate(String enableDate) { + this.enableDate = enableDate; + } + + public String getEquipmentCategory() { + return equipmentCategory; + } + + public void setEquipmentCategory(String equipmentCategory) { + this.equipmentCategory = equipmentCategory; + } + + public String getEquipmentCategoryName() { + return equipmentCategoryName; + } + + public void setEquipmentCategoryName(String equipmentCategoryName) { + this.equipmentCategoryName = equipmentCategoryName; + } + + public String getEquipmentName() { + return equipmentName; + } + + public void setEquipmentName(String equipmentName) { + this.equipmentName = equipmentName; + } + + public String getEquipmentNo() { + return equipmentNo; + } + + public void setEquipmentNo(String equipmentNo) { + this.equipmentNo = equipmentNo; + } + + public String getEquipmentSpecifications() { + return equipmentSpecifications; + } + + public void setEquipmentSpecifications(String equipmentSpecifications) { + this.equipmentSpecifications = equipmentSpecifications; + } + + public String getEquipmentType() { + return equipmentType; + } + + public void setEquipmentType(String equipmentType) { + this.equipmentType = equipmentType; + } + + public String getEquipmentTypeName() { + return equipmentTypeName; + } + + public void setEquipmentTypeName(String equipmentTypeName) { + this.equipmentTypeName = equipmentTypeName; + } + + public List getFileList() { + return fileList; + } + + public void setFileList(List fileList) { + this.fileList = fileList; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getInstallIncidentalExpenses() { + return installIncidentalExpenses; + } + + public void setInstallIncidentalExpenses(String installIncidentalExpenses) { + this.installIncidentalExpenses = installIncidentalExpenses; + } + + public String getInstallPlace() { + return installPlace; + } + + public void setInstallPlace(String installPlace) { + this.installPlace = installPlace; + } + + public String getIntactState() { + return intactState; + } + + public void setIntactState(String intactState) { + this.intactState = intactState; + } + + public String getIsCalibrationTestEquipment() { + return isCalibrationTestEquipment; + } + + public void setIsCalibrationTestEquipment(String isCalibrationTestEquipment) { + this.isCalibrationTestEquipment = isCalibrationTestEquipment; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getIsFixedAssets() { + return isFixedAssets; + } + + public void setIsFixedAssets(String isFixedAssets) { + this.isFixedAssets = isFixedAssets; + } + + public String getIsMeasureAccount() { + return isMeasureAccount; + } + + public void setIsMeasureAccount(String isMeasureAccount) { + this.isMeasureAccount = isMeasureAccount; + } + + public String getIsStandardSupportEquipment() { + return isStandardSupportEquipment; + } + + public void setIsStandardSupportEquipment(String isStandardSupportEquipment) { + this.isStandardSupportEquipment = isStandardSupportEquipment; + } + + public String getLabelBind() { + return labelBind; + } + + public void setLabelBind(String labelBind) { + this.labelBind = labelBind; + } + + public String getMajorCategory() { + return majorCategory; + } + + public void setMajorCategory(String majorCategory) { + this.majorCategory = majorCategory; + } + + public String getMajorCategoryName() { + return majorCategoryName; + } + + public void setMajorCategoryName(String majorCategoryName) { + this.majorCategoryName = majorCategoryName; + } + + public String getManagerLevel() { + return managerLevel; + } + + public void setManagerLevel(String managerLevel) { + this.managerLevel = managerLevel; + } + + public String getManagerLevelName() { + return managerLevelName; + } + + public void setManagerLevelName(String managerLevelName) { + this.managerLevelName = managerLevelName; + } + + public String getManagerState() { + return managerState; + } + + public void setManagerState(String managerState) { + this.managerState = managerState; + } + + public String getManagerStateName() { + return managerStateName; + } + + public void setManagerStateName(String managerStateName) { + this.managerStateName = managerStateName; + } + + public String getManufacturer() { + return manufacturer; + } + + public void setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + } + + public String getManufacturerCountry() { + return manufacturerCountry; + } + + public void setManufacturerCountry(String manufacturerCountry) { + this.manufacturerCountry = manufacturerCountry; + } + + public String getManufacturingDate() { + return manufacturingDate; + } + + public void setManufacturingDate(String manufacturingDate) { + this.manufacturingDate = manufacturingDate; + } + + public String getManufacturingNo() { + return manufacturingNo; + } + + public void setManufacturingNo(String manufacturingNo) { + this.manufacturingNo = manufacturingNo; + } + + public String getMesureCycle() { + return mesureCycle; + } + + public void setMesureCycle(String mesureCycle) { + this.mesureCycle = mesureCycle; + } + + public String getMesureDate() { + return mesureDate; + } + + public void setMesureDate(String mesureDate) { + this.mesureDate = mesureDate; + } + + public String getMesureDept() { + return mesureDept; + } + + public void setMesureDept(String mesureDept) { + this.mesureDept = mesureDept; + } + + public String getMesureRange() { + return mesureRange; + } + + public void setMesureRange(String mesureRange) { + this.mesureRange = mesureRange; + } + + public String getMesureResult() { + return mesureResult; + } + + public void setMesureResult(String mesureResult) { + this.mesureResult = mesureResult; + } + + public String getMesureResultName() { + return mesureResultName; + } + + public void setMesureResultName(String mesureResultName) { + this.mesureResultName = mesureResultName; + } + + public String getMesureType() { + return mesureType; + } + + public void setMesureType(String mesureType) { + this.mesureType = mesureType; + } + + public String getMesureTypeName() { + return mesureTypeName; + } + + public void setMesureTypeName(String mesureTypeName) { + this.mesureTypeName = mesureTypeName; + } + + public String getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getOriginValue() { + return originValue; + } + + public void setOriginValue(String originValue) { + this.originValue = originValue; + } + + public String getOverallDimension() { + return overallDimension; + } + + public void setOverallDimension(String overallDimension) { + this.overallDimension = overallDimension; + } + + public String getPresentOriginValue() { + return presentOriginValue; + } + + public void setPresentOriginValue(String presentOriginValue) { + this.presentOriginValue = presentOriginValue; + } + + public String getPurpose() { + return purpose; + } + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getSinglePrice() { + return singlePrice; + } + + public void setSinglePrice(String singlePrice) { + this.singlePrice = singlePrice; + } + + public String getSupportStandardEquipmentName() { + return supportStandardEquipmentName; + } + + public void setSupportStandardEquipmentName(String supportStandardEquipmentName) { + this.supportStandardEquipmentName = supportStandardEquipmentName; + } + + public String getSupportStandardEquipmentNo() { + return supportStandardEquipmentNo; + } + + public void setSupportStandardEquipmentNo(String supportStandardEquipmentNo) { + this.supportStandardEquipmentNo = supportStandardEquipmentNo; + } + + public String getTechnicalLevel() { + return technicalLevel; + } + + public void setTechnicalLevel(String technicalLevel) { + this.technicalLevel = technicalLevel; + } + + public String getUncertainty() { + return uncertainty; + } + + public void setUncertainty(String uncertainty) { + this.uncertainty = uncertainty; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getUseDept() { + return useDept; + } + + public void setUseDept(String useDept) { + this.useDept = useDept; + } + + public String getUseDeptName() { + return useDeptName; + } + + public void setUseDeptName(String useDeptName) { + this.useDeptName = useDeptName; + } + + public String getUsePerson() { + return usePerson; + } + + public void setUsePerson(String usePerson) { + this.usePerson = usePerson; + } + + public String getUsePersonName() { + return usePersonName; + } + + public void setUsePersonName(String usePersonName) { + this.usePersonName = usePersonName; + } + + public String getValidDate() { + return validDate; + } + + public void setValidDate(String validDate) { + this.validDate = validDate; + } + + public int getVersion() { + return version; + } + + public void setVersion(int version) { + this.version = version; + } + + public String getWeight() { + return weight; + } + + public void setWeight(String weight) { + this.weight = weight; + } + + public static class FileListModel { + private String assetId; + private String createTime; + private String createUser; + private String fileName; + private String id; + private int isDel; + private String minioFileName; + private String remark; + private String updateTime; + + public String getAssetId() { + return assetId; + } + + public void setAssetId(String assetId) { + this.assetId = assetId; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getFileName() { + return fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getMinioFileName() { + return minioFileName; + } + + public void setMinioFileName(String minioFileName) { + this.minioFileName = minioFileName; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + } + } +} diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 3892b5a..02160cd 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -34,16 +34,18 @@ - - - - - - - + + + + + + + + + +) : RecyclerView.Adapter() { + + private var layoutInflater: LayoutInflater = LayoutInflater.from(context) + + override fun getItemCount(): Int = dataRows.size + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = ItemViewHolder( + layoutInflater.inflate(R.layout.item_equipment_rv_l, parent, false) + ) + + override fun onBindViewHolder(holder: ItemViewHolder, position: Int) { + //绑定数据 + val rowsBean = dataRows[position] + holder.equipmentNameView.text = rowsBean.equipmentName + holder.equipmentCodeView.text = rowsBean.equipmentNo + holder.equipmentDateView.text = rowsBean.enableDate + holder.equipmentLibView.text = rowsBean.useDeptName + + //绑定事件 + holder.itemView.setOnClickListener { + listener?.onItemClicked(position) + } + } + + inner class ItemViewHolder(view: View) : RecyclerView.ViewHolder(view) { + var equipmentNameView: TextView = view.findViewById(R.id.equipmentNameView) + var equipmentCodeView: TextView = view.findViewById(R.id.equipmentCodeView) + var equipmentDateView: TextView = view.findViewById(R.id.equipmentDateView) + var equipmentLibView: TextView = view.findViewById(R.id.equipmentLibView) + } + + private var listener: OnItemClickListener? = null + + interface OnItemClickListener { + fun onItemClicked(position: Int) + } + + fun setOnItemClickListener(onClickListener: OnItemClickListener?) { + this.listener = onClickListener + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt index b4628f3..d970b55 100644 --- a/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt +++ b/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt @@ -5,7 +5,8 @@ import com.casic.xz.meterage.R import com.casic.xz.meterage.adapter.HomeGridAdapter import com.casic.xz.meterage.utils.LocaleConstant -import com.casic.xz.meterage.view.NoticeListActivity +import com.casic.xz.meterage.view.home.EquipmentActivity +import com.casic.xz.meterage.view.notice.NoticeListActivity import com.casic.xz.meterage.vm.NoticeViewModel import com.pengxh.kt.lite.base.KotlinBaseFragment import com.pengxh.kt.lite.extensions.navigatePageTo @@ -36,8 +37,19 @@ homeFuncRecyclerView.adapter = homeAdapter homeAdapter.setOnGridItemClickListener(object : HomeGridAdapter.OnGridItemClickListener { override fun onItemClick(position: Int) { - when (position) { - + when (LocaleConstant.HOME_FUNC_OPERATE[position]) { + "仪器设备" -> requireContext().navigatePageTo() +// "标准装置" -> requireContext().navigatePageTo() +// "证书报告" -> requireContext().navigatePageTo() +// "委托需求" -> requireContext().navigatePageTo() +// "访客" -> requireContext().navigatePageTo() +// "标准规范" -> requireContext().navigatePageTo() +// "能力列表" -> requireContext().navigatePageTo() +// "计量培训" -> requireContext().navigatePageTo() +// "合同发票" -> requireContext().navigatePageTo() +// "业务统计" -> requireContext().navigatePageTo() +// "客户列表" -> requireContext().navigatePageTo() +// "外场检测" -> requireContext().navigatePageTo() } } }) diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt index 7e75abe..56dc5ec 100644 --- a/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt +++ b/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt @@ -2,9 +2,11 @@ import android.view.View import androidx.lifecycle.ViewModelProvider +import com.bumptech.glide.Glide +import com.bumptech.glide.request.RequestOptions import com.casic.xz.meterage.R import com.casic.xz.meterage.utils.LocaleConstant -import com.casic.xz.meterage.view.NoticeListActivity +import com.casic.xz.meterage.view.notice.NoticeListActivity import com.casic.xz.meterage.vm.NoticeViewModel import com.casic.xz.meterage.vm.UserViewModel import com.pengxh.kt.lite.base.KotlinBaseFragment @@ -23,6 +25,12 @@ val data = it.data userNameView.text = data.name userUnitView.text = data.deptName + +// Glide.with(requireContext()) +// .load(R.mipmap.default_avatar) +// .apply(RequestOptions.circleCropTransform()) +// .placeholder(R.mipmap.load_image_error) +// .into(userAvatarView) } }) diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt new file mode 100644 index 0000000..cf22646 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt @@ -0,0 +1,103 @@ +package com.casic.xz.meterage.fragment.equipment + +import android.graphics.Paint +import androidx.lifecycle.ViewModelProvider +import com.casic.xz.meterage.R +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.casic.xz.meterage.vm.EquipmentViewModel +import com.pengxh.kt.lite.base.KotlinBaseFragment +import com.pengxh.kt.lite.extensions.convertColor +import com.pengxh.kt.lite.vm.LoadState +import kotlinx.android.synthetic.main.fragment_basic_information.* + +class BasicInformationFragment(private val id: String) : KotlinBaseFragment() { + + private lateinit var equipmentViewModel: EquipmentViewModel + + override fun initData() { + equipmentViewModel = ViewModelProvider(this)[EquipmentViewModel::class.java] + equipmentViewModel.getEquipmentDetail(id) + equipmentViewModel.equipmentDetailResult.observe(this, { + if (it.code == 200) { + val data = it.data!! + + equipmentCodeView.text = data.equipmentNo + equipmentNameView.text = data.equipmentName + manufacturerView.text = data.manufacturer + factoryNumberView.text = data.manufacturingNo + modelView.text = data.modelNo + verificationMethodView.text = data.mesureTypeName + measuringRangeView.text = data.mesureRange + uncertaintyView.text = data.uncertainty + firstUseView.text = data.createTime + originalValueView.text = data.originValue + usageDeptView.text = data.useDeptName + userView.text = data.usePersonName + managementStatusView.text = data.managerStateName + verificationDeptView.text = data.useDeptName +// nextVerificationDeptView.text = data. + verificationPeriodView.text = data.mesureCycle + verificationDateView.text = data.mesureDate + effectiveDateView.text = data.validDate + verificationResultsView.text = data.mesureResultName + abcView.text = data.abcName + isNeedTechnicalView.text = if ( + data.isCalibrationTestEquipment.isNullOrBlank() || data.isCalibrationTestEquipment == "0" + ) { + "否" + } else { + "是" + } + + isStandingBook.text = if ( + data.isMeasureAccount.isNullOrBlank() || data.isMeasureAccount == "0" + ) { + "否" + } else { + "是" + } + + isStandardView.text = if ( + data.isStandardSupportEquipment.isNullOrBlank() || data.isStandardSupportEquipment == "0" + ) { + "否" + } else { + "是" + } + remarkView.text = data.remark + if (data.fileList.size == 0) { + instructionsView.text = "暂无" + } else { + instructionsView.text = "查看附件列表" + val textPaint = instructionsView.paint + textPaint.flags = Paint.UNDERLINE_TEXT_FLAG + textPaint.isAntiAlias = true + instructionsView.setTextColor(R.color.themeColor.convertColor(requireContext())) + + instructionsView.setOnClickListener { + + } + } + } + }) + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_basic_information + + override fun observeRequestState() { + equipmentViewModel.loadState.observe(this, { + when (it) { + LoadState.Loading -> LoadingDialogHub.show(requireActivity(), "数据加载中...") + else -> LoadingDialogHub.dismiss() + } + }) + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt new file mode 100644 index 0000000..0b4a747 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class CertificateFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_certificate + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt new file mode 100644 index 0000000..f05c491 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class ChangeRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_change_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt new file mode 100644 index 0000000..849ffa5 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class InspectionRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_inspection_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt new file mode 100644 index 0000000..aa4edd9 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class UsageRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_usage_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java b/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java new file mode 100644 index 0000000..0b9124e --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java @@ -0,0 +1,760 @@ +package com.casic.xz.meterage.model; + +import java.util.List; + +public class EquipmentDetailModel { + + private int code; + private DataModel data; + private String message; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataModel getData() { + return data; + } + + public void setData(DataModel data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public static class DataModel { + private String abc; + private String abcName; + private String assetNo; + private String assetSource; + private String assetType; + private String assetTypeName; + private String attribute; + private String capitalSource; + private String capitalSourceName; + private String cardEstablishmentDate; + private String createTime; + private String createUser; + private String depreciationMethod; + private String depreciationMethodName; + private String depreciationPeriod; + private String enableDate; + private String equipmentCategory; + private String equipmentCategoryName; + private String equipmentName; + private String equipmentNo; + private String equipmentSpecifications; + private String equipmentType; + private String equipmentTypeName; + private List fileList; + private String id; + private String installIncidentalExpenses; + private String installPlace; + private String intactState; + private String isCalibrationTestEquipment; + private int isDel; + private String isFixedAssets; + private String isMeasureAccount; + private String isStandardSupportEquipment; + private String labelBind; + private String majorCategory; + private String majorCategoryName; + private String managerLevel; + private String managerLevelName; + private String managerState; + private String managerStateName; + private String manufacturer; + private String manufacturerCountry; + private String manufacturingDate; + private String manufacturingNo; + private String mesureCycle; + private String mesureDate; + private String mesureDept; + private String mesureRange; + private String mesureResult; + private String mesureResultName; + private String mesureType; + private String mesureTypeName; + private String modelNo; + private String originValue; + private String overallDimension; + private String presentOriginValue; + private String purpose; + private String remark; + private String singlePrice; + private String supportStandardEquipmentName; + private String supportStandardEquipmentNo; + private String technicalLevel; + private String uncertainty; + private String updateTime; + private String useDept; + private String useDeptName; + private String usePerson; + private String usePersonName; + private String validDate; + private int version; + private String weight; + + public String getAbc() { + return abc; + } + + public void setAbc(String abc) { + this.abc = abc; + } + + public String getAbcName() { + return abcName; + } + + public void setAbcName(String abcName) { + this.abcName = abcName; + } + + public String getAssetNo() { + return assetNo; + } + + public void setAssetNo(String assetNo) { + this.assetNo = assetNo; + } + + public String getAssetSource() { + return assetSource; + } + + public void setAssetSource(String assetSource) { + this.assetSource = assetSource; + } + + public String getAssetType() { + return assetType; + } + + public void setAssetType(String assetType) { + this.assetType = assetType; + } + + public String getAssetTypeName() { + return assetTypeName; + } + + public void setAssetTypeName(String assetTypeName) { + this.assetTypeName = assetTypeName; + } + + public String getAttribute() { + return attribute; + } + + public void setAttribute(String attribute) { + this.attribute = attribute; + } + + public String getCapitalSource() { + return capitalSource; + } + + public void setCapitalSource(String capitalSource) { + this.capitalSource = capitalSource; + } + + public String getCapitalSourceName() { + return capitalSourceName; + } + + public void setCapitalSourceName(String capitalSourceName) { + this.capitalSourceName = capitalSourceName; + } + + public String getCardEstablishmentDate() { + return cardEstablishmentDate; + } + + public void setCardEstablishmentDate(String cardEstablishmentDate) { + this.cardEstablishmentDate = cardEstablishmentDate; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getDepreciationMethod() { + return depreciationMethod; + } + + public void setDepreciationMethod(String depreciationMethod) { + this.depreciationMethod = depreciationMethod; + } + + public String getDepreciationMethodName() { + return depreciationMethodName; + } + + public void setDepreciationMethodName(String depreciationMethodName) { + this.depreciationMethodName = depreciationMethodName; + } + + public String getDepreciationPeriod() { + return depreciationPeriod; + } + + public void setDepreciationPeriod(String depreciationPeriod) { + this.depreciationPeriod = depreciationPeriod; + } + + public String getEnableDate() { + return enableDate; + } + + public void setEnableDate(String enableDate) { + this.enableDate = enableDate; + } + + public String getEquipmentCategory() { + return equipmentCategory; + } + + public void setEquipmentCategory(String equipmentCategory) { + this.equipmentCategory = equipmentCategory; + } + + public String getEquipmentCategoryName() { + return equipmentCategoryName; + } + + public void setEquipmentCategoryName(String equipmentCategoryName) { + this.equipmentCategoryName = equipmentCategoryName; + } + + public String getEquipmentName() { + return equipmentName; + } + + public void setEquipmentName(String equipmentName) { + this.equipmentName = equipmentName; + } + + public String getEquipmentNo() { + return equipmentNo; + } + + public void setEquipmentNo(String equipmentNo) { + this.equipmentNo = equipmentNo; + } + + public String getEquipmentSpecifications() { + return equipmentSpecifications; + } + + public void setEquipmentSpecifications(String equipmentSpecifications) { + this.equipmentSpecifications = equipmentSpecifications; + } + + public String getEquipmentType() { + return equipmentType; + } + + public void setEquipmentType(String equipmentType) { + this.equipmentType = equipmentType; + } + + public String getEquipmentTypeName() { + return equipmentTypeName; + } + + public void setEquipmentTypeName(String equipmentTypeName) { + this.equipmentTypeName = equipmentTypeName; + } + + public List getFileList() { + return fileList; + } + + public void setFileList(List fileList) { + this.fileList = fileList; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getInstallIncidentalExpenses() { + return installIncidentalExpenses; + } + + public void setInstallIncidentalExpenses(String installIncidentalExpenses) { + this.installIncidentalExpenses = installIncidentalExpenses; + } + + public String getInstallPlace() { + return installPlace; + } + + public void setInstallPlace(String installPlace) { + this.installPlace = installPlace; + } + + public String getIntactState() { + return intactState; + } + + public void setIntactState(String intactState) { + this.intactState = intactState; + } + + public String getIsCalibrationTestEquipment() { + return isCalibrationTestEquipment; + } + + public void setIsCalibrationTestEquipment(String isCalibrationTestEquipment) { + this.isCalibrationTestEquipment = isCalibrationTestEquipment; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getIsFixedAssets() { + return isFixedAssets; + } + + public void setIsFixedAssets(String isFixedAssets) { + this.isFixedAssets = isFixedAssets; + } + + public String getIsMeasureAccount() { + return isMeasureAccount; + } + + public void setIsMeasureAccount(String isMeasureAccount) { + this.isMeasureAccount = isMeasureAccount; + } + + public String getIsStandardSupportEquipment() { + return isStandardSupportEquipment; + } + + public void setIsStandardSupportEquipment(String isStandardSupportEquipment) { + this.isStandardSupportEquipment = isStandardSupportEquipment; + } + + public String getLabelBind() { + return labelBind; + } + + public void setLabelBind(String labelBind) { + this.labelBind = labelBind; + } + + public String getMajorCategory() { + return majorCategory; + } + + public void setMajorCategory(String majorCategory) { + this.majorCategory = majorCategory; + } + + public String getMajorCategoryName() { + return majorCategoryName; + } + + public void setMajorCategoryName(String majorCategoryName) { + this.majorCategoryName = majorCategoryName; + } + + public String getManagerLevel() { + return managerLevel; + } + + public void setManagerLevel(String managerLevel) { + this.managerLevel = managerLevel; + } + + public String getManagerLevelName() { + return managerLevelName; + } + + public void setManagerLevelName(String managerLevelName) { + this.managerLevelName = managerLevelName; + } + + public String getManagerState() { + return managerState; + } + + public void setManagerState(String managerState) { + this.managerState = managerState; + } + + public String getManagerStateName() { + return managerStateName; + } + + public void setManagerStateName(String managerStateName) { + this.managerStateName = managerStateName; + } + + public String getManufacturer() { + return manufacturer; + } + + public void setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + } + + public String getManufacturerCountry() { + return manufacturerCountry; + } + + public void setManufacturerCountry(String manufacturerCountry) { + this.manufacturerCountry = manufacturerCountry; + } + + public String getManufacturingDate() { + return manufacturingDate; + } + + public void setManufacturingDate(String manufacturingDate) { + this.manufacturingDate = manufacturingDate; + } + + public String getManufacturingNo() { + return manufacturingNo; + } + + public void setManufacturingNo(String manufacturingNo) { + this.manufacturingNo = manufacturingNo; + } + + public String getMesureCycle() { + return mesureCycle; + } + + public void setMesureCycle(String mesureCycle) { + this.mesureCycle = mesureCycle; + } + + public String getMesureDate() { + return mesureDate; + } + + public void setMesureDate(String mesureDate) { + this.mesureDate = mesureDate; + } + + public String getMesureDept() { + return mesureDept; + } + + public void setMesureDept(String mesureDept) { + this.mesureDept = mesureDept; + } + + public String getMesureRange() { + return mesureRange; + } + + public void setMesureRange(String mesureRange) { + this.mesureRange = mesureRange; + } + + public String getMesureResult() { + return mesureResult; + } + + public void setMesureResult(String mesureResult) { + this.mesureResult = mesureResult; + } + + public String getMesureResultName() { + return mesureResultName; + } + + public void setMesureResultName(String mesureResultName) { + this.mesureResultName = mesureResultName; + } + + public String getMesureType() { + return mesureType; + } + + public void setMesureType(String mesureType) { + this.mesureType = mesureType; + } + + public String getMesureTypeName() { + return mesureTypeName; + } + + public void setMesureTypeName(String mesureTypeName) { + this.mesureTypeName = mesureTypeName; + } + + public String getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getOriginValue() { + return originValue; + } + + public void setOriginValue(String originValue) { + this.originValue = originValue; + } + + public String getOverallDimension() { + return overallDimension; + } + + public void setOverallDimension(String overallDimension) { + this.overallDimension = overallDimension; + } + + public String getPresentOriginValue() { + return presentOriginValue; + } + + public void setPresentOriginValue(String presentOriginValue) { + this.presentOriginValue = presentOriginValue; + } + + public String getPurpose() { + return purpose; + } + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getSinglePrice() { + return singlePrice; + } + + public void setSinglePrice(String singlePrice) { + this.singlePrice = singlePrice; + } + + public String getSupportStandardEquipmentName() { + return supportStandardEquipmentName; + } + + public void setSupportStandardEquipmentName(String supportStandardEquipmentName) { + this.supportStandardEquipmentName = supportStandardEquipmentName; + } + + public String getSupportStandardEquipmentNo() { + return supportStandardEquipmentNo; + } + + public void setSupportStandardEquipmentNo(String supportStandardEquipmentNo) { + this.supportStandardEquipmentNo = supportStandardEquipmentNo; + } + + public String getTechnicalLevel() { + return technicalLevel; + } + + public void setTechnicalLevel(String technicalLevel) { + this.technicalLevel = technicalLevel; + } + + public String getUncertainty() { + return uncertainty; + } + + public void setUncertainty(String uncertainty) { + this.uncertainty = uncertainty; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getUseDept() { + return useDept; + } + + public void setUseDept(String useDept) { + this.useDept = useDept; + } + + public String getUseDeptName() { + return useDeptName; + } + + public void setUseDeptName(String useDeptName) { + this.useDeptName = useDeptName; + } + + public String getUsePerson() { + return usePerson; + } + + public void setUsePerson(String usePerson) { + this.usePerson = usePerson; + } + + public String getUsePersonName() { + return usePersonName; + } + + public void setUsePersonName(String usePersonName) { + this.usePersonName = usePersonName; + } + + public String getValidDate() { + return validDate; + } + + public void setValidDate(String validDate) { + this.validDate = validDate; + } + + public int getVersion() { + return version; + } + + public void setVersion(int version) { + this.version = version; + } + + public String getWeight() { + return weight; + } + + public void setWeight(String weight) { + this.weight = weight; + } + + public static class FileListModel { + private String assetId; + private String createTime; + private String createUser; + private String fileName; + private String id; + private int isDel; + private String minioFileName; + private String remark; + private String updateTime; + + public String getAssetId() { + return assetId; + } + + public void setAssetId(String assetId) { + this.assetId = assetId; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getFileName() { + return fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getMinioFileName() { + return minioFileName; + } + + public void setMinioFileName(String minioFileName) { + this.minioFileName = minioFileName; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + } + } +} diff --git a/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java b/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java new file mode 100644 index 0000000..15fc128 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java @@ -0,0 +1,697 @@ +package com.casic.xz.meterage.model; + +import java.util.List; + +public class EquipmentListModel { + + private int code; + private DataModel data; + private String message; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataModel getData() { + return data; + } + + public void setData(DataModel data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public static class DataModel { + private List rows; + private int total; + + public List getRows() { + return rows; + } + + public void setRows(List rows) { + this.rows = rows; + } + + public int getTotal() { + return total; + } + + public void setTotal(int total) { + this.total = total; + } + + public static class RowsModel { + private String abc; + private String abcName; + private String assetNo; + private String assetSource; + private String assetType; + private String assetTypeName; + private String attribute; + private String capitalSource; + private String capitalSourceName; + private String cardEstablishmentDate; + private String createTime; + private String createUser; + private String depreciationMethod; + private String depreciationMethodName; + private String depreciationPeriod; + private String enableDate; + private String equipmentCategory; + private String equipmentCategoryName; + private String equipmentName; + private String equipmentNo; + private String equipmentSpecifications; + private String equipmentType; + private String equipmentTypeName; + private String fileList; + private String id; + private String installIncidentalExpenses; + private String installPlace; + private String intactState; + private String isCalibrationTestEquipment; + private int isDel; + private String isFixedAssets; + private String isMeasureAccount; + private String isStandardSupportEquipment; + private String labelBind; + private String majorCategory; + private String majorCategoryName; + private String managerLevel; + private String managerLevelName; + private String managerState; + private String managerStateName; + private String manufacturer; + private String manufacturerCountry; + private String manufacturingDate; + private String manufacturingNo; + private String mesureCycle; + private String mesureDate; + private String mesureDept; + private String mesureRange; + private String mesureResult; + private String mesureResultName; + private String mesureType; + private String mesureTypeName; + private String modelNo; + private String originValue; + private String overallDimension; + private String presentOriginValue; + private String purpose; + private String remark; + private String singlePrice; + private String supportStandardEquipmentName; + private String supportStandardEquipmentNo; + private String technicalLevel; + private String uncertainty; + private String updateTime; + private String useDept; + private String useDeptName; + private String usePerson; + private String usePersonName; + private String validDate; + private int version; + private String weight; + + public String getAbc() { + return abc; + } + + public void setAbc(String abc) { + this.abc = abc; + } + + public String getAbcName() { + return abcName; + } + + public void setAbcName(String abcName) { + this.abcName = abcName; + } + + public String getAssetNo() { + return assetNo; + } + + public void setAssetNo(String assetNo) { + this.assetNo = assetNo; + } + + public String getAssetSource() { + return assetSource; + } + + public void setAssetSource(String assetSource) { + this.assetSource = assetSource; + } + + public String getAssetType() { + return assetType; + } + + public void setAssetType(String assetType) { + this.assetType = assetType; + } + + public String getAssetTypeName() { + return assetTypeName; + } + + public void setAssetTypeName(String assetTypeName) { + this.assetTypeName = assetTypeName; + } + + public String getAttribute() { + return attribute; + } + + public void setAttribute(String attribute) { + this.attribute = attribute; + } + + public String getCapitalSource() { + return capitalSource; + } + + public void setCapitalSource(String capitalSource) { + this.capitalSource = capitalSource; + } + + public String getCapitalSourceName() { + return capitalSourceName; + } + + public void setCapitalSourceName(String capitalSourceName) { + this.capitalSourceName = capitalSourceName; + } + + public String getCardEstablishmentDate() { + return cardEstablishmentDate; + } + + public void setCardEstablishmentDate(String cardEstablishmentDate) { + this.cardEstablishmentDate = cardEstablishmentDate; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getDepreciationMethod() { + return depreciationMethod; + } + + public void setDepreciationMethod(String depreciationMethod) { + this.depreciationMethod = depreciationMethod; + } + + public String getDepreciationMethodName() { + return depreciationMethodName; + } + + public void setDepreciationMethodName(String depreciationMethodName) { + this.depreciationMethodName = depreciationMethodName; + } + + public String getDepreciationPeriod() { + return depreciationPeriod; + } + + public void setDepreciationPeriod(String depreciationPeriod) { + this.depreciationPeriod = depreciationPeriod; + } + + public String getEnableDate() { + return enableDate; + } + + public void setEnableDate(String enableDate) { + this.enableDate = enableDate; + } + + public String getEquipmentCategory() { + return equipmentCategory; + } + + public void setEquipmentCategory(String equipmentCategory) { + this.equipmentCategory = equipmentCategory; + } + + public String getEquipmentCategoryName() { + return equipmentCategoryName; + } + + public void setEquipmentCategoryName(String equipmentCategoryName) { + this.equipmentCategoryName = equipmentCategoryName; + } + + public String getEquipmentName() { + return equipmentName; + } + + public void setEquipmentName(String equipmentName) { + this.equipmentName = equipmentName; + } + + public String getEquipmentNo() { + return equipmentNo; + } + + public void setEquipmentNo(String equipmentNo) { + this.equipmentNo = equipmentNo; + } + + public String getEquipmentSpecifications() { + return equipmentSpecifications; + } + + public void setEquipmentSpecifications(String equipmentSpecifications) { + this.equipmentSpecifications = equipmentSpecifications; + } + + public String getEquipmentType() { + return equipmentType; + } + + public void setEquipmentType(String equipmentType) { + this.equipmentType = equipmentType; + } + + public String getEquipmentTypeName() { + return equipmentTypeName; + } + + public void setEquipmentTypeName(String equipmentTypeName) { + this.equipmentTypeName = equipmentTypeName; + } + + public String getFileList() { + return fileList; + } + + public void setFileList(String fileList) { + this.fileList = fileList; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getInstallIncidentalExpenses() { + return installIncidentalExpenses; + } + + public void setInstallIncidentalExpenses(String installIncidentalExpenses) { + this.installIncidentalExpenses = installIncidentalExpenses; + } + + public String getInstallPlace() { + return installPlace; + } + + public void setInstallPlace(String installPlace) { + this.installPlace = installPlace; + } + + public String getIntactState() { + return intactState; + } + + public void setIntactState(String intactState) { + this.intactState = intactState; + } + + public String getIsCalibrationTestEquipment() { + return isCalibrationTestEquipment; + } + + public void setIsCalibrationTestEquipment(String isCalibrationTestEquipment) { + this.isCalibrationTestEquipment = isCalibrationTestEquipment; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getIsFixedAssets() { + return isFixedAssets; + } + + public void setIsFixedAssets(String isFixedAssets) { + this.isFixedAssets = isFixedAssets; + } + + public String getIsMeasureAccount() { + return isMeasureAccount; + } + + public void setIsMeasureAccount(String isMeasureAccount) { + this.isMeasureAccount = isMeasureAccount; + } + + public String getIsStandardSupportEquipment() { + return isStandardSupportEquipment; + } + + public void setIsStandardSupportEquipment(String isStandardSupportEquipment) { + this.isStandardSupportEquipment = isStandardSupportEquipment; + } + + public String getLabelBind() { + return labelBind; + } + + public void setLabelBind(String labelBind) { + this.labelBind = labelBind; + } + + public String getMajorCategory() { + return majorCategory; + } + + public void setMajorCategory(String majorCategory) { + this.majorCategory = majorCategory; + } + + public String getMajorCategoryName() { + return majorCategoryName; + } + + public void setMajorCategoryName(String majorCategoryName) { + this.majorCategoryName = majorCategoryName; + } + + public String getManagerLevel() { + return managerLevel; + } + + public void setManagerLevel(String managerLevel) { + this.managerLevel = managerLevel; + } + + public String getManagerLevelName() { + return managerLevelName; + } + + public void setManagerLevelName(String managerLevelName) { + this.managerLevelName = managerLevelName; + } + + public String getManagerState() { + return managerState; + } + + public void setManagerState(String managerState) { + this.managerState = managerState; + } + + public String getManagerStateName() { + return managerStateName; + } + + public void setManagerStateName(String managerStateName) { + this.managerStateName = managerStateName; + } + + public String getManufacturer() { + return manufacturer; + } + + public void setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + } + + public String getManufacturerCountry() { + return manufacturerCountry; + } + + public void setManufacturerCountry(String manufacturerCountry) { + this.manufacturerCountry = manufacturerCountry; + } + + public String getManufacturingDate() { + return manufacturingDate; + } + + public void setManufacturingDate(String manufacturingDate) { + this.manufacturingDate = manufacturingDate; + } + + public String getManufacturingNo() { + return manufacturingNo; + } + + public void setManufacturingNo(String manufacturingNo) { + this.manufacturingNo = manufacturingNo; + } + + public String getMesureCycle() { + return mesureCycle; + } + + public void setMesureCycle(String mesureCycle) { + this.mesureCycle = mesureCycle; + } + + public String getMesureDate() { + return mesureDate; + } + + public void setMesureDate(String mesureDate) { + this.mesureDate = mesureDate; + } + + public String getMesureDept() { + return mesureDept; + } + + public void setMesureDept(String mesureDept) { + this.mesureDept = mesureDept; + } + + public String getMesureRange() { + return mesureRange; + } + + public void setMesureRange(String mesureRange) { + this.mesureRange = mesureRange; + } + + public String getMesureResult() { + return mesureResult; + } + + public void setMesureResult(String mesureResult) { + this.mesureResult = mesureResult; + } + + public String getMesureResultName() { + return mesureResultName; + } + + public void setMesureResultName(String mesureResultName) { + this.mesureResultName = mesureResultName; + } + + public String getMesureType() { + return mesureType; + } + + public void setMesureType(String mesureType) { + this.mesureType = mesureType; + } + + public String getMesureTypeName() { + return mesureTypeName; + } + + public void setMesureTypeName(String mesureTypeName) { + this.mesureTypeName = mesureTypeName; + } + + public String getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getOriginValue() { + return originValue; + } + + public void setOriginValue(String originValue) { + this.originValue = originValue; + } + + public String getOverallDimension() { + return overallDimension; + } + + public void setOverallDimension(String overallDimension) { + this.overallDimension = overallDimension; + } + + public String getPresentOriginValue() { + return presentOriginValue; + } + + public void setPresentOriginValue(String presentOriginValue) { + this.presentOriginValue = presentOriginValue; + } + + public String getPurpose() { + return purpose; + } + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getSinglePrice() { + return singlePrice; + } + + public void setSinglePrice(String singlePrice) { + this.singlePrice = singlePrice; + } + + public String getSupportStandardEquipmentName() { + return supportStandardEquipmentName; + } + + public void setSupportStandardEquipmentName(String supportStandardEquipmentName) { + this.supportStandardEquipmentName = supportStandardEquipmentName; + } + + public String getSupportStandardEquipmentNo() { + return supportStandardEquipmentNo; + } + + public void setSupportStandardEquipmentNo(String supportStandardEquipmentNo) { + this.supportStandardEquipmentNo = supportStandardEquipmentNo; + } + + public String getTechnicalLevel() { + return technicalLevel; + } + + public void setTechnicalLevel(String technicalLevel) { + this.technicalLevel = technicalLevel; + } + + public String getUncertainty() { + return uncertainty; + } + + public void setUncertainty(String uncertainty) { + this.uncertainty = uncertainty; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getUseDept() { + return useDept; + } + + public void setUseDept(String useDept) { + this.useDept = useDept; + } + + public String getUseDeptName() { + return useDeptName; + } + + public void setUseDeptName(String useDeptName) { + this.useDeptName = useDeptName; + } + + public String getUsePerson() { + return usePerson; + } + + public void setUsePerson(String usePerson) { + this.usePerson = usePerson; + } + + public String getUsePersonName() { + return usePersonName; + } + + public void setUsePersonName(String usePersonName) { + this.usePersonName = usePersonName; + } + + public String getValidDate() { + return validDate; + } + + public void setValidDate(String validDate) { + this.validDate = validDate; + } + + public int getVersion() { + return version; + } + + public void setVersion(int version) { + this.version = version; + } + + public String getWeight() { + return weight; + } + + public void setWeight(String weight) { + this.weight = weight; + } + } + } +} diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 3892b5a..02160cd 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -34,16 +34,18 @@ - - - - - - - + + + + + + + + + +) : RecyclerView.Adapter() { + + private var layoutInflater: LayoutInflater = LayoutInflater.from(context) + + override fun getItemCount(): Int = dataRows.size + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = ItemViewHolder( + layoutInflater.inflate(R.layout.item_equipment_rv_l, parent, false) + ) + + override fun onBindViewHolder(holder: ItemViewHolder, position: Int) { + //绑定数据 + val rowsBean = dataRows[position] + holder.equipmentNameView.text = rowsBean.equipmentName + holder.equipmentCodeView.text = rowsBean.equipmentNo + holder.equipmentDateView.text = rowsBean.enableDate + holder.equipmentLibView.text = rowsBean.useDeptName + + //绑定事件 + holder.itemView.setOnClickListener { + listener?.onItemClicked(position) + } + } + + inner class ItemViewHolder(view: View) : RecyclerView.ViewHolder(view) { + var equipmentNameView: TextView = view.findViewById(R.id.equipmentNameView) + var equipmentCodeView: TextView = view.findViewById(R.id.equipmentCodeView) + var equipmentDateView: TextView = view.findViewById(R.id.equipmentDateView) + var equipmentLibView: TextView = view.findViewById(R.id.equipmentLibView) + } + + private var listener: OnItemClickListener? = null + + interface OnItemClickListener { + fun onItemClicked(position: Int) + } + + fun setOnItemClickListener(onClickListener: OnItemClickListener?) { + this.listener = onClickListener + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt index b4628f3..d970b55 100644 --- a/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt +++ b/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt @@ -5,7 +5,8 @@ import com.casic.xz.meterage.R import com.casic.xz.meterage.adapter.HomeGridAdapter import com.casic.xz.meterage.utils.LocaleConstant -import com.casic.xz.meterage.view.NoticeListActivity +import com.casic.xz.meterage.view.home.EquipmentActivity +import com.casic.xz.meterage.view.notice.NoticeListActivity import com.casic.xz.meterage.vm.NoticeViewModel import com.pengxh.kt.lite.base.KotlinBaseFragment import com.pengxh.kt.lite.extensions.navigatePageTo @@ -36,8 +37,19 @@ homeFuncRecyclerView.adapter = homeAdapter homeAdapter.setOnGridItemClickListener(object : HomeGridAdapter.OnGridItemClickListener { override fun onItemClick(position: Int) { - when (position) { - + when (LocaleConstant.HOME_FUNC_OPERATE[position]) { + "仪器设备" -> requireContext().navigatePageTo() +// "标准装置" -> requireContext().navigatePageTo() +// "证书报告" -> requireContext().navigatePageTo() +// "委托需求" -> requireContext().navigatePageTo() +// "访客" -> requireContext().navigatePageTo() +// "标准规范" -> requireContext().navigatePageTo() +// "能力列表" -> requireContext().navigatePageTo() +// "计量培训" -> requireContext().navigatePageTo() +// "合同发票" -> requireContext().navigatePageTo() +// "业务统计" -> requireContext().navigatePageTo() +// "客户列表" -> requireContext().navigatePageTo() +// "外场检测" -> requireContext().navigatePageTo() } } }) diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt index 7e75abe..56dc5ec 100644 --- a/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt +++ b/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt @@ -2,9 +2,11 @@ import android.view.View import androidx.lifecycle.ViewModelProvider +import com.bumptech.glide.Glide +import com.bumptech.glide.request.RequestOptions import com.casic.xz.meterage.R import com.casic.xz.meterage.utils.LocaleConstant -import com.casic.xz.meterage.view.NoticeListActivity +import com.casic.xz.meterage.view.notice.NoticeListActivity import com.casic.xz.meterage.vm.NoticeViewModel import com.casic.xz.meterage.vm.UserViewModel import com.pengxh.kt.lite.base.KotlinBaseFragment @@ -23,6 +25,12 @@ val data = it.data userNameView.text = data.name userUnitView.text = data.deptName + +// Glide.with(requireContext()) +// .load(R.mipmap.default_avatar) +// .apply(RequestOptions.circleCropTransform()) +// .placeholder(R.mipmap.load_image_error) +// .into(userAvatarView) } }) diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt new file mode 100644 index 0000000..cf22646 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt @@ -0,0 +1,103 @@ +package com.casic.xz.meterage.fragment.equipment + +import android.graphics.Paint +import androidx.lifecycle.ViewModelProvider +import com.casic.xz.meterage.R +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.casic.xz.meterage.vm.EquipmentViewModel +import com.pengxh.kt.lite.base.KotlinBaseFragment +import com.pengxh.kt.lite.extensions.convertColor +import com.pengxh.kt.lite.vm.LoadState +import kotlinx.android.synthetic.main.fragment_basic_information.* + +class BasicInformationFragment(private val id: String) : KotlinBaseFragment() { + + private lateinit var equipmentViewModel: EquipmentViewModel + + override fun initData() { + equipmentViewModel = ViewModelProvider(this)[EquipmentViewModel::class.java] + equipmentViewModel.getEquipmentDetail(id) + equipmentViewModel.equipmentDetailResult.observe(this, { + if (it.code == 200) { + val data = it.data!! + + equipmentCodeView.text = data.equipmentNo + equipmentNameView.text = data.equipmentName + manufacturerView.text = data.manufacturer + factoryNumberView.text = data.manufacturingNo + modelView.text = data.modelNo + verificationMethodView.text = data.mesureTypeName + measuringRangeView.text = data.mesureRange + uncertaintyView.text = data.uncertainty + firstUseView.text = data.createTime + originalValueView.text = data.originValue + usageDeptView.text = data.useDeptName + userView.text = data.usePersonName + managementStatusView.text = data.managerStateName + verificationDeptView.text = data.useDeptName +// nextVerificationDeptView.text = data. + verificationPeriodView.text = data.mesureCycle + verificationDateView.text = data.mesureDate + effectiveDateView.text = data.validDate + verificationResultsView.text = data.mesureResultName + abcView.text = data.abcName + isNeedTechnicalView.text = if ( + data.isCalibrationTestEquipment.isNullOrBlank() || data.isCalibrationTestEquipment == "0" + ) { + "否" + } else { + "是" + } + + isStandingBook.text = if ( + data.isMeasureAccount.isNullOrBlank() || data.isMeasureAccount == "0" + ) { + "否" + } else { + "是" + } + + isStandardView.text = if ( + data.isStandardSupportEquipment.isNullOrBlank() || data.isStandardSupportEquipment == "0" + ) { + "否" + } else { + "是" + } + remarkView.text = data.remark + if (data.fileList.size == 0) { + instructionsView.text = "暂无" + } else { + instructionsView.text = "查看附件列表" + val textPaint = instructionsView.paint + textPaint.flags = Paint.UNDERLINE_TEXT_FLAG + textPaint.isAntiAlias = true + instructionsView.setTextColor(R.color.themeColor.convertColor(requireContext())) + + instructionsView.setOnClickListener { + + } + } + } + }) + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_basic_information + + override fun observeRequestState() { + equipmentViewModel.loadState.observe(this, { + when (it) { + LoadState.Loading -> LoadingDialogHub.show(requireActivity(), "数据加载中...") + else -> LoadingDialogHub.dismiss() + } + }) + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt new file mode 100644 index 0000000..0b4a747 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class CertificateFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_certificate + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt new file mode 100644 index 0000000..f05c491 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class ChangeRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_change_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt new file mode 100644 index 0000000..849ffa5 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class InspectionRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_inspection_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt new file mode 100644 index 0000000..aa4edd9 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class UsageRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_usage_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java b/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java new file mode 100644 index 0000000..0b9124e --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java @@ -0,0 +1,760 @@ +package com.casic.xz.meterage.model; + +import java.util.List; + +public class EquipmentDetailModel { + + private int code; + private DataModel data; + private String message; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataModel getData() { + return data; + } + + public void setData(DataModel data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public static class DataModel { + private String abc; + private String abcName; + private String assetNo; + private String assetSource; + private String assetType; + private String assetTypeName; + private String attribute; + private String capitalSource; + private String capitalSourceName; + private String cardEstablishmentDate; + private String createTime; + private String createUser; + private String depreciationMethod; + private String depreciationMethodName; + private String depreciationPeriod; + private String enableDate; + private String equipmentCategory; + private String equipmentCategoryName; + private String equipmentName; + private String equipmentNo; + private String equipmentSpecifications; + private String equipmentType; + private String equipmentTypeName; + private List fileList; + private String id; + private String installIncidentalExpenses; + private String installPlace; + private String intactState; + private String isCalibrationTestEquipment; + private int isDel; + private String isFixedAssets; + private String isMeasureAccount; + private String isStandardSupportEquipment; + private String labelBind; + private String majorCategory; + private String majorCategoryName; + private String managerLevel; + private String managerLevelName; + private String managerState; + private String managerStateName; + private String manufacturer; + private String manufacturerCountry; + private String manufacturingDate; + private String manufacturingNo; + private String mesureCycle; + private String mesureDate; + private String mesureDept; + private String mesureRange; + private String mesureResult; + private String mesureResultName; + private String mesureType; + private String mesureTypeName; + private String modelNo; + private String originValue; + private String overallDimension; + private String presentOriginValue; + private String purpose; + private String remark; + private String singlePrice; + private String supportStandardEquipmentName; + private String supportStandardEquipmentNo; + private String technicalLevel; + private String uncertainty; + private String updateTime; + private String useDept; + private String useDeptName; + private String usePerson; + private String usePersonName; + private String validDate; + private int version; + private String weight; + + public String getAbc() { + return abc; + } + + public void setAbc(String abc) { + this.abc = abc; + } + + public String getAbcName() { + return abcName; + } + + public void setAbcName(String abcName) { + this.abcName = abcName; + } + + public String getAssetNo() { + return assetNo; + } + + public void setAssetNo(String assetNo) { + this.assetNo = assetNo; + } + + public String getAssetSource() { + return assetSource; + } + + public void setAssetSource(String assetSource) { + this.assetSource = assetSource; + } + + public String getAssetType() { + return assetType; + } + + public void setAssetType(String assetType) { + this.assetType = assetType; + } + + public String getAssetTypeName() { + return assetTypeName; + } + + public void setAssetTypeName(String assetTypeName) { + this.assetTypeName = assetTypeName; + } + + public String getAttribute() { + return attribute; + } + + public void setAttribute(String attribute) { + this.attribute = attribute; + } + + public String getCapitalSource() { + return capitalSource; + } + + public void setCapitalSource(String capitalSource) { + this.capitalSource = capitalSource; + } + + public String getCapitalSourceName() { + return capitalSourceName; + } + + public void setCapitalSourceName(String capitalSourceName) { + this.capitalSourceName = capitalSourceName; + } + + public String getCardEstablishmentDate() { + return cardEstablishmentDate; + } + + public void setCardEstablishmentDate(String cardEstablishmentDate) { + this.cardEstablishmentDate = cardEstablishmentDate; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getDepreciationMethod() { + return depreciationMethod; + } + + public void setDepreciationMethod(String depreciationMethod) { + this.depreciationMethod = depreciationMethod; + } + + public String getDepreciationMethodName() { + return depreciationMethodName; + } + + public void setDepreciationMethodName(String depreciationMethodName) { + this.depreciationMethodName = depreciationMethodName; + } + + public String getDepreciationPeriod() { + return depreciationPeriod; + } + + public void setDepreciationPeriod(String depreciationPeriod) { + this.depreciationPeriod = depreciationPeriod; + } + + public String getEnableDate() { + return enableDate; + } + + public void setEnableDate(String enableDate) { + this.enableDate = enableDate; + } + + public String getEquipmentCategory() { + return equipmentCategory; + } + + public void setEquipmentCategory(String equipmentCategory) { + this.equipmentCategory = equipmentCategory; + } + + public String getEquipmentCategoryName() { + return equipmentCategoryName; + } + + public void setEquipmentCategoryName(String equipmentCategoryName) { + this.equipmentCategoryName = equipmentCategoryName; + } + + public String getEquipmentName() { + return equipmentName; + } + + public void setEquipmentName(String equipmentName) { + this.equipmentName = equipmentName; + } + + public String getEquipmentNo() { + return equipmentNo; + } + + public void setEquipmentNo(String equipmentNo) { + this.equipmentNo = equipmentNo; + } + + public String getEquipmentSpecifications() { + return equipmentSpecifications; + } + + public void setEquipmentSpecifications(String equipmentSpecifications) { + this.equipmentSpecifications = equipmentSpecifications; + } + + public String getEquipmentType() { + return equipmentType; + } + + public void setEquipmentType(String equipmentType) { + this.equipmentType = equipmentType; + } + + public String getEquipmentTypeName() { + return equipmentTypeName; + } + + public void setEquipmentTypeName(String equipmentTypeName) { + this.equipmentTypeName = equipmentTypeName; + } + + public List getFileList() { + return fileList; + } + + public void setFileList(List fileList) { + this.fileList = fileList; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getInstallIncidentalExpenses() { + return installIncidentalExpenses; + } + + public void setInstallIncidentalExpenses(String installIncidentalExpenses) { + this.installIncidentalExpenses = installIncidentalExpenses; + } + + public String getInstallPlace() { + return installPlace; + } + + public void setInstallPlace(String installPlace) { + this.installPlace = installPlace; + } + + public String getIntactState() { + return intactState; + } + + public void setIntactState(String intactState) { + this.intactState = intactState; + } + + public String getIsCalibrationTestEquipment() { + return isCalibrationTestEquipment; + } + + public void setIsCalibrationTestEquipment(String isCalibrationTestEquipment) { + this.isCalibrationTestEquipment = isCalibrationTestEquipment; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getIsFixedAssets() { + return isFixedAssets; + } + + public void setIsFixedAssets(String isFixedAssets) { + this.isFixedAssets = isFixedAssets; + } + + public String getIsMeasureAccount() { + return isMeasureAccount; + } + + public void setIsMeasureAccount(String isMeasureAccount) { + this.isMeasureAccount = isMeasureAccount; + } + + public String getIsStandardSupportEquipment() { + return isStandardSupportEquipment; + } + + public void setIsStandardSupportEquipment(String isStandardSupportEquipment) { + this.isStandardSupportEquipment = isStandardSupportEquipment; + } + + public String getLabelBind() { + return labelBind; + } + + public void setLabelBind(String labelBind) { + this.labelBind = labelBind; + } + + public String getMajorCategory() { + return majorCategory; + } + + public void setMajorCategory(String majorCategory) { + this.majorCategory = majorCategory; + } + + public String getMajorCategoryName() { + return majorCategoryName; + } + + public void setMajorCategoryName(String majorCategoryName) { + this.majorCategoryName = majorCategoryName; + } + + public String getManagerLevel() { + return managerLevel; + } + + public void setManagerLevel(String managerLevel) { + this.managerLevel = managerLevel; + } + + public String getManagerLevelName() { + return managerLevelName; + } + + public void setManagerLevelName(String managerLevelName) { + this.managerLevelName = managerLevelName; + } + + public String getManagerState() { + return managerState; + } + + public void setManagerState(String managerState) { + this.managerState = managerState; + } + + public String getManagerStateName() { + return managerStateName; + } + + public void setManagerStateName(String managerStateName) { + this.managerStateName = managerStateName; + } + + public String getManufacturer() { + return manufacturer; + } + + public void setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + } + + public String getManufacturerCountry() { + return manufacturerCountry; + } + + public void setManufacturerCountry(String manufacturerCountry) { + this.manufacturerCountry = manufacturerCountry; + } + + public String getManufacturingDate() { + return manufacturingDate; + } + + public void setManufacturingDate(String manufacturingDate) { + this.manufacturingDate = manufacturingDate; + } + + public String getManufacturingNo() { + return manufacturingNo; + } + + public void setManufacturingNo(String manufacturingNo) { + this.manufacturingNo = manufacturingNo; + } + + public String getMesureCycle() { + return mesureCycle; + } + + public void setMesureCycle(String mesureCycle) { + this.mesureCycle = mesureCycle; + } + + public String getMesureDate() { + return mesureDate; + } + + public void setMesureDate(String mesureDate) { + this.mesureDate = mesureDate; + } + + public String getMesureDept() { + return mesureDept; + } + + public void setMesureDept(String mesureDept) { + this.mesureDept = mesureDept; + } + + public String getMesureRange() { + return mesureRange; + } + + public void setMesureRange(String mesureRange) { + this.mesureRange = mesureRange; + } + + public String getMesureResult() { + return mesureResult; + } + + public void setMesureResult(String mesureResult) { + this.mesureResult = mesureResult; + } + + public String getMesureResultName() { + return mesureResultName; + } + + public void setMesureResultName(String mesureResultName) { + this.mesureResultName = mesureResultName; + } + + public String getMesureType() { + return mesureType; + } + + public void setMesureType(String mesureType) { + this.mesureType = mesureType; + } + + public String getMesureTypeName() { + return mesureTypeName; + } + + public void setMesureTypeName(String mesureTypeName) { + this.mesureTypeName = mesureTypeName; + } + + public String getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getOriginValue() { + return originValue; + } + + public void setOriginValue(String originValue) { + this.originValue = originValue; + } + + public String getOverallDimension() { + return overallDimension; + } + + public void setOverallDimension(String overallDimension) { + this.overallDimension = overallDimension; + } + + public String getPresentOriginValue() { + return presentOriginValue; + } + + public void setPresentOriginValue(String presentOriginValue) { + this.presentOriginValue = presentOriginValue; + } + + public String getPurpose() { + return purpose; + } + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getSinglePrice() { + return singlePrice; + } + + public void setSinglePrice(String singlePrice) { + this.singlePrice = singlePrice; + } + + public String getSupportStandardEquipmentName() { + return supportStandardEquipmentName; + } + + public void setSupportStandardEquipmentName(String supportStandardEquipmentName) { + this.supportStandardEquipmentName = supportStandardEquipmentName; + } + + public String getSupportStandardEquipmentNo() { + return supportStandardEquipmentNo; + } + + public void setSupportStandardEquipmentNo(String supportStandardEquipmentNo) { + this.supportStandardEquipmentNo = supportStandardEquipmentNo; + } + + public String getTechnicalLevel() { + return technicalLevel; + } + + public void setTechnicalLevel(String technicalLevel) { + this.technicalLevel = technicalLevel; + } + + public String getUncertainty() { + return uncertainty; + } + + public void setUncertainty(String uncertainty) { + this.uncertainty = uncertainty; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getUseDept() { + return useDept; + } + + public void setUseDept(String useDept) { + this.useDept = useDept; + } + + public String getUseDeptName() { + return useDeptName; + } + + public void setUseDeptName(String useDeptName) { + this.useDeptName = useDeptName; + } + + public String getUsePerson() { + return usePerson; + } + + public void setUsePerson(String usePerson) { + this.usePerson = usePerson; + } + + public String getUsePersonName() { + return usePersonName; + } + + public void setUsePersonName(String usePersonName) { + this.usePersonName = usePersonName; + } + + public String getValidDate() { + return validDate; + } + + public void setValidDate(String validDate) { + this.validDate = validDate; + } + + public int getVersion() { + return version; + } + + public void setVersion(int version) { + this.version = version; + } + + public String getWeight() { + return weight; + } + + public void setWeight(String weight) { + this.weight = weight; + } + + public static class FileListModel { + private String assetId; + private String createTime; + private String createUser; + private String fileName; + private String id; + private int isDel; + private String minioFileName; + private String remark; + private String updateTime; + + public String getAssetId() { + return assetId; + } + + public void setAssetId(String assetId) { + this.assetId = assetId; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getFileName() { + return fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getMinioFileName() { + return minioFileName; + } + + public void setMinioFileName(String minioFileName) { + this.minioFileName = minioFileName; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + } + } +} diff --git a/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java b/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java new file mode 100644 index 0000000..15fc128 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java @@ -0,0 +1,697 @@ +package com.casic.xz.meterage.model; + +import java.util.List; + +public class EquipmentListModel { + + private int code; + private DataModel data; + private String message; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataModel getData() { + return data; + } + + public void setData(DataModel data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public static class DataModel { + private List rows; + private int total; + + public List getRows() { + return rows; + } + + public void setRows(List rows) { + this.rows = rows; + } + + public int getTotal() { + return total; + } + + public void setTotal(int total) { + this.total = total; + } + + public static class RowsModel { + private String abc; + private String abcName; + private String assetNo; + private String assetSource; + private String assetType; + private String assetTypeName; + private String attribute; + private String capitalSource; + private String capitalSourceName; + private String cardEstablishmentDate; + private String createTime; + private String createUser; + private String depreciationMethod; + private String depreciationMethodName; + private String depreciationPeriod; + private String enableDate; + private String equipmentCategory; + private String equipmentCategoryName; + private String equipmentName; + private String equipmentNo; + private String equipmentSpecifications; + private String equipmentType; + private String equipmentTypeName; + private String fileList; + private String id; + private String installIncidentalExpenses; + private String installPlace; + private String intactState; + private String isCalibrationTestEquipment; + private int isDel; + private String isFixedAssets; + private String isMeasureAccount; + private String isStandardSupportEquipment; + private String labelBind; + private String majorCategory; + private String majorCategoryName; + private String managerLevel; + private String managerLevelName; + private String managerState; + private String managerStateName; + private String manufacturer; + private String manufacturerCountry; + private String manufacturingDate; + private String manufacturingNo; + private String mesureCycle; + private String mesureDate; + private String mesureDept; + private String mesureRange; + private String mesureResult; + private String mesureResultName; + private String mesureType; + private String mesureTypeName; + private String modelNo; + private String originValue; + private String overallDimension; + private String presentOriginValue; + private String purpose; + private String remark; + private String singlePrice; + private String supportStandardEquipmentName; + private String supportStandardEquipmentNo; + private String technicalLevel; + private String uncertainty; + private String updateTime; + private String useDept; + private String useDeptName; + private String usePerson; + private String usePersonName; + private String validDate; + private int version; + private String weight; + + public String getAbc() { + return abc; + } + + public void setAbc(String abc) { + this.abc = abc; + } + + public String getAbcName() { + return abcName; + } + + public void setAbcName(String abcName) { + this.abcName = abcName; + } + + public String getAssetNo() { + return assetNo; + } + + public void setAssetNo(String assetNo) { + this.assetNo = assetNo; + } + + public String getAssetSource() { + return assetSource; + } + + public void setAssetSource(String assetSource) { + this.assetSource = assetSource; + } + + public String getAssetType() { + return assetType; + } + + public void setAssetType(String assetType) { + this.assetType = assetType; + } + + public String getAssetTypeName() { + return assetTypeName; + } + + public void setAssetTypeName(String assetTypeName) { + this.assetTypeName = assetTypeName; + } + + public String getAttribute() { + return attribute; + } + + public void setAttribute(String attribute) { + this.attribute = attribute; + } + + public String getCapitalSource() { + return capitalSource; + } + + public void setCapitalSource(String capitalSource) { + this.capitalSource = capitalSource; + } + + public String getCapitalSourceName() { + return capitalSourceName; + } + + public void setCapitalSourceName(String capitalSourceName) { + this.capitalSourceName = capitalSourceName; + } + + public String getCardEstablishmentDate() { + return cardEstablishmentDate; + } + + public void setCardEstablishmentDate(String cardEstablishmentDate) { + this.cardEstablishmentDate = cardEstablishmentDate; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getDepreciationMethod() { + return depreciationMethod; + } + + public void setDepreciationMethod(String depreciationMethod) { + this.depreciationMethod = depreciationMethod; + } + + public String getDepreciationMethodName() { + return depreciationMethodName; + } + + public void setDepreciationMethodName(String depreciationMethodName) { + this.depreciationMethodName = depreciationMethodName; + } + + public String getDepreciationPeriod() { + return depreciationPeriod; + } + + public void setDepreciationPeriod(String depreciationPeriod) { + this.depreciationPeriod = depreciationPeriod; + } + + public String getEnableDate() { + return enableDate; + } + + public void setEnableDate(String enableDate) { + this.enableDate = enableDate; + } + + public String getEquipmentCategory() { + return equipmentCategory; + } + + public void setEquipmentCategory(String equipmentCategory) { + this.equipmentCategory = equipmentCategory; + } + + public String getEquipmentCategoryName() { + return equipmentCategoryName; + } + + public void setEquipmentCategoryName(String equipmentCategoryName) { + this.equipmentCategoryName = equipmentCategoryName; + } + + public String getEquipmentName() { + return equipmentName; + } + + public void setEquipmentName(String equipmentName) { + this.equipmentName = equipmentName; + } + + public String getEquipmentNo() { + return equipmentNo; + } + + public void setEquipmentNo(String equipmentNo) { + this.equipmentNo = equipmentNo; + } + + public String getEquipmentSpecifications() { + return equipmentSpecifications; + } + + public void setEquipmentSpecifications(String equipmentSpecifications) { + this.equipmentSpecifications = equipmentSpecifications; + } + + public String getEquipmentType() { + return equipmentType; + } + + public void setEquipmentType(String equipmentType) { + this.equipmentType = equipmentType; + } + + public String getEquipmentTypeName() { + return equipmentTypeName; + } + + public void setEquipmentTypeName(String equipmentTypeName) { + this.equipmentTypeName = equipmentTypeName; + } + + public String getFileList() { + return fileList; + } + + public void setFileList(String fileList) { + this.fileList = fileList; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getInstallIncidentalExpenses() { + return installIncidentalExpenses; + } + + public void setInstallIncidentalExpenses(String installIncidentalExpenses) { + this.installIncidentalExpenses = installIncidentalExpenses; + } + + public String getInstallPlace() { + return installPlace; + } + + public void setInstallPlace(String installPlace) { + this.installPlace = installPlace; + } + + public String getIntactState() { + return intactState; + } + + public void setIntactState(String intactState) { + this.intactState = intactState; + } + + public String getIsCalibrationTestEquipment() { + return isCalibrationTestEquipment; + } + + public void setIsCalibrationTestEquipment(String isCalibrationTestEquipment) { + this.isCalibrationTestEquipment = isCalibrationTestEquipment; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getIsFixedAssets() { + return isFixedAssets; + } + + public void setIsFixedAssets(String isFixedAssets) { + this.isFixedAssets = isFixedAssets; + } + + public String getIsMeasureAccount() { + return isMeasureAccount; + } + + public void setIsMeasureAccount(String isMeasureAccount) { + this.isMeasureAccount = isMeasureAccount; + } + + public String getIsStandardSupportEquipment() { + return isStandardSupportEquipment; + } + + public void setIsStandardSupportEquipment(String isStandardSupportEquipment) { + this.isStandardSupportEquipment = isStandardSupportEquipment; + } + + public String getLabelBind() { + return labelBind; + } + + public void setLabelBind(String labelBind) { + this.labelBind = labelBind; + } + + public String getMajorCategory() { + return majorCategory; + } + + public void setMajorCategory(String majorCategory) { + this.majorCategory = majorCategory; + } + + public String getMajorCategoryName() { + return majorCategoryName; + } + + public void setMajorCategoryName(String majorCategoryName) { + this.majorCategoryName = majorCategoryName; + } + + public String getManagerLevel() { + return managerLevel; + } + + public void setManagerLevel(String managerLevel) { + this.managerLevel = managerLevel; + } + + public String getManagerLevelName() { + return managerLevelName; + } + + public void setManagerLevelName(String managerLevelName) { + this.managerLevelName = managerLevelName; + } + + public String getManagerState() { + return managerState; + } + + public void setManagerState(String managerState) { + this.managerState = managerState; + } + + public String getManagerStateName() { + return managerStateName; + } + + public void setManagerStateName(String managerStateName) { + this.managerStateName = managerStateName; + } + + public String getManufacturer() { + return manufacturer; + } + + public void setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + } + + public String getManufacturerCountry() { + return manufacturerCountry; + } + + public void setManufacturerCountry(String manufacturerCountry) { + this.manufacturerCountry = manufacturerCountry; + } + + public String getManufacturingDate() { + return manufacturingDate; + } + + public void setManufacturingDate(String manufacturingDate) { + this.manufacturingDate = manufacturingDate; + } + + public String getManufacturingNo() { + return manufacturingNo; + } + + public void setManufacturingNo(String manufacturingNo) { + this.manufacturingNo = manufacturingNo; + } + + public String getMesureCycle() { + return mesureCycle; + } + + public void setMesureCycle(String mesureCycle) { + this.mesureCycle = mesureCycle; + } + + public String getMesureDate() { + return mesureDate; + } + + public void setMesureDate(String mesureDate) { + this.mesureDate = mesureDate; + } + + public String getMesureDept() { + return mesureDept; + } + + public void setMesureDept(String mesureDept) { + this.mesureDept = mesureDept; + } + + public String getMesureRange() { + return mesureRange; + } + + public void setMesureRange(String mesureRange) { + this.mesureRange = mesureRange; + } + + public String getMesureResult() { + return mesureResult; + } + + public void setMesureResult(String mesureResult) { + this.mesureResult = mesureResult; + } + + public String getMesureResultName() { + return mesureResultName; + } + + public void setMesureResultName(String mesureResultName) { + this.mesureResultName = mesureResultName; + } + + public String getMesureType() { + return mesureType; + } + + public void setMesureType(String mesureType) { + this.mesureType = mesureType; + } + + public String getMesureTypeName() { + return mesureTypeName; + } + + public void setMesureTypeName(String mesureTypeName) { + this.mesureTypeName = mesureTypeName; + } + + public String getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getOriginValue() { + return originValue; + } + + public void setOriginValue(String originValue) { + this.originValue = originValue; + } + + public String getOverallDimension() { + return overallDimension; + } + + public void setOverallDimension(String overallDimension) { + this.overallDimension = overallDimension; + } + + public String getPresentOriginValue() { + return presentOriginValue; + } + + public void setPresentOriginValue(String presentOriginValue) { + this.presentOriginValue = presentOriginValue; + } + + public String getPurpose() { + return purpose; + } + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getSinglePrice() { + return singlePrice; + } + + public void setSinglePrice(String singlePrice) { + this.singlePrice = singlePrice; + } + + public String getSupportStandardEquipmentName() { + return supportStandardEquipmentName; + } + + public void setSupportStandardEquipmentName(String supportStandardEquipmentName) { + this.supportStandardEquipmentName = supportStandardEquipmentName; + } + + public String getSupportStandardEquipmentNo() { + return supportStandardEquipmentNo; + } + + public void setSupportStandardEquipmentNo(String supportStandardEquipmentNo) { + this.supportStandardEquipmentNo = supportStandardEquipmentNo; + } + + public String getTechnicalLevel() { + return technicalLevel; + } + + public void setTechnicalLevel(String technicalLevel) { + this.technicalLevel = technicalLevel; + } + + public String getUncertainty() { + return uncertainty; + } + + public void setUncertainty(String uncertainty) { + this.uncertainty = uncertainty; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getUseDept() { + return useDept; + } + + public void setUseDept(String useDept) { + this.useDept = useDept; + } + + public String getUseDeptName() { + return useDeptName; + } + + public void setUseDeptName(String useDeptName) { + this.useDeptName = useDeptName; + } + + public String getUsePerson() { + return usePerson; + } + + public void setUsePerson(String usePerson) { + this.usePerson = usePerson; + } + + public String getUsePersonName() { + return usePersonName; + } + + public void setUsePersonName(String usePersonName) { + this.usePersonName = usePersonName; + } + + public String getValidDate() { + return validDate; + } + + public void setValidDate(String validDate) { + this.validDate = validDate; + } + + public int getVersion() { + return version; + } + + public void setVersion(int version) { + this.version = version; + } + + public String getWeight() { + return weight; + } + + public void setWeight(String weight) { + this.weight = weight; + } + } + } +} diff --git a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt index a3f514f..46e5eef 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt @@ -35,4 +35,24 @@ @QueryMap limit: Map, @QueryMap offset: Map ): String + + /** + * 获取设备列表 + */ + @POST("/meter/assets/listPage") + suspend fun getEquipmentList( + @Header("token") token: String, + @Body requestBody: RequestBody, + @QueryMap limit: Map, + @QueryMap offset: Map + ): String + + /** + * 获取设备详情 + */ + @POST("/meter/assets/detail") + suspend fun getEquipmentDetail( + @Header("token") token: String, + @Body requestBody: RequestBody + ): String } \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 3892b5a..02160cd 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -34,16 +34,18 @@ - - - - - - - + + + + + + + + + +) : RecyclerView.Adapter() { + + private var layoutInflater: LayoutInflater = LayoutInflater.from(context) + + override fun getItemCount(): Int = dataRows.size + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = ItemViewHolder( + layoutInflater.inflate(R.layout.item_equipment_rv_l, parent, false) + ) + + override fun onBindViewHolder(holder: ItemViewHolder, position: Int) { + //绑定数据 + val rowsBean = dataRows[position] + holder.equipmentNameView.text = rowsBean.equipmentName + holder.equipmentCodeView.text = rowsBean.equipmentNo + holder.equipmentDateView.text = rowsBean.enableDate + holder.equipmentLibView.text = rowsBean.useDeptName + + //绑定事件 + holder.itemView.setOnClickListener { + listener?.onItemClicked(position) + } + } + + inner class ItemViewHolder(view: View) : RecyclerView.ViewHolder(view) { + var equipmentNameView: TextView = view.findViewById(R.id.equipmentNameView) + var equipmentCodeView: TextView = view.findViewById(R.id.equipmentCodeView) + var equipmentDateView: TextView = view.findViewById(R.id.equipmentDateView) + var equipmentLibView: TextView = view.findViewById(R.id.equipmentLibView) + } + + private var listener: OnItemClickListener? = null + + interface OnItemClickListener { + fun onItemClicked(position: Int) + } + + fun setOnItemClickListener(onClickListener: OnItemClickListener?) { + this.listener = onClickListener + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt index b4628f3..d970b55 100644 --- a/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt +++ b/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt @@ -5,7 +5,8 @@ import com.casic.xz.meterage.R import com.casic.xz.meterage.adapter.HomeGridAdapter import com.casic.xz.meterage.utils.LocaleConstant -import com.casic.xz.meterage.view.NoticeListActivity +import com.casic.xz.meterage.view.home.EquipmentActivity +import com.casic.xz.meterage.view.notice.NoticeListActivity import com.casic.xz.meterage.vm.NoticeViewModel import com.pengxh.kt.lite.base.KotlinBaseFragment import com.pengxh.kt.lite.extensions.navigatePageTo @@ -36,8 +37,19 @@ homeFuncRecyclerView.adapter = homeAdapter homeAdapter.setOnGridItemClickListener(object : HomeGridAdapter.OnGridItemClickListener { override fun onItemClick(position: Int) { - when (position) { - + when (LocaleConstant.HOME_FUNC_OPERATE[position]) { + "仪器设备" -> requireContext().navigatePageTo() +// "标准装置" -> requireContext().navigatePageTo() +// "证书报告" -> requireContext().navigatePageTo() +// "委托需求" -> requireContext().navigatePageTo() +// "访客" -> requireContext().navigatePageTo() +// "标准规范" -> requireContext().navigatePageTo() +// "能力列表" -> requireContext().navigatePageTo() +// "计量培训" -> requireContext().navigatePageTo() +// "合同发票" -> requireContext().navigatePageTo() +// "业务统计" -> requireContext().navigatePageTo() +// "客户列表" -> requireContext().navigatePageTo() +// "外场检测" -> requireContext().navigatePageTo() } } }) diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt index 7e75abe..56dc5ec 100644 --- a/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt +++ b/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt @@ -2,9 +2,11 @@ import android.view.View import androidx.lifecycle.ViewModelProvider +import com.bumptech.glide.Glide +import com.bumptech.glide.request.RequestOptions import com.casic.xz.meterage.R import com.casic.xz.meterage.utils.LocaleConstant -import com.casic.xz.meterage.view.NoticeListActivity +import com.casic.xz.meterage.view.notice.NoticeListActivity import com.casic.xz.meterage.vm.NoticeViewModel import com.casic.xz.meterage.vm.UserViewModel import com.pengxh.kt.lite.base.KotlinBaseFragment @@ -23,6 +25,12 @@ val data = it.data userNameView.text = data.name userUnitView.text = data.deptName + +// Glide.with(requireContext()) +// .load(R.mipmap.default_avatar) +// .apply(RequestOptions.circleCropTransform()) +// .placeholder(R.mipmap.load_image_error) +// .into(userAvatarView) } }) diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt new file mode 100644 index 0000000..cf22646 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt @@ -0,0 +1,103 @@ +package com.casic.xz.meterage.fragment.equipment + +import android.graphics.Paint +import androidx.lifecycle.ViewModelProvider +import com.casic.xz.meterage.R +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.casic.xz.meterage.vm.EquipmentViewModel +import com.pengxh.kt.lite.base.KotlinBaseFragment +import com.pengxh.kt.lite.extensions.convertColor +import com.pengxh.kt.lite.vm.LoadState +import kotlinx.android.synthetic.main.fragment_basic_information.* + +class BasicInformationFragment(private val id: String) : KotlinBaseFragment() { + + private lateinit var equipmentViewModel: EquipmentViewModel + + override fun initData() { + equipmentViewModel = ViewModelProvider(this)[EquipmentViewModel::class.java] + equipmentViewModel.getEquipmentDetail(id) + equipmentViewModel.equipmentDetailResult.observe(this, { + if (it.code == 200) { + val data = it.data!! + + equipmentCodeView.text = data.equipmentNo + equipmentNameView.text = data.equipmentName + manufacturerView.text = data.manufacturer + factoryNumberView.text = data.manufacturingNo + modelView.text = data.modelNo + verificationMethodView.text = data.mesureTypeName + measuringRangeView.text = data.mesureRange + uncertaintyView.text = data.uncertainty + firstUseView.text = data.createTime + originalValueView.text = data.originValue + usageDeptView.text = data.useDeptName + userView.text = data.usePersonName + managementStatusView.text = data.managerStateName + verificationDeptView.text = data.useDeptName +// nextVerificationDeptView.text = data. + verificationPeriodView.text = data.mesureCycle + verificationDateView.text = data.mesureDate + effectiveDateView.text = data.validDate + verificationResultsView.text = data.mesureResultName + abcView.text = data.abcName + isNeedTechnicalView.text = if ( + data.isCalibrationTestEquipment.isNullOrBlank() || data.isCalibrationTestEquipment == "0" + ) { + "否" + } else { + "是" + } + + isStandingBook.text = if ( + data.isMeasureAccount.isNullOrBlank() || data.isMeasureAccount == "0" + ) { + "否" + } else { + "是" + } + + isStandardView.text = if ( + data.isStandardSupportEquipment.isNullOrBlank() || data.isStandardSupportEquipment == "0" + ) { + "否" + } else { + "是" + } + remarkView.text = data.remark + if (data.fileList.size == 0) { + instructionsView.text = "暂无" + } else { + instructionsView.text = "查看附件列表" + val textPaint = instructionsView.paint + textPaint.flags = Paint.UNDERLINE_TEXT_FLAG + textPaint.isAntiAlias = true + instructionsView.setTextColor(R.color.themeColor.convertColor(requireContext())) + + instructionsView.setOnClickListener { + + } + } + } + }) + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_basic_information + + override fun observeRequestState() { + equipmentViewModel.loadState.observe(this, { + when (it) { + LoadState.Loading -> LoadingDialogHub.show(requireActivity(), "数据加载中...") + else -> LoadingDialogHub.dismiss() + } + }) + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt new file mode 100644 index 0000000..0b4a747 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class CertificateFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_certificate + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt new file mode 100644 index 0000000..f05c491 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class ChangeRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_change_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt new file mode 100644 index 0000000..849ffa5 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class InspectionRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_inspection_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt new file mode 100644 index 0000000..aa4edd9 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class UsageRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_usage_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java b/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java new file mode 100644 index 0000000..0b9124e --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java @@ -0,0 +1,760 @@ +package com.casic.xz.meterage.model; + +import java.util.List; + +public class EquipmentDetailModel { + + private int code; + private DataModel data; + private String message; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataModel getData() { + return data; + } + + public void setData(DataModel data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public static class DataModel { + private String abc; + private String abcName; + private String assetNo; + private String assetSource; + private String assetType; + private String assetTypeName; + private String attribute; + private String capitalSource; + private String capitalSourceName; + private String cardEstablishmentDate; + private String createTime; + private String createUser; + private String depreciationMethod; + private String depreciationMethodName; + private String depreciationPeriod; + private String enableDate; + private String equipmentCategory; + private String equipmentCategoryName; + private String equipmentName; + private String equipmentNo; + private String equipmentSpecifications; + private String equipmentType; + private String equipmentTypeName; + private List fileList; + private String id; + private String installIncidentalExpenses; + private String installPlace; + private String intactState; + private String isCalibrationTestEquipment; + private int isDel; + private String isFixedAssets; + private String isMeasureAccount; + private String isStandardSupportEquipment; + private String labelBind; + private String majorCategory; + private String majorCategoryName; + private String managerLevel; + private String managerLevelName; + private String managerState; + private String managerStateName; + private String manufacturer; + private String manufacturerCountry; + private String manufacturingDate; + private String manufacturingNo; + private String mesureCycle; + private String mesureDate; + private String mesureDept; + private String mesureRange; + private String mesureResult; + private String mesureResultName; + private String mesureType; + private String mesureTypeName; + private String modelNo; + private String originValue; + private String overallDimension; + private String presentOriginValue; + private String purpose; + private String remark; + private String singlePrice; + private String supportStandardEquipmentName; + private String supportStandardEquipmentNo; + private String technicalLevel; + private String uncertainty; + private String updateTime; + private String useDept; + private String useDeptName; + private String usePerson; + private String usePersonName; + private String validDate; + private int version; + private String weight; + + public String getAbc() { + return abc; + } + + public void setAbc(String abc) { + this.abc = abc; + } + + public String getAbcName() { + return abcName; + } + + public void setAbcName(String abcName) { + this.abcName = abcName; + } + + public String getAssetNo() { + return assetNo; + } + + public void setAssetNo(String assetNo) { + this.assetNo = assetNo; + } + + public String getAssetSource() { + return assetSource; + } + + public void setAssetSource(String assetSource) { + this.assetSource = assetSource; + } + + public String getAssetType() { + return assetType; + } + + public void setAssetType(String assetType) { + this.assetType = assetType; + } + + public String getAssetTypeName() { + return assetTypeName; + } + + public void setAssetTypeName(String assetTypeName) { + this.assetTypeName = assetTypeName; + } + + public String getAttribute() { + return attribute; + } + + public void setAttribute(String attribute) { + this.attribute = attribute; + } + + public String getCapitalSource() { + return capitalSource; + } + + public void setCapitalSource(String capitalSource) { + this.capitalSource = capitalSource; + } + + public String getCapitalSourceName() { + return capitalSourceName; + } + + public void setCapitalSourceName(String capitalSourceName) { + this.capitalSourceName = capitalSourceName; + } + + public String getCardEstablishmentDate() { + return cardEstablishmentDate; + } + + public void setCardEstablishmentDate(String cardEstablishmentDate) { + this.cardEstablishmentDate = cardEstablishmentDate; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getDepreciationMethod() { + return depreciationMethod; + } + + public void setDepreciationMethod(String depreciationMethod) { + this.depreciationMethod = depreciationMethod; + } + + public String getDepreciationMethodName() { + return depreciationMethodName; + } + + public void setDepreciationMethodName(String depreciationMethodName) { + this.depreciationMethodName = depreciationMethodName; + } + + public String getDepreciationPeriod() { + return depreciationPeriod; + } + + public void setDepreciationPeriod(String depreciationPeriod) { + this.depreciationPeriod = depreciationPeriod; + } + + public String getEnableDate() { + return enableDate; + } + + public void setEnableDate(String enableDate) { + this.enableDate = enableDate; + } + + public String getEquipmentCategory() { + return equipmentCategory; + } + + public void setEquipmentCategory(String equipmentCategory) { + this.equipmentCategory = equipmentCategory; + } + + public String getEquipmentCategoryName() { + return equipmentCategoryName; + } + + public void setEquipmentCategoryName(String equipmentCategoryName) { + this.equipmentCategoryName = equipmentCategoryName; + } + + public String getEquipmentName() { + return equipmentName; + } + + public void setEquipmentName(String equipmentName) { + this.equipmentName = equipmentName; + } + + public String getEquipmentNo() { + return equipmentNo; + } + + public void setEquipmentNo(String equipmentNo) { + this.equipmentNo = equipmentNo; + } + + public String getEquipmentSpecifications() { + return equipmentSpecifications; + } + + public void setEquipmentSpecifications(String equipmentSpecifications) { + this.equipmentSpecifications = equipmentSpecifications; + } + + public String getEquipmentType() { + return equipmentType; + } + + public void setEquipmentType(String equipmentType) { + this.equipmentType = equipmentType; + } + + public String getEquipmentTypeName() { + return equipmentTypeName; + } + + public void setEquipmentTypeName(String equipmentTypeName) { + this.equipmentTypeName = equipmentTypeName; + } + + public List getFileList() { + return fileList; + } + + public void setFileList(List fileList) { + this.fileList = fileList; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getInstallIncidentalExpenses() { + return installIncidentalExpenses; + } + + public void setInstallIncidentalExpenses(String installIncidentalExpenses) { + this.installIncidentalExpenses = installIncidentalExpenses; + } + + public String getInstallPlace() { + return installPlace; + } + + public void setInstallPlace(String installPlace) { + this.installPlace = installPlace; + } + + public String getIntactState() { + return intactState; + } + + public void setIntactState(String intactState) { + this.intactState = intactState; + } + + public String getIsCalibrationTestEquipment() { + return isCalibrationTestEquipment; + } + + public void setIsCalibrationTestEquipment(String isCalibrationTestEquipment) { + this.isCalibrationTestEquipment = isCalibrationTestEquipment; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getIsFixedAssets() { + return isFixedAssets; + } + + public void setIsFixedAssets(String isFixedAssets) { + this.isFixedAssets = isFixedAssets; + } + + public String getIsMeasureAccount() { + return isMeasureAccount; + } + + public void setIsMeasureAccount(String isMeasureAccount) { + this.isMeasureAccount = isMeasureAccount; + } + + public String getIsStandardSupportEquipment() { + return isStandardSupportEquipment; + } + + public void setIsStandardSupportEquipment(String isStandardSupportEquipment) { + this.isStandardSupportEquipment = isStandardSupportEquipment; + } + + public String getLabelBind() { + return labelBind; + } + + public void setLabelBind(String labelBind) { + this.labelBind = labelBind; + } + + public String getMajorCategory() { + return majorCategory; + } + + public void setMajorCategory(String majorCategory) { + this.majorCategory = majorCategory; + } + + public String getMajorCategoryName() { + return majorCategoryName; + } + + public void setMajorCategoryName(String majorCategoryName) { + this.majorCategoryName = majorCategoryName; + } + + public String getManagerLevel() { + return managerLevel; + } + + public void setManagerLevel(String managerLevel) { + this.managerLevel = managerLevel; + } + + public String getManagerLevelName() { + return managerLevelName; + } + + public void setManagerLevelName(String managerLevelName) { + this.managerLevelName = managerLevelName; + } + + public String getManagerState() { + return managerState; + } + + public void setManagerState(String managerState) { + this.managerState = managerState; + } + + public String getManagerStateName() { + return managerStateName; + } + + public void setManagerStateName(String managerStateName) { + this.managerStateName = managerStateName; + } + + public String getManufacturer() { + return manufacturer; + } + + public void setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + } + + public String getManufacturerCountry() { + return manufacturerCountry; + } + + public void setManufacturerCountry(String manufacturerCountry) { + this.manufacturerCountry = manufacturerCountry; + } + + public String getManufacturingDate() { + return manufacturingDate; + } + + public void setManufacturingDate(String manufacturingDate) { + this.manufacturingDate = manufacturingDate; + } + + public String getManufacturingNo() { + return manufacturingNo; + } + + public void setManufacturingNo(String manufacturingNo) { + this.manufacturingNo = manufacturingNo; + } + + public String getMesureCycle() { + return mesureCycle; + } + + public void setMesureCycle(String mesureCycle) { + this.mesureCycle = mesureCycle; + } + + public String getMesureDate() { + return mesureDate; + } + + public void setMesureDate(String mesureDate) { + this.mesureDate = mesureDate; + } + + public String getMesureDept() { + return mesureDept; + } + + public void setMesureDept(String mesureDept) { + this.mesureDept = mesureDept; + } + + public String getMesureRange() { + return mesureRange; + } + + public void setMesureRange(String mesureRange) { + this.mesureRange = mesureRange; + } + + public String getMesureResult() { + return mesureResult; + } + + public void setMesureResult(String mesureResult) { + this.mesureResult = mesureResult; + } + + public String getMesureResultName() { + return mesureResultName; + } + + public void setMesureResultName(String mesureResultName) { + this.mesureResultName = mesureResultName; + } + + public String getMesureType() { + return mesureType; + } + + public void setMesureType(String mesureType) { + this.mesureType = mesureType; + } + + public String getMesureTypeName() { + return mesureTypeName; + } + + public void setMesureTypeName(String mesureTypeName) { + this.mesureTypeName = mesureTypeName; + } + + public String getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getOriginValue() { + return originValue; + } + + public void setOriginValue(String originValue) { + this.originValue = originValue; + } + + public String getOverallDimension() { + return overallDimension; + } + + public void setOverallDimension(String overallDimension) { + this.overallDimension = overallDimension; + } + + public String getPresentOriginValue() { + return presentOriginValue; + } + + public void setPresentOriginValue(String presentOriginValue) { + this.presentOriginValue = presentOriginValue; + } + + public String getPurpose() { + return purpose; + } + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getSinglePrice() { + return singlePrice; + } + + public void setSinglePrice(String singlePrice) { + this.singlePrice = singlePrice; + } + + public String getSupportStandardEquipmentName() { + return supportStandardEquipmentName; + } + + public void setSupportStandardEquipmentName(String supportStandardEquipmentName) { + this.supportStandardEquipmentName = supportStandardEquipmentName; + } + + public String getSupportStandardEquipmentNo() { + return supportStandardEquipmentNo; + } + + public void setSupportStandardEquipmentNo(String supportStandardEquipmentNo) { + this.supportStandardEquipmentNo = supportStandardEquipmentNo; + } + + public String getTechnicalLevel() { + return technicalLevel; + } + + public void setTechnicalLevel(String technicalLevel) { + this.technicalLevel = technicalLevel; + } + + public String getUncertainty() { + return uncertainty; + } + + public void setUncertainty(String uncertainty) { + this.uncertainty = uncertainty; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getUseDept() { + return useDept; + } + + public void setUseDept(String useDept) { + this.useDept = useDept; + } + + public String getUseDeptName() { + return useDeptName; + } + + public void setUseDeptName(String useDeptName) { + this.useDeptName = useDeptName; + } + + public String getUsePerson() { + return usePerson; + } + + public void setUsePerson(String usePerson) { + this.usePerson = usePerson; + } + + public String getUsePersonName() { + return usePersonName; + } + + public void setUsePersonName(String usePersonName) { + this.usePersonName = usePersonName; + } + + public String getValidDate() { + return validDate; + } + + public void setValidDate(String validDate) { + this.validDate = validDate; + } + + public int getVersion() { + return version; + } + + public void setVersion(int version) { + this.version = version; + } + + public String getWeight() { + return weight; + } + + public void setWeight(String weight) { + this.weight = weight; + } + + public static class FileListModel { + private String assetId; + private String createTime; + private String createUser; + private String fileName; + private String id; + private int isDel; + private String minioFileName; + private String remark; + private String updateTime; + + public String getAssetId() { + return assetId; + } + + public void setAssetId(String assetId) { + this.assetId = assetId; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getFileName() { + return fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getMinioFileName() { + return minioFileName; + } + + public void setMinioFileName(String minioFileName) { + this.minioFileName = minioFileName; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + } + } +} diff --git a/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java b/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java new file mode 100644 index 0000000..15fc128 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java @@ -0,0 +1,697 @@ +package com.casic.xz.meterage.model; + +import java.util.List; + +public class EquipmentListModel { + + private int code; + private DataModel data; + private String message; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataModel getData() { + return data; + } + + public void setData(DataModel data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public static class DataModel { + private List rows; + private int total; + + public List getRows() { + return rows; + } + + public void setRows(List rows) { + this.rows = rows; + } + + public int getTotal() { + return total; + } + + public void setTotal(int total) { + this.total = total; + } + + public static class RowsModel { + private String abc; + private String abcName; + private String assetNo; + private String assetSource; + private String assetType; + private String assetTypeName; + private String attribute; + private String capitalSource; + private String capitalSourceName; + private String cardEstablishmentDate; + private String createTime; + private String createUser; + private String depreciationMethod; + private String depreciationMethodName; + private String depreciationPeriod; + private String enableDate; + private String equipmentCategory; + private String equipmentCategoryName; + private String equipmentName; + private String equipmentNo; + private String equipmentSpecifications; + private String equipmentType; + private String equipmentTypeName; + private String fileList; + private String id; + private String installIncidentalExpenses; + private String installPlace; + private String intactState; + private String isCalibrationTestEquipment; + private int isDel; + private String isFixedAssets; + private String isMeasureAccount; + private String isStandardSupportEquipment; + private String labelBind; + private String majorCategory; + private String majorCategoryName; + private String managerLevel; + private String managerLevelName; + private String managerState; + private String managerStateName; + private String manufacturer; + private String manufacturerCountry; + private String manufacturingDate; + private String manufacturingNo; + private String mesureCycle; + private String mesureDate; + private String mesureDept; + private String mesureRange; + private String mesureResult; + private String mesureResultName; + private String mesureType; + private String mesureTypeName; + private String modelNo; + private String originValue; + private String overallDimension; + private String presentOriginValue; + private String purpose; + private String remark; + private String singlePrice; + private String supportStandardEquipmentName; + private String supportStandardEquipmentNo; + private String technicalLevel; + private String uncertainty; + private String updateTime; + private String useDept; + private String useDeptName; + private String usePerson; + private String usePersonName; + private String validDate; + private int version; + private String weight; + + public String getAbc() { + return abc; + } + + public void setAbc(String abc) { + this.abc = abc; + } + + public String getAbcName() { + return abcName; + } + + public void setAbcName(String abcName) { + this.abcName = abcName; + } + + public String getAssetNo() { + return assetNo; + } + + public void setAssetNo(String assetNo) { + this.assetNo = assetNo; + } + + public String getAssetSource() { + return assetSource; + } + + public void setAssetSource(String assetSource) { + this.assetSource = assetSource; + } + + public String getAssetType() { + return assetType; + } + + public void setAssetType(String assetType) { + this.assetType = assetType; + } + + public String getAssetTypeName() { + return assetTypeName; + } + + public void setAssetTypeName(String assetTypeName) { + this.assetTypeName = assetTypeName; + } + + public String getAttribute() { + return attribute; + } + + public void setAttribute(String attribute) { + this.attribute = attribute; + } + + public String getCapitalSource() { + return capitalSource; + } + + public void setCapitalSource(String capitalSource) { + this.capitalSource = capitalSource; + } + + public String getCapitalSourceName() { + return capitalSourceName; + } + + public void setCapitalSourceName(String capitalSourceName) { + this.capitalSourceName = capitalSourceName; + } + + public String getCardEstablishmentDate() { + return cardEstablishmentDate; + } + + public void setCardEstablishmentDate(String cardEstablishmentDate) { + this.cardEstablishmentDate = cardEstablishmentDate; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getDepreciationMethod() { + return depreciationMethod; + } + + public void setDepreciationMethod(String depreciationMethod) { + this.depreciationMethod = depreciationMethod; + } + + public String getDepreciationMethodName() { + return depreciationMethodName; + } + + public void setDepreciationMethodName(String depreciationMethodName) { + this.depreciationMethodName = depreciationMethodName; + } + + public String getDepreciationPeriod() { + return depreciationPeriod; + } + + public void setDepreciationPeriod(String depreciationPeriod) { + this.depreciationPeriod = depreciationPeriod; + } + + public String getEnableDate() { + return enableDate; + } + + public void setEnableDate(String enableDate) { + this.enableDate = enableDate; + } + + public String getEquipmentCategory() { + return equipmentCategory; + } + + public void setEquipmentCategory(String equipmentCategory) { + this.equipmentCategory = equipmentCategory; + } + + public String getEquipmentCategoryName() { + return equipmentCategoryName; + } + + public void setEquipmentCategoryName(String equipmentCategoryName) { + this.equipmentCategoryName = equipmentCategoryName; + } + + public String getEquipmentName() { + return equipmentName; + } + + public void setEquipmentName(String equipmentName) { + this.equipmentName = equipmentName; + } + + public String getEquipmentNo() { + return equipmentNo; + } + + public void setEquipmentNo(String equipmentNo) { + this.equipmentNo = equipmentNo; + } + + public String getEquipmentSpecifications() { + return equipmentSpecifications; + } + + public void setEquipmentSpecifications(String equipmentSpecifications) { + this.equipmentSpecifications = equipmentSpecifications; + } + + public String getEquipmentType() { + return equipmentType; + } + + public void setEquipmentType(String equipmentType) { + this.equipmentType = equipmentType; + } + + public String getEquipmentTypeName() { + return equipmentTypeName; + } + + public void setEquipmentTypeName(String equipmentTypeName) { + this.equipmentTypeName = equipmentTypeName; + } + + public String getFileList() { + return fileList; + } + + public void setFileList(String fileList) { + this.fileList = fileList; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getInstallIncidentalExpenses() { + return installIncidentalExpenses; + } + + public void setInstallIncidentalExpenses(String installIncidentalExpenses) { + this.installIncidentalExpenses = installIncidentalExpenses; + } + + public String getInstallPlace() { + return installPlace; + } + + public void setInstallPlace(String installPlace) { + this.installPlace = installPlace; + } + + public String getIntactState() { + return intactState; + } + + public void setIntactState(String intactState) { + this.intactState = intactState; + } + + public String getIsCalibrationTestEquipment() { + return isCalibrationTestEquipment; + } + + public void setIsCalibrationTestEquipment(String isCalibrationTestEquipment) { + this.isCalibrationTestEquipment = isCalibrationTestEquipment; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getIsFixedAssets() { + return isFixedAssets; + } + + public void setIsFixedAssets(String isFixedAssets) { + this.isFixedAssets = isFixedAssets; + } + + public String getIsMeasureAccount() { + return isMeasureAccount; + } + + public void setIsMeasureAccount(String isMeasureAccount) { + this.isMeasureAccount = isMeasureAccount; + } + + public String getIsStandardSupportEquipment() { + return isStandardSupportEquipment; + } + + public void setIsStandardSupportEquipment(String isStandardSupportEquipment) { + this.isStandardSupportEquipment = isStandardSupportEquipment; + } + + public String getLabelBind() { + return labelBind; + } + + public void setLabelBind(String labelBind) { + this.labelBind = labelBind; + } + + public String getMajorCategory() { + return majorCategory; + } + + public void setMajorCategory(String majorCategory) { + this.majorCategory = majorCategory; + } + + public String getMajorCategoryName() { + return majorCategoryName; + } + + public void setMajorCategoryName(String majorCategoryName) { + this.majorCategoryName = majorCategoryName; + } + + public String getManagerLevel() { + return managerLevel; + } + + public void setManagerLevel(String managerLevel) { + this.managerLevel = managerLevel; + } + + public String getManagerLevelName() { + return managerLevelName; + } + + public void setManagerLevelName(String managerLevelName) { + this.managerLevelName = managerLevelName; + } + + public String getManagerState() { + return managerState; + } + + public void setManagerState(String managerState) { + this.managerState = managerState; + } + + public String getManagerStateName() { + return managerStateName; + } + + public void setManagerStateName(String managerStateName) { + this.managerStateName = managerStateName; + } + + public String getManufacturer() { + return manufacturer; + } + + public void setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + } + + public String getManufacturerCountry() { + return manufacturerCountry; + } + + public void setManufacturerCountry(String manufacturerCountry) { + this.manufacturerCountry = manufacturerCountry; + } + + public String getManufacturingDate() { + return manufacturingDate; + } + + public void setManufacturingDate(String manufacturingDate) { + this.manufacturingDate = manufacturingDate; + } + + public String getManufacturingNo() { + return manufacturingNo; + } + + public void setManufacturingNo(String manufacturingNo) { + this.manufacturingNo = manufacturingNo; + } + + public String getMesureCycle() { + return mesureCycle; + } + + public void setMesureCycle(String mesureCycle) { + this.mesureCycle = mesureCycle; + } + + public String getMesureDate() { + return mesureDate; + } + + public void setMesureDate(String mesureDate) { + this.mesureDate = mesureDate; + } + + public String getMesureDept() { + return mesureDept; + } + + public void setMesureDept(String mesureDept) { + this.mesureDept = mesureDept; + } + + public String getMesureRange() { + return mesureRange; + } + + public void setMesureRange(String mesureRange) { + this.mesureRange = mesureRange; + } + + public String getMesureResult() { + return mesureResult; + } + + public void setMesureResult(String mesureResult) { + this.mesureResult = mesureResult; + } + + public String getMesureResultName() { + return mesureResultName; + } + + public void setMesureResultName(String mesureResultName) { + this.mesureResultName = mesureResultName; + } + + public String getMesureType() { + return mesureType; + } + + public void setMesureType(String mesureType) { + this.mesureType = mesureType; + } + + public String getMesureTypeName() { + return mesureTypeName; + } + + public void setMesureTypeName(String mesureTypeName) { + this.mesureTypeName = mesureTypeName; + } + + public String getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getOriginValue() { + return originValue; + } + + public void setOriginValue(String originValue) { + this.originValue = originValue; + } + + public String getOverallDimension() { + return overallDimension; + } + + public void setOverallDimension(String overallDimension) { + this.overallDimension = overallDimension; + } + + public String getPresentOriginValue() { + return presentOriginValue; + } + + public void setPresentOriginValue(String presentOriginValue) { + this.presentOriginValue = presentOriginValue; + } + + public String getPurpose() { + return purpose; + } + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getSinglePrice() { + return singlePrice; + } + + public void setSinglePrice(String singlePrice) { + this.singlePrice = singlePrice; + } + + public String getSupportStandardEquipmentName() { + return supportStandardEquipmentName; + } + + public void setSupportStandardEquipmentName(String supportStandardEquipmentName) { + this.supportStandardEquipmentName = supportStandardEquipmentName; + } + + public String getSupportStandardEquipmentNo() { + return supportStandardEquipmentNo; + } + + public void setSupportStandardEquipmentNo(String supportStandardEquipmentNo) { + this.supportStandardEquipmentNo = supportStandardEquipmentNo; + } + + public String getTechnicalLevel() { + return technicalLevel; + } + + public void setTechnicalLevel(String technicalLevel) { + this.technicalLevel = technicalLevel; + } + + public String getUncertainty() { + return uncertainty; + } + + public void setUncertainty(String uncertainty) { + this.uncertainty = uncertainty; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getUseDept() { + return useDept; + } + + public void setUseDept(String useDept) { + this.useDept = useDept; + } + + public String getUseDeptName() { + return useDeptName; + } + + public void setUseDeptName(String useDeptName) { + this.useDeptName = useDeptName; + } + + public String getUsePerson() { + return usePerson; + } + + public void setUsePerson(String usePerson) { + this.usePerson = usePerson; + } + + public String getUsePersonName() { + return usePersonName; + } + + public void setUsePersonName(String usePersonName) { + this.usePersonName = usePersonName; + } + + public String getValidDate() { + return validDate; + } + + public void setValidDate(String validDate) { + this.validDate = validDate; + } + + public int getVersion() { + return version; + } + + public void setVersion(int version) { + this.version = version; + } + + public String getWeight() { + return weight; + } + + public void setWeight(String weight) { + this.weight = weight; + } + } + } +} diff --git a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt index a3f514f..46e5eef 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt @@ -35,4 +35,24 @@ @QueryMap limit: Map, @QueryMap offset: Map ): String + + /** + * 获取设备列表 + */ + @POST("/meter/assets/listPage") + suspend fun getEquipmentList( + @Header("token") token: String, + @Body requestBody: RequestBody, + @QueryMap limit: Map, + @QueryMap offset: Map + ): String + + /** + * 获取设备详情 + */ + @POST("/meter/assets/detail") + suspend fun getEquipmentDetail( + @Header("token") token: String, + @Body requestBody: RequestBody + ): String } \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt index 444a872..386a1d8 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt @@ -6,8 +6,10 @@ import com.pengxh.kt.lite.utils.SaveKeyValues import okhttp3.MediaType.Companion.toMediaType import okhttp3.RequestBody.Companion.toRequestBody +import org.json.JSONArray import org.json.JSONObject + object RetrofitServiceManager { private val api by lazy { @@ -73,4 +75,71 @@ offsetMap["offset"] = offset return api.getNoticeList(AuthenticationHelper.token!!, requestBody, limitMap, offsetMap) } + + /** + * 获取设备列表 + */ + suspend fun getEquipmentList( + equipmentNo: String, + equipmentName: String, + mesureType: String, + managerState: String, + useDept: String, + assetType: String, + equipmentCategory: String, + isCalibrationTestEquipment: String, + isMeasureAccount: String, + isStandardSupportEquipment: String, + isFixedAssets: String, + validStartDate: String, + validEndDate: String, + abc: String, + ids: Array, + offset: Int + ): String { + val paramObject = JSONObject() + paramObject.put("equipmentNo", equipmentNo) + paramObject.put("equipmentName", equipmentName) + paramObject.put("mesureType", mesureType) + paramObject.put("managerState", managerState) + paramObject.put("useDept", useDept) + paramObject.put("assetType", assetType) + paramObject.put("equipmentCategory", equipmentCategory) + paramObject.put("isCalibrationTestEquipment", isCalibrationTestEquipment) + paramObject.put("isMeasureAccount", isMeasureAccount) + paramObject.put("isStandardSupportEquipment", isStandardSupportEquipment) + paramObject.put("isFixedAssets", isFixedAssets) + paramObject.put("validStartDate", validStartDate) + paramObject.put("validEndDate", validEndDate) + paramObject.put("abc", abc) + + val jsonArray = JSONArray() + ids.forEach { + jsonArray.put(it) + } + paramObject.put("ids", jsonArray) + + val requestBody = paramObject.toString().toRequestBody( + "application/json;charset=UTF-8".toMediaType() + ) + + val limitMap = HashMap() + limitMap["limit"] = LocaleConstant.PAGE_LIMIT + + val offsetMap = HashMap() + offsetMap["offset"] = offset + return api.getEquipmentList(AuthenticationHelper.token!!, requestBody, limitMap, offsetMap) + } + + /** + * 获取设备详情 + */ + suspend fun getEquipmentDetail(id: String): String { + val paramObject = JSONObject() + paramObject.put("id", id) + val requestBody = paramObject.toString().toRequestBody( + "application/json;charset=UTF-8".toMediaType() + ) + return api.getEquipmentDetail(AuthenticationHelper.token!!, requestBody) + } } \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 3892b5a..02160cd 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -34,16 +34,18 @@ - - - - - - - + + + + + + + + + +) : RecyclerView.Adapter() { + + private var layoutInflater: LayoutInflater = LayoutInflater.from(context) + + override fun getItemCount(): Int = dataRows.size + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = ItemViewHolder( + layoutInflater.inflate(R.layout.item_equipment_rv_l, parent, false) + ) + + override fun onBindViewHolder(holder: ItemViewHolder, position: Int) { + //绑定数据 + val rowsBean = dataRows[position] + holder.equipmentNameView.text = rowsBean.equipmentName + holder.equipmentCodeView.text = rowsBean.equipmentNo + holder.equipmentDateView.text = rowsBean.enableDate + holder.equipmentLibView.text = rowsBean.useDeptName + + //绑定事件 + holder.itemView.setOnClickListener { + listener?.onItemClicked(position) + } + } + + inner class ItemViewHolder(view: View) : RecyclerView.ViewHolder(view) { + var equipmentNameView: TextView = view.findViewById(R.id.equipmentNameView) + var equipmentCodeView: TextView = view.findViewById(R.id.equipmentCodeView) + var equipmentDateView: TextView = view.findViewById(R.id.equipmentDateView) + var equipmentLibView: TextView = view.findViewById(R.id.equipmentLibView) + } + + private var listener: OnItemClickListener? = null + + interface OnItemClickListener { + fun onItemClicked(position: Int) + } + + fun setOnItemClickListener(onClickListener: OnItemClickListener?) { + this.listener = onClickListener + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt index b4628f3..d970b55 100644 --- a/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt +++ b/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt @@ -5,7 +5,8 @@ import com.casic.xz.meterage.R import com.casic.xz.meterage.adapter.HomeGridAdapter import com.casic.xz.meterage.utils.LocaleConstant -import com.casic.xz.meterage.view.NoticeListActivity +import com.casic.xz.meterage.view.home.EquipmentActivity +import com.casic.xz.meterage.view.notice.NoticeListActivity import com.casic.xz.meterage.vm.NoticeViewModel import com.pengxh.kt.lite.base.KotlinBaseFragment import com.pengxh.kt.lite.extensions.navigatePageTo @@ -36,8 +37,19 @@ homeFuncRecyclerView.adapter = homeAdapter homeAdapter.setOnGridItemClickListener(object : HomeGridAdapter.OnGridItemClickListener { override fun onItemClick(position: Int) { - when (position) { - + when (LocaleConstant.HOME_FUNC_OPERATE[position]) { + "仪器设备" -> requireContext().navigatePageTo() +// "标准装置" -> requireContext().navigatePageTo() +// "证书报告" -> requireContext().navigatePageTo() +// "委托需求" -> requireContext().navigatePageTo() +// "访客" -> requireContext().navigatePageTo() +// "标准规范" -> requireContext().navigatePageTo() +// "能力列表" -> requireContext().navigatePageTo() +// "计量培训" -> requireContext().navigatePageTo() +// "合同发票" -> requireContext().navigatePageTo() +// "业务统计" -> requireContext().navigatePageTo() +// "客户列表" -> requireContext().navigatePageTo() +// "外场检测" -> requireContext().navigatePageTo() } } }) diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt index 7e75abe..56dc5ec 100644 --- a/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt +++ b/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt @@ -2,9 +2,11 @@ import android.view.View import androidx.lifecycle.ViewModelProvider +import com.bumptech.glide.Glide +import com.bumptech.glide.request.RequestOptions import com.casic.xz.meterage.R import com.casic.xz.meterage.utils.LocaleConstant -import com.casic.xz.meterage.view.NoticeListActivity +import com.casic.xz.meterage.view.notice.NoticeListActivity import com.casic.xz.meterage.vm.NoticeViewModel import com.casic.xz.meterage.vm.UserViewModel import com.pengxh.kt.lite.base.KotlinBaseFragment @@ -23,6 +25,12 @@ val data = it.data userNameView.text = data.name userUnitView.text = data.deptName + +// Glide.with(requireContext()) +// .load(R.mipmap.default_avatar) +// .apply(RequestOptions.circleCropTransform()) +// .placeholder(R.mipmap.load_image_error) +// .into(userAvatarView) } }) diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt new file mode 100644 index 0000000..cf22646 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt @@ -0,0 +1,103 @@ +package com.casic.xz.meterage.fragment.equipment + +import android.graphics.Paint +import androidx.lifecycle.ViewModelProvider +import com.casic.xz.meterage.R +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.casic.xz.meterage.vm.EquipmentViewModel +import com.pengxh.kt.lite.base.KotlinBaseFragment +import com.pengxh.kt.lite.extensions.convertColor +import com.pengxh.kt.lite.vm.LoadState +import kotlinx.android.synthetic.main.fragment_basic_information.* + +class BasicInformationFragment(private val id: String) : KotlinBaseFragment() { + + private lateinit var equipmentViewModel: EquipmentViewModel + + override fun initData() { + equipmentViewModel = ViewModelProvider(this)[EquipmentViewModel::class.java] + equipmentViewModel.getEquipmentDetail(id) + equipmentViewModel.equipmentDetailResult.observe(this, { + if (it.code == 200) { + val data = it.data!! + + equipmentCodeView.text = data.equipmentNo + equipmentNameView.text = data.equipmentName + manufacturerView.text = data.manufacturer + factoryNumberView.text = data.manufacturingNo + modelView.text = data.modelNo + verificationMethodView.text = data.mesureTypeName + measuringRangeView.text = data.mesureRange + uncertaintyView.text = data.uncertainty + firstUseView.text = data.createTime + originalValueView.text = data.originValue + usageDeptView.text = data.useDeptName + userView.text = data.usePersonName + managementStatusView.text = data.managerStateName + verificationDeptView.text = data.useDeptName +// nextVerificationDeptView.text = data. + verificationPeriodView.text = data.mesureCycle + verificationDateView.text = data.mesureDate + effectiveDateView.text = data.validDate + verificationResultsView.text = data.mesureResultName + abcView.text = data.abcName + isNeedTechnicalView.text = if ( + data.isCalibrationTestEquipment.isNullOrBlank() || data.isCalibrationTestEquipment == "0" + ) { + "否" + } else { + "是" + } + + isStandingBook.text = if ( + data.isMeasureAccount.isNullOrBlank() || data.isMeasureAccount == "0" + ) { + "否" + } else { + "是" + } + + isStandardView.text = if ( + data.isStandardSupportEquipment.isNullOrBlank() || data.isStandardSupportEquipment == "0" + ) { + "否" + } else { + "是" + } + remarkView.text = data.remark + if (data.fileList.size == 0) { + instructionsView.text = "暂无" + } else { + instructionsView.text = "查看附件列表" + val textPaint = instructionsView.paint + textPaint.flags = Paint.UNDERLINE_TEXT_FLAG + textPaint.isAntiAlias = true + instructionsView.setTextColor(R.color.themeColor.convertColor(requireContext())) + + instructionsView.setOnClickListener { + + } + } + } + }) + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_basic_information + + override fun observeRequestState() { + equipmentViewModel.loadState.observe(this, { + when (it) { + LoadState.Loading -> LoadingDialogHub.show(requireActivity(), "数据加载中...") + else -> LoadingDialogHub.dismiss() + } + }) + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt new file mode 100644 index 0000000..0b4a747 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class CertificateFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_certificate + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt new file mode 100644 index 0000000..f05c491 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class ChangeRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_change_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt new file mode 100644 index 0000000..849ffa5 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class InspectionRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_inspection_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt new file mode 100644 index 0000000..aa4edd9 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class UsageRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_usage_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java b/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java new file mode 100644 index 0000000..0b9124e --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java @@ -0,0 +1,760 @@ +package com.casic.xz.meterage.model; + +import java.util.List; + +public class EquipmentDetailModel { + + private int code; + private DataModel data; + private String message; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataModel getData() { + return data; + } + + public void setData(DataModel data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public static class DataModel { + private String abc; + private String abcName; + private String assetNo; + private String assetSource; + private String assetType; + private String assetTypeName; + private String attribute; + private String capitalSource; + private String capitalSourceName; + private String cardEstablishmentDate; + private String createTime; + private String createUser; + private String depreciationMethod; + private String depreciationMethodName; + private String depreciationPeriod; + private String enableDate; + private String equipmentCategory; + private String equipmentCategoryName; + private String equipmentName; + private String equipmentNo; + private String equipmentSpecifications; + private String equipmentType; + private String equipmentTypeName; + private List fileList; + private String id; + private String installIncidentalExpenses; + private String installPlace; + private String intactState; + private String isCalibrationTestEquipment; + private int isDel; + private String isFixedAssets; + private String isMeasureAccount; + private String isStandardSupportEquipment; + private String labelBind; + private String majorCategory; + private String majorCategoryName; + private String managerLevel; + private String managerLevelName; + private String managerState; + private String managerStateName; + private String manufacturer; + private String manufacturerCountry; + private String manufacturingDate; + private String manufacturingNo; + private String mesureCycle; + private String mesureDate; + private String mesureDept; + private String mesureRange; + private String mesureResult; + private String mesureResultName; + private String mesureType; + private String mesureTypeName; + private String modelNo; + private String originValue; + private String overallDimension; + private String presentOriginValue; + private String purpose; + private String remark; + private String singlePrice; + private String supportStandardEquipmentName; + private String supportStandardEquipmentNo; + private String technicalLevel; + private String uncertainty; + private String updateTime; + private String useDept; + private String useDeptName; + private String usePerson; + private String usePersonName; + private String validDate; + private int version; + private String weight; + + public String getAbc() { + return abc; + } + + public void setAbc(String abc) { + this.abc = abc; + } + + public String getAbcName() { + return abcName; + } + + public void setAbcName(String abcName) { + this.abcName = abcName; + } + + public String getAssetNo() { + return assetNo; + } + + public void setAssetNo(String assetNo) { + this.assetNo = assetNo; + } + + public String getAssetSource() { + return assetSource; + } + + public void setAssetSource(String assetSource) { + this.assetSource = assetSource; + } + + public String getAssetType() { + return assetType; + } + + public void setAssetType(String assetType) { + this.assetType = assetType; + } + + public String getAssetTypeName() { + return assetTypeName; + } + + public void setAssetTypeName(String assetTypeName) { + this.assetTypeName = assetTypeName; + } + + public String getAttribute() { + return attribute; + } + + public void setAttribute(String attribute) { + this.attribute = attribute; + } + + public String getCapitalSource() { + return capitalSource; + } + + public void setCapitalSource(String capitalSource) { + this.capitalSource = capitalSource; + } + + public String getCapitalSourceName() { + return capitalSourceName; + } + + public void setCapitalSourceName(String capitalSourceName) { + this.capitalSourceName = capitalSourceName; + } + + public String getCardEstablishmentDate() { + return cardEstablishmentDate; + } + + public void setCardEstablishmentDate(String cardEstablishmentDate) { + this.cardEstablishmentDate = cardEstablishmentDate; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getDepreciationMethod() { + return depreciationMethod; + } + + public void setDepreciationMethod(String depreciationMethod) { + this.depreciationMethod = depreciationMethod; + } + + public String getDepreciationMethodName() { + return depreciationMethodName; + } + + public void setDepreciationMethodName(String depreciationMethodName) { + this.depreciationMethodName = depreciationMethodName; + } + + public String getDepreciationPeriod() { + return depreciationPeriod; + } + + public void setDepreciationPeriod(String depreciationPeriod) { + this.depreciationPeriod = depreciationPeriod; + } + + public String getEnableDate() { + return enableDate; + } + + public void setEnableDate(String enableDate) { + this.enableDate = enableDate; + } + + public String getEquipmentCategory() { + return equipmentCategory; + } + + public void setEquipmentCategory(String equipmentCategory) { + this.equipmentCategory = equipmentCategory; + } + + public String getEquipmentCategoryName() { + return equipmentCategoryName; + } + + public void setEquipmentCategoryName(String equipmentCategoryName) { + this.equipmentCategoryName = equipmentCategoryName; + } + + public String getEquipmentName() { + return equipmentName; + } + + public void setEquipmentName(String equipmentName) { + this.equipmentName = equipmentName; + } + + public String getEquipmentNo() { + return equipmentNo; + } + + public void setEquipmentNo(String equipmentNo) { + this.equipmentNo = equipmentNo; + } + + public String getEquipmentSpecifications() { + return equipmentSpecifications; + } + + public void setEquipmentSpecifications(String equipmentSpecifications) { + this.equipmentSpecifications = equipmentSpecifications; + } + + public String getEquipmentType() { + return equipmentType; + } + + public void setEquipmentType(String equipmentType) { + this.equipmentType = equipmentType; + } + + public String getEquipmentTypeName() { + return equipmentTypeName; + } + + public void setEquipmentTypeName(String equipmentTypeName) { + this.equipmentTypeName = equipmentTypeName; + } + + public List getFileList() { + return fileList; + } + + public void setFileList(List fileList) { + this.fileList = fileList; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getInstallIncidentalExpenses() { + return installIncidentalExpenses; + } + + public void setInstallIncidentalExpenses(String installIncidentalExpenses) { + this.installIncidentalExpenses = installIncidentalExpenses; + } + + public String getInstallPlace() { + return installPlace; + } + + public void setInstallPlace(String installPlace) { + this.installPlace = installPlace; + } + + public String getIntactState() { + return intactState; + } + + public void setIntactState(String intactState) { + this.intactState = intactState; + } + + public String getIsCalibrationTestEquipment() { + return isCalibrationTestEquipment; + } + + public void setIsCalibrationTestEquipment(String isCalibrationTestEquipment) { + this.isCalibrationTestEquipment = isCalibrationTestEquipment; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getIsFixedAssets() { + return isFixedAssets; + } + + public void setIsFixedAssets(String isFixedAssets) { + this.isFixedAssets = isFixedAssets; + } + + public String getIsMeasureAccount() { + return isMeasureAccount; + } + + public void setIsMeasureAccount(String isMeasureAccount) { + this.isMeasureAccount = isMeasureAccount; + } + + public String getIsStandardSupportEquipment() { + return isStandardSupportEquipment; + } + + public void setIsStandardSupportEquipment(String isStandardSupportEquipment) { + this.isStandardSupportEquipment = isStandardSupportEquipment; + } + + public String getLabelBind() { + return labelBind; + } + + public void setLabelBind(String labelBind) { + this.labelBind = labelBind; + } + + public String getMajorCategory() { + return majorCategory; + } + + public void setMajorCategory(String majorCategory) { + this.majorCategory = majorCategory; + } + + public String getMajorCategoryName() { + return majorCategoryName; + } + + public void setMajorCategoryName(String majorCategoryName) { + this.majorCategoryName = majorCategoryName; + } + + public String getManagerLevel() { + return managerLevel; + } + + public void setManagerLevel(String managerLevel) { + this.managerLevel = managerLevel; + } + + public String getManagerLevelName() { + return managerLevelName; + } + + public void setManagerLevelName(String managerLevelName) { + this.managerLevelName = managerLevelName; + } + + public String getManagerState() { + return managerState; + } + + public void setManagerState(String managerState) { + this.managerState = managerState; + } + + public String getManagerStateName() { + return managerStateName; + } + + public void setManagerStateName(String managerStateName) { + this.managerStateName = managerStateName; + } + + public String getManufacturer() { + return manufacturer; + } + + public void setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + } + + public String getManufacturerCountry() { + return manufacturerCountry; + } + + public void setManufacturerCountry(String manufacturerCountry) { + this.manufacturerCountry = manufacturerCountry; + } + + public String getManufacturingDate() { + return manufacturingDate; + } + + public void setManufacturingDate(String manufacturingDate) { + this.manufacturingDate = manufacturingDate; + } + + public String getManufacturingNo() { + return manufacturingNo; + } + + public void setManufacturingNo(String manufacturingNo) { + this.manufacturingNo = manufacturingNo; + } + + public String getMesureCycle() { + return mesureCycle; + } + + public void setMesureCycle(String mesureCycle) { + this.mesureCycle = mesureCycle; + } + + public String getMesureDate() { + return mesureDate; + } + + public void setMesureDate(String mesureDate) { + this.mesureDate = mesureDate; + } + + public String getMesureDept() { + return mesureDept; + } + + public void setMesureDept(String mesureDept) { + this.mesureDept = mesureDept; + } + + public String getMesureRange() { + return mesureRange; + } + + public void setMesureRange(String mesureRange) { + this.mesureRange = mesureRange; + } + + public String getMesureResult() { + return mesureResult; + } + + public void setMesureResult(String mesureResult) { + this.mesureResult = mesureResult; + } + + public String getMesureResultName() { + return mesureResultName; + } + + public void setMesureResultName(String mesureResultName) { + this.mesureResultName = mesureResultName; + } + + public String getMesureType() { + return mesureType; + } + + public void setMesureType(String mesureType) { + this.mesureType = mesureType; + } + + public String getMesureTypeName() { + return mesureTypeName; + } + + public void setMesureTypeName(String mesureTypeName) { + this.mesureTypeName = mesureTypeName; + } + + public String getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getOriginValue() { + return originValue; + } + + public void setOriginValue(String originValue) { + this.originValue = originValue; + } + + public String getOverallDimension() { + return overallDimension; + } + + public void setOverallDimension(String overallDimension) { + this.overallDimension = overallDimension; + } + + public String getPresentOriginValue() { + return presentOriginValue; + } + + public void setPresentOriginValue(String presentOriginValue) { + this.presentOriginValue = presentOriginValue; + } + + public String getPurpose() { + return purpose; + } + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getSinglePrice() { + return singlePrice; + } + + public void setSinglePrice(String singlePrice) { + this.singlePrice = singlePrice; + } + + public String getSupportStandardEquipmentName() { + return supportStandardEquipmentName; + } + + public void setSupportStandardEquipmentName(String supportStandardEquipmentName) { + this.supportStandardEquipmentName = supportStandardEquipmentName; + } + + public String getSupportStandardEquipmentNo() { + return supportStandardEquipmentNo; + } + + public void setSupportStandardEquipmentNo(String supportStandardEquipmentNo) { + this.supportStandardEquipmentNo = supportStandardEquipmentNo; + } + + public String getTechnicalLevel() { + return technicalLevel; + } + + public void setTechnicalLevel(String technicalLevel) { + this.technicalLevel = technicalLevel; + } + + public String getUncertainty() { + return uncertainty; + } + + public void setUncertainty(String uncertainty) { + this.uncertainty = uncertainty; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getUseDept() { + return useDept; + } + + public void setUseDept(String useDept) { + this.useDept = useDept; + } + + public String getUseDeptName() { + return useDeptName; + } + + public void setUseDeptName(String useDeptName) { + this.useDeptName = useDeptName; + } + + public String getUsePerson() { + return usePerson; + } + + public void setUsePerson(String usePerson) { + this.usePerson = usePerson; + } + + public String getUsePersonName() { + return usePersonName; + } + + public void setUsePersonName(String usePersonName) { + this.usePersonName = usePersonName; + } + + public String getValidDate() { + return validDate; + } + + public void setValidDate(String validDate) { + this.validDate = validDate; + } + + public int getVersion() { + return version; + } + + public void setVersion(int version) { + this.version = version; + } + + public String getWeight() { + return weight; + } + + public void setWeight(String weight) { + this.weight = weight; + } + + public static class FileListModel { + private String assetId; + private String createTime; + private String createUser; + private String fileName; + private String id; + private int isDel; + private String minioFileName; + private String remark; + private String updateTime; + + public String getAssetId() { + return assetId; + } + + public void setAssetId(String assetId) { + this.assetId = assetId; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getFileName() { + return fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getMinioFileName() { + return minioFileName; + } + + public void setMinioFileName(String minioFileName) { + this.minioFileName = minioFileName; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + } + } +} diff --git a/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java b/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java new file mode 100644 index 0000000..15fc128 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java @@ -0,0 +1,697 @@ +package com.casic.xz.meterage.model; + +import java.util.List; + +public class EquipmentListModel { + + private int code; + private DataModel data; + private String message; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataModel getData() { + return data; + } + + public void setData(DataModel data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public static class DataModel { + private List rows; + private int total; + + public List getRows() { + return rows; + } + + public void setRows(List rows) { + this.rows = rows; + } + + public int getTotal() { + return total; + } + + public void setTotal(int total) { + this.total = total; + } + + public static class RowsModel { + private String abc; + private String abcName; + private String assetNo; + private String assetSource; + private String assetType; + private String assetTypeName; + private String attribute; + private String capitalSource; + private String capitalSourceName; + private String cardEstablishmentDate; + private String createTime; + private String createUser; + private String depreciationMethod; + private String depreciationMethodName; + private String depreciationPeriod; + private String enableDate; + private String equipmentCategory; + private String equipmentCategoryName; + private String equipmentName; + private String equipmentNo; + private String equipmentSpecifications; + private String equipmentType; + private String equipmentTypeName; + private String fileList; + private String id; + private String installIncidentalExpenses; + private String installPlace; + private String intactState; + private String isCalibrationTestEquipment; + private int isDel; + private String isFixedAssets; + private String isMeasureAccount; + private String isStandardSupportEquipment; + private String labelBind; + private String majorCategory; + private String majorCategoryName; + private String managerLevel; + private String managerLevelName; + private String managerState; + private String managerStateName; + private String manufacturer; + private String manufacturerCountry; + private String manufacturingDate; + private String manufacturingNo; + private String mesureCycle; + private String mesureDate; + private String mesureDept; + private String mesureRange; + private String mesureResult; + private String mesureResultName; + private String mesureType; + private String mesureTypeName; + private String modelNo; + private String originValue; + private String overallDimension; + private String presentOriginValue; + private String purpose; + private String remark; + private String singlePrice; + private String supportStandardEquipmentName; + private String supportStandardEquipmentNo; + private String technicalLevel; + private String uncertainty; + private String updateTime; + private String useDept; + private String useDeptName; + private String usePerson; + private String usePersonName; + private String validDate; + private int version; + private String weight; + + public String getAbc() { + return abc; + } + + public void setAbc(String abc) { + this.abc = abc; + } + + public String getAbcName() { + return abcName; + } + + public void setAbcName(String abcName) { + this.abcName = abcName; + } + + public String getAssetNo() { + return assetNo; + } + + public void setAssetNo(String assetNo) { + this.assetNo = assetNo; + } + + public String getAssetSource() { + return assetSource; + } + + public void setAssetSource(String assetSource) { + this.assetSource = assetSource; + } + + public String getAssetType() { + return assetType; + } + + public void setAssetType(String assetType) { + this.assetType = assetType; + } + + public String getAssetTypeName() { + return assetTypeName; + } + + public void setAssetTypeName(String assetTypeName) { + this.assetTypeName = assetTypeName; + } + + public String getAttribute() { + return attribute; + } + + public void setAttribute(String attribute) { + this.attribute = attribute; + } + + public String getCapitalSource() { + return capitalSource; + } + + public void setCapitalSource(String capitalSource) { + this.capitalSource = capitalSource; + } + + public String getCapitalSourceName() { + return capitalSourceName; + } + + public void setCapitalSourceName(String capitalSourceName) { + this.capitalSourceName = capitalSourceName; + } + + public String getCardEstablishmentDate() { + return cardEstablishmentDate; + } + + public void setCardEstablishmentDate(String cardEstablishmentDate) { + this.cardEstablishmentDate = cardEstablishmentDate; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getDepreciationMethod() { + return depreciationMethod; + } + + public void setDepreciationMethod(String depreciationMethod) { + this.depreciationMethod = depreciationMethod; + } + + public String getDepreciationMethodName() { + return depreciationMethodName; + } + + public void setDepreciationMethodName(String depreciationMethodName) { + this.depreciationMethodName = depreciationMethodName; + } + + public String getDepreciationPeriod() { + return depreciationPeriod; + } + + public void setDepreciationPeriod(String depreciationPeriod) { + this.depreciationPeriod = depreciationPeriod; + } + + public String getEnableDate() { + return enableDate; + } + + public void setEnableDate(String enableDate) { + this.enableDate = enableDate; + } + + public String getEquipmentCategory() { + return equipmentCategory; + } + + public void setEquipmentCategory(String equipmentCategory) { + this.equipmentCategory = equipmentCategory; + } + + public String getEquipmentCategoryName() { + return equipmentCategoryName; + } + + public void setEquipmentCategoryName(String equipmentCategoryName) { + this.equipmentCategoryName = equipmentCategoryName; + } + + public String getEquipmentName() { + return equipmentName; + } + + public void setEquipmentName(String equipmentName) { + this.equipmentName = equipmentName; + } + + public String getEquipmentNo() { + return equipmentNo; + } + + public void setEquipmentNo(String equipmentNo) { + this.equipmentNo = equipmentNo; + } + + public String getEquipmentSpecifications() { + return equipmentSpecifications; + } + + public void setEquipmentSpecifications(String equipmentSpecifications) { + this.equipmentSpecifications = equipmentSpecifications; + } + + public String getEquipmentType() { + return equipmentType; + } + + public void setEquipmentType(String equipmentType) { + this.equipmentType = equipmentType; + } + + public String getEquipmentTypeName() { + return equipmentTypeName; + } + + public void setEquipmentTypeName(String equipmentTypeName) { + this.equipmentTypeName = equipmentTypeName; + } + + public String getFileList() { + return fileList; + } + + public void setFileList(String fileList) { + this.fileList = fileList; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getInstallIncidentalExpenses() { + return installIncidentalExpenses; + } + + public void setInstallIncidentalExpenses(String installIncidentalExpenses) { + this.installIncidentalExpenses = installIncidentalExpenses; + } + + public String getInstallPlace() { + return installPlace; + } + + public void setInstallPlace(String installPlace) { + this.installPlace = installPlace; + } + + public String getIntactState() { + return intactState; + } + + public void setIntactState(String intactState) { + this.intactState = intactState; + } + + public String getIsCalibrationTestEquipment() { + return isCalibrationTestEquipment; + } + + public void setIsCalibrationTestEquipment(String isCalibrationTestEquipment) { + this.isCalibrationTestEquipment = isCalibrationTestEquipment; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getIsFixedAssets() { + return isFixedAssets; + } + + public void setIsFixedAssets(String isFixedAssets) { + this.isFixedAssets = isFixedAssets; + } + + public String getIsMeasureAccount() { + return isMeasureAccount; + } + + public void setIsMeasureAccount(String isMeasureAccount) { + this.isMeasureAccount = isMeasureAccount; + } + + public String getIsStandardSupportEquipment() { + return isStandardSupportEquipment; + } + + public void setIsStandardSupportEquipment(String isStandardSupportEquipment) { + this.isStandardSupportEquipment = isStandardSupportEquipment; + } + + public String getLabelBind() { + return labelBind; + } + + public void setLabelBind(String labelBind) { + this.labelBind = labelBind; + } + + public String getMajorCategory() { + return majorCategory; + } + + public void setMajorCategory(String majorCategory) { + this.majorCategory = majorCategory; + } + + public String getMajorCategoryName() { + return majorCategoryName; + } + + public void setMajorCategoryName(String majorCategoryName) { + this.majorCategoryName = majorCategoryName; + } + + public String getManagerLevel() { + return managerLevel; + } + + public void setManagerLevel(String managerLevel) { + this.managerLevel = managerLevel; + } + + public String getManagerLevelName() { + return managerLevelName; + } + + public void setManagerLevelName(String managerLevelName) { + this.managerLevelName = managerLevelName; + } + + public String getManagerState() { + return managerState; + } + + public void setManagerState(String managerState) { + this.managerState = managerState; + } + + public String getManagerStateName() { + return managerStateName; + } + + public void setManagerStateName(String managerStateName) { + this.managerStateName = managerStateName; + } + + public String getManufacturer() { + return manufacturer; + } + + public void setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + } + + public String getManufacturerCountry() { + return manufacturerCountry; + } + + public void setManufacturerCountry(String manufacturerCountry) { + this.manufacturerCountry = manufacturerCountry; + } + + public String getManufacturingDate() { + return manufacturingDate; + } + + public void setManufacturingDate(String manufacturingDate) { + this.manufacturingDate = manufacturingDate; + } + + public String getManufacturingNo() { + return manufacturingNo; + } + + public void setManufacturingNo(String manufacturingNo) { + this.manufacturingNo = manufacturingNo; + } + + public String getMesureCycle() { + return mesureCycle; + } + + public void setMesureCycle(String mesureCycle) { + this.mesureCycle = mesureCycle; + } + + public String getMesureDate() { + return mesureDate; + } + + public void setMesureDate(String mesureDate) { + this.mesureDate = mesureDate; + } + + public String getMesureDept() { + return mesureDept; + } + + public void setMesureDept(String mesureDept) { + this.mesureDept = mesureDept; + } + + public String getMesureRange() { + return mesureRange; + } + + public void setMesureRange(String mesureRange) { + this.mesureRange = mesureRange; + } + + public String getMesureResult() { + return mesureResult; + } + + public void setMesureResult(String mesureResult) { + this.mesureResult = mesureResult; + } + + public String getMesureResultName() { + return mesureResultName; + } + + public void setMesureResultName(String mesureResultName) { + this.mesureResultName = mesureResultName; + } + + public String getMesureType() { + return mesureType; + } + + public void setMesureType(String mesureType) { + this.mesureType = mesureType; + } + + public String getMesureTypeName() { + return mesureTypeName; + } + + public void setMesureTypeName(String mesureTypeName) { + this.mesureTypeName = mesureTypeName; + } + + public String getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getOriginValue() { + return originValue; + } + + public void setOriginValue(String originValue) { + this.originValue = originValue; + } + + public String getOverallDimension() { + return overallDimension; + } + + public void setOverallDimension(String overallDimension) { + this.overallDimension = overallDimension; + } + + public String getPresentOriginValue() { + return presentOriginValue; + } + + public void setPresentOriginValue(String presentOriginValue) { + this.presentOriginValue = presentOriginValue; + } + + public String getPurpose() { + return purpose; + } + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getSinglePrice() { + return singlePrice; + } + + public void setSinglePrice(String singlePrice) { + this.singlePrice = singlePrice; + } + + public String getSupportStandardEquipmentName() { + return supportStandardEquipmentName; + } + + public void setSupportStandardEquipmentName(String supportStandardEquipmentName) { + this.supportStandardEquipmentName = supportStandardEquipmentName; + } + + public String getSupportStandardEquipmentNo() { + return supportStandardEquipmentNo; + } + + public void setSupportStandardEquipmentNo(String supportStandardEquipmentNo) { + this.supportStandardEquipmentNo = supportStandardEquipmentNo; + } + + public String getTechnicalLevel() { + return technicalLevel; + } + + public void setTechnicalLevel(String technicalLevel) { + this.technicalLevel = technicalLevel; + } + + public String getUncertainty() { + return uncertainty; + } + + public void setUncertainty(String uncertainty) { + this.uncertainty = uncertainty; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getUseDept() { + return useDept; + } + + public void setUseDept(String useDept) { + this.useDept = useDept; + } + + public String getUseDeptName() { + return useDeptName; + } + + public void setUseDeptName(String useDeptName) { + this.useDeptName = useDeptName; + } + + public String getUsePerson() { + return usePerson; + } + + public void setUsePerson(String usePerson) { + this.usePerson = usePerson; + } + + public String getUsePersonName() { + return usePersonName; + } + + public void setUsePersonName(String usePersonName) { + this.usePersonName = usePersonName; + } + + public String getValidDate() { + return validDate; + } + + public void setValidDate(String validDate) { + this.validDate = validDate; + } + + public int getVersion() { + return version; + } + + public void setVersion(int version) { + this.version = version; + } + + public String getWeight() { + return weight; + } + + public void setWeight(String weight) { + this.weight = weight; + } + } + } +} diff --git a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt index a3f514f..46e5eef 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt @@ -35,4 +35,24 @@ @QueryMap limit: Map, @QueryMap offset: Map ): String + + /** + * 获取设备列表 + */ + @POST("/meter/assets/listPage") + suspend fun getEquipmentList( + @Header("token") token: String, + @Body requestBody: RequestBody, + @QueryMap limit: Map, + @QueryMap offset: Map + ): String + + /** + * 获取设备详情 + */ + @POST("/meter/assets/detail") + suspend fun getEquipmentDetail( + @Header("token") token: String, + @Body requestBody: RequestBody + ): String } \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt index 444a872..386a1d8 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt @@ -6,8 +6,10 @@ import com.pengxh.kt.lite.utils.SaveKeyValues import okhttp3.MediaType.Companion.toMediaType import okhttp3.RequestBody.Companion.toRequestBody +import org.json.JSONArray import org.json.JSONObject + object RetrofitServiceManager { private val api by lazy { @@ -73,4 +75,71 @@ offsetMap["offset"] = offset return api.getNoticeList(AuthenticationHelper.token!!, requestBody, limitMap, offsetMap) } + + /** + * 获取设备列表 + */ + suspend fun getEquipmentList( + equipmentNo: String, + equipmentName: String, + mesureType: String, + managerState: String, + useDept: String, + assetType: String, + equipmentCategory: String, + isCalibrationTestEquipment: String, + isMeasureAccount: String, + isStandardSupportEquipment: String, + isFixedAssets: String, + validStartDate: String, + validEndDate: String, + abc: String, + ids: Array, + offset: Int + ): String { + val paramObject = JSONObject() + paramObject.put("equipmentNo", equipmentNo) + paramObject.put("equipmentName", equipmentName) + paramObject.put("mesureType", mesureType) + paramObject.put("managerState", managerState) + paramObject.put("useDept", useDept) + paramObject.put("assetType", assetType) + paramObject.put("equipmentCategory", equipmentCategory) + paramObject.put("isCalibrationTestEquipment", isCalibrationTestEquipment) + paramObject.put("isMeasureAccount", isMeasureAccount) + paramObject.put("isStandardSupportEquipment", isStandardSupportEquipment) + paramObject.put("isFixedAssets", isFixedAssets) + paramObject.put("validStartDate", validStartDate) + paramObject.put("validEndDate", validEndDate) + paramObject.put("abc", abc) + + val jsonArray = JSONArray() + ids.forEach { + jsonArray.put(it) + } + paramObject.put("ids", jsonArray) + + val requestBody = paramObject.toString().toRequestBody( + "application/json;charset=UTF-8".toMediaType() + ) + + val limitMap = HashMap() + limitMap["limit"] = LocaleConstant.PAGE_LIMIT + + val offsetMap = HashMap() + offsetMap["offset"] = offset + return api.getEquipmentList(AuthenticationHelper.token!!, requestBody, limitMap, offsetMap) + } + + /** + * 获取设备详情 + */ + suspend fun getEquipmentDetail(id: String): String { + val paramObject = JSONObject() + paramObject.put("id", id) + val requestBody = paramObject.toString().toRequestBody( + "application/json;charset=UTF-8".toMediaType() + ) + return api.getEquipmentDetail(AuthenticationHelper.token!!, requestBody) + } } \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt deleted file mode 100644 index a5bb60b..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt +++ /dev/null @@ -1,104 +0,0 @@ -package com.casic.xz.meterage.view - -import android.annotation.SuppressLint -import android.graphics.Paint -import androidx.lifecycle.ViewModelProvider -import com.casic.xz.meterage.R -import com.casic.xz.meterage.extensions.combineImagePath -import com.casic.xz.meterage.extensions.formatTextFromHtml -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.vm.NoticeViewModel -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.extensions.convertColor -import com.pengxh.kt.lite.extensions.navigatePageTo -import com.pengxh.kt.lite.extensions.obtainScreenWidth -import com.pengxh.kt.lite.extensions.show -import com.pengxh.kt.lite.utils.Constant -import kotlinx.android.synthetic.main.activity_notice_detail.* -import kotlinx.android.synthetic.main.include_base_title.* -import java.util.* - -@SuppressLint("SetTextI18n") -class NoticeDetailActivity : KotlinBaseActivity() { - - private lateinit var noticeViewModel: NoticeViewModel - - override fun initData() { - leftBackView.setOnClickListener { finish() } - titleView.text = "通知公告" - - val args = intent.getStringArrayListExtra(Constant.INTENT_PARAM)!! - - noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] - noticeViewModel.getNoticeList(args[0], args[1], args[2], "", "", 1) - noticeViewModel.noticeResult.observe(this, { - if (it.code == 200) { - val dataRow = it.data?.rows!![0] - - noticeDateView.text = dataRow.noticeTime - noticePublisherView.text = "发布人 ${dataRow.noticePublisher}" - noticeCompanyView.text = "发布单位 ${dataRow.noticeCompany}" - - noticeNoView.text = dataRow.noticeNo - noticeTitleView.text = dataRow.noticeTitle - noticeSketchView.text = dataRow.noticeSketch - - dataRow.noticeContent.formatTextFromHtml( - this, noticeContentView, obtainScreenWidth() - ) - - if (dataRow.minioFileName.isNullOrBlank()) { - minioFileView.text = "暂无附件" - } else { - val minioFileName = dataRow.minioFileName - - minioFileView.text = minioFileName - val textPaint = minioFileView.paint - textPaint.flags = Paint.UNDERLINE_TEXT_FLAG - textPaint.isAntiAlias = true - minioFileView.setTextColor(R.color.themeColor.convertColor(this)) - - minioFileView.setOnClickListener { - //查看附件 - if (minioFileName.endsWith("pdf")) { - navigatePageTo(minioFileName) - } else if ( - minioFileName.endsWith("doc") || - minioFileName.endsWith("docx") - ) { - navigatePageTo(minioFileName) - } else if (minioFileName.endsWith("txt")) { - navigatePageTo(minioFileName) - } else if ( - minioFileName.endsWith("png") || - minioFileName.endsWith("jpeg") || - minioFileName.endsWith("jpg") - ) { - val urls = ArrayList() - urls.add(minioFileName.combineImagePath()) - navigatePageTo(0, urls) - } else { - "文件类型未知,无法打开附件".show(this) - } - } - } - } - }) - } - - override fun initEvent() { - - } - - override fun initLayoutView(): Int = R.layout.activity_notice_detail - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 3892b5a..02160cd 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -34,16 +34,18 @@ - - - - - - - + + + + + + + + + +) : RecyclerView.Adapter() { + + private var layoutInflater: LayoutInflater = LayoutInflater.from(context) + + override fun getItemCount(): Int = dataRows.size + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = ItemViewHolder( + layoutInflater.inflate(R.layout.item_equipment_rv_l, parent, false) + ) + + override fun onBindViewHolder(holder: ItemViewHolder, position: Int) { + //绑定数据 + val rowsBean = dataRows[position] + holder.equipmentNameView.text = rowsBean.equipmentName + holder.equipmentCodeView.text = rowsBean.equipmentNo + holder.equipmentDateView.text = rowsBean.enableDate + holder.equipmentLibView.text = rowsBean.useDeptName + + //绑定事件 + holder.itemView.setOnClickListener { + listener?.onItemClicked(position) + } + } + + inner class ItemViewHolder(view: View) : RecyclerView.ViewHolder(view) { + var equipmentNameView: TextView = view.findViewById(R.id.equipmentNameView) + var equipmentCodeView: TextView = view.findViewById(R.id.equipmentCodeView) + var equipmentDateView: TextView = view.findViewById(R.id.equipmentDateView) + var equipmentLibView: TextView = view.findViewById(R.id.equipmentLibView) + } + + private var listener: OnItemClickListener? = null + + interface OnItemClickListener { + fun onItemClicked(position: Int) + } + + fun setOnItemClickListener(onClickListener: OnItemClickListener?) { + this.listener = onClickListener + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt index b4628f3..d970b55 100644 --- a/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt +++ b/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt @@ -5,7 +5,8 @@ import com.casic.xz.meterage.R import com.casic.xz.meterage.adapter.HomeGridAdapter import com.casic.xz.meterage.utils.LocaleConstant -import com.casic.xz.meterage.view.NoticeListActivity +import com.casic.xz.meterage.view.home.EquipmentActivity +import com.casic.xz.meterage.view.notice.NoticeListActivity import com.casic.xz.meterage.vm.NoticeViewModel import com.pengxh.kt.lite.base.KotlinBaseFragment import com.pengxh.kt.lite.extensions.navigatePageTo @@ -36,8 +37,19 @@ homeFuncRecyclerView.adapter = homeAdapter homeAdapter.setOnGridItemClickListener(object : HomeGridAdapter.OnGridItemClickListener { override fun onItemClick(position: Int) { - when (position) { - + when (LocaleConstant.HOME_FUNC_OPERATE[position]) { + "仪器设备" -> requireContext().navigatePageTo() +// "标准装置" -> requireContext().navigatePageTo() +// "证书报告" -> requireContext().navigatePageTo() +// "委托需求" -> requireContext().navigatePageTo() +// "访客" -> requireContext().navigatePageTo() +// "标准规范" -> requireContext().navigatePageTo() +// "能力列表" -> requireContext().navigatePageTo() +// "计量培训" -> requireContext().navigatePageTo() +// "合同发票" -> requireContext().navigatePageTo() +// "业务统计" -> requireContext().navigatePageTo() +// "客户列表" -> requireContext().navigatePageTo() +// "外场检测" -> requireContext().navigatePageTo() } } }) diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt index 7e75abe..56dc5ec 100644 --- a/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt +++ b/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt @@ -2,9 +2,11 @@ import android.view.View import androidx.lifecycle.ViewModelProvider +import com.bumptech.glide.Glide +import com.bumptech.glide.request.RequestOptions import com.casic.xz.meterage.R import com.casic.xz.meterage.utils.LocaleConstant -import com.casic.xz.meterage.view.NoticeListActivity +import com.casic.xz.meterage.view.notice.NoticeListActivity import com.casic.xz.meterage.vm.NoticeViewModel import com.casic.xz.meterage.vm.UserViewModel import com.pengxh.kt.lite.base.KotlinBaseFragment @@ -23,6 +25,12 @@ val data = it.data userNameView.text = data.name userUnitView.text = data.deptName + +// Glide.with(requireContext()) +// .load(R.mipmap.default_avatar) +// .apply(RequestOptions.circleCropTransform()) +// .placeholder(R.mipmap.load_image_error) +// .into(userAvatarView) } }) diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt new file mode 100644 index 0000000..cf22646 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt @@ -0,0 +1,103 @@ +package com.casic.xz.meterage.fragment.equipment + +import android.graphics.Paint +import androidx.lifecycle.ViewModelProvider +import com.casic.xz.meterage.R +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.casic.xz.meterage.vm.EquipmentViewModel +import com.pengxh.kt.lite.base.KotlinBaseFragment +import com.pengxh.kt.lite.extensions.convertColor +import com.pengxh.kt.lite.vm.LoadState +import kotlinx.android.synthetic.main.fragment_basic_information.* + +class BasicInformationFragment(private val id: String) : KotlinBaseFragment() { + + private lateinit var equipmentViewModel: EquipmentViewModel + + override fun initData() { + equipmentViewModel = ViewModelProvider(this)[EquipmentViewModel::class.java] + equipmentViewModel.getEquipmentDetail(id) + equipmentViewModel.equipmentDetailResult.observe(this, { + if (it.code == 200) { + val data = it.data!! + + equipmentCodeView.text = data.equipmentNo + equipmentNameView.text = data.equipmentName + manufacturerView.text = data.manufacturer + factoryNumberView.text = data.manufacturingNo + modelView.text = data.modelNo + verificationMethodView.text = data.mesureTypeName + measuringRangeView.text = data.mesureRange + uncertaintyView.text = data.uncertainty + firstUseView.text = data.createTime + originalValueView.text = data.originValue + usageDeptView.text = data.useDeptName + userView.text = data.usePersonName + managementStatusView.text = data.managerStateName + verificationDeptView.text = data.useDeptName +// nextVerificationDeptView.text = data. + verificationPeriodView.text = data.mesureCycle + verificationDateView.text = data.mesureDate + effectiveDateView.text = data.validDate + verificationResultsView.text = data.mesureResultName + abcView.text = data.abcName + isNeedTechnicalView.text = if ( + data.isCalibrationTestEquipment.isNullOrBlank() || data.isCalibrationTestEquipment == "0" + ) { + "否" + } else { + "是" + } + + isStandingBook.text = if ( + data.isMeasureAccount.isNullOrBlank() || data.isMeasureAccount == "0" + ) { + "否" + } else { + "是" + } + + isStandardView.text = if ( + data.isStandardSupportEquipment.isNullOrBlank() || data.isStandardSupportEquipment == "0" + ) { + "否" + } else { + "是" + } + remarkView.text = data.remark + if (data.fileList.size == 0) { + instructionsView.text = "暂无" + } else { + instructionsView.text = "查看附件列表" + val textPaint = instructionsView.paint + textPaint.flags = Paint.UNDERLINE_TEXT_FLAG + textPaint.isAntiAlias = true + instructionsView.setTextColor(R.color.themeColor.convertColor(requireContext())) + + instructionsView.setOnClickListener { + + } + } + } + }) + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_basic_information + + override fun observeRequestState() { + equipmentViewModel.loadState.observe(this, { + when (it) { + LoadState.Loading -> LoadingDialogHub.show(requireActivity(), "数据加载中...") + else -> LoadingDialogHub.dismiss() + } + }) + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt new file mode 100644 index 0000000..0b4a747 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class CertificateFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_certificate + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt new file mode 100644 index 0000000..f05c491 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class ChangeRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_change_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt new file mode 100644 index 0000000..849ffa5 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class InspectionRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_inspection_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt new file mode 100644 index 0000000..aa4edd9 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class UsageRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_usage_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java b/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java new file mode 100644 index 0000000..0b9124e --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java @@ -0,0 +1,760 @@ +package com.casic.xz.meterage.model; + +import java.util.List; + +public class EquipmentDetailModel { + + private int code; + private DataModel data; + private String message; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataModel getData() { + return data; + } + + public void setData(DataModel data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public static class DataModel { + private String abc; + private String abcName; + private String assetNo; + private String assetSource; + private String assetType; + private String assetTypeName; + private String attribute; + private String capitalSource; + private String capitalSourceName; + private String cardEstablishmentDate; + private String createTime; + private String createUser; + private String depreciationMethod; + private String depreciationMethodName; + private String depreciationPeriod; + private String enableDate; + private String equipmentCategory; + private String equipmentCategoryName; + private String equipmentName; + private String equipmentNo; + private String equipmentSpecifications; + private String equipmentType; + private String equipmentTypeName; + private List fileList; + private String id; + private String installIncidentalExpenses; + private String installPlace; + private String intactState; + private String isCalibrationTestEquipment; + private int isDel; + private String isFixedAssets; + private String isMeasureAccount; + private String isStandardSupportEquipment; + private String labelBind; + private String majorCategory; + private String majorCategoryName; + private String managerLevel; + private String managerLevelName; + private String managerState; + private String managerStateName; + private String manufacturer; + private String manufacturerCountry; + private String manufacturingDate; + private String manufacturingNo; + private String mesureCycle; + private String mesureDate; + private String mesureDept; + private String mesureRange; + private String mesureResult; + private String mesureResultName; + private String mesureType; + private String mesureTypeName; + private String modelNo; + private String originValue; + private String overallDimension; + private String presentOriginValue; + private String purpose; + private String remark; + private String singlePrice; + private String supportStandardEquipmentName; + private String supportStandardEquipmentNo; + private String technicalLevel; + private String uncertainty; + private String updateTime; + private String useDept; + private String useDeptName; + private String usePerson; + private String usePersonName; + private String validDate; + private int version; + private String weight; + + public String getAbc() { + return abc; + } + + public void setAbc(String abc) { + this.abc = abc; + } + + public String getAbcName() { + return abcName; + } + + public void setAbcName(String abcName) { + this.abcName = abcName; + } + + public String getAssetNo() { + return assetNo; + } + + public void setAssetNo(String assetNo) { + this.assetNo = assetNo; + } + + public String getAssetSource() { + return assetSource; + } + + public void setAssetSource(String assetSource) { + this.assetSource = assetSource; + } + + public String getAssetType() { + return assetType; + } + + public void setAssetType(String assetType) { + this.assetType = assetType; + } + + public String getAssetTypeName() { + return assetTypeName; + } + + public void setAssetTypeName(String assetTypeName) { + this.assetTypeName = assetTypeName; + } + + public String getAttribute() { + return attribute; + } + + public void setAttribute(String attribute) { + this.attribute = attribute; + } + + public String getCapitalSource() { + return capitalSource; + } + + public void setCapitalSource(String capitalSource) { + this.capitalSource = capitalSource; + } + + public String getCapitalSourceName() { + return capitalSourceName; + } + + public void setCapitalSourceName(String capitalSourceName) { + this.capitalSourceName = capitalSourceName; + } + + public String getCardEstablishmentDate() { + return cardEstablishmentDate; + } + + public void setCardEstablishmentDate(String cardEstablishmentDate) { + this.cardEstablishmentDate = cardEstablishmentDate; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getDepreciationMethod() { + return depreciationMethod; + } + + public void setDepreciationMethod(String depreciationMethod) { + this.depreciationMethod = depreciationMethod; + } + + public String getDepreciationMethodName() { + return depreciationMethodName; + } + + public void setDepreciationMethodName(String depreciationMethodName) { + this.depreciationMethodName = depreciationMethodName; + } + + public String getDepreciationPeriod() { + return depreciationPeriod; + } + + public void setDepreciationPeriod(String depreciationPeriod) { + this.depreciationPeriod = depreciationPeriod; + } + + public String getEnableDate() { + return enableDate; + } + + public void setEnableDate(String enableDate) { + this.enableDate = enableDate; + } + + public String getEquipmentCategory() { + return equipmentCategory; + } + + public void setEquipmentCategory(String equipmentCategory) { + this.equipmentCategory = equipmentCategory; + } + + public String getEquipmentCategoryName() { + return equipmentCategoryName; + } + + public void setEquipmentCategoryName(String equipmentCategoryName) { + this.equipmentCategoryName = equipmentCategoryName; + } + + public String getEquipmentName() { + return equipmentName; + } + + public void setEquipmentName(String equipmentName) { + this.equipmentName = equipmentName; + } + + public String getEquipmentNo() { + return equipmentNo; + } + + public void setEquipmentNo(String equipmentNo) { + this.equipmentNo = equipmentNo; + } + + public String getEquipmentSpecifications() { + return equipmentSpecifications; + } + + public void setEquipmentSpecifications(String equipmentSpecifications) { + this.equipmentSpecifications = equipmentSpecifications; + } + + public String getEquipmentType() { + return equipmentType; + } + + public void setEquipmentType(String equipmentType) { + this.equipmentType = equipmentType; + } + + public String getEquipmentTypeName() { + return equipmentTypeName; + } + + public void setEquipmentTypeName(String equipmentTypeName) { + this.equipmentTypeName = equipmentTypeName; + } + + public List getFileList() { + return fileList; + } + + public void setFileList(List fileList) { + this.fileList = fileList; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getInstallIncidentalExpenses() { + return installIncidentalExpenses; + } + + public void setInstallIncidentalExpenses(String installIncidentalExpenses) { + this.installIncidentalExpenses = installIncidentalExpenses; + } + + public String getInstallPlace() { + return installPlace; + } + + public void setInstallPlace(String installPlace) { + this.installPlace = installPlace; + } + + public String getIntactState() { + return intactState; + } + + public void setIntactState(String intactState) { + this.intactState = intactState; + } + + public String getIsCalibrationTestEquipment() { + return isCalibrationTestEquipment; + } + + public void setIsCalibrationTestEquipment(String isCalibrationTestEquipment) { + this.isCalibrationTestEquipment = isCalibrationTestEquipment; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getIsFixedAssets() { + return isFixedAssets; + } + + public void setIsFixedAssets(String isFixedAssets) { + this.isFixedAssets = isFixedAssets; + } + + public String getIsMeasureAccount() { + return isMeasureAccount; + } + + public void setIsMeasureAccount(String isMeasureAccount) { + this.isMeasureAccount = isMeasureAccount; + } + + public String getIsStandardSupportEquipment() { + return isStandardSupportEquipment; + } + + public void setIsStandardSupportEquipment(String isStandardSupportEquipment) { + this.isStandardSupportEquipment = isStandardSupportEquipment; + } + + public String getLabelBind() { + return labelBind; + } + + public void setLabelBind(String labelBind) { + this.labelBind = labelBind; + } + + public String getMajorCategory() { + return majorCategory; + } + + public void setMajorCategory(String majorCategory) { + this.majorCategory = majorCategory; + } + + public String getMajorCategoryName() { + return majorCategoryName; + } + + public void setMajorCategoryName(String majorCategoryName) { + this.majorCategoryName = majorCategoryName; + } + + public String getManagerLevel() { + return managerLevel; + } + + public void setManagerLevel(String managerLevel) { + this.managerLevel = managerLevel; + } + + public String getManagerLevelName() { + return managerLevelName; + } + + public void setManagerLevelName(String managerLevelName) { + this.managerLevelName = managerLevelName; + } + + public String getManagerState() { + return managerState; + } + + public void setManagerState(String managerState) { + this.managerState = managerState; + } + + public String getManagerStateName() { + return managerStateName; + } + + public void setManagerStateName(String managerStateName) { + this.managerStateName = managerStateName; + } + + public String getManufacturer() { + return manufacturer; + } + + public void setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + } + + public String getManufacturerCountry() { + return manufacturerCountry; + } + + public void setManufacturerCountry(String manufacturerCountry) { + this.manufacturerCountry = manufacturerCountry; + } + + public String getManufacturingDate() { + return manufacturingDate; + } + + public void setManufacturingDate(String manufacturingDate) { + this.manufacturingDate = manufacturingDate; + } + + public String getManufacturingNo() { + return manufacturingNo; + } + + public void setManufacturingNo(String manufacturingNo) { + this.manufacturingNo = manufacturingNo; + } + + public String getMesureCycle() { + return mesureCycle; + } + + public void setMesureCycle(String mesureCycle) { + this.mesureCycle = mesureCycle; + } + + public String getMesureDate() { + return mesureDate; + } + + public void setMesureDate(String mesureDate) { + this.mesureDate = mesureDate; + } + + public String getMesureDept() { + return mesureDept; + } + + public void setMesureDept(String mesureDept) { + this.mesureDept = mesureDept; + } + + public String getMesureRange() { + return mesureRange; + } + + public void setMesureRange(String mesureRange) { + this.mesureRange = mesureRange; + } + + public String getMesureResult() { + return mesureResult; + } + + public void setMesureResult(String mesureResult) { + this.mesureResult = mesureResult; + } + + public String getMesureResultName() { + return mesureResultName; + } + + public void setMesureResultName(String mesureResultName) { + this.mesureResultName = mesureResultName; + } + + public String getMesureType() { + return mesureType; + } + + public void setMesureType(String mesureType) { + this.mesureType = mesureType; + } + + public String getMesureTypeName() { + return mesureTypeName; + } + + public void setMesureTypeName(String mesureTypeName) { + this.mesureTypeName = mesureTypeName; + } + + public String getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getOriginValue() { + return originValue; + } + + public void setOriginValue(String originValue) { + this.originValue = originValue; + } + + public String getOverallDimension() { + return overallDimension; + } + + public void setOverallDimension(String overallDimension) { + this.overallDimension = overallDimension; + } + + public String getPresentOriginValue() { + return presentOriginValue; + } + + public void setPresentOriginValue(String presentOriginValue) { + this.presentOriginValue = presentOriginValue; + } + + public String getPurpose() { + return purpose; + } + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getSinglePrice() { + return singlePrice; + } + + public void setSinglePrice(String singlePrice) { + this.singlePrice = singlePrice; + } + + public String getSupportStandardEquipmentName() { + return supportStandardEquipmentName; + } + + public void setSupportStandardEquipmentName(String supportStandardEquipmentName) { + this.supportStandardEquipmentName = supportStandardEquipmentName; + } + + public String getSupportStandardEquipmentNo() { + return supportStandardEquipmentNo; + } + + public void setSupportStandardEquipmentNo(String supportStandardEquipmentNo) { + this.supportStandardEquipmentNo = supportStandardEquipmentNo; + } + + public String getTechnicalLevel() { + return technicalLevel; + } + + public void setTechnicalLevel(String technicalLevel) { + this.technicalLevel = technicalLevel; + } + + public String getUncertainty() { + return uncertainty; + } + + public void setUncertainty(String uncertainty) { + this.uncertainty = uncertainty; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getUseDept() { + return useDept; + } + + public void setUseDept(String useDept) { + this.useDept = useDept; + } + + public String getUseDeptName() { + return useDeptName; + } + + public void setUseDeptName(String useDeptName) { + this.useDeptName = useDeptName; + } + + public String getUsePerson() { + return usePerson; + } + + public void setUsePerson(String usePerson) { + this.usePerson = usePerson; + } + + public String getUsePersonName() { + return usePersonName; + } + + public void setUsePersonName(String usePersonName) { + this.usePersonName = usePersonName; + } + + public String getValidDate() { + return validDate; + } + + public void setValidDate(String validDate) { + this.validDate = validDate; + } + + public int getVersion() { + return version; + } + + public void setVersion(int version) { + this.version = version; + } + + public String getWeight() { + return weight; + } + + public void setWeight(String weight) { + this.weight = weight; + } + + public static class FileListModel { + private String assetId; + private String createTime; + private String createUser; + private String fileName; + private String id; + private int isDel; + private String minioFileName; + private String remark; + private String updateTime; + + public String getAssetId() { + return assetId; + } + + public void setAssetId(String assetId) { + this.assetId = assetId; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getFileName() { + return fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getMinioFileName() { + return minioFileName; + } + + public void setMinioFileName(String minioFileName) { + this.minioFileName = minioFileName; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + } + } +} diff --git a/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java b/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java new file mode 100644 index 0000000..15fc128 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java @@ -0,0 +1,697 @@ +package com.casic.xz.meterage.model; + +import java.util.List; + +public class EquipmentListModel { + + private int code; + private DataModel data; + private String message; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataModel getData() { + return data; + } + + public void setData(DataModel data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public static class DataModel { + private List rows; + private int total; + + public List getRows() { + return rows; + } + + public void setRows(List rows) { + this.rows = rows; + } + + public int getTotal() { + return total; + } + + public void setTotal(int total) { + this.total = total; + } + + public static class RowsModel { + private String abc; + private String abcName; + private String assetNo; + private String assetSource; + private String assetType; + private String assetTypeName; + private String attribute; + private String capitalSource; + private String capitalSourceName; + private String cardEstablishmentDate; + private String createTime; + private String createUser; + private String depreciationMethod; + private String depreciationMethodName; + private String depreciationPeriod; + private String enableDate; + private String equipmentCategory; + private String equipmentCategoryName; + private String equipmentName; + private String equipmentNo; + private String equipmentSpecifications; + private String equipmentType; + private String equipmentTypeName; + private String fileList; + private String id; + private String installIncidentalExpenses; + private String installPlace; + private String intactState; + private String isCalibrationTestEquipment; + private int isDel; + private String isFixedAssets; + private String isMeasureAccount; + private String isStandardSupportEquipment; + private String labelBind; + private String majorCategory; + private String majorCategoryName; + private String managerLevel; + private String managerLevelName; + private String managerState; + private String managerStateName; + private String manufacturer; + private String manufacturerCountry; + private String manufacturingDate; + private String manufacturingNo; + private String mesureCycle; + private String mesureDate; + private String mesureDept; + private String mesureRange; + private String mesureResult; + private String mesureResultName; + private String mesureType; + private String mesureTypeName; + private String modelNo; + private String originValue; + private String overallDimension; + private String presentOriginValue; + private String purpose; + private String remark; + private String singlePrice; + private String supportStandardEquipmentName; + private String supportStandardEquipmentNo; + private String technicalLevel; + private String uncertainty; + private String updateTime; + private String useDept; + private String useDeptName; + private String usePerson; + private String usePersonName; + private String validDate; + private int version; + private String weight; + + public String getAbc() { + return abc; + } + + public void setAbc(String abc) { + this.abc = abc; + } + + public String getAbcName() { + return abcName; + } + + public void setAbcName(String abcName) { + this.abcName = abcName; + } + + public String getAssetNo() { + return assetNo; + } + + public void setAssetNo(String assetNo) { + this.assetNo = assetNo; + } + + public String getAssetSource() { + return assetSource; + } + + public void setAssetSource(String assetSource) { + this.assetSource = assetSource; + } + + public String getAssetType() { + return assetType; + } + + public void setAssetType(String assetType) { + this.assetType = assetType; + } + + public String getAssetTypeName() { + return assetTypeName; + } + + public void setAssetTypeName(String assetTypeName) { + this.assetTypeName = assetTypeName; + } + + public String getAttribute() { + return attribute; + } + + public void setAttribute(String attribute) { + this.attribute = attribute; + } + + public String getCapitalSource() { + return capitalSource; + } + + public void setCapitalSource(String capitalSource) { + this.capitalSource = capitalSource; + } + + public String getCapitalSourceName() { + return capitalSourceName; + } + + public void setCapitalSourceName(String capitalSourceName) { + this.capitalSourceName = capitalSourceName; + } + + public String getCardEstablishmentDate() { + return cardEstablishmentDate; + } + + public void setCardEstablishmentDate(String cardEstablishmentDate) { + this.cardEstablishmentDate = cardEstablishmentDate; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getDepreciationMethod() { + return depreciationMethod; + } + + public void setDepreciationMethod(String depreciationMethod) { + this.depreciationMethod = depreciationMethod; + } + + public String getDepreciationMethodName() { + return depreciationMethodName; + } + + public void setDepreciationMethodName(String depreciationMethodName) { + this.depreciationMethodName = depreciationMethodName; + } + + public String getDepreciationPeriod() { + return depreciationPeriod; + } + + public void setDepreciationPeriod(String depreciationPeriod) { + this.depreciationPeriod = depreciationPeriod; + } + + public String getEnableDate() { + return enableDate; + } + + public void setEnableDate(String enableDate) { + this.enableDate = enableDate; + } + + public String getEquipmentCategory() { + return equipmentCategory; + } + + public void setEquipmentCategory(String equipmentCategory) { + this.equipmentCategory = equipmentCategory; + } + + public String getEquipmentCategoryName() { + return equipmentCategoryName; + } + + public void setEquipmentCategoryName(String equipmentCategoryName) { + this.equipmentCategoryName = equipmentCategoryName; + } + + public String getEquipmentName() { + return equipmentName; + } + + public void setEquipmentName(String equipmentName) { + this.equipmentName = equipmentName; + } + + public String getEquipmentNo() { + return equipmentNo; + } + + public void setEquipmentNo(String equipmentNo) { + this.equipmentNo = equipmentNo; + } + + public String getEquipmentSpecifications() { + return equipmentSpecifications; + } + + public void setEquipmentSpecifications(String equipmentSpecifications) { + this.equipmentSpecifications = equipmentSpecifications; + } + + public String getEquipmentType() { + return equipmentType; + } + + public void setEquipmentType(String equipmentType) { + this.equipmentType = equipmentType; + } + + public String getEquipmentTypeName() { + return equipmentTypeName; + } + + public void setEquipmentTypeName(String equipmentTypeName) { + this.equipmentTypeName = equipmentTypeName; + } + + public String getFileList() { + return fileList; + } + + public void setFileList(String fileList) { + this.fileList = fileList; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getInstallIncidentalExpenses() { + return installIncidentalExpenses; + } + + public void setInstallIncidentalExpenses(String installIncidentalExpenses) { + this.installIncidentalExpenses = installIncidentalExpenses; + } + + public String getInstallPlace() { + return installPlace; + } + + public void setInstallPlace(String installPlace) { + this.installPlace = installPlace; + } + + public String getIntactState() { + return intactState; + } + + public void setIntactState(String intactState) { + this.intactState = intactState; + } + + public String getIsCalibrationTestEquipment() { + return isCalibrationTestEquipment; + } + + public void setIsCalibrationTestEquipment(String isCalibrationTestEquipment) { + this.isCalibrationTestEquipment = isCalibrationTestEquipment; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getIsFixedAssets() { + return isFixedAssets; + } + + public void setIsFixedAssets(String isFixedAssets) { + this.isFixedAssets = isFixedAssets; + } + + public String getIsMeasureAccount() { + return isMeasureAccount; + } + + public void setIsMeasureAccount(String isMeasureAccount) { + this.isMeasureAccount = isMeasureAccount; + } + + public String getIsStandardSupportEquipment() { + return isStandardSupportEquipment; + } + + public void setIsStandardSupportEquipment(String isStandardSupportEquipment) { + this.isStandardSupportEquipment = isStandardSupportEquipment; + } + + public String getLabelBind() { + return labelBind; + } + + public void setLabelBind(String labelBind) { + this.labelBind = labelBind; + } + + public String getMajorCategory() { + return majorCategory; + } + + public void setMajorCategory(String majorCategory) { + this.majorCategory = majorCategory; + } + + public String getMajorCategoryName() { + return majorCategoryName; + } + + public void setMajorCategoryName(String majorCategoryName) { + this.majorCategoryName = majorCategoryName; + } + + public String getManagerLevel() { + return managerLevel; + } + + public void setManagerLevel(String managerLevel) { + this.managerLevel = managerLevel; + } + + public String getManagerLevelName() { + return managerLevelName; + } + + public void setManagerLevelName(String managerLevelName) { + this.managerLevelName = managerLevelName; + } + + public String getManagerState() { + return managerState; + } + + public void setManagerState(String managerState) { + this.managerState = managerState; + } + + public String getManagerStateName() { + return managerStateName; + } + + public void setManagerStateName(String managerStateName) { + this.managerStateName = managerStateName; + } + + public String getManufacturer() { + return manufacturer; + } + + public void setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + } + + public String getManufacturerCountry() { + return manufacturerCountry; + } + + public void setManufacturerCountry(String manufacturerCountry) { + this.manufacturerCountry = manufacturerCountry; + } + + public String getManufacturingDate() { + return manufacturingDate; + } + + public void setManufacturingDate(String manufacturingDate) { + this.manufacturingDate = manufacturingDate; + } + + public String getManufacturingNo() { + return manufacturingNo; + } + + public void setManufacturingNo(String manufacturingNo) { + this.manufacturingNo = manufacturingNo; + } + + public String getMesureCycle() { + return mesureCycle; + } + + public void setMesureCycle(String mesureCycle) { + this.mesureCycle = mesureCycle; + } + + public String getMesureDate() { + return mesureDate; + } + + public void setMesureDate(String mesureDate) { + this.mesureDate = mesureDate; + } + + public String getMesureDept() { + return mesureDept; + } + + public void setMesureDept(String mesureDept) { + this.mesureDept = mesureDept; + } + + public String getMesureRange() { + return mesureRange; + } + + public void setMesureRange(String mesureRange) { + this.mesureRange = mesureRange; + } + + public String getMesureResult() { + return mesureResult; + } + + public void setMesureResult(String mesureResult) { + this.mesureResult = mesureResult; + } + + public String getMesureResultName() { + return mesureResultName; + } + + public void setMesureResultName(String mesureResultName) { + this.mesureResultName = mesureResultName; + } + + public String getMesureType() { + return mesureType; + } + + public void setMesureType(String mesureType) { + this.mesureType = mesureType; + } + + public String getMesureTypeName() { + return mesureTypeName; + } + + public void setMesureTypeName(String mesureTypeName) { + this.mesureTypeName = mesureTypeName; + } + + public String getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getOriginValue() { + return originValue; + } + + public void setOriginValue(String originValue) { + this.originValue = originValue; + } + + public String getOverallDimension() { + return overallDimension; + } + + public void setOverallDimension(String overallDimension) { + this.overallDimension = overallDimension; + } + + public String getPresentOriginValue() { + return presentOriginValue; + } + + public void setPresentOriginValue(String presentOriginValue) { + this.presentOriginValue = presentOriginValue; + } + + public String getPurpose() { + return purpose; + } + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getSinglePrice() { + return singlePrice; + } + + public void setSinglePrice(String singlePrice) { + this.singlePrice = singlePrice; + } + + public String getSupportStandardEquipmentName() { + return supportStandardEquipmentName; + } + + public void setSupportStandardEquipmentName(String supportStandardEquipmentName) { + this.supportStandardEquipmentName = supportStandardEquipmentName; + } + + public String getSupportStandardEquipmentNo() { + return supportStandardEquipmentNo; + } + + public void setSupportStandardEquipmentNo(String supportStandardEquipmentNo) { + this.supportStandardEquipmentNo = supportStandardEquipmentNo; + } + + public String getTechnicalLevel() { + return technicalLevel; + } + + public void setTechnicalLevel(String technicalLevel) { + this.technicalLevel = technicalLevel; + } + + public String getUncertainty() { + return uncertainty; + } + + public void setUncertainty(String uncertainty) { + this.uncertainty = uncertainty; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getUseDept() { + return useDept; + } + + public void setUseDept(String useDept) { + this.useDept = useDept; + } + + public String getUseDeptName() { + return useDeptName; + } + + public void setUseDeptName(String useDeptName) { + this.useDeptName = useDeptName; + } + + public String getUsePerson() { + return usePerson; + } + + public void setUsePerson(String usePerson) { + this.usePerson = usePerson; + } + + public String getUsePersonName() { + return usePersonName; + } + + public void setUsePersonName(String usePersonName) { + this.usePersonName = usePersonName; + } + + public String getValidDate() { + return validDate; + } + + public void setValidDate(String validDate) { + this.validDate = validDate; + } + + public int getVersion() { + return version; + } + + public void setVersion(int version) { + this.version = version; + } + + public String getWeight() { + return weight; + } + + public void setWeight(String weight) { + this.weight = weight; + } + } + } +} diff --git a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt index a3f514f..46e5eef 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt @@ -35,4 +35,24 @@ @QueryMap limit: Map, @QueryMap offset: Map ): String + + /** + * 获取设备列表 + */ + @POST("/meter/assets/listPage") + suspend fun getEquipmentList( + @Header("token") token: String, + @Body requestBody: RequestBody, + @QueryMap limit: Map, + @QueryMap offset: Map + ): String + + /** + * 获取设备详情 + */ + @POST("/meter/assets/detail") + suspend fun getEquipmentDetail( + @Header("token") token: String, + @Body requestBody: RequestBody + ): String } \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt index 444a872..386a1d8 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt @@ -6,8 +6,10 @@ import com.pengxh.kt.lite.utils.SaveKeyValues import okhttp3.MediaType.Companion.toMediaType import okhttp3.RequestBody.Companion.toRequestBody +import org.json.JSONArray import org.json.JSONObject + object RetrofitServiceManager { private val api by lazy { @@ -73,4 +75,71 @@ offsetMap["offset"] = offset return api.getNoticeList(AuthenticationHelper.token!!, requestBody, limitMap, offsetMap) } + + /** + * 获取设备列表 + */ + suspend fun getEquipmentList( + equipmentNo: String, + equipmentName: String, + mesureType: String, + managerState: String, + useDept: String, + assetType: String, + equipmentCategory: String, + isCalibrationTestEquipment: String, + isMeasureAccount: String, + isStandardSupportEquipment: String, + isFixedAssets: String, + validStartDate: String, + validEndDate: String, + abc: String, + ids: Array, + offset: Int + ): String { + val paramObject = JSONObject() + paramObject.put("equipmentNo", equipmentNo) + paramObject.put("equipmentName", equipmentName) + paramObject.put("mesureType", mesureType) + paramObject.put("managerState", managerState) + paramObject.put("useDept", useDept) + paramObject.put("assetType", assetType) + paramObject.put("equipmentCategory", equipmentCategory) + paramObject.put("isCalibrationTestEquipment", isCalibrationTestEquipment) + paramObject.put("isMeasureAccount", isMeasureAccount) + paramObject.put("isStandardSupportEquipment", isStandardSupportEquipment) + paramObject.put("isFixedAssets", isFixedAssets) + paramObject.put("validStartDate", validStartDate) + paramObject.put("validEndDate", validEndDate) + paramObject.put("abc", abc) + + val jsonArray = JSONArray() + ids.forEach { + jsonArray.put(it) + } + paramObject.put("ids", jsonArray) + + val requestBody = paramObject.toString().toRequestBody( + "application/json;charset=UTF-8".toMediaType() + ) + + val limitMap = HashMap() + limitMap["limit"] = LocaleConstant.PAGE_LIMIT + + val offsetMap = HashMap() + offsetMap["offset"] = offset + return api.getEquipmentList(AuthenticationHelper.token!!, requestBody, limitMap, offsetMap) + } + + /** + * 获取设备详情 + */ + suspend fun getEquipmentDetail(id: String): String { + val paramObject = JSONObject() + paramObject.put("id", id) + val requestBody = paramObject.toString().toRequestBody( + "application/json;charset=UTF-8".toMediaType() + ) + return api.getEquipmentDetail(AuthenticationHelper.token!!, requestBody) + } } \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt deleted file mode 100644 index a5bb60b..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt +++ /dev/null @@ -1,104 +0,0 @@ -package com.casic.xz.meterage.view - -import android.annotation.SuppressLint -import android.graphics.Paint -import androidx.lifecycle.ViewModelProvider -import com.casic.xz.meterage.R -import com.casic.xz.meterage.extensions.combineImagePath -import com.casic.xz.meterage.extensions.formatTextFromHtml -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.vm.NoticeViewModel -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.extensions.convertColor -import com.pengxh.kt.lite.extensions.navigatePageTo -import com.pengxh.kt.lite.extensions.obtainScreenWidth -import com.pengxh.kt.lite.extensions.show -import com.pengxh.kt.lite.utils.Constant -import kotlinx.android.synthetic.main.activity_notice_detail.* -import kotlinx.android.synthetic.main.include_base_title.* -import java.util.* - -@SuppressLint("SetTextI18n") -class NoticeDetailActivity : KotlinBaseActivity() { - - private lateinit var noticeViewModel: NoticeViewModel - - override fun initData() { - leftBackView.setOnClickListener { finish() } - titleView.text = "通知公告" - - val args = intent.getStringArrayListExtra(Constant.INTENT_PARAM)!! - - noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] - noticeViewModel.getNoticeList(args[0], args[1], args[2], "", "", 1) - noticeViewModel.noticeResult.observe(this, { - if (it.code == 200) { - val dataRow = it.data?.rows!![0] - - noticeDateView.text = dataRow.noticeTime - noticePublisherView.text = "发布人 ${dataRow.noticePublisher}" - noticeCompanyView.text = "发布单位 ${dataRow.noticeCompany}" - - noticeNoView.text = dataRow.noticeNo - noticeTitleView.text = dataRow.noticeTitle - noticeSketchView.text = dataRow.noticeSketch - - dataRow.noticeContent.formatTextFromHtml( - this, noticeContentView, obtainScreenWidth() - ) - - if (dataRow.minioFileName.isNullOrBlank()) { - minioFileView.text = "暂无附件" - } else { - val minioFileName = dataRow.minioFileName - - minioFileView.text = minioFileName - val textPaint = minioFileView.paint - textPaint.flags = Paint.UNDERLINE_TEXT_FLAG - textPaint.isAntiAlias = true - minioFileView.setTextColor(R.color.themeColor.convertColor(this)) - - minioFileView.setOnClickListener { - //查看附件 - if (minioFileName.endsWith("pdf")) { - navigatePageTo(minioFileName) - } else if ( - minioFileName.endsWith("doc") || - minioFileName.endsWith("docx") - ) { - navigatePageTo(minioFileName) - } else if (minioFileName.endsWith("txt")) { - navigatePageTo(minioFileName) - } else if ( - minioFileName.endsWith("png") || - minioFileName.endsWith("jpeg") || - minioFileName.endsWith("jpg") - ) { - val urls = ArrayList() - urls.add(minioFileName.combineImagePath()) - navigatePageTo(0, urls) - } else { - "文件类型未知,无法打开附件".show(this) - } - } - } - } - }) - } - - override fun initEvent() { - - } - - override fun initLayoutView(): Int = R.layout.activity_notice_detail - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/NoticeListActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/NoticeListActivity.kt deleted file mode 100644 index 15f6a16..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/NoticeListActivity.kt +++ /dev/null @@ -1,180 +0,0 @@ -package com.casic.xz.meterage.view - -import android.os.Handler -import android.util.Log -import android.view.View -import androidx.lifecycle.ViewModelProvider -import com.casic.xz.meterage.R -import com.casic.xz.meterage.adapter.NoticeListAdapter -import com.casic.xz.meterage.extensions.addAll -import com.casic.xz.meterage.extensions.combineFilePath -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.extensions.showEmptyPage -import com.casic.xz.meterage.model.NoticeListModel -import com.casic.xz.meterage.vm.NoticeViewModel -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.extensions.navigatePageTo -import com.pengxh.kt.lite.extensions.show -import com.pengxh.kt.lite.utils.WeakReferenceHandler -import com.pengxh.kt.lite.widget.dialog.AlertControlDialog -import kotlinx.android.synthetic.main.activity_notice_list.* -import kotlinx.android.synthetic.main.include_empty_view.* - -class NoticeListActivity : KotlinBaseActivity() { - - private lateinit var weakReferenceHandler: WeakReferenceHandler - private lateinit var noticeViewModel: NoticeViewModel - private lateinit var noticeListAdapter: NoticeListAdapter - private var dataBeans: MutableList = ArrayList() - private var pageIndex = 1 - private var isRefresh = false - private var isLoadMore = false - - override fun initData() { - weakReferenceHandler = WeakReferenceHandler(callback) - noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] - noticeViewModel.noticeResult.observe(this, { - if (it.code == 200) { - val dataRows = it.data?.rows!! -// countBadeNumber(dataRows) - when { - isRefresh -> { - dataBeans.clear() - dataBeans = dataRows - noticeLayout.finishRefresh() - isRefresh = false - } - isLoadMore -> { - if (dataRows.size == 0) { - "到底了,别拉了".show(this) - } - dataBeans.addAll(dataRows) - noticeLayout.finishLoadMore() - isLoadMore = false - } - else -> { - dataBeans = dataRows - } - } - weakReferenceHandler.sendEmptyMessage(2023013101) - } - }) - } - - override fun initEvent() { - leftBackView.setOnClickListener { finish() } - rightOperateView.setOnClickListener { - AlertControlDialog.Builder() - .setContext(this) - .setTitle("提示") - .setMessage("确定将所有未读消息标为已读?") - .setNegativeButton("取消") - .setPositiveButton("确定") - .setOnDialogButtonClickListener(object : - AlertControlDialog.OnDialogButtonClickListener { - override fun onCancelClick() { - - } - - override fun onConfirmClick() { - //TODO 设置为已读 - } - }).build().show() - } - - if (hasNoticePermission()) { - openSystemNoticeLayout.visibility = View.GONE - openSystemNoticeLayout.visibility = View.GONE - } else { - openSystemNoticeLayout.setOnClickListener { - - } - - - closeLayoutView.setOnClickListener { - openSystemNoticeLayout.visibility = View.GONE - } - } - - noticeLayout.setOnRefreshListener { - isRefresh = true - //刷新之后页码重置 - pageIndex = 1 - getNoticeListByPage() - } - - noticeLayout.setOnLoadMoreListener { - isLoadMore = true - pageIndex++ - getNoticeListByPage() - } - } - - override fun onResume() { - super.onResume() - pageIndex = 1 - getNoticeListByPage() - } - - private fun getNoticeListByPage() { - noticeViewModel.getNoticeList("", "", "", "", "", pageIndex) - } - - private val callback = Handler.Callback { - when (it.what) { - 2023013101 -> { - if (isRefresh || isLoadMore) { - noticeListAdapter.notifyDataSetChanged() - } else { - if (dataBeans.size == 0) { - emptyView!!.showEmptyPage("没有任何消息") { - pageIndex = 1 - getNoticeListByPage() - } - } else { - emptyView!!.hide() - noticeListAdapter = NoticeListAdapter(this, dataBeans) - noticeRecyclerView.adapter = noticeListAdapter - noticeListAdapter.setOnItemClickListener(object : - NoticeListAdapter.OnItemClickListener { - override fun onItemClicked(position: Int) { - val rowsModel = dataBeans[position] - val allArgs = addAll( - rowsModel.noticeNo, - rowsModel.noticeTitle, - rowsModel.noticePublisher, - "", - "" - ) - Log.d( - "Casic", - "NoticeListActivity => onItemClicked: ${rowsModel.minioFileName.combineFilePath()}" - ) - navigatePageTo(allArgs) - } - }) - } - } - } - } - true - } - - //TODO 判断是否开启通知权限 - private fun hasNoticePermission(): Boolean { - - return false - } - - override fun initLayoutView(): Int = R.layout.activity_notice_list - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 3892b5a..02160cd 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -34,16 +34,18 @@ - - - - - - - + + + + + + + + + +) : RecyclerView.Adapter() { + + private var layoutInflater: LayoutInflater = LayoutInflater.from(context) + + override fun getItemCount(): Int = dataRows.size + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = ItemViewHolder( + layoutInflater.inflate(R.layout.item_equipment_rv_l, parent, false) + ) + + override fun onBindViewHolder(holder: ItemViewHolder, position: Int) { + //绑定数据 + val rowsBean = dataRows[position] + holder.equipmentNameView.text = rowsBean.equipmentName + holder.equipmentCodeView.text = rowsBean.equipmentNo + holder.equipmentDateView.text = rowsBean.enableDate + holder.equipmentLibView.text = rowsBean.useDeptName + + //绑定事件 + holder.itemView.setOnClickListener { + listener?.onItemClicked(position) + } + } + + inner class ItemViewHolder(view: View) : RecyclerView.ViewHolder(view) { + var equipmentNameView: TextView = view.findViewById(R.id.equipmentNameView) + var equipmentCodeView: TextView = view.findViewById(R.id.equipmentCodeView) + var equipmentDateView: TextView = view.findViewById(R.id.equipmentDateView) + var equipmentLibView: TextView = view.findViewById(R.id.equipmentLibView) + } + + private var listener: OnItemClickListener? = null + + interface OnItemClickListener { + fun onItemClicked(position: Int) + } + + fun setOnItemClickListener(onClickListener: OnItemClickListener?) { + this.listener = onClickListener + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt index b4628f3..d970b55 100644 --- a/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt +++ b/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt @@ -5,7 +5,8 @@ import com.casic.xz.meterage.R import com.casic.xz.meterage.adapter.HomeGridAdapter import com.casic.xz.meterage.utils.LocaleConstant -import com.casic.xz.meterage.view.NoticeListActivity +import com.casic.xz.meterage.view.home.EquipmentActivity +import com.casic.xz.meterage.view.notice.NoticeListActivity import com.casic.xz.meterage.vm.NoticeViewModel import com.pengxh.kt.lite.base.KotlinBaseFragment import com.pengxh.kt.lite.extensions.navigatePageTo @@ -36,8 +37,19 @@ homeFuncRecyclerView.adapter = homeAdapter homeAdapter.setOnGridItemClickListener(object : HomeGridAdapter.OnGridItemClickListener { override fun onItemClick(position: Int) { - when (position) { - + when (LocaleConstant.HOME_FUNC_OPERATE[position]) { + "仪器设备" -> requireContext().navigatePageTo() +// "标准装置" -> requireContext().navigatePageTo() +// "证书报告" -> requireContext().navigatePageTo() +// "委托需求" -> requireContext().navigatePageTo() +// "访客" -> requireContext().navigatePageTo() +// "标准规范" -> requireContext().navigatePageTo() +// "能力列表" -> requireContext().navigatePageTo() +// "计量培训" -> requireContext().navigatePageTo() +// "合同发票" -> requireContext().navigatePageTo() +// "业务统计" -> requireContext().navigatePageTo() +// "客户列表" -> requireContext().navigatePageTo() +// "外场检测" -> requireContext().navigatePageTo() } } }) diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt index 7e75abe..56dc5ec 100644 --- a/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt +++ b/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt @@ -2,9 +2,11 @@ import android.view.View import androidx.lifecycle.ViewModelProvider +import com.bumptech.glide.Glide +import com.bumptech.glide.request.RequestOptions import com.casic.xz.meterage.R import com.casic.xz.meterage.utils.LocaleConstant -import com.casic.xz.meterage.view.NoticeListActivity +import com.casic.xz.meterage.view.notice.NoticeListActivity import com.casic.xz.meterage.vm.NoticeViewModel import com.casic.xz.meterage.vm.UserViewModel import com.pengxh.kt.lite.base.KotlinBaseFragment @@ -23,6 +25,12 @@ val data = it.data userNameView.text = data.name userUnitView.text = data.deptName + +// Glide.with(requireContext()) +// .load(R.mipmap.default_avatar) +// .apply(RequestOptions.circleCropTransform()) +// .placeholder(R.mipmap.load_image_error) +// .into(userAvatarView) } }) diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt new file mode 100644 index 0000000..cf22646 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt @@ -0,0 +1,103 @@ +package com.casic.xz.meterage.fragment.equipment + +import android.graphics.Paint +import androidx.lifecycle.ViewModelProvider +import com.casic.xz.meterage.R +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.casic.xz.meterage.vm.EquipmentViewModel +import com.pengxh.kt.lite.base.KotlinBaseFragment +import com.pengxh.kt.lite.extensions.convertColor +import com.pengxh.kt.lite.vm.LoadState +import kotlinx.android.synthetic.main.fragment_basic_information.* + +class BasicInformationFragment(private val id: String) : KotlinBaseFragment() { + + private lateinit var equipmentViewModel: EquipmentViewModel + + override fun initData() { + equipmentViewModel = ViewModelProvider(this)[EquipmentViewModel::class.java] + equipmentViewModel.getEquipmentDetail(id) + equipmentViewModel.equipmentDetailResult.observe(this, { + if (it.code == 200) { + val data = it.data!! + + equipmentCodeView.text = data.equipmentNo + equipmentNameView.text = data.equipmentName + manufacturerView.text = data.manufacturer + factoryNumberView.text = data.manufacturingNo + modelView.text = data.modelNo + verificationMethodView.text = data.mesureTypeName + measuringRangeView.text = data.mesureRange + uncertaintyView.text = data.uncertainty + firstUseView.text = data.createTime + originalValueView.text = data.originValue + usageDeptView.text = data.useDeptName + userView.text = data.usePersonName + managementStatusView.text = data.managerStateName + verificationDeptView.text = data.useDeptName +// nextVerificationDeptView.text = data. + verificationPeriodView.text = data.mesureCycle + verificationDateView.text = data.mesureDate + effectiveDateView.text = data.validDate + verificationResultsView.text = data.mesureResultName + abcView.text = data.abcName + isNeedTechnicalView.text = if ( + data.isCalibrationTestEquipment.isNullOrBlank() || data.isCalibrationTestEquipment == "0" + ) { + "否" + } else { + "是" + } + + isStandingBook.text = if ( + data.isMeasureAccount.isNullOrBlank() || data.isMeasureAccount == "0" + ) { + "否" + } else { + "是" + } + + isStandardView.text = if ( + data.isStandardSupportEquipment.isNullOrBlank() || data.isStandardSupportEquipment == "0" + ) { + "否" + } else { + "是" + } + remarkView.text = data.remark + if (data.fileList.size == 0) { + instructionsView.text = "暂无" + } else { + instructionsView.text = "查看附件列表" + val textPaint = instructionsView.paint + textPaint.flags = Paint.UNDERLINE_TEXT_FLAG + textPaint.isAntiAlias = true + instructionsView.setTextColor(R.color.themeColor.convertColor(requireContext())) + + instructionsView.setOnClickListener { + + } + } + } + }) + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_basic_information + + override fun observeRequestState() { + equipmentViewModel.loadState.observe(this, { + when (it) { + LoadState.Loading -> LoadingDialogHub.show(requireActivity(), "数据加载中...") + else -> LoadingDialogHub.dismiss() + } + }) + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt new file mode 100644 index 0000000..0b4a747 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class CertificateFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_certificate + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt new file mode 100644 index 0000000..f05c491 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class ChangeRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_change_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt new file mode 100644 index 0000000..849ffa5 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class InspectionRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_inspection_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt new file mode 100644 index 0000000..aa4edd9 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class UsageRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_usage_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java b/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java new file mode 100644 index 0000000..0b9124e --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java @@ -0,0 +1,760 @@ +package com.casic.xz.meterage.model; + +import java.util.List; + +public class EquipmentDetailModel { + + private int code; + private DataModel data; + private String message; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataModel getData() { + return data; + } + + public void setData(DataModel data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public static class DataModel { + private String abc; + private String abcName; + private String assetNo; + private String assetSource; + private String assetType; + private String assetTypeName; + private String attribute; + private String capitalSource; + private String capitalSourceName; + private String cardEstablishmentDate; + private String createTime; + private String createUser; + private String depreciationMethod; + private String depreciationMethodName; + private String depreciationPeriod; + private String enableDate; + private String equipmentCategory; + private String equipmentCategoryName; + private String equipmentName; + private String equipmentNo; + private String equipmentSpecifications; + private String equipmentType; + private String equipmentTypeName; + private List fileList; + private String id; + private String installIncidentalExpenses; + private String installPlace; + private String intactState; + private String isCalibrationTestEquipment; + private int isDel; + private String isFixedAssets; + private String isMeasureAccount; + private String isStandardSupportEquipment; + private String labelBind; + private String majorCategory; + private String majorCategoryName; + private String managerLevel; + private String managerLevelName; + private String managerState; + private String managerStateName; + private String manufacturer; + private String manufacturerCountry; + private String manufacturingDate; + private String manufacturingNo; + private String mesureCycle; + private String mesureDate; + private String mesureDept; + private String mesureRange; + private String mesureResult; + private String mesureResultName; + private String mesureType; + private String mesureTypeName; + private String modelNo; + private String originValue; + private String overallDimension; + private String presentOriginValue; + private String purpose; + private String remark; + private String singlePrice; + private String supportStandardEquipmentName; + private String supportStandardEquipmentNo; + private String technicalLevel; + private String uncertainty; + private String updateTime; + private String useDept; + private String useDeptName; + private String usePerson; + private String usePersonName; + private String validDate; + private int version; + private String weight; + + public String getAbc() { + return abc; + } + + public void setAbc(String abc) { + this.abc = abc; + } + + public String getAbcName() { + return abcName; + } + + public void setAbcName(String abcName) { + this.abcName = abcName; + } + + public String getAssetNo() { + return assetNo; + } + + public void setAssetNo(String assetNo) { + this.assetNo = assetNo; + } + + public String getAssetSource() { + return assetSource; + } + + public void setAssetSource(String assetSource) { + this.assetSource = assetSource; + } + + public String getAssetType() { + return assetType; + } + + public void setAssetType(String assetType) { + this.assetType = assetType; + } + + public String getAssetTypeName() { + return assetTypeName; + } + + public void setAssetTypeName(String assetTypeName) { + this.assetTypeName = assetTypeName; + } + + public String getAttribute() { + return attribute; + } + + public void setAttribute(String attribute) { + this.attribute = attribute; + } + + public String getCapitalSource() { + return capitalSource; + } + + public void setCapitalSource(String capitalSource) { + this.capitalSource = capitalSource; + } + + public String getCapitalSourceName() { + return capitalSourceName; + } + + public void setCapitalSourceName(String capitalSourceName) { + this.capitalSourceName = capitalSourceName; + } + + public String getCardEstablishmentDate() { + return cardEstablishmentDate; + } + + public void setCardEstablishmentDate(String cardEstablishmentDate) { + this.cardEstablishmentDate = cardEstablishmentDate; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getDepreciationMethod() { + return depreciationMethod; + } + + public void setDepreciationMethod(String depreciationMethod) { + this.depreciationMethod = depreciationMethod; + } + + public String getDepreciationMethodName() { + return depreciationMethodName; + } + + public void setDepreciationMethodName(String depreciationMethodName) { + this.depreciationMethodName = depreciationMethodName; + } + + public String getDepreciationPeriod() { + return depreciationPeriod; + } + + public void setDepreciationPeriod(String depreciationPeriod) { + this.depreciationPeriod = depreciationPeriod; + } + + public String getEnableDate() { + return enableDate; + } + + public void setEnableDate(String enableDate) { + this.enableDate = enableDate; + } + + public String getEquipmentCategory() { + return equipmentCategory; + } + + public void setEquipmentCategory(String equipmentCategory) { + this.equipmentCategory = equipmentCategory; + } + + public String getEquipmentCategoryName() { + return equipmentCategoryName; + } + + public void setEquipmentCategoryName(String equipmentCategoryName) { + this.equipmentCategoryName = equipmentCategoryName; + } + + public String getEquipmentName() { + return equipmentName; + } + + public void setEquipmentName(String equipmentName) { + this.equipmentName = equipmentName; + } + + public String getEquipmentNo() { + return equipmentNo; + } + + public void setEquipmentNo(String equipmentNo) { + this.equipmentNo = equipmentNo; + } + + public String getEquipmentSpecifications() { + return equipmentSpecifications; + } + + public void setEquipmentSpecifications(String equipmentSpecifications) { + this.equipmentSpecifications = equipmentSpecifications; + } + + public String getEquipmentType() { + return equipmentType; + } + + public void setEquipmentType(String equipmentType) { + this.equipmentType = equipmentType; + } + + public String getEquipmentTypeName() { + return equipmentTypeName; + } + + public void setEquipmentTypeName(String equipmentTypeName) { + this.equipmentTypeName = equipmentTypeName; + } + + public List getFileList() { + return fileList; + } + + public void setFileList(List fileList) { + this.fileList = fileList; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getInstallIncidentalExpenses() { + return installIncidentalExpenses; + } + + public void setInstallIncidentalExpenses(String installIncidentalExpenses) { + this.installIncidentalExpenses = installIncidentalExpenses; + } + + public String getInstallPlace() { + return installPlace; + } + + public void setInstallPlace(String installPlace) { + this.installPlace = installPlace; + } + + public String getIntactState() { + return intactState; + } + + public void setIntactState(String intactState) { + this.intactState = intactState; + } + + public String getIsCalibrationTestEquipment() { + return isCalibrationTestEquipment; + } + + public void setIsCalibrationTestEquipment(String isCalibrationTestEquipment) { + this.isCalibrationTestEquipment = isCalibrationTestEquipment; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getIsFixedAssets() { + return isFixedAssets; + } + + public void setIsFixedAssets(String isFixedAssets) { + this.isFixedAssets = isFixedAssets; + } + + public String getIsMeasureAccount() { + return isMeasureAccount; + } + + public void setIsMeasureAccount(String isMeasureAccount) { + this.isMeasureAccount = isMeasureAccount; + } + + public String getIsStandardSupportEquipment() { + return isStandardSupportEquipment; + } + + public void setIsStandardSupportEquipment(String isStandardSupportEquipment) { + this.isStandardSupportEquipment = isStandardSupportEquipment; + } + + public String getLabelBind() { + return labelBind; + } + + public void setLabelBind(String labelBind) { + this.labelBind = labelBind; + } + + public String getMajorCategory() { + return majorCategory; + } + + public void setMajorCategory(String majorCategory) { + this.majorCategory = majorCategory; + } + + public String getMajorCategoryName() { + return majorCategoryName; + } + + public void setMajorCategoryName(String majorCategoryName) { + this.majorCategoryName = majorCategoryName; + } + + public String getManagerLevel() { + return managerLevel; + } + + public void setManagerLevel(String managerLevel) { + this.managerLevel = managerLevel; + } + + public String getManagerLevelName() { + return managerLevelName; + } + + public void setManagerLevelName(String managerLevelName) { + this.managerLevelName = managerLevelName; + } + + public String getManagerState() { + return managerState; + } + + public void setManagerState(String managerState) { + this.managerState = managerState; + } + + public String getManagerStateName() { + return managerStateName; + } + + public void setManagerStateName(String managerStateName) { + this.managerStateName = managerStateName; + } + + public String getManufacturer() { + return manufacturer; + } + + public void setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + } + + public String getManufacturerCountry() { + return manufacturerCountry; + } + + public void setManufacturerCountry(String manufacturerCountry) { + this.manufacturerCountry = manufacturerCountry; + } + + public String getManufacturingDate() { + return manufacturingDate; + } + + public void setManufacturingDate(String manufacturingDate) { + this.manufacturingDate = manufacturingDate; + } + + public String getManufacturingNo() { + return manufacturingNo; + } + + public void setManufacturingNo(String manufacturingNo) { + this.manufacturingNo = manufacturingNo; + } + + public String getMesureCycle() { + return mesureCycle; + } + + public void setMesureCycle(String mesureCycle) { + this.mesureCycle = mesureCycle; + } + + public String getMesureDate() { + return mesureDate; + } + + public void setMesureDate(String mesureDate) { + this.mesureDate = mesureDate; + } + + public String getMesureDept() { + return mesureDept; + } + + public void setMesureDept(String mesureDept) { + this.mesureDept = mesureDept; + } + + public String getMesureRange() { + return mesureRange; + } + + public void setMesureRange(String mesureRange) { + this.mesureRange = mesureRange; + } + + public String getMesureResult() { + return mesureResult; + } + + public void setMesureResult(String mesureResult) { + this.mesureResult = mesureResult; + } + + public String getMesureResultName() { + return mesureResultName; + } + + public void setMesureResultName(String mesureResultName) { + this.mesureResultName = mesureResultName; + } + + public String getMesureType() { + return mesureType; + } + + public void setMesureType(String mesureType) { + this.mesureType = mesureType; + } + + public String getMesureTypeName() { + return mesureTypeName; + } + + public void setMesureTypeName(String mesureTypeName) { + this.mesureTypeName = mesureTypeName; + } + + public String getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getOriginValue() { + return originValue; + } + + public void setOriginValue(String originValue) { + this.originValue = originValue; + } + + public String getOverallDimension() { + return overallDimension; + } + + public void setOverallDimension(String overallDimension) { + this.overallDimension = overallDimension; + } + + public String getPresentOriginValue() { + return presentOriginValue; + } + + public void setPresentOriginValue(String presentOriginValue) { + this.presentOriginValue = presentOriginValue; + } + + public String getPurpose() { + return purpose; + } + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getSinglePrice() { + return singlePrice; + } + + public void setSinglePrice(String singlePrice) { + this.singlePrice = singlePrice; + } + + public String getSupportStandardEquipmentName() { + return supportStandardEquipmentName; + } + + public void setSupportStandardEquipmentName(String supportStandardEquipmentName) { + this.supportStandardEquipmentName = supportStandardEquipmentName; + } + + public String getSupportStandardEquipmentNo() { + return supportStandardEquipmentNo; + } + + public void setSupportStandardEquipmentNo(String supportStandardEquipmentNo) { + this.supportStandardEquipmentNo = supportStandardEquipmentNo; + } + + public String getTechnicalLevel() { + return technicalLevel; + } + + public void setTechnicalLevel(String technicalLevel) { + this.technicalLevel = technicalLevel; + } + + public String getUncertainty() { + return uncertainty; + } + + public void setUncertainty(String uncertainty) { + this.uncertainty = uncertainty; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getUseDept() { + return useDept; + } + + public void setUseDept(String useDept) { + this.useDept = useDept; + } + + public String getUseDeptName() { + return useDeptName; + } + + public void setUseDeptName(String useDeptName) { + this.useDeptName = useDeptName; + } + + public String getUsePerson() { + return usePerson; + } + + public void setUsePerson(String usePerson) { + this.usePerson = usePerson; + } + + public String getUsePersonName() { + return usePersonName; + } + + public void setUsePersonName(String usePersonName) { + this.usePersonName = usePersonName; + } + + public String getValidDate() { + return validDate; + } + + public void setValidDate(String validDate) { + this.validDate = validDate; + } + + public int getVersion() { + return version; + } + + public void setVersion(int version) { + this.version = version; + } + + public String getWeight() { + return weight; + } + + public void setWeight(String weight) { + this.weight = weight; + } + + public static class FileListModel { + private String assetId; + private String createTime; + private String createUser; + private String fileName; + private String id; + private int isDel; + private String minioFileName; + private String remark; + private String updateTime; + + public String getAssetId() { + return assetId; + } + + public void setAssetId(String assetId) { + this.assetId = assetId; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getFileName() { + return fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getMinioFileName() { + return minioFileName; + } + + public void setMinioFileName(String minioFileName) { + this.minioFileName = minioFileName; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + } + } +} diff --git a/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java b/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java new file mode 100644 index 0000000..15fc128 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java @@ -0,0 +1,697 @@ +package com.casic.xz.meterage.model; + +import java.util.List; + +public class EquipmentListModel { + + private int code; + private DataModel data; + private String message; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataModel getData() { + return data; + } + + public void setData(DataModel data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public static class DataModel { + private List rows; + private int total; + + public List getRows() { + return rows; + } + + public void setRows(List rows) { + this.rows = rows; + } + + public int getTotal() { + return total; + } + + public void setTotal(int total) { + this.total = total; + } + + public static class RowsModel { + private String abc; + private String abcName; + private String assetNo; + private String assetSource; + private String assetType; + private String assetTypeName; + private String attribute; + private String capitalSource; + private String capitalSourceName; + private String cardEstablishmentDate; + private String createTime; + private String createUser; + private String depreciationMethod; + private String depreciationMethodName; + private String depreciationPeriod; + private String enableDate; + private String equipmentCategory; + private String equipmentCategoryName; + private String equipmentName; + private String equipmentNo; + private String equipmentSpecifications; + private String equipmentType; + private String equipmentTypeName; + private String fileList; + private String id; + private String installIncidentalExpenses; + private String installPlace; + private String intactState; + private String isCalibrationTestEquipment; + private int isDel; + private String isFixedAssets; + private String isMeasureAccount; + private String isStandardSupportEquipment; + private String labelBind; + private String majorCategory; + private String majorCategoryName; + private String managerLevel; + private String managerLevelName; + private String managerState; + private String managerStateName; + private String manufacturer; + private String manufacturerCountry; + private String manufacturingDate; + private String manufacturingNo; + private String mesureCycle; + private String mesureDate; + private String mesureDept; + private String mesureRange; + private String mesureResult; + private String mesureResultName; + private String mesureType; + private String mesureTypeName; + private String modelNo; + private String originValue; + private String overallDimension; + private String presentOriginValue; + private String purpose; + private String remark; + private String singlePrice; + private String supportStandardEquipmentName; + private String supportStandardEquipmentNo; + private String technicalLevel; + private String uncertainty; + private String updateTime; + private String useDept; + private String useDeptName; + private String usePerson; + private String usePersonName; + private String validDate; + private int version; + private String weight; + + public String getAbc() { + return abc; + } + + public void setAbc(String abc) { + this.abc = abc; + } + + public String getAbcName() { + return abcName; + } + + public void setAbcName(String abcName) { + this.abcName = abcName; + } + + public String getAssetNo() { + return assetNo; + } + + public void setAssetNo(String assetNo) { + this.assetNo = assetNo; + } + + public String getAssetSource() { + return assetSource; + } + + public void setAssetSource(String assetSource) { + this.assetSource = assetSource; + } + + public String getAssetType() { + return assetType; + } + + public void setAssetType(String assetType) { + this.assetType = assetType; + } + + public String getAssetTypeName() { + return assetTypeName; + } + + public void setAssetTypeName(String assetTypeName) { + this.assetTypeName = assetTypeName; + } + + public String getAttribute() { + return attribute; + } + + public void setAttribute(String attribute) { + this.attribute = attribute; + } + + public String getCapitalSource() { + return capitalSource; + } + + public void setCapitalSource(String capitalSource) { + this.capitalSource = capitalSource; + } + + public String getCapitalSourceName() { + return capitalSourceName; + } + + public void setCapitalSourceName(String capitalSourceName) { + this.capitalSourceName = capitalSourceName; + } + + public String getCardEstablishmentDate() { + return cardEstablishmentDate; + } + + public void setCardEstablishmentDate(String cardEstablishmentDate) { + this.cardEstablishmentDate = cardEstablishmentDate; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getDepreciationMethod() { + return depreciationMethod; + } + + public void setDepreciationMethod(String depreciationMethod) { + this.depreciationMethod = depreciationMethod; + } + + public String getDepreciationMethodName() { + return depreciationMethodName; + } + + public void setDepreciationMethodName(String depreciationMethodName) { + this.depreciationMethodName = depreciationMethodName; + } + + public String getDepreciationPeriod() { + return depreciationPeriod; + } + + public void setDepreciationPeriod(String depreciationPeriod) { + this.depreciationPeriod = depreciationPeriod; + } + + public String getEnableDate() { + return enableDate; + } + + public void setEnableDate(String enableDate) { + this.enableDate = enableDate; + } + + public String getEquipmentCategory() { + return equipmentCategory; + } + + public void setEquipmentCategory(String equipmentCategory) { + this.equipmentCategory = equipmentCategory; + } + + public String getEquipmentCategoryName() { + return equipmentCategoryName; + } + + public void setEquipmentCategoryName(String equipmentCategoryName) { + this.equipmentCategoryName = equipmentCategoryName; + } + + public String getEquipmentName() { + return equipmentName; + } + + public void setEquipmentName(String equipmentName) { + this.equipmentName = equipmentName; + } + + public String getEquipmentNo() { + return equipmentNo; + } + + public void setEquipmentNo(String equipmentNo) { + this.equipmentNo = equipmentNo; + } + + public String getEquipmentSpecifications() { + return equipmentSpecifications; + } + + public void setEquipmentSpecifications(String equipmentSpecifications) { + this.equipmentSpecifications = equipmentSpecifications; + } + + public String getEquipmentType() { + return equipmentType; + } + + public void setEquipmentType(String equipmentType) { + this.equipmentType = equipmentType; + } + + public String getEquipmentTypeName() { + return equipmentTypeName; + } + + public void setEquipmentTypeName(String equipmentTypeName) { + this.equipmentTypeName = equipmentTypeName; + } + + public String getFileList() { + return fileList; + } + + public void setFileList(String fileList) { + this.fileList = fileList; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getInstallIncidentalExpenses() { + return installIncidentalExpenses; + } + + public void setInstallIncidentalExpenses(String installIncidentalExpenses) { + this.installIncidentalExpenses = installIncidentalExpenses; + } + + public String getInstallPlace() { + return installPlace; + } + + public void setInstallPlace(String installPlace) { + this.installPlace = installPlace; + } + + public String getIntactState() { + return intactState; + } + + public void setIntactState(String intactState) { + this.intactState = intactState; + } + + public String getIsCalibrationTestEquipment() { + return isCalibrationTestEquipment; + } + + public void setIsCalibrationTestEquipment(String isCalibrationTestEquipment) { + this.isCalibrationTestEquipment = isCalibrationTestEquipment; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getIsFixedAssets() { + return isFixedAssets; + } + + public void setIsFixedAssets(String isFixedAssets) { + this.isFixedAssets = isFixedAssets; + } + + public String getIsMeasureAccount() { + return isMeasureAccount; + } + + public void setIsMeasureAccount(String isMeasureAccount) { + this.isMeasureAccount = isMeasureAccount; + } + + public String getIsStandardSupportEquipment() { + return isStandardSupportEquipment; + } + + public void setIsStandardSupportEquipment(String isStandardSupportEquipment) { + this.isStandardSupportEquipment = isStandardSupportEquipment; + } + + public String getLabelBind() { + return labelBind; + } + + public void setLabelBind(String labelBind) { + this.labelBind = labelBind; + } + + public String getMajorCategory() { + return majorCategory; + } + + public void setMajorCategory(String majorCategory) { + this.majorCategory = majorCategory; + } + + public String getMajorCategoryName() { + return majorCategoryName; + } + + public void setMajorCategoryName(String majorCategoryName) { + this.majorCategoryName = majorCategoryName; + } + + public String getManagerLevel() { + return managerLevel; + } + + public void setManagerLevel(String managerLevel) { + this.managerLevel = managerLevel; + } + + public String getManagerLevelName() { + return managerLevelName; + } + + public void setManagerLevelName(String managerLevelName) { + this.managerLevelName = managerLevelName; + } + + public String getManagerState() { + return managerState; + } + + public void setManagerState(String managerState) { + this.managerState = managerState; + } + + public String getManagerStateName() { + return managerStateName; + } + + public void setManagerStateName(String managerStateName) { + this.managerStateName = managerStateName; + } + + public String getManufacturer() { + return manufacturer; + } + + public void setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + } + + public String getManufacturerCountry() { + return manufacturerCountry; + } + + public void setManufacturerCountry(String manufacturerCountry) { + this.manufacturerCountry = manufacturerCountry; + } + + public String getManufacturingDate() { + return manufacturingDate; + } + + public void setManufacturingDate(String manufacturingDate) { + this.manufacturingDate = manufacturingDate; + } + + public String getManufacturingNo() { + return manufacturingNo; + } + + public void setManufacturingNo(String manufacturingNo) { + this.manufacturingNo = manufacturingNo; + } + + public String getMesureCycle() { + return mesureCycle; + } + + public void setMesureCycle(String mesureCycle) { + this.mesureCycle = mesureCycle; + } + + public String getMesureDate() { + return mesureDate; + } + + public void setMesureDate(String mesureDate) { + this.mesureDate = mesureDate; + } + + public String getMesureDept() { + return mesureDept; + } + + public void setMesureDept(String mesureDept) { + this.mesureDept = mesureDept; + } + + public String getMesureRange() { + return mesureRange; + } + + public void setMesureRange(String mesureRange) { + this.mesureRange = mesureRange; + } + + public String getMesureResult() { + return mesureResult; + } + + public void setMesureResult(String mesureResult) { + this.mesureResult = mesureResult; + } + + public String getMesureResultName() { + return mesureResultName; + } + + public void setMesureResultName(String mesureResultName) { + this.mesureResultName = mesureResultName; + } + + public String getMesureType() { + return mesureType; + } + + public void setMesureType(String mesureType) { + this.mesureType = mesureType; + } + + public String getMesureTypeName() { + return mesureTypeName; + } + + public void setMesureTypeName(String mesureTypeName) { + this.mesureTypeName = mesureTypeName; + } + + public String getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getOriginValue() { + return originValue; + } + + public void setOriginValue(String originValue) { + this.originValue = originValue; + } + + public String getOverallDimension() { + return overallDimension; + } + + public void setOverallDimension(String overallDimension) { + this.overallDimension = overallDimension; + } + + public String getPresentOriginValue() { + return presentOriginValue; + } + + public void setPresentOriginValue(String presentOriginValue) { + this.presentOriginValue = presentOriginValue; + } + + public String getPurpose() { + return purpose; + } + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getSinglePrice() { + return singlePrice; + } + + public void setSinglePrice(String singlePrice) { + this.singlePrice = singlePrice; + } + + public String getSupportStandardEquipmentName() { + return supportStandardEquipmentName; + } + + public void setSupportStandardEquipmentName(String supportStandardEquipmentName) { + this.supportStandardEquipmentName = supportStandardEquipmentName; + } + + public String getSupportStandardEquipmentNo() { + return supportStandardEquipmentNo; + } + + public void setSupportStandardEquipmentNo(String supportStandardEquipmentNo) { + this.supportStandardEquipmentNo = supportStandardEquipmentNo; + } + + public String getTechnicalLevel() { + return technicalLevel; + } + + public void setTechnicalLevel(String technicalLevel) { + this.technicalLevel = technicalLevel; + } + + public String getUncertainty() { + return uncertainty; + } + + public void setUncertainty(String uncertainty) { + this.uncertainty = uncertainty; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getUseDept() { + return useDept; + } + + public void setUseDept(String useDept) { + this.useDept = useDept; + } + + public String getUseDeptName() { + return useDeptName; + } + + public void setUseDeptName(String useDeptName) { + this.useDeptName = useDeptName; + } + + public String getUsePerson() { + return usePerson; + } + + public void setUsePerson(String usePerson) { + this.usePerson = usePerson; + } + + public String getUsePersonName() { + return usePersonName; + } + + public void setUsePersonName(String usePersonName) { + this.usePersonName = usePersonName; + } + + public String getValidDate() { + return validDate; + } + + public void setValidDate(String validDate) { + this.validDate = validDate; + } + + public int getVersion() { + return version; + } + + public void setVersion(int version) { + this.version = version; + } + + public String getWeight() { + return weight; + } + + public void setWeight(String weight) { + this.weight = weight; + } + } + } +} diff --git a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt index a3f514f..46e5eef 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt @@ -35,4 +35,24 @@ @QueryMap limit: Map, @QueryMap offset: Map ): String + + /** + * 获取设备列表 + */ + @POST("/meter/assets/listPage") + suspend fun getEquipmentList( + @Header("token") token: String, + @Body requestBody: RequestBody, + @QueryMap limit: Map, + @QueryMap offset: Map + ): String + + /** + * 获取设备详情 + */ + @POST("/meter/assets/detail") + suspend fun getEquipmentDetail( + @Header("token") token: String, + @Body requestBody: RequestBody + ): String } \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt index 444a872..386a1d8 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt @@ -6,8 +6,10 @@ import com.pengxh.kt.lite.utils.SaveKeyValues import okhttp3.MediaType.Companion.toMediaType import okhttp3.RequestBody.Companion.toRequestBody +import org.json.JSONArray import org.json.JSONObject + object RetrofitServiceManager { private val api by lazy { @@ -73,4 +75,71 @@ offsetMap["offset"] = offset return api.getNoticeList(AuthenticationHelper.token!!, requestBody, limitMap, offsetMap) } + + /** + * 获取设备列表 + */ + suspend fun getEquipmentList( + equipmentNo: String, + equipmentName: String, + mesureType: String, + managerState: String, + useDept: String, + assetType: String, + equipmentCategory: String, + isCalibrationTestEquipment: String, + isMeasureAccount: String, + isStandardSupportEquipment: String, + isFixedAssets: String, + validStartDate: String, + validEndDate: String, + abc: String, + ids: Array, + offset: Int + ): String { + val paramObject = JSONObject() + paramObject.put("equipmentNo", equipmentNo) + paramObject.put("equipmentName", equipmentName) + paramObject.put("mesureType", mesureType) + paramObject.put("managerState", managerState) + paramObject.put("useDept", useDept) + paramObject.put("assetType", assetType) + paramObject.put("equipmentCategory", equipmentCategory) + paramObject.put("isCalibrationTestEquipment", isCalibrationTestEquipment) + paramObject.put("isMeasureAccount", isMeasureAccount) + paramObject.put("isStandardSupportEquipment", isStandardSupportEquipment) + paramObject.put("isFixedAssets", isFixedAssets) + paramObject.put("validStartDate", validStartDate) + paramObject.put("validEndDate", validEndDate) + paramObject.put("abc", abc) + + val jsonArray = JSONArray() + ids.forEach { + jsonArray.put(it) + } + paramObject.put("ids", jsonArray) + + val requestBody = paramObject.toString().toRequestBody( + "application/json;charset=UTF-8".toMediaType() + ) + + val limitMap = HashMap() + limitMap["limit"] = LocaleConstant.PAGE_LIMIT + + val offsetMap = HashMap() + offsetMap["offset"] = offset + return api.getEquipmentList(AuthenticationHelper.token!!, requestBody, limitMap, offsetMap) + } + + /** + * 获取设备详情 + */ + suspend fun getEquipmentDetail(id: String): String { + val paramObject = JSONObject() + paramObject.put("id", id) + val requestBody = paramObject.toString().toRequestBody( + "application/json;charset=UTF-8".toMediaType() + ) + return api.getEquipmentDetail(AuthenticationHelper.token!!, requestBody) + } } \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt deleted file mode 100644 index a5bb60b..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt +++ /dev/null @@ -1,104 +0,0 @@ -package com.casic.xz.meterage.view - -import android.annotation.SuppressLint -import android.graphics.Paint -import androidx.lifecycle.ViewModelProvider -import com.casic.xz.meterage.R -import com.casic.xz.meterage.extensions.combineImagePath -import com.casic.xz.meterage.extensions.formatTextFromHtml -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.vm.NoticeViewModel -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.extensions.convertColor -import com.pengxh.kt.lite.extensions.navigatePageTo -import com.pengxh.kt.lite.extensions.obtainScreenWidth -import com.pengxh.kt.lite.extensions.show -import com.pengxh.kt.lite.utils.Constant -import kotlinx.android.synthetic.main.activity_notice_detail.* -import kotlinx.android.synthetic.main.include_base_title.* -import java.util.* - -@SuppressLint("SetTextI18n") -class NoticeDetailActivity : KotlinBaseActivity() { - - private lateinit var noticeViewModel: NoticeViewModel - - override fun initData() { - leftBackView.setOnClickListener { finish() } - titleView.text = "通知公告" - - val args = intent.getStringArrayListExtra(Constant.INTENT_PARAM)!! - - noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] - noticeViewModel.getNoticeList(args[0], args[1], args[2], "", "", 1) - noticeViewModel.noticeResult.observe(this, { - if (it.code == 200) { - val dataRow = it.data?.rows!![0] - - noticeDateView.text = dataRow.noticeTime - noticePublisherView.text = "发布人 ${dataRow.noticePublisher}" - noticeCompanyView.text = "发布单位 ${dataRow.noticeCompany}" - - noticeNoView.text = dataRow.noticeNo - noticeTitleView.text = dataRow.noticeTitle - noticeSketchView.text = dataRow.noticeSketch - - dataRow.noticeContent.formatTextFromHtml( - this, noticeContentView, obtainScreenWidth() - ) - - if (dataRow.minioFileName.isNullOrBlank()) { - minioFileView.text = "暂无附件" - } else { - val minioFileName = dataRow.minioFileName - - minioFileView.text = minioFileName - val textPaint = minioFileView.paint - textPaint.flags = Paint.UNDERLINE_TEXT_FLAG - textPaint.isAntiAlias = true - minioFileView.setTextColor(R.color.themeColor.convertColor(this)) - - minioFileView.setOnClickListener { - //查看附件 - if (minioFileName.endsWith("pdf")) { - navigatePageTo(minioFileName) - } else if ( - minioFileName.endsWith("doc") || - minioFileName.endsWith("docx") - ) { - navigatePageTo(minioFileName) - } else if (minioFileName.endsWith("txt")) { - navigatePageTo(minioFileName) - } else if ( - minioFileName.endsWith("png") || - minioFileName.endsWith("jpeg") || - minioFileName.endsWith("jpg") - ) { - val urls = ArrayList() - urls.add(minioFileName.combineImagePath()) - navigatePageTo(0, urls) - } else { - "文件类型未知,无法打开附件".show(this) - } - } - } - } - }) - } - - override fun initEvent() { - - } - - override fun initLayoutView(): Int = R.layout.activity_notice_detail - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/NoticeListActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/NoticeListActivity.kt deleted file mode 100644 index 15f6a16..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/NoticeListActivity.kt +++ /dev/null @@ -1,180 +0,0 @@ -package com.casic.xz.meterage.view - -import android.os.Handler -import android.util.Log -import android.view.View -import androidx.lifecycle.ViewModelProvider -import com.casic.xz.meterage.R -import com.casic.xz.meterage.adapter.NoticeListAdapter -import com.casic.xz.meterage.extensions.addAll -import com.casic.xz.meterage.extensions.combineFilePath -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.extensions.showEmptyPage -import com.casic.xz.meterage.model.NoticeListModel -import com.casic.xz.meterage.vm.NoticeViewModel -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.extensions.navigatePageTo -import com.pengxh.kt.lite.extensions.show -import com.pengxh.kt.lite.utils.WeakReferenceHandler -import com.pengxh.kt.lite.widget.dialog.AlertControlDialog -import kotlinx.android.synthetic.main.activity_notice_list.* -import kotlinx.android.synthetic.main.include_empty_view.* - -class NoticeListActivity : KotlinBaseActivity() { - - private lateinit var weakReferenceHandler: WeakReferenceHandler - private lateinit var noticeViewModel: NoticeViewModel - private lateinit var noticeListAdapter: NoticeListAdapter - private var dataBeans: MutableList = ArrayList() - private var pageIndex = 1 - private var isRefresh = false - private var isLoadMore = false - - override fun initData() { - weakReferenceHandler = WeakReferenceHandler(callback) - noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] - noticeViewModel.noticeResult.observe(this, { - if (it.code == 200) { - val dataRows = it.data?.rows!! -// countBadeNumber(dataRows) - when { - isRefresh -> { - dataBeans.clear() - dataBeans = dataRows - noticeLayout.finishRefresh() - isRefresh = false - } - isLoadMore -> { - if (dataRows.size == 0) { - "到底了,别拉了".show(this) - } - dataBeans.addAll(dataRows) - noticeLayout.finishLoadMore() - isLoadMore = false - } - else -> { - dataBeans = dataRows - } - } - weakReferenceHandler.sendEmptyMessage(2023013101) - } - }) - } - - override fun initEvent() { - leftBackView.setOnClickListener { finish() } - rightOperateView.setOnClickListener { - AlertControlDialog.Builder() - .setContext(this) - .setTitle("提示") - .setMessage("确定将所有未读消息标为已读?") - .setNegativeButton("取消") - .setPositiveButton("确定") - .setOnDialogButtonClickListener(object : - AlertControlDialog.OnDialogButtonClickListener { - override fun onCancelClick() { - - } - - override fun onConfirmClick() { - //TODO 设置为已读 - } - }).build().show() - } - - if (hasNoticePermission()) { - openSystemNoticeLayout.visibility = View.GONE - openSystemNoticeLayout.visibility = View.GONE - } else { - openSystemNoticeLayout.setOnClickListener { - - } - - - closeLayoutView.setOnClickListener { - openSystemNoticeLayout.visibility = View.GONE - } - } - - noticeLayout.setOnRefreshListener { - isRefresh = true - //刷新之后页码重置 - pageIndex = 1 - getNoticeListByPage() - } - - noticeLayout.setOnLoadMoreListener { - isLoadMore = true - pageIndex++ - getNoticeListByPage() - } - } - - override fun onResume() { - super.onResume() - pageIndex = 1 - getNoticeListByPage() - } - - private fun getNoticeListByPage() { - noticeViewModel.getNoticeList("", "", "", "", "", pageIndex) - } - - private val callback = Handler.Callback { - when (it.what) { - 2023013101 -> { - if (isRefresh || isLoadMore) { - noticeListAdapter.notifyDataSetChanged() - } else { - if (dataBeans.size == 0) { - emptyView!!.showEmptyPage("没有任何消息") { - pageIndex = 1 - getNoticeListByPage() - } - } else { - emptyView!!.hide() - noticeListAdapter = NoticeListAdapter(this, dataBeans) - noticeRecyclerView.adapter = noticeListAdapter - noticeListAdapter.setOnItemClickListener(object : - NoticeListAdapter.OnItemClickListener { - override fun onItemClicked(position: Int) { - val rowsModel = dataBeans[position] - val allArgs = addAll( - rowsModel.noticeNo, - rowsModel.noticeTitle, - rowsModel.noticePublisher, - "", - "" - ) - Log.d( - "Casic", - "NoticeListActivity => onItemClicked: ${rowsModel.minioFileName.combineFilePath()}" - ) - navigatePageTo(allArgs) - } - }) - } - } - } - } - true - } - - //TODO 判断是否开启通知权限 - private fun hasNoticePermission(): Boolean { - - return false - } - - override fun initLayoutView(): Int = R.layout.activity_notice_list - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/PreviewDocumentActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/PreviewDocumentActivity.kt deleted file mode 100644 index e233ddc..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/PreviewDocumentActivity.kt +++ /dev/null @@ -1,24 +0,0 @@ -package com.casic.xz.meterage.view - -import com.casic.xz.meterage.R -import com.pengxh.kt.lite.base.KotlinBaseActivity - -class PreviewDocumentActivity : KotlinBaseActivity() { - override fun initData() { - - } - - override fun initEvent() { - - } - - override fun initLayoutView(): Int = R.layout.activity_preview_doc - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - - } -} \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 3892b5a..02160cd 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -34,16 +34,18 @@ - - - - - - - + + + + + + + + + +) : RecyclerView.Adapter() { + + private var layoutInflater: LayoutInflater = LayoutInflater.from(context) + + override fun getItemCount(): Int = dataRows.size + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = ItemViewHolder( + layoutInflater.inflate(R.layout.item_equipment_rv_l, parent, false) + ) + + override fun onBindViewHolder(holder: ItemViewHolder, position: Int) { + //绑定数据 + val rowsBean = dataRows[position] + holder.equipmentNameView.text = rowsBean.equipmentName + holder.equipmentCodeView.text = rowsBean.equipmentNo + holder.equipmentDateView.text = rowsBean.enableDate + holder.equipmentLibView.text = rowsBean.useDeptName + + //绑定事件 + holder.itemView.setOnClickListener { + listener?.onItemClicked(position) + } + } + + inner class ItemViewHolder(view: View) : RecyclerView.ViewHolder(view) { + var equipmentNameView: TextView = view.findViewById(R.id.equipmentNameView) + var equipmentCodeView: TextView = view.findViewById(R.id.equipmentCodeView) + var equipmentDateView: TextView = view.findViewById(R.id.equipmentDateView) + var equipmentLibView: TextView = view.findViewById(R.id.equipmentLibView) + } + + private var listener: OnItemClickListener? = null + + interface OnItemClickListener { + fun onItemClicked(position: Int) + } + + fun setOnItemClickListener(onClickListener: OnItemClickListener?) { + this.listener = onClickListener + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt index b4628f3..d970b55 100644 --- a/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt +++ b/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt @@ -5,7 +5,8 @@ import com.casic.xz.meterage.R import com.casic.xz.meterage.adapter.HomeGridAdapter import com.casic.xz.meterage.utils.LocaleConstant -import com.casic.xz.meterage.view.NoticeListActivity +import com.casic.xz.meterage.view.home.EquipmentActivity +import com.casic.xz.meterage.view.notice.NoticeListActivity import com.casic.xz.meterage.vm.NoticeViewModel import com.pengxh.kt.lite.base.KotlinBaseFragment import com.pengxh.kt.lite.extensions.navigatePageTo @@ -36,8 +37,19 @@ homeFuncRecyclerView.adapter = homeAdapter homeAdapter.setOnGridItemClickListener(object : HomeGridAdapter.OnGridItemClickListener { override fun onItemClick(position: Int) { - when (position) { - + when (LocaleConstant.HOME_FUNC_OPERATE[position]) { + "仪器设备" -> requireContext().navigatePageTo() +// "标准装置" -> requireContext().navigatePageTo() +// "证书报告" -> requireContext().navigatePageTo() +// "委托需求" -> requireContext().navigatePageTo() +// "访客" -> requireContext().navigatePageTo() +// "标准规范" -> requireContext().navigatePageTo() +// "能力列表" -> requireContext().navigatePageTo() +// "计量培训" -> requireContext().navigatePageTo() +// "合同发票" -> requireContext().navigatePageTo() +// "业务统计" -> requireContext().navigatePageTo() +// "客户列表" -> requireContext().navigatePageTo() +// "外场检测" -> requireContext().navigatePageTo() } } }) diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt index 7e75abe..56dc5ec 100644 --- a/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt +++ b/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt @@ -2,9 +2,11 @@ import android.view.View import androidx.lifecycle.ViewModelProvider +import com.bumptech.glide.Glide +import com.bumptech.glide.request.RequestOptions import com.casic.xz.meterage.R import com.casic.xz.meterage.utils.LocaleConstant -import com.casic.xz.meterage.view.NoticeListActivity +import com.casic.xz.meterage.view.notice.NoticeListActivity import com.casic.xz.meterage.vm.NoticeViewModel import com.casic.xz.meterage.vm.UserViewModel import com.pengxh.kt.lite.base.KotlinBaseFragment @@ -23,6 +25,12 @@ val data = it.data userNameView.text = data.name userUnitView.text = data.deptName + +// Glide.with(requireContext()) +// .load(R.mipmap.default_avatar) +// .apply(RequestOptions.circleCropTransform()) +// .placeholder(R.mipmap.load_image_error) +// .into(userAvatarView) } }) diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt new file mode 100644 index 0000000..cf22646 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt @@ -0,0 +1,103 @@ +package com.casic.xz.meterage.fragment.equipment + +import android.graphics.Paint +import androidx.lifecycle.ViewModelProvider +import com.casic.xz.meterage.R +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.casic.xz.meterage.vm.EquipmentViewModel +import com.pengxh.kt.lite.base.KotlinBaseFragment +import com.pengxh.kt.lite.extensions.convertColor +import com.pengxh.kt.lite.vm.LoadState +import kotlinx.android.synthetic.main.fragment_basic_information.* + +class BasicInformationFragment(private val id: String) : KotlinBaseFragment() { + + private lateinit var equipmentViewModel: EquipmentViewModel + + override fun initData() { + equipmentViewModel = ViewModelProvider(this)[EquipmentViewModel::class.java] + equipmentViewModel.getEquipmentDetail(id) + equipmentViewModel.equipmentDetailResult.observe(this, { + if (it.code == 200) { + val data = it.data!! + + equipmentCodeView.text = data.equipmentNo + equipmentNameView.text = data.equipmentName + manufacturerView.text = data.manufacturer + factoryNumberView.text = data.manufacturingNo + modelView.text = data.modelNo + verificationMethodView.text = data.mesureTypeName + measuringRangeView.text = data.mesureRange + uncertaintyView.text = data.uncertainty + firstUseView.text = data.createTime + originalValueView.text = data.originValue + usageDeptView.text = data.useDeptName + userView.text = data.usePersonName + managementStatusView.text = data.managerStateName + verificationDeptView.text = data.useDeptName +// nextVerificationDeptView.text = data. + verificationPeriodView.text = data.mesureCycle + verificationDateView.text = data.mesureDate + effectiveDateView.text = data.validDate + verificationResultsView.text = data.mesureResultName + abcView.text = data.abcName + isNeedTechnicalView.text = if ( + data.isCalibrationTestEquipment.isNullOrBlank() || data.isCalibrationTestEquipment == "0" + ) { + "否" + } else { + "是" + } + + isStandingBook.text = if ( + data.isMeasureAccount.isNullOrBlank() || data.isMeasureAccount == "0" + ) { + "否" + } else { + "是" + } + + isStandardView.text = if ( + data.isStandardSupportEquipment.isNullOrBlank() || data.isStandardSupportEquipment == "0" + ) { + "否" + } else { + "是" + } + remarkView.text = data.remark + if (data.fileList.size == 0) { + instructionsView.text = "暂无" + } else { + instructionsView.text = "查看附件列表" + val textPaint = instructionsView.paint + textPaint.flags = Paint.UNDERLINE_TEXT_FLAG + textPaint.isAntiAlias = true + instructionsView.setTextColor(R.color.themeColor.convertColor(requireContext())) + + instructionsView.setOnClickListener { + + } + } + } + }) + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_basic_information + + override fun observeRequestState() { + equipmentViewModel.loadState.observe(this, { + when (it) { + LoadState.Loading -> LoadingDialogHub.show(requireActivity(), "数据加载中...") + else -> LoadingDialogHub.dismiss() + } + }) + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt new file mode 100644 index 0000000..0b4a747 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class CertificateFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_certificate + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt new file mode 100644 index 0000000..f05c491 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class ChangeRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_change_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt new file mode 100644 index 0000000..849ffa5 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class InspectionRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_inspection_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt new file mode 100644 index 0000000..aa4edd9 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class UsageRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_usage_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java b/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java new file mode 100644 index 0000000..0b9124e --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java @@ -0,0 +1,760 @@ +package com.casic.xz.meterage.model; + +import java.util.List; + +public class EquipmentDetailModel { + + private int code; + private DataModel data; + private String message; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataModel getData() { + return data; + } + + public void setData(DataModel data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public static class DataModel { + private String abc; + private String abcName; + private String assetNo; + private String assetSource; + private String assetType; + private String assetTypeName; + private String attribute; + private String capitalSource; + private String capitalSourceName; + private String cardEstablishmentDate; + private String createTime; + private String createUser; + private String depreciationMethod; + private String depreciationMethodName; + private String depreciationPeriod; + private String enableDate; + private String equipmentCategory; + private String equipmentCategoryName; + private String equipmentName; + private String equipmentNo; + private String equipmentSpecifications; + private String equipmentType; + private String equipmentTypeName; + private List fileList; + private String id; + private String installIncidentalExpenses; + private String installPlace; + private String intactState; + private String isCalibrationTestEquipment; + private int isDel; + private String isFixedAssets; + private String isMeasureAccount; + private String isStandardSupportEquipment; + private String labelBind; + private String majorCategory; + private String majorCategoryName; + private String managerLevel; + private String managerLevelName; + private String managerState; + private String managerStateName; + private String manufacturer; + private String manufacturerCountry; + private String manufacturingDate; + private String manufacturingNo; + private String mesureCycle; + private String mesureDate; + private String mesureDept; + private String mesureRange; + private String mesureResult; + private String mesureResultName; + private String mesureType; + private String mesureTypeName; + private String modelNo; + private String originValue; + private String overallDimension; + private String presentOriginValue; + private String purpose; + private String remark; + private String singlePrice; + private String supportStandardEquipmentName; + private String supportStandardEquipmentNo; + private String technicalLevel; + private String uncertainty; + private String updateTime; + private String useDept; + private String useDeptName; + private String usePerson; + private String usePersonName; + private String validDate; + private int version; + private String weight; + + public String getAbc() { + return abc; + } + + public void setAbc(String abc) { + this.abc = abc; + } + + public String getAbcName() { + return abcName; + } + + public void setAbcName(String abcName) { + this.abcName = abcName; + } + + public String getAssetNo() { + return assetNo; + } + + public void setAssetNo(String assetNo) { + this.assetNo = assetNo; + } + + public String getAssetSource() { + return assetSource; + } + + public void setAssetSource(String assetSource) { + this.assetSource = assetSource; + } + + public String getAssetType() { + return assetType; + } + + public void setAssetType(String assetType) { + this.assetType = assetType; + } + + public String getAssetTypeName() { + return assetTypeName; + } + + public void setAssetTypeName(String assetTypeName) { + this.assetTypeName = assetTypeName; + } + + public String getAttribute() { + return attribute; + } + + public void setAttribute(String attribute) { + this.attribute = attribute; + } + + public String getCapitalSource() { + return capitalSource; + } + + public void setCapitalSource(String capitalSource) { + this.capitalSource = capitalSource; + } + + public String getCapitalSourceName() { + return capitalSourceName; + } + + public void setCapitalSourceName(String capitalSourceName) { + this.capitalSourceName = capitalSourceName; + } + + public String getCardEstablishmentDate() { + return cardEstablishmentDate; + } + + public void setCardEstablishmentDate(String cardEstablishmentDate) { + this.cardEstablishmentDate = cardEstablishmentDate; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getDepreciationMethod() { + return depreciationMethod; + } + + public void setDepreciationMethod(String depreciationMethod) { + this.depreciationMethod = depreciationMethod; + } + + public String getDepreciationMethodName() { + return depreciationMethodName; + } + + public void setDepreciationMethodName(String depreciationMethodName) { + this.depreciationMethodName = depreciationMethodName; + } + + public String getDepreciationPeriod() { + return depreciationPeriod; + } + + public void setDepreciationPeriod(String depreciationPeriod) { + this.depreciationPeriod = depreciationPeriod; + } + + public String getEnableDate() { + return enableDate; + } + + public void setEnableDate(String enableDate) { + this.enableDate = enableDate; + } + + public String getEquipmentCategory() { + return equipmentCategory; + } + + public void setEquipmentCategory(String equipmentCategory) { + this.equipmentCategory = equipmentCategory; + } + + public String getEquipmentCategoryName() { + return equipmentCategoryName; + } + + public void setEquipmentCategoryName(String equipmentCategoryName) { + this.equipmentCategoryName = equipmentCategoryName; + } + + public String getEquipmentName() { + return equipmentName; + } + + public void setEquipmentName(String equipmentName) { + this.equipmentName = equipmentName; + } + + public String getEquipmentNo() { + return equipmentNo; + } + + public void setEquipmentNo(String equipmentNo) { + this.equipmentNo = equipmentNo; + } + + public String getEquipmentSpecifications() { + return equipmentSpecifications; + } + + public void setEquipmentSpecifications(String equipmentSpecifications) { + this.equipmentSpecifications = equipmentSpecifications; + } + + public String getEquipmentType() { + return equipmentType; + } + + public void setEquipmentType(String equipmentType) { + this.equipmentType = equipmentType; + } + + public String getEquipmentTypeName() { + return equipmentTypeName; + } + + public void setEquipmentTypeName(String equipmentTypeName) { + this.equipmentTypeName = equipmentTypeName; + } + + public List getFileList() { + return fileList; + } + + public void setFileList(List fileList) { + this.fileList = fileList; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getInstallIncidentalExpenses() { + return installIncidentalExpenses; + } + + public void setInstallIncidentalExpenses(String installIncidentalExpenses) { + this.installIncidentalExpenses = installIncidentalExpenses; + } + + public String getInstallPlace() { + return installPlace; + } + + public void setInstallPlace(String installPlace) { + this.installPlace = installPlace; + } + + public String getIntactState() { + return intactState; + } + + public void setIntactState(String intactState) { + this.intactState = intactState; + } + + public String getIsCalibrationTestEquipment() { + return isCalibrationTestEquipment; + } + + public void setIsCalibrationTestEquipment(String isCalibrationTestEquipment) { + this.isCalibrationTestEquipment = isCalibrationTestEquipment; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getIsFixedAssets() { + return isFixedAssets; + } + + public void setIsFixedAssets(String isFixedAssets) { + this.isFixedAssets = isFixedAssets; + } + + public String getIsMeasureAccount() { + return isMeasureAccount; + } + + public void setIsMeasureAccount(String isMeasureAccount) { + this.isMeasureAccount = isMeasureAccount; + } + + public String getIsStandardSupportEquipment() { + return isStandardSupportEquipment; + } + + public void setIsStandardSupportEquipment(String isStandardSupportEquipment) { + this.isStandardSupportEquipment = isStandardSupportEquipment; + } + + public String getLabelBind() { + return labelBind; + } + + public void setLabelBind(String labelBind) { + this.labelBind = labelBind; + } + + public String getMajorCategory() { + return majorCategory; + } + + public void setMajorCategory(String majorCategory) { + this.majorCategory = majorCategory; + } + + public String getMajorCategoryName() { + return majorCategoryName; + } + + public void setMajorCategoryName(String majorCategoryName) { + this.majorCategoryName = majorCategoryName; + } + + public String getManagerLevel() { + return managerLevel; + } + + public void setManagerLevel(String managerLevel) { + this.managerLevel = managerLevel; + } + + public String getManagerLevelName() { + return managerLevelName; + } + + public void setManagerLevelName(String managerLevelName) { + this.managerLevelName = managerLevelName; + } + + public String getManagerState() { + return managerState; + } + + public void setManagerState(String managerState) { + this.managerState = managerState; + } + + public String getManagerStateName() { + return managerStateName; + } + + public void setManagerStateName(String managerStateName) { + this.managerStateName = managerStateName; + } + + public String getManufacturer() { + return manufacturer; + } + + public void setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + } + + public String getManufacturerCountry() { + return manufacturerCountry; + } + + public void setManufacturerCountry(String manufacturerCountry) { + this.manufacturerCountry = manufacturerCountry; + } + + public String getManufacturingDate() { + return manufacturingDate; + } + + public void setManufacturingDate(String manufacturingDate) { + this.manufacturingDate = manufacturingDate; + } + + public String getManufacturingNo() { + return manufacturingNo; + } + + public void setManufacturingNo(String manufacturingNo) { + this.manufacturingNo = manufacturingNo; + } + + public String getMesureCycle() { + return mesureCycle; + } + + public void setMesureCycle(String mesureCycle) { + this.mesureCycle = mesureCycle; + } + + public String getMesureDate() { + return mesureDate; + } + + public void setMesureDate(String mesureDate) { + this.mesureDate = mesureDate; + } + + public String getMesureDept() { + return mesureDept; + } + + public void setMesureDept(String mesureDept) { + this.mesureDept = mesureDept; + } + + public String getMesureRange() { + return mesureRange; + } + + public void setMesureRange(String mesureRange) { + this.mesureRange = mesureRange; + } + + public String getMesureResult() { + return mesureResult; + } + + public void setMesureResult(String mesureResult) { + this.mesureResult = mesureResult; + } + + public String getMesureResultName() { + return mesureResultName; + } + + public void setMesureResultName(String mesureResultName) { + this.mesureResultName = mesureResultName; + } + + public String getMesureType() { + return mesureType; + } + + public void setMesureType(String mesureType) { + this.mesureType = mesureType; + } + + public String getMesureTypeName() { + return mesureTypeName; + } + + public void setMesureTypeName(String mesureTypeName) { + this.mesureTypeName = mesureTypeName; + } + + public String getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getOriginValue() { + return originValue; + } + + public void setOriginValue(String originValue) { + this.originValue = originValue; + } + + public String getOverallDimension() { + return overallDimension; + } + + public void setOverallDimension(String overallDimension) { + this.overallDimension = overallDimension; + } + + public String getPresentOriginValue() { + return presentOriginValue; + } + + public void setPresentOriginValue(String presentOriginValue) { + this.presentOriginValue = presentOriginValue; + } + + public String getPurpose() { + return purpose; + } + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getSinglePrice() { + return singlePrice; + } + + public void setSinglePrice(String singlePrice) { + this.singlePrice = singlePrice; + } + + public String getSupportStandardEquipmentName() { + return supportStandardEquipmentName; + } + + public void setSupportStandardEquipmentName(String supportStandardEquipmentName) { + this.supportStandardEquipmentName = supportStandardEquipmentName; + } + + public String getSupportStandardEquipmentNo() { + return supportStandardEquipmentNo; + } + + public void setSupportStandardEquipmentNo(String supportStandardEquipmentNo) { + this.supportStandardEquipmentNo = supportStandardEquipmentNo; + } + + public String getTechnicalLevel() { + return technicalLevel; + } + + public void setTechnicalLevel(String technicalLevel) { + this.technicalLevel = technicalLevel; + } + + public String getUncertainty() { + return uncertainty; + } + + public void setUncertainty(String uncertainty) { + this.uncertainty = uncertainty; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getUseDept() { + return useDept; + } + + public void setUseDept(String useDept) { + this.useDept = useDept; + } + + public String getUseDeptName() { + return useDeptName; + } + + public void setUseDeptName(String useDeptName) { + this.useDeptName = useDeptName; + } + + public String getUsePerson() { + return usePerson; + } + + public void setUsePerson(String usePerson) { + this.usePerson = usePerson; + } + + public String getUsePersonName() { + return usePersonName; + } + + public void setUsePersonName(String usePersonName) { + this.usePersonName = usePersonName; + } + + public String getValidDate() { + return validDate; + } + + public void setValidDate(String validDate) { + this.validDate = validDate; + } + + public int getVersion() { + return version; + } + + public void setVersion(int version) { + this.version = version; + } + + public String getWeight() { + return weight; + } + + public void setWeight(String weight) { + this.weight = weight; + } + + public static class FileListModel { + private String assetId; + private String createTime; + private String createUser; + private String fileName; + private String id; + private int isDel; + private String minioFileName; + private String remark; + private String updateTime; + + public String getAssetId() { + return assetId; + } + + public void setAssetId(String assetId) { + this.assetId = assetId; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getFileName() { + return fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getMinioFileName() { + return minioFileName; + } + + public void setMinioFileName(String minioFileName) { + this.minioFileName = minioFileName; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + } + } +} diff --git a/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java b/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java new file mode 100644 index 0000000..15fc128 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java @@ -0,0 +1,697 @@ +package com.casic.xz.meterage.model; + +import java.util.List; + +public class EquipmentListModel { + + private int code; + private DataModel data; + private String message; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataModel getData() { + return data; + } + + public void setData(DataModel data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public static class DataModel { + private List rows; + private int total; + + public List getRows() { + return rows; + } + + public void setRows(List rows) { + this.rows = rows; + } + + public int getTotal() { + return total; + } + + public void setTotal(int total) { + this.total = total; + } + + public static class RowsModel { + private String abc; + private String abcName; + private String assetNo; + private String assetSource; + private String assetType; + private String assetTypeName; + private String attribute; + private String capitalSource; + private String capitalSourceName; + private String cardEstablishmentDate; + private String createTime; + private String createUser; + private String depreciationMethod; + private String depreciationMethodName; + private String depreciationPeriod; + private String enableDate; + private String equipmentCategory; + private String equipmentCategoryName; + private String equipmentName; + private String equipmentNo; + private String equipmentSpecifications; + private String equipmentType; + private String equipmentTypeName; + private String fileList; + private String id; + private String installIncidentalExpenses; + private String installPlace; + private String intactState; + private String isCalibrationTestEquipment; + private int isDel; + private String isFixedAssets; + private String isMeasureAccount; + private String isStandardSupportEquipment; + private String labelBind; + private String majorCategory; + private String majorCategoryName; + private String managerLevel; + private String managerLevelName; + private String managerState; + private String managerStateName; + private String manufacturer; + private String manufacturerCountry; + private String manufacturingDate; + private String manufacturingNo; + private String mesureCycle; + private String mesureDate; + private String mesureDept; + private String mesureRange; + private String mesureResult; + private String mesureResultName; + private String mesureType; + private String mesureTypeName; + private String modelNo; + private String originValue; + private String overallDimension; + private String presentOriginValue; + private String purpose; + private String remark; + private String singlePrice; + private String supportStandardEquipmentName; + private String supportStandardEquipmentNo; + private String technicalLevel; + private String uncertainty; + private String updateTime; + private String useDept; + private String useDeptName; + private String usePerson; + private String usePersonName; + private String validDate; + private int version; + private String weight; + + public String getAbc() { + return abc; + } + + public void setAbc(String abc) { + this.abc = abc; + } + + public String getAbcName() { + return abcName; + } + + public void setAbcName(String abcName) { + this.abcName = abcName; + } + + public String getAssetNo() { + return assetNo; + } + + public void setAssetNo(String assetNo) { + this.assetNo = assetNo; + } + + public String getAssetSource() { + return assetSource; + } + + public void setAssetSource(String assetSource) { + this.assetSource = assetSource; + } + + public String getAssetType() { + return assetType; + } + + public void setAssetType(String assetType) { + this.assetType = assetType; + } + + public String getAssetTypeName() { + return assetTypeName; + } + + public void setAssetTypeName(String assetTypeName) { + this.assetTypeName = assetTypeName; + } + + public String getAttribute() { + return attribute; + } + + public void setAttribute(String attribute) { + this.attribute = attribute; + } + + public String getCapitalSource() { + return capitalSource; + } + + public void setCapitalSource(String capitalSource) { + this.capitalSource = capitalSource; + } + + public String getCapitalSourceName() { + return capitalSourceName; + } + + public void setCapitalSourceName(String capitalSourceName) { + this.capitalSourceName = capitalSourceName; + } + + public String getCardEstablishmentDate() { + return cardEstablishmentDate; + } + + public void setCardEstablishmentDate(String cardEstablishmentDate) { + this.cardEstablishmentDate = cardEstablishmentDate; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getDepreciationMethod() { + return depreciationMethod; + } + + public void setDepreciationMethod(String depreciationMethod) { + this.depreciationMethod = depreciationMethod; + } + + public String getDepreciationMethodName() { + return depreciationMethodName; + } + + public void setDepreciationMethodName(String depreciationMethodName) { + this.depreciationMethodName = depreciationMethodName; + } + + public String getDepreciationPeriod() { + return depreciationPeriod; + } + + public void setDepreciationPeriod(String depreciationPeriod) { + this.depreciationPeriod = depreciationPeriod; + } + + public String getEnableDate() { + return enableDate; + } + + public void setEnableDate(String enableDate) { + this.enableDate = enableDate; + } + + public String getEquipmentCategory() { + return equipmentCategory; + } + + public void setEquipmentCategory(String equipmentCategory) { + this.equipmentCategory = equipmentCategory; + } + + public String getEquipmentCategoryName() { + return equipmentCategoryName; + } + + public void setEquipmentCategoryName(String equipmentCategoryName) { + this.equipmentCategoryName = equipmentCategoryName; + } + + public String getEquipmentName() { + return equipmentName; + } + + public void setEquipmentName(String equipmentName) { + this.equipmentName = equipmentName; + } + + public String getEquipmentNo() { + return equipmentNo; + } + + public void setEquipmentNo(String equipmentNo) { + this.equipmentNo = equipmentNo; + } + + public String getEquipmentSpecifications() { + return equipmentSpecifications; + } + + public void setEquipmentSpecifications(String equipmentSpecifications) { + this.equipmentSpecifications = equipmentSpecifications; + } + + public String getEquipmentType() { + return equipmentType; + } + + public void setEquipmentType(String equipmentType) { + this.equipmentType = equipmentType; + } + + public String getEquipmentTypeName() { + return equipmentTypeName; + } + + public void setEquipmentTypeName(String equipmentTypeName) { + this.equipmentTypeName = equipmentTypeName; + } + + public String getFileList() { + return fileList; + } + + public void setFileList(String fileList) { + this.fileList = fileList; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getInstallIncidentalExpenses() { + return installIncidentalExpenses; + } + + public void setInstallIncidentalExpenses(String installIncidentalExpenses) { + this.installIncidentalExpenses = installIncidentalExpenses; + } + + public String getInstallPlace() { + return installPlace; + } + + public void setInstallPlace(String installPlace) { + this.installPlace = installPlace; + } + + public String getIntactState() { + return intactState; + } + + public void setIntactState(String intactState) { + this.intactState = intactState; + } + + public String getIsCalibrationTestEquipment() { + return isCalibrationTestEquipment; + } + + public void setIsCalibrationTestEquipment(String isCalibrationTestEquipment) { + this.isCalibrationTestEquipment = isCalibrationTestEquipment; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getIsFixedAssets() { + return isFixedAssets; + } + + public void setIsFixedAssets(String isFixedAssets) { + this.isFixedAssets = isFixedAssets; + } + + public String getIsMeasureAccount() { + return isMeasureAccount; + } + + public void setIsMeasureAccount(String isMeasureAccount) { + this.isMeasureAccount = isMeasureAccount; + } + + public String getIsStandardSupportEquipment() { + return isStandardSupportEquipment; + } + + public void setIsStandardSupportEquipment(String isStandardSupportEquipment) { + this.isStandardSupportEquipment = isStandardSupportEquipment; + } + + public String getLabelBind() { + return labelBind; + } + + public void setLabelBind(String labelBind) { + this.labelBind = labelBind; + } + + public String getMajorCategory() { + return majorCategory; + } + + public void setMajorCategory(String majorCategory) { + this.majorCategory = majorCategory; + } + + public String getMajorCategoryName() { + return majorCategoryName; + } + + public void setMajorCategoryName(String majorCategoryName) { + this.majorCategoryName = majorCategoryName; + } + + public String getManagerLevel() { + return managerLevel; + } + + public void setManagerLevel(String managerLevel) { + this.managerLevel = managerLevel; + } + + public String getManagerLevelName() { + return managerLevelName; + } + + public void setManagerLevelName(String managerLevelName) { + this.managerLevelName = managerLevelName; + } + + public String getManagerState() { + return managerState; + } + + public void setManagerState(String managerState) { + this.managerState = managerState; + } + + public String getManagerStateName() { + return managerStateName; + } + + public void setManagerStateName(String managerStateName) { + this.managerStateName = managerStateName; + } + + public String getManufacturer() { + return manufacturer; + } + + public void setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + } + + public String getManufacturerCountry() { + return manufacturerCountry; + } + + public void setManufacturerCountry(String manufacturerCountry) { + this.manufacturerCountry = manufacturerCountry; + } + + public String getManufacturingDate() { + return manufacturingDate; + } + + public void setManufacturingDate(String manufacturingDate) { + this.manufacturingDate = manufacturingDate; + } + + public String getManufacturingNo() { + return manufacturingNo; + } + + public void setManufacturingNo(String manufacturingNo) { + this.manufacturingNo = manufacturingNo; + } + + public String getMesureCycle() { + return mesureCycle; + } + + public void setMesureCycle(String mesureCycle) { + this.mesureCycle = mesureCycle; + } + + public String getMesureDate() { + return mesureDate; + } + + public void setMesureDate(String mesureDate) { + this.mesureDate = mesureDate; + } + + public String getMesureDept() { + return mesureDept; + } + + public void setMesureDept(String mesureDept) { + this.mesureDept = mesureDept; + } + + public String getMesureRange() { + return mesureRange; + } + + public void setMesureRange(String mesureRange) { + this.mesureRange = mesureRange; + } + + public String getMesureResult() { + return mesureResult; + } + + public void setMesureResult(String mesureResult) { + this.mesureResult = mesureResult; + } + + public String getMesureResultName() { + return mesureResultName; + } + + public void setMesureResultName(String mesureResultName) { + this.mesureResultName = mesureResultName; + } + + public String getMesureType() { + return mesureType; + } + + public void setMesureType(String mesureType) { + this.mesureType = mesureType; + } + + public String getMesureTypeName() { + return mesureTypeName; + } + + public void setMesureTypeName(String mesureTypeName) { + this.mesureTypeName = mesureTypeName; + } + + public String getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getOriginValue() { + return originValue; + } + + public void setOriginValue(String originValue) { + this.originValue = originValue; + } + + public String getOverallDimension() { + return overallDimension; + } + + public void setOverallDimension(String overallDimension) { + this.overallDimension = overallDimension; + } + + public String getPresentOriginValue() { + return presentOriginValue; + } + + public void setPresentOriginValue(String presentOriginValue) { + this.presentOriginValue = presentOriginValue; + } + + public String getPurpose() { + return purpose; + } + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getSinglePrice() { + return singlePrice; + } + + public void setSinglePrice(String singlePrice) { + this.singlePrice = singlePrice; + } + + public String getSupportStandardEquipmentName() { + return supportStandardEquipmentName; + } + + public void setSupportStandardEquipmentName(String supportStandardEquipmentName) { + this.supportStandardEquipmentName = supportStandardEquipmentName; + } + + public String getSupportStandardEquipmentNo() { + return supportStandardEquipmentNo; + } + + public void setSupportStandardEquipmentNo(String supportStandardEquipmentNo) { + this.supportStandardEquipmentNo = supportStandardEquipmentNo; + } + + public String getTechnicalLevel() { + return technicalLevel; + } + + public void setTechnicalLevel(String technicalLevel) { + this.technicalLevel = technicalLevel; + } + + public String getUncertainty() { + return uncertainty; + } + + public void setUncertainty(String uncertainty) { + this.uncertainty = uncertainty; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getUseDept() { + return useDept; + } + + public void setUseDept(String useDept) { + this.useDept = useDept; + } + + public String getUseDeptName() { + return useDeptName; + } + + public void setUseDeptName(String useDeptName) { + this.useDeptName = useDeptName; + } + + public String getUsePerson() { + return usePerson; + } + + public void setUsePerson(String usePerson) { + this.usePerson = usePerson; + } + + public String getUsePersonName() { + return usePersonName; + } + + public void setUsePersonName(String usePersonName) { + this.usePersonName = usePersonName; + } + + public String getValidDate() { + return validDate; + } + + public void setValidDate(String validDate) { + this.validDate = validDate; + } + + public int getVersion() { + return version; + } + + public void setVersion(int version) { + this.version = version; + } + + public String getWeight() { + return weight; + } + + public void setWeight(String weight) { + this.weight = weight; + } + } + } +} diff --git a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt index a3f514f..46e5eef 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt @@ -35,4 +35,24 @@ @QueryMap limit: Map, @QueryMap offset: Map ): String + + /** + * 获取设备列表 + */ + @POST("/meter/assets/listPage") + suspend fun getEquipmentList( + @Header("token") token: String, + @Body requestBody: RequestBody, + @QueryMap limit: Map, + @QueryMap offset: Map + ): String + + /** + * 获取设备详情 + */ + @POST("/meter/assets/detail") + suspend fun getEquipmentDetail( + @Header("token") token: String, + @Body requestBody: RequestBody + ): String } \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt index 444a872..386a1d8 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt @@ -6,8 +6,10 @@ import com.pengxh.kt.lite.utils.SaveKeyValues import okhttp3.MediaType.Companion.toMediaType import okhttp3.RequestBody.Companion.toRequestBody +import org.json.JSONArray import org.json.JSONObject + object RetrofitServiceManager { private val api by lazy { @@ -73,4 +75,71 @@ offsetMap["offset"] = offset return api.getNoticeList(AuthenticationHelper.token!!, requestBody, limitMap, offsetMap) } + + /** + * 获取设备列表 + */ + suspend fun getEquipmentList( + equipmentNo: String, + equipmentName: String, + mesureType: String, + managerState: String, + useDept: String, + assetType: String, + equipmentCategory: String, + isCalibrationTestEquipment: String, + isMeasureAccount: String, + isStandardSupportEquipment: String, + isFixedAssets: String, + validStartDate: String, + validEndDate: String, + abc: String, + ids: Array, + offset: Int + ): String { + val paramObject = JSONObject() + paramObject.put("equipmentNo", equipmentNo) + paramObject.put("equipmentName", equipmentName) + paramObject.put("mesureType", mesureType) + paramObject.put("managerState", managerState) + paramObject.put("useDept", useDept) + paramObject.put("assetType", assetType) + paramObject.put("equipmentCategory", equipmentCategory) + paramObject.put("isCalibrationTestEquipment", isCalibrationTestEquipment) + paramObject.put("isMeasureAccount", isMeasureAccount) + paramObject.put("isStandardSupportEquipment", isStandardSupportEquipment) + paramObject.put("isFixedAssets", isFixedAssets) + paramObject.put("validStartDate", validStartDate) + paramObject.put("validEndDate", validEndDate) + paramObject.put("abc", abc) + + val jsonArray = JSONArray() + ids.forEach { + jsonArray.put(it) + } + paramObject.put("ids", jsonArray) + + val requestBody = paramObject.toString().toRequestBody( + "application/json;charset=UTF-8".toMediaType() + ) + + val limitMap = HashMap() + limitMap["limit"] = LocaleConstant.PAGE_LIMIT + + val offsetMap = HashMap() + offsetMap["offset"] = offset + return api.getEquipmentList(AuthenticationHelper.token!!, requestBody, limitMap, offsetMap) + } + + /** + * 获取设备详情 + */ + suspend fun getEquipmentDetail(id: String): String { + val paramObject = JSONObject() + paramObject.put("id", id) + val requestBody = paramObject.toString().toRequestBody( + "application/json;charset=UTF-8".toMediaType() + ) + return api.getEquipmentDetail(AuthenticationHelper.token!!, requestBody) + } } \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt deleted file mode 100644 index a5bb60b..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt +++ /dev/null @@ -1,104 +0,0 @@ -package com.casic.xz.meterage.view - -import android.annotation.SuppressLint -import android.graphics.Paint -import androidx.lifecycle.ViewModelProvider -import com.casic.xz.meterage.R -import com.casic.xz.meterage.extensions.combineImagePath -import com.casic.xz.meterage.extensions.formatTextFromHtml -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.vm.NoticeViewModel -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.extensions.convertColor -import com.pengxh.kt.lite.extensions.navigatePageTo -import com.pengxh.kt.lite.extensions.obtainScreenWidth -import com.pengxh.kt.lite.extensions.show -import com.pengxh.kt.lite.utils.Constant -import kotlinx.android.synthetic.main.activity_notice_detail.* -import kotlinx.android.synthetic.main.include_base_title.* -import java.util.* - -@SuppressLint("SetTextI18n") -class NoticeDetailActivity : KotlinBaseActivity() { - - private lateinit var noticeViewModel: NoticeViewModel - - override fun initData() { - leftBackView.setOnClickListener { finish() } - titleView.text = "通知公告" - - val args = intent.getStringArrayListExtra(Constant.INTENT_PARAM)!! - - noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] - noticeViewModel.getNoticeList(args[0], args[1], args[2], "", "", 1) - noticeViewModel.noticeResult.observe(this, { - if (it.code == 200) { - val dataRow = it.data?.rows!![0] - - noticeDateView.text = dataRow.noticeTime - noticePublisherView.text = "发布人 ${dataRow.noticePublisher}" - noticeCompanyView.text = "发布单位 ${dataRow.noticeCompany}" - - noticeNoView.text = dataRow.noticeNo - noticeTitleView.text = dataRow.noticeTitle - noticeSketchView.text = dataRow.noticeSketch - - dataRow.noticeContent.formatTextFromHtml( - this, noticeContentView, obtainScreenWidth() - ) - - if (dataRow.minioFileName.isNullOrBlank()) { - minioFileView.text = "暂无附件" - } else { - val minioFileName = dataRow.minioFileName - - minioFileView.text = minioFileName - val textPaint = minioFileView.paint - textPaint.flags = Paint.UNDERLINE_TEXT_FLAG - textPaint.isAntiAlias = true - minioFileView.setTextColor(R.color.themeColor.convertColor(this)) - - minioFileView.setOnClickListener { - //查看附件 - if (minioFileName.endsWith("pdf")) { - navigatePageTo(minioFileName) - } else if ( - minioFileName.endsWith("doc") || - minioFileName.endsWith("docx") - ) { - navigatePageTo(minioFileName) - } else if (minioFileName.endsWith("txt")) { - navigatePageTo(minioFileName) - } else if ( - minioFileName.endsWith("png") || - minioFileName.endsWith("jpeg") || - minioFileName.endsWith("jpg") - ) { - val urls = ArrayList() - urls.add(minioFileName.combineImagePath()) - navigatePageTo(0, urls) - } else { - "文件类型未知,无法打开附件".show(this) - } - } - } - } - }) - } - - override fun initEvent() { - - } - - override fun initLayoutView(): Int = R.layout.activity_notice_detail - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/NoticeListActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/NoticeListActivity.kt deleted file mode 100644 index 15f6a16..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/NoticeListActivity.kt +++ /dev/null @@ -1,180 +0,0 @@ -package com.casic.xz.meterage.view - -import android.os.Handler -import android.util.Log -import android.view.View -import androidx.lifecycle.ViewModelProvider -import com.casic.xz.meterage.R -import com.casic.xz.meterage.adapter.NoticeListAdapter -import com.casic.xz.meterage.extensions.addAll -import com.casic.xz.meterage.extensions.combineFilePath -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.extensions.showEmptyPage -import com.casic.xz.meterage.model.NoticeListModel -import com.casic.xz.meterage.vm.NoticeViewModel -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.extensions.navigatePageTo -import com.pengxh.kt.lite.extensions.show -import com.pengxh.kt.lite.utils.WeakReferenceHandler -import com.pengxh.kt.lite.widget.dialog.AlertControlDialog -import kotlinx.android.synthetic.main.activity_notice_list.* -import kotlinx.android.synthetic.main.include_empty_view.* - -class NoticeListActivity : KotlinBaseActivity() { - - private lateinit var weakReferenceHandler: WeakReferenceHandler - private lateinit var noticeViewModel: NoticeViewModel - private lateinit var noticeListAdapter: NoticeListAdapter - private var dataBeans: MutableList = ArrayList() - private var pageIndex = 1 - private var isRefresh = false - private var isLoadMore = false - - override fun initData() { - weakReferenceHandler = WeakReferenceHandler(callback) - noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] - noticeViewModel.noticeResult.observe(this, { - if (it.code == 200) { - val dataRows = it.data?.rows!! -// countBadeNumber(dataRows) - when { - isRefresh -> { - dataBeans.clear() - dataBeans = dataRows - noticeLayout.finishRefresh() - isRefresh = false - } - isLoadMore -> { - if (dataRows.size == 0) { - "到底了,别拉了".show(this) - } - dataBeans.addAll(dataRows) - noticeLayout.finishLoadMore() - isLoadMore = false - } - else -> { - dataBeans = dataRows - } - } - weakReferenceHandler.sendEmptyMessage(2023013101) - } - }) - } - - override fun initEvent() { - leftBackView.setOnClickListener { finish() } - rightOperateView.setOnClickListener { - AlertControlDialog.Builder() - .setContext(this) - .setTitle("提示") - .setMessage("确定将所有未读消息标为已读?") - .setNegativeButton("取消") - .setPositiveButton("确定") - .setOnDialogButtonClickListener(object : - AlertControlDialog.OnDialogButtonClickListener { - override fun onCancelClick() { - - } - - override fun onConfirmClick() { - //TODO 设置为已读 - } - }).build().show() - } - - if (hasNoticePermission()) { - openSystemNoticeLayout.visibility = View.GONE - openSystemNoticeLayout.visibility = View.GONE - } else { - openSystemNoticeLayout.setOnClickListener { - - } - - - closeLayoutView.setOnClickListener { - openSystemNoticeLayout.visibility = View.GONE - } - } - - noticeLayout.setOnRefreshListener { - isRefresh = true - //刷新之后页码重置 - pageIndex = 1 - getNoticeListByPage() - } - - noticeLayout.setOnLoadMoreListener { - isLoadMore = true - pageIndex++ - getNoticeListByPage() - } - } - - override fun onResume() { - super.onResume() - pageIndex = 1 - getNoticeListByPage() - } - - private fun getNoticeListByPage() { - noticeViewModel.getNoticeList("", "", "", "", "", pageIndex) - } - - private val callback = Handler.Callback { - when (it.what) { - 2023013101 -> { - if (isRefresh || isLoadMore) { - noticeListAdapter.notifyDataSetChanged() - } else { - if (dataBeans.size == 0) { - emptyView!!.showEmptyPage("没有任何消息") { - pageIndex = 1 - getNoticeListByPage() - } - } else { - emptyView!!.hide() - noticeListAdapter = NoticeListAdapter(this, dataBeans) - noticeRecyclerView.adapter = noticeListAdapter - noticeListAdapter.setOnItemClickListener(object : - NoticeListAdapter.OnItemClickListener { - override fun onItemClicked(position: Int) { - val rowsModel = dataBeans[position] - val allArgs = addAll( - rowsModel.noticeNo, - rowsModel.noticeTitle, - rowsModel.noticePublisher, - "", - "" - ) - Log.d( - "Casic", - "NoticeListActivity => onItemClicked: ${rowsModel.minioFileName.combineFilePath()}" - ) - navigatePageTo(allArgs) - } - }) - } - } - } - } - true - } - - //TODO 判断是否开启通知权限 - private fun hasNoticePermission(): Boolean { - - return false - } - - override fun initLayoutView(): Int = R.layout.activity_notice_list - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/PreviewDocumentActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/PreviewDocumentActivity.kt deleted file mode 100644 index e233ddc..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/PreviewDocumentActivity.kt +++ /dev/null @@ -1,24 +0,0 @@ -package com.casic.xz.meterage.view - -import com.casic.xz.meterage.R -import com.pengxh.kt.lite.base.KotlinBaseActivity - -class PreviewDocumentActivity : KotlinBaseActivity() { - override fun initData() { - - } - - override fun initEvent() { - - } - - override fun initLayoutView(): Int = R.layout.activity_preview_doc - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/PreviewPdfActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/PreviewPdfActivity.kt deleted file mode 100644 index 39f8ac2..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/PreviewPdfActivity.kt +++ /dev/null @@ -1,62 +0,0 @@ -package com.casic.xz.meterage.view - -import com.casic.xz.meterage.R -import com.casic.xz.meterage.extensions.combineFilePath -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.utils.LoadingDialogHub -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.callback.OnDownloadListener -import com.pengxh.kt.lite.extensions.createDownloadFileDir -import com.pengxh.kt.lite.extensions.downloadFile -import com.pengxh.kt.lite.utils.Constant -import kotlinx.android.synthetic.main.activity_preview_pdf.* -import kotlinx.android.synthetic.main.include_base_title.* -import java.io.File -import java.io.FileInputStream - - -class PreviewPdfActivity : KotlinBaseActivity() { - - override fun initData() { - val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! - titleView.text = minioFileName - - val url = minioFileName.combineFilePath() - url.downloadFile(createDownloadFileDir().toString(), - object : OnDownloadListener { - override fun onDownloadStart(totalBytes: Long) { - runOnUiThread { - LoadingDialogHub.show(this@PreviewPdfActivity, "附件加载中") - } - } - - override fun onProgressChanged(currentBytes: Long) { - - } - - override fun onDownloadEnd(file: File?) { - runOnUiThread { - LoadingDialogHub.dismiss() - } - val inputStream = FileInputStream(file) - pdfView.fromStream(inputStream).load() - } - }) - } - - override fun initEvent() { - leftBackView.setOnClickListener { finish() } - } - - override fun initLayoutView(): Int = R.layout.activity_preview_pdf - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 3892b5a..02160cd 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -34,16 +34,18 @@ - - - - - - - + + + + + + + + + +) : RecyclerView.Adapter() { + + private var layoutInflater: LayoutInflater = LayoutInflater.from(context) + + override fun getItemCount(): Int = dataRows.size + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = ItemViewHolder( + layoutInflater.inflate(R.layout.item_equipment_rv_l, parent, false) + ) + + override fun onBindViewHolder(holder: ItemViewHolder, position: Int) { + //绑定数据 + val rowsBean = dataRows[position] + holder.equipmentNameView.text = rowsBean.equipmentName + holder.equipmentCodeView.text = rowsBean.equipmentNo + holder.equipmentDateView.text = rowsBean.enableDate + holder.equipmentLibView.text = rowsBean.useDeptName + + //绑定事件 + holder.itemView.setOnClickListener { + listener?.onItemClicked(position) + } + } + + inner class ItemViewHolder(view: View) : RecyclerView.ViewHolder(view) { + var equipmentNameView: TextView = view.findViewById(R.id.equipmentNameView) + var equipmentCodeView: TextView = view.findViewById(R.id.equipmentCodeView) + var equipmentDateView: TextView = view.findViewById(R.id.equipmentDateView) + var equipmentLibView: TextView = view.findViewById(R.id.equipmentLibView) + } + + private var listener: OnItemClickListener? = null + + interface OnItemClickListener { + fun onItemClicked(position: Int) + } + + fun setOnItemClickListener(onClickListener: OnItemClickListener?) { + this.listener = onClickListener + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt index b4628f3..d970b55 100644 --- a/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt +++ b/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt @@ -5,7 +5,8 @@ import com.casic.xz.meterage.R import com.casic.xz.meterage.adapter.HomeGridAdapter import com.casic.xz.meterage.utils.LocaleConstant -import com.casic.xz.meterage.view.NoticeListActivity +import com.casic.xz.meterage.view.home.EquipmentActivity +import com.casic.xz.meterage.view.notice.NoticeListActivity import com.casic.xz.meterage.vm.NoticeViewModel import com.pengxh.kt.lite.base.KotlinBaseFragment import com.pengxh.kt.lite.extensions.navigatePageTo @@ -36,8 +37,19 @@ homeFuncRecyclerView.adapter = homeAdapter homeAdapter.setOnGridItemClickListener(object : HomeGridAdapter.OnGridItemClickListener { override fun onItemClick(position: Int) { - when (position) { - + when (LocaleConstant.HOME_FUNC_OPERATE[position]) { + "仪器设备" -> requireContext().navigatePageTo() +// "标准装置" -> requireContext().navigatePageTo() +// "证书报告" -> requireContext().navigatePageTo() +// "委托需求" -> requireContext().navigatePageTo() +// "访客" -> requireContext().navigatePageTo() +// "标准规范" -> requireContext().navigatePageTo() +// "能力列表" -> requireContext().navigatePageTo() +// "计量培训" -> requireContext().navigatePageTo() +// "合同发票" -> requireContext().navigatePageTo() +// "业务统计" -> requireContext().navigatePageTo() +// "客户列表" -> requireContext().navigatePageTo() +// "外场检测" -> requireContext().navigatePageTo() } } }) diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt index 7e75abe..56dc5ec 100644 --- a/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt +++ b/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt @@ -2,9 +2,11 @@ import android.view.View import androidx.lifecycle.ViewModelProvider +import com.bumptech.glide.Glide +import com.bumptech.glide.request.RequestOptions import com.casic.xz.meterage.R import com.casic.xz.meterage.utils.LocaleConstant -import com.casic.xz.meterage.view.NoticeListActivity +import com.casic.xz.meterage.view.notice.NoticeListActivity import com.casic.xz.meterage.vm.NoticeViewModel import com.casic.xz.meterage.vm.UserViewModel import com.pengxh.kt.lite.base.KotlinBaseFragment @@ -23,6 +25,12 @@ val data = it.data userNameView.text = data.name userUnitView.text = data.deptName + +// Glide.with(requireContext()) +// .load(R.mipmap.default_avatar) +// .apply(RequestOptions.circleCropTransform()) +// .placeholder(R.mipmap.load_image_error) +// .into(userAvatarView) } }) diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt new file mode 100644 index 0000000..cf22646 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt @@ -0,0 +1,103 @@ +package com.casic.xz.meterage.fragment.equipment + +import android.graphics.Paint +import androidx.lifecycle.ViewModelProvider +import com.casic.xz.meterage.R +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.casic.xz.meterage.vm.EquipmentViewModel +import com.pengxh.kt.lite.base.KotlinBaseFragment +import com.pengxh.kt.lite.extensions.convertColor +import com.pengxh.kt.lite.vm.LoadState +import kotlinx.android.synthetic.main.fragment_basic_information.* + +class BasicInformationFragment(private val id: String) : KotlinBaseFragment() { + + private lateinit var equipmentViewModel: EquipmentViewModel + + override fun initData() { + equipmentViewModel = ViewModelProvider(this)[EquipmentViewModel::class.java] + equipmentViewModel.getEquipmentDetail(id) + equipmentViewModel.equipmentDetailResult.observe(this, { + if (it.code == 200) { + val data = it.data!! + + equipmentCodeView.text = data.equipmentNo + equipmentNameView.text = data.equipmentName + manufacturerView.text = data.manufacturer + factoryNumberView.text = data.manufacturingNo + modelView.text = data.modelNo + verificationMethodView.text = data.mesureTypeName + measuringRangeView.text = data.mesureRange + uncertaintyView.text = data.uncertainty + firstUseView.text = data.createTime + originalValueView.text = data.originValue + usageDeptView.text = data.useDeptName + userView.text = data.usePersonName + managementStatusView.text = data.managerStateName + verificationDeptView.text = data.useDeptName +// nextVerificationDeptView.text = data. + verificationPeriodView.text = data.mesureCycle + verificationDateView.text = data.mesureDate + effectiveDateView.text = data.validDate + verificationResultsView.text = data.mesureResultName + abcView.text = data.abcName + isNeedTechnicalView.text = if ( + data.isCalibrationTestEquipment.isNullOrBlank() || data.isCalibrationTestEquipment == "0" + ) { + "否" + } else { + "是" + } + + isStandingBook.text = if ( + data.isMeasureAccount.isNullOrBlank() || data.isMeasureAccount == "0" + ) { + "否" + } else { + "是" + } + + isStandardView.text = if ( + data.isStandardSupportEquipment.isNullOrBlank() || data.isStandardSupportEquipment == "0" + ) { + "否" + } else { + "是" + } + remarkView.text = data.remark + if (data.fileList.size == 0) { + instructionsView.text = "暂无" + } else { + instructionsView.text = "查看附件列表" + val textPaint = instructionsView.paint + textPaint.flags = Paint.UNDERLINE_TEXT_FLAG + textPaint.isAntiAlias = true + instructionsView.setTextColor(R.color.themeColor.convertColor(requireContext())) + + instructionsView.setOnClickListener { + + } + } + } + }) + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_basic_information + + override fun observeRequestState() { + equipmentViewModel.loadState.observe(this, { + when (it) { + LoadState.Loading -> LoadingDialogHub.show(requireActivity(), "数据加载中...") + else -> LoadingDialogHub.dismiss() + } + }) + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt new file mode 100644 index 0000000..0b4a747 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class CertificateFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_certificate + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt new file mode 100644 index 0000000..f05c491 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class ChangeRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_change_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt new file mode 100644 index 0000000..849ffa5 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class InspectionRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_inspection_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt new file mode 100644 index 0000000..aa4edd9 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class UsageRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_usage_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java b/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java new file mode 100644 index 0000000..0b9124e --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java @@ -0,0 +1,760 @@ +package com.casic.xz.meterage.model; + +import java.util.List; + +public class EquipmentDetailModel { + + private int code; + private DataModel data; + private String message; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataModel getData() { + return data; + } + + public void setData(DataModel data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public static class DataModel { + private String abc; + private String abcName; + private String assetNo; + private String assetSource; + private String assetType; + private String assetTypeName; + private String attribute; + private String capitalSource; + private String capitalSourceName; + private String cardEstablishmentDate; + private String createTime; + private String createUser; + private String depreciationMethod; + private String depreciationMethodName; + private String depreciationPeriod; + private String enableDate; + private String equipmentCategory; + private String equipmentCategoryName; + private String equipmentName; + private String equipmentNo; + private String equipmentSpecifications; + private String equipmentType; + private String equipmentTypeName; + private List fileList; + private String id; + private String installIncidentalExpenses; + private String installPlace; + private String intactState; + private String isCalibrationTestEquipment; + private int isDel; + private String isFixedAssets; + private String isMeasureAccount; + private String isStandardSupportEquipment; + private String labelBind; + private String majorCategory; + private String majorCategoryName; + private String managerLevel; + private String managerLevelName; + private String managerState; + private String managerStateName; + private String manufacturer; + private String manufacturerCountry; + private String manufacturingDate; + private String manufacturingNo; + private String mesureCycle; + private String mesureDate; + private String mesureDept; + private String mesureRange; + private String mesureResult; + private String mesureResultName; + private String mesureType; + private String mesureTypeName; + private String modelNo; + private String originValue; + private String overallDimension; + private String presentOriginValue; + private String purpose; + private String remark; + private String singlePrice; + private String supportStandardEquipmentName; + private String supportStandardEquipmentNo; + private String technicalLevel; + private String uncertainty; + private String updateTime; + private String useDept; + private String useDeptName; + private String usePerson; + private String usePersonName; + private String validDate; + private int version; + private String weight; + + public String getAbc() { + return abc; + } + + public void setAbc(String abc) { + this.abc = abc; + } + + public String getAbcName() { + return abcName; + } + + public void setAbcName(String abcName) { + this.abcName = abcName; + } + + public String getAssetNo() { + return assetNo; + } + + public void setAssetNo(String assetNo) { + this.assetNo = assetNo; + } + + public String getAssetSource() { + return assetSource; + } + + public void setAssetSource(String assetSource) { + this.assetSource = assetSource; + } + + public String getAssetType() { + return assetType; + } + + public void setAssetType(String assetType) { + this.assetType = assetType; + } + + public String getAssetTypeName() { + return assetTypeName; + } + + public void setAssetTypeName(String assetTypeName) { + this.assetTypeName = assetTypeName; + } + + public String getAttribute() { + return attribute; + } + + public void setAttribute(String attribute) { + this.attribute = attribute; + } + + public String getCapitalSource() { + return capitalSource; + } + + public void setCapitalSource(String capitalSource) { + this.capitalSource = capitalSource; + } + + public String getCapitalSourceName() { + return capitalSourceName; + } + + public void setCapitalSourceName(String capitalSourceName) { + this.capitalSourceName = capitalSourceName; + } + + public String getCardEstablishmentDate() { + return cardEstablishmentDate; + } + + public void setCardEstablishmentDate(String cardEstablishmentDate) { + this.cardEstablishmentDate = cardEstablishmentDate; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getDepreciationMethod() { + return depreciationMethod; + } + + public void setDepreciationMethod(String depreciationMethod) { + this.depreciationMethod = depreciationMethod; + } + + public String getDepreciationMethodName() { + return depreciationMethodName; + } + + public void setDepreciationMethodName(String depreciationMethodName) { + this.depreciationMethodName = depreciationMethodName; + } + + public String getDepreciationPeriod() { + return depreciationPeriod; + } + + public void setDepreciationPeriod(String depreciationPeriod) { + this.depreciationPeriod = depreciationPeriod; + } + + public String getEnableDate() { + return enableDate; + } + + public void setEnableDate(String enableDate) { + this.enableDate = enableDate; + } + + public String getEquipmentCategory() { + return equipmentCategory; + } + + public void setEquipmentCategory(String equipmentCategory) { + this.equipmentCategory = equipmentCategory; + } + + public String getEquipmentCategoryName() { + return equipmentCategoryName; + } + + public void setEquipmentCategoryName(String equipmentCategoryName) { + this.equipmentCategoryName = equipmentCategoryName; + } + + public String getEquipmentName() { + return equipmentName; + } + + public void setEquipmentName(String equipmentName) { + this.equipmentName = equipmentName; + } + + public String getEquipmentNo() { + return equipmentNo; + } + + public void setEquipmentNo(String equipmentNo) { + this.equipmentNo = equipmentNo; + } + + public String getEquipmentSpecifications() { + return equipmentSpecifications; + } + + public void setEquipmentSpecifications(String equipmentSpecifications) { + this.equipmentSpecifications = equipmentSpecifications; + } + + public String getEquipmentType() { + return equipmentType; + } + + public void setEquipmentType(String equipmentType) { + this.equipmentType = equipmentType; + } + + public String getEquipmentTypeName() { + return equipmentTypeName; + } + + public void setEquipmentTypeName(String equipmentTypeName) { + this.equipmentTypeName = equipmentTypeName; + } + + public List getFileList() { + return fileList; + } + + public void setFileList(List fileList) { + this.fileList = fileList; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getInstallIncidentalExpenses() { + return installIncidentalExpenses; + } + + public void setInstallIncidentalExpenses(String installIncidentalExpenses) { + this.installIncidentalExpenses = installIncidentalExpenses; + } + + public String getInstallPlace() { + return installPlace; + } + + public void setInstallPlace(String installPlace) { + this.installPlace = installPlace; + } + + public String getIntactState() { + return intactState; + } + + public void setIntactState(String intactState) { + this.intactState = intactState; + } + + public String getIsCalibrationTestEquipment() { + return isCalibrationTestEquipment; + } + + public void setIsCalibrationTestEquipment(String isCalibrationTestEquipment) { + this.isCalibrationTestEquipment = isCalibrationTestEquipment; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getIsFixedAssets() { + return isFixedAssets; + } + + public void setIsFixedAssets(String isFixedAssets) { + this.isFixedAssets = isFixedAssets; + } + + public String getIsMeasureAccount() { + return isMeasureAccount; + } + + public void setIsMeasureAccount(String isMeasureAccount) { + this.isMeasureAccount = isMeasureAccount; + } + + public String getIsStandardSupportEquipment() { + return isStandardSupportEquipment; + } + + public void setIsStandardSupportEquipment(String isStandardSupportEquipment) { + this.isStandardSupportEquipment = isStandardSupportEquipment; + } + + public String getLabelBind() { + return labelBind; + } + + public void setLabelBind(String labelBind) { + this.labelBind = labelBind; + } + + public String getMajorCategory() { + return majorCategory; + } + + public void setMajorCategory(String majorCategory) { + this.majorCategory = majorCategory; + } + + public String getMajorCategoryName() { + return majorCategoryName; + } + + public void setMajorCategoryName(String majorCategoryName) { + this.majorCategoryName = majorCategoryName; + } + + public String getManagerLevel() { + return managerLevel; + } + + public void setManagerLevel(String managerLevel) { + this.managerLevel = managerLevel; + } + + public String getManagerLevelName() { + return managerLevelName; + } + + public void setManagerLevelName(String managerLevelName) { + this.managerLevelName = managerLevelName; + } + + public String getManagerState() { + return managerState; + } + + public void setManagerState(String managerState) { + this.managerState = managerState; + } + + public String getManagerStateName() { + return managerStateName; + } + + public void setManagerStateName(String managerStateName) { + this.managerStateName = managerStateName; + } + + public String getManufacturer() { + return manufacturer; + } + + public void setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + } + + public String getManufacturerCountry() { + return manufacturerCountry; + } + + public void setManufacturerCountry(String manufacturerCountry) { + this.manufacturerCountry = manufacturerCountry; + } + + public String getManufacturingDate() { + return manufacturingDate; + } + + public void setManufacturingDate(String manufacturingDate) { + this.manufacturingDate = manufacturingDate; + } + + public String getManufacturingNo() { + return manufacturingNo; + } + + public void setManufacturingNo(String manufacturingNo) { + this.manufacturingNo = manufacturingNo; + } + + public String getMesureCycle() { + return mesureCycle; + } + + public void setMesureCycle(String mesureCycle) { + this.mesureCycle = mesureCycle; + } + + public String getMesureDate() { + return mesureDate; + } + + public void setMesureDate(String mesureDate) { + this.mesureDate = mesureDate; + } + + public String getMesureDept() { + return mesureDept; + } + + public void setMesureDept(String mesureDept) { + this.mesureDept = mesureDept; + } + + public String getMesureRange() { + return mesureRange; + } + + public void setMesureRange(String mesureRange) { + this.mesureRange = mesureRange; + } + + public String getMesureResult() { + return mesureResult; + } + + public void setMesureResult(String mesureResult) { + this.mesureResult = mesureResult; + } + + public String getMesureResultName() { + return mesureResultName; + } + + public void setMesureResultName(String mesureResultName) { + this.mesureResultName = mesureResultName; + } + + public String getMesureType() { + return mesureType; + } + + public void setMesureType(String mesureType) { + this.mesureType = mesureType; + } + + public String getMesureTypeName() { + return mesureTypeName; + } + + public void setMesureTypeName(String mesureTypeName) { + this.mesureTypeName = mesureTypeName; + } + + public String getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getOriginValue() { + return originValue; + } + + public void setOriginValue(String originValue) { + this.originValue = originValue; + } + + public String getOverallDimension() { + return overallDimension; + } + + public void setOverallDimension(String overallDimension) { + this.overallDimension = overallDimension; + } + + public String getPresentOriginValue() { + return presentOriginValue; + } + + public void setPresentOriginValue(String presentOriginValue) { + this.presentOriginValue = presentOriginValue; + } + + public String getPurpose() { + return purpose; + } + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getSinglePrice() { + return singlePrice; + } + + public void setSinglePrice(String singlePrice) { + this.singlePrice = singlePrice; + } + + public String getSupportStandardEquipmentName() { + return supportStandardEquipmentName; + } + + public void setSupportStandardEquipmentName(String supportStandardEquipmentName) { + this.supportStandardEquipmentName = supportStandardEquipmentName; + } + + public String getSupportStandardEquipmentNo() { + return supportStandardEquipmentNo; + } + + public void setSupportStandardEquipmentNo(String supportStandardEquipmentNo) { + this.supportStandardEquipmentNo = supportStandardEquipmentNo; + } + + public String getTechnicalLevel() { + return technicalLevel; + } + + public void setTechnicalLevel(String technicalLevel) { + this.technicalLevel = technicalLevel; + } + + public String getUncertainty() { + return uncertainty; + } + + public void setUncertainty(String uncertainty) { + this.uncertainty = uncertainty; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getUseDept() { + return useDept; + } + + public void setUseDept(String useDept) { + this.useDept = useDept; + } + + public String getUseDeptName() { + return useDeptName; + } + + public void setUseDeptName(String useDeptName) { + this.useDeptName = useDeptName; + } + + public String getUsePerson() { + return usePerson; + } + + public void setUsePerson(String usePerson) { + this.usePerson = usePerson; + } + + public String getUsePersonName() { + return usePersonName; + } + + public void setUsePersonName(String usePersonName) { + this.usePersonName = usePersonName; + } + + public String getValidDate() { + return validDate; + } + + public void setValidDate(String validDate) { + this.validDate = validDate; + } + + public int getVersion() { + return version; + } + + public void setVersion(int version) { + this.version = version; + } + + public String getWeight() { + return weight; + } + + public void setWeight(String weight) { + this.weight = weight; + } + + public static class FileListModel { + private String assetId; + private String createTime; + private String createUser; + private String fileName; + private String id; + private int isDel; + private String minioFileName; + private String remark; + private String updateTime; + + public String getAssetId() { + return assetId; + } + + public void setAssetId(String assetId) { + this.assetId = assetId; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getFileName() { + return fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getMinioFileName() { + return minioFileName; + } + + public void setMinioFileName(String minioFileName) { + this.minioFileName = minioFileName; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + } + } +} diff --git a/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java b/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java new file mode 100644 index 0000000..15fc128 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java @@ -0,0 +1,697 @@ +package com.casic.xz.meterage.model; + +import java.util.List; + +public class EquipmentListModel { + + private int code; + private DataModel data; + private String message; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataModel getData() { + return data; + } + + public void setData(DataModel data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public static class DataModel { + private List rows; + private int total; + + public List getRows() { + return rows; + } + + public void setRows(List rows) { + this.rows = rows; + } + + public int getTotal() { + return total; + } + + public void setTotal(int total) { + this.total = total; + } + + public static class RowsModel { + private String abc; + private String abcName; + private String assetNo; + private String assetSource; + private String assetType; + private String assetTypeName; + private String attribute; + private String capitalSource; + private String capitalSourceName; + private String cardEstablishmentDate; + private String createTime; + private String createUser; + private String depreciationMethod; + private String depreciationMethodName; + private String depreciationPeriod; + private String enableDate; + private String equipmentCategory; + private String equipmentCategoryName; + private String equipmentName; + private String equipmentNo; + private String equipmentSpecifications; + private String equipmentType; + private String equipmentTypeName; + private String fileList; + private String id; + private String installIncidentalExpenses; + private String installPlace; + private String intactState; + private String isCalibrationTestEquipment; + private int isDel; + private String isFixedAssets; + private String isMeasureAccount; + private String isStandardSupportEquipment; + private String labelBind; + private String majorCategory; + private String majorCategoryName; + private String managerLevel; + private String managerLevelName; + private String managerState; + private String managerStateName; + private String manufacturer; + private String manufacturerCountry; + private String manufacturingDate; + private String manufacturingNo; + private String mesureCycle; + private String mesureDate; + private String mesureDept; + private String mesureRange; + private String mesureResult; + private String mesureResultName; + private String mesureType; + private String mesureTypeName; + private String modelNo; + private String originValue; + private String overallDimension; + private String presentOriginValue; + private String purpose; + private String remark; + private String singlePrice; + private String supportStandardEquipmentName; + private String supportStandardEquipmentNo; + private String technicalLevel; + private String uncertainty; + private String updateTime; + private String useDept; + private String useDeptName; + private String usePerson; + private String usePersonName; + private String validDate; + private int version; + private String weight; + + public String getAbc() { + return abc; + } + + public void setAbc(String abc) { + this.abc = abc; + } + + public String getAbcName() { + return abcName; + } + + public void setAbcName(String abcName) { + this.abcName = abcName; + } + + public String getAssetNo() { + return assetNo; + } + + public void setAssetNo(String assetNo) { + this.assetNo = assetNo; + } + + public String getAssetSource() { + return assetSource; + } + + public void setAssetSource(String assetSource) { + this.assetSource = assetSource; + } + + public String getAssetType() { + return assetType; + } + + public void setAssetType(String assetType) { + this.assetType = assetType; + } + + public String getAssetTypeName() { + return assetTypeName; + } + + public void setAssetTypeName(String assetTypeName) { + this.assetTypeName = assetTypeName; + } + + public String getAttribute() { + return attribute; + } + + public void setAttribute(String attribute) { + this.attribute = attribute; + } + + public String getCapitalSource() { + return capitalSource; + } + + public void setCapitalSource(String capitalSource) { + this.capitalSource = capitalSource; + } + + public String getCapitalSourceName() { + return capitalSourceName; + } + + public void setCapitalSourceName(String capitalSourceName) { + this.capitalSourceName = capitalSourceName; + } + + public String getCardEstablishmentDate() { + return cardEstablishmentDate; + } + + public void setCardEstablishmentDate(String cardEstablishmentDate) { + this.cardEstablishmentDate = cardEstablishmentDate; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getDepreciationMethod() { + return depreciationMethod; + } + + public void setDepreciationMethod(String depreciationMethod) { + this.depreciationMethod = depreciationMethod; + } + + public String getDepreciationMethodName() { + return depreciationMethodName; + } + + public void setDepreciationMethodName(String depreciationMethodName) { + this.depreciationMethodName = depreciationMethodName; + } + + public String getDepreciationPeriod() { + return depreciationPeriod; + } + + public void setDepreciationPeriod(String depreciationPeriod) { + this.depreciationPeriod = depreciationPeriod; + } + + public String getEnableDate() { + return enableDate; + } + + public void setEnableDate(String enableDate) { + this.enableDate = enableDate; + } + + public String getEquipmentCategory() { + return equipmentCategory; + } + + public void setEquipmentCategory(String equipmentCategory) { + this.equipmentCategory = equipmentCategory; + } + + public String getEquipmentCategoryName() { + return equipmentCategoryName; + } + + public void setEquipmentCategoryName(String equipmentCategoryName) { + this.equipmentCategoryName = equipmentCategoryName; + } + + public String getEquipmentName() { + return equipmentName; + } + + public void setEquipmentName(String equipmentName) { + this.equipmentName = equipmentName; + } + + public String getEquipmentNo() { + return equipmentNo; + } + + public void setEquipmentNo(String equipmentNo) { + this.equipmentNo = equipmentNo; + } + + public String getEquipmentSpecifications() { + return equipmentSpecifications; + } + + public void setEquipmentSpecifications(String equipmentSpecifications) { + this.equipmentSpecifications = equipmentSpecifications; + } + + public String getEquipmentType() { + return equipmentType; + } + + public void setEquipmentType(String equipmentType) { + this.equipmentType = equipmentType; + } + + public String getEquipmentTypeName() { + return equipmentTypeName; + } + + public void setEquipmentTypeName(String equipmentTypeName) { + this.equipmentTypeName = equipmentTypeName; + } + + public String getFileList() { + return fileList; + } + + public void setFileList(String fileList) { + this.fileList = fileList; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getInstallIncidentalExpenses() { + return installIncidentalExpenses; + } + + public void setInstallIncidentalExpenses(String installIncidentalExpenses) { + this.installIncidentalExpenses = installIncidentalExpenses; + } + + public String getInstallPlace() { + return installPlace; + } + + public void setInstallPlace(String installPlace) { + this.installPlace = installPlace; + } + + public String getIntactState() { + return intactState; + } + + public void setIntactState(String intactState) { + this.intactState = intactState; + } + + public String getIsCalibrationTestEquipment() { + return isCalibrationTestEquipment; + } + + public void setIsCalibrationTestEquipment(String isCalibrationTestEquipment) { + this.isCalibrationTestEquipment = isCalibrationTestEquipment; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getIsFixedAssets() { + return isFixedAssets; + } + + public void setIsFixedAssets(String isFixedAssets) { + this.isFixedAssets = isFixedAssets; + } + + public String getIsMeasureAccount() { + return isMeasureAccount; + } + + public void setIsMeasureAccount(String isMeasureAccount) { + this.isMeasureAccount = isMeasureAccount; + } + + public String getIsStandardSupportEquipment() { + return isStandardSupportEquipment; + } + + public void setIsStandardSupportEquipment(String isStandardSupportEquipment) { + this.isStandardSupportEquipment = isStandardSupportEquipment; + } + + public String getLabelBind() { + return labelBind; + } + + public void setLabelBind(String labelBind) { + this.labelBind = labelBind; + } + + public String getMajorCategory() { + return majorCategory; + } + + public void setMajorCategory(String majorCategory) { + this.majorCategory = majorCategory; + } + + public String getMajorCategoryName() { + return majorCategoryName; + } + + public void setMajorCategoryName(String majorCategoryName) { + this.majorCategoryName = majorCategoryName; + } + + public String getManagerLevel() { + return managerLevel; + } + + public void setManagerLevel(String managerLevel) { + this.managerLevel = managerLevel; + } + + public String getManagerLevelName() { + return managerLevelName; + } + + public void setManagerLevelName(String managerLevelName) { + this.managerLevelName = managerLevelName; + } + + public String getManagerState() { + return managerState; + } + + public void setManagerState(String managerState) { + this.managerState = managerState; + } + + public String getManagerStateName() { + return managerStateName; + } + + public void setManagerStateName(String managerStateName) { + this.managerStateName = managerStateName; + } + + public String getManufacturer() { + return manufacturer; + } + + public void setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + } + + public String getManufacturerCountry() { + return manufacturerCountry; + } + + public void setManufacturerCountry(String manufacturerCountry) { + this.manufacturerCountry = manufacturerCountry; + } + + public String getManufacturingDate() { + return manufacturingDate; + } + + public void setManufacturingDate(String manufacturingDate) { + this.manufacturingDate = manufacturingDate; + } + + public String getManufacturingNo() { + return manufacturingNo; + } + + public void setManufacturingNo(String manufacturingNo) { + this.manufacturingNo = manufacturingNo; + } + + public String getMesureCycle() { + return mesureCycle; + } + + public void setMesureCycle(String mesureCycle) { + this.mesureCycle = mesureCycle; + } + + public String getMesureDate() { + return mesureDate; + } + + public void setMesureDate(String mesureDate) { + this.mesureDate = mesureDate; + } + + public String getMesureDept() { + return mesureDept; + } + + public void setMesureDept(String mesureDept) { + this.mesureDept = mesureDept; + } + + public String getMesureRange() { + return mesureRange; + } + + public void setMesureRange(String mesureRange) { + this.mesureRange = mesureRange; + } + + public String getMesureResult() { + return mesureResult; + } + + public void setMesureResult(String mesureResult) { + this.mesureResult = mesureResult; + } + + public String getMesureResultName() { + return mesureResultName; + } + + public void setMesureResultName(String mesureResultName) { + this.mesureResultName = mesureResultName; + } + + public String getMesureType() { + return mesureType; + } + + public void setMesureType(String mesureType) { + this.mesureType = mesureType; + } + + public String getMesureTypeName() { + return mesureTypeName; + } + + public void setMesureTypeName(String mesureTypeName) { + this.mesureTypeName = mesureTypeName; + } + + public String getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getOriginValue() { + return originValue; + } + + public void setOriginValue(String originValue) { + this.originValue = originValue; + } + + public String getOverallDimension() { + return overallDimension; + } + + public void setOverallDimension(String overallDimension) { + this.overallDimension = overallDimension; + } + + public String getPresentOriginValue() { + return presentOriginValue; + } + + public void setPresentOriginValue(String presentOriginValue) { + this.presentOriginValue = presentOriginValue; + } + + public String getPurpose() { + return purpose; + } + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getSinglePrice() { + return singlePrice; + } + + public void setSinglePrice(String singlePrice) { + this.singlePrice = singlePrice; + } + + public String getSupportStandardEquipmentName() { + return supportStandardEquipmentName; + } + + public void setSupportStandardEquipmentName(String supportStandardEquipmentName) { + this.supportStandardEquipmentName = supportStandardEquipmentName; + } + + public String getSupportStandardEquipmentNo() { + return supportStandardEquipmentNo; + } + + public void setSupportStandardEquipmentNo(String supportStandardEquipmentNo) { + this.supportStandardEquipmentNo = supportStandardEquipmentNo; + } + + public String getTechnicalLevel() { + return technicalLevel; + } + + public void setTechnicalLevel(String technicalLevel) { + this.technicalLevel = technicalLevel; + } + + public String getUncertainty() { + return uncertainty; + } + + public void setUncertainty(String uncertainty) { + this.uncertainty = uncertainty; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getUseDept() { + return useDept; + } + + public void setUseDept(String useDept) { + this.useDept = useDept; + } + + public String getUseDeptName() { + return useDeptName; + } + + public void setUseDeptName(String useDeptName) { + this.useDeptName = useDeptName; + } + + public String getUsePerson() { + return usePerson; + } + + public void setUsePerson(String usePerson) { + this.usePerson = usePerson; + } + + public String getUsePersonName() { + return usePersonName; + } + + public void setUsePersonName(String usePersonName) { + this.usePersonName = usePersonName; + } + + public String getValidDate() { + return validDate; + } + + public void setValidDate(String validDate) { + this.validDate = validDate; + } + + public int getVersion() { + return version; + } + + public void setVersion(int version) { + this.version = version; + } + + public String getWeight() { + return weight; + } + + public void setWeight(String weight) { + this.weight = weight; + } + } + } +} diff --git a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt index a3f514f..46e5eef 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt @@ -35,4 +35,24 @@ @QueryMap limit: Map, @QueryMap offset: Map ): String + + /** + * 获取设备列表 + */ + @POST("/meter/assets/listPage") + suspend fun getEquipmentList( + @Header("token") token: String, + @Body requestBody: RequestBody, + @QueryMap limit: Map, + @QueryMap offset: Map + ): String + + /** + * 获取设备详情 + */ + @POST("/meter/assets/detail") + suspend fun getEquipmentDetail( + @Header("token") token: String, + @Body requestBody: RequestBody + ): String } \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt index 444a872..386a1d8 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt @@ -6,8 +6,10 @@ import com.pengxh.kt.lite.utils.SaveKeyValues import okhttp3.MediaType.Companion.toMediaType import okhttp3.RequestBody.Companion.toRequestBody +import org.json.JSONArray import org.json.JSONObject + object RetrofitServiceManager { private val api by lazy { @@ -73,4 +75,71 @@ offsetMap["offset"] = offset return api.getNoticeList(AuthenticationHelper.token!!, requestBody, limitMap, offsetMap) } + + /** + * 获取设备列表 + */ + suspend fun getEquipmentList( + equipmentNo: String, + equipmentName: String, + mesureType: String, + managerState: String, + useDept: String, + assetType: String, + equipmentCategory: String, + isCalibrationTestEquipment: String, + isMeasureAccount: String, + isStandardSupportEquipment: String, + isFixedAssets: String, + validStartDate: String, + validEndDate: String, + abc: String, + ids: Array, + offset: Int + ): String { + val paramObject = JSONObject() + paramObject.put("equipmentNo", equipmentNo) + paramObject.put("equipmentName", equipmentName) + paramObject.put("mesureType", mesureType) + paramObject.put("managerState", managerState) + paramObject.put("useDept", useDept) + paramObject.put("assetType", assetType) + paramObject.put("equipmentCategory", equipmentCategory) + paramObject.put("isCalibrationTestEquipment", isCalibrationTestEquipment) + paramObject.put("isMeasureAccount", isMeasureAccount) + paramObject.put("isStandardSupportEquipment", isStandardSupportEquipment) + paramObject.put("isFixedAssets", isFixedAssets) + paramObject.put("validStartDate", validStartDate) + paramObject.put("validEndDate", validEndDate) + paramObject.put("abc", abc) + + val jsonArray = JSONArray() + ids.forEach { + jsonArray.put(it) + } + paramObject.put("ids", jsonArray) + + val requestBody = paramObject.toString().toRequestBody( + "application/json;charset=UTF-8".toMediaType() + ) + + val limitMap = HashMap() + limitMap["limit"] = LocaleConstant.PAGE_LIMIT + + val offsetMap = HashMap() + offsetMap["offset"] = offset + return api.getEquipmentList(AuthenticationHelper.token!!, requestBody, limitMap, offsetMap) + } + + /** + * 获取设备详情 + */ + suspend fun getEquipmentDetail(id: String): String { + val paramObject = JSONObject() + paramObject.put("id", id) + val requestBody = paramObject.toString().toRequestBody( + "application/json;charset=UTF-8".toMediaType() + ) + return api.getEquipmentDetail(AuthenticationHelper.token!!, requestBody) + } } \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt deleted file mode 100644 index a5bb60b..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt +++ /dev/null @@ -1,104 +0,0 @@ -package com.casic.xz.meterage.view - -import android.annotation.SuppressLint -import android.graphics.Paint -import androidx.lifecycle.ViewModelProvider -import com.casic.xz.meterage.R -import com.casic.xz.meterage.extensions.combineImagePath -import com.casic.xz.meterage.extensions.formatTextFromHtml -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.vm.NoticeViewModel -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.extensions.convertColor -import com.pengxh.kt.lite.extensions.navigatePageTo -import com.pengxh.kt.lite.extensions.obtainScreenWidth -import com.pengxh.kt.lite.extensions.show -import com.pengxh.kt.lite.utils.Constant -import kotlinx.android.synthetic.main.activity_notice_detail.* -import kotlinx.android.synthetic.main.include_base_title.* -import java.util.* - -@SuppressLint("SetTextI18n") -class NoticeDetailActivity : KotlinBaseActivity() { - - private lateinit var noticeViewModel: NoticeViewModel - - override fun initData() { - leftBackView.setOnClickListener { finish() } - titleView.text = "通知公告" - - val args = intent.getStringArrayListExtra(Constant.INTENT_PARAM)!! - - noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] - noticeViewModel.getNoticeList(args[0], args[1], args[2], "", "", 1) - noticeViewModel.noticeResult.observe(this, { - if (it.code == 200) { - val dataRow = it.data?.rows!![0] - - noticeDateView.text = dataRow.noticeTime - noticePublisherView.text = "发布人 ${dataRow.noticePublisher}" - noticeCompanyView.text = "发布单位 ${dataRow.noticeCompany}" - - noticeNoView.text = dataRow.noticeNo - noticeTitleView.text = dataRow.noticeTitle - noticeSketchView.text = dataRow.noticeSketch - - dataRow.noticeContent.formatTextFromHtml( - this, noticeContentView, obtainScreenWidth() - ) - - if (dataRow.minioFileName.isNullOrBlank()) { - minioFileView.text = "暂无附件" - } else { - val minioFileName = dataRow.minioFileName - - minioFileView.text = minioFileName - val textPaint = minioFileView.paint - textPaint.flags = Paint.UNDERLINE_TEXT_FLAG - textPaint.isAntiAlias = true - minioFileView.setTextColor(R.color.themeColor.convertColor(this)) - - minioFileView.setOnClickListener { - //查看附件 - if (minioFileName.endsWith("pdf")) { - navigatePageTo(minioFileName) - } else if ( - minioFileName.endsWith("doc") || - minioFileName.endsWith("docx") - ) { - navigatePageTo(minioFileName) - } else if (minioFileName.endsWith("txt")) { - navigatePageTo(minioFileName) - } else if ( - minioFileName.endsWith("png") || - minioFileName.endsWith("jpeg") || - minioFileName.endsWith("jpg") - ) { - val urls = ArrayList() - urls.add(minioFileName.combineImagePath()) - navigatePageTo(0, urls) - } else { - "文件类型未知,无法打开附件".show(this) - } - } - } - } - }) - } - - override fun initEvent() { - - } - - override fun initLayoutView(): Int = R.layout.activity_notice_detail - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/NoticeListActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/NoticeListActivity.kt deleted file mode 100644 index 15f6a16..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/NoticeListActivity.kt +++ /dev/null @@ -1,180 +0,0 @@ -package com.casic.xz.meterage.view - -import android.os.Handler -import android.util.Log -import android.view.View -import androidx.lifecycle.ViewModelProvider -import com.casic.xz.meterage.R -import com.casic.xz.meterage.adapter.NoticeListAdapter -import com.casic.xz.meterage.extensions.addAll -import com.casic.xz.meterage.extensions.combineFilePath -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.extensions.showEmptyPage -import com.casic.xz.meterage.model.NoticeListModel -import com.casic.xz.meterage.vm.NoticeViewModel -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.extensions.navigatePageTo -import com.pengxh.kt.lite.extensions.show -import com.pengxh.kt.lite.utils.WeakReferenceHandler -import com.pengxh.kt.lite.widget.dialog.AlertControlDialog -import kotlinx.android.synthetic.main.activity_notice_list.* -import kotlinx.android.synthetic.main.include_empty_view.* - -class NoticeListActivity : KotlinBaseActivity() { - - private lateinit var weakReferenceHandler: WeakReferenceHandler - private lateinit var noticeViewModel: NoticeViewModel - private lateinit var noticeListAdapter: NoticeListAdapter - private var dataBeans: MutableList = ArrayList() - private var pageIndex = 1 - private var isRefresh = false - private var isLoadMore = false - - override fun initData() { - weakReferenceHandler = WeakReferenceHandler(callback) - noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] - noticeViewModel.noticeResult.observe(this, { - if (it.code == 200) { - val dataRows = it.data?.rows!! -// countBadeNumber(dataRows) - when { - isRefresh -> { - dataBeans.clear() - dataBeans = dataRows - noticeLayout.finishRefresh() - isRefresh = false - } - isLoadMore -> { - if (dataRows.size == 0) { - "到底了,别拉了".show(this) - } - dataBeans.addAll(dataRows) - noticeLayout.finishLoadMore() - isLoadMore = false - } - else -> { - dataBeans = dataRows - } - } - weakReferenceHandler.sendEmptyMessage(2023013101) - } - }) - } - - override fun initEvent() { - leftBackView.setOnClickListener { finish() } - rightOperateView.setOnClickListener { - AlertControlDialog.Builder() - .setContext(this) - .setTitle("提示") - .setMessage("确定将所有未读消息标为已读?") - .setNegativeButton("取消") - .setPositiveButton("确定") - .setOnDialogButtonClickListener(object : - AlertControlDialog.OnDialogButtonClickListener { - override fun onCancelClick() { - - } - - override fun onConfirmClick() { - //TODO 设置为已读 - } - }).build().show() - } - - if (hasNoticePermission()) { - openSystemNoticeLayout.visibility = View.GONE - openSystemNoticeLayout.visibility = View.GONE - } else { - openSystemNoticeLayout.setOnClickListener { - - } - - - closeLayoutView.setOnClickListener { - openSystemNoticeLayout.visibility = View.GONE - } - } - - noticeLayout.setOnRefreshListener { - isRefresh = true - //刷新之后页码重置 - pageIndex = 1 - getNoticeListByPage() - } - - noticeLayout.setOnLoadMoreListener { - isLoadMore = true - pageIndex++ - getNoticeListByPage() - } - } - - override fun onResume() { - super.onResume() - pageIndex = 1 - getNoticeListByPage() - } - - private fun getNoticeListByPage() { - noticeViewModel.getNoticeList("", "", "", "", "", pageIndex) - } - - private val callback = Handler.Callback { - when (it.what) { - 2023013101 -> { - if (isRefresh || isLoadMore) { - noticeListAdapter.notifyDataSetChanged() - } else { - if (dataBeans.size == 0) { - emptyView!!.showEmptyPage("没有任何消息") { - pageIndex = 1 - getNoticeListByPage() - } - } else { - emptyView!!.hide() - noticeListAdapter = NoticeListAdapter(this, dataBeans) - noticeRecyclerView.adapter = noticeListAdapter - noticeListAdapter.setOnItemClickListener(object : - NoticeListAdapter.OnItemClickListener { - override fun onItemClicked(position: Int) { - val rowsModel = dataBeans[position] - val allArgs = addAll( - rowsModel.noticeNo, - rowsModel.noticeTitle, - rowsModel.noticePublisher, - "", - "" - ) - Log.d( - "Casic", - "NoticeListActivity => onItemClicked: ${rowsModel.minioFileName.combineFilePath()}" - ) - navigatePageTo(allArgs) - } - }) - } - } - } - } - true - } - - //TODO 判断是否开启通知权限 - private fun hasNoticePermission(): Boolean { - - return false - } - - override fun initLayoutView(): Int = R.layout.activity_notice_list - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/PreviewDocumentActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/PreviewDocumentActivity.kt deleted file mode 100644 index e233ddc..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/PreviewDocumentActivity.kt +++ /dev/null @@ -1,24 +0,0 @@ -package com.casic.xz.meterage.view - -import com.casic.xz.meterage.R -import com.pengxh.kt.lite.base.KotlinBaseActivity - -class PreviewDocumentActivity : KotlinBaseActivity() { - override fun initData() { - - } - - override fun initEvent() { - - } - - override fun initLayoutView(): Int = R.layout.activity_preview_doc - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/PreviewPdfActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/PreviewPdfActivity.kt deleted file mode 100644 index 39f8ac2..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/PreviewPdfActivity.kt +++ /dev/null @@ -1,62 +0,0 @@ -package com.casic.xz.meterage.view - -import com.casic.xz.meterage.R -import com.casic.xz.meterage.extensions.combineFilePath -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.utils.LoadingDialogHub -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.callback.OnDownloadListener -import com.pengxh.kt.lite.extensions.createDownloadFileDir -import com.pengxh.kt.lite.extensions.downloadFile -import com.pengxh.kt.lite.utils.Constant -import kotlinx.android.synthetic.main.activity_preview_pdf.* -import kotlinx.android.synthetic.main.include_base_title.* -import java.io.File -import java.io.FileInputStream - - -class PreviewPdfActivity : KotlinBaseActivity() { - - override fun initData() { - val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! - titleView.text = minioFileName - - val url = minioFileName.combineFilePath() - url.downloadFile(createDownloadFileDir().toString(), - object : OnDownloadListener { - override fun onDownloadStart(totalBytes: Long) { - runOnUiThread { - LoadingDialogHub.show(this@PreviewPdfActivity, "附件加载中") - } - } - - override fun onProgressChanged(currentBytes: Long) { - - } - - override fun onDownloadEnd(file: File?) { - runOnUiThread { - LoadingDialogHub.dismiss() - } - val inputStream = FileInputStream(file) - pdfView.fromStream(inputStream).load() - } - }) - } - - override fun initEvent() { - leftBackView.setOnClickListener { finish() } - } - - override fun initLayoutView(): Int = R.layout.activity_preview_pdf - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/PreviewTextActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/PreviewTextActivity.kt deleted file mode 100644 index d634ca3..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/PreviewTextActivity.kt +++ /dev/null @@ -1,60 +0,0 @@ -package com.casic.xz.meterage.view - -import com.casic.xz.meterage.R -import com.casic.xz.meterage.extensions.combineFilePath -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.utils.LoadingDialogHub -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.callback.OnDownloadListener -import com.pengxh.kt.lite.extensions.createDownloadFileDir -import com.pengxh.kt.lite.extensions.downloadFile -import com.pengxh.kt.lite.extensions.read -import com.pengxh.kt.lite.utils.Constant -import kotlinx.android.synthetic.main.activity_preview_txt.* -import kotlinx.android.synthetic.main.include_base_title.* -import java.io.File - -class PreviewTextActivity : KotlinBaseActivity() { - - override fun initData() { - val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! - titleView.text = minioFileName - - val url = minioFileName.combineFilePath() - url.downloadFile(createDownloadFileDir().toString(), - object : OnDownloadListener { - override fun onDownloadStart(totalBytes: Long) { - runOnUiThread { - LoadingDialogHub.show(this@PreviewTextActivity, "附件加载中") - } - } - - override fun onProgressChanged(currentBytes: Long) { - - } - - override fun onDownloadEnd(file: File?) { - runOnUiThread { - LoadingDialogHub.dismiss() - textView.text = file?.read() - } - } - }) - } - - override fun initEvent() { - leftBackView.setOnClickListener { finish() } - } - - override fun initLayoutView(): Int = R.layout.activity_preview_txt - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 3892b5a..02160cd 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -34,16 +34,18 @@ - - - - - - - + + + + + + + + + +) : RecyclerView.Adapter() { + + private var layoutInflater: LayoutInflater = LayoutInflater.from(context) + + override fun getItemCount(): Int = dataRows.size + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = ItemViewHolder( + layoutInflater.inflate(R.layout.item_equipment_rv_l, parent, false) + ) + + override fun onBindViewHolder(holder: ItemViewHolder, position: Int) { + //绑定数据 + val rowsBean = dataRows[position] + holder.equipmentNameView.text = rowsBean.equipmentName + holder.equipmentCodeView.text = rowsBean.equipmentNo + holder.equipmentDateView.text = rowsBean.enableDate + holder.equipmentLibView.text = rowsBean.useDeptName + + //绑定事件 + holder.itemView.setOnClickListener { + listener?.onItemClicked(position) + } + } + + inner class ItemViewHolder(view: View) : RecyclerView.ViewHolder(view) { + var equipmentNameView: TextView = view.findViewById(R.id.equipmentNameView) + var equipmentCodeView: TextView = view.findViewById(R.id.equipmentCodeView) + var equipmentDateView: TextView = view.findViewById(R.id.equipmentDateView) + var equipmentLibView: TextView = view.findViewById(R.id.equipmentLibView) + } + + private var listener: OnItemClickListener? = null + + interface OnItemClickListener { + fun onItemClicked(position: Int) + } + + fun setOnItemClickListener(onClickListener: OnItemClickListener?) { + this.listener = onClickListener + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt index b4628f3..d970b55 100644 --- a/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt +++ b/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt @@ -5,7 +5,8 @@ import com.casic.xz.meterage.R import com.casic.xz.meterage.adapter.HomeGridAdapter import com.casic.xz.meterage.utils.LocaleConstant -import com.casic.xz.meterage.view.NoticeListActivity +import com.casic.xz.meterage.view.home.EquipmentActivity +import com.casic.xz.meterage.view.notice.NoticeListActivity import com.casic.xz.meterage.vm.NoticeViewModel import com.pengxh.kt.lite.base.KotlinBaseFragment import com.pengxh.kt.lite.extensions.navigatePageTo @@ -36,8 +37,19 @@ homeFuncRecyclerView.adapter = homeAdapter homeAdapter.setOnGridItemClickListener(object : HomeGridAdapter.OnGridItemClickListener { override fun onItemClick(position: Int) { - when (position) { - + when (LocaleConstant.HOME_FUNC_OPERATE[position]) { + "仪器设备" -> requireContext().navigatePageTo() +// "标准装置" -> requireContext().navigatePageTo() +// "证书报告" -> requireContext().navigatePageTo() +// "委托需求" -> requireContext().navigatePageTo() +// "访客" -> requireContext().navigatePageTo() +// "标准规范" -> requireContext().navigatePageTo() +// "能力列表" -> requireContext().navigatePageTo() +// "计量培训" -> requireContext().navigatePageTo() +// "合同发票" -> requireContext().navigatePageTo() +// "业务统计" -> requireContext().navigatePageTo() +// "客户列表" -> requireContext().navigatePageTo() +// "外场检测" -> requireContext().navigatePageTo() } } }) diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt index 7e75abe..56dc5ec 100644 --- a/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt +++ b/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt @@ -2,9 +2,11 @@ import android.view.View import androidx.lifecycle.ViewModelProvider +import com.bumptech.glide.Glide +import com.bumptech.glide.request.RequestOptions import com.casic.xz.meterage.R import com.casic.xz.meterage.utils.LocaleConstant -import com.casic.xz.meterage.view.NoticeListActivity +import com.casic.xz.meterage.view.notice.NoticeListActivity import com.casic.xz.meterage.vm.NoticeViewModel import com.casic.xz.meterage.vm.UserViewModel import com.pengxh.kt.lite.base.KotlinBaseFragment @@ -23,6 +25,12 @@ val data = it.data userNameView.text = data.name userUnitView.text = data.deptName + +// Glide.with(requireContext()) +// .load(R.mipmap.default_avatar) +// .apply(RequestOptions.circleCropTransform()) +// .placeholder(R.mipmap.load_image_error) +// .into(userAvatarView) } }) diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt new file mode 100644 index 0000000..cf22646 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt @@ -0,0 +1,103 @@ +package com.casic.xz.meterage.fragment.equipment + +import android.graphics.Paint +import androidx.lifecycle.ViewModelProvider +import com.casic.xz.meterage.R +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.casic.xz.meterage.vm.EquipmentViewModel +import com.pengxh.kt.lite.base.KotlinBaseFragment +import com.pengxh.kt.lite.extensions.convertColor +import com.pengxh.kt.lite.vm.LoadState +import kotlinx.android.synthetic.main.fragment_basic_information.* + +class BasicInformationFragment(private val id: String) : KotlinBaseFragment() { + + private lateinit var equipmentViewModel: EquipmentViewModel + + override fun initData() { + equipmentViewModel = ViewModelProvider(this)[EquipmentViewModel::class.java] + equipmentViewModel.getEquipmentDetail(id) + equipmentViewModel.equipmentDetailResult.observe(this, { + if (it.code == 200) { + val data = it.data!! + + equipmentCodeView.text = data.equipmentNo + equipmentNameView.text = data.equipmentName + manufacturerView.text = data.manufacturer + factoryNumberView.text = data.manufacturingNo + modelView.text = data.modelNo + verificationMethodView.text = data.mesureTypeName + measuringRangeView.text = data.mesureRange + uncertaintyView.text = data.uncertainty + firstUseView.text = data.createTime + originalValueView.text = data.originValue + usageDeptView.text = data.useDeptName + userView.text = data.usePersonName + managementStatusView.text = data.managerStateName + verificationDeptView.text = data.useDeptName +// nextVerificationDeptView.text = data. + verificationPeriodView.text = data.mesureCycle + verificationDateView.text = data.mesureDate + effectiveDateView.text = data.validDate + verificationResultsView.text = data.mesureResultName + abcView.text = data.abcName + isNeedTechnicalView.text = if ( + data.isCalibrationTestEquipment.isNullOrBlank() || data.isCalibrationTestEquipment == "0" + ) { + "否" + } else { + "是" + } + + isStandingBook.text = if ( + data.isMeasureAccount.isNullOrBlank() || data.isMeasureAccount == "0" + ) { + "否" + } else { + "是" + } + + isStandardView.text = if ( + data.isStandardSupportEquipment.isNullOrBlank() || data.isStandardSupportEquipment == "0" + ) { + "否" + } else { + "是" + } + remarkView.text = data.remark + if (data.fileList.size == 0) { + instructionsView.text = "暂无" + } else { + instructionsView.text = "查看附件列表" + val textPaint = instructionsView.paint + textPaint.flags = Paint.UNDERLINE_TEXT_FLAG + textPaint.isAntiAlias = true + instructionsView.setTextColor(R.color.themeColor.convertColor(requireContext())) + + instructionsView.setOnClickListener { + + } + } + } + }) + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_basic_information + + override fun observeRequestState() { + equipmentViewModel.loadState.observe(this, { + when (it) { + LoadState.Loading -> LoadingDialogHub.show(requireActivity(), "数据加载中...") + else -> LoadingDialogHub.dismiss() + } + }) + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt new file mode 100644 index 0000000..0b4a747 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class CertificateFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_certificate + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt new file mode 100644 index 0000000..f05c491 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class ChangeRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_change_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt new file mode 100644 index 0000000..849ffa5 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class InspectionRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_inspection_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt new file mode 100644 index 0000000..aa4edd9 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class UsageRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_usage_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java b/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java new file mode 100644 index 0000000..0b9124e --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java @@ -0,0 +1,760 @@ +package com.casic.xz.meterage.model; + +import java.util.List; + +public class EquipmentDetailModel { + + private int code; + private DataModel data; + private String message; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataModel getData() { + return data; + } + + public void setData(DataModel data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public static class DataModel { + private String abc; + private String abcName; + private String assetNo; + private String assetSource; + private String assetType; + private String assetTypeName; + private String attribute; + private String capitalSource; + private String capitalSourceName; + private String cardEstablishmentDate; + private String createTime; + private String createUser; + private String depreciationMethod; + private String depreciationMethodName; + private String depreciationPeriod; + private String enableDate; + private String equipmentCategory; + private String equipmentCategoryName; + private String equipmentName; + private String equipmentNo; + private String equipmentSpecifications; + private String equipmentType; + private String equipmentTypeName; + private List fileList; + private String id; + private String installIncidentalExpenses; + private String installPlace; + private String intactState; + private String isCalibrationTestEquipment; + private int isDel; + private String isFixedAssets; + private String isMeasureAccount; + private String isStandardSupportEquipment; + private String labelBind; + private String majorCategory; + private String majorCategoryName; + private String managerLevel; + private String managerLevelName; + private String managerState; + private String managerStateName; + private String manufacturer; + private String manufacturerCountry; + private String manufacturingDate; + private String manufacturingNo; + private String mesureCycle; + private String mesureDate; + private String mesureDept; + private String mesureRange; + private String mesureResult; + private String mesureResultName; + private String mesureType; + private String mesureTypeName; + private String modelNo; + private String originValue; + private String overallDimension; + private String presentOriginValue; + private String purpose; + private String remark; + private String singlePrice; + private String supportStandardEquipmentName; + private String supportStandardEquipmentNo; + private String technicalLevel; + private String uncertainty; + private String updateTime; + private String useDept; + private String useDeptName; + private String usePerson; + private String usePersonName; + private String validDate; + private int version; + private String weight; + + public String getAbc() { + return abc; + } + + public void setAbc(String abc) { + this.abc = abc; + } + + public String getAbcName() { + return abcName; + } + + public void setAbcName(String abcName) { + this.abcName = abcName; + } + + public String getAssetNo() { + return assetNo; + } + + public void setAssetNo(String assetNo) { + this.assetNo = assetNo; + } + + public String getAssetSource() { + return assetSource; + } + + public void setAssetSource(String assetSource) { + this.assetSource = assetSource; + } + + public String getAssetType() { + return assetType; + } + + public void setAssetType(String assetType) { + this.assetType = assetType; + } + + public String getAssetTypeName() { + return assetTypeName; + } + + public void setAssetTypeName(String assetTypeName) { + this.assetTypeName = assetTypeName; + } + + public String getAttribute() { + return attribute; + } + + public void setAttribute(String attribute) { + this.attribute = attribute; + } + + public String getCapitalSource() { + return capitalSource; + } + + public void setCapitalSource(String capitalSource) { + this.capitalSource = capitalSource; + } + + public String getCapitalSourceName() { + return capitalSourceName; + } + + public void setCapitalSourceName(String capitalSourceName) { + this.capitalSourceName = capitalSourceName; + } + + public String getCardEstablishmentDate() { + return cardEstablishmentDate; + } + + public void setCardEstablishmentDate(String cardEstablishmentDate) { + this.cardEstablishmentDate = cardEstablishmentDate; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getDepreciationMethod() { + return depreciationMethod; + } + + public void setDepreciationMethod(String depreciationMethod) { + this.depreciationMethod = depreciationMethod; + } + + public String getDepreciationMethodName() { + return depreciationMethodName; + } + + public void setDepreciationMethodName(String depreciationMethodName) { + this.depreciationMethodName = depreciationMethodName; + } + + public String getDepreciationPeriod() { + return depreciationPeriod; + } + + public void setDepreciationPeriod(String depreciationPeriod) { + this.depreciationPeriod = depreciationPeriod; + } + + public String getEnableDate() { + return enableDate; + } + + public void setEnableDate(String enableDate) { + this.enableDate = enableDate; + } + + public String getEquipmentCategory() { + return equipmentCategory; + } + + public void setEquipmentCategory(String equipmentCategory) { + this.equipmentCategory = equipmentCategory; + } + + public String getEquipmentCategoryName() { + return equipmentCategoryName; + } + + public void setEquipmentCategoryName(String equipmentCategoryName) { + this.equipmentCategoryName = equipmentCategoryName; + } + + public String getEquipmentName() { + return equipmentName; + } + + public void setEquipmentName(String equipmentName) { + this.equipmentName = equipmentName; + } + + public String getEquipmentNo() { + return equipmentNo; + } + + public void setEquipmentNo(String equipmentNo) { + this.equipmentNo = equipmentNo; + } + + public String getEquipmentSpecifications() { + return equipmentSpecifications; + } + + public void setEquipmentSpecifications(String equipmentSpecifications) { + this.equipmentSpecifications = equipmentSpecifications; + } + + public String getEquipmentType() { + return equipmentType; + } + + public void setEquipmentType(String equipmentType) { + this.equipmentType = equipmentType; + } + + public String getEquipmentTypeName() { + return equipmentTypeName; + } + + public void setEquipmentTypeName(String equipmentTypeName) { + this.equipmentTypeName = equipmentTypeName; + } + + public List getFileList() { + return fileList; + } + + public void setFileList(List fileList) { + this.fileList = fileList; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getInstallIncidentalExpenses() { + return installIncidentalExpenses; + } + + public void setInstallIncidentalExpenses(String installIncidentalExpenses) { + this.installIncidentalExpenses = installIncidentalExpenses; + } + + public String getInstallPlace() { + return installPlace; + } + + public void setInstallPlace(String installPlace) { + this.installPlace = installPlace; + } + + public String getIntactState() { + return intactState; + } + + public void setIntactState(String intactState) { + this.intactState = intactState; + } + + public String getIsCalibrationTestEquipment() { + return isCalibrationTestEquipment; + } + + public void setIsCalibrationTestEquipment(String isCalibrationTestEquipment) { + this.isCalibrationTestEquipment = isCalibrationTestEquipment; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getIsFixedAssets() { + return isFixedAssets; + } + + public void setIsFixedAssets(String isFixedAssets) { + this.isFixedAssets = isFixedAssets; + } + + public String getIsMeasureAccount() { + return isMeasureAccount; + } + + public void setIsMeasureAccount(String isMeasureAccount) { + this.isMeasureAccount = isMeasureAccount; + } + + public String getIsStandardSupportEquipment() { + return isStandardSupportEquipment; + } + + public void setIsStandardSupportEquipment(String isStandardSupportEquipment) { + this.isStandardSupportEquipment = isStandardSupportEquipment; + } + + public String getLabelBind() { + return labelBind; + } + + public void setLabelBind(String labelBind) { + this.labelBind = labelBind; + } + + public String getMajorCategory() { + return majorCategory; + } + + public void setMajorCategory(String majorCategory) { + this.majorCategory = majorCategory; + } + + public String getMajorCategoryName() { + return majorCategoryName; + } + + public void setMajorCategoryName(String majorCategoryName) { + this.majorCategoryName = majorCategoryName; + } + + public String getManagerLevel() { + return managerLevel; + } + + public void setManagerLevel(String managerLevel) { + this.managerLevel = managerLevel; + } + + public String getManagerLevelName() { + return managerLevelName; + } + + public void setManagerLevelName(String managerLevelName) { + this.managerLevelName = managerLevelName; + } + + public String getManagerState() { + return managerState; + } + + public void setManagerState(String managerState) { + this.managerState = managerState; + } + + public String getManagerStateName() { + return managerStateName; + } + + public void setManagerStateName(String managerStateName) { + this.managerStateName = managerStateName; + } + + public String getManufacturer() { + return manufacturer; + } + + public void setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + } + + public String getManufacturerCountry() { + return manufacturerCountry; + } + + public void setManufacturerCountry(String manufacturerCountry) { + this.manufacturerCountry = manufacturerCountry; + } + + public String getManufacturingDate() { + return manufacturingDate; + } + + public void setManufacturingDate(String manufacturingDate) { + this.manufacturingDate = manufacturingDate; + } + + public String getManufacturingNo() { + return manufacturingNo; + } + + public void setManufacturingNo(String manufacturingNo) { + this.manufacturingNo = manufacturingNo; + } + + public String getMesureCycle() { + return mesureCycle; + } + + public void setMesureCycle(String mesureCycle) { + this.mesureCycle = mesureCycle; + } + + public String getMesureDate() { + return mesureDate; + } + + public void setMesureDate(String mesureDate) { + this.mesureDate = mesureDate; + } + + public String getMesureDept() { + return mesureDept; + } + + public void setMesureDept(String mesureDept) { + this.mesureDept = mesureDept; + } + + public String getMesureRange() { + return mesureRange; + } + + public void setMesureRange(String mesureRange) { + this.mesureRange = mesureRange; + } + + public String getMesureResult() { + return mesureResult; + } + + public void setMesureResult(String mesureResult) { + this.mesureResult = mesureResult; + } + + public String getMesureResultName() { + return mesureResultName; + } + + public void setMesureResultName(String mesureResultName) { + this.mesureResultName = mesureResultName; + } + + public String getMesureType() { + return mesureType; + } + + public void setMesureType(String mesureType) { + this.mesureType = mesureType; + } + + public String getMesureTypeName() { + return mesureTypeName; + } + + public void setMesureTypeName(String mesureTypeName) { + this.mesureTypeName = mesureTypeName; + } + + public String getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getOriginValue() { + return originValue; + } + + public void setOriginValue(String originValue) { + this.originValue = originValue; + } + + public String getOverallDimension() { + return overallDimension; + } + + public void setOverallDimension(String overallDimension) { + this.overallDimension = overallDimension; + } + + public String getPresentOriginValue() { + return presentOriginValue; + } + + public void setPresentOriginValue(String presentOriginValue) { + this.presentOriginValue = presentOriginValue; + } + + public String getPurpose() { + return purpose; + } + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getSinglePrice() { + return singlePrice; + } + + public void setSinglePrice(String singlePrice) { + this.singlePrice = singlePrice; + } + + public String getSupportStandardEquipmentName() { + return supportStandardEquipmentName; + } + + public void setSupportStandardEquipmentName(String supportStandardEquipmentName) { + this.supportStandardEquipmentName = supportStandardEquipmentName; + } + + public String getSupportStandardEquipmentNo() { + return supportStandardEquipmentNo; + } + + public void setSupportStandardEquipmentNo(String supportStandardEquipmentNo) { + this.supportStandardEquipmentNo = supportStandardEquipmentNo; + } + + public String getTechnicalLevel() { + return technicalLevel; + } + + public void setTechnicalLevel(String technicalLevel) { + this.technicalLevel = technicalLevel; + } + + public String getUncertainty() { + return uncertainty; + } + + public void setUncertainty(String uncertainty) { + this.uncertainty = uncertainty; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getUseDept() { + return useDept; + } + + public void setUseDept(String useDept) { + this.useDept = useDept; + } + + public String getUseDeptName() { + return useDeptName; + } + + public void setUseDeptName(String useDeptName) { + this.useDeptName = useDeptName; + } + + public String getUsePerson() { + return usePerson; + } + + public void setUsePerson(String usePerson) { + this.usePerson = usePerson; + } + + public String getUsePersonName() { + return usePersonName; + } + + public void setUsePersonName(String usePersonName) { + this.usePersonName = usePersonName; + } + + public String getValidDate() { + return validDate; + } + + public void setValidDate(String validDate) { + this.validDate = validDate; + } + + public int getVersion() { + return version; + } + + public void setVersion(int version) { + this.version = version; + } + + public String getWeight() { + return weight; + } + + public void setWeight(String weight) { + this.weight = weight; + } + + public static class FileListModel { + private String assetId; + private String createTime; + private String createUser; + private String fileName; + private String id; + private int isDel; + private String minioFileName; + private String remark; + private String updateTime; + + public String getAssetId() { + return assetId; + } + + public void setAssetId(String assetId) { + this.assetId = assetId; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getFileName() { + return fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getMinioFileName() { + return minioFileName; + } + + public void setMinioFileName(String minioFileName) { + this.minioFileName = minioFileName; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + } + } +} diff --git a/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java b/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java new file mode 100644 index 0000000..15fc128 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java @@ -0,0 +1,697 @@ +package com.casic.xz.meterage.model; + +import java.util.List; + +public class EquipmentListModel { + + private int code; + private DataModel data; + private String message; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataModel getData() { + return data; + } + + public void setData(DataModel data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public static class DataModel { + private List rows; + private int total; + + public List getRows() { + return rows; + } + + public void setRows(List rows) { + this.rows = rows; + } + + public int getTotal() { + return total; + } + + public void setTotal(int total) { + this.total = total; + } + + public static class RowsModel { + private String abc; + private String abcName; + private String assetNo; + private String assetSource; + private String assetType; + private String assetTypeName; + private String attribute; + private String capitalSource; + private String capitalSourceName; + private String cardEstablishmentDate; + private String createTime; + private String createUser; + private String depreciationMethod; + private String depreciationMethodName; + private String depreciationPeriod; + private String enableDate; + private String equipmentCategory; + private String equipmentCategoryName; + private String equipmentName; + private String equipmentNo; + private String equipmentSpecifications; + private String equipmentType; + private String equipmentTypeName; + private String fileList; + private String id; + private String installIncidentalExpenses; + private String installPlace; + private String intactState; + private String isCalibrationTestEquipment; + private int isDel; + private String isFixedAssets; + private String isMeasureAccount; + private String isStandardSupportEquipment; + private String labelBind; + private String majorCategory; + private String majorCategoryName; + private String managerLevel; + private String managerLevelName; + private String managerState; + private String managerStateName; + private String manufacturer; + private String manufacturerCountry; + private String manufacturingDate; + private String manufacturingNo; + private String mesureCycle; + private String mesureDate; + private String mesureDept; + private String mesureRange; + private String mesureResult; + private String mesureResultName; + private String mesureType; + private String mesureTypeName; + private String modelNo; + private String originValue; + private String overallDimension; + private String presentOriginValue; + private String purpose; + private String remark; + private String singlePrice; + private String supportStandardEquipmentName; + private String supportStandardEquipmentNo; + private String technicalLevel; + private String uncertainty; + private String updateTime; + private String useDept; + private String useDeptName; + private String usePerson; + private String usePersonName; + private String validDate; + private int version; + private String weight; + + public String getAbc() { + return abc; + } + + public void setAbc(String abc) { + this.abc = abc; + } + + public String getAbcName() { + return abcName; + } + + public void setAbcName(String abcName) { + this.abcName = abcName; + } + + public String getAssetNo() { + return assetNo; + } + + public void setAssetNo(String assetNo) { + this.assetNo = assetNo; + } + + public String getAssetSource() { + return assetSource; + } + + public void setAssetSource(String assetSource) { + this.assetSource = assetSource; + } + + public String getAssetType() { + return assetType; + } + + public void setAssetType(String assetType) { + this.assetType = assetType; + } + + public String getAssetTypeName() { + return assetTypeName; + } + + public void setAssetTypeName(String assetTypeName) { + this.assetTypeName = assetTypeName; + } + + public String getAttribute() { + return attribute; + } + + public void setAttribute(String attribute) { + this.attribute = attribute; + } + + public String getCapitalSource() { + return capitalSource; + } + + public void setCapitalSource(String capitalSource) { + this.capitalSource = capitalSource; + } + + public String getCapitalSourceName() { + return capitalSourceName; + } + + public void setCapitalSourceName(String capitalSourceName) { + this.capitalSourceName = capitalSourceName; + } + + public String getCardEstablishmentDate() { + return cardEstablishmentDate; + } + + public void setCardEstablishmentDate(String cardEstablishmentDate) { + this.cardEstablishmentDate = cardEstablishmentDate; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getDepreciationMethod() { + return depreciationMethod; + } + + public void setDepreciationMethod(String depreciationMethod) { + this.depreciationMethod = depreciationMethod; + } + + public String getDepreciationMethodName() { + return depreciationMethodName; + } + + public void setDepreciationMethodName(String depreciationMethodName) { + this.depreciationMethodName = depreciationMethodName; + } + + public String getDepreciationPeriod() { + return depreciationPeriod; + } + + public void setDepreciationPeriod(String depreciationPeriod) { + this.depreciationPeriod = depreciationPeriod; + } + + public String getEnableDate() { + return enableDate; + } + + public void setEnableDate(String enableDate) { + this.enableDate = enableDate; + } + + public String getEquipmentCategory() { + return equipmentCategory; + } + + public void setEquipmentCategory(String equipmentCategory) { + this.equipmentCategory = equipmentCategory; + } + + public String getEquipmentCategoryName() { + return equipmentCategoryName; + } + + public void setEquipmentCategoryName(String equipmentCategoryName) { + this.equipmentCategoryName = equipmentCategoryName; + } + + public String getEquipmentName() { + return equipmentName; + } + + public void setEquipmentName(String equipmentName) { + this.equipmentName = equipmentName; + } + + public String getEquipmentNo() { + return equipmentNo; + } + + public void setEquipmentNo(String equipmentNo) { + this.equipmentNo = equipmentNo; + } + + public String getEquipmentSpecifications() { + return equipmentSpecifications; + } + + public void setEquipmentSpecifications(String equipmentSpecifications) { + this.equipmentSpecifications = equipmentSpecifications; + } + + public String getEquipmentType() { + return equipmentType; + } + + public void setEquipmentType(String equipmentType) { + this.equipmentType = equipmentType; + } + + public String getEquipmentTypeName() { + return equipmentTypeName; + } + + public void setEquipmentTypeName(String equipmentTypeName) { + this.equipmentTypeName = equipmentTypeName; + } + + public String getFileList() { + return fileList; + } + + public void setFileList(String fileList) { + this.fileList = fileList; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getInstallIncidentalExpenses() { + return installIncidentalExpenses; + } + + public void setInstallIncidentalExpenses(String installIncidentalExpenses) { + this.installIncidentalExpenses = installIncidentalExpenses; + } + + public String getInstallPlace() { + return installPlace; + } + + public void setInstallPlace(String installPlace) { + this.installPlace = installPlace; + } + + public String getIntactState() { + return intactState; + } + + public void setIntactState(String intactState) { + this.intactState = intactState; + } + + public String getIsCalibrationTestEquipment() { + return isCalibrationTestEquipment; + } + + public void setIsCalibrationTestEquipment(String isCalibrationTestEquipment) { + this.isCalibrationTestEquipment = isCalibrationTestEquipment; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getIsFixedAssets() { + return isFixedAssets; + } + + public void setIsFixedAssets(String isFixedAssets) { + this.isFixedAssets = isFixedAssets; + } + + public String getIsMeasureAccount() { + return isMeasureAccount; + } + + public void setIsMeasureAccount(String isMeasureAccount) { + this.isMeasureAccount = isMeasureAccount; + } + + public String getIsStandardSupportEquipment() { + return isStandardSupportEquipment; + } + + public void setIsStandardSupportEquipment(String isStandardSupportEquipment) { + this.isStandardSupportEquipment = isStandardSupportEquipment; + } + + public String getLabelBind() { + return labelBind; + } + + public void setLabelBind(String labelBind) { + this.labelBind = labelBind; + } + + public String getMajorCategory() { + return majorCategory; + } + + public void setMajorCategory(String majorCategory) { + this.majorCategory = majorCategory; + } + + public String getMajorCategoryName() { + return majorCategoryName; + } + + public void setMajorCategoryName(String majorCategoryName) { + this.majorCategoryName = majorCategoryName; + } + + public String getManagerLevel() { + return managerLevel; + } + + public void setManagerLevel(String managerLevel) { + this.managerLevel = managerLevel; + } + + public String getManagerLevelName() { + return managerLevelName; + } + + public void setManagerLevelName(String managerLevelName) { + this.managerLevelName = managerLevelName; + } + + public String getManagerState() { + return managerState; + } + + public void setManagerState(String managerState) { + this.managerState = managerState; + } + + public String getManagerStateName() { + return managerStateName; + } + + public void setManagerStateName(String managerStateName) { + this.managerStateName = managerStateName; + } + + public String getManufacturer() { + return manufacturer; + } + + public void setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + } + + public String getManufacturerCountry() { + return manufacturerCountry; + } + + public void setManufacturerCountry(String manufacturerCountry) { + this.manufacturerCountry = manufacturerCountry; + } + + public String getManufacturingDate() { + return manufacturingDate; + } + + public void setManufacturingDate(String manufacturingDate) { + this.manufacturingDate = manufacturingDate; + } + + public String getManufacturingNo() { + return manufacturingNo; + } + + public void setManufacturingNo(String manufacturingNo) { + this.manufacturingNo = manufacturingNo; + } + + public String getMesureCycle() { + return mesureCycle; + } + + public void setMesureCycle(String mesureCycle) { + this.mesureCycle = mesureCycle; + } + + public String getMesureDate() { + return mesureDate; + } + + public void setMesureDate(String mesureDate) { + this.mesureDate = mesureDate; + } + + public String getMesureDept() { + return mesureDept; + } + + public void setMesureDept(String mesureDept) { + this.mesureDept = mesureDept; + } + + public String getMesureRange() { + return mesureRange; + } + + public void setMesureRange(String mesureRange) { + this.mesureRange = mesureRange; + } + + public String getMesureResult() { + return mesureResult; + } + + public void setMesureResult(String mesureResult) { + this.mesureResult = mesureResult; + } + + public String getMesureResultName() { + return mesureResultName; + } + + public void setMesureResultName(String mesureResultName) { + this.mesureResultName = mesureResultName; + } + + public String getMesureType() { + return mesureType; + } + + public void setMesureType(String mesureType) { + this.mesureType = mesureType; + } + + public String getMesureTypeName() { + return mesureTypeName; + } + + public void setMesureTypeName(String mesureTypeName) { + this.mesureTypeName = mesureTypeName; + } + + public String getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getOriginValue() { + return originValue; + } + + public void setOriginValue(String originValue) { + this.originValue = originValue; + } + + public String getOverallDimension() { + return overallDimension; + } + + public void setOverallDimension(String overallDimension) { + this.overallDimension = overallDimension; + } + + public String getPresentOriginValue() { + return presentOriginValue; + } + + public void setPresentOriginValue(String presentOriginValue) { + this.presentOriginValue = presentOriginValue; + } + + public String getPurpose() { + return purpose; + } + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getSinglePrice() { + return singlePrice; + } + + public void setSinglePrice(String singlePrice) { + this.singlePrice = singlePrice; + } + + public String getSupportStandardEquipmentName() { + return supportStandardEquipmentName; + } + + public void setSupportStandardEquipmentName(String supportStandardEquipmentName) { + this.supportStandardEquipmentName = supportStandardEquipmentName; + } + + public String getSupportStandardEquipmentNo() { + return supportStandardEquipmentNo; + } + + public void setSupportStandardEquipmentNo(String supportStandardEquipmentNo) { + this.supportStandardEquipmentNo = supportStandardEquipmentNo; + } + + public String getTechnicalLevel() { + return technicalLevel; + } + + public void setTechnicalLevel(String technicalLevel) { + this.technicalLevel = technicalLevel; + } + + public String getUncertainty() { + return uncertainty; + } + + public void setUncertainty(String uncertainty) { + this.uncertainty = uncertainty; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getUseDept() { + return useDept; + } + + public void setUseDept(String useDept) { + this.useDept = useDept; + } + + public String getUseDeptName() { + return useDeptName; + } + + public void setUseDeptName(String useDeptName) { + this.useDeptName = useDeptName; + } + + public String getUsePerson() { + return usePerson; + } + + public void setUsePerson(String usePerson) { + this.usePerson = usePerson; + } + + public String getUsePersonName() { + return usePersonName; + } + + public void setUsePersonName(String usePersonName) { + this.usePersonName = usePersonName; + } + + public String getValidDate() { + return validDate; + } + + public void setValidDate(String validDate) { + this.validDate = validDate; + } + + public int getVersion() { + return version; + } + + public void setVersion(int version) { + this.version = version; + } + + public String getWeight() { + return weight; + } + + public void setWeight(String weight) { + this.weight = weight; + } + } + } +} diff --git a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt index a3f514f..46e5eef 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt @@ -35,4 +35,24 @@ @QueryMap limit: Map, @QueryMap offset: Map ): String + + /** + * 获取设备列表 + */ + @POST("/meter/assets/listPage") + suspend fun getEquipmentList( + @Header("token") token: String, + @Body requestBody: RequestBody, + @QueryMap limit: Map, + @QueryMap offset: Map + ): String + + /** + * 获取设备详情 + */ + @POST("/meter/assets/detail") + suspend fun getEquipmentDetail( + @Header("token") token: String, + @Body requestBody: RequestBody + ): String } \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt index 444a872..386a1d8 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt @@ -6,8 +6,10 @@ import com.pengxh.kt.lite.utils.SaveKeyValues import okhttp3.MediaType.Companion.toMediaType import okhttp3.RequestBody.Companion.toRequestBody +import org.json.JSONArray import org.json.JSONObject + object RetrofitServiceManager { private val api by lazy { @@ -73,4 +75,71 @@ offsetMap["offset"] = offset return api.getNoticeList(AuthenticationHelper.token!!, requestBody, limitMap, offsetMap) } + + /** + * 获取设备列表 + */ + suspend fun getEquipmentList( + equipmentNo: String, + equipmentName: String, + mesureType: String, + managerState: String, + useDept: String, + assetType: String, + equipmentCategory: String, + isCalibrationTestEquipment: String, + isMeasureAccount: String, + isStandardSupportEquipment: String, + isFixedAssets: String, + validStartDate: String, + validEndDate: String, + abc: String, + ids: Array, + offset: Int + ): String { + val paramObject = JSONObject() + paramObject.put("equipmentNo", equipmentNo) + paramObject.put("equipmentName", equipmentName) + paramObject.put("mesureType", mesureType) + paramObject.put("managerState", managerState) + paramObject.put("useDept", useDept) + paramObject.put("assetType", assetType) + paramObject.put("equipmentCategory", equipmentCategory) + paramObject.put("isCalibrationTestEquipment", isCalibrationTestEquipment) + paramObject.put("isMeasureAccount", isMeasureAccount) + paramObject.put("isStandardSupportEquipment", isStandardSupportEquipment) + paramObject.put("isFixedAssets", isFixedAssets) + paramObject.put("validStartDate", validStartDate) + paramObject.put("validEndDate", validEndDate) + paramObject.put("abc", abc) + + val jsonArray = JSONArray() + ids.forEach { + jsonArray.put(it) + } + paramObject.put("ids", jsonArray) + + val requestBody = paramObject.toString().toRequestBody( + "application/json;charset=UTF-8".toMediaType() + ) + + val limitMap = HashMap() + limitMap["limit"] = LocaleConstant.PAGE_LIMIT + + val offsetMap = HashMap() + offsetMap["offset"] = offset + return api.getEquipmentList(AuthenticationHelper.token!!, requestBody, limitMap, offsetMap) + } + + /** + * 获取设备详情 + */ + suspend fun getEquipmentDetail(id: String): String { + val paramObject = JSONObject() + paramObject.put("id", id) + val requestBody = paramObject.toString().toRequestBody( + "application/json;charset=UTF-8".toMediaType() + ) + return api.getEquipmentDetail(AuthenticationHelper.token!!, requestBody) + } } \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt deleted file mode 100644 index a5bb60b..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt +++ /dev/null @@ -1,104 +0,0 @@ -package com.casic.xz.meterage.view - -import android.annotation.SuppressLint -import android.graphics.Paint -import androidx.lifecycle.ViewModelProvider -import com.casic.xz.meterage.R -import com.casic.xz.meterage.extensions.combineImagePath -import com.casic.xz.meterage.extensions.formatTextFromHtml -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.vm.NoticeViewModel -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.extensions.convertColor -import com.pengxh.kt.lite.extensions.navigatePageTo -import com.pengxh.kt.lite.extensions.obtainScreenWidth -import com.pengxh.kt.lite.extensions.show -import com.pengxh.kt.lite.utils.Constant -import kotlinx.android.synthetic.main.activity_notice_detail.* -import kotlinx.android.synthetic.main.include_base_title.* -import java.util.* - -@SuppressLint("SetTextI18n") -class NoticeDetailActivity : KotlinBaseActivity() { - - private lateinit var noticeViewModel: NoticeViewModel - - override fun initData() { - leftBackView.setOnClickListener { finish() } - titleView.text = "通知公告" - - val args = intent.getStringArrayListExtra(Constant.INTENT_PARAM)!! - - noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] - noticeViewModel.getNoticeList(args[0], args[1], args[2], "", "", 1) - noticeViewModel.noticeResult.observe(this, { - if (it.code == 200) { - val dataRow = it.data?.rows!![0] - - noticeDateView.text = dataRow.noticeTime - noticePublisherView.text = "发布人 ${dataRow.noticePublisher}" - noticeCompanyView.text = "发布单位 ${dataRow.noticeCompany}" - - noticeNoView.text = dataRow.noticeNo - noticeTitleView.text = dataRow.noticeTitle - noticeSketchView.text = dataRow.noticeSketch - - dataRow.noticeContent.formatTextFromHtml( - this, noticeContentView, obtainScreenWidth() - ) - - if (dataRow.minioFileName.isNullOrBlank()) { - minioFileView.text = "暂无附件" - } else { - val minioFileName = dataRow.minioFileName - - minioFileView.text = minioFileName - val textPaint = minioFileView.paint - textPaint.flags = Paint.UNDERLINE_TEXT_FLAG - textPaint.isAntiAlias = true - minioFileView.setTextColor(R.color.themeColor.convertColor(this)) - - minioFileView.setOnClickListener { - //查看附件 - if (minioFileName.endsWith("pdf")) { - navigatePageTo(minioFileName) - } else if ( - minioFileName.endsWith("doc") || - minioFileName.endsWith("docx") - ) { - navigatePageTo(minioFileName) - } else if (minioFileName.endsWith("txt")) { - navigatePageTo(minioFileName) - } else if ( - minioFileName.endsWith("png") || - minioFileName.endsWith("jpeg") || - minioFileName.endsWith("jpg") - ) { - val urls = ArrayList() - urls.add(minioFileName.combineImagePath()) - navigatePageTo(0, urls) - } else { - "文件类型未知,无法打开附件".show(this) - } - } - } - } - }) - } - - override fun initEvent() { - - } - - override fun initLayoutView(): Int = R.layout.activity_notice_detail - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/NoticeListActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/NoticeListActivity.kt deleted file mode 100644 index 15f6a16..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/NoticeListActivity.kt +++ /dev/null @@ -1,180 +0,0 @@ -package com.casic.xz.meterage.view - -import android.os.Handler -import android.util.Log -import android.view.View -import androidx.lifecycle.ViewModelProvider -import com.casic.xz.meterage.R -import com.casic.xz.meterage.adapter.NoticeListAdapter -import com.casic.xz.meterage.extensions.addAll -import com.casic.xz.meterage.extensions.combineFilePath -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.extensions.showEmptyPage -import com.casic.xz.meterage.model.NoticeListModel -import com.casic.xz.meterage.vm.NoticeViewModel -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.extensions.navigatePageTo -import com.pengxh.kt.lite.extensions.show -import com.pengxh.kt.lite.utils.WeakReferenceHandler -import com.pengxh.kt.lite.widget.dialog.AlertControlDialog -import kotlinx.android.synthetic.main.activity_notice_list.* -import kotlinx.android.synthetic.main.include_empty_view.* - -class NoticeListActivity : KotlinBaseActivity() { - - private lateinit var weakReferenceHandler: WeakReferenceHandler - private lateinit var noticeViewModel: NoticeViewModel - private lateinit var noticeListAdapter: NoticeListAdapter - private var dataBeans: MutableList = ArrayList() - private var pageIndex = 1 - private var isRefresh = false - private var isLoadMore = false - - override fun initData() { - weakReferenceHandler = WeakReferenceHandler(callback) - noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] - noticeViewModel.noticeResult.observe(this, { - if (it.code == 200) { - val dataRows = it.data?.rows!! -// countBadeNumber(dataRows) - when { - isRefresh -> { - dataBeans.clear() - dataBeans = dataRows - noticeLayout.finishRefresh() - isRefresh = false - } - isLoadMore -> { - if (dataRows.size == 0) { - "到底了,别拉了".show(this) - } - dataBeans.addAll(dataRows) - noticeLayout.finishLoadMore() - isLoadMore = false - } - else -> { - dataBeans = dataRows - } - } - weakReferenceHandler.sendEmptyMessage(2023013101) - } - }) - } - - override fun initEvent() { - leftBackView.setOnClickListener { finish() } - rightOperateView.setOnClickListener { - AlertControlDialog.Builder() - .setContext(this) - .setTitle("提示") - .setMessage("确定将所有未读消息标为已读?") - .setNegativeButton("取消") - .setPositiveButton("确定") - .setOnDialogButtonClickListener(object : - AlertControlDialog.OnDialogButtonClickListener { - override fun onCancelClick() { - - } - - override fun onConfirmClick() { - //TODO 设置为已读 - } - }).build().show() - } - - if (hasNoticePermission()) { - openSystemNoticeLayout.visibility = View.GONE - openSystemNoticeLayout.visibility = View.GONE - } else { - openSystemNoticeLayout.setOnClickListener { - - } - - - closeLayoutView.setOnClickListener { - openSystemNoticeLayout.visibility = View.GONE - } - } - - noticeLayout.setOnRefreshListener { - isRefresh = true - //刷新之后页码重置 - pageIndex = 1 - getNoticeListByPage() - } - - noticeLayout.setOnLoadMoreListener { - isLoadMore = true - pageIndex++ - getNoticeListByPage() - } - } - - override fun onResume() { - super.onResume() - pageIndex = 1 - getNoticeListByPage() - } - - private fun getNoticeListByPage() { - noticeViewModel.getNoticeList("", "", "", "", "", pageIndex) - } - - private val callback = Handler.Callback { - when (it.what) { - 2023013101 -> { - if (isRefresh || isLoadMore) { - noticeListAdapter.notifyDataSetChanged() - } else { - if (dataBeans.size == 0) { - emptyView!!.showEmptyPage("没有任何消息") { - pageIndex = 1 - getNoticeListByPage() - } - } else { - emptyView!!.hide() - noticeListAdapter = NoticeListAdapter(this, dataBeans) - noticeRecyclerView.adapter = noticeListAdapter - noticeListAdapter.setOnItemClickListener(object : - NoticeListAdapter.OnItemClickListener { - override fun onItemClicked(position: Int) { - val rowsModel = dataBeans[position] - val allArgs = addAll( - rowsModel.noticeNo, - rowsModel.noticeTitle, - rowsModel.noticePublisher, - "", - "" - ) - Log.d( - "Casic", - "NoticeListActivity => onItemClicked: ${rowsModel.minioFileName.combineFilePath()}" - ) - navigatePageTo(allArgs) - } - }) - } - } - } - } - true - } - - //TODO 判断是否开启通知权限 - private fun hasNoticePermission(): Boolean { - - return false - } - - override fun initLayoutView(): Int = R.layout.activity_notice_list - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/PreviewDocumentActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/PreviewDocumentActivity.kt deleted file mode 100644 index e233ddc..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/PreviewDocumentActivity.kt +++ /dev/null @@ -1,24 +0,0 @@ -package com.casic.xz.meterage.view - -import com.casic.xz.meterage.R -import com.pengxh.kt.lite.base.KotlinBaseActivity - -class PreviewDocumentActivity : KotlinBaseActivity() { - override fun initData() { - - } - - override fun initEvent() { - - } - - override fun initLayoutView(): Int = R.layout.activity_preview_doc - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/PreviewPdfActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/PreviewPdfActivity.kt deleted file mode 100644 index 39f8ac2..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/PreviewPdfActivity.kt +++ /dev/null @@ -1,62 +0,0 @@ -package com.casic.xz.meterage.view - -import com.casic.xz.meterage.R -import com.casic.xz.meterage.extensions.combineFilePath -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.utils.LoadingDialogHub -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.callback.OnDownloadListener -import com.pengxh.kt.lite.extensions.createDownloadFileDir -import com.pengxh.kt.lite.extensions.downloadFile -import com.pengxh.kt.lite.utils.Constant -import kotlinx.android.synthetic.main.activity_preview_pdf.* -import kotlinx.android.synthetic.main.include_base_title.* -import java.io.File -import java.io.FileInputStream - - -class PreviewPdfActivity : KotlinBaseActivity() { - - override fun initData() { - val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! - titleView.text = minioFileName - - val url = minioFileName.combineFilePath() - url.downloadFile(createDownloadFileDir().toString(), - object : OnDownloadListener { - override fun onDownloadStart(totalBytes: Long) { - runOnUiThread { - LoadingDialogHub.show(this@PreviewPdfActivity, "附件加载中") - } - } - - override fun onProgressChanged(currentBytes: Long) { - - } - - override fun onDownloadEnd(file: File?) { - runOnUiThread { - LoadingDialogHub.dismiss() - } - val inputStream = FileInputStream(file) - pdfView.fromStream(inputStream).load() - } - }) - } - - override fun initEvent() { - leftBackView.setOnClickListener { finish() } - } - - override fun initLayoutView(): Int = R.layout.activity_preview_pdf - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/PreviewTextActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/PreviewTextActivity.kt deleted file mode 100644 index d634ca3..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/PreviewTextActivity.kt +++ /dev/null @@ -1,60 +0,0 @@ -package com.casic.xz.meterage.view - -import com.casic.xz.meterage.R -import com.casic.xz.meterage.extensions.combineFilePath -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.utils.LoadingDialogHub -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.callback.OnDownloadListener -import com.pengxh.kt.lite.extensions.createDownloadFileDir -import com.pengxh.kt.lite.extensions.downloadFile -import com.pengxh.kt.lite.extensions.read -import com.pengxh.kt.lite.utils.Constant -import kotlinx.android.synthetic.main.activity_preview_txt.* -import kotlinx.android.synthetic.main.include_base_title.* -import java.io.File - -class PreviewTextActivity : KotlinBaseActivity() { - - override fun initData() { - val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! - titleView.text = minioFileName - - val url = minioFileName.combineFilePath() - url.downloadFile(createDownloadFileDir().toString(), - object : OnDownloadListener { - override fun onDownloadStart(totalBytes: Long) { - runOnUiThread { - LoadingDialogHub.show(this@PreviewTextActivity, "附件加载中") - } - } - - override fun onProgressChanged(currentBytes: Long) { - - } - - override fun onDownloadEnd(file: File?) { - runOnUiThread { - LoadingDialogHub.dismiss() - textView.text = file?.read() - } - } - }) - } - - override fun initEvent() { - leftBackView.setOnClickListener { finish() } - } - - override fun initLayoutView(): Int = R.layout.activity_preview_txt - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentActivity.kt new file mode 100644 index 0000000..35ca098 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentActivity.kt @@ -0,0 +1,158 @@ +package com.casic.xz.meterage.view.home + +import android.os.Handler +import androidx.lifecycle.ViewModelProvider +import androidx.recyclerview.widget.DividerItemDecoration +import com.casic.xz.meterage.R +import com.casic.xz.meterage.adapter.EquipmentListAdapter +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.extensions.showEmptyPage +import com.casic.xz.meterage.model.EquipmentListModel +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.casic.xz.meterage.vm.EquipmentViewModel +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.extensions.navigatePageTo +import com.pengxh.kt.lite.extensions.show +import com.pengxh.kt.lite.utils.WeakReferenceHandler +import com.pengxh.kt.lite.vm.LoadState +import kotlinx.android.synthetic.main.activity_equipment.* +import kotlinx.android.synthetic.main.include_empty_view.* +import kotlinx.android.synthetic.main.include_search_title.* + +class EquipmentActivity : KotlinBaseActivity() { + + private lateinit var weakReferenceHandler: WeakReferenceHandler + private lateinit var equipmentViewModel: EquipmentViewModel + private lateinit var equipmentListAdapter: EquipmentListAdapter + private var dataBeans: MutableList = ArrayList() + private var pageIndex = 1 + private var isRefresh = false + private var isLoadMore = false + + override fun initData() { + weakReferenceHandler = WeakReferenceHandler(callback) + equipmentViewModel = ViewModelProvider(this)[EquipmentViewModel::class.java] + equipmentViewModel.equipmentResult.observe(this, { + if (it.code == 200) { + val dataRows = it.data?.rows!! + when { + isRefresh -> { + dataBeans.clear() + dataBeans = dataRows + equipmentLayout.finishRefresh() + isRefresh = false + } + isLoadMore -> { + if (dataRows.size == 0) { + "到底了,别拉了".show(this) + } + dataBeans.addAll(dataRows) + equipmentLayout.finishLoadMore() + isLoadMore = false + } + else -> { + dataBeans = dataRows + } + } + weakReferenceHandler.sendEmptyMessage(2023020801) + } + }) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + rightOperateView.setOnClickListener { + + } + + equipmentLayout.setOnRefreshListener { + isRefresh = true + //刷新之后页码重置 + pageIndex = 1 + getEquipmentListByPage() + } + + equipmentLayout.setOnLoadMoreListener { + isLoadMore = true + pageIndex++ + getEquipmentListByPage() + } + } + + override fun initLayoutView(): Int = R.layout.activity_equipment + + override fun observeRequestState() { + equipmentViewModel.loadState.observe(this, { + when (it) { + LoadState.Loading -> LoadingDialogHub.show(this, "数据加载中...") + else -> LoadingDialogHub.dismiss() + } + }) + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + titleView.text = "仪器设备" + } + + override fun onResume() { + super.onResume() + pageIndex = 1 + getEquipmentListByPage() + } + + private fun getEquipmentListByPage() { + equipmentViewModel.getEquipmentList( + "", + "", + "", + "", + "", + "1", + "", + "", + "", + "", + "", + "", + "", + "", + arrayOf(), + pageIndex + ) + } + + private val callback = Handler.Callback { + when (it.what) { + 2023020801 -> { + if (isRefresh || isLoadMore) { + equipmentListAdapter.notifyDataSetChanged() + } else { + if (dataBeans.size == 0) { + emptyView!!.showEmptyPage("无设备") { + pageIndex = 1 + getEquipmentListByPage() + } + } else { + emptyView!!.hide() + equipmentListAdapter = EquipmentListAdapter(this, dataBeans) + equipmentRecyclerView.addItemDecoration( + DividerItemDecoration(this, DividerItemDecoration.VERTICAL) + ) + equipmentRecyclerView.adapter = equipmentListAdapter + equipmentListAdapter.setOnItemClickListener(object : + EquipmentListAdapter.OnItemClickListener { + override fun onItemClicked(position: Int) { + val rowsModel = dataBeans[position] + navigatePageTo(rowsModel.id) + } + }) + } + } + } + } + true + } +} \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 3892b5a..02160cd 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -34,16 +34,18 @@ - - - - - - - + + + + + + + + + +) : RecyclerView.Adapter() { + + private var layoutInflater: LayoutInflater = LayoutInflater.from(context) + + override fun getItemCount(): Int = dataRows.size + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = ItemViewHolder( + layoutInflater.inflate(R.layout.item_equipment_rv_l, parent, false) + ) + + override fun onBindViewHolder(holder: ItemViewHolder, position: Int) { + //绑定数据 + val rowsBean = dataRows[position] + holder.equipmentNameView.text = rowsBean.equipmentName + holder.equipmentCodeView.text = rowsBean.equipmentNo + holder.equipmentDateView.text = rowsBean.enableDate + holder.equipmentLibView.text = rowsBean.useDeptName + + //绑定事件 + holder.itemView.setOnClickListener { + listener?.onItemClicked(position) + } + } + + inner class ItemViewHolder(view: View) : RecyclerView.ViewHolder(view) { + var equipmentNameView: TextView = view.findViewById(R.id.equipmentNameView) + var equipmentCodeView: TextView = view.findViewById(R.id.equipmentCodeView) + var equipmentDateView: TextView = view.findViewById(R.id.equipmentDateView) + var equipmentLibView: TextView = view.findViewById(R.id.equipmentLibView) + } + + private var listener: OnItemClickListener? = null + + interface OnItemClickListener { + fun onItemClicked(position: Int) + } + + fun setOnItemClickListener(onClickListener: OnItemClickListener?) { + this.listener = onClickListener + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt index b4628f3..d970b55 100644 --- a/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt +++ b/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt @@ -5,7 +5,8 @@ import com.casic.xz.meterage.R import com.casic.xz.meterage.adapter.HomeGridAdapter import com.casic.xz.meterage.utils.LocaleConstant -import com.casic.xz.meterage.view.NoticeListActivity +import com.casic.xz.meterage.view.home.EquipmentActivity +import com.casic.xz.meterage.view.notice.NoticeListActivity import com.casic.xz.meterage.vm.NoticeViewModel import com.pengxh.kt.lite.base.KotlinBaseFragment import com.pengxh.kt.lite.extensions.navigatePageTo @@ -36,8 +37,19 @@ homeFuncRecyclerView.adapter = homeAdapter homeAdapter.setOnGridItemClickListener(object : HomeGridAdapter.OnGridItemClickListener { override fun onItemClick(position: Int) { - when (position) { - + when (LocaleConstant.HOME_FUNC_OPERATE[position]) { + "仪器设备" -> requireContext().navigatePageTo() +// "标准装置" -> requireContext().navigatePageTo() +// "证书报告" -> requireContext().navigatePageTo() +// "委托需求" -> requireContext().navigatePageTo() +// "访客" -> requireContext().navigatePageTo() +// "标准规范" -> requireContext().navigatePageTo() +// "能力列表" -> requireContext().navigatePageTo() +// "计量培训" -> requireContext().navigatePageTo() +// "合同发票" -> requireContext().navigatePageTo() +// "业务统计" -> requireContext().navigatePageTo() +// "客户列表" -> requireContext().navigatePageTo() +// "外场检测" -> requireContext().navigatePageTo() } } }) diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt index 7e75abe..56dc5ec 100644 --- a/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt +++ b/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt @@ -2,9 +2,11 @@ import android.view.View import androidx.lifecycle.ViewModelProvider +import com.bumptech.glide.Glide +import com.bumptech.glide.request.RequestOptions import com.casic.xz.meterage.R import com.casic.xz.meterage.utils.LocaleConstant -import com.casic.xz.meterage.view.NoticeListActivity +import com.casic.xz.meterage.view.notice.NoticeListActivity import com.casic.xz.meterage.vm.NoticeViewModel import com.casic.xz.meterage.vm.UserViewModel import com.pengxh.kt.lite.base.KotlinBaseFragment @@ -23,6 +25,12 @@ val data = it.data userNameView.text = data.name userUnitView.text = data.deptName + +// Glide.with(requireContext()) +// .load(R.mipmap.default_avatar) +// .apply(RequestOptions.circleCropTransform()) +// .placeholder(R.mipmap.load_image_error) +// .into(userAvatarView) } }) diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt new file mode 100644 index 0000000..cf22646 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt @@ -0,0 +1,103 @@ +package com.casic.xz.meterage.fragment.equipment + +import android.graphics.Paint +import androidx.lifecycle.ViewModelProvider +import com.casic.xz.meterage.R +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.casic.xz.meterage.vm.EquipmentViewModel +import com.pengxh.kt.lite.base.KotlinBaseFragment +import com.pengxh.kt.lite.extensions.convertColor +import com.pengxh.kt.lite.vm.LoadState +import kotlinx.android.synthetic.main.fragment_basic_information.* + +class BasicInformationFragment(private val id: String) : KotlinBaseFragment() { + + private lateinit var equipmentViewModel: EquipmentViewModel + + override fun initData() { + equipmentViewModel = ViewModelProvider(this)[EquipmentViewModel::class.java] + equipmentViewModel.getEquipmentDetail(id) + equipmentViewModel.equipmentDetailResult.observe(this, { + if (it.code == 200) { + val data = it.data!! + + equipmentCodeView.text = data.equipmentNo + equipmentNameView.text = data.equipmentName + manufacturerView.text = data.manufacturer + factoryNumberView.text = data.manufacturingNo + modelView.text = data.modelNo + verificationMethodView.text = data.mesureTypeName + measuringRangeView.text = data.mesureRange + uncertaintyView.text = data.uncertainty + firstUseView.text = data.createTime + originalValueView.text = data.originValue + usageDeptView.text = data.useDeptName + userView.text = data.usePersonName + managementStatusView.text = data.managerStateName + verificationDeptView.text = data.useDeptName +// nextVerificationDeptView.text = data. + verificationPeriodView.text = data.mesureCycle + verificationDateView.text = data.mesureDate + effectiveDateView.text = data.validDate + verificationResultsView.text = data.mesureResultName + abcView.text = data.abcName + isNeedTechnicalView.text = if ( + data.isCalibrationTestEquipment.isNullOrBlank() || data.isCalibrationTestEquipment == "0" + ) { + "否" + } else { + "是" + } + + isStandingBook.text = if ( + data.isMeasureAccount.isNullOrBlank() || data.isMeasureAccount == "0" + ) { + "否" + } else { + "是" + } + + isStandardView.text = if ( + data.isStandardSupportEquipment.isNullOrBlank() || data.isStandardSupportEquipment == "0" + ) { + "否" + } else { + "是" + } + remarkView.text = data.remark + if (data.fileList.size == 0) { + instructionsView.text = "暂无" + } else { + instructionsView.text = "查看附件列表" + val textPaint = instructionsView.paint + textPaint.flags = Paint.UNDERLINE_TEXT_FLAG + textPaint.isAntiAlias = true + instructionsView.setTextColor(R.color.themeColor.convertColor(requireContext())) + + instructionsView.setOnClickListener { + + } + } + } + }) + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_basic_information + + override fun observeRequestState() { + equipmentViewModel.loadState.observe(this, { + when (it) { + LoadState.Loading -> LoadingDialogHub.show(requireActivity(), "数据加载中...") + else -> LoadingDialogHub.dismiss() + } + }) + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt new file mode 100644 index 0000000..0b4a747 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class CertificateFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_certificate + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt new file mode 100644 index 0000000..f05c491 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class ChangeRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_change_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt new file mode 100644 index 0000000..849ffa5 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class InspectionRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_inspection_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt new file mode 100644 index 0000000..aa4edd9 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class UsageRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_usage_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java b/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java new file mode 100644 index 0000000..0b9124e --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java @@ -0,0 +1,760 @@ +package com.casic.xz.meterage.model; + +import java.util.List; + +public class EquipmentDetailModel { + + private int code; + private DataModel data; + private String message; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataModel getData() { + return data; + } + + public void setData(DataModel data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public static class DataModel { + private String abc; + private String abcName; + private String assetNo; + private String assetSource; + private String assetType; + private String assetTypeName; + private String attribute; + private String capitalSource; + private String capitalSourceName; + private String cardEstablishmentDate; + private String createTime; + private String createUser; + private String depreciationMethod; + private String depreciationMethodName; + private String depreciationPeriod; + private String enableDate; + private String equipmentCategory; + private String equipmentCategoryName; + private String equipmentName; + private String equipmentNo; + private String equipmentSpecifications; + private String equipmentType; + private String equipmentTypeName; + private List fileList; + private String id; + private String installIncidentalExpenses; + private String installPlace; + private String intactState; + private String isCalibrationTestEquipment; + private int isDel; + private String isFixedAssets; + private String isMeasureAccount; + private String isStandardSupportEquipment; + private String labelBind; + private String majorCategory; + private String majorCategoryName; + private String managerLevel; + private String managerLevelName; + private String managerState; + private String managerStateName; + private String manufacturer; + private String manufacturerCountry; + private String manufacturingDate; + private String manufacturingNo; + private String mesureCycle; + private String mesureDate; + private String mesureDept; + private String mesureRange; + private String mesureResult; + private String mesureResultName; + private String mesureType; + private String mesureTypeName; + private String modelNo; + private String originValue; + private String overallDimension; + private String presentOriginValue; + private String purpose; + private String remark; + private String singlePrice; + private String supportStandardEquipmentName; + private String supportStandardEquipmentNo; + private String technicalLevel; + private String uncertainty; + private String updateTime; + private String useDept; + private String useDeptName; + private String usePerson; + private String usePersonName; + private String validDate; + private int version; + private String weight; + + public String getAbc() { + return abc; + } + + public void setAbc(String abc) { + this.abc = abc; + } + + public String getAbcName() { + return abcName; + } + + public void setAbcName(String abcName) { + this.abcName = abcName; + } + + public String getAssetNo() { + return assetNo; + } + + public void setAssetNo(String assetNo) { + this.assetNo = assetNo; + } + + public String getAssetSource() { + return assetSource; + } + + public void setAssetSource(String assetSource) { + this.assetSource = assetSource; + } + + public String getAssetType() { + return assetType; + } + + public void setAssetType(String assetType) { + this.assetType = assetType; + } + + public String getAssetTypeName() { + return assetTypeName; + } + + public void setAssetTypeName(String assetTypeName) { + this.assetTypeName = assetTypeName; + } + + public String getAttribute() { + return attribute; + } + + public void setAttribute(String attribute) { + this.attribute = attribute; + } + + public String getCapitalSource() { + return capitalSource; + } + + public void setCapitalSource(String capitalSource) { + this.capitalSource = capitalSource; + } + + public String getCapitalSourceName() { + return capitalSourceName; + } + + public void setCapitalSourceName(String capitalSourceName) { + this.capitalSourceName = capitalSourceName; + } + + public String getCardEstablishmentDate() { + return cardEstablishmentDate; + } + + public void setCardEstablishmentDate(String cardEstablishmentDate) { + this.cardEstablishmentDate = cardEstablishmentDate; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getDepreciationMethod() { + return depreciationMethod; + } + + public void setDepreciationMethod(String depreciationMethod) { + this.depreciationMethod = depreciationMethod; + } + + public String getDepreciationMethodName() { + return depreciationMethodName; + } + + public void setDepreciationMethodName(String depreciationMethodName) { + this.depreciationMethodName = depreciationMethodName; + } + + public String getDepreciationPeriod() { + return depreciationPeriod; + } + + public void setDepreciationPeriod(String depreciationPeriod) { + this.depreciationPeriod = depreciationPeriod; + } + + public String getEnableDate() { + return enableDate; + } + + public void setEnableDate(String enableDate) { + this.enableDate = enableDate; + } + + public String getEquipmentCategory() { + return equipmentCategory; + } + + public void setEquipmentCategory(String equipmentCategory) { + this.equipmentCategory = equipmentCategory; + } + + public String getEquipmentCategoryName() { + return equipmentCategoryName; + } + + public void setEquipmentCategoryName(String equipmentCategoryName) { + this.equipmentCategoryName = equipmentCategoryName; + } + + public String getEquipmentName() { + return equipmentName; + } + + public void setEquipmentName(String equipmentName) { + this.equipmentName = equipmentName; + } + + public String getEquipmentNo() { + return equipmentNo; + } + + public void setEquipmentNo(String equipmentNo) { + this.equipmentNo = equipmentNo; + } + + public String getEquipmentSpecifications() { + return equipmentSpecifications; + } + + public void setEquipmentSpecifications(String equipmentSpecifications) { + this.equipmentSpecifications = equipmentSpecifications; + } + + public String getEquipmentType() { + return equipmentType; + } + + public void setEquipmentType(String equipmentType) { + this.equipmentType = equipmentType; + } + + public String getEquipmentTypeName() { + return equipmentTypeName; + } + + public void setEquipmentTypeName(String equipmentTypeName) { + this.equipmentTypeName = equipmentTypeName; + } + + public List getFileList() { + return fileList; + } + + public void setFileList(List fileList) { + this.fileList = fileList; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getInstallIncidentalExpenses() { + return installIncidentalExpenses; + } + + public void setInstallIncidentalExpenses(String installIncidentalExpenses) { + this.installIncidentalExpenses = installIncidentalExpenses; + } + + public String getInstallPlace() { + return installPlace; + } + + public void setInstallPlace(String installPlace) { + this.installPlace = installPlace; + } + + public String getIntactState() { + return intactState; + } + + public void setIntactState(String intactState) { + this.intactState = intactState; + } + + public String getIsCalibrationTestEquipment() { + return isCalibrationTestEquipment; + } + + public void setIsCalibrationTestEquipment(String isCalibrationTestEquipment) { + this.isCalibrationTestEquipment = isCalibrationTestEquipment; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getIsFixedAssets() { + return isFixedAssets; + } + + public void setIsFixedAssets(String isFixedAssets) { + this.isFixedAssets = isFixedAssets; + } + + public String getIsMeasureAccount() { + return isMeasureAccount; + } + + public void setIsMeasureAccount(String isMeasureAccount) { + this.isMeasureAccount = isMeasureAccount; + } + + public String getIsStandardSupportEquipment() { + return isStandardSupportEquipment; + } + + public void setIsStandardSupportEquipment(String isStandardSupportEquipment) { + this.isStandardSupportEquipment = isStandardSupportEquipment; + } + + public String getLabelBind() { + return labelBind; + } + + public void setLabelBind(String labelBind) { + this.labelBind = labelBind; + } + + public String getMajorCategory() { + return majorCategory; + } + + public void setMajorCategory(String majorCategory) { + this.majorCategory = majorCategory; + } + + public String getMajorCategoryName() { + return majorCategoryName; + } + + public void setMajorCategoryName(String majorCategoryName) { + this.majorCategoryName = majorCategoryName; + } + + public String getManagerLevel() { + return managerLevel; + } + + public void setManagerLevel(String managerLevel) { + this.managerLevel = managerLevel; + } + + public String getManagerLevelName() { + return managerLevelName; + } + + public void setManagerLevelName(String managerLevelName) { + this.managerLevelName = managerLevelName; + } + + public String getManagerState() { + return managerState; + } + + public void setManagerState(String managerState) { + this.managerState = managerState; + } + + public String getManagerStateName() { + return managerStateName; + } + + public void setManagerStateName(String managerStateName) { + this.managerStateName = managerStateName; + } + + public String getManufacturer() { + return manufacturer; + } + + public void setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + } + + public String getManufacturerCountry() { + return manufacturerCountry; + } + + public void setManufacturerCountry(String manufacturerCountry) { + this.manufacturerCountry = manufacturerCountry; + } + + public String getManufacturingDate() { + return manufacturingDate; + } + + public void setManufacturingDate(String manufacturingDate) { + this.manufacturingDate = manufacturingDate; + } + + public String getManufacturingNo() { + return manufacturingNo; + } + + public void setManufacturingNo(String manufacturingNo) { + this.manufacturingNo = manufacturingNo; + } + + public String getMesureCycle() { + return mesureCycle; + } + + public void setMesureCycle(String mesureCycle) { + this.mesureCycle = mesureCycle; + } + + public String getMesureDate() { + return mesureDate; + } + + public void setMesureDate(String mesureDate) { + this.mesureDate = mesureDate; + } + + public String getMesureDept() { + return mesureDept; + } + + public void setMesureDept(String mesureDept) { + this.mesureDept = mesureDept; + } + + public String getMesureRange() { + return mesureRange; + } + + public void setMesureRange(String mesureRange) { + this.mesureRange = mesureRange; + } + + public String getMesureResult() { + return mesureResult; + } + + public void setMesureResult(String mesureResult) { + this.mesureResult = mesureResult; + } + + public String getMesureResultName() { + return mesureResultName; + } + + public void setMesureResultName(String mesureResultName) { + this.mesureResultName = mesureResultName; + } + + public String getMesureType() { + return mesureType; + } + + public void setMesureType(String mesureType) { + this.mesureType = mesureType; + } + + public String getMesureTypeName() { + return mesureTypeName; + } + + public void setMesureTypeName(String mesureTypeName) { + this.mesureTypeName = mesureTypeName; + } + + public String getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getOriginValue() { + return originValue; + } + + public void setOriginValue(String originValue) { + this.originValue = originValue; + } + + public String getOverallDimension() { + return overallDimension; + } + + public void setOverallDimension(String overallDimension) { + this.overallDimension = overallDimension; + } + + public String getPresentOriginValue() { + return presentOriginValue; + } + + public void setPresentOriginValue(String presentOriginValue) { + this.presentOriginValue = presentOriginValue; + } + + public String getPurpose() { + return purpose; + } + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getSinglePrice() { + return singlePrice; + } + + public void setSinglePrice(String singlePrice) { + this.singlePrice = singlePrice; + } + + public String getSupportStandardEquipmentName() { + return supportStandardEquipmentName; + } + + public void setSupportStandardEquipmentName(String supportStandardEquipmentName) { + this.supportStandardEquipmentName = supportStandardEquipmentName; + } + + public String getSupportStandardEquipmentNo() { + return supportStandardEquipmentNo; + } + + public void setSupportStandardEquipmentNo(String supportStandardEquipmentNo) { + this.supportStandardEquipmentNo = supportStandardEquipmentNo; + } + + public String getTechnicalLevel() { + return technicalLevel; + } + + public void setTechnicalLevel(String technicalLevel) { + this.technicalLevel = technicalLevel; + } + + public String getUncertainty() { + return uncertainty; + } + + public void setUncertainty(String uncertainty) { + this.uncertainty = uncertainty; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getUseDept() { + return useDept; + } + + public void setUseDept(String useDept) { + this.useDept = useDept; + } + + public String getUseDeptName() { + return useDeptName; + } + + public void setUseDeptName(String useDeptName) { + this.useDeptName = useDeptName; + } + + public String getUsePerson() { + return usePerson; + } + + public void setUsePerson(String usePerson) { + this.usePerson = usePerson; + } + + public String getUsePersonName() { + return usePersonName; + } + + public void setUsePersonName(String usePersonName) { + this.usePersonName = usePersonName; + } + + public String getValidDate() { + return validDate; + } + + public void setValidDate(String validDate) { + this.validDate = validDate; + } + + public int getVersion() { + return version; + } + + public void setVersion(int version) { + this.version = version; + } + + public String getWeight() { + return weight; + } + + public void setWeight(String weight) { + this.weight = weight; + } + + public static class FileListModel { + private String assetId; + private String createTime; + private String createUser; + private String fileName; + private String id; + private int isDel; + private String minioFileName; + private String remark; + private String updateTime; + + public String getAssetId() { + return assetId; + } + + public void setAssetId(String assetId) { + this.assetId = assetId; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getFileName() { + return fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getMinioFileName() { + return minioFileName; + } + + public void setMinioFileName(String minioFileName) { + this.minioFileName = minioFileName; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + } + } +} diff --git a/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java b/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java new file mode 100644 index 0000000..15fc128 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java @@ -0,0 +1,697 @@ +package com.casic.xz.meterage.model; + +import java.util.List; + +public class EquipmentListModel { + + private int code; + private DataModel data; + private String message; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataModel getData() { + return data; + } + + public void setData(DataModel data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public static class DataModel { + private List rows; + private int total; + + public List getRows() { + return rows; + } + + public void setRows(List rows) { + this.rows = rows; + } + + public int getTotal() { + return total; + } + + public void setTotal(int total) { + this.total = total; + } + + public static class RowsModel { + private String abc; + private String abcName; + private String assetNo; + private String assetSource; + private String assetType; + private String assetTypeName; + private String attribute; + private String capitalSource; + private String capitalSourceName; + private String cardEstablishmentDate; + private String createTime; + private String createUser; + private String depreciationMethod; + private String depreciationMethodName; + private String depreciationPeriod; + private String enableDate; + private String equipmentCategory; + private String equipmentCategoryName; + private String equipmentName; + private String equipmentNo; + private String equipmentSpecifications; + private String equipmentType; + private String equipmentTypeName; + private String fileList; + private String id; + private String installIncidentalExpenses; + private String installPlace; + private String intactState; + private String isCalibrationTestEquipment; + private int isDel; + private String isFixedAssets; + private String isMeasureAccount; + private String isStandardSupportEquipment; + private String labelBind; + private String majorCategory; + private String majorCategoryName; + private String managerLevel; + private String managerLevelName; + private String managerState; + private String managerStateName; + private String manufacturer; + private String manufacturerCountry; + private String manufacturingDate; + private String manufacturingNo; + private String mesureCycle; + private String mesureDate; + private String mesureDept; + private String mesureRange; + private String mesureResult; + private String mesureResultName; + private String mesureType; + private String mesureTypeName; + private String modelNo; + private String originValue; + private String overallDimension; + private String presentOriginValue; + private String purpose; + private String remark; + private String singlePrice; + private String supportStandardEquipmentName; + private String supportStandardEquipmentNo; + private String technicalLevel; + private String uncertainty; + private String updateTime; + private String useDept; + private String useDeptName; + private String usePerson; + private String usePersonName; + private String validDate; + private int version; + private String weight; + + public String getAbc() { + return abc; + } + + public void setAbc(String abc) { + this.abc = abc; + } + + public String getAbcName() { + return abcName; + } + + public void setAbcName(String abcName) { + this.abcName = abcName; + } + + public String getAssetNo() { + return assetNo; + } + + public void setAssetNo(String assetNo) { + this.assetNo = assetNo; + } + + public String getAssetSource() { + return assetSource; + } + + public void setAssetSource(String assetSource) { + this.assetSource = assetSource; + } + + public String getAssetType() { + return assetType; + } + + public void setAssetType(String assetType) { + this.assetType = assetType; + } + + public String getAssetTypeName() { + return assetTypeName; + } + + public void setAssetTypeName(String assetTypeName) { + this.assetTypeName = assetTypeName; + } + + public String getAttribute() { + return attribute; + } + + public void setAttribute(String attribute) { + this.attribute = attribute; + } + + public String getCapitalSource() { + return capitalSource; + } + + public void setCapitalSource(String capitalSource) { + this.capitalSource = capitalSource; + } + + public String getCapitalSourceName() { + return capitalSourceName; + } + + public void setCapitalSourceName(String capitalSourceName) { + this.capitalSourceName = capitalSourceName; + } + + public String getCardEstablishmentDate() { + return cardEstablishmentDate; + } + + public void setCardEstablishmentDate(String cardEstablishmentDate) { + this.cardEstablishmentDate = cardEstablishmentDate; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getDepreciationMethod() { + return depreciationMethod; + } + + public void setDepreciationMethod(String depreciationMethod) { + this.depreciationMethod = depreciationMethod; + } + + public String getDepreciationMethodName() { + return depreciationMethodName; + } + + public void setDepreciationMethodName(String depreciationMethodName) { + this.depreciationMethodName = depreciationMethodName; + } + + public String getDepreciationPeriod() { + return depreciationPeriod; + } + + public void setDepreciationPeriod(String depreciationPeriod) { + this.depreciationPeriod = depreciationPeriod; + } + + public String getEnableDate() { + return enableDate; + } + + public void setEnableDate(String enableDate) { + this.enableDate = enableDate; + } + + public String getEquipmentCategory() { + return equipmentCategory; + } + + public void setEquipmentCategory(String equipmentCategory) { + this.equipmentCategory = equipmentCategory; + } + + public String getEquipmentCategoryName() { + return equipmentCategoryName; + } + + public void setEquipmentCategoryName(String equipmentCategoryName) { + this.equipmentCategoryName = equipmentCategoryName; + } + + public String getEquipmentName() { + return equipmentName; + } + + public void setEquipmentName(String equipmentName) { + this.equipmentName = equipmentName; + } + + public String getEquipmentNo() { + return equipmentNo; + } + + public void setEquipmentNo(String equipmentNo) { + this.equipmentNo = equipmentNo; + } + + public String getEquipmentSpecifications() { + return equipmentSpecifications; + } + + public void setEquipmentSpecifications(String equipmentSpecifications) { + this.equipmentSpecifications = equipmentSpecifications; + } + + public String getEquipmentType() { + return equipmentType; + } + + public void setEquipmentType(String equipmentType) { + this.equipmentType = equipmentType; + } + + public String getEquipmentTypeName() { + return equipmentTypeName; + } + + public void setEquipmentTypeName(String equipmentTypeName) { + this.equipmentTypeName = equipmentTypeName; + } + + public String getFileList() { + return fileList; + } + + public void setFileList(String fileList) { + this.fileList = fileList; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getInstallIncidentalExpenses() { + return installIncidentalExpenses; + } + + public void setInstallIncidentalExpenses(String installIncidentalExpenses) { + this.installIncidentalExpenses = installIncidentalExpenses; + } + + public String getInstallPlace() { + return installPlace; + } + + public void setInstallPlace(String installPlace) { + this.installPlace = installPlace; + } + + public String getIntactState() { + return intactState; + } + + public void setIntactState(String intactState) { + this.intactState = intactState; + } + + public String getIsCalibrationTestEquipment() { + return isCalibrationTestEquipment; + } + + public void setIsCalibrationTestEquipment(String isCalibrationTestEquipment) { + this.isCalibrationTestEquipment = isCalibrationTestEquipment; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getIsFixedAssets() { + return isFixedAssets; + } + + public void setIsFixedAssets(String isFixedAssets) { + this.isFixedAssets = isFixedAssets; + } + + public String getIsMeasureAccount() { + return isMeasureAccount; + } + + public void setIsMeasureAccount(String isMeasureAccount) { + this.isMeasureAccount = isMeasureAccount; + } + + public String getIsStandardSupportEquipment() { + return isStandardSupportEquipment; + } + + public void setIsStandardSupportEquipment(String isStandardSupportEquipment) { + this.isStandardSupportEquipment = isStandardSupportEquipment; + } + + public String getLabelBind() { + return labelBind; + } + + public void setLabelBind(String labelBind) { + this.labelBind = labelBind; + } + + public String getMajorCategory() { + return majorCategory; + } + + public void setMajorCategory(String majorCategory) { + this.majorCategory = majorCategory; + } + + public String getMajorCategoryName() { + return majorCategoryName; + } + + public void setMajorCategoryName(String majorCategoryName) { + this.majorCategoryName = majorCategoryName; + } + + public String getManagerLevel() { + return managerLevel; + } + + public void setManagerLevel(String managerLevel) { + this.managerLevel = managerLevel; + } + + public String getManagerLevelName() { + return managerLevelName; + } + + public void setManagerLevelName(String managerLevelName) { + this.managerLevelName = managerLevelName; + } + + public String getManagerState() { + return managerState; + } + + public void setManagerState(String managerState) { + this.managerState = managerState; + } + + public String getManagerStateName() { + return managerStateName; + } + + public void setManagerStateName(String managerStateName) { + this.managerStateName = managerStateName; + } + + public String getManufacturer() { + return manufacturer; + } + + public void setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + } + + public String getManufacturerCountry() { + return manufacturerCountry; + } + + public void setManufacturerCountry(String manufacturerCountry) { + this.manufacturerCountry = manufacturerCountry; + } + + public String getManufacturingDate() { + return manufacturingDate; + } + + public void setManufacturingDate(String manufacturingDate) { + this.manufacturingDate = manufacturingDate; + } + + public String getManufacturingNo() { + return manufacturingNo; + } + + public void setManufacturingNo(String manufacturingNo) { + this.manufacturingNo = manufacturingNo; + } + + public String getMesureCycle() { + return mesureCycle; + } + + public void setMesureCycle(String mesureCycle) { + this.mesureCycle = mesureCycle; + } + + public String getMesureDate() { + return mesureDate; + } + + public void setMesureDate(String mesureDate) { + this.mesureDate = mesureDate; + } + + public String getMesureDept() { + return mesureDept; + } + + public void setMesureDept(String mesureDept) { + this.mesureDept = mesureDept; + } + + public String getMesureRange() { + return mesureRange; + } + + public void setMesureRange(String mesureRange) { + this.mesureRange = mesureRange; + } + + public String getMesureResult() { + return mesureResult; + } + + public void setMesureResult(String mesureResult) { + this.mesureResult = mesureResult; + } + + public String getMesureResultName() { + return mesureResultName; + } + + public void setMesureResultName(String mesureResultName) { + this.mesureResultName = mesureResultName; + } + + public String getMesureType() { + return mesureType; + } + + public void setMesureType(String mesureType) { + this.mesureType = mesureType; + } + + public String getMesureTypeName() { + return mesureTypeName; + } + + public void setMesureTypeName(String mesureTypeName) { + this.mesureTypeName = mesureTypeName; + } + + public String getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getOriginValue() { + return originValue; + } + + public void setOriginValue(String originValue) { + this.originValue = originValue; + } + + public String getOverallDimension() { + return overallDimension; + } + + public void setOverallDimension(String overallDimension) { + this.overallDimension = overallDimension; + } + + public String getPresentOriginValue() { + return presentOriginValue; + } + + public void setPresentOriginValue(String presentOriginValue) { + this.presentOriginValue = presentOriginValue; + } + + public String getPurpose() { + return purpose; + } + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getSinglePrice() { + return singlePrice; + } + + public void setSinglePrice(String singlePrice) { + this.singlePrice = singlePrice; + } + + public String getSupportStandardEquipmentName() { + return supportStandardEquipmentName; + } + + public void setSupportStandardEquipmentName(String supportStandardEquipmentName) { + this.supportStandardEquipmentName = supportStandardEquipmentName; + } + + public String getSupportStandardEquipmentNo() { + return supportStandardEquipmentNo; + } + + public void setSupportStandardEquipmentNo(String supportStandardEquipmentNo) { + this.supportStandardEquipmentNo = supportStandardEquipmentNo; + } + + public String getTechnicalLevel() { + return technicalLevel; + } + + public void setTechnicalLevel(String technicalLevel) { + this.technicalLevel = technicalLevel; + } + + public String getUncertainty() { + return uncertainty; + } + + public void setUncertainty(String uncertainty) { + this.uncertainty = uncertainty; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getUseDept() { + return useDept; + } + + public void setUseDept(String useDept) { + this.useDept = useDept; + } + + public String getUseDeptName() { + return useDeptName; + } + + public void setUseDeptName(String useDeptName) { + this.useDeptName = useDeptName; + } + + public String getUsePerson() { + return usePerson; + } + + public void setUsePerson(String usePerson) { + this.usePerson = usePerson; + } + + public String getUsePersonName() { + return usePersonName; + } + + public void setUsePersonName(String usePersonName) { + this.usePersonName = usePersonName; + } + + public String getValidDate() { + return validDate; + } + + public void setValidDate(String validDate) { + this.validDate = validDate; + } + + public int getVersion() { + return version; + } + + public void setVersion(int version) { + this.version = version; + } + + public String getWeight() { + return weight; + } + + public void setWeight(String weight) { + this.weight = weight; + } + } + } +} diff --git a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt index a3f514f..46e5eef 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt @@ -35,4 +35,24 @@ @QueryMap limit: Map, @QueryMap offset: Map ): String + + /** + * 获取设备列表 + */ + @POST("/meter/assets/listPage") + suspend fun getEquipmentList( + @Header("token") token: String, + @Body requestBody: RequestBody, + @QueryMap limit: Map, + @QueryMap offset: Map + ): String + + /** + * 获取设备详情 + */ + @POST("/meter/assets/detail") + suspend fun getEquipmentDetail( + @Header("token") token: String, + @Body requestBody: RequestBody + ): String } \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt index 444a872..386a1d8 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt @@ -6,8 +6,10 @@ import com.pengxh.kt.lite.utils.SaveKeyValues import okhttp3.MediaType.Companion.toMediaType import okhttp3.RequestBody.Companion.toRequestBody +import org.json.JSONArray import org.json.JSONObject + object RetrofitServiceManager { private val api by lazy { @@ -73,4 +75,71 @@ offsetMap["offset"] = offset return api.getNoticeList(AuthenticationHelper.token!!, requestBody, limitMap, offsetMap) } + + /** + * 获取设备列表 + */ + suspend fun getEquipmentList( + equipmentNo: String, + equipmentName: String, + mesureType: String, + managerState: String, + useDept: String, + assetType: String, + equipmentCategory: String, + isCalibrationTestEquipment: String, + isMeasureAccount: String, + isStandardSupportEquipment: String, + isFixedAssets: String, + validStartDate: String, + validEndDate: String, + abc: String, + ids: Array, + offset: Int + ): String { + val paramObject = JSONObject() + paramObject.put("equipmentNo", equipmentNo) + paramObject.put("equipmentName", equipmentName) + paramObject.put("mesureType", mesureType) + paramObject.put("managerState", managerState) + paramObject.put("useDept", useDept) + paramObject.put("assetType", assetType) + paramObject.put("equipmentCategory", equipmentCategory) + paramObject.put("isCalibrationTestEquipment", isCalibrationTestEquipment) + paramObject.put("isMeasureAccount", isMeasureAccount) + paramObject.put("isStandardSupportEquipment", isStandardSupportEquipment) + paramObject.put("isFixedAssets", isFixedAssets) + paramObject.put("validStartDate", validStartDate) + paramObject.put("validEndDate", validEndDate) + paramObject.put("abc", abc) + + val jsonArray = JSONArray() + ids.forEach { + jsonArray.put(it) + } + paramObject.put("ids", jsonArray) + + val requestBody = paramObject.toString().toRequestBody( + "application/json;charset=UTF-8".toMediaType() + ) + + val limitMap = HashMap() + limitMap["limit"] = LocaleConstant.PAGE_LIMIT + + val offsetMap = HashMap() + offsetMap["offset"] = offset + return api.getEquipmentList(AuthenticationHelper.token!!, requestBody, limitMap, offsetMap) + } + + /** + * 获取设备详情 + */ + suspend fun getEquipmentDetail(id: String): String { + val paramObject = JSONObject() + paramObject.put("id", id) + val requestBody = paramObject.toString().toRequestBody( + "application/json;charset=UTF-8".toMediaType() + ) + return api.getEquipmentDetail(AuthenticationHelper.token!!, requestBody) + } } \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt deleted file mode 100644 index a5bb60b..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt +++ /dev/null @@ -1,104 +0,0 @@ -package com.casic.xz.meterage.view - -import android.annotation.SuppressLint -import android.graphics.Paint -import androidx.lifecycle.ViewModelProvider -import com.casic.xz.meterage.R -import com.casic.xz.meterage.extensions.combineImagePath -import com.casic.xz.meterage.extensions.formatTextFromHtml -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.vm.NoticeViewModel -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.extensions.convertColor -import com.pengxh.kt.lite.extensions.navigatePageTo -import com.pengxh.kt.lite.extensions.obtainScreenWidth -import com.pengxh.kt.lite.extensions.show -import com.pengxh.kt.lite.utils.Constant -import kotlinx.android.synthetic.main.activity_notice_detail.* -import kotlinx.android.synthetic.main.include_base_title.* -import java.util.* - -@SuppressLint("SetTextI18n") -class NoticeDetailActivity : KotlinBaseActivity() { - - private lateinit var noticeViewModel: NoticeViewModel - - override fun initData() { - leftBackView.setOnClickListener { finish() } - titleView.text = "通知公告" - - val args = intent.getStringArrayListExtra(Constant.INTENT_PARAM)!! - - noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] - noticeViewModel.getNoticeList(args[0], args[1], args[2], "", "", 1) - noticeViewModel.noticeResult.observe(this, { - if (it.code == 200) { - val dataRow = it.data?.rows!![0] - - noticeDateView.text = dataRow.noticeTime - noticePublisherView.text = "发布人 ${dataRow.noticePublisher}" - noticeCompanyView.text = "发布单位 ${dataRow.noticeCompany}" - - noticeNoView.text = dataRow.noticeNo - noticeTitleView.text = dataRow.noticeTitle - noticeSketchView.text = dataRow.noticeSketch - - dataRow.noticeContent.formatTextFromHtml( - this, noticeContentView, obtainScreenWidth() - ) - - if (dataRow.minioFileName.isNullOrBlank()) { - minioFileView.text = "暂无附件" - } else { - val minioFileName = dataRow.minioFileName - - minioFileView.text = minioFileName - val textPaint = minioFileView.paint - textPaint.flags = Paint.UNDERLINE_TEXT_FLAG - textPaint.isAntiAlias = true - minioFileView.setTextColor(R.color.themeColor.convertColor(this)) - - minioFileView.setOnClickListener { - //查看附件 - if (minioFileName.endsWith("pdf")) { - navigatePageTo(minioFileName) - } else if ( - minioFileName.endsWith("doc") || - minioFileName.endsWith("docx") - ) { - navigatePageTo(minioFileName) - } else if (minioFileName.endsWith("txt")) { - navigatePageTo(minioFileName) - } else if ( - minioFileName.endsWith("png") || - minioFileName.endsWith("jpeg") || - minioFileName.endsWith("jpg") - ) { - val urls = ArrayList() - urls.add(minioFileName.combineImagePath()) - navigatePageTo(0, urls) - } else { - "文件类型未知,无法打开附件".show(this) - } - } - } - } - }) - } - - override fun initEvent() { - - } - - override fun initLayoutView(): Int = R.layout.activity_notice_detail - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/NoticeListActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/NoticeListActivity.kt deleted file mode 100644 index 15f6a16..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/NoticeListActivity.kt +++ /dev/null @@ -1,180 +0,0 @@ -package com.casic.xz.meterage.view - -import android.os.Handler -import android.util.Log -import android.view.View -import androidx.lifecycle.ViewModelProvider -import com.casic.xz.meterage.R -import com.casic.xz.meterage.adapter.NoticeListAdapter -import com.casic.xz.meterage.extensions.addAll -import com.casic.xz.meterage.extensions.combineFilePath -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.extensions.showEmptyPage -import com.casic.xz.meterage.model.NoticeListModel -import com.casic.xz.meterage.vm.NoticeViewModel -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.extensions.navigatePageTo -import com.pengxh.kt.lite.extensions.show -import com.pengxh.kt.lite.utils.WeakReferenceHandler -import com.pengxh.kt.lite.widget.dialog.AlertControlDialog -import kotlinx.android.synthetic.main.activity_notice_list.* -import kotlinx.android.synthetic.main.include_empty_view.* - -class NoticeListActivity : KotlinBaseActivity() { - - private lateinit var weakReferenceHandler: WeakReferenceHandler - private lateinit var noticeViewModel: NoticeViewModel - private lateinit var noticeListAdapter: NoticeListAdapter - private var dataBeans: MutableList = ArrayList() - private var pageIndex = 1 - private var isRefresh = false - private var isLoadMore = false - - override fun initData() { - weakReferenceHandler = WeakReferenceHandler(callback) - noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] - noticeViewModel.noticeResult.observe(this, { - if (it.code == 200) { - val dataRows = it.data?.rows!! -// countBadeNumber(dataRows) - when { - isRefresh -> { - dataBeans.clear() - dataBeans = dataRows - noticeLayout.finishRefresh() - isRefresh = false - } - isLoadMore -> { - if (dataRows.size == 0) { - "到底了,别拉了".show(this) - } - dataBeans.addAll(dataRows) - noticeLayout.finishLoadMore() - isLoadMore = false - } - else -> { - dataBeans = dataRows - } - } - weakReferenceHandler.sendEmptyMessage(2023013101) - } - }) - } - - override fun initEvent() { - leftBackView.setOnClickListener { finish() } - rightOperateView.setOnClickListener { - AlertControlDialog.Builder() - .setContext(this) - .setTitle("提示") - .setMessage("确定将所有未读消息标为已读?") - .setNegativeButton("取消") - .setPositiveButton("确定") - .setOnDialogButtonClickListener(object : - AlertControlDialog.OnDialogButtonClickListener { - override fun onCancelClick() { - - } - - override fun onConfirmClick() { - //TODO 设置为已读 - } - }).build().show() - } - - if (hasNoticePermission()) { - openSystemNoticeLayout.visibility = View.GONE - openSystemNoticeLayout.visibility = View.GONE - } else { - openSystemNoticeLayout.setOnClickListener { - - } - - - closeLayoutView.setOnClickListener { - openSystemNoticeLayout.visibility = View.GONE - } - } - - noticeLayout.setOnRefreshListener { - isRefresh = true - //刷新之后页码重置 - pageIndex = 1 - getNoticeListByPage() - } - - noticeLayout.setOnLoadMoreListener { - isLoadMore = true - pageIndex++ - getNoticeListByPage() - } - } - - override fun onResume() { - super.onResume() - pageIndex = 1 - getNoticeListByPage() - } - - private fun getNoticeListByPage() { - noticeViewModel.getNoticeList("", "", "", "", "", pageIndex) - } - - private val callback = Handler.Callback { - when (it.what) { - 2023013101 -> { - if (isRefresh || isLoadMore) { - noticeListAdapter.notifyDataSetChanged() - } else { - if (dataBeans.size == 0) { - emptyView!!.showEmptyPage("没有任何消息") { - pageIndex = 1 - getNoticeListByPage() - } - } else { - emptyView!!.hide() - noticeListAdapter = NoticeListAdapter(this, dataBeans) - noticeRecyclerView.adapter = noticeListAdapter - noticeListAdapter.setOnItemClickListener(object : - NoticeListAdapter.OnItemClickListener { - override fun onItemClicked(position: Int) { - val rowsModel = dataBeans[position] - val allArgs = addAll( - rowsModel.noticeNo, - rowsModel.noticeTitle, - rowsModel.noticePublisher, - "", - "" - ) - Log.d( - "Casic", - "NoticeListActivity => onItemClicked: ${rowsModel.minioFileName.combineFilePath()}" - ) - navigatePageTo(allArgs) - } - }) - } - } - } - } - true - } - - //TODO 判断是否开启通知权限 - private fun hasNoticePermission(): Boolean { - - return false - } - - override fun initLayoutView(): Int = R.layout.activity_notice_list - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/PreviewDocumentActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/PreviewDocumentActivity.kt deleted file mode 100644 index e233ddc..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/PreviewDocumentActivity.kt +++ /dev/null @@ -1,24 +0,0 @@ -package com.casic.xz.meterage.view - -import com.casic.xz.meterage.R -import com.pengxh.kt.lite.base.KotlinBaseActivity - -class PreviewDocumentActivity : KotlinBaseActivity() { - override fun initData() { - - } - - override fun initEvent() { - - } - - override fun initLayoutView(): Int = R.layout.activity_preview_doc - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/PreviewPdfActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/PreviewPdfActivity.kt deleted file mode 100644 index 39f8ac2..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/PreviewPdfActivity.kt +++ /dev/null @@ -1,62 +0,0 @@ -package com.casic.xz.meterage.view - -import com.casic.xz.meterage.R -import com.casic.xz.meterage.extensions.combineFilePath -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.utils.LoadingDialogHub -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.callback.OnDownloadListener -import com.pengxh.kt.lite.extensions.createDownloadFileDir -import com.pengxh.kt.lite.extensions.downloadFile -import com.pengxh.kt.lite.utils.Constant -import kotlinx.android.synthetic.main.activity_preview_pdf.* -import kotlinx.android.synthetic.main.include_base_title.* -import java.io.File -import java.io.FileInputStream - - -class PreviewPdfActivity : KotlinBaseActivity() { - - override fun initData() { - val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! - titleView.text = minioFileName - - val url = minioFileName.combineFilePath() - url.downloadFile(createDownloadFileDir().toString(), - object : OnDownloadListener { - override fun onDownloadStart(totalBytes: Long) { - runOnUiThread { - LoadingDialogHub.show(this@PreviewPdfActivity, "附件加载中") - } - } - - override fun onProgressChanged(currentBytes: Long) { - - } - - override fun onDownloadEnd(file: File?) { - runOnUiThread { - LoadingDialogHub.dismiss() - } - val inputStream = FileInputStream(file) - pdfView.fromStream(inputStream).load() - } - }) - } - - override fun initEvent() { - leftBackView.setOnClickListener { finish() } - } - - override fun initLayoutView(): Int = R.layout.activity_preview_pdf - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/PreviewTextActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/PreviewTextActivity.kt deleted file mode 100644 index d634ca3..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/PreviewTextActivity.kt +++ /dev/null @@ -1,60 +0,0 @@ -package com.casic.xz.meterage.view - -import com.casic.xz.meterage.R -import com.casic.xz.meterage.extensions.combineFilePath -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.utils.LoadingDialogHub -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.callback.OnDownloadListener -import com.pengxh.kt.lite.extensions.createDownloadFileDir -import com.pengxh.kt.lite.extensions.downloadFile -import com.pengxh.kt.lite.extensions.read -import com.pengxh.kt.lite.utils.Constant -import kotlinx.android.synthetic.main.activity_preview_txt.* -import kotlinx.android.synthetic.main.include_base_title.* -import java.io.File - -class PreviewTextActivity : KotlinBaseActivity() { - - override fun initData() { - val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! - titleView.text = minioFileName - - val url = minioFileName.combineFilePath() - url.downloadFile(createDownloadFileDir().toString(), - object : OnDownloadListener { - override fun onDownloadStart(totalBytes: Long) { - runOnUiThread { - LoadingDialogHub.show(this@PreviewTextActivity, "附件加载中") - } - } - - override fun onProgressChanged(currentBytes: Long) { - - } - - override fun onDownloadEnd(file: File?) { - runOnUiThread { - LoadingDialogHub.dismiss() - textView.text = file?.read() - } - } - }) - } - - override fun initEvent() { - leftBackView.setOnClickListener { finish() } - } - - override fun initLayoutView(): Int = R.layout.activity_preview_txt - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentActivity.kt new file mode 100644 index 0000000..35ca098 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentActivity.kt @@ -0,0 +1,158 @@ +package com.casic.xz.meterage.view.home + +import android.os.Handler +import androidx.lifecycle.ViewModelProvider +import androidx.recyclerview.widget.DividerItemDecoration +import com.casic.xz.meterage.R +import com.casic.xz.meterage.adapter.EquipmentListAdapter +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.extensions.showEmptyPage +import com.casic.xz.meterage.model.EquipmentListModel +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.casic.xz.meterage.vm.EquipmentViewModel +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.extensions.navigatePageTo +import com.pengxh.kt.lite.extensions.show +import com.pengxh.kt.lite.utils.WeakReferenceHandler +import com.pengxh.kt.lite.vm.LoadState +import kotlinx.android.synthetic.main.activity_equipment.* +import kotlinx.android.synthetic.main.include_empty_view.* +import kotlinx.android.synthetic.main.include_search_title.* + +class EquipmentActivity : KotlinBaseActivity() { + + private lateinit var weakReferenceHandler: WeakReferenceHandler + private lateinit var equipmentViewModel: EquipmentViewModel + private lateinit var equipmentListAdapter: EquipmentListAdapter + private var dataBeans: MutableList = ArrayList() + private var pageIndex = 1 + private var isRefresh = false + private var isLoadMore = false + + override fun initData() { + weakReferenceHandler = WeakReferenceHandler(callback) + equipmentViewModel = ViewModelProvider(this)[EquipmentViewModel::class.java] + equipmentViewModel.equipmentResult.observe(this, { + if (it.code == 200) { + val dataRows = it.data?.rows!! + when { + isRefresh -> { + dataBeans.clear() + dataBeans = dataRows + equipmentLayout.finishRefresh() + isRefresh = false + } + isLoadMore -> { + if (dataRows.size == 0) { + "到底了,别拉了".show(this) + } + dataBeans.addAll(dataRows) + equipmentLayout.finishLoadMore() + isLoadMore = false + } + else -> { + dataBeans = dataRows + } + } + weakReferenceHandler.sendEmptyMessage(2023020801) + } + }) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + rightOperateView.setOnClickListener { + + } + + equipmentLayout.setOnRefreshListener { + isRefresh = true + //刷新之后页码重置 + pageIndex = 1 + getEquipmentListByPage() + } + + equipmentLayout.setOnLoadMoreListener { + isLoadMore = true + pageIndex++ + getEquipmentListByPage() + } + } + + override fun initLayoutView(): Int = R.layout.activity_equipment + + override fun observeRequestState() { + equipmentViewModel.loadState.observe(this, { + when (it) { + LoadState.Loading -> LoadingDialogHub.show(this, "数据加载中...") + else -> LoadingDialogHub.dismiss() + } + }) + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + titleView.text = "仪器设备" + } + + override fun onResume() { + super.onResume() + pageIndex = 1 + getEquipmentListByPage() + } + + private fun getEquipmentListByPage() { + equipmentViewModel.getEquipmentList( + "", + "", + "", + "", + "", + "1", + "", + "", + "", + "", + "", + "", + "", + "", + arrayOf(), + pageIndex + ) + } + + private val callback = Handler.Callback { + when (it.what) { + 2023020801 -> { + if (isRefresh || isLoadMore) { + equipmentListAdapter.notifyDataSetChanged() + } else { + if (dataBeans.size == 0) { + emptyView!!.showEmptyPage("无设备") { + pageIndex = 1 + getEquipmentListByPage() + } + } else { + emptyView!!.hide() + equipmentListAdapter = EquipmentListAdapter(this, dataBeans) + equipmentRecyclerView.addItemDecoration( + DividerItemDecoration(this, DividerItemDecoration.VERTICAL) + ) + equipmentRecyclerView.adapter = equipmentListAdapter + equipmentListAdapter.setOnItemClickListener(object : + EquipmentListAdapter.OnItemClickListener { + override fun onItemClicked(position: Int) { + val rowsModel = dataBeans[position] + navigatePageTo(rowsModel.id) + } + }) + } + } + } + } + true + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentDetailActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentDetailActivity.kt new file mode 100644 index 0000000..7dee13c --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentDetailActivity.kt @@ -0,0 +1,53 @@ +package com.casic.xz.meterage.view.home + +import androidx.fragment.app.Fragment +import com.casic.xz.meterage.R +import com.casic.xz.meterage.adapter.SubViewPagerAdapter +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.fragment.equipment.* +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.utils.Constant +import kotlinx.android.synthetic.main.activity_equipment.rootView +import kotlinx.android.synthetic.main.activity_equipment_detail.* +import kotlinx.android.synthetic.main.include_base_title.* + +class EquipmentDetailActivity : KotlinBaseActivity() { + + private var fragmentPages: ArrayList = ArrayList() + + override fun initData() { + val equipmentId = intent.getStringExtra(Constant.INTENT_PARAM)!! + + fragmentPages.add(BasicInformationFragment(equipmentId)) + fragmentPages.add(InspectionRecordFragment()) + fragmentPages.add(ChangeRecordFragment()) + fragmentPages.add(UsageRecordFragment()) + fragmentPages.add(CertificateFragment()) + + val equipmentPageTitles = arrayOf("基础信息", "周检记录", "状态变更记录", "使用记录", "检定证书") + + equipmentViewPager.adapter = SubViewPagerAdapter( + supportFragmentManager, fragmentPages, equipmentPageTitles + ) + equipmentViewPager.offscreenPageLimit = fragmentPages.size + //绑定 + topTabLayout.setupWithViewPager(equipmentViewPager) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + } + + override fun initLayoutView(): Int = R.layout.activity_equipment_detail + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + titleView.text = "仪器设备" + } +} \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 3892b5a..02160cd 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -34,16 +34,18 @@ - - - - - - - + + + + + + + + + +) : RecyclerView.Adapter() { + + private var layoutInflater: LayoutInflater = LayoutInflater.from(context) + + override fun getItemCount(): Int = dataRows.size + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = ItemViewHolder( + layoutInflater.inflate(R.layout.item_equipment_rv_l, parent, false) + ) + + override fun onBindViewHolder(holder: ItemViewHolder, position: Int) { + //绑定数据 + val rowsBean = dataRows[position] + holder.equipmentNameView.text = rowsBean.equipmentName + holder.equipmentCodeView.text = rowsBean.equipmentNo + holder.equipmentDateView.text = rowsBean.enableDate + holder.equipmentLibView.text = rowsBean.useDeptName + + //绑定事件 + holder.itemView.setOnClickListener { + listener?.onItemClicked(position) + } + } + + inner class ItemViewHolder(view: View) : RecyclerView.ViewHolder(view) { + var equipmentNameView: TextView = view.findViewById(R.id.equipmentNameView) + var equipmentCodeView: TextView = view.findViewById(R.id.equipmentCodeView) + var equipmentDateView: TextView = view.findViewById(R.id.equipmentDateView) + var equipmentLibView: TextView = view.findViewById(R.id.equipmentLibView) + } + + private var listener: OnItemClickListener? = null + + interface OnItemClickListener { + fun onItemClicked(position: Int) + } + + fun setOnItemClickListener(onClickListener: OnItemClickListener?) { + this.listener = onClickListener + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt index b4628f3..d970b55 100644 --- a/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt +++ b/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt @@ -5,7 +5,8 @@ import com.casic.xz.meterage.R import com.casic.xz.meterage.adapter.HomeGridAdapter import com.casic.xz.meterage.utils.LocaleConstant -import com.casic.xz.meterage.view.NoticeListActivity +import com.casic.xz.meterage.view.home.EquipmentActivity +import com.casic.xz.meterage.view.notice.NoticeListActivity import com.casic.xz.meterage.vm.NoticeViewModel import com.pengxh.kt.lite.base.KotlinBaseFragment import com.pengxh.kt.lite.extensions.navigatePageTo @@ -36,8 +37,19 @@ homeFuncRecyclerView.adapter = homeAdapter homeAdapter.setOnGridItemClickListener(object : HomeGridAdapter.OnGridItemClickListener { override fun onItemClick(position: Int) { - when (position) { - + when (LocaleConstant.HOME_FUNC_OPERATE[position]) { + "仪器设备" -> requireContext().navigatePageTo() +// "标准装置" -> requireContext().navigatePageTo() +// "证书报告" -> requireContext().navigatePageTo() +// "委托需求" -> requireContext().navigatePageTo() +// "访客" -> requireContext().navigatePageTo() +// "标准规范" -> requireContext().navigatePageTo() +// "能力列表" -> requireContext().navigatePageTo() +// "计量培训" -> requireContext().navigatePageTo() +// "合同发票" -> requireContext().navigatePageTo() +// "业务统计" -> requireContext().navigatePageTo() +// "客户列表" -> requireContext().navigatePageTo() +// "外场检测" -> requireContext().navigatePageTo() } } }) diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt index 7e75abe..56dc5ec 100644 --- a/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt +++ b/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt @@ -2,9 +2,11 @@ import android.view.View import androidx.lifecycle.ViewModelProvider +import com.bumptech.glide.Glide +import com.bumptech.glide.request.RequestOptions import com.casic.xz.meterage.R import com.casic.xz.meterage.utils.LocaleConstant -import com.casic.xz.meterage.view.NoticeListActivity +import com.casic.xz.meterage.view.notice.NoticeListActivity import com.casic.xz.meterage.vm.NoticeViewModel import com.casic.xz.meterage.vm.UserViewModel import com.pengxh.kt.lite.base.KotlinBaseFragment @@ -23,6 +25,12 @@ val data = it.data userNameView.text = data.name userUnitView.text = data.deptName + +// Glide.with(requireContext()) +// .load(R.mipmap.default_avatar) +// .apply(RequestOptions.circleCropTransform()) +// .placeholder(R.mipmap.load_image_error) +// .into(userAvatarView) } }) diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt new file mode 100644 index 0000000..cf22646 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt @@ -0,0 +1,103 @@ +package com.casic.xz.meterage.fragment.equipment + +import android.graphics.Paint +import androidx.lifecycle.ViewModelProvider +import com.casic.xz.meterage.R +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.casic.xz.meterage.vm.EquipmentViewModel +import com.pengxh.kt.lite.base.KotlinBaseFragment +import com.pengxh.kt.lite.extensions.convertColor +import com.pengxh.kt.lite.vm.LoadState +import kotlinx.android.synthetic.main.fragment_basic_information.* + +class BasicInformationFragment(private val id: String) : KotlinBaseFragment() { + + private lateinit var equipmentViewModel: EquipmentViewModel + + override fun initData() { + equipmentViewModel = ViewModelProvider(this)[EquipmentViewModel::class.java] + equipmentViewModel.getEquipmentDetail(id) + equipmentViewModel.equipmentDetailResult.observe(this, { + if (it.code == 200) { + val data = it.data!! + + equipmentCodeView.text = data.equipmentNo + equipmentNameView.text = data.equipmentName + manufacturerView.text = data.manufacturer + factoryNumberView.text = data.manufacturingNo + modelView.text = data.modelNo + verificationMethodView.text = data.mesureTypeName + measuringRangeView.text = data.mesureRange + uncertaintyView.text = data.uncertainty + firstUseView.text = data.createTime + originalValueView.text = data.originValue + usageDeptView.text = data.useDeptName + userView.text = data.usePersonName + managementStatusView.text = data.managerStateName + verificationDeptView.text = data.useDeptName +// nextVerificationDeptView.text = data. + verificationPeriodView.text = data.mesureCycle + verificationDateView.text = data.mesureDate + effectiveDateView.text = data.validDate + verificationResultsView.text = data.mesureResultName + abcView.text = data.abcName + isNeedTechnicalView.text = if ( + data.isCalibrationTestEquipment.isNullOrBlank() || data.isCalibrationTestEquipment == "0" + ) { + "否" + } else { + "是" + } + + isStandingBook.text = if ( + data.isMeasureAccount.isNullOrBlank() || data.isMeasureAccount == "0" + ) { + "否" + } else { + "是" + } + + isStandardView.text = if ( + data.isStandardSupportEquipment.isNullOrBlank() || data.isStandardSupportEquipment == "0" + ) { + "否" + } else { + "是" + } + remarkView.text = data.remark + if (data.fileList.size == 0) { + instructionsView.text = "暂无" + } else { + instructionsView.text = "查看附件列表" + val textPaint = instructionsView.paint + textPaint.flags = Paint.UNDERLINE_TEXT_FLAG + textPaint.isAntiAlias = true + instructionsView.setTextColor(R.color.themeColor.convertColor(requireContext())) + + instructionsView.setOnClickListener { + + } + } + } + }) + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_basic_information + + override fun observeRequestState() { + equipmentViewModel.loadState.observe(this, { + when (it) { + LoadState.Loading -> LoadingDialogHub.show(requireActivity(), "数据加载中...") + else -> LoadingDialogHub.dismiss() + } + }) + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt new file mode 100644 index 0000000..0b4a747 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class CertificateFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_certificate + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt new file mode 100644 index 0000000..f05c491 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class ChangeRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_change_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt new file mode 100644 index 0000000..849ffa5 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class InspectionRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_inspection_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt new file mode 100644 index 0000000..aa4edd9 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class UsageRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_usage_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java b/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java new file mode 100644 index 0000000..0b9124e --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java @@ -0,0 +1,760 @@ +package com.casic.xz.meterage.model; + +import java.util.List; + +public class EquipmentDetailModel { + + private int code; + private DataModel data; + private String message; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataModel getData() { + return data; + } + + public void setData(DataModel data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public static class DataModel { + private String abc; + private String abcName; + private String assetNo; + private String assetSource; + private String assetType; + private String assetTypeName; + private String attribute; + private String capitalSource; + private String capitalSourceName; + private String cardEstablishmentDate; + private String createTime; + private String createUser; + private String depreciationMethod; + private String depreciationMethodName; + private String depreciationPeriod; + private String enableDate; + private String equipmentCategory; + private String equipmentCategoryName; + private String equipmentName; + private String equipmentNo; + private String equipmentSpecifications; + private String equipmentType; + private String equipmentTypeName; + private List fileList; + private String id; + private String installIncidentalExpenses; + private String installPlace; + private String intactState; + private String isCalibrationTestEquipment; + private int isDel; + private String isFixedAssets; + private String isMeasureAccount; + private String isStandardSupportEquipment; + private String labelBind; + private String majorCategory; + private String majorCategoryName; + private String managerLevel; + private String managerLevelName; + private String managerState; + private String managerStateName; + private String manufacturer; + private String manufacturerCountry; + private String manufacturingDate; + private String manufacturingNo; + private String mesureCycle; + private String mesureDate; + private String mesureDept; + private String mesureRange; + private String mesureResult; + private String mesureResultName; + private String mesureType; + private String mesureTypeName; + private String modelNo; + private String originValue; + private String overallDimension; + private String presentOriginValue; + private String purpose; + private String remark; + private String singlePrice; + private String supportStandardEquipmentName; + private String supportStandardEquipmentNo; + private String technicalLevel; + private String uncertainty; + private String updateTime; + private String useDept; + private String useDeptName; + private String usePerson; + private String usePersonName; + private String validDate; + private int version; + private String weight; + + public String getAbc() { + return abc; + } + + public void setAbc(String abc) { + this.abc = abc; + } + + public String getAbcName() { + return abcName; + } + + public void setAbcName(String abcName) { + this.abcName = abcName; + } + + public String getAssetNo() { + return assetNo; + } + + public void setAssetNo(String assetNo) { + this.assetNo = assetNo; + } + + public String getAssetSource() { + return assetSource; + } + + public void setAssetSource(String assetSource) { + this.assetSource = assetSource; + } + + public String getAssetType() { + return assetType; + } + + public void setAssetType(String assetType) { + this.assetType = assetType; + } + + public String getAssetTypeName() { + return assetTypeName; + } + + public void setAssetTypeName(String assetTypeName) { + this.assetTypeName = assetTypeName; + } + + public String getAttribute() { + return attribute; + } + + public void setAttribute(String attribute) { + this.attribute = attribute; + } + + public String getCapitalSource() { + return capitalSource; + } + + public void setCapitalSource(String capitalSource) { + this.capitalSource = capitalSource; + } + + public String getCapitalSourceName() { + return capitalSourceName; + } + + public void setCapitalSourceName(String capitalSourceName) { + this.capitalSourceName = capitalSourceName; + } + + public String getCardEstablishmentDate() { + return cardEstablishmentDate; + } + + public void setCardEstablishmentDate(String cardEstablishmentDate) { + this.cardEstablishmentDate = cardEstablishmentDate; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getDepreciationMethod() { + return depreciationMethod; + } + + public void setDepreciationMethod(String depreciationMethod) { + this.depreciationMethod = depreciationMethod; + } + + public String getDepreciationMethodName() { + return depreciationMethodName; + } + + public void setDepreciationMethodName(String depreciationMethodName) { + this.depreciationMethodName = depreciationMethodName; + } + + public String getDepreciationPeriod() { + return depreciationPeriod; + } + + public void setDepreciationPeriod(String depreciationPeriod) { + this.depreciationPeriod = depreciationPeriod; + } + + public String getEnableDate() { + return enableDate; + } + + public void setEnableDate(String enableDate) { + this.enableDate = enableDate; + } + + public String getEquipmentCategory() { + return equipmentCategory; + } + + public void setEquipmentCategory(String equipmentCategory) { + this.equipmentCategory = equipmentCategory; + } + + public String getEquipmentCategoryName() { + return equipmentCategoryName; + } + + public void setEquipmentCategoryName(String equipmentCategoryName) { + this.equipmentCategoryName = equipmentCategoryName; + } + + public String getEquipmentName() { + return equipmentName; + } + + public void setEquipmentName(String equipmentName) { + this.equipmentName = equipmentName; + } + + public String getEquipmentNo() { + return equipmentNo; + } + + public void setEquipmentNo(String equipmentNo) { + this.equipmentNo = equipmentNo; + } + + public String getEquipmentSpecifications() { + return equipmentSpecifications; + } + + public void setEquipmentSpecifications(String equipmentSpecifications) { + this.equipmentSpecifications = equipmentSpecifications; + } + + public String getEquipmentType() { + return equipmentType; + } + + public void setEquipmentType(String equipmentType) { + this.equipmentType = equipmentType; + } + + public String getEquipmentTypeName() { + return equipmentTypeName; + } + + public void setEquipmentTypeName(String equipmentTypeName) { + this.equipmentTypeName = equipmentTypeName; + } + + public List getFileList() { + return fileList; + } + + public void setFileList(List fileList) { + this.fileList = fileList; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getInstallIncidentalExpenses() { + return installIncidentalExpenses; + } + + public void setInstallIncidentalExpenses(String installIncidentalExpenses) { + this.installIncidentalExpenses = installIncidentalExpenses; + } + + public String getInstallPlace() { + return installPlace; + } + + public void setInstallPlace(String installPlace) { + this.installPlace = installPlace; + } + + public String getIntactState() { + return intactState; + } + + public void setIntactState(String intactState) { + this.intactState = intactState; + } + + public String getIsCalibrationTestEquipment() { + return isCalibrationTestEquipment; + } + + public void setIsCalibrationTestEquipment(String isCalibrationTestEquipment) { + this.isCalibrationTestEquipment = isCalibrationTestEquipment; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getIsFixedAssets() { + return isFixedAssets; + } + + public void setIsFixedAssets(String isFixedAssets) { + this.isFixedAssets = isFixedAssets; + } + + public String getIsMeasureAccount() { + return isMeasureAccount; + } + + public void setIsMeasureAccount(String isMeasureAccount) { + this.isMeasureAccount = isMeasureAccount; + } + + public String getIsStandardSupportEquipment() { + return isStandardSupportEquipment; + } + + public void setIsStandardSupportEquipment(String isStandardSupportEquipment) { + this.isStandardSupportEquipment = isStandardSupportEquipment; + } + + public String getLabelBind() { + return labelBind; + } + + public void setLabelBind(String labelBind) { + this.labelBind = labelBind; + } + + public String getMajorCategory() { + return majorCategory; + } + + public void setMajorCategory(String majorCategory) { + this.majorCategory = majorCategory; + } + + public String getMajorCategoryName() { + return majorCategoryName; + } + + public void setMajorCategoryName(String majorCategoryName) { + this.majorCategoryName = majorCategoryName; + } + + public String getManagerLevel() { + return managerLevel; + } + + public void setManagerLevel(String managerLevel) { + this.managerLevel = managerLevel; + } + + public String getManagerLevelName() { + return managerLevelName; + } + + public void setManagerLevelName(String managerLevelName) { + this.managerLevelName = managerLevelName; + } + + public String getManagerState() { + return managerState; + } + + public void setManagerState(String managerState) { + this.managerState = managerState; + } + + public String getManagerStateName() { + return managerStateName; + } + + public void setManagerStateName(String managerStateName) { + this.managerStateName = managerStateName; + } + + public String getManufacturer() { + return manufacturer; + } + + public void setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + } + + public String getManufacturerCountry() { + return manufacturerCountry; + } + + public void setManufacturerCountry(String manufacturerCountry) { + this.manufacturerCountry = manufacturerCountry; + } + + public String getManufacturingDate() { + return manufacturingDate; + } + + public void setManufacturingDate(String manufacturingDate) { + this.manufacturingDate = manufacturingDate; + } + + public String getManufacturingNo() { + return manufacturingNo; + } + + public void setManufacturingNo(String manufacturingNo) { + this.manufacturingNo = manufacturingNo; + } + + public String getMesureCycle() { + return mesureCycle; + } + + public void setMesureCycle(String mesureCycle) { + this.mesureCycle = mesureCycle; + } + + public String getMesureDate() { + return mesureDate; + } + + public void setMesureDate(String mesureDate) { + this.mesureDate = mesureDate; + } + + public String getMesureDept() { + return mesureDept; + } + + public void setMesureDept(String mesureDept) { + this.mesureDept = mesureDept; + } + + public String getMesureRange() { + return mesureRange; + } + + public void setMesureRange(String mesureRange) { + this.mesureRange = mesureRange; + } + + public String getMesureResult() { + return mesureResult; + } + + public void setMesureResult(String mesureResult) { + this.mesureResult = mesureResult; + } + + public String getMesureResultName() { + return mesureResultName; + } + + public void setMesureResultName(String mesureResultName) { + this.mesureResultName = mesureResultName; + } + + public String getMesureType() { + return mesureType; + } + + public void setMesureType(String mesureType) { + this.mesureType = mesureType; + } + + public String getMesureTypeName() { + return mesureTypeName; + } + + public void setMesureTypeName(String mesureTypeName) { + this.mesureTypeName = mesureTypeName; + } + + public String getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getOriginValue() { + return originValue; + } + + public void setOriginValue(String originValue) { + this.originValue = originValue; + } + + public String getOverallDimension() { + return overallDimension; + } + + public void setOverallDimension(String overallDimension) { + this.overallDimension = overallDimension; + } + + public String getPresentOriginValue() { + return presentOriginValue; + } + + public void setPresentOriginValue(String presentOriginValue) { + this.presentOriginValue = presentOriginValue; + } + + public String getPurpose() { + return purpose; + } + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getSinglePrice() { + return singlePrice; + } + + public void setSinglePrice(String singlePrice) { + this.singlePrice = singlePrice; + } + + public String getSupportStandardEquipmentName() { + return supportStandardEquipmentName; + } + + public void setSupportStandardEquipmentName(String supportStandardEquipmentName) { + this.supportStandardEquipmentName = supportStandardEquipmentName; + } + + public String getSupportStandardEquipmentNo() { + return supportStandardEquipmentNo; + } + + public void setSupportStandardEquipmentNo(String supportStandardEquipmentNo) { + this.supportStandardEquipmentNo = supportStandardEquipmentNo; + } + + public String getTechnicalLevel() { + return technicalLevel; + } + + public void setTechnicalLevel(String technicalLevel) { + this.technicalLevel = technicalLevel; + } + + public String getUncertainty() { + return uncertainty; + } + + public void setUncertainty(String uncertainty) { + this.uncertainty = uncertainty; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getUseDept() { + return useDept; + } + + public void setUseDept(String useDept) { + this.useDept = useDept; + } + + public String getUseDeptName() { + return useDeptName; + } + + public void setUseDeptName(String useDeptName) { + this.useDeptName = useDeptName; + } + + public String getUsePerson() { + return usePerson; + } + + public void setUsePerson(String usePerson) { + this.usePerson = usePerson; + } + + public String getUsePersonName() { + return usePersonName; + } + + public void setUsePersonName(String usePersonName) { + this.usePersonName = usePersonName; + } + + public String getValidDate() { + return validDate; + } + + public void setValidDate(String validDate) { + this.validDate = validDate; + } + + public int getVersion() { + return version; + } + + public void setVersion(int version) { + this.version = version; + } + + public String getWeight() { + return weight; + } + + public void setWeight(String weight) { + this.weight = weight; + } + + public static class FileListModel { + private String assetId; + private String createTime; + private String createUser; + private String fileName; + private String id; + private int isDel; + private String minioFileName; + private String remark; + private String updateTime; + + public String getAssetId() { + return assetId; + } + + public void setAssetId(String assetId) { + this.assetId = assetId; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getFileName() { + return fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getMinioFileName() { + return minioFileName; + } + + public void setMinioFileName(String minioFileName) { + this.minioFileName = minioFileName; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + } + } +} diff --git a/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java b/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java new file mode 100644 index 0000000..15fc128 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java @@ -0,0 +1,697 @@ +package com.casic.xz.meterage.model; + +import java.util.List; + +public class EquipmentListModel { + + private int code; + private DataModel data; + private String message; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataModel getData() { + return data; + } + + public void setData(DataModel data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public static class DataModel { + private List rows; + private int total; + + public List getRows() { + return rows; + } + + public void setRows(List rows) { + this.rows = rows; + } + + public int getTotal() { + return total; + } + + public void setTotal(int total) { + this.total = total; + } + + public static class RowsModel { + private String abc; + private String abcName; + private String assetNo; + private String assetSource; + private String assetType; + private String assetTypeName; + private String attribute; + private String capitalSource; + private String capitalSourceName; + private String cardEstablishmentDate; + private String createTime; + private String createUser; + private String depreciationMethod; + private String depreciationMethodName; + private String depreciationPeriod; + private String enableDate; + private String equipmentCategory; + private String equipmentCategoryName; + private String equipmentName; + private String equipmentNo; + private String equipmentSpecifications; + private String equipmentType; + private String equipmentTypeName; + private String fileList; + private String id; + private String installIncidentalExpenses; + private String installPlace; + private String intactState; + private String isCalibrationTestEquipment; + private int isDel; + private String isFixedAssets; + private String isMeasureAccount; + private String isStandardSupportEquipment; + private String labelBind; + private String majorCategory; + private String majorCategoryName; + private String managerLevel; + private String managerLevelName; + private String managerState; + private String managerStateName; + private String manufacturer; + private String manufacturerCountry; + private String manufacturingDate; + private String manufacturingNo; + private String mesureCycle; + private String mesureDate; + private String mesureDept; + private String mesureRange; + private String mesureResult; + private String mesureResultName; + private String mesureType; + private String mesureTypeName; + private String modelNo; + private String originValue; + private String overallDimension; + private String presentOriginValue; + private String purpose; + private String remark; + private String singlePrice; + private String supportStandardEquipmentName; + private String supportStandardEquipmentNo; + private String technicalLevel; + private String uncertainty; + private String updateTime; + private String useDept; + private String useDeptName; + private String usePerson; + private String usePersonName; + private String validDate; + private int version; + private String weight; + + public String getAbc() { + return abc; + } + + public void setAbc(String abc) { + this.abc = abc; + } + + public String getAbcName() { + return abcName; + } + + public void setAbcName(String abcName) { + this.abcName = abcName; + } + + public String getAssetNo() { + return assetNo; + } + + public void setAssetNo(String assetNo) { + this.assetNo = assetNo; + } + + public String getAssetSource() { + return assetSource; + } + + public void setAssetSource(String assetSource) { + this.assetSource = assetSource; + } + + public String getAssetType() { + return assetType; + } + + public void setAssetType(String assetType) { + this.assetType = assetType; + } + + public String getAssetTypeName() { + return assetTypeName; + } + + public void setAssetTypeName(String assetTypeName) { + this.assetTypeName = assetTypeName; + } + + public String getAttribute() { + return attribute; + } + + public void setAttribute(String attribute) { + this.attribute = attribute; + } + + public String getCapitalSource() { + return capitalSource; + } + + public void setCapitalSource(String capitalSource) { + this.capitalSource = capitalSource; + } + + public String getCapitalSourceName() { + return capitalSourceName; + } + + public void setCapitalSourceName(String capitalSourceName) { + this.capitalSourceName = capitalSourceName; + } + + public String getCardEstablishmentDate() { + return cardEstablishmentDate; + } + + public void setCardEstablishmentDate(String cardEstablishmentDate) { + this.cardEstablishmentDate = cardEstablishmentDate; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getDepreciationMethod() { + return depreciationMethod; + } + + public void setDepreciationMethod(String depreciationMethod) { + this.depreciationMethod = depreciationMethod; + } + + public String getDepreciationMethodName() { + return depreciationMethodName; + } + + public void setDepreciationMethodName(String depreciationMethodName) { + this.depreciationMethodName = depreciationMethodName; + } + + public String getDepreciationPeriod() { + return depreciationPeriod; + } + + public void setDepreciationPeriod(String depreciationPeriod) { + this.depreciationPeriod = depreciationPeriod; + } + + public String getEnableDate() { + return enableDate; + } + + public void setEnableDate(String enableDate) { + this.enableDate = enableDate; + } + + public String getEquipmentCategory() { + return equipmentCategory; + } + + public void setEquipmentCategory(String equipmentCategory) { + this.equipmentCategory = equipmentCategory; + } + + public String getEquipmentCategoryName() { + return equipmentCategoryName; + } + + public void setEquipmentCategoryName(String equipmentCategoryName) { + this.equipmentCategoryName = equipmentCategoryName; + } + + public String getEquipmentName() { + return equipmentName; + } + + public void setEquipmentName(String equipmentName) { + this.equipmentName = equipmentName; + } + + public String getEquipmentNo() { + return equipmentNo; + } + + public void setEquipmentNo(String equipmentNo) { + this.equipmentNo = equipmentNo; + } + + public String getEquipmentSpecifications() { + return equipmentSpecifications; + } + + public void setEquipmentSpecifications(String equipmentSpecifications) { + this.equipmentSpecifications = equipmentSpecifications; + } + + public String getEquipmentType() { + return equipmentType; + } + + public void setEquipmentType(String equipmentType) { + this.equipmentType = equipmentType; + } + + public String getEquipmentTypeName() { + return equipmentTypeName; + } + + public void setEquipmentTypeName(String equipmentTypeName) { + this.equipmentTypeName = equipmentTypeName; + } + + public String getFileList() { + return fileList; + } + + public void setFileList(String fileList) { + this.fileList = fileList; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getInstallIncidentalExpenses() { + return installIncidentalExpenses; + } + + public void setInstallIncidentalExpenses(String installIncidentalExpenses) { + this.installIncidentalExpenses = installIncidentalExpenses; + } + + public String getInstallPlace() { + return installPlace; + } + + public void setInstallPlace(String installPlace) { + this.installPlace = installPlace; + } + + public String getIntactState() { + return intactState; + } + + public void setIntactState(String intactState) { + this.intactState = intactState; + } + + public String getIsCalibrationTestEquipment() { + return isCalibrationTestEquipment; + } + + public void setIsCalibrationTestEquipment(String isCalibrationTestEquipment) { + this.isCalibrationTestEquipment = isCalibrationTestEquipment; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getIsFixedAssets() { + return isFixedAssets; + } + + public void setIsFixedAssets(String isFixedAssets) { + this.isFixedAssets = isFixedAssets; + } + + public String getIsMeasureAccount() { + return isMeasureAccount; + } + + public void setIsMeasureAccount(String isMeasureAccount) { + this.isMeasureAccount = isMeasureAccount; + } + + public String getIsStandardSupportEquipment() { + return isStandardSupportEquipment; + } + + public void setIsStandardSupportEquipment(String isStandardSupportEquipment) { + this.isStandardSupportEquipment = isStandardSupportEquipment; + } + + public String getLabelBind() { + return labelBind; + } + + public void setLabelBind(String labelBind) { + this.labelBind = labelBind; + } + + public String getMajorCategory() { + return majorCategory; + } + + public void setMajorCategory(String majorCategory) { + this.majorCategory = majorCategory; + } + + public String getMajorCategoryName() { + return majorCategoryName; + } + + public void setMajorCategoryName(String majorCategoryName) { + this.majorCategoryName = majorCategoryName; + } + + public String getManagerLevel() { + return managerLevel; + } + + public void setManagerLevel(String managerLevel) { + this.managerLevel = managerLevel; + } + + public String getManagerLevelName() { + return managerLevelName; + } + + public void setManagerLevelName(String managerLevelName) { + this.managerLevelName = managerLevelName; + } + + public String getManagerState() { + return managerState; + } + + public void setManagerState(String managerState) { + this.managerState = managerState; + } + + public String getManagerStateName() { + return managerStateName; + } + + public void setManagerStateName(String managerStateName) { + this.managerStateName = managerStateName; + } + + public String getManufacturer() { + return manufacturer; + } + + public void setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + } + + public String getManufacturerCountry() { + return manufacturerCountry; + } + + public void setManufacturerCountry(String manufacturerCountry) { + this.manufacturerCountry = manufacturerCountry; + } + + public String getManufacturingDate() { + return manufacturingDate; + } + + public void setManufacturingDate(String manufacturingDate) { + this.manufacturingDate = manufacturingDate; + } + + public String getManufacturingNo() { + return manufacturingNo; + } + + public void setManufacturingNo(String manufacturingNo) { + this.manufacturingNo = manufacturingNo; + } + + public String getMesureCycle() { + return mesureCycle; + } + + public void setMesureCycle(String mesureCycle) { + this.mesureCycle = mesureCycle; + } + + public String getMesureDate() { + return mesureDate; + } + + public void setMesureDate(String mesureDate) { + this.mesureDate = mesureDate; + } + + public String getMesureDept() { + return mesureDept; + } + + public void setMesureDept(String mesureDept) { + this.mesureDept = mesureDept; + } + + public String getMesureRange() { + return mesureRange; + } + + public void setMesureRange(String mesureRange) { + this.mesureRange = mesureRange; + } + + public String getMesureResult() { + return mesureResult; + } + + public void setMesureResult(String mesureResult) { + this.mesureResult = mesureResult; + } + + public String getMesureResultName() { + return mesureResultName; + } + + public void setMesureResultName(String mesureResultName) { + this.mesureResultName = mesureResultName; + } + + public String getMesureType() { + return mesureType; + } + + public void setMesureType(String mesureType) { + this.mesureType = mesureType; + } + + public String getMesureTypeName() { + return mesureTypeName; + } + + public void setMesureTypeName(String mesureTypeName) { + this.mesureTypeName = mesureTypeName; + } + + public String getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getOriginValue() { + return originValue; + } + + public void setOriginValue(String originValue) { + this.originValue = originValue; + } + + public String getOverallDimension() { + return overallDimension; + } + + public void setOverallDimension(String overallDimension) { + this.overallDimension = overallDimension; + } + + public String getPresentOriginValue() { + return presentOriginValue; + } + + public void setPresentOriginValue(String presentOriginValue) { + this.presentOriginValue = presentOriginValue; + } + + public String getPurpose() { + return purpose; + } + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getSinglePrice() { + return singlePrice; + } + + public void setSinglePrice(String singlePrice) { + this.singlePrice = singlePrice; + } + + public String getSupportStandardEquipmentName() { + return supportStandardEquipmentName; + } + + public void setSupportStandardEquipmentName(String supportStandardEquipmentName) { + this.supportStandardEquipmentName = supportStandardEquipmentName; + } + + public String getSupportStandardEquipmentNo() { + return supportStandardEquipmentNo; + } + + public void setSupportStandardEquipmentNo(String supportStandardEquipmentNo) { + this.supportStandardEquipmentNo = supportStandardEquipmentNo; + } + + public String getTechnicalLevel() { + return technicalLevel; + } + + public void setTechnicalLevel(String technicalLevel) { + this.technicalLevel = technicalLevel; + } + + public String getUncertainty() { + return uncertainty; + } + + public void setUncertainty(String uncertainty) { + this.uncertainty = uncertainty; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getUseDept() { + return useDept; + } + + public void setUseDept(String useDept) { + this.useDept = useDept; + } + + public String getUseDeptName() { + return useDeptName; + } + + public void setUseDeptName(String useDeptName) { + this.useDeptName = useDeptName; + } + + public String getUsePerson() { + return usePerson; + } + + public void setUsePerson(String usePerson) { + this.usePerson = usePerson; + } + + public String getUsePersonName() { + return usePersonName; + } + + public void setUsePersonName(String usePersonName) { + this.usePersonName = usePersonName; + } + + public String getValidDate() { + return validDate; + } + + public void setValidDate(String validDate) { + this.validDate = validDate; + } + + public int getVersion() { + return version; + } + + public void setVersion(int version) { + this.version = version; + } + + public String getWeight() { + return weight; + } + + public void setWeight(String weight) { + this.weight = weight; + } + } + } +} diff --git a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt index a3f514f..46e5eef 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt @@ -35,4 +35,24 @@ @QueryMap limit: Map, @QueryMap offset: Map ): String + + /** + * 获取设备列表 + */ + @POST("/meter/assets/listPage") + suspend fun getEquipmentList( + @Header("token") token: String, + @Body requestBody: RequestBody, + @QueryMap limit: Map, + @QueryMap offset: Map + ): String + + /** + * 获取设备详情 + */ + @POST("/meter/assets/detail") + suspend fun getEquipmentDetail( + @Header("token") token: String, + @Body requestBody: RequestBody + ): String } \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt index 444a872..386a1d8 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt @@ -6,8 +6,10 @@ import com.pengxh.kt.lite.utils.SaveKeyValues import okhttp3.MediaType.Companion.toMediaType import okhttp3.RequestBody.Companion.toRequestBody +import org.json.JSONArray import org.json.JSONObject + object RetrofitServiceManager { private val api by lazy { @@ -73,4 +75,71 @@ offsetMap["offset"] = offset return api.getNoticeList(AuthenticationHelper.token!!, requestBody, limitMap, offsetMap) } + + /** + * 获取设备列表 + */ + suspend fun getEquipmentList( + equipmentNo: String, + equipmentName: String, + mesureType: String, + managerState: String, + useDept: String, + assetType: String, + equipmentCategory: String, + isCalibrationTestEquipment: String, + isMeasureAccount: String, + isStandardSupportEquipment: String, + isFixedAssets: String, + validStartDate: String, + validEndDate: String, + abc: String, + ids: Array, + offset: Int + ): String { + val paramObject = JSONObject() + paramObject.put("equipmentNo", equipmentNo) + paramObject.put("equipmentName", equipmentName) + paramObject.put("mesureType", mesureType) + paramObject.put("managerState", managerState) + paramObject.put("useDept", useDept) + paramObject.put("assetType", assetType) + paramObject.put("equipmentCategory", equipmentCategory) + paramObject.put("isCalibrationTestEquipment", isCalibrationTestEquipment) + paramObject.put("isMeasureAccount", isMeasureAccount) + paramObject.put("isStandardSupportEquipment", isStandardSupportEquipment) + paramObject.put("isFixedAssets", isFixedAssets) + paramObject.put("validStartDate", validStartDate) + paramObject.put("validEndDate", validEndDate) + paramObject.put("abc", abc) + + val jsonArray = JSONArray() + ids.forEach { + jsonArray.put(it) + } + paramObject.put("ids", jsonArray) + + val requestBody = paramObject.toString().toRequestBody( + "application/json;charset=UTF-8".toMediaType() + ) + + val limitMap = HashMap() + limitMap["limit"] = LocaleConstant.PAGE_LIMIT + + val offsetMap = HashMap() + offsetMap["offset"] = offset + return api.getEquipmentList(AuthenticationHelper.token!!, requestBody, limitMap, offsetMap) + } + + /** + * 获取设备详情 + */ + suspend fun getEquipmentDetail(id: String): String { + val paramObject = JSONObject() + paramObject.put("id", id) + val requestBody = paramObject.toString().toRequestBody( + "application/json;charset=UTF-8".toMediaType() + ) + return api.getEquipmentDetail(AuthenticationHelper.token!!, requestBody) + } } \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt deleted file mode 100644 index a5bb60b..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt +++ /dev/null @@ -1,104 +0,0 @@ -package com.casic.xz.meterage.view - -import android.annotation.SuppressLint -import android.graphics.Paint -import androidx.lifecycle.ViewModelProvider -import com.casic.xz.meterage.R -import com.casic.xz.meterage.extensions.combineImagePath -import com.casic.xz.meterage.extensions.formatTextFromHtml -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.vm.NoticeViewModel -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.extensions.convertColor -import com.pengxh.kt.lite.extensions.navigatePageTo -import com.pengxh.kt.lite.extensions.obtainScreenWidth -import com.pengxh.kt.lite.extensions.show -import com.pengxh.kt.lite.utils.Constant -import kotlinx.android.synthetic.main.activity_notice_detail.* -import kotlinx.android.synthetic.main.include_base_title.* -import java.util.* - -@SuppressLint("SetTextI18n") -class NoticeDetailActivity : KotlinBaseActivity() { - - private lateinit var noticeViewModel: NoticeViewModel - - override fun initData() { - leftBackView.setOnClickListener { finish() } - titleView.text = "通知公告" - - val args = intent.getStringArrayListExtra(Constant.INTENT_PARAM)!! - - noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] - noticeViewModel.getNoticeList(args[0], args[1], args[2], "", "", 1) - noticeViewModel.noticeResult.observe(this, { - if (it.code == 200) { - val dataRow = it.data?.rows!![0] - - noticeDateView.text = dataRow.noticeTime - noticePublisherView.text = "发布人 ${dataRow.noticePublisher}" - noticeCompanyView.text = "发布单位 ${dataRow.noticeCompany}" - - noticeNoView.text = dataRow.noticeNo - noticeTitleView.text = dataRow.noticeTitle - noticeSketchView.text = dataRow.noticeSketch - - dataRow.noticeContent.formatTextFromHtml( - this, noticeContentView, obtainScreenWidth() - ) - - if (dataRow.minioFileName.isNullOrBlank()) { - minioFileView.text = "暂无附件" - } else { - val minioFileName = dataRow.minioFileName - - minioFileView.text = minioFileName - val textPaint = minioFileView.paint - textPaint.flags = Paint.UNDERLINE_TEXT_FLAG - textPaint.isAntiAlias = true - minioFileView.setTextColor(R.color.themeColor.convertColor(this)) - - minioFileView.setOnClickListener { - //查看附件 - if (minioFileName.endsWith("pdf")) { - navigatePageTo(minioFileName) - } else if ( - minioFileName.endsWith("doc") || - minioFileName.endsWith("docx") - ) { - navigatePageTo(minioFileName) - } else if (minioFileName.endsWith("txt")) { - navigatePageTo(minioFileName) - } else if ( - minioFileName.endsWith("png") || - minioFileName.endsWith("jpeg") || - minioFileName.endsWith("jpg") - ) { - val urls = ArrayList() - urls.add(minioFileName.combineImagePath()) - navigatePageTo(0, urls) - } else { - "文件类型未知,无法打开附件".show(this) - } - } - } - } - }) - } - - override fun initEvent() { - - } - - override fun initLayoutView(): Int = R.layout.activity_notice_detail - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/NoticeListActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/NoticeListActivity.kt deleted file mode 100644 index 15f6a16..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/NoticeListActivity.kt +++ /dev/null @@ -1,180 +0,0 @@ -package com.casic.xz.meterage.view - -import android.os.Handler -import android.util.Log -import android.view.View -import androidx.lifecycle.ViewModelProvider -import com.casic.xz.meterage.R -import com.casic.xz.meterage.adapter.NoticeListAdapter -import com.casic.xz.meterage.extensions.addAll -import com.casic.xz.meterage.extensions.combineFilePath -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.extensions.showEmptyPage -import com.casic.xz.meterage.model.NoticeListModel -import com.casic.xz.meterage.vm.NoticeViewModel -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.extensions.navigatePageTo -import com.pengxh.kt.lite.extensions.show -import com.pengxh.kt.lite.utils.WeakReferenceHandler -import com.pengxh.kt.lite.widget.dialog.AlertControlDialog -import kotlinx.android.synthetic.main.activity_notice_list.* -import kotlinx.android.synthetic.main.include_empty_view.* - -class NoticeListActivity : KotlinBaseActivity() { - - private lateinit var weakReferenceHandler: WeakReferenceHandler - private lateinit var noticeViewModel: NoticeViewModel - private lateinit var noticeListAdapter: NoticeListAdapter - private var dataBeans: MutableList = ArrayList() - private var pageIndex = 1 - private var isRefresh = false - private var isLoadMore = false - - override fun initData() { - weakReferenceHandler = WeakReferenceHandler(callback) - noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] - noticeViewModel.noticeResult.observe(this, { - if (it.code == 200) { - val dataRows = it.data?.rows!! -// countBadeNumber(dataRows) - when { - isRefresh -> { - dataBeans.clear() - dataBeans = dataRows - noticeLayout.finishRefresh() - isRefresh = false - } - isLoadMore -> { - if (dataRows.size == 0) { - "到底了,别拉了".show(this) - } - dataBeans.addAll(dataRows) - noticeLayout.finishLoadMore() - isLoadMore = false - } - else -> { - dataBeans = dataRows - } - } - weakReferenceHandler.sendEmptyMessage(2023013101) - } - }) - } - - override fun initEvent() { - leftBackView.setOnClickListener { finish() } - rightOperateView.setOnClickListener { - AlertControlDialog.Builder() - .setContext(this) - .setTitle("提示") - .setMessage("确定将所有未读消息标为已读?") - .setNegativeButton("取消") - .setPositiveButton("确定") - .setOnDialogButtonClickListener(object : - AlertControlDialog.OnDialogButtonClickListener { - override fun onCancelClick() { - - } - - override fun onConfirmClick() { - //TODO 设置为已读 - } - }).build().show() - } - - if (hasNoticePermission()) { - openSystemNoticeLayout.visibility = View.GONE - openSystemNoticeLayout.visibility = View.GONE - } else { - openSystemNoticeLayout.setOnClickListener { - - } - - - closeLayoutView.setOnClickListener { - openSystemNoticeLayout.visibility = View.GONE - } - } - - noticeLayout.setOnRefreshListener { - isRefresh = true - //刷新之后页码重置 - pageIndex = 1 - getNoticeListByPage() - } - - noticeLayout.setOnLoadMoreListener { - isLoadMore = true - pageIndex++ - getNoticeListByPage() - } - } - - override fun onResume() { - super.onResume() - pageIndex = 1 - getNoticeListByPage() - } - - private fun getNoticeListByPage() { - noticeViewModel.getNoticeList("", "", "", "", "", pageIndex) - } - - private val callback = Handler.Callback { - when (it.what) { - 2023013101 -> { - if (isRefresh || isLoadMore) { - noticeListAdapter.notifyDataSetChanged() - } else { - if (dataBeans.size == 0) { - emptyView!!.showEmptyPage("没有任何消息") { - pageIndex = 1 - getNoticeListByPage() - } - } else { - emptyView!!.hide() - noticeListAdapter = NoticeListAdapter(this, dataBeans) - noticeRecyclerView.adapter = noticeListAdapter - noticeListAdapter.setOnItemClickListener(object : - NoticeListAdapter.OnItemClickListener { - override fun onItemClicked(position: Int) { - val rowsModel = dataBeans[position] - val allArgs = addAll( - rowsModel.noticeNo, - rowsModel.noticeTitle, - rowsModel.noticePublisher, - "", - "" - ) - Log.d( - "Casic", - "NoticeListActivity => onItemClicked: ${rowsModel.minioFileName.combineFilePath()}" - ) - navigatePageTo(allArgs) - } - }) - } - } - } - } - true - } - - //TODO 判断是否开启通知权限 - private fun hasNoticePermission(): Boolean { - - return false - } - - override fun initLayoutView(): Int = R.layout.activity_notice_list - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/PreviewDocumentActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/PreviewDocumentActivity.kt deleted file mode 100644 index e233ddc..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/PreviewDocumentActivity.kt +++ /dev/null @@ -1,24 +0,0 @@ -package com.casic.xz.meterage.view - -import com.casic.xz.meterage.R -import com.pengxh.kt.lite.base.KotlinBaseActivity - -class PreviewDocumentActivity : KotlinBaseActivity() { - override fun initData() { - - } - - override fun initEvent() { - - } - - override fun initLayoutView(): Int = R.layout.activity_preview_doc - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/PreviewPdfActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/PreviewPdfActivity.kt deleted file mode 100644 index 39f8ac2..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/PreviewPdfActivity.kt +++ /dev/null @@ -1,62 +0,0 @@ -package com.casic.xz.meterage.view - -import com.casic.xz.meterage.R -import com.casic.xz.meterage.extensions.combineFilePath -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.utils.LoadingDialogHub -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.callback.OnDownloadListener -import com.pengxh.kt.lite.extensions.createDownloadFileDir -import com.pengxh.kt.lite.extensions.downloadFile -import com.pengxh.kt.lite.utils.Constant -import kotlinx.android.synthetic.main.activity_preview_pdf.* -import kotlinx.android.synthetic.main.include_base_title.* -import java.io.File -import java.io.FileInputStream - - -class PreviewPdfActivity : KotlinBaseActivity() { - - override fun initData() { - val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! - titleView.text = minioFileName - - val url = minioFileName.combineFilePath() - url.downloadFile(createDownloadFileDir().toString(), - object : OnDownloadListener { - override fun onDownloadStart(totalBytes: Long) { - runOnUiThread { - LoadingDialogHub.show(this@PreviewPdfActivity, "附件加载中") - } - } - - override fun onProgressChanged(currentBytes: Long) { - - } - - override fun onDownloadEnd(file: File?) { - runOnUiThread { - LoadingDialogHub.dismiss() - } - val inputStream = FileInputStream(file) - pdfView.fromStream(inputStream).load() - } - }) - } - - override fun initEvent() { - leftBackView.setOnClickListener { finish() } - } - - override fun initLayoutView(): Int = R.layout.activity_preview_pdf - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/PreviewTextActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/PreviewTextActivity.kt deleted file mode 100644 index d634ca3..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/PreviewTextActivity.kt +++ /dev/null @@ -1,60 +0,0 @@ -package com.casic.xz.meterage.view - -import com.casic.xz.meterage.R -import com.casic.xz.meterage.extensions.combineFilePath -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.utils.LoadingDialogHub -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.callback.OnDownloadListener -import com.pengxh.kt.lite.extensions.createDownloadFileDir -import com.pengxh.kt.lite.extensions.downloadFile -import com.pengxh.kt.lite.extensions.read -import com.pengxh.kt.lite.utils.Constant -import kotlinx.android.synthetic.main.activity_preview_txt.* -import kotlinx.android.synthetic.main.include_base_title.* -import java.io.File - -class PreviewTextActivity : KotlinBaseActivity() { - - override fun initData() { - val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! - titleView.text = minioFileName - - val url = minioFileName.combineFilePath() - url.downloadFile(createDownloadFileDir().toString(), - object : OnDownloadListener { - override fun onDownloadStart(totalBytes: Long) { - runOnUiThread { - LoadingDialogHub.show(this@PreviewTextActivity, "附件加载中") - } - } - - override fun onProgressChanged(currentBytes: Long) { - - } - - override fun onDownloadEnd(file: File?) { - runOnUiThread { - LoadingDialogHub.dismiss() - textView.text = file?.read() - } - } - }) - } - - override fun initEvent() { - leftBackView.setOnClickListener { finish() } - } - - override fun initLayoutView(): Int = R.layout.activity_preview_txt - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentActivity.kt new file mode 100644 index 0000000..35ca098 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentActivity.kt @@ -0,0 +1,158 @@ +package com.casic.xz.meterage.view.home + +import android.os.Handler +import androidx.lifecycle.ViewModelProvider +import androidx.recyclerview.widget.DividerItemDecoration +import com.casic.xz.meterage.R +import com.casic.xz.meterage.adapter.EquipmentListAdapter +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.extensions.showEmptyPage +import com.casic.xz.meterage.model.EquipmentListModel +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.casic.xz.meterage.vm.EquipmentViewModel +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.extensions.navigatePageTo +import com.pengxh.kt.lite.extensions.show +import com.pengxh.kt.lite.utils.WeakReferenceHandler +import com.pengxh.kt.lite.vm.LoadState +import kotlinx.android.synthetic.main.activity_equipment.* +import kotlinx.android.synthetic.main.include_empty_view.* +import kotlinx.android.synthetic.main.include_search_title.* + +class EquipmentActivity : KotlinBaseActivity() { + + private lateinit var weakReferenceHandler: WeakReferenceHandler + private lateinit var equipmentViewModel: EquipmentViewModel + private lateinit var equipmentListAdapter: EquipmentListAdapter + private var dataBeans: MutableList = ArrayList() + private var pageIndex = 1 + private var isRefresh = false + private var isLoadMore = false + + override fun initData() { + weakReferenceHandler = WeakReferenceHandler(callback) + equipmentViewModel = ViewModelProvider(this)[EquipmentViewModel::class.java] + equipmentViewModel.equipmentResult.observe(this, { + if (it.code == 200) { + val dataRows = it.data?.rows!! + when { + isRefresh -> { + dataBeans.clear() + dataBeans = dataRows + equipmentLayout.finishRefresh() + isRefresh = false + } + isLoadMore -> { + if (dataRows.size == 0) { + "到底了,别拉了".show(this) + } + dataBeans.addAll(dataRows) + equipmentLayout.finishLoadMore() + isLoadMore = false + } + else -> { + dataBeans = dataRows + } + } + weakReferenceHandler.sendEmptyMessage(2023020801) + } + }) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + rightOperateView.setOnClickListener { + + } + + equipmentLayout.setOnRefreshListener { + isRefresh = true + //刷新之后页码重置 + pageIndex = 1 + getEquipmentListByPage() + } + + equipmentLayout.setOnLoadMoreListener { + isLoadMore = true + pageIndex++ + getEquipmentListByPage() + } + } + + override fun initLayoutView(): Int = R.layout.activity_equipment + + override fun observeRequestState() { + equipmentViewModel.loadState.observe(this, { + when (it) { + LoadState.Loading -> LoadingDialogHub.show(this, "数据加载中...") + else -> LoadingDialogHub.dismiss() + } + }) + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + titleView.text = "仪器设备" + } + + override fun onResume() { + super.onResume() + pageIndex = 1 + getEquipmentListByPage() + } + + private fun getEquipmentListByPage() { + equipmentViewModel.getEquipmentList( + "", + "", + "", + "", + "", + "1", + "", + "", + "", + "", + "", + "", + "", + "", + arrayOf(), + pageIndex + ) + } + + private val callback = Handler.Callback { + when (it.what) { + 2023020801 -> { + if (isRefresh || isLoadMore) { + equipmentListAdapter.notifyDataSetChanged() + } else { + if (dataBeans.size == 0) { + emptyView!!.showEmptyPage("无设备") { + pageIndex = 1 + getEquipmentListByPage() + } + } else { + emptyView!!.hide() + equipmentListAdapter = EquipmentListAdapter(this, dataBeans) + equipmentRecyclerView.addItemDecoration( + DividerItemDecoration(this, DividerItemDecoration.VERTICAL) + ) + equipmentRecyclerView.adapter = equipmentListAdapter + equipmentListAdapter.setOnItemClickListener(object : + EquipmentListAdapter.OnItemClickListener { + override fun onItemClicked(position: Int) { + val rowsModel = dataBeans[position] + navigatePageTo(rowsModel.id) + } + }) + } + } + } + } + true + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentDetailActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentDetailActivity.kt new file mode 100644 index 0000000..7dee13c --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentDetailActivity.kt @@ -0,0 +1,53 @@ +package com.casic.xz.meterage.view.home + +import androidx.fragment.app.Fragment +import com.casic.xz.meterage.R +import com.casic.xz.meterage.adapter.SubViewPagerAdapter +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.fragment.equipment.* +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.utils.Constant +import kotlinx.android.synthetic.main.activity_equipment.rootView +import kotlinx.android.synthetic.main.activity_equipment_detail.* +import kotlinx.android.synthetic.main.include_base_title.* + +class EquipmentDetailActivity : KotlinBaseActivity() { + + private var fragmentPages: ArrayList = ArrayList() + + override fun initData() { + val equipmentId = intent.getStringExtra(Constant.INTENT_PARAM)!! + + fragmentPages.add(BasicInformationFragment(equipmentId)) + fragmentPages.add(InspectionRecordFragment()) + fragmentPages.add(ChangeRecordFragment()) + fragmentPages.add(UsageRecordFragment()) + fragmentPages.add(CertificateFragment()) + + val equipmentPageTitles = arrayOf("基础信息", "周检记录", "状态变更记录", "使用记录", "检定证书") + + equipmentViewPager.adapter = SubViewPagerAdapter( + supportFragmentManager, fragmentPages, equipmentPageTitles + ) + equipmentViewPager.offscreenPageLimit = fragmentPages.size + //绑定 + topTabLayout.setupWithViewPager(equipmentViewPager) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + } + + override fun initLayoutView(): Int = R.layout.activity_equipment_detail + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + titleView.text = "仪器设备" + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeDetailActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeDetailActivity.kt new file mode 100644 index 0000000..6fe0022 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeDetailActivity.kt @@ -0,0 +1,105 @@ +package com.casic.xz.meterage.view.notice + +import android.annotation.SuppressLint +import android.graphics.Paint +import androidx.lifecycle.ViewModelProvider +import com.casic.xz.meterage.R +import com.casic.xz.meterage.extensions.combineImagePath +import com.casic.xz.meterage.extensions.formatTextFromHtml +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.view.BigImageActivity +import com.casic.xz.meterage.vm.NoticeViewModel +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.extensions.convertColor +import com.pengxh.kt.lite.extensions.navigatePageTo +import com.pengxh.kt.lite.extensions.obtainScreenWidth +import com.pengxh.kt.lite.extensions.show +import com.pengxh.kt.lite.utils.Constant +import kotlinx.android.synthetic.main.activity_notice_detail.* +import kotlinx.android.synthetic.main.include_base_title.* +import java.util.* + +@SuppressLint("SetTextI18n") +class NoticeDetailActivity : KotlinBaseActivity() { + + private lateinit var noticeViewModel: NoticeViewModel + + override fun initData() { + leftBackView.setOnClickListener { finish() } + titleView.text = "通知公告" + + val args = intent.getStringArrayListExtra(Constant.INTENT_PARAM)!! + + noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] + noticeViewModel.getNoticeList(args[0], args[1], args[2], "", "", 1) + noticeViewModel.noticeResult.observe(this, { + if (it.code == 200) { + val dataRow = it.data?.rows!![0] + + noticeDateView.text = dataRow.noticeTime + noticePublisherView.text = "发布人 ${dataRow.noticePublisher}" + noticeCompanyView.text = "发布单位 ${dataRow.noticeCompany}" + + noticeNoView.text = dataRow.noticeNo + noticeTitleView.text = dataRow.noticeTitle + noticeSketchView.text = dataRow.noticeSketch + + dataRow.noticeContent.formatTextFromHtml( + this, noticeContentView, obtainScreenWidth() + ) + + if (dataRow.minioFileName.isNullOrBlank()) { + minioFileView.text = "暂无附件" + } else { + val minioFileName = dataRow.minioFileName + + minioFileView.text = minioFileName + val textPaint = minioFileView.paint + textPaint.flags = Paint.UNDERLINE_TEXT_FLAG + textPaint.isAntiAlias = true + minioFileView.setTextColor(R.color.themeColor.convertColor(this)) + + minioFileView.setOnClickListener { + //查看附件 + if (minioFileName.endsWith("pdf")) { + navigatePageTo(minioFileName) + } else if ( + minioFileName.endsWith("doc") || + minioFileName.endsWith("docx") + ) { + navigatePageTo(minioFileName) + } else if (minioFileName.endsWith("txt")) { + navigatePageTo(minioFileName) + } else if ( + minioFileName.endsWith("png") || + minioFileName.endsWith("jpeg") || + minioFileName.endsWith("jpg") + ) { + val urls = ArrayList() + urls.add(minioFileName.combineImagePath()) + navigatePageTo(0, urls) + } else { + "文件类型未知,无法打开附件".show(this) + } + } + } + } + }) + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.activity_notice_detail + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + } +} \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 3892b5a..02160cd 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -34,16 +34,18 @@ - - - - - - - + + + + + + + + + +) : RecyclerView.Adapter() { + + private var layoutInflater: LayoutInflater = LayoutInflater.from(context) + + override fun getItemCount(): Int = dataRows.size + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = ItemViewHolder( + layoutInflater.inflate(R.layout.item_equipment_rv_l, parent, false) + ) + + override fun onBindViewHolder(holder: ItemViewHolder, position: Int) { + //绑定数据 + val rowsBean = dataRows[position] + holder.equipmentNameView.text = rowsBean.equipmentName + holder.equipmentCodeView.text = rowsBean.equipmentNo + holder.equipmentDateView.text = rowsBean.enableDate + holder.equipmentLibView.text = rowsBean.useDeptName + + //绑定事件 + holder.itemView.setOnClickListener { + listener?.onItemClicked(position) + } + } + + inner class ItemViewHolder(view: View) : RecyclerView.ViewHolder(view) { + var equipmentNameView: TextView = view.findViewById(R.id.equipmentNameView) + var equipmentCodeView: TextView = view.findViewById(R.id.equipmentCodeView) + var equipmentDateView: TextView = view.findViewById(R.id.equipmentDateView) + var equipmentLibView: TextView = view.findViewById(R.id.equipmentLibView) + } + + private var listener: OnItemClickListener? = null + + interface OnItemClickListener { + fun onItemClicked(position: Int) + } + + fun setOnItemClickListener(onClickListener: OnItemClickListener?) { + this.listener = onClickListener + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt index b4628f3..d970b55 100644 --- a/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt +++ b/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt @@ -5,7 +5,8 @@ import com.casic.xz.meterage.R import com.casic.xz.meterage.adapter.HomeGridAdapter import com.casic.xz.meterage.utils.LocaleConstant -import com.casic.xz.meterage.view.NoticeListActivity +import com.casic.xz.meterage.view.home.EquipmentActivity +import com.casic.xz.meterage.view.notice.NoticeListActivity import com.casic.xz.meterage.vm.NoticeViewModel import com.pengxh.kt.lite.base.KotlinBaseFragment import com.pengxh.kt.lite.extensions.navigatePageTo @@ -36,8 +37,19 @@ homeFuncRecyclerView.adapter = homeAdapter homeAdapter.setOnGridItemClickListener(object : HomeGridAdapter.OnGridItemClickListener { override fun onItemClick(position: Int) { - when (position) { - + when (LocaleConstant.HOME_FUNC_OPERATE[position]) { + "仪器设备" -> requireContext().navigatePageTo() +// "标准装置" -> requireContext().navigatePageTo() +// "证书报告" -> requireContext().navigatePageTo() +// "委托需求" -> requireContext().navigatePageTo() +// "访客" -> requireContext().navigatePageTo() +// "标准规范" -> requireContext().navigatePageTo() +// "能力列表" -> requireContext().navigatePageTo() +// "计量培训" -> requireContext().navigatePageTo() +// "合同发票" -> requireContext().navigatePageTo() +// "业务统计" -> requireContext().navigatePageTo() +// "客户列表" -> requireContext().navigatePageTo() +// "外场检测" -> requireContext().navigatePageTo() } } }) diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt index 7e75abe..56dc5ec 100644 --- a/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt +++ b/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt @@ -2,9 +2,11 @@ import android.view.View import androidx.lifecycle.ViewModelProvider +import com.bumptech.glide.Glide +import com.bumptech.glide.request.RequestOptions import com.casic.xz.meterage.R import com.casic.xz.meterage.utils.LocaleConstant -import com.casic.xz.meterage.view.NoticeListActivity +import com.casic.xz.meterage.view.notice.NoticeListActivity import com.casic.xz.meterage.vm.NoticeViewModel import com.casic.xz.meterage.vm.UserViewModel import com.pengxh.kt.lite.base.KotlinBaseFragment @@ -23,6 +25,12 @@ val data = it.data userNameView.text = data.name userUnitView.text = data.deptName + +// Glide.with(requireContext()) +// .load(R.mipmap.default_avatar) +// .apply(RequestOptions.circleCropTransform()) +// .placeholder(R.mipmap.load_image_error) +// .into(userAvatarView) } }) diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt new file mode 100644 index 0000000..cf22646 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt @@ -0,0 +1,103 @@ +package com.casic.xz.meterage.fragment.equipment + +import android.graphics.Paint +import androidx.lifecycle.ViewModelProvider +import com.casic.xz.meterage.R +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.casic.xz.meterage.vm.EquipmentViewModel +import com.pengxh.kt.lite.base.KotlinBaseFragment +import com.pengxh.kt.lite.extensions.convertColor +import com.pengxh.kt.lite.vm.LoadState +import kotlinx.android.synthetic.main.fragment_basic_information.* + +class BasicInformationFragment(private val id: String) : KotlinBaseFragment() { + + private lateinit var equipmentViewModel: EquipmentViewModel + + override fun initData() { + equipmentViewModel = ViewModelProvider(this)[EquipmentViewModel::class.java] + equipmentViewModel.getEquipmentDetail(id) + equipmentViewModel.equipmentDetailResult.observe(this, { + if (it.code == 200) { + val data = it.data!! + + equipmentCodeView.text = data.equipmentNo + equipmentNameView.text = data.equipmentName + manufacturerView.text = data.manufacturer + factoryNumberView.text = data.manufacturingNo + modelView.text = data.modelNo + verificationMethodView.text = data.mesureTypeName + measuringRangeView.text = data.mesureRange + uncertaintyView.text = data.uncertainty + firstUseView.text = data.createTime + originalValueView.text = data.originValue + usageDeptView.text = data.useDeptName + userView.text = data.usePersonName + managementStatusView.text = data.managerStateName + verificationDeptView.text = data.useDeptName +// nextVerificationDeptView.text = data. + verificationPeriodView.text = data.mesureCycle + verificationDateView.text = data.mesureDate + effectiveDateView.text = data.validDate + verificationResultsView.text = data.mesureResultName + abcView.text = data.abcName + isNeedTechnicalView.text = if ( + data.isCalibrationTestEquipment.isNullOrBlank() || data.isCalibrationTestEquipment == "0" + ) { + "否" + } else { + "是" + } + + isStandingBook.text = if ( + data.isMeasureAccount.isNullOrBlank() || data.isMeasureAccount == "0" + ) { + "否" + } else { + "是" + } + + isStandardView.text = if ( + data.isStandardSupportEquipment.isNullOrBlank() || data.isStandardSupportEquipment == "0" + ) { + "否" + } else { + "是" + } + remarkView.text = data.remark + if (data.fileList.size == 0) { + instructionsView.text = "暂无" + } else { + instructionsView.text = "查看附件列表" + val textPaint = instructionsView.paint + textPaint.flags = Paint.UNDERLINE_TEXT_FLAG + textPaint.isAntiAlias = true + instructionsView.setTextColor(R.color.themeColor.convertColor(requireContext())) + + instructionsView.setOnClickListener { + + } + } + } + }) + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_basic_information + + override fun observeRequestState() { + equipmentViewModel.loadState.observe(this, { + when (it) { + LoadState.Loading -> LoadingDialogHub.show(requireActivity(), "数据加载中...") + else -> LoadingDialogHub.dismiss() + } + }) + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt new file mode 100644 index 0000000..0b4a747 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class CertificateFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_certificate + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt new file mode 100644 index 0000000..f05c491 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class ChangeRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_change_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt new file mode 100644 index 0000000..849ffa5 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class InspectionRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_inspection_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt new file mode 100644 index 0000000..aa4edd9 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class UsageRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_usage_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java b/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java new file mode 100644 index 0000000..0b9124e --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java @@ -0,0 +1,760 @@ +package com.casic.xz.meterage.model; + +import java.util.List; + +public class EquipmentDetailModel { + + private int code; + private DataModel data; + private String message; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataModel getData() { + return data; + } + + public void setData(DataModel data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public static class DataModel { + private String abc; + private String abcName; + private String assetNo; + private String assetSource; + private String assetType; + private String assetTypeName; + private String attribute; + private String capitalSource; + private String capitalSourceName; + private String cardEstablishmentDate; + private String createTime; + private String createUser; + private String depreciationMethod; + private String depreciationMethodName; + private String depreciationPeriod; + private String enableDate; + private String equipmentCategory; + private String equipmentCategoryName; + private String equipmentName; + private String equipmentNo; + private String equipmentSpecifications; + private String equipmentType; + private String equipmentTypeName; + private List fileList; + private String id; + private String installIncidentalExpenses; + private String installPlace; + private String intactState; + private String isCalibrationTestEquipment; + private int isDel; + private String isFixedAssets; + private String isMeasureAccount; + private String isStandardSupportEquipment; + private String labelBind; + private String majorCategory; + private String majorCategoryName; + private String managerLevel; + private String managerLevelName; + private String managerState; + private String managerStateName; + private String manufacturer; + private String manufacturerCountry; + private String manufacturingDate; + private String manufacturingNo; + private String mesureCycle; + private String mesureDate; + private String mesureDept; + private String mesureRange; + private String mesureResult; + private String mesureResultName; + private String mesureType; + private String mesureTypeName; + private String modelNo; + private String originValue; + private String overallDimension; + private String presentOriginValue; + private String purpose; + private String remark; + private String singlePrice; + private String supportStandardEquipmentName; + private String supportStandardEquipmentNo; + private String technicalLevel; + private String uncertainty; + private String updateTime; + private String useDept; + private String useDeptName; + private String usePerson; + private String usePersonName; + private String validDate; + private int version; + private String weight; + + public String getAbc() { + return abc; + } + + public void setAbc(String abc) { + this.abc = abc; + } + + public String getAbcName() { + return abcName; + } + + public void setAbcName(String abcName) { + this.abcName = abcName; + } + + public String getAssetNo() { + return assetNo; + } + + public void setAssetNo(String assetNo) { + this.assetNo = assetNo; + } + + public String getAssetSource() { + return assetSource; + } + + public void setAssetSource(String assetSource) { + this.assetSource = assetSource; + } + + public String getAssetType() { + return assetType; + } + + public void setAssetType(String assetType) { + this.assetType = assetType; + } + + public String getAssetTypeName() { + return assetTypeName; + } + + public void setAssetTypeName(String assetTypeName) { + this.assetTypeName = assetTypeName; + } + + public String getAttribute() { + return attribute; + } + + public void setAttribute(String attribute) { + this.attribute = attribute; + } + + public String getCapitalSource() { + return capitalSource; + } + + public void setCapitalSource(String capitalSource) { + this.capitalSource = capitalSource; + } + + public String getCapitalSourceName() { + return capitalSourceName; + } + + public void setCapitalSourceName(String capitalSourceName) { + this.capitalSourceName = capitalSourceName; + } + + public String getCardEstablishmentDate() { + return cardEstablishmentDate; + } + + public void setCardEstablishmentDate(String cardEstablishmentDate) { + this.cardEstablishmentDate = cardEstablishmentDate; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getDepreciationMethod() { + return depreciationMethod; + } + + public void setDepreciationMethod(String depreciationMethod) { + this.depreciationMethod = depreciationMethod; + } + + public String getDepreciationMethodName() { + return depreciationMethodName; + } + + public void setDepreciationMethodName(String depreciationMethodName) { + this.depreciationMethodName = depreciationMethodName; + } + + public String getDepreciationPeriod() { + return depreciationPeriod; + } + + public void setDepreciationPeriod(String depreciationPeriod) { + this.depreciationPeriod = depreciationPeriod; + } + + public String getEnableDate() { + return enableDate; + } + + public void setEnableDate(String enableDate) { + this.enableDate = enableDate; + } + + public String getEquipmentCategory() { + return equipmentCategory; + } + + public void setEquipmentCategory(String equipmentCategory) { + this.equipmentCategory = equipmentCategory; + } + + public String getEquipmentCategoryName() { + return equipmentCategoryName; + } + + public void setEquipmentCategoryName(String equipmentCategoryName) { + this.equipmentCategoryName = equipmentCategoryName; + } + + public String getEquipmentName() { + return equipmentName; + } + + public void setEquipmentName(String equipmentName) { + this.equipmentName = equipmentName; + } + + public String getEquipmentNo() { + return equipmentNo; + } + + public void setEquipmentNo(String equipmentNo) { + this.equipmentNo = equipmentNo; + } + + public String getEquipmentSpecifications() { + return equipmentSpecifications; + } + + public void setEquipmentSpecifications(String equipmentSpecifications) { + this.equipmentSpecifications = equipmentSpecifications; + } + + public String getEquipmentType() { + return equipmentType; + } + + public void setEquipmentType(String equipmentType) { + this.equipmentType = equipmentType; + } + + public String getEquipmentTypeName() { + return equipmentTypeName; + } + + public void setEquipmentTypeName(String equipmentTypeName) { + this.equipmentTypeName = equipmentTypeName; + } + + public List getFileList() { + return fileList; + } + + public void setFileList(List fileList) { + this.fileList = fileList; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getInstallIncidentalExpenses() { + return installIncidentalExpenses; + } + + public void setInstallIncidentalExpenses(String installIncidentalExpenses) { + this.installIncidentalExpenses = installIncidentalExpenses; + } + + public String getInstallPlace() { + return installPlace; + } + + public void setInstallPlace(String installPlace) { + this.installPlace = installPlace; + } + + public String getIntactState() { + return intactState; + } + + public void setIntactState(String intactState) { + this.intactState = intactState; + } + + public String getIsCalibrationTestEquipment() { + return isCalibrationTestEquipment; + } + + public void setIsCalibrationTestEquipment(String isCalibrationTestEquipment) { + this.isCalibrationTestEquipment = isCalibrationTestEquipment; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getIsFixedAssets() { + return isFixedAssets; + } + + public void setIsFixedAssets(String isFixedAssets) { + this.isFixedAssets = isFixedAssets; + } + + public String getIsMeasureAccount() { + return isMeasureAccount; + } + + public void setIsMeasureAccount(String isMeasureAccount) { + this.isMeasureAccount = isMeasureAccount; + } + + public String getIsStandardSupportEquipment() { + return isStandardSupportEquipment; + } + + public void setIsStandardSupportEquipment(String isStandardSupportEquipment) { + this.isStandardSupportEquipment = isStandardSupportEquipment; + } + + public String getLabelBind() { + return labelBind; + } + + public void setLabelBind(String labelBind) { + this.labelBind = labelBind; + } + + public String getMajorCategory() { + return majorCategory; + } + + public void setMajorCategory(String majorCategory) { + this.majorCategory = majorCategory; + } + + public String getMajorCategoryName() { + return majorCategoryName; + } + + public void setMajorCategoryName(String majorCategoryName) { + this.majorCategoryName = majorCategoryName; + } + + public String getManagerLevel() { + return managerLevel; + } + + public void setManagerLevel(String managerLevel) { + this.managerLevel = managerLevel; + } + + public String getManagerLevelName() { + return managerLevelName; + } + + public void setManagerLevelName(String managerLevelName) { + this.managerLevelName = managerLevelName; + } + + public String getManagerState() { + return managerState; + } + + public void setManagerState(String managerState) { + this.managerState = managerState; + } + + public String getManagerStateName() { + return managerStateName; + } + + public void setManagerStateName(String managerStateName) { + this.managerStateName = managerStateName; + } + + public String getManufacturer() { + return manufacturer; + } + + public void setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + } + + public String getManufacturerCountry() { + return manufacturerCountry; + } + + public void setManufacturerCountry(String manufacturerCountry) { + this.manufacturerCountry = manufacturerCountry; + } + + public String getManufacturingDate() { + return manufacturingDate; + } + + public void setManufacturingDate(String manufacturingDate) { + this.manufacturingDate = manufacturingDate; + } + + public String getManufacturingNo() { + return manufacturingNo; + } + + public void setManufacturingNo(String manufacturingNo) { + this.manufacturingNo = manufacturingNo; + } + + public String getMesureCycle() { + return mesureCycle; + } + + public void setMesureCycle(String mesureCycle) { + this.mesureCycle = mesureCycle; + } + + public String getMesureDate() { + return mesureDate; + } + + public void setMesureDate(String mesureDate) { + this.mesureDate = mesureDate; + } + + public String getMesureDept() { + return mesureDept; + } + + public void setMesureDept(String mesureDept) { + this.mesureDept = mesureDept; + } + + public String getMesureRange() { + return mesureRange; + } + + public void setMesureRange(String mesureRange) { + this.mesureRange = mesureRange; + } + + public String getMesureResult() { + return mesureResult; + } + + public void setMesureResult(String mesureResult) { + this.mesureResult = mesureResult; + } + + public String getMesureResultName() { + return mesureResultName; + } + + public void setMesureResultName(String mesureResultName) { + this.mesureResultName = mesureResultName; + } + + public String getMesureType() { + return mesureType; + } + + public void setMesureType(String mesureType) { + this.mesureType = mesureType; + } + + public String getMesureTypeName() { + return mesureTypeName; + } + + public void setMesureTypeName(String mesureTypeName) { + this.mesureTypeName = mesureTypeName; + } + + public String getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getOriginValue() { + return originValue; + } + + public void setOriginValue(String originValue) { + this.originValue = originValue; + } + + public String getOverallDimension() { + return overallDimension; + } + + public void setOverallDimension(String overallDimension) { + this.overallDimension = overallDimension; + } + + public String getPresentOriginValue() { + return presentOriginValue; + } + + public void setPresentOriginValue(String presentOriginValue) { + this.presentOriginValue = presentOriginValue; + } + + public String getPurpose() { + return purpose; + } + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getSinglePrice() { + return singlePrice; + } + + public void setSinglePrice(String singlePrice) { + this.singlePrice = singlePrice; + } + + public String getSupportStandardEquipmentName() { + return supportStandardEquipmentName; + } + + public void setSupportStandardEquipmentName(String supportStandardEquipmentName) { + this.supportStandardEquipmentName = supportStandardEquipmentName; + } + + public String getSupportStandardEquipmentNo() { + return supportStandardEquipmentNo; + } + + public void setSupportStandardEquipmentNo(String supportStandardEquipmentNo) { + this.supportStandardEquipmentNo = supportStandardEquipmentNo; + } + + public String getTechnicalLevel() { + return technicalLevel; + } + + public void setTechnicalLevel(String technicalLevel) { + this.technicalLevel = technicalLevel; + } + + public String getUncertainty() { + return uncertainty; + } + + public void setUncertainty(String uncertainty) { + this.uncertainty = uncertainty; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getUseDept() { + return useDept; + } + + public void setUseDept(String useDept) { + this.useDept = useDept; + } + + public String getUseDeptName() { + return useDeptName; + } + + public void setUseDeptName(String useDeptName) { + this.useDeptName = useDeptName; + } + + public String getUsePerson() { + return usePerson; + } + + public void setUsePerson(String usePerson) { + this.usePerson = usePerson; + } + + public String getUsePersonName() { + return usePersonName; + } + + public void setUsePersonName(String usePersonName) { + this.usePersonName = usePersonName; + } + + public String getValidDate() { + return validDate; + } + + public void setValidDate(String validDate) { + this.validDate = validDate; + } + + public int getVersion() { + return version; + } + + public void setVersion(int version) { + this.version = version; + } + + public String getWeight() { + return weight; + } + + public void setWeight(String weight) { + this.weight = weight; + } + + public static class FileListModel { + private String assetId; + private String createTime; + private String createUser; + private String fileName; + private String id; + private int isDel; + private String minioFileName; + private String remark; + private String updateTime; + + public String getAssetId() { + return assetId; + } + + public void setAssetId(String assetId) { + this.assetId = assetId; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getFileName() { + return fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getMinioFileName() { + return minioFileName; + } + + public void setMinioFileName(String minioFileName) { + this.minioFileName = minioFileName; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + } + } +} diff --git a/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java b/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java new file mode 100644 index 0000000..15fc128 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java @@ -0,0 +1,697 @@ +package com.casic.xz.meterage.model; + +import java.util.List; + +public class EquipmentListModel { + + private int code; + private DataModel data; + private String message; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataModel getData() { + return data; + } + + public void setData(DataModel data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public static class DataModel { + private List rows; + private int total; + + public List getRows() { + return rows; + } + + public void setRows(List rows) { + this.rows = rows; + } + + public int getTotal() { + return total; + } + + public void setTotal(int total) { + this.total = total; + } + + public static class RowsModel { + private String abc; + private String abcName; + private String assetNo; + private String assetSource; + private String assetType; + private String assetTypeName; + private String attribute; + private String capitalSource; + private String capitalSourceName; + private String cardEstablishmentDate; + private String createTime; + private String createUser; + private String depreciationMethod; + private String depreciationMethodName; + private String depreciationPeriod; + private String enableDate; + private String equipmentCategory; + private String equipmentCategoryName; + private String equipmentName; + private String equipmentNo; + private String equipmentSpecifications; + private String equipmentType; + private String equipmentTypeName; + private String fileList; + private String id; + private String installIncidentalExpenses; + private String installPlace; + private String intactState; + private String isCalibrationTestEquipment; + private int isDel; + private String isFixedAssets; + private String isMeasureAccount; + private String isStandardSupportEquipment; + private String labelBind; + private String majorCategory; + private String majorCategoryName; + private String managerLevel; + private String managerLevelName; + private String managerState; + private String managerStateName; + private String manufacturer; + private String manufacturerCountry; + private String manufacturingDate; + private String manufacturingNo; + private String mesureCycle; + private String mesureDate; + private String mesureDept; + private String mesureRange; + private String mesureResult; + private String mesureResultName; + private String mesureType; + private String mesureTypeName; + private String modelNo; + private String originValue; + private String overallDimension; + private String presentOriginValue; + private String purpose; + private String remark; + private String singlePrice; + private String supportStandardEquipmentName; + private String supportStandardEquipmentNo; + private String technicalLevel; + private String uncertainty; + private String updateTime; + private String useDept; + private String useDeptName; + private String usePerson; + private String usePersonName; + private String validDate; + private int version; + private String weight; + + public String getAbc() { + return abc; + } + + public void setAbc(String abc) { + this.abc = abc; + } + + public String getAbcName() { + return abcName; + } + + public void setAbcName(String abcName) { + this.abcName = abcName; + } + + public String getAssetNo() { + return assetNo; + } + + public void setAssetNo(String assetNo) { + this.assetNo = assetNo; + } + + public String getAssetSource() { + return assetSource; + } + + public void setAssetSource(String assetSource) { + this.assetSource = assetSource; + } + + public String getAssetType() { + return assetType; + } + + public void setAssetType(String assetType) { + this.assetType = assetType; + } + + public String getAssetTypeName() { + return assetTypeName; + } + + public void setAssetTypeName(String assetTypeName) { + this.assetTypeName = assetTypeName; + } + + public String getAttribute() { + return attribute; + } + + public void setAttribute(String attribute) { + this.attribute = attribute; + } + + public String getCapitalSource() { + return capitalSource; + } + + public void setCapitalSource(String capitalSource) { + this.capitalSource = capitalSource; + } + + public String getCapitalSourceName() { + return capitalSourceName; + } + + public void setCapitalSourceName(String capitalSourceName) { + this.capitalSourceName = capitalSourceName; + } + + public String getCardEstablishmentDate() { + return cardEstablishmentDate; + } + + public void setCardEstablishmentDate(String cardEstablishmentDate) { + this.cardEstablishmentDate = cardEstablishmentDate; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getDepreciationMethod() { + return depreciationMethod; + } + + public void setDepreciationMethod(String depreciationMethod) { + this.depreciationMethod = depreciationMethod; + } + + public String getDepreciationMethodName() { + return depreciationMethodName; + } + + public void setDepreciationMethodName(String depreciationMethodName) { + this.depreciationMethodName = depreciationMethodName; + } + + public String getDepreciationPeriod() { + return depreciationPeriod; + } + + public void setDepreciationPeriod(String depreciationPeriod) { + this.depreciationPeriod = depreciationPeriod; + } + + public String getEnableDate() { + return enableDate; + } + + public void setEnableDate(String enableDate) { + this.enableDate = enableDate; + } + + public String getEquipmentCategory() { + return equipmentCategory; + } + + public void setEquipmentCategory(String equipmentCategory) { + this.equipmentCategory = equipmentCategory; + } + + public String getEquipmentCategoryName() { + return equipmentCategoryName; + } + + public void setEquipmentCategoryName(String equipmentCategoryName) { + this.equipmentCategoryName = equipmentCategoryName; + } + + public String getEquipmentName() { + return equipmentName; + } + + public void setEquipmentName(String equipmentName) { + this.equipmentName = equipmentName; + } + + public String getEquipmentNo() { + return equipmentNo; + } + + public void setEquipmentNo(String equipmentNo) { + this.equipmentNo = equipmentNo; + } + + public String getEquipmentSpecifications() { + return equipmentSpecifications; + } + + public void setEquipmentSpecifications(String equipmentSpecifications) { + this.equipmentSpecifications = equipmentSpecifications; + } + + public String getEquipmentType() { + return equipmentType; + } + + public void setEquipmentType(String equipmentType) { + this.equipmentType = equipmentType; + } + + public String getEquipmentTypeName() { + return equipmentTypeName; + } + + public void setEquipmentTypeName(String equipmentTypeName) { + this.equipmentTypeName = equipmentTypeName; + } + + public String getFileList() { + return fileList; + } + + public void setFileList(String fileList) { + this.fileList = fileList; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getInstallIncidentalExpenses() { + return installIncidentalExpenses; + } + + public void setInstallIncidentalExpenses(String installIncidentalExpenses) { + this.installIncidentalExpenses = installIncidentalExpenses; + } + + public String getInstallPlace() { + return installPlace; + } + + public void setInstallPlace(String installPlace) { + this.installPlace = installPlace; + } + + public String getIntactState() { + return intactState; + } + + public void setIntactState(String intactState) { + this.intactState = intactState; + } + + public String getIsCalibrationTestEquipment() { + return isCalibrationTestEquipment; + } + + public void setIsCalibrationTestEquipment(String isCalibrationTestEquipment) { + this.isCalibrationTestEquipment = isCalibrationTestEquipment; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getIsFixedAssets() { + return isFixedAssets; + } + + public void setIsFixedAssets(String isFixedAssets) { + this.isFixedAssets = isFixedAssets; + } + + public String getIsMeasureAccount() { + return isMeasureAccount; + } + + public void setIsMeasureAccount(String isMeasureAccount) { + this.isMeasureAccount = isMeasureAccount; + } + + public String getIsStandardSupportEquipment() { + return isStandardSupportEquipment; + } + + public void setIsStandardSupportEquipment(String isStandardSupportEquipment) { + this.isStandardSupportEquipment = isStandardSupportEquipment; + } + + public String getLabelBind() { + return labelBind; + } + + public void setLabelBind(String labelBind) { + this.labelBind = labelBind; + } + + public String getMajorCategory() { + return majorCategory; + } + + public void setMajorCategory(String majorCategory) { + this.majorCategory = majorCategory; + } + + public String getMajorCategoryName() { + return majorCategoryName; + } + + public void setMajorCategoryName(String majorCategoryName) { + this.majorCategoryName = majorCategoryName; + } + + public String getManagerLevel() { + return managerLevel; + } + + public void setManagerLevel(String managerLevel) { + this.managerLevel = managerLevel; + } + + public String getManagerLevelName() { + return managerLevelName; + } + + public void setManagerLevelName(String managerLevelName) { + this.managerLevelName = managerLevelName; + } + + public String getManagerState() { + return managerState; + } + + public void setManagerState(String managerState) { + this.managerState = managerState; + } + + public String getManagerStateName() { + return managerStateName; + } + + public void setManagerStateName(String managerStateName) { + this.managerStateName = managerStateName; + } + + public String getManufacturer() { + return manufacturer; + } + + public void setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + } + + public String getManufacturerCountry() { + return manufacturerCountry; + } + + public void setManufacturerCountry(String manufacturerCountry) { + this.manufacturerCountry = manufacturerCountry; + } + + public String getManufacturingDate() { + return manufacturingDate; + } + + public void setManufacturingDate(String manufacturingDate) { + this.manufacturingDate = manufacturingDate; + } + + public String getManufacturingNo() { + return manufacturingNo; + } + + public void setManufacturingNo(String manufacturingNo) { + this.manufacturingNo = manufacturingNo; + } + + public String getMesureCycle() { + return mesureCycle; + } + + public void setMesureCycle(String mesureCycle) { + this.mesureCycle = mesureCycle; + } + + public String getMesureDate() { + return mesureDate; + } + + public void setMesureDate(String mesureDate) { + this.mesureDate = mesureDate; + } + + public String getMesureDept() { + return mesureDept; + } + + public void setMesureDept(String mesureDept) { + this.mesureDept = mesureDept; + } + + public String getMesureRange() { + return mesureRange; + } + + public void setMesureRange(String mesureRange) { + this.mesureRange = mesureRange; + } + + public String getMesureResult() { + return mesureResult; + } + + public void setMesureResult(String mesureResult) { + this.mesureResult = mesureResult; + } + + public String getMesureResultName() { + return mesureResultName; + } + + public void setMesureResultName(String mesureResultName) { + this.mesureResultName = mesureResultName; + } + + public String getMesureType() { + return mesureType; + } + + public void setMesureType(String mesureType) { + this.mesureType = mesureType; + } + + public String getMesureTypeName() { + return mesureTypeName; + } + + public void setMesureTypeName(String mesureTypeName) { + this.mesureTypeName = mesureTypeName; + } + + public String getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getOriginValue() { + return originValue; + } + + public void setOriginValue(String originValue) { + this.originValue = originValue; + } + + public String getOverallDimension() { + return overallDimension; + } + + public void setOverallDimension(String overallDimension) { + this.overallDimension = overallDimension; + } + + public String getPresentOriginValue() { + return presentOriginValue; + } + + public void setPresentOriginValue(String presentOriginValue) { + this.presentOriginValue = presentOriginValue; + } + + public String getPurpose() { + return purpose; + } + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getSinglePrice() { + return singlePrice; + } + + public void setSinglePrice(String singlePrice) { + this.singlePrice = singlePrice; + } + + public String getSupportStandardEquipmentName() { + return supportStandardEquipmentName; + } + + public void setSupportStandardEquipmentName(String supportStandardEquipmentName) { + this.supportStandardEquipmentName = supportStandardEquipmentName; + } + + public String getSupportStandardEquipmentNo() { + return supportStandardEquipmentNo; + } + + public void setSupportStandardEquipmentNo(String supportStandardEquipmentNo) { + this.supportStandardEquipmentNo = supportStandardEquipmentNo; + } + + public String getTechnicalLevel() { + return technicalLevel; + } + + public void setTechnicalLevel(String technicalLevel) { + this.technicalLevel = technicalLevel; + } + + public String getUncertainty() { + return uncertainty; + } + + public void setUncertainty(String uncertainty) { + this.uncertainty = uncertainty; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getUseDept() { + return useDept; + } + + public void setUseDept(String useDept) { + this.useDept = useDept; + } + + public String getUseDeptName() { + return useDeptName; + } + + public void setUseDeptName(String useDeptName) { + this.useDeptName = useDeptName; + } + + public String getUsePerson() { + return usePerson; + } + + public void setUsePerson(String usePerson) { + this.usePerson = usePerson; + } + + public String getUsePersonName() { + return usePersonName; + } + + public void setUsePersonName(String usePersonName) { + this.usePersonName = usePersonName; + } + + public String getValidDate() { + return validDate; + } + + public void setValidDate(String validDate) { + this.validDate = validDate; + } + + public int getVersion() { + return version; + } + + public void setVersion(int version) { + this.version = version; + } + + public String getWeight() { + return weight; + } + + public void setWeight(String weight) { + this.weight = weight; + } + } + } +} diff --git a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt index a3f514f..46e5eef 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt @@ -35,4 +35,24 @@ @QueryMap limit: Map, @QueryMap offset: Map ): String + + /** + * 获取设备列表 + */ + @POST("/meter/assets/listPage") + suspend fun getEquipmentList( + @Header("token") token: String, + @Body requestBody: RequestBody, + @QueryMap limit: Map, + @QueryMap offset: Map + ): String + + /** + * 获取设备详情 + */ + @POST("/meter/assets/detail") + suspend fun getEquipmentDetail( + @Header("token") token: String, + @Body requestBody: RequestBody + ): String } \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt index 444a872..386a1d8 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt @@ -6,8 +6,10 @@ import com.pengxh.kt.lite.utils.SaveKeyValues import okhttp3.MediaType.Companion.toMediaType import okhttp3.RequestBody.Companion.toRequestBody +import org.json.JSONArray import org.json.JSONObject + object RetrofitServiceManager { private val api by lazy { @@ -73,4 +75,71 @@ offsetMap["offset"] = offset return api.getNoticeList(AuthenticationHelper.token!!, requestBody, limitMap, offsetMap) } + + /** + * 获取设备列表 + */ + suspend fun getEquipmentList( + equipmentNo: String, + equipmentName: String, + mesureType: String, + managerState: String, + useDept: String, + assetType: String, + equipmentCategory: String, + isCalibrationTestEquipment: String, + isMeasureAccount: String, + isStandardSupportEquipment: String, + isFixedAssets: String, + validStartDate: String, + validEndDate: String, + abc: String, + ids: Array, + offset: Int + ): String { + val paramObject = JSONObject() + paramObject.put("equipmentNo", equipmentNo) + paramObject.put("equipmentName", equipmentName) + paramObject.put("mesureType", mesureType) + paramObject.put("managerState", managerState) + paramObject.put("useDept", useDept) + paramObject.put("assetType", assetType) + paramObject.put("equipmentCategory", equipmentCategory) + paramObject.put("isCalibrationTestEquipment", isCalibrationTestEquipment) + paramObject.put("isMeasureAccount", isMeasureAccount) + paramObject.put("isStandardSupportEquipment", isStandardSupportEquipment) + paramObject.put("isFixedAssets", isFixedAssets) + paramObject.put("validStartDate", validStartDate) + paramObject.put("validEndDate", validEndDate) + paramObject.put("abc", abc) + + val jsonArray = JSONArray() + ids.forEach { + jsonArray.put(it) + } + paramObject.put("ids", jsonArray) + + val requestBody = paramObject.toString().toRequestBody( + "application/json;charset=UTF-8".toMediaType() + ) + + val limitMap = HashMap() + limitMap["limit"] = LocaleConstant.PAGE_LIMIT + + val offsetMap = HashMap() + offsetMap["offset"] = offset + return api.getEquipmentList(AuthenticationHelper.token!!, requestBody, limitMap, offsetMap) + } + + /** + * 获取设备详情 + */ + suspend fun getEquipmentDetail(id: String): String { + val paramObject = JSONObject() + paramObject.put("id", id) + val requestBody = paramObject.toString().toRequestBody( + "application/json;charset=UTF-8".toMediaType() + ) + return api.getEquipmentDetail(AuthenticationHelper.token!!, requestBody) + } } \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt deleted file mode 100644 index a5bb60b..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt +++ /dev/null @@ -1,104 +0,0 @@ -package com.casic.xz.meterage.view - -import android.annotation.SuppressLint -import android.graphics.Paint -import androidx.lifecycle.ViewModelProvider -import com.casic.xz.meterage.R -import com.casic.xz.meterage.extensions.combineImagePath -import com.casic.xz.meterage.extensions.formatTextFromHtml -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.vm.NoticeViewModel -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.extensions.convertColor -import com.pengxh.kt.lite.extensions.navigatePageTo -import com.pengxh.kt.lite.extensions.obtainScreenWidth -import com.pengxh.kt.lite.extensions.show -import com.pengxh.kt.lite.utils.Constant -import kotlinx.android.synthetic.main.activity_notice_detail.* -import kotlinx.android.synthetic.main.include_base_title.* -import java.util.* - -@SuppressLint("SetTextI18n") -class NoticeDetailActivity : KotlinBaseActivity() { - - private lateinit var noticeViewModel: NoticeViewModel - - override fun initData() { - leftBackView.setOnClickListener { finish() } - titleView.text = "通知公告" - - val args = intent.getStringArrayListExtra(Constant.INTENT_PARAM)!! - - noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] - noticeViewModel.getNoticeList(args[0], args[1], args[2], "", "", 1) - noticeViewModel.noticeResult.observe(this, { - if (it.code == 200) { - val dataRow = it.data?.rows!![0] - - noticeDateView.text = dataRow.noticeTime - noticePublisherView.text = "发布人 ${dataRow.noticePublisher}" - noticeCompanyView.text = "发布单位 ${dataRow.noticeCompany}" - - noticeNoView.text = dataRow.noticeNo - noticeTitleView.text = dataRow.noticeTitle - noticeSketchView.text = dataRow.noticeSketch - - dataRow.noticeContent.formatTextFromHtml( - this, noticeContentView, obtainScreenWidth() - ) - - if (dataRow.minioFileName.isNullOrBlank()) { - minioFileView.text = "暂无附件" - } else { - val minioFileName = dataRow.minioFileName - - minioFileView.text = minioFileName - val textPaint = minioFileView.paint - textPaint.flags = Paint.UNDERLINE_TEXT_FLAG - textPaint.isAntiAlias = true - minioFileView.setTextColor(R.color.themeColor.convertColor(this)) - - minioFileView.setOnClickListener { - //查看附件 - if (minioFileName.endsWith("pdf")) { - navigatePageTo(minioFileName) - } else if ( - minioFileName.endsWith("doc") || - minioFileName.endsWith("docx") - ) { - navigatePageTo(minioFileName) - } else if (minioFileName.endsWith("txt")) { - navigatePageTo(minioFileName) - } else if ( - minioFileName.endsWith("png") || - minioFileName.endsWith("jpeg") || - minioFileName.endsWith("jpg") - ) { - val urls = ArrayList() - urls.add(minioFileName.combineImagePath()) - navigatePageTo(0, urls) - } else { - "文件类型未知,无法打开附件".show(this) - } - } - } - } - }) - } - - override fun initEvent() { - - } - - override fun initLayoutView(): Int = R.layout.activity_notice_detail - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/NoticeListActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/NoticeListActivity.kt deleted file mode 100644 index 15f6a16..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/NoticeListActivity.kt +++ /dev/null @@ -1,180 +0,0 @@ -package com.casic.xz.meterage.view - -import android.os.Handler -import android.util.Log -import android.view.View -import androidx.lifecycle.ViewModelProvider -import com.casic.xz.meterage.R -import com.casic.xz.meterage.adapter.NoticeListAdapter -import com.casic.xz.meterage.extensions.addAll -import com.casic.xz.meterage.extensions.combineFilePath -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.extensions.showEmptyPage -import com.casic.xz.meterage.model.NoticeListModel -import com.casic.xz.meterage.vm.NoticeViewModel -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.extensions.navigatePageTo -import com.pengxh.kt.lite.extensions.show -import com.pengxh.kt.lite.utils.WeakReferenceHandler -import com.pengxh.kt.lite.widget.dialog.AlertControlDialog -import kotlinx.android.synthetic.main.activity_notice_list.* -import kotlinx.android.synthetic.main.include_empty_view.* - -class NoticeListActivity : KotlinBaseActivity() { - - private lateinit var weakReferenceHandler: WeakReferenceHandler - private lateinit var noticeViewModel: NoticeViewModel - private lateinit var noticeListAdapter: NoticeListAdapter - private var dataBeans: MutableList = ArrayList() - private var pageIndex = 1 - private var isRefresh = false - private var isLoadMore = false - - override fun initData() { - weakReferenceHandler = WeakReferenceHandler(callback) - noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] - noticeViewModel.noticeResult.observe(this, { - if (it.code == 200) { - val dataRows = it.data?.rows!! -// countBadeNumber(dataRows) - when { - isRefresh -> { - dataBeans.clear() - dataBeans = dataRows - noticeLayout.finishRefresh() - isRefresh = false - } - isLoadMore -> { - if (dataRows.size == 0) { - "到底了,别拉了".show(this) - } - dataBeans.addAll(dataRows) - noticeLayout.finishLoadMore() - isLoadMore = false - } - else -> { - dataBeans = dataRows - } - } - weakReferenceHandler.sendEmptyMessage(2023013101) - } - }) - } - - override fun initEvent() { - leftBackView.setOnClickListener { finish() } - rightOperateView.setOnClickListener { - AlertControlDialog.Builder() - .setContext(this) - .setTitle("提示") - .setMessage("确定将所有未读消息标为已读?") - .setNegativeButton("取消") - .setPositiveButton("确定") - .setOnDialogButtonClickListener(object : - AlertControlDialog.OnDialogButtonClickListener { - override fun onCancelClick() { - - } - - override fun onConfirmClick() { - //TODO 设置为已读 - } - }).build().show() - } - - if (hasNoticePermission()) { - openSystemNoticeLayout.visibility = View.GONE - openSystemNoticeLayout.visibility = View.GONE - } else { - openSystemNoticeLayout.setOnClickListener { - - } - - - closeLayoutView.setOnClickListener { - openSystemNoticeLayout.visibility = View.GONE - } - } - - noticeLayout.setOnRefreshListener { - isRefresh = true - //刷新之后页码重置 - pageIndex = 1 - getNoticeListByPage() - } - - noticeLayout.setOnLoadMoreListener { - isLoadMore = true - pageIndex++ - getNoticeListByPage() - } - } - - override fun onResume() { - super.onResume() - pageIndex = 1 - getNoticeListByPage() - } - - private fun getNoticeListByPage() { - noticeViewModel.getNoticeList("", "", "", "", "", pageIndex) - } - - private val callback = Handler.Callback { - when (it.what) { - 2023013101 -> { - if (isRefresh || isLoadMore) { - noticeListAdapter.notifyDataSetChanged() - } else { - if (dataBeans.size == 0) { - emptyView!!.showEmptyPage("没有任何消息") { - pageIndex = 1 - getNoticeListByPage() - } - } else { - emptyView!!.hide() - noticeListAdapter = NoticeListAdapter(this, dataBeans) - noticeRecyclerView.adapter = noticeListAdapter - noticeListAdapter.setOnItemClickListener(object : - NoticeListAdapter.OnItemClickListener { - override fun onItemClicked(position: Int) { - val rowsModel = dataBeans[position] - val allArgs = addAll( - rowsModel.noticeNo, - rowsModel.noticeTitle, - rowsModel.noticePublisher, - "", - "" - ) - Log.d( - "Casic", - "NoticeListActivity => onItemClicked: ${rowsModel.minioFileName.combineFilePath()}" - ) - navigatePageTo(allArgs) - } - }) - } - } - } - } - true - } - - //TODO 判断是否开启通知权限 - private fun hasNoticePermission(): Boolean { - - return false - } - - override fun initLayoutView(): Int = R.layout.activity_notice_list - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/PreviewDocumentActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/PreviewDocumentActivity.kt deleted file mode 100644 index e233ddc..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/PreviewDocumentActivity.kt +++ /dev/null @@ -1,24 +0,0 @@ -package com.casic.xz.meterage.view - -import com.casic.xz.meterage.R -import com.pengxh.kt.lite.base.KotlinBaseActivity - -class PreviewDocumentActivity : KotlinBaseActivity() { - override fun initData() { - - } - - override fun initEvent() { - - } - - override fun initLayoutView(): Int = R.layout.activity_preview_doc - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/PreviewPdfActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/PreviewPdfActivity.kt deleted file mode 100644 index 39f8ac2..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/PreviewPdfActivity.kt +++ /dev/null @@ -1,62 +0,0 @@ -package com.casic.xz.meterage.view - -import com.casic.xz.meterage.R -import com.casic.xz.meterage.extensions.combineFilePath -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.utils.LoadingDialogHub -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.callback.OnDownloadListener -import com.pengxh.kt.lite.extensions.createDownloadFileDir -import com.pengxh.kt.lite.extensions.downloadFile -import com.pengxh.kt.lite.utils.Constant -import kotlinx.android.synthetic.main.activity_preview_pdf.* -import kotlinx.android.synthetic.main.include_base_title.* -import java.io.File -import java.io.FileInputStream - - -class PreviewPdfActivity : KotlinBaseActivity() { - - override fun initData() { - val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! - titleView.text = minioFileName - - val url = minioFileName.combineFilePath() - url.downloadFile(createDownloadFileDir().toString(), - object : OnDownloadListener { - override fun onDownloadStart(totalBytes: Long) { - runOnUiThread { - LoadingDialogHub.show(this@PreviewPdfActivity, "附件加载中") - } - } - - override fun onProgressChanged(currentBytes: Long) { - - } - - override fun onDownloadEnd(file: File?) { - runOnUiThread { - LoadingDialogHub.dismiss() - } - val inputStream = FileInputStream(file) - pdfView.fromStream(inputStream).load() - } - }) - } - - override fun initEvent() { - leftBackView.setOnClickListener { finish() } - } - - override fun initLayoutView(): Int = R.layout.activity_preview_pdf - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/PreviewTextActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/PreviewTextActivity.kt deleted file mode 100644 index d634ca3..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/PreviewTextActivity.kt +++ /dev/null @@ -1,60 +0,0 @@ -package com.casic.xz.meterage.view - -import com.casic.xz.meterage.R -import com.casic.xz.meterage.extensions.combineFilePath -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.utils.LoadingDialogHub -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.callback.OnDownloadListener -import com.pengxh.kt.lite.extensions.createDownloadFileDir -import com.pengxh.kt.lite.extensions.downloadFile -import com.pengxh.kt.lite.extensions.read -import com.pengxh.kt.lite.utils.Constant -import kotlinx.android.synthetic.main.activity_preview_txt.* -import kotlinx.android.synthetic.main.include_base_title.* -import java.io.File - -class PreviewTextActivity : KotlinBaseActivity() { - - override fun initData() { - val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! - titleView.text = minioFileName - - val url = minioFileName.combineFilePath() - url.downloadFile(createDownloadFileDir().toString(), - object : OnDownloadListener { - override fun onDownloadStart(totalBytes: Long) { - runOnUiThread { - LoadingDialogHub.show(this@PreviewTextActivity, "附件加载中") - } - } - - override fun onProgressChanged(currentBytes: Long) { - - } - - override fun onDownloadEnd(file: File?) { - runOnUiThread { - LoadingDialogHub.dismiss() - textView.text = file?.read() - } - } - }) - } - - override fun initEvent() { - leftBackView.setOnClickListener { finish() } - } - - override fun initLayoutView(): Int = R.layout.activity_preview_txt - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentActivity.kt new file mode 100644 index 0000000..35ca098 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentActivity.kt @@ -0,0 +1,158 @@ +package com.casic.xz.meterage.view.home + +import android.os.Handler +import androidx.lifecycle.ViewModelProvider +import androidx.recyclerview.widget.DividerItemDecoration +import com.casic.xz.meterage.R +import com.casic.xz.meterage.adapter.EquipmentListAdapter +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.extensions.showEmptyPage +import com.casic.xz.meterage.model.EquipmentListModel +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.casic.xz.meterage.vm.EquipmentViewModel +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.extensions.navigatePageTo +import com.pengxh.kt.lite.extensions.show +import com.pengxh.kt.lite.utils.WeakReferenceHandler +import com.pengxh.kt.lite.vm.LoadState +import kotlinx.android.synthetic.main.activity_equipment.* +import kotlinx.android.synthetic.main.include_empty_view.* +import kotlinx.android.synthetic.main.include_search_title.* + +class EquipmentActivity : KotlinBaseActivity() { + + private lateinit var weakReferenceHandler: WeakReferenceHandler + private lateinit var equipmentViewModel: EquipmentViewModel + private lateinit var equipmentListAdapter: EquipmentListAdapter + private var dataBeans: MutableList = ArrayList() + private var pageIndex = 1 + private var isRefresh = false + private var isLoadMore = false + + override fun initData() { + weakReferenceHandler = WeakReferenceHandler(callback) + equipmentViewModel = ViewModelProvider(this)[EquipmentViewModel::class.java] + equipmentViewModel.equipmentResult.observe(this, { + if (it.code == 200) { + val dataRows = it.data?.rows!! + when { + isRefresh -> { + dataBeans.clear() + dataBeans = dataRows + equipmentLayout.finishRefresh() + isRefresh = false + } + isLoadMore -> { + if (dataRows.size == 0) { + "到底了,别拉了".show(this) + } + dataBeans.addAll(dataRows) + equipmentLayout.finishLoadMore() + isLoadMore = false + } + else -> { + dataBeans = dataRows + } + } + weakReferenceHandler.sendEmptyMessage(2023020801) + } + }) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + rightOperateView.setOnClickListener { + + } + + equipmentLayout.setOnRefreshListener { + isRefresh = true + //刷新之后页码重置 + pageIndex = 1 + getEquipmentListByPage() + } + + equipmentLayout.setOnLoadMoreListener { + isLoadMore = true + pageIndex++ + getEquipmentListByPage() + } + } + + override fun initLayoutView(): Int = R.layout.activity_equipment + + override fun observeRequestState() { + equipmentViewModel.loadState.observe(this, { + when (it) { + LoadState.Loading -> LoadingDialogHub.show(this, "数据加载中...") + else -> LoadingDialogHub.dismiss() + } + }) + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + titleView.text = "仪器设备" + } + + override fun onResume() { + super.onResume() + pageIndex = 1 + getEquipmentListByPage() + } + + private fun getEquipmentListByPage() { + equipmentViewModel.getEquipmentList( + "", + "", + "", + "", + "", + "1", + "", + "", + "", + "", + "", + "", + "", + "", + arrayOf(), + pageIndex + ) + } + + private val callback = Handler.Callback { + when (it.what) { + 2023020801 -> { + if (isRefresh || isLoadMore) { + equipmentListAdapter.notifyDataSetChanged() + } else { + if (dataBeans.size == 0) { + emptyView!!.showEmptyPage("无设备") { + pageIndex = 1 + getEquipmentListByPage() + } + } else { + emptyView!!.hide() + equipmentListAdapter = EquipmentListAdapter(this, dataBeans) + equipmentRecyclerView.addItemDecoration( + DividerItemDecoration(this, DividerItemDecoration.VERTICAL) + ) + equipmentRecyclerView.adapter = equipmentListAdapter + equipmentListAdapter.setOnItemClickListener(object : + EquipmentListAdapter.OnItemClickListener { + override fun onItemClicked(position: Int) { + val rowsModel = dataBeans[position] + navigatePageTo(rowsModel.id) + } + }) + } + } + } + } + true + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentDetailActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentDetailActivity.kt new file mode 100644 index 0000000..7dee13c --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentDetailActivity.kt @@ -0,0 +1,53 @@ +package com.casic.xz.meterage.view.home + +import androidx.fragment.app.Fragment +import com.casic.xz.meterage.R +import com.casic.xz.meterage.adapter.SubViewPagerAdapter +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.fragment.equipment.* +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.utils.Constant +import kotlinx.android.synthetic.main.activity_equipment.rootView +import kotlinx.android.synthetic.main.activity_equipment_detail.* +import kotlinx.android.synthetic.main.include_base_title.* + +class EquipmentDetailActivity : KotlinBaseActivity() { + + private var fragmentPages: ArrayList = ArrayList() + + override fun initData() { + val equipmentId = intent.getStringExtra(Constant.INTENT_PARAM)!! + + fragmentPages.add(BasicInformationFragment(equipmentId)) + fragmentPages.add(InspectionRecordFragment()) + fragmentPages.add(ChangeRecordFragment()) + fragmentPages.add(UsageRecordFragment()) + fragmentPages.add(CertificateFragment()) + + val equipmentPageTitles = arrayOf("基础信息", "周检记录", "状态变更记录", "使用记录", "检定证书") + + equipmentViewPager.adapter = SubViewPagerAdapter( + supportFragmentManager, fragmentPages, equipmentPageTitles + ) + equipmentViewPager.offscreenPageLimit = fragmentPages.size + //绑定 + topTabLayout.setupWithViewPager(equipmentViewPager) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + } + + override fun initLayoutView(): Int = R.layout.activity_equipment_detail + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + titleView.text = "仪器设备" + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeDetailActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeDetailActivity.kt new file mode 100644 index 0000000..6fe0022 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeDetailActivity.kt @@ -0,0 +1,105 @@ +package com.casic.xz.meterage.view.notice + +import android.annotation.SuppressLint +import android.graphics.Paint +import androidx.lifecycle.ViewModelProvider +import com.casic.xz.meterage.R +import com.casic.xz.meterage.extensions.combineImagePath +import com.casic.xz.meterage.extensions.formatTextFromHtml +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.view.BigImageActivity +import com.casic.xz.meterage.vm.NoticeViewModel +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.extensions.convertColor +import com.pengxh.kt.lite.extensions.navigatePageTo +import com.pengxh.kt.lite.extensions.obtainScreenWidth +import com.pengxh.kt.lite.extensions.show +import com.pengxh.kt.lite.utils.Constant +import kotlinx.android.synthetic.main.activity_notice_detail.* +import kotlinx.android.synthetic.main.include_base_title.* +import java.util.* + +@SuppressLint("SetTextI18n") +class NoticeDetailActivity : KotlinBaseActivity() { + + private lateinit var noticeViewModel: NoticeViewModel + + override fun initData() { + leftBackView.setOnClickListener { finish() } + titleView.text = "通知公告" + + val args = intent.getStringArrayListExtra(Constant.INTENT_PARAM)!! + + noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] + noticeViewModel.getNoticeList(args[0], args[1], args[2], "", "", 1) + noticeViewModel.noticeResult.observe(this, { + if (it.code == 200) { + val dataRow = it.data?.rows!![0] + + noticeDateView.text = dataRow.noticeTime + noticePublisherView.text = "发布人 ${dataRow.noticePublisher}" + noticeCompanyView.text = "发布单位 ${dataRow.noticeCompany}" + + noticeNoView.text = dataRow.noticeNo + noticeTitleView.text = dataRow.noticeTitle + noticeSketchView.text = dataRow.noticeSketch + + dataRow.noticeContent.formatTextFromHtml( + this, noticeContentView, obtainScreenWidth() + ) + + if (dataRow.minioFileName.isNullOrBlank()) { + minioFileView.text = "暂无附件" + } else { + val minioFileName = dataRow.minioFileName + + minioFileView.text = minioFileName + val textPaint = minioFileView.paint + textPaint.flags = Paint.UNDERLINE_TEXT_FLAG + textPaint.isAntiAlias = true + minioFileView.setTextColor(R.color.themeColor.convertColor(this)) + + minioFileView.setOnClickListener { + //查看附件 + if (minioFileName.endsWith("pdf")) { + navigatePageTo(minioFileName) + } else if ( + minioFileName.endsWith("doc") || + minioFileName.endsWith("docx") + ) { + navigatePageTo(minioFileName) + } else if (minioFileName.endsWith("txt")) { + navigatePageTo(minioFileName) + } else if ( + minioFileName.endsWith("png") || + minioFileName.endsWith("jpeg") || + minioFileName.endsWith("jpg") + ) { + val urls = ArrayList() + urls.add(minioFileName.combineImagePath()) + navigatePageTo(0, urls) + } else { + "文件类型未知,无法打开附件".show(this) + } + } + } + } + }) + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.activity_notice_detail + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeListActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeListActivity.kt new file mode 100644 index 0000000..31c0490 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeListActivity.kt @@ -0,0 +1,180 @@ +package com.casic.xz.meterage.view.notice + +import android.os.Handler +import android.util.Log +import android.view.View +import androidx.lifecycle.ViewModelProvider +import com.casic.xz.meterage.R +import com.casic.xz.meterage.adapter.NoticeListAdapter +import com.casic.xz.meterage.extensions.addAll +import com.casic.xz.meterage.extensions.combineFilePath +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.extensions.showEmptyPage +import com.casic.xz.meterage.model.NoticeListModel +import com.casic.xz.meterage.vm.NoticeViewModel +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.extensions.navigatePageTo +import com.pengxh.kt.lite.extensions.show +import com.pengxh.kt.lite.utils.WeakReferenceHandler +import com.pengxh.kt.lite.widget.dialog.AlertControlDialog +import kotlinx.android.synthetic.main.activity_notice_list.* +import kotlinx.android.synthetic.main.include_empty_view.* + +class NoticeListActivity : KotlinBaseActivity() { + + private lateinit var weakReferenceHandler: WeakReferenceHandler + private lateinit var noticeViewModel: NoticeViewModel + private lateinit var noticeListAdapter: NoticeListAdapter + private var dataBeans: MutableList = ArrayList() + private var pageIndex = 1 + private var isRefresh = false + private var isLoadMore = false + + override fun initData() { + weakReferenceHandler = WeakReferenceHandler(callback) + noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] + noticeViewModel.noticeResult.observe(this, { + if (it.code == 200) { + val dataRows = it.data?.rows!! +// countBadeNumber(dataRows) + when { + isRefresh -> { + dataBeans.clear() + dataBeans = dataRows + noticeLayout.finishRefresh() + isRefresh = false + } + isLoadMore -> { + if (dataRows.size == 0) { + "到底了,别拉了".show(this) + } + dataBeans.addAll(dataRows) + noticeLayout.finishLoadMore() + isLoadMore = false + } + else -> { + dataBeans = dataRows + } + } + weakReferenceHandler.sendEmptyMessage(2023013101) + } + }) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + rightOperateView.setOnClickListener { + AlertControlDialog.Builder() + .setContext(this) + .setTitle("提示") + .setMessage("确定将所有未读消息标为已读?") + .setNegativeButton("取消") + .setPositiveButton("确定") + .setOnDialogButtonClickListener(object : + AlertControlDialog.OnDialogButtonClickListener { + override fun onCancelClick() { + + } + + override fun onConfirmClick() { + //TODO 设置为已读 + } + }).build().show() + } + + if (hasNoticePermission()) { + openSystemNoticeLayout.visibility = View.GONE + openSystemNoticeLayout.visibility = View.GONE + } else { + openSystemNoticeLayout.setOnClickListener { + + } + + + closeLayoutView.setOnClickListener { + openSystemNoticeLayout.visibility = View.GONE + } + } + + noticeLayout.setOnRefreshListener { + isRefresh = true + //刷新之后页码重置 + pageIndex = 1 + getNoticeListByPage() + } + + noticeLayout.setOnLoadMoreListener { + isLoadMore = true + pageIndex++ + getNoticeListByPage() + } + } + + override fun onResume() { + super.onResume() + pageIndex = 1 + getNoticeListByPage() + } + + private fun getNoticeListByPage() { + noticeViewModel.getNoticeList("", "", "", "", "", pageIndex) + } + + private val callback = Handler.Callback { + when (it.what) { + 2023013101 -> { + if (isRefresh || isLoadMore) { + noticeListAdapter.notifyDataSetChanged() + } else { + if (dataBeans.size == 0) { + emptyView!!.showEmptyPage("没有任何消息") { + pageIndex = 1 + getNoticeListByPage() + } + } else { + emptyView!!.hide() + noticeListAdapter = NoticeListAdapter(this, dataBeans) + noticeRecyclerView.adapter = noticeListAdapter + noticeListAdapter.setOnItemClickListener(object : + NoticeListAdapter.OnItemClickListener { + override fun onItemClicked(position: Int) { + val rowsModel = dataBeans[position] + val allArgs = addAll( + rowsModel.noticeNo, + rowsModel.noticeTitle, + rowsModel.noticePublisher, + "", + "" + ) + Log.d( + "Casic", + "NoticeListActivity => onItemClicked: ${rowsModel.minioFileName.combineFilePath()}" + ) + navigatePageTo(allArgs) + } + }) + } + } + } + } + true + } + + //TODO 判断是否开启通知权限 + private fun hasNoticePermission(): Boolean { + + return false + } + + override fun initLayoutView(): Int = R.layout.activity_notice_list + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + } +} \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 3892b5a..02160cd 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -34,16 +34,18 @@ - - - - - - - + + + + + + + + + +) : RecyclerView.Adapter() { + + private var layoutInflater: LayoutInflater = LayoutInflater.from(context) + + override fun getItemCount(): Int = dataRows.size + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = ItemViewHolder( + layoutInflater.inflate(R.layout.item_equipment_rv_l, parent, false) + ) + + override fun onBindViewHolder(holder: ItemViewHolder, position: Int) { + //绑定数据 + val rowsBean = dataRows[position] + holder.equipmentNameView.text = rowsBean.equipmentName + holder.equipmentCodeView.text = rowsBean.equipmentNo + holder.equipmentDateView.text = rowsBean.enableDate + holder.equipmentLibView.text = rowsBean.useDeptName + + //绑定事件 + holder.itemView.setOnClickListener { + listener?.onItemClicked(position) + } + } + + inner class ItemViewHolder(view: View) : RecyclerView.ViewHolder(view) { + var equipmentNameView: TextView = view.findViewById(R.id.equipmentNameView) + var equipmentCodeView: TextView = view.findViewById(R.id.equipmentCodeView) + var equipmentDateView: TextView = view.findViewById(R.id.equipmentDateView) + var equipmentLibView: TextView = view.findViewById(R.id.equipmentLibView) + } + + private var listener: OnItemClickListener? = null + + interface OnItemClickListener { + fun onItemClicked(position: Int) + } + + fun setOnItemClickListener(onClickListener: OnItemClickListener?) { + this.listener = onClickListener + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt index b4628f3..d970b55 100644 --- a/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt +++ b/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt @@ -5,7 +5,8 @@ import com.casic.xz.meterage.R import com.casic.xz.meterage.adapter.HomeGridAdapter import com.casic.xz.meterage.utils.LocaleConstant -import com.casic.xz.meterage.view.NoticeListActivity +import com.casic.xz.meterage.view.home.EquipmentActivity +import com.casic.xz.meterage.view.notice.NoticeListActivity import com.casic.xz.meterage.vm.NoticeViewModel import com.pengxh.kt.lite.base.KotlinBaseFragment import com.pengxh.kt.lite.extensions.navigatePageTo @@ -36,8 +37,19 @@ homeFuncRecyclerView.adapter = homeAdapter homeAdapter.setOnGridItemClickListener(object : HomeGridAdapter.OnGridItemClickListener { override fun onItemClick(position: Int) { - when (position) { - + when (LocaleConstant.HOME_FUNC_OPERATE[position]) { + "仪器设备" -> requireContext().navigatePageTo() +// "标准装置" -> requireContext().navigatePageTo() +// "证书报告" -> requireContext().navigatePageTo() +// "委托需求" -> requireContext().navigatePageTo() +// "访客" -> requireContext().navigatePageTo() +// "标准规范" -> requireContext().navigatePageTo() +// "能力列表" -> requireContext().navigatePageTo() +// "计量培训" -> requireContext().navigatePageTo() +// "合同发票" -> requireContext().navigatePageTo() +// "业务统计" -> requireContext().navigatePageTo() +// "客户列表" -> requireContext().navigatePageTo() +// "外场检测" -> requireContext().navigatePageTo() } } }) diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt index 7e75abe..56dc5ec 100644 --- a/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt +++ b/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt @@ -2,9 +2,11 @@ import android.view.View import androidx.lifecycle.ViewModelProvider +import com.bumptech.glide.Glide +import com.bumptech.glide.request.RequestOptions import com.casic.xz.meterage.R import com.casic.xz.meterage.utils.LocaleConstant -import com.casic.xz.meterage.view.NoticeListActivity +import com.casic.xz.meterage.view.notice.NoticeListActivity import com.casic.xz.meterage.vm.NoticeViewModel import com.casic.xz.meterage.vm.UserViewModel import com.pengxh.kt.lite.base.KotlinBaseFragment @@ -23,6 +25,12 @@ val data = it.data userNameView.text = data.name userUnitView.text = data.deptName + +// Glide.with(requireContext()) +// .load(R.mipmap.default_avatar) +// .apply(RequestOptions.circleCropTransform()) +// .placeholder(R.mipmap.load_image_error) +// .into(userAvatarView) } }) diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt new file mode 100644 index 0000000..cf22646 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt @@ -0,0 +1,103 @@ +package com.casic.xz.meterage.fragment.equipment + +import android.graphics.Paint +import androidx.lifecycle.ViewModelProvider +import com.casic.xz.meterage.R +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.casic.xz.meterage.vm.EquipmentViewModel +import com.pengxh.kt.lite.base.KotlinBaseFragment +import com.pengxh.kt.lite.extensions.convertColor +import com.pengxh.kt.lite.vm.LoadState +import kotlinx.android.synthetic.main.fragment_basic_information.* + +class BasicInformationFragment(private val id: String) : KotlinBaseFragment() { + + private lateinit var equipmentViewModel: EquipmentViewModel + + override fun initData() { + equipmentViewModel = ViewModelProvider(this)[EquipmentViewModel::class.java] + equipmentViewModel.getEquipmentDetail(id) + equipmentViewModel.equipmentDetailResult.observe(this, { + if (it.code == 200) { + val data = it.data!! + + equipmentCodeView.text = data.equipmentNo + equipmentNameView.text = data.equipmentName + manufacturerView.text = data.manufacturer + factoryNumberView.text = data.manufacturingNo + modelView.text = data.modelNo + verificationMethodView.text = data.mesureTypeName + measuringRangeView.text = data.mesureRange + uncertaintyView.text = data.uncertainty + firstUseView.text = data.createTime + originalValueView.text = data.originValue + usageDeptView.text = data.useDeptName + userView.text = data.usePersonName + managementStatusView.text = data.managerStateName + verificationDeptView.text = data.useDeptName +// nextVerificationDeptView.text = data. + verificationPeriodView.text = data.mesureCycle + verificationDateView.text = data.mesureDate + effectiveDateView.text = data.validDate + verificationResultsView.text = data.mesureResultName + abcView.text = data.abcName + isNeedTechnicalView.text = if ( + data.isCalibrationTestEquipment.isNullOrBlank() || data.isCalibrationTestEquipment == "0" + ) { + "否" + } else { + "是" + } + + isStandingBook.text = if ( + data.isMeasureAccount.isNullOrBlank() || data.isMeasureAccount == "0" + ) { + "否" + } else { + "是" + } + + isStandardView.text = if ( + data.isStandardSupportEquipment.isNullOrBlank() || data.isStandardSupportEquipment == "0" + ) { + "否" + } else { + "是" + } + remarkView.text = data.remark + if (data.fileList.size == 0) { + instructionsView.text = "暂无" + } else { + instructionsView.text = "查看附件列表" + val textPaint = instructionsView.paint + textPaint.flags = Paint.UNDERLINE_TEXT_FLAG + textPaint.isAntiAlias = true + instructionsView.setTextColor(R.color.themeColor.convertColor(requireContext())) + + instructionsView.setOnClickListener { + + } + } + } + }) + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_basic_information + + override fun observeRequestState() { + equipmentViewModel.loadState.observe(this, { + when (it) { + LoadState.Loading -> LoadingDialogHub.show(requireActivity(), "数据加载中...") + else -> LoadingDialogHub.dismiss() + } + }) + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt new file mode 100644 index 0000000..0b4a747 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class CertificateFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_certificate + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt new file mode 100644 index 0000000..f05c491 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class ChangeRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_change_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt new file mode 100644 index 0000000..849ffa5 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class InspectionRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_inspection_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt new file mode 100644 index 0000000..aa4edd9 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class UsageRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_usage_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java b/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java new file mode 100644 index 0000000..0b9124e --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java @@ -0,0 +1,760 @@ +package com.casic.xz.meterage.model; + +import java.util.List; + +public class EquipmentDetailModel { + + private int code; + private DataModel data; + private String message; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataModel getData() { + return data; + } + + public void setData(DataModel data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public static class DataModel { + private String abc; + private String abcName; + private String assetNo; + private String assetSource; + private String assetType; + private String assetTypeName; + private String attribute; + private String capitalSource; + private String capitalSourceName; + private String cardEstablishmentDate; + private String createTime; + private String createUser; + private String depreciationMethod; + private String depreciationMethodName; + private String depreciationPeriod; + private String enableDate; + private String equipmentCategory; + private String equipmentCategoryName; + private String equipmentName; + private String equipmentNo; + private String equipmentSpecifications; + private String equipmentType; + private String equipmentTypeName; + private List fileList; + private String id; + private String installIncidentalExpenses; + private String installPlace; + private String intactState; + private String isCalibrationTestEquipment; + private int isDel; + private String isFixedAssets; + private String isMeasureAccount; + private String isStandardSupportEquipment; + private String labelBind; + private String majorCategory; + private String majorCategoryName; + private String managerLevel; + private String managerLevelName; + private String managerState; + private String managerStateName; + private String manufacturer; + private String manufacturerCountry; + private String manufacturingDate; + private String manufacturingNo; + private String mesureCycle; + private String mesureDate; + private String mesureDept; + private String mesureRange; + private String mesureResult; + private String mesureResultName; + private String mesureType; + private String mesureTypeName; + private String modelNo; + private String originValue; + private String overallDimension; + private String presentOriginValue; + private String purpose; + private String remark; + private String singlePrice; + private String supportStandardEquipmentName; + private String supportStandardEquipmentNo; + private String technicalLevel; + private String uncertainty; + private String updateTime; + private String useDept; + private String useDeptName; + private String usePerson; + private String usePersonName; + private String validDate; + private int version; + private String weight; + + public String getAbc() { + return abc; + } + + public void setAbc(String abc) { + this.abc = abc; + } + + public String getAbcName() { + return abcName; + } + + public void setAbcName(String abcName) { + this.abcName = abcName; + } + + public String getAssetNo() { + return assetNo; + } + + public void setAssetNo(String assetNo) { + this.assetNo = assetNo; + } + + public String getAssetSource() { + return assetSource; + } + + public void setAssetSource(String assetSource) { + this.assetSource = assetSource; + } + + public String getAssetType() { + return assetType; + } + + public void setAssetType(String assetType) { + this.assetType = assetType; + } + + public String getAssetTypeName() { + return assetTypeName; + } + + public void setAssetTypeName(String assetTypeName) { + this.assetTypeName = assetTypeName; + } + + public String getAttribute() { + return attribute; + } + + public void setAttribute(String attribute) { + this.attribute = attribute; + } + + public String getCapitalSource() { + return capitalSource; + } + + public void setCapitalSource(String capitalSource) { + this.capitalSource = capitalSource; + } + + public String getCapitalSourceName() { + return capitalSourceName; + } + + public void setCapitalSourceName(String capitalSourceName) { + this.capitalSourceName = capitalSourceName; + } + + public String getCardEstablishmentDate() { + return cardEstablishmentDate; + } + + public void setCardEstablishmentDate(String cardEstablishmentDate) { + this.cardEstablishmentDate = cardEstablishmentDate; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getDepreciationMethod() { + return depreciationMethod; + } + + public void setDepreciationMethod(String depreciationMethod) { + this.depreciationMethod = depreciationMethod; + } + + public String getDepreciationMethodName() { + return depreciationMethodName; + } + + public void setDepreciationMethodName(String depreciationMethodName) { + this.depreciationMethodName = depreciationMethodName; + } + + public String getDepreciationPeriod() { + return depreciationPeriod; + } + + public void setDepreciationPeriod(String depreciationPeriod) { + this.depreciationPeriod = depreciationPeriod; + } + + public String getEnableDate() { + return enableDate; + } + + public void setEnableDate(String enableDate) { + this.enableDate = enableDate; + } + + public String getEquipmentCategory() { + return equipmentCategory; + } + + public void setEquipmentCategory(String equipmentCategory) { + this.equipmentCategory = equipmentCategory; + } + + public String getEquipmentCategoryName() { + return equipmentCategoryName; + } + + public void setEquipmentCategoryName(String equipmentCategoryName) { + this.equipmentCategoryName = equipmentCategoryName; + } + + public String getEquipmentName() { + return equipmentName; + } + + public void setEquipmentName(String equipmentName) { + this.equipmentName = equipmentName; + } + + public String getEquipmentNo() { + return equipmentNo; + } + + public void setEquipmentNo(String equipmentNo) { + this.equipmentNo = equipmentNo; + } + + public String getEquipmentSpecifications() { + return equipmentSpecifications; + } + + public void setEquipmentSpecifications(String equipmentSpecifications) { + this.equipmentSpecifications = equipmentSpecifications; + } + + public String getEquipmentType() { + return equipmentType; + } + + public void setEquipmentType(String equipmentType) { + this.equipmentType = equipmentType; + } + + public String getEquipmentTypeName() { + return equipmentTypeName; + } + + public void setEquipmentTypeName(String equipmentTypeName) { + this.equipmentTypeName = equipmentTypeName; + } + + public List getFileList() { + return fileList; + } + + public void setFileList(List fileList) { + this.fileList = fileList; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getInstallIncidentalExpenses() { + return installIncidentalExpenses; + } + + public void setInstallIncidentalExpenses(String installIncidentalExpenses) { + this.installIncidentalExpenses = installIncidentalExpenses; + } + + public String getInstallPlace() { + return installPlace; + } + + public void setInstallPlace(String installPlace) { + this.installPlace = installPlace; + } + + public String getIntactState() { + return intactState; + } + + public void setIntactState(String intactState) { + this.intactState = intactState; + } + + public String getIsCalibrationTestEquipment() { + return isCalibrationTestEquipment; + } + + public void setIsCalibrationTestEquipment(String isCalibrationTestEquipment) { + this.isCalibrationTestEquipment = isCalibrationTestEquipment; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getIsFixedAssets() { + return isFixedAssets; + } + + public void setIsFixedAssets(String isFixedAssets) { + this.isFixedAssets = isFixedAssets; + } + + public String getIsMeasureAccount() { + return isMeasureAccount; + } + + public void setIsMeasureAccount(String isMeasureAccount) { + this.isMeasureAccount = isMeasureAccount; + } + + public String getIsStandardSupportEquipment() { + return isStandardSupportEquipment; + } + + public void setIsStandardSupportEquipment(String isStandardSupportEquipment) { + this.isStandardSupportEquipment = isStandardSupportEquipment; + } + + public String getLabelBind() { + return labelBind; + } + + public void setLabelBind(String labelBind) { + this.labelBind = labelBind; + } + + public String getMajorCategory() { + return majorCategory; + } + + public void setMajorCategory(String majorCategory) { + this.majorCategory = majorCategory; + } + + public String getMajorCategoryName() { + return majorCategoryName; + } + + public void setMajorCategoryName(String majorCategoryName) { + this.majorCategoryName = majorCategoryName; + } + + public String getManagerLevel() { + return managerLevel; + } + + public void setManagerLevel(String managerLevel) { + this.managerLevel = managerLevel; + } + + public String getManagerLevelName() { + return managerLevelName; + } + + public void setManagerLevelName(String managerLevelName) { + this.managerLevelName = managerLevelName; + } + + public String getManagerState() { + return managerState; + } + + public void setManagerState(String managerState) { + this.managerState = managerState; + } + + public String getManagerStateName() { + return managerStateName; + } + + public void setManagerStateName(String managerStateName) { + this.managerStateName = managerStateName; + } + + public String getManufacturer() { + return manufacturer; + } + + public void setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + } + + public String getManufacturerCountry() { + return manufacturerCountry; + } + + public void setManufacturerCountry(String manufacturerCountry) { + this.manufacturerCountry = manufacturerCountry; + } + + public String getManufacturingDate() { + return manufacturingDate; + } + + public void setManufacturingDate(String manufacturingDate) { + this.manufacturingDate = manufacturingDate; + } + + public String getManufacturingNo() { + return manufacturingNo; + } + + public void setManufacturingNo(String manufacturingNo) { + this.manufacturingNo = manufacturingNo; + } + + public String getMesureCycle() { + return mesureCycle; + } + + public void setMesureCycle(String mesureCycle) { + this.mesureCycle = mesureCycle; + } + + public String getMesureDate() { + return mesureDate; + } + + public void setMesureDate(String mesureDate) { + this.mesureDate = mesureDate; + } + + public String getMesureDept() { + return mesureDept; + } + + public void setMesureDept(String mesureDept) { + this.mesureDept = mesureDept; + } + + public String getMesureRange() { + return mesureRange; + } + + public void setMesureRange(String mesureRange) { + this.mesureRange = mesureRange; + } + + public String getMesureResult() { + return mesureResult; + } + + public void setMesureResult(String mesureResult) { + this.mesureResult = mesureResult; + } + + public String getMesureResultName() { + return mesureResultName; + } + + public void setMesureResultName(String mesureResultName) { + this.mesureResultName = mesureResultName; + } + + public String getMesureType() { + return mesureType; + } + + public void setMesureType(String mesureType) { + this.mesureType = mesureType; + } + + public String getMesureTypeName() { + return mesureTypeName; + } + + public void setMesureTypeName(String mesureTypeName) { + this.mesureTypeName = mesureTypeName; + } + + public String getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getOriginValue() { + return originValue; + } + + public void setOriginValue(String originValue) { + this.originValue = originValue; + } + + public String getOverallDimension() { + return overallDimension; + } + + public void setOverallDimension(String overallDimension) { + this.overallDimension = overallDimension; + } + + public String getPresentOriginValue() { + return presentOriginValue; + } + + public void setPresentOriginValue(String presentOriginValue) { + this.presentOriginValue = presentOriginValue; + } + + public String getPurpose() { + return purpose; + } + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getSinglePrice() { + return singlePrice; + } + + public void setSinglePrice(String singlePrice) { + this.singlePrice = singlePrice; + } + + public String getSupportStandardEquipmentName() { + return supportStandardEquipmentName; + } + + public void setSupportStandardEquipmentName(String supportStandardEquipmentName) { + this.supportStandardEquipmentName = supportStandardEquipmentName; + } + + public String getSupportStandardEquipmentNo() { + return supportStandardEquipmentNo; + } + + public void setSupportStandardEquipmentNo(String supportStandardEquipmentNo) { + this.supportStandardEquipmentNo = supportStandardEquipmentNo; + } + + public String getTechnicalLevel() { + return technicalLevel; + } + + public void setTechnicalLevel(String technicalLevel) { + this.technicalLevel = technicalLevel; + } + + public String getUncertainty() { + return uncertainty; + } + + public void setUncertainty(String uncertainty) { + this.uncertainty = uncertainty; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getUseDept() { + return useDept; + } + + public void setUseDept(String useDept) { + this.useDept = useDept; + } + + public String getUseDeptName() { + return useDeptName; + } + + public void setUseDeptName(String useDeptName) { + this.useDeptName = useDeptName; + } + + public String getUsePerson() { + return usePerson; + } + + public void setUsePerson(String usePerson) { + this.usePerson = usePerson; + } + + public String getUsePersonName() { + return usePersonName; + } + + public void setUsePersonName(String usePersonName) { + this.usePersonName = usePersonName; + } + + public String getValidDate() { + return validDate; + } + + public void setValidDate(String validDate) { + this.validDate = validDate; + } + + public int getVersion() { + return version; + } + + public void setVersion(int version) { + this.version = version; + } + + public String getWeight() { + return weight; + } + + public void setWeight(String weight) { + this.weight = weight; + } + + public static class FileListModel { + private String assetId; + private String createTime; + private String createUser; + private String fileName; + private String id; + private int isDel; + private String minioFileName; + private String remark; + private String updateTime; + + public String getAssetId() { + return assetId; + } + + public void setAssetId(String assetId) { + this.assetId = assetId; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getFileName() { + return fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getMinioFileName() { + return minioFileName; + } + + public void setMinioFileName(String minioFileName) { + this.minioFileName = minioFileName; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + } + } +} diff --git a/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java b/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java new file mode 100644 index 0000000..15fc128 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java @@ -0,0 +1,697 @@ +package com.casic.xz.meterage.model; + +import java.util.List; + +public class EquipmentListModel { + + private int code; + private DataModel data; + private String message; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataModel getData() { + return data; + } + + public void setData(DataModel data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public static class DataModel { + private List rows; + private int total; + + public List getRows() { + return rows; + } + + public void setRows(List rows) { + this.rows = rows; + } + + public int getTotal() { + return total; + } + + public void setTotal(int total) { + this.total = total; + } + + public static class RowsModel { + private String abc; + private String abcName; + private String assetNo; + private String assetSource; + private String assetType; + private String assetTypeName; + private String attribute; + private String capitalSource; + private String capitalSourceName; + private String cardEstablishmentDate; + private String createTime; + private String createUser; + private String depreciationMethod; + private String depreciationMethodName; + private String depreciationPeriod; + private String enableDate; + private String equipmentCategory; + private String equipmentCategoryName; + private String equipmentName; + private String equipmentNo; + private String equipmentSpecifications; + private String equipmentType; + private String equipmentTypeName; + private String fileList; + private String id; + private String installIncidentalExpenses; + private String installPlace; + private String intactState; + private String isCalibrationTestEquipment; + private int isDel; + private String isFixedAssets; + private String isMeasureAccount; + private String isStandardSupportEquipment; + private String labelBind; + private String majorCategory; + private String majorCategoryName; + private String managerLevel; + private String managerLevelName; + private String managerState; + private String managerStateName; + private String manufacturer; + private String manufacturerCountry; + private String manufacturingDate; + private String manufacturingNo; + private String mesureCycle; + private String mesureDate; + private String mesureDept; + private String mesureRange; + private String mesureResult; + private String mesureResultName; + private String mesureType; + private String mesureTypeName; + private String modelNo; + private String originValue; + private String overallDimension; + private String presentOriginValue; + private String purpose; + private String remark; + private String singlePrice; + private String supportStandardEquipmentName; + private String supportStandardEquipmentNo; + private String technicalLevel; + private String uncertainty; + private String updateTime; + private String useDept; + private String useDeptName; + private String usePerson; + private String usePersonName; + private String validDate; + private int version; + private String weight; + + public String getAbc() { + return abc; + } + + public void setAbc(String abc) { + this.abc = abc; + } + + public String getAbcName() { + return abcName; + } + + public void setAbcName(String abcName) { + this.abcName = abcName; + } + + public String getAssetNo() { + return assetNo; + } + + public void setAssetNo(String assetNo) { + this.assetNo = assetNo; + } + + public String getAssetSource() { + return assetSource; + } + + public void setAssetSource(String assetSource) { + this.assetSource = assetSource; + } + + public String getAssetType() { + return assetType; + } + + public void setAssetType(String assetType) { + this.assetType = assetType; + } + + public String getAssetTypeName() { + return assetTypeName; + } + + public void setAssetTypeName(String assetTypeName) { + this.assetTypeName = assetTypeName; + } + + public String getAttribute() { + return attribute; + } + + public void setAttribute(String attribute) { + this.attribute = attribute; + } + + public String getCapitalSource() { + return capitalSource; + } + + public void setCapitalSource(String capitalSource) { + this.capitalSource = capitalSource; + } + + public String getCapitalSourceName() { + return capitalSourceName; + } + + public void setCapitalSourceName(String capitalSourceName) { + this.capitalSourceName = capitalSourceName; + } + + public String getCardEstablishmentDate() { + return cardEstablishmentDate; + } + + public void setCardEstablishmentDate(String cardEstablishmentDate) { + this.cardEstablishmentDate = cardEstablishmentDate; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getDepreciationMethod() { + return depreciationMethod; + } + + public void setDepreciationMethod(String depreciationMethod) { + this.depreciationMethod = depreciationMethod; + } + + public String getDepreciationMethodName() { + return depreciationMethodName; + } + + public void setDepreciationMethodName(String depreciationMethodName) { + this.depreciationMethodName = depreciationMethodName; + } + + public String getDepreciationPeriod() { + return depreciationPeriod; + } + + public void setDepreciationPeriod(String depreciationPeriod) { + this.depreciationPeriod = depreciationPeriod; + } + + public String getEnableDate() { + return enableDate; + } + + public void setEnableDate(String enableDate) { + this.enableDate = enableDate; + } + + public String getEquipmentCategory() { + return equipmentCategory; + } + + public void setEquipmentCategory(String equipmentCategory) { + this.equipmentCategory = equipmentCategory; + } + + public String getEquipmentCategoryName() { + return equipmentCategoryName; + } + + public void setEquipmentCategoryName(String equipmentCategoryName) { + this.equipmentCategoryName = equipmentCategoryName; + } + + public String getEquipmentName() { + return equipmentName; + } + + public void setEquipmentName(String equipmentName) { + this.equipmentName = equipmentName; + } + + public String getEquipmentNo() { + return equipmentNo; + } + + public void setEquipmentNo(String equipmentNo) { + this.equipmentNo = equipmentNo; + } + + public String getEquipmentSpecifications() { + return equipmentSpecifications; + } + + public void setEquipmentSpecifications(String equipmentSpecifications) { + this.equipmentSpecifications = equipmentSpecifications; + } + + public String getEquipmentType() { + return equipmentType; + } + + public void setEquipmentType(String equipmentType) { + this.equipmentType = equipmentType; + } + + public String getEquipmentTypeName() { + return equipmentTypeName; + } + + public void setEquipmentTypeName(String equipmentTypeName) { + this.equipmentTypeName = equipmentTypeName; + } + + public String getFileList() { + return fileList; + } + + public void setFileList(String fileList) { + this.fileList = fileList; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getInstallIncidentalExpenses() { + return installIncidentalExpenses; + } + + public void setInstallIncidentalExpenses(String installIncidentalExpenses) { + this.installIncidentalExpenses = installIncidentalExpenses; + } + + public String getInstallPlace() { + return installPlace; + } + + public void setInstallPlace(String installPlace) { + this.installPlace = installPlace; + } + + public String getIntactState() { + return intactState; + } + + public void setIntactState(String intactState) { + this.intactState = intactState; + } + + public String getIsCalibrationTestEquipment() { + return isCalibrationTestEquipment; + } + + public void setIsCalibrationTestEquipment(String isCalibrationTestEquipment) { + this.isCalibrationTestEquipment = isCalibrationTestEquipment; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getIsFixedAssets() { + return isFixedAssets; + } + + public void setIsFixedAssets(String isFixedAssets) { + this.isFixedAssets = isFixedAssets; + } + + public String getIsMeasureAccount() { + return isMeasureAccount; + } + + public void setIsMeasureAccount(String isMeasureAccount) { + this.isMeasureAccount = isMeasureAccount; + } + + public String getIsStandardSupportEquipment() { + return isStandardSupportEquipment; + } + + public void setIsStandardSupportEquipment(String isStandardSupportEquipment) { + this.isStandardSupportEquipment = isStandardSupportEquipment; + } + + public String getLabelBind() { + return labelBind; + } + + public void setLabelBind(String labelBind) { + this.labelBind = labelBind; + } + + public String getMajorCategory() { + return majorCategory; + } + + public void setMajorCategory(String majorCategory) { + this.majorCategory = majorCategory; + } + + public String getMajorCategoryName() { + return majorCategoryName; + } + + public void setMajorCategoryName(String majorCategoryName) { + this.majorCategoryName = majorCategoryName; + } + + public String getManagerLevel() { + return managerLevel; + } + + public void setManagerLevel(String managerLevel) { + this.managerLevel = managerLevel; + } + + public String getManagerLevelName() { + return managerLevelName; + } + + public void setManagerLevelName(String managerLevelName) { + this.managerLevelName = managerLevelName; + } + + public String getManagerState() { + return managerState; + } + + public void setManagerState(String managerState) { + this.managerState = managerState; + } + + public String getManagerStateName() { + return managerStateName; + } + + public void setManagerStateName(String managerStateName) { + this.managerStateName = managerStateName; + } + + public String getManufacturer() { + return manufacturer; + } + + public void setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + } + + public String getManufacturerCountry() { + return manufacturerCountry; + } + + public void setManufacturerCountry(String manufacturerCountry) { + this.manufacturerCountry = manufacturerCountry; + } + + public String getManufacturingDate() { + return manufacturingDate; + } + + public void setManufacturingDate(String manufacturingDate) { + this.manufacturingDate = manufacturingDate; + } + + public String getManufacturingNo() { + return manufacturingNo; + } + + public void setManufacturingNo(String manufacturingNo) { + this.manufacturingNo = manufacturingNo; + } + + public String getMesureCycle() { + return mesureCycle; + } + + public void setMesureCycle(String mesureCycle) { + this.mesureCycle = mesureCycle; + } + + public String getMesureDate() { + return mesureDate; + } + + public void setMesureDate(String mesureDate) { + this.mesureDate = mesureDate; + } + + public String getMesureDept() { + return mesureDept; + } + + public void setMesureDept(String mesureDept) { + this.mesureDept = mesureDept; + } + + public String getMesureRange() { + return mesureRange; + } + + public void setMesureRange(String mesureRange) { + this.mesureRange = mesureRange; + } + + public String getMesureResult() { + return mesureResult; + } + + public void setMesureResult(String mesureResult) { + this.mesureResult = mesureResult; + } + + public String getMesureResultName() { + return mesureResultName; + } + + public void setMesureResultName(String mesureResultName) { + this.mesureResultName = mesureResultName; + } + + public String getMesureType() { + return mesureType; + } + + public void setMesureType(String mesureType) { + this.mesureType = mesureType; + } + + public String getMesureTypeName() { + return mesureTypeName; + } + + public void setMesureTypeName(String mesureTypeName) { + this.mesureTypeName = mesureTypeName; + } + + public String getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getOriginValue() { + return originValue; + } + + public void setOriginValue(String originValue) { + this.originValue = originValue; + } + + public String getOverallDimension() { + return overallDimension; + } + + public void setOverallDimension(String overallDimension) { + this.overallDimension = overallDimension; + } + + public String getPresentOriginValue() { + return presentOriginValue; + } + + public void setPresentOriginValue(String presentOriginValue) { + this.presentOriginValue = presentOriginValue; + } + + public String getPurpose() { + return purpose; + } + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getSinglePrice() { + return singlePrice; + } + + public void setSinglePrice(String singlePrice) { + this.singlePrice = singlePrice; + } + + public String getSupportStandardEquipmentName() { + return supportStandardEquipmentName; + } + + public void setSupportStandardEquipmentName(String supportStandardEquipmentName) { + this.supportStandardEquipmentName = supportStandardEquipmentName; + } + + public String getSupportStandardEquipmentNo() { + return supportStandardEquipmentNo; + } + + public void setSupportStandardEquipmentNo(String supportStandardEquipmentNo) { + this.supportStandardEquipmentNo = supportStandardEquipmentNo; + } + + public String getTechnicalLevel() { + return technicalLevel; + } + + public void setTechnicalLevel(String technicalLevel) { + this.technicalLevel = technicalLevel; + } + + public String getUncertainty() { + return uncertainty; + } + + public void setUncertainty(String uncertainty) { + this.uncertainty = uncertainty; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getUseDept() { + return useDept; + } + + public void setUseDept(String useDept) { + this.useDept = useDept; + } + + public String getUseDeptName() { + return useDeptName; + } + + public void setUseDeptName(String useDeptName) { + this.useDeptName = useDeptName; + } + + public String getUsePerson() { + return usePerson; + } + + public void setUsePerson(String usePerson) { + this.usePerson = usePerson; + } + + public String getUsePersonName() { + return usePersonName; + } + + public void setUsePersonName(String usePersonName) { + this.usePersonName = usePersonName; + } + + public String getValidDate() { + return validDate; + } + + public void setValidDate(String validDate) { + this.validDate = validDate; + } + + public int getVersion() { + return version; + } + + public void setVersion(int version) { + this.version = version; + } + + public String getWeight() { + return weight; + } + + public void setWeight(String weight) { + this.weight = weight; + } + } + } +} diff --git a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt index a3f514f..46e5eef 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt @@ -35,4 +35,24 @@ @QueryMap limit: Map, @QueryMap offset: Map ): String + + /** + * 获取设备列表 + */ + @POST("/meter/assets/listPage") + suspend fun getEquipmentList( + @Header("token") token: String, + @Body requestBody: RequestBody, + @QueryMap limit: Map, + @QueryMap offset: Map + ): String + + /** + * 获取设备详情 + */ + @POST("/meter/assets/detail") + suspend fun getEquipmentDetail( + @Header("token") token: String, + @Body requestBody: RequestBody + ): String } \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt index 444a872..386a1d8 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt @@ -6,8 +6,10 @@ import com.pengxh.kt.lite.utils.SaveKeyValues import okhttp3.MediaType.Companion.toMediaType import okhttp3.RequestBody.Companion.toRequestBody +import org.json.JSONArray import org.json.JSONObject + object RetrofitServiceManager { private val api by lazy { @@ -73,4 +75,71 @@ offsetMap["offset"] = offset return api.getNoticeList(AuthenticationHelper.token!!, requestBody, limitMap, offsetMap) } + + /** + * 获取设备列表 + */ + suspend fun getEquipmentList( + equipmentNo: String, + equipmentName: String, + mesureType: String, + managerState: String, + useDept: String, + assetType: String, + equipmentCategory: String, + isCalibrationTestEquipment: String, + isMeasureAccount: String, + isStandardSupportEquipment: String, + isFixedAssets: String, + validStartDate: String, + validEndDate: String, + abc: String, + ids: Array, + offset: Int + ): String { + val paramObject = JSONObject() + paramObject.put("equipmentNo", equipmentNo) + paramObject.put("equipmentName", equipmentName) + paramObject.put("mesureType", mesureType) + paramObject.put("managerState", managerState) + paramObject.put("useDept", useDept) + paramObject.put("assetType", assetType) + paramObject.put("equipmentCategory", equipmentCategory) + paramObject.put("isCalibrationTestEquipment", isCalibrationTestEquipment) + paramObject.put("isMeasureAccount", isMeasureAccount) + paramObject.put("isStandardSupportEquipment", isStandardSupportEquipment) + paramObject.put("isFixedAssets", isFixedAssets) + paramObject.put("validStartDate", validStartDate) + paramObject.put("validEndDate", validEndDate) + paramObject.put("abc", abc) + + val jsonArray = JSONArray() + ids.forEach { + jsonArray.put(it) + } + paramObject.put("ids", jsonArray) + + val requestBody = paramObject.toString().toRequestBody( + "application/json;charset=UTF-8".toMediaType() + ) + + val limitMap = HashMap() + limitMap["limit"] = LocaleConstant.PAGE_LIMIT + + val offsetMap = HashMap() + offsetMap["offset"] = offset + return api.getEquipmentList(AuthenticationHelper.token!!, requestBody, limitMap, offsetMap) + } + + /** + * 获取设备详情 + */ + suspend fun getEquipmentDetail(id: String): String { + val paramObject = JSONObject() + paramObject.put("id", id) + val requestBody = paramObject.toString().toRequestBody( + "application/json;charset=UTF-8".toMediaType() + ) + return api.getEquipmentDetail(AuthenticationHelper.token!!, requestBody) + } } \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt deleted file mode 100644 index a5bb60b..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt +++ /dev/null @@ -1,104 +0,0 @@ -package com.casic.xz.meterage.view - -import android.annotation.SuppressLint -import android.graphics.Paint -import androidx.lifecycle.ViewModelProvider -import com.casic.xz.meterage.R -import com.casic.xz.meterage.extensions.combineImagePath -import com.casic.xz.meterage.extensions.formatTextFromHtml -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.vm.NoticeViewModel -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.extensions.convertColor -import com.pengxh.kt.lite.extensions.navigatePageTo -import com.pengxh.kt.lite.extensions.obtainScreenWidth -import com.pengxh.kt.lite.extensions.show -import com.pengxh.kt.lite.utils.Constant -import kotlinx.android.synthetic.main.activity_notice_detail.* -import kotlinx.android.synthetic.main.include_base_title.* -import java.util.* - -@SuppressLint("SetTextI18n") -class NoticeDetailActivity : KotlinBaseActivity() { - - private lateinit var noticeViewModel: NoticeViewModel - - override fun initData() { - leftBackView.setOnClickListener { finish() } - titleView.text = "通知公告" - - val args = intent.getStringArrayListExtra(Constant.INTENT_PARAM)!! - - noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] - noticeViewModel.getNoticeList(args[0], args[1], args[2], "", "", 1) - noticeViewModel.noticeResult.observe(this, { - if (it.code == 200) { - val dataRow = it.data?.rows!![0] - - noticeDateView.text = dataRow.noticeTime - noticePublisherView.text = "发布人 ${dataRow.noticePublisher}" - noticeCompanyView.text = "发布单位 ${dataRow.noticeCompany}" - - noticeNoView.text = dataRow.noticeNo - noticeTitleView.text = dataRow.noticeTitle - noticeSketchView.text = dataRow.noticeSketch - - dataRow.noticeContent.formatTextFromHtml( - this, noticeContentView, obtainScreenWidth() - ) - - if (dataRow.minioFileName.isNullOrBlank()) { - minioFileView.text = "暂无附件" - } else { - val minioFileName = dataRow.minioFileName - - minioFileView.text = minioFileName - val textPaint = minioFileView.paint - textPaint.flags = Paint.UNDERLINE_TEXT_FLAG - textPaint.isAntiAlias = true - minioFileView.setTextColor(R.color.themeColor.convertColor(this)) - - minioFileView.setOnClickListener { - //查看附件 - if (minioFileName.endsWith("pdf")) { - navigatePageTo(minioFileName) - } else if ( - minioFileName.endsWith("doc") || - minioFileName.endsWith("docx") - ) { - navigatePageTo(minioFileName) - } else if (minioFileName.endsWith("txt")) { - navigatePageTo(minioFileName) - } else if ( - minioFileName.endsWith("png") || - minioFileName.endsWith("jpeg") || - minioFileName.endsWith("jpg") - ) { - val urls = ArrayList() - urls.add(minioFileName.combineImagePath()) - navigatePageTo(0, urls) - } else { - "文件类型未知,无法打开附件".show(this) - } - } - } - } - }) - } - - override fun initEvent() { - - } - - override fun initLayoutView(): Int = R.layout.activity_notice_detail - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/NoticeListActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/NoticeListActivity.kt deleted file mode 100644 index 15f6a16..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/NoticeListActivity.kt +++ /dev/null @@ -1,180 +0,0 @@ -package com.casic.xz.meterage.view - -import android.os.Handler -import android.util.Log -import android.view.View -import androidx.lifecycle.ViewModelProvider -import com.casic.xz.meterage.R -import com.casic.xz.meterage.adapter.NoticeListAdapter -import com.casic.xz.meterage.extensions.addAll -import com.casic.xz.meterage.extensions.combineFilePath -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.extensions.showEmptyPage -import com.casic.xz.meterage.model.NoticeListModel -import com.casic.xz.meterage.vm.NoticeViewModel -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.extensions.navigatePageTo -import com.pengxh.kt.lite.extensions.show -import com.pengxh.kt.lite.utils.WeakReferenceHandler -import com.pengxh.kt.lite.widget.dialog.AlertControlDialog -import kotlinx.android.synthetic.main.activity_notice_list.* -import kotlinx.android.synthetic.main.include_empty_view.* - -class NoticeListActivity : KotlinBaseActivity() { - - private lateinit var weakReferenceHandler: WeakReferenceHandler - private lateinit var noticeViewModel: NoticeViewModel - private lateinit var noticeListAdapter: NoticeListAdapter - private var dataBeans: MutableList = ArrayList() - private var pageIndex = 1 - private var isRefresh = false - private var isLoadMore = false - - override fun initData() { - weakReferenceHandler = WeakReferenceHandler(callback) - noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] - noticeViewModel.noticeResult.observe(this, { - if (it.code == 200) { - val dataRows = it.data?.rows!! -// countBadeNumber(dataRows) - when { - isRefresh -> { - dataBeans.clear() - dataBeans = dataRows - noticeLayout.finishRefresh() - isRefresh = false - } - isLoadMore -> { - if (dataRows.size == 0) { - "到底了,别拉了".show(this) - } - dataBeans.addAll(dataRows) - noticeLayout.finishLoadMore() - isLoadMore = false - } - else -> { - dataBeans = dataRows - } - } - weakReferenceHandler.sendEmptyMessage(2023013101) - } - }) - } - - override fun initEvent() { - leftBackView.setOnClickListener { finish() } - rightOperateView.setOnClickListener { - AlertControlDialog.Builder() - .setContext(this) - .setTitle("提示") - .setMessage("确定将所有未读消息标为已读?") - .setNegativeButton("取消") - .setPositiveButton("确定") - .setOnDialogButtonClickListener(object : - AlertControlDialog.OnDialogButtonClickListener { - override fun onCancelClick() { - - } - - override fun onConfirmClick() { - //TODO 设置为已读 - } - }).build().show() - } - - if (hasNoticePermission()) { - openSystemNoticeLayout.visibility = View.GONE - openSystemNoticeLayout.visibility = View.GONE - } else { - openSystemNoticeLayout.setOnClickListener { - - } - - - closeLayoutView.setOnClickListener { - openSystemNoticeLayout.visibility = View.GONE - } - } - - noticeLayout.setOnRefreshListener { - isRefresh = true - //刷新之后页码重置 - pageIndex = 1 - getNoticeListByPage() - } - - noticeLayout.setOnLoadMoreListener { - isLoadMore = true - pageIndex++ - getNoticeListByPage() - } - } - - override fun onResume() { - super.onResume() - pageIndex = 1 - getNoticeListByPage() - } - - private fun getNoticeListByPage() { - noticeViewModel.getNoticeList("", "", "", "", "", pageIndex) - } - - private val callback = Handler.Callback { - when (it.what) { - 2023013101 -> { - if (isRefresh || isLoadMore) { - noticeListAdapter.notifyDataSetChanged() - } else { - if (dataBeans.size == 0) { - emptyView!!.showEmptyPage("没有任何消息") { - pageIndex = 1 - getNoticeListByPage() - } - } else { - emptyView!!.hide() - noticeListAdapter = NoticeListAdapter(this, dataBeans) - noticeRecyclerView.adapter = noticeListAdapter - noticeListAdapter.setOnItemClickListener(object : - NoticeListAdapter.OnItemClickListener { - override fun onItemClicked(position: Int) { - val rowsModel = dataBeans[position] - val allArgs = addAll( - rowsModel.noticeNo, - rowsModel.noticeTitle, - rowsModel.noticePublisher, - "", - "" - ) - Log.d( - "Casic", - "NoticeListActivity => onItemClicked: ${rowsModel.minioFileName.combineFilePath()}" - ) - navigatePageTo(allArgs) - } - }) - } - } - } - } - true - } - - //TODO 判断是否开启通知权限 - private fun hasNoticePermission(): Boolean { - - return false - } - - override fun initLayoutView(): Int = R.layout.activity_notice_list - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/PreviewDocumentActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/PreviewDocumentActivity.kt deleted file mode 100644 index e233ddc..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/PreviewDocumentActivity.kt +++ /dev/null @@ -1,24 +0,0 @@ -package com.casic.xz.meterage.view - -import com.casic.xz.meterage.R -import com.pengxh.kt.lite.base.KotlinBaseActivity - -class PreviewDocumentActivity : KotlinBaseActivity() { - override fun initData() { - - } - - override fun initEvent() { - - } - - override fun initLayoutView(): Int = R.layout.activity_preview_doc - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/PreviewPdfActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/PreviewPdfActivity.kt deleted file mode 100644 index 39f8ac2..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/PreviewPdfActivity.kt +++ /dev/null @@ -1,62 +0,0 @@ -package com.casic.xz.meterage.view - -import com.casic.xz.meterage.R -import com.casic.xz.meterage.extensions.combineFilePath -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.utils.LoadingDialogHub -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.callback.OnDownloadListener -import com.pengxh.kt.lite.extensions.createDownloadFileDir -import com.pengxh.kt.lite.extensions.downloadFile -import com.pengxh.kt.lite.utils.Constant -import kotlinx.android.synthetic.main.activity_preview_pdf.* -import kotlinx.android.synthetic.main.include_base_title.* -import java.io.File -import java.io.FileInputStream - - -class PreviewPdfActivity : KotlinBaseActivity() { - - override fun initData() { - val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! - titleView.text = minioFileName - - val url = minioFileName.combineFilePath() - url.downloadFile(createDownloadFileDir().toString(), - object : OnDownloadListener { - override fun onDownloadStart(totalBytes: Long) { - runOnUiThread { - LoadingDialogHub.show(this@PreviewPdfActivity, "附件加载中") - } - } - - override fun onProgressChanged(currentBytes: Long) { - - } - - override fun onDownloadEnd(file: File?) { - runOnUiThread { - LoadingDialogHub.dismiss() - } - val inputStream = FileInputStream(file) - pdfView.fromStream(inputStream).load() - } - }) - } - - override fun initEvent() { - leftBackView.setOnClickListener { finish() } - } - - override fun initLayoutView(): Int = R.layout.activity_preview_pdf - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/PreviewTextActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/PreviewTextActivity.kt deleted file mode 100644 index d634ca3..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/PreviewTextActivity.kt +++ /dev/null @@ -1,60 +0,0 @@ -package com.casic.xz.meterage.view - -import com.casic.xz.meterage.R -import com.casic.xz.meterage.extensions.combineFilePath -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.utils.LoadingDialogHub -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.callback.OnDownloadListener -import com.pengxh.kt.lite.extensions.createDownloadFileDir -import com.pengxh.kt.lite.extensions.downloadFile -import com.pengxh.kt.lite.extensions.read -import com.pengxh.kt.lite.utils.Constant -import kotlinx.android.synthetic.main.activity_preview_txt.* -import kotlinx.android.synthetic.main.include_base_title.* -import java.io.File - -class PreviewTextActivity : KotlinBaseActivity() { - - override fun initData() { - val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! - titleView.text = minioFileName - - val url = minioFileName.combineFilePath() - url.downloadFile(createDownloadFileDir().toString(), - object : OnDownloadListener { - override fun onDownloadStart(totalBytes: Long) { - runOnUiThread { - LoadingDialogHub.show(this@PreviewTextActivity, "附件加载中") - } - } - - override fun onProgressChanged(currentBytes: Long) { - - } - - override fun onDownloadEnd(file: File?) { - runOnUiThread { - LoadingDialogHub.dismiss() - textView.text = file?.read() - } - } - }) - } - - override fun initEvent() { - leftBackView.setOnClickListener { finish() } - } - - override fun initLayoutView(): Int = R.layout.activity_preview_txt - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentActivity.kt new file mode 100644 index 0000000..35ca098 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentActivity.kt @@ -0,0 +1,158 @@ +package com.casic.xz.meterage.view.home + +import android.os.Handler +import androidx.lifecycle.ViewModelProvider +import androidx.recyclerview.widget.DividerItemDecoration +import com.casic.xz.meterage.R +import com.casic.xz.meterage.adapter.EquipmentListAdapter +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.extensions.showEmptyPage +import com.casic.xz.meterage.model.EquipmentListModel +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.casic.xz.meterage.vm.EquipmentViewModel +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.extensions.navigatePageTo +import com.pengxh.kt.lite.extensions.show +import com.pengxh.kt.lite.utils.WeakReferenceHandler +import com.pengxh.kt.lite.vm.LoadState +import kotlinx.android.synthetic.main.activity_equipment.* +import kotlinx.android.synthetic.main.include_empty_view.* +import kotlinx.android.synthetic.main.include_search_title.* + +class EquipmentActivity : KotlinBaseActivity() { + + private lateinit var weakReferenceHandler: WeakReferenceHandler + private lateinit var equipmentViewModel: EquipmentViewModel + private lateinit var equipmentListAdapter: EquipmentListAdapter + private var dataBeans: MutableList = ArrayList() + private var pageIndex = 1 + private var isRefresh = false + private var isLoadMore = false + + override fun initData() { + weakReferenceHandler = WeakReferenceHandler(callback) + equipmentViewModel = ViewModelProvider(this)[EquipmentViewModel::class.java] + equipmentViewModel.equipmentResult.observe(this, { + if (it.code == 200) { + val dataRows = it.data?.rows!! + when { + isRefresh -> { + dataBeans.clear() + dataBeans = dataRows + equipmentLayout.finishRefresh() + isRefresh = false + } + isLoadMore -> { + if (dataRows.size == 0) { + "到底了,别拉了".show(this) + } + dataBeans.addAll(dataRows) + equipmentLayout.finishLoadMore() + isLoadMore = false + } + else -> { + dataBeans = dataRows + } + } + weakReferenceHandler.sendEmptyMessage(2023020801) + } + }) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + rightOperateView.setOnClickListener { + + } + + equipmentLayout.setOnRefreshListener { + isRefresh = true + //刷新之后页码重置 + pageIndex = 1 + getEquipmentListByPage() + } + + equipmentLayout.setOnLoadMoreListener { + isLoadMore = true + pageIndex++ + getEquipmentListByPage() + } + } + + override fun initLayoutView(): Int = R.layout.activity_equipment + + override fun observeRequestState() { + equipmentViewModel.loadState.observe(this, { + when (it) { + LoadState.Loading -> LoadingDialogHub.show(this, "数据加载中...") + else -> LoadingDialogHub.dismiss() + } + }) + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + titleView.text = "仪器设备" + } + + override fun onResume() { + super.onResume() + pageIndex = 1 + getEquipmentListByPage() + } + + private fun getEquipmentListByPage() { + equipmentViewModel.getEquipmentList( + "", + "", + "", + "", + "", + "1", + "", + "", + "", + "", + "", + "", + "", + "", + arrayOf(), + pageIndex + ) + } + + private val callback = Handler.Callback { + when (it.what) { + 2023020801 -> { + if (isRefresh || isLoadMore) { + equipmentListAdapter.notifyDataSetChanged() + } else { + if (dataBeans.size == 0) { + emptyView!!.showEmptyPage("无设备") { + pageIndex = 1 + getEquipmentListByPage() + } + } else { + emptyView!!.hide() + equipmentListAdapter = EquipmentListAdapter(this, dataBeans) + equipmentRecyclerView.addItemDecoration( + DividerItemDecoration(this, DividerItemDecoration.VERTICAL) + ) + equipmentRecyclerView.adapter = equipmentListAdapter + equipmentListAdapter.setOnItemClickListener(object : + EquipmentListAdapter.OnItemClickListener { + override fun onItemClicked(position: Int) { + val rowsModel = dataBeans[position] + navigatePageTo(rowsModel.id) + } + }) + } + } + } + } + true + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentDetailActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentDetailActivity.kt new file mode 100644 index 0000000..7dee13c --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentDetailActivity.kt @@ -0,0 +1,53 @@ +package com.casic.xz.meterage.view.home + +import androidx.fragment.app.Fragment +import com.casic.xz.meterage.R +import com.casic.xz.meterage.adapter.SubViewPagerAdapter +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.fragment.equipment.* +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.utils.Constant +import kotlinx.android.synthetic.main.activity_equipment.rootView +import kotlinx.android.synthetic.main.activity_equipment_detail.* +import kotlinx.android.synthetic.main.include_base_title.* + +class EquipmentDetailActivity : KotlinBaseActivity() { + + private var fragmentPages: ArrayList = ArrayList() + + override fun initData() { + val equipmentId = intent.getStringExtra(Constant.INTENT_PARAM)!! + + fragmentPages.add(BasicInformationFragment(equipmentId)) + fragmentPages.add(InspectionRecordFragment()) + fragmentPages.add(ChangeRecordFragment()) + fragmentPages.add(UsageRecordFragment()) + fragmentPages.add(CertificateFragment()) + + val equipmentPageTitles = arrayOf("基础信息", "周检记录", "状态变更记录", "使用记录", "检定证书") + + equipmentViewPager.adapter = SubViewPagerAdapter( + supportFragmentManager, fragmentPages, equipmentPageTitles + ) + equipmentViewPager.offscreenPageLimit = fragmentPages.size + //绑定 + topTabLayout.setupWithViewPager(equipmentViewPager) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + } + + override fun initLayoutView(): Int = R.layout.activity_equipment_detail + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + titleView.text = "仪器设备" + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeDetailActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeDetailActivity.kt new file mode 100644 index 0000000..6fe0022 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeDetailActivity.kt @@ -0,0 +1,105 @@ +package com.casic.xz.meterage.view.notice + +import android.annotation.SuppressLint +import android.graphics.Paint +import androidx.lifecycle.ViewModelProvider +import com.casic.xz.meterage.R +import com.casic.xz.meterage.extensions.combineImagePath +import com.casic.xz.meterage.extensions.formatTextFromHtml +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.view.BigImageActivity +import com.casic.xz.meterage.vm.NoticeViewModel +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.extensions.convertColor +import com.pengxh.kt.lite.extensions.navigatePageTo +import com.pengxh.kt.lite.extensions.obtainScreenWidth +import com.pengxh.kt.lite.extensions.show +import com.pengxh.kt.lite.utils.Constant +import kotlinx.android.synthetic.main.activity_notice_detail.* +import kotlinx.android.synthetic.main.include_base_title.* +import java.util.* + +@SuppressLint("SetTextI18n") +class NoticeDetailActivity : KotlinBaseActivity() { + + private lateinit var noticeViewModel: NoticeViewModel + + override fun initData() { + leftBackView.setOnClickListener { finish() } + titleView.text = "通知公告" + + val args = intent.getStringArrayListExtra(Constant.INTENT_PARAM)!! + + noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] + noticeViewModel.getNoticeList(args[0], args[1], args[2], "", "", 1) + noticeViewModel.noticeResult.observe(this, { + if (it.code == 200) { + val dataRow = it.data?.rows!![0] + + noticeDateView.text = dataRow.noticeTime + noticePublisherView.text = "发布人 ${dataRow.noticePublisher}" + noticeCompanyView.text = "发布单位 ${dataRow.noticeCompany}" + + noticeNoView.text = dataRow.noticeNo + noticeTitleView.text = dataRow.noticeTitle + noticeSketchView.text = dataRow.noticeSketch + + dataRow.noticeContent.formatTextFromHtml( + this, noticeContentView, obtainScreenWidth() + ) + + if (dataRow.minioFileName.isNullOrBlank()) { + minioFileView.text = "暂无附件" + } else { + val minioFileName = dataRow.minioFileName + + minioFileView.text = minioFileName + val textPaint = minioFileView.paint + textPaint.flags = Paint.UNDERLINE_TEXT_FLAG + textPaint.isAntiAlias = true + minioFileView.setTextColor(R.color.themeColor.convertColor(this)) + + minioFileView.setOnClickListener { + //查看附件 + if (minioFileName.endsWith("pdf")) { + navigatePageTo(minioFileName) + } else if ( + minioFileName.endsWith("doc") || + minioFileName.endsWith("docx") + ) { + navigatePageTo(minioFileName) + } else if (minioFileName.endsWith("txt")) { + navigatePageTo(minioFileName) + } else if ( + minioFileName.endsWith("png") || + minioFileName.endsWith("jpeg") || + minioFileName.endsWith("jpg") + ) { + val urls = ArrayList() + urls.add(minioFileName.combineImagePath()) + navigatePageTo(0, urls) + } else { + "文件类型未知,无法打开附件".show(this) + } + } + } + } + }) + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.activity_notice_detail + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeListActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeListActivity.kt new file mode 100644 index 0000000..31c0490 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeListActivity.kt @@ -0,0 +1,180 @@ +package com.casic.xz.meterage.view.notice + +import android.os.Handler +import android.util.Log +import android.view.View +import androidx.lifecycle.ViewModelProvider +import com.casic.xz.meterage.R +import com.casic.xz.meterage.adapter.NoticeListAdapter +import com.casic.xz.meterage.extensions.addAll +import com.casic.xz.meterage.extensions.combineFilePath +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.extensions.showEmptyPage +import com.casic.xz.meterage.model.NoticeListModel +import com.casic.xz.meterage.vm.NoticeViewModel +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.extensions.navigatePageTo +import com.pengxh.kt.lite.extensions.show +import com.pengxh.kt.lite.utils.WeakReferenceHandler +import com.pengxh.kt.lite.widget.dialog.AlertControlDialog +import kotlinx.android.synthetic.main.activity_notice_list.* +import kotlinx.android.synthetic.main.include_empty_view.* + +class NoticeListActivity : KotlinBaseActivity() { + + private lateinit var weakReferenceHandler: WeakReferenceHandler + private lateinit var noticeViewModel: NoticeViewModel + private lateinit var noticeListAdapter: NoticeListAdapter + private var dataBeans: MutableList = ArrayList() + private var pageIndex = 1 + private var isRefresh = false + private var isLoadMore = false + + override fun initData() { + weakReferenceHandler = WeakReferenceHandler(callback) + noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] + noticeViewModel.noticeResult.observe(this, { + if (it.code == 200) { + val dataRows = it.data?.rows!! +// countBadeNumber(dataRows) + when { + isRefresh -> { + dataBeans.clear() + dataBeans = dataRows + noticeLayout.finishRefresh() + isRefresh = false + } + isLoadMore -> { + if (dataRows.size == 0) { + "到底了,别拉了".show(this) + } + dataBeans.addAll(dataRows) + noticeLayout.finishLoadMore() + isLoadMore = false + } + else -> { + dataBeans = dataRows + } + } + weakReferenceHandler.sendEmptyMessage(2023013101) + } + }) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + rightOperateView.setOnClickListener { + AlertControlDialog.Builder() + .setContext(this) + .setTitle("提示") + .setMessage("确定将所有未读消息标为已读?") + .setNegativeButton("取消") + .setPositiveButton("确定") + .setOnDialogButtonClickListener(object : + AlertControlDialog.OnDialogButtonClickListener { + override fun onCancelClick() { + + } + + override fun onConfirmClick() { + //TODO 设置为已读 + } + }).build().show() + } + + if (hasNoticePermission()) { + openSystemNoticeLayout.visibility = View.GONE + openSystemNoticeLayout.visibility = View.GONE + } else { + openSystemNoticeLayout.setOnClickListener { + + } + + + closeLayoutView.setOnClickListener { + openSystemNoticeLayout.visibility = View.GONE + } + } + + noticeLayout.setOnRefreshListener { + isRefresh = true + //刷新之后页码重置 + pageIndex = 1 + getNoticeListByPage() + } + + noticeLayout.setOnLoadMoreListener { + isLoadMore = true + pageIndex++ + getNoticeListByPage() + } + } + + override fun onResume() { + super.onResume() + pageIndex = 1 + getNoticeListByPage() + } + + private fun getNoticeListByPage() { + noticeViewModel.getNoticeList("", "", "", "", "", pageIndex) + } + + private val callback = Handler.Callback { + when (it.what) { + 2023013101 -> { + if (isRefresh || isLoadMore) { + noticeListAdapter.notifyDataSetChanged() + } else { + if (dataBeans.size == 0) { + emptyView!!.showEmptyPage("没有任何消息") { + pageIndex = 1 + getNoticeListByPage() + } + } else { + emptyView!!.hide() + noticeListAdapter = NoticeListAdapter(this, dataBeans) + noticeRecyclerView.adapter = noticeListAdapter + noticeListAdapter.setOnItemClickListener(object : + NoticeListAdapter.OnItemClickListener { + override fun onItemClicked(position: Int) { + val rowsModel = dataBeans[position] + val allArgs = addAll( + rowsModel.noticeNo, + rowsModel.noticeTitle, + rowsModel.noticePublisher, + "", + "" + ) + Log.d( + "Casic", + "NoticeListActivity => onItemClicked: ${rowsModel.minioFileName.combineFilePath()}" + ) + navigatePageTo(allArgs) + } + }) + } + } + } + } + true + } + + //TODO 判断是否开启通知权限 + private fun hasNoticePermission(): Boolean { + + return false + } + + override fun initLayoutView(): Int = R.layout.activity_notice_list + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewDocumentActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewDocumentActivity.kt new file mode 100644 index 0000000..4b16ae8 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewDocumentActivity.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.view.notice + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseActivity + +class PreviewDocumentActivity : KotlinBaseActivity() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.activity_preview_doc + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 3892b5a..02160cd 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -34,16 +34,18 @@ - - - - - - - + + + + + + + + + +) : RecyclerView.Adapter() { + + private var layoutInflater: LayoutInflater = LayoutInflater.from(context) + + override fun getItemCount(): Int = dataRows.size + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = ItemViewHolder( + layoutInflater.inflate(R.layout.item_equipment_rv_l, parent, false) + ) + + override fun onBindViewHolder(holder: ItemViewHolder, position: Int) { + //绑定数据 + val rowsBean = dataRows[position] + holder.equipmentNameView.text = rowsBean.equipmentName + holder.equipmentCodeView.text = rowsBean.equipmentNo + holder.equipmentDateView.text = rowsBean.enableDate + holder.equipmentLibView.text = rowsBean.useDeptName + + //绑定事件 + holder.itemView.setOnClickListener { + listener?.onItemClicked(position) + } + } + + inner class ItemViewHolder(view: View) : RecyclerView.ViewHolder(view) { + var equipmentNameView: TextView = view.findViewById(R.id.equipmentNameView) + var equipmentCodeView: TextView = view.findViewById(R.id.equipmentCodeView) + var equipmentDateView: TextView = view.findViewById(R.id.equipmentDateView) + var equipmentLibView: TextView = view.findViewById(R.id.equipmentLibView) + } + + private var listener: OnItemClickListener? = null + + interface OnItemClickListener { + fun onItemClicked(position: Int) + } + + fun setOnItemClickListener(onClickListener: OnItemClickListener?) { + this.listener = onClickListener + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt index b4628f3..d970b55 100644 --- a/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt +++ b/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt @@ -5,7 +5,8 @@ import com.casic.xz.meterage.R import com.casic.xz.meterage.adapter.HomeGridAdapter import com.casic.xz.meterage.utils.LocaleConstant -import com.casic.xz.meterage.view.NoticeListActivity +import com.casic.xz.meterage.view.home.EquipmentActivity +import com.casic.xz.meterage.view.notice.NoticeListActivity import com.casic.xz.meterage.vm.NoticeViewModel import com.pengxh.kt.lite.base.KotlinBaseFragment import com.pengxh.kt.lite.extensions.navigatePageTo @@ -36,8 +37,19 @@ homeFuncRecyclerView.adapter = homeAdapter homeAdapter.setOnGridItemClickListener(object : HomeGridAdapter.OnGridItemClickListener { override fun onItemClick(position: Int) { - when (position) { - + when (LocaleConstant.HOME_FUNC_OPERATE[position]) { + "仪器设备" -> requireContext().navigatePageTo() +// "标准装置" -> requireContext().navigatePageTo() +// "证书报告" -> requireContext().navigatePageTo() +// "委托需求" -> requireContext().navigatePageTo() +// "访客" -> requireContext().navigatePageTo() +// "标准规范" -> requireContext().navigatePageTo() +// "能力列表" -> requireContext().navigatePageTo() +// "计量培训" -> requireContext().navigatePageTo() +// "合同发票" -> requireContext().navigatePageTo() +// "业务统计" -> requireContext().navigatePageTo() +// "客户列表" -> requireContext().navigatePageTo() +// "外场检测" -> requireContext().navigatePageTo() } } }) diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt index 7e75abe..56dc5ec 100644 --- a/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt +++ b/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt @@ -2,9 +2,11 @@ import android.view.View import androidx.lifecycle.ViewModelProvider +import com.bumptech.glide.Glide +import com.bumptech.glide.request.RequestOptions import com.casic.xz.meterage.R import com.casic.xz.meterage.utils.LocaleConstant -import com.casic.xz.meterage.view.NoticeListActivity +import com.casic.xz.meterage.view.notice.NoticeListActivity import com.casic.xz.meterage.vm.NoticeViewModel import com.casic.xz.meterage.vm.UserViewModel import com.pengxh.kt.lite.base.KotlinBaseFragment @@ -23,6 +25,12 @@ val data = it.data userNameView.text = data.name userUnitView.text = data.deptName + +// Glide.with(requireContext()) +// .load(R.mipmap.default_avatar) +// .apply(RequestOptions.circleCropTransform()) +// .placeholder(R.mipmap.load_image_error) +// .into(userAvatarView) } }) diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt new file mode 100644 index 0000000..cf22646 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt @@ -0,0 +1,103 @@ +package com.casic.xz.meterage.fragment.equipment + +import android.graphics.Paint +import androidx.lifecycle.ViewModelProvider +import com.casic.xz.meterage.R +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.casic.xz.meterage.vm.EquipmentViewModel +import com.pengxh.kt.lite.base.KotlinBaseFragment +import com.pengxh.kt.lite.extensions.convertColor +import com.pengxh.kt.lite.vm.LoadState +import kotlinx.android.synthetic.main.fragment_basic_information.* + +class BasicInformationFragment(private val id: String) : KotlinBaseFragment() { + + private lateinit var equipmentViewModel: EquipmentViewModel + + override fun initData() { + equipmentViewModel = ViewModelProvider(this)[EquipmentViewModel::class.java] + equipmentViewModel.getEquipmentDetail(id) + equipmentViewModel.equipmentDetailResult.observe(this, { + if (it.code == 200) { + val data = it.data!! + + equipmentCodeView.text = data.equipmentNo + equipmentNameView.text = data.equipmentName + manufacturerView.text = data.manufacturer + factoryNumberView.text = data.manufacturingNo + modelView.text = data.modelNo + verificationMethodView.text = data.mesureTypeName + measuringRangeView.text = data.mesureRange + uncertaintyView.text = data.uncertainty + firstUseView.text = data.createTime + originalValueView.text = data.originValue + usageDeptView.text = data.useDeptName + userView.text = data.usePersonName + managementStatusView.text = data.managerStateName + verificationDeptView.text = data.useDeptName +// nextVerificationDeptView.text = data. + verificationPeriodView.text = data.mesureCycle + verificationDateView.text = data.mesureDate + effectiveDateView.text = data.validDate + verificationResultsView.text = data.mesureResultName + abcView.text = data.abcName + isNeedTechnicalView.text = if ( + data.isCalibrationTestEquipment.isNullOrBlank() || data.isCalibrationTestEquipment == "0" + ) { + "否" + } else { + "是" + } + + isStandingBook.text = if ( + data.isMeasureAccount.isNullOrBlank() || data.isMeasureAccount == "0" + ) { + "否" + } else { + "是" + } + + isStandardView.text = if ( + data.isStandardSupportEquipment.isNullOrBlank() || data.isStandardSupportEquipment == "0" + ) { + "否" + } else { + "是" + } + remarkView.text = data.remark + if (data.fileList.size == 0) { + instructionsView.text = "暂无" + } else { + instructionsView.text = "查看附件列表" + val textPaint = instructionsView.paint + textPaint.flags = Paint.UNDERLINE_TEXT_FLAG + textPaint.isAntiAlias = true + instructionsView.setTextColor(R.color.themeColor.convertColor(requireContext())) + + instructionsView.setOnClickListener { + + } + } + } + }) + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_basic_information + + override fun observeRequestState() { + equipmentViewModel.loadState.observe(this, { + when (it) { + LoadState.Loading -> LoadingDialogHub.show(requireActivity(), "数据加载中...") + else -> LoadingDialogHub.dismiss() + } + }) + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt new file mode 100644 index 0000000..0b4a747 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class CertificateFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_certificate + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt new file mode 100644 index 0000000..f05c491 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class ChangeRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_change_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt new file mode 100644 index 0000000..849ffa5 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class InspectionRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_inspection_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt new file mode 100644 index 0000000..aa4edd9 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class UsageRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_usage_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java b/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java new file mode 100644 index 0000000..0b9124e --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java @@ -0,0 +1,760 @@ +package com.casic.xz.meterage.model; + +import java.util.List; + +public class EquipmentDetailModel { + + private int code; + private DataModel data; + private String message; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataModel getData() { + return data; + } + + public void setData(DataModel data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public static class DataModel { + private String abc; + private String abcName; + private String assetNo; + private String assetSource; + private String assetType; + private String assetTypeName; + private String attribute; + private String capitalSource; + private String capitalSourceName; + private String cardEstablishmentDate; + private String createTime; + private String createUser; + private String depreciationMethod; + private String depreciationMethodName; + private String depreciationPeriod; + private String enableDate; + private String equipmentCategory; + private String equipmentCategoryName; + private String equipmentName; + private String equipmentNo; + private String equipmentSpecifications; + private String equipmentType; + private String equipmentTypeName; + private List fileList; + private String id; + private String installIncidentalExpenses; + private String installPlace; + private String intactState; + private String isCalibrationTestEquipment; + private int isDel; + private String isFixedAssets; + private String isMeasureAccount; + private String isStandardSupportEquipment; + private String labelBind; + private String majorCategory; + private String majorCategoryName; + private String managerLevel; + private String managerLevelName; + private String managerState; + private String managerStateName; + private String manufacturer; + private String manufacturerCountry; + private String manufacturingDate; + private String manufacturingNo; + private String mesureCycle; + private String mesureDate; + private String mesureDept; + private String mesureRange; + private String mesureResult; + private String mesureResultName; + private String mesureType; + private String mesureTypeName; + private String modelNo; + private String originValue; + private String overallDimension; + private String presentOriginValue; + private String purpose; + private String remark; + private String singlePrice; + private String supportStandardEquipmentName; + private String supportStandardEquipmentNo; + private String technicalLevel; + private String uncertainty; + private String updateTime; + private String useDept; + private String useDeptName; + private String usePerson; + private String usePersonName; + private String validDate; + private int version; + private String weight; + + public String getAbc() { + return abc; + } + + public void setAbc(String abc) { + this.abc = abc; + } + + public String getAbcName() { + return abcName; + } + + public void setAbcName(String abcName) { + this.abcName = abcName; + } + + public String getAssetNo() { + return assetNo; + } + + public void setAssetNo(String assetNo) { + this.assetNo = assetNo; + } + + public String getAssetSource() { + return assetSource; + } + + public void setAssetSource(String assetSource) { + this.assetSource = assetSource; + } + + public String getAssetType() { + return assetType; + } + + public void setAssetType(String assetType) { + this.assetType = assetType; + } + + public String getAssetTypeName() { + return assetTypeName; + } + + public void setAssetTypeName(String assetTypeName) { + this.assetTypeName = assetTypeName; + } + + public String getAttribute() { + return attribute; + } + + public void setAttribute(String attribute) { + this.attribute = attribute; + } + + public String getCapitalSource() { + return capitalSource; + } + + public void setCapitalSource(String capitalSource) { + this.capitalSource = capitalSource; + } + + public String getCapitalSourceName() { + return capitalSourceName; + } + + public void setCapitalSourceName(String capitalSourceName) { + this.capitalSourceName = capitalSourceName; + } + + public String getCardEstablishmentDate() { + return cardEstablishmentDate; + } + + public void setCardEstablishmentDate(String cardEstablishmentDate) { + this.cardEstablishmentDate = cardEstablishmentDate; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getDepreciationMethod() { + return depreciationMethod; + } + + public void setDepreciationMethod(String depreciationMethod) { + this.depreciationMethod = depreciationMethod; + } + + public String getDepreciationMethodName() { + return depreciationMethodName; + } + + public void setDepreciationMethodName(String depreciationMethodName) { + this.depreciationMethodName = depreciationMethodName; + } + + public String getDepreciationPeriod() { + return depreciationPeriod; + } + + public void setDepreciationPeriod(String depreciationPeriod) { + this.depreciationPeriod = depreciationPeriod; + } + + public String getEnableDate() { + return enableDate; + } + + public void setEnableDate(String enableDate) { + this.enableDate = enableDate; + } + + public String getEquipmentCategory() { + return equipmentCategory; + } + + public void setEquipmentCategory(String equipmentCategory) { + this.equipmentCategory = equipmentCategory; + } + + public String getEquipmentCategoryName() { + return equipmentCategoryName; + } + + public void setEquipmentCategoryName(String equipmentCategoryName) { + this.equipmentCategoryName = equipmentCategoryName; + } + + public String getEquipmentName() { + return equipmentName; + } + + public void setEquipmentName(String equipmentName) { + this.equipmentName = equipmentName; + } + + public String getEquipmentNo() { + return equipmentNo; + } + + public void setEquipmentNo(String equipmentNo) { + this.equipmentNo = equipmentNo; + } + + public String getEquipmentSpecifications() { + return equipmentSpecifications; + } + + public void setEquipmentSpecifications(String equipmentSpecifications) { + this.equipmentSpecifications = equipmentSpecifications; + } + + public String getEquipmentType() { + return equipmentType; + } + + public void setEquipmentType(String equipmentType) { + this.equipmentType = equipmentType; + } + + public String getEquipmentTypeName() { + return equipmentTypeName; + } + + public void setEquipmentTypeName(String equipmentTypeName) { + this.equipmentTypeName = equipmentTypeName; + } + + public List getFileList() { + return fileList; + } + + public void setFileList(List fileList) { + this.fileList = fileList; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getInstallIncidentalExpenses() { + return installIncidentalExpenses; + } + + public void setInstallIncidentalExpenses(String installIncidentalExpenses) { + this.installIncidentalExpenses = installIncidentalExpenses; + } + + public String getInstallPlace() { + return installPlace; + } + + public void setInstallPlace(String installPlace) { + this.installPlace = installPlace; + } + + public String getIntactState() { + return intactState; + } + + public void setIntactState(String intactState) { + this.intactState = intactState; + } + + public String getIsCalibrationTestEquipment() { + return isCalibrationTestEquipment; + } + + public void setIsCalibrationTestEquipment(String isCalibrationTestEquipment) { + this.isCalibrationTestEquipment = isCalibrationTestEquipment; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getIsFixedAssets() { + return isFixedAssets; + } + + public void setIsFixedAssets(String isFixedAssets) { + this.isFixedAssets = isFixedAssets; + } + + public String getIsMeasureAccount() { + return isMeasureAccount; + } + + public void setIsMeasureAccount(String isMeasureAccount) { + this.isMeasureAccount = isMeasureAccount; + } + + public String getIsStandardSupportEquipment() { + return isStandardSupportEquipment; + } + + public void setIsStandardSupportEquipment(String isStandardSupportEquipment) { + this.isStandardSupportEquipment = isStandardSupportEquipment; + } + + public String getLabelBind() { + return labelBind; + } + + public void setLabelBind(String labelBind) { + this.labelBind = labelBind; + } + + public String getMajorCategory() { + return majorCategory; + } + + public void setMajorCategory(String majorCategory) { + this.majorCategory = majorCategory; + } + + public String getMajorCategoryName() { + return majorCategoryName; + } + + public void setMajorCategoryName(String majorCategoryName) { + this.majorCategoryName = majorCategoryName; + } + + public String getManagerLevel() { + return managerLevel; + } + + public void setManagerLevel(String managerLevel) { + this.managerLevel = managerLevel; + } + + public String getManagerLevelName() { + return managerLevelName; + } + + public void setManagerLevelName(String managerLevelName) { + this.managerLevelName = managerLevelName; + } + + public String getManagerState() { + return managerState; + } + + public void setManagerState(String managerState) { + this.managerState = managerState; + } + + public String getManagerStateName() { + return managerStateName; + } + + public void setManagerStateName(String managerStateName) { + this.managerStateName = managerStateName; + } + + public String getManufacturer() { + return manufacturer; + } + + public void setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + } + + public String getManufacturerCountry() { + return manufacturerCountry; + } + + public void setManufacturerCountry(String manufacturerCountry) { + this.manufacturerCountry = manufacturerCountry; + } + + public String getManufacturingDate() { + return manufacturingDate; + } + + public void setManufacturingDate(String manufacturingDate) { + this.manufacturingDate = manufacturingDate; + } + + public String getManufacturingNo() { + return manufacturingNo; + } + + public void setManufacturingNo(String manufacturingNo) { + this.manufacturingNo = manufacturingNo; + } + + public String getMesureCycle() { + return mesureCycle; + } + + public void setMesureCycle(String mesureCycle) { + this.mesureCycle = mesureCycle; + } + + public String getMesureDate() { + return mesureDate; + } + + public void setMesureDate(String mesureDate) { + this.mesureDate = mesureDate; + } + + public String getMesureDept() { + return mesureDept; + } + + public void setMesureDept(String mesureDept) { + this.mesureDept = mesureDept; + } + + public String getMesureRange() { + return mesureRange; + } + + public void setMesureRange(String mesureRange) { + this.mesureRange = mesureRange; + } + + public String getMesureResult() { + return mesureResult; + } + + public void setMesureResult(String mesureResult) { + this.mesureResult = mesureResult; + } + + public String getMesureResultName() { + return mesureResultName; + } + + public void setMesureResultName(String mesureResultName) { + this.mesureResultName = mesureResultName; + } + + public String getMesureType() { + return mesureType; + } + + public void setMesureType(String mesureType) { + this.mesureType = mesureType; + } + + public String getMesureTypeName() { + return mesureTypeName; + } + + public void setMesureTypeName(String mesureTypeName) { + this.mesureTypeName = mesureTypeName; + } + + public String getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getOriginValue() { + return originValue; + } + + public void setOriginValue(String originValue) { + this.originValue = originValue; + } + + public String getOverallDimension() { + return overallDimension; + } + + public void setOverallDimension(String overallDimension) { + this.overallDimension = overallDimension; + } + + public String getPresentOriginValue() { + return presentOriginValue; + } + + public void setPresentOriginValue(String presentOriginValue) { + this.presentOriginValue = presentOriginValue; + } + + public String getPurpose() { + return purpose; + } + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getSinglePrice() { + return singlePrice; + } + + public void setSinglePrice(String singlePrice) { + this.singlePrice = singlePrice; + } + + public String getSupportStandardEquipmentName() { + return supportStandardEquipmentName; + } + + public void setSupportStandardEquipmentName(String supportStandardEquipmentName) { + this.supportStandardEquipmentName = supportStandardEquipmentName; + } + + public String getSupportStandardEquipmentNo() { + return supportStandardEquipmentNo; + } + + public void setSupportStandardEquipmentNo(String supportStandardEquipmentNo) { + this.supportStandardEquipmentNo = supportStandardEquipmentNo; + } + + public String getTechnicalLevel() { + return technicalLevel; + } + + public void setTechnicalLevel(String technicalLevel) { + this.technicalLevel = technicalLevel; + } + + public String getUncertainty() { + return uncertainty; + } + + public void setUncertainty(String uncertainty) { + this.uncertainty = uncertainty; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getUseDept() { + return useDept; + } + + public void setUseDept(String useDept) { + this.useDept = useDept; + } + + public String getUseDeptName() { + return useDeptName; + } + + public void setUseDeptName(String useDeptName) { + this.useDeptName = useDeptName; + } + + public String getUsePerson() { + return usePerson; + } + + public void setUsePerson(String usePerson) { + this.usePerson = usePerson; + } + + public String getUsePersonName() { + return usePersonName; + } + + public void setUsePersonName(String usePersonName) { + this.usePersonName = usePersonName; + } + + public String getValidDate() { + return validDate; + } + + public void setValidDate(String validDate) { + this.validDate = validDate; + } + + public int getVersion() { + return version; + } + + public void setVersion(int version) { + this.version = version; + } + + public String getWeight() { + return weight; + } + + public void setWeight(String weight) { + this.weight = weight; + } + + public static class FileListModel { + private String assetId; + private String createTime; + private String createUser; + private String fileName; + private String id; + private int isDel; + private String minioFileName; + private String remark; + private String updateTime; + + public String getAssetId() { + return assetId; + } + + public void setAssetId(String assetId) { + this.assetId = assetId; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getFileName() { + return fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getMinioFileName() { + return minioFileName; + } + + public void setMinioFileName(String minioFileName) { + this.minioFileName = minioFileName; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + } + } +} diff --git a/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java b/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java new file mode 100644 index 0000000..15fc128 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java @@ -0,0 +1,697 @@ +package com.casic.xz.meterage.model; + +import java.util.List; + +public class EquipmentListModel { + + private int code; + private DataModel data; + private String message; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataModel getData() { + return data; + } + + public void setData(DataModel data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public static class DataModel { + private List rows; + private int total; + + public List getRows() { + return rows; + } + + public void setRows(List rows) { + this.rows = rows; + } + + public int getTotal() { + return total; + } + + public void setTotal(int total) { + this.total = total; + } + + public static class RowsModel { + private String abc; + private String abcName; + private String assetNo; + private String assetSource; + private String assetType; + private String assetTypeName; + private String attribute; + private String capitalSource; + private String capitalSourceName; + private String cardEstablishmentDate; + private String createTime; + private String createUser; + private String depreciationMethod; + private String depreciationMethodName; + private String depreciationPeriod; + private String enableDate; + private String equipmentCategory; + private String equipmentCategoryName; + private String equipmentName; + private String equipmentNo; + private String equipmentSpecifications; + private String equipmentType; + private String equipmentTypeName; + private String fileList; + private String id; + private String installIncidentalExpenses; + private String installPlace; + private String intactState; + private String isCalibrationTestEquipment; + private int isDel; + private String isFixedAssets; + private String isMeasureAccount; + private String isStandardSupportEquipment; + private String labelBind; + private String majorCategory; + private String majorCategoryName; + private String managerLevel; + private String managerLevelName; + private String managerState; + private String managerStateName; + private String manufacturer; + private String manufacturerCountry; + private String manufacturingDate; + private String manufacturingNo; + private String mesureCycle; + private String mesureDate; + private String mesureDept; + private String mesureRange; + private String mesureResult; + private String mesureResultName; + private String mesureType; + private String mesureTypeName; + private String modelNo; + private String originValue; + private String overallDimension; + private String presentOriginValue; + private String purpose; + private String remark; + private String singlePrice; + private String supportStandardEquipmentName; + private String supportStandardEquipmentNo; + private String technicalLevel; + private String uncertainty; + private String updateTime; + private String useDept; + private String useDeptName; + private String usePerson; + private String usePersonName; + private String validDate; + private int version; + private String weight; + + public String getAbc() { + return abc; + } + + public void setAbc(String abc) { + this.abc = abc; + } + + public String getAbcName() { + return abcName; + } + + public void setAbcName(String abcName) { + this.abcName = abcName; + } + + public String getAssetNo() { + return assetNo; + } + + public void setAssetNo(String assetNo) { + this.assetNo = assetNo; + } + + public String getAssetSource() { + return assetSource; + } + + public void setAssetSource(String assetSource) { + this.assetSource = assetSource; + } + + public String getAssetType() { + return assetType; + } + + public void setAssetType(String assetType) { + this.assetType = assetType; + } + + public String getAssetTypeName() { + return assetTypeName; + } + + public void setAssetTypeName(String assetTypeName) { + this.assetTypeName = assetTypeName; + } + + public String getAttribute() { + return attribute; + } + + public void setAttribute(String attribute) { + this.attribute = attribute; + } + + public String getCapitalSource() { + return capitalSource; + } + + public void setCapitalSource(String capitalSource) { + this.capitalSource = capitalSource; + } + + public String getCapitalSourceName() { + return capitalSourceName; + } + + public void setCapitalSourceName(String capitalSourceName) { + this.capitalSourceName = capitalSourceName; + } + + public String getCardEstablishmentDate() { + return cardEstablishmentDate; + } + + public void setCardEstablishmentDate(String cardEstablishmentDate) { + this.cardEstablishmentDate = cardEstablishmentDate; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getDepreciationMethod() { + return depreciationMethod; + } + + public void setDepreciationMethod(String depreciationMethod) { + this.depreciationMethod = depreciationMethod; + } + + public String getDepreciationMethodName() { + return depreciationMethodName; + } + + public void setDepreciationMethodName(String depreciationMethodName) { + this.depreciationMethodName = depreciationMethodName; + } + + public String getDepreciationPeriod() { + return depreciationPeriod; + } + + public void setDepreciationPeriod(String depreciationPeriod) { + this.depreciationPeriod = depreciationPeriod; + } + + public String getEnableDate() { + return enableDate; + } + + public void setEnableDate(String enableDate) { + this.enableDate = enableDate; + } + + public String getEquipmentCategory() { + return equipmentCategory; + } + + public void setEquipmentCategory(String equipmentCategory) { + this.equipmentCategory = equipmentCategory; + } + + public String getEquipmentCategoryName() { + return equipmentCategoryName; + } + + public void setEquipmentCategoryName(String equipmentCategoryName) { + this.equipmentCategoryName = equipmentCategoryName; + } + + public String getEquipmentName() { + return equipmentName; + } + + public void setEquipmentName(String equipmentName) { + this.equipmentName = equipmentName; + } + + public String getEquipmentNo() { + return equipmentNo; + } + + public void setEquipmentNo(String equipmentNo) { + this.equipmentNo = equipmentNo; + } + + public String getEquipmentSpecifications() { + return equipmentSpecifications; + } + + public void setEquipmentSpecifications(String equipmentSpecifications) { + this.equipmentSpecifications = equipmentSpecifications; + } + + public String getEquipmentType() { + return equipmentType; + } + + public void setEquipmentType(String equipmentType) { + this.equipmentType = equipmentType; + } + + public String getEquipmentTypeName() { + return equipmentTypeName; + } + + public void setEquipmentTypeName(String equipmentTypeName) { + this.equipmentTypeName = equipmentTypeName; + } + + public String getFileList() { + return fileList; + } + + public void setFileList(String fileList) { + this.fileList = fileList; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getInstallIncidentalExpenses() { + return installIncidentalExpenses; + } + + public void setInstallIncidentalExpenses(String installIncidentalExpenses) { + this.installIncidentalExpenses = installIncidentalExpenses; + } + + public String getInstallPlace() { + return installPlace; + } + + public void setInstallPlace(String installPlace) { + this.installPlace = installPlace; + } + + public String getIntactState() { + return intactState; + } + + public void setIntactState(String intactState) { + this.intactState = intactState; + } + + public String getIsCalibrationTestEquipment() { + return isCalibrationTestEquipment; + } + + public void setIsCalibrationTestEquipment(String isCalibrationTestEquipment) { + this.isCalibrationTestEquipment = isCalibrationTestEquipment; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getIsFixedAssets() { + return isFixedAssets; + } + + public void setIsFixedAssets(String isFixedAssets) { + this.isFixedAssets = isFixedAssets; + } + + public String getIsMeasureAccount() { + return isMeasureAccount; + } + + public void setIsMeasureAccount(String isMeasureAccount) { + this.isMeasureAccount = isMeasureAccount; + } + + public String getIsStandardSupportEquipment() { + return isStandardSupportEquipment; + } + + public void setIsStandardSupportEquipment(String isStandardSupportEquipment) { + this.isStandardSupportEquipment = isStandardSupportEquipment; + } + + public String getLabelBind() { + return labelBind; + } + + public void setLabelBind(String labelBind) { + this.labelBind = labelBind; + } + + public String getMajorCategory() { + return majorCategory; + } + + public void setMajorCategory(String majorCategory) { + this.majorCategory = majorCategory; + } + + public String getMajorCategoryName() { + return majorCategoryName; + } + + public void setMajorCategoryName(String majorCategoryName) { + this.majorCategoryName = majorCategoryName; + } + + public String getManagerLevel() { + return managerLevel; + } + + public void setManagerLevel(String managerLevel) { + this.managerLevel = managerLevel; + } + + public String getManagerLevelName() { + return managerLevelName; + } + + public void setManagerLevelName(String managerLevelName) { + this.managerLevelName = managerLevelName; + } + + public String getManagerState() { + return managerState; + } + + public void setManagerState(String managerState) { + this.managerState = managerState; + } + + public String getManagerStateName() { + return managerStateName; + } + + public void setManagerStateName(String managerStateName) { + this.managerStateName = managerStateName; + } + + public String getManufacturer() { + return manufacturer; + } + + public void setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + } + + public String getManufacturerCountry() { + return manufacturerCountry; + } + + public void setManufacturerCountry(String manufacturerCountry) { + this.manufacturerCountry = manufacturerCountry; + } + + public String getManufacturingDate() { + return manufacturingDate; + } + + public void setManufacturingDate(String manufacturingDate) { + this.manufacturingDate = manufacturingDate; + } + + public String getManufacturingNo() { + return manufacturingNo; + } + + public void setManufacturingNo(String manufacturingNo) { + this.manufacturingNo = manufacturingNo; + } + + public String getMesureCycle() { + return mesureCycle; + } + + public void setMesureCycle(String mesureCycle) { + this.mesureCycle = mesureCycle; + } + + public String getMesureDate() { + return mesureDate; + } + + public void setMesureDate(String mesureDate) { + this.mesureDate = mesureDate; + } + + public String getMesureDept() { + return mesureDept; + } + + public void setMesureDept(String mesureDept) { + this.mesureDept = mesureDept; + } + + public String getMesureRange() { + return mesureRange; + } + + public void setMesureRange(String mesureRange) { + this.mesureRange = mesureRange; + } + + public String getMesureResult() { + return mesureResult; + } + + public void setMesureResult(String mesureResult) { + this.mesureResult = mesureResult; + } + + public String getMesureResultName() { + return mesureResultName; + } + + public void setMesureResultName(String mesureResultName) { + this.mesureResultName = mesureResultName; + } + + public String getMesureType() { + return mesureType; + } + + public void setMesureType(String mesureType) { + this.mesureType = mesureType; + } + + public String getMesureTypeName() { + return mesureTypeName; + } + + public void setMesureTypeName(String mesureTypeName) { + this.mesureTypeName = mesureTypeName; + } + + public String getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getOriginValue() { + return originValue; + } + + public void setOriginValue(String originValue) { + this.originValue = originValue; + } + + public String getOverallDimension() { + return overallDimension; + } + + public void setOverallDimension(String overallDimension) { + this.overallDimension = overallDimension; + } + + public String getPresentOriginValue() { + return presentOriginValue; + } + + public void setPresentOriginValue(String presentOriginValue) { + this.presentOriginValue = presentOriginValue; + } + + public String getPurpose() { + return purpose; + } + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getSinglePrice() { + return singlePrice; + } + + public void setSinglePrice(String singlePrice) { + this.singlePrice = singlePrice; + } + + public String getSupportStandardEquipmentName() { + return supportStandardEquipmentName; + } + + public void setSupportStandardEquipmentName(String supportStandardEquipmentName) { + this.supportStandardEquipmentName = supportStandardEquipmentName; + } + + public String getSupportStandardEquipmentNo() { + return supportStandardEquipmentNo; + } + + public void setSupportStandardEquipmentNo(String supportStandardEquipmentNo) { + this.supportStandardEquipmentNo = supportStandardEquipmentNo; + } + + public String getTechnicalLevel() { + return technicalLevel; + } + + public void setTechnicalLevel(String technicalLevel) { + this.technicalLevel = technicalLevel; + } + + public String getUncertainty() { + return uncertainty; + } + + public void setUncertainty(String uncertainty) { + this.uncertainty = uncertainty; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getUseDept() { + return useDept; + } + + public void setUseDept(String useDept) { + this.useDept = useDept; + } + + public String getUseDeptName() { + return useDeptName; + } + + public void setUseDeptName(String useDeptName) { + this.useDeptName = useDeptName; + } + + public String getUsePerson() { + return usePerson; + } + + public void setUsePerson(String usePerson) { + this.usePerson = usePerson; + } + + public String getUsePersonName() { + return usePersonName; + } + + public void setUsePersonName(String usePersonName) { + this.usePersonName = usePersonName; + } + + public String getValidDate() { + return validDate; + } + + public void setValidDate(String validDate) { + this.validDate = validDate; + } + + public int getVersion() { + return version; + } + + public void setVersion(int version) { + this.version = version; + } + + public String getWeight() { + return weight; + } + + public void setWeight(String weight) { + this.weight = weight; + } + } + } +} diff --git a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt index a3f514f..46e5eef 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt @@ -35,4 +35,24 @@ @QueryMap limit: Map, @QueryMap offset: Map ): String + + /** + * 获取设备列表 + */ + @POST("/meter/assets/listPage") + suspend fun getEquipmentList( + @Header("token") token: String, + @Body requestBody: RequestBody, + @QueryMap limit: Map, + @QueryMap offset: Map + ): String + + /** + * 获取设备详情 + */ + @POST("/meter/assets/detail") + suspend fun getEquipmentDetail( + @Header("token") token: String, + @Body requestBody: RequestBody + ): String } \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt index 444a872..386a1d8 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt @@ -6,8 +6,10 @@ import com.pengxh.kt.lite.utils.SaveKeyValues import okhttp3.MediaType.Companion.toMediaType import okhttp3.RequestBody.Companion.toRequestBody +import org.json.JSONArray import org.json.JSONObject + object RetrofitServiceManager { private val api by lazy { @@ -73,4 +75,71 @@ offsetMap["offset"] = offset return api.getNoticeList(AuthenticationHelper.token!!, requestBody, limitMap, offsetMap) } + + /** + * 获取设备列表 + */ + suspend fun getEquipmentList( + equipmentNo: String, + equipmentName: String, + mesureType: String, + managerState: String, + useDept: String, + assetType: String, + equipmentCategory: String, + isCalibrationTestEquipment: String, + isMeasureAccount: String, + isStandardSupportEquipment: String, + isFixedAssets: String, + validStartDate: String, + validEndDate: String, + abc: String, + ids: Array, + offset: Int + ): String { + val paramObject = JSONObject() + paramObject.put("equipmentNo", equipmentNo) + paramObject.put("equipmentName", equipmentName) + paramObject.put("mesureType", mesureType) + paramObject.put("managerState", managerState) + paramObject.put("useDept", useDept) + paramObject.put("assetType", assetType) + paramObject.put("equipmentCategory", equipmentCategory) + paramObject.put("isCalibrationTestEquipment", isCalibrationTestEquipment) + paramObject.put("isMeasureAccount", isMeasureAccount) + paramObject.put("isStandardSupportEquipment", isStandardSupportEquipment) + paramObject.put("isFixedAssets", isFixedAssets) + paramObject.put("validStartDate", validStartDate) + paramObject.put("validEndDate", validEndDate) + paramObject.put("abc", abc) + + val jsonArray = JSONArray() + ids.forEach { + jsonArray.put(it) + } + paramObject.put("ids", jsonArray) + + val requestBody = paramObject.toString().toRequestBody( + "application/json;charset=UTF-8".toMediaType() + ) + + val limitMap = HashMap() + limitMap["limit"] = LocaleConstant.PAGE_LIMIT + + val offsetMap = HashMap() + offsetMap["offset"] = offset + return api.getEquipmentList(AuthenticationHelper.token!!, requestBody, limitMap, offsetMap) + } + + /** + * 获取设备详情 + */ + suspend fun getEquipmentDetail(id: String): String { + val paramObject = JSONObject() + paramObject.put("id", id) + val requestBody = paramObject.toString().toRequestBody( + "application/json;charset=UTF-8".toMediaType() + ) + return api.getEquipmentDetail(AuthenticationHelper.token!!, requestBody) + } } \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt deleted file mode 100644 index a5bb60b..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt +++ /dev/null @@ -1,104 +0,0 @@ -package com.casic.xz.meterage.view - -import android.annotation.SuppressLint -import android.graphics.Paint -import androidx.lifecycle.ViewModelProvider -import com.casic.xz.meterage.R -import com.casic.xz.meterage.extensions.combineImagePath -import com.casic.xz.meterage.extensions.formatTextFromHtml -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.vm.NoticeViewModel -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.extensions.convertColor -import com.pengxh.kt.lite.extensions.navigatePageTo -import com.pengxh.kt.lite.extensions.obtainScreenWidth -import com.pengxh.kt.lite.extensions.show -import com.pengxh.kt.lite.utils.Constant -import kotlinx.android.synthetic.main.activity_notice_detail.* -import kotlinx.android.synthetic.main.include_base_title.* -import java.util.* - -@SuppressLint("SetTextI18n") -class NoticeDetailActivity : KotlinBaseActivity() { - - private lateinit var noticeViewModel: NoticeViewModel - - override fun initData() { - leftBackView.setOnClickListener { finish() } - titleView.text = "通知公告" - - val args = intent.getStringArrayListExtra(Constant.INTENT_PARAM)!! - - noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] - noticeViewModel.getNoticeList(args[0], args[1], args[2], "", "", 1) - noticeViewModel.noticeResult.observe(this, { - if (it.code == 200) { - val dataRow = it.data?.rows!![0] - - noticeDateView.text = dataRow.noticeTime - noticePublisherView.text = "发布人 ${dataRow.noticePublisher}" - noticeCompanyView.text = "发布单位 ${dataRow.noticeCompany}" - - noticeNoView.text = dataRow.noticeNo - noticeTitleView.text = dataRow.noticeTitle - noticeSketchView.text = dataRow.noticeSketch - - dataRow.noticeContent.formatTextFromHtml( - this, noticeContentView, obtainScreenWidth() - ) - - if (dataRow.minioFileName.isNullOrBlank()) { - minioFileView.text = "暂无附件" - } else { - val minioFileName = dataRow.minioFileName - - minioFileView.text = minioFileName - val textPaint = minioFileView.paint - textPaint.flags = Paint.UNDERLINE_TEXT_FLAG - textPaint.isAntiAlias = true - minioFileView.setTextColor(R.color.themeColor.convertColor(this)) - - minioFileView.setOnClickListener { - //查看附件 - if (minioFileName.endsWith("pdf")) { - navigatePageTo(minioFileName) - } else if ( - minioFileName.endsWith("doc") || - minioFileName.endsWith("docx") - ) { - navigatePageTo(minioFileName) - } else if (minioFileName.endsWith("txt")) { - navigatePageTo(minioFileName) - } else if ( - minioFileName.endsWith("png") || - minioFileName.endsWith("jpeg") || - minioFileName.endsWith("jpg") - ) { - val urls = ArrayList() - urls.add(minioFileName.combineImagePath()) - navigatePageTo(0, urls) - } else { - "文件类型未知,无法打开附件".show(this) - } - } - } - } - }) - } - - override fun initEvent() { - - } - - override fun initLayoutView(): Int = R.layout.activity_notice_detail - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/NoticeListActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/NoticeListActivity.kt deleted file mode 100644 index 15f6a16..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/NoticeListActivity.kt +++ /dev/null @@ -1,180 +0,0 @@ -package com.casic.xz.meterage.view - -import android.os.Handler -import android.util.Log -import android.view.View -import androidx.lifecycle.ViewModelProvider -import com.casic.xz.meterage.R -import com.casic.xz.meterage.adapter.NoticeListAdapter -import com.casic.xz.meterage.extensions.addAll -import com.casic.xz.meterage.extensions.combineFilePath -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.extensions.showEmptyPage -import com.casic.xz.meterage.model.NoticeListModel -import com.casic.xz.meterage.vm.NoticeViewModel -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.extensions.navigatePageTo -import com.pengxh.kt.lite.extensions.show -import com.pengxh.kt.lite.utils.WeakReferenceHandler -import com.pengxh.kt.lite.widget.dialog.AlertControlDialog -import kotlinx.android.synthetic.main.activity_notice_list.* -import kotlinx.android.synthetic.main.include_empty_view.* - -class NoticeListActivity : KotlinBaseActivity() { - - private lateinit var weakReferenceHandler: WeakReferenceHandler - private lateinit var noticeViewModel: NoticeViewModel - private lateinit var noticeListAdapter: NoticeListAdapter - private var dataBeans: MutableList = ArrayList() - private var pageIndex = 1 - private var isRefresh = false - private var isLoadMore = false - - override fun initData() { - weakReferenceHandler = WeakReferenceHandler(callback) - noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] - noticeViewModel.noticeResult.observe(this, { - if (it.code == 200) { - val dataRows = it.data?.rows!! -// countBadeNumber(dataRows) - when { - isRefresh -> { - dataBeans.clear() - dataBeans = dataRows - noticeLayout.finishRefresh() - isRefresh = false - } - isLoadMore -> { - if (dataRows.size == 0) { - "到底了,别拉了".show(this) - } - dataBeans.addAll(dataRows) - noticeLayout.finishLoadMore() - isLoadMore = false - } - else -> { - dataBeans = dataRows - } - } - weakReferenceHandler.sendEmptyMessage(2023013101) - } - }) - } - - override fun initEvent() { - leftBackView.setOnClickListener { finish() } - rightOperateView.setOnClickListener { - AlertControlDialog.Builder() - .setContext(this) - .setTitle("提示") - .setMessage("确定将所有未读消息标为已读?") - .setNegativeButton("取消") - .setPositiveButton("确定") - .setOnDialogButtonClickListener(object : - AlertControlDialog.OnDialogButtonClickListener { - override fun onCancelClick() { - - } - - override fun onConfirmClick() { - //TODO 设置为已读 - } - }).build().show() - } - - if (hasNoticePermission()) { - openSystemNoticeLayout.visibility = View.GONE - openSystemNoticeLayout.visibility = View.GONE - } else { - openSystemNoticeLayout.setOnClickListener { - - } - - - closeLayoutView.setOnClickListener { - openSystemNoticeLayout.visibility = View.GONE - } - } - - noticeLayout.setOnRefreshListener { - isRefresh = true - //刷新之后页码重置 - pageIndex = 1 - getNoticeListByPage() - } - - noticeLayout.setOnLoadMoreListener { - isLoadMore = true - pageIndex++ - getNoticeListByPage() - } - } - - override fun onResume() { - super.onResume() - pageIndex = 1 - getNoticeListByPage() - } - - private fun getNoticeListByPage() { - noticeViewModel.getNoticeList("", "", "", "", "", pageIndex) - } - - private val callback = Handler.Callback { - when (it.what) { - 2023013101 -> { - if (isRefresh || isLoadMore) { - noticeListAdapter.notifyDataSetChanged() - } else { - if (dataBeans.size == 0) { - emptyView!!.showEmptyPage("没有任何消息") { - pageIndex = 1 - getNoticeListByPage() - } - } else { - emptyView!!.hide() - noticeListAdapter = NoticeListAdapter(this, dataBeans) - noticeRecyclerView.adapter = noticeListAdapter - noticeListAdapter.setOnItemClickListener(object : - NoticeListAdapter.OnItemClickListener { - override fun onItemClicked(position: Int) { - val rowsModel = dataBeans[position] - val allArgs = addAll( - rowsModel.noticeNo, - rowsModel.noticeTitle, - rowsModel.noticePublisher, - "", - "" - ) - Log.d( - "Casic", - "NoticeListActivity => onItemClicked: ${rowsModel.minioFileName.combineFilePath()}" - ) - navigatePageTo(allArgs) - } - }) - } - } - } - } - true - } - - //TODO 判断是否开启通知权限 - private fun hasNoticePermission(): Boolean { - - return false - } - - override fun initLayoutView(): Int = R.layout.activity_notice_list - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/PreviewDocumentActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/PreviewDocumentActivity.kt deleted file mode 100644 index e233ddc..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/PreviewDocumentActivity.kt +++ /dev/null @@ -1,24 +0,0 @@ -package com.casic.xz.meterage.view - -import com.casic.xz.meterage.R -import com.pengxh.kt.lite.base.KotlinBaseActivity - -class PreviewDocumentActivity : KotlinBaseActivity() { - override fun initData() { - - } - - override fun initEvent() { - - } - - override fun initLayoutView(): Int = R.layout.activity_preview_doc - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/PreviewPdfActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/PreviewPdfActivity.kt deleted file mode 100644 index 39f8ac2..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/PreviewPdfActivity.kt +++ /dev/null @@ -1,62 +0,0 @@ -package com.casic.xz.meterage.view - -import com.casic.xz.meterage.R -import com.casic.xz.meterage.extensions.combineFilePath -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.utils.LoadingDialogHub -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.callback.OnDownloadListener -import com.pengxh.kt.lite.extensions.createDownloadFileDir -import com.pengxh.kt.lite.extensions.downloadFile -import com.pengxh.kt.lite.utils.Constant -import kotlinx.android.synthetic.main.activity_preview_pdf.* -import kotlinx.android.synthetic.main.include_base_title.* -import java.io.File -import java.io.FileInputStream - - -class PreviewPdfActivity : KotlinBaseActivity() { - - override fun initData() { - val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! - titleView.text = minioFileName - - val url = minioFileName.combineFilePath() - url.downloadFile(createDownloadFileDir().toString(), - object : OnDownloadListener { - override fun onDownloadStart(totalBytes: Long) { - runOnUiThread { - LoadingDialogHub.show(this@PreviewPdfActivity, "附件加载中") - } - } - - override fun onProgressChanged(currentBytes: Long) { - - } - - override fun onDownloadEnd(file: File?) { - runOnUiThread { - LoadingDialogHub.dismiss() - } - val inputStream = FileInputStream(file) - pdfView.fromStream(inputStream).load() - } - }) - } - - override fun initEvent() { - leftBackView.setOnClickListener { finish() } - } - - override fun initLayoutView(): Int = R.layout.activity_preview_pdf - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/PreviewTextActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/PreviewTextActivity.kt deleted file mode 100644 index d634ca3..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/PreviewTextActivity.kt +++ /dev/null @@ -1,60 +0,0 @@ -package com.casic.xz.meterage.view - -import com.casic.xz.meterage.R -import com.casic.xz.meterage.extensions.combineFilePath -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.utils.LoadingDialogHub -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.callback.OnDownloadListener -import com.pengxh.kt.lite.extensions.createDownloadFileDir -import com.pengxh.kt.lite.extensions.downloadFile -import com.pengxh.kt.lite.extensions.read -import com.pengxh.kt.lite.utils.Constant -import kotlinx.android.synthetic.main.activity_preview_txt.* -import kotlinx.android.synthetic.main.include_base_title.* -import java.io.File - -class PreviewTextActivity : KotlinBaseActivity() { - - override fun initData() { - val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! - titleView.text = minioFileName - - val url = minioFileName.combineFilePath() - url.downloadFile(createDownloadFileDir().toString(), - object : OnDownloadListener { - override fun onDownloadStart(totalBytes: Long) { - runOnUiThread { - LoadingDialogHub.show(this@PreviewTextActivity, "附件加载中") - } - } - - override fun onProgressChanged(currentBytes: Long) { - - } - - override fun onDownloadEnd(file: File?) { - runOnUiThread { - LoadingDialogHub.dismiss() - textView.text = file?.read() - } - } - }) - } - - override fun initEvent() { - leftBackView.setOnClickListener { finish() } - } - - override fun initLayoutView(): Int = R.layout.activity_preview_txt - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentActivity.kt new file mode 100644 index 0000000..35ca098 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentActivity.kt @@ -0,0 +1,158 @@ +package com.casic.xz.meterage.view.home + +import android.os.Handler +import androidx.lifecycle.ViewModelProvider +import androidx.recyclerview.widget.DividerItemDecoration +import com.casic.xz.meterage.R +import com.casic.xz.meterage.adapter.EquipmentListAdapter +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.extensions.showEmptyPage +import com.casic.xz.meterage.model.EquipmentListModel +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.casic.xz.meterage.vm.EquipmentViewModel +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.extensions.navigatePageTo +import com.pengxh.kt.lite.extensions.show +import com.pengxh.kt.lite.utils.WeakReferenceHandler +import com.pengxh.kt.lite.vm.LoadState +import kotlinx.android.synthetic.main.activity_equipment.* +import kotlinx.android.synthetic.main.include_empty_view.* +import kotlinx.android.synthetic.main.include_search_title.* + +class EquipmentActivity : KotlinBaseActivity() { + + private lateinit var weakReferenceHandler: WeakReferenceHandler + private lateinit var equipmentViewModel: EquipmentViewModel + private lateinit var equipmentListAdapter: EquipmentListAdapter + private var dataBeans: MutableList = ArrayList() + private var pageIndex = 1 + private var isRefresh = false + private var isLoadMore = false + + override fun initData() { + weakReferenceHandler = WeakReferenceHandler(callback) + equipmentViewModel = ViewModelProvider(this)[EquipmentViewModel::class.java] + equipmentViewModel.equipmentResult.observe(this, { + if (it.code == 200) { + val dataRows = it.data?.rows!! + when { + isRefresh -> { + dataBeans.clear() + dataBeans = dataRows + equipmentLayout.finishRefresh() + isRefresh = false + } + isLoadMore -> { + if (dataRows.size == 0) { + "到底了,别拉了".show(this) + } + dataBeans.addAll(dataRows) + equipmentLayout.finishLoadMore() + isLoadMore = false + } + else -> { + dataBeans = dataRows + } + } + weakReferenceHandler.sendEmptyMessage(2023020801) + } + }) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + rightOperateView.setOnClickListener { + + } + + equipmentLayout.setOnRefreshListener { + isRefresh = true + //刷新之后页码重置 + pageIndex = 1 + getEquipmentListByPage() + } + + equipmentLayout.setOnLoadMoreListener { + isLoadMore = true + pageIndex++ + getEquipmentListByPage() + } + } + + override fun initLayoutView(): Int = R.layout.activity_equipment + + override fun observeRequestState() { + equipmentViewModel.loadState.observe(this, { + when (it) { + LoadState.Loading -> LoadingDialogHub.show(this, "数据加载中...") + else -> LoadingDialogHub.dismiss() + } + }) + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + titleView.text = "仪器设备" + } + + override fun onResume() { + super.onResume() + pageIndex = 1 + getEquipmentListByPage() + } + + private fun getEquipmentListByPage() { + equipmentViewModel.getEquipmentList( + "", + "", + "", + "", + "", + "1", + "", + "", + "", + "", + "", + "", + "", + "", + arrayOf(), + pageIndex + ) + } + + private val callback = Handler.Callback { + when (it.what) { + 2023020801 -> { + if (isRefresh || isLoadMore) { + equipmentListAdapter.notifyDataSetChanged() + } else { + if (dataBeans.size == 0) { + emptyView!!.showEmptyPage("无设备") { + pageIndex = 1 + getEquipmentListByPage() + } + } else { + emptyView!!.hide() + equipmentListAdapter = EquipmentListAdapter(this, dataBeans) + equipmentRecyclerView.addItemDecoration( + DividerItemDecoration(this, DividerItemDecoration.VERTICAL) + ) + equipmentRecyclerView.adapter = equipmentListAdapter + equipmentListAdapter.setOnItemClickListener(object : + EquipmentListAdapter.OnItemClickListener { + override fun onItemClicked(position: Int) { + val rowsModel = dataBeans[position] + navigatePageTo(rowsModel.id) + } + }) + } + } + } + } + true + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentDetailActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentDetailActivity.kt new file mode 100644 index 0000000..7dee13c --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentDetailActivity.kt @@ -0,0 +1,53 @@ +package com.casic.xz.meterage.view.home + +import androidx.fragment.app.Fragment +import com.casic.xz.meterage.R +import com.casic.xz.meterage.adapter.SubViewPagerAdapter +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.fragment.equipment.* +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.utils.Constant +import kotlinx.android.synthetic.main.activity_equipment.rootView +import kotlinx.android.synthetic.main.activity_equipment_detail.* +import kotlinx.android.synthetic.main.include_base_title.* + +class EquipmentDetailActivity : KotlinBaseActivity() { + + private var fragmentPages: ArrayList = ArrayList() + + override fun initData() { + val equipmentId = intent.getStringExtra(Constant.INTENT_PARAM)!! + + fragmentPages.add(BasicInformationFragment(equipmentId)) + fragmentPages.add(InspectionRecordFragment()) + fragmentPages.add(ChangeRecordFragment()) + fragmentPages.add(UsageRecordFragment()) + fragmentPages.add(CertificateFragment()) + + val equipmentPageTitles = arrayOf("基础信息", "周检记录", "状态变更记录", "使用记录", "检定证书") + + equipmentViewPager.adapter = SubViewPagerAdapter( + supportFragmentManager, fragmentPages, equipmentPageTitles + ) + equipmentViewPager.offscreenPageLimit = fragmentPages.size + //绑定 + topTabLayout.setupWithViewPager(equipmentViewPager) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + } + + override fun initLayoutView(): Int = R.layout.activity_equipment_detail + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + titleView.text = "仪器设备" + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeDetailActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeDetailActivity.kt new file mode 100644 index 0000000..6fe0022 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeDetailActivity.kt @@ -0,0 +1,105 @@ +package com.casic.xz.meterage.view.notice + +import android.annotation.SuppressLint +import android.graphics.Paint +import androidx.lifecycle.ViewModelProvider +import com.casic.xz.meterage.R +import com.casic.xz.meterage.extensions.combineImagePath +import com.casic.xz.meterage.extensions.formatTextFromHtml +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.view.BigImageActivity +import com.casic.xz.meterage.vm.NoticeViewModel +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.extensions.convertColor +import com.pengxh.kt.lite.extensions.navigatePageTo +import com.pengxh.kt.lite.extensions.obtainScreenWidth +import com.pengxh.kt.lite.extensions.show +import com.pengxh.kt.lite.utils.Constant +import kotlinx.android.synthetic.main.activity_notice_detail.* +import kotlinx.android.synthetic.main.include_base_title.* +import java.util.* + +@SuppressLint("SetTextI18n") +class NoticeDetailActivity : KotlinBaseActivity() { + + private lateinit var noticeViewModel: NoticeViewModel + + override fun initData() { + leftBackView.setOnClickListener { finish() } + titleView.text = "通知公告" + + val args = intent.getStringArrayListExtra(Constant.INTENT_PARAM)!! + + noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] + noticeViewModel.getNoticeList(args[0], args[1], args[2], "", "", 1) + noticeViewModel.noticeResult.observe(this, { + if (it.code == 200) { + val dataRow = it.data?.rows!![0] + + noticeDateView.text = dataRow.noticeTime + noticePublisherView.text = "发布人 ${dataRow.noticePublisher}" + noticeCompanyView.text = "发布单位 ${dataRow.noticeCompany}" + + noticeNoView.text = dataRow.noticeNo + noticeTitleView.text = dataRow.noticeTitle + noticeSketchView.text = dataRow.noticeSketch + + dataRow.noticeContent.formatTextFromHtml( + this, noticeContentView, obtainScreenWidth() + ) + + if (dataRow.minioFileName.isNullOrBlank()) { + minioFileView.text = "暂无附件" + } else { + val minioFileName = dataRow.minioFileName + + minioFileView.text = minioFileName + val textPaint = minioFileView.paint + textPaint.flags = Paint.UNDERLINE_TEXT_FLAG + textPaint.isAntiAlias = true + minioFileView.setTextColor(R.color.themeColor.convertColor(this)) + + minioFileView.setOnClickListener { + //查看附件 + if (minioFileName.endsWith("pdf")) { + navigatePageTo(minioFileName) + } else if ( + minioFileName.endsWith("doc") || + minioFileName.endsWith("docx") + ) { + navigatePageTo(minioFileName) + } else if (minioFileName.endsWith("txt")) { + navigatePageTo(minioFileName) + } else if ( + minioFileName.endsWith("png") || + minioFileName.endsWith("jpeg") || + minioFileName.endsWith("jpg") + ) { + val urls = ArrayList() + urls.add(minioFileName.combineImagePath()) + navigatePageTo(0, urls) + } else { + "文件类型未知,无法打开附件".show(this) + } + } + } + } + }) + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.activity_notice_detail + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeListActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeListActivity.kt new file mode 100644 index 0000000..31c0490 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeListActivity.kt @@ -0,0 +1,180 @@ +package com.casic.xz.meterage.view.notice + +import android.os.Handler +import android.util.Log +import android.view.View +import androidx.lifecycle.ViewModelProvider +import com.casic.xz.meterage.R +import com.casic.xz.meterage.adapter.NoticeListAdapter +import com.casic.xz.meterage.extensions.addAll +import com.casic.xz.meterage.extensions.combineFilePath +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.extensions.showEmptyPage +import com.casic.xz.meterage.model.NoticeListModel +import com.casic.xz.meterage.vm.NoticeViewModel +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.extensions.navigatePageTo +import com.pengxh.kt.lite.extensions.show +import com.pengxh.kt.lite.utils.WeakReferenceHandler +import com.pengxh.kt.lite.widget.dialog.AlertControlDialog +import kotlinx.android.synthetic.main.activity_notice_list.* +import kotlinx.android.synthetic.main.include_empty_view.* + +class NoticeListActivity : KotlinBaseActivity() { + + private lateinit var weakReferenceHandler: WeakReferenceHandler + private lateinit var noticeViewModel: NoticeViewModel + private lateinit var noticeListAdapter: NoticeListAdapter + private var dataBeans: MutableList = ArrayList() + private var pageIndex = 1 + private var isRefresh = false + private var isLoadMore = false + + override fun initData() { + weakReferenceHandler = WeakReferenceHandler(callback) + noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] + noticeViewModel.noticeResult.observe(this, { + if (it.code == 200) { + val dataRows = it.data?.rows!! +// countBadeNumber(dataRows) + when { + isRefresh -> { + dataBeans.clear() + dataBeans = dataRows + noticeLayout.finishRefresh() + isRefresh = false + } + isLoadMore -> { + if (dataRows.size == 0) { + "到底了,别拉了".show(this) + } + dataBeans.addAll(dataRows) + noticeLayout.finishLoadMore() + isLoadMore = false + } + else -> { + dataBeans = dataRows + } + } + weakReferenceHandler.sendEmptyMessage(2023013101) + } + }) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + rightOperateView.setOnClickListener { + AlertControlDialog.Builder() + .setContext(this) + .setTitle("提示") + .setMessage("确定将所有未读消息标为已读?") + .setNegativeButton("取消") + .setPositiveButton("确定") + .setOnDialogButtonClickListener(object : + AlertControlDialog.OnDialogButtonClickListener { + override fun onCancelClick() { + + } + + override fun onConfirmClick() { + //TODO 设置为已读 + } + }).build().show() + } + + if (hasNoticePermission()) { + openSystemNoticeLayout.visibility = View.GONE + openSystemNoticeLayout.visibility = View.GONE + } else { + openSystemNoticeLayout.setOnClickListener { + + } + + + closeLayoutView.setOnClickListener { + openSystemNoticeLayout.visibility = View.GONE + } + } + + noticeLayout.setOnRefreshListener { + isRefresh = true + //刷新之后页码重置 + pageIndex = 1 + getNoticeListByPage() + } + + noticeLayout.setOnLoadMoreListener { + isLoadMore = true + pageIndex++ + getNoticeListByPage() + } + } + + override fun onResume() { + super.onResume() + pageIndex = 1 + getNoticeListByPage() + } + + private fun getNoticeListByPage() { + noticeViewModel.getNoticeList("", "", "", "", "", pageIndex) + } + + private val callback = Handler.Callback { + when (it.what) { + 2023013101 -> { + if (isRefresh || isLoadMore) { + noticeListAdapter.notifyDataSetChanged() + } else { + if (dataBeans.size == 0) { + emptyView!!.showEmptyPage("没有任何消息") { + pageIndex = 1 + getNoticeListByPage() + } + } else { + emptyView!!.hide() + noticeListAdapter = NoticeListAdapter(this, dataBeans) + noticeRecyclerView.adapter = noticeListAdapter + noticeListAdapter.setOnItemClickListener(object : + NoticeListAdapter.OnItemClickListener { + override fun onItemClicked(position: Int) { + val rowsModel = dataBeans[position] + val allArgs = addAll( + rowsModel.noticeNo, + rowsModel.noticeTitle, + rowsModel.noticePublisher, + "", + "" + ) + Log.d( + "Casic", + "NoticeListActivity => onItemClicked: ${rowsModel.minioFileName.combineFilePath()}" + ) + navigatePageTo(allArgs) + } + }) + } + } + } + } + true + } + + //TODO 判断是否开启通知权限 + private fun hasNoticePermission(): Boolean { + + return false + } + + override fun initLayoutView(): Int = R.layout.activity_notice_list + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewDocumentActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewDocumentActivity.kt new file mode 100644 index 0000000..4b16ae8 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewDocumentActivity.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.view.notice + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseActivity + +class PreviewDocumentActivity : KotlinBaseActivity() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.activity_preview_doc + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewPdfActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewPdfActivity.kt new file mode 100644 index 0000000..fad73b6 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewPdfActivity.kt @@ -0,0 +1,62 @@ +package com.casic.xz.meterage.view.notice + +import com.casic.xz.meterage.R +import com.casic.xz.meterage.extensions.combineFilePath +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.callback.OnDownloadListener +import com.pengxh.kt.lite.extensions.createDownloadFileDir +import com.pengxh.kt.lite.extensions.downloadFile +import com.pengxh.kt.lite.utils.Constant +import kotlinx.android.synthetic.main.activity_preview_pdf.* +import kotlinx.android.synthetic.main.include_base_title.* +import java.io.File +import java.io.FileInputStream + + +class PreviewPdfActivity : KotlinBaseActivity() { + + override fun initData() { + val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! + titleView.text = minioFileName + + val url = minioFileName.combineFilePath() + url.downloadFile(createDownloadFileDir().toString(), + object : OnDownloadListener { + override fun onDownloadStart(totalBytes: Long) { + runOnUiThread { + LoadingDialogHub.show(this@PreviewPdfActivity, "附件加载中") + } + } + + override fun onProgressChanged(currentBytes: Long) { + + } + + override fun onDownloadEnd(file: File?) { + runOnUiThread { + LoadingDialogHub.dismiss() + } + val inputStream = FileInputStream(file) + pdfView.fromStream(inputStream).load() + } + }) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + } + + override fun initLayoutView(): Int = R.layout.activity_preview_pdf + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + } +} \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 3892b5a..02160cd 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -34,16 +34,18 @@ - - - - - - - + + + + + + + + + +) : RecyclerView.Adapter() { + + private var layoutInflater: LayoutInflater = LayoutInflater.from(context) + + override fun getItemCount(): Int = dataRows.size + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = ItemViewHolder( + layoutInflater.inflate(R.layout.item_equipment_rv_l, parent, false) + ) + + override fun onBindViewHolder(holder: ItemViewHolder, position: Int) { + //绑定数据 + val rowsBean = dataRows[position] + holder.equipmentNameView.text = rowsBean.equipmentName + holder.equipmentCodeView.text = rowsBean.equipmentNo + holder.equipmentDateView.text = rowsBean.enableDate + holder.equipmentLibView.text = rowsBean.useDeptName + + //绑定事件 + holder.itemView.setOnClickListener { + listener?.onItemClicked(position) + } + } + + inner class ItemViewHolder(view: View) : RecyclerView.ViewHolder(view) { + var equipmentNameView: TextView = view.findViewById(R.id.equipmentNameView) + var equipmentCodeView: TextView = view.findViewById(R.id.equipmentCodeView) + var equipmentDateView: TextView = view.findViewById(R.id.equipmentDateView) + var equipmentLibView: TextView = view.findViewById(R.id.equipmentLibView) + } + + private var listener: OnItemClickListener? = null + + interface OnItemClickListener { + fun onItemClicked(position: Int) + } + + fun setOnItemClickListener(onClickListener: OnItemClickListener?) { + this.listener = onClickListener + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt index b4628f3..d970b55 100644 --- a/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt +++ b/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt @@ -5,7 +5,8 @@ import com.casic.xz.meterage.R import com.casic.xz.meterage.adapter.HomeGridAdapter import com.casic.xz.meterage.utils.LocaleConstant -import com.casic.xz.meterage.view.NoticeListActivity +import com.casic.xz.meterage.view.home.EquipmentActivity +import com.casic.xz.meterage.view.notice.NoticeListActivity import com.casic.xz.meterage.vm.NoticeViewModel import com.pengxh.kt.lite.base.KotlinBaseFragment import com.pengxh.kt.lite.extensions.navigatePageTo @@ -36,8 +37,19 @@ homeFuncRecyclerView.adapter = homeAdapter homeAdapter.setOnGridItemClickListener(object : HomeGridAdapter.OnGridItemClickListener { override fun onItemClick(position: Int) { - when (position) { - + when (LocaleConstant.HOME_FUNC_OPERATE[position]) { + "仪器设备" -> requireContext().navigatePageTo() +// "标准装置" -> requireContext().navigatePageTo() +// "证书报告" -> requireContext().navigatePageTo() +// "委托需求" -> requireContext().navigatePageTo() +// "访客" -> requireContext().navigatePageTo() +// "标准规范" -> requireContext().navigatePageTo() +// "能力列表" -> requireContext().navigatePageTo() +// "计量培训" -> requireContext().navigatePageTo() +// "合同发票" -> requireContext().navigatePageTo() +// "业务统计" -> requireContext().navigatePageTo() +// "客户列表" -> requireContext().navigatePageTo() +// "外场检测" -> requireContext().navigatePageTo() } } }) diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt index 7e75abe..56dc5ec 100644 --- a/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt +++ b/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt @@ -2,9 +2,11 @@ import android.view.View import androidx.lifecycle.ViewModelProvider +import com.bumptech.glide.Glide +import com.bumptech.glide.request.RequestOptions import com.casic.xz.meterage.R import com.casic.xz.meterage.utils.LocaleConstant -import com.casic.xz.meterage.view.NoticeListActivity +import com.casic.xz.meterage.view.notice.NoticeListActivity import com.casic.xz.meterage.vm.NoticeViewModel import com.casic.xz.meterage.vm.UserViewModel import com.pengxh.kt.lite.base.KotlinBaseFragment @@ -23,6 +25,12 @@ val data = it.data userNameView.text = data.name userUnitView.text = data.deptName + +// Glide.with(requireContext()) +// .load(R.mipmap.default_avatar) +// .apply(RequestOptions.circleCropTransform()) +// .placeholder(R.mipmap.load_image_error) +// .into(userAvatarView) } }) diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt new file mode 100644 index 0000000..cf22646 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt @@ -0,0 +1,103 @@ +package com.casic.xz.meterage.fragment.equipment + +import android.graphics.Paint +import androidx.lifecycle.ViewModelProvider +import com.casic.xz.meterage.R +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.casic.xz.meterage.vm.EquipmentViewModel +import com.pengxh.kt.lite.base.KotlinBaseFragment +import com.pengxh.kt.lite.extensions.convertColor +import com.pengxh.kt.lite.vm.LoadState +import kotlinx.android.synthetic.main.fragment_basic_information.* + +class BasicInformationFragment(private val id: String) : KotlinBaseFragment() { + + private lateinit var equipmentViewModel: EquipmentViewModel + + override fun initData() { + equipmentViewModel = ViewModelProvider(this)[EquipmentViewModel::class.java] + equipmentViewModel.getEquipmentDetail(id) + equipmentViewModel.equipmentDetailResult.observe(this, { + if (it.code == 200) { + val data = it.data!! + + equipmentCodeView.text = data.equipmentNo + equipmentNameView.text = data.equipmentName + manufacturerView.text = data.manufacturer + factoryNumberView.text = data.manufacturingNo + modelView.text = data.modelNo + verificationMethodView.text = data.mesureTypeName + measuringRangeView.text = data.mesureRange + uncertaintyView.text = data.uncertainty + firstUseView.text = data.createTime + originalValueView.text = data.originValue + usageDeptView.text = data.useDeptName + userView.text = data.usePersonName + managementStatusView.text = data.managerStateName + verificationDeptView.text = data.useDeptName +// nextVerificationDeptView.text = data. + verificationPeriodView.text = data.mesureCycle + verificationDateView.text = data.mesureDate + effectiveDateView.text = data.validDate + verificationResultsView.text = data.mesureResultName + abcView.text = data.abcName + isNeedTechnicalView.text = if ( + data.isCalibrationTestEquipment.isNullOrBlank() || data.isCalibrationTestEquipment == "0" + ) { + "否" + } else { + "是" + } + + isStandingBook.text = if ( + data.isMeasureAccount.isNullOrBlank() || data.isMeasureAccount == "0" + ) { + "否" + } else { + "是" + } + + isStandardView.text = if ( + data.isStandardSupportEquipment.isNullOrBlank() || data.isStandardSupportEquipment == "0" + ) { + "否" + } else { + "是" + } + remarkView.text = data.remark + if (data.fileList.size == 0) { + instructionsView.text = "暂无" + } else { + instructionsView.text = "查看附件列表" + val textPaint = instructionsView.paint + textPaint.flags = Paint.UNDERLINE_TEXT_FLAG + textPaint.isAntiAlias = true + instructionsView.setTextColor(R.color.themeColor.convertColor(requireContext())) + + instructionsView.setOnClickListener { + + } + } + } + }) + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_basic_information + + override fun observeRequestState() { + equipmentViewModel.loadState.observe(this, { + when (it) { + LoadState.Loading -> LoadingDialogHub.show(requireActivity(), "数据加载中...") + else -> LoadingDialogHub.dismiss() + } + }) + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt new file mode 100644 index 0000000..0b4a747 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class CertificateFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_certificate + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt new file mode 100644 index 0000000..f05c491 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class ChangeRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_change_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt new file mode 100644 index 0000000..849ffa5 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class InspectionRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_inspection_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt new file mode 100644 index 0000000..aa4edd9 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class UsageRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_usage_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java b/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java new file mode 100644 index 0000000..0b9124e --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java @@ -0,0 +1,760 @@ +package com.casic.xz.meterage.model; + +import java.util.List; + +public class EquipmentDetailModel { + + private int code; + private DataModel data; + private String message; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataModel getData() { + return data; + } + + public void setData(DataModel data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public static class DataModel { + private String abc; + private String abcName; + private String assetNo; + private String assetSource; + private String assetType; + private String assetTypeName; + private String attribute; + private String capitalSource; + private String capitalSourceName; + private String cardEstablishmentDate; + private String createTime; + private String createUser; + private String depreciationMethod; + private String depreciationMethodName; + private String depreciationPeriod; + private String enableDate; + private String equipmentCategory; + private String equipmentCategoryName; + private String equipmentName; + private String equipmentNo; + private String equipmentSpecifications; + private String equipmentType; + private String equipmentTypeName; + private List fileList; + private String id; + private String installIncidentalExpenses; + private String installPlace; + private String intactState; + private String isCalibrationTestEquipment; + private int isDel; + private String isFixedAssets; + private String isMeasureAccount; + private String isStandardSupportEquipment; + private String labelBind; + private String majorCategory; + private String majorCategoryName; + private String managerLevel; + private String managerLevelName; + private String managerState; + private String managerStateName; + private String manufacturer; + private String manufacturerCountry; + private String manufacturingDate; + private String manufacturingNo; + private String mesureCycle; + private String mesureDate; + private String mesureDept; + private String mesureRange; + private String mesureResult; + private String mesureResultName; + private String mesureType; + private String mesureTypeName; + private String modelNo; + private String originValue; + private String overallDimension; + private String presentOriginValue; + private String purpose; + private String remark; + private String singlePrice; + private String supportStandardEquipmentName; + private String supportStandardEquipmentNo; + private String technicalLevel; + private String uncertainty; + private String updateTime; + private String useDept; + private String useDeptName; + private String usePerson; + private String usePersonName; + private String validDate; + private int version; + private String weight; + + public String getAbc() { + return abc; + } + + public void setAbc(String abc) { + this.abc = abc; + } + + public String getAbcName() { + return abcName; + } + + public void setAbcName(String abcName) { + this.abcName = abcName; + } + + public String getAssetNo() { + return assetNo; + } + + public void setAssetNo(String assetNo) { + this.assetNo = assetNo; + } + + public String getAssetSource() { + return assetSource; + } + + public void setAssetSource(String assetSource) { + this.assetSource = assetSource; + } + + public String getAssetType() { + return assetType; + } + + public void setAssetType(String assetType) { + this.assetType = assetType; + } + + public String getAssetTypeName() { + return assetTypeName; + } + + public void setAssetTypeName(String assetTypeName) { + this.assetTypeName = assetTypeName; + } + + public String getAttribute() { + return attribute; + } + + public void setAttribute(String attribute) { + this.attribute = attribute; + } + + public String getCapitalSource() { + return capitalSource; + } + + public void setCapitalSource(String capitalSource) { + this.capitalSource = capitalSource; + } + + public String getCapitalSourceName() { + return capitalSourceName; + } + + public void setCapitalSourceName(String capitalSourceName) { + this.capitalSourceName = capitalSourceName; + } + + public String getCardEstablishmentDate() { + return cardEstablishmentDate; + } + + public void setCardEstablishmentDate(String cardEstablishmentDate) { + this.cardEstablishmentDate = cardEstablishmentDate; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getDepreciationMethod() { + return depreciationMethod; + } + + public void setDepreciationMethod(String depreciationMethod) { + this.depreciationMethod = depreciationMethod; + } + + public String getDepreciationMethodName() { + return depreciationMethodName; + } + + public void setDepreciationMethodName(String depreciationMethodName) { + this.depreciationMethodName = depreciationMethodName; + } + + public String getDepreciationPeriod() { + return depreciationPeriod; + } + + public void setDepreciationPeriod(String depreciationPeriod) { + this.depreciationPeriod = depreciationPeriod; + } + + public String getEnableDate() { + return enableDate; + } + + public void setEnableDate(String enableDate) { + this.enableDate = enableDate; + } + + public String getEquipmentCategory() { + return equipmentCategory; + } + + public void setEquipmentCategory(String equipmentCategory) { + this.equipmentCategory = equipmentCategory; + } + + public String getEquipmentCategoryName() { + return equipmentCategoryName; + } + + public void setEquipmentCategoryName(String equipmentCategoryName) { + this.equipmentCategoryName = equipmentCategoryName; + } + + public String getEquipmentName() { + return equipmentName; + } + + public void setEquipmentName(String equipmentName) { + this.equipmentName = equipmentName; + } + + public String getEquipmentNo() { + return equipmentNo; + } + + public void setEquipmentNo(String equipmentNo) { + this.equipmentNo = equipmentNo; + } + + public String getEquipmentSpecifications() { + return equipmentSpecifications; + } + + public void setEquipmentSpecifications(String equipmentSpecifications) { + this.equipmentSpecifications = equipmentSpecifications; + } + + public String getEquipmentType() { + return equipmentType; + } + + public void setEquipmentType(String equipmentType) { + this.equipmentType = equipmentType; + } + + public String getEquipmentTypeName() { + return equipmentTypeName; + } + + public void setEquipmentTypeName(String equipmentTypeName) { + this.equipmentTypeName = equipmentTypeName; + } + + public List getFileList() { + return fileList; + } + + public void setFileList(List fileList) { + this.fileList = fileList; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getInstallIncidentalExpenses() { + return installIncidentalExpenses; + } + + public void setInstallIncidentalExpenses(String installIncidentalExpenses) { + this.installIncidentalExpenses = installIncidentalExpenses; + } + + public String getInstallPlace() { + return installPlace; + } + + public void setInstallPlace(String installPlace) { + this.installPlace = installPlace; + } + + public String getIntactState() { + return intactState; + } + + public void setIntactState(String intactState) { + this.intactState = intactState; + } + + public String getIsCalibrationTestEquipment() { + return isCalibrationTestEquipment; + } + + public void setIsCalibrationTestEquipment(String isCalibrationTestEquipment) { + this.isCalibrationTestEquipment = isCalibrationTestEquipment; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getIsFixedAssets() { + return isFixedAssets; + } + + public void setIsFixedAssets(String isFixedAssets) { + this.isFixedAssets = isFixedAssets; + } + + public String getIsMeasureAccount() { + return isMeasureAccount; + } + + public void setIsMeasureAccount(String isMeasureAccount) { + this.isMeasureAccount = isMeasureAccount; + } + + public String getIsStandardSupportEquipment() { + return isStandardSupportEquipment; + } + + public void setIsStandardSupportEquipment(String isStandardSupportEquipment) { + this.isStandardSupportEquipment = isStandardSupportEquipment; + } + + public String getLabelBind() { + return labelBind; + } + + public void setLabelBind(String labelBind) { + this.labelBind = labelBind; + } + + public String getMajorCategory() { + return majorCategory; + } + + public void setMajorCategory(String majorCategory) { + this.majorCategory = majorCategory; + } + + public String getMajorCategoryName() { + return majorCategoryName; + } + + public void setMajorCategoryName(String majorCategoryName) { + this.majorCategoryName = majorCategoryName; + } + + public String getManagerLevel() { + return managerLevel; + } + + public void setManagerLevel(String managerLevel) { + this.managerLevel = managerLevel; + } + + public String getManagerLevelName() { + return managerLevelName; + } + + public void setManagerLevelName(String managerLevelName) { + this.managerLevelName = managerLevelName; + } + + public String getManagerState() { + return managerState; + } + + public void setManagerState(String managerState) { + this.managerState = managerState; + } + + public String getManagerStateName() { + return managerStateName; + } + + public void setManagerStateName(String managerStateName) { + this.managerStateName = managerStateName; + } + + public String getManufacturer() { + return manufacturer; + } + + public void setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + } + + public String getManufacturerCountry() { + return manufacturerCountry; + } + + public void setManufacturerCountry(String manufacturerCountry) { + this.manufacturerCountry = manufacturerCountry; + } + + public String getManufacturingDate() { + return manufacturingDate; + } + + public void setManufacturingDate(String manufacturingDate) { + this.manufacturingDate = manufacturingDate; + } + + public String getManufacturingNo() { + return manufacturingNo; + } + + public void setManufacturingNo(String manufacturingNo) { + this.manufacturingNo = manufacturingNo; + } + + public String getMesureCycle() { + return mesureCycle; + } + + public void setMesureCycle(String mesureCycle) { + this.mesureCycle = mesureCycle; + } + + public String getMesureDate() { + return mesureDate; + } + + public void setMesureDate(String mesureDate) { + this.mesureDate = mesureDate; + } + + public String getMesureDept() { + return mesureDept; + } + + public void setMesureDept(String mesureDept) { + this.mesureDept = mesureDept; + } + + public String getMesureRange() { + return mesureRange; + } + + public void setMesureRange(String mesureRange) { + this.mesureRange = mesureRange; + } + + public String getMesureResult() { + return mesureResult; + } + + public void setMesureResult(String mesureResult) { + this.mesureResult = mesureResult; + } + + public String getMesureResultName() { + return mesureResultName; + } + + public void setMesureResultName(String mesureResultName) { + this.mesureResultName = mesureResultName; + } + + public String getMesureType() { + return mesureType; + } + + public void setMesureType(String mesureType) { + this.mesureType = mesureType; + } + + public String getMesureTypeName() { + return mesureTypeName; + } + + public void setMesureTypeName(String mesureTypeName) { + this.mesureTypeName = mesureTypeName; + } + + public String getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getOriginValue() { + return originValue; + } + + public void setOriginValue(String originValue) { + this.originValue = originValue; + } + + public String getOverallDimension() { + return overallDimension; + } + + public void setOverallDimension(String overallDimension) { + this.overallDimension = overallDimension; + } + + public String getPresentOriginValue() { + return presentOriginValue; + } + + public void setPresentOriginValue(String presentOriginValue) { + this.presentOriginValue = presentOriginValue; + } + + public String getPurpose() { + return purpose; + } + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getSinglePrice() { + return singlePrice; + } + + public void setSinglePrice(String singlePrice) { + this.singlePrice = singlePrice; + } + + public String getSupportStandardEquipmentName() { + return supportStandardEquipmentName; + } + + public void setSupportStandardEquipmentName(String supportStandardEquipmentName) { + this.supportStandardEquipmentName = supportStandardEquipmentName; + } + + public String getSupportStandardEquipmentNo() { + return supportStandardEquipmentNo; + } + + public void setSupportStandardEquipmentNo(String supportStandardEquipmentNo) { + this.supportStandardEquipmentNo = supportStandardEquipmentNo; + } + + public String getTechnicalLevel() { + return technicalLevel; + } + + public void setTechnicalLevel(String technicalLevel) { + this.technicalLevel = technicalLevel; + } + + public String getUncertainty() { + return uncertainty; + } + + public void setUncertainty(String uncertainty) { + this.uncertainty = uncertainty; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getUseDept() { + return useDept; + } + + public void setUseDept(String useDept) { + this.useDept = useDept; + } + + public String getUseDeptName() { + return useDeptName; + } + + public void setUseDeptName(String useDeptName) { + this.useDeptName = useDeptName; + } + + public String getUsePerson() { + return usePerson; + } + + public void setUsePerson(String usePerson) { + this.usePerson = usePerson; + } + + public String getUsePersonName() { + return usePersonName; + } + + public void setUsePersonName(String usePersonName) { + this.usePersonName = usePersonName; + } + + public String getValidDate() { + return validDate; + } + + public void setValidDate(String validDate) { + this.validDate = validDate; + } + + public int getVersion() { + return version; + } + + public void setVersion(int version) { + this.version = version; + } + + public String getWeight() { + return weight; + } + + public void setWeight(String weight) { + this.weight = weight; + } + + public static class FileListModel { + private String assetId; + private String createTime; + private String createUser; + private String fileName; + private String id; + private int isDel; + private String minioFileName; + private String remark; + private String updateTime; + + public String getAssetId() { + return assetId; + } + + public void setAssetId(String assetId) { + this.assetId = assetId; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getFileName() { + return fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getMinioFileName() { + return minioFileName; + } + + public void setMinioFileName(String minioFileName) { + this.minioFileName = minioFileName; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + } + } +} diff --git a/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java b/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java new file mode 100644 index 0000000..15fc128 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java @@ -0,0 +1,697 @@ +package com.casic.xz.meterage.model; + +import java.util.List; + +public class EquipmentListModel { + + private int code; + private DataModel data; + private String message; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataModel getData() { + return data; + } + + public void setData(DataModel data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public static class DataModel { + private List rows; + private int total; + + public List getRows() { + return rows; + } + + public void setRows(List rows) { + this.rows = rows; + } + + public int getTotal() { + return total; + } + + public void setTotal(int total) { + this.total = total; + } + + public static class RowsModel { + private String abc; + private String abcName; + private String assetNo; + private String assetSource; + private String assetType; + private String assetTypeName; + private String attribute; + private String capitalSource; + private String capitalSourceName; + private String cardEstablishmentDate; + private String createTime; + private String createUser; + private String depreciationMethod; + private String depreciationMethodName; + private String depreciationPeriod; + private String enableDate; + private String equipmentCategory; + private String equipmentCategoryName; + private String equipmentName; + private String equipmentNo; + private String equipmentSpecifications; + private String equipmentType; + private String equipmentTypeName; + private String fileList; + private String id; + private String installIncidentalExpenses; + private String installPlace; + private String intactState; + private String isCalibrationTestEquipment; + private int isDel; + private String isFixedAssets; + private String isMeasureAccount; + private String isStandardSupportEquipment; + private String labelBind; + private String majorCategory; + private String majorCategoryName; + private String managerLevel; + private String managerLevelName; + private String managerState; + private String managerStateName; + private String manufacturer; + private String manufacturerCountry; + private String manufacturingDate; + private String manufacturingNo; + private String mesureCycle; + private String mesureDate; + private String mesureDept; + private String mesureRange; + private String mesureResult; + private String mesureResultName; + private String mesureType; + private String mesureTypeName; + private String modelNo; + private String originValue; + private String overallDimension; + private String presentOriginValue; + private String purpose; + private String remark; + private String singlePrice; + private String supportStandardEquipmentName; + private String supportStandardEquipmentNo; + private String technicalLevel; + private String uncertainty; + private String updateTime; + private String useDept; + private String useDeptName; + private String usePerson; + private String usePersonName; + private String validDate; + private int version; + private String weight; + + public String getAbc() { + return abc; + } + + public void setAbc(String abc) { + this.abc = abc; + } + + public String getAbcName() { + return abcName; + } + + public void setAbcName(String abcName) { + this.abcName = abcName; + } + + public String getAssetNo() { + return assetNo; + } + + public void setAssetNo(String assetNo) { + this.assetNo = assetNo; + } + + public String getAssetSource() { + return assetSource; + } + + public void setAssetSource(String assetSource) { + this.assetSource = assetSource; + } + + public String getAssetType() { + return assetType; + } + + public void setAssetType(String assetType) { + this.assetType = assetType; + } + + public String getAssetTypeName() { + return assetTypeName; + } + + public void setAssetTypeName(String assetTypeName) { + this.assetTypeName = assetTypeName; + } + + public String getAttribute() { + return attribute; + } + + public void setAttribute(String attribute) { + this.attribute = attribute; + } + + public String getCapitalSource() { + return capitalSource; + } + + public void setCapitalSource(String capitalSource) { + this.capitalSource = capitalSource; + } + + public String getCapitalSourceName() { + return capitalSourceName; + } + + public void setCapitalSourceName(String capitalSourceName) { + this.capitalSourceName = capitalSourceName; + } + + public String getCardEstablishmentDate() { + return cardEstablishmentDate; + } + + public void setCardEstablishmentDate(String cardEstablishmentDate) { + this.cardEstablishmentDate = cardEstablishmentDate; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getDepreciationMethod() { + return depreciationMethod; + } + + public void setDepreciationMethod(String depreciationMethod) { + this.depreciationMethod = depreciationMethod; + } + + public String getDepreciationMethodName() { + return depreciationMethodName; + } + + public void setDepreciationMethodName(String depreciationMethodName) { + this.depreciationMethodName = depreciationMethodName; + } + + public String getDepreciationPeriod() { + return depreciationPeriod; + } + + public void setDepreciationPeriod(String depreciationPeriod) { + this.depreciationPeriod = depreciationPeriod; + } + + public String getEnableDate() { + return enableDate; + } + + public void setEnableDate(String enableDate) { + this.enableDate = enableDate; + } + + public String getEquipmentCategory() { + return equipmentCategory; + } + + public void setEquipmentCategory(String equipmentCategory) { + this.equipmentCategory = equipmentCategory; + } + + public String getEquipmentCategoryName() { + return equipmentCategoryName; + } + + public void setEquipmentCategoryName(String equipmentCategoryName) { + this.equipmentCategoryName = equipmentCategoryName; + } + + public String getEquipmentName() { + return equipmentName; + } + + public void setEquipmentName(String equipmentName) { + this.equipmentName = equipmentName; + } + + public String getEquipmentNo() { + return equipmentNo; + } + + public void setEquipmentNo(String equipmentNo) { + this.equipmentNo = equipmentNo; + } + + public String getEquipmentSpecifications() { + return equipmentSpecifications; + } + + public void setEquipmentSpecifications(String equipmentSpecifications) { + this.equipmentSpecifications = equipmentSpecifications; + } + + public String getEquipmentType() { + return equipmentType; + } + + public void setEquipmentType(String equipmentType) { + this.equipmentType = equipmentType; + } + + public String getEquipmentTypeName() { + return equipmentTypeName; + } + + public void setEquipmentTypeName(String equipmentTypeName) { + this.equipmentTypeName = equipmentTypeName; + } + + public String getFileList() { + return fileList; + } + + public void setFileList(String fileList) { + this.fileList = fileList; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getInstallIncidentalExpenses() { + return installIncidentalExpenses; + } + + public void setInstallIncidentalExpenses(String installIncidentalExpenses) { + this.installIncidentalExpenses = installIncidentalExpenses; + } + + public String getInstallPlace() { + return installPlace; + } + + public void setInstallPlace(String installPlace) { + this.installPlace = installPlace; + } + + public String getIntactState() { + return intactState; + } + + public void setIntactState(String intactState) { + this.intactState = intactState; + } + + public String getIsCalibrationTestEquipment() { + return isCalibrationTestEquipment; + } + + public void setIsCalibrationTestEquipment(String isCalibrationTestEquipment) { + this.isCalibrationTestEquipment = isCalibrationTestEquipment; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getIsFixedAssets() { + return isFixedAssets; + } + + public void setIsFixedAssets(String isFixedAssets) { + this.isFixedAssets = isFixedAssets; + } + + public String getIsMeasureAccount() { + return isMeasureAccount; + } + + public void setIsMeasureAccount(String isMeasureAccount) { + this.isMeasureAccount = isMeasureAccount; + } + + public String getIsStandardSupportEquipment() { + return isStandardSupportEquipment; + } + + public void setIsStandardSupportEquipment(String isStandardSupportEquipment) { + this.isStandardSupportEquipment = isStandardSupportEquipment; + } + + public String getLabelBind() { + return labelBind; + } + + public void setLabelBind(String labelBind) { + this.labelBind = labelBind; + } + + public String getMajorCategory() { + return majorCategory; + } + + public void setMajorCategory(String majorCategory) { + this.majorCategory = majorCategory; + } + + public String getMajorCategoryName() { + return majorCategoryName; + } + + public void setMajorCategoryName(String majorCategoryName) { + this.majorCategoryName = majorCategoryName; + } + + public String getManagerLevel() { + return managerLevel; + } + + public void setManagerLevel(String managerLevel) { + this.managerLevel = managerLevel; + } + + public String getManagerLevelName() { + return managerLevelName; + } + + public void setManagerLevelName(String managerLevelName) { + this.managerLevelName = managerLevelName; + } + + public String getManagerState() { + return managerState; + } + + public void setManagerState(String managerState) { + this.managerState = managerState; + } + + public String getManagerStateName() { + return managerStateName; + } + + public void setManagerStateName(String managerStateName) { + this.managerStateName = managerStateName; + } + + public String getManufacturer() { + return manufacturer; + } + + public void setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + } + + public String getManufacturerCountry() { + return manufacturerCountry; + } + + public void setManufacturerCountry(String manufacturerCountry) { + this.manufacturerCountry = manufacturerCountry; + } + + public String getManufacturingDate() { + return manufacturingDate; + } + + public void setManufacturingDate(String manufacturingDate) { + this.manufacturingDate = manufacturingDate; + } + + public String getManufacturingNo() { + return manufacturingNo; + } + + public void setManufacturingNo(String manufacturingNo) { + this.manufacturingNo = manufacturingNo; + } + + public String getMesureCycle() { + return mesureCycle; + } + + public void setMesureCycle(String mesureCycle) { + this.mesureCycle = mesureCycle; + } + + public String getMesureDate() { + return mesureDate; + } + + public void setMesureDate(String mesureDate) { + this.mesureDate = mesureDate; + } + + public String getMesureDept() { + return mesureDept; + } + + public void setMesureDept(String mesureDept) { + this.mesureDept = mesureDept; + } + + public String getMesureRange() { + return mesureRange; + } + + public void setMesureRange(String mesureRange) { + this.mesureRange = mesureRange; + } + + public String getMesureResult() { + return mesureResult; + } + + public void setMesureResult(String mesureResult) { + this.mesureResult = mesureResult; + } + + public String getMesureResultName() { + return mesureResultName; + } + + public void setMesureResultName(String mesureResultName) { + this.mesureResultName = mesureResultName; + } + + public String getMesureType() { + return mesureType; + } + + public void setMesureType(String mesureType) { + this.mesureType = mesureType; + } + + public String getMesureTypeName() { + return mesureTypeName; + } + + public void setMesureTypeName(String mesureTypeName) { + this.mesureTypeName = mesureTypeName; + } + + public String getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getOriginValue() { + return originValue; + } + + public void setOriginValue(String originValue) { + this.originValue = originValue; + } + + public String getOverallDimension() { + return overallDimension; + } + + public void setOverallDimension(String overallDimension) { + this.overallDimension = overallDimension; + } + + public String getPresentOriginValue() { + return presentOriginValue; + } + + public void setPresentOriginValue(String presentOriginValue) { + this.presentOriginValue = presentOriginValue; + } + + public String getPurpose() { + return purpose; + } + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getSinglePrice() { + return singlePrice; + } + + public void setSinglePrice(String singlePrice) { + this.singlePrice = singlePrice; + } + + public String getSupportStandardEquipmentName() { + return supportStandardEquipmentName; + } + + public void setSupportStandardEquipmentName(String supportStandardEquipmentName) { + this.supportStandardEquipmentName = supportStandardEquipmentName; + } + + public String getSupportStandardEquipmentNo() { + return supportStandardEquipmentNo; + } + + public void setSupportStandardEquipmentNo(String supportStandardEquipmentNo) { + this.supportStandardEquipmentNo = supportStandardEquipmentNo; + } + + public String getTechnicalLevel() { + return technicalLevel; + } + + public void setTechnicalLevel(String technicalLevel) { + this.technicalLevel = technicalLevel; + } + + public String getUncertainty() { + return uncertainty; + } + + public void setUncertainty(String uncertainty) { + this.uncertainty = uncertainty; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getUseDept() { + return useDept; + } + + public void setUseDept(String useDept) { + this.useDept = useDept; + } + + public String getUseDeptName() { + return useDeptName; + } + + public void setUseDeptName(String useDeptName) { + this.useDeptName = useDeptName; + } + + public String getUsePerson() { + return usePerson; + } + + public void setUsePerson(String usePerson) { + this.usePerson = usePerson; + } + + public String getUsePersonName() { + return usePersonName; + } + + public void setUsePersonName(String usePersonName) { + this.usePersonName = usePersonName; + } + + public String getValidDate() { + return validDate; + } + + public void setValidDate(String validDate) { + this.validDate = validDate; + } + + public int getVersion() { + return version; + } + + public void setVersion(int version) { + this.version = version; + } + + public String getWeight() { + return weight; + } + + public void setWeight(String weight) { + this.weight = weight; + } + } + } +} diff --git a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt index a3f514f..46e5eef 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt @@ -35,4 +35,24 @@ @QueryMap limit: Map, @QueryMap offset: Map ): String + + /** + * 获取设备列表 + */ + @POST("/meter/assets/listPage") + suspend fun getEquipmentList( + @Header("token") token: String, + @Body requestBody: RequestBody, + @QueryMap limit: Map, + @QueryMap offset: Map + ): String + + /** + * 获取设备详情 + */ + @POST("/meter/assets/detail") + suspend fun getEquipmentDetail( + @Header("token") token: String, + @Body requestBody: RequestBody + ): String } \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt index 444a872..386a1d8 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt @@ -6,8 +6,10 @@ import com.pengxh.kt.lite.utils.SaveKeyValues import okhttp3.MediaType.Companion.toMediaType import okhttp3.RequestBody.Companion.toRequestBody +import org.json.JSONArray import org.json.JSONObject + object RetrofitServiceManager { private val api by lazy { @@ -73,4 +75,71 @@ offsetMap["offset"] = offset return api.getNoticeList(AuthenticationHelper.token!!, requestBody, limitMap, offsetMap) } + + /** + * 获取设备列表 + */ + suspend fun getEquipmentList( + equipmentNo: String, + equipmentName: String, + mesureType: String, + managerState: String, + useDept: String, + assetType: String, + equipmentCategory: String, + isCalibrationTestEquipment: String, + isMeasureAccount: String, + isStandardSupportEquipment: String, + isFixedAssets: String, + validStartDate: String, + validEndDate: String, + abc: String, + ids: Array, + offset: Int + ): String { + val paramObject = JSONObject() + paramObject.put("equipmentNo", equipmentNo) + paramObject.put("equipmentName", equipmentName) + paramObject.put("mesureType", mesureType) + paramObject.put("managerState", managerState) + paramObject.put("useDept", useDept) + paramObject.put("assetType", assetType) + paramObject.put("equipmentCategory", equipmentCategory) + paramObject.put("isCalibrationTestEquipment", isCalibrationTestEquipment) + paramObject.put("isMeasureAccount", isMeasureAccount) + paramObject.put("isStandardSupportEquipment", isStandardSupportEquipment) + paramObject.put("isFixedAssets", isFixedAssets) + paramObject.put("validStartDate", validStartDate) + paramObject.put("validEndDate", validEndDate) + paramObject.put("abc", abc) + + val jsonArray = JSONArray() + ids.forEach { + jsonArray.put(it) + } + paramObject.put("ids", jsonArray) + + val requestBody = paramObject.toString().toRequestBody( + "application/json;charset=UTF-8".toMediaType() + ) + + val limitMap = HashMap() + limitMap["limit"] = LocaleConstant.PAGE_LIMIT + + val offsetMap = HashMap() + offsetMap["offset"] = offset + return api.getEquipmentList(AuthenticationHelper.token!!, requestBody, limitMap, offsetMap) + } + + /** + * 获取设备详情 + */ + suspend fun getEquipmentDetail(id: String): String { + val paramObject = JSONObject() + paramObject.put("id", id) + val requestBody = paramObject.toString().toRequestBody( + "application/json;charset=UTF-8".toMediaType() + ) + return api.getEquipmentDetail(AuthenticationHelper.token!!, requestBody) + } } \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt deleted file mode 100644 index a5bb60b..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt +++ /dev/null @@ -1,104 +0,0 @@ -package com.casic.xz.meterage.view - -import android.annotation.SuppressLint -import android.graphics.Paint -import androidx.lifecycle.ViewModelProvider -import com.casic.xz.meterage.R -import com.casic.xz.meterage.extensions.combineImagePath -import com.casic.xz.meterage.extensions.formatTextFromHtml -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.vm.NoticeViewModel -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.extensions.convertColor -import com.pengxh.kt.lite.extensions.navigatePageTo -import com.pengxh.kt.lite.extensions.obtainScreenWidth -import com.pengxh.kt.lite.extensions.show -import com.pengxh.kt.lite.utils.Constant -import kotlinx.android.synthetic.main.activity_notice_detail.* -import kotlinx.android.synthetic.main.include_base_title.* -import java.util.* - -@SuppressLint("SetTextI18n") -class NoticeDetailActivity : KotlinBaseActivity() { - - private lateinit var noticeViewModel: NoticeViewModel - - override fun initData() { - leftBackView.setOnClickListener { finish() } - titleView.text = "通知公告" - - val args = intent.getStringArrayListExtra(Constant.INTENT_PARAM)!! - - noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] - noticeViewModel.getNoticeList(args[0], args[1], args[2], "", "", 1) - noticeViewModel.noticeResult.observe(this, { - if (it.code == 200) { - val dataRow = it.data?.rows!![0] - - noticeDateView.text = dataRow.noticeTime - noticePublisherView.text = "发布人 ${dataRow.noticePublisher}" - noticeCompanyView.text = "发布单位 ${dataRow.noticeCompany}" - - noticeNoView.text = dataRow.noticeNo - noticeTitleView.text = dataRow.noticeTitle - noticeSketchView.text = dataRow.noticeSketch - - dataRow.noticeContent.formatTextFromHtml( - this, noticeContentView, obtainScreenWidth() - ) - - if (dataRow.minioFileName.isNullOrBlank()) { - minioFileView.text = "暂无附件" - } else { - val minioFileName = dataRow.minioFileName - - minioFileView.text = minioFileName - val textPaint = minioFileView.paint - textPaint.flags = Paint.UNDERLINE_TEXT_FLAG - textPaint.isAntiAlias = true - minioFileView.setTextColor(R.color.themeColor.convertColor(this)) - - minioFileView.setOnClickListener { - //查看附件 - if (minioFileName.endsWith("pdf")) { - navigatePageTo(minioFileName) - } else if ( - minioFileName.endsWith("doc") || - minioFileName.endsWith("docx") - ) { - navigatePageTo(minioFileName) - } else if (minioFileName.endsWith("txt")) { - navigatePageTo(minioFileName) - } else if ( - minioFileName.endsWith("png") || - minioFileName.endsWith("jpeg") || - minioFileName.endsWith("jpg") - ) { - val urls = ArrayList() - urls.add(minioFileName.combineImagePath()) - navigatePageTo(0, urls) - } else { - "文件类型未知,无法打开附件".show(this) - } - } - } - } - }) - } - - override fun initEvent() { - - } - - override fun initLayoutView(): Int = R.layout.activity_notice_detail - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/NoticeListActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/NoticeListActivity.kt deleted file mode 100644 index 15f6a16..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/NoticeListActivity.kt +++ /dev/null @@ -1,180 +0,0 @@ -package com.casic.xz.meterage.view - -import android.os.Handler -import android.util.Log -import android.view.View -import androidx.lifecycle.ViewModelProvider -import com.casic.xz.meterage.R -import com.casic.xz.meterage.adapter.NoticeListAdapter -import com.casic.xz.meterage.extensions.addAll -import com.casic.xz.meterage.extensions.combineFilePath -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.extensions.showEmptyPage -import com.casic.xz.meterage.model.NoticeListModel -import com.casic.xz.meterage.vm.NoticeViewModel -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.extensions.navigatePageTo -import com.pengxh.kt.lite.extensions.show -import com.pengxh.kt.lite.utils.WeakReferenceHandler -import com.pengxh.kt.lite.widget.dialog.AlertControlDialog -import kotlinx.android.synthetic.main.activity_notice_list.* -import kotlinx.android.synthetic.main.include_empty_view.* - -class NoticeListActivity : KotlinBaseActivity() { - - private lateinit var weakReferenceHandler: WeakReferenceHandler - private lateinit var noticeViewModel: NoticeViewModel - private lateinit var noticeListAdapter: NoticeListAdapter - private var dataBeans: MutableList = ArrayList() - private var pageIndex = 1 - private var isRefresh = false - private var isLoadMore = false - - override fun initData() { - weakReferenceHandler = WeakReferenceHandler(callback) - noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] - noticeViewModel.noticeResult.observe(this, { - if (it.code == 200) { - val dataRows = it.data?.rows!! -// countBadeNumber(dataRows) - when { - isRefresh -> { - dataBeans.clear() - dataBeans = dataRows - noticeLayout.finishRefresh() - isRefresh = false - } - isLoadMore -> { - if (dataRows.size == 0) { - "到底了,别拉了".show(this) - } - dataBeans.addAll(dataRows) - noticeLayout.finishLoadMore() - isLoadMore = false - } - else -> { - dataBeans = dataRows - } - } - weakReferenceHandler.sendEmptyMessage(2023013101) - } - }) - } - - override fun initEvent() { - leftBackView.setOnClickListener { finish() } - rightOperateView.setOnClickListener { - AlertControlDialog.Builder() - .setContext(this) - .setTitle("提示") - .setMessage("确定将所有未读消息标为已读?") - .setNegativeButton("取消") - .setPositiveButton("确定") - .setOnDialogButtonClickListener(object : - AlertControlDialog.OnDialogButtonClickListener { - override fun onCancelClick() { - - } - - override fun onConfirmClick() { - //TODO 设置为已读 - } - }).build().show() - } - - if (hasNoticePermission()) { - openSystemNoticeLayout.visibility = View.GONE - openSystemNoticeLayout.visibility = View.GONE - } else { - openSystemNoticeLayout.setOnClickListener { - - } - - - closeLayoutView.setOnClickListener { - openSystemNoticeLayout.visibility = View.GONE - } - } - - noticeLayout.setOnRefreshListener { - isRefresh = true - //刷新之后页码重置 - pageIndex = 1 - getNoticeListByPage() - } - - noticeLayout.setOnLoadMoreListener { - isLoadMore = true - pageIndex++ - getNoticeListByPage() - } - } - - override fun onResume() { - super.onResume() - pageIndex = 1 - getNoticeListByPage() - } - - private fun getNoticeListByPage() { - noticeViewModel.getNoticeList("", "", "", "", "", pageIndex) - } - - private val callback = Handler.Callback { - when (it.what) { - 2023013101 -> { - if (isRefresh || isLoadMore) { - noticeListAdapter.notifyDataSetChanged() - } else { - if (dataBeans.size == 0) { - emptyView!!.showEmptyPage("没有任何消息") { - pageIndex = 1 - getNoticeListByPage() - } - } else { - emptyView!!.hide() - noticeListAdapter = NoticeListAdapter(this, dataBeans) - noticeRecyclerView.adapter = noticeListAdapter - noticeListAdapter.setOnItemClickListener(object : - NoticeListAdapter.OnItemClickListener { - override fun onItemClicked(position: Int) { - val rowsModel = dataBeans[position] - val allArgs = addAll( - rowsModel.noticeNo, - rowsModel.noticeTitle, - rowsModel.noticePublisher, - "", - "" - ) - Log.d( - "Casic", - "NoticeListActivity => onItemClicked: ${rowsModel.minioFileName.combineFilePath()}" - ) - navigatePageTo(allArgs) - } - }) - } - } - } - } - true - } - - //TODO 判断是否开启通知权限 - private fun hasNoticePermission(): Boolean { - - return false - } - - override fun initLayoutView(): Int = R.layout.activity_notice_list - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/PreviewDocumentActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/PreviewDocumentActivity.kt deleted file mode 100644 index e233ddc..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/PreviewDocumentActivity.kt +++ /dev/null @@ -1,24 +0,0 @@ -package com.casic.xz.meterage.view - -import com.casic.xz.meterage.R -import com.pengxh.kt.lite.base.KotlinBaseActivity - -class PreviewDocumentActivity : KotlinBaseActivity() { - override fun initData() { - - } - - override fun initEvent() { - - } - - override fun initLayoutView(): Int = R.layout.activity_preview_doc - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/PreviewPdfActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/PreviewPdfActivity.kt deleted file mode 100644 index 39f8ac2..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/PreviewPdfActivity.kt +++ /dev/null @@ -1,62 +0,0 @@ -package com.casic.xz.meterage.view - -import com.casic.xz.meterage.R -import com.casic.xz.meterage.extensions.combineFilePath -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.utils.LoadingDialogHub -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.callback.OnDownloadListener -import com.pengxh.kt.lite.extensions.createDownloadFileDir -import com.pengxh.kt.lite.extensions.downloadFile -import com.pengxh.kt.lite.utils.Constant -import kotlinx.android.synthetic.main.activity_preview_pdf.* -import kotlinx.android.synthetic.main.include_base_title.* -import java.io.File -import java.io.FileInputStream - - -class PreviewPdfActivity : KotlinBaseActivity() { - - override fun initData() { - val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! - titleView.text = minioFileName - - val url = minioFileName.combineFilePath() - url.downloadFile(createDownloadFileDir().toString(), - object : OnDownloadListener { - override fun onDownloadStart(totalBytes: Long) { - runOnUiThread { - LoadingDialogHub.show(this@PreviewPdfActivity, "附件加载中") - } - } - - override fun onProgressChanged(currentBytes: Long) { - - } - - override fun onDownloadEnd(file: File?) { - runOnUiThread { - LoadingDialogHub.dismiss() - } - val inputStream = FileInputStream(file) - pdfView.fromStream(inputStream).load() - } - }) - } - - override fun initEvent() { - leftBackView.setOnClickListener { finish() } - } - - override fun initLayoutView(): Int = R.layout.activity_preview_pdf - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/PreviewTextActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/PreviewTextActivity.kt deleted file mode 100644 index d634ca3..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/PreviewTextActivity.kt +++ /dev/null @@ -1,60 +0,0 @@ -package com.casic.xz.meterage.view - -import com.casic.xz.meterage.R -import com.casic.xz.meterage.extensions.combineFilePath -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.utils.LoadingDialogHub -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.callback.OnDownloadListener -import com.pengxh.kt.lite.extensions.createDownloadFileDir -import com.pengxh.kt.lite.extensions.downloadFile -import com.pengxh.kt.lite.extensions.read -import com.pengxh.kt.lite.utils.Constant -import kotlinx.android.synthetic.main.activity_preview_txt.* -import kotlinx.android.synthetic.main.include_base_title.* -import java.io.File - -class PreviewTextActivity : KotlinBaseActivity() { - - override fun initData() { - val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! - titleView.text = minioFileName - - val url = minioFileName.combineFilePath() - url.downloadFile(createDownloadFileDir().toString(), - object : OnDownloadListener { - override fun onDownloadStart(totalBytes: Long) { - runOnUiThread { - LoadingDialogHub.show(this@PreviewTextActivity, "附件加载中") - } - } - - override fun onProgressChanged(currentBytes: Long) { - - } - - override fun onDownloadEnd(file: File?) { - runOnUiThread { - LoadingDialogHub.dismiss() - textView.text = file?.read() - } - } - }) - } - - override fun initEvent() { - leftBackView.setOnClickListener { finish() } - } - - override fun initLayoutView(): Int = R.layout.activity_preview_txt - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentActivity.kt new file mode 100644 index 0000000..35ca098 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentActivity.kt @@ -0,0 +1,158 @@ +package com.casic.xz.meterage.view.home + +import android.os.Handler +import androidx.lifecycle.ViewModelProvider +import androidx.recyclerview.widget.DividerItemDecoration +import com.casic.xz.meterage.R +import com.casic.xz.meterage.adapter.EquipmentListAdapter +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.extensions.showEmptyPage +import com.casic.xz.meterage.model.EquipmentListModel +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.casic.xz.meterage.vm.EquipmentViewModel +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.extensions.navigatePageTo +import com.pengxh.kt.lite.extensions.show +import com.pengxh.kt.lite.utils.WeakReferenceHandler +import com.pengxh.kt.lite.vm.LoadState +import kotlinx.android.synthetic.main.activity_equipment.* +import kotlinx.android.synthetic.main.include_empty_view.* +import kotlinx.android.synthetic.main.include_search_title.* + +class EquipmentActivity : KotlinBaseActivity() { + + private lateinit var weakReferenceHandler: WeakReferenceHandler + private lateinit var equipmentViewModel: EquipmentViewModel + private lateinit var equipmentListAdapter: EquipmentListAdapter + private var dataBeans: MutableList = ArrayList() + private var pageIndex = 1 + private var isRefresh = false + private var isLoadMore = false + + override fun initData() { + weakReferenceHandler = WeakReferenceHandler(callback) + equipmentViewModel = ViewModelProvider(this)[EquipmentViewModel::class.java] + equipmentViewModel.equipmentResult.observe(this, { + if (it.code == 200) { + val dataRows = it.data?.rows!! + when { + isRefresh -> { + dataBeans.clear() + dataBeans = dataRows + equipmentLayout.finishRefresh() + isRefresh = false + } + isLoadMore -> { + if (dataRows.size == 0) { + "到底了,别拉了".show(this) + } + dataBeans.addAll(dataRows) + equipmentLayout.finishLoadMore() + isLoadMore = false + } + else -> { + dataBeans = dataRows + } + } + weakReferenceHandler.sendEmptyMessage(2023020801) + } + }) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + rightOperateView.setOnClickListener { + + } + + equipmentLayout.setOnRefreshListener { + isRefresh = true + //刷新之后页码重置 + pageIndex = 1 + getEquipmentListByPage() + } + + equipmentLayout.setOnLoadMoreListener { + isLoadMore = true + pageIndex++ + getEquipmentListByPage() + } + } + + override fun initLayoutView(): Int = R.layout.activity_equipment + + override fun observeRequestState() { + equipmentViewModel.loadState.observe(this, { + when (it) { + LoadState.Loading -> LoadingDialogHub.show(this, "数据加载中...") + else -> LoadingDialogHub.dismiss() + } + }) + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + titleView.text = "仪器设备" + } + + override fun onResume() { + super.onResume() + pageIndex = 1 + getEquipmentListByPage() + } + + private fun getEquipmentListByPage() { + equipmentViewModel.getEquipmentList( + "", + "", + "", + "", + "", + "1", + "", + "", + "", + "", + "", + "", + "", + "", + arrayOf(), + pageIndex + ) + } + + private val callback = Handler.Callback { + when (it.what) { + 2023020801 -> { + if (isRefresh || isLoadMore) { + equipmentListAdapter.notifyDataSetChanged() + } else { + if (dataBeans.size == 0) { + emptyView!!.showEmptyPage("无设备") { + pageIndex = 1 + getEquipmentListByPage() + } + } else { + emptyView!!.hide() + equipmentListAdapter = EquipmentListAdapter(this, dataBeans) + equipmentRecyclerView.addItemDecoration( + DividerItemDecoration(this, DividerItemDecoration.VERTICAL) + ) + equipmentRecyclerView.adapter = equipmentListAdapter + equipmentListAdapter.setOnItemClickListener(object : + EquipmentListAdapter.OnItemClickListener { + override fun onItemClicked(position: Int) { + val rowsModel = dataBeans[position] + navigatePageTo(rowsModel.id) + } + }) + } + } + } + } + true + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentDetailActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentDetailActivity.kt new file mode 100644 index 0000000..7dee13c --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentDetailActivity.kt @@ -0,0 +1,53 @@ +package com.casic.xz.meterage.view.home + +import androidx.fragment.app.Fragment +import com.casic.xz.meterage.R +import com.casic.xz.meterage.adapter.SubViewPagerAdapter +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.fragment.equipment.* +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.utils.Constant +import kotlinx.android.synthetic.main.activity_equipment.rootView +import kotlinx.android.synthetic.main.activity_equipment_detail.* +import kotlinx.android.synthetic.main.include_base_title.* + +class EquipmentDetailActivity : KotlinBaseActivity() { + + private var fragmentPages: ArrayList = ArrayList() + + override fun initData() { + val equipmentId = intent.getStringExtra(Constant.INTENT_PARAM)!! + + fragmentPages.add(BasicInformationFragment(equipmentId)) + fragmentPages.add(InspectionRecordFragment()) + fragmentPages.add(ChangeRecordFragment()) + fragmentPages.add(UsageRecordFragment()) + fragmentPages.add(CertificateFragment()) + + val equipmentPageTitles = arrayOf("基础信息", "周检记录", "状态变更记录", "使用记录", "检定证书") + + equipmentViewPager.adapter = SubViewPagerAdapter( + supportFragmentManager, fragmentPages, equipmentPageTitles + ) + equipmentViewPager.offscreenPageLimit = fragmentPages.size + //绑定 + topTabLayout.setupWithViewPager(equipmentViewPager) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + } + + override fun initLayoutView(): Int = R.layout.activity_equipment_detail + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + titleView.text = "仪器设备" + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeDetailActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeDetailActivity.kt new file mode 100644 index 0000000..6fe0022 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeDetailActivity.kt @@ -0,0 +1,105 @@ +package com.casic.xz.meterage.view.notice + +import android.annotation.SuppressLint +import android.graphics.Paint +import androidx.lifecycle.ViewModelProvider +import com.casic.xz.meterage.R +import com.casic.xz.meterage.extensions.combineImagePath +import com.casic.xz.meterage.extensions.formatTextFromHtml +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.view.BigImageActivity +import com.casic.xz.meterage.vm.NoticeViewModel +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.extensions.convertColor +import com.pengxh.kt.lite.extensions.navigatePageTo +import com.pengxh.kt.lite.extensions.obtainScreenWidth +import com.pengxh.kt.lite.extensions.show +import com.pengxh.kt.lite.utils.Constant +import kotlinx.android.synthetic.main.activity_notice_detail.* +import kotlinx.android.synthetic.main.include_base_title.* +import java.util.* + +@SuppressLint("SetTextI18n") +class NoticeDetailActivity : KotlinBaseActivity() { + + private lateinit var noticeViewModel: NoticeViewModel + + override fun initData() { + leftBackView.setOnClickListener { finish() } + titleView.text = "通知公告" + + val args = intent.getStringArrayListExtra(Constant.INTENT_PARAM)!! + + noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] + noticeViewModel.getNoticeList(args[0], args[1], args[2], "", "", 1) + noticeViewModel.noticeResult.observe(this, { + if (it.code == 200) { + val dataRow = it.data?.rows!![0] + + noticeDateView.text = dataRow.noticeTime + noticePublisherView.text = "发布人 ${dataRow.noticePublisher}" + noticeCompanyView.text = "发布单位 ${dataRow.noticeCompany}" + + noticeNoView.text = dataRow.noticeNo + noticeTitleView.text = dataRow.noticeTitle + noticeSketchView.text = dataRow.noticeSketch + + dataRow.noticeContent.formatTextFromHtml( + this, noticeContentView, obtainScreenWidth() + ) + + if (dataRow.minioFileName.isNullOrBlank()) { + minioFileView.text = "暂无附件" + } else { + val minioFileName = dataRow.minioFileName + + minioFileView.text = minioFileName + val textPaint = minioFileView.paint + textPaint.flags = Paint.UNDERLINE_TEXT_FLAG + textPaint.isAntiAlias = true + minioFileView.setTextColor(R.color.themeColor.convertColor(this)) + + minioFileView.setOnClickListener { + //查看附件 + if (minioFileName.endsWith("pdf")) { + navigatePageTo(minioFileName) + } else if ( + minioFileName.endsWith("doc") || + minioFileName.endsWith("docx") + ) { + navigatePageTo(minioFileName) + } else if (minioFileName.endsWith("txt")) { + navigatePageTo(minioFileName) + } else if ( + minioFileName.endsWith("png") || + minioFileName.endsWith("jpeg") || + minioFileName.endsWith("jpg") + ) { + val urls = ArrayList() + urls.add(minioFileName.combineImagePath()) + navigatePageTo(0, urls) + } else { + "文件类型未知,无法打开附件".show(this) + } + } + } + } + }) + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.activity_notice_detail + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeListActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeListActivity.kt new file mode 100644 index 0000000..31c0490 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeListActivity.kt @@ -0,0 +1,180 @@ +package com.casic.xz.meterage.view.notice + +import android.os.Handler +import android.util.Log +import android.view.View +import androidx.lifecycle.ViewModelProvider +import com.casic.xz.meterage.R +import com.casic.xz.meterage.adapter.NoticeListAdapter +import com.casic.xz.meterage.extensions.addAll +import com.casic.xz.meterage.extensions.combineFilePath +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.extensions.showEmptyPage +import com.casic.xz.meterage.model.NoticeListModel +import com.casic.xz.meterage.vm.NoticeViewModel +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.extensions.navigatePageTo +import com.pengxh.kt.lite.extensions.show +import com.pengxh.kt.lite.utils.WeakReferenceHandler +import com.pengxh.kt.lite.widget.dialog.AlertControlDialog +import kotlinx.android.synthetic.main.activity_notice_list.* +import kotlinx.android.synthetic.main.include_empty_view.* + +class NoticeListActivity : KotlinBaseActivity() { + + private lateinit var weakReferenceHandler: WeakReferenceHandler + private lateinit var noticeViewModel: NoticeViewModel + private lateinit var noticeListAdapter: NoticeListAdapter + private var dataBeans: MutableList = ArrayList() + private var pageIndex = 1 + private var isRefresh = false + private var isLoadMore = false + + override fun initData() { + weakReferenceHandler = WeakReferenceHandler(callback) + noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] + noticeViewModel.noticeResult.observe(this, { + if (it.code == 200) { + val dataRows = it.data?.rows!! +// countBadeNumber(dataRows) + when { + isRefresh -> { + dataBeans.clear() + dataBeans = dataRows + noticeLayout.finishRefresh() + isRefresh = false + } + isLoadMore -> { + if (dataRows.size == 0) { + "到底了,别拉了".show(this) + } + dataBeans.addAll(dataRows) + noticeLayout.finishLoadMore() + isLoadMore = false + } + else -> { + dataBeans = dataRows + } + } + weakReferenceHandler.sendEmptyMessage(2023013101) + } + }) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + rightOperateView.setOnClickListener { + AlertControlDialog.Builder() + .setContext(this) + .setTitle("提示") + .setMessage("确定将所有未读消息标为已读?") + .setNegativeButton("取消") + .setPositiveButton("确定") + .setOnDialogButtonClickListener(object : + AlertControlDialog.OnDialogButtonClickListener { + override fun onCancelClick() { + + } + + override fun onConfirmClick() { + //TODO 设置为已读 + } + }).build().show() + } + + if (hasNoticePermission()) { + openSystemNoticeLayout.visibility = View.GONE + openSystemNoticeLayout.visibility = View.GONE + } else { + openSystemNoticeLayout.setOnClickListener { + + } + + + closeLayoutView.setOnClickListener { + openSystemNoticeLayout.visibility = View.GONE + } + } + + noticeLayout.setOnRefreshListener { + isRefresh = true + //刷新之后页码重置 + pageIndex = 1 + getNoticeListByPage() + } + + noticeLayout.setOnLoadMoreListener { + isLoadMore = true + pageIndex++ + getNoticeListByPage() + } + } + + override fun onResume() { + super.onResume() + pageIndex = 1 + getNoticeListByPage() + } + + private fun getNoticeListByPage() { + noticeViewModel.getNoticeList("", "", "", "", "", pageIndex) + } + + private val callback = Handler.Callback { + when (it.what) { + 2023013101 -> { + if (isRefresh || isLoadMore) { + noticeListAdapter.notifyDataSetChanged() + } else { + if (dataBeans.size == 0) { + emptyView!!.showEmptyPage("没有任何消息") { + pageIndex = 1 + getNoticeListByPage() + } + } else { + emptyView!!.hide() + noticeListAdapter = NoticeListAdapter(this, dataBeans) + noticeRecyclerView.adapter = noticeListAdapter + noticeListAdapter.setOnItemClickListener(object : + NoticeListAdapter.OnItemClickListener { + override fun onItemClicked(position: Int) { + val rowsModel = dataBeans[position] + val allArgs = addAll( + rowsModel.noticeNo, + rowsModel.noticeTitle, + rowsModel.noticePublisher, + "", + "" + ) + Log.d( + "Casic", + "NoticeListActivity => onItemClicked: ${rowsModel.minioFileName.combineFilePath()}" + ) + navigatePageTo(allArgs) + } + }) + } + } + } + } + true + } + + //TODO 判断是否开启通知权限 + private fun hasNoticePermission(): Boolean { + + return false + } + + override fun initLayoutView(): Int = R.layout.activity_notice_list + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewDocumentActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewDocumentActivity.kt new file mode 100644 index 0000000..4b16ae8 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewDocumentActivity.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.view.notice + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseActivity + +class PreviewDocumentActivity : KotlinBaseActivity() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.activity_preview_doc + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewPdfActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewPdfActivity.kt new file mode 100644 index 0000000..fad73b6 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewPdfActivity.kt @@ -0,0 +1,62 @@ +package com.casic.xz.meterage.view.notice + +import com.casic.xz.meterage.R +import com.casic.xz.meterage.extensions.combineFilePath +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.callback.OnDownloadListener +import com.pengxh.kt.lite.extensions.createDownloadFileDir +import com.pengxh.kt.lite.extensions.downloadFile +import com.pengxh.kt.lite.utils.Constant +import kotlinx.android.synthetic.main.activity_preview_pdf.* +import kotlinx.android.synthetic.main.include_base_title.* +import java.io.File +import java.io.FileInputStream + + +class PreviewPdfActivity : KotlinBaseActivity() { + + override fun initData() { + val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! + titleView.text = minioFileName + + val url = minioFileName.combineFilePath() + url.downloadFile(createDownloadFileDir().toString(), + object : OnDownloadListener { + override fun onDownloadStart(totalBytes: Long) { + runOnUiThread { + LoadingDialogHub.show(this@PreviewPdfActivity, "附件加载中") + } + } + + override fun onProgressChanged(currentBytes: Long) { + + } + + override fun onDownloadEnd(file: File?) { + runOnUiThread { + LoadingDialogHub.dismiss() + } + val inputStream = FileInputStream(file) + pdfView.fromStream(inputStream).load() + } + }) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + } + + override fun initLayoutView(): Int = R.layout.activity_preview_pdf + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewTextActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewTextActivity.kt new file mode 100644 index 0000000..d7850fb --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewTextActivity.kt @@ -0,0 +1,60 @@ +package com.casic.xz.meterage.view.notice + +import com.casic.xz.meterage.R +import com.casic.xz.meterage.extensions.combineFilePath +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.callback.OnDownloadListener +import com.pengxh.kt.lite.extensions.createDownloadFileDir +import com.pengxh.kt.lite.extensions.downloadFile +import com.pengxh.kt.lite.extensions.read +import com.pengxh.kt.lite.utils.Constant +import kotlinx.android.synthetic.main.activity_preview_txt.* +import kotlinx.android.synthetic.main.include_base_title.* +import java.io.File + +class PreviewTextActivity : KotlinBaseActivity() { + + override fun initData() { + val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! + titleView.text = minioFileName + + val url = minioFileName.combineFilePath() + url.downloadFile(createDownloadFileDir().toString(), + object : OnDownloadListener { + override fun onDownloadStart(totalBytes: Long) { + runOnUiThread { + LoadingDialogHub.show(this@PreviewTextActivity, "附件加载中") + } + } + + override fun onProgressChanged(currentBytes: Long) { + + } + + override fun onDownloadEnd(file: File?) { + runOnUiThread { + LoadingDialogHub.dismiss() + textView.text = file?.read() + } + } + }) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + } + + override fun initLayoutView(): Int = R.layout.activity_preview_txt + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + } +} \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 3892b5a..02160cd 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -34,16 +34,18 @@ - - - - - - - + + + + + + + + + +) : RecyclerView.Adapter() { + + private var layoutInflater: LayoutInflater = LayoutInflater.from(context) + + override fun getItemCount(): Int = dataRows.size + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = ItemViewHolder( + layoutInflater.inflate(R.layout.item_equipment_rv_l, parent, false) + ) + + override fun onBindViewHolder(holder: ItemViewHolder, position: Int) { + //绑定数据 + val rowsBean = dataRows[position] + holder.equipmentNameView.text = rowsBean.equipmentName + holder.equipmentCodeView.text = rowsBean.equipmentNo + holder.equipmentDateView.text = rowsBean.enableDate + holder.equipmentLibView.text = rowsBean.useDeptName + + //绑定事件 + holder.itemView.setOnClickListener { + listener?.onItemClicked(position) + } + } + + inner class ItemViewHolder(view: View) : RecyclerView.ViewHolder(view) { + var equipmentNameView: TextView = view.findViewById(R.id.equipmentNameView) + var equipmentCodeView: TextView = view.findViewById(R.id.equipmentCodeView) + var equipmentDateView: TextView = view.findViewById(R.id.equipmentDateView) + var equipmentLibView: TextView = view.findViewById(R.id.equipmentLibView) + } + + private var listener: OnItemClickListener? = null + + interface OnItemClickListener { + fun onItemClicked(position: Int) + } + + fun setOnItemClickListener(onClickListener: OnItemClickListener?) { + this.listener = onClickListener + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt index b4628f3..d970b55 100644 --- a/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt +++ b/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt @@ -5,7 +5,8 @@ import com.casic.xz.meterage.R import com.casic.xz.meterage.adapter.HomeGridAdapter import com.casic.xz.meterage.utils.LocaleConstant -import com.casic.xz.meterage.view.NoticeListActivity +import com.casic.xz.meterage.view.home.EquipmentActivity +import com.casic.xz.meterage.view.notice.NoticeListActivity import com.casic.xz.meterage.vm.NoticeViewModel import com.pengxh.kt.lite.base.KotlinBaseFragment import com.pengxh.kt.lite.extensions.navigatePageTo @@ -36,8 +37,19 @@ homeFuncRecyclerView.adapter = homeAdapter homeAdapter.setOnGridItemClickListener(object : HomeGridAdapter.OnGridItemClickListener { override fun onItemClick(position: Int) { - when (position) { - + when (LocaleConstant.HOME_FUNC_OPERATE[position]) { + "仪器设备" -> requireContext().navigatePageTo() +// "标准装置" -> requireContext().navigatePageTo() +// "证书报告" -> requireContext().navigatePageTo() +// "委托需求" -> requireContext().navigatePageTo() +// "访客" -> requireContext().navigatePageTo() +// "标准规范" -> requireContext().navigatePageTo() +// "能力列表" -> requireContext().navigatePageTo() +// "计量培训" -> requireContext().navigatePageTo() +// "合同发票" -> requireContext().navigatePageTo() +// "业务统计" -> requireContext().navigatePageTo() +// "客户列表" -> requireContext().navigatePageTo() +// "外场检测" -> requireContext().navigatePageTo() } } }) diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt index 7e75abe..56dc5ec 100644 --- a/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt +++ b/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt @@ -2,9 +2,11 @@ import android.view.View import androidx.lifecycle.ViewModelProvider +import com.bumptech.glide.Glide +import com.bumptech.glide.request.RequestOptions import com.casic.xz.meterage.R import com.casic.xz.meterage.utils.LocaleConstant -import com.casic.xz.meterage.view.NoticeListActivity +import com.casic.xz.meterage.view.notice.NoticeListActivity import com.casic.xz.meterage.vm.NoticeViewModel import com.casic.xz.meterage.vm.UserViewModel import com.pengxh.kt.lite.base.KotlinBaseFragment @@ -23,6 +25,12 @@ val data = it.data userNameView.text = data.name userUnitView.text = data.deptName + +// Glide.with(requireContext()) +// .load(R.mipmap.default_avatar) +// .apply(RequestOptions.circleCropTransform()) +// .placeholder(R.mipmap.load_image_error) +// .into(userAvatarView) } }) diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt new file mode 100644 index 0000000..cf22646 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt @@ -0,0 +1,103 @@ +package com.casic.xz.meterage.fragment.equipment + +import android.graphics.Paint +import androidx.lifecycle.ViewModelProvider +import com.casic.xz.meterage.R +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.casic.xz.meterage.vm.EquipmentViewModel +import com.pengxh.kt.lite.base.KotlinBaseFragment +import com.pengxh.kt.lite.extensions.convertColor +import com.pengxh.kt.lite.vm.LoadState +import kotlinx.android.synthetic.main.fragment_basic_information.* + +class BasicInformationFragment(private val id: String) : KotlinBaseFragment() { + + private lateinit var equipmentViewModel: EquipmentViewModel + + override fun initData() { + equipmentViewModel = ViewModelProvider(this)[EquipmentViewModel::class.java] + equipmentViewModel.getEquipmentDetail(id) + equipmentViewModel.equipmentDetailResult.observe(this, { + if (it.code == 200) { + val data = it.data!! + + equipmentCodeView.text = data.equipmentNo + equipmentNameView.text = data.equipmentName + manufacturerView.text = data.manufacturer + factoryNumberView.text = data.manufacturingNo + modelView.text = data.modelNo + verificationMethodView.text = data.mesureTypeName + measuringRangeView.text = data.mesureRange + uncertaintyView.text = data.uncertainty + firstUseView.text = data.createTime + originalValueView.text = data.originValue + usageDeptView.text = data.useDeptName + userView.text = data.usePersonName + managementStatusView.text = data.managerStateName + verificationDeptView.text = data.useDeptName +// nextVerificationDeptView.text = data. + verificationPeriodView.text = data.mesureCycle + verificationDateView.text = data.mesureDate + effectiveDateView.text = data.validDate + verificationResultsView.text = data.mesureResultName + abcView.text = data.abcName + isNeedTechnicalView.text = if ( + data.isCalibrationTestEquipment.isNullOrBlank() || data.isCalibrationTestEquipment == "0" + ) { + "否" + } else { + "是" + } + + isStandingBook.text = if ( + data.isMeasureAccount.isNullOrBlank() || data.isMeasureAccount == "0" + ) { + "否" + } else { + "是" + } + + isStandardView.text = if ( + data.isStandardSupportEquipment.isNullOrBlank() || data.isStandardSupportEquipment == "0" + ) { + "否" + } else { + "是" + } + remarkView.text = data.remark + if (data.fileList.size == 0) { + instructionsView.text = "暂无" + } else { + instructionsView.text = "查看附件列表" + val textPaint = instructionsView.paint + textPaint.flags = Paint.UNDERLINE_TEXT_FLAG + textPaint.isAntiAlias = true + instructionsView.setTextColor(R.color.themeColor.convertColor(requireContext())) + + instructionsView.setOnClickListener { + + } + } + } + }) + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_basic_information + + override fun observeRequestState() { + equipmentViewModel.loadState.observe(this, { + when (it) { + LoadState.Loading -> LoadingDialogHub.show(requireActivity(), "数据加载中...") + else -> LoadingDialogHub.dismiss() + } + }) + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt new file mode 100644 index 0000000..0b4a747 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class CertificateFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_certificate + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt new file mode 100644 index 0000000..f05c491 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class ChangeRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_change_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt new file mode 100644 index 0000000..849ffa5 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class InspectionRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_inspection_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt new file mode 100644 index 0000000..aa4edd9 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class UsageRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_usage_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java b/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java new file mode 100644 index 0000000..0b9124e --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java @@ -0,0 +1,760 @@ +package com.casic.xz.meterage.model; + +import java.util.List; + +public class EquipmentDetailModel { + + private int code; + private DataModel data; + private String message; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataModel getData() { + return data; + } + + public void setData(DataModel data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public static class DataModel { + private String abc; + private String abcName; + private String assetNo; + private String assetSource; + private String assetType; + private String assetTypeName; + private String attribute; + private String capitalSource; + private String capitalSourceName; + private String cardEstablishmentDate; + private String createTime; + private String createUser; + private String depreciationMethod; + private String depreciationMethodName; + private String depreciationPeriod; + private String enableDate; + private String equipmentCategory; + private String equipmentCategoryName; + private String equipmentName; + private String equipmentNo; + private String equipmentSpecifications; + private String equipmentType; + private String equipmentTypeName; + private List fileList; + private String id; + private String installIncidentalExpenses; + private String installPlace; + private String intactState; + private String isCalibrationTestEquipment; + private int isDel; + private String isFixedAssets; + private String isMeasureAccount; + private String isStandardSupportEquipment; + private String labelBind; + private String majorCategory; + private String majorCategoryName; + private String managerLevel; + private String managerLevelName; + private String managerState; + private String managerStateName; + private String manufacturer; + private String manufacturerCountry; + private String manufacturingDate; + private String manufacturingNo; + private String mesureCycle; + private String mesureDate; + private String mesureDept; + private String mesureRange; + private String mesureResult; + private String mesureResultName; + private String mesureType; + private String mesureTypeName; + private String modelNo; + private String originValue; + private String overallDimension; + private String presentOriginValue; + private String purpose; + private String remark; + private String singlePrice; + private String supportStandardEquipmentName; + private String supportStandardEquipmentNo; + private String technicalLevel; + private String uncertainty; + private String updateTime; + private String useDept; + private String useDeptName; + private String usePerson; + private String usePersonName; + private String validDate; + private int version; + private String weight; + + public String getAbc() { + return abc; + } + + public void setAbc(String abc) { + this.abc = abc; + } + + public String getAbcName() { + return abcName; + } + + public void setAbcName(String abcName) { + this.abcName = abcName; + } + + public String getAssetNo() { + return assetNo; + } + + public void setAssetNo(String assetNo) { + this.assetNo = assetNo; + } + + public String getAssetSource() { + return assetSource; + } + + public void setAssetSource(String assetSource) { + this.assetSource = assetSource; + } + + public String getAssetType() { + return assetType; + } + + public void setAssetType(String assetType) { + this.assetType = assetType; + } + + public String getAssetTypeName() { + return assetTypeName; + } + + public void setAssetTypeName(String assetTypeName) { + this.assetTypeName = assetTypeName; + } + + public String getAttribute() { + return attribute; + } + + public void setAttribute(String attribute) { + this.attribute = attribute; + } + + public String getCapitalSource() { + return capitalSource; + } + + public void setCapitalSource(String capitalSource) { + this.capitalSource = capitalSource; + } + + public String getCapitalSourceName() { + return capitalSourceName; + } + + public void setCapitalSourceName(String capitalSourceName) { + this.capitalSourceName = capitalSourceName; + } + + public String getCardEstablishmentDate() { + return cardEstablishmentDate; + } + + public void setCardEstablishmentDate(String cardEstablishmentDate) { + this.cardEstablishmentDate = cardEstablishmentDate; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getDepreciationMethod() { + return depreciationMethod; + } + + public void setDepreciationMethod(String depreciationMethod) { + this.depreciationMethod = depreciationMethod; + } + + public String getDepreciationMethodName() { + return depreciationMethodName; + } + + public void setDepreciationMethodName(String depreciationMethodName) { + this.depreciationMethodName = depreciationMethodName; + } + + public String getDepreciationPeriod() { + return depreciationPeriod; + } + + public void setDepreciationPeriod(String depreciationPeriod) { + this.depreciationPeriod = depreciationPeriod; + } + + public String getEnableDate() { + return enableDate; + } + + public void setEnableDate(String enableDate) { + this.enableDate = enableDate; + } + + public String getEquipmentCategory() { + return equipmentCategory; + } + + public void setEquipmentCategory(String equipmentCategory) { + this.equipmentCategory = equipmentCategory; + } + + public String getEquipmentCategoryName() { + return equipmentCategoryName; + } + + public void setEquipmentCategoryName(String equipmentCategoryName) { + this.equipmentCategoryName = equipmentCategoryName; + } + + public String getEquipmentName() { + return equipmentName; + } + + public void setEquipmentName(String equipmentName) { + this.equipmentName = equipmentName; + } + + public String getEquipmentNo() { + return equipmentNo; + } + + public void setEquipmentNo(String equipmentNo) { + this.equipmentNo = equipmentNo; + } + + public String getEquipmentSpecifications() { + return equipmentSpecifications; + } + + public void setEquipmentSpecifications(String equipmentSpecifications) { + this.equipmentSpecifications = equipmentSpecifications; + } + + public String getEquipmentType() { + return equipmentType; + } + + public void setEquipmentType(String equipmentType) { + this.equipmentType = equipmentType; + } + + public String getEquipmentTypeName() { + return equipmentTypeName; + } + + public void setEquipmentTypeName(String equipmentTypeName) { + this.equipmentTypeName = equipmentTypeName; + } + + public List getFileList() { + return fileList; + } + + public void setFileList(List fileList) { + this.fileList = fileList; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getInstallIncidentalExpenses() { + return installIncidentalExpenses; + } + + public void setInstallIncidentalExpenses(String installIncidentalExpenses) { + this.installIncidentalExpenses = installIncidentalExpenses; + } + + public String getInstallPlace() { + return installPlace; + } + + public void setInstallPlace(String installPlace) { + this.installPlace = installPlace; + } + + public String getIntactState() { + return intactState; + } + + public void setIntactState(String intactState) { + this.intactState = intactState; + } + + public String getIsCalibrationTestEquipment() { + return isCalibrationTestEquipment; + } + + public void setIsCalibrationTestEquipment(String isCalibrationTestEquipment) { + this.isCalibrationTestEquipment = isCalibrationTestEquipment; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getIsFixedAssets() { + return isFixedAssets; + } + + public void setIsFixedAssets(String isFixedAssets) { + this.isFixedAssets = isFixedAssets; + } + + public String getIsMeasureAccount() { + return isMeasureAccount; + } + + public void setIsMeasureAccount(String isMeasureAccount) { + this.isMeasureAccount = isMeasureAccount; + } + + public String getIsStandardSupportEquipment() { + return isStandardSupportEquipment; + } + + public void setIsStandardSupportEquipment(String isStandardSupportEquipment) { + this.isStandardSupportEquipment = isStandardSupportEquipment; + } + + public String getLabelBind() { + return labelBind; + } + + public void setLabelBind(String labelBind) { + this.labelBind = labelBind; + } + + public String getMajorCategory() { + return majorCategory; + } + + public void setMajorCategory(String majorCategory) { + this.majorCategory = majorCategory; + } + + public String getMajorCategoryName() { + return majorCategoryName; + } + + public void setMajorCategoryName(String majorCategoryName) { + this.majorCategoryName = majorCategoryName; + } + + public String getManagerLevel() { + return managerLevel; + } + + public void setManagerLevel(String managerLevel) { + this.managerLevel = managerLevel; + } + + public String getManagerLevelName() { + return managerLevelName; + } + + public void setManagerLevelName(String managerLevelName) { + this.managerLevelName = managerLevelName; + } + + public String getManagerState() { + return managerState; + } + + public void setManagerState(String managerState) { + this.managerState = managerState; + } + + public String getManagerStateName() { + return managerStateName; + } + + public void setManagerStateName(String managerStateName) { + this.managerStateName = managerStateName; + } + + public String getManufacturer() { + return manufacturer; + } + + public void setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + } + + public String getManufacturerCountry() { + return manufacturerCountry; + } + + public void setManufacturerCountry(String manufacturerCountry) { + this.manufacturerCountry = manufacturerCountry; + } + + public String getManufacturingDate() { + return manufacturingDate; + } + + public void setManufacturingDate(String manufacturingDate) { + this.manufacturingDate = manufacturingDate; + } + + public String getManufacturingNo() { + return manufacturingNo; + } + + public void setManufacturingNo(String manufacturingNo) { + this.manufacturingNo = manufacturingNo; + } + + public String getMesureCycle() { + return mesureCycle; + } + + public void setMesureCycle(String mesureCycle) { + this.mesureCycle = mesureCycle; + } + + public String getMesureDate() { + return mesureDate; + } + + public void setMesureDate(String mesureDate) { + this.mesureDate = mesureDate; + } + + public String getMesureDept() { + return mesureDept; + } + + public void setMesureDept(String mesureDept) { + this.mesureDept = mesureDept; + } + + public String getMesureRange() { + return mesureRange; + } + + public void setMesureRange(String mesureRange) { + this.mesureRange = mesureRange; + } + + public String getMesureResult() { + return mesureResult; + } + + public void setMesureResult(String mesureResult) { + this.mesureResult = mesureResult; + } + + public String getMesureResultName() { + return mesureResultName; + } + + public void setMesureResultName(String mesureResultName) { + this.mesureResultName = mesureResultName; + } + + public String getMesureType() { + return mesureType; + } + + public void setMesureType(String mesureType) { + this.mesureType = mesureType; + } + + public String getMesureTypeName() { + return mesureTypeName; + } + + public void setMesureTypeName(String mesureTypeName) { + this.mesureTypeName = mesureTypeName; + } + + public String getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getOriginValue() { + return originValue; + } + + public void setOriginValue(String originValue) { + this.originValue = originValue; + } + + public String getOverallDimension() { + return overallDimension; + } + + public void setOverallDimension(String overallDimension) { + this.overallDimension = overallDimension; + } + + public String getPresentOriginValue() { + return presentOriginValue; + } + + public void setPresentOriginValue(String presentOriginValue) { + this.presentOriginValue = presentOriginValue; + } + + public String getPurpose() { + return purpose; + } + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getSinglePrice() { + return singlePrice; + } + + public void setSinglePrice(String singlePrice) { + this.singlePrice = singlePrice; + } + + public String getSupportStandardEquipmentName() { + return supportStandardEquipmentName; + } + + public void setSupportStandardEquipmentName(String supportStandardEquipmentName) { + this.supportStandardEquipmentName = supportStandardEquipmentName; + } + + public String getSupportStandardEquipmentNo() { + return supportStandardEquipmentNo; + } + + public void setSupportStandardEquipmentNo(String supportStandardEquipmentNo) { + this.supportStandardEquipmentNo = supportStandardEquipmentNo; + } + + public String getTechnicalLevel() { + return technicalLevel; + } + + public void setTechnicalLevel(String technicalLevel) { + this.technicalLevel = technicalLevel; + } + + public String getUncertainty() { + return uncertainty; + } + + public void setUncertainty(String uncertainty) { + this.uncertainty = uncertainty; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getUseDept() { + return useDept; + } + + public void setUseDept(String useDept) { + this.useDept = useDept; + } + + public String getUseDeptName() { + return useDeptName; + } + + public void setUseDeptName(String useDeptName) { + this.useDeptName = useDeptName; + } + + public String getUsePerson() { + return usePerson; + } + + public void setUsePerson(String usePerson) { + this.usePerson = usePerson; + } + + public String getUsePersonName() { + return usePersonName; + } + + public void setUsePersonName(String usePersonName) { + this.usePersonName = usePersonName; + } + + public String getValidDate() { + return validDate; + } + + public void setValidDate(String validDate) { + this.validDate = validDate; + } + + public int getVersion() { + return version; + } + + public void setVersion(int version) { + this.version = version; + } + + public String getWeight() { + return weight; + } + + public void setWeight(String weight) { + this.weight = weight; + } + + public static class FileListModel { + private String assetId; + private String createTime; + private String createUser; + private String fileName; + private String id; + private int isDel; + private String minioFileName; + private String remark; + private String updateTime; + + public String getAssetId() { + return assetId; + } + + public void setAssetId(String assetId) { + this.assetId = assetId; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getFileName() { + return fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getMinioFileName() { + return minioFileName; + } + + public void setMinioFileName(String minioFileName) { + this.minioFileName = minioFileName; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + } + } +} diff --git a/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java b/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java new file mode 100644 index 0000000..15fc128 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java @@ -0,0 +1,697 @@ +package com.casic.xz.meterage.model; + +import java.util.List; + +public class EquipmentListModel { + + private int code; + private DataModel data; + private String message; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataModel getData() { + return data; + } + + public void setData(DataModel data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public static class DataModel { + private List rows; + private int total; + + public List getRows() { + return rows; + } + + public void setRows(List rows) { + this.rows = rows; + } + + public int getTotal() { + return total; + } + + public void setTotal(int total) { + this.total = total; + } + + public static class RowsModel { + private String abc; + private String abcName; + private String assetNo; + private String assetSource; + private String assetType; + private String assetTypeName; + private String attribute; + private String capitalSource; + private String capitalSourceName; + private String cardEstablishmentDate; + private String createTime; + private String createUser; + private String depreciationMethod; + private String depreciationMethodName; + private String depreciationPeriod; + private String enableDate; + private String equipmentCategory; + private String equipmentCategoryName; + private String equipmentName; + private String equipmentNo; + private String equipmentSpecifications; + private String equipmentType; + private String equipmentTypeName; + private String fileList; + private String id; + private String installIncidentalExpenses; + private String installPlace; + private String intactState; + private String isCalibrationTestEquipment; + private int isDel; + private String isFixedAssets; + private String isMeasureAccount; + private String isStandardSupportEquipment; + private String labelBind; + private String majorCategory; + private String majorCategoryName; + private String managerLevel; + private String managerLevelName; + private String managerState; + private String managerStateName; + private String manufacturer; + private String manufacturerCountry; + private String manufacturingDate; + private String manufacturingNo; + private String mesureCycle; + private String mesureDate; + private String mesureDept; + private String mesureRange; + private String mesureResult; + private String mesureResultName; + private String mesureType; + private String mesureTypeName; + private String modelNo; + private String originValue; + private String overallDimension; + private String presentOriginValue; + private String purpose; + private String remark; + private String singlePrice; + private String supportStandardEquipmentName; + private String supportStandardEquipmentNo; + private String technicalLevel; + private String uncertainty; + private String updateTime; + private String useDept; + private String useDeptName; + private String usePerson; + private String usePersonName; + private String validDate; + private int version; + private String weight; + + public String getAbc() { + return abc; + } + + public void setAbc(String abc) { + this.abc = abc; + } + + public String getAbcName() { + return abcName; + } + + public void setAbcName(String abcName) { + this.abcName = abcName; + } + + public String getAssetNo() { + return assetNo; + } + + public void setAssetNo(String assetNo) { + this.assetNo = assetNo; + } + + public String getAssetSource() { + return assetSource; + } + + public void setAssetSource(String assetSource) { + this.assetSource = assetSource; + } + + public String getAssetType() { + return assetType; + } + + public void setAssetType(String assetType) { + this.assetType = assetType; + } + + public String getAssetTypeName() { + return assetTypeName; + } + + public void setAssetTypeName(String assetTypeName) { + this.assetTypeName = assetTypeName; + } + + public String getAttribute() { + return attribute; + } + + public void setAttribute(String attribute) { + this.attribute = attribute; + } + + public String getCapitalSource() { + return capitalSource; + } + + public void setCapitalSource(String capitalSource) { + this.capitalSource = capitalSource; + } + + public String getCapitalSourceName() { + return capitalSourceName; + } + + public void setCapitalSourceName(String capitalSourceName) { + this.capitalSourceName = capitalSourceName; + } + + public String getCardEstablishmentDate() { + return cardEstablishmentDate; + } + + public void setCardEstablishmentDate(String cardEstablishmentDate) { + this.cardEstablishmentDate = cardEstablishmentDate; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getDepreciationMethod() { + return depreciationMethod; + } + + public void setDepreciationMethod(String depreciationMethod) { + this.depreciationMethod = depreciationMethod; + } + + public String getDepreciationMethodName() { + return depreciationMethodName; + } + + public void setDepreciationMethodName(String depreciationMethodName) { + this.depreciationMethodName = depreciationMethodName; + } + + public String getDepreciationPeriod() { + return depreciationPeriod; + } + + public void setDepreciationPeriod(String depreciationPeriod) { + this.depreciationPeriod = depreciationPeriod; + } + + public String getEnableDate() { + return enableDate; + } + + public void setEnableDate(String enableDate) { + this.enableDate = enableDate; + } + + public String getEquipmentCategory() { + return equipmentCategory; + } + + public void setEquipmentCategory(String equipmentCategory) { + this.equipmentCategory = equipmentCategory; + } + + public String getEquipmentCategoryName() { + return equipmentCategoryName; + } + + public void setEquipmentCategoryName(String equipmentCategoryName) { + this.equipmentCategoryName = equipmentCategoryName; + } + + public String getEquipmentName() { + return equipmentName; + } + + public void setEquipmentName(String equipmentName) { + this.equipmentName = equipmentName; + } + + public String getEquipmentNo() { + return equipmentNo; + } + + public void setEquipmentNo(String equipmentNo) { + this.equipmentNo = equipmentNo; + } + + public String getEquipmentSpecifications() { + return equipmentSpecifications; + } + + public void setEquipmentSpecifications(String equipmentSpecifications) { + this.equipmentSpecifications = equipmentSpecifications; + } + + public String getEquipmentType() { + return equipmentType; + } + + public void setEquipmentType(String equipmentType) { + this.equipmentType = equipmentType; + } + + public String getEquipmentTypeName() { + return equipmentTypeName; + } + + public void setEquipmentTypeName(String equipmentTypeName) { + this.equipmentTypeName = equipmentTypeName; + } + + public String getFileList() { + return fileList; + } + + public void setFileList(String fileList) { + this.fileList = fileList; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getInstallIncidentalExpenses() { + return installIncidentalExpenses; + } + + public void setInstallIncidentalExpenses(String installIncidentalExpenses) { + this.installIncidentalExpenses = installIncidentalExpenses; + } + + public String getInstallPlace() { + return installPlace; + } + + public void setInstallPlace(String installPlace) { + this.installPlace = installPlace; + } + + public String getIntactState() { + return intactState; + } + + public void setIntactState(String intactState) { + this.intactState = intactState; + } + + public String getIsCalibrationTestEquipment() { + return isCalibrationTestEquipment; + } + + public void setIsCalibrationTestEquipment(String isCalibrationTestEquipment) { + this.isCalibrationTestEquipment = isCalibrationTestEquipment; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getIsFixedAssets() { + return isFixedAssets; + } + + public void setIsFixedAssets(String isFixedAssets) { + this.isFixedAssets = isFixedAssets; + } + + public String getIsMeasureAccount() { + return isMeasureAccount; + } + + public void setIsMeasureAccount(String isMeasureAccount) { + this.isMeasureAccount = isMeasureAccount; + } + + public String getIsStandardSupportEquipment() { + return isStandardSupportEquipment; + } + + public void setIsStandardSupportEquipment(String isStandardSupportEquipment) { + this.isStandardSupportEquipment = isStandardSupportEquipment; + } + + public String getLabelBind() { + return labelBind; + } + + public void setLabelBind(String labelBind) { + this.labelBind = labelBind; + } + + public String getMajorCategory() { + return majorCategory; + } + + public void setMajorCategory(String majorCategory) { + this.majorCategory = majorCategory; + } + + public String getMajorCategoryName() { + return majorCategoryName; + } + + public void setMajorCategoryName(String majorCategoryName) { + this.majorCategoryName = majorCategoryName; + } + + public String getManagerLevel() { + return managerLevel; + } + + public void setManagerLevel(String managerLevel) { + this.managerLevel = managerLevel; + } + + public String getManagerLevelName() { + return managerLevelName; + } + + public void setManagerLevelName(String managerLevelName) { + this.managerLevelName = managerLevelName; + } + + public String getManagerState() { + return managerState; + } + + public void setManagerState(String managerState) { + this.managerState = managerState; + } + + public String getManagerStateName() { + return managerStateName; + } + + public void setManagerStateName(String managerStateName) { + this.managerStateName = managerStateName; + } + + public String getManufacturer() { + return manufacturer; + } + + public void setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + } + + public String getManufacturerCountry() { + return manufacturerCountry; + } + + public void setManufacturerCountry(String manufacturerCountry) { + this.manufacturerCountry = manufacturerCountry; + } + + public String getManufacturingDate() { + return manufacturingDate; + } + + public void setManufacturingDate(String manufacturingDate) { + this.manufacturingDate = manufacturingDate; + } + + public String getManufacturingNo() { + return manufacturingNo; + } + + public void setManufacturingNo(String manufacturingNo) { + this.manufacturingNo = manufacturingNo; + } + + public String getMesureCycle() { + return mesureCycle; + } + + public void setMesureCycle(String mesureCycle) { + this.mesureCycle = mesureCycle; + } + + public String getMesureDate() { + return mesureDate; + } + + public void setMesureDate(String mesureDate) { + this.mesureDate = mesureDate; + } + + public String getMesureDept() { + return mesureDept; + } + + public void setMesureDept(String mesureDept) { + this.mesureDept = mesureDept; + } + + public String getMesureRange() { + return mesureRange; + } + + public void setMesureRange(String mesureRange) { + this.mesureRange = mesureRange; + } + + public String getMesureResult() { + return mesureResult; + } + + public void setMesureResult(String mesureResult) { + this.mesureResult = mesureResult; + } + + public String getMesureResultName() { + return mesureResultName; + } + + public void setMesureResultName(String mesureResultName) { + this.mesureResultName = mesureResultName; + } + + public String getMesureType() { + return mesureType; + } + + public void setMesureType(String mesureType) { + this.mesureType = mesureType; + } + + public String getMesureTypeName() { + return mesureTypeName; + } + + public void setMesureTypeName(String mesureTypeName) { + this.mesureTypeName = mesureTypeName; + } + + public String getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getOriginValue() { + return originValue; + } + + public void setOriginValue(String originValue) { + this.originValue = originValue; + } + + public String getOverallDimension() { + return overallDimension; + } + + public void setOverallDimension(String overallDimension) { + this.overallDimension = overallDimension; + } + + public String getPresentOriginValue() { + return presentOriginValue; + } + + public void setPresentOriginValue(String presentOriginValue) { + this.presentOriginValue = presentOriginValue; + } + + public String getPurpose() { + return purpose; + } + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getSinglePrice() { + return singlePrice; + } + + public void setSinglePrice(String singlePrice) { + this.singlePrice = singlePrice; + } + + public String getSupportStandardEquipmentName() { + return supportStandardEquipmentName; + } + + public void setSupportStandardEquipmentName(String supportStandardEquipmentName) { + this.supportStandardEquipmentName = supportStandardEquipmentName; + } + + public String getSupportStandardEquipmentNo() { + return supportStandardEquipmentNo; + } + + public void setSupportStandardEquipmentNo(String supportStandardEquipmentNo) { + this.supportStandardEquipmentNo = supportStandardEquipmentNo; + } + + public String getTechnicalLevel() { + return technicalLevel; + } + + public void setTechnicalLevel(String technicalLevel) { + this.technicalLevel = technicalLevel; + } + + public String getUncertainty() { + return uncertainty; + } + + public void setUncertainty(String uncertainty) { + this.uncertainty = uncertainty; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getUseDept() { + return useDept; + } + + public void setUseDept(String useDept) { + this.useDept = useDept; + } + + public String getUseDeptName() { + return useDeptName; + } + + public void setUseDeptName(String useDeptName) { + this.useDeptName = useDeptName; + } + + public String getUsePerson() { + return usePerson; + } + + public void setUsePerson(String usePerson) { + this.usePerson = usePerson; + } + + public String getUsePersonName() { + return usePersonName; + } + + public void setUsePersonName(String usePersonName) { + this.usePersonName = usePersonName; + } + + public String getValidDate() { + return validDate; + } + + public void setValidDate(String validDate) { + this.validDate = validDate; + } + + public int getVersion() { + return version; + } + + public void setVersion(int version) { + this.version = version; + } + + public String getWeight() { + return weight; + } + + public void setWeight(String weight) { + this.weight = weight; + } + } + } +} diff --git a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt index a3f514f..46e5eef 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt @@ -35,4 +35,24 @@ @QueryMap limit: Map, @QueryMap offset: Map ): String + + /** + * 获取设备列表 + */ + @POST("/meter/assets/listPage") + suspend fun getEquipmentList( + @Header("token") token: String, + @Body requestBody: RequestBody, + @QueryMap limit: Map, + @QueryMap offset: Map + ): String + + /** + * 获取设备详情 + */ + @POST("/meter/assets/detail") + suspend fun getEquipmentDetail( + @Header("token") token: String, + @Body requestBody: RequestBody + ): String } \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt index 444a872..386a1d8 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt @@ -6,8 +6,10 @@ import com.pengxh.kt.lite.utils.SaveKeyValues import okhttp3.MediaType.Companion.toMediaType import okhttp3.RequestBody.Companion.toRequestBody +import org.json.JSONArray import org.json.JSONObject + object RetrofitServiceManager { private val api by lazy { @@ -73,4 +75,71 @@ offsetMap["offset"] = offset return api.getNoticeList(AuthenticationHelper.token!!, requestBody, limitMap, offsetMap) } + + /** + * 获取设备列表 + */ + suspend fun getEquipmentList( + equipmentNo: String, + equipmentName: String, + mesureType: String, + managerState: String, + useDept: String, + assetType: String, + equipmentCategory: String, + isCalibrationTestEquipment: String, + isMeasureAccount: String, + isStandardSupportEquipment: String, + isFixedAssets: String, + validStartDate: String, + validEndDate: String, + abc: String, + ids: Array, + offset: Int + ): String { + val paramObject = JSONObject() + paramObject.put("equipmentNo", equipmentNo) + paramObject.put("equipmentName", equipmentName) + paramObject.put("mesureType", mesureType) + paramObject.put("managerState", managerState) + paramObject.put("useDept", useDept) + paramObject.put("assetType", assetType) + paramObject.put("equipmentCategory", equipmentCategory) + paramObject.put("isCalibrationTestEquipment", isCalibrationTestEquipment) + paramObject.put("isMeasureAccount", isMeasureAccount) + paramObject.put("isStandardSupportEquipment", isStandardSupportEquipment) + paramObject.put("isFixedAssets", isFixedAssets) + paramObject.put("validStartDate", validStartDate) + paramObject.put("validEndDate", validEndDate) + paramObject.put("abc", abc) + + val jsonArray = JSONArray() + ids.forEach { + jsonArray.put(it) + } + paramObject.put("ids", jsonArray) + + val requestBody = paramObject.toString().toRequestBody( + "application/json;charset=UTF-8".toMediaType() + ) + + val limitMap = HashMap() + limitMap["limit"] = LocaleConstant.PAGE_LIMIT + + val offsetMap = HashMap() + offsetMap["offset"] = offset + return api.getEquipmentList(AuthenticationHelper.token!!, requestBody, limitMap, offsetMap) + } + + /** + * 获取设备详情 + */ + suspend fun getEquipmentDetail(id: String): String { + val paramObject = JSONObject() + paramObject.put("id", id) + val requestBody = paramObject.toString().toRequestBody( + "application/json;charset=UTF-8".toMediaType() + ) + return api.getEquipmentDetail(AuthenticationHelper.token!!, requestBody) + } } \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt deleted file mode 100644 index a5bb60b..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt +++ /dev/null @@ -1,104 +0,0 @@ -package com.casic.xz.meterage.view - -import android.annotation.SuppressLint -import android.graphics.Paint -import androidx.lifecycle.ViewModelProvider -import com.casic.xz.meterage.R -import com.casic.xz.meterage.extensions.combineImagePath -import com.casic.xz.meterage.extensions.formatTextFromHtml -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.vm.NoticeViewModel -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.extensions.convertColor -import com.pengxh.kt.lite.extensions.navigatePageTo -import com.pengxh.kt.lite.extensions.obtainScreenWidth -import com.pengxh.kt.lite.extensions.show -import com.pengxh.kt.lite.utils.Constant -import kotlinx.android.synthetic.main.activity_notice_detail.* -import kotlinx.android.synthetic.main.include_base_title.* -import java.util.* - -@SuppressLint("SetTextI18n") -class NoticeDetailActivity : KotlinBaseActivity() { - - private lateinit var noticeViewModel: NoticeViewModel - - override fun initData() { - leftBackView.setOnClickListener { finish() } - titleView.text = "通知公告" - - val args = intent.getStringArrayListExtra(Constant.INTENT_PARAM)!! - - noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] - noticeViewModel.getNoticeList(args[0], args[1], args[2], "", "", 1) - noticeViewModel.noticeResult.observe(this, { - if (it.code == 200) { - val dataRow = it.data?.rows!![0] - - noticeDateView.text = dataRow.noticeTime - noticePublisherView.text = "发布人 ${dataRow.noticePublisher}" - noticeCompanyView.text = "发布单位 ${dataRow.noticeCompany}" - - noticeNoView.text = dataRow.noticeNo - noticeTitleView.text = dataRow.noticeTitle - noticeSketchView.text = dataRow.noticeSketch - - dataRow.noticeContent.formatTextFromHtml( - this, noticeContentView, obtainScreenWidth() - ) - - if (dataRow.minioFileName.isNullOrBlank()) { - minioFileView.text = "暂无附件" - } else { - val minioFileName = dataRow.minioFileName - - minioFileView.text = minioFileName - val textPaint = minioFileView.paint - textPaint.flags = Paint.UNDERLINE_TEXT_FLAG - textPaint.isAntiAlias = true - minioFileView.setTextColor(R.color.themeColor.convertColor(this)) - - minioFileView.setOnClickListener { - //查看附件 - if (minioFileName.endsWith("pdf")) { - navigatePageTo(minioFileName) - } else if ( - minioFileName.endsWith("doc") || - minioFileName.endsWith("docx") - ) { - navigatePageTo(minioFileName) - } else if (minioFileName.endsWith("txt")) { - navigatePageTo(minioFileName) - } else if ( - minioFileName.endsWith("png") || - minioFileName.endsWith("jpeg") || - minioFileName.endsWith("jpg") - ) { - val urls = ArrayList() - urls.add(minioFileName.combineImagePath()) - navigatePageTo(0, urls) - } else { - "文件类型未知,无法打开附件".show(this) - } - } - } - } - }) - } - - override fun initEvent() { - - } - - override fun initLayoutView(): Int = R.layout.activity_notice_detail - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/NoticeListActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/NoticeListActivity.kt deleted file mode 100644 index 15f6a16..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/NoticeListActivity.kt +++ /dev/null @@ -1,180 +0,0 @@ -package com.casic.xz.meterage.view - -import android.os.Handler -import android.util.Log -import android.view.View -import androidx.lifecycle.ViewModelProvider -import com.casic.xz.meterage.R -import com.casic.xz.meterage.adapter.NoticeListAdapter -import com.casic.xz.meterage.extensions.addAll -import com.casic.xz.meterage.extensions.combineFilePath -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.extensions.showEmptyPage -import com.casic.xz.meterage.model.NoticeListModel -import com.casic.xz.meterage.vm.NoticeViewModel -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.extensions.navigatePageTo -import com.pengxh.kt.lite.extensions.show -import com.pengxh.kt.lite.utils.WeakReferenceHandler -import com.pengxh.kt.lite.widget.dialog.AlertControlDialog -import kotlinx.android.synthetic.main.activity_notice_list.* -import kotlinx.android.synthetic.main.include_empty_view.* - -class NoticeListActivity : KotlinBaseActivity() { - - private lateinit var weakReferenceHandler: WeakReferenceHandler - private lateinit var noticeViewModel: NoticeViewModel - private lateinit var noticeListAdapter: NoticeListAdapter - private var dataBeans: MutableList = ArrayList() - private var pageIndex = 1 - private var isRefresh = false - private var isLoadMore = false - - override fun initData() { - weakReferenceHandler = WeakReferenceHandler(callback) - noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] - noticeViewModel.noticeResult.observe(this, { - if (it.code == 200) { - val dataRows = it.data?.rows!! -// countBadeNumber(dataRows) - when { - isRefresh -> { - dataBeans.clear() - dataBeans = dataRows - noticeLayout.finishRefresh() - isRefresh = false - } - isLoadMore -> { - if (dataRows.size == 0) { - "到底了,别拉了".show(this) - } - dataBeans.addAll(dataRows) - noticeLayout.finishLoadMore() - isLoadMore = false - } - else -> { - dataBeans = dataRows - } - } - weakReferenceHandler.sendEmptyMessage(2023013101) - } - }) - } - - override fun initEvent() { - leftBackView.setOnClickListener { finish() } - rightOperateView.setOnClickListener { - AlertControlDialog.Builder() - .setContext(this) - .setTitle("提示") - .setMessage("确定将所有未读消息标为已读?") - .setNegativeButton("取消") - .setPositiveButton("确定") - .setOnDialogButtonClickListener(object : - AlertControlDialog.OnDialogButtonClickListener { - override fun onCancelClick() { - - } - - override fun onConfirmClick() { - //TODO 设置为已读 - } - }).build().show() - } - - if (hasNoticePermission()) { - openSystemNoticeLayout.visibility = View.GONE - openSystemNoticeLayout.visibility = View.GONE - } else { - openSystemNoticeLayout.setOnClickListener { - - } - - - closeLayoutView.setOnClickListener { - openSystemNoticeLayout.visibility = View.GONE - } - } - - noticeLayout.setOnRefreshListener { - isRefresh = true - //刷新之后页码重置 - pageIndex = 1 - getNoticeListByPage() - } - - noticeLayout.setOnLoadMoreListener { - isLoadMore = true - pageIndex++ - getNoticeListByPage() - } - } - - override fun onResume() { - super.onResume() - pageIndex = 1 - getNoticeListByPage() - } - - private fun getNoticeListByPage() { - noticeViewModel.getNoticeList("", "", "", "", "", pageIndex) - } - - private val callback = Handler.Callback { - when (it.what) { - 2023013101 -> { - if (isRefresh || isLoadMore) { - noticeListAdapter.notifyDataSetChanged() - } else { - if (dataBeans.size == 0) { - emptyView!!.showEmptyPage("没有任何消息") { - pageIndex = 1 - getNoticeListByPage() - } - } else { - emptyView!!.hide() - noticeListAdapter = NoticeListAdapter(this, dataBeans) - noticeRecyclerView.adapter = noticeListAdapter - noticeListAdapter.setOnItemClickListener(object : - NoticeListAdapter.OnItemClickListener { - override fun onItemClicked(position: Int) { - val rowsModel = dataBeans[position] - val allArgs = addAll( - rowsModel.noticeNo, - rowsModel.noticeTitle, - rowsModel.noticePublisher, - "", - "" - ) - Log.d( - "Casic", - "NoticeListActivity => onItemClicked: ${rowsModel.minioFileName.combineFilePath()}" - ) - navigatePageTo(allArgs) - } - }) - } - } - } - } - true - } - - //TODO 判断是否开启通知权限 - private fun hasNoticePermission(): Boolean { - - return false - } - - override fun initLayoutView(): Int = R.layout.activity_notice_list - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/PreviewDocumentActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/PreviewDocumentActivity.kt deleted file mode 100644 index e233ddc..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/PreviewDocumentActivity.kt +++ /dev/null @@ -1,24 +0,0 @@ -package com.casic.xz.meterage.view - -import com.casic.xz.meterage.R -import com.pengxh.kt.lite.base.KotlinBaseActivity - -class PreviewDocumentActivity : KotlinBaseActivity() { - override fun initData() { - - } - - override fun initEvent() { - - } - - override fun initLayoutView(): Int = R.layout.activity_preview_doc - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/PreviewPdfActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/PreviewPdfActivity.kt deleted file mode 100644 index 39f8ac2..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/PreviewPdfActivity.kt +++ /dev/null @@ -1,62 +0,0 @@ -package com.casic.xz.meterage.view - -import com.casic.xz.meterage.R -import com.casic.xz.meterage.extensions.combineFilePath -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.utils.LoadingDialogHub -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.callback.OnDownloadListener -import com.pengxh.kt.lite.extensions.createDownloadFileDir -import com.pengxh.kt.lite.extensions.downloadFile -import com.pengxh.kt.lite.utils.Constant -import kotlinx.android.synthetic.main.activity_preview_pdf.* -import kotlinx.android.synthetic.main.include_base_title.* -import java.io.File -import java.io.FileInputStream - - -class PreviewPdfActivity : KotlinBaseActivity() { - - override fun initData() { - val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! - titleView.text = minioFileName - - val url = minioFileName.combineFilePath() - url.downloadFile(createDownloadFileDir().toString(), - object : OnDownloadListener { - override fun onDownloadStart(totalBytes: Long) { - runOnUiThread { - LoadingDialogHub.show(this@PreviewPdfActivity, "附件加载中") - } - } - - override fun onProgressChanged(currentBytes: Long) { - - } - - override fun onDownloadEnd(file: File?) { - runOnUiThread { - LoadingDialogHub.dismiss() - } - val inputStream = FileInputStream(file) - pdfView.fromStream(inputStream).load() - } - }) - } - - override fun initEvent() { - leftBackView.setOnClickListener { finish() } - } - - override fun initLayoutView(): Int = R.layout.activity_preview_pdf - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/PreviewTextActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/PreviewTextActivity.kt deleted file mode 100644 index d634ca3..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/PreviewTextActivity.kt +++ /dev/null @@ -1,60 +0,0 @@ -package com.casic.xz.meterage.view - -import com.casic.xz.meterage.R -import com.casic.xz.meterage.extensions.combineFilePath -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.utils.LoadingDialogHub -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.callback.OnDownloadListener -import com.pengxh.kt.lite.extensions.createDownloadFileDir -import com.pengxh.kt.lite.extensions.downloadFile -import com.pengxh.kt.lite.extensions.read -import com.pengxh.kt.lite.utils.Constant -import kotlinx.android.synthetic.main.activity_preview_txt.* -import kotlinx.android.synthetic.main.include_base_title.* -import java.io.File - -class PreviewTextActivity : KotlinBaseActivity() { - - override fun initData() { - val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! - titleView.text = minioFileName - - val url = minioFileName.combineFilePath() - url.downloadFile(createDownloadFileDir().toString(), - object : OnDownloadListener { - override fun onDownloadStart(totalBytes: Long) { - runOnUiThread { - LoadingDialogHub.show(this@PreviewTextActivity, "附件加载中") - } - } - - override fun onProgressChanged(currentBytes: Long) { - - } - - override fun onDownloadEnd(file: File?) { - runOnUiThread { - LoadingDialogHub.dismiss() - textView.text = file?.read() - } - } - }) - } - - override fun initEvent() { - leftBackView.setOnClickListener { finish() } - } - - override fun initLayoutView(): Int = R.layout.activity_preview_txt - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentActivity.kt new file mode 100644 index 0000000..35ca098 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentActivity.kt @@ -0,0 +1,158 @@ +package com.casic.xz.meterage.view.home + +import android.os.Handler +import androidx.lifecycle.ViewModelProvider +import androidx.recyclerview.widget.DividerItemDecoration +import com.casic.xz.meterage.R +import com.casic.xz.meterage.adapter.EquipmentListAdapter +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.extensions.showEmptyPage +import com.casic.xz.meterage.model.EquipmentListModel +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.casic.xz.meterage.vm.EquipmentViewModel +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.extensions.navigatePageTo +import com.pengxh.kt.lite.extensions.show +import com.pengxh.kt.lite.utils.WeakReferenceHandler +import com.pengxh.kt.lite.vm.LoadState +import kotlinx.android.synthetic.main.activity_equipment.* +import kotlinx.android.synthetic.main.include_empty_view.* +import kotlinx.android.synthetic.main.include_search_title.* + +class EquipmentActivity : KotlinBaseActivity() { + + private lateinit var weakReferenceHandler: WeakReferenceHandler + private lateinit var equipmentViewModel: EquipmentViewModel + private lateinit var equipmentListAdapter: EquipmentListAdapter + private var dataBeans: MutableList = ArrayList() + private var pageIndex = 1 + private var isRefresh = false + private var isLoadMore = false + + override fun initData() { + weakReferenceHandler = WeakReferenceHandler(callback) + equipmentViewModel = ViewModelProvider(this)[EquipmentViewModel::class.java] + equipmentViewModel.equipmentResult.observe(this, { + if (it.code == 200) { + val dataRows = it.data?.rows!! + when { + isRefresh -> { + dataBeans.clear() + dataBeans = dataRows + equipmentLayout.finishRefresh() + isRefresh = false + } + isLoadMore -> { + if (dataRows.size == 0) { + "到底了,别拉了".show(this) + } + dataBeans.addAll(dataRows) + equipmentLayout.finishLoadMore() + isLoadMore = false + } + else -> { + dataBeans = dataRows + } + } + weakReferenceHandler.sendEmptyMessage(2023020801) + } + }) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + rightOperateView.setOnClickListener { + + } + + equipmentLayout.setOnRefreshListener { + isRefresh = true + //刷新之后页码重置 + pageIndex = 1 + getEquipmentListByPage() + } + + equipmentLayout.setOnLoadMoreListener { + isLoadMore = true + pageIndex++ + getEquipmentListByPage() + } + } + + override fun initLayoutView(): Int = R.layout.activity_equipment + + override fun observeRequestState() { + equipmentViewModel.loadState.observe(this, { + when (it) { + LoadState.Loading -> LoadingDialogHub.show(this, "数据加载中...") + else -> LoadingDialogHub.dismiss() + } + }) + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + titleView.text = "仪器设备" + } + + override fun onResume() { + super.onResume() + pageIndex = 1 + getEquipmentListByPage() + } + + private fun getEquipmentListByPage() { + equipmentViewModel.getEquipmentList( + "", + "", + "", + "", + "", + "1", + "", + "", + "", + "", + "", + "", + "", + "", + arrayOf(), + pageIndex + ) + } + + private val callback = Handler.Callback { + when (it.what) { + 2023020801 -> { + if (isRefresh || isLoadMore) { + equipmentListAdapter.notifyDataSetChanged() + } else { + if (dataBeans.size == 0) { + emptyView!!.showEmptyPage("无设备") { + pageIndex = 1 + getEquipmentListByPage() + } + } else { + emptyView!!.hide() + equipmentListAdapter = EquipmentListAdapter(this, dataBeans) + equipmentRecyclerView.addItemDecoration( + DividerItemDecoration(this, DividerItemDecoration.VERTICAL) + ) + equipmentRecyclerView.adapter = equipmentListAdapter + equipmentListAdapter.setOnItemClickListener(object : + EquipmentListAdapter.OnItemClickListener { + override fun onItemClicked(position: Int) { + val rowsModel = dataBeans[position] + navigatePageTo(rowsModel.id) + } + }) + } + } + } + } + true + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentDetailActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentDetailActivity.kt new file mode 100644 index 0000000..7dee13c --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentDetailActivity.kt @@ -0,0 +1,53 @@ +package com.casic.xz.meterage.view.home + +import androidx.fragment.app.Fragment +import com.casic.xz.meterage.R +import com.casic.xz.meterage.adapter.SubViewPagerAdapter +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.fragment.equipment.* +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.utils.Constant +import kotlinx.android.synthetic.main.activity_equipment.rootView +import kotlinx.android.synthetic.main.activity_equipment_detail.* +import kotlinx.android.synthetic.main.include_base_title.* + +class EquipmentDetailActivity : KotlinBaseActivity() { + + private var fragmentPages: ArrayList = ArrayList() + + override fun initData() { + val equipmentId = intent.getStringExtra(Constant.INTENT_PARAM)!! + + fragmentPages.add(BasicInformationFragment(equipmentId)) + fragmentPages.add(InspectionRecordFragment()) + fragmentPages.add(ChangeRecordFragment()) + fragmentPages.add(UsageRecordFragment()) + fragmentPages.add(CertificateFragment()) + + val equipmentPageTitles = arrayOf("基础信息", "周检记录", "状态变更记录", "使用记录", "检定证书") + + equipmentViewPager.adapter = SubViewPagerAdapter( + supportFragmentManager, fragmentPages, equipmentPageTitles + ) + equipmentViewPager.offscreenPageLimit = fragmentPages.size + //绑定 + topTabLayout.setupWithViewPager(equipmentViewPager) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + } + + override fun initLayoutView(): Int = R.layout.activity_equipment_detail + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + titleView.text = "仪器设备" + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeDetailActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeDetailActivity.kt new file mode 100644 index 0000000..6fe0022 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeDetailActivity.kt @@ -0,0 +1,105 @@ +package com.casic.xz.meterage.view.notice + +import android.annotation.SuppressLint +import android.graphics.Paint +import androidx.lifecycle.ViewModelProvider +import com.casic.xz.meterage.R +import com.casic.xz.meterage.extensions.combineImagePath +import com.casic.xz.meterage.extensions.formatTextFromHtml +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.view.BigImageActivity +import com.casic.xz.meterage.vm.NoticeViewModel +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.extensions.convertColor +import com.pengxh.kt.lite.extensions.navigatePageTo +import com.pengxh.kt.lite.extensions.obtainScreenWidth +import com.pengxh.kt.lite.extensions.show +import com.pengxh.kt.lite.utils.Constant +import kotlinx.android.synthetic.main.activity_notice_detail.* +import kotlinx.android.synthetic.main.include_base_title.* +import java.util.* + +@SuppressLint("SetTextI18n") +class NoticeDetailActivity : KotlinBaseActivity() { + + private lateinit var noticeViewModel: NoticeViewModel + + override fun initData() { + leftBackView.setOnClickListener { finish() } + titleView.text = "通知公告" + + val args = intent.getStringArrayListExtra(Constant.INTENT_PARAM)!! + + noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] + noticeViewModel.getNoticeList(args[0], args[1], args[2], "", "", 1) + noticeViewModel.noticeResult.observe(this, { + if (it.code == 200) { + val dataRow = it.data?.rows!![0] + + noticeDateView.text = dataRow.noticeTime + noticePublisherView.text = "发布人 ${dataRow.noticePublisher}" + noticeCompanyView.text = "发布单位 ${dataRow.noticeCompany}" + + noticeNoView.text = dataRow.noticeNo + noticeTitleView.text = dataRow.noticeTitle + noticeSketchView.text = dataRow.noticeSketch + + dataRow.noticeContent.formatTextFromHtml( + this, noticeContentView, obtainScreenWidth() + ) + + if (dataRow.minioFileName.isNullOrBlank()) { + minioFileView.text = "暂无附件" + } else { + val minioFileName = dataRow.minioFileName + + minioFileView.text = minioFileName + val textPaint = minioFileView.paint + textPaint.flags = Paint.UNDERLINE_TEXT_FLAG + textPaint.isAntiAlias = true + minioFileView.setTextColor(R.color.themeColor.convertColor(this)) + + minioFileView.setOnClickListener { + //查看附件 + if (minioFileName.endsWith("pdf")) { + navigatePageTo(minioFileName) + } else if ( + minioFileName.endsWith("doc") || + minioFileName.endsWith("docx") + ) { + navigatePageTo(minioFileName) + } else if (minioFileName.endsWith("txt")) { + navigatePageTo(minioFileName) + } else if ( + minioFileName.endsWith("png") || + minioFileName.endsWith("jpeg") || + minioFileName.endsWith("jpg") + ) { + val urls = ArrayList() + urls.add(minioFileName.combineImagePath()) + navigatePageTo(0, urls) + } else { + "文件类型未知,无法打开附件".show(this) + } + } + } + } + }) + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.activity_notice_detail + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeListActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeListActivity.kt new file mode 100644 index 0000000..31c0490 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeListActivity.kt @@ -0,0 +1,180 @@ +package com.casic.xz.meterage.view.notice + +import android.os.Handler +import android.util.Log +import android.view.View +import androidx.lifecycle.ViewModelProvider +import com.casic.xz.meterage.R +import com.casic.xz.meterage.adapter.NoticeListAdapter +import com.casic.xz.meterage.extensions.addAll +import com.casic.xz.meterage.extensions.combineFilePath +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.extensions.showEmptyPage +import com.casic.xz.meterage.model.NoticeListModel +import com.casic.xz.meterage.vm.NoticeViewModel +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.extensions.navigatePageTo +import com.pengxh.kt.lite.extensions.show +import com.pengxh.kt.lite.utils.WeakReferenceHandler +import com.pengxh.kt.lite.widget.dialog.AlertControlDialog +import kotlinx.android.synthetic.main.activity_notice_list.* +import kotlinx.android.synthetic.main.include_empty_view.* + +class NoticeListActivity : KotlinBaseActivity() { + + private lateinit var weakReferenceHandler: WeakReferenceHandler + private lateinit var noticeViewModel: NoticeViewModel + private lateinit var noticeListAdapter: NoticeListAdapter + private var dataBeans: MutableList = ArrayList() + private var pageIndex = 1 + private var isRefresh = false + private var isLoadMore = false + + override fun initData() { + weakReferenceHandler = WeakReferenceHandler(callback) + noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] + noticeViewModel.noticeResult.observe(this, { + if (it.code == 200) { + val dataRows = it.data?.rows!! +// countBadeNumber(dataRows) + when { + isRefresh -> { + dataBeans.clear() + dataBeans = dataRows + noticeLayout.finishRefresh() + isRefresh = false + } + isLoadMore -> { + if (dataRows.size == 0) { + "到底了,别拉了".show(this) + } + dataBeans.addAll(dataRows) + noticeLayout.finishLoadMore() + isLoadMore = false + } + else -> { + dataBeans = dataRows + } + } + weakReferenceHandler.sendEmptyMessage(2023013101) + } + }) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + rightOperateView.setOnClickListener { + AlertControlDialog.Builder() + .setContext(this) + .setTitle("提示") + .setMessage("确定将所有未读消息标为已读?") + .setNegativeButton("取消") + .setPositiveButton("确定") + .setOnDialogButtonClickListener(object : + AlertControlDialog.OnDialogButtonClickListener { + override fun onCancelClick() { + + } + + override fun onConfirmClick() { + //TODO 设置为已读 + } + }).build().show() + } + + if (hasNoticePermission()) { + openSystemNoticeLayout.visibility = View.GONE + openSystemNoticeLayout.visibility = View.GONE + } else { + openSystemNoticeLayout.setOnClickListener { + + } + + + closeLayoutView.setOnClickListener { + openSystemNoticeLayout.visibility = View.GONE + } + } + + noticeLayout.setOnRefreshListener { + isRefresh = true + //刷新之后页码重置 + pageIndex = 1 + getNoticeListByPage() + } + + noticeLayout.setOnLoadMoreListener { + isLoadMore = true + pageIndex++ + getNoticeListByPage() + } + } + + override fun onResume() { + super.onResume() + pageIndex = 1 + getNoticeListByPage() + } + + private fun getNoticeListByPage() { + noticeViewModel.getNoticeList("", "", "", "", "", pageIndex) + } + + private val callback = Handler.Callback { + when (it.what) { + 2023013101 -> { + if (isRefresh || isLoadMore) { + noticeListAdapter.notifyDataSetChanged() + } else { + if (dataBeans.size == 0) { + emptyView!!.showEmptyPage("没有任何消息") { + pageIndex = 1 + getNoticeListByPage() + } + } else { + emptyView!!.hide() + noticeListAdapter = NoticeListAdapter(this, dataBeans) + noticeRecyclerView.adapter = noticeListAdapter + noticeListAdapter.setOnItemClickListener(object : + NoticeListAdapter.OnItemClickListener { + override fun onItemClicked(position: Int) { + val rowsModel = dataBeans[position] + val allArgs = addAll( + rowsModel.noticeNo, + rowsModel.noticeTitle, + rowsModel.noticePublisher, + "", + "" + ) + Log.d( + "Casic", + "NoticeListActivity => onItemClicked: ${rowsModel.minioFileName.combineFilePath()}" + ) + navigatePageTo(allArgs) + } + }) + } + } + } + } + true + } + + //TODO 判断是否开启通知权限 + private fun hasNoticePermission(): Boolean { + + return false + } + + override fun initLayoutView(): Int = R.layout.activity_notice_list + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewDocumentActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewDocumentActivity.kt new file mode 100644 index 0000000..4b16ae8 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewDocumentActivity.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.view.notice + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseActivity + +class PreviewDocumentActivity : KotlinBaseActivity() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.activity_preview_doc + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewPdfActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewPdfActivity.kt new file mode 100644 index 0000000..fad73b6 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewPdfActivity.kt @@ -0,0 +1,62 @@ +package com.casic.xz.meterage.view.notice + +import com.casic.xz.meterage.R +import com.casic.xz.meterage.extensions.combineFilePath +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.callback.OnDownloadListener +import com.pengxh.kt.lite.extensions.createDownloadFileDir +import com.pengxh.kt.lite.extensions.downloadFile +import com.pengxh.kt.lite.utils.Constant +import kotlinx.android.synthetic.main.activity_preview_pdf.* +import kotlinx.android.synthetic.main.include_base_title.* +import java.io.File +import java.io.FileInputStream + + +class PreviewPdfActivity : KotlinBaseActivity() { + + override fun initData() { + val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! + titleView.text = minioFileName + + val url = minioFileName.combineFilePath() + url.downloadFile(createDownloadFileDir().toString(), + object : OnDownloadListener { + override fun onDownloadStart(totalBytes: Long) { + runOnUiThread { + LoadingDialogHub.show(this@PreviewPdfActivity, "附件加载中") + } + } + + override fun onProgressChanged(currentBytes: Long) { + + } + + override fun onDownloadEnd(file: File?) { + runOnUiThread { + LoadingDialogHub.dismiss() + } + val inputStream = FileInputStream(file) + pdfView.fromStream(inputStream).load() + } + }) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + } + + override fun initLayoutView(): Int = R.layout.activity_preview_pdf + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewTextActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewTextActivity.kt new file mode 100644 index 0000000..d7850fb --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewTextActivity.kt @@ -0,0 +1,60 @@ +package com.casic.xz.meterage.view.notice + +import com.casic.xz.meterage.R +import com.casic.xz.meterage.extensions.combineFilePath +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.callback.OnDownloadListener +import com.pengxh.kt.lite.extensions.createDownloadFileDir +import com.pengxh.kt.lite.extensions.downloadFile +import com.pengxh.kt.lite.extensions.read +import com.pengxh.kt.lite.utils.Constant +import kotlinx.android.synthetic.main.activity_preview_txt.* +import kotlinx.android.synthetic.main.include_base_title.* +import java.io.File + +class PreviewTextActivity : KotlinBaseActivity() { + + override fun initData() { + val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! + titleView.text = minioFileName + + val url = minioFileName.combineFilePath() + url.downloadFile(createDownloadFileDir().toString(), + object : OnDownloadListener { + override fun onDownloadStart(totalBytes: Long) { + runOnUiThread { + LoadingDialogHub.show(this@PreviewTextActivity, "附件加载中") + } + } + + override fun onProgressChanged(currentBytes: Long) { + + } + + override fun onDownloadEnd(file: File?) { + runOnUiThread { + LoadingDialogHub.dismiss() + textView.text = file?.read() + } + } + }) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + } + + override fun initLayoutView(): Int = R.layout.activity_preview_txt + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/vm/EquipmentViewModel.kt b/app/src/main/java/com/casic/xz/meterage/vm/EquipmentViewModel.kt new file mode 100644 index 0000000..b5f21f6 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/vm/EquipmentViewModel.kt @@ -0,0 +1,92 @@ +package com.casic.xz.meterage.vm + +import androidx.lifecycle.MutableLiveData +import com.casic.xz.meterage.base.BaseApplication +import com.casic.xz.meterage.extensions.separateResponseCode +import com.casic.xz.meterage.extensions.toErrorMessage +import com.casic.xz.meterage.model.EquipmentDetailModel +import com.casic.xz.meterage.model.EquipmentListModel +import com.casic.xz.meterage.utils.retrofit.RetrofitServiceManager +import com.google.gson.Gson +import com.google.gson.reflect.TypeToken +import com.pengxh.kt.lite.extensions.launch +import com.pengxh.kt.lite.extensions.show +import com.pengxh.kt.lite.vm.BaseViewModel +import com.pengxh.kt.lite.vm.LoadState + +class EquipmentViewModel : BaseViewModel() { + + private val gson by lazy { Gson() } + val equipmentResult = MutableLiveData() + val equipmentDetailResult = MutableLiveData() + + fun getEquipmentList( + equipmentNo: String, + equipmentName: String, + mesureType: String, + managerState: String, + useDept: String, + assetType: String, + equipmentCategory: String, + isCalibrationTestEquipment: String, + isMeasureAccount: String, + isStandardSupportEquipment: String, + isFixedAssets: String, + validStartDate: String, + validEndDate: String, + abc: String, + ids: Array, + offset: Int + ) = launch({ + loadState.value = LoadState.Loading + val response = RetrofitServiceManager.getEquipmentList( + equipmentNo, + equipmentName, + mesureType, + managerState, + useDept, + assetType, + equipmentCategory, + isCalibrationTestEquipment, + isMeasureAccount, + isStandardSupportEquipment, + isFixedAssets, + validStartDate, + validEndDate, + abc, + ids, + offset + ) + val responseCode = response.separateResponseCode() + if (responseCode == 200) { + loadState.value = LoadState.Success + equipmentResult.value = gson.fromJson( + response, object : TypeToken() {}.type + ) + } else { + loadState.value = LoadState.Fail + response.toErrorMessage().show(BaseApplication.get()) + } + }, { + loadState.value = LoadState.Fail + it.printStackTrace() + }) + + fun getEquipmentDetail(id: String) = launch({ + loadState.value = LoadState.Loading + val response = RetrofitServiceManager.getEquipmentDetail(id) + val responseCode = response.separateResponseCode() + if (responseCode == 200) { + loadState.value = LoadState.Success + equipmentDetailResult.value = gson.fromJson( + response, object : TypeToken() {}.type + ) + } else { + loadState.value = LoadState.Fail + response.toErrorMessage().show(BaseApplication.get()) + } + }, { + loadState.value = LoadState.Fail + it.printStackTrace() + }) +} \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 3892b5a..02160cd 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -34,16 +34,18 @@ - - - - - - - + + + + + + + + + +) : RecyclerView.Adapter() { + + private var layoutInflater: LayoutInflater = LayoutInflater.from(context) + + override fun getItemCount(): Int = dataRows.size + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = ItemViewHolder( + layoutInflater.inflate(R.layout.item_equipment_rv_l, parent, false) + ) + + override fun onBindViewHolder(holder: ItemViewHolder, position: Int) { + //绑定数据 + val rowsBean = dataRows[position] + holder.equipmentNameView.text = rowsBean.equipmentName + holder.equipmentCodeView.text = rowsBean.equipmentNo + holder.equipmentDateView.text = rowsBean.enableDate + holder.equipmentLibView.text = rowsBean.useDeptName + + //绑定事件 + holder.itemView.setOnClickListener { + listener?.onItemClicked(position) + } + } + + inner class ItemViewHolder(view: View) : RecyclerView.ViewHolder(view) { + var equipmentNameView: TextView = view.findViewById(R.id.equipmentNameView) + var equipmentCodeView: TextView = view.findViewById(R.id.equipmentCodeView) + var equipmentDateView: TextView = view.findViewById(R.id.equipmentDateView) + var equipmentLibView: TextView = view.findViewById(R.id.equipmentLibView) + } + + private var listener: OnItemClickListener? = null + + interface OnItemClickListener { + fun onItemClicked(position: Int) + } + + fun setOnItemClickListener(onClickListener: OnItemClickListener?) { + this.listener = onClickListener + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt index b4628f3..d970b55 100644 --- a/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt +++ b/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt @@ -5,7 +5,8 @@ import com.casic.xz.meterage.R import com.casic.xz.meterage.adapter.HomeGridAdapter import com.casic.xz.meterage.utils.LocaleConstant -import com.casic.xz.meterage.view.NoticeListActivity +import com.casic.xz.meterage.view.home.EquipmentActivity +import com.casic.xz.meterage.view.notice.NoticeListActivity import com.casic.xz.meterage.vm.NoticeViewModel import com.pengxh.kt.lite.base.KotlinBaseFragment import com.pengxh.kt.lite.extensions.navigatePageTo @@ -36,8 +37,19 @@ homeFuncRecyclerView.adapter = homeAdapter homeAdapter.setOnGridItemClickListener(object : HomeGridAdapter.OnGridItemClickListener { override fun onItemClick(position: Int) { - when (position) { - + when (LocaleConstant.HOME_FUNC_OPERATE[position]) { + "仪器设备" -> requireContext().navigatePageTo() +// "标准装置" -> requireContext().navigatePageTo() +// "证书报告" -> requireContext().navigatePageTo() +// "委托需求" -> requireContext().navigatePageTo() +// "访客" -> requireContext().navigatePageTo() +// "标准规范" -> requireContext().navigatePageTo() +// "能力列表" -> requireContext().navigatePageTo() +// "计量培训" -> requireContext().navigatePageTo() +// "合同发票" -> requireContext().navigatePageTo() +// "业务统计" -> requireContext().navigatePageTo() +// "客户列表" -> requireContext().navigatePageTo() +// "外场检测" -> requireContext().navigatePageTo() } } }) diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt index 7e75abe..56dc5ec 100644 --- a/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt +++ b/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt @@ -2,9 +2,11 @@ import android.view.View import androidx.lifecycle.ViewModelProvider +import com.bumptech.glide.Glide +import com.bumptech.glide.request.RequestOptions import com.casic.xz.meterage.R import com.casic.xz.meterage.utils.LocaleConstant -import com.casic.xz.meterage.view.NoticeListActivity +import com.casic.xz.meterage.view.notice.NoticeListActivity import com.casic.xz.meterage.vm.NoticeViewModel import com.casic.xz.meterage.vm.UserViewModel import com.pengxh.kt.lite.base.KotlinBaseFragment @@ -23,6 +25,12 @@ val data = it.data userNameView.text = data.name userUnitView.text = data.deptName + +// Glide.with(requireContext()) +// .load(R.mipmap.default_avatar) +// .apply(RequestOptions.circleCropTransform()) +// .placeholder(R.mipmap.load_image_error) +// .into(userAvatarView) } }) diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt new file mode 100644 index 0000000..cf22646 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt @@ -0,0 +1,103 @@ +package com.casic.xz.meterage.fragment.equipment + +import android.graphics.Paint +import androidx.lifecycle.ViewModelProvider +import com.casic.xz.meterage.R +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.casic.xz.meterage.vm.EquipmentViewModel +import com.pengxh.kt.lite.base.KotlinBaseFragment +import com.pengxh.kt.lite.extensions.convertColor +import com.pengxh.kt.lite.vm.LoadState +import kotlinx.android.synthetic.main.fragment_basic_information.* + +class BasicInformationFragment(private val id: String) : KotlinBaseFragment() { + + private lateinit var equipmentViewModel: EquipmentViewModel + + override fun initData() { + equipmentViewModel = ViewModelProvider(this)[EquipmentViewModel::class.java] + equipmentViewModel.getEquipmentDetail(id) + equipmentViewModel.equipmentDetailResult.observe(this, { + if (it.code == 200) { + val data = it.data!! + + equipmentCodeView.text = data.equipmentNo + equipmentNameView.text = data.equipmentName + manufacturerView.text = data.manufacturer + factoryNumberView.text = data.manufacturingNo + modelView.text = data.modelNo + verificationMethodView.text = data.mesureTypeName + measuringRangeView.text = data.mesureRange + uncertaintyView.text = data.uncertainty + firstUseView.text = data.createTime + originalValueView.text = data.originValue + usageDeptView.text = data.useDeptName + userView.text = data.usePersonName + managementStatusView.text = data.managerStateName + verificationDeptView.text = data.useDeptName +// nextVerificationDeptView.text = data. + verificationPeriodView.text = data.mesureCycle + verificationDateView.text = data.mesureDate + effectiveDateView.text = data.validDate + verificationResultsView.text = data.mesureResultName + abcView.text = data.abcName + isNeedTechnicalView.text = if ( + data.isCalibrationTestEquipment.isNullOrBlank() || data.isCalibrationTestEquipment == "0" + ) { + "否" + } else { + "是" + } + + isStandingBook.text = if ( + data.isMeasureAccount.isNullOrBlank() || data.isMeasureAccount == "0" + ) { + "否" + } else { + "是" + } + + isStandardView.text = if ( + data.isStandardSupportEquipment.isNullOrBlank() || data.isStandardSupportEquipment == "0" + ) { + "否" + } else { + "是" + } + remarkView.text = data.remark + if (data.fileList.size == 0) { + instructionsView.text = "暂无" + } else { + instructionsView.text = "查看附件列表" + val textPaint = instructionsView.paint + textPaint.flags = Paint.UNDERLINE_TEXT_FLAG + textPaint.isAntiAlias = true + instructionsView.setTextColor(R.color.themeColor.convertColor(requireContext())) + + instructionsView.setOnClickListener { + + } + } + } + }) + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_basic_information + + override fun observeRequestState() { + equipmentViewModel.loadState.observe(this, { + when (it) { + LoadState.Loading -> LoadingDialogHub.show(requireActivity(), "数据加载中...") + else -> LoadingDialogHub.dismiss() + } + }) + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt new file mode 100644 index 0000000..0b4a747 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class CertificateFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_certificate + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt new file mode 100644 index 0000000..f05c491 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class ChangeRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_change_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt new file mode 100644 index 0000000..849ffa5 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class InspectionRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_inspection_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt new file mode 100644 index 0000000..aa4edd9 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class UsageRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_usage_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java b/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java new file mode 100644 index 0000000..0b9124e --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java @@ -0,0 +1,760 @@ +package com.casic.xz.meterage.model; + +import java.util.List; + +public class EquipmentDetailModel { + + private int code; + private DataModel data; + private String message; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataModel getData() { + return data; + } + + public void setData(DataModel data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public static class DataModel { + private String abc; + private String abcName; + private String assetNo; + private String assetSource; + private String assetType; + private String assetTypeName; + private String attribute; + private String capitalSource; + private String capitalSourceName; + private String cardEstablishmentDate; + private String createTime; + private String createUser; + private String depreciationMethod; + private String depreciationMethodName; + private String depreciationPeriod; + private String enableDate; + private String equipmentCategory; + private String equipmentCategoryName; + private String equipmentName; + private String equipmentNo; + private String equipmentSpecifications; + private String equipmentType; + private String equipmentTypeName; + private List fileList; + private String id; + private String installIncidentalExpenses; + private String installPlace; + private String intactState; + private String isCalibrationTestEquipment; + private int isDel; + private String isFixedAssets; + private String isMeasureAccount; + private String isStandardSupportEquipment; + private String labelBind; + private String majorCategory; + private String majorCategoryName; + private String managerLevel; + private String managerLevelName; + private String managerState; + private String managerStateName; + private String manufacturer; + private String manufacturerCountry; + private String manufacturingDate; + private String manufacturingNo; + private String mesureCycle; + private String mesureDate; + private String mesureDept; + private String mesureRange; + private String mesureResult; + private String mesureResultName; + private String mesureType; + private String mesureTypeName; + private String modelNo; + private String originValue; + private String overallDimension; + private String presentOriginValue; + private String purpose; + private String remark; + private String singlePrice; + private String supportStandardEquipmentName; + private String supportStandardEquipmentNo; + private String technicalLevel; + private String uncertainty; + private String updateTime; + private String useDept; + private String useDeptName; + private String usePerson; + private String usePersonName; + private String validDate; + private int version; + private String weight; + + public String getAbc() { + return abc; + } + + public void setAbc(String abc) { + this.abc = abc; + } + + public String getAbcName() { + return abcName; + } + + public void setAbcName(String abcName) { + this.abcName = abcName; + } + + public String getAssetNo() { + return assetNo; + } + + public void setAssetNo(String assetNo) { + this.assetNo = assetNo; + } + + public String getAssetSource() { + return assetSource; + } + + public void setAssetSource(String assetSource) { + this.assetSource = assetSource; + } + + public String getAssetType() { + return assetType; + } + + public void setAssetType(String assetType) { + this.assetType = assetType; + } + + public String getAssetTypeName() { + return assetTypeName; + } + + public void setAssetTypeName(String assetTypeName) { + this.assetTypeName = assetTypeName; + } + + public String getAttribute() { + return attribute; + } + + public void setAttribute(String attribute) { + this.attribute = attribute; + } + + public String getCapitalSource() { + return capitalSource; + } + + public void setCapitalSource(String capitalSource) { + this.capitalSource = capitalSource; + } + + public String getCapitalSourceName() { + return capitalSourceName; + } + + public void setCapitalSourceName(String capitalSourceName) { + this.capitalSourceName = capitalSourceName; + } + + public String getCardEstablishmentDate() { + return cardEstablishmentDate; + } + + public void setCardEstablishmentDate(String cardEstablishmentDate) { + this.cardEstablishmentDate = cardEstablishmentDate; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getDepreciationMethod() { + return depreciationMethod; + } + + public void setDepreciationMethod(String depreciationMethod) { + this.depreciationMethod = depreciationMethod; + } + + public String getDepreciationMethodName() { + return depreciationMethodName; + } + + public void setDepreciationMethodName(String depreciationMethodName) { + this.depreciationMethodName = depreciationMethodName; + } + + public String getDepreciationPeriod() { + return depreciationPeriod; + } + + public void setDepreciationPeriod(String depreciationPeriod) { + this.depreciationPeriod = depreciationPeriod; + } + + public String getEnableDate() { + return enableDate; + } + + public void setEnableDate(String enableDate) { + this.enableDate = enableDate; + } + + public String getEquipmentCategory() { + return equipmentCategory; + } + + public void setEquipmentCategory(String equipmentCategory) { + this.equipmentCategory = equipmentCategory; + } + + public String getEquipmentCategoryName() { + return equipmentCategoryName; + } + + public void setEquipmentCategoryName(String equipmentCategoryName) { + this.equipmentCategoryName = equipmentCategoryName; + } + + public String getEquipmentName() { + return equipmentName; + } + + public void setEquipmentName(String equipmentName) { + this.equipmentName = equipmentName; + } + + public String getEquipmentNo() { + return equipmentNo; + } + + public void setEquipmentNo(String equipmentNo) { + this.equipmentNo = equipmentNo; + } + + public String getEquipmentSpecifications() { + return equipmentSpecifications; + } + + public void setEquipmentSpecifications(String equipmentSpecifications) { + this.equipmentSpecifications = equipmentSpecifications; + } + + public String getEquipmentType() { + return equipmentType; + } + + public void setEquipmentType(String equipmentType) { + this.equipmentType = equipmentType; + } + + public String getEquipmentTypeName() { + return equipmentTypeName; + } + + public void setEquipmentTypeName(String equipmentTypeName) { + this.equipmentTypeName = equipmentTypeName; + } + + public List getFileList() { + return fileList; + } + + public void setFileList(List fileList) { + this.fileList = fileList; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getInstallIncidentalExpenses() { + return installIncidentalExpenses; + } + + public void setInstallIncidentalExpenses(String installIncidentalExpenses) { + this.installIncidentalExpenses = installIncidentalExpenses; + } + + public String getInstallPlace() { + return installPlace; + } + + public void setInstallPlace(String installPlace) { + this.installPlace = installPlace; + } + + public String getIntactState() { + return intactState; + } + + public void setIntactState(String intactState) { + this.intactState = intactState; + } + + public String getIsCalibrationTestEquipment() { + return isCalibrationTestEquipment; + } + + public void setIsCalibrationTestEquipment(String isCalibrationTestEquipment) { + this.isCalibrationTestEquipment = isCalibrationTestEquipment; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getIsFixedAssets() { + return isFixedAssets; + } + + public void setIsFixedAssets(String isFixedAssets) { + this.isFixedAssets = isFixedAssets; + } + + public String getIsMeasureAccount() { + return isMeasureAccount; + } + + public void setIsMeasureAccount(String isMeasureAccount) { + this.isMeasureAccount = isMeasureAccount; + } + + public String getIsStandardSupportEquipment() { + return isStandardSupportEquipment; + } + + public void setIsStandardSupportEquipment(String isStandardSupportEquipment) { + this.isStandardSupportEquipment = isStandardSupportEquipment; + } + + public String getLabelBind() { + return labelBind; + } + + public void setLabelBind(String labelBind) { + this.labelBind = labelBind; + } + + public String getMajorCategory() { + return majorCategory; + } + + public void setMajorCategory(String majorCategory) { + this.majorCategory = majorCategory; + } + + public String getMajorCategoryName() { + return majorCategoryName; + } + + public void setMajorCategoryName(String majorCategoryName) { + this.majorCategoryName = majorCategoryName; + } + + public String getManagerLevel() { + return managerLevel; + } + + public void setManagerLevel(String managerLevel) { + this.managerLevel = managerLevel; + } + + public String getManagerLevelName() { + return managerLevelName; + } + + public void setManagerLevelName(String managerLevelName) { + this.managerLevelName = managerLevelName; + } + + public String getManagerState() { + return managerState; + } + + public void setManagerState(String managerState) { + this.managerState = managerState; + } + + public String getManagerStateName() { + return managerStateName; + } + + public void setManagerStateName(String managerStateName) { + this.managerStateName = managerStateName; + } + + public String getManufacturer() { + return manufacturer; + } + + public void setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + } + + public String getManufacturerCountry() { + return manufacturerCountry; + } + + public void setManufacturerCountry(String manufacturerCountry) { + this.manufacturerCountry = manufacturerCountry; + } + + public String getManufacturingDate() { + return manufacturingDate; + } + + public void setManufacturingDate(String manufacturingDate) { + this.manufacturingDate = manufacturingDate; + } + + public String getManufacturingNo() { + return manufacturingNo; + } + + public void setManufacturingNo(String manufacturingNo) { + this.manufacturingNo = manufacturingNo; + } + + public String getMesureCycle() { + return mesureCycle; + } + + public void setMesureCycle(String mesureCycle) { + this.mesureCycle = mesureCycle; + } + + public String getMesureDate() { + return mesureDate; + } + + public void setMesureDate(String mesureDate) { + this.mesureDate = mesureDate; + } + + public String getMesureDept() { + return mesureDept; + } + + public void setMesureDept(String mesureDept) { + this.mesureDept = mesureDept; + } + + public String getMesureRange() { + return mesureRange; + } + + public void setMesureRange(String mesureRange) { + this.mesureRange = mesureRange; + } + + public String getMesureResult() { + return mesureResult; + } + + public void setMesureResult(String mesureResult) { + this.mesureResult = mesureResult; + } + + public String getMesureResultName() { + return mesureResultName; + } + + public void setMesureResultName(String mesureResultName) { + this.mesureResultName = mesureResultName; + } + + public String getMesureType() { + return mesureType; + } + + public void setMesureType(String mesureType) { + this.mesureType = mesureType; + } + + public String getMesureTypeName() { + return mesureTypeName; + } + + public void setMesureTypeName(String mesureTypeName) { + this.mesureTypeName = mesureTypeName; + } + + public String getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getOriginValue() { + return originValue; + } + + public void setOriginValue(String originValue) { + this.originValue = originValue; + } + + public String getOverallDimension() { + return overallDimension; + } + + public void setOverallDimension(String overallDimension) { + this.overallDimension = overallDimension; + } + + public String getPresentOriginValue() { + return presentOriginValue; + } + + public void setPresentOriginValue(String presentOriginValue) { + this.presentOriginValue = presentOriginValue; + } + + public String getPurpose() { + return purpose; + } + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getSinglePrice() { + return singlePrice; + } + + public void setSinglePrice(String singlePrice) { + this.singlePrice = singlePrice; + } + + public String getSupportStandardEquipmentName() { + return supportStandardEquipmentName; + } + + public void setSupportStandardEquipmentName(String supportStandardEquipmentName) { + this.supportStandardEquipmentName = supportStandardEquipmentName; + } + + public String getSupportStandardEquipmentNo() { + return supportStandardEquipmentNo; + } + + public void setSupportStandardEquipmentNo(String supportStandardEquipmentNo) { + this.supportStandardEquipmentNo = supportStandardEquipmentNo; + } + + public String getTechnicalLevel() { + return technicalLevel; + } + + public void setTechnicalLevel(String technicalLevel) { + this.technicalLevel = technicalLevel; + } + + public String getUncertainty() { + return uncertainty; + } + + public void setUncertainty(String uncertainty) { + this.uncertainty = uncertainty; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getUseDept() { + return useDept; + } + + public void setUseDept(String useDept) { + this.useDept = useDept; + } + + public String getUseDeptName() { + return useDeptName; + } + + public void setUseDeptName(String useDeptName) { + this.useDeptName = useDeptName; + } + + public String getUsePerson() { + return usePerson; + } + + public void setUsePerson(String usePerson) { + this.usePerson = usePerson; + } + + public String getUsePersonName() { + return usePersonName; + } + + public void setUsePersonName(String usePersonName) { + this.usePersonName = usePersonName; + } + + public String getValidDate() { + return validDate; + } + + public void setValidDate(String validDate) { + this.validDate = validDate; + } + + public int getVersion() { + return version; + } + + public void setVersion(int version) { + this.version = version; + } + + public String getWeight() { + return weight; + } + + public void setWeight(String weight) { + this.weight = weight; + } + + public static class FileListModel { + private String assetId; + private String createTime; + private String createUser; + private String fileName; + private String id; + private int isDel; + private String minioFileName; + private String remark; + private String updateTime; + + public String getAssetId() { + return assetId; + } + + public void setAssetId(String assetId) { + this.assetId = assetId; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getFileName() { + return fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getMinioFileName() { + return minioFileName; + } + + public void setMinioFileName(String minioFileName) { + this.minioFileName = minioFileName; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + } + } +} diff --git a/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java b/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java new file mode 100644 index 0000000..15fc128 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java @@ -0,0 +1,697 @@ +package com.casic.xz.meterage.model; + +import java.util.List; + +public class EquipmentListModel { + + private int code; + private DataModel data; + private String message; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataModel getData() { + return data; + } + + public void setData(DataModel data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public static class DataModel { + private List rows; + private int total; + + public List getRows() { + return rows; + } + + public void setRows(List rows) { + this.rows = rows; + } + + public int getTotal() { + return total; + } + + public void setTotal(int total) { + this.total = total; + } + + public static class RowsModel { + private String abc; + private String abcName; + private String assetNo; + private String assetSource; + private String assetType; + private String assetTypeName; + private String attribute; + private String capitalSource; + private String capitalSourceName; + private String cardEstablishmentDate; + private String createTime; + private String createUser; + private String depreciationMethod; + private String depreciationMethodName; + private String depreciationPeriod; + private String enableDate; + private String equipmentCategory; + private String equipmentCategoryName; + private String equipmentName; + private String equipmentNo; + private String equipmentSpecifications; + private String equipmentType; + private String equipmentTypeName; + private String fileList; + private String id; + private String installIncidentalExpenses; + private String installPlace; + private String intactState; + private String isCalibrationTestEquipment; + private int isDel; + private String isFixedAssets; + private String isMeasureAccount; + private String isStandardSupportEquipment; + private String labelBind; + private String majorCategory; + private String majorCategoryName; + private String managerLevel; + private String managerLevelName; + private String managerState; + private String managerStateName; + private String manufacturer; + private String manufacturerCountry; + private String manufacturingDate; + private String manufacturingNo; + private String mesureCycle; + private String mesureDate; + private String mesureDept; + private String mesureRange; + private String mesureResult; + private String mesureResultName; + private String mesureType; + private String mesureTypeName; + private String modelNo; + private String originValue; + private String overallDimension; + private String presentOriginValue; + private String purpose; + private String remark; + private String singlePrice; + private String supportStandardEquipmentName; + private String supportStandardEquipmentNo; + private String technicalLevel; + private String uncertainty; + private String updateTime; + private String useDept; + private String useDeptName; + private String usePerson; + private String usePersonName; + private String validDate; + private int version; + private String weight; + + public String getAbc() { + return abc; + } + + public void setAbc(String abc) { + this.abc = abc; + } + + public String getAbcName() { + return abcName; + } + + public void setAbcName(String abcName) { + this.abcName = abcName; + } + + public String getAssetNo() { + return assetNo; + } + + public void setAssetNo(String assetNo) { + this.assetNo = assetNo; + } + + public String getAssetSource() { + return assetSource; + } + + public void setAssetSource(String assetSource) { + this.assetSource = assetSource; + } + + public String getAssetType() { + return assetType; + } + + public void setAssetType(String assetType) { + this.assetType = assetType; + } + + public String getAssetTypeName() { + return assetTypeName; + } + + public void setAssetTypeName(String assetTypeName) { + this.assetTypeName = assetTypeName; + } + + public String getAttribute() { + return attribute; + } + + public void setAttribute(String attribute) { + this.attribute = attribute; + } + + public String getCapitalSource() { + return capitalSource; + } + + public void setCapitalSource(String capitalSource) { + this.capitalSource = capitalSource; + } + + public String getCapitalSourceName() { + return capitalSourceName; + } + + public void setCapitalSourceName(String capitalSourceName) { + this.capitalSourceName = capitalSourceName; + } + + public String getCardEstablishmentDate() { + return cardEstablishmentDate; + } + + public void setCardEstablishmentDate(String cardEstablishmentDate) { + this.cardEstablishmentDate = cardEstablishmentDate; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getDepreciationMethod() { + return depreciationMethod; + } + + public void setDepreciationMethod(String depreciationMethod) { + this.depreciationMethod = depreciationMethod; + } + + public String getDepreciationMethodName() { + return depreciationMethodName; + } + + public void setDepreciationMethodName(String depreciationMethodName) { + this.depreciationMethodName = depreciationMethodName; + } + + public String getDepreciationPeriod() { + return depreciationPeriod; + } + + public void setDepreciationPeriod(String depreciationPeriod) { + this.depreciationPeriod = depreciationPeriod; + } + + public String getEnableDate() { + return enableDate; + } + + public void setEnableDate(String enableDate) { + this.enableDate = enableDate; + } + + public String getEquipmentCategory() { + return equipmentCategory; + } + + public void setEquipmentCategory(String equipmentCategory) { + this.equipmentCategory = equipmentCategory; + } + + public String getEquipmentCategoryName() { + return equipmentCategoryName; + } + + public void setEquipmentCategoryName(String equipmentCategoryName) { + this.equipmentCategoryName = equipmentCategoryName; + } + + public String getEquipmentName() { + return equipmentName; + } + + public void setEquipmentName(String equipmentName) { + this.equipmentName = equipmentName; + } + + public String getEquipmentNo() { + return equipmentNo; + } + + public void setEquipmentNo(String equipmentNo) { + this.equipmentNo = equipmentNo; + } + + public String getEquipmentSpecifications() { + return equipmentSpecifications; + } + + public void setEquipmentSpecifications(String equipmentSpecifications) { + this.equipmentSpecifications = equipmentSpecifications; + } + + public String getEquipmentType() { + return equipmentType; + } + + public void setEquipmentType(String equipmentType) { + this.equipmentType = equipmentType; + } + + public String getEquipmentTypeName() { + return equipmentTypeName; + } + + public void setEquipmentTypeName(String equipmentTypeName) { + this.equipmentTypeName = equipmentTypeName; + } + + public String getFileList() { + return fileList; + } + + public void setFileList(String fileList) { + this.fileList = fileList; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getInstallIncidentalExpenses() { + return installIncidentalExpenses; + } + + public void setInstallIncidentalExpenses(String installIncidentalExpenses) { + this.installIncidentalExpenses = installIncidentalExpenses; + } + + public String getInstallPlace() { + return installPlace; + } + + public void setInstallPlace(String installPlace) { + this.installPlace = installPlace; + } + + public String getIntactState() { + return intactState; + } + + public void setIntactState(String intactState) { + this.intactState = intactState; + } + + public String getIsCalibrationTestEquipment() { + return isCalibrationTestEquipment; + } + + public void setIsCalibrationTestEquipment(String isCalibrationTestEquipment) { + this.isCalibrationTestEquipment = isCalibrationTestEquipment; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getIsFixedAssets() { + return isFixedAssets; + } + + public void setIsFixedAssets(String isFixedAssets) { + this.isFixedAssets = isFixedAssets; + } + + public String getIsMeasureAccount() { + return isMeasureAccount; + } + + public void setIsMeasureAccount(String isMeasureAccount) { + this.isMeasureAccount = isMeasureAccount; + } + + public String getIsStandardSupportEquipment() { + return isStandardSupportEquipment; + } + + public void setIsStandardSupportEquipment(String isStandardSupportEquipment) { + this.isStandardSupportEquipment = isStandardSupportEquipment; + } + + public String getLabelBind() { + return labelBind; + } + + public void setLabelBind(String labelBind) { + this.labelBind = labelBind; + } + + public String getMajorCategory() { + return majorCategory; + } + + public void setMajorCategory(String majorCategory) { + this.majorCategory = majorCategory; + } + + public String getMajorCategoryName() { + return majorCategoryName; + } + + public void setMajorCategoryName(String majorCategoryName) { + this.majorCategoryName = majorCategoryName; + } + + public String getManagerLevel() { + return managerLevel; + } + + public void setManagerLevel(String managerLevel) { + this.managerLevel = managerLevel; + } + + public String getManagerLevelName() { + return managerLevelName; + } + + public void setManagerLevelName(String managerLevelName) { + this.managerLevelName = managerLevelName; + } + + public String getManagerState() { + return managerState; + } + + public void setManagerState(String managerState) { + this.managerState = managerState; + } + + public String getManagerStateName() { + return managerStateName; + } + + public void setManagerStateName(String managerStateName) { + this.managerStateName = managerStateName; + } + + public String getManufacturer() { + return manufacturer; + } + + public void setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + } + + public String getManufacturerCountry() { + return manufacturerCountry; + } + + public void setManufacturerCountry(String manufacturerCountry) { + this.manufacturerCountry = manufacturerCountry; + } + + public String getManufacturingDate() { + return manufacturingDate; + } + + public void setManufacturingDate(String manufacturingDate) { + this.manufacturingDate = manufacturingDate; + } + + public String getManufacturingNo() { + return manufacturingNo; + } + + public void setManufacturingNo(String manufacturingNo) { + this.manufacturingNo = manufacturingNo; + } + + public String getMesureCycle() { + return mesureCycle; + } + + public void setMesureCycle(String mesureCycle) { + this.mesureCycle = mesureCycle; + } + + public String getMesureDate() { + return mesureDate; + } + + public void setMesureDate(String mesureDate) { + this.mesureDate = mesureDate; + } + + public String getMesureDept() { + return mesureDept; + } + + public void setMesureDept(String mesureDept) { + this.mesureDept = mesureDept; + } + + public String getMesureRange() { + return mesureRange; + } + + public void setMesureRange(String mesureRange) { + this.mesureRange = mesureRange; + } + + public String getMesureResult() { + return mesureResult; + } + + public void setMesureResult(String mesureResult) { + this.mesureResult = mesureResult; + } + + public String getMesureResultName() { + return mesureResultName; + } + + public void setMesureResultName(String mesureResultName) { + this.mesureResultName = mesureResultName; + } + + public String getMesureType() { + return mesureType; + } + + public void setMesureType(String mesureType) { + this.mesureType = mesureType; + } + + public String getMesureTypeName() { + return mesureTypeName; + } + + public void setMesureTypeName(String mesureTypeName) { + this.mesureTypeName = mesureTypeName; + } + + public String getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getOriginValue() { + return originValue; + } + + public void setOriginValue(String originValue) { + this.originValue = originValue; + } + + public String getOverallDimension() { + return overallDimension; + } + + public void setOverallDimension(String overallDimension) { + this.overallDimension = overallDimension; + } + + public String getPresentOriginValue() { + return presentOriginValue; + } + + public void setPresentOriginValue(String presentOriginValue) { + this.presentOriginValue = presentOriginValue; + } + + public String getPurpose() { + return purpose; + } + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getSinglePrice() { + return singlePrice; + } + + public void setSinglePrice(String singlePrice) { + this.singlePrice = singlePrice; + } + + public String getSupportStandardEquipmentName() { + return supportStandardEquipmentName; + } + + public void setSupportStandardEquipmentName(String supportStandardEquipmentName) { + this.supportStandardEquipmentName = supportStandardEquipmentName; + } + + public String getSupportStandardEquipmentNo() { + return supportStandardEquipmentNo; + } + + public void setSupportStandardEquipmentNo(String supportStandardEquipmentNo) { + this.supportStandardEquipmentNo = supportStandardEquipmentNo; + } + + public String getTechnicalLevel() { + return technicalLevel; + } + + public void setTechnicalLevel(String technicalLevel) { + this.technicalLevel = technicalLevel; + } + + public String getUncertainty() { + return uncertainty; + } + + public void setUncertainty(String uncertainty) { + this.uncertainty = uncertainty; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getUseDept() { + return useDept; + } + + public void setUseDept(String useDept) { + this.useDept = useDept; + } + + public String getUseDeptName() { + return useDeptName; + } + + public void setUseDeptName(String useDeptName) { + this.useDeptName = useDeptName; + } + + public String getUsePerson() { + return usePerson; + } + + public void setUsePerson(String usePerson) { + this.usePerson = usePerson; + } + + public String getUsePersonName() { + return usePersonName; + } + + public void setUsePersonName(String usePersonName) { + this.usePersonName = usePersonName; + } + + public String getValidDate() { + return validDate; + } + + public void setValidDate(String validDate) { + this.validDate = validDate; + } + + public int getVersion() { + return version; + } + + public void setVersion(int version) { + this.version = version; + } + + public String getWeight() { + return weight; + } + + public void setWeight(String weight) { + this.weight = weight; + } + } + } +} diff --git a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt index a3f514f..46e5eef 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt @@ -35,4 +35,24 @@ @QueryMap limit: Map, @QueryMap offset: Map ): String + + /** + * 获取设备列表 + */ + @POST("/meter/assets/listPage") + suspend fun getEquipmentList( + @Header("token") token: String, + @Body requestBody: RequestBody, + @QueryMap limit: Map, + @QueryMap offset: Map + ): String + + /** + * 获取设备详情 + */ + @POST("/meter/assets/detail") + suspend fun getEquipmentDetail( + @Header("token") token: String, + @Body requestBody: RequestBody + ): String } \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt index 444a872..386a1d8 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt @@ -6,8 +6,10 @@ import com.pengxh.kt.lite.utils.SaveKeyValues import okhttp3.MediaType.Companion.toMediaType import okhttp3.RequestBody.Companion.toRequestBody +import org.json.JSONArray import org.json.JSONObject + object RetrofitServiceManager { private val api by lazy { @@ -73,4 +75,71 @@ offsetMap["offset"] = offset return api.getNoticeList(AuthenticationHelper.token!!, requestBody, limitMap, offsetMap) } + + /** + * 获取设备列表 + */ + suspend fun getEquipmentList( + equipmentNo: String, + equipmentName: String, + mesureType: String, + managerState: String, + useDept: String, + assetType: String, + equipmentCategory: String, + isCalibrationTestEquipment: String, + isMeasureAccount: String, + isStandardSupportEquipment: String, + isFixedAssets: String, + validStartDate: String, + validEndDate: String, + abc: String, + ids: Array, + offset: Int + ): String { + val paramObject = JSONObject() + paramObject.put("equipmentNo", equipmentNo) + paramObject.put("equipmentName", equipmentName) + paramObject.put("mesureType", mesureType) + paramObject.put("managerState", managerState) + paramObject.put("useDept", useDept) + paramObject.put("assetType", assetType) + paramObject.put("equipmentCategory", equipmentCategory) + paramObject.put("isCalibrationTestEquipment", isCalibrationTestEquipment) + paramObject.put("isMeasureAccount", isMeasureAccount) + paramObject.put("isStandardSupportEquipment", isStandardSupportEquipment) + paramObject.put("isFixedAssets", isFixedAssets) + paramObject.put("validStartDate", validStartDate) + paramObject.put("validEndDate", validEndDate) + paramObject.put("abc", abc) + + val jsonArray = JSONArray() + ids.forEach { + jsonArray.put(it) + } + paramObject.put("ids", jsonArray) + + val requestBody = paramObject.toString().toRequestBody( + "application/json;charset=UTF-8".toMediaType() + ) + + val limitMap = HashMap() + limitMap["limit"] = LocaleConstant.PAGE_LIMIT + + val offsetMap = HashMap() + offsetMap["offset"] = offset + return api.getEquipmentList(AuthenticationHelper.token!!, requestBody, limitMap, offsetMap) + } + + /** + * 获取设备详情 + */ + suspend fun getEquipmentDetail(id: String): String { + val paramObject = JSONObject() + paramObject.put("id", id) + val requestBody = paramObject.toString().toRequestBody( + "application/json;charset=UTF-8".toMediaType() + ) + return api.getEquipmentDetail(AuthenticationHelper.token!!, requestBody) + } } \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt deleted file mode 100644 index a5bb60b..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt +++ /dev/null @@ -1,104 +0,0 @@ -package com.casic.xz.meterage.view - -import android.annotation.SuppressLint -import android.graphics.Paint -import androidx.lifecycle.ViewModelProvider -import com.casic.xz.meterage.R -import com.casic.xz.meterage.extensions.combineImagePath -import com.casic.xz.meterage.extensions.formatTextFromHtml -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.vm.NoticeViewModel -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.extensions.convertColor -import com.pengxh.kt.lite.extensions.navigatePageTo -import com.pengxh.kt.lite.extensions.obtainScreenWidth -import com.pengxh.kt.lite.extensions.show -import com.pengxh.kt.lite.utils.Constant -import kotlinx.android.synthetic.main.activity_notice_detail.* -import kotlinx.android.synthetic.main.include_base_title.* -import java.util.* - -@SuppressLint("SetTextI18n") -class NoticeDetailActivity : KotlinBaseActivity() { - - private lateinit var noticeViewModel: NoticeViewModel - - override fun initData() { - leftBackView.setOnClickListener { finish() } - titleView.text = "通知公告" - - val args = intent.getStringArrayListExtra(Constant.INTENT_PARAM)!! - - noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] - noticeViewModel.getNoticeList(args[0], args[1], args[2], "", "", 1) - noticeViewModel.noticeResult.observe(this, { - if (it.code == 200) { - val dataRow = it.data?.rows!![0] - - noticeDateView.text = dataRow.noticeTime - noticePublisherView.text = "发布人 ${dataRow.noticePublisher}" - noticeCompanyView.text = "发布单位 ${dataRow.noticeCompany}" - - noticeNoView.text = dataRow.noticeNo - noticeTitleView.text = dataRow.noticeTitle - noticeSketchView.text = dataRow.noticeSketch - - dataRow.noticeContent.formatTextFromHtml( - this, noticeContentView, obtainScreenWidth() - ) - - if (dataRow.minioFileName.isNullOrBlank()) { - minioFileView.text = "暂无附件" - } else { - val minioFileName = dataRow.minioFileName - - minioFileView.text = minioFileName - val textPaint = minioFileView.paint - textPaint.flags = Paint.UNDERLINE_TEXT_FLAG - textPaint.isAntiAlias = true - minioFileView.setTextColor(R.color.themeColor.convertColor(this)) - - minioFileView.setOnClickListener { - //查看附件 - if (minioFileName.endsWith("pdf")) { - navigatePageTo(minioFileName) - } else if ( - minioFileName.endsWith("doc") || - minioFileName.endsWith("docx") - ) { - navigatePageTo(minioFileName) - } else if (minioFileName.endsWith("txt")) { - navigatePageTo(minioFileName) - } else if ( - minioFileName.endsWith("png") || - minioFileName.endsWith("jpeg") || - minioFileName.endsWith("jpg") - ) { - val urls = ArrayList() - urls.add(minioFileName.combineImagePath()) - navigatePageTo(0, urls) - } else { - "文件类型未知,无法打开附件".show(this) - } - } - } - } - }) - } - - override fun initEvent() { - - } - - override fun initLayoutView(): Int = R.layout.activity_notice_detail - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/NoticeListActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/NoticeListActivity.kt deleted file mode 100644 index 15f6a16..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/NoticeListActivity.kt +++ /dev/null @@ -1,180 +0,0 @@ -package com.casic.xz.meterage.view - -import android.os.Handler -import android.util.Log -import android.view.View -import androidx.lifecycle.ViewModelProvider -import com.casic.xz.meterage.R -import com.casic.xz.meterage.adapter.NoticeListAdapter -import com.casic.xz.meterage.extensions.addAll -import com.casic.xz.meterage.extensions.combineFilePath -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.extensions.showEmptyPage -import com.casic.xz.meterage.model.NoticeListModel -import com.casic.xz.meterage.vm.NoticeViewModel -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.extensions.navigatePageTo -import com.pengxh.kt.lite.extensions.show -import com.pengxh.kt.lite.utils.WeakReferenceHandler -import com.pengxh.kt.lite.widget.dialog.AlertControlDialog -import kotlinx.android.synthetic.main.activity_notice_list.* -import kotlinx.android.synthetic.main.include_empty_view.* - -class NoticeListActivity : KotlinBaseActivity() { - - private lateinit var weakReferenceHandler: WeakReferenceHandler - private lateinit var noticeViewModel: NoticeViewModel - private lateinit var noticeListAdapter: NoticeListAdapter - private var dataBeans: MutableList = ArrayList() - private var pageIndex = 1 - private var isRefresh = false - private var isLoadMore = false - - override fun initData() { - weakReferenceHandler = WeakReferenceHandler(callback) - noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] - noticeViewModel.noticeResult.observe(this, { - if (it.code == 200) { - val dataRows = it.data?.rows!! -// countBadeNumber(dataRows) - when { - isRefresh -> { - dataBeans.clear() - dataBeans = dataRows - noticeLayout.finishRefresh() - isRefresh = false - } - isLoadMore -> { - if (dataRows.size == 0) { - "到底了,别拉了".show(this) - } - dataBeans.addAll(dataRows) - noticeLayout.finishLoadMore() - isLoadMore = false - } - else -> { - dataBeans = dataRows - } - } - weakReferenceHandler.sendEmptyMessage(2023013101) - } - }) - } - - override fun initEvent() { - leftBackView.setOnClickListener { finish() } - rightOperateView.setOnClickListener { - AlertControlDialog.Builder() - .setContext(this) - .setTitle("提示") - .setMessage("确定将所有未读消息标为已读?") - .setNegativeButton("取消") - .setPositiveButton("确定") - .setOnDialogButtonClickListener(object : - AlertControlDialog.OnDialogButtonClickListener { - override fun onCancelClick() { - - } - - override fun onConfirmClick() { - //TODO 设置为已读 - } - }).build().show() - } - - if (hasNoticePermission()) { - openSystemNoticeLayout.visibility = View.GONE - openSystemNoticeLayout.visibility = View.GONE - } else { - openSystemNoticeLayout.setOnClickListener { - - } - - - closeLayoutView.setOnClickListener { - openSystemNoticeLayout.visibility = View.GONE - } - } - - noticeLayout.setOnRefreshListener { - isRefresh = true - //刷新之后页码重置 - pageIndex = 1 - getNoticeListByPage() - } - - noticeLayout.setOnLoadMoreListener { - isLoadMore = true - pageIndex++ - getNoticeListByPage() - } - } - - override fun onResume() { - super.onResume() - pageIndex = 1 - getNoticeListByPage() - } - - private fun getNoticeListByPage() { - noticeViewModel.getNoticeList("", "", "", "", "", pageIndex) - } - - private val callback = Handler.Callback { - when (it.what) { - 2023013101 -> { - if (isRefresh || isLoadMore) { - noticeListAdapter.notifyDataSetChanged() - } else { - if (dataBeans.size == 0) { - emptyView!!.showEmptyPage("没有任何消息") { - pageIndex = 1 - getNoticeListByPage() - } - } else { - emptyView!!.hide() - noticeListAdapter = NoticeListAdapter(this, dataBeans) - noticeRecyclerView.adapter = noticeListAdapter - noticeListAdapter.setOnItemClickListener(object : - NoticeListAdapter.OnItemClickListener { - override fun onItemClicked(position: Int) { - val rowsModel = dataBeans[position] - val allArgs = addAll( - rowsModel.noticeNo, - rowsModel.noticeTitle, - rowsModel.noticePublisher, - "", - "" - ) - Log.d( - "Casic", - "NoticeListActivity => onItemClicked: ${rowsModel.minioFileName.combineFilePath()}" - ) - navigatePageTo(allArgs) - } - }) - } - } - } - } - true - } - - //TODO 判断是否开启通知权限 - private fun hasNoticePermission(): Boolean { - - return false - } - - override fun initLayoutView(): Int = R.layout.activity_notice_list - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/PreviewDocumentActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/PreviewDocumentActivity.kt deleted file mode 100644 index e233ddc..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/PreviewDocumentActivity.kt +++ /dev/null @@ -1,24 +0,0 @@ -package com.casic.xz.meterage.view - -import com.casic.xz.meterage.R -import com.pengxh.kt.lite.base.KotlinBaseActivity - -class PreviewDocumentActivity : KotlinBaseActivity() { - override fun initData() { - - } - - override fun initEvent() { - - } - - override fun initLayoutView(): Int = R.layout.activity_preview_doc - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/PreviewPdfActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/PreviewPdfActivity.kt deleted file mode 100644 index 39f8ac2..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/PreviewPdfActivity.kt +++ /dev/null @@ -1,62 +0,0 @@ -package com.casic.xz.meterage.view - -import com.casic.xz.meterage.R -import com.casic.xz.meterage.extensions.combineFilePath -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.utils.LoadingDialogHub -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.callback.OnDownloadListener -import com.pengxh.kt.lite.extensions.createDownloadFileDir -import com.pengxh.kt.lite.extensions.downloadFile -import com.pengxh.kt.lite.utils.Constant -import kotlinx.android.synthetic.main.activity_preview_pdf.* -import kotlinx.android.synthetic.main.include_base_title.* -import java.io.File -import java.io.FileInputStream - - -class PreviewPdfActivity : KotlinBaseActivity() { - - override fun initData() { - val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! - titleView.text = minioFileName - - val url = minioFileName.combineFilePath() - url.downloadFile(createDownloadFileDir().toString(), - object : OnDownloadListener { - override fun onDownloadStart(totalBytes: Long) { - runOnUiThread { - LoadingDialogHub.show(this@PreviewPdfActivity, "附件加载中") - } - } - - override fun onProgressChanged(currentBytes: Long) { - - } - - override fun onDownloadEnd(file: File?) { - runOnUiThread { - LoadingDialogHub.dismiss() - } - val inputStream = FileInputStream(file) - pdfView.fromStream(inputStream).load() - } - }) - } - - override fun initEvent() { - leftBackView.setOnClickListener { finish() } - } - - override fun initLayoutView(): Int = R.layout.activity_preview_pdf - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/PreviewTextActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/PreviewTextActivity.kt deleted file mode 100644 index d634ca3..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/PreviewTextActivity.kt +++ /dev/null @@ -1,60 +0,0 @@ -package com.casic.xz.meterage.view - -import com.casic.xz.meterage.R -import com.casic.xz.meterage.extensions.combineFilePath -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.utils.LoadingDialogHub -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.callback.OnDownloadListener -import com.pengxh.kt.lite.extensions.createDownloadFileDir -import com.pengxh.kt.lite.extensions.downloadFile -import com.pengxh.kt.lite.extensions.read -import com.pengxh.kt.lite.utils.Constant -import kotlinx.android.synthetic.main.activity_preview_txt.* -import kotlinx.android.synthetic.main.include_base_title.* -import java.io.File - -class PreviewTextActivity : KotlinBaseActivity() { - - override fun initData() { - val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! - titleView.text = minioFileName - - val url = minioFileName.combineFilePath() - url.downloadFile(createDownloadFileDir().toString(), - object : OnDownloadListener { - override fun onDownloadStart(totalBytes: Long) { - runOnUiThread { - LoadingDialogHub.show(this@PreviewTextActivity, "附件加载中") - } - } - - override fun onProgressChanged(currentBytes: Long) { - - } - - override fun onDownloadEnd(file: File?) { - runOnUiThread { - LoadingDialogHub.dismiss() - textView.text = file?.read() - } - } - }) - } - - override fun initEvent() { - leftBackView.setOnClickListener { finish() } - } - - override fun initLayoutView(): Int = R.layout.activity_preview_txt - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentActivity.kt new file mode 100644 index 0000000..35ca098 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentActivity.kt @@ -0,0 +1,158 @@ +package com.casic.xz.meterage.view.home + +import android.os.Handler +import androidx.lifecycle.ViewModelProvider +import androidx.recyclerview.widget.DividerItemDecoration +import com.casic.xz.meterage.R +import com.casic.xz.meterage.adapter.EquipmentListAdapter +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.extensions.showEmptyPage +import com.casic.xz.meterage.model.EquipmentListModel +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.casic.xz.meterage.vm.EquipmentViewModel +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.extensions.navigatePageTo +import com.pengxh.kt.lite.extensions.show +import com.pengxh.kt.lite.utils.WeakReferenceHandler +import com.pengxh.kt.lite.vm.LoadState +import kotlinx.android.synthetic.main.activity_equipment.* +import kotlinx.android.synthetic.main.include_empty_view.* +import kotlinx.android.synthetic.main.include_search_title.* + +class EquipmentActivity : KotlinBaseActivity() { + + private lateinit var weakReferenceHandler: WeakReferenceHandler + private lateinit var equipmentViewModel: EquipmentViewModel + private lateinit var equipmentListAdapter: EquipmentListAdapter + private var dataBeans: MutableList = ArrayList() + private var pageIndex = 1 + private var isRefresh = false + private var isLoadMore = false + + override fun initData() { + weakReferenceHandler = WeakReferenceHandler(callback) + equipmentViewModel = ViewModelProvider(this)[EquipmentViewModel::class.java] + equipmentViewModel.equipmentResult.observe(this, { + if (it.code == 200) { + val dataRows = it.data?.rows!! + when { + isRefresh -> { + dataBeans.clear() + dataBeans = dataRows + equipmentLayout.finishRefresh() + isRefresh = false + } + isLoadMore -> { + if (dataRows.size == 0) { + "到底了,别拉了".show(this) + } + dataBeans.addAll(dataRows) + equipmentLayout.finishLoadMore() + isLoadMore = false + } + else -> { + dataBeans = dataRows + } + } + weakReferenceHandler.sendEmptyMessage(2023020801) + } + }) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + rightOperateView.setOnClickListener { + + } + + equipmentLayout.setOnRefreshListener { + isRefresh = true + //刷新之后页码重置 + pageIndex = 1 + getEquipmentListByPage() + } + + equipmentLayout.setOnLoadMoreListener { + isLoadMore = true + pageIndex++ + getEquipmentListByPage() + } + } + + override fun initLayoutView(): Int = R.layout.activity_equipment + + override fun observeRequestState() { + equipmentViewModel.loadState.observe(this, { + when (it) { + LoadState.Loading -> LoadingDialogHub.show(this, "数据加载中...") + else -> LoadingDialogHub.dismiss() + } + }) + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + titleView.text = "仪器设备" + } + + override fun onResume() { + super.onResume() + pageIndex = 1 + getEquipmentListByPage() + } + + private fun getEquipmentListByPage() { + equipmentViewModel.getEquipmentList( + "", + "", + "", + "", + "", + "1", + "", + "", + "", + "", + "", + "", + "", + "", + arrayOf(), + pageIndex + ) + } + + private val callback = Handler.Callback { + when (it.what) { + 2023020801 -> { + if (isRefresh || isLoadMore) { + equipmentListAdapter.notifyDataSetChanged() + } else { + if (dataBeans.size == 0) { + emptyView!!.showEmptyPage("无设备") { + pageIndex = 1 + getEquipmentListByPage() + } + } else { + emptyView!!.hide() + equipmentListAdapter = EquipmentListAdapter(this, dataBeans) + equipmentRecyclerView.addItemDecoration( + DividerItemDecoration(this, DividerItemDecoration.VERTICAL) + ) + equipmentRecyclerView.adapter = equipmentListAdapter + equipmentListAdapter.setOnItemClickListener(object : + EquipmentListAdapter.OnItemClickListener { + override fun onItemClicked(position: Int) { + val rowsModel = dataBeans[position] + navigatePageTo(rowsModel.id) + } + }) + } + } + } + } + true + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentDetailActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentDetailActivity.kt new file mode 100644 index 0000000..7dee13c --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentDetailActivity.kt @@ -0,0 +1,53 @@ +package com.casic.xz.meterage.view.home + +import androidx.fragment.app.Fragment +import com.casic.xz.meterage.R +import com.casic.xz.meterage.adapter.SubViewPagerAdapter +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.fragment.equipment.* +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.utils.Constant +import kotlinx.android.synthetic.main.activity_equipment.rootView +import kotlinx.android.synthetic.main.activity_equipment_detail.* +import kotlinx.android.synthetic.main.include_base_title.* + +class EquipmentDetailActivity : KotlinBaseActivity() { + + private var fragmentPages: ArrayList = ArrayList() + + override fun initData() { + val equipmentId = intent.getStringExtra(Constant.INTENT_PARAM)!! + + fragmentPages.add(BasicInformationFragment(equipmentId)) + fragmentPages.add(InspectionRecordFragment()) + fragmentPages.add(ChangeRecordFragment()) + fragmentPages.add(UsageRecordFragment()) + fragmentPages.add(CertificateFragment()) + + val equipmentPageTitles = arrayOf("基础信息", "周检记录", "状态变更记录", "使用记录", "检定证书") + + equipmentViewPager.adapter = SubViewPagerAdapter( + supportFragmentManager, fragmentPages, equipmentPageTitles + ) + equipmentViewPager.offscreenPageLimit = fragmentPages.size + //绑定 + topTabLayout.setupWithViewPager(equipmentViewPager) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + } + + override fun initLayoutView(): Int = R.layout.activity_equipment_detail + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + titleView.text = "仪器设备" + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeDetailActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeDetailActivity.kt new file mode 100644 index 0000000..6fe0022 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeDetailActivity.kt @@ -0,0 +1,105 @@ +package com.casic.xz.meterage.view.notice + +import android.annotation.SuppressLint +import android.graphics.Paint +import androidx.lifecycle.ViewModelProvider +import com.casic.xz.meterage.R +import com.casic.xz.meterage.extensions.combineImagePath +import com.casic.xz.meterage.extensions.formatTextFromHtml +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.view.BigImageActivity +import com.casic.xz.meterage.vm.NoticeViewModel +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.extensions.convertColor +import com.pengxh.kt.lite.extensions.navigatePageTo +import com.pengxh.kt.lite.extensions.obtainScreenWidth +import com.pengxh.kt.lite.extensions.show +import com.pengxh.kt.lite.utils.Constant +import kotlinx.android.synthetic.main.activity_notice_detail.* +import kotlinx.android.synthetic.main.include_base_title.* +import java.util.* + +@SuppressLint("SetTextI18n") +class NoticeDetailActivity : KotlinBaseActivity() { + + private lateinit var noticeViewModel: NoticeViewModel + + override fun initData() { + leftBackView.setOnClickListener { finish() } + titleView.text = "通知公告" + + val args = intent.getStringArrayListExtra(Constant.INTENT_PARAM)!! + + noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] + noticeViewModel.getNoticeList(args[0], args[1], args[2], "", "", 1) + noticeViewModel.noticeResult.observe(this, { + if (it.code == 200) { + val dataRow = it.data?.rows!![0] + + noticeDateView.text = dataRow.noticeTime + noticePublisherView.text = "发布人 ${dataRow.noticePublisher}" + noticeCompanyView.text = "发布单位 ${dataRow.noticeCompany}" + + noticeNoView.text = dataRow.noticeNo + noticeTitleView.text = dataRow.noticeTitle + noticeSketchView.text = dataRow.noticeSketch + + dataRow.noticeContent.formatTextFromHtml( + this, noticeContentView, obtainScreenWidth() + ) + + if (dataRow.minioFileName.isNullOrBlank()) { + minioFileView.text = "暂无附件" + } else { + val minioFileName = dataRow.minioFileName + + minioFileView.text = minioFileName + val textPaint = minioFileView.paint + textPaint.flags = Paint.UNDERLINE_TEXT_FLAG + textPaint.isAntiAlias = true + minioFileView.setTextColor(R.color.themeColor.convertColor(this)) + + minioFileView.setOnClickListener { + //查看附件 + if (minioFileName.endsWith("pdf")) { + navigatePageTo(minioFileName) + } else if ( + minioFileName.endsWith("doc") || + minioFileName.endsWith("docx") + ) { + navigatePageTo(minioFileName) + } else if (minioFileName.endsWith("txt")) { + navigatePageTo(minioFileName) + } else if ( + minioFileName.endsWith("png") || + minioFileName.endsWith("jpeg") || + minioFileName.endsWith("jpg") + ) { + val urls = ArrayList() + urls.add(minioFileName.combineImagePath()) + navigatePageTo(0, urls) + } else { + "文件类型未知,无法打开附件".show(this) + } + } + } + } + }) + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.activity_notice_detail + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeListActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeListActivity.kt new file mode 100644 index 0000000..31c0490 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeListActivity.kt @@ -0,0 +1,180 @@ +package com.casic.xz.meterage.view.notice + +import android.os.Handler +import android.util.Log +import android.view.View +import androidx.lifecycle.ViewModelProvider +import com.casic.xz.meterage.R +import com.casic.xz.meterage.adapter.NoticeListAdapter +import com.casic.xz.meterage.extensions.addAll +import com.casic.xz.meterage.extensions.combineFilePath +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.extensions.showEmptyPage +import com.casic.xz.meterage.model.NoticeListModel +import com.casic.xz.meterage.vm.NoticeViewModel +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.extensions.navigatePageTo +import com.pengxh.kt.lite.extensions.show +import com.pengxh.kt.lite.utils.WeakReferenceHandler +import com.pengxh.kt.lite.widget.dialog.AlertControlDialog +import kotlinx.android.synthetic.main.activity_notice_list.* +import kotlinx.android.synthetic.main.include_empty_view.* + +class NoticeListActivity : KotlinBaseActivity() { + + private lateinit var weakReferenceHandler: WeakReferenceHandler + private lateinit var noticeViewModel: NoticeViewModel + private lateinit var noticeListAdapter: NoticeListAdapter + private var dataBeans: MutableList = ArrayList() + private var pageIndex = 1 + private var isRefresh = false + private var isLoadMore = false + + override fun initData() { + weakReferenceHandler = WeakReferenceHandler(callback) + noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] + noticeViewModel.noticeResult.observe(this, { + if (it.code == 200) { + val dataRows = it.data?.rows!! +// countBadeNumber(dataRows) + when { + isRefresh -> { + dataBeans.clear() + dataBeans = dataRows + noticeLayout.finishRefresh() + isRefresh = false + } + isLoadMore -> { + if (dataRows.size == 0) { + "到底了,别拉了".show(this) + } + dataBeans.addAll(dataRows) + noticeLayout.finishLoadMore() + isLoadMore = false + } + else -> { + dataBeans = dataRows + } + } + weakReferenceHandler.sendEmptyMessage(2023013101) + } + }) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + rightOperateView.setOnClickListener { + AlertControlDialog.Builder() + .setContext(this) + .setTitle("提示") + .setMessage("确定将所有未读消息标为已读?") + .setNegativeButton("取消") + .setPositiveButton("确定") + .setOnDialogButtonClickListener(object : + AlertControlDialog.OnDialogButtonClickListener { + override fun onCancelClick() { + + } + + override fun onConfirmClick() { + //TODO 设置为已读 + } + }).build().show() + } + + if (hasNoticePermission()) { + openSystemNoticeLayout.visibility = View.GONE + openSystemNoticeLayout.visibility = View.GONE + } else { + openSystemNoticeLayout.setOnClickListener { + + } + + + closeLayoutView.setOnClickListener { + openSystemNoticeLayout.visibility = View.GONE + } + } + + noticeLayout.setOnRefreshListener { + isRefresh = true + //刷新之后页码重置 + pageIndex = 1 + getNoticeListByPage() + } + + noticeLayout.setOnLoadMoreListener { + isLoadMore = true + pageIndex++ + getNoticeListByPage() + } + } + + override fun onResume() { + super.onResume() + pageIndex = 1 + getNoticeListByPage() + } + + private fun getNoticeListByPage() { + noticeViewModel.getNoticeList("", "", "", "", "", pageIndex) + } + + private val callback = Handler.Callback { + when (it.what) { + 2023013101 -> { + if (isRefresh || isLoadMore) { + noticeListAdapter.notifyDataSetChanged() + } else { + if (dataBeans.size == 0) { + emptyView!!.showEmptyPage("没有任何消息") { + pageIndex = 1 + getNoticeListByPage() + } + } else { + emptyView!!.hide() + noticeListAdapter = NoticeListAdapter(this, dataBeans) + noticeRecyclerView.adapter = noticeListAdapter + noticeListAdapter.setOnItemClickListener(object : + NoticeListAdapter.OnItemClickListener { + override fun onItemClicked(position: Int) { + val rowsModel = dataBeans[position] + val allArgs = addAll( + rowsModel.noticeNo, + rowsModel.noticeTitle, + rowsModel.noticePublisher, + "", + "" + ) + Log.d( + "Casic", + "NoticeListActivity => onItemClicked: ${rowsModel.minioFileName.combineFilePath()}" + ) + navigatePageTo(allArgs) + } + }) + } + } + } + } + true + } + + //TODO 判断是否开启通知权限 + private fun hasNoticePermission(): Boolean { + + return false + } + + override fun initLayoutView(): Int = R.layout.activity_notice_list + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewDocumentActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewDocumentActivity.kt new file mode 100644 index 0000000..4b16ae8 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewDocumentActivity.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.view.notice + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseActivity + +class PreviewDocumentActivity : KotlinBaseActivity() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.activity_preview_doc + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewPdfActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewPdfActivity.kt new file mode 100644 index 0000000..fad73b6 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewPdfActivity.kt @@ -0,0 +1,62 @@ +package com.casic.xz.meterage.view.notice + +import com.casic.xz.meterage.R +import com.casic.xz.meterage.extensions.combineFilePath +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.callback.OnDownloadListener +import com.pengxh.kt.lite.extensions.createDownloadFileDir +import com.pengxh.kt.lite.extensions.downloadFile +import com.pengxh.kt.lite.utils.Constant +import kotlinx.android.synthetic.main.activity_preview_pdf.* +import kotlinx.android.synthetic.main.include_base_title.* +import java.io.File +import java.io.FileInputStream + + +class PreviewPdfActivity : KotlinBaseActivity() { + + override fun initData() { + val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! + titleView.text = minioFileName + + val url = minioFileName.combineFilePath() + url.downloadFile(createDownloadFileDir().toString(), + object : OnDownloadListener { + override fun onDownloadStart(totalBytes: Long) { + runOnUiThread { + LoadingDialogHub.show(this@PreviewPdfActivity, "附件加载中") + } + } + + override fun onProgressChanged(currentBytes: Long) { + + } + + override fun onDownloadEnd(file: File?) { + runOnUiThread { + LoadingDialogHub.dismiss() + } + val inputStream = FileInputStream(file) + pdfView.fromStream(inputStream).load() + } + }) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + } + + override fun initLayoutView(): Int = R.layout.activity_preview_pdf + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewTextActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewTextActivity.kt new file mode 100644 index 0000000..d7850fb --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewTextActivity.kt @@ -0,0 +1,60 @@ +package com.casic.xz.meterage.view.notice + +import com.casic.xz.meterage.R +import com.casic.xz.meterage.extensions.combineFilePath +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.callback.OnDownloadListener +import com.pengxh.kt.lite.extensions.createDownloadFileDir +import com.pengxh.kt.lite.extensions.downloadFile +import com.pengxh.kt.lite.extensions.read +import com.pengxh.kt.lite.utils.Constant +import kotlinx.android.synthetic.main.activity_preview_txt.* +import kotlinx.android.synthetic.main.include_base_title.* +import java.io.File + +class PreviewTextActivity : KotlinBaseActivity() { + + override fun initData() { + val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! + titleView.text = minioFileName + + val url = minioFileName.combineFilePath() + url.downloadFile(createDownloadFileDir().toString(), + object : OnDownloadListener { + override fun onDownloadStart(totalBytes: Long) { + runOnUiThread { + LoadingDialogHub.show(this@PreviewTextActivity, "附件加载中") + } + } + + override fun onProgressChanged(currentBytes: Long) { + + } + + override fun onDownloadEnd(file: File?) { + runOnUiThread { + LoadingDialogHub.dismiss() + textView.text = file?.read() + } + } + }) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + } + + override fun initLayoutView(): Int = R.layout.activity_preview_txt + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/vm/EquipmentViewModel.kt b/app/src/main/java/com/casic/xz/meterage/vm/EquipmentViewModel.kt new file mode 100644 index 0000000..b5f21f6 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/vm/EquipmentViewModel.kt @@ -0,0 +1,92 @@ +package com.casic.xz.meterage.vm + +import androidx.lifecycle.MutableLiveData +import com.casic.xz.meterage.base.BaseApplication +import com.casic.xz.meterage.extensions.separateResponseCode +import com.casic.xz.meterage.extensions.toErrorMessage +import com.casic.xz.meterage.model.EquipmentDetailModel +import com.casic.xz.meterage.model.EquipmentListModel +import com.casic.xz.meterage.utils.retrofit.RetrofitServiceManager +import com.google.gson.Gson +import com.google.gson.reflect.TypeToken +import com.pengxh.kt.lite.extensions.launch +import com.pengxh.kt.lite.extensions.show +import com.pengxh.kt.lite.vm.BaseViewModel +import com.pengxh.kt.lite.vm.LoadState + +class EquipmentViewModel : BaseViewModel() { + + private val gson by lazy { Gson() } + val equipmentResult = MutableLiveData() + val equipmentDetailResult = MutableLiveData() + + fun getEquipmentList( + equipmentNo: String, + equipmentName: String, + mesureType: String, + managerState: String, + useDept: String, + assetType: String, + equipmentCategory: String, + isCalibrationTestEquipment: String, + isMeasureAccount: String, + isStandardSupportEquipment: String, + isFixedAssets: String, + validStartDate: String, + validEndDate: String, + abc: String, + ids: Array, + offset: Int + ) = launch({ + loadState.value = LoadState.Loading + val response = RetrofitServiceManager.getEquipmentList( + equipmentNo, + equipmentName, + mesureType, + managerState, + useDept, + assetType, + equipmentCategory, + isCalibrationTestEquipment, + isMeasureAccount, + isStandardSupportEquipment, + isFixedAssets, + validStartDate, + validEndDate, + abc, + ids, + offset + ) + val responseCode = response.separateResponseCode() + if (responseCode == 200) { + loadState.value = LoadState.Success + equipmentResult.value = gson.fromJson( + response, object : TypeToken() {}.type + ) + } else { + loadState.value = LoadState.Fail + response.toErrorMessage().show(BaseApplication.get()) + } + }, { + loadState.value = LoadState.Fail + it.printStackTrace() + }) + + fun getEquipmentDetail(id: String) = launch({ + loadState.value = LoadState.Loading + val response = RetrofitServiceManager.getEquipmentDetail(id) + val responseCode = response.separateResponseCode() + if (responseCode == 200) { + loadState.value = LoadState.Success + equipmentDetailResult.value = gson.fromJson( + response, object : TypeToken() {}.type + ) + } else { + loadState.value = LoadState.Fail + response.toErrorMessage().show(BaseApplication.get()) + } + }, { + loadState.value = LoadState.Fail + it.printStackTrace() + }) +} \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_sorting.xml b/app/src/main/res/drawable/ic_sorting.xml new file mode 100644 index 0000000..252bfe6 --- /dev/null +++ b/app/src/main/res/drawable/ic_sorting.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 3892b5a..02160cd 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -34,16 +34,18 @@ - - - - - - - + + + + + + + + + +) : RecyclerView.Adapter() { + + private var layoutInflater: LayoutInflater = LayoutInflater.from(context) + + override fun getItemCount(): Int = dataRows.size + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = ItemViewHolder( + layoutInflater.inflate(R.layout.item_equipment_rv_l, parent, false) + ) + + override fun onBindViewHolder(holder: ItemViewHolder, position: Int) { + //绑定数据 + val rowsBean = dataRows[position] + holder.equipmentNameView.text = rowsBean.equipmentName + holder.equipmentCodeView.text = rowsBean.equipmentNo + holder.equipmentDateView.text = rowsBean.enableDate + holder.equipmentLibView.text = rowsBean.useDeptName + + //绑定事件 + holder.itemView.setOnClickListener { + listener?.onItemClicked(position) + } + } + + inner class ItemViewHolder(view: View) : RecyclerView.ViewHolder(view) { + var equipmentNameView: TextView = view.findViewById(R.id.equipmentNameView) + var equipmentCodeView: TextView = view.findViewById(R.id.equipmentCodeView) + var equipmentDateView: TextView = view.findViewById(R.id.equipmentDateView) + var equipmentLibView: TextView = view.findViewById(R.id.equipmentLibView) + } + + private var listener: OnItemClickListener? = null + + interface OnItemClickListener { + fun onItemClicked(position: Int) + } + + fun setOnItemClickListener(onClickListener: OnItemClickListener?) { + this.listener = onClickListener + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt index b4628f3..d970b55 100644 --- a/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt +++ b/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt @@ -5,7 +5,8 @@ import com.casic.xz.meterage.R import com.casic.xz.meterage.adapter.HomeGridAdapter import com.casic.xz.meterage.utils.LocaleConstant -import com.casic.xz.meterage.view.NoticeListActivity +import com.casic.xz.meterage.view.home.EquipmentActivity +import com.casic.xz.meterage.view.notice.NoticeListActivity import com.casic.xz.meterage.vm.NoticeViewModel import com.pengxh.kt.lite.base.KotlinBaseFragment import com.pengxh.kt.lite.extensions.navigatePageTo @@ -36,8 +37,19 @@ homeFuncRecyclerView.adapter = homeAdapter homeAdapter.setOnGridItemClickListener(object : HomeGridAdapter.OnGridItemClickListener { override fun onItemClick(position: Int) { - when (position) { - + when (LocaleConstant.HOME_FUNC_OPERATE[position]) { + "仪器设备" -> requireContext().navigatePageTo() +// "标准装置" -> requireContext().navigatePageTo() +// "证书报告" -> requireContext().navigatePageTo() +// "委托需求" -> requireContext().navigatePageTo() +// "访客" -> requireContext().navigatePageTo() +// "标准规范" -> requireContext().navigatePageTo() +// "能力列表" -> requireContext().navigatePageTo() +// "计量培训" -> requireContext().navigatePageTo() +// "合同发票" -> requireContext().navigatePageTo() +// "业务统计" -> requireContext().navigatePageTo() +// "客户列表" -> requireContext().navigatePageTo() +// "外场检测" -> requireContext().navigatePageTo() } } }) diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt index 7e75abe..56dc5ec 100644 --- a/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt +++ b/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt @@ -2,9 +2,11 @@ import android.view.View import androidx.lifecycle.ViewModelProvider +import com.bumptech.glide.Glide +import com.bumptech.glide.request.RequestOptions import com.casic.xz.meterage.R import com.casic.xz.meterage.utils.LocaleConstant -import com.casic.xz.meterage.view.NoticeListActivity +import com.casic.xz.meterage.view.notice.NoticeListActivity import com.casic.xz.meterage.vm.NoticeViewModel import com.casic.xz.meterage.vm.UserViewModel import com.pengxh.kt.lite.base.KotlinBaseFragment @@ -23,6 +25,12 @@ val data = it.data userNameView.text = data.name userUnitView.text = data.deptName + +// Glide.with(requireContext()) +// .load(R.mipmap.default_avatar) +// .apply(RequestOptions.circleCropTransform()) +// .placeholder(R.mipmap.load_image_error) +// .into(userAvatarView) } }) diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt new file mode 100644 index 0000000..cf22646 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt @@ -0,0 +1,103 @@ +package com.casic.xz.meterage.fragment.equipment + +import android.graphics.Paint +import androidx.lifecycle.ViewModelProvider +import com.casic.xz.meterage.R +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.casic.xz.meterage.vm.EquipmentViewModel +import com.pengxh.kt.lite.base.KotlinBaseFragment +import com.pengxh.kt.lite.extensions.convertColor +import com.pengxh.kt.lite.vm.LoadState +import kotlinx.android.synthetic.main.fragment_basic_information.* + +class BasicInformationFragment(private val id: String) : KotlinBaseFragment() { + + private lateinit var equipmentViewModel: EquipmentViewModel + + override fun initData() { + equipmentViewModel = ViewModelProvider(this)[EquipmentViewModel::class.java] + equipmentViewModel.getEquipmentDetail(id) + equipmentViewModel.equipmentDetailResult.observe(this, { + if (it.code == 200) { + val data = it.data!! + + equipmentCodeView.text = data.equipmentNo + equipmentNameView.text = data.equipmentName + manufacturerView.text = data.manufacturer + factoryNumberView.text = data.manufacturingNo + modelView.text = data.modelNo + verificationMethodView.text = data.mesureTypeName + measuringRangeView.text = data.mesureRange + uncertaintyView.text = data.uncertainty + firstUseView.text = data.createTime + originalValueView.text = data.originValue + usageDeptView.text = data.useDeptName + userView.text = data.usePersonName + managementStatusView.text = data.managerStateName + verificationDeptView.text = data.useDeptName +// nextVerificationDeptView.text = data. + verificationPeriodView.text = data.mesureCycle + verificationDateView.text = data.mesureDate + effectiveDateView.text = data.validDate + verificationResultsView.text = data.mesureResultName + abcView.text = data.abcName + isNeedTechnicalView.text = if ( + data.isCalibrationTestEquipment.isNullOrBlank() || data.isCalibrationTestEquipment == "0" + ) { + "否" + } else { + "是" + } + + isStandingBook.text = if ( + data.isMeasureAccount.isNullOrBlank() || data.isMeasureAccount == "0" + ) { + "否" + } else { + "是" + } + + isStandardView.text = if ( + data.isStandardSupportEquipment.isNullOrBlank() || data.isStandardSupportEquipment == "0" + ) { + "否" + } else { + "是" + } + remarkView.text = data.remark + if (data.fileList.size == 0) { + instructionsView.text = "暂无" + } else { + instructionsView.text = "查看附件列表" + val textPaint = instructionsView.paint + textPaint.flags = Paint.UNDERLINE_TEXT_FLAG + textPaint.isAntiAlias = true + instructionsView.setTextColor(R.color.themeColor.convertColor(requireContext())) + + instructionsView.setOnClickListener { + + } + } + } + }) + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_basic_information + + override fun observeRequestState() { + equipmentViewModel.loadState.observe(this, { + when (it) { + LoadState.Loading -> LoadingDialogHub.show(requireActivity(), "数据加载中...") + else -> LoadingDialogHub.dismiss() + } + }) + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt new file mode 100644 index 0000000..0b4a747 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class CertificateFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_certificate + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt new file mode 100644 index 0000000..f05c491 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class ChangeRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_change_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt new file mode 100644 index 0000000..849ffa5 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class InspectionRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_inspection_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt new file mode 100644 index 0000000..aa4edd9 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class UsageRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_usage_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java b/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java new file mode 100644 index 0000000..0b9124e --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java @@ -0,0 +1,760 @@ +package com.casic.xz.meterage.model; + +import java.util.List; + +public class EquipmentDetailModel { + + private int code; + private DataModel data; + private String message; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataModel getData() { + return data; + } + + public void setData(DataModel data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public static class DataModel { + private String abc; + private String abcName; + private String assetNo; + private String assetSource; + private String assetType; + private String assetTypeName; + private String attribute; + private String capitalSource; + private String capitalSourceName; + private String cardEstablishmentDate; + private String createTime; + private String createUser; + private String depreciationMethod; + private String depreciationMethodName; + private String depreciationPeriod; + private String enableDate; + private String equipmentCategory; + private String equipmentCategoryName; + private String equipmentName; + private String equipmentNo; + private String equipmentSpecifications; + private String equipmentType; + private String equipmentTypeName; + private List fileList; + private String id; + private String installIncidentalExpenses; + private String installPlace; + private String intactState; + private String isCalibrationTestEquipment; + private int isDel; + private String isFixedAssets; + private String isMeasureAccount; + private String isStandardSupportEquipment; + private String labelBind; + private String majorCategory; + private String majorCategoryName; + private String managerLevel; + private String managerLevelName; + private String managerState; + private String managerStateName; + private String manufacturer; + private String manufacturerCountry; + private String manufacturingDate; + private String manufacturingNo; + private String mesureCycle; + private String mesureDate; + private String mesureDept; + private String mesureRange; + private String mesureResult; + private String mesureResultName; + private String mesureType; + private String mesureTypeName; + private String modelNo; + private String originValue; + private String overallDimension; + private String presentOriginValue; + private String purpose; + private String remark; + private String singlePrice; + private String supportStandardEquipmentName; + private String supportStandardEquipmentNo; + private String technicalLevel; + private String uncertainty; + private String updateTime; + private String useDept; + private String useDeptName; + private String usePerson; + private String usePersonName; + private String validDate; + private int version; + private String weight; + + public String getAbc() { + return abc; + } + + public void setAbc(String abc) { + this.abc = abc; + } + + public String getAbcName() { + return abcName; + } + + public void setAbcName(String abcName) { + this.abcName = abcName; + } + + public String getAssetNo() { + return assetNo; + } + + public void setAssetNo(String assetNo) { + this.assetNo = assetNo; + } + + public String getAssetSource() { + return assetSource; + } + + public void setAssetSource(String assetSource) { + this.assetSource = assetSource; + } + + public String getAssetType() { + return assetType; + } + + public void setAssetType(String assetType) { + this.assetType = assetType; + } + + public String getAssetTypeName() { + return assetTypeName; + } + + public void setAssetTypeName(String assetTypeName) { + this.assetTypeName = assetTypeName; + } + + public String getAttribute() { + return attribute; + } + + public void setAttribute(String attribute) { + this.attribute = attribute; + } + + public String getCapitalSource() { + return capitalSource; + } + + public void setCapitalSource(String capitalSource) { + this.capitalSource = capitalSource; + } + + public String getCapitalSourceName() { + return capitalSourceName; + } + + public void setCapitalSourceName(String capitalSourceName) { + this.capitalSourceName = capitalSourceName; + } + + public String getCardEstablishmentDate() { + return cardEstablishmentDate; + } + + public void setCardEstablishmentDate(String cardEstablishmentDate) { + this.cardEstablishmentDate = cardEstablishmentDate; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getDepreciationMethod() { + return depreciationMethod; + } + + public void setDepreciationMethod(String depreciationMethod) { + this.depreciationMethod = depreciationMethod; + } + + public String getDepreciationMethodName() { + return depreciationMethodName; + } + + public void setDepreciationMethodName(String depreciationMethodName) { + this.depreciationMethodName = depreciationMethodName; + } + + public String getDepreciationPeriod() { + return depreciationPeriod; + } + + public void setDepreciationPeriod(String depreciationPeriod) { + this.depreciationPeriod = depreciationPeriod; + } + + public String getEnableDate() { + return enableDate; + } + + public void setEnableDate(String enableDate) { + this.enableDate = enableDate; + } + + public String getEquipmentCategory() { + return equipmentCategory; + } + + public void setEquipmentCategory(String equipmentCategory) { + this.equipmentCategory = equipmentCategory; + } + + public String getEquipmentCategoryName() { + return equipmentCategoryName; + } + + public void setEquipmentCategoryName(String equipmentCategoryName) { + this.equipmentCategoryName = equipmentCategoryName; + } + + public String getEquipmentName() { + return equipmentName; + } + + public void setEquipmentName(String equipmentName) { + this.equipmentName = equipmentName; + } + + public String getEquipmentNo() { + return equipmentNo; + } + + public void setEquipmentNo(String equipmentNo) { + this.equipmentNo = equipmentNo; + } + + public String getEquipmentSpecifications() { + return equipmentSpecifications; + } + + public void setEquipmentSpecifications(String equipmentSpecifications) { + this.equipmentSpecifications = equipmentSpecifications; + } + + public String getEquipmentType() { + return equipmentType; + } + + public void setEquipmentType(String equipmentType) { + this.equipmentType = equipmentType; + } + + public String getEquipmentTypeName() { + return equipmentTypeName; + } + + public void setEquipmentTypeName(String equipmentTypeName) { + this.equipmentTypeName = equipmentTypeName; + } + + public List getFileList() { + return fileList; + } + + public void setFileList(List fileList) { + this.fileList = fileList; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getInstallIncidentalExpenses() { + return installIncidentalExpenses; + } + + public void setInstallIncidentalExpenses(String installIncidentalExpenses) { + this.installIncidentalExpenses = installIncidentalExpenses; + } + + public String getInstallPlace() { + return installPlace; + } + + public void setInstallPlace(String installPlace) { + this.installPlace = installPlace; + } + + public String getIntactState() { + return intactState; + } + + public void setIntactState(String intactState) { + this.intactState = intactState; + } + + public String getIsCalibrationTestEquipment() { + return isCalibrationTestEquipment; + } + + public void setIsCalibrationTestEquipment(String isCalibrationTestEquipment) { + this.isCalibrationTestEquipment = isCalibrationTestEquipment; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getIsFixedAssets() { + return isFixedAssets; + } + + public void setIsFixedAssets(String isFixedAssets) { + this.isFixedAssets = isFixedAssets; + } + + public String getIsMeasureAccount() { + return isMeasureAccount; + } + + public void setIsMeasureAccount(String isMeasureAccount) { + this.isMeasureAccount = isMeasureAccount; + } + + public String getIsStandardSupportEquipment() { + return isStandardSupportEquipment; + } + + public void setIsStandardSupportEquipment(String isStandardSupportEquipment) { + this.isStandardSupportEquipment = isStandardSupportEquipment; + } + + public String getLabelBind() { + return labelBind; + } + + public void setLabelBind(String labelBind) { + this.labelBind = labelBind; + } + + public String getMajorCategory() { + return majorCategory; + } + + public void setMajorCategory(String majorCategory) { + this.majorCategory = majorCategory; + } + + public String getMajorCategoryName() { + return majorCategoryName; + } + + public void setMajorCategoryName(String majorCategoryName) { + this.majorCategoryName = majorCategoryName; + } + + public String getManagerLevel() { + return managerLevel; + } + + public void setManagerLevel(String managerLevel) { + this.managerLevel = managerLevel; + } + + public String getManagerLevelName() { + return managerLevelName; + } + + public void setManagerLevelName(String managerLevelName) { + this.managerLevelName = managerLevelName; + } + + public String getManagerState() { + return managerState; + } + + public void setManagerState(String managerState) { + this.managerState = managerState; + } + + public String getManagerStateName() { + return managerStateName; + } + + public void setManagerStateName(String managerStateName) { + this.managerStateName = managerStateName; + } + + public String getManufacturer() { + return manufacturer; + } + + public void setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + } + + public String getManufacturerCountry() { + return manufacturerCountry; + } + + public void setManufacturerCountry(String manufacturerCountry) { + this.manufacturerCountry = manufacturerCountry; + } + + public String getManufacturingDate() { + return manufacturingDate; + } + + public void setManufacturingDate(String manufacturingDate) { + this.manufacturingDate = manufacturingDate; + } + + public String getManufacturingNo() { + return manufacturingNo; + } + + public void setManufacturingNo(String manufacturingNo) { + this.manufacturingNo = manufacturingNo; + } + + public String getMesureCycle() { + return mesureCycle; + } + + public void setMesureCycle(String mesureCycle) { + this.mesureCycle = mesureCycle; + } + + public String getMesureDate() { + return mesureDate; + } + + public void setMesureDate(String mesureDate) { + this.mesureDate = mesureDate; + } + + public String getMesureDept() { + return mesureDept; + } + + public void setMesureDept(String mesureDept) { + this.mesureDept = mesureDept; + } + + public String getMesureRange() { + return mesureRange; + } + + public void setMesureRange(String mesureRange) { + this.mesureRange = mesureRange; + } + + public String getMesureResult() { + return mesureResult; + } + + public void setMesureResult(String mesureResult) { + this.mesureResult = mesureResult; + } + + public String getMesureResultName() { + return mesureResultName; + } + + public void setMesureResultName(String mesureResultName) { + this.mesureResultName = mesureResultName; + } + + public String getMesureType() { + return mesureType; + } + + public void setMesureType(String mesureType) { + this.mesureType = mesureType; + } + + public String getMesureTypeName() { + return mesureTypeName; + } + + public void setMesureTypeName(String mesureTypeName) { + this.mesureTypeName = mesureTypeName; + } + + public String getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getOriginValue() { + return originValue; + } + + public void setOriginValue(String originValue) { + this.originValue = originValue; + } + + public String getOverallDimension() { + return overallDimension; + } + + public void setOverallDimension(String overallDimension) { + this.overallDimension = overallDimension; + } + + public String getPresentOriginValue() { + return presentOriginValue; + } + + public void setPresentOriginValue(String presentOriginValue) { + this.presentOriginValue = presentOriginValue; + } + + public String getPurpose() { + return purpose; + } + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getSinglePrice() { + return singlePrice; + } + + public void setSinglePrice(String singlePrice) { + this.singlePrice = singlePrice; + } + + public String getSupportStandardEquipmentName() { + return supportStandardEquipmentName; + } + + public void setSupportStandardEquipmentName(String supportStandardEquipmentName) { + this.supportStandardEquipmentName = supportStandardEquipmentName; + } + + public String getSupportStandardEquipmentNo() { + return supportStandardEquipmentNo; + } + + public void setSupportStandardEquipmentNo(String supportStandardEquipmentNo) { + this.supportStandardEquipmentNo = supportStandardEquipmentNo; + } + + public String getTechnicalLevel() { + return technicalLevel; + } + + public void setTechnicalLevel(String technicalLevel) { + this.technicalLevel = technicalLevel; + } + + public String getUncertainty() { + return uncertainty; + } + + public void setUncertainty(String uncertainty) { + this.uncertainty = uncertainty; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getUseDept() { + return useDept; + } + + public void setUseDept(String useDept) { + this.useDept = useDept; + } + + public String getUseDeptName() { + return useDeptName; + } + + public void setUseDeptName(String useDeptName) { + this.useDeptName = useDeptName; + } + + public String getUsePerson() { + return usePerson; + } + + public void setUsePerson(String usePerson) { + this.usePerson = usePerson; + } + + public String getUsePersonName() { + return usePersonName; + } + + public void setUsePersonName(String usePersonName) { + this.usePersonName = usePersonName; + } + + public String getValidDate() { + return validDate; + } + + public void setValidDate(String validDate) { + this.validDate = validDate; + } + + public int getVersion() { + return version; + } + + public void setVersion(int version) { + this.version = version; + } + + public String getWeight() { + return weight; + } + + public void setWeight(String weight) { + this.weight = weight; + } + + public static class FileListModel { + private String assetId; + private String createTime; + private String createUser; + private String fileName; + private String id; + private int isDel; + private String minioFileName; + private String remark; + private String updateTime; + + public String getAssetId() { + return assetId; + } + + public void setAssetId(String assetId) { + this.assetId = assetId; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getFileName() { + return fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getMinioFileName() { + return minioFileName; + } + + public void setMinioFileName(String minioFileName) { + this.minioFileName = minioFileName; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + } + } +} diff --git a/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java b/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java new file mode 100644 index 0000000..15fc128 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java @@ -0,0 +1,697 @@ +package com.casic.xz.meterage.model; + +import java.util.List; + +public class EquipmentListModel { + + private int code; + private DataModel data; + private String message; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataModel getData() { + return data; + } + + public void setData(DataModel data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public static class DataModel { + private List rows; + private int total; + + public List getRows() { + return rows; + } + + public void setRows(List rows) { + this.rows = rows; + } + + public int getTotal() { + return total; + } + + public void setTotal(int total) { + this.total = total; + } + + public static class RowsModel { + private String abc; + private String abcName; + private String assetNo; + private String assetSource; + private String assetType; + private String assetTypeName; + private String attribute; + private String capitalSource; + private String capitalSourceName; + private String cardEstablishmentDate; + private String createTime; + private String createUser; + private String depreciationMethod; + private String depreciationMethodName; + private String depreciationPeriod; + private String enableDate; + private String equipmentCategory; + private String equipmentCategoryName; + private String equipmentName; + private String equipmentNo; + private String equipmentSpecifications; + private String equipmentType; + private String equipmentTypeName; + private String fileList; + private String id; + private String installIncidentalExpenses; + private String installPlace; + private String intactState; + private String isCalibrationTestEquipment; + private int isDel; + private String isFixedAssets; + private String isMeasureAccount; + private String isStandardSupportEquipment; + private String labelBind; + private String majorCategory; + private String majorCategoryName; + private String managerLevel; + private String managerLevelName; + private String managerState; + private String managerStateName; + private String manufacturer; + private String manufacturerCountry; + private String manufacturingDate; + private String manufacturingNo; + private String mesureCycle; + private String mesureDate; + private String mesureDept; + private String mesureRange; + private String mesureResult; + private String mesureResultName; + private String mesureType; + private String mesureTypeName; + private String modelNo; + private String originValue; + private String overallDimension; + private String presentOriginValue; + private String purpose; + private String remark; + private String singlePrice; + private String supportStandardEquipmentName; + private String supportStandardEquipmentNo; + private String technicalLevel; + private String uncertainty; + private String updateTime; + private String useDept; + private String useDeptName; + private String usePerson; + private String usePersonName; + private String validDate; + private int version; + private String weight; + + public String getAbc() { + return abc; + } + + public void setAbc(String abc) { + this.abc = abc; + } + + public String getAbcName() { + return abcName; + } + + public void setAbcName(String abcName) { + this.abcName = abcName; + } + + public String getAssetNo() { + return assetNo; + } + + public void setAssetNo(String assetNo) { + this.assetNo = assetNo; + } + + public String getAssetSource() { + return assetSource; + } + + public void setAssetSource(String assetSource) { + this.assetSource = assetSource; + } + + public String getAssetType() { + return assetType; + } + + public void setAssetType(String assetType) { + this.assetType = assetType; + } + + public String getAssetTypeName() { + return assetTypeName; + } + + public void setAssetTypeName(String assetTypeName) { + this.assetTypeName = assetTypeName; + } + + public String getAttribute() { + return attribute; + } + + public void setAttribute(String attribute) { + this.attribute = attribute; + } + + public String getCapitalSource() { + return capitalSource; + } + + public void setCapitalSource(String capitalSource) { + this.capitalSource = capitalSource; + } + + public String getCapitalSourceName() { + return capitalSourceName; + } + + public void setCapitalSourceName(String capitalSourceName) { + this.capitalSourceName = capitalSourceName; + } + + public String getCardEstablishmentDate() { + return cardEstablishmentDate; + } + + public void setCardEstablishmentDate(String cardEstablishmentDate) { + this.cardEstablishmentDate = cardEstablishmentDate; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getDepreciationMethod() { + return depreciationMethod; + } + + public void setDepreciationMethod(String depreciationMethod) { + this.depreciationMethod = depreciationMethod; + } + + public String getDepreciationMethodName() { + return depreciationMethodName; + } + + public void setDepreciationMethodName(String depreciationMethodName) { + this.depreciationMethodName = depreciationMethodName; + } + + public String getDepreciationPeriod() { + return depreciationPeriod; + } + + public void setDepreciationPeriod(String depreciationPeriod) { + this.depreciationPeriod = depreciationPeriod; + } + + public String getEnableDate() { + return enableDate; + } + + public void setEnableDate(String enableDate) { + this.enableDate = enableDate; + } + + public String getEquipmentCategory() { + return equipmentCategory; + } + + public void setEquipmentCategory(String equipmentCategory) { + this.equipmentCategory = equipmentCategory; + } + + public String getEquipmentCategoryName() { + return equipmentCategoryName; + } + + public void setEquipmentCategoryName(String equipmentCategoryName) { + this.equipmentCategoryName = equipmentCategoryName; + } + + public String getEquipmentName() { + return equipmentName; + } + + public void setEquipmentName(String equipmentName) { + this.equipmentName = equipmentName; + } + + public String getEquipmentNo() { + return equipmentNo; + } + + public void setEquipmentNo(String equipmentNo) { + this.equipmentNo = equipmentNo; + } + + public String getEquipmentSpecifications() { + return equipmentSpecifications; + } + + public void setEquipmentSpecifications(String equipmentSpecifications) { + this.equipmentSpecifications = equipmentSpecifications; + } + + public String getEquipmentType() { + return equipmentType; + } + + public void setEquipmentType(String equipmentType) { + this.equipmentType = equipmentType; + } + + public String getEquipmentTypeName() { + return equipmentTypeName; + } + + public void setEquipmentTypeName(String equipmentTypeName) { + this.equipmentTypeName = equipmentTypeName; + } + + public String getFileList() { + return fileList; + } + + public void setFileList(String fileList) { + this.fileList = fileList; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getInstallIncidentalExpenses() { + return installIncidentalExpenses; + } + + public void setInstallIncidentalExpenses(String installIncidentalExpenses) { + this.installIncidentalExpenses = installIncidentalExpenses; + } + + public String getInstallPlace() { + return installPlace; + } + + public void setInstallPlace(String installPlace) { + this.installPlace = installPlace; + } + + public String getIntactState() { + return intactState; + } + + public void setIntactState(String intactState) { + this.intactState = intactState; + } + + public String getIsCalibrationTestEquipment() { + return isCalibrationTestEquipment; + } + + public void setIsCalibrationTestEquipment(String isCalibrationTestEquipment) { + this.isCalibrationTestEquipment = isCalibrationTestEquipment; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getIsFixedAssets() { + return isFixedAssets; + } + + public void setIsFixedAssets(String isFixedAssets) { + this.isFixedAssets = isFixedAssets; + } + + public String getIsMeasureAccount() { + return isMeasureAccount; + } + + public void setIsMeasureAccount(String isMeasureAccount) { + this.isMeasureAccount = isMeasureAccount; + } + + public String getIsStandardSupportEquipment() { + return isStandardSupportEquipment; + } + + public void setIsStandardSupportEquipment(String isStandardSupportEquipment) { + this.isStandardSupportEquipment = isStandardSupportEquipment; + } + + public String getLabelBind() { + return labelBind; + } + + public void setLabelBind(String labelBind) { + this.labelBind = labelBind; + } + + public String getMajorCategory() { + return majorCategory; + } + + public void setMajorCategory(String majorCategory) { + this.majorCategory = majorCategory; + } + + public String getMajorCategoryName() { + return majorCategoryName; + } + + public void setMajorCategoryName(String majorCategoryName) { + this.majorCategoryName = majorCategoryName; + } + + public String getManagerLevel() { + return managerLevel; + } + + public void setManagerLevel(String managerLevel) { + this.managerLevel = managerLevel; + } + + public String getManagerLevelName() { + return managerLevelName; + } + + public void setManagerLevelName(String managerLevelName) { + this.managerLevelName = managerLevelName; + } + + public String getManagerState() { + return managerState; + } + + public void setManagerState(String managerState) { + this.managerState = managerState; + } + + public String getManagerStateName() { + return managerStateName; + } + + public void setManagerStateName(String managerStateName) { + this.managerStateName = managerStateName; + } + + public String getManufacturer() { + return manufacturer; + } + + public void setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + } + + public String getManufacturerCountry() { + return manufacturerCountry; + } + + public void setManufacturerCountry(String manufacturerCountry) { + this.manufacturerCountry = manufacturerCountry; + } + + public String getManufacturingDate() { + return manufacturingDate; + } + + public void setManufacturingDate(String manufacturingDate) { + this.manufacturingDate = manufacturingDate; + } + + public String getManufacturingNo() { + return manufacturingNo; + } + + public void setManufacturingNo(String manufacturingNo) { + this.manufacturingNo = manufacturingNo; + } + + public String getMesureCycle() { + return mesureCycle; + } + + public void setMesureCycle(String mesureCycle) { + this.mesureCycle = mesureCycle; + } + + public String getMesureDate() { + return mesureDate; + } + + public void setMesureDate(String mesureDate) { + this.mesureDate = mesureDate; + } + + public String getMesureDept() { + return mesureDept; + } + + public void setMesureDept(String mesureDept) { + this.mesureDept = mesureDept; + } + + public String getMesureRange() { + return mesureRange; + } + + public void setMesureRange(String mesureRange) { + this.mesureRange = mesureRange; + } + + public String getMesureResult() { + return mesureResult; + } + + public void setMesureResult(String mesureResult) { + this.mesureResult = mesureResult; + } + + public String getMesureResultName() { + return mesureResultName; + } + + public void setMesureResultName(String mesureResultName) { + this.mesureResultName = mesureResultName; + } + + public String getMesureType() { + return mesureType; + } + + public void setMesureType(String mesureType) { + this.mesureType = mesureType; + } + + public String getMesureTypeName() { + return mesureTypeName; + } + + public void setMesureTypeName(String mesureTypeName) { + this.mesureTypeName = mesureTypeName; + } + + public String getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getOriginValue() { + return originValue; + } + + public void setOriginValue(String originValue) { + this.originValue = originValue; + } + + public String getOverallDimension() { + return overallDimension; + } + + public void setOverallDimension(String overallDimension) { + this.overallDimension = overallDimension; + } + + public String getPresentOriginValue() { + return presentOriginValue; + } + + public void setPresentOriginValue(String presentOriginValue) { + this.presentOriginValue = presentOriginValue; + } + + public String getPurpose() { + return purpose; + } + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getSinglePrice() { + return singlePrice; + } + + public void setSinglePrice(String singlePrice) { + this.singlePrice = singlePrice; + } + + public String getSupportStandardEquipmentName() { + return supportStandardEquipmentName; + } + + public void setSupportStandardEquipmentName(String supportStandardEquipmentName) { + this.supportStandardEquipmentName = supportStandardEquipmentName; + } + + public String getSupportStandardEquipmentNo() { + return supportStandardEquipmentNo; + } + + public void setSupportStandardEquipmentNo(String supportStandardEquipmentNo) { + this.supportStandardEquipmentNo = supportStandardEquipmentNo; + } + + public String getTechnicalLevel() { + return technicalLevel; + } + + public void setTechnicalLevel(String technicalLevel) { + this.technicalLevel = technicalLevel; + } + + public String getUncertainty() { + return uncertainty; + } + + public void setUncertainty(String uncertainty) { + this.uncertainty = uncertainty; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getUseDept() { + return useDept; + } + + public void setUseDept(String useDept) { + this.useDept = useDept; + } + + public String getUseDeptName() { + return useDeptName; + } + + public void setUseDeptName(String useDeptName) { + this.useDeptName = useDeptName; + } + + public String getUsePerson() { + return usePerson; + } + + public void setUsePerson(String usePerson) { + this.usePerson = usePerson; + } + + public String getUsePersonName() { + return usePersonName; + } + + public void setUsePersonName(String usePersonName) { + this.usePersonName = usePersonName; + } + + public String getValidDate() { + return validDate; + } + + public void setValidDate(String validDate) { + this.validDate = validDate; + } + + public int getVersion() { + return version; + } + + public void setVersion(int version) { + this.version = version; + } + + public String getWeight() { + return weight; + } + + public void setWeight(String weight) { + this.weight = weight; + } + } + } +} diff --git a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt index a3f514f..46e5eef 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt @@ -35,4 +35,24 @@ @QueryMap limit: Map, @QueryMap offset: Map ): String + + /** + * 获取设备列表 + */ + @POST("/meter/assets/listPage") + suspend fun getEquipmentList( + @Header("token") token: String, + @Body requestBody: RequestBody, + @QueryMap limit: Map, + @QueryMap offset: Map + ): String + + /** + * 获取设备详情 + */ + @POST("/meter/assets/detail") + suspend fun getEquipmentDetail( + @Header("token") token: String, + @Body requestBody: RequestBody + ): String } \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt index 444a872..386a1d8 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt @@ -6,8 +6,10 @@ import com.pengxh.kt.lite.utils.SaveKeyValues import okhttp3.MediaType.Companion.toMediaType import okhttp3.RequestBody.Companion.toRequestBody +import org.json.JSONArray import org.json.JSONObject + object RetrofitServiceManager { private val api by lazy { @@ -73,4 +75,71 @@ offsetMap["offset"] = offset return api.getNoticeList(AuthenticationHelper.token!!, requestBody, limitMap, offsetMap) } + + /** + * 获取设备列表 + */ + suspend fun getEquipmentList( + equipmentNo: String, + equipmentName: String, + mesureType: String, + managerState: String, + useDept: String, + assetType: String, + equipmentCategory: String, + isCalibrationTestEquipment: String, + isMeasureAccount: String, + isStandardSupportEquipment: String, + isFixedAssets: String, + validStartDate: String, + validEndDate: String, + abc: String, + ids: Array, + offset: Int + ): String { + val paramObject = JSONObject() + paramObject.put("equipmentNo", equipmentNo) + paramObject.put("equipmentName", equipmentName) + paramObject.put("mesureType", mesureType) + paramObject.put("managerState", managerState) + paramObject.put("useDept", useDept) + paramObject.put("assetType", assetType) + paramObject.put("equipmentCategory", equipmentCategory) + paramObject.put("isCalibrationTestEquipment", isCalibrationTestEquipment) + paramObject.put("isMeasureAccount", isMeasureAccount) + paramObject.put("isStandardSupportEquipment", isStandardSupportEquipment) + paramObject.put("isFixedAssets", isFixedAssets) + paramObject.put("validStartDate", validStartDate) + paramObject.put("validEndDate", validEndDate) + paramObject.put("abc", abc) + + val jsonArray = JSONArray() + ids.forEach { + jsonArray.put(it) + } + paramObject.put("ids", jsonArray) + + val requestBody = paramObject.toString().toRequestBody( + "application/json;charset=UTF-8".toMediaType() + ) + + val limitMap = HashMap() + limitMap["limit"] = LocaleConstant.PAGE_LIMIT + + val offsetMap = HashMap() + offsetMap["offset"] = offset + return api.getEquipmentList(AuthenticationHelper.token!!, requestBody, limitMap, offsetMap) + } + + /** + * 获取设备详情 + */ + suspend fun getEquipmentDetail(id: String): String { + val paramObject = JSONObject() + paramObject.put("id", id) + val requestBody = paramObject.toString().toRequestBody( + "application/json;charset=UTF-8".toMediaType() + ) + return api.getEquipmentDetail(AuthenticationHelper.token!!, requestBody) + } } \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt deleted file mode 100644 index a5bb60b..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt +++ /dev/null @@ -1,104 +0,0 @@ -package com.casic.xz.meterage.view - -import android.annotation.SuppressLint -import android.graphics.Paint -import androidx.lifecycle.ViewModelProvider -import com.casic.xz.meterage.R -import com.casic.xz.meterage.extensions.combineImagePath -import com.casic.xz.meterage.extensions.formatTextFromHtml -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.vm.NoticeViewModel -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.extensions.convertColor -import com.pengxh.kt.lite.extensions.navigatePageTo -import com.pengxh.kt.lite.extensions.obtainScreenWidth -import com.pengxh.kt.lite.extensions.show -import com.pengxh.kt.lite.utils.Constant -import kotlinx.android.synthetic.main.activity_notice_detail.* -import kotlinx.android.synthetic.main.include_base_title.* -import java.util.* - -@SuppressLint("SetTextI18n") -class NoticeDetailActivity : KotlinBaseActivity() { - - private lateinit var noticeViewModel: NoticeViewModel - - override fun initData() { - leftBackView.setOnClickListener { finish() } - titleView.text = "通知公告" - - val args = intent.getStringArrayListExtra(Constant.INTENT_PARAM)!! - - noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] - noticeViewModel.getNoticeList(args[0], args[1], args[2], "", "", 1) - noticeViewModel.noticeResult.observe(this, { - if (it.code == 200) { - val dataRow = it.data?.rows!![0] - - noticeDateView.text = dataRow.noticeTime - noticePublisherView.text = "发布人 ${dataRow.noticePublisher}" - noticeCompanyView.text = "发布单位 ${dataRow.noticeCompany}" - - noticeNoView.text = dataRow.noticeNo - noticeTitleView.text = dataRow.noticeTitle - noticeSketchView.text = dataRow.noticeSketch - - dataRow.noticeContent.formatTextFromHtml( - this, noticeContentView, obtainScreenWidth() - ) - - if (dataRow.minioFileName.isNullOrBlank()) { - minioFileView.text = "暂无附件" - } else { - val minioFileName = dataRow.minioFileName - - minioFileView.text = minioFileName - val textPaint = minioFileView.paint - textPaint.flags = Paint.UNDERLINE_TEXT_FLAG - textPaint.isAntiAlias = true - minioFileView.setTextColor(R.color.themeColor.convertColor(this)) - - minioFileView.setOnClickListener { - //查看附件 - if (minioFileName.endsWith("pdf")) { - navigatePageTo(minioFileName) - } else if ( - minioFileName.endsWith("doc") || - minioFileName.endsWith("docx") - ) { - navigatePageTo(minioFileName) - } else if (minioFileName.endsWith("txt")) { - navigatePageTo(minioFileName) - } else if ( - minioFileName.endsWith("png") || - minioFileName.endsWith("jpeg") || - minioFileName.endsWith("jpg") - ) { - val urls = ArrayList() - urls.add(minioFileName.combineImagePath()) - navigatePageTo(0, urls) - } else { - "文件类型未知,无法打开附件".show(this) - } - } - } - } - }) - } - - override fun initEvent() { - - } - - override fun initLayoutView(): Int = R.layout.activity_notice_detail - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/NoticeListActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/NoticeListActivity.kt deleted file mode 100644 index 15f6a16..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/NoticeListActivity.kt +++ /dev/null @@ -1,180 +0,0 @@ -package com.casic.xz.meterage.view - -import android.os.Handler -import android.util.Log -import android.view.View -import androidx.lifecycle.ViewModelProvider -import com.casic.xz.meterage.R -import com.casic.xz.meterage.adapter.NoticeListAdapter -import com.casic.xz.meterage.extensions.addAll -import com.casic.xz.meterage.extensions.combineFilePath -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.extensions.showEmptyPage -import com.casic.xz.meterage.model.NoticeListModel -import com.casic.xz.meterage.vm.NoticeViewModel -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.extensions.navigatePageTo -import com.pengxh.kt.lite.extensions.show -import com.pengxh.kt.lite.utils.WeakReferenceHandler -import com.pengxh.kt.lite.widget.dialog.AlertControlDialog -import kotlinx.android.synthetic.main.activity_notice_list.* -import kotlinx.android.synthetic.main.include_empty_view.* - -class NoticeListActivity : KotlinBaseActivity() { - - private lateinit var weakReferenceHandler: WeakReferenceHandler - private lateinit var noticeViewModel: NoticeViewModel - private lateinit var noticeListAdapter: NoticeListAdapter - private var dataBeans: MutableList = ArrayList() - private var pageIndex = 1 - private var isRefresh = false - private var isLoadMore = false - - override fun initData() { - weakReferenceHandler = WeakReferenceHandler(callback) - noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] - noticeViewModel.noticeResult.observe(this, { - if (it.code == 200) { - val dataRows = it.data?.rows!! -// countBadeNumber(dataRows) - when { - isRefresh -> { - dataBeans.clear() - dataBeans = dataRows - noticeLayout.finishRefresh() - isRefresh = false - } - isLoadMore -> { - if (dataRows.size == 0) { - "到底了,别拉了".show(this) - } - dataBeans.addAll(dataRows) - noticeLayout.finishLoadMore() - isLoadMore = false - } - else -> { - dataBeans = dataRows - } - } - weakReferenceHandler.sendEmptyMessage(2023013101) - } - }) - } - - override fun initEvent() { - leftBackView.setOnClickListener { finish() } - rightOperateView.setOnClickListener { - AlertControlDialog.Builder() - .setContext(this) - .setTitle("提示") - .setMessage("确定将所有未读消息标为已读?") - .setNegativeButton("取消") - .setPositiveButton("确定") - .setOnDialogButtonClickListener(object : - AlertControlDialog.OnDialogButtonClickListener { - override fun onCancelClick() { - - } - - override fun onConfirmClick() { - //TODO 设置为已读 - } - }).build().show() - } - - if (hasNoticePermission()) { - openSystemNoticeLayout.visibility = View.GONE - openSystemNoticeLayout.visibility = View.GONE - } else { - openSystemNoticeLayout.setOnClickListener { - - } - - - closeLayoutView.setOnClickListener { - openSystemNoticeLayout.visibility = View.GONE - } - } - - noticeLayout.setOnRefreshListener { - isRefresh = true - //刷新之后页码重置 - pageIndex = 1 - getNoticeListByPage() - } - - noticeLayout.setOnLoadMoreListener { - isLoadMore = true - pageIndex++ - getNoticeListByPage() - } - } - - override fun onResume() { - super.onResume() - pageIndex = 1 - getNoticeListByPage() - } - - private fun getNoticeListByPage() { - noticeViewModel.getNoticeList("", "", "", "", "", pageIndex) - } - - private val callback = Handler.Callback { - when (it.what) { - 2023013101 -> { - if (isRefresh || isLoadMore) { - noticeListAdapter.notifyDataSetChanged() - } else { - if (dataBeans.size == 0) { - emptyView!!.showEmptyPage("没有任何消息") { - pageIndex = 1 - getNoticeListByPage() - } - } else { - emptyView!!.hide() - noticeListAdapter = NoticeListAdapter(this, dataBeans) - noticeRecyclerView.adapter = noticeListAdapter - noticeListAdapter.setOnItemClickListener(object : - NoticeListAdapter.OnItemClickListener { - override fun onItemClicked(position: Int) { - val rowsModel = dataBeans[position] - val allArgs = addAll( - rowsModel.noticeNo, - rowsModel.noticeTitle, - rowsModel.noticePublisher, - "", - "" - ) - Log.d( - "Casic", - "NoticeListActivity => onItemClicked: ${rowsModel.minioFileName.combineFilePath()}" - ) - navigatePageTo(allArgs) - } - }) - } - } - } - } - true - } - - //TODO 判断是否开启通知权限 - private fun hasNoticePermission(): Boolean { - - return false - } - - override fun initLayoutView(): Int = R.layout.activity_notice_list - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/PreviewDocumentActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/PreviewDocumentActivity.kt deleted file mode 100644 index e233ddc..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/PreviewDocumentActivity.kt +++ /dev/null @@ -1,24 +0,0 @@ -package com.casic.xz.meterage.view - -import com.casic.xz.meterage.R -import com.pengxh.kt.lite.base.KotlinBaseActivity - -class PreviewDocumentActivity : KotlinBaseActivity() { - override fun initData() { - - } - - override fun initEvent() { - - } - - override fun initLayoutView(): Int = R.layout.activity_preview_doc - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/PreviewPdfActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/PreviewPdfActivity.kt deleted file mode 100644 index 39f8ac2..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/PreviewPdfActivity.kt +++ /dev/null @@ -1,62 +0,0 @@ -package com.casic.xz.meterage.view - -import com.casic.xz.meterage.R -import com.casic.xz.meterage.extensions.combineFilePath -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.utils.LoadingDialogHub -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.callback.OnDownloadListener -import com.pengxh.kt.lite.extensions.createDownloadFileDir -import com.pengxh.kt.lite.extensions.downloadFile -import com.pengxh.kt.lite.utils.Constant -import kotlinx.android.synthetic.main.activity_preview_pdf.* -import kotlinx.android.synthetic.main.include_base_title.* -import java.io.File -import java.io.FileInputStream - - -class PreviewPdfActivity : KotlinBaseActivity() { - - override fun initData() { - val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! - titleView.text = minioFileName - - val url = minioFileName.combineFilePath() - url.downloadFile(createDownloadFileDir().toString(), - object : OnDownloadListener { - override fun onDownloadStart(totalBytes: Long) { - runOnUiThread { - LoadingDialogHub.show(this@PreviewPdfActivity, "附件加载中") - } - } - - override fun onProgressChanged(currentBytes: Long) { - - } - - override fun onDownloadEnd(file: File?) { - runOnUiThread { - LoadingDialogHub.dismiss() - } - val inputStream = FileInputStream(file) - pdfView.fromStream(inputStream).load() - } - }) - } - - override fun initEvent() { - leftBackView.setOnClickListener { finish() } - } - - override fun initLayoutView(): Int = R.layout.activity_preview_pdf - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/PreviewTextActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/PreviewTextActivity.kt deleted file mode 100644 index d634ca3..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/PreviewTextActivity.kt +++ /dev/null @@ -1,60 +0,0 @@ -package com.casic.xz.meterage.view - -import com.casic.xz.meterage.R -import com.casic.xz.meterage.extensions.combineFilePath -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.utils.LoadingDialogHub -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.callback.OnDownloadListener -import com.pengxh.kt.lite.extensions.createDownloadFileDir -import com.pengxh.kt.lite.extensions.downloadFile -import com.pengxh.kt.lite.extensions.read -import com.pengxh.kt.lite.utils.Constant -import kotlinx.android.synthetic.main.activity_preview_txt.* -import kotlinx.android.synthetic.main.include_base_title.* -import java.io.File - -class PreviewTextActivity : KotlinBaseActivity() { - - override fun initData() { - val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! - titleView.text = minioFileName - - val url = minioFileName.combineFilePath() - url.downloadFile(createDownloadFileDir().toString(), - object : OnDownloadListener { - override fun onDownloadStart(totalBytes: Long) { - runOnUiThread { - LoadingDialogHub.show(this@PreviewTextActivity, "附件加载中") - } - } - - override fun onProgressChanged(currentBytes: Long) { - - } - - override fun onDownloadEnd(file: File?) { - runOnUiThread { - LoadingDialogHub.dismiss() - textView.text = file?.read() - } - } - }) - } - - override fun initEvent() { - leftBackView.setOnClickListener { finish() } - } - - override fun initLayoutView(): Int = R.layout.activity_preview_txt - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentActivity.kt new file mode 100644 index 0000000..35ca098 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentActivity.kt @@ -0,0 +1,158 @@ +package com.casic.xz.meterage.view.home + +import android.os.Handler +import androidx.lifecycle.ViewModelProvider +import androidx.recyclerview.widget.DividerItemDecoration +import com.casic.xz.meterage.R +import com.casic.xz.meterage.adapter.EquipmentListAdapter +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.extensions.showEmptyPage +import com.casic.xz.meterage.model.EquipmentListModel +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.casic.xz.meterage.vm.EquipmentViewModel +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.extensions.navigatePageTo +import com.pengxh.kt.lite.extensions.show +import com.pengxh.kt.lite.utils.WeakReferenceHandler +import com.pengxh.kt.lite.vm.LoadState +import kotlinx.android.synthetic.main.activity_equipment.* +import kotlinx.android.synthetic.main.include_empty_view.* +import kotlinx.android.synthetic.main.include_search_title.* + +class EquipmentActivity : KotlinBaseActivity() { + + private lateinit var weakReferenceHandler: WeakReferenceHandler + private lateinit var equipmentViewModel: EquipmentViewModel + private lateinit var equipmentListAdapter: EquipmentListAdapter + private var dataBeans: MutableList = ArrayList() + private var pageIndex = 1 + private var isRefresh = false + private var isLoadMore = false + + override fun initData() { + weakReferenceHandler = WeakReferenceHandler(callback) + equipmentViewModel = ViewModelProvider(this)[EquipmentViewModel::class.java] + equipmentViewModel.equipmentResult.observe(this, { + if (it.code == 200) { + val dataRows = it.data?.rows!! + when { + isRefresh -> { + dataBeans.clear() + dataBeans = dataRows + equipmentLayout.finishRefresh() + isRefresh = false + } + isLoadMore -> { + if (dataRows.size == 0) { + "到底了,别拉了".show(this) + } + dataBeans.addAll(dataRows) + equipmentLayout.finishLoadMore() + isLoadMore = false + } + else -> { + dataBeans = dataRows + } + } + weakReferenceHandler.sendEmptyMessage(2023020801) + } + }) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + rightOperateView.setOnClickListener { + + } + + equipmentLayout.setOnRefreshListener { + isRefresh = true + //刷新之后页码重置 + pageIndex = 1 + getEquipmentListByPage() + } + + equipmentLayout.setOnLoadMoreListener { + isLoadMore = true + pageIndex++ + getEquipmentListByPage() + } + } + + override fun initLayoutView(): Int = R.layout.activity_equipment + + override fun observeRequestState() { + equipmentViewModel.loadState.observe(this, { + when (it) { + LoadState.Loading -> LoadingDialogHub.show(this, "数据加载中...") + else -> LoadingDialogHub.dismiss() + } + }) + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + titleView.text = "仪器设备" + } + + override fun onResume() { + super.onResume() + pageIndex = 1 + getEquipmentListByPage() + } + + private fun getEquipmentListByPage() { + equipmentViewModel.getEquipmentList( + "", + "", + "", + "", + "", + "1", + "", + "", + "", + "", + "", + "", + "", + "", + arrayOf(), + pageIndex + ) + } + + private val callback = Handler.Callback { + when (it.what) { + 2023020801 -> { + if (isRefresh || isLoadMore) { + equipmentListAdapter.notifyDataSetChanged() + } else { + if (dataBeans.size == 0) { + emptyView!!.showEmptyPage("无设备") { + pageIndex = 1 + getEquipmentListByPage() + } + } else { + emptyView!!.hide() + equipmentListAdapter = EquipmentListAdapter(this, dataBeans) + equipmentRecyclerView.addItemDecoration( + DividerItemDecoration(this, DividerItemDecoration.VERTICAL) + ) + equipmentRecyclerView.adapter = equipmentListAdapter + equipmentListAdapter.setOnItemClickListener(object : + EquipmentListAdapter.OnItemClickListener { + override fun onItemClicked(position: Int) { + val rowsModel = dataBeans[position] + navigatePageTo(rowsModel.id) + } + }) + } + } + } + } + true + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentDetailActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentDetailActivity.kt new file mode 100644 index 0000000..7dee13c --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentDetailActivity.kt @@ -0,0 +1,53 @@ +package com.casic.xz.meterage.view.home + +import androidx.fragment.app.Fragment +import com.casic.xz.meterage.R +import com.casic.xz.meterage.adapter.SubViewPagerAdapter +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.fragment.equipment.* +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.utils.Constant +import kotlinx.android.synthetic.main.activity_equipment.rootView +import kotlinx.android.synthetic.main.activity_equipment_detail.* +import kotlinx.android.synthetic.main.include_base_title.* + +class EquipmentDetailActivity : KotlinBaseActivity() { + + private var fragmentPages: ArrayList = ArrayList() + + override fun initData() { + val equipmentId = intent.getStringExtra(Constant.INTENT_PARAM)!! + + fragmentPages.add(BasicInformationFragment(equipmentId)) + fragmentPages.add(InspectionRecordFragment()) + fragmentPages.add(ChangeRecordFragment()) + fragmentPages.add(UsageRecordFragment()) + fragmentPages.add(CertificateFragment()) + + val equipmentPageTitles = arrayOf("基础信息", "周检记录", "状态变更记录", "使用记录", "检定证书") + + equipmentViewPager.adapter = SubViewPagerAdapter( + supportFragmentManager, fragmentPages, equipmentPageTitles + ) + equipmentViewPager.offscreenPageLimit = fragmentPages.size + //绑定 + topTabLayout.setupWithViewPager(equipmentViewPager) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + } + + override fun initLayoutView(): Int = R.layout.activity_equipment_detail + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + titleView.text = "仪器设备" + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeDetailActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeDetailActivity.kt new file mode 100644 index 0000000..6fe0022 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeDetailActivity.kt @@ -0,0 +1,105 @@ +package com.casic.xz.meterage.view.notice + +import android.annotation.SuppressLint +import android.graphics.Paint +import androidx.lifecycle.ViewModelProvider +import com.casic.xz.meterage.R +import com.casic.xz.meterage.extensions.combineImagePath +import com.casic.xz.meterage.extensions.formatTextFromHtml +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.view.BigImageActivity +import com.casic.xz.meterage.vm.NoticeViewModel +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.extensions.convertColor +import com.pengxh.kt.lite.extensions.navigatePageTo +import com.pengxh.kt.lite.extensions.obtainScreenWidth +import com.pengxh.kt.lite.extensions.show +import com.pengxh.kt.lite.utils.Constant +import kotlinx.android.synthetic.main.activity_notice_detail.* +import kotlinx.android.synthetic.main.include_base_title.* +import java.util.* + +@SuppressLint("SetTextI18n") +class NoticeDetailActivity : KotlinBaseActivity() { + + private lateinit var noticeViewModel: NoticeViewModel + + override fun initData() { + leftBackView.setOnClickListener { finish() } + titleView.text = "通知公告" + + val args = intent.getStringArrayListExtra(Constant.INTENT_PARAM)!! + + noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] + noticeViewModel.getNoticeList(args[0], args[1], args[2], "", "", 1) + noticeViewModel.noticeResult.observe(this, { + if (it.code == 200) { + val dataRow = it.data?.rows!![0] + + noticeDateView.text = dataRow.noticeTime + noticePublisherView.text = "发布人 ${dataRow.noticePublisher}" + noticeCompanyView.text = "发布单位 ${dataRow.noticeCompany}" + + noticeNoView.text = dataRow.noticeNo + noticeTitleView.text = dataRow.noticeTitle + noticeSketchView.text = dataRow.noticeSketch + + dataRow.noticeContent.formatTextFromHtml( + this, noticeContentView, obtainScreenWidth() + ) + + if (dataRow.minioFileName.isNullOrBlank()) { + minioFileView.text = "暂无附件" + } else { + val minioFileName = dataRow.minioFileName + + minioFileView.text = minioFileName + val textPaint = minioFileView.paint + textPaint.flags = Paint.UNDERLINE_TEXT_FLAG + textPaint.isAntiAlias = true + minioFileView.setTextColor(R.color.themeColor.convertColor(this)) + + minioFileView.setOnClickListener { + //查看附件 + if (minioFileName.endsWith("pdf")) { + navigatePageTo(minioFileName) + } else if ( + minioFileName.endsWith("doc") || + minioFileName.endsWith("docx") + ) { + navigatePageTo(minioFileName) + } else if (minioFileName.endsWith("txt")) { + navigatePageTo(minioFileName) + } else if ( + minioFileName.endsWith("png") || + minioFileName.endsWith("jpeg") || + minioFileName.endsWith("jpg") + ) { + val urls = ArrayList() + urls.add(minioFileName.combineImagePath()) + navigatePageTo(0, urls) + } else { + "文件类型未知,无法打开附件".show(this) + } + } + } + } + }) + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.activity_notice_detail + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeListActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeListActivity.kt new file mode 100644 index 0000000..31c0490 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeListActivity.kt @@ -0,0 +1,180 @@ +package com.casic.xz.meterage.view.notice + +import android.os.Handler +import android.util.Log +import android.view.View +import androidx.lifecycle.ViewModelProvider +import com.casic.xz.meterage.R +import com.casic.xz.meterage.adapter.NoticeListAdapter +import com.casic.xz.meterage.extensions.addAll +import com.casic.xz.meterage.extensions.combineFilePath +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.extensions.showEmptyPage +import com.casic.xz.meterage.model.NoticeListModel +import com.casic.xz.meterage.vm.NoticeViewModel +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.extensions.navigatePageTo +import com.pengxh.kt.lite.extensions.show +import com.pengxh.kt.lite.utils.WeakReferenceHandler +import com.pengxh.kt.lite.widget.dialog.AlertControlDialog +import kotlinx.android.synthetic.main.activity_notice_list.* +import kotlinx.android.synthetic.main.include_empty_view.* + +class NoticeListActivity : KotlinBaseActivity() { + + private lateinit var weakReferenceHandler: WeakReferenceHandler + private lateinit var noticeViewModel: NoticeViewModel + private lateinit var noticeListAdapter: NoticeListAdapter + private var dataBeans: MutableList = ArrayList() + private var pageIndex = 1 + private var isRefresh = false + private var isLoadMore = false + + override fun initData() { + weakReferenceHandler = WeakReferenceHandler(callback) + noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] + noticeViewModel.noticeResult.observe(this, { + if (it.code == 200) { + val dataRows = it.data?.rows!! +// countBadeNumber(dataRows) + when { + isRefresh -> { + dataBeans.clear() + dataBeans = dataRows + noticeLayout.finishRefresh() + isRefresh = false + } + isLoadMore -> { + if (dataRows.size == 0) { + "到底了,别拉了".show(this) + } + dataBeans.addAll(dataRows) + noticeLayout.finishLoadMore() + isLoadMore = false + } + else -> { + dataBeans = dataRows + } + } + weakReferenceHandler.sendEmptyMessage(2023013101) + } + }) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + rightOperateView.setOnClickListener { + AlertControlDialog.Builder() + .setContext(this) + .setTitle("提示") + .setMessage("确定将所有未读消息标为已读?") + .setNegativeButton("取消") + .setPositiveButton("确定") + .setOnDialogButtonClickListener(object : + AlertControlDialog.OnDialogButtonClickListener { + override fun onCancelClick() { + + } + + override fun onConfirmClick() { + //TODO 设置为已读 + } + }).build().show() + } + + if (hasNoticePermission()) { + openSystemNoticeLayout.visibility = View.GONE + openSystemNoticeLayout.visibility = View.GONE + } else { + openSystemNoticeLayout.setOnClickListener { + + } + + + closeLayoutView.setOnClickListener { + openSystemNoticeLayout.visibility = View.GONE + } + } + + noticeLayout.setOnRefreshListener { + isRefresh = true + //刷新之后页码重置 + pageIndex = 1 + getNoticeListByPage() + } + + noticeLayout.setOnLoadMoreListener { + isLoadMore = true + pageIndex++ + getNoticeListByPage() + } + } + + override fun onResume() { + super.onResume() + pageIndex = 1 + getNoticeListByPage() + } + + private fun getNoticeListByPage() { + noticeViewModel.getNoticeList("", "", "", "", "", pageIndex) + } + + private val callback = Handler.Callback { + when (it.what) { + 2023013101 -> { + if (isRefresh || isLoadMore) { + noticeListAdapter.notifyDataSetChanged() + } else { + if (dataBeans.size == 0) { + emptyView!!.showEmptyPage("没有任何消息") { + pageIndex = 1 + getNoticeListByPage() + } + } else { + emptyView!!.hide() + noticeListAdapter = NoticeListAdapter(this, dataBeans) + noticeRecyclerView.adapter = noticeListAdapter + noticeListAdapter.setOnItemClickListener(object : + NoticeListAdapter.OnItemClickListener { + override fun onItemClicked(position: Int) { + val rowsModel = dataBeans[position] + val allArgs = addAll( + rowsModel.noticeNo, + rowsModel.noticeTitle, + rowsModel.noticePublisher, + "", + "" + ) + Log.d( + "Casic", + "NoticeListActivity => onItemClicked: ${rowsModel.minioFileName.combineFilePath()}" + ) + navigatePageTo(allArgs) + } + }) + } + } + } + } + true + } + + //TODO 判断是否开启通知权限 + private fun hasNoticePermission(): Boolean { + + return false + } + + override fun initLayoutView(): Int = R.layout.activity_notice_list + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewDocumentActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewDocumentActivity.kt new file mode 100644 index 0000000..4b16ae8 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewDocumentActivity.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.view.notice + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseActivity + +class PreviewDocumentActivity : KotlinBaseActivity() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.activity_preview_doc + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewPdfActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewPdfActivity.kt new file mode 100644 index 0000000..fad73b6 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewPdfActivity.kt @@ -0,0 +1,62 @@ +package com.casic.xz.meterage.view.notice + +import com.casic.xz.meterage.R +import com.casic.xz.meterage.extensions.combineFilePath +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.callback.OnDownloadListener +import com.pengxh.kt.lite.extensions.createDownloadFileDir +import com.pengxh.kt.lite.extensions.downloadFile +import com.pengxh.kt.lite.utils.Constant +import kotlinx.android.synthetic.main.activity_preview_pdf.* +import kotlinx.android.synthetic.main.include_base_title.* +import java.io.File +import java.io.FileInputStream + + +class PreviewPdfActivity : KotlinBaseActivity() { + + override fun initData() { + val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! + titleView.text = minioFileName + + val url = minioFileName.combineFilePath() + url.downloadFile(createDownloadFileDir().toString(), + object : OnDownloadListener { + override fun onDownloadStart(totalBytes: Long) { + runOnUiThread { + LoadingDialogHub.show(this@PreviewPdfActivity, "附件加载中") + } + } + + override fun onProgressChanged(currentBytes: Long) { + + } + + override fun onDownloadEnd(file: File?) { + runOnUiThread { + LoadingDialogHub.dismiss() + } + val inputStream = FileInputStream(file) + pdfView.fromStream(inputStream).load() + } + }) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + } + + override fun initLayoutView(): Int = R.layout.activity_preview_pdf + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewTextActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewTextActivity.kt new file mode 100644 index 0000000..d7850fb --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewTextActivity.kt @@ -0,0 +1,60 @@ +package com.casic.xz.meterage.view.notice + +import com.casic.xz.meterage.R +import com.casic.xz.meterage.extensions.combineFilePath +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.callback.OnDownloadListener +import com.pengxh.kt.lite.extensions.createDownloadFileDir +import com.pengxh.kt.lite.extensions.downloadFile +import com.pengxh.kt.lite.extensions.read +import com.pengxh.kt.lite.utils.Constant +import kotlinx.android.synthetic.main.activity_preview_txt.* +import kotlinx.android.synthetic.main.include_base_title.* +import java.io.File + +class PreviewTextActivity : KotlinBaseActivity() { + + override fun initData() { + val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! + titleView.text = minioFileName + + val url = minioFileName.combineFilePath() + url.downloadFile(createDownloadFileDir().toString(), + object : OnDownloadListener { + override fun onDownloadStart(totalBytes: Long) { + runOnUiThread { + LoadingDialogHub.show(this@PreviewTextActivity, "附件加载中") + } + } + + override fun onProgressChanged(currentBytes: Long) { + + } + + override fun onDownloadEnd(file: File?) { + runOnUiThread { + LoadingDialogHub.dismiss() + textView.text = file?.read() + } + } + }) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + } + + override fun initLayoutView(): Int = R.layout.activity_preview_txt + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/vm/EquipmentViewModel.kt b/app/src/main/java/com/casic/xz/meterage/vm/EquipmentViewModel.kt new file mode 100644 index 0000000..b5f21f6 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/vm/EquipmentViewModel.kt @@ -0,0 +1,92 @@ +package com.casic.xz.meterage.vm + +import androidx.lifecycle.MutableLiveData +import com.casic.xz.meterage.base.BaseApplication +import com.casic.xz.meterage.extensions.separateResponseCode +import com.casic.xz.meterage.extensions.toErrorMessage +import com.casic.xz.meterage.model.EquipmentDetailModel +import com.casic.xz.meterage.model.EquipmentListModel +import com.casic.xz.meterage.utils.retrofit.RetrofitServiceManager +import com.google.gson.Gson +import com.google.gson.reflect.TypeToken +import com.pengxh.kt.lite.extensions.launch +import com.pengxh.kt.lite.extensions.show +import com.pengxh.kt.lite.vm.BaseViewModel +import com.pengxh.kt.lite.vm.LoadState + +class EquipmentViewModel : BaseViewModel() { + + private val gson by lazy { Gson() } + val equipmentResult = MutableLiveData() + val equipmentDetailResult = MutableLiveData() + + fun getEquipmentList( + equipmentNo: String, + equipmentName: String, + mesureType: String, + managerState: String, + useDept: String, + assetType: String, + equipmentCategory: String, + isCalibrationTestEquipment: String, + isMeasureAccount: String, + isStandardSupportEquipment: String, + isFixedAssets: String, + validStartDate: String, + validEndDate: String, + abc: String, + ids: Array, + offset: Int + ) = launch({ + loadState.value = LoadState.Loading + val response = RetrofitServiceManager.getEquipmentList( + equipmentNo, + equipmentName, + mesureType, + managerState, + useDept, + assetType, + equipmentCategory, + isCalibrationTestEquipment, + isMeasureAccount, + isStandardSupportEquipment, + isFixedAssets, + validStartDate, + validEndDate, + abc, + ids, + offset + ) + val responseCode = response.separateResponseCode() + if (responseCode == 200) { + loadState.value = LoadState.Success + equipmentResult.value = gson.fromJson( + response, object : TypeToken() {}.type + ) + } else { + loadState.value = LoadState.Fail + response.toErrorMessage().show(BaseApplication.get()) + } + }, { + loadState.value = LoadState.Fail + it.printStackTrace() + }) + + fun getEquipmentDetail(id: String) = launch({ + loadState.value = LoadState.Loading + val response = RetrofitServiceManager.getEquipmentDetail(id) + val responseCode = response.separateResponseCode() + if (responseCode == 200) { + loadState.value = LoadState.Success + equipmentDetailResult.value = gson.fromJson( + response, object : TypeToken() {}.type + ) + } else { + loadState.value = LoadState.Fail + response.toErrorMessage().show(BaseApplication.get()) + } + }, { + loadState.value = LoadState.Fail + it.printStackTrace() + }) +} \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_sorting.xml b/app/src/main/res/drawable/ic_sorting.xml new file mode 100644 index 0000000..252bfe6 --- /dev/null +++ b/app/src/main/res/drawable/ic_sorting.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/layout/activity_equipment.xml b/app/src/main/res/layout/activity_equipment.xml new file mode 100644 index 0000000..d6a64b1 --- /dev/null +++ b/app/src/main/res/layout/activity_equipment.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 3892b5a..02160cd 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -34,16 +34,18 @@ - - - - - - - + + + + + + + + + +) : RecyclerView.Adapter() { + + private var layoutInflater: LayoutInflater = LayoutInflater.from(context) + + override fun getItemCount(): Int = dataRows.size + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = ItemViewHolder( + layoutInflater.inflate(R.layout.item_equipment_rv_l, parent, false) + ) + + override fun onBindViewHolder(holder: ItemViewHolder, position: Int) { + //绑定数据 + val rowsBean = dataRows[position] + holder.equipmentNameView.text = rowsBean.equipmentName + holder.equipmentCodeView.text = rowsBean.equipmentNo + holder.equipmentDateView.text = rowsBean.enableDate + holder.equipmentLibView.text = rowsBean.useDeptName + + //绑定事件 + holder.itemView.setOnClickListener { + listener?.onItemClicked(position) + } + } + + inner class ItemViewHolder(view: View) : RecyclerView.ViewHolder(view) { + var equipmentNameView: TextView = view.findViewById(R.id.equipmentNameView) + var equipmentCodeView: TextView = view.findViewById(R.id.equipmentCodeView) + var equipmentDateView: TextView = view.findViewById(R.id.equipmentDateView) + var equipmentLibView: TextView = view.findViewById(R.id.equipmentLibView) + } + + private var listener: OnItemClickListener? = null + + interface OnItemClickListener { + fun onItemClicked(position: Int) + } + + fun setOnItemClickListener(onClickListener: OnItemClickListener?) { + this.listener = onClickListener + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt index b4628f3..d970b55 100644 --- a/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt +++ b/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt @@ -5,7 +5,8 @@ import com.casic.xz.meterage.R import com.casic.xz.meterage.adapter.HomeGridAdapter import com.casic.xz.meterage.utils.LocaleConstant -import com.casic.xz.meterage.view.NoticeListActivity +import com.casic.xz.meterage.view.home.EquipmentActivity +import com.casic.xz.meterage.view.notice.NoticeListActivity import com.casic.xz.meterage.vm.NoticeViewModel import com.pengxh.kt.lite.base.KotlinBaseFragment import com.pengxh.kt.lite.extensions.navigatePageTo @@ -36,8 +37,19 @@ homeFuncRecyclerView.adapter = homeAdapter homeAdapter.setOnGridItemClickListener(object : HomeGridAdapter.OnGridItemClickListener { override fun onItemClick(position: Int) { - when (position) { - + when (LocaleConstant.HOME_FUNC_OPERATE[position]) { + "仪器设备" -> requireContext().navigatePageTo() +// "标准装置" -> requireContext().navigatePageTo() +// "证书报告" -> requireContext().navigatePageTo() +// "委托需求" -> requireContext().navigatePageTo() +// "访客" -> requireContext().navigatePageTo() +// "标准规范" -> requireContext().navigatePageTo() +// "能力列表" -> requireContext().navigatePageTo() +// "计量培训" -> requireContext().navigatePageTo() +// "合同发票" -> requireContext().navigatePageTo() +// "业务统计" -> requireContext().navigatePageTo() +// "客户列表" -> requireContext().navigatePageTo() +// "外场检测" -> requireContext().navigatePageTo() } } }) diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt index 7e75abe..56dc5ec 100644 --- a/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt +++ b/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt @@ -2,9 +2,11 @@ import android.view.View import androidx.lifecycle.ViewModelProvider +import com.bumptech.glide.Glide +import com.bumptech.glide.request.RequestOptions import com.casic.xz.meterage.R import com.casic.xz.meterage.utils.LocaleConstant -import com.casic.xz.meterage.view.NoticeListActivity +import com.casic.xz.meterage.view.notice.NoticeListActivity import com.casic.xz.meterage.vm.NoticeViewModel import com.casic.xz.meterage.vm.UserViewModel import com.pengxh.kt.lite.base.KotlinBaseFragment @@ -23,6 +25,12 @@ val data = it.data userNameView.text = data.name userUnitView.text = data.deptName + +// Glide.with(requireContext()) +// .load(R.mipmap.default_avatar) +// .apply(RequestOptions.circleCropTransform()) +// .placeholder(R.mipmap.load_image_error) +// .into(userAvatarView) } }) diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt new file mode 100644 index 0000000..cf22646 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt @@ -0,0 +1,103 @@ +package com.casic.xz.meterage.fragment.equipment + +import android.graphics.Paint +import androidx.lifecycle.ViewModelProvider +import com.casic.xz.meterage.R +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.casic.xz.meterage.vm.EquipmentViewModel +import com.pengxh.kt.lite.base.KotlinBaseFragment +import com.pengxh.kt.lite.extensions.convertColor +import com.pengxh.kt.lite.vm.LoadState +import kotlinx.android.synthetic.main.fragment_basic_information.* + +class BasicInformationFragment(private val id: String) : KotlinBaseFragment() { + + private lateinit var equipmentViewModel: EquipmentViewModel + + override fun initData() { + equipmentViewModel = ViewModelProvider(this)[EquipmentViewModel::class.java] + equipmentViewModel.getEquipmentDetail(id) + equipmentViewModel.equipmentDetailResult.observe(this, { + if (it.code == 200) { + val data = it.data!! + + equipmentCodeView.text = data.equipmentNo + equipmentNameView.text = data.equipmentName + manufacturerView.text = data.manufacturer + factoryNumberView.text = data.manufacturingNo + modelView.text = data.modelNo + verificationMethodView.text = data.mesureTypeName + measuringRangeView.text = data.mesureRange + uncertaintyView.text = data.uncertainty + firstUseView.text = data.createTime + originalValueView.text = data.originValue + usageDeptView.text = data.useDeptName + userView.text = data.usePersonName + managementStatusView.text = data.managerStateName + verificationDeptView.text = data.useDeptName +// nextVerificationDeptView.text = data. + verificationPeriodView.text = data.mesureCycle + verificationDateView.text = data.mesureDate + effectiveDateView.text = data.validDate + verificationResultsView.text = data.mesureResultName + abcView.text = data.abcName + isNeedTechnicalView.text = if ( + data.isCalibrationTestEquipment.isNullOrBlank() || data.isCalibrationTestEquipment == "0" + ) { + "否" + } else { + "是" + } + + isStandingBook.text = if ( + data.isMeasureAccount.isNullOrBlank() || data.isMeasureAccount == "0" + ) { + "否" + } else { + "是" + } + + isStandardView.text = if ( + data.isStandardSupportEquipment.isNullOrBlank() || data.isStandardSupportEquipment == "0" + ) { + "否" + } else { + "是" + } + remarkView.text = data.remark + if (data.fileList.size == 0) { + instructionsView.text = "暂无" + } else { + instructionsView.text = "查看附件列表" + val textPaint = instructionsView.paint + textPaint.flags = Paint.UNDERLINE_TEXT_FLAG + textPaint.isAntiAlias = true + instructionsView.setTextColor(R.color.themeColor.convertColor(requireContext())) + + instructionsView.setOnClickListener { + + } + } + } + }) + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_basic_information + + override fun observeRequestState() { + equipmentViewModel.loadState.observe(this, { + when (it) { + LoadState.Loading -> LoadingDialogHub.show(requireActivity(), "数据加载中...") + else -> LoadingDialogHub.dismiss() + } + }) + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt new file mode 100644 index 0000000..0b4a747 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class CertificateFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_certificate + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt new file mode 100644 index 0000000..f05c491 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class ChangeRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_change_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt new file mode 100644 index 0000000..849ffa5 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class InspectionRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_inspection_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt new file mode 100644 index 0000000..aa4edd9 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class UsageRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_usage_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java b/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java new file mode 100644 index 0000000..0b9124e --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java @@ -0,0 +1,760 @@ +package com.casic.xz.meterage.model; + +import java.util.List; + +public class EquipmentDetailModel { + + private int code; + private DataModel data; + private String message; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataModel getData() { + return data; + } + + public void setData(DataModel data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public static class DataModel { + private String abc; + private String abcName; + private String assetNo; + private String assetSource; + private String assetType; + private String assetTypeName; + private String attribute; + private String capitalSource; + private String capitalSourceName; + private String cardEstablishmentDate; + private String createTime; + private String createUser; + private String depreciationMethod; + private String depreciationMethodName; + private String depreciationPeriod; + private String enableDate; + private String equipmentCategory; + private String equipmentCategoryName; + private String equipmentName; + private String equipmentNo; + private String equipmentSpecifications; + private String equipmentType; + private String equipmentTypeName; + private List fileList; + private String id; + private String installIncidentalExpenses; + private String installPlace; + private String intactState; + private String isCalibrationTestEquipment; + private int isDel; + private String isFixedAssets; + private String isMeasureAccount; + private String isStandardSupportEquipment; + private String labelBind; + private String majorCategory; + private String majorCategoryName; + private String managerLevel; + private String managerLevelName; + private String managerState; + private String managerStateName; + private String manufacturer; + private String manufacturerCountry; + private String manufacturingDate; + private String manufacturingNo; + private String mesureCycle; + private String mesureDate; + private String mesureDept; + private String mesureRange; + private String mesureResult; + private String mesureResultName; + private String mesureType; + private String mesureTypeName; + private String modelNo; + private String originValue; + private String overallDimension; + private String presentOriginValue; + private String purpose; + private String remark; + private String singlePrice; + private String supportStandardEquipmentName; + private String supportStandardEquipmentNo; + private String technicalLevel; + private String uncertainty; + private String updateTime; + private String useDept; + private String useDeptName; + private String usePerson; + private String usePersonName; + private String validDate; + private int version; + private String weight; + + public String getAbc() { + return abc; + } + + public void setAbc(String abc) { + this.abc = abc; + } + + public String getAbcName() { + return abcName; + } + + public void setAbcName(String abcName) { + this.abcName = abcName; + } + + public String getAssetNo() { + return assetNo; + } + + public void setAssetNo(String assetNo) { + this.assetNo = assetNo; + } + + public String getAssetSource() { + return assetSource; + } + + public void setAssetSource(String assetSource) { + this.assetSource = assetSource; + } + + public String getAssetType() { + return assetType; + } + + public void setAssetType(String assetType) { + this.assetType = assetType; + } + + public String getAssetTypeName() { + return assetTypeName; + } + + public void setAssetTypeName(String assetTypeName) { + this.assetTypeName = assetTypeName; + } + + public String getAttribute() { + return attribute; + } + + public void setAttribute(String attribute) { + this.attribute = attribute; + } + + public String getCapitalSource() { + return capitalSource; + } + + public void setCapitalSource(String capitalSource) { + this.capitalSource = capitalSource; + } + + public String getCapitalSourceName() { + return capitalSourceName; + } + + public void setCapitalSourceName(String capitalSourceName) { + this.capitalSourceName = capitalSourceName; + } + + public String getCardEstablishmentDate() { + return cardEstablishmentDate; + } + + public void setCardEstablishmentDate(String cardEstablishmentDate) { + this.cardEstablishmentDate = cardEstablishmentDate; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getDepreciationMethod() { + return depreciationMethod; + } + + public void setDepreciationMethod(String depreciationMethod) { + this.depreciationMethod = depreciationMethod; + } + + public String getDepreciationMethodName() { + return depreciationMethodName; + } + + public void setDepreciationMethodName(String depreciationMethodName) { + this.depreciationMethodName = depreciationMethodName; + } + + public String getDepreciationPeriod() { + return depreciationPeriod; + } + + public void setDepreciationPeriod(String depreciationPeriod) { + this.depreciationPeriod = depreciationPeriod; + } + + public String getEnableDate() { + return enableDate; + } + + public void setEnableDate(String enableDate) { + this.enableDate = enableDate; + } + + public String getEquipmentCategory() { + return equipmentCategory; + } + + public void setEquipmentCategory(String equipmentCategory) { + this.equipmentCategory = equipmentCategory; + } + + public String getEquipmentCategoryName() { + return equipmentCategoryName; + } + + public void setEquipmentCategoryName(String equipmentCategoryName) { + this.equipmentCategoryName = equipmentCategoryName; + } + + public String getEquipmentName() { + return equipmentName; + } + + public void setEquipmentName(String equipmentName) { + this.equipmentName = equipmentName; + } + + public String getEquipmentNo() { + return equipmentNo; + } + + public void setEquipmentNo(String equipmentNo) { + this.equipmentNo = equipmentNo; + } + + public String getEquipmentSpecifications() { + return equipmentSpecifications; + } + + public void setEquipmentSpecifications(String equipmentSpecifications) { + this.equipmentSpecifications = equipmentSpecifications; + } + + public String getEquipmentType() { + return equipmentType; + } + + public void setEquipmentType(String equipmentType) { + this.equipmentType = equipmentType; + } + + public String getEquipmentTypeName() { + return equipmentTypeName; + } + + public void setEquipmentTypeName(String equipmentTypeName) { + this.equipmentTypeName = equipmentTypeName; + } + + public List getFileList() { + return fileList; + } + + public void setFileList(List fileList) { + this.fileList = fileList; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getInstallIncidentalExpenses() { + return installIncidentalExpenses; + } + + public void setInstallIncidentalExpenses(String installIncidentalExpenses) { + this.installIncidentalExpenses = installIncidentalExpenses; + } + + public String getInstallPlace() { + return installPlace; + } + + public void setInstallPlace(String installPlace) { + this.installPlace = installPlace; + } + + public String getIntactState() { + return intactState; + } + + public void setIntactState(String intactState) { + this.intactState = intactState; + } + + public String getIsCalibrationTestEquipment() { + return isCalibrationTestEquipment; + } + + public void setIsCalibrationTestEquipment(String isCalibrationTestEquipment) { + this.isCalibrationTestEquipment = isCalibrationTestEquipment; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getIsFixedAssets() { + return isFixedAssets; + } + + public void setIsFixedAssets(String isFixedAssets) { + this.isFixedAssets = isFixedAssets; + } + + public String getIsMeasureAccount() { + return isMeasureAccount; + } + + public void setIsMeasureAccount(String isMeasureAccount) { + this.isMeasureAccount = isMeasureAccount; + } + + public String getIsStandardSupportEquipment() { + return isStandardSupportEquipment; + } + + public void setIsStandardSupportEquipment(String isStandardSupportEquipment) { + this.isStandardSupportEquipment = isStandardSupportEquipment; + } + + public String getLabelBind() { + return labelBind; + } + + public void setLabelBind(String labelBind) { + this.labelBind = labelBind; + } + + public String getMajorCategory() { + return majorCategory; + } + + public void setMajorCategory(String majorCategory) { + this.majorCategory = majorCategory; + } + + public String getMajorCategoryName() { + return majorCategoryName; + } + + public void setMajorCategoryName(String majorCategoryName) { + this.majorCategoryName = majorCategoryName; + } + + public String getManagerLevel() { + return managerLevel; + } + + public void setManagerLevel(String managerLevel) { + this.managerLevel = managerLevel; + } + + public String getManagerLevelName() { + return managerLevelName; + } + + public void setManagerLevelName(String managerLevelName) { + this.managerLevelName = managerLevelName; + } + + public String getManagerState() { + return managerState; + } + + public void setManagerState(String managerState) { + this.managerState = managerState; + } + + public String getManagerStateName() { + return managerStateName; + } + + public void setManagerStateName(String managerStateName) { + this.managerStateName = managerStateName; + } + + public String getManufacturer() { + return manufacturer; + } + + public void setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + } + + public String getManufacturerCountry() { + return manufacturerCountry; + } + + public void setManufacturerCountry(String manufacturerCountry) { + this.manufacturerCountry = manufacturerCountry; + } + + public String getManufacturingDate() { + return manufacturingDate; + } + + public void setManufacturingDate(String manufacturingDate) { + this.manufacturingDate = manufacturingDate; + } + + public String getManufacturingNo() { + return manufacturingNo; + } + + public void setManufacturingNo(String manufacturingNo) { + this.manufacturingNo = manufacturingNo; + } + + public String getMesureCycle() { + return mesureCycle; + } + + public void setMesureCycle(String mesureCycle) { + this.mesureCycle = mesureCycle; + } + + public String getMesureDate() { + return mesureDate; + } + + public void setMesureDate(String mesureDate) { + this.mesureDate = mesureDate; + } + + public String getMesureDept() { + return mesureDept; + } + + public void setMesureDept(String mesureDept) { + this.mesureDept = mesureDept; + } + + public String getMesureRange() { + return mesureRange; + } + + public void setMesureRange(String mesureRange) { + this.mesureRange = mesureRange; + } + + public String getMesureResult() { + return mesureResult; + } + + public void setMesureResult(String mesureResult) { + this.mesureResult = mesureResult; + } + + public String getMesureResultName() { + return mesureResultName; + } + + public void setMesureResultName(String mesureResultName) { + this.mesureResultName = mesureResultName; + } + + public String getMesureType() { + return mesureType; + } + + public void setMesureType(String mesureType) { + this.mesureType = mesureType; + } + + public String getMesureTypeName() { + return mesureTypeName; + } + + public void setMesureTypeName(String mesureTypeName) { + this.mesureTypeName = mesureTypeName; + } + + public String getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getOriginValue() { + return originValue; + } + + public void setOriginValue(String originValue) { + this.originValue = originValue; + } + + public String getOverallDimension() { + return overallDimension; + } + + public void setOverallDimension(String overallDimension) { + this.overallDimension = overallDimension; + } + + public String getPresentOriginValue() { + return presentOriginValue; + } + + public void setPresentOriginValue(String presentOriginValue) { + this.presentOriginValue = presentOriginValue; + } + + public String getPurpose() { + return purpose; + } + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getSinglePrice() { + return singlePrice; + } + + public void setSinglePrice(String singlePrice) { + this.singlePrice = singlePrice; + } + + public String getSupportStandardEquipmentName() { + return supportStandardEquipmentName; + } + + public void setSupportStandardEquipmentName(String supportStandardEquipmentName) { + this.supportStandardEquipmentName = supportStandardEquipmentName; + } + + public String getSupportStandardEquipmentNo() { + return supportStandardEquipmentNo; + } + + public void setSupportStandardEquipmentNo(String supportStandardEquipmentNo) { + this.supportStandardEquipmentNo = supportStandardEquipmentNo; + } + + public String getTechnicalLevel() { + return technicalLevel; + } + + public void setTechnicalLevel(String technicalLevel) { + this.technicalLevel = technicalLevel; + } + + public String getUncertainty() { + return uncertainty; + } + + public void setUncertainty(String uncertainty) { + this.uncertainty = uncertainty; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getUseDept() { + return useDept; + } + + public void setUseDept(String useDept) { + this.useDept = useDept; + } + + public String getUseDeptName() { + return useDeptName; + } + + public void setUseDeptName(String useDeptName) { + this.useDeptName = useDeptName; + } + + public String getUsePerson() { + return usePerson; + } + + public void setUsePerson(String usePerson) { + this.usePerson = usePerson; + } + + public String getUsePersonName() { + return usePersonName; + } + + public void setUsePersonName(String usePersonName) { + this.usePersonName = usePersonName; + } + + public String getValidDate() { + return validDate; + } + + public void setValidDate(String validDate) { + this.validDate = validDate; + } + + public int getVersion() { + return version; + } + + public void setVersion(int version) { + this.version = version; + } + + public String getWeight() { + return weight; + } + + public void setWeight(String weight) { + this.weight = weight; + } + + public static class FileListModel { + private String assetId; + private String createTime; + private String createUser; + private String fileName; + private String id; + private int isDel; + private String minioFileName; + private String remark; + private String updateTime; + + public String getAssetId() { + return assetId; + } + + public void setAssetId(String assetId) { + this.assetId = assetId; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getFileName() { + return fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getMinioFileName() { + return minioFileName; + } + + public void setMinioFileName(String minioFileName) { + this.minioFileName = minioFileName; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + } + } +} diff --git a/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java b/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java new file mode 100644 index 0000000..15fc128 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java @@ -0,0 +1,697 @@ +package com.casic.xz.meterage.model; + +import java.util.List; + +public class EquipmentListModel { + + private int code; + private DataModel data; + private String message; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataModel getData() { + return data; + } + + public void setData(DataModel data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public static class DataModel { + private List rows; + private int total; + + public List getRows() { + return rows; + } + + public void setRows(List rows) { + this.rows = rows; + } + + public int getTotal() { + return total; + } + + public void setTotal(int total) { + this.total = total; + } + + public static class RowsModel { + private String abc; + private String abcName; + private String assetNo; + private String assetSource; + private String assetType; + private String assetTypeName; + private String attribute; + private String capitalSource; + private String capitalSourceName; + private String cardEstablishmentDate; + private String createTime; + private String createUser; + private String depreciationMethod; + private String depreciationMethodName; + private String depreciationPeriod; + private String enableDate; + private String equipmentCategory; + private String equipmentCategoryName; + private String equipmentName; + private String equipmentNo; + private String equipmentSpecifications; + private String equipmentType; + private String equipmentTypeName; + private String fileList; + private String id; + private String installIncidentalExpenses; + private String installPlace; + private String intactState; + private String isCalibrationTestEquipment; + private int isDel; + private String isFixedAssets; + private String isMeasureAccount; + private String isStandardSupportEquipment; + private String labelBind; + private String majorCategory; + private String majorCategoryName; + private String managerLevel; + private String managerLevelName; + private String managerState; + private String managerStateName; + private String manufacturer; + private String manufacturerCountry; + private String manufacturingDate; + private String manufacturingNo; + private String mesureCycle; + private String mesureDate; + private String mesureDept; + private String mesureRange; + private String mesureResult; + private String mesureResultName; + private String mesureType; + private String mesureTypeName; + private String modelNo; + private String originValue; + private String overallDimension; + private String presentOriginValue; + private String purpose; + private String remark; + private String singlePrice; + private String supportStandardEquipmentName; + private String supportStandardEquipmentNo; + private String technicalLevel; + private String uncertainty; + private String updateTime; + private String useDept; + private String useDeptName; + private String usePerson; + private String usePersonName; + private String validDate; + private int version; + private String weight; + + public String getAbc() { + return abc; + } + + public void setAbc(String abc) { + this.abc = abc; + } + + public String getAbcName() { + return abcName; + } + + public void setAbcName(String abcName) { + this.abcName = abcName; + } + + public String getAssetNo() { + return assetNo; + } + + public void setAssetNo(String assetNo) { + this.assetNo = assetNo; + } + + public String getAssetSource() { + return assetSource; + } + + public void setAssetSource(String assetSource) { + this.assetSource = assetSource; + } + + public String getAssetType() { + return assetType; + } + + public void setAssetType(String assetType) { + this.assetType = assetType; + } + + public String getAssetTypeName() { + return assetTypeName; + } + + public void setAssetTypeName(String assetTypeName) { + this.assetTypeName = assetTypeName; + } + + public String getAttribute() { + return attribute; + } + + public void setAttribute(String attribute) { + this.attribute = attribute; + } + + public String getCapitalSource() { + return capitalSource; + } + + public void setCapitalSource(String capitalSource) { + this.capitalSource = capitalSource; + } + + public String getCapitalSourceName() { + return capitalSourceName; + } + + public void setCapitalSourceName(String capitalSourceName) { + this.capitalSourceName = capitalSourceName; + } + + public String getCardEstablishmentDate() { + return cardEstablishmentDate; + } + + public void setCardEstablishmentDate(String cardEstablishmentDate) { + this.cardEstablishmentDate = cardEstablishmentDate; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getDepreciationMethod() { + return depreciationMethod; + } + + public void setDepreciationMethod(String depreciationMethod) { + this.depreciationMethod = depreciationMethod; + } + + public String getDepreciationMethodName() { + return depreciationMethodName; + } + + public void setDepreciationMethodName(String depreciationMethodName) { + this.depreciationMethodName = depreciationMethodName; + } + + public String getDepreciationPeriod() { + return depreciationPeriod; + } + + public void setDepreciationPeriod(String depreciationPeriod) { + this.depreciationPeriod = depreciationPeriod; + } + + public String getEnableDate() { + return enableDate; + } + + public void setEnableDate(String enableDate) { + this.enableDate = enableDate; + } + + public String getEquipmentCategory() { + return equipmentCategory; + } + + public void setEquipmentCategory(String equipmentCategory) { + this.equipmentCategory = equipmentCategory; + } + + public String getEquipmentCategoryName() { + return equipmentCategoryName; + } + + public void setEquipmentCategoryName(String equipmentCategoryName) { + this.equipmentCategoryName = equipmentCategoryName; + } + + public String getEquipmentName() { + return equipmentName; + } + + public void setEquipmentName(String equipmentName) { + this.equipmentName = equipmentName; + } + + public String getEquipmentNo() { + return equipmentNo; + } + + public void setEquipmentNo(String equipmentNo) { + this.equipmentNo = equipmentNo; + } + + public String getEquipmentSpecifications() { + return equipmentSpecifications; + } + + public void setEquipmentSpecifications(String equipmentSpecifications) { + this.equipmentSpecifications = equipmentSpecifications; + } + + public String getEquipmentType() { + return equipmentType; + } + + public void setEquipmentType(String equipmentType) { + this.equipmentType = equipmentType; + } + + public String getEquipmentTypeName() { + return equipmentTypeName; + } + + public void setEquipmentTypeName(String equipmentTypeName) { + this.equipmentTypeName = equipmentTypeName; + } + + public String getFileList() { + return fileList; + } + + public void setFileList(String fileList) { + this.fileList = fileList; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getInstallIncidentalExpenses() { + return installIncidentalExpenses; + } + + public void setInstallIncidentalExpenses(String installIncidentalExpenses) { + this.installIncidentalExpenses = installIncidentalExpenses; + } + + public String getInstallPlace() { + return installPlace; + } + + public void setInstallPlace(String installPlace) { + this.installPlace = installPlace; + } + + public String getIntactState() { + return intactState; + } + + public void setIntactState(String intactState) { + this.intactState = intactState; + } + + public String getIsCalibrationTestEquipment() { + return isCalibrationTestEquipment; + } + + public void setIsCalibrationTestEquipment(String isCalibrationTestEquipment) { + this.isCalibrationTestEquipment = isCalibrationTestEquipment; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getIsFixedAssets() { + return isFixedAssets; + } + + public void setIsFixedAssets(String isFixedAssets) { + this.isFixedAssets = isFixedAssets; + } + + public String getIsMeasureAccount() { + return isMeasureAccount; + } + + public void setIsMeasureAccount(String isMeasureAccount) { + this.isMeasureAccount = isMeasureAccount; + } + + public String getIsStandardSupportEquipment() { + return isStandardSupportEquipment; + } + + public void setIsStandardSupportEquipment(String isStandardSupportEquipment) { + this.isStandardSupportEquipment = isStandardSupportEquipment; + } + + public String getLabelBind() { + return labelBind; + } + + public void setLabelBind(String labelBind) { + this.labelBind = labelBind; + } + + public String getMajorCategory() { + return majorCategory; + } + + public void setMajorCategory(String majorCategory) { + this.majorCategory = majorCategory; + } + + public String getMajorCategoryName() { + return majorCategoryName; + } + + public void setMajorCategoryName(String majorCategoryName) { + this.majorCategoryName = majorCategoryName; + } + + public String getManagerLevel() { + return managerLevel; + } + + public void setManagerLevel(String managerLevel) { + this.managerLevel = managerLevel; + } + + public String getManagerLevelName() { + return managerLevelName; + } + + public void setManagerLevelName(String managerLevelName) { + this.managerLevelName = managerLevelName; + } + + public String getManagerState() { + return managerState; + } + + public void setManagerState(String managerState) { + this.managerState = managerState; + } + + public String getManagerStateName() { + return managerStateName; + } + + public void setManagerStateName(String managerStateName) { + this.managerStateName = managerStateName; + } + + public String getManufacturer() { + return manufacturer; + } + + public void setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + } + + public String getManufacturerCountry() { + return manufacturerCountry; + } + + public void setManufacturerCountry(String manufacturerCountry) { + this.manufacturerCountry = manufacturerCountry; + } + + public String getManufacturingDate() { + return manufacturingDate; + } + + public void setManufacturingDate(String manufacturingDate) { + this.manufacturingDate = manufacturingDate; + } + + public String getManufacturingNo() { + return manufacturingNo; + } + + public void setManufacturingNo(String manufacturingNo) { + this.manufacturingNo = manufacturingNo; + } + + public String getMesureCycle() { + return mesureCycle; + } + + public void setMesureCycle(String mesureCycle) { + this.mesureCycle = mesureCycle; + } + + public String getMesureDate() { + return mesureDate; + } + + public void setMesureDate(String mesureDate) { + this.mesureDate = mesureDate; + } + + public String getMesureDept() { + return mesureDept; + } + + public void setMesureDept(String mesureDept) { + this.mesureDept = mesureDept; + } + + public String getMesureRange() { + return mesureRange; + } + + public void setMesureRange(String mesureRange) { + this.mesureRange = mesureRange; + } + + public String getMesureResult() { + return mesureResult; + } + + public void setMesureResult(String mesureResult) { + this.mesureResult = mesureResult; + } + + public String getMesureResultName() { + return mesureResultName; + } + + public void setMesureResultName(String mesureResultName) { + this.mesureResultName = mesureResultName; + } + + public String getMesureType() { + return mesureType; + } + + public void setMesureType(String mesureType) { + this.mesureType = mesureType; + } + + public String getMesureTypeName() { + return mesureTypeName; + } + + public void setMesureTypeName(String mesureTypeName) { + this.mesureTypeName = mesureTypeName; + } + + public String getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getOriginValue() { + return originValue; + } + + public void setOriginValue(String originValue) { + this.originValue = originValue; + } + + public String getOverallDimension() { + return overallDimension; + } + + public void setOverallDimension(String overallDimension) { + this.overallDimension = overallDimension; + } + + public String getPresentOriginValue() { + return presentOriginValue; + } + + public void setPresentOriginValue(String presentOriginValue) { + this.presentOriginValue = presentOriginValue; + } + + public String getPurpose() { + return purpose; + } + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getSinglePrice() { + return singlePrice; + } + + public void setSinglePrice(String singlePrice) { + this.singlePrice = singlePrice; + } + + public String getSupportStandardEquipmentName() { + return supportStandardEquipmentName; + } + + public void setSupportStandardEquipmentName(String supportStandardEquipmentName) { + this.supportStandardEquipmentName = supportStandardEquipmentName; + } + + public String getSupportStandardEquipmentNo() { + return supportStandardEquipmentNo; + } + + public void setSupportStandardEquipmentNo(String supportStandardEquipmentNo) { + this.supportStandardEquipmentNo = supportStandardEquipmentNo; + } + + public String getTechnicalLevel() { + return technicalLevel; + } + + public void setTechnicalLevel(String technicalLevel) { + this.technicalLevel = technicalLevel; + } + + public String getUncertainty() { + return uncertainty; + } + + public void setUncertainty(String uncertainty) { + this.uncertainty = uncertainty; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getUseDept() { + return useDept; + } + + public void setUseDept(String useDept) { + this.useDept = useDept; + } + + public String getUseDeptName() { + return useDeptName; + } + + public void setUseDeptName(String useDeptName) { + this.useDeptName = useDeptName; + } + + public String getUsePerson() { + return usePerson; + } + + public void setUsePerson(String usePerson) { + this.usePerson = usePerson; + } + + public String getUsePersonName() { + return usePersonName; + } + + public void setUsePersonName(String usePersonName) { + this.usePersonName = usePersonName; + } + + public String getValidDate() { + return validDate; + } + + public void setValidDate(String validDate) { + this.validDate = validDate; + } + + public int getVersion() { + return version; + } + + public void setVersion(int version) { + this.version = version; + } + + public String getWeight() { + return weight; + } + + public void setWeight(String weight) { + this.weight = weight; + } + } + } +} diff --git a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt index a3f514f..46e5eef 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt @@ -35,4 +35,24 @@ @QueryMap limit: Map, @QueryMap offset: Map ): String + + /** + * 获取设备列表 + */ + @POST("/meter/assets/listPage") + suspend fun getEquipmentList( + @Header("token") token: String, + @Body requestBody: RequestBody, + @QueryMap limit: Map, + @QueryMap offset: Map + ): String + + /** + * 获取设备详情 + */ + @POST("/meter/assets/detail") + suspend fun getEquipmentDetail( + @Header("token") token: String, + @Body requestBody: RequestBody + ): String } \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt index 444a872..386a1d8 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt @@ -6,8 +6,10 @@ import com.pengxh.kt.lite.utils.SaveKeyValues import okhttp3.MediaType.Companion.toMediaType import okhttp3.RequestBody.Companion.toRequestBody +import org.json.JSONArray import org.json.JSONObject + object RetrofitServiceManager { private val api by lazy { @@ -73,4 +75,71 @@ offsetMap["offset"] = offset return api.getNoticeList(AuthenticationHelper.token!!, requestBody, limitMap, offsetMap) } + + /** + * 获取设备列表 + */ + suspend fun getEquipmentList( + equipmentNo: String, + equipmentName: String, + mesureType: String, + managerState: String, + useDept: String, + assetType: String, + equipmentCategory: String, + isCalibrationTestEquipment: String, + isMeasureAccount: String, + isStandardSupportEquipment: String, + isFixedAssets: String, + validStartDate: String, + validEndDate: String, + abc: String, + ids: Array, + offset: Int + ): String { + val paramObject = JSONObject() + paramObject.put("equipmentNo", equipmentNo) + paramObject.put("equipmentName", equipmentName) + paramObject.put("mesureType", mesureType) + paramObject.put("managerState", managerState) + paramObject.put("useDept", useDept) + paramObject.put("assetType", assetType) + paramObject.put("equipmentCategory", equipmentCategory) + paramObject.put("isCalibrationTestEquipment", isCalibrationTestEquipment) + paramObject.put("isMeasureAccount", isMeasureAccount) + paramObject.put("isStandardSupportEquipment", isStandardSupportEquipment) + paramObject.put("isFixedAssets", isFixedAssets) + paramObject.put("validStartDate", validStartDate) + paramObject.put("validEndDate", validEndDate) + paramObject.put("abc", abc) + + val jsonArray = JSONArray() + ids.forEach { + jsonArray.put(it) + } + paramObject.put("ids", jsonArray) + + val requestBody = paramObject.toString().toRequestBody( + "application/json;charset=UTF-8".toMediaType() + ) + + val limitMap = HashMap() + limitMap["limit"] = LocaleConstant.PAGE_LIMIT + + val offsetMap = HashMap() + offsetMap["offset"] = offset + return api.getEquipmentList(AuthenticationHelper.token!!, requestBody, limitMap, offsetMap) + } + + /** + * 获取设备详情 + */ + suspend fun getEquipmentDetail(id: String): String { + val paramObject = JSONObject() + paramObject.put("id", id) + val requestBody = paramObject.toString().toRequestBody( + "application/json;charset=UTF-8".toMediaType() + ) + return api.getEquipmentDetail(AuthenticationHelper.token!!, requestBody) + } } \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt deleted file mode 100644 index a5bb60b..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt +++ /dev/null @@ -1,104 +0,0 @@ -package com.casic.xz.meterage.view - -import android.annotation.SuppressLint -import android.graphics.Paint -import androidx.lifecycle.ViewModelProvider -import com.casic.xz.meterage.R -import com.casic.xz.meterage.extensions.combineImagePath -import com.casic.xz.meterage.extensions.formatTextFromHtml -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.vm.NoticeViewModel -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.extensions.convertColor -import com.pengxh.kt.lite.extensions.navigatePageTo -import com.pengxh.kt.lite.extensions.obtainScreenWidth -import com.pengxh.kt.lite.extensions.show -import com.pengxh.kt.lite.utils.Constant -import kotlinx.android.synthetic.main.activity_notice_detail.* -import kotlinx.android.synthetic.main.include_base_title.* -import java.util.* - -@SuppressLint("SetTextI18n") -class NoticeDetailActivity : KotlinBaseActivity() { - - private lateinit var noticeViewModel: NoticeViewModel - - override fun initData() { - leftBackView.setOnClickListener { finish() } - titleView.text = "通知公告" - - val args = intent.getStringArrayListExtra(Constant.INTENT_PARAM)!! - - noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] - noticeViewModel.getNoticeList(args[0], args[1], args[2], "", "", 1) - noticeViewModel.noticeResult.observe(this, { - if (it.code == 200) { - val dataRow = it.data?.rows!![0] - - noticeDateView.text = dataRow.noticeTime - noticePublisherView.text = "发布人 ${dataRow.noticePublisher}" - noticeCompanyView.text = "发布单位 ${dataRow.noticeCompany}" - - noticeNoView.text = dataRow.noticeNo - noticeTitleView.text = dataRow.noticeTitle - noticeSketchView.text = dataRow.noticeSketch - - dataRow.noticeContent.formatTextFromHtml( - this, noticeContentView, obtainScreenWidth() - ) - - if (dataRow.minioFileName.isNullOrBlank()) { - minioFileView.text = "暂无附件" - } else { - val minioFileName = dataRow.minioFileName - - minioFileView.text = minioFileName - val textPaint = minioFileView.paint - textPaint.flags = Paint.UNDERLINE_TEXT_FLAG - textPaint.isAntiAlias = true - minioFileView.setTextColor(R.color.themeColor.convertColor(this)) - - minioFileView.setOnClickListener { - //查看附件 - if (minioFileName.endsWith("pdf")) { - navigatePageTo(minioFileName) - } else if ( - minioFileName.endsWith("doc") || - minioFileName.endsWith("docx") - ) { - navigatePageTo(minioFileName) - } else if (minioFileName.endsWith("txt")) { - navigatePageTo(minioFileName) - } else if ( - minioFileName.endsWith("png") || - minioFileName.endsWith("jpeg") || - minioFileName.endsWith("jpg") - ) { - val urls = ArrayList() - urls.add(minioFileName.combineImagePath()) - navigatePageTo(0, urls) - } else { - "文件类型未知,无法打开附件".show(this) - } - } - } - } - }) - } - - override fun initEvent() { - - } - - override fun initLayoutView(): Int = R.layout.activity_notice_detail - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/NoticeListActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/NoticeListActivity.kt deleted file mode 100644 index 15f6a16..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/NoticeListActivity.kt +++ /dev/null @@ -1,180 +0,0 @@ -package com.casic.xz.meterage.view - -import android.os.Handler -import android.util.Log -import android.view.View -import androidx.lifecycle.ViewModelProvider -import com.casic.xz.meterage.R -import com.casic.xz.meterage.adapter.NoticeListAdapter -import com.casic.xz.meterage.extensions.addAll -import com.casic.xz.meterage.extensions.combineFilePath -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.extensions.showEmptyPage -import com.casic.xz.meterage.model.NoticeListModel -import com.casic.xz.meterage.vm.NoticeViewModel -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.extensions.navigatePageTo -import com.pengxh.kt.lite.extensions.show -import com.pengxh.kt.lite.utils.WeakReferenceHandler -import com.pengxh.kt.lite.widget.dialog.AlertControlDialog -import kotlinx.android.synthetic.main.activity_notice_list.* -import kotlinx.android.synthetic.main.include_empty_view.* - -class NoticeListActivity : KotlinBaseActivity() { - - private lateinit var weakReferenceHandler: WeakReferenceHandler - private lateinit var noticeViewModel: NoticeViewModel - private lateinit var noticeListAdapter: NoticeListAdapter - private var dataBeans: MutableList = ArrayList() - private var pageIndex = 1 - private var isRefresh = false - private var isLoadMore = false - - override fun initData() { - weakReferenceHandler = WeakReferenceHandler(callback) - noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] - noticeViewModel.noticeResult.observe(this, { - if (it.code == 200) { - val dataRows = it.data?.rows!! -// countBadeNumber(dataRows) - when { - isRefresh -> { - dataBeans.clear() - dataBeans = dataRows - noticeLayout.finishRefresh() - isRefresh = false - } - isLoadMore -> { - if (dataRows.size == 0) { - "到底了,别拉了".show(this) - } - dataBeans.addAll(dataRows) - noticeLayout.finishLoadMore() - isLoadMore = false - } - else -> { - dataBeans = dataRows - } - } - weakReferenceHandler.sendEmptyMessage(2023013101) - } - }) - } - - override fun initEvent() { - leftBackView.setOnClickListener { finish() } - rightOperateView.setOnClickListener { - AlertControlDialog.Builder() - .setContext(this) - .setTitle("提示") - .setMessage("确定将所有未读消息标为已读?") - .setNegativeButton("取消") - .setPositiveButton("确定") - .setOnDialogButtonClickListener(object : - AlertControlDialog.OnDialogButtonClickListener { - override fun onCancelClick() { - - } - - override fun onConfirmClick() { - //TODO 设置为已读 - } - }).build().show() - } - - if (hasNoticePermission()) { - openSystemNoticeLayout.visibility = View.GONE - openSystemNoticeLayout.visibility = View.GONE - } else { - openSystemNoticeLayout.setOnClickListener { - - } - - - closeLayoutView.setOnClickListener { - openSystemNoticeLayout.visibility = View.GONE - } - } - - noticeLayout.setOnRefreshListener { - isRefresh = true - //刷新之后页码重置 - pageIndex = 1 - getNoticeListByPage() - } - - noticeLayout.setOnLoadMoreListener { - isLoadMore = true - pageIndex++ - getNoticeListByPage() - } - } - - override fun onResume() { - super.onResume() - pageIndex = 1 - getNoticeListByPage() - } - - private fun getNoticeListByPage() { - noticeViewModel.getNoticeList("", "", "", "", "", pageIndex) - } - - private val callback = Handler.Callback { - when (it.what) { - 2023013101 -> { - if (isRefresh || isLoadMore) { - noticeListAdapter.notifyDataSetChanged() - } else { - if (dataBeans.size == 0) { - emptyView!!.showEmptyPage("没有任何消息") { - pageIndex = 1 - getNoticeListByPage() - } - } else { - emptyView!!.hide() - noticeListAdapter = NoticeListAdapter(this, dataBeans) - noticeRecyclerView.adapter = noticeListAdapter - noticeListAdapter.setOnItemClickListener(object : - NoticeListAdapter.OnItemClickListener { - override fun onItemClicked(position: Int) { - val rowsModel = dataBeans[position] - val allArgs = addAll( - rowsModel.noticeNo, - rowsModel.noticeTitle, - rowsModel.noticePublisher, - "", - "" - ) - Log.d( - "Casic", - "NoticeListActivity => onItemClicked: ${rowsModel.minioFileName.combineFilePath()}" - ) - navigatePageTo(allArgs) - } - }) - } - } - } - } - true - } - - //TODO 判断是否开启通知权限 - private fun hasNoticePermission(): Boolean { - - return false - } - - override fun initLayoutView(): Int = R.layout.activity_notice_list - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/PreviewDocumentActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/PreviewDocumentActivity.kt deleted file mode 100644 index e233ddc..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/PreviewDocumentActivity.kt +++ /dev/null @@ -1,24 +0,0 @@ -package com.casic.xz.meterage.view - -import com.casic.xz.meterage.R -import com.pengxh.kt.lite.base.KotlinBaseActivity - -class PreviewDocumentActivity : KotlinBaseActivity() { - override fun initData() { - - } - - override fun initEvent() { - - } - - override fun initLayoutView(): Int = R.layout.activity_preview_doc - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/PreviewPdfActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/PreviewPdfActivity.kt deleted file mode 100644 index 39f8ac2..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/PreviewPdfActivity.kt +++ /dev/null @@ -1,62 +0,0 @@ -package com.casic.xz.meterage.view - -import com.casic.xz.meterage.R -import com.casic.xz.meterage.extensions.combineFilePath -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.utils.LoadingDialogHub -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.callback.OnDownloadListener -import com.pengxh.kt.lite.extensions.createDownloadFileDir -import com.pengxh.kt.lite.extensions.downloadFile -import com.pengxh.kt.lite.utils.Constant -import kotlinx.android.synthetic.main.activity_preview_pdf.* -import kotlinx.android.synthetic.main.include_base_title.* -import java.io.File -import java.io.FileInputStream - - -class PreviewPdfActivity : KotlinBaseActivity() { - - override fun initData() { - val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! - titleView.text = minioFileName - - val url = minioFileName.combineFilePath() - url.downloadFile(createDownloadFileDir().toString(), - object : OnDownloadListener { - override fun onDownloadStart(totalBytes: Long) { - runOnUiThread { - LoadingDialogHub.show(this@PreviewPdfActivity, "附件加载中") - } - } - - override fun onProgressChanged(currentBytes: Long) { - - } - - override fun onDownloadEnd(file: File?) { - runOnUiThread { - LoadingDialogHub.dismiss() - } - val inputStream = FileInputStream(file) - pdfView.fromStream(inputStream).load() - } - }) - } - - override fun initEvent() { - leftBackView.setOnClickListener { finish() } - } - - override fun initLayoutView(): Int = R.layout.activity_preview_pdf - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/PreviewTextActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/PreviewTextActivity.kt deleted file mode 100644 index d634ca3..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/PreviewTextActivity.kt +++ /dev/null @@ -1,60 +0,0 @@ -package com.casic.xz.meterage.view - -import com.casic.xz.meterage.R -import com.casic.xz.meterage.extensions.combineFilePath -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.utils.LoadingDialogHub -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.callback.OnDownloadListener -import com.pengxh.kt.lite.extensions.createDownloadFileDir -import com.pengxh.kt.lite.extensions.downloadFile -import com.pengxh.kt.lite.extensions.read -import com.pengxh.kt.lite.utils.Constant -import kotlinx.android.synthetic.main.activity_preview_txt.* -import kotlinx.android.synthetic.main.include_base_title.* -import java.io.File - -class PreviewTextActivity : KotlinBaseActivity() { - - override fun initData() { - val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! - titleView.text = minioFileName - - val url = minioFileName.combineFilePath() - url.downloadFile(createDownloadFileDir().toString(), - object : OnDownloadListener { - override fun onDownloadStart(totalBytes: Long) { - runOnUiThread { - LoadingDialogHub.show(this@PreviewTextActivity, "附件加载中") - } - } - - override fun onProgressChanged(currentBytes: Long) { - - } - - override fun onDownloadEnd(file: File?) { - runOnUiThread { - LoadingDialogHub.dismiss() - textView.text = file?.read() - } - } - }) - } - - override fun initEvent() { - leftBackView.setOnClickListener { finish() } - } - - override fun initLayoutView(): Int = R.layout.activity_preview_txt - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentActivity.kt new file mode 100644 index 0000000..35ca098 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentActivity.kt @@ -0,0 +1,158 @@ +package com.casic.xz.meterage.view.home + +import android.os.Handler +import androidx.lifecycle.ViewModelProvider +import androidx.recyclerview.widget.DividerItemDecoration +import com.casic.xz.meterage.R +import com.casic.xz.meterage.adapter.EquipmentListAdapter +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.extensions.showEmptyPage +import com.casic.xz.meterage.model.EquipmentListModel +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.casic.xz.meterage.vm.EquipmentViewModel +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.extensions.navigatePageTo +import com.pengxh.kt.lite.extensions.show +import com.pengxh.kt.lite.utils.WeakReferenceHandler +import com.pengxh.kt.lite.vm.LoadState +import kotlinx.android.synthetic.main.activity_equipment.* +import kotlinx.android.synthetic.main.include_empty_view.* +import kotlinx.android.synthetic.main.include_search_title.* + +class EquipmentActivity : KotlinBaseActivity() { + + private lateinit var weakReferenceHandler: WeakReferenceHandler + private lateinit var equipmentViewModel: EquipmentViewModel + private lateinit var equipmentListAdapter: EquipmentListAdapter + private var dataBeans: MutableList = ArrayList() + private var pageIndex = 1 + private var isRefresh = false + private var isLoadMore = false + + override fun initData() { + weakReferenceHandler = WeakReferenceHandler(callback) + equipmentViewModel = ViewModelProvider(this)[EquipmentViewModel::class.java] + equipmentViewModel.equipmentResult.observe(this, { + if (it.code == 200) { + val dataRows = it.data?.rows!! + when { + isRefresh -> { + dataBeans.clear() + dataBeans = dataRows + equipmentLayout.finishRefresh() + isRefresh = false + } + isLoadMore -> { + if (dataRows.size == 0) { + "到底了,别拉了".show(this) + } + dataBeans.addAll(dataRows) + equipmentLayout.finishLoadMore() + isLoadMore = false + } + else -> { + dataBeans = dataRows + } + } + weakReferenceHandler.sendEmptyMessage(2023020801) + } + }) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + rightOperateView.setOnClickListener { + + } + + equipmentLayout.setOnRefreshListener { + isRefresh = true + //刷新之后页码重置 + pageIndex = 1 + getEquipmentListByPage() + } + + equipmentLayout.setOnLoadMoreListener { + isLoadMore = true + pageIndex++ + getEquipmentListByPage() + } + } + + override fun initLayoutView(): Int = R.layout.activity_equipment + + override fun observeRequestState() { + equipmentViewModel.loadState.observe(this, { + when (it) { + LoadState.Loading -> LoadingDialogHub.show(this, "数据加载中...") + else -> LoadingDialogHub.dismiss() + } + }) + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + titleView.text = "仪器设备" + } + + override fun onResume() { + super.onResume() + pageIndex = 1 + getEquipmentListByPage() + } + + private fun getEquipmentListByPage() { + equipmentViewModel.getEquipmentList( + "", + "", + "", + "", + "", + "1", + "", + "", + "", + "", + "", + "", + "", + "", + arrayOf(), + pageIndex + ) + } + + private val callback = Handler.Callback { + when (it.what) { + 2023020801 -> { + if (isRefresh || isLoadMore) { + equipmentListAdapter.notifyDataSetChanged() + } else { + if (dataBeans.size == 0) { + emptyView!!.showEmptyPage("无设备") { + pageIndex = 1 + getEquipmentListByPage() + } + } else { + emptyView!!.hide() + equipmentListAdapter = EquipmentListAdapter(this, dataBeans) + equipmentRecyclerView.addItemDecoration( + DividerItemDecoration(this, DividerItemDecoration.VERTICAL) + ) + equipmentRecyclerView.adapter = equipmentListAdapter + equipmentListAdapter.setOnItemClickListener(object : + EquipmentListAdapter.OnItemClickListener { + override fun onItemClicked(position: Int) { + val rowsModel = dataBeans[position] + navigatePageTo(rowsModel.id) + } + }) + } + } + } + } + true + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentDetailActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentDetailActivity.kt new file mode 100644 index 0000000..7dee13c --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentDetailActivity.kt @@ -0,0 +1,53 @@ +package com.casic.xz.meterage.view.home + +import androidx.fragment.app.Fragment +import com.casic.xz.meterage.R +import com.casic.xz.meterage.adapter.SubViewPagerAdapter +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.fragment.equipment.* +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.utils.Constant +import kotlinx.android.synthetic.main.activity_equipment.rootView +import kotlinx.android.synthetic.main.activity_equipment_detail.* +import kotlinx.android.synthetic.main.include_base_title.* + +class EquipmentDetailActivity : KotlinBaseActivity() { + + private var fragmentPages: ArrayList = ArrayList() + + override fun initData() { + val equipmentId = intent.getStringExtra(Constant.INTENT_PARAM)!! + + fragmentPages.add(BasicInformationFragment(equipmentId)) + fragmentPages.add(InspectionRecordFragment()) + fragmentPages.add(ChangeRecordFragment()) + fragmentPages.add(UsageRecordFragment()) + fragmentPages.add(CertificateFragment()) + + val equipmentPageTitles = arrayOf("基础信息", "周检记录", "状态变更记录", "使用记录", "检定证书") + + equipmentViewPager.adapter = SubViewPagerAdapter( + supportFragmentManager, fragmentPages, equipmentPageTitles + ) + equipmentViewPager.offscreenPageLimit = fragmentPages.size + //绑定 + topTabLayout.setupWithViewPager(equipmentViewPager) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + } + + override fun initLayoutView(): Int = R.layout.activity_equipment_detail + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + titleView.text = "仪器设备" + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeDetailActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeDetailActivity.kt new file mode 100644 index 0000000..6fe0022 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeDetailActivity.kt @@ -0,0 +1,105 @@ +package com.casic.xz.meterage.view.notice + +import android.annotation.SuppressLint +import android.graphics.Paint +import androidx.lifecycle.ViewModelProvider +import com.casic.xz.meterage.R +import com.casic.xz.meterage.extensions.combineImagePath +import com.casic.xz.meterage.extensions.formatTextFromHtml +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.view.BigImageActivity +import com.casic.xz.meterage.vm.NoticeViewModel +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.extensions.convertColor +import com.pengxh.kt.lite.extensions.navigatePageTo +import com.pengxh.kt.lite.extensions.obtainScreenWidth +import com.pengxh.kt.lite.extensions.show +import com.pengxh.kt.lite.utils.Constant +import kotlinx.android.synthetic.main.activity_notice_detail.* +import kotlinx.android.synthetic.main.include_base_title.* +import java.util.* + +@SuppressLint("SetTextI18n") +class NoticeDetailActivity : KotlinBaseActivity() { + + private lateinit var noticeViewModel: NoticeViewModel + + override fun initData() { + leftBackView.setOnClickListener { finish() } + titleView.text = "通知公告" + + val args = intent.getStringArrayListExtra(Constant.INTENT_PARAM)!! + + noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] + noticeViewModel.getNoticeList(args[0], args[1], args[2], "", "", 1) + noticeViewModel.noticeResult.observe(this, { + if (it.code == 200) { + val dataRow = it.data?.rows!![0] + + noticeDateView.text = dataRow.noticeTime + noticePublisherView.text = "发布人 ${dataRow.noticePublisher}" + noticeCompanyView.text = "发布单位 ${dataRow.noticeCompany}" + + noticeNoView.text = dataRow.noticeNo + noticeTitleView.text = dataRow.noticeTitle + noticeSketchView.text = dataRow.noticeSketch + + dataRow.noticeContent.formatTextFromHtml( + this, noticeContentView, obtainScreenWidth() + ) + + if (dataRow.minioFileName.isNullOrBlank()) { + minioFileView.text = "暂无附件" + } else { + val minioFileName = dataRow.minioFileName + + minioFileView.text = minioFileName + val textPaint = minioFileView.paint + textPaint.flags = Paint.UNDERLINE_TEXT_FLAG + textPaint.isAntiAlias = true + minioFileView.setTextColor(R.color.themeColor.convertColor(this)) + + minioFileView.setOnClickListener { + //查看附件 + if (minioFileName.endsWith("pdf")) { + navigatePageTo(minioFileName) + } else if ( + minioFileName.endsWith("doc") || + minioFileName.endsWith("docx") + ) { + navigatePageTo(minioFileName) + } else if (minioFileName.endsWith("txt")) { + navigatePageTo(minioFileName) + } else if ( + minioFileName.endsWith("png") || + minioFileName.endsWith("jpeg") || + minioFileName.endsWith("jpg") + ) { + val urls = ArrayList() + urls.add(minioFileName.combineImagePath()) + navigatePageTo(0, urls) + } else { + "文件类型未知,无法打开附件".show(this) + } + } + } + } + }) + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.activity_notice_detail + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeListActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeListActivity.kt new file mode 100644 index 0000000..31c0490 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeListActivity.kt @@ -0,0 +1,180 @@ +package com.casic.xz.meterage.view.notice + +import android.os.Handler +import android.util.Log +import android.view.View +import androidx.lifecycle.ViewModelProvider +import com.casic.xz.meterage.R +import com.casic.xz.meterage.adapter.NoticeListAdapter +import com.casic.xz.meterage.extensions.addAll +import com.casic.xz.meterage.extensions.combineFilePath +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.extensions.showEmptyPage +import com.casic.xz.meterage.model.NoticeListModel +import com.casic.xz.meterage.vm.NoticeViewModel +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.extensions.navigatePageTo +import com.pengxh.kt.lite.extensions.show +import com.pengxh.kt.lite.utils.WeakReferenceHandler +import com.pengxh.kt.lite.widget.dialog.AlertControlDialog +import kotlinx.android.synthetic.main.activity_notice_list.* +import kotlinx.android.synthetic.main.include_empty_view.* + +class NoticeListActivity : KotlinBaseActivity() { + + private lateinit var weakReferenceHandler: WeakReferenceHandler + private lateinit var noticeViewModel: NoticeViewModel + private lateinit var noticeListAdapter: NoticeListAdapter + private var dataBeans: MutableList = ArrayList() + private var pageIndex = 1 + private var isRefresh = false + private var isLoadMore = false + + override fun initData() { + weakReferenceHandler = WeakReferenceHandler(callback) + noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] + noticeViewModel.noticeResult.observe(this, { + if (it.code == 200) { + val dataRows = it.data?.rows!! +// countBadeNumber(dataRows) + when { + isRefresh -> { + dataBeans.clear() + dataBeans = dataRows + noticeLayout.finishRefresh() + isRefresh = false + } + isLoadMore -> { + if (dataRows.size == 0) { + "到底了,别拉了".show(this) + } + dataBeans.addAll(dataRows) + noticeLayout.finishLoadMore() + isLoadMore = false + } + else -> { + dataBeans = dataRows + } + } + weakReferenceHandler.sendEmptyMessage(2023013101) + } + }) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + rightOperateView.setOnClickListener { + AlertControlDialog.Builder() + .setContext(this) + .setTitle("提示") + .setMessage("确定将所有未读消息标为已读?") + .setNegativeButton("取消") + .setPositiveButton("确定") + .setOnDialogButtonClickListener(object : + AlertControlDialog.OnDialogButtonClickListener { + override fun onCancelClick() { + + } + + override fun onConfirmClick() { + //TODO 设置为已读 + } + }).build().show() + } + + if (hasNoticePermission()) { + openSystemNoticeLayout.visibility = View.GONE + openSystemNoticeLayout.visibility = View.GONE + } else { + openSystemNoticeLayout.setOnClickListener { + + } + + + closeLayoutView.setOnClickListener { + openSystemNoticeLayout.visibility = View.GONE + } + } + + noticeLayout.setOnRefreshListener { + isRefresh = true + //刷新之后页码重置 + pageIndex = 1 + getNoticeListByPage() + } + + noticeLayout.setOnLoadMoreListener { + isLoadMore = true + pageIndex++ + getNoticeListByPage() + } + } + + override fun onResume() { + super.onResume() + pageIndex = 1 + getNoticeListByPage() + } + + private fun getNoticeListByPage() { + noticeViewModel.getNoticeList("", "", "", "", "", pageIndex) + } + + private val callback = Handler.Callback { + when (it.what) { + 2023013101 -> { + if (isRefresh || isLoadMore) { + noticeListAdapter.notifyDataSetChanged() + } else { + if (dataBeans.size == 0) { + emptyView!!.showEmptyPage("没有任何消息") { + pageIndex = 1 + getNoticeListByPage() + } + } else { + emptyView!!.hide() + noticeListAdapter = NoticeListAdapter(this, dataBeans) + noticeRecyclerView.adapter = noticeListAdapter + noticeListAdapter.setOnItemClickListener(object : + NoticeListAdapter.OnItemClickListener { + override fun onItemClicked(position: Int) { + val rowsModel = dataBeans[position] + val allArgs = addAll( + rowsModel.noticeNo, + rowsModel.noticeTitle, + rowsModel.noticePublisher, + "", + "" + ) + Log.d( + "Casic", + "NoticeListActivity => onItemClicked: ${rowsModel.minioFileName.combineFilePath()}" + ) + navigatePageTo(allArgs) + } + }) + } + } + } + } + true + } + + //TODO 判断是否开启通知权限 + private fun hasNoticePermission(): Boolean { + + return false + } + + override fun initLayoutView(): Int = R.layout.activity_notice_list + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewDocumentActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewDocumentActivity.kt new file mode 100644 index 0000000..4b16ae8 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewDocumentActivity.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.view.notice + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseActivity + +class PreviewDocumentActivity : KotlinBaseActivity() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.activity_preview_doc + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewPdfActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewPdfActivity.kt new file mode 100644 index 0000000..fad73b6 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewPdfActivity.kt @@ -0,0 +1,62 @@ +package com.casic.xz.meterage.view.notice + +import com.casic.xz.meterage.R +import com.casic.xz.meterage.extensions.combineFilePath +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.callback.OnDownloadListener +import com.pengxh.kt.lite.extensions.createDownloadFileDir +import com.pengxh.kt.lite.extensions.downloadFile +import com.pengxh.kt.lite.utils.Constant +import kotlinx.android.synthetic.main.activity_preview_pdf.* +import kotlinx.android.synthetic.main.include_base_title.* +import java.io.File +import java.io.FileInputStream + + +class PreviewPdfActivity : KotlinBaseActivity() { + + override fun initData() { + val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! + titleView.text = minioFileName + + val url = minioFileName.combineFilePath() + url.downloadFile(createDownloadFileDir().toString(), + object : OnDownloadListener { + override fun onDownloadStart(totalBytes: Long) { + runOnUiThread { + LoadingDialogHub.show(this@PreviewPdfActivity, "附件加载中") + } + } + + override fun onProgressChanged(currentBytes: Long) { + + } + + override fun onDownloadEnd(file: File?) { + runOnUiThread { + LoadingDialogHub.dismiss() + } + val inputStream = FileInputStream(file) + pdfView.fromStream(inputStream).load() + } + }) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + } + + override fun initLayoutView(): Int = R.layout.activity_preview_pdf + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewTextActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewTextActivity.kt new file mode 100644 index 0000000..d7850fb --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewTextActivity.kt @@ -0,0 +1,60 @@ +package com.casic.xz.meterage.view.notice + +import com.casic.xz.meterage.R +import com.casic.xz.meterage.extensions.combineFilePath +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.callback.OnDownloadListener +import com.pengxh.kt.lite.extensions.createDownloadFileDir +import com.pengxh.kt.lite.extensions.downloadFile +import com.pengxh.kt.lite.extensions.read +import com.pengxh.kt.lite.utils.Constant +import kotlinx.android.synthetic.main.activity_preview_txt.* +import kotlinx.android.synthetic.main.include_base_title.* +import java.io.File + +class PreviewTextActivity : KotlinBaseActivity() { + + override fun initData() { + val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! + titleView.text = minioFileName + + val url = minioFileName.combineFilePath() + url.downloadFile(createDownloadFileDir().toString(), + object : OnDownloadListener { + override fun onDownloadStart(totalBytes: Long) { + runOnUiThread { + LoadingDialogHub.show(this@PreviewTextActivity, "附件加载中") + } + } + + override fun onProgressChanged(currentBytes: Long) { + + } + + override fun onDownloadEnd(file: File?) { + runOnUiThread { + LoadingDialogHub.dismiss() + textView.text = file?.read() + } + } + }) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + } + + override fun initLayoutView(): Int = R.layout.activity_preview_txt + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/vm/EquipmentViewModel.kt b/app/src/main/java/com/casic/xz/meterage/vm/EquipmentViewModel.kt new file mode 100644 index 0000000..b5f21f6 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/vm/EquipmentViewModel.kt @@ -0,0 +1,92 @@ +package com.casic.xz.meterage.vm + +import androidx.lifecycle.MutableLiveData +import com.casic.xz.meterage.base.BaseApplication +import com.casic.xz.meterage.extensions.separateResponseCode +import com.casic.xz.meterage.extensions.toErrorMessage +import com.casic.xz.meterage.model.EquipmentDetailModel +import com.casic.xz.meterage.model.EquipmentListModel +import com.casic.xz.meterage.utils.retrofit.RetrofitServiceManager +import com.google.gson.Gson +import com.google.gson.reflect.TypeToken +import com.pengxh.kt.lite.extensions.launch +import com.pengxh.kt.lite.extensions.show +import com.pengxh.kt.lite.vm.BaseViewModel +import com.pengxh.kt.lite.vm.LoadState + +class EquipmentViewModel : BaseViewModel() { + + private val gson by lazy { Gson() } + val equipmentResult = MutableLiveData() + val equipmentDetailResult = MutableLiveData() + + fun getEquipmentList( + equipmentNo: String, + equipmentName: String, + mesureType: String, + managerState: String, + useDept: String, + assetType: String, + equipmentCategory: String, + isCalibrationTestEquipment: String, + isMeasureAccount: String, + isStandardSupportEquipment: String, + isFixedAssets: String, + validStartDate: String, + validEndDate: String, + abc: String, + ids: Array, + offset: Int + ) = launch({ + loadState.value = LoadState.Loading + val response = RetrofitServiceManager.getEquipmentList( + equipmentNo, + equipmentName, + mesureType, + managerState, + useDept, + assetType, + equipmentCategory, + isCalibrationTestEquipment, + isMeasureAccount, + isStandardSupportEquipment, + isFixedAssets, + validStartDate, + validEndDate, + abc, + ids, + offset + ) + val responseCode = response.separateResponseCode() + if (responseCode == 200) { + loadState.value = LoadState.Success + equipmentResult.value = gson.fromJson( + response, object : TypeToken() {}.type + ) + } else { + loadState.value = LoadState.Fail + response.toErrorMessage().show(BaseApplication.get()) + } + }, { + loadState.value = LoadState.Fail + it.printStackTrace() + }) + + fun getEquipmentDetail(id: String) = launch({ + loadState.value = LoadState.Loading + val response = RetrofitServiceManager.getEquipmentDetail(id) + val responseCode = response.separateResponseCode() + if (responseCode == 200) { + loadState.value = LoadState.Success + equipmentDetailResult.value = gson.fromJson( + response, object : TypeToken() {}.type + ) + } else { + loadState.value = LoadState.Fail + response.toErrorMessage().show(BaseApplication.get()) + } + }, { + loadState.value = LoadState.Fail + it.printStackTrace() + }) +} \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_sorting.xml b/app/src/main/res/drawable/ic_sorting.xml new file mode 100644 index 0000000..252bfe6 --- /dev/null +++ b/app/src/main/res/drawable/ic_sorting.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/layout/activity_equipment.xml b/app/src/main/res/layout/activity_equipment.xml new file mode 100644 index 0000000..d6a64b1 --- /dev/null +++ b/app/src/main/res/layout/activity_equipment.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_equipment_detail.xml b/app/src/main/res/layout/activity_equipment_detail.xml new file mode 100644 index 0000000..7254762 --- /dev/null +++ b/app/src/main/res/layout/activity_equipment_detail.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 3892b5a..02160cd 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -34,16 +34,18 @@ - - - - - - - + + + + + + + + + +) : RecyclerView.Adapter() { + + private var layoutInflater: LayoutInflater = LayoutInflater.from(context) + + override fun getItemCount(): Int = dataRows.size + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = ItemViewHolder( + layoutInflater.inflate(R.layout.item_equipment_rv_l, parent, false) + ) + + override fun onBindViewHolder(holder: ItemViewHolder, position: Int) { + //绑定数据 + val rowsBean = dataRows[position] + holder.equipmentNameView.text = rowsBean.equipmentName + holder.equipmentCodeView.text = rowsBean.equipmentNo + holder.equipmentDateView.text = rowsBean.enableDate + holder.equipmentLibView.text = rowsBean.useDeptName + + //绑定事件 + holder.itemView.setOnClickListener { + listener?.onItemClicked(position) + } + } + + inner class ItemViewHolder(view: View) : RecyclerView.ViewHolder(view) { + var equipmentNameView: TextView = view.findViewById(R.id.equipmentNameView) + var equipmentCodeView: TextView = view.findViewById(R.id.equipmentCodeView) + var equipmentDateView: TextView = view.findViewById(R.id.equipmentDateView) + var equipmentLibView: TextView = view.findViewById(R.id.equipmentLibView) + } + + private var listener: OnItemClickListener? = null + + interface OnItemClickListener { + fun onItemClicked(position: Int) + } + + fun setOnItemClickListener(onClickListener: OnItemClickListener?) { + this.listener = onClickListener + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt index b4628f3..d970b55 100644 --- a/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt +++ b/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt @@ -5,7 +5,8 @@ import com.casic.xz.meterage.R import com.casic.xz.meterage.adapter.HomeGridAdapter import com.casic.xz.meterage.utils.LocaleConstant -import com.casic.xz.meterage.view.NoticeListActivity +import com.casic.xz.meterage.view.home.EquipmentActivity +import com.casic.xz.meterage.view.notice.NoticeListActivity import com.casic.xz.meterage.vm.NoticeViewModel import com.pengxh.kt.lite.base.KotlinBaseFragment import com.pengxh.kt.lite.extensions.navigatePageTo @@ -36,8 +37,19 @@ homeFuncRecyclerView.adapter = homeAdapter homeAdapter.setOnGridItemClickListener(object : HomeGridAdapter.OnGridItemClickListener { override fun onItemClick(position: Int) { - when (position) { - + when (LocaleConstant.HOME_FUNC_OPERATE[position]) { + "仪器设备" -> requireContext().navigatePageTo() +// "标准装置" -> requireContext().navigatePageTo() +// "证书报告" -> requireContext().navigatePageTo() +// "委托需求" -> requireContext().navigatePageTo() +// "访客" -> requireContext().navigatePageTo() +// "标准规范" -> requireContext().navigatePageTo() +// "能力列表" -> requireContext().navigatePageTo() +// "计量培训" -> requireContext().navigatePageTo() +// "合同发票" -> requireContext().navigatePageTo() +// "业务统计" -> requireContext().navigatePageTo() +// "客户列表" -> requireContext().navigatePageTo() +// "外场检测" -> requireContext().navigatePageTo() } } }) diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt index 7e75abe..56dc5ec 100644 --- a/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt +++ b/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt @@ -2,9 +2,11 @@ import android.view.View import androidx.lifecycle.ViewModelProvider +import com.bumptech.glide.Glide +import com.bumptech.glide.request.RequestOptions import com.casic.xz.meterage.R import com.casic.xz.meterage.utils.LocaleConstant -import com.casic.xz.meterage.view.NoticeListActivity +import com.casic.xz.meterage.view.notice.NoticeListActivity import com.casic.xz.meterage.vm.NoticeViewModel import com.casic.xz.meterage.vm.UserViewModel import com.pengxh.kt.lite.base.KotlinBaseFragment @@ -23,6 +25,12 @@ val data = it.data userNameView.text = data.name userUnitView.text = data.deptName + +// Glide.with(requireContext()) +// .load(R.mipmap.default_avatar) +// .apply(RequestOptions.circleCropTransform()) +// .placeholder(R.mipmap.load_image_error) +// .into(userAvatarView) } }) diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt new file mode 100644 index 0000000..cf22646 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt @@ -0,0 +1,103 @@ +package com.casic.xz.meterage.fragment.equipment + +import android.graphics.Paint +import androidx.lifecycle.ViewModelProvider +import com.casic.xz.meterage.R +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.casic.xz.meterage.vm.EquipmentViewModel +import com.pengxh.kt.lite.base.KotlinBaseFragment +import com.pengxh.kt.lite.extensions.convertColor +import com.pengxh.kt.lite.vm.LoadState +import kotlinx.android.synthetic.main.fragment_basic_information.* + +class BasicInformationFragment(private val id: String) : KotlinBaseFragment() { + + private lateinit var equipmentViewModel: EquipmentViewModel + + override fun initData() { + equipmentViewModel = ViewModelProvider(this)[EquipmentViewModel::class.java] + equipmentViewModel.getEquipmentDetail(id) + equipmentViewModel.equipmentDetailResult.observe(this, { + if (it.code == 200) { + val data = it.data!! + + equipmentCodeView.text = data.equipmentNo + equipmentNameView.text = data.equipmentName + manufacturerView.text = data.manufacturer + factoryNumberView.text = data.manufacturingNo + modelView.text = data.modelNo + verificationMethodView.text = data.mesureTypeName + measuringRangeView.text = data.mesureRange + uncertaintyView.text = data.uncertainty + firstUseView.text = data.createTime + originalValueView.text = data.originValue + usageDeptView.text = data.useDeptName + userView.text = data.usePersonName + managementStatusView.text = data.managerStateName + verificationDeptView.text = data.useDeptName +// nextVerificationDeptView.text = data. + verificationPeriodView.text = data.mesureCycle + verificationDateView.text = data.mesureDate + effectiveDateView.text = data.validDate + verificationResultsView.text = data.mesureResultName + abcView.text = data.abcName + isNeedTechnicalView.text = if ( + data.isCalibrationTestEquipment.isNullOrBlank() || data.isCalibrationTestEquipment == "0" + ) { + "否" + } else { + "是" + } + + isStandingBook.text = if ( + data.isMeasureAccount.isNullOrBlank() || data.isMeasureAccount == "0" + ) { + "否" + } else { + "是" + } + + isStandardView.text = if ( + data.isStandardSupportEquipment.isNullOrBlank() || data.isStandardSupportEquipment == "0" + ) { + "否" + } else { + "是" + } + remarkView.text = data.remark + if (data.fileList.size == 0) { + instructionsView.text = "暂无" + } else { + instructionsView.text = "查看附件列表" + val textPaint = instructionsView.paint + textPaint.flags = Paint.UNDERLINE_TEXT_FLAG + textPaint.isAntiAlias = true + instructionsView.setTextColor(R.color.themeColor.convertColor(requireContext())) + + instructionsView.setOnClickListener { + + } + } + } + }) + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_basic_information + + override fun observeRequestState() { + equipmentViewModel.loadState.observe(this, { + when (it) { + LoadState.Loading -> LoadingDialogHub.show(requireActivity(), "数据加载中...") + else -> LoadingDialogHub.dismiss() + } + }) + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt new file mode 100644 index 0000000..0b4a747 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class CertificateFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_certificate + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt new file mode 100644 index 0000000..f05c491 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class ChangeRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_change_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt new file mode 100644 index 0000000..849ffa5 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class InspectionRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_inspection_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt new file mode 100644 index 0000000..aa4edd9 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class UsageRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_usage_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java b/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java new file mode 100644 index 0000000..0b9124e --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java @@ -0,0 +1,760 @@ +package com.casic.xz.meterage.model; + +import java.util.List; + +public class EquipmentDetailModel { + + private int code; + private DataModel data; + private String message; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataModel getData() { + return data; + } + + public void setData(DataModel data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public static class DataModel { + private String abc; + private String abcName; + private String assetNo; + private String assetSource; + private String assetType; + private String assetTypeName; + private String attribute; + private String capitalSource; + private String capitalSourceName; + private String cardEstablishmentDate; + private String createTime; + private String createUser; + private String depreciationMethod; + private String depreciationMethodName; + private String depreciationPeriod; + private String enableDate; + private String equipmentCategory; + private String equipmentCategoryName; + private String equipmentName; + private String equipmentNo; + private String equipmentSpecifications; + private String equipmentType; + private String equipmentTypeName; + private List fileList; + private String id; + private String installIncidentalExpenses; + private String installPlace; + private String intactState; + private String isCalibrationTestEquipment; + private int isDel; + private String isFixedAssets; + private String isMeasureAccount; + private String isStandardSupportEquipment; + private String labelBind; + private String majorCategory; + private String majorCategoryName; + private String managerLevel; + private String managerLevelName; + private String managerState; + private String managerStateName; + private String manufacturer; + private String manufacturerCountry; + private String manufacturingDate; + private String manufacturingNo; + private String mesureCycle; + private String mesureDate; + private String mesureDept; + private String mesureRange; + private String mesureResult; + private String mesureResultName; + private String mesureType; + private String mesureTypeName; + private String modelNo; + private String originValue; + private String overallDimension; + private String presentOriginValue; + private String purpose; + private String remark; + private String singlePrice; + private String supportStandardEquipmentName; + private String supportStandardEquipmentNo; + private String technicalLevel; + private String uncertainty; + private String updateTime; + private String useDept; + private String useDeptName; + private String usePerson; + private String usePersonName; + private String validDate; + private int version; + private String weight; + + public String getAbc() { + return abc; + } + + public void setAbc(String abc) { + this.abc = abc; + } + + public String getAbcName() { + return abcName; + } + + public void setAbcName(String abcName) { + this.abcName = abcName; + } + + public String getAssetNo() { + return assetNo; + } + + public void setAssetNo(String assetNo) { + this.assetNo = assetNo; + } + + public String getAssetSource() { + return assetSource; + } + + public void setAssetSource(String assetSource) { + this.assetSource = assetSource; + } + + public String getAssetType() { + return assetType; + } + + public void setAssetType(String assetType) { + this.assetType = assetType; + } + + public String getAssetTypeName() { + return assetTypeName; + } + + public void setAssetTypeName(String assetTypeName) { + this.assetTypeName = assetTypeName; + } + + public String getAttribute() { + return attribute; + } + + public void setAttribute(String attribute) { + this.attribute = attribute; + } + + public String getCapitalSource() { + return capitalSource; + } + + public void setCapitalSource(String capitalSource) { + this.capitalSource = capitalSource; + } + + public String getCapitalSourceName() { + return capitalSourceName; + } + + public void setCapitalSourceName(String capitalSourceName) { + this.capitalSourceName = capitalSourceName; + } + + public String getCardEstablishmentDate() { + return cardEstablishmentDate; + } + + public void setCardEstablishmentDate(String cardEstablishmentDate) { + this.cardEstablishmentDate = cardEstablishmentDate; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getDepreciationMethod() { + return depreciationMethod; + } + + public void setDepreciationMethod(String depreciationMethod) { + this.depreciationMethod = depreciationMethod; + } + + public String getDepreciationMethodName() { + return depreciationMethodName; + } + + public void setDepreciationMethodName(String depreciationMethodName) { + this.depreciationMethodName = depreciationMethodName; + } + + public String getDepreciationPeriod() { + return depreciationPeriod; + } + + public void setDepreciationPeriod(String depreciationPeriod) { + this.depreciationPeriod = depreciationPeriod; + } + + public String getEnableDate() { + return enableDate; + } + + public void setEnableDate(String enableDate) { + this.enableDate = enableDate; + } + + public String getEquipmentCategory() { + return equipmentCategory; + } + + public void setEquipmentCategory(String equipmentCategory) { + this.equipmentCategory = equipmentCategory; + } + + public String getEquipmentCategoryName() { + return equipmentCategoryName; + } + + public void setEquipmentCategoryName(String equipmentCategoryName) { + this.equipmentCategoryName = equipmentCategoryName; + } + + public String getEquipmentName() { + return equipmentName; + } + + public void setEquipmentName(String equipmentName) { + this.equipmentName = equipmentName; + } + + public String getEquipmentNo() { + return equipmentNo; + } + + public void setEquipmentNo(String equipmentNo) { + this.equipmentNo = equipmentNo; + } + + public String getEquipmentSpecifications() { + return equipmentSpecifications; + } + + public void setEquipmentSpecifications(String equipmentSpecifications) { + this.equipmentSpecifications = equipmentSpecifications; + } + + public String getEquipmentType() { + return equipmentType; + } + + public void setEquipmentType(String equipmentType) { + this.equipmentType = equipmentType; + } + + public String getEquipmentTypeName() { + return equipmentTypeName; + } + + public void setEquipmentTypeName(String equipmentTypeName) { + this.equipmentTypeName = equipmentTypeName; + } + + public List getFileList() { + return fileList; + } + + public void setFileList(List fileList) { + this.fileList = fileList; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getInstallIncidentalExpenses() { + return installIncidentalExpenses; + } + + public void setInstallIncidentalExpenses(String installIncidentalExpenses) { + this.installIncidentalExpenses = installIncidentalExpenses; + } + + public String getInstallPlace() { + return installPlace; + } + + public void setInstallPlace(String installPlace) { + this.installPlace = installPlace; + } + + public String getIntactState() { + return intactState; + } + + public void setIntactState(String intactState) { + this.intactState = intactState; + } + + public String getIsCalibrationTestEquipment() { + return isCalibrationTestEquipment; + } + + public void setIsCalibrationTestEquipment(String isCalibrationTestEquipment) { + this.isCalibrationTestEquipment = isCalibrationTestEquipment; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getIsFixedAssets() { + return isFixedAssets; + } + + public void setIsFixedAssets(String isFixedAssets) { + this.isFixedAssets = isFixedAssets; + } + + public String getIsMeasureAccount() { + return isMeasureAccount; + } + + public void setIsMeasureAccount(String isMeasureAccount) { + this.isMeasureAccount = isMeasureAccount; + } + + public String getIsStandardSupportEquipment() { + return isStandardSupportEquipment; + } + + public void setIsStandardSupportEquipment(String isStandardSupportEquipment) { + this.isStandardSupportEquipment = isStandardSupportEquipment; + } + + public String getLabelBind() { + return labelBind; + } + + public void setLabelBind(String labelBind) { + this.labelBind = labelBind; + } + + public String getMajorCategory() { + return majorCategory; + } + + public void setMajorCategory(String majorCategory) { + this.majorCategory = majorCategory; + } + + public String getMajorCategoryName() { + return majorCategoryName; + } + + public void setMajorCategoryName(String majorCategoryName) { + this.majorCategoryName = majorCategoryName; + } + + public String getManagerLevel() { + return managerLevel; + } + + public void setManagerLevel(String managerLevel) { + this.managerLevel = managerLevel; + } + + public String getManagerLevelName() { + return managerLevelName; + } + + public void setManagerLevelName(String managerLevelName) { + this.managerLevelName = managerLevelName; + } + + public String getManagerState() { + return managerState; + } + + public void setManagerState(String managerState) { + this.managerState = managerState; + } + + public String getManagerStateName() { + return managerStateName; + } + + public void setManagerStateName(String managerStateName) { + this.managerStateName = managerStateName; + } + + public String getManufacturer() { + return manufacturer; + } + + public void setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + } + + public String getManufacturerCountry() { + return manufacturerCountry; + } + + public void setManufacturerCountry(String manufacturerCountry) { + this.manufacturerCountry = manufacturerCountry; + } + + public String getManufacturingDate() { + return manufacturingDate; + } + + public void setManufacturingDate(String manufacturingDate) { + this.manufacturingDate = manufacturingDate; + } + + public String getManufacturingNo() { + return manufacturingNo; + } + + public void setManufacturingNo(String manufacturingNo) { + this.manufacturingNo = manufacturingNo; + } + + public String getMesureCycle() { + return mesureCycle; + } + + public void setMesureCycle(String mesureCycle) { + this.mesureCycle = mesureCycle; + } + + public String getMesureDate() { + return mesureDate; + } + + public void setMesureDate(String mesureDate) { + this.mesureDate = mesureDate; + } + + public String getMesureDept() { + return mesureDept; + } + + public void setMesureDept(String mesureDept) { + this.mesureDept = mesureDept; + } + + public String getMesureRange() { + return mesureRange; + } + + public void setMesureRange(String mesureRange) { + this.mesureRange = mesureRange; + } + + public String getMesureResult() { + return mesureResult; + } + + public void setMesureResult(String mesureResult) { + this.mesureResult = mesureResult; + } + + public String getMesureResultName() { + return mesureResultName; + } + + public void setMesureResultName(String mesureResultName) { + this.mesureResultName = mesureResultName; + } + + public String getMesureType() { + return mesureType; + } + + public void setMesureType(String mesureType) { + this.mesureType = mesureType; + } + + public String getMesureTypeName() { + return mesureTypeName; + } + + public void setMesureTypeName(String mesureTypeName) { + this.mesureTypeName = mesureTypeName; + } + + public String getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getOriginValue() { + return originValue; + } + + public void setOriginValue(String originValue) { + this.originValue = originValue; + } + + public String getOverallDimension() { + return overallDimension; + } + + public void setOverallDimension(String overallDimension) { + this.overallDimension = overallDimension; + } + + public String getPresentOriginValue() { + return presentOriginValue; + } + + public void setPresentOriginValue(String presentOriginValue) { + this.presentOriginValue = presentOriginValue; + } + + public String getPurpose() { + return purpose; + } + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getSinglePrice() { + return singlePrice; + } + + public void setSinglePrice(String singlePrice) { + this.singlePrice = singlePrice; + } + + public String getSupportStandardEquipmentName() { + return supportStandardEquipmentName; + } + + public void setSupportStandardEquipmentName(String supportStandardEquipmentName) { + this.supportStandardEquipmentName = supportStandardEquipmentName; + } + + public String getSupportStandardEquipmentNo() { + return supportStandardEquipmentNo; + } + + public void setSupportStandardEquipmentNo(String supportStandardEquipmentNo) { + this.supportStandardEquipmentNo = supportStandardEquipmentNo; + } + + public String getTechnicalLevel() { + return technicalLevel; + } + + public void setTechnicalLevel(String technicalLevel) { + this.technicalLevel = technicalLevel; + } + + public String getUncertainty() { + return uncertainty; + } + + public void setUncertainty(String uncertainty) { + this.uncertainty = uncertainty; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getUseDept() { + return useDept; + } + + public void setUseDept(String useDept) { + this.useDept = useDept; + } + + public String getUseDeptName() { + return useDeptName; + } + + public void setUseDeptName(String useDeptName) { + this.useDeptName = useDeptName; + } + + public String getUsePerson() { + return usePerson; + } + + public void setUsePerson(String usePerson) { + this.usePerson = usePerson; + } + + public String getUsePersonName() { + return usePersonName; + } + + public void setUsePersonName(String usePersonName) { + this.usePersonName = usePersonName; + } + + public String getValidDate() { + return validDate; + } + + public void setValidDate(String validDate) { + this.validDate = validDate; + } + + public int getVersion() { + return version; + } + + public void setVersion(int version) { + this.version = version; + } + + public String getWeight() { + return weight; + } + + public void setWeight(String weight) { + this.weight = weight; + } + + public static class FileListModel { + private String assetId; + private String createTime; + private String createUser; + private String fileName; + private String id; + private int isDel; + private String minioFileName; + private String remark; + private String updateTime; + + public String getAssetId() { + return assetId; + } + + public void setAssetId(String assetId) { + this.assetId = assetId; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getFileName() { + return fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getMinioFileName() { + return minioFileName; + } + + public void setMinioFileName(String minioFileName) { + this.minioFileName = minioFileName; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + } + } +} diff --git a/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java b/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java new file mode 100644 index 0000000..15fc128 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java @@ -0,0 +1,697 @@ +package com.casic.xz.meterage.model; + +import java.util.List; + +public class EquipmentListModel { + + private int code; + private DataModel data; + private String message; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataModel getData() { + return data; + } + + public void setData(DataModel data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public static class DataModel { + private List rows; + private int total; + + public List getRows() { + return rows; + } + + public void setRows(List rows) { + this.rows = rows; + } + + public int getTotal() { + return total; + } + + public void setTotal(int total) { + this.total = total; + } + + public static class RowsModel { + private String abc; + private String abcName; + private String assetNo; + private String assetSource; + private String assetType; + private String assetTypeName; + private String attribute; + private String capitalSource; + private String capitalSourceName; + private String cardEstablishmentDate; + private String createTime; + private String createUser; + private String depreciationMethod; + private String depreciationMethodName; + private String depreciationPeriod; + private String enableDate; + private String equipmentCategory; + private String equipmentCategoryName; + private String equipmentName; + private String equipmentNo; + private String equipmentSpecifications; + private String equipmentType; + private String equipmentTypeName; + private String fileList; + private String id; + private String installIncidentalExpenses; + private String installPlace; + private String intactState; + private String isCalibrationTestEquipment; + private int isDel; + private String isFixedAssets; + private String isMeasureAccount; + private String isStandardSupportEquipment; + private String labelBind; + private String majorCategory; + private String majorCategoryName; + private String managerLevel; + private String managerLevelName; + private String managerState; + private String managerStateName; + private String manufacturer; + private String manufacturerCountry; + private String manufacturingDate; + private String manufacturingNo; + private String mesureCycle; + private String mesureDate; + private String mesureDept; + private String mesureRange; + private String mesureResult; + private String mesureResultName; + private String mesureType; + private String mesureTypeName; + private String modelNo; + private String originValue; + private String overallDimension; + private String presentOriginValue; + private String purpose; + private String remark; + private String singlePrice; + private String supportStandardEquipmentName; + private String supportStandardEquipmentNo; + private String technicalLevel; + private String uncertainty; + private String updateTime; + private String useDept; + private String useDeptName; + private String usePerson; + private String usePersonName; + private String validDate; + private int version; + private String weight; + + public String getAbc() { + return abc; + } + + public void setAbc(String abc) { + this.abc = abc; + } + + public String getAbcName() { + return abcName; + } + + public void setAbcName(String abcName) { + this.abcName = abcName; + } + + public String getAssetNo() { + return assetNo; + } + + public void setAssetNo(String assetNo) { + this.assetNo = assetNo; + } + + public String getAssetSource() { + return assetSource; + } + + public void setAssetSource(String assetSource) { + this.assetSource = assetSource; + } + + public String getAssetType() { + return assetType; + } + + public void setAssetType(String assetType) { + this.assetType = assetType; + } + + public String getAssetTypeName() { + return assetTypeName; + } + + public void setAssetTypeName(String assetTypeName) { + this.assetTypeName = assetTypeName; + } + + public String getAttribute() { + return attribute; + } + + public void setAttribute(String attribute) { + this.attribute = attribute; + } + + public String getCapitalSource() { + return capitalSource; + } + + public void setCapitalSource(String capitalSource) { + this.capitalSource = capitalSource; + } + + public String getCapitalSourceName() { + return capitalSourceName; + } + + public void setCapitalSourceName(String capitalSourceName) { + this.capitalSourceName = capitalSourceName; + } + + public String getCardEstablishmentDate() { + return cardEstablishmentDate; + } + + public void setCardEstablishmentDate(String cardEstablishmentDate) { + this.cardEstablishmentDate = cardEstablishmentDate; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getDepreciationMethod() { + return depreciationMethod; + } + + public void setDepreciationMethod(String depreciationMethod) { + this.depreciationMethod = depreciationMethod; + } + + public String getDepreciationMethodName() { + return depreciationMethodName; + } + + public void setDepreciationMethodName(String depreciationMethodName) { + this.depreciationMethodName = depreciationMethodName; + } + + public String getDepreciationPeriod() { + return depreciationPeriod; + } + + public void setDepreciationPeriod(String depreciationPeriod) { + this.depreciationPeriod = depreciationPeriod; + } + + public String getEnableDate() { + return enableDate; + } + + public void setEnableDate(String enableDate) { + this.enableDate = enableDate; + } + + public String getEquipmentCategory() { + return equipmentCategory; + } + + public void setEquipmentCategory(String equipmentCategory) { + this.equipmentCategory = equipmentCategory; + } + + public String getEquipmentCategoryName() { + return equipmentCategoryName; + } + + public void setEquipmentCategoryName(String equipmentCategoryName) { + this.equipmentCategoryName = equipmentCategoryName; + } + + public String getEquipmentName() { + return equipmentName; + } + + public void setEquipmentName(String equipmentName) { + this.equipmentName = equipmentName; + } + + public String getEquipmentNo() { + return equipmentNo; + } + + public void setEquipmentNo(String equipmentNo) { + this.equipmentNo = equipmentNo; + } + + public String getEquipmentSpecifications() { + return equipmentSpecifications; + } + + public void setEquipmentSpecifications(String equipmentSpecifications) { + this.equipmentSpecifications = equipmentSpecifications; + } + + public String getEquipmentType() { + return equipmentType; + } + + public void setEquipmentType(String equipmentType) { + this.equipmentType = equipmentType; + } + + public String getEquipmentTypeName() { + return equipmentTypeName; + } + + public void setEquipmentTypeName(String equipmentTypeName) { + this.equipmentTypeName = equipmentTypeName; + } + + public String getFileList() { + return fileList; + } + + public void setFileList(String fileList) { + this.fileList = fileList; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getInstallIncidentalExpenses() { + return installIncidentalExpenses; + } + + public void setInstallIncidentalExpenses(String installIncidentalExpenses) { + this.installIncidentalExpenses = installIncidentalExpenses; + } + + public String getInstallPlace() { + return installPlace; + } + + public void setInstallPlace(String installPlace) { + this.installPlace = installPlace; + } + + public String getIntactState() { + return intactState; + } + + public void setIntactState(String intactState) { + this.intactState = intactState; + } + + public String getIsCalibrationTestEquipment() { + return isCalibrationTestEquipment; + } + + public void setIsCalibrationTestEquipment(String isCalibrationTestEquipment) { + this.isCalibrationTestEquipment = isCalibrationTestEquipment; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getIsFixedAssets() { + return isFixedAssets; + } + + public void setIsFixedAssets(String isFixedAssets) { + this.isFixedAssets = isFixedAssets; + } + + public String getIsMeasureAccount() { + return isMeasureAccount; + } + + public void setIsMeasureAccount(String isMeasureAccount) { + this.isMeasureAccount = isMeasureAccount; + } + + public String getIsStandardSupportEquipment() { + return isStandardSupportEquipment; + } + + public void setIsStandardSupportEquipment(String isStandardSupportEquipment) { + this.isStandardSupportEquipment = isStandardSupportEquipment; + } + + public String getLabelBind() { + return labelBind; + } + + public void setLabelBind(String labelBind) { + this.labelBind = labelBind; + } + + public String getMajorCategory() { + return majorCategory; + } + + public void setMajorCategory(String majorCategory) { + this.majorCategory = majorCategory; + } + + public String getMajorCategoryName() { + return majorCategoryName; + } + + public void setMajorCategoryName(String majorCategoryName) { + this.majorCategoryName = majorCategoryName; + } + + public String getManagerLevel() { + return managerLevel; + } + + public void setManagerLevel(String managerLevel) { + this.managerLevel = managerLevel; + } + + public String getManagerLevelName() { + return managerLevelName; + } + + public void setManagerLevelName(String managerLevelName) { + this.managerLevelName = managerLevelName; + } + + public String getManagerState() { + return managerState; + } + + public void setManagerState(String managerState) { + this.managerState = managerState; + } + + public String getManagerStateName() { + return managerStateName; + } + + public void setManagerStateName(String managerStateName) { + this.managerStateName = managerStateName; + } + + public String getManufacturer() { + return manufacturer; + } + + public void setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + } + + public String getManufacturerCountry() { + return manufacturerCountry; + } + + public void setManufacturerCountry(String manufacturerCountry) { + this.manufacturerCountry = manufacturerCountry; + } + + public String getManufacturingDate() { + return manufacturingDate; + } + + public void setManufacturingDate(String manufacturingDate) { + this.manufacturingDate = manufacturingDate; + } + + public String getManufacturingNo() { + return manufacturingNo; + } + + public void setManufacturingNo(String manufacturingNo) { + this.manufacturingNo = manufacturingNo; + } + + public String getMesureCycle() { + return mesureCycle; + } + + public void setMesureCycle(String mesureCycle) { + this.mesureCycle = mesureCycle; + } + + public String getMesureDate() { + return mesureDate; + } + + public void setMesureDate(String mesureDate) { + this.mesureDate = mesureDate; + } + + public String getMesureDept() { + return mesureDept; + } + + public void setMesureDept(String mesureDept) { + this.mesureDept = mesureDept; + } + + public String getMesureRange() { + return mesureRange; + } + + public void setMesureRange(String mesureRange) { + this.mesureRange = mesureRange; + } + + public String getMesureResult() { + return mesureResult; + } + + public void setMesureResult(String mesureResult) { + this.mesureResult = mesureResult; + } + + public String getMesureResultName() { + return mesureResultName; + } + + public void setMesureResultName(String mesureResultName) { + this.mesureResultName = mesureResultName; + } + + public String getMesureType() { + return mesureType; + } + + public void setMesureType(String mesureType) { + this.mesureType = mesureType; + } + + public String getMesureTypeName() { + return mesureTypeName; + } + + public void setMesureTypeName(String mesureTypeName) { + this.mesureTypeName = mesureTypeName; + } + + public String getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getOriginValue() { + return originValue; + } + + public void setOriginValue(String originValue) { + this.originValue = originValue; + } + + public String getOverallDimension() { + return overallDimension; + } + + public void setOverallDimension(String overallDimension) { + this.overallDimension = overallDimension; + } + + public String getPresentOriginValue() { + return presentOriginValue; + } + + public void setPresentOriginValue(String presentOriginValue) { + this.presentOriginValue = presentOriginValue; + } + + public String getPurpose() { + return purpose; + } + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getSinglePrice() { + return singlePrice; + } + + public void setSinglePrice(String singlePrice) { + this.singlePrice = singlePrice; + } + + public String getSupportStandardEquipmentName() { + return supportStandardEquipmentName; + } + + public void setSupportStandardEquipmentName(String supportStandardEquipmentName) { + this.supportStandardEquipmentName = supportStandardEquipmentName; + } + + public String getSupportStandardEquipmentNo() { + return supportStandardEquipmentNo; + } + + public void setSupportStandardEquipmentNo(String supportStandardEquipmentNo) { + this.supportStandardEquipmentNo = supportStandardEquipmentNo; + } + + public String getTechnicalLevel() { + return technicalLevel; + } + + public void setTechnicalLevel(String technicalLevel) { + this.technicalLevel = technicalLevel; + } + + public String getUncertainty() { + return uncertainty; + } + + public void setUncertainty(String uncertainty) { + this.uncertainty = uncertainty; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getUseDept() { + return useDept; + } + + public void setUseDept(String useDept) { + this.useDept = useDept; + } + + public String getUseDeptName() { + return useDeptName; + } + + public void setUseDeptName(String useDeptName) { + this.useDeptName = useDeptName; + } + + public String getUsePerson() { + return usePerson; + } + + public void setUsePerson(String usePerson) { + this.usePerson = usePerson; + } + + public String getUsePersonName() { + return usePersonName; + } + + public void setUsePersonName(String usePersonName) { + this.usePersonName = usePersonName; + } + + public String getValidDate() { + return validDate; + } + + public void setValidDate(String validDate) { + this.validDate = validDate; + } + + public int getVersion() { + return version; + } + + public void setVersion(int version) { + this.version = version; + } + + public String getWeight() { + return weight; + } + + public void setWeight(String weight) { + this.weight = weight; + } + } + } +} diff --git a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt index a3f514f..46e5eef 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt @@ -35,4 +35,24 @@ @QueryMap limit: Map, @QueryMap offset: Map ): String + + /** + * 获取设备列表 + */ + @POST("/meter/assets/listPage") + suspend fun getEquipmentList( + @Header("token") token: String, + @Body requestBody: RequestBody, + @QueryMap limit: Map, + @QueryMap offset: Map + ): String + + /** + * 获取设备详情 + */ + @POST("/meter/assets/detail") + suspend fun getEquipmentDetail( + @Header("token") token: String, + @Body requestBody: RequestBody + ): String } \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt index 444a872..386a1d8 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt @@ -6,8 +6,10 @@ import com.pengxh.kt.lite.utils.SaveKeyValues import okhttp3.MediaType.Companion.toMediaType import okhttp3.RequestBody.Companion.toRequestBody +import org.json.JSONArray import org.json.JSONObject + object RetrofitServiceManager { private val api by lazy { @@ -73,4 +75,71 @@ offsetMap["offset"] = offset return api.getNoticeList(AuthenticationHelper.token!!, requestBody, limitMap, offsetMap) } + + /** + * 获取设备列表 + */ + suspend fun getEquipmentList( + equipmentNo: String, + equipmentName: String, + mesureType: String, + managerState: String, + useDept: String, + assetType: String, + equipmentCategory: String, + isCalibrationTestEquipment: String, + isMeasureAccount: String, + isStandardSupportEquipment: String, + isFixedAssets: String, + validStartDate: String, + validEndDate: String, + abc: String, + ids: Array, + offset: Int + ): String { + val paramObject = JSONObject() + paramObject.put("equipmentNo", equipmentNo) + paramObject.put("equipmentName", equipmentName) + paramObject.put("mesureType", mesureType) + paramObject.put("managerState", managerState) + paramObject.put("useDept", useDept) + paramObject.put("assetType", assetType) + paramObject.put("equipmentCategory", equipmentCategory) + paramObject.put("isCalibrationTestEquipment", isCalibrationTestEquipment) + paramObject.put("isMeasureAccount", isMeasureAccount) + paramObject.put("isStandardSupportEquipment", isStandardSupportEquipment) + paramObject.put("isFixedAssets", isFixedAssets) + paramObject.put("validStartDate", validStartDate) + paramObject.put("validEndDate", validEndDate) + paramObject.put("abc", abc) + + val jsonArray = JSONArray() + ids.forEach { + jsonArray.put(it) + } + paramObject.put("ids", jsonArray) + + val requestBody = paramObject.toString().toRequestBody( + "application/json;charset=UTF-8".toMediaType() + ) + + val limitMap = HashMap() + limitMap["limit"] = LocaleConstant.PAGE_LIMIT + + val offsetMap = HashMap() + offsetMap["offset"] = offset + return api.getEquipmentList(AuthenticationHelper.token!!, requestBody, limitMap, offsetMap) + } + + /** + * 获取设备详情 + */ + suspend fun getEquipmentDetail(id: String): String { + val paramObject = JSONObject() + paramObject.put("id", id) + val requestBody = paramObject.toString().toRequestBody( + "application/json;charset=UTF-8".toMediaType() + ) + return api.getEquipmentDetail(AuthenticationHelper.token!!, requestBody) + } } \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt deleted file mode 100644 index a5bb60b..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt +++ /dev/null @@ -1,104 +0,0 @@ -package com.casic.xz.meterage.view - -import android.annotation.SuppressLint -import android.graphics.Paint -import androidx.lifecycle.ViewModelProvider -import com.casic.xz.meterage.R -import com.casic.xz.meterage.extensions.combineImagePath -import com.casic.xz.meterage.extensions.formatTextFromHtml -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.vm.NoticeViewModel -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.extensions.convertColor -import com.pengxh.kt.lite.extensions.navigatePageTo -import com.pengxh.kt.lite.extensions.obtainScreenWidth -import com.pengxh.kt.lite.extensions.show -import com.pengxh.kt.lite.utils.Constant -import kotlinx.android.synthetic.main.activity_notice_detail.* -import kotlinx.android.synthetic.main.include_base_title.* -import java.util.* - -@SuppressLint("SetTextI18n") -class NoticeDetailActivity : KotlinBaseActivity() { - - private lateinit var noticeViewModel: NoticeViewModel - - override fun initData() { - leftBackView.setOnClickListener { finish() } - titleView.text = "通知公告" - - val args = intent.getStringArrayListExtra(Constant.INTENT_PARAM)!! - - noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] - noticeViewModel.getNoticeList(args[0], args[1], args[2], "", "", 1) - noticeViewModel.noticeResult.observe(this, { - if (it.code == 200) { - val dataRow = it.data?.rows!![0] - - noticeDateView.text = dataRow.noticeTime - noticePublisherView.text = "发布人 ${dataRow.noticePublisher}" - noticeCompanyView.text = "发布单位 ${dataRow.noticeCompany}" - - noticeNoView.text = dataRow.noticeNo - noticeTitleView.text = dataRow.noticeTitle - noticeSketchView.text = dataRow.noticeSketch - - dataRow.noticeContent.formatTextFromHtml( - this, noticeContentView, obtainScreenWidth() - ) - - if (dataRow.minioFileName.isNullOrBlank()) { - minioFileView.text = "暂无附件" - } else { - val minioFileName = dataRow.minioFileName - - minioFileView.text = minioFileName - val textPaint = minioFileView.paint - textPaint.flags = Paint.UNDERLINE_TEXT_FLAG - textPaint.isAntiAlias = true - minioFileView.setTextColor(R.color.themeColor.convertColor(this)) - - minioFileView.setOnClickListener { - //查看附件 - if (minioFileName.endsWith("pdf")) { - navigatePageTo(minioFileName) - } else if ( - minioFileName.endsWith("doc") || - minioFileName.endsWith("docx") - ) { - navigatePageTo(minioFileName) - } else if (minioFileName.endsWith("txt")) { - navigatePageTo(minioFileName) - } else if ( - minioFileName.endsWith("png") || - minioFileName.endsWith("jpeg") || - minioFileName.endsWith("jpg") - ) { - val urls = ArrayList() - urls.add(minioFileName.combineImagePath()) - navigatePageTo(0, urls) - } else { - "文件类型未知,无法打开附件".show(this) - } - } - } - } - }) - } - - override fun initEvent() { - - } - - override fun initLayoutView(): Int = R.layout.activity_notice_detail - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/NoticeListActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/NoticeListActivity.kt deleted file mode 100644 index 15f6a16..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/NoticeListActivity.kt +++ /dev/null @@ -1,180 +0,0 @@ -package com.casic.xz.meterage.view - -import android.os.Handler -import android.util.Log -import android.view.View -import androidx.lifecycle.ViewModelProvider -import com.casic.xz.meterage.R -import com.casic.xz.meterage.adapter.NoticeListAdapter -import com.casic.xz.meterage.extensions.addAll -import com.casic.xz.meterage.extensions.combineFilePath -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.extensions.showEmptyPage -import com.casic.xz.meterage.model.NoticeListModel -import com.casic.xz.meterage.vm.NoticeViewModel -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.extensions.navigatePageTo -import com.pengxh.kt.lite.extensions.show -import com.pengxh.kt.lite.utils.WeakReferenceHandler -import com.pengxh.kt.lite.widget.dialog.AlertControlDialog -import kotlinx.android.synthetic.main.activity_notice_list.* -import kotlinx.android.synthetic.main.include_empty_view.* - -class NoticeListActivity : KotlinBaseActivity() { - - private lateinit var weakReferenceHandler: WeakReferenceHandler - private lateinit var noticeViewModel: NoticeViewModel - private lateinit var noticeListAdapter: NoticeListAdapter - private var dataBeans: MutableList = ArrayList() - private var pageIndex = 1 - private var isRefresh = false - private var isLoadMore = false - - override fun initData() { - weakReferenceHandler = WeakReferenceHandler(callback) - noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] - noticeViewModel.noticeResult.observe(this, { - if (it.code == 200) { - val dataRows = it.data?.rows!! -// countBadeNumber(dataRows) - when { - isRefresh -> { - dataBeans.clear() - dataBeans = dataRows - noticeLayout.finishRefresh() - isRefresh = false - } - isLoadMore -> { - if (dataRows.size == 0) { - "到底了,别拉了".show(this) - } - dataBeans.addAll(dataRows) - noticeLayout.finishLoadMore() - isLoadMore = false - } - else -> { - dataBeans = dataRows - } - } - weakReferenceHandler.sendEmptyMessage(2023013101) - } - }) - } - - override fun initEvent() { - leftBackView.setOnClickListener { finish() } - rightOperateView.setOnClickListener { - AlertControlDialog.Builder() - .setContext(this) - .setTitle("提示") - .setMessage("确定将所有未读消息标为已读?") - .setNegativeButton("取消") - .setPositiveButton("确定") - .setOnDialogButtonClickListener(object : - AlertControlDialog.OnDialogButtonClickListener { - override fun onCancelClick() { - - } - - override fun onConfirmClick() { - //TODO 设置为已读 - } - }).build().show() - } - - if (hasNoticePermission()) { - openSystemNoticeLayout.visibility = View.GONE - openSystemNoticeLayout.visibility = View.GONE - } else { - openSystemNoticeLayout.setOnClickListener { - - } - - - closeLayoutView.setOnClickListener { - openSystemNoticeLayout.visibility = View.GONE - } - } - - noticeLayout.setOnRefreshListener { - isRefresh = true - //刷新之后页码重置 - pageIndex = 1 - getNoticeListByPage() - } - - noticeLayout.setOnLoadMoreListener { - isLoadMore = true - pageIndex++ - getNoticeListByPage() - } - } - - override fun onResume() { - super.onResume() - pageIndex = 1 - getNoticeListByPage() - } - - private fun getNoticeListByPage() { - noticeViewModel.getNoticeList("", "", "", "", "", pageIndex) - } - - private val callback = Handler.Callback { - when (it.what) { - 2023013101 -> { - if (isRefresh || isLoadMore) { - noticeListAdapter.notifyDataSetChanged() - } else { - if (dataBeans.size == 0) { - emptyView!!.showEmptyPage("没有任何消息") { - pageIndex = 1 - getNoticeListByPage() - } - } else { - emptyView!!.hide() - noticeListAdapter = NoticeListAdapter(this, dataBeans) - noticeRecyclerView.adapter = noticeListAdapter - noticeListAdapter.setOnItemClickListener(object : - NoticeListAdapter.OnItemClickListener { - override fun onItemClicked(position: Int) { - val rowsModel = dataBeans[position] - val allArgs = addAll( - rowsModel.noticeNo, - rowsModel.noticeTitle, - rowsModel.noticePublisher, - "", - "" - ) - Log.d( - "Casic", - "NoticeListActivity => onItemClicked: ${rowsModel.minioFileName.combineFilePath()}" - ) - navigatePageTo(allArgs) - } - }) - } - } - } - } - true - } - - //TODO 判断是否开启通知权限 - private fun hasNoticePermission(): Boolean { - - return false - } - - override fun initLayoutView(): Int = R.layout.activity_notice_list - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/PreviewDocumentActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/PreviewDocumentActivity.kt deleted file mode 100644 index e233ddc..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/PreviewDocumentActivity.kt +++ /dev/null @@ -1,24 +0,0 @@ -package com.casic.xz.meterage.view - -import com.casic.xz.meterage.R -import com.pengxh.kt.lite.base.KotlinBaseActivity - -class PreviewDocumentActivity : KotlinBaseActivity() { - override fun initData() { - - } - - override fun initEvent() { - - } - - override fun initLayoutView(): Int = R.layout.activity_preview_doc - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/PreviewPdfActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/PreviewPdfActivity.kt deleted file mode 100644 index 39f8ac2..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/PreviewPdfActivity.kt +++ /dev/null @@ -1,62 +0,0 @@ -package com.casic.xz.meterage.view - -import com.casic.xz.meterage.R -import com.casic.xz.meterage.extensions.combineFilePath -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.utils.LoadingDialogHub -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.callback.OnDownloadListener -import com.pengxh.kt.lite.extensions.createDownloadFileDir -import com.pengxh.kt.lite.extensions.downloadFile -import com.pengxh.kt.lite.utils.Constant -import kotlinx.android.synthetic.main.activity_preview_pdf.* -import kotlinx.android.synthetic.main.include_base_title.* -import java.io.File -import java.io.FileInputStream - - -class PreviewPdfActivity : KotlinBaseActivity() { - - override fun initData() { - val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! - titleView.text = minioFileName - - val url = minioFileName.combineFilePath() - url.downloadFile(createDownloadFileDir().toString(), - object : OnDownloadListener { - override fun onDownloadStart(totalBytes: Long) { - runOnUiThread { - LoadingDialogHub.show(this@PreviewPdfActivity, "附件加载中") - } - } - - override fun onProgressChanged(currentBytes: Long) { - - } - - override fun onDownloadEnd(file: File?) { - runOnUiThread { - LoadingDialogHub.dismiss() - } - val inputStream = FileInputStream(file) - pdfView.fromStream(inputStream).load() - } - }) - } - - override fun initEvent() { - leftBackView.setOnClickListener { finish() } - } - - override fun initLayoutView(): Int = R.layout.activity_preview_pdf - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/PreviewTextActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/PreviewTextActivity.kt deleted file mode 100644 index d634ca3..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/PreviewTextActivity.kt +++ /dev/null @@ -1,60 +0,0 @@ -package com.casic.xz.meterage.view - -import com.casic.xz.meterage.R -import com.casic.xz.meterage.extensions.combineFilePath -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.utils.LoadingDialogHub -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.callback.OnDownloadListener -import com.pengxh.kt.lite.extensions.createDownloadFileDir -import com.pengxh.kt.lite.extensions.downloadFile -import com.pengxh.kt.lite.extensions.read -import com.pengxh.kt.lite.utils.Constant -import kotlinx.android.synthetic.main.activity_preview_txt.* -import kotlinx.android.synthetic.main.include_base_title.* -import java.io.File - -class PreviewTextActivity : KotlinBaseActivity() { - - override fun initData() { - val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! - titleView.text = minioFileName - - val url = minioFileName.combineFilePath() - url.downloadFile(createDownloadFileDir().toString(), - object : OnDownloadListener { - override fun onDownloadStart(totalBytes: Long) { - runOnUiThread { - LoadingDialogHub.show(this@PreviewTextActivity, "附件加载中") - } - } - - override fun onProgressChanged(currentBytes: Long) { - - } - - override fun onDownloadEnd(file: File?) { - runOnUiThread { - LoadingDialogHub.dismiss() - textView.text = file?.read() - } - } - }) - } - - override fun initEvent() { - leftBackView.setOnClickListener { finish() } - } - - override fun initLayoutView(): Int = R.layout.activity_preview_txt - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentActivity.kt new file mode 100644 index 0000000..35ca098 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentActivity.kt @@ -0,0 +1,158 @@ +package com.casic.xz.meterage.view.home + +import android.os.Handler +import androidx.lifecycle.ViewModelProvider +import androidx.recyclerview.widget.DividerItemDecoration +import com.casic.xz.meterage.R +import com.casic.xz.meterage.adapter.EquipmentListAdapter +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.extensions.showEmptyPage +import com.casic.xz.meterage.model.EquipmentListModel +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.casic.xz.meterage.vm.EquipmentViewModel +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.extensions.navigatePageTo +import com.pengxh.kt.lite.extensions.show +import com.pengxh.kt.lite.utils.WeakReferenceHandler +import com.pengxh.kt.lite.vm.LoadState +import kotlinx.android.synthetic.main.activity_equipment.* +import kotlinx.android.synthetic.main.include_empty_view.* +import kotlinx.android.synthetic.main.include_search_title.* + +class EquipmentActivity : KotlinBaseActivity() { + + private lateinit var weakReferenceHandler: WeakReferenceHandler + private lateinit var equipmentViewModel: EquipmentViewModel + private lateinit var equipmentListAdapter: EquipmentListAdapter + private var dataBeans: MutableList = ArrayList() + private var pageIndex = 1 + private var isRefresh = false + private var isLoadMore = false + + override fun initData() { + weakReferenceHandler = WeakReferenceHandler(callback) + equipmentViewModel = ViewModelProvider(this)[EquipmentViewModel::class.java] + equipmentViewModel.equipmentResult.observe(this, { + if (it.code == 200) { + val dataRows = it.data?.rows!! + when { + isRefresh -> { + dataBeans.clear() + dataBeans = dataRows + equipmentLayout.finishRefresh() + isRefresh = false + } + isLoadMore -> { + if (dataRows.size == 0) { + "到底了,别拉了".show(this) + } + dataBeans.addAll(dataRows) + equipmentLayout.finishLoadMore() + isLoadMore = false + } + else -> { + dataBeans = dataRows + } + } + weakReferenceHandler.sendEmptyMessage(2023020801) + } + }) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + rightOperateView.setOnClickListener { + + } + + equipmentLayout.setOnRefreshListener { + isRefresh = true + //刷新之后页码重置 + pageIndex = 1 + getEquipmentListByPage() + } + + equipmentLayout.setOnLoadMoreListener { + isLoadMore = true + pageIndex++ + getEquipmentListByPage() + } + } + + override fun initLayoutView(): Int = R.layout.activity_equipment + + override fun observeRequestState() { + equipmentViewModel.loadState.observe(this, { + when (it) { + LoadState.Loading -> LoadingDialogHub.show(this, "数据加载中...") + else -> LoadingDialogHub.dismiss() + } + }) + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + titleView.text = "仪器设备" + } + + override fun onResume() { + super.onResume() + pageIndex = 1 + getEquipmentListByPage() + } + + private fun getEquipmentListByPage() { + equipmentViewModel.getEquipmentList( + "", + "", + "", + "", + "", + "1", + "", + "", + "", + "", + "", + "", + "", + "", + arrayOf(), + pageIndex + ) + } + + private val callback = Handler.Callback { + when (it.what) { + 2023020801 -> { + if (isRefresh || isLoadMore) { + equipmentListAdapter.notifyDataSetChanged() + } else { + if (dataBeans.size == 0) { + emptyView!!.showEmptyPage("无设备") { + pageIndex = 1 + getEquipmentListByPage() + } + } else { + emptyView!!.hide() + equipmentListAdapter = EquipmentListAdapter(this, dataBeans) + equipmentRecyclerView.addItemDecoration( + DividerItemDecoration(this, DividerItemDecoration.VERTICAL) + ) + equipmentRecyclerView.adapter = equipmentListAdapter + equipmentListAdapter.setOnItemClickListener(object : + EquipmentListAdapter.OnItemClickListener { + override fun onItemClicked(position: Int) { + val rowsModel = dataBeans[position] + navigatePageTo(rowsModel.id) + } + }) + } + } + } + } + true + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentDetailActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentDetailActivity.kt new file mode 100644 index 0000000..7dee13c --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentDetailActivity.kt @@ -0,0 +1,53 @@ +package com.casic.xz.meterage.view.home + +import androidx.fragment.app.Fragment +import com.casic.xz.meterage.R +import com.casic.xz.meterage.adapter.SubViewPagerAdapter +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.fragment.equipment.* +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.utils.Constant +import kotlinx.android.synthetic.main.activity_equipment.rootView +import kotlinx.android.synthetic.main.activity_equipment_detail.* +import kotlinx.android.synthetic.main.include_base_title.* + +class EquipmentDetailActivity : KotlinBaseActivity() { + + private var fragmentPages: ArrayList = ArrayList() + + override fun initData() { + val equipmentId = intent.getStringExtra(Constant.INTENT_PARAM)!! + + fragmentPages.add(BasicInformationFragment(equipmentId)) + fragmentPages.add(InspectionRecordFragment()) + fragmentPages.add(ChangeRecordFragment()) + fragmentPages.add(UsageRecordFragment()) + fragmentPages.add(CertificateFragment()) + + val equipmentPageTitles = arrayOf("基础信息", "周检记录", "状态变更记录", "使用记录", "检定证书") + + equipmentViewPager.adapter = SubViewPagerAdapter( + supportFragmentManager, fragmentPages, equipmentPageTitles + ) + equipmentViewPager.offscreenPageLimit = fragmentPages.size + //绑定 + topTabLayout.setupWithViewPager(equipmentViewPager) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + } + + override fun initLayoutView(): Int = R.layout.activity_equipment_detail + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + titleView.text = "仪器设备" + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeDetailActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeDetailActivity.kt new file mode 100644 index 0000000..6fe0022 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeDetailActivity.kt @@ -0,0 +1,105 @@ +package com.casic.xz.meterage.view.notice + +import android.annotation.SuppressLint +import android.graphics.Paint +import androidx.lifecycle.ViewModelProvider +import com.casic.xz.meterage.R +import com.casic.xz.meterage.extensions.combineImagePath +import com.casic.xz.meterage.extensions.formatTextFromHtml +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.view.BigImageActivity +import com.casic.xz.meterage.vm.NoticeViewModel +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.extensions.convertColor +import com.pengxh.kt.lite.extensions.navigatePageTo +import com.pengxh.kt.lite.extensions.obtainScreenWidth +import com.pengxh.kt.lite.extensions.show +import com.pengxh.kt.lite.utils.Constant +import kotlinx.android.synthetic.main.activity_notice_detail.* +import kotlinx.android.synthetic.main.include_base_title.* +import java.util.* + +@SuppressLint("SetTextI18n") +class NoticeDetailActivity : KotlinBaseActivity() { + + private lateinit var noticeViewModel: NoticeViewModel + + override fun initData() { + leftBackView.setOnClickListener { finish() } + titleView.text = "通知公告" + + val args = intent.getStringArrayListExtra(Constant.INTENT_PARAM)!! + + noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] + noticeViewModel.getNoticeList(args[0], args[1], args[2], "", "", 1) + noticeViewModel.noticeResult.observe(this, { + if (it.code == 200) { + val dataRow = it.data?.rows!![0] + + noticeDateView.text = dataRow.noticeTime + noticePublisherView.text = "发布人 ${dataRow.noticePublisher}" + noticeCompanyView.text = "发布单位 ${dataRow.noticeCompany}" + + noticeNoView.text = dataRow.noticeNo + noticeTitleView.text = dataRow.noticeTitle + noticeSketchView.text = dataRow.noticeSketch + + dataRow.noticeContent.formatTextFromHtml( + this, noticeContentView, obtainScreenWidth() + ) + + if (dataRow.minioFileName.isNullOrBlank()) { + minioFileView.text = "暂无附件" + } else { + val minioFileName = dataRow.minioFileName + + minioFileView.text = minioFileName + val textPaint = minioFileView.paint + textPaint.flags = Paint.UNDERLINE_TEXT_FLAG + textPaint.isAntiAlias = true + minioFileView.setTextColor(R.color.themeColor.convertColor(this)) + + minioFileView.setOnClickListener { + //查看附件 + if (minioFileName.endsWith("pdf")) { + navigatePageTo(minioFileName) + } else if ( + minioFileName.endsWith("doc") || + minioFileName.endsWith("docx") + ) { + navigatePageTo(minioFileName) + } else if (minioFileName.endsWith("txt")) { + navigatePageTo(minioFileName) + } else if ( + minioFileName.endsWith("png") || + minioFileName.endsWith("jpeg") || + minioFileName.endsWith("jpg") + ) { + val urls = ArrayList() + urls.add(minioFileName.combineImagePath()) + navigatePageTo(0, urls) + } else { + "文件类型未知,无法打开附件".show(this) + } + } + } + } + }) + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.activity_notice_detail + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeListActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeListActivity.kt new file mode 100644 index 0000000..31c0490 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeListActivity.kt @@ -0,0 +1,180 @@ +package com.casic.xz.meterage.view.notice + +import android.os.Handler +import android.util.Log +import android.view.View +import androidx.lifecycle.ViewModelProvider +import com.casic.xz.meterage.R +import com.casic.xz.meterage.adapter.NoticeListAdapter +import com.casic.xz.meterage.extensions.addAll +import com.casic.xz.meterage.extensions.combineFilePath +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.extensions.showEmptyPage +import com.casic.xz.meterage.model.NoticeListModel +import com.casic.xz.meterage.vm.NoticeViewModel +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.extensions.navigatePageTo +import com.pengxh.kt.lite.extensions.show +import com.pengxh.kt.lite.utils.WeakReferenceHandler +import com.pengxh.kt.lite.widget.dialog.AlertControlDialog +import kotlinx.android.synthetic.main.activity_notice_list.* +import kotlinx.android.synthetic.main.include_empty_view.* + +class NoticeListActivity : KotlinBaseActivity() { + + private lateinit var weakReferenceHandler: WeakReferenceHandler + private lateinit var noticeViewModel: NoticeViewModel + private lateinit var noticeListAdapter: NoticeListAdapter + private var dataBeans: MutableList = ArrayList() + private var pageIndex = 1 + private var isRefresh = false + private var isLoadMore = false + + override fun initData() { + weakReferenceHandler = WeakReferenceHandler(callback) + noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] + noticeViewModel.noticeResult.observe(this, { + if (it.code == 200) { + val dataRows = it.data?.rows!! +// countBadeNumber(dataRows) + when { + isRefresh -> { + dataBeans.clear() + dataBeans = dataRows + noticeLayout.finishRefresh() + isRefresh = false + } + isLoadMore -> { + if (dataRows.size == 0) { + "到底了,别拉了".show(this) + } + dataBeans.addAll(dataRows) + noticeLayout.finishLoadMore() + isLoadMore = false + } + else -> { + dataBeans = dataRows + } + } + weakReferenceHandler.sendEmptyMessage(2023013101) + } + }) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + rightOperateView.setOnClickListener { + AlertControlDialog.Builder() + .setContext(this) + .setTitle("提示") + .setMessage("确定将所有未读消息标为已读?") + .setNegativeButton("取消") + .setPositiveButton("确定") + .setOnDialogButtonClickListener(object : + AlertControlDialog.OnDialogButtonClickListener { + override fun onCancelClick() { + + } + + override fun onConfirmClick() { + //TODO 设置为已读 + } + }).build().show() + } + + if (hasNoticePermission()) { + openSystemNoticeLayout.visibility = View.GONE + openSystemNoticeLayout.visibility = View.GONE + } else { + openSystemNoticeLayout.setOnClickListener { + + } + + + closeLayoutView.setOnClickListener { + openSystemNoticeLayout.visibility = View.GONE + } + } + + noticeLayout.setOnRefreshListener { + isRefresh = true + //刷新之后页码重置 + pageIndex = 1 + getNoticeListByPage() + } + + noticeLayout.setOnLoadMoreListener { + isLoadMore = true + pageIndex++ + getNoticeListByPage() + } + } + + override fun onResume() { + super.onResume() + pageIndex = 1 + getNoticeListByPage() + } + + private fun getNoticeListByPage() { + noticeViewModel.getNoticeList("", "", "", "", "", pageIndex) + } + + private val callback = Handler.Callback { + when (it.what) { + 2023013101 -> { + if (isRefresh || isLoadMore) { + noticeListAdapter.notifyDataSetChanged() + } else { + if (dataBeans.size == 0) { + emptyView!!.showEmptyPage("没有任何消息") { + pageIndex = 1 + getNoticeListByPage() + } + } else { + emptyView!!.hide() + noticeListAdapter = NoticeListAdapter(this, dataBeans) + noticeRecyclerView.adapter = noticeListAdapter + noticeListAdapter.setOnItemClickListener(object : + NoticeListAdapter.OnItemClickListener { + override fun onItemClicked(position: Int) { + val rowsModel = dataBeans[position] + val allArgs = addAll( + rowsModel.noticeNo, + rowsModel.noticeTitle, + rowsModel.noticePublisher, + "", + "" + ) + Log.d( + "Casic", + "NoticeListActivity => onItemClicked: ${rowsModel.minioFileName.combineFilePath()}" + ) + navigatePageTo(allArgs) + } + }) + } + } + } + } + true + } + + //TODO 判断是否开启通知权限 + private fun hasNoticePermission(): Boolean { + + return false + } + + override fun initLayoutView(): Int = R.layout.activity_notice_list + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewDocumentActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewDocumentActivity.kt new file mode 100644 index 0000000..4b16ae8 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewDocumentActivity.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.view.notice + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseActivity + +class PreviewDocumentActivity : KotlinBaseActivity() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.activity_preview_doc + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewPdfActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewPdfActivity.kt new file mode 100644 index 0000000..fad73b6 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewPdfActivity.kt @@ -0,0 +1,62 @@ +package com.casic.xz.meterage.view.notice + +import com.casic.xz.meterage.R +import com.casic.xz.meterage.extensions.combineFilePath +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.callback.OnDownloadListener +import com.pengxh.kt.lite.extensions.createDownloadFileDir +import com.pengxh.kt.lite.extensions.downloadFile +import com.pengxh.kt.lite.utils.Constant +import kotlinx.android.synthetic.main.activity_preview_pdf.* +import kotlinx.android.synthetic.main.include_base_title.* +import java.io.File +import java.io.FileInputStream + + +class PreviewPdfActivity : KotlinBaseActivity() { + + override fun initData() { + val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! + titleView.text = minioFileName + + val url = minioFileName.combineFilePath() + url.downloadFile(createDownloadFileDir().toString(), + object : OnDownloadListener { + override fun onDownloadStart(totalBytes: Long) { + runOnUiThread { + LoadingDialogHub.show(this@PreviewPdfActivity, "附件加载中") + } + } + + override fun onProgressChanged(currentBytes: Long) { + + } + + override fun onDownloadEnd(file: File?) { + runOnUiThread { + LoadingDialogHub.dismiss() + } + val inputStream = FileInputStream(file) + pdfView.fromStream(inputStream).load() + } + }) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + } + + override fun initLayoutView(): Int = R.layout.activity_preview_pdf + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewTextActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewTextActivity.kt new file mode 100644 index 0000000..d7850fb --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewTextActivity.kt @@ -0,0 +1,60 @@ +package com.casic.xz.meterage.view.notice + +import com.casic.xz.meterage.R +import com.casic.xz.meterage.extensions.combineFilePath +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.callback.OnDownloadListener +import com.pengxh.kt.lite.extensions.createDownloadFileDir +import com.pengxh.kt.lite.extensions.downloadFile +import com.pengxh.kt.lite.extensions.read +import com.pengxh.kt.lite.utils.Constant +import kotlinx.android.synthetic.main.activity_preview_txt.* +import kotlinx.android.synthetic.main.include_base_title.* +import java.io.File + +class PreviewTextActivity : KotlinBaseActivity() { + + override fun initData() { + val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! + titleView.text = minioFileName + + val url = minioFileName.combineFilePath() + url.downloadFile(createDownloadFileDir().toString(), + object : OnDownloadListener { + override fun onDownloadStart(totalBytes: Long) { + runOnUiThread { + LoadingDialogHub.show(this@PreviewTextActivity, "附件加载中") + } + } + + override fun onProgressChanged(currentBytes: Long) { + + } + + override fun onDownloadEnd(file: File?) { + runOnUiThread { + LoadingDialogHub.dismiss() + textView.text = file?.read() + } + } + }) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + } + + override fun initLayoutView(): Int = R.layout.activity_preview_txt + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/vm/EquipmentViewModel.kt b/app/src/main/java/com/casic/xz/meterage/vm/EquipmentViewModel.kt new file mode 100644 index 0000000..b5f21f6 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/vm/EquipmentViewModel.kt @@ -0,0 +1,92 @@ +package com.casic.xz.meterage.vm + +import androidx.lifecycle.MutableLiveData +import com.casic.xz.meterage.base.BaseApplication +import com.casic.xz.meterage.extensions.separateResponseCode +import com.casic.xz.meterage.extensions.toErrorMessage +import com.casic.xz.meterage.model.EquipmentDetailModel +import com.casic.xz.meterage.model.EquipmentListModel +import com.casic.xz.meterage.utils.retrofit.RetrofitServiceManager +import com.google.gson.Gson +import com.google.gson.reflect.TypeToken +import com.pengxh.kt.lite.extensions.launch +import com.pengxh.kt.lite.extensions.show +import com.pengxh.kt.lite.vm.BaseViewModel +import com.pengxh.kt.lite.vm.LoadState + +class EquipmentViewModel : BaseViewModel() { + + private val gson by lazy { Gson() } + val equipmentResult = MutableLiveData() + val equipmentDetailResult = MutableLiveData() + + fun getEquipmentList( + equipmentNo: String, + equipmentName: String, + mesureType: String, + managerState: String, + useDept: String, + assetType: String, + equipmentCategory: String, + isCalibrationTestEquipment: String, + isMeasureAccount: String, + isStandardSupportEquipment: String, + isFixedAssets: String, + validStartDate: String, + validEndDate: String, + abc: String, + ids: Array, + offset: Int + ) = launch({ + loadState.value = LoadState.Loading + val response = RetrofitServiceManager.getEquipmentList( + equipmentNo, + equipmentName, + mesureType, + managerState, + useDept, + assetType, + equipmentCategory, + isCalibrationTestEquipment, + isMeasureAccount, + isStandardSupportEquipment, + isFixedAssets, + validStartDate, + validEndDate, + abc, + ids, + offset + ) + val responseCode = response.separateResponseCode() + if (responseCode == 200) { + loadState.value = LoadState.Success + equipmentResult.value = gson.fromJson( + response, object : TypeToken() {}.type + ) + } else { + loadState.value = LoadState.Fail + response.toErrorMessage().show(BaseApplication.get()) + } + }, { + loadState.value = LoadState.Fail + it.printStackTrace() + }) + + fun getEquipmentDetail(id: String) = launch({ + loadState.value = LoadState.Loading + val response = RetrofitServiceManager.getEquipmentDetail(id) + val responseCode = response.separateResponseCode() + if (responseCode == 200) { + loadState.value = LoadState.Success + equipmentDetailResult.value = gson.fromJson( + response, object : TypeToken() {}.type + ) + } else { + loadState.value = LoadState.Fail + response.toErrorMessage().show(BaseApplication.get()) + } + }, { + loadState.value = LoadState.Fail + it.printStackTrace() + }) +} \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_sorting.xml b/app/src/main/res/drawable/ic_sorting.xml new file mode 100644 index 0000000..252bfe6 --- /dev/null +++ b/app/src/main/res/drawable/ic_sorting.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/layout/activity_equipment.xml b/app/src/main/res/layout/activity_equipment.xml new file mode 100644 index 0000000..d6a64b1 --- /dev/null +++ b/app/src/main/res/layout/activity_equipment.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_equipment_detail.xml b/app/src/main/res/layout/activity_equipment_detail.xml new file mode 100644 index 0000000..7254762 --- /dev/null +++ b/app/src/main/res/layout/activity_equipment_detail.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_basic_information.xml b/app/src/main/res/layout/fragment_basic_information.xml new file mode 100644 index 0000000..4a3c1c7 --- /dev/null +++ b/app/src/main/res/layout/fragment_basic_information.xml @@ -0,0 +1,390 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 3892b5a..02160cd 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -34,16 +34,18 @@ - - - - - - - + + + + + + + + + +) : RecyclerView.Adapter() { + + private var layoutInflater: LayoutInflater = LayoutInflater.from(context) + + override fun getItemCount(): Int = dataRows.size + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = ItemViewHolder( + layoutInflater.inflate(R.layout.item_equipment_rv_l, parent, false) + ) + + override fun onBindViewHolder(holder: ItemViewHolder, position: Int) { + //绑定数据 + val rowsBean = dataRows[position] + holder.equipmentNameView.text = rowsBean.equipmentName + holder.equipmentCodeView.text = rowsBean.equipmentNo + holder.equipmentDateView.text = rowsBean.enableDate + holder.equipmentLibView.text = rowsBean.useDeptName + + //绑定事件 + holder.itemView.setOnClickListener { + listener?.onItemClicked(position) + } + } + + inner class ItemViewHolder(view: View) : RecyclerView.ViewHolder(view) { + var equipmentNameView: TextView = view.findViewById(R.id.equipmentNameView) + var equipmentCodeView: TextView = view.findViewById(R.id.equipmentCodeView) + var equipmentDateView: TextView = view.findViewById(R.id.equipmentDateView) + var equipmentLibView: TextView = view.findViewById(R.id.equipmentLibView) + } + + private var listener: OnItemClickListener? = null + + interface OnItemClickListener { + fun onItemClicked(position: Int) + } + + fun setOnItemClickListener(onClickListener: OnItemClickListener?) { + this.listener = onClickListener + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt index b4628f3..d970b55 100644 --- a/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt +++ b/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt @@ -5,7 +5,8 @@ import com.casic.xz.meterage.R import com.casic.xz.meterage.adapter.HomeGridAdapter import com.casic.xz.meterage.utils.LocaleConstant -import com.casic.xz.meterage.view.NoticeListActivity +import com.casic.xz.meterage.view.home.EquipmentActivity +import com.casic.xz.meterage.view.notice.NoticeListActivity import com.casic.xz.meterage.vm.NoticeViewModel import com.pengxh.kt.lite.base.KotlinBaseFragment import com.pengxh.kt.lite.extensions.navigatePageTo @@ -36,8 +37,19 @@ homeFuncRecyclerView.adapter = homeAdapter homeAdapter.setOnGridItemClickListener(object : HomeGridAdapter.OnGridItemClickListener { override fun onItemClick(position: Int) { - when (position) { - + when (LocaleConstant.HOME_FUNC_OPERATE[position]) { + "仪器设备" -> requireContext().navigatePageTo() +// "标准装置" -> requireContext().navigatePageTo() +// "证书报告" -> requireContext().navigatePageTo() +// "委托需求" -> requireContext().navigatePageTo() +// "访客" -> requireContext().navigatePageTo() +// "标准规范" -> requireContext().navigatePageTo() +// "能力列表" -> requireContext().navigatePageTo() +// "计量培训" -> requireContext().navigatePageTo() +// "合同发票" -> requireContext().navigatePageTo() +// "业务统计" -> requireContext().navigatePageTo() +// "客户列表" -> requireContext().navigatePageTo() +// "外场检测" -> requireContext().navigatePageTo() } } }) diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt index 7e75abe..56dc5ec 100644 --- a/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt +++ b/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt @@ -2,9 +2,11 @@ import android.view.View import androidx.lifecycle.ViewModelProvider +import com.bumptech.glide.Glide +import com.bumptech.glide.request.RequestOptions import com.casic.xz.meterage.R import com.casic.xz.meterage.utils.LocaleConstant -import com.casic.xz.meterage.view.NoticeListActivity +import com.casic.xz.meterage.view.notice.NoticeListActivity import com.casic.xz.meterage.vm.NoticeViewModel import com.casic.xz.meterage.vm.UserViewModel import com.pengxh.kt.lite.base.KotlinBaseFragment @@ -23,6 +25,12 @@ val data = it.data userNameView.text = data.name userUnitView.text = data.deptName + +// Glide.with(requireContext()) +// .load(R.mipmap.default_avatar) +// .apply(RequestOptions.circleCropTransform()) +// .placeholder(R.mipmap.load_image_error) +// .into(userAvatarView) } }) diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt new file mode 100644 index 0000000..cf22646 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt @@ -0,0 +1,103 @@ +package com.casic.xz.meterage.fragment.equipment + +import android.graphics.Paint +import androidx.lifecycle.ViewModelProvider +import com.casic.xz.meterage.R +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.casic.xz.meterage.vm.EquipmentViewModel +import com.pengxh.kt.lite.base.KotlinBaseFragment +import com.pengxh.kt.lite.extensions.convertColor +import com.pengxh.kt.lite.vm.LoadState +import kotlinx.android.synthetic.main.fragment_basic_information.* + +class BasicInformationFragment(private val id: String) : KotlinBaseFragment() { + + private lateinit var equipmentViewModel: EquipmentViewModel + + override fun initData() { + equipmentViewModel = ViewModelProvider(this)[EquipmentViewModel::class.java] + equipmentViewModel.getEquipmentDetail(id) + equipmentViewModel.equipmentDetailResult.observe(this, { + if (it.code == 200) { + val data = it.data!! + + equipmentCodeView.text = data.equipmentNo + equipmentNameView.text = data.equipmentName + manufacturerView.text = data.manufacturer + factoryNumberView.text = data.manufacturingNo + modelView.text = data.modelNo + verificationMethodView.text = data.mesureTypeName + measuringRangeView.text = data.mesureRange + uncertaintyView.text = data.uncertainty + firstUseView.text = data.createTime + originalValueView.text = data.originValue + usageDeptView.text = data.useDeptName + userView.text = data.usePersonName + managementStatusView.text = data.managerStateName + verificationDeptView.text = data.useDeptName +// nextVerificationDeptView.text = data. + verificationPeriodView.text = data.mesureCycle + verificationDateView.text = data.mesureDate + effectiveDateView.text = data.validDate + verificationResultsView.text = data.mesureResultName + abcView.text = data.abcName + isNeedTechnicalView.text = if ( + data.isCalibrationTestEquipment.isNullOrBlank() || data.isCalibrationTestEquipment == "0" + ) { + "否" + } else { + "是" + } + + isStandingBook.text = if ( + data.isMeasureAccount.isNullOrBlank() || data.isMeasureAccount == "0" + ) { + "否" + } else { + "是" + } + + isStandardView.text = if ( + data.isStandardSupportEquipment.isNullOrBlank() || data.isStandardSupportEquipment == "0" + ) { + "否" + } else { + "是" + } + remarkView.text = data.remark + if (data.fileList.size == 0) { + instructionsView.text = "暂无" + } else { + instructionsView.text = "查看附件列表" + val textPaint = instructionsView.paint + textPaint.flags = Paint.UNDERLINE_TEXT_FLAG + textPaint.isAntiAlias = true + instructionsView.setTextColor(R.color.themeColor.convertColor(requireContext())) + + instructionsView.setOnClickListener { + + } + } + } + }) + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_basic_information + + override fun observeRequestState() { + equipmentViewModel.loadState.observe(this, { + when (it) { + LoadState.Loading -> LoadingDialogHub.show(requireActivity(), "数据加载中...") + else -> LoadingDialogHub.dismiss() + } + }) + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt new file mode 100644 index 0000000..0b4a747 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class CertificateFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_certificate + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt new file mode 100644 index 0000000..f05c491 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class ChangeRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_change_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt new file mode 100644 index 0000000..849ffa5 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class InspectionRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_inspection_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt new file mode 100644 index 0000000..aa4edd9 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class UsageRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_usage_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java b/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java new file mode 100644 index 0000000..0b9124e --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java @@ -0,0 +1,760 @@ +package com.casic.xz.meterage.model; + +import java.util.List; + +public class EquipmentDetailModel { + + private int code; + private DataModel data; + private String message; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataModel getData() { + return data; + } + + public void setData(DataModel data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public static class DataModel { + private String abc; + private String abcName; + private String assetNo; + private String assetSource; + private String assetType; + private String assetTypeName; + private String attribute; + private String capitalSource; + private String capitalSourceName; + private String cardEstablishmentDate; + private String createTime; + private String createUser; + private String depreciationMethod; + private String depreciationMethodName; + private String depreciationPeriod; + private String enableDate; + private String equipmentCategory; + private String equipmentCategoryName; + private String equipmentName; + private String equipmentNo; + private String equipmentSpecifications; + private String equipmentType; + private String equipmentTypeName; + private List fileList; + private String id; + private String installIncidentalExpenses; + private String installPlace; + private String intactState; + private String isCalibrationTestEquipment; + private int isDel; + private String isFixedAssets; + private String isMeasureAccount; + private String isStandardSupportEquipment; + private String labelBind; + private String majorCategory; + private String majorCategoryName; + private String managerLevel; + private String managerLevelName; + private String managerState; + private String managerStateName; + private String manufacturer; + private String manufacturerCountry; + private String manufacturingDate; + private String manufacturingNo; + private String mesureCycle; + private String mesureDate; + private String mesureDept; + private String mesureRange; + private String mesureResult; + private String mesureResultName; + private String mesureType; + private String mesureTypeName; + private String modelNo; + private String originValue; + private String overallDimension; + private String presentOriginValue; + private String purpose; + private String remark; + private String singlePrice; + private String supportStandardEquipmentName; + private String supportStandardEquipmentNo; + private String technicalLevel; + private String uncertainty; + private String updateTime; + private String useDept; + private String useDeptName; + private String usePerson; + private String usePersonName; + private String validDate; + private int version; + private String weight; + + public String getAbc() { + return abc; + } + + public void setAbc(String abc) { + this.abc = abc; + } + + public String getAbcName() { + return abcName; + } + + public void setAbcName(String abcName) { + this.abcName = abcName; + } + + public String getAssetNo() { + return assetNo; + } + + public void setAssetNo(String assetNo) { + this.assetNo = assetNo; + } + + public String getAssetSource() { + return assetSource; + } + + public void setAssetSource(String assetSource) { + this.assetSource = assetSource; + } + + public String getAssetType() { + return assetType; + } + + public void setAssetType(String assetType) { + this.assetType = assetType; + } + + public String getAssetTypeName() { + return assetTypeName; + } + + public void setAssetTypeName(String assetTypeName) { + this.assetTypeName = assetTypeName; + } + + public String getAttribute() { + return attribute; + } + + public void setAttribute(String attribute) { + this.attribute = attribute; + } + + public String getCapitalSource() { + return capitalSource; + } + + public void setCapitalSource(String capitalSource) { + this.capitalSource = capitalSource; + } + + public String getCapitalSourceName() { + return capitalSourceName; + } + + public void setCapitalSourceName(String capitalSourceName) { + this.capitalSourceName = capitalSourceName; + } + + public String getCardEstablishmentDate() { + return cardEstablishmentDate; + } + + public void setCardEstablishmentDate(String cardEstablishmentDate) { + this.cardEstablishmentDate = cardEstablishmentDate; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getDepreciationMethod() { + return depreciationMethod; + } + + public void setDepreciationMethod(String depreciationMethod) { + this.depreciationMethod = depreciationMethod; + } + + public String getDepreciationMethodName() { + return depreciationMethodName; + } + + public void setDepreciationMethodName(String depreciationMethodName) { + this.depreciationMethodName = depreciationMethodName; + } + + public String getDepreciationPeriod() { + return depreciationPeriod; + } + + public void setDepreciationPeriod(String depreciationPeriod) { + this.depreciationPeriod = depreciationPeriod; + } + + public String getEnableDate() { + return enableDate; + } + + public void setEnableDate(String enableDate) { + this.enableDate = enableDate; + } + + public String getEquipmentCategory() { + return equipmentCategory; + } + + public void setEquipmentCategory(String equipmentCategory) { + this.equipmentCategory = equipmentCategory; + } + + public String getEquipmentCategoryName() { + return equipmentCategoryName; + } + + public void setEquipmentCategoryName(String equipmentCategoryName) { + this.equipmentCategoryName = equipmentCategoryName; + } + + public String getEquipmentName() { + return equipmentName; + } + + public void setEquipmentName(String equipmentName) { + this.equipmentName = equipmentName; + } + + public String getEquipmentNo() { + return equipmentNo; + } + + public void setEquipmentNo(String equipmentNo) { + this.equipmentNo = equipmentNo; + } + + public String getEquipmentSpecifications() { + return equipmentSpecifications; + } + + public void setEquipmentSpecifications(String equipmentSpecifications) { + this.equipmentSpecifications = equipmentSpecifications; + } + + public String getEquipmentType() { + return equipmentType; + } + + public void setEquipmentType(String equipmentType) { + this.equipmentType = equipmentType; + } + + public String getEquipmentTypeName() { + return equipmentTypeName; + } + + public void setEquipmentTypeName(String equipmentTypeName) { + this.equipmentTypeName = equipmentTypeName; + } + + public List getFileList() { + return fileList; + } + + public void setFileList(List fileList) { + this.fileList = fileList; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getInstallIncidentalExpenses() { + return installIncidentalExpenses; + } + + public void setInstallIncidentalExpenses(String installIncidentalExpenses) { + this.installIncidentalExpenses = installIncidentalExpenses; + } + + public String getInstallPlace() { + return installPlace; + } + + public void setInstallPlace(String installPlace) { + this.installPlace = installPlace; + } + + public String getIntactState() { + return intactState; + } + + public void setIntactState(String intactState) { + this.intactState = intactState; + } + + public String getIsCalibrationTestEquipment() { + return isCalibrationTestEquipment; + } + + public void setIsCalibrationTestEquipment(String isCalibrationTestEquipment) { + this.isCalibrationTestEquipment = isCalibrationTestEquipment; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getIsFixedAssets() { + return isFixedAssets; + } + + public void setIsFixedAssets(String isFixedAssets) { + this.isFixedAssets = isFixedAssets; + } + + public String getIsMeasureAccount() { + return isMeasureAccount; + } + + public void setIsMeasureAccount(String isMeasureAccount) { + this.isMeasureAccount = isMeasureAccount; + } + + public String getIsStandardSupportEquipment() { + return isStandardSupportEquipment; + } + + public void setIsStandardSupportEquipment(String isStandardSupportEquipment) { + this.isStandardSupportEquipment = isStandardSupportEquipment; + } + + public String getLabelBind() { + return labelBind; + } + + public void setLabelBind(String labelBind) { + this.labelBind = labelBind; + } + + public String getMajorCategory() { + return majorCategory; + } + + public void setMajorCategory(String majorCategory) { + this.majorCategory = majorCategory; + } + + public String getMajorCategoryName() { + return majorCategoryName; + } + + public void setMajorCategoryName(String majorCategoryName) { + this.majorCategoryName = majorCategoryName; + } + + public String getManagerLevel() { + return managerLevel; + } + + public void setManagerLevel(String managerLevel) { + this.managerLevel = managerLevel; + } + + public String getManagerLevelName() { + return managerLevelName; + } + + public void setManagerLevelName(String managerLevelName) { + this.managerLevelName = managerLevelName; + } + + public String getManagerState() { + return managerState; + } + + public void setManagerState(String managerState) { + this.managerState = managerState; + } + + public String getManagerStateName() { + return managerStateName; + } + + public void setManagerStateName(String managerStateName) { + this.managerStateName = managerStateName; + } + + public String getManufacturer() { + return manufacturer; + } + + public void setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + } + + public String getManufacturerCountry() { + return manufacturerCountry; + } + + public void setManufacturerCountry(String manufacturerCountry) { + this.manufacturerCountry = manufacturerCountry; + } + + public String getManufacturingDate() { + return manufacturingDate; + } + + public void setManufacturingDate(String manufacturingDate) { + this.manufacturingDate = manufacturingDate; + } + + public String getManufacturingNo() { + return manufacturingNo; + } + + public void setManufacturingNo(String manufacturingNo) { + this.manufacturingNo = manufacturingNo; + } + + public String getMesureCycle() { + return mesureCycle; + } + + public void setMesureCycle(String mesureCycle) { + this.mesureCycle = mesureCycle; + } + + public String getMesureDate() { + return mesureDate; + } + + public void setMesureDate(String mesureDate) { + this.mesureDate = mesureDate; + } + + public String getMesureDept() { + return mesureDept; + } + + public void setMesureDept(String mesureDept) { + this.mesureDept = mesureDept; + } + + public String getMesureRange() { + return mesureRange; + } + + public void setMesureRange(String mesureRange) { + this.mesureRange = mesureRange; + } + + public String getMesureResult() { + return mesureResult; + } + + public void setMesureResult(String mesureResult) { + this.mesureResult = mesureResult; + } + + public String getMesureResultName() { + return mesureResultName; + } + + public void setMesureResultName(String mesureResultName) { + this.mesureResultName = mesureResultName; + } + + public String getMesureType() { + return mesureType; + } + + public void setMesureType(String mesureType) { + this.mesureType = mesureType; + } + + public String getMesureTypeName() { + return mesureTypeName; + } + + public void setMesureTypeName(String mesureTypeName) { + this.mesureTypeName = mesureTypeName; + } + + public String getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getOriginValue() { + return originValue; + } + + public void setOriginValue(String originValue) { + this.originValue = originValue; + } + + public String getOverallDimension() { + return overallDimension; + } + + public void setOverallDimension(String overallDimension) { + this.overallDimension = overallDimension; + } + + public String getPresentOriginValue() { + return presentOriginValue; + } + + public void setPresentOriginValue(String presentOriginValue) { + this.presentOriginValue = presentOriginValue; + } + + public String getPurpose() { + return purpose; + } + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getSinglePrice() { + return singlePrice; + } + + public void setSinglePrice(String singlePrice) { + this.singlePrice = singlePrice; + } + + public String getSupportStandardEquipmentName() { + return supportStandardEquipmentName; + } + + public void setSupportStandardEquipmentName(String supportStandardEquipmentName) { + this.supportStandardEquipmentName = supportStandardEquipmentName; + } + + public String getSupportStandardEquipmentNo() { + return supportStandardEquipmentNo; + } + + public void setSupportStandardEquipmentNo(String supportStandardEquipmentNo) { + this.supportStandardEquipmentNo = supportStandardEquipmentNo; + } + + public String getTechnicalLevel() { + return technicalLevel; + } + + public void setTechnicalLevel(String technicalLevel) { + this.technicalLevel = technicalLevel; + } + + public String getUncertainty() { + return uncertainty; + } + + public void setUncertainty(String uncertainty) { + this.uncertainty = uncertainty; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getUseDept() { + return useDept; + } + + public void setUseDept(String useDept) { + this.useDept = useDept; + } + + public String getUseDeptName() { + return useDeptName; + } + + public void setUseDeptName(String useDeptName) { + this.useDeptName = useDeptName; + } + + public String getUsePerson() { + return usePerson; + } + + public void setUsePerson(String usePerson) { + this.usePerson = usePerson; + } + + public String getUsePersonName() { + return usePersonName; + } + + public void setUsePersonName(String usePersonName) { + this.usePersonName = usePersonName; + } + + public String getValidDate() { + return validDate; + } + + public void setValidDate(String validDate) { + this.validDate = validDate; + } + + public int getVersion() { + return version; + } + + public void setVersion(int version) { + this.version = version; + } + + public String getWeight() { + return weight; + } + + public void setWeight(String weight) { + this.weight = weight; + } + + public static class FileListModel { + private String assetId; + private String createTime; + private String createUser; + private String fileName; + private String id; + private int isDel; + private String minioFileName; + private String remark; + private String updateTime; + + public String getAssetId() { + return assetId; + } + + public void setAssetId(String assetId) { + this.assetId = assetId; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getFileName() { + return fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getMinioFileName() { + return minioFileName; + } + + public void setMinioFileName(String minioFileName) { + this.minioFileName = minioFileName; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + } + } +} diff --git a/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java b/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java new file mode 100644 index 0000000..15fc128 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java @@ -0,0 +1,697 @@ +package com.casic.xz.meterage.model; + +import java.util.List; + +public class EquipmentListModel { + + private int code; + private DataModel data; + private String message; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataModel getData() { + return data; + } + + public void setData(DataModel data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public static class DataModel { + private List rows; + private int total; + + public List getRows() { + return rows; + } + + public void setRows(List rows) { + this.rows = rows; + } + + public int getTotal() { + return total; + } + + public void setTotal(int total) { + this.total = total; + } + + public static class RowsModel { + private String abc; + private String abcName; + private String assetNo; + private String assetSource; + private String assetType; + private String assetTypeName; + private String attribute; + private String capitalSource; + private String capitalSourceName; + private String cardEstablishmentDate; + private String createTime; + private String createUser; + private String depreciationMethod; + private String depreciationMethodName; + private String depreciationPeriod; + private String enableDate; + private String equipmentCategory; + private String equipmentCategoryName; + private String equipmentName; + private String equipmentNo; + private String equipmentSpecifications; + private String equipmentType; + private String equipmentTypeName; + private String fileList; + private String id; + private String installIncidentalExpenses; + private String installPlace; + private String intactState; + private String isCalibrationTestEquipment; + private int isDel; + private String isFixedAssets; + private String isMeasureAccount; + private String isStandardSupportEquipment; + private String labelBind; + private String majorCategory; + private String majorCategoryName; + private String managerLevel; + private String managerLevelName; + private String managerState; + private String managerStateName; + private String manufacturer; + private String manufacturerCountry; + private String manufacturingDate; + private String manufacturingNo; + private String mesureCycle; + private String mesureDate; + private String mesureDept; + private String mesureRange; + private String mesureResult; + private String mesureResultName; + private String mesureType; + private String mesureTypeName; + private String modelNo; + private String originValue; + private String overallDimension; + private String presentOriginValue; + private String purpose; + private String remark; + private String singlePrice; + private String supportStandardEquipmentName; + private String supportStandardEquipmentNo; + private String technicalLevel; + private String uncertainty; + private String updateTime; + private String useDept; + private String useDeptName; + private String usePerson; + private String usePersonName; + private String validDate; + private int version; + private String weight; + + public String getAbc() { + return abc; + } + + public void setAbc(String abc) { + this.abc = abc; + } + + public String getAbcName() { + return abcName; + } + + public void setAbcName(String abcName) { + this.abcName = abcName; + } + + public String getAssetNo() { + return assetNo; + } + + public void setAssetNo(String assetNo) { + this.assetNo = assetNo; + } + + public String getAssetSource() { + return assetSource; + } + + public void setAssetSource(String assetSource) { + this.assetSource = assetSource; + } + + public String getAssetType() { + return assetType; + } + + public void setAssetType(String assetType) { + this.assetType = assetType; + } + + public String getAssetTypeName() { + return assetTypeName; + } + + public void setAssetTypeName(String assetTypeName) { + this.assetTypeName = assetTypeName; + } + + public String getAttribute() { + return attribute; + } + + public void setAttribute(String attribute) { + this.attribute = attribute; + } + + public String getCapitalSource() { + return capitalSource; + } + + public void setCapitalSource(String capitalSource) { + this.capitalSource = capitalSource; + } + + public String getCapitalSourceName() { + return capitalSourceName; + } + + public void setCapitalSourceName(String capitalSourceName) { + this.capitalSourceName = capitalSourceName; + } + + public String getCardEstablishmentDate() { + return cardEstablishmentDate; + } + + public void setCardEstablishmentDate(String cardEstablishmentDate) { + this.cardEstablishmentDate = cardEstablishmentDate; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getDepreciationMethod() { + return depreciationMethod; + } + + public void setDepreciationMethod(String depreciationMethod) { + this.depreciationMethod = depreciationMethod; + } + + public String getDepreciationMethodName() { + return depreciationMethodName; + } + + public void setDepreciationMethodName(String depreciationMethodName) { + this.depreciationMethodName = depreciationMethodName; + } + + public String getDepreciationPeriod() { + return depreciationPeriod; + } + + public void setDepreciationPeriod(String depreciationPeriod) { + this.depreciationPeriod = depreciationPeriod; + } + + public String getEnableDate() { + return enableDate; + } + + public void setEnableDate(String enableDate) { + this.enableDate = enableDate; + } + + public String getEquipmentCategory() { + return equipmentCategory; + } + + public void setEquipmentCategory(String equipmentCategory) { + this.equipmentCategory = equipmentCategory; + } + + public String getEquipmentCategoryName() { + return equipmentCategoryName; + } + + public void setEquipmentCategoryName(String equipmentCategoryName) { + this.equipmentCategoryName = equipmentCategoryName; + } + + public String getEquipmentName() { + return equipmentName; + } + + public void setEquipmentName(String equipmentName) { + this.equipmentName = equipmentName; + } + + public String getEquipmentNo() { + return equipmentNo; + } + + public void setEquipmentNo(String equipmentNo) { + this.equipmentNo = equipmentNo; + } + + public String getEquipmentSpecifications() { + return equipmentSpecifications; + } + + public void setEquipmentSpecifications(String equipmentSpecifications) { + this.equipmentSpecifications = equipmentSpecifications; + } + + public String getEquipmentType() { + return equipmentType; + } + + public void setEquipmentType(String equipmentType) { + this.equipmentType = equipmentType; + } + + public String getEquipmentTypeName() { + return equipmentTypeName; + } + + public void setEquipmentTypeName(String equipmentTypeName) { + this.equipmentTypeName = equipmentTypeName; + } + + public String getFileList() { + return fileList; + } + + public void setFileList(String fileList) { + this.fileList = fileList; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getInstallIncidentalExpenses() { + return installIncidentalExpenses; + } + + public void setInstallIncidentalExpenses(String installIncidentalExpenses) { + this.installIncidentalExpenses = installIncidentalExpenses; + } + + public String getInstallPlace() { + return installPlace; + } + + public void setInstallPlace(String installPlace) { + this.installPlace = installPlace; + } + + public String getIntactState() { + return intactState; + } + + public void setIntactState(String intactState) { + this.intactState = intactState; + } + + public String getIsCalibrationTestEquipment() { + return isCalibrationTestEquipment; + } + + public void setIsCalibrationTestEquipment(String isCalibrationTestEquipment) { + this.isCalibrationTestEquipment = isCalibrationTestEquipment; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getIsFixedAssets() { + return isFixedAssets; + } + + public void setIsFixedAssets(String isFixedAssets) { + this.isFixedAssets = isFixedAssets; + } + + public String getIsMeasureAccount() { + return isMeasureAccount; + } + + public void setIsMeasureAccount(String isMeasureAccount) { + this.isMeasureAccount = isMeasureAccount; + } + + public String getIsStandardSupportEquipment() { + return isStandardSupportEquipment; + } + + public void setIsStandardSupportEquipment(String isStandardSupportEquipment) { + this.isStandardSupportEquipment = isStandardSupportEquipment; + } + + public String getLabelBind() { + return labelBind; + } + + public void setLabelBind(String labelBind) { + this.labelBind = labelBind; + } + + public String getMajorCategory() { + return majorCategory; + } + + public void setMajorCategory(String majorCategory) { + this.majorCategory = majorCategory; + } + + public String getMajorCategoryName() { + return majorCategoryName; + } + + public void setMajorCategoryName(String majorCategoryName) { + this.majorCategoryName = majorCategoryName; + } + + public String getManagerLevel() { + return managerLevel; + } + + public void setManagerLevel(String managerLevel) { + this.managerLevel = managerLevel; + } + + public String getManagerLevelName() { + return managerLevelName; + } + + public void setManagerLevelName(String managerLevelName) { + this.managerLevelName = managerLevelName; + } + + public String getManagerState() { + return managerState; + } + + public void setManagerState(String managerState) { + this.managerState = managerState; + } + + public String getManagerStateName() { + return managerStateName; + } + + public void setManagerStateName(String managerStateName) { + this.managerStateName = managerStateName; + } + + public String getManufacturer() { + return manufacturer; + } + + public void setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + } + + public String getManufacturerCountry() { + return manufacturerCountry; + } + + public void setManufacturerCountry(String manufacturerCountry) { + this.manufacturerCountry = manufacturerCountry; + } + + public String getManufacturingDate() { + return manufacturingDate; + } + + public void setManufacturingDate(String manufacturingDate) { + this.manufacturingDate = manufacturingDate; + } + + public String getManufacturingNo() { + return manufacturingNo; + } + + public void setManufacturingNo(String manufacturingNo) { + this.manufacturingNo = manufacturingNo; + } + + public String getMesureCycle() { + return mesureCycle; + } + + public void setMesureCycle(String mesureCycle) { + this.mesureCycle = mesureCycle; + } + + public String getMesureDate() { + return mesureDate; + } + + public void setMesureDate(String mesureDate) { + this.mesureDate = mesureDate; + } + + public String getMesureDept() { + return mesureDept; + } + + public void setMesureDept(String mesureDept) { + this.mesureDept = mesureDept; + } + + public String getMesureRange() { + return mesureRange; + } + + public void setMesureRange(String mesureRange) { + this.mesureRange = mesureRange; + } + + public String getMesureResult() { + return mesureResult; + } + + public void setMesureResult(String mesureResult) { + this.mesureResult = mesureResult; + } + + public String getMesureResultName() { + return mesureResultName; + } + + public void setMesureResultName(String mesureResultName) { + this.mesureResultName = mesureResultName; + } + + public String getMesureType() { + return mesureType; + } + + public void setMesureType(String mesureType) { + this.mesureType = mesureType; + } + + public String getMesureTypeName() { + return mesureTypeName; + } + + public void setMesureTypeName(String mesureTypeName) { + this.mesureTypeName = mesureTypeName; + } + + public String getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getOriginValue() { + return originValue; + } + + public void setOriginValue(String originValue) { + this.originValue = originValue; + } + + public String getOverallDimension() { + return overallDimension; + } + + public void setOverallDimension(String overallDimension) { + this.overallDimension = overallDimension; + } + + public String getPresentOriginValue() { + return presentOriginValue; + } + + public void setPresentOriginValue(String presentOriginValue) { + this.presentOriginValue = presentOriginValue; + } + + public String getPurpose() { + return purpose; + } + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getSinglePrice() { + return singlePrice; + } + + public void setSinglePrice(String singlePrice) { + this.singlePrice = singlePrice; + } + + public String getSupportStandardEquipmentName() { + return supportStandardEquipmentName; + } + + public void setSupportStandardEquipmentName(String supportStandardEquipmentName) { + this.supportStandardEquipmentName = supportStandardEquipmentName; + } + + public String getSupportStandardEquipmentNo() { + return supportStandardEquipmentNo; + } + + public void setSupportStandardEquipmentNo(String supportStandardEquipmentNo) { + this.supportStandardEquipmentNo = supportStandardEquipmentNo; + } + + public String getTechnicalLevel() { + return technicalLevel; + } + + public void setTechnicalLevel(String technicalLevel) { + this.technicalLevel = technicalLevel; + } + + public String getUncertainty() { + return uncertainty; + } + + public void setUncertainty(String uncertainty) { + this.uncertainty = uncertainty; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getUseDept() { + return useDept; + } + + public void setUseDept(String useDept) { + this.useDept = useDept; + } + + public String getUseDeptName() { + return useDeptName; + } + + public void setUseDeptName(String useDeptName) { + this.useDeptName = useDeptName; + } + + public String getUsePerson() { + return usePerson; + } + + public void setUsePerson(String usePerson) { + this.usePerson = usePerson; + } + + public String getUsePersonName() { + return usePersonName; + } + + public void setUsePersonName(String usePersonName) { + this.usePersonName = usePersonName; + } + + public String getValidDate() { + return validDate; + } + + public void setValidDate(String validDate) { + this.validDate = validDate; + } + + public int getVersion() { + return version; + } + + public void setVersion(int version) { + this.version = version; + } + + public String getWeight() { + return weight; + } + + public void setWeight(String weight) { + this.weight = weight; + } + } + } +} diff --git a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt index a3f514f..46e5eef 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt @@ -35,4 +35,24 @@ @QueryMap limit: Map, @QueryMap offset: Map ): String + + /** + * 获取设备列表 + */ + @POST("/meter/assets/listPage") + suspend fun getEquipmentList( + @Header("token") token: String, + @Body requestBody: RequestBody, + @QueryMap limit: Map, + @QueryMap offset: Map + ): String + + /** + * 获取设备详情 + */ + @POST("/meter/assets/detail") + suspend fun getEquipmentDetail( + @Header("token") token: String, + @Body requestBody: RequestBody + ): String } \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt index 444a872..386a1d8 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt @@ -6,8 +6,10 @@ import com.pengxh.kt.lite.utils.SaveKeyValues import okhttp3.MediaType.Companion.toMediaType import okhttp3.RequestBody.Companion.toRequestBody +import org.json.JSONArray import org.json.JSONObject + object RetrofitServiceManager { private val api by lazy { @@ -73,4 +75,71 @@ offsetMap["offset"] = offset return api.getNoticeList(AuthenticationHelper.token!!, requestBody, limitMap, offsetMap) } + + /** + * 获取设备列表 + */ + suspend fun getEquipmentList( + equipmentNo: String, + equipmentName: String, + mesureType: String, + managerState: String, + useDept: String, + assetType: String, + equipmentCategory: String, + isCalibrationTestEquipment: String, + isMeasureAccount: String, + isStandardSupportEquipment: String, + isFixedAssets: String, + validStartDate: String, + validEndDate: String, + abc: String, + ids: Array, + offset: Int + ): String { + val paramObject = JSONObject() + paramObject.put("equipmentNo", equipmentNo) + paramObject.put("equipmentName", equipmentName) + paramObject.put("mesureType", mesureType) + paramObject.put("managerState", managerState) + paramObject.put("useDept", useDept) + paramObject.put("assetType", assetType) + paramObject.put("equipmentCategory", equipmentCategory) + paramObject.put("isCalibrationTestEquipment", isCalibrationTestEquipment) + paramObject.put("isMeasureAccount", isMeasureAccount) + paramObject.put("isStandardSupportEquipment", isStandardSupportEquipment) + paramObject.put("isFixedAssets", isFixedAssets) + paramObject.put("validStartDate", validStartDate) + paramObject.put("validEndDate", validEndDate) + paramObject.put("abc", abc) + + val jsonArray = JSONArray() + ids.forEach { + jsonArray.put(it) + } + paramObject.put("ids", jsonArray) + + val requestBody = paramObject.toString().toRequestBody( + "application/json;charset=UTF-8".toMediaType() + ) + + val limitMap = HashMap() + limitMap["limit"] = LocaleConstant.PAGE_LIMIT + + val offsetMap = HashMap() + offsetMap["offset"] = offset + return api.getEquipmentList(AuthenticationHelper.token!!, requestBody, limitMap, offsetMap) + } + + /** + * 获取设备详情 + */ + suspend fun getEquipmentDetail(id: String): String { + val paramObject = JSONObject() + paramObject.put("id", id) + val requestBody = paramObject.toString().toRequestBody( + "application/json;charset=UTF-8".toMediaType() + ) + return api.getEquipmentDetail(AuthenticationHelper.token!!, requestBody) + } } \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt deleted file mode 100644 index a5bb60b..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt +++ /dev/null @@ -1,104 +0,0 @@ -package com.casic.xz.meterage.view - -import android.annotation.SuppressLint -import android.graphics.Paint -import androidx.lifecycle.ViewModelProvider -import com.casic.xz.meterage.R -import com.casic.xz.meterage.extensions.combineImagePath -import com.casic.xz.meterage.extensions.formatTextFromHtml -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.vm.NoticeViewModel -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.extensions.convertColor -import com.pengxh.kt.lite.extensions.navigatePageTo -import com.pengxh.kt.lite.extensions.obtainScreenWidth -import com.pengxh.kt.lite.extensions.show -import com.pengxh.kt.lite.utils.Constant -import kotlinx.android.synthetic.main.activity_notice_detail.* -import kotlinx.android.synthetic.main.include_base_title.* -import java.util.* - -@SuppressLint("SetTextI18n") -class NoticeDetailActivity : KotlinBaseActivity() { - - private lateinit var noticeViewModel: NoticeViewModel - - override fun initData() { - leftBackView.setOnClickListener { finish() } - titleView.text = "通知公告" - - val args = intent.getStringArrayListExtra(Constant.INTENT_PARAM)!! - - noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] - noticeViewModel.getNoticeList(args[0], args[1], args[2], "", "", 1) - noticeViewModel.noticeResult.observe(this, { - if (it.code == 200) { - val dataRow = it.data?.rows!![0] - - noticeDateView.text = dataRow.noticeTime - noticePublisherView.text = "发布人 ${dataRow.noticePublisher}" - noticeCompanyView.text = "发布单位 ${dataRow.noticeCompany}" - - noticeNoView.text = dataRow.noticeNo - noticeTitleView.text = dataRow.noticeTitle - noticeSketchView.text = dataRow.noticeSketch - - dataRow.noticeContent.formatTextFromHtml( - this, noticeContentView, obtainScreenWidth() - ) - - if (dataRow.minioFileName.isNullOrBlank()) { - minioFileView.text = "暂无附件" - } else { - val minioFileName = dataRow.minioFileName - - minioFileView.text = minioFileName - val textPaint = minioFileView.paint - textPaint.flags = Paint.UNDERLINE_TEXT_FLAG - textPaint.isAntiAlias = true - minioFileView.setTextColor(R.color.themeColor.convertColor(this)) - - minioFileView.setOnClickListener { - //查看附件 - if (minioFileName.endsWith("pdf")) { - navigatePageTo(minioFileName) - } else if ( - minioFileName.endsWith("doc") || - minioFileName.endsWith("docx") - ) { - navigatePageTo(minioFileName) - } else if (minioFileName.endsWith("txt")) { - navigatePageTo(minioFileName) - } else if ( - minioFileName.endsWith("png") || - minioFileName.endsWith("jpeg") || - minioFileName.endsWith("jpg") - ) { - val urls = ArrayList() - urls.add(minioFileName.combineImagePath()) - navigatePageTo(0, urls) - } else { - "文件类型未知,无法打开附件".show(this) - } - } - } - } - }) - } - - override fun initEvent() { - - } - - override fun initLayoutView(): Int = R.layout.activity_notice_detail - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/NoticeListActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/NoticeListActivity.kt deleted file mode 100644 index 15f6a16..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/NoticeListActivity.kt +++ /dev/null @@ -1,180 +0,0 @@ -package com.casic.xz.meterage.view - -import android.os.Handler -import android.util.Log -import android.view.View -import androidx.lifecycle.ViewModelProvider -import com.casic.xz.meterage.R -import com.casic.xz.meterage.adapter.NoticeListAdapter -import com.casic.xz.meterage.extensions.addAll -import com.casic.xz.meterage.extensions.combineFilePath -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.extensions.showEmptyPage -import com.casic.xz.meterage.model.NoticeListModel -import com.casic.xz.meterage.vm.NoticeViewModel -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.extensions.navigatePageTo -import com.pengxh.kt.lite.extensions.show -import com.pengxh.kt.lite.utils.WeakReferenceHandler -import com.pengxh.kt.lite.widget.dialog.AlertControlDialog -import kotlinx.android.synthetic.main.activity_notice_list.* -import kotlinx.android.synthetic.main.include_empty_view.* - -class NoticeListActivity : KotlinBaseActivity() { - - private lateinit var weakReferenceHandler: WeakReferenceHandler - private lateinit var noticeViewModel: NoticeViewModel - private lateinit var noticeListAdapter: NoticeListAdapter - private var dataBeans: MutableList = ArrayList() - private var pageIndex = 1 - private var isRefresh = false - private var isLoadMore = false - - override fun initData() { - weakReferenceHandler = WeakReferenceHandler(callback) - noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] - noticeViewModel.noticeResult.observe(this, { - if (it.code == 200) { - val dataRows = it.data?.rows!! -// countBadeNumber(dataRows) - when { - isRefresh -> { - dataBeans.clear() - dataBeans = dataRows - noticeLayout.finishRefresh() - isRefresh = false - } - isLoadMore -> { - if (dataRows.size == 0) { - "到底了,别拉了".show(this) - } - dataBeans.addAll(dataRows) - noticeLayout.finishLoadMore() - isLoadMore = false - } - else -> { - dataBeans = dataRows - } - } - weakReferenceHandler.sendEmptyMessage(2023013101) - } - }) - } - - override fun initEvent() { - leftBackView.setOnClickListener { finish() } - rightOperateView.setOnClickListener { - AlertControlDialog.Builder() - .setContext(this) - .setTitle("提示") - .setMessage("确定将所有未读消息标为已读?") - .setNegativeButton("取消") - .setPositiveButton("确定") - .setOnDialogButtonClickListener(object : - AlertControlDialog.OnDialogButtonClickListener { - override fun onCancelClick() { - - } - - override fun onConfirmClick() { - //TODO 设置为已读 - } - }).build().show() - } - - if (hasNoticePermission()) { - openSystemNoticeLayout.visibility = View.GONE - openSystemNoticeLayout.visibility = View.GONE - } else { - openSystemNoticeLayout.setOnClickListener { - - } - - - closeLayoutView.setOnClickListener { - openSystemNoticeLayout.visibility = View.GONE - } - } - - noticeLayout.setOnRefreshListener { - isRefresh = true - //刷新之后页码重置 - pageIndex = 1 - getNoticeListByPage() - } - - noticeLayout.setOnLoadMoreListener { - isLoadMore = true - pageIndex++ - getNoticeListByPage() - } - } - - override fun onResume() { - super.onResume() - pageIndex = 1 - getNoticeListByPage() - } - - private fun getNoticeListByPage() { - noticeViewModel.getNoticeList("", "", "", "", "", pageIndex) - } - - private val callback = Handler.Callback { - when (it.what) { - 2023013101 -> { - if (isRefresh || isLoadMore) { - noticeListAdapter.notifyDataSetChanged() - } else { - if (dataBeans.size == 0) { - emptyView!!.showEmptyPage("没有任何消息") { - pageIndex = 1 - getNoticeListByPage() - } - } else { - emptyView!!.hide() - noticeListAdapter = NoticeListAdapter(this, dataBeans) - noticeRecyclerView.adapter = noticeListAdapter - noticeListAdapter.setOnItemClickListener(object : - NoticeListAdapter.OnItemClickListener { - override fun onItemClicked(position: Int) { - val rowsModel = dataBeans[position] - val allArgs = addAll( - rowsModel.noticeNo, - rowsModel.noticeTitle, - rowsModel.noticePublisher, - "", - "" - ) - Log.d( - "Casic", - "NoticeListActivity => onItemClicked: ${rowsModel.minioFileName.combineFilePath()}" - ) - navigatePageTo(allArgs) - } - }) - } - } - } - } - true - } - - //TODO 判断是否开启通知权限 - private fun hasNoticePermission(): Boolean { - - return false - } - - override fun initLayoutView(): Int = R.layout.activity_notice_list - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/PreviewDocumentActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/PreviewDocumentActivity.kt deleted file mode 100644 index e233ddc..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/PreviewDocumentActivity.kt +++ /dev/null @@ -1,24 +0,0 @@ -package com.casic.xz.meterage.view - -import com.casic.xz.meterage.R -import com.pengxh.kt.lite.base.KotlinBaseActivity - -class PreviewDocumentActivity : KotlinBaseActivity() { - override fun initData() { - - } - - override fun initEvent() { - - } - - override fun initLayoutView(): Int = R.layout.activity_preview_doc - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/PreviewPdfActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/PreviewPdfActivity.kt deleted file mode 100644 index 39f8ac2..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/PreviewPdfActivity.kt +++ /dev/null @@ -1,62 +0,0 @@ -package com.casic.xz.meterage.view - -import com.casic.xz.meterage.R -import com.casic.xz.meterage.extensions.combineFilePath -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.utils.LoadingDialogHub -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.callback.OnDownloadListener -import com.pengxh.kt.lite.extensions.createDownloadFileDir -import com.pengxh.kt.lite.extensions.downloadFile -import com.pengxh.kt.lite.utils.Constant -import kotlinx.android.synthetic.main.activity_preview_pdf.* -import kotlinx.android.synthetic.main.include_base_title.* -import java.io.File -import java.io.FileInputStream - - -class PreviewPdfActivity : KotlinBaseActivity() { - - override fun initData() { - val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! - titleView.text = minioFileName - - val url = minioFileName.combineFilePath() - url.downloadFile(createDownloadFileDir().toString(), - object : OnDownloadListener { - override fun onDownloadStart(totalBytes: Long) { - runOnUiThread { - LoadingDialogHub.show(this@PreviewPdfActivity, "附件加载中") - } - } - - override fun onProgressChanged(currentBytes: Long) { - - } - - override fun onDownloadEnd(file: File?) { - runOnUiThread { - LoadingDialogHub.dismiss() - } - val inputStream = FileInputStream(file) - pdfView.fromStream(inputStream).load() - } - }) - } - - override fun initEvent() { - leftBackView.setOnClickListener { finish() } - } - - override fun initLayoutView(): Int = R.layout.activity_preview_pdf - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/PreviewTextActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/PreviewTextActivity.kt deleted file mode 100644 index d634ca3..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/PreviewTextActivity.kt +++ /dev/null @@ -1,60 +0,0 @@ -package com.casic.xz.meterage.view - -import com.casic.xz.meterage.R -import com.casic.xz.meterage.extensions.combineFilePath -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.utils.LoadingDialogHub -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.callback.OnDownloadListener -import com.pengxh.kt.lite.extensions.createDownloadFileDir -import com.pengxh.kt.lite.extensions.downloadFile -import com.pengxh.kt.lite.extensions.read -import com.pengxh.kt.lite.utils.Constant -import kotlinx.android.synthetic.main.activity_preview_txt.* -import kotlinx.android.synthetic.main.include_base_title.* -import java.io.File - -class PreviewTextActivity : KotlinBaseActivity() { - - override fun initData() { - val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! - titleView.text = minioFileName - - val url = minioFileName.combineFilePath() - url.downloadFile(createDownloadFileDir().toString(), - object : OnDownloadListener { - override fun onDownloadStart(totalBytes: Long) { - runOnUiThread { - LoadingDialogHub.show(this@PreviewTextActivity, "附件加载中") - } - } - - override fun onProgressChanged(currentBytes: Long) { - - } - - override fun onDownloadEnd(file: File?) { - runOnUiThread { - LoadingDialogHub.dismiss() - textView.text = file?.read() - } - } - }) - } - - override fun initEvent() { - leftBackView.setOnClickListener { finish() } - } - - override fun initLayoutView(): Int = R.layout.activity_preview_txt - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentActivity.kt new file mode 100644 index 0000000..35ca098 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentActivity.kt @@ -0,0 +1,158 @@ +package com.casic.xz.meterage.view.home + +import android.os.Handler +import androidx.lifecycle.ViewModelProvider +import androidx.recyclerview.widget.DividerItemDecoration +import com.casic.xz.meterage.R +import com.casic.xz.meterage.adapter.EquipmentListAdapter +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.extensions.showEmptyPage +import com.casic.xz.meterage.model.EquipmentListModel +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.casic.xz.meterage.vm.EquipmentViewModel +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.extensions.navigatePageTo +import com.pengxh.kt.lite.extensions.show +import com.pengxh.kt.lite.utils.WeakReferenceHandler +import com.pengxh.kt.lite.vm.LoadState +import kotlinx.android.synthetic.main.activity_equipment.* +import kotlinx.android.synthetic.main.include_empty_view.* +import kotlinx.android.synthetic.main.include_search_title.* + +class EquipmentActivity : KotlinBaseActivity() { + + private lateinit var weakReferenceHandler: WeakReferenceHandler + private lateinit var equipmentViewModel: EquipmentViewModel + private lateinit var equipmentListAdapter: EquipmentListAdapter + private var dataBeans: MutableList = ArrayList() + private var pageIndex = 1 + private var isRefresh = false + private var isLoadMore = false + + override fun initData() { + weakReferenceHandler = WeakReferenceHandler(callback) + equipmentViewModel = ViewModelProvider(this)[EquipmentViewModel::class.java] + equipmentViewModel.equipmentResult.observe(this, { + if (it.code == 200) { + val dataRows = it.data?.rows!! + when { + isRefresh -> { + dataBeans.clear() + dataBeans = dataRows + equipmentLayout.finishRefresh() + isRefresh = false + } + isLoadMore -> { + if (dataRows.size == 0) { + "到底了,别拉了".show(this) + } + dataBeans.addAll(dataRows) + equipmentLayout.finishLoadMore() + isLoadMore = false + } + else -> { + dataBeans = dataRows + } + } + weakReferenceHandler.sendEmptyMessage(2023020801) + } + }) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + rightOperateView.setOnClickListener { + + } + + equipmentLayout.setOnRefreshListener { + isRefresh = true + //刷新之后页码重置 + pageIndex = 1 + getEquipmentListByPage() + } + + equipmentLayout.setOnLoadMoreListener { + isLoadMore = true + pageIndex++ + getEquipmentListByPage() + } + } + + override fun initLayoutView(): Int = R.layout.activity_equipment + + override fun observeRequestState() { + equipmentViewModel.loadState.observe(this, { + when (it) { + LoadState.Loading -> LoadingDialogHub.show(this, "数据加载中...") + else -> LoadingDialogHub.dismiss() + } + }) + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + titleView.text = "仪器设备" + } + + override fun onResume() { + super.onResume() + pageIndex = 1 + getEquipmentListByPage() + } + + private fun getEquipmentListByPage() { + equipmentViewModel.getEquipmentList( + "", + "", + "", + "", + "", + "1", + "", + "", + "", + "", + "", + "", + "", + "", + arrayOf(), + pageIndex + ) + } + + private val callback = Handler.Callback { + when (it.what) { + 2023020801 -> { + if (isRefresh || isLoadMore) { + equipmentListAdapter.notifyDataSetChanged() + } else { + if (dataBeans.size == 0) { + emptyView!!.showEmptyPage("无设备") { + pageIndex = 1 + getEquipmentListByPage() + } + } else { + emptyView!!.hide() + equipmentListAdapter = EquipmentListAdapter(this, dataBeans) + equipmentRecyclerView.addItemDecoration( + DividerItemDecoration(this, DividerItemDecoration.VERTICAL) + ) + equipmentRecyclerView.adapter = equipmentListAdapter + equipmentListAdapter.setOnItemClickListener(object : + EquipmentListAdapter.OnItemClickListener { + override fun onItemClicked(position: Int) { + val rowsModel = dataBeans[position] + navigatePageTo(rowsModel.id) + } + }) + } + } + } + } + true + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentDetailActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentDetailActivity.kt new file mode 100644 index 0000000..7dee13c --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentDetailActivity.kt @@ -0,0 +1,53 @@ +package com.casic.xz.meterage.view.home + +import androidx.fragment.app.Fragment +import com.casic.xz.meterage.R +import com.casic.xz.meterage.adapter.SubViewPagerAdapter +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.fragment.equipment.* +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.utils.Constant +import kotlinx.android.synthetic.main.activity_equipment.rootView +import kotlinx.android.synthetic.main.activity_equipment_detail.* +import kotlinx.android.synthetic.main.include_base_title.* + +class EquipmentDetailActivity : KotlinBaseActivity() { + + private var fragmentPages: ArrayList = ArrayList() + + override fun initData() { + val equipmentId = intent.getStringExtra(Constant.INTENT_PARAM)!! + + fragmentPages.add(BasicInformationFragment(equipmentId)) + fragmentPages.add(InspectionRecordFragment()) + fragmentPages.add(ChangeRecordFragment()) + fragmentPages.add(UsageRecordFragment()) + fragmentPages.add(CertificateFragment()) + + val equipmentPageTitles = arrayOf("基础信息", "周检记录", "状态变更记录", "使用记录", "检定证书") + + equipmentViewPager.adapter = SubViewPagerAdapter( + supportFragmentManager, fragmentPages, equipmentPageTitles + ) + equipmentViewPager.offscreenPageLimit = fragmentPages.size + //绑定 + topTabLayout.setupWithViewPager(equipmentViewPager) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + } + + override fun initLayoutView(): Int = R.layout.activity_equipment_detail + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + titleView.text = "仪器设备" + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeDetailActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeDetailActivity.kt new file mode 100644 index 0000000..6fe0022 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeDetailActivity.kt @@ -0,0 +1,105 @@ +package com.casic.xz.meterage.view.notice + +import android.annotation.SuppressLint +import android.graphics.Paint +import androidx.lifecycle.ViewModelProvider +import com.casic.xz.meterage.R +import com.casic.xz.meterage.extensions.combineImagePath +import com.casic.xz.meterage.extensions.formatTextFromHtml +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.view.BigImageActivity +import com.casic.xz.meterage.vm.NoticeViewModel +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.extensions.convertColor +import com.pengxh.kt.lite.extensions.navigatePageTo +import com.pengxh.kt.lite.extensions.obtainScreenWidth +import com.pengxh.kt.lite.extensions.show +import com.pengxh.kt.lite.utils.Constant +import kotlinx.android.synthetic.main.activity_notice_detail.* +import kotlinx.android.synthetic.main.include_base_title.* +import java.util.* + +@SuppressLint("SetTextI18n") +class NoticeDetailActivity : KotlinBaseActivity() { + + private lateinit var noticeViewModel: NoticeViewModel + + override fun initData() { + leftBackView.setOnClickListener { finish() } + titleView.text = "通知公告" + + val args = intent.getStringArrayListExtra(Constant.INTENT_PARAM)!! + + noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] + noticeViewModel.getNoticeList(args[0], args[1], args[2], "", "", 1) + noticeViewModel.noticeResult.observe(this, { + if (it.code == 200) { + val dataRow = it.data?.rows!![0] + + noticeDateView.text = dataRow.noticeTime + noticePublisherView.text = "发布人 ${dataRow.noticePublisher}" + noticeCompanyView.text = "发布单位 ${dataRow.noticeCompany}" + + noticeNoView.text = dataRow.noticeNo + noticeTitleView.text = dataRow.noticeTitle + noticeSketchView.text = dataRow.noticeSketch + + dataRow.noticeContent.formatTextFromHtml( + this, noticeContentView, obtainScreenWidth() + ) + + if (dataRow.minioFileName.isNullOrBlank()) { + minioFileView.text = "暂无附件" + } else { + val minioFileName = dataRow.minioFileName + + minioFileView.text = minioFileName + val textPaint = minioFileView.paint + textPaint.flags = Paint.UNDERLINE_TEXT_FLAG + textPaint.isAntiAlias = true + minioFileView.setTextColor(R.color.themeColor.convertColor(this)) + + minioFileView.setOnClickListener { + //查看附件 + if (minioFileName.endsWith("pdf")) { + navigatePageTo(minioFileName) + } else if ( + minioFileName.endsWith("doc") || + minioFileName.endsWith("docx") + ) { + navigatePageTo(minioFileName) + } else if (minioFileName.endsWith("txt")) { + navigatePageTo(minioFileName) + } else if ( + minioFileName.endsWith("png") || + minioFileName.endsWith("jpeg") || + minioFileName.endsWith("jpg") + ) { + val urls = ArrayList() + urls.add(minioFileName.combineImagePath()) + navigatePageTo(0, urls) + } else { + "文件类型未知,无法打开附件".show(this) + } + } + } + } + }) + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.activity_notice_detail + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeListActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeListActivity.kt new file mode 100644 index 0000000..31c0490 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeListActivity.kt @@ -0,0 +1,180 @@ +package com.casic.xz.meterage.view.notice + +import android.os.Handler +import android.util.Log +import android.view.View +import androidx.lifecycle.ViewModelProvider +import com.casic.xz.meterage.R +import com.casic.xz.meterage.adapter.NoticeListAdapter +import com.casic.xz.meterage.extensions.addAll +import com.casic.xz.meterage.extensions.combineFilePath +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.extensions.showEmptyPage +import com.casic.xz.meterage.model.NoticeListModel +import com.casic.xz.meterage.vm.NoticeViewModel +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.extensions.navigatePageTo +import com.pengxh.kt.lite.extensions.show +import com.pengxh.kt.lite.utils.WeakReferenceHandler +import com.pengxh.kt.lite.widget.dialog.AlertControlDialog +import kotlinx.android.synthetic.main.activity_notice_list.* +import kotlinx.android.synthetic.main.include_empty_view.* + +class NoticeListActivity : KotlinBaseActivity() { + + private lateinit var weakReferenceHandler: WeakReferenceHandler + private lateinit var noticeViewModel: NoticeViewModel + private lateinit var noticeListAdapter: NoticeListAdapter + private var dataBeans: MutableList = ArrayList() + private var pageIndex = 1 + private var isRefresh = false + private var isLoadMore = false + + override fun initData() { + weakReferenceHandler = WeakReferenceHandler(callback) + noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] + noticeViewModel.noticeResult.observe(this, { + if (it.code == 200) { + val dataRows = it.data?.rows!! +// countBadeNumber(dataRows) + when { + isRefresh -> { + dataBeans.clear() + dataBeans = dataRows + noticeLayout.finishRefresh() + isRefresh = false + } + isLoadMore -> { + if (dataRows.size == 0) { + "到底了,别拉了".show(this) + } + dataBeans.addAll(dataRows) + noticeLayout.finishLoadMore() + isLoadMore = false + } + else -> { + dataBeans = dataRows + } + } + weakReferenceHandler.sendEmptyMessage(2023013101) + } + }) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + rightOperateView.setOnClickListener { + AlertControlDialog.Builder() + .setContext(this) + .setTitle("提示") + .setMessage("确定将所有未读消息标为已读?") + .setNegativeButton("取消") + .setPositiveButton("确定") + .setOnDialogButtonClickListener(object : + AlertControlDialog.OnDialogButtonClickListener { + override fun onCancelClick() { + + } + + override fun onConfirmClick() { + //TODO 设置为已读 + } + }).build().show() + } + + if (hasNoticePermission()) { + openSystemNoticeLayout.visibility = View.GONE + openSystemNoticeLayout.visibility = View.GONE + } else { + openSystemNoticeLayout.setOnClickListener { + + } + + + closeLayoutView.setOnClickListener { + openSystemNoticeLayout.visibility = View.GONE + } + } + + noticeLayout.setOnRefreshListener { + isRefresh = true + //刷新之后页码重置 + pageIndex = 1 + getNoticeListByPage() + } + + noticeLayout.setOnLoadMoreListener { + isLoadMore = true + pageIndex++ + getNoticeListByPage() + } + } + + override fun onResume() { + super.onResume() + pageIndex = 1 + getNoticeListByPage() + } + + private fun getNoticeListByPage() { + noticeViewModel.getNoticeList("", "", "", "", "", pageIndex) + } + + private val callback = Handler.Callback { + when (it.what) { + 2023013101 -> { + if (isRefresh || isLoadMore) { + noticeListAdapter.notifyDataSetChanged() + } else { + if (dataBeans.size == 0) { + emptyView!!.showEmptyPage("没有任何消息") { + pageIndex = 1 + getNoticeListByPage() + } + } else { + emptyView!!.hide() + noticeListAdapter = NoticeListAdapter(this, dataBeans) + noticeRecyclerView.adapter = noticeListAdapter + noticeListAdapter.setOnItemClickListener(object : + NoticeListAdapter.OnItemClickListener { + override fun onItemClicked(position: Int) { + val rowsModel = dataBeans[position] + val allArgs = addAll( + rowsModel.noticeNo, + rowsModel.noticeTitle, + rowsModel.noticePublisher, + "", + "" + ) + Log.d( + "Casic", + "NoticeListActivity => onItemClicked: ${rowsModel.minioFileName.combineFilePath()}" + ) + navigatePageTo(allArgs) + } + }) + } + } + } + } + true + } + + //TODO 判断是否开启通知权限 + private fun hasNoticePermission(): Boolean { + + return false + } + + override fun initLayoutView(): Int = R.layout.activity_notice_list + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewDocumentActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewDocumentActivity.kt new file mode 100644 index 0000000..4b16ae8 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewDocumentActivity.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.view.notice + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseActivity + +class PreviewDocumentActivity : KotlinBaseActivity() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.activity_preview_doc + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewPdfActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewPdfActivity.kt new file mode 100644 index 0000000..fad73b6 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewPdfActivity.kt @@ -0,0 +1,62 @@ +package com.casic.xz.meterage.view.notice + +import com.casic.xz.meterage.R +import com.casic.xz.meterage.extensions.combineFilePath +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.callback.OnDownloadListener +import com.pengxh.kt.lite.extensions.createDownloadFileDir +import com.pengxh.kt.lite.extensions.downloadFile +import com.pengxh.kt.lite.utils.Constant +import kotlinx.android.synthetic.main.activity_preview_pdf.* +import kotlinx.android.synthetic.main.include_base_title.* +import java.io.File +import java.io.FileInputStream + + +class PreviewPdfActivity : KotlinBaseActivity() { + + override fun initData() { + val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! + titleView.text = minioFileName + + val url = minioFileName.combineFilePath() + url.downloadFile(createDownloadFileDir().toString(), + object : OnDownloadListener { + override fun onDownloadStart(totalBytes: Long) { + runOnUiThread { + LoadingDialogHub.show(this@PreviewPdfActivity, "附件加载中") + } + } + + override fun onProgressChanged(currentBytes: Long) { + + } + + override fun onDownloadEnd(file: File?) { + runOnUiThread { + LoadingDialogHub.dismiss() + } + val inputStream = FileInputStream(file) + pdfView.fromStream(inputStream).load() + } + }) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + } + + override fun initLayoutView(): Int = R.layout.activity_preview_pdf + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewTextActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewTextActivity.kt new file mode 100644 index 0000000..d7850fb --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewTextActivity.kt @@ -0,0 +1,60 @@ +package com.casic.xz.meterage.view.notice + +import com.casic.xz.meterage.R +import com.casic.xz.meterage.extensions.combineFilePath +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.callback.OnDownloadListener +import com.pengxh.kt.lite.extensions.createDownloadFileDir +import com.pengxh.kt.lite.extensions.downloadFile +import com.pengxh.kt.lite.extensions.read +import com.pengxh.kt.lite.utils.Constant +import kotlinx.android.synthetic.main.activity_preview_txt.* +import kotlinx.android.synthetic.main.include_base_title.* +import java.io.File + +class PreviewTextActivity : KotlinBaseActivity() { + + override fun initData() { + val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! + titleView.text = minioFileName + + val url = minioFileName.combineFilePath() + url.downloadFile(createDownloadFileDir().toString(), + object : OnDownloadListener { + override fun onDownloadStart(totalBytes: Long) { + runOnUiThread { + LoadingDialogHub.show(this@PreviewTextActivity, "附件加载中") + } + } + + override fun onProgressChanged(currentBytes: Long) { + + } + + override fun onDownloadEnd(file: File?) { + runOnUiThread { + LoadingDialogHub.dismiss() + textView.text = file?.read() + } + } + }) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + } + + override fun initLayoutView(): Int = R.layout.activity_preview_txt + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/vm/EquipmentViewModel.kt b/app/src/main/java/com/casic/xz/meterage/vm/EquipmentViewModel.kt new file mode 100644 index 0000000..b5f21f6 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/vm/EquipmentViewModel.kt @@ -0,0 +1,92 @@ +package com.casic.xz.meterage.vm + +import androidx.lifecycle.MutableLiveData +import com.casic.xz.meterage.base.BaseApplication +import com.casic.xz.meterage.extensions.separateResponseCode +import com.casic.xz.meterage.extensions.toErrorMessage +import com.casic.xz.meterage.model.EquipmentDetailModel +import com.casic.xz.meterage.model.EquipmentListModel +import com.casic.xz.meterage.utils.retrofit.RetrofitServiceManager +import com.google.gson.Gson +import com.google.gson.reflect.TypeToken +import com.pengxh.kt.lite.extensions.launch +import com.pengxh.kt.lite.extensions.show +import com.pengxh.kt.lite.vm.BaseViewModel +import com.pengxh.kt.lite.vm.LoadState + +class EquipmentViewModel : BaseViewModel() { + + private val gson by lazy { Gson() } + val equipmentResult = MutableLiveData() + val equipmentDetailResult = MutableLiveData() + + fun getEquipmentList( + equipmentNo: String, + equipmentName: String, + mesureType: String, + managerState: String, + useDept: String, + assetType: String, + equipmentCategory: String, + isCalibrationTestEquipment: String, + isMeasureAccount: String, + isStandardSupportEquipment: String, + isFixedAssets: String, + validStartDate: String, + validEndDate: String, + abc: String, + ids: Array, + offset: Int + ) = launch({ + loadState.value = LoadState.Loading + val response = RetrofitServiceManager.getEquipmentList( + equipmentNo, + equipmentName, + mesureType, + managerState, + useDept, + assetType, + equipmentCategory, + isCalibrationTestEquipment, + isMeasureAccount, + isStandardSupportEquipment, + isFixedAssets, + validStartDate, + validEndDate, + abc, + ids, + offset + ) + val responseCode = response.separateResponseCode() + if (responseCode == 200) { + loadState.value = LoadState.Success + equipmentResult.value = gson.fromJson( + response, object : TypeToken() {}.type + ) + } else { + loadState.value = LoadState.Fail + response.toErrorMessage().show(BaseApplication.get()) + } + }, { + loadState.value = LoadState.Fail + it.printStackTrace() + }) + + fun getEquipmentDetail(id: String) = launch({ + loadState.value = LoadState.Loading + val response = RetrofitServiceManager.getEquipmentDetail(id) + val responseCode = response.separateResponseCode() + if (responseCode == 200) { + loadState.value = LoadState.Success + equipmentDetailResult.value = gson.fromJson( + response, object : TypeToken() {}.type + ) + } else { + loadState.value = LoadState.Fail + response.toErrorMessage().show(BaseApplication.get()) + } + }, { + loadState.value = LoadState.Fail + it.printStackTrace() + }) +} \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_sorting.xml b/app/src/main/res/drawable/ic_sorting.xml new file mode 100644 index 0000000..252bfe6 --- /dev/null +++ b/app/src/main/res/drawable/ic_sorting.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/layout/activity_equipment.xml b/app/src/main/res/layout/activity_equipment.xml new file mode 100644 index 0000000..d6a64b1 --- /dev/null +++ b/app/src/main/res/layout/activity_equipment.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_equipment_detail.xml b/app/src/main/res/layout/activity_equipment_detail.xml new file mode 100644 index 0000000..7254762 --- /dev/null +++ b/app/src/main/res/layout/activity_equipment_detail.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_basic_information.xml b/app/src/main/res/layout/fragment_basic_information.xml new file mode 100644 index 0000000..4a3c1c7 --- /dev/null +++ b/app/src/main/res/layout/fragment_basic_information.xml @@ -0,0 +1,390 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_certificate.xml b/app/src/main/res/layout/fragment_certificate.xml new file mode 100644 index 0000000..77d9ef6 --- /dev/null +++ b/app/src/main/res/layout/fragment_certificate.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 3892b5a..02160cd 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -34,16 +34,18 @@ - - - - - - - + + + + + + + + + +) : RecyclerView.Adapter() { + + private var layoutInflater: LayoutInflater = LayoutInflater.from(context) + + override fun getItemCount(): Int = dataRows.size + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = ItemViewHolder( + layoutInflater.inflate(R.layout.item_equipment_rv_l, parent, false) + ) + + override fun onBindViewHolder(holder: ItemViewHolder, position: Int) { + //绑定数据 + val rowsBean = dataRows[position] + holder.equipmentNameView.text = rowsBean.equipmentName + holder.equipmentCodeView.text = rowsBean.equipmentNo + holder.equipmentDateView.text = rowsBean.enableDate + holder.equipmentLibView.text = rowsBean.useDeptName + + //绑定事件 + holder.itemView.setOnClickListener { + listener?.onItemClicked(position) + } + } + + inner class ItemViewHolder(view: View) : RecyclerView.ViewHolder(view) { + var equipmentNameView: TextView = view.findViewById(R.id.equipmentNameView) + var equipmentCodeView: TextView = view.findViewById(R.id.equipmentCodeView) + var equipmentDateView: TextView = view.findViewById(R.id.equipmentDateView) + var equipmentLibView: TextView = view.findViewById(R.id.equipmentLibView) + } + + private var listener: OnItemClickListener? = null + + interface OnItemClickListener { + fun onItemClicked(position: Int) + } + + fun setOnItemClickListener(onClickListener: OnItemClickListener?) { + this.listener = onClickListener + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt index b4628f3..d970b55 100644 --- a/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt +++ b/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt @@ -5,7 +5,8 @@ import com.casic.xz.meterage.R import com.casic.xz.meterage.adapter.HomeGridAdapter import com.casic.xz.meterage.utils.LocaleConstant -import com.casic.xz.meterage.view.NoticeListActivity +import com.casic.xz.meterage.view.home.EquipmentActivity +import com.casic.xz.meterage.view.notice.NoticeListActivity import com.casic.xz.meterage.vm.NoticeViewModel import com.pengxh.kt.lite.base.KotlinBaseFragment import com.pengxh.kt.lite.extensions.navigatePageTo @@ -36,8 +37,19 @@ homeFuncRecyclerView.adapter = homeAdapter homeAdapter.setOnGridItemClickListener(object : HomeGridAdapter.OnGridItemClickListener { override fun onItemClick(position: Int) { - when (position) { - + when (LocaleConstant.HOME_FUNC_OPERATE[position]) { + "仪器设备" -> requireContext().navigatePageTo() +// "标准装置" -> requireContext().navigatePageTo() +// "证书报告" -> requireContext().navigatePageTo() +// "委托需求" -> requireContext().navigatePageTo() +// "访客" -> requireContext().navigatePageTo() +// "标准规范" -> requireContext().navigatePageTo() +// "能力列表" -> requireContext().navigatePageTo() +// "计量培训" -> requireContext().navigatePageTo() +// "合同发票" -> requireContext().navigatePageTo() +// "业务统计" -> requireContext().navigatePageTo() +// "客户列表" -> requireContext().navigatePageTo() +// "外场检测" -> requireContext().navigatePageTo() } } }) diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt index 7e75abe..56dc5ec 100644 --- a/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt +++ b/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt @@ -2,9 +2,11 @@ import android.view.View import androidx.lifecycle.ViewModelProvider +import com.bumptech.glide.Glide +import com.bumptech.glide.request.RequestOptions import com.casic.xz.meterage.R import com.casic.xz.meterage.utils.LocaleConstant -import com.casic.xz.meterage.view.NoticeListActivity +import com.casic.xz.meterage.view.notice.NoticeListActivity import com.casic.xz.meterage.vm.NoticeViewModel import com.casic.xz.meterage.vm.UserViewModel import com.pengxh.kt.lite.base.KotlinBaseFragment @@ -23,6 +25,12 @@ val data = it.data userNameView.text = data.name userUnitView.text = data.deptName + +// Glide.with(requireContext()) +// .load(R.mipmap.default_avatar) +// .apply(RequestOptions.circleCropTransform()) +// .placeholder(R.mipmap.load_image_error) +// .into(userAvatarView) } }) diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt new file mode 100644 index 0000000..cf22646 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt @@ -0,0 +1,103 @@ +package com.casic.xz.meterage.fragment.equipment + +import android.graphics.Paint +import androidx.lifecycle.ViewModelProvider +import com.casic.xz.meterage.R +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.casic.xz.meterage.vm.EquipmentViewModel +import com.pengxh.kt.lite.base.KotlinBaseFragment +import com.pengxh.kt.lite.extensions.convertColor +import com.pengxh.kt.lite.vm.LoadState +import kotlinx.android.synthetic.main.fragment_basic_information.* + +class BasicInformationFragment(private val id: String) : KotlinBaseFragment() { + + private lateinit var equipmentViewModel: EquipmentViewModel + + override fun initData() { + equipmentViewModel = ViewModelProvider(this)[EquipmentViewModel::class.java] + equipmentViewModel.getEquipmentDetail(id) + equipmentViewModel.equipmentDetailResult.observe(this, { + if (it.code == 200) { + val data = it.data!! + + equipmentCodeView.text = data.equipmentNo + equipmentNameView.text = data.equipmentName + manufacturerView.text = data.manufacturer + factoryNumberView.text = data.manufacturingNo + modelView.text = data.modelNo + verificationMethodView.text = data.mesureTypeName + measuringRangeView.text = data.mesureRange + uncertaintyView.text = data.uncertainty + firstUseView.text = data.createTime + originalValueView.text = data.originValue + usageDeptView.text = data.useDeptName + userView.text = data.usePersonName + managementStatusView.text = data.managerStateName + verificationDeptView.text = data.useDeptName +// nextVerificationDeptView.text = data. + verificationPeriodView.text = data.mesureCycle + verificationDateView.text = data.mesureDate + effectiveDateView.text = data.validDate + verificationResultsView.text = data.mesureResultName + abcView.text = data.abcName + isNeedTechnicalView.text = if ( + data.isCalibrationTestEquipment.isNullOrBlank() || data.isCalibrationTestEquipment == "0" + ) { + "否" + } else { + "是" + } + + isStandingBook.text = if ( + data.isMeasureAccount.isNullOrBlank() || data.isMeasureAccount == "0" + ) { + "否" + } else { + "是" + } + + isStandardView.text = if ( + data.isStandardSupportEquipment.isNullOrBlank() || data.isStandardSupportEquipment == "0" + ) { + "否" + } else { + "是" + } + remarkView.text = data.remark + if (data.fileList.size == 0) { + instructionsView.text = "暂无" + } else { + instructionsView.text = "查看附件列表" + val textPaint = instructionsView.paint + textPaint.flags = Paint.UNDERLINE_TEXT_FLAG + textPaint.isAntiAlias = true + instructionsView.setTextColor(R.color.themeColor.convertColor(requireContext())) + + instructionsView.setOnClickListener { + + } + } + } + }) + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_basic_information + + override fun observeRequestState() { + equipmentViewModel.loadState.observe(this, { + when (it) { + LoadState.Loading -> LoadingDialogHub.show(requireActivity(), "数据加载中...") + else -> LoadingDialogHub.dismiss() + } + }) + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt new file mode 100644 index 0000000..0b4a747 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class CertificateFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_certificate + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt new file mode 100644 index 0000000..f05c491 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class ChangeRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_change_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt new file mode 100644 index 0000000..849ffa5 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class InspectionRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_inspection_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt new file mode 100644 index 0000000..aa4edd9 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class UsageRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_usage_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java b/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java new file mode 100644 index 0000000..0b9124e --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java @@ -0,0 +1,760 @@ +package com.casic.xz.meterage.model; + +import java.util.List; + +public class EquipmentDetailModel { + + private int code; + private DataModel data; + private String message; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataModel getData() { + return data; + } + + public void setData(DataModel data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public static class DataModel { + private String abc; + private String abcName; + private String assetNo; + private String assetSource; + private String assetType; + private String assetTypeName; + private String attribute; + private String capitalSource; + private String capitalSourceName; + private String cardEstablishmentDate; + private String createTime; + private String createUser; + private String depreciationMethod; + private String depreciationMethodName; + private String depreciationPeriod; + private String enableDate; + private String equipmentCategory; + private String equipmentCategoryName; + private String equipmentName; + private String equipmentNo; + private String equipmentSpecifications; + private String equipmentType; + private String equipmentTypeName; + private List fileList; + private String id; + private String installIncidentalExpenses; + private String installPlace; + private String intactState; + private String isCalibrationTestEquipment; + private int isDel; + private String isFixedAssets; + private String isMeasureAccount; + private String isStandardSupportEquipment; + private String labelBind; + private String majorCategory; + private String majorCategoryName; + private String managerLevel; + private String managerLevelName; + private String managerState; + private String managerStateName; + private String manufacturer; + private String manufacturerCountry; + private String manufacturingDate; + private String manufacturingNo; + private String mesureCycle; + private String mesureDate; + private String mesureDept; + private String mesureRange; + private String mesureResult; + private String mesureResultName; + private String mesureType; + private String mesureTypeName; + private String modelNo; + private String originValue; + private String overallDimension; + private String presentOriginValue; + private String purpose; + private String remark; + private String singlePrice; + private String supportStandardEquipmentName; + private String supportStandardEquipmentNo; + private String technicalLevel; + private String uncertainty; + private String updateTime; + private String useDept; + private String useDeptName; + private String usePerson; + private String usePersonName; + private String validDate; + private int version; + private String weight; + + public String getAbc() { + return abc; + } + + public void setAbc(String abc) { + this.abc = abc; + } + + public String getAbcName() { + return abcName; + } + + public void setAbcName(String abcName) { + this.abcName = abcName; + } + + public String getAssetNo() { + return assetNo; + } + + public void setAssetNo(String assetNo) { + this.assetNo = assetNo; + } + + public String getAssetSource() { + return assetSource; + } + + public void setAssetSource(String assetSource) { + this.assetSource = assetSource; + } + + public String getAssetType() { + return assetType; + } + + public void setAssetType(String assetType) { + this.assetType = assetType; + } + + public String getAssetTypeName() { + return assetTypeName; + } + + public void setAssetTypeName(String assetTypeName) { + this.assetTypeName = assetTypeName; + } + + public String getAttribute() { + return attribute; + } + + public void setAttribute(String attribute) { + this.attribute = attribute; + } + + public String getCapitalSource() { + return capitalSource; + } + + public void setCapitalSource(String capitalSource) { + this.capitalSource = capitalSource; + } + + public String getCapitalSourceName() { + return capitalSourceName; + } + + public void setCapitalSourceName(String capitalSourceName) { + this.capitalSourceName = capitalSourceName; + } + + public String getCardEstablishmentDate() { + return cardEstablishmentDate; + } + + public void setCardEstablishmentDate(String cardEstablishmentDate) { + this.cardEstablishmentDate = cardEstablishmentDate; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getDepreciationMethod() { + return depreciationMethod; + } + + public void setDepreciationMethod(String depreciationMethod) { + this.depreciationMethod = depreciationMethod; + } + + public String getDepreciationMethodName() { + return depreciationMethodName; + } + + public void setDepreciationMethodName(String depreciationMethodName) { + this.depreciationMethodName = depreciationMethodName; + } + + public String getDepreciationPeriod() { + return depreciationPeriod; + } + + public void setDepreciationPeriod(String depreciationPeriod) { + this.depreciationPeriod = depreciationPeriod; + } + + public String getEnableDate() { + return enableDate; + } + + public void setEnableDate(String enableDate) { + this.enableDate = enableDate; + } + + public String getEquipmentCategory() { + return equipmentCategory; + } + + public void setEquipmentCategory(String equipmentCategory) { + this.equipmentCategory = equipmentCategory; + } + + public String getEquipmentCategoryName() { + return equipmentCategoryName; + } + + public void setEquipmentCategoryName(String equipmentCategoryName) { + this.equipmentCategoryName = equipmentCategoryName; + } + + public String getEquipmentName() { + return equipmentName; + } + + public void setEquipmentName(String equipmentName) { + this.equipmentName = equipmentName; + } + + public String getEquipmentNo() { + return equipmentNo; + } + + public void setEquipmentNo(String equipmentNo) { + this.equipmentNo = equipmentNo; + } + + public String getEquipmentSpecifications() { + return equipmentSpecifications; + } + + public void setEquipmentSpecifications(String equipmentSpecifications) { + this.equipmentSpecifications = equipmentSpecifications; + } + + public String getEquipmentType() { + return equipmentType; + } + + public void setEquipmentType(String equipmentType) { + this.equipmentType = equipmentType; + } + + public String getEquipmentTypeName() { + return equipmentTypeName; + } + + public void setEquipmentTypeName(String equipmentTypeName) { + this.equipmentTypeName = equipmentTypeName; + } + + public List getFileList() { + return fileList; + } + + public void setFileList(List fileList) { + this.fileList = fileList; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getInstallIncidentalExpenses() { + return installIncidentalExpenses; + } + + public void setInstallIncidentalExpenses(String installIncidentalExpenses) { + this.installIncidentalExpenses = installIncidentalExpenses; + } + + public String getInstallPlace() { + return installPlace; + } + + public void setInstallPlace(String installPlace) { + this.installPlace = installPlace; + } + + public String getIntactState() { + return intactState; + } + + public void setIntactState(String intactState) { + this.intactState = intactState; + } + + public String getIsCalibrationTestEquipment() { + return isCalibrationTestEquipment; + } + + public void setIsCalibrationTestEquipment(String isCalibrationTestEquipment) { + this.isCalibrationTestEquipment = isCalibrationTestEquipment; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getIsFixedAssets() { + return isFixedAssets; + } + + public void setIsFixedAssets(String isFixedAssets) { + this.isFixedAssets = isFixedAssets; + } + + public String getIsMeasureAccount() { + return isMeasureAccount; + } + + public void setIsMeasureAccount(String isMeasureAccount) { + this.isMeasureAccount = isMeasureAccount; + } + + public String getIsStandardSupportEquipment() { + return isStandardSupportEquipment; + } + + public void setIsStandardSupportEquipment(String isStandardSupportEquipment) { + this.isStandardSupportEquipment = isStandardSupportEquipment; + } + + public String getLabelBind() { + return labelBind; + } + + public void setLabelBind(String labelBind) { + this.labelBind = labelBind; + } + + public String getMajorCategory() { + return majorCategory; + } + + public void setMajorCategory(String majorCategory) { + this.majorCategory = majorCategory; + } + + public String getMajorCategoryName() { + return majorCategoryName; + } + + public void setMajorCategoryName(String majorCategoryName) { + this.majorCategoryName = majorCategoryName; + } + + public String getManagerLevel() { + return managerLevel; + } + + public void setManagerLevel(String managerLevel) { + this.managerLevel = managerLevel; + } + + public String getManagerLevelName() { + return managerLevelName; + } + + public void setManagerLevelName(String managerLevelName) { + this.managerLevelName = managerLevelName; + } + + public String getManagerState() { + return managerState; + } + + public void setManagerState(String managerState) { + this.managerState = managerState; + } + + public String getManagerStateName() { + return managerStateName; + } + + public void setManagerStateName(String managerStateName) { + this.managerStateName = managerStateName; + } + + public String getManufacturer() { + return manufacturer; + } + + public void setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + } + + public String getManufacturerCountry() { + return manufacturerCountry; + } + + public void setManufacturerCountry(String manufacturerCountry) { + this.manufacturerCountry = manufacturerCountry; + } + + public String getManufacturingDate() { + return manufacturingDate; + } + + public void setManufacturingDate(String manufacturingDate) { + this.manufacturingDate = manufacturingDate; + } + + public String getManufacturingNo() { + return manufacturingNo; + } + + public void setManufacturingNo(String manufacturingNo) { + this.manufacturingNo = manufacturingNo; + } + + public String getMesureCycle() { + return mesureCycle; + } + + public void setMesureCycle(String mesureCycle) { + this.mesureCycle = mesureCycle; + } + + public String getMesureDate() { + return mesureDate; + } + + public void setMesureDate(String mesureDate) { + this.mesureDate = mesureDate; + } + + public String getMesureDept() { + return mesureDept; + } + + public void setMesureDept(String mesureDept) { + this.mesureDept = mesureDept; + } + + public String getMesureRange() { + return mesureRange; + } + + public void setMesureRange(String mesureRange) { + this.mesureRange = mesureRange; + } + + public String getMesureResult() { + return mesureResult; + } + + public void setMesureResult(String mesureResult) { + this.mesureResult = mesureResult; + } + + public String getMesureResultName() { + return mesureResultName; + } + + public void setMesureResultName(String mesureResultName) { + this.mesureResultName = mesureResultName; + } + + public String getMesureType() { + return mesureType; + } + + public void setMesureType(String mesureType) { + this.mesureType = mesureType; + } + + public String getMesureTypeName() { + return mesureTypeName; + } + + public void setMesureTypeName(String mesureTypeName) { + this.mesureTypeName = mesureTypeName; + } + + public String getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getOriginValue() { + return originValue; + } + + public void setOriginValue(String originValue) { + this.originValue = originValue; + } + + public String getOverallDimension() { + return overallDimension; + } + + public void setOverallDimension(String overallDimension) { + this.overallDimension = overallDimension; + } + + public String getPresentOriginValue() { + return presentOriginValue; + } + + public void setPresentOriginValue(String presentOriginValue) { + this.presentOriginValue = presentOriginValue; + } + + public String getPurpose() { + return purpose; + } + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getSinglePrice() { + return singlePrice; + } + + public void setSinglePrice(String singlePrice) { + this.singlePrice = singlePrice; + } + + public String getSupportStandardEquipmentName() { + return supportStandardEquipmentName; + } + + public void setSupportStandardEquipmentName(String supportStandardEquipmentName) { + this.supportStandardEquipmentName = supportStandardEquipmentName; + } + + public String getSupportStandardEquipmentNo() { + return supportStandardEquipmentNo; + } + + public void setSupportStandardEquipmentNo(String supportStandardEquipmentNo) { + this.supportStandardEquipmentNo = supportStandardEquipmentNo; + } + + public String getTechnicalLevel() { + return technicalLevel; + } + + public void setTechnicalLevel(String technicalLevel) { + this.technicalLevel = technicalLevel; + } + + public String getUncertainty() { + return uncertainty; + } + + public void setUncertainty(String uncertainty) { + this.uncertainty = uncertainty; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getUseDept() { + return useDept; + } + + public void setUseDept(String useDept) { + this.useDept = useDept; + } + + public String getUseDeptName() { + return useDeptName; + } + + public void setUseDeptName(String useDeptName) { + this.useDeptName = useDeptName; + } + + public String getUsePerson() { + return usePerson; + } + + public void setUsePerson(String usePerson) { + this.usePerson = usePerson; + } + + public String getUsePersonName() { + return usePersonName; + } + + public void setUsePersonName(String usePersonName) { + this.usePersonName = usePersonName; + } + + public String getValidDate() { + return validDate; + } + + public void setValidDate(String validDate) { + this.validDate = validDate; + } + + public int getVersion() { + return version; + } + + public void setVersion(int version) { + this.version = version; + } + + public String getWeight() { + return weight; + } + + public void setWeight(String weight) { + this.weight = weight; + } + + public static class FileListModel { + private String assetId; + private String createTime; + private String createUser; + private String fileName; + private String id; + private int isDel; + private String minioFileName; + private String remark; + private String updateTime; + + public String getAssetId() { + return assetId; + } + + public void setAssetId(String assetId) { + this.assetId = assetId; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getFileName() { + return fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getMinioFileName() { + return minioFileName; + } + + public void setMinioFileName(String minioFileName) { + this.minioFileName = minioFileName; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + } + } +} diff --git a/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java b/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java new file mode 100644 index 0000000..15fc128 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java @@ -0,0 +1,697 @@ +package com.casic.xz.meterage.model; + +import java.util.List; + +public class EquipmentListModel { + + private int code; + private DataModel data; + private String message; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataModel getData() { + return data; + } + + public void setData(DataModel data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public static class DataModel { + private List rows; + private int total; + + public List getRows() { + return rows; + } + + public void setRows(List rows) { + this.rows = rows; + } + + public int getTotal() { + return total; + } + + public void setTotal(int total) { + this.total = total; + } + + public static class RowsModel { + private String abc; + private String abcName; + private String assetNo; + private String assetSource; + private String assetType; + private String assetTypeName; + private String attribute; + private String capitalSource; + private String capitalSourceName; + private String cardEstablishmentDate; + private String createTime; + private String createUser; + private String depreciationMethod; + private String depreciationMethodName; + private String depreciationPeriod; + private String enableDate; + private String equipmentCategory; + private String equipmentCategoryName; + private String equipmentName; + private String equipmentNo; + private String equipmentSpecifications; + private String equipmentType; + private String equipmentTypeName; + private String fileList; + private String id; + private String installIncidentalExpenses; + private String installPlace; + private String intactState; + private String isCalibrationTestEquipment; + private int isDel; + private String isFixedAssets; + private String isMeasureAccount; + private String isStandardSupportEquipment; + private String labelBind; + private String majorCategory; + private String majorCategoryName; + private String managerLevel; + private String managerLevelName; + private String managerState; + private String managerStateName; + private String manufacturer; + private String manufacturerCountry; + private String manufacturingDate; + private String manufacturingNo; + private String mesureCycle; + private String mesureDate; + private String mesureDept; + private String mesureRange; + private String mesureResult; + private String mesureResultName; + private String mesureType; + private String mesureTypeName; + private String modelNo; + private String originValue; + private String overallDimension; + private String presentOriginValue; + private String purpose; + private String remark; + private String singlePrice; + private String supportStandardEquipmentName; + private String supportStandardEquipmentNo; + private String technicalLevel; + private String uncertainty; + private String updateTime; + private String useDept; + private String useDeptName; + private String usePerson; + private String usePersonName; + private String validDate; + private int version; + private String weight; + + public String getAbc() { + return abc; + } + + public void setAbc(String abc) { + this.abc = abc; + } + + public String getAbcName() { + return abcName; + } + + public void setAbcName(String abcName) { + this.abcName = abcName; + } + + public String getAssetNo() { + return assetNo; + } + + public void setAssetNo(String assetNo) { + this.assetNo = assetNo; + } + + public String getAssetSource() { + return assetSource; + } + + public void setAssetSource(String assetSource) { + this.assetSource = assetSource; + } + + public String getAssetType() { + return assetType; + } + + public void setAssetType(String assetType) { + this.assetType = assetType; + } + + public String getAssetTypeName() { + return assetTypeName; + } + + public void setAssetTypeName(String assetTypeName) { + this.assetTypeName = assetTypeName; + } + + public String getAttribute() { + return attribute; + } + + public void setAttribute(String attribute) { + this.attribute = attribute; + } + + public String getCapitalSource() { + return capitalSource; + } + + public void setCapitalSource(String capitalSource) { + this.capitalSource = capitalSource; + } + + public String getCapitalSourceName() { + return capitalSourceName; + } + + public void setCapitalSourceName(String capitalSourceName) { + this.capitalSourceName = capitalSourceName; + } + + public String getCardEstablishmentDate() { + return cardEstablishmentDate; + } + + public void setCardEstablishmentDate(String cardEstablishmentDate) { + this.cardEstablishmentDate = cardEstablishmentDate; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getDepreciationMethod() { + return depreciationMethod; + } + + public void setDepreciationMethod(String depreciationMethod) { + this.depreciationMethod = depreciationMethod; + } + + public String getDepreciationMethodName() { + return depreciationMethodName; + } + + public void setDepreciationMethodName(String depreciationMethodName) { + this.depreciationMethodName = depreciationMethodName; + } + + public String getDepreciationPeriod() { + return depreciationPeriod; + } + + public void setDepreciationPeriod(String depreciationPeriod) { + this.depreciationPeriod = depreciationPeriod; + } + + public String getEnableDate() { + return enableDate; + } + + public void setEnableDate(String enableDate) { + this.enableDate = enableDate; + } + + public String getEquipmentCategory() { + return equipmentCategory; + } + + public void setEquipmentCategory(String equipmentCategory) { + this.equipmentCategory = equipmentCategory; + } + + public String getEquipmentCategoryName() { + return equipmentCategoryName; + } + + public void setEquipmentCategoryName(String equipmentCategoryName) { + this.equipmentCategoryName = equipmentCategoryName; + } + + public String getEquipmentName() { + return equipmentName; + } + + public void setEquipmentName(String equipmentName) { + this.equipmentName = equipmentName; + } + + public String getEquipmentNo() { + return equipmentNo; + } + + public void setEquipmentNo(String equipmentNo) { + this.equipmentNo = equipmentNo; + } + + public String getEquipmentSpecifications() { + return equipmentSpecifications; + } + + public void setEquipmentSpecifications(String equipmentSpecifications) { + this.equipmentSpecifications = equipmentSpecifications; + } + + public String getEquipmentType() { + return equipmentType; + } + + public void setEquipmentType(String equipmentType) { + this.equipmentType = equipmentType; + } + + public String getEquipmentTypeName() { + return equipmentTypeName; + } + + public void setEquipmentTypeName(String equipmentTypeName) { + this.equipmentTypeName = equipmentTypeName; + } + + public String getFileList() { + return fileList; + } + + public void setFileList(String fileList) { + this.fileList = fileList; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getInstallIncidentalExpenses() { + return installIncidentalExpenses; + } + + public void setInstallIncidentalExpenses(String installIncidentalExpenses) { + this.installIncidentalExpenses = installIncidentalExpenses; + } + + public String getInstallPlace() { + return installPlace; + } + + public void setInstallPlace(String installPlace) { + this.installPlace = installPlace; + } + + public String getIntactState() { + return intactState; + } + + public void setIntactState(String intactState) { + this.intactState = intactState; + } + + public String getIsCalibrationTestEquipment() { + return isCalibrationTestEquipment; + } + + public void setIsCalibrationTestEquipment(String isCalibrationTestEquipment) { + this.isCalibrationTestEquipment = isCalibrationTestEquipment; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getIsFixedAssets() { + return isFixedAssets; + } + + public void setIsFixedAssets(String isFixedAssets) { + this.isFixedAssets = isFixedAssets; + } + + public String getIsMeasureAccount() { + return isMeasureAccount; + } + + public void setIsMeasureAccount(String isMeasureAccount) { + this.isMeasureAccount = isMeasureAccount; + } + + public String getIsStandardSupportEquipment() { + return isStandardSupportEquipment; + } + + public void setIsStandardSupportEquipment(String isStandardSupportEquipment) { + this.isStandardSupportEquipment = isStandardSupportEquipment; + } + + public String getLabelBind() { + return labelBind; + } + + public void setLabelBind(String labelBind) { + this.labelBind = labelBind; + } + + public String getMajorCategory() { + return majorCategory; + } + + public void setMajorCategory(String majorCategory) { + this.majorCategory = majorCategory; + } + + public String getMajorCategoryName() { + return majorCategoryName; + } + + public void setMajorCategoryName(String majorCategoryName) { + this.majorCategoryName = majorCategoryName; + } + + public String getManagerLevel() { + return managerLevel; + } + + public void setManagerLevel(String managerLevel) { + this.managerLevel = managerLevel; + } + + public String getManagerLevelName() { + return managerLevelName; + } + + public void setManagerLevelName(String managerLevelName) { + this.managerLevelName = managerLevelName; + } + + public String getManagerState() { + return managerState; + } + + public void setManagerState(String managerState) { + this.managerState = managerState; + } + + public String getManagerStateName() { + return managerStateName; + } + + public void setManagerStateName(String managerStateName) { + this.managerStateName = managerStateName; + } + + public String getManufacturer() { + return manufacturer; + } + + public void setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + } + + public String getManufacturerCountry() { + return manufacturerCountry; + } + + public void setManufacturerCountry(String manufacturerCountry) { + this.manufacturerCountry = manufacturerCountry; + } + + public String getManufacturingDate() { + return manufacturingDate; + } + + public void setManufacturingDate(String manufacturingDate) { + this.manufacturingDate = manufacturingDate; + } + + public String getManufacturingNo() { + return manufacturingNo; + } + + public void setManufacturingNo(String manufacturingNo) { + this.manufacturingNo = manufacturingNo; + } + + public String getMesureCycle() { + return mesureCycle; + } + + public void setMesureCycle(String mesureCycle) { + this.mesureCycle = mesureCycle; + } + + public String getMesureDate() { + return mesureDate; + } + + public void setMesureDate(String mesureDate) { + this.mesureDate = mesureDate; + } + + public String getMesureDept() { + return mesureDept; + } + + public void setMesureDept(String mesureDept) { + this.mesureDept = mesureDept; + } + + public String getMesureRange() { + return mesureRange; + } + + public void setMesureRange(String mesureRange) { + this.mesureRange = mesureRange; + } + + public String getMesureResult() { + return mesureResult; + } + + public void setMesureResult(String mesureResult) { + this.mesureResult = mesureResult; + } + + public String getMesureResultName() { + return mesureResultName; + } + + public void setMesureResultName(String mesureResultName) { + this.mesureResultName = mesureResultName; + } + + public String getMesureType() { + return mesureType; + } + + public void setMesureType(String mesureType) { + this.mesureType = mesureType; + } + + public String getMesureTypeName() { + return mesureTypeName; + } + + public void setMesureTypeName(String mesureTypeName) { + this.mesureTypeName = mesureTypeName; + } + + public String getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getOriginValue() { + return originValue; + } + + public void setOriginValue(String originValue) { + this.originValue = originValue; + } + + public String getOverallDimension() { + return overallDimension; + } + + public void setOverallDimension(String overallDimension) { + this.overallDimension = overallDimension; + } + + public String getPresentOriginValue() { + return presentOriginValue; + } + + public void setPresentOriginValue(String presentOriginValue) { + this.presentOriginValue = presentOriginValue; + } + + public String getPurpose() { + return purpose; + } + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getSinglePrice() { + return singlePrice; + } + + public void setSinglePrice(String singlePrice) { + this.singlePrice = singlePrice; + } + + public String getSupportStandardEquipmentName() { + return supportStandardEquipmentName; + } + + public void setSupportStandardEquipmentName(String supportStandardEquipmentName) { + this.supportStandardEquipmentName = supportStandardEquipmentName; + } + + public String getSupportStandardEquipmentNo() { + return supportStandardEquipmentNo; + } + + public void setSupportStandardEquipmentNo(String supportStandardEquipmentNo) { + this.supportStandardEquipmentNo = supportStandardEquipmentNo; + } + + public String getTechnicalLevel() { + return technicalLevel; + } + + public void setTechnicalLevel(String technicalLevel) { + this.technicalLevel = technicalLevel; + } + + public String getUncertainty() { + return uncertainty; + } + + public void setUncertainty(String uncertainty) { + this.uncertainty = uncertainty; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getUseDept() { + return useDept; + } + + public void setUseDept(String useDept) { + this.useDept = useDept; + } + + public String getUseDeptName() { + return useDeptName; + } + + public void setUseDeptName(String useDeptName) { + this.useDeptName = useDeptName; + } + + public String getUsePerson() { + return usePerson; + } + + public void setUsePerson(String usePerson) { + this.usePerson = usePerson; + } + + public String getUsePersonName() { + return usePersonName; + } + + public void setUsePersonName(String usePersonName) { + this.usePersonName = usePersonName; + } + + public String getValidDate() { + return validDate; + } + + public void setValidDate(String validDate) { + this.validDate = validDate; + } + + public int getVersion() { + return version; + } + + public void setVersion(int version) { + this.version = version; + } + + public String getWeight() { + return weight; + } + + public void setWeight(String weight) { + this.weight = weight; + } + } + } +} diff --git a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt index a3f514f..46e5eef 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt @@ -35,4 +35,24 @@ @QueryMap limit: Map, @QueryMap offset: Map ): String + + /** + * 获取设备列表 + */ + @POST("/meter/assets/listPage") + suspend fun getEquipmentList( + @Header("token") token: String, + @Body requestBody: RequestBody, + @QueryMap limit: Map, + @QueryMap offset: Map + ): String + + /** + * 获取设备详情 + */ + @POST("/meter/assets/detail") + suspend fun getEquipmentDetail( + @Header("token") token: String, + @Body requestBody: RequestBody + ): String } \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt index 444a872..386a1d8 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt @@ -6,8 +6,10 @@ import com.pengxh.kt.lite.utils.SaveKeyValues import okhttp3.MediaType.Companion.toMediaType import okhttp3.RequestBody.Companion.toRequestBody +import org.json.JSONArray import org.json.JSONObject + object RetrofitServiceManager { private val api by lazy { @@ -73,4 +75,71 @@ offsetMap["offset"] = offset return api.getNoticeList(AuthenticationHelper.token!!, requestBody, limitMap, offsetMap) } + + /** + * 获取设备列表 + */ + suspend fun getEquipmentList( + equipmentNo: String, + equipmentName: String, + mesureType: String, + managerState: String, + useDept: String, + assetType: String, + equipmentCategory: String, + isCalibrationTestEquipment: String, + isMeasureAccount: String, + isStandardSupportEquipment: String, + isFixedAssets: String, + validStartDate: String, + validEndDate: String, + abc: String, + ids: Array, + offset: Int + ): String { + val paramObject = JSONObject() + paramObject.put("equipmentNo", equipmentNo) + paramObject.put("equipmentName", equipmentName) + paramObject.put("mesureType", mesureType) + paramObject.put("managerState", managerState) + paramObject.put("useDept", useDept) + paramObject.put("assetType", assetType) + paramObject.put("equipmentCategory", equipmentCategory) + paramObject.put("isCalibrationTestEquipment", isCalibrationTestEquipment) + paramObject.put("isMeasureAccount", isMeasureAccount) + paramObject.put("isStandardSupportEquipment", isStandardSupportEquipment) + paramObject.put("isFixedAssets", isFixedAssets) + paramObject.put("validStartDate", validStartDate) + paramObject.put("validEndDate", validEndDate) + paramObject.put("abc", abc) + + val jsonArray = JSONArray() + ids.forEach { + jsonArray.put(it) + } + paramObject.put("ids", jsonArray) + + val requestBody = paramObject.toString().toRequestBody( + "application/json;charset=UTF-8".toMediaType() + ) + + val limitMap = HashMap() + limitMap["limit"] = LocaleConstant.PAGE_LIMIT + + val offsetMap = HashMap() + offsetMap["offset"] = offset + return api.getEquipmentList(AuthenticationHelper.token!!, requestBody, limitMap, offsetMap) + } + + /** + * 获取设备详情 + */ + suspend fun getEquipmentDetail(id: String): String { + val paramObject = JSONObject() + paramObject.put("id", id) + val requestBody = paramObject.toString().toRequestBody( + "application/json;charset=UTF-8".toMediaType() + ) + return api.getEquipmentDetail(AuthenticationHelper.token!!, requestBody) + } } \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt deleted file mode 100644 index a5bb60b..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt +++ /dev/null @@ -1,104 +0,0 @@ -package com.casic.xz.meterage.view - -import android.annotation.SuppressLint -import android.graphics.Paint -import androidx.lifecycle.ViewModelProvider -import com.casic.xz.meterage.R -import com.casic.xz.meterage.extensions.combineImagePath -import com.casic.xz.meterage.extensions.formatTextFromHtml -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.vm.NoticeViewModel -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.extensions.convertColor -import com.pengxh.kt.lite.extensions.navigatePageTo -import com.pengxh.kt.lite.extensions.obtainScreenWidth -import com.pengxh.kt.lite.extensions.show -import com.pengxh.kt.lite.utils.Constant -import kotlinx.android.synthetic.main.activity_notice_detail.* -import kotlinx.android.synthetic.main.include_base_title.* -import java.util.* - -@SuppressLint("SetTextI18n") -class NoticeDetailActivity : KotlinBaseActivity() { - - private lateinit var noticeViewModel: NoticeViewModel - - override fun initData() { - leftBackView.setOnClickListener { finish() } - titleView.text = "通知公告" - - val args = intent.getStringArrayListExtra(Constant.INTENT_PARAM)!! - - noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] - noticeViewModel.getNoticeList(args[0], args[1], args[2], "", "", 1) - noticeViewModel.noticeResult.observe(this, { - if (it.code == 200) { - val dataRow = it.data?.rows!![0] - - noticeDateView.text = dataRow.noticeTime - noticePublisherView.text = "发布人 ${dataRow.noticePublisher}" - noticeCompanyView.text = "发布单位 ${dataRow.noticeCompany}" - - noticeNoView.text = dataRow.noticeNo - noticeTitleView.text = dataRow.noticeTitle - noticeSketchView.text = dataRow.noticeSketch - - dataRow.noticeContent.formatTextFromHtml( - this, noticeContentView, obtainScreenWidth() - ) - - if (dataRow.minioFileName.isNullOrBlank()) { - minioFileView.text = "暂无附件" - } else { - val minioFileName = dataRow.minioFileName - - minioFileView.text = minioFileName - val textPaint = minioFileView.paint - textPaint.flags = Paint.UNDERLINE_TEXT_FLAG - textPaint.isAntiAlias = true - minioFileView.setTextColor(R.color.themeColor.convertColor(this)) - - minioFileView.setOnClickListener { - //查看附件 - if (minioFileName.endsWith("pdf")) { - navigatePageTo(minioFileName) - } else if ( - minioFileName.endsWith("doc") || - minioFileName.endsWith("docx") - ) { - navigatePageTo(minioFileName) - } else if (minioFileName.endsWith("txt")) { - navigatePageTo(minioFileName) - } else if ( - minioFileName.endsWith("png") || - minioFileName.endsWith("jpeg") || - minioFileName.endsWith("jpg") - ) { - val urls = ArrayList() - urls.add(minioFileName.combineImagePath()) - navigatePageTo(0, urls) - } else { - "文件类型未知,无法打开附件".show(this) - } - } - } - } - }) - } - - override fun initEvent() { - - } - - override fun initLayoutView(): Int = R.layout.activity_notice_detail - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/NoticeListActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/NoticeListActivity.kt deleted file mode 100644 index 15f6a16..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/NoticeListActivity.kt +++ /dev/null @@ -1,180 +0,0 @@ -package com.casic.xz.meterage.view - -import android.os.Handler -import android.util.Log -import android.view.View -import androidx.lifecycle.ViewModelProvider -import com.casic.xz.meterage.R -import com.casic.xz.meterage.adapter.NoticeListAdapter -import com.casic.xz.meterage.extensions.addAll -import com.casic.xz.meterage.extensions.combineFilePath -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.extensions.showEmptyPage -import com.casic.xz.meterage.model.NoticeListModel -import com.casic.xz.meterage.vm.NoticeViewModel -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.extensions.navigatePageTo -import com.pengxh.kt.lite.extensions.show -import com.pengxh.kt.lite.utils.WeakReferenceHandler -import com.pengxh.kt.lite.widget.dialog.AlertControlDialog -import kotlinx.android.synthetic.main.activity_notice_list.* -import kotlinx.android.synthetic.main.include_empty_view.* - -class NoticeListActivity : KotlinBaseActivity() { - - private lateinit var weakReferenceHandler: WeakReferenceHandler - private lateinit var noticeViewModel: NoticeViewModel - private lateinit var noticeListAdapter: NoticeListAdapter - private var dataBeans: MutableList = ArrayList() - private var pageIndex = 1 - private var isRefresh = false - private var isLoadMore = false - - override fun initData() { - weakReferenceHandler = WeakReferenceHandler(callback) - noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] - noticeViewModel.noticeResult.observe(this, { - if (it.code == 200) { - val dataRows = it.data?.rows!! -// countBadeNumber(dataRows) - when { - isRefresh -> { - dataBeans.clear() - dataBeans = dataRows - noticeLayout.finishRefresh() - isRefresh = false - } - isLoadMore -> { - if (dataRows.size == 0) { - "到底了,别拉了".show(this) - } - dataBeans.addAll(dataRows) - noticeLayout.finishLoadMore() - isLoadMore = false - } - else -> { - dataBeans = dataRows - } - } - weakReferenceHandler.sendEmptyMessage(2023013101) - } - }) - } - - override fun initEvent() { - leftBackView.setOnClickListener { finish() } - rightOperateView.setOnClickListener { - AlertControlDialog.Builder() - .setContext(this) - .setTitle("提示") - .setMessage("确定将所有未读消息标为已读?") - .setNegativeButton("取消") - .setPositiveButton("确定") - .setOnDialogButtonClickListener(object : - AlertControlDialog.OnDialogButtonClickListener { - override fun onCancelClick() { - - } - - override fun onConfirmClick() { - //TODO 设置为已读 - } - }).build().show() - } - - if (hasNoticePermission()) { - openSystemNoticeLayout.visibility = View.GONE - openSystemNoticeLayout.visibility = View.GONE - } else { - openSystemNoticeLayout.setOnClickListener { - - } - - - closeLayoutView.setOnClickListener { - openSystemNoticeLayout.visibility = View.GONE - } - } - - noticeLayout.setOnRefreshListener { - isRefresh = true - //刷新之后页码重置 - pageIndex = 1 - getNoticeListByPage() - } - - noticeLayout.setOnLoadMoreListener { - isLoadMore = true - pageIndex++ - getNoticeListByPage() - } - } - - override fun onResume() { - super.onResume() - pageIndex = 1 - getNoticeListByPage() - } - - private fun getNoticeListByPage() { - noticeViewModel.getNoticeList("", "", "", "", "", pageIndex) - } - - private val callback = Handler.Callback { - when (it.what) { - 2023013101 -> { - if (isRefresh || isLoadMore) { - noticeListAdapter.notifyDataSetChanged() - } else { - if (dataBeans.size == 0) { - emptyView!!.showEmptyPage("没有任何消息") { - pageIndex = 1 - getNoticeListByPage() - } - } else { - emptyView!!.hide() - noticeListAdapter = NoticeListAdapter(this, dataBeans) - noticeRecyclerView.adapter = noticeListAdapter - noticeListAdapter.setOnItemClickListener(object : - NoticeListAdapter.OnItemClickListener { - override fun onItemClicked(position: Int) { - val rowsModel = dataBeans[position] - val allArgs = addAll( - rowsModel.noticeNo, - rowsModel.noticeTitle, - rowsModel.noticePublisher, - "", - "" - ) - Log.d( - "Casic", - "NoticeListActivity => onItemClicked: ${rowsModel.minioFileName.combineFilePath()}" - ) - navigatePageTo(allArgs) - } - }) - } - } - } - } - true - } - - //TODO 判断是否开启通知权限 - private fun hasNoticePermission(): Boolean { - - return false - } - - override fun initLayoutView(): Int = R.layout.activity_notice_list - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/PreviewDocumentActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/PreviewDocumentActivity.kt deleted file mode 100644 index e233ddc..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/PreviewDocumentActivity.kt +++ /dev/null @@ -1,24 +0,0 @@ -package com.casic.xz.meterage.view - -import com.casic.xz.meterage.R -import com.pengxh.kt.lite.base.KotlinBaseActivity - -class PreviewDocumentActivity : KotlinBaseActivity() { - override fun initData() { - - } - - override fun initEvent() { - - } - - override fun initLayoutView(): Int = R.layout.activity_preview_doc - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/PreviewPdfActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/PreviewPdfActivity.kt deleted file mode 100644 index 39f8ac2..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/PreviewPdfActivity.kt +++ /dev/null @@ -1,62 +0,0 @@ -package com.casic.xz.meterage.view - -import com.casic.xz.meterage.R -import com.casic.xz.meterage.extensions.combineFilePath -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.utils.LoadingDialogHub -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.callback.OnDownloadListener -import com.pengxh.kt.lite.extensions.createDownloadFileDir -import com.pengxh.kt.lite.extensions.downloadFile -import com.pengxh.kt.lite.utils.Constant -import kotlinx.android.synthetic.main.activity_preview_pdf.* -import kotlinx.android.synthetic.main.include_base_title.* -import java.io.File -import java.io.FileInputStream - - -class PreviewPdfActivity : KotlinBaseActivity() { - - override fun initData() { - val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! - titleView.text = minioFileName - - val url = minioFileName.combineFilePath() - url.downloadFile(createDownloadFileDir().toString(), - object : OnDownloadListener { - override fun onDownloadStart(totalBytes: Long) { - runOnUiThread { - LoadingDialogHub.show(this@PreviewPdfActivity, "附件加载中") - } - } - - override fun onProgressChanged(currentBytes: Long) { - - } - - override fun onDownloadEnd(file: File?) { - runOnUiThread { - LoadingDialogHub.dismiss() - } - val inputStream = FileInputStream(file) - pdfView.fromStream(inputStream).load() - } - }) - } - - override fun initEvent() { - leftBackView.setOnClickListener { finish() } - } - - override fun initLayoutView(): Int = R.layout.activity_preview_pdf - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/PreviewTextActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/PreviewTextActivity.kt deleted file mode 100644 index d634ca3..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/PreviewTextActivity.kt +++ /dev/null @@ -1,60 +0,0 @@ -package com.casic.xz.meterage.view - -import com.casic.xz.meterage.R -import com.casic.xz.meterage.extensions.combineFilePath -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.utils.LoadingDialogHub -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.callback.OnDownloadListener -import com.pengxh.kt.lite.extensions.createDownloadFileDir -import com.pengxh.kt.lite.extensions.downloadFile -import com.pengxh.kt.lite.extensions.read -import com.pengxh.kt.lite.utils.Constant -import kotlinx.android.synthetic.main.activity_preview_txt.* -import kotlinx.android.synthetic.main.include_base_title.* -import java.io.File - -class PreviewTextActivity : KotlinBaseActivity() { - - override fun initData() { - val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! - titleView.text = minioFileName - - val url = minioFileName.combineFilePath() - url.downloadFile(createDownloadFileDir().toString(), - object : OnDownloadListener { - override fun onDownloadStart(totalBytes: Long) { - runOnUiThread { - LoadingDialogHub.show(this@PreviewTextActivity, "附件加载中") - } - } - - override fun onProgressChanged(currentBytes: Long) { - - } - - override fun onDownloadEnd(file: File?) { - runOnUiThread { - LoadingDialogHub.dismiss() - textView.text = file?.read() - } - } - }) - } - - override fun initEvent() { - leftBackView.setOnClickListener { finish() } - } - - override fun initLayoutView(): Int = R.layout.activity_preview_txt - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentActivity.kt new file mode 100644 index 0000000..35ca098 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentActivity.kt @@ -0,0 +1,158 @@ +package com.casic.xz.meterage.view.home + +import android.os.Handler +import androidx.lifecycle.ViewModelProvider +import androidx.recyclerview.widget.DividerItemDecoration +import com.casic.xz.meterage.R +import com.casic.xz.meterage.adapter.EquipmentListAdapter +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.extensions.showEmptyPage +import com.casic.xz.meterage.model.EquipmentListModel +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.casic.xz.meterage.vm.EquipmentViewModel +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.extensions.navigatePageTo +import com.pengxh.kt.lite.extensions.show +import com.pengxh.kt.lite.utils.WeakReferenceHandler +import com.pengxh.kt.lite.vm.LoadState +import kotlinx.android.synthetic.main.activity_equipment.* +import kotlinx.android.synthetic.main.include_empty_view.* +import kotlinx.android.synthetic.main.include_search_title.* + +class EquipmentActivity : KotlinBaseActivity() { + + private lateinit var weakReferenceHandler: WeakReferenceHandler + private lateinit var equipmentViewModel: EquipmentViewModel + private lateinit var equipmentListAdapter: EquipmentListAdapter + private var dataBeans: MutableList = ArrayList() + private var pageIndex = 1 + private var isRefresh = false + private var isLoadMore = false + + override fun initData() { + weakReferenceHandler = WeakReferenceHandler(callback) + equipmentViewModel = ViewModelProvider(this)[EquipmentViewModel::class.java] + equipmentViewModel.equipmentResult.observe(this, { + if (it.code == 200) { + val dataRows = it.data?.rows!! + when { + isRefresh -> { + dataBeans.clear() + dataBeans = dataRows + equipmentLayout.finishRefresh() + isRefresh = false + } + isLoadMore -> { + if (dataRows.size == 0) { + "到底了,别拉了".show(this) + } + dataBeans.addAll(dataRows) + equipmentLayout.finishLoadMore() + isLoadMore = false + } + else -> { + dataBeans = dataRows + } + } + weakReferenceHandler.sendEmptyMessage(2023020801) + } + }) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + rightOperateView.setOnClickListener { + + } + + equipmentLayout.setOnRefreshListener { + isRefresh = true + //刷新之后页码重置 + pageIndex = 1 + getEquipmentListByPage() + } + + equipmentLayout.setOnLoadMoreListener { + isLoadMore = true + pageIndex++ + getEquipmentListByPage() + } + } + + override fun initLayoutView(): Int = R.layout.activity_equipment + + override fun observeRequestState() { + equipmentViewModel.loadState.observe(this, { + when (it) { + LoadState.Loading -> LoadingDialogHub.show(this, "数据加载中...") + else -> LoadingDialogHub.dismiss() + } + }) + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + titleView.text = "仪器设备" + } + + override fun onResume() { + super.onResume() + pageIndex = 1 + getEquipmentListByPage() + } + + private fun getEquipmentListByPage() { + equipmentViewModel.getEquipmentList( + "", + "", + "", + "", + "", + "1", + "", + "", + "", + "", + "", + "", + "", + "", + arrayOf(), + pageIndex + ) + } + + private val callback = Handler.Callback { + when (it.what) { + 2023020801 -> { + if (isRefresh || isLoadMore) { + equipmentListAdapter.notifyDataSetChanged() + } else { + if (dataBeans.size == 0) { + emptyView!!.showEmptyPage("无设备") { + pageIndex = 1 + getEquipmentListByPage() + } + } else { + emptyView!!.hide() + equipmentListAdapter = EquipmentListAdapter(this, dataBeans) + equipmentRecyclerView.addItemDecoration( + DividerItemDecoration(this, DividerItemDecoration.VERTICAL) + ) + equipmentRecyclerView.adapter = equipmentListAdapter + equipmentListAdapter.setOnItemClickListener(object : + EquipmentListAdapter.OnItemClickListener { + override fun onItemClicked(position: Int) { + val rowsModel = dataBeans[position] + navigatePageTo(rowsModel.id) + } + }) + } + } + } + } + true + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentDetailActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentDetailActivity.kt new file mode 100644 index 0000000..7dee13c --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentDetailActivity.kt @@ -0,0 +1,53 @@ +package com.casic.xz.meterage.view.home + +import androidx.fragment.app.Fragment +import com.casic.xz.meterage.R +import com.casic.xz.meterage.adapter.SubViewPagerAdapter +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.fragment.equipment.* +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.utils.Constant +import kotlinx.android.synthetic.main.activity_equipment.rootView +import kotlinx.android.synthetic.main.activity_equipment_detail.* +import kotlinx.android.synthetic.main.include_base_title.* + +class EquipmentDetailActivity : KotlinBaseActivity() { + + private var fragmentPages: ArrayList = ArrayList() + + override fun initData() { + val equipmentId = intent.getStringExtra(Constant.INTENT_PARAM)!! + + fragmentPages.add(BasicInformationFragment(equipmentId)) + fragmentPages.add(InspectionRecordFragment()) + fragmentPages.add(ChangeRecordFragment()) + fragmentPages.add(UsageRecordFragment()) + fragmentPages.add(CertificateFragment()) + + val equipmentPageTitles = arrayOf("基础信息", "周检记录", "状态变更记录", "使用记录", "检定证书") + + equipmentViewPager.adapter = SubViewPagerAdapter( + supportFragmentManager, fragmentPages, equipmentPageTitles + ) + equipmentViewPager.offscreenPageLimit = fragmentPages.size + //绑定 + topTabLayout.setupWithViewPager(equipmentViewPager) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + } + + override fun initLayoutView(): Int = R.layout.activity_equipment_detail + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + titleView.text = "仪器设备" + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeDetailActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeDetailActivity.kt new file mode 100644 index 0000000..6fe0022 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeDetailActivity.kt @@ -0,0 +1,105 @@ +package com.casic.xz.meterage.view.notice + +import android.annotation.SuppressLint +import android.graphics.Paint +import androidx.lifecycle.ViewModelProvider +import com.casic.xz.meterage.R +import com.casic.xz.meterage.extensions.combineImagePath +import com.casic.xz.meterage.extensions.formatTextFromHtml +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.view.BigImageActivity +import com.casic.xz.meterage.vm.NoticeViewModel +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.extensions.convertColor +import com.pengxh.kt.lite.extensions.navigatePageTo +import com.pengxh.kt.lite.extensions.obtainScreenWidth +import com.pengxh.kt.lite.extensions.show +import com.pengxh.kt.lite.utils.Constant +import kotlinx.android.synthetic.main.activity_notice_detail.* +import kotlinx.android.synthetic.main.include_base_title.* +import java.util.* + +@SuppressLint("SetTextI18n") +class NoticeDetailActivity : KotlinBaseActivity() { + + private lateinit var noticeViewModel: NoticeViewModel + + override fun initData() { + leftBackView.setOnClickListener { finish() } + titleView.text = "通知公告" + + val args = intent.getStringArrayListExtra(Constant.INTENT_PARAM)!! + + noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] + noticeViewModel.getNoticeList(args[0], args[1], args[2], "", "", 1) + noticeViewModel.noticeResult.observe(this, { + if (it.code == 200) { + val dataRow = it.data?.rows!![0] + + noticeDateView.text = dataRow.noticeTime + noticePublisherView.text = "发布人 ${dataRow.noticePublisher}" + noticeCompanyView.text = "发布单位 ${dataRow.noticeCompany}" + + noticeNoView.text = dataRow.noticeNo + noticeTitleView.text = dataRow.noticeTitle + noticeSketchView.text = dataRow.noticeSketch + + dataRow.noticeContent.formatTextFromHtml( + this, noticeContentView, obtainScreenWidth() + ) + + if (dataRow.minioFileName.isNullOrBlank()) { + minioFileView.text = "暂无附件" + } else { + val minioFileName = dataRow.minioFileName + + minioFileView.text = minioFileName + val textPaint = minioFileView.paint + textPaint.flags = Paint.UNDERLINE_TEXT_FLAG + textPaint.isAntiAlias = true + minioFileView.setTextColor(R.color.themeColor.convertColor(this)) + + minioFileView.setOnClickListener { + //查看附件 + if (minioFileName.endsWith("pdf")) { + navigatePageTo(minioFileName) + } else if ( + minioFileName.endsWith("doc") || + minioFileName.endsWith("docx") + ) { + navigatePageTo(minioFileName) + } else if (minioFileName.endsWith("txt")) { + navigatePageTo(minioFileName) + } else if ( + minioFileName.endsWith("png") || + minioFileName.endsWith("jpeg") || + minioFileName.endsWith("jpg") + ) { + val urls = ArrayList() + urls.add(minioFileName.combineImagePath()) + navigatePageTo(0, urls) + } else { + "文件类型未知,无法打开附件".show(this) + } + } + } + } + }) + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.activity_notice_detail + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeListActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeListActivity.kt new file mode 100644 index 0000000..31c0490 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeListActivity.kt @@ -0,0 +1,180 @@ +package com.casic.xz.meterage.view.notice + +import android.os.Handler +import android.util.Log +import android.view.View +import androidx.lifecycle.ViewModelProvider +import com.casic.xz.meterage.R +import com.casic.xz.meterage.adapter.NoticeListAdapter +import com.casic.xz.meterage.extensions.addAll +import com.casic.xz.meterage.extensions.combineFilePath +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.extensions.showEmptyPage +import com.casic.xz.meterage.model.NoticeListModel +import com.casic.xz.meterage.vm.NoticeViewModel +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.extensions.navigatePageTo +import com.pengxh.kt.lite.extensions.show +import com.pengxh.kt.lite.utils.WeakReferenceHandler +import com.pengxh.kt.lite.widget.dialog.AlertControlDialog +import kotlinx.android.synthetic.main.activity_notice_list.* +import kotlinx.android.synthetic.main.include_empty_view.* + +class NoticeListActivity : KotlinBaseActivity() { + + private lateinit var weakReferenceHandler: WeakReferenceHandler + private lateinit var noticeViewModel: NoticeViewModel + private lateinit var noticeListAdapter: NoticeListAdapter + private var dataBeans: MutableList = ArrayList() + private var pageIndex = 1 + private var isRefresh = false + private var isLoadMore = false + + override fun initData() { + weakReferenceHandler = WeakReferenceHandler(callback) + noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] + noticeViewModel.noticeResult.observe(this, { + if (it.code == 200) { + val dataRows = it.data?.rows!! +// countBadeNumber(dataRows) + when { + isRefresh -> { + dataBeans.clear() + dataBeans = dataRows + noticeLayout.finishRefresh() + isRefresh = false + } + isLoadMore -> { + if (dataRows.size == 0) { + "到底了,别拉了".show(this) + } + dataBeans.addAll(dataRows) + noticeLayout.finishLoadMore() + isLoadMore = false + } + else -> { + dataBeans = dataRows + } + } + weakReferenceHandler.sendEmptyMessage(2023013101) + } + }) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + rightOperateView.setOnClickListener { + AlertControlDialog.Builder() + .setContext(this) + .setTitle("提示") + .setMessage("确定将所有未读消息标为已读?") + .setNegativeButton("取消") + .setPositiveButton("确定") + .setOnDialogButtonClickListener(object : + AlertControlDialog.OnDialogButtonClickListener { + override fun onCancelClick() { + + } + + override fun onConfirmClick() { + //TODO 设置为已读 + } + }).build().show() + } + + if (hasNoticePermission()) { + openSystemNoticeLayout.visibility = View.GONE + openSystemNoticeLayout.visibility = View.GONE + } else { + openSystemNoticeLayout.setOnClickListener { + + } + + + closeLayoutView.setOnClickListener { + openSystemNoticeLayout.visibility = View.GONE + } + } + + noticeLayout.setOnRefreshListener { + isRefresh = true + //刷新之后页码重置 + pageIndex = 1 + getNoticeListByPage() + } + + noticeLayout.setOnLoadMoreListener { + isLoadMore = true + pageIndex++ + getNoticeListByPage() + } + } + + override fun onResume() { + super.onResume() + pageIndex = 1 + getNoticeListByPage() + } + + private fun getNoticeListByPage() { + noticeViewModel.getNoticeList("", "", "", "", "", pageIndex) + } + + private val callback = Handler.Callback { + when (it.what) { + 2023013101 -> { + if (isRefresh || isLoadMore) { + noticeListAdapter.notifyDataSetChanged() + } else { + if (dataBeans.size == 0) { + emptyView!!.showEmptyPage("没有任何消息") { + pageIndex = 1 + getNoticeListByPage() + } + } else { + emptyView!!.hide() + noticeListAdapter = NoticeListAdapter(this, dataBeans) + noticeRecyclerView.adapter = noticeListAdapter + noticeListAdapter.setOnItemClickListener(object : + NoticeListAdapter.OnItemClickListener { + override fun onItemClicked(position: Int) { + val rowsModel = dataBeans[position] + val allArgs = addAll( + rowsModel.noticeNo, + rowsModel.noticeTitle, + rowsModel.noticePublisher, + "", + "" + ) + Log.d( + "Casic", + "NoticeListActivity => onItemClicked: ${rowsModel.minioFileName.combineFilePath()}" + ) + navigatePageTo(allArgs) + } + }) + } + } + } + } + true + } + + //TODO 判断是否开启通知权限 + private fun hasNoticePermission(): Boolean { + + return false + } + + override fun initLayoutView(): Int = R.layout.activity_notice_list + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewDocumentActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewDocumentActivity.kt new file mode 100644 index 0000000..4b16ae8 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewDocumentActivity.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.view.notice + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseActivity + +class PreviewDocumentActivity : KotlinBaseActivity() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.activity_preview_doc + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewPdfActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewPdfActivity.kt new file mode 100644 index 0000000..fad73b6 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewPdfActivity.kt @@ -0,0 +1,62 @@ +package com.casic.xz.meterage.view.notice + +import com.casic.xz.meterage.R +import com.casic.xz.meterage.extensions.combineFilePath +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.callback.OnDownloadListener +import com.pengxh.kt.lite.extensions.createDownloadFileDir +import com.pengxh.kt.lite.extensions.downloadFile +import com.pengxh.kt.lite.utils.Constant +import kotlinx.android.synthetic.main.activity_preview_pdf.* +import kotlinx.android.synthetic.main.include_base_title.* +import java.io.File +import java.io.FileInputStream + + +class PreviewPdfActivity : KotlinBaseActivity() { + + override fun initData() { + val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! + titleView.text = minioFileName + + val url = minioFileName.combineFilePath() + url.downloadFile(createDownloadFileDir().toString(), + object : OnDownloadListener { + override fun onDownloadStart(totalBytes: Long) { + runOnUiThread { + LoadingDialogHub.show(this@PreviewPdfActivity, "附件加载中") + } + } + + override fun onProgressChanged(currentBytes: Long) { + + } + + override fun onDownloadEnd(file: File?) { + runOnUiThread { + LoadingDialogHub.dismiss() + } + val inputStream = FileInputStream(file) + pdfView.fromStream(inputStream).load() + } + }) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + } + + override fun initLayoutView(): Int = R.layout.activity_preview_pdf + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewTextActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewTextActivity.kt new file mode 100644 index 0000000..d7850fb --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewTextActivity.kt @@ -0,0 +1,60 @@ +package com.casic.xz.meterage.view.notice + +import com.casic.xz.meterage.R +import com.casic.xz.meterage.extensions.combineFilePath +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.callback.OnDownloadListener +import com.pengxh.kt.lite.extensions.createDownloadFileDir +import com.pengxh.kt.lite.extensions.downloadFile +import com.pengxh.kt.lite.extensions.read +import com.pengxh.kt.lite.utils.Constant +import kotlinx.android.synthetic.main.activity_preview_txt.* +import kotlinx.android.synthetic.main.include_base_title.* +import java.io.File + +class PreviewTextActivity : KotlinBaseActivity() { + + override fun initData() { + val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! + titleView.text = minioFileName + + val url = minioFileName.combineFilePath() + url.downloadFile(createDownloadFileDir().toString(), + object : OnDownloadListener { + override fun onDownloadStart(totalBytes: Long) { + runOnUiThread { + LoadingDialogHub.show(this@PreviewTextActivity, "附件加载中") + } + } + + override fun onProgressChanged(currentBytes: Long) { + + } + + override fun onDownloadEnd(file: File?) { + runOnUiThread { + LoadingDialogHub.dismiss() + textView.text = file?.read() + } + } + }) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + } + + override fun initLayoutView(): Int = R.layout.activity_preview_txt + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/vm/EquipmentViewModel.kt b/app/src/main/java/com/casic/xz/meterage/vm/EquipmentViewModel.kt new file mode 100644 index 0000000..b5f21f6 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/vm/EquipmentViewModel.kt @@ -0,0 +1,92 @@ +package com.casic.xz.meterage.vm + +import androidx.lifecycle.MutableLiveData +import com.casic.xz.meterage.base.BaseApplication +import com.casic.xz.meterage.extensions.separateResponseCode +import com.casic.xz.meterage.extensions.toErrorMessage +import com.casic.xz.meterage.model.EquipmentDetailModel +import com.casic.xz.meterage.model.EquipmentListModel +import com.casic.xz.meterage.utils.retrofit.RetrofitServiceManager +import com.google.gson.Gson +import com.google.gson.reflect.TypeToken +import com.pengxh.kt.lite.extensions.launch +import com.pengxh.kt.lite.extensions.show +import com.pengxh.kt.lite.vm.BaseViewModel +import com.pengxh.kt.lite.vm.LoadState + +class EquipmentViewModel : BaseViewModel() { + + private val gson by lazy { Gson() } + val equipmentResult = MutableLiveData() + val equipmentDetailResult = MutableLiveData() + + fun getEquipmentList( + equipmentNo: String, + equipmentName: String, + mesureType: String, + managerState: String, + useDept: String, + assetType: String, + equipmentCategory: String, + isCalibrationTestEquipment: String, + isMeasureAccount: String, + isStandardSupportEquipment: String, + isFixedAssets: String, + validStartDate: String, + validEndDate: String, + abc: String, + ids: Array, + offset: Int + ) = launch({ + loadState.value = LoadState.Loading + val response = RetrofitServiceManager.getEquipmentList( + equipmentNo, + equipmentName, + mesureType, + managerState, + useDept, + assetType, + equipmentCategory, + isCalibrationTestEquipment, + isMeasureAccount, + isStandardSupportEquipment, + isFixedAssets, + validStartDate, + validEndDate, + abc, + ids, + offset + ) + val responseCode = response.separateResponseCode() + if (responseCode == 200) { + loadState.value = LoadState.Success + equipmentResult.value = gson.fromJson( + response, object : TypeToken() {}.type + ) + } else { + loadState.value = LoadState.Fail + response.toErrorMessage().show(BaseApplication.get()) + } + }, { + loadState.value = LoadState.Fail + it.printStackTrace() + }) + + fun getEquipmentDetail(id: String) = launch({ + loadState.value = LoadState.Loading + val response = RetrofitServiceManager.getEquipmentDetail(id) + val responseCode = response.separateResponseCode() + if (responseCode == 200) { + loadState.value = LoadState.Success + equipmentDetailResult.value = gson.fromJson( + response, object : TypeToken() {}.type + ) + } else { + loadState.value = LoadState.Fail + response.toErrorMessage().show(BaseApplication.get()) + } + }, { + loadState.value = LoadState.Fail + it.printStackTrace() + }) +} \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_sorting.xml b/app/src/main/res/drawable/ic_sorting.xml new file mode 100644 index 0000000..252bfe6 --- /dev/null +++ b/app/src/main/res/drawable/ic_sorting.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/layout/activity_equipment.xml b/app/src/main/res/layout/activity_equipment.xml new file mode 100644 index 0000000..d6a64b1 --- /dev/null +++ b/app/src/main/res/layout/activity_equipment.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_equipment_detail.xml b/app/src/main/res/layout/activity_equipment_detail.xml new file mode 100644 index 0000000..7254762 --- /dev/null +++ b/app/src/main/res/layout/activity_equipment_detail.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_basic_information.xml b/app/src/main/res/layout/fragment_basic_information.xml new file mode 100644 index 0000000..4a3c1c7 --- /dev/null +++ b/app/src/main/res/layout/fragment_basic_information.xml @@ -0,0 +1,390 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_certificate.xml b/app/src/main/res/layout/fragment_certificate.xml new file mode 100644 index 0000000..77d9ef6 --- /dev/null +++ b/app/src/main/res/layout/fragment_certificate.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_change_record.xml b/app/src/main/res/layout/fragment_change_record.xml new file mode 100644 index 0000000..77d9ef6 --- /dev/null +++ b/app/src/main/res/layout/fragment_change_record.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 3892b5a..02160cd 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -34,16 +34,18 @@ - - - - - - - + + + + + + + + + +) : RecyclerView.Adapter() { + + private var layoutInflater: LayoutInflater = LayoutInflater.from(context) + + override fun getItemCount(): Int = dataRows.size + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = ItemViewHolder( + layoutInflater.inflate(R.layout.item_equipment_rv_l, parent, false) + ) + + override fun onBindViewHolder(holder: ItemViewHolder, position: Int) { + //绑定数据 + val rowsBean = dataRows[position] + holder.equipmentNameView.text = rowsBean.equipmentName + holder.equipmentCodeView.text = rowsBean.equipmentNo + holder.equipmentDateView.text = rowsBean.enableDate + holder.equipmentLibView.text = rowsBean.useDeptName + + //绑定事件 + holder.itemView.setOnClickListener { + listener?.onItemClicked(position) + } + } + + inner class ItemViewHolder(view: View) : RecyclerView.ViewHolder(view) { + var equipmentNameView: TextView = view.findViewById(R.id.equipmentNameView) + var equipmentCodeView: TextView = view.findViewById(R.id.equipmentCodeView) + var equipmentDateView: TextView = view.findViewById(R.id.equipmentDateView) + var equipmentLibView: TextView = view.findViewById(R.id.equipmentLibView) + } + + private var listener: OnItemClickListener? = null + + interface OnItemClickListener { + fun onItemClicked(position: Int) + } + + fun setOnItemClickListener(onClickListener: OnItemClickListener?) { + this.listener = onClickListener + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt index b4628f3..d970b55 100644 --- a/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt +++ b/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt @@ -5,7 +5,8 @@ import com.casic.xz.meterage.R import com.casic.xz.meterage.adapter.HomeGridAdapter import com.casic.xz.meterage.utils.LocaleConstant -import com.casic.xz.meterage.view.NoticeListActivity +import com.casic.xz.meterage.view.home.EquipmentActivity +import com.casic.xz.meterage.view.notice.NoticeListActivity import com.casic.xz.meterage.vm.NoticeViewModel import com.pengxh.kt.lite.base.KotlinBaseFragment import com.pengxh.kt.lite.extensions.navigatePageTo @@ -36,8 +37,19 @@ homeFuncRecyclerView.adapter = homeAdapter homeAdapter.setOnGridItemClickListener(object : HomeGridAdapter.OnGridItemClickListener { override fun onItemClick(position: Int) { - when (position) { - + when (LocaleConstant.HOME_FUNC_OPERATE[position]) { + "仪器设备" -> requireContext().navigatePageTo() +// "标准装置" -> requireContext().navigatePageTo() +// "证书报告" -> requireContext().navigatePageTo() +// "委托需求" -> requireContext().navigatePageTo() +// "访客" -> requireContext().navigatePageTo() +// "标准规范" -> requireContext().navigatePageTo() +// "能力列表" -> requireContext().navigatePageTo() +// "计量培训" -> requireContext().navigatePageTo() +// "合同发票" -> requireContext().navigatePageTo() +// "业务统计" -> requireContext().navigatePageTo() +// "客户列表" -> requireContext().navigatePageTo() +// "外场检测" -> requireContext().navigatePageTo() } } }) diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt index 7e75abe..56dc5ec 100644 --- a/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt +++ b/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt @@ -2,9 +2,11 @@ import android.view.View import androidx.lifecycle.ViewModelProvider +import com.bumptech.glide.Glide +import com.bumptech.glide.request.RequestOptions import com.casic.xz.meterage.R import com.casic.xz.meterage.utils.LocaleConstant -import com.casic.xz.meterage.view.NoticeListActivity +import com.casic.xz.meterage.view.notice.NoticeListActivity import com.casic.xz.meterage.vm.NoticeViewModel import com.casic.xz.meterage.vm.UserViewModel import com.pengxh.kt.lite.base.KotlinBaseFragment @@ -23,6 +25,12 @@ val data = it.data userNameView.text = data.name userUnitView.text = data.deptName + +// Glide.with(requireContext()) +// .load(R.mipmap.default_avatar) +// .apply(RequestOptions.circleCropTransform()) +// .placeholder(R.mipmap.load_image_error) +// .into(userAvatarView) } }) diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt new file mode 100644 index 0000000..cf22646 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt @@ -0,0 +1,103 @@ +package com.casic.xz.meterage.fragment.equipment + +import android.graphics.Paint +import androidx.lifecycle.ViewModelProvider +import com.casic.xz.meterage.R +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.casic.xz.meterage.vm.EquipmentViewModel +import com.pengxh.kt.lite.base.KotlinBaseFragment +import com.pengxh.kt.lite.extensions.convertColor +import com.pengxh.kt.lite.vm.LoadState +import kotlinx.android.synthetic.main.fragment_basic_information.* + +class BasicInformationFragment(private val id: String) : KotlinBaseFragment() { + + private lateinit var equipmentViewModel: EquipmentViewModel + + override fun initData() { + equipmentViewModel = ViewModelProvider(this)[EquipmentViewModel::class.java] + equipmentViewModel.getEquipmentDetail(id) + equipmentViewModel.equipmentDetailResult.observe(this, { + if (it.code == 200) { + val data = it.data!! + + equipmentCodeView.text = data.equipmentNo + equipmentNameView.text = data.equipmentName + manufacturerView.text = data.manufacturer + factoryNumberView.text = data.manufacturingNo + modelView.text = data.modelNo + verificationMethodView.text = data.mesureTypeName + measuringRangeView.text = data.mesureRange + uncertaintyView.text = data.uncertainty + firstUseView.text = data.createTime + originalValueView.text = data.originValue + usageDeptView.text = data.useDeptName + userView.text = data.usePersonName + managementStatusView.text = data.managerStateName + verificationDeptView.text = data.useDeptName +// nextVerificationDeptView.text = data. + verificationPeriodView.text = data.mesureCycle + verificationDateView.text = data.mesureDate + effectiveDateView.text = data.validDate + verificationResultsView.text = data.mesureResultName + abcView.text = data.abcName + isNeedTechnicalView.text = if ( + data.isCalibrationTestEquipment.isNullOrBlank() || data.isCalibrationTestEquipment == "0" + ) { + "否" + } else { + "是" + } + + isStandingBook.text = if ( + data.isMeasureAccount.isNullOrBlank() || data.isMeasureAccount == "0" + ) { + "否" + } else { + "是" + } + + isStandardView.text = if ( + data.isStandardSupportEquipment.isNullOrBlank() || data.isStandardSupportEquipment == "0" + ) { + "否" + } else { + "是" + } + remarkView.text = data.remark + if (data.fileList.size == 0) { + instructionsView.text = "暂无" + } else { + instructionsView.text = "查看附件列表" + val textPaint = instructionsView.paint + textPaint.flags = Paint.UNDERLINE_TEXT_FLAG + textPaint.isAntiAlias = true + instructionsView.setTextColor(R.color.themeColor.convertColor(requireContext())) + + instructionsView.setOnClickListener { + + } + } + } + }) + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_basic_information + + override fun observeRequestState() { + equipmentViewModel.loadState.observe(this, { + when (it) { + LoadState.Loading -> LoadingDialogHub.show(requireActivity(), "数据加载中...") + else -> LoadingDialogHub.dismiss() + } + }) + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt new file mode 100644 index 0000000..0b4a747 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class CertificateFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_certificate + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt new file mode 100644 index 0000000..f05c491 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class ChangeRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_change_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt new file mode 100644 index 0000000..849ffa5 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class InspectionRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_inspection_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt new file mode 100644 index 0000000..aa4edd9 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class UsageRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_usage_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java b/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java new file mode 100644 index 0000000..0b9124e --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java @@ -0,0 +1,760 @@ +package com.casic.xz.meterage.model; + +import java.util.List; + +public class EquipmentDetailModel { + + private int code; + private DataModel data; + private String message; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataModel getData() { + return data; + } + + public void setData(DataModel data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public static class DataModel { + private String abc; + private String abcName; + private String assetNo; + private String assetSource; + private String assetType; + private String assetTypeName; + private String attribute; + private String capitalSource; + private String capitalSourceName; + private String cardEstablishmentDate; + private String createTime; + private String createUser; + private String depreciationMethod; + private String depreciationMethodName; + private String depreciationPeriod; + private String enableDate; + private String equipmentCategory; + private String equipmentCategoryName; + private String equipmentName; + private String equipmentNo; + private String equipmentSpecifications; + private String equipmentType; + private String equipmentTypeName; + private List fileList; + private String id; + private String installIncidentalExpenses; + private String installPlace; + private String intactState; + private String isCalibrationTestEquipment; + private int isDel; + private String isFixedAssets; + private String isMeasureAccount; + private String isStandardSupportEquipment; + private String labelBind; + private String majorCategory; + private String majorCategoryName; + private String managerLevel; + private String managerLevelName; + private String managerState; + private String managerStateName; + private String manufacturer; + private String manufacturerCountry; + private String manufacturingDate; + private String manufacturingNo; + private String mesureCycle; + private String mesureDate; + private String mesureDept; + private String mesureRange; + private String mesureResult; + private String mesureResultName; + private String mesureType; + private String mesureTypeName; + private String modelNo; + private String originValue; + private String overallDimension; + private String presentOriginValue; + private String purpose; + private String remark; + private String singlePrice; + private String supportStandardEquipmentName; + private String supportStandardEquipmentNo; + private String technicalLevel; + private String uncertainty; + private String updateTime; + private String useDept; + private String useDeptName; + private String usePerson; + private String usePersonName; + private String validDate; + private int version; + private String weight; + + public String getAbc() { + return abc; + } + + public void setAbc(String abc) { + this.abc = abc; + } + + public String getAbcName() { + return abcName; + } + + public void setAbcName(String abcName) { + this.abcName = abcName; + } + + public String getAssetNo() { + return assetNo; + } + + public void setAssetNo(String assetNo) { + this.assetNo = assetNo; + } + + public String getAssetSource() { + return assetSource; + } + + public void setAssetSource(String assetSource) { + this.assetSource = assetSource; + } + + public String getAssetType() { + return assetType; + } + + public void setAssetType(String assetType) { + this.assetType = assetType; + } + + public String getAssetTypeName() { + return assetTypeName; + } + + public void setAssetTypeName(String assetTypeName) { + this.assetTypeName = assetTypeName; + } + + public String getAttribute() { + return attribute; + } + + public void setAttribute(String attribute) { + this.attribute = attribute; + } + + public String getCapitalSource() { + return capitalSource; + } + + public void setCapitalSource(String capitalSource) { + this.capitalSource = capitalSource; + } + + public String getCapitalSourceName() { + return capitalSourceName; + } + + public void setCapitalSourceName(String capitalSourceName) { + this.capitalSourceName = capitalSourceName; + } + + public String getCardEstablishmentDate() { + return cardEstablishmentDate; + } + + public void setCardEstablishmentDate(String cardEstablishmentDate) { + this.cardEstablishmentDate = cardEstablishmentDate; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getDepreciationMethod() { + return depreciationMethod; + } + + public void setDepreciationMethod(String depreciationMethod) { + this.depreciationMethod = depreciationMethod; + } + + public String getDepreciationMethodName() { + return depreciationMethodName; + } + + public void setDepreciationMethodName(String depreciationMethodName) { + this.depreciationMethodName = depreciationMethodName; + } + + public String getDepreciationPeriod() { + return depreciationPeriod; + } + + public void setDepreciationPeriod(String depreciationPeriod) { + this.depreciationPeriod = depreciationPeriod; + } + + public String getEnableDate() { + return enableDate; + } + + public void setEnableDate(String enableDate) { + this.enableDate = enableDate; + } + + public String getEquipmentCategory() { + return equipmentCategory; + } + + public void setEquipmentCategory(String equipmentCategory) { + this.equipmentCategory = equipmentCategory; + } + + public String getEquipmentCategoryName() { + return equipmentCategoryName; + } + + public void setEquipmentCategoryName(String equipmentCategoryName) { + this.equipmentCategoryName = equipmentCategoryName; + } + + public String getEquipmentName() { + return equipmentName; + } + + public void setEquipmentName(String equipmentName) { + this.equipmentName = equipmentName; + } + + public String getEquipmentNo() { + return equipmentNo; + } + + public void setEquipmentNo(String equipmentNo) { + this.equipmentNo = equipmentNo; + } + + public String getEquipmentSpecifications() { + return equipmentSpecifications; + } + + public void setEquipmentSpecifications(String equipmentSpecifications) { + this.equipmentSpecifications = equipmentSpecifications; + } + + public String getEquipmentType() { + return equipmentType; + } + + public void setEquipmentType(String equipmentType) { + this.equipmentType = equipmentType; + } + + public String getEquipmentTypeName() { + return equipmentTypeName; + } + + public void setEquipmentTypeName(String equipmentTypeName) { + this.equipmentTypeName = equipmentTypeName; + } + + public List getFileList() { + return fileList; + } + + public void setFileList(List fileList) { + this.fileList = fileList; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getInstallIncidentalExpenses() { + return installIncidentalExpenses; + } + + public void setInstallIncidentalExpenses(String installIncidentalExpenses) { + this.installIncidentalExpenses = installIncidentalExpenses; + } + + public String getInstallPlace() { + return installPlace; + } + + public void setInstallPlace(String installPlace) { + this.installPlace = installPlace; + } + + public String getIntactState() { + return intactState; + } + + public void setIntactState(String intactState) { + this.intactState = intactState; + } + + public String getIsCalibrationTestEquipment() { + return isCalibrationTestEquipment; + } + + public void setIsCalibrationTestEquipment(String isCalibrationTestEquipment) { + this.isCalibrationTestEquipment = isCalibrationTestEquipment; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getIsFixedAssets() { + return isFixedAssets; + } + + public void setIsFixedAssets(String isFixedAssets) { + this.isFixedAssets = isFixedAssets; + } + + public String getIsMeasureAccount() { + return isMeasureAccount; + } + + public void setIsMeasureAccount(String isMeasureAccount) { + this.isMeasureAccount = isMeasureAccount; + } + + public String getIsStandardSupportEquipment() { + return isStandardSupportEquipment; + } + + public void setIsStandardSupportEquipment(String isStandardSupportEquipment) { + this.isStandardSupportEquipment = isStandardSupportEquipment; + } + + public String getLabelBind() { + return labelBind; + } + + public void setLabelBind(String labelBind) { + this.labelBind = labelBind; + } + + public String getMajorCategory() { + return majorCategory; + } + + public void setMajorCategory(String majorCategory) { + this.majorCategory = majorCategory; + } + + public String getMajorCategoryName() { + return majorCategoryName; + } + + public void setMajorCategoryName(String majorCategoryName) { + this.majorCategoryName = majorCategoryName; + } + + public String getManagerLevel() { + return managerLevel; + } + + public void setManagerLevel(String managerLevel) { + this.managerLevel = managerLevel; + } + + public String getManagerLevelName() { + return managerLevelName; + } + + public void setManagerLevelName(String managerLevelName) { + this.managerLevelName = managerLevelName; + } + + public String getManagerState() { + return managerState; + } + + public void setManagerState(String managerState) { + this.managerState = managerState; + } + + public String getManagerStateName() { + return managerStateName; + } + + public void setManagerStateName(String managerStateName) { + this.managerStateName = managerStateName; + } + + public String getManufacturer() { + return manufacturer; + } + + public void setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + } + + public String getManufacturerCountry() { + return manufacturerCountry; + } + + public void setManufacturerCountry(String manufacturerCountry) { + this.manufacturerCountry = manufacturerCountry; + } + + public String getManufacturingDate() { + return manufacturingDate; + } + + public void setManufacturingDate(String manufacturingDate) { + this.manufacturingDate = manufacturingDate; + } + + public String getManufacturingNo() { + return manufacturingNo; + } + + public void setManufacturingNo(String manufacturingNo) { + this.manufacturingNo = manufacturingNo; + } + + public String getMesureCycle() { + return mesureCycle; + } + + public void setMesureCycle(String mesureCycle) { + this.mesureCycle = mesureCycle; + } + + public String getMesureDate() { + return mesureDate; + } + + public void setMesureDate(String mesureDate) { + this.mesureDate = mesureDate; + } + + public String getMesureDept() { + return mesureDept; + } + + public void setMesureDept(String mesureDept) { + this.mesureDept = mesureDept; + } + + public String getMesureRange() { + return mesureRange; + } + + public void setMesureRange(String mesureRange) { + this.mesureRange = mesureRange; + } + + public String getMesureResult() { + return mesureResult; + } + + public void setMesureResult(String mesureResult) { + this.mesureResult = mesureResult; + } + + public String getMesureResultName() { + return mesureResultName; + } + + public void setMesureResultName(String mesureResultName) { + this.mesureResultName = mesureResultName; + } + + public String getMesureType() { + return mesureType; + } + + public void setMesureType(String mesureType) { + this.mesureType = mesureType; + } + + public String getMesureTypeName() { + return mesureTypeName; + } + + public void setMesureTypeName(String mesureTypeName) { + this.mesureTypeName = mesureTypeName; + } + + public String getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getOriginValue() { + return originValue; + } + + public void setOriginValue(String originValue) { + this.originValue = originValue; + } + + public String getOverallDimension() { + return overallDimension; + } + + public void setOverallDimension(String overallDimension) { + this.overallDimension = overallDimension; + } + + public String getPresentOriginValue() { + return presentOriginValue; + } + + public void setPresentOriginValue(String presentOriginValue) { + this.presentOriginValue = presentOriginValue; + } + + public String getPurpose() { + return purpose; + } + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getSinglePrice() { + return singlePrice; + } + + public void setSinglePrice(String singlePrice) { + this.singlePrice = singlePrice; + } + + public String getSupportStandardEquipmentName() { + return supportStandardEquipmentName; + } + + public void setSupportStandardEquipmentName(String supportStandardEquipmentName) { + this.supportStandardEquipmentName = supportStandardEquipmentName; + } + + public String getSupportStandardEquipmentNo() { + return supportStandardEquipmentNo; + } + + public void setSupportStandardEquipmentNo(String supportStandardEquipmentNo) { + this.supportStandardEquipmentNo = supportStandardEquipmentNo; + } + + public String getTechnicalLevel() { + return technicalLevel; + } + + public void setTechnicalLevel(String technicalLevel) { + this.technicalLevel = technicalLevel; + } + + public String getUncertainty() { + return uncertainty; + } + + public void setUncertainty(String uncertainty) { + this.uncertainty = uncertainty; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getUseDept() { + return useDept; + } + + public void setUseDept(String useDept) { + this.useDept = useDept; + } + + public String getUseDeptName() { + return useDeptName; + } + + public void setUseDeptName(String useDeptName) { + this.useDeptName = useDeptName; + } + + public String getUsePerson() { + return usePerson; + } + + public void setUsePerson(String usePerson) { + this.usePerson = usePerson; + } + + public String getUsePersonName() { + return usePersonName; + } + + public void setUsePersonName(String usePersonName) { + this.usePersonName = usePersonName; + } + + public String getValidDate() { + return validDate; + } + + public void setValidDate(String validDate) { + this.validDate = validDate; + } + + public int getVersion() { + return version; + } + + public void setVersion(int version) { + this.version = version; + } + + public String getWeight() { + return weight; + } + + public void setWeight(String weight) { + this.weight = weight; + } + + public static class FileListModel { + private String assetId; + private String createTime; + private String createUser; + private String fileName; + private String id; + private int isDel; + private String minioFileName; + private String remark; + private String updateTime; + + public String getAssetId() { + return assetId; + } + + public void setAssetId(String assetId) { + this.assetId = assetId; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getFileName() { + return fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getMinioFileName() { + return minioFileName; + } + + public void setMinioFileName(String minioFileName) { + this.minioFileName = minioFileName; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + } + } +} diff --git a/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java b/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java new file mode 100644 index 0000000..15fc128 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java @@ -0,0 +1,697 @@ +package com.casic.xz.meterage.model; + +import java.util.List; + +public class EquipmentListModel { + + private int code; + private DataModel data; + private String message; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataModel getData() { + return data; + } + + public void setData(DataModel data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public static class DataModel { + private List rows; + private int total; + + public List getRows() { + return rows; + } + + public void setRows(List rows) { + this.rows = rows; + } + + public int getTotal() { + return total; + } + + public void setTotal(int total) { + this.total = total; + } + + public static class RowsModel { + private String abc; + private String abcName; + private String assetNo; + private String assetSource; + private String assetType; + private String assetTypeName; + private String attribute; + private String capitalSource; + private String capitalSourceName; + private String cardEstablishmentDate; + private String createTime; + private String createUser; + private String depreciationMethod; + private String depreciationMethodName; + private String depreciationPeriod; + private String enableDate; + private String equipmentCategory; + private String equipmentCategoryName; + private String equipmentName; + private String equipmentNo; + private String equipmentSpecifications; + private String equipmentType; + private String equipmentTypeName; + private String fileList; + private String id; + private String installIncidentalExpenses; + private String installPlace; + private String intactState; + private String isCalibrationTestEquipment; + private int isDel; + private String isFixedAssets; + private String isMeasureAccount; + private String isStandardSupportEquipment; + private String labelBind; + private String majorCategory; + private String majorCategoryName; + private String managerLevel; + private String managerLevelName; + private String managerState; + private String managerStateName; + private String manufacturer; + private String manufacturerCountry; + private String manufacturingDate; + private String manufacturingNo; + private String mesureCycle; + private String mesureDate; + private String mesureDept; + private String mesureRange; + private String mesureResult; + private String mesureResultName; + private String mesureType; + private String mesureTypeName; + private String modelNo; + private String originValue; + private String overallDimension; + private String presentOriginValue; + private String purpose; + private String remark; + private String singlePrice; + private String supportStandardEquipmentName; + private String supportStandardEquipmentNo; + private String technicalLevel; + private String uncertainty; + private String updateTime; + private String useDept; + private String useDeptName; + private String usePerson; + private String usePersonName; + private String validDate; + private int version; + private String weight; + + public String getAbc() { + return abc; + } + + public void setAbc(String abc) { + this.abc = abc; + } + + public String getAbcName() { + return abcName; + } + + public void setAbcName(String abcName) { + this.abcName = abcName; + } + + public String getAssetNo() { + return assetNo; + } + + public void setAssetNo(String assetNo) { + this.assetNo = assetNo; + } + + public String getAssetSource() { + return assetSource; + } + + public void setAssetSource(String assetSource) { + this.assetSource = assetSource; + } + + public String getAssetType() { + return assetType; + } + + public void setAssetType(String assetType) { + this.assetType = assetType; + } + + public String getAssetTypeName() { + return assetTypeName; + } + + public void setAssetTypeName(String assetTypeName) { + this.assetTypeName = assetTypeName; + } + + public String getAttribute() { + return attribute; + } + + public void setAttribute(String attribute) { + this.attribute = attribute; + } + + public String getCapitalSource() { + return capitalSource; + } + + public void setCapitalSource(String capitalSource) { + this.capitalSource = capitalSource; + } + + public String getCapitalSourceName() { + return capitalSourceName; + } + + public void setCapitalSourceName(String capitalSourceName) { + this.capitalSourceName = capitalSourceName; + } + + public String getCardEstablishmentDate() { + return cardEstablishmentDate; + } + + public void setCardEstablishmentDate(String cardEstablishmentDate) { + this.cardEstablishmentDate = cardEstablishmentDate; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getDepreciationMethod() { + return depreciationMethod; + } + + public void setDepreciationMethod(String depreciationMethod) { + this.depreciationMethod = depreciationMethod; + } + + public String getDepreciationMethodName() { + return depreciationMethodName; + } + + public void setDepreciationMethodName(String depreciationMethodName) { + this.depreciationMethodName = depreciationMethodName; + } + + public String getDepreciationPeriod() { + return depreciationPeriod; + } + + public void setDepreciationPeriod(String depreciationPeriod) { + this.depreciationPeriod = depreciationPeriod; + } + + public String getEnableDate() { + return enableDate; + } + + public void setEnableDate(String enableDate) { + this.enableDate = enableDate; + } + + public String getEquipmentCategory() { + return equipmentCategory; + } + + public void setEquipmentCategory(String equipmentCategory) { + this.equipmentCategory = equipmentCategory; + } + + public String getEquipmentCategoryName() { + return equipmentCategoryName; + } + + public void setEquipmentCategoryName(String equipmentCategoryName) { + this.equipmentCategoryName = equipmentCategoryName; + } + + public String getEquipmentName() { + return equipmentName; + } + + public void setEquipmentName(String equipmentName) { + this.equipmentName = equipmentName; + } + + public String getEquipmentNo() { + return equipmentNo; + } + + public void setEquipmentNo(String equipmentNo) { + this.equipmentNo = equipmentNo; + } + + public String getEquipmentSpecifications() { + return equipmentSpecifications; + } + + public void setEquipmentSpecifications(String equipmentSpecifications) { + this.equipmentSpecifications = equipmentSpecifications; + } + + public String getEquipmentType() { + return equipmentType; + } + + public void setEquipmentType(String equipmentType) { + this.equipmentType = equipmentType; + } + + public String getEquipmentTypeName() { + return equipmentTypeName; + } + + public void setEquipmentTypeName(String equipmentTypeName) { + this.equipmentTypeName = equipmentTypeName; + } + + public String getFileList() { + return fileList; + } + + public void setFileList(String fileList) { + this.fileList = fileList; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getInstallIncidentalExpenses() { + return installIncidentalExpenses; + } + + public void setInstallIncidentalExpenses(String installIncidentalExpenses) { + this.installIncidentalExpenses = installIncidentalExpenses; + } + + public String getInstallPlace() { + return installPlace; + } + + public void setInstallPlace(String installPlace) { + this.installPlace = installPlace; + } + + public String getIntactState() { + return intactState; + } + + public void setIntactState(String intactState) { + this.intactState = intactState; + } + + public String getIsCalibrationTestEquipment() { + return isCalibrationTestEquipment; + } + + public void setIsCalibrationTestEquipment(String isCalibrationTestEquipment) { + this.isCalibrationTestEquipment = isCalibrationTestEquipment; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getIsFixedAssets() { + return isFixedAssets; + } + + public void setIsFixedAssets(String isFixedAssets) { + this.isFixedAssets = isFixedAssets; + } + + public String getIsMeasureAccount() { + return isMeasureAccount; + } + + public void setIsMeasureAccount(String isMeasureAccount) { + this.isMeasureAccount = isMeasureAccount; + } + + public String getIsStandardSupportEquipment() { + return isStandardSupportEquipment; + } + + public void setIsStandardSupportEquipment(String isStandardSupportEquipment) { + this.isStandardSupportEquipment = isStandardSupportEquipment; + } + + public String getLabelBind() { + return labelBind; + } + + public void setLabelBind(String labelBind) { + this.labelBind = labelBind; + } + + public String getMajorCategory() { + return majorCategory; + } + + public void setMajorCategory(String majorCategory) { + this.majorCategory = majorCategory; + } + + public String getMajorCategoryName() { + return majorCategoryName; + } + + public void setMajorCategoryName(String majorCategoryName) { + this.majorCategoryName = majorCategoryName; + } + + public String getManagerLevel() { + return managerLevel; + } + + public void setManagerLevel(String managerLevel) { + this.managerLevel = managerLevel; + } + + public String getManagerLevelName() { + return managerLevelName; + } + + public void setManagerLevelName(String managerLevelName) { + this.managerLevelName = managerLevelName; + } + + public String getManagerState() { + return managerState; + } + + public void setManagerState(String managerState) { + this.managerState = managerState; + } + + public String getManagerStateName() { + return managerStateName; + } + + public void setManagerStateName(String managerStateName) { + this.managerStateName = managerStateName; + } + + public String getManufacturer() { + return manufacturer; + } + + public void setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + } + + public String getManufacturerCountry() { + return manufacturerCountry; + } + + public void setManufacturerCountry(String manufacturerCountry) { + this.manufacturerCountry = manufacturerCountry; + } + + public String getManufacturingDate() { + return manufacturingDate; + } + + public void setManufacturingDate(String manufacturingDate) { + this.manufacturingDate = manufacturingDate; + } + + public String getManufacturingNo() { + return manufacturingNo; + } + + public void setManufacturingNo(String manufacturingNo) { + this.manufacturingNo = manufacturingNo; + } + + public String getMesureCycle() { + return mesureCycle; + } + + public void setMesureCycle(String mesureCycle) { + this.mesureCycle = mesureCycle; + } + + public String getMesureDate() { + return mesureDate; + } + + public void setMesureDate(String mesureDate) { + this.mesureDate = mesureDate; + } + + public String getMesureDept() { + return mesureDept; + } + + public void setMesureDept(String mesureDept) { + this.mesureDept = mesureDept; + } + + public String getMesureRange() { + return mesureRange; + } + + public void setMesureRange(String mesureRange) { + this.mesureRange = mesureRange; + } + + public String getMesureResult() { + return mesureResult; + } + + public void setMesureResult(String mesureResult) { + this.mesureResult = mesureResult; + } + + public String getMesureResultName() { + return mesureResultName; + } + + public void setMesureResultName(String mesureResultName) { + this.mesureResultName = mesureResultName; + } + + public String getMesureType() { + return mesureType; + } + + public void setMesureType(String mesureType) { + this.mesureType = mesureType; + } + + public String getMesureTypeName() { + return mesureTypeName; + } + + public void setMesureTypeName(String mesureTypeName) { + this.mesureTypeName = mesureTypeName; + } + + public String getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getOriginValue() { + return originValue; + } + + public void setOriginValue(String originValue) { + this.originValue = originValue; + } + + public String getOverallDimension() { + return overallDimension; + } + + public void setOverallDimension(String overallDimension) { + this.overallDimension = overallDimension; + } + + public String getPresentOriginValue() { + return presentOriginValue; + } + + public void setPresentOriginValue(String presentOriginValue) { + this.presentOriginValue = presentOriginValue; + } + + public String getPurpose() { + return purpose; + } + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getSinglePrice() { + return singlePrice; + } + + public void setSinglePrice(String singlePrice) { + this.singlePrice = singlePrice; + } + + public String getSupportStandardEquipmentName() { + return supportStandardEquipmentName; + } + + public void setSupportStandardEquipmentName(String supportStandardEquipmentName) { + this.supportStandardEquipmentName = supportStandardEquipmentName; + } + + public String getSupportStandardEquipmentNo() { + return supportStandardEquipmentNo; + } + + public void setSupportStandardEquipmentNo(String supportStandardEquipmentNo) { + this.supportStandardEquipmentNo = supportStandardEquipmentNo; + } + + public String getTechnicalLevel() { + return technicalLevel; + } + + public void setTechnicalLevel(String technicalLevel) { + this.technicalLevel = technicalLevel; + } + + public String getUncertainty() { + return uncertainty; + } + + public void setUncertainty(String uncertainty) { + this.uncertainty = uncertainty; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getUseDept() { + return useDept; + } + + public void setUseDept(String useDept) { + this.useDept = useDept; + } + + public String getUseDeptName() { + return useDeptName; + } + + public void setUseDeptName(String useDeptName) { + this.useDeptName = useDeptName; + } + + public String getUsePerson() { + return usePerson; + } + + public void setUsePerson(String usePerson) { + this.usePerson = usePerson; + } + + public String getUsePersonName() { + return usePersonName; + } + + public void setUsePersonName(String usePersonName) { + this.usePersonName = usePersonName; + } + + public String getValidDate() { + return validDate; + } + + public void setValidDate(String validDate) { + this.validDate = validDate; + } + + public int getVersion() { + return version; + } + + public void setVersion(int version) { + this.version = version; + } + + public String getWeight() { + return weight; + } + + public void setWeight(String weight) { + this.weight = weight; + } + } + } +} diff --git a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt index a3f514f..46e5eef 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt @@ -35,4 +35,24 @@ @QueryMap limit: Map, @QueryMap offset: Map ): String + + /** + * 获取设备列表 + */ + @POST("/meter/assets/listPage") + suspend fun getEquipmentList( + @Header("token") token: String, + @Body requestBody: RequestBody, + @QueryMap limit: Map, + @QueryMap offset: Map + ): String + + /** + * 获取设备详情 + */ + @POST("/meter/assets/detail") + suspend fun getEquipmentDetail( + @Header("token") token: String, + @Body requestBody: RequestBody + ): String } \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt index 444a872..386a1d8 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt @@ -6,8 +6,10 @@ import com.pengxh.kt.lite.utils.SaveKeyValues import okhttp3.MediaType.Companion.toMediaType import okhttp3.RequestBody.Companion.toRequestBody +import org.json.JSONArray import org.json.JSONObject + object RetrofitServiceManager { private val api by lazy { @@ -73,4 +75,71 @@ offsetMap["offset"] = offset return api.getNoticeList(AuthenticationHelper.token!!, requestBody, limitMap, offsetMap) } + + /** + * 获取设备列表 + */ + suspend fun getEquipmentList( + equipmentNo: String, + equipmentName: String, + mesureType: String, + managerState: String, + useDept: String, + assetType: String, + equipmentCategory: String, + isCalibrationTestEquipment: String, + isMeasureAccount: String, + isStandardSupportEquipment: String, + isFixedAssets: String, + validStartDate: String, + validEndDate: String, + abc: String, + ids: Array, + offset: Int + ): String { + val paramObject = JSONObject() + paramObject.put("equipmentNo", equipmentNo) + paramObject.put("equipmentName", equipmentName) + paramObject.put("mesureType", mesureType) + paramObject.put("managerState", managerState) + paramObject.put("useDept", useDept) + paramObject.put("assetType", assetType) + paramObject.put("equipmentCategory", equipmentCategory) + paramObject.put("isCalibrationTestEquipment", isCalibrationTestEquipment) + paramObject.put("isMeasureAccount", isMeasureAccount) + paramObject.put("isStandardSupportEquipment", isStandardSupportEquipment) + paramObject.put("isFixedAssets", isFixedAssets) + paramObject.put("validStartDate", validStartDate) + paramObject.put("validEndDate", validEndDate) + paramObject.put("abc", abc) + + val jsonArray = JSONArray() + ids.forEach { + jsonArray.put(it) + } + paramObject.put("ids", jsonArray) + + val requestBody = paramObject.toString().toRequestBody( + "application/json;charset=UTF-8".toMediaType() + ) + + val limitMap = HashMap() + limitMap["limit"] = LocaleConstant.PAGE_LIMIT + + val offsetMap = HashMap() + offsetMap["offset"] = offset + return api.getEquipmentList(AuthenticationHelper.token!!, requestBody, limitMap, offsetMap) + } + + /** + * 获取设备详情 + */ + suspend fun getEquipmentDetail(id: String): String { + val paramObject = JSONObject() + paramObject.put("id", id) + val requestBody = paramObject.toString().toRequestBody( + "application/json;charset=UTF-8".toMediaType() + ) + return api.getEquipmentDetail(AuthenticationHelper.token!!, requestBody) + } } \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt deleted file mode 100644 index a5bb60b..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt +++ /dev/null @@ -1,104 +0,0 @@ -package com.casic.xz.meterage.view - -import android.annotation.SuppressLint -import android.graphics.Paint -import androidx.lifecycle.ViewModelProvider -import com.casic.xz.meterage.R -import com.casic.xz.meterage.extensions.combineImagePath -import com.casic.xz.meterage.extensions.formatTextFromHtml -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.vm.NoticeViewModel -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.extensions.convertColor -import com.pengxh.kt.lite.extensions.navigatePageTo -import com.pengxh.kt.lite.extensions.obtainScreenWidth -import com.pengxh.kt.lite.extensions.show -import com.pengxh.kt.lite.utils.Constant -import kotlinx.android.synthetic.main.activity_notice_detail.* -import kotlinx.android.synthetic.main.include_base_title.* -import java.util.* - -@SuppressLint("SetTextI18n") -class NoticeDetailActivity : KotlinBaseActivity() { - - private lateinit var noticeViewModel: NoticeViewModel - - override fun initData() { - leftBackView.setOnClickListener { finish() } - titleView.text = "通知公告" - - val args = intent.getStringArrayListExtra(Constant.INTENT_PARAM)!! - - noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] - noticeViewModel.getNoticeList(args[0], args[1], args[2], "", "", 1) - noticeViewModel.noticeResult.observe(this, { - if (it.code == 200) { - val dataRow = it.data?.rows!![0] - - noticeDateView.text = dataRow.noticeTime - noticePublisherView.text = "发布人 ${dataRow.noticePublisher}" - noticeCompanyView.text = "发布单位 ${dataRow.noticeCompany}" - - noticeNoView.text = dataRow.noticeNo - noticeTitleView.text = dataRow.noticeTitle - noticeSketchView.text = dataRow.noticeSketch - - dataRow.noticeContent.formatTextFromHtml( - this, noticeContentView, obtainScreenWidth() - ) - - if (dataRow.minioFileName.isNullOrBlank()) { - minioFileView.text = "暂无附件" - } else { - val minioFileName = dataRow.minioFileName - - minioFileView.text = minioFileName - val textPaint = minioFileView.paint - textPaint.flags = Paint.UNDERLINE_TEXT_FLAG - textPaint.isAntiAlias = true - minioFileView.setTextColor(R.color.themeColor.convertColor(this)) - - minioFileView.setOnClickListener { - //查看附件 - if (minioFileName.endsWith("pdf")) { - navigatePageTo(minioFileName) - } else if ( - minioFileName.endsWith("doc") || - minioFileName.endsWith("docx") - ) { - navigatePageTo(minioFileName) - } else if (minioFileName.endsWith("txt")) { - navigatePageTo(minioFileName) - } else if ( - minioFileName.endsWith("png") || - minioFileName.endsWith("jpeg") || - minioFileName.endsWith("jpg") - ) { - val urls = ArrayList() - urls.add(minioFileName.combineImagePath()) - navigatePageTo(0, urls) - } else { - "文件类型未知,无法打开附件".show(this) - } - } - } - } - }) - } - - override fun initEvent() { - - } - - override fun initLayoutView(): Int = R.layout.activity_notice_detail - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/NoticeListActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/NoticeListActivity.kt deleted file mode 100644 index 15f6a16..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/NoticeListActivity.kt +++ /dev/null @@ -1,180 +0,0 @@ -package com.casic.xz.meterage.view - -import android.os.Handler -import android.util.Log -import android.view.View -import androidx.lifecycle.ViewModelProvider -import com.casic.xz.meterage.R -import com.casic.xz.meterage.adapter.NoticeListAdapter -import com.casic.xz.meterage.extensions.addAll -import com.casic.xz.meterage.extensions.combineFilePath -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.extensions.showEmptyPage -import com.casic.xz.meterage.model.NoticeListModel -import com.casic.xz.meterage.vm.NoticeViewModel -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.extensions.navigatePageTo -import com.pengxh.kt.lite.extensions.show -import com.pengxh.kt.lite.utils.WeakReferenceHandler -import com.pengxh.kt.lite.widget.dialog.AlertControlDialog -import kotlinx.android.synthetic.main.activity_notice_list.* -import kotlinx.android.synthetic.main.include_empty_view.* - -class NoticeListActivity : KotlinBaseActivity() { - - private lateinit var weakReferenceHandler: WeakReferenceHandler - private lateinit var noticeViewModel: NoticeViewModel - private lateinit var noticeListAdapter: NoticeListAdapter - private var dataBeans: MutableList = ArrayList() - private var pageIndex = 1 - private var isRefresh = false - private var isLoadMore = false - - override fun initData() { - weakReferenceHandler = WeakReferenceHandler(callback) - noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] - noticeViewModel.noticeResult.observe(this, { - if (it.code == 200) { - val dataRows = it.data?.rows!! -// countBadeNumber(dataRows) - when { - isRefresh -> { - dataBeans.clear() - dataBeans = dataRows - noticeLayout.finishRefresh() - isRefresh = false - } - isLoadMore -> { - if (dataRows.size == 0) { - "到底了,别拉了".show(this) - } - dataBeans.addAll(dataRows) - noticeLayout.finishLoadMore() - isLoadMore = false - } - else -> { - dataBeans = dataRows - } - } - weakReferenceHandler.sendEmptyMessage(2023013101) - } - }) - } - - override fun initEvent() { - leftBackView.setOnClickListener { finish() } - rightOperateView.setOnClickListener { - AlertControlDialog.Builder() - .setContext(this) - .setTitle("提示") - .setMessage("确定将所有未读消息标为已读?") - .setNegativeButton("取消") - .setPositiveButton("确定") - .setOnDialogButtonClickListener(object : - AlertControlDialog.OnDialogButtonClickListener { - override fun onCancelClick() { - - } - - override fun onConfirmClick() { - //TODO 设置为已读 - } - }).build().show() - } - - if (hasNoticePermission()) { - openSystemNoticeLayout.visibility = View.GONE - openSystemNoticeLayout.visibility = View.GONE - } else { - openSystemNoticeLayout.setOnClickListener { - - } - - - closeLayoutView.setOnClickListener { - openSystemNoticeLayout.visibility = View.GONE - } - } - - noticeLayout.setOnRefreshListener { - isRefresh = true - //刷新之后页码重置 - pageIndex = 1 - getNoticeListByPage() - } - - noticeLayout.setOnLoadMoreListener { - isLoadMore = true - pageIndex++ - getNoticeListByPage() - } - } - - override fun onResume() { - super.onResume() - pageIndex = 1 - getNoticeListByPage() - } - - private fun getNoticeListByPage() { - noticeViewModel.getNoticeList("", "", "", "", "", pageIndex) - } - - private val callback = Handler.Callback { - when (it.what) { - 2023013101 -> { - if (isRefresh || isLoadMore) { - noticeListAdapter.notifyDataSetChanged() - } else { - if (dataBeans.size == 0) { - emptyView!!.showEmptyPage("没有任何消息") { - pageIndex = 1 - getNoticeListByPage() - } - } else { - emptyView!!.hide() - noticeListAdapter = NoticeListAdapter(this, dataBeans) - noticeRecyclerView.adapter = noticeListAdapter - noticeListAdapter.setOnItemClickListener(object : - NoticeListAdapter.OnItemClickListener { - override fun onItemClicked(position: Int) { - val rowsModel = dataBeans[position] - val allArgs = addAll( - rowsModel.noticeNo, - rowsModel.noticeTitle, - rowsModel.noticePublisher, - "", - "" - ) - Log.d( - "Casic", - "NoticeListActivity => onItemClicked: ${rowsModel.minioFileName.combineFilePath()}" - ) - navigatePageTo(allArgs) - } - }) - } - } - } - } - true - } - - //TODO 判断是否开启通知权限 - private fun hasNoticePermission(): Boolean { - - return false - } - - override fun initLayoutView(): Int = R.layout.activity_notice_list - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/PreviewDocumentActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/PreviewDocumentActivity.kt deleted file mode 100644 index e233ddc..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/PreviewDocumentActivity.kt +++ /dev/null @@ -1,24 +0,0 @@ -package com.casic.xz.meterage.view - -import com.casic.xz.meterage.R -import com.pengxh.kt.lite.base.KotlinBaseActivity - -class PreviewDocumentActivity : KotlinBaseActivity() { - override fun initData() { - - } - - override fun initEvent() { - - } - - override fun initLayoutView(): Int = R.layout.activity_preview_doc - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/PreviewPdfActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/PreviewPdfActivity.kt deleted file mode 100644 index 39f8ac2..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/PreviewPdfActivity.kt +++ /dev/null @@ -1,62 +0,0 @@ -package com.casic.xz.meterage.view - -import com.casic.xz.meterage.R -import com.casic.xz.meterage.extensions.combineFilePath -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.utils.LoadingDialogHub -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.callback.OnDownloadListener -import com.pengxh.kt.lite.extensions.createDownloadFileDir -import com.pengxh.kt.lite.extensions.downloadFile -import com.pengxh.kt.lite.utils.Constant -import kotlinx.android.synthetic.main.activity_preview_pdf.* -import kotlinx.android.synthetic.main.include_base_title.* -import java.io.File -import java.io.FileInputStream - - -class PreviewPdfActivity : KotlinBaseActivity() { - - override fun initData() { - val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! - titleView.text = minioFileName - - val url = minioFileName.combineFilePath() - url.downloadFile(createDownloadFileDir().toString(), - object : OnDownloadListener { - override fun onDownloadStart(totalBytes: Long) { - runOnUiThread { - LoadingDialogHub.show(this@PreviewPdfActivity, "附件加载中") - } - } - - override fun onProgressChanged(currentBytes: Long) { - - } - - override fun onDownloadEnd(file: File?) { - runOnUiThread { - LoadingDialogHub.dismiss() - } - val inputStream = FileInputStream(file) - pdfView.fromStream(inputStream).load() - } - }) - } - - override fun initEvent() { - leftBackView.setOnClickListener { finish() } - } - - override fun initLayoutView(): Int = R.layout.activity_preview_pdf - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/PreviewTextActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/PreviewTextActivity.kt deleted file mode 100644 index d634ca3..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/PreviewTextActivity.kt +++ /dev/null @@ -1,60 +0,0 @@ -package com.casic.xz.meterage.view - -import com.casic.xz.meterage.R -import com.casic.xz.meterage.extensions.combineFilePath -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.utils.LoadingDialogHub -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.callback.OnDownloadListener -import com.pengxh.kt.lite.extensions.createDownloadFileDir -import com.pengxh.kt.lite.extensions.downloadFile -import com.pengxh.kt.lite.extensions.read -import com.pengxh.kt.lite.utils.Constant -import kotlinx.android.synthetic.main.activity_preview_txt.* -import kotlinx.android.synthetic.main.include_base_title.* -import java.io.File - -class PreviewTextActivity : KotlinBaseActivity() { - - override fun initData() { - val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! - titleView.text = minioFileName - - val url = minioFileName.combineFilePath() - url.downloadFile(createDownloadFileDir().toString(), - object : OnDownloadListener { - override fun onDownloadStart(totalBytes: Long) { - runOnUiThread { - LoadingDialogHub.show(this@PreviewTextActivity, "附件加载中") - } - } - - override fun onProgressChanged(currentBytes: Long) { - - } - - override fun onDownloadEnd(file: File?) { - runOnUiThread { - LoadingDialogHub.dismiss() - textView.text = file?.read() - } - } - }) - } - - override fun initEvent() { - leftBackView.setOnClickListener { finish() } - } - - override fun initLayoutView(): Int = R.layout.activity_preview_txt - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentActivity.kt new file mode 100644 index 0000000..35ca098 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentActivity.kt @@ -0,0 +1,158 @@ +package com.casic.xz.meterage.view.home + +import android.os.Handler +import androidx.lifecycle.ViewModelProvider +import androidx.recyclerview.widget.DividerItemDecoration +import com.casic.xz.meterage.R +import com.casic.xz.meterage.adapter.EquipmentListAdapter +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.extensions.showEmptyPage +import com.casic.xz.meterage.model.EquipmentListModel +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.casic.xz.meterage.vm.EquipmentViewModel +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.extensions.navigatePageTo +import com.pengxh.kt.lite.extensions.show +import com.pengxh.kt.lite.utils.WeakReferenceHandler +import com.pengxh.kt.lite.vm.LoadState +import kotlinx.android.synthetic.main.activity_equipment.* +import kotlinx.android.synthetic.main.include_empty_view.* +import kotlinx.android.synthetic.main.include_search_title.* + +class EquipmentActivity : KotlinBaseActivity() { + + private lateinit var weakReferenceHandler: WeakReferenceHandler + private lateinit var equipmentViewModel: EquipmentViewModel + private lateinit var equipmentListAdapter: EquipmentListAdapter + private var dataBeans: MutableList = ArrayList() + private var pageIndex = 1 + private var isRefresh = false + private var isLoadMore = false + + override fun initData() { + weakReferenceHandler = WeakReferenceHandler(callback) + equipmentViewModel = ViewModelProvider(this)[EquipmentViewModel::class.java] + equipmentViewModel.equipmentResult.observe(this, { + if (it.code == 200) { + val dataRows = it.data?.rows!! + when { + isRefresh -> { + dataBeans.clear() + dataBeans = dataRows + equipmentLayout.finishRefresh() + isRefresh = false + } + isLoadMore -> { + if (dataRows.size == 0) { + "到底了,别拉了".show(this) + } + dataBeans.addAll(dataRows) + equipmentLayout.finishLoadMore() + isLoadMore = false + } + else -> { + dataBeans = dataRows + } + } + weakReferenceHandler.sendEmptyMessage(2023020801) + } + }) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + rightOperateView.setOnClickListener { + + } + + equipmentLayout.setOnRefreshListener { + isRefresh = true + //刷新之后页码重置 + pageIndex = 1 + getEquipmentListByPage() + } + + equipmentLayout.setOnLoadMoreListener { + isLoadMore = true + pageIndex++ + getEquipmentListByPage() + } + } + + override fun initLayoutView(): Int = R.layout.activity_equipment + + override fun observeRequestState() { + equipmentViewModel.loadState.observe(this, { + when (it) { + LoadState.Loading -> LoadingDialogHub.show(this, "数据加载中...") + else -> LoadingDialogHub.dismiss() + } + }) + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + titleView.text = "仪器设备" + } + + override fun onResume() { + super.onResume() + pageIndex = 1 + getEquipmentListByPage() + } + + private fun getEquipmentListByPage() { + equipmentViewModel.getEquipmentList( + "", + "", + "", + "", + "", + "1", + "", + "", + "", + "", + "", + "", + "", + "", + arrayOf(), + pageIndex + ) + } + + private val callback = Handler.Callback { + when (it.what) { + 2023020801 -> { + if (isRefresh || isLoadMore) { + equipmentListAdapter.notifyDataSetChanged() + } else { + if (dataBeans.size == 0) { + emptyView!!.showEmptyPage("无设备") { + pageIndex = 1 + getEquipmentListByPage() + } + } else { + emptyView!!.hide() + equipmentListAdapter = EquipmentListAdapter(this, dataBeans) + equipmentRecyclerView.addItemDecoration( + DividerItemDecoration(this, DividerItemDecoration.VERTICAL) + ) + equipmentRecyclerView.adapter = equipmentListAdapter + equipmentListAdapter.setOnItemClickListener(object : + EquipmentListAdapter.OnItemClickListener { + override fun onItemClicked(position: Int) { + val rowsModel = dataBeans[position] + navigatePageTo(rowsModel.id) + } + }) + } + } + } + } + true + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentDetailActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentDetailActivity.kt new file mode 100644 index 0000000..7dee13c --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentDetailActivity.kt @@ -0,0 +1,53 @@ +package com.casic.xz.meterage.view.home + +import androidx.fragment.app.Fragment +import com.casic.xz.meterage.R +import com.casic.xz.meterage.adapter.SubViewPagerAdapter +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.fragment.equipment.* +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.utils.Constant +import kotlinx.android.synthetic.main.activity_equipment.rootView +import kotlinx.android.synthetic.main.activity_equipment_detail.* +import kotlinx.android.synthetic.main.include_base_title.* + +class EquipmentDetailActivity : KotlinBaseActivity() { + + private var fragmentPages: ArrayList = ArrayList() + + override fun initData() { + val equipmentId = intent.getStringExtra(Constant.INTENT_PARAM)!! + + fragmentPages.add(BasicInformationFragment(equipmentId)) + fragmentPages.add(InspectionRecordFragment()) + fragmentPages.add(ChangeRecordFragment()) + fragmentPages.add(UsageRecordFragment()) + fragmentPages.add(CertificateFragment()) + + val equipmentPageTitles = arrayOf("基础信息", "周检记录", "状态变更记录", "使用记录", "检定证书") + + equipmentViewPager.adapter = SubViewPagerAdapter( + supportFragmentManager, fragmentPages, equipmentPageTitles + ) + equipmentViewPager.offscreenPageLimit = fragmentPages.size + //绑定 + topTabLayout.setupWithViewPager(equipmentViewPager) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + } + + override fun initLayoutView(): Int = R.layout.activity_equipment_detail + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + titleView.text = "仪器设备" + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeDetailActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeDetailActivity.kt new file mode 100644 index 0000000..6fe0022 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeDetailActivity.kt @@ -0,0 +1,105 @@ +package com.casic.xz.meterage.view.notice + +import android.annotation.SuppressLint +import android.graphics.Paint +import androidx.lifecycle.ViewModelProvider +import com.casic.xz.meterage.R +import com.casic.xz.meterage.extensions.combineImagePath +import com.casic.xz.meterage.extensions.formatTextFromHtml +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.view.BigImageActivity +import com.casic.xz.meterage.vm.NoticeViewModel +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.extensions.convertColor +import com.pengxh.kt.lite.extensions.navigatePageTo +import com.pengxh.kt.lite.extensions.obtainScreenWidth +import com.pengxh.kt.lite.extensions.show +import com.pengxh.kt.lite.utils.Constant +import kotlinx.android.synthetic.main.activity_notice_detail.* +import kotlinx.android.synthetic.main.include_base_title.* +import java.util.* + +@SuppressLint("SetTextI18n") +class NoticeDetailActivity : KotlinBaseActivity() { + + private lateinit var noticeViewModel: NoticeViewModel + + override fun initData() { + leftBackView.setOnClickListener { finish() } + titleView.text = "通知公告" + + val args = intent.getStringArrayListExtra(Constant.INTENT_PARAM)!! + + noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] + noticeViewModel.getNoticeList(args[0], args[1], args[2], "", "", 1) + noticeViewModel.noticeResult.observe(this, { + if (it.code == 200) { + val dataRow = it.data?.rows!![0] + + noticeDateView.text = dataRow.noticeTime + noticePublisherView.text = "发布人 ${dataRow.noticePublisher}" + noticeCompanyView.text = "发布单位 ${dataRow.noticeCompany}" + + noticeNoView.text = dataRow.noticeNo + noticeTitleView.text = dataRow.noticeTitle + noticeSketchView.text = dataRow.noticeSketch + + dataRow.noticeContent.formatTextFromHtml( + this, noticeContentView, obtainScreenWidth() + ) + + if (dataRow.minioFileName.isNullOrBlank()) { + minioFileView.text = "暂无附件" + } else { + val minioFileName = dataRow.minioFileName + + minioFileView.text = minioFileName + val textPaint = minioFileView.paint + textPaint.flags = Paint.UNDERLINE_TEXT_FLAG + textPaint.isAntiAlias = true + minioFileView.setTextColor(R.color.themeColor.convertColor(this)) + + minioFileView.setOnClickListener { + //查看附件 + if (minioFileName.endsWith("pdf")) { + navigatePageTo(minioFileName) + } else if ( + minioFileName.endsWith("doc") || + minioFileName.endsWith("docx") + ) { + navigatePageTo(minioFileName) + } else if (minioFileName.endsWith("txt")) { + navigatePageTo(minioFileName) + } else if ( + minioFileName.endsWith("png") || + minioFileName.endsWith("jpeg") || + minioFileName.endsWith("jpg") + ) { + val urls = ArrayList() + urls.add(minioFileName.combineImagePath()) + navigatePageTo(0, urls) + } else { + "文件类型未知,无法打开附件".show(this) + } + } + } + } + }) + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.activity_notice_detail + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeListActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeListActivity.kt new file mode 100644 index 0000000..31c0490 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeListActivity.kt @@ -0,0 +1,180 @@ +package com.casic.xz.meterage.view.notice + +import android.os.Handler +import android.util.Log +import android.view.View +import androidx.lifecycle.ViewModelProvider +import com.casic.xz.meterage.R +import com.casic.xz.meterage.adapter.NoticeListAdapter +import com.casic.xz.meterage.extensions.addAll +import com.casic.xz.meterage.extensions.combineFilePath +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.extensions.showEmptyPage +import com.casic.xz.meterage.model.NoticeListModel +import com.casic.xz.meterage.vm.NoticeViewModel +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.extensions.navigatePageTo +import com.pengxh.kt.lite.extensions.show +import com.pengxh.kt.lite.utils.WeakReferenceHandler +import com.pengxh.kt.lite.widget.dialog.AlertControlDialog +import kotlinx.android.synthetic.main.activity_notice_list.* +import kotlinx.android.synthetic.main.include_empty_view.* + +class NoticeListActivity : KotlinBaseActivity() { + + private lateinit var weakReferenceHandler: WeakReferenceHandler + private lateinit var noticeViewModel: NoticeViewModel + private lateinit var noticeListAdapter: NoticeListAdapter + private var dataBeans: MutableList = ArrayList() + private var pageIndex = 1 + private var isRefresh = false + private var isLoadMore = false + + override fun initData() { + weakReferenceHandler = WeakReferenceHandler(callback) + noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] + noticeViewModel.noticeResult.observe(this, { + if (it.code == 200) { + val dataRows = it.data?.rows!! +// countBadeNumber(dataRows) + when { + isRefresh -> { + dataBeans.clear() + dataBeans = dataRows + noticeLayout.finishRefresh() + isRefresh = false + } + isLoadMore -> { + if (dataRows.size == 0) { + "到底了,别拉了".show(this) + } + dataBeans.addAll(dataRows) + noticeLayout.finishLoadMore() + isLoadMore = false + } + else -> { + dataBeans = dataRows + } + } + weakReferenceHandler.sendEmptyMessage(2023013101) + } + }) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + rightOperateView.setOnClickListener { + AlertControlDialog.Builder() + .setContext(this) + .setTitle("提示") + .setMessage("确定将所有未读消息标为已读?") + .setNegativeButton("取消") + .setPositiveButton("确定") + .setOnDialogButtonClickListener(object : + AlertControlDialog.OnDialogButtonClickListener { + override fun onCancelClick() { + + } + + override fun onConfirmClick() { + //TODO 设置为已读 + } + }).build().show() + } + + if (hasNoticePermission()) { + openSystemNoticeLayout.visibility = View.GONE + openSystemNoticeLayout.visibility = View.GONE + } else { + openSystemNoticeLayout.setOnClickListener { + + } + + + closeLayoutView.setOnClickListener { + openSystemNoticeLayout.visibility = View.GONE + } + } + + noticeLayout.setOnRefreshListener { + isRefresh = true + //刷新之后页码重置 + pageIndex = 1 + getNoticeListByPage() + } + + noticeLayout.setOnLoadMoreListener { + isLoadMore = true + pageIndex++ + getNoticeListByPage() + } + } + + override fun onResume() { + super.onResume() + pageIndex = 1 + getNoticeListByPage() + } + + private fun getNoticeListByPage() { + noticeViewModel.getNoticeList("", "", "", "", "", pageIndex) + } + + private val callback = Handler.Callback { + when (it.what) { + 2023013101 -> { + if (isRefresh || isLoadMore) { + noticeListAdapter.notifyDataSetChanged() + } else { + if (dataBeans.size == 0) { + emptyView!!.showEmptyPage("没有任何消息") { + pageIndex = 1 + getNoticeListByPage() + } + } else { + emptyView!!.hide() + noticeListAdapter = NoticeListAdapter(this, dataBeans) + noticeRecyclerView.adapter = noticeListAdapter + noticeListAdapter.setOnItemClickListener(object : + NoticeListAdapter.OnItemClickListener { + override fun onItemClicked(position: Int) { + val rowsModel = dataBeans[position] + val allArgs = addAll( + rowsModel.noticeNo, + rowsModel.noticeTitle, + rowsModel.noticePublisher, + "", + "" + ) + Log.d( + "Casic", + "NoticeListActivity => onItemClicked: ${rowsModel.minioFileName.combineFilePath()}" + ) + navigatePageTo(allArgs) + } + }) + } + } + } + } + true + } + + //TODO 判断是否开启通知权限 + private fun hasNoticePermission(): Boolean { + + return false + } + + override fun initLayoutView(): Int = R.layout.activity_notice_list + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewDocumentActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewDocumentActivity.kt new file mode 100644 index 0000000..4b16ae8 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewDocumentActivity.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.view.notice + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseActivity + +class PreviewDocumentActivity : KotlinBaseActivity() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.activity_preview_doc + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewPdfActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewPdfActivity.kt new file mode 100644 index 0000000..fad73b6 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewPdfActivity.kt @@ -0,0 +1,62 @@ +package com.casic.xz.meterage.view.notice + +import com.casic.xz.meterage.R +import com.casic.xz.meterage.extensions.combineFilePath +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.callback.OnDownloadListener +import com.pengxh.kt.lite.extensions.createDownloadFileDir +import com.pengxh.kt.lite.extensions.downloadFile +import com.pengxh.kt.lite.utils.Constant +import kotlinx.android.synthetic.main.activity_preview_pdf.* +import kotlinx.android.synthetic.main.include_base_title.* +import java.io.File +import java.io.FileInputStream + + +class PreviewPdfActivity : KotlinBaseActivity() { + + override fun initData() { + val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! + titleView.text = minioFileName + + val url = minioFileName.combineFilePath() + url.downloadFile(createDownloadFileDir().toString(), + object : OnDownloadListener { + override fun onDownloadStart(totalBytes: Long) { + runOnUiThread { + LoadingDialogHub.show(this@PreviewPdfActivity, "附件加载中") + } + } + + override fun onProgressChanged(currentBytes: Long) { + + } + + override fun onDownloadEnd(file: File?) { + runOnUiThread { + LoadingDialogHub.dismiss() + } + val inputStream = FileInputStream(file) + pdfView.fromStream(inputStream).load() + } + }) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + } + + override fun initLayoutView(): Int = R.layout.activity_preview_pdf + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewTextActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewTextActivity.kt new file mode 100644 index 0000000..d7850fb --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewTextActivity.kt @@ -0,0 +1,60 @@ +package com.casic.xz.meterage.view.notice + +import com.casic.xz.meterage.R +import com.casic.xz.meterage.extensions.combineFilePath +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.callback.OnDownloadListener +import com.pengxh.kt.lite.extensions.createDownloadFileDir +import com.pengxh.kt.lite.extensions.downloadFile +import com.pengxh.kt.lite.extensions.read +import com.pengxh.kt.lite.utils.Constant +import kotlinx.android.synthetic.main.activity_preview_txt.* +import kotlinx.android.synthetic.main.include_base_title.* +import java.io.File + +class PreviewTextActivity : KotlinBaseActivity() { + + override fun initData() { + val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! + titleView.text = minioFileName + + val url = minioFileName.combineFilePath() + url.downloadFile(createDownloadFileDir().toString(), + object : OnDownloadListener { + override fun onDownloadStart(totalBytes: Long) { + runOnUiThread { + LoadingDialogHub.show(this@PreviewTextActivity, "附件加载中") + } + } + + override fun onProgressChanged(currentBytes: Long) { + + } + + override fun onDownloadEnd(file: File?) { + runOnUiThread { + LoadingDialogHub.dismiss() + textView.text = file?.read() + } + } + }) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + } + + override fun initLayoutView(): Int = R.layout.activity_preview_txt + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/vm/EquipmentViewModel.kt b/app/src/main/java/com/casic/xz/meterage/vm/EquipmentViewModel.kt new file mode 100644 index 0000000..b5f21f6 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/vm/EquipmentViewModel.kt @@ -0,0 +1,92 @@ +package com.casic.xz.meterage.vm + +import androidx.lifecycle.MutableLiveData +import com.casic.xz.meterage.base.BaseApplication +import com.casic.xz.meterage.extensions.separateResponseCode +import com.casic.xz.meterage.extensions.toErrorMessage +import com.casic.xz.meterage.model.EquipmentDetailModel +import com.casic.xz.meterage.model.EquipmentListModel +import com.casic.xz.meterage.utils.retrofit.RetrofitServiceManager +import com.google.gson.Gson +import com.google.gson.reflect.TypeToken +import com.pengxh.kt.lite.extensions.launch +import com.pengxh.kt.lite.extensions.show +import com.pengxh.kt.lite.vm.BaseViewModel +import com.pengxh.kt.lite.vm.LoadState + +class EquipmentViewModel : BaseViewModel() { + + private val gson by lazy { Gson() } + val equipmentResult = MutableLiveData() + val equipmentDetailResult = MutableLiveData() + + fun getEquipmentList( + equipmentNo: String, + equipmentName: String, + mesureType: String, + managerState: String, + useDept: String, + assetType: String, + equipmentCategory: String, + isCalibrationTestEquipment: String, + isMeasureAccount: String, + isStandardSupportEquipment: String, + isFixedAssets: String, + validStartDate: String, + validEndDate: String, + abc: String, + ids: Array, + offset: Int + ) = launch({ + loadState.value = LoadState.Loading + val response = RetrofitServiceManager.getEquipmentList( + equipmentNo, + equipmentName, + mesureType, + managerState, + useDept, + assetType, + equipmentCategory, + isCalibrationTestEquipment, + isMeasureAccount, + isStandardSupportEquipment, + isFixedAssets, + validStartDate, + validEndDate, + abc, + ids, + offset + ) + val responseCode = response.separateResponseCode() + if (responseCode == 200) { + loadState.value = LoadState.Success + equipmentResult.value = gson.fromJson( + response, object : TypeToken() {}.type + ) + } else { + loadState.value = LoadState.Fail + response.toErrorMessage().show(BaseApplication.get()) + } + }, { + loadState.value = LoadState.Fail + it.printStackTrace() + }) + + fun getEquipmentDetail(id: String) = launch({ + loadState.value = LoadState.Loading + val response = RetrofitServiceManager.getEquipmentDetail(id) + val responseCode = response.separateResponseCode() + if (responseCode == 200) { + loadState.value = LoadState.Success + equipmentDetailResult.value = gson.fromJson( + response, object : TypeToken() {}.type + ) + } else { + loadState.value = LoadState.Fail + response.toErrorMessage().show(BaseApplication.get()) + } + }, { + loadState.value = LoadState.Fail + it.printStackTrace() + }) +} \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_sorting.xml b/app/src/main/res/drawable/ic_sorting.xml new file mode 100644 index 0000000..252bfe6 --- /dev/null +++ b/app/src/main/res/drawable/ic_sorting.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/layout/activity_equipment.xml b/app/src/main/res/layout/activity_equipment.xml new file mode 100644 index 0000000..d6a64b1 --- /dev/null +++ b/app/src/main/res/layout/activity_equipment.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_equipment_detail.xml b/app/src/main/res/layout/activity_equipment_detail.xml new file mode 100644 index 0000000..7254762 --- /dev/null +++ b/app/src/main/res/layout/activity_equipment_detail.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_basic_information.xml b/app/src/main/res/layout/fragment_basic_information.xml new file mode 100644 index 0000000..4a3c1c7 --- /dev/null +++ b/app/src/main/res/layout/fragment_basic_information.xml @@ -0,0 +1,390 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_certificate.xml b/app/src/main/res/layout/fragment_certificate.xml new file mode 100644 index 0000000..77d9ef6 --- /dev/null +++ b/app/src/main/res/layout/fragment_certificate.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_change_record.xml b/app/src/main/res/layout/fragment_change_record.xml new file mode 100644 index 0000000..77d9ef6 --- /dev/null +++ b/app/src/main/res/layout/fragment_change_record.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_home.xml b/app/src/main/res/layout/fragment_home.xml index 41b32a9..e1ab759 100644 --- a/app/src/main/res/layout/fragment_home.xml +++ b/app/src/main/res/layout/fragment_home.xml @@ -71,7 +71,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" app:layoutManager="androidx.recyclerview.widget.GridLayoutManager" - app:spanCount="5" /> + app:spanCount="4" /> - - - - - - - + + + + + + + + + +) : RecyclerView.Adapter() { + + private var layoutInflater: LayoutInflater = LayoutInflater.from(context) + + override fun getItemCount(): Int = dataRows.size + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = ItemViewHolder( + layoutInflater.inflate(R.layout.item_equipment_rv_l, parent, false) + ) + + override fun onBindViewHolder(holder: ItemViewHolder, position: Int) { + //绑定数据 + val rowsBean = dataRows[position] + holder.equipmentNameView.text = rowsBean.equipmentName + holder.equipmentCodeView.text = rowsBean.equipmentNo + holder.equipmentDateView.text = rowsBean.enableDate + holder.equipmentLibView.text = rowsBean.useDeptName + + //绑定事件 + holder.itemView.setOnClickListener { + listener?.onItemClicked(position) + } + } + + inner class ItemViewHolder(view: View) : RecyclerView.ViewHolder(view) { + var equipmentNameView: TextView = view.findViewById(R.id.equipmentNameView) + var equipmentCodeView: TextView = view.findViewById(R.id.equipmentCodeView) + var equipmentDateView: TextView = view.findViewById(R.id.equipmentDateView) + var equipmentLibView: TextView = view.findViewById(R.id.equipmentLibView) + } + + private var listener: OnItemClickListener? = null + + interface OnItemClickListener { + fun onItemClicked(position: Int) + } + + fun setOnItemClickListener(onClickListener: OnItemClickListener?) { + this.listener = onClickListener + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt index b4628f3..d970b55 100644 --- a/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt +++ b/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt @@ -5,7 +5,8 @@ import com.casic.xz.meterage.R import com.casic.xz.meterage.adapter.HomeGridAdapter import com.casic.xz.meterage.utils.LocaleConstant -import com.casic.xz.meterage.view.NoticeListActivity +import com.casic.xz.meterage.view.home.EquipmentActivity +import com.casic.xz.meterage.view.notice.NoticeListActivity import com.casic.xz.meterage.vm.NoticeViewModel import com.pengxh.kt.lite.base.KotlinBaseFragment import com.pengxh.kt.lite.extensions.navigatePageTo @@ -36,8 +37,19 @@ homeFuncRecyclerView.adapter = homeAdapter homeAdapter.setOnGridItemClickListener(object : HomeGridAdapter.OnGridItemClickListener { override fun onItemClick(position: Int) { - when (position) { - + when (LocaleConstant.HOME_FUNC_OPERATE[position]) { + "仪器设备" -> requireContext().navigatePageTo() +// "标准装置" -> requireContext().navigatePageTo() +// "证书报告" -> requireContext().navigatePageTo() +// "委托需求" -> requireContext().navigatePageTo() +// "访客" -> requireContext().navigatePageTo() +// "标准规范" -> requireContext().navigatePageTo() +// "能力列表" -> requireContext().navigatePageTo() +// "计量培训" -> requireContext().navigatePageTo() +// "合同发票" -> requireContext().navigatePageTo() +// "业务统计" -> requireContext().navigatePageTo() +// "客户列表" -> requireContext().navigatePageTo() +// "外场检测" -> requireContext().navigatePageTo() } } }) diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt index 7e75abe..56dc5ec 100644 --- a/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt +++ b/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt @@ -2,9 +2,11 @@ import android.view.View import androidx.lifecycle.ViewModelProvider +import com.bumptech.glide.Glide +import com.bumptech.glide.request.RequestOptions import com.casic.xz.meterage.R import com.casic.xz.meterage.utils.LocaleConstant -import com.casic.xz.meterage.view.NoticeListActivity +import com.casic.xz.meterage.view.notice.NoticeListActivity import com.casic.xz.meterage.vm.NoticeViewModel import com.casic.xz.meterage.vm.UserViewModel import com.pengxh.kt.lite.base.KotlinBaseFragment @@ -23,6 +25,12 @@ val data = it.data userNameView.text = data.name userUnitView.text = data.deptName + +// Glide.with(requireContext()) +// .load(R.mipmap.default_avatar) +// .apply(RequestOptions.circleCropTransform()) +// .placeholder(R.mipmap.load_image_error) +// .into(userAvatarView) } }) diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt new file mode 100644 index 0000000..cf22646 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt @@ -0,0 +1,103 @@ +package com.casic.xz.meterage.fragment.equipment + +import android.graphics.Paint +import androidx.lifecycle.ViewModelProvider +import com.casic.xz.meterage.R +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.casic.xz.meterage.vm.EquipmentViewModel +import com.pengxh.kt.lite.base.KotlinBaseFragment +import com.pengxh.kt.lite.extensions.convertColor +import com.pengxh.kt.lite.vm.LoadState +import kotlinx.android.synthetic.main.fragment_basic_information.* + +class BasicInformationFragment(private val id: String) : KotlinBaseFragment() { + + private lateinit var equipmentViewModel: EquipmentViewModel + + override fun initData() { + equipmentViewModel = ViewModelProvider(this)[EquipmentViewModel::class.java] + equipmentViewModel.getEquipmentDetail(id) + equipmentViewModel.equipmentDetailResult.observe(this, { + if (it.code == 200) { + val data = it.data!! + + equipmentCodeView.text = data.equipmentNo + equipmentNameView.text = data.equipmentName + manufacturerView.text = data.manufacturer + factoryNumberView.text = data.manufacturingNo + modelView.text = data.modelNo + verificationMethodView.text = data.mesureTypeName + measuringRangeView.text = data.mesureRange + uncertaintyView.text = data.uncertainty + firstUseView.text = data.createTime + originalValueView.text = data.originValue + usageDeptView.text = data.useDeptName + userView.text = data.usePersonName + managementStatusView.text = data.managerStateName + verificationDeptView.text = data.useDeptName +// nextVerificationDeptView.text = data. + verificationPeriodView.text = data.mesureCycle + verificationDateView.text = data.mesureDate + effectiveDateView.text = data.validDate + verificationResultsView.text = data.mesureResultName + abcView.text = data.abcName + isNeedTechnicalView.text = if ( + data.isCalibrationTestEquipment.isNullOrBlank() || data.isCalibrationTestEquipment == "0" + ) { + "否" + } else { + "是" + } + + isStandingBook.text = if ( + data.isMeasureAccount.isNullOrBlank() || data.isMeasureAccount == "0" + ) { + "否" + } else { + "是" + } + + isStandardView.text = if ( + data.isStandardSupportEquipment.isNullOrBlank() || data.isStandardSupportEquipment == "0" + ) { + "否" + } else { + "是" + } + remarkView.text = data.remark + if (data.fileList.size == 0) { + instructionsView.text = "暂无" + } else { + instructionsView.text = "查看附件列表" + val textPaint = instructionsView.paint + textPaint.flags = Paint.UNDERLINE_TEXT_FLAG + textPaint.isAntiAlias = true + instructionsView.setTextColor(R.color.themeColor.convertColor(requireContext())) + + instructionsView.setOnClickListener { + + } + } + } + }) + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_basic_information + + override fun observeRequestState() { + equipmentViewModel.loadState.observe(this, { + when (it) { + LoadState.Loading -> LoadingDialogHub.show(requireActivity(), "数据加载中...") + else -> LoadingDialogHub.dismiss() + } + }) + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt new file mode 100644 index 0000000..0b4a747 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class CertificateFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_certificate + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt new file mode 100644 index 0000000..f05c491 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class ChangeRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_change_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt new file mode 100644 index 0000000..849ffa5 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class InspectionRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_inspection_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt new file mode 100644 index 0000000..aa4edd9 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class UsageRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_usage_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java b/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java new file mode 100644 index 0000000..0b9124e --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java @@ -0,0 +1,760 @@ +package com.casic.xz.meterage.model; + +import java.util.List; + +public class EquipmentDetailModel { + + private int code; + private DataModel data; + private String message; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataModel getData() { + return data; + } + + public void setData(DataModel data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public static class DataModel { + private String abc; + private String abcName; + private String assetNo; + private String assetSource; + private String assetType; + private String assetTypeName; + private String attribute; + private String capitalSource; + private String capitalSourceName; + private String cardEstablishmentDate; + private String createTime; + private String createUser; + private String depreciationMethod; + private String depreciationMethodName; + private String depreciationPeriod; + private String enableDate; + private String equipmentCategory; + private String equipmentCategoryName; + private String equipmentName; + private String equipmentNo; + private String equipmentSpecifications; + private String equipmentType; + private String equipmentTypeName; + private List fileList; + private String id; + private String installIncidentalExpenses; + private String installPlace; + private String intactState; + private String isCalibrationTestEquipment; + private int isDel; + private String isFixedAssets; + private String isMeasureAccount; + private String isStandardSupportEquipment; + private String labelBind; + private String majorCategory; + private String majorCategoryName; + private String managerLevel; + private String managerLevelName; + private String managerState; + private String managerStateName; + private String manufacturer; + private String manufacturerCountry; + private String manufacturingDate; + private String manufacturingNo; + private String mesureCycle; + private String mesureDate; + private String mesureDept; + private String mesureRange; + private String mesureResult; + private String mesureResultName; + private String mesureType; + private String mesureTypeName; + private String modelNo; + private String originValue; + private String overallDimension; + private String presentOriginValue; + private String purpose; + private String remark; + private String singlePrice; + private String supportStandardEquipmentName; + private String supportStandardEquipmentNo; + private String technicalLevel; + private String uncertainty; + private String updateTime; + private String useDept; + private String useDeptName; + private String usePerson; + private String usePersonName; + private String validDate; + private int version; + private String weight; + + public String getAbc() { + return abc; + } + + public void setAbc(String abc) { + this.abc = abc; + } + + public String getAbcName() { + return abcName; + } + + public void setAbcName(String abcName) { + this.abcName = abcName; + } + + public String getAssetNo() { + return assetNo; + } + + public void setAssetNo(String assetNo) { + this.assetNo = assetNo; + } + + public String getAssetSource() { + return assetSource; + } + + public void setAssetSource(String assetSource) { + this.assetSource = assetSource; + } + + public String getAssetType() { + return assetType; + } + + public void setAssetType(String assetType) { + this.assetType = assetType; + } + + public String getAssetTypeName() { + return assetTypeName; + } + + public void setAssetTypeName(String assetTypeName) { + this.assetTypeName = assetTypeName; + } + + public String getAttribute() { + return attribute; + } + + public void setAttribute(String attribute) { + this.attribute = attribute; + } + + public String getCapitalSource() { + return capitalSource; + } + + public void setCapitalSource(String capitalSource) { + this.capitalSource = capitalSource; + } + + public String getCapitalSourceName() { + return capitalSourceName; + } + + public void setCapitalSourceName(String capitalSourceName) { + this.capitalSourceName = capitalSourceName; + } + + public String getCardEstablishmentDate() { + return cardEstablishmentDate; + } + + public void setCardEstablishmentDate(String cardEstablishmentDate) { + this.cardEstablishmentDate = cardEstablishmentDate; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getDepreciationMethod() { + return depreciationMethod; + } + + public void setDepreciationMethod(String depreciationMethod) { + this.depreciationMethod = depreciationMethod; + } + + public String getDepreciationMethodName() { + return depreciationMethodName; + } + + public void setDepreciationMethodName(String depreciationMethodName) { + this.depreciationMethodName = depreciationMethodName; + } + + public String getDepreciationPeriod() { + return depreciationPeriod; + } + + public void setDepreciationPeriod(String depreciationPeriod) { + this.depreciationPeriod = depreciationPeriod; + } + + public String getEnableDate() { + return enableDate; + } + + public void setEnableDate(String enableDate) { + this.enableDate = enableDate; + } + + public String getEquipmentCategory() { + return equipmentCategory; + } + + public void setEquipmentCategory(String equipmentCategory) { + this.equipmentCategory = equipmentCategory; + } + + public String getEquipmentCategoryName() { + return equipmentCategoryName; + } + + public void setEquipmentCategoryName(String equipmentCategoryName) { + this.equipmentCategoryName = equipmentCategoryName; + } + + public String getEquipmentName() { + return equipmentName; + } + + public void setEquipmentName(String equipmentName) { + this.equipmentName = equipmentName; + } + + public String getEquipmentNo() { + return equipmentNo; + } + + public void setEquipmentNo(String equipmentNo) { + this.equipmentNo = equipmentNo; + } + + public String getEquipmentSpecifications() { + return equipmentSpecifications; + } + + public void setEquipmentSpecifications(String equipmentSpecifications) { + this.equipmentSpecifications = equipmentSpecifications; + } + + public String getEquipmentType() { + return equipmentType; + } + + public void setEquipmentType(String equipmentType) { + this.equipmentType = equipmentType; + } + + public String getEquipmentTypeName() { + return equipmentTypeName; + } + + public void setEquipmentTypeName(String equipmentTypeName) { + this.equipmentTypeName = equipmentTypeName; + } + + public List getFileList() { + return fileList; + } + + public void setFileList(List fileList) { + this.fileList = fileList; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getInstallIncidentalExpenses() { + return installIncidentalExpenses; + } + + public void setInstallIncidentalExpenses(String installIncidentalExpenses) { + this.installIncidentalExpenses = installIncidentalExpenses; + } + + public String getInstallPlace() { + return installPlace; + } + + public void setInstallPlace(String installPlace) { + this.installPlace = installPlace; + } + + public String getIntactState() { + return intactState; + } + + public void setIntactState(String intactState) { + this.intactState = intactState; + } + + public String getIsCalibrationTestEquipment() { + return isCalibrationTestEquipment; + } + + public void setIsCalibrationTestEquipment(String isCalibrationTestEquipment) { + this.isCalibrationTestEquipment = isCalibrationTestEquipment; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getIsFixedAssets() { + return isFixedAssets; + } + + public void setIsFixedAssets(String isFixedAssets) { + this.isFixedAssets = isFixedAssets; + } + + public String getIsMeasureAccount() { + return isMeasureAccount; + } + + public void setIsMeasureAccount(String isMeasureAccount) { + this.isMeasureAccount = isMeasureAccount; + } + + public String getIsStandardSupportEquipment() { + return isStandardSupportEquipment; + } + + public void setIsStandardSupportEquipment(String isStandardSupportEquipment) { + this.isStandardSupportEquipment = isStandardSupportEquipment; + } + + public String getLabelBind() { + return labelBind; + } + + public void setLabelBind(String labelBind) { + this.labelBind = labelBind; + } + + public String getMajorCategory() { + return majorCategory; + } + + public void setMajorCategory(String majorCategory) { + this.majorCategory = majorCategory; + } + + public String getMajorCategoryName() { + return majorCategoryName; + } + + public void setMajorCategoryName(String majorCategoryName) { + this.majorCategoryName = majorCategoryName; + } + + public String getManagerLevel() { + return managerLevel; + } + + public void setManagerLevel(String managerLevel) { + this.managerLevel = managerLevel; + } + + public String getManagerLevelName() { + return managerLevelName; + } + + public void setManagerLevelName(String managerLevelName) { + this.managerLevelName = managerLevelName; + } + + public String getManagerState() { + return managerState; + } + + public void setManagerState(String managerState) { + this.managerState = managerState; + } + + public String getManagerStateName() { + return managerStateName; + } + + public void setManagerStateName(String managerStateName) { + this.managerStateName = managerStateName; + } + + public String getManufacturer() { + return manufacturer; + } + + public void setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + } + + public String getManufacturerCountry() { + return manufacturerCountry; + } + + public void setManufacturerCountry(String manufacturerCountry) { + this.manufacturerCountry = manufacturerCountry; + } + + public String getManufacturingDate() { + return manufacturingDate; + } + + public void setManufacturingDate(String manufacturingDate) { + this.manufacturingDate = manufacturingDate; + } + + public String getManufacturingNo() { + return manufacturingNo; + } + + public void setManufacturingNo(String manufacturingNo) { + this.manufacturingNo = manufacturingNo; + } + + public String getMesureCycle() { + return mesureCycle; + } + + public void setMesureCycle(String mesureCycle) { + this.mesureCycle = mesureCycle; + } + + public String getMesureDate() { + return mesureDate; + } + + public void setMesureDate(String mesureDate) { + this.mesureDate = mesureDate; + } + + public String getMesureDept() { + return mesureDept; + } + + public void setMesureDept(String mesureDept) { + this.mesureDept = mesureDept; + } + + public String getMesureRange() { + return mesureRange; + } + + public void setMesureRange(String mesureRange) { + this.mesureRange = mesureRange; + } + + public String getMesureResult() { + return mesureResult; + } + + public void setMesureResult(String mesureResult) { + this.mesureResult = mesureResult; + } + + public String getMesureResultName() { + return mesureResultName; + } + + public void setMesureResultName(String mesureResultName) { + this.mesureResultName = mesureResultName; + } + + public String getMesureType() { + return mesureType; + } + + public void setMesureType(String mesureType) { + this.mesureType = mesureType; + } + + public String getMesureTypeName() { + return mesureTypeName; + } + + public void setMesureTypeName(String mesureTypeName) { + this.mesureTypeName = mesureTypeName; + } + + public String getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getOriginValue() { + return originValue; + } + + public void setOriginValue(String originValue) { + this.originValue = originValue; + } + + public String getOverallDimension() { + return overallDimension; + } + + public void setOverallDimension(String overallDimension) { + this.overallDimension = overallDimension; + } + + public String getPresentOriginValue() { + return presentOriginValue; + } + + public void setPresentOriginValue(String presentOriginValue) { + this.presentOriginValue = presentOriginValue; + } + + public String getPurpose() { + return purpose; + } + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getSinglePrice() { + return singlePrice; + } + + public void setSinglePrice(String singlePrice) { + this.singlePrice = singlePrice; + } + + public String getSupportStandardEquipmentName() { + return supportStandardEquipmentName; + } + + public void setSupportStandardEquipmentName(String supportStandardEquipmentName) { + this.supportStandardEquipmentName = supportStandardEquipmentName; + } + + public String getSupportStandardEquipmentNo() { + return supportStandardEquipmentNo; + } + + public void setSupportStandardEquipmentNo(String supportStandardEquipmentNo) { + this.supportStandardEquipmentNo = supportStandardEquipmentNo; + } + + public String getTechnicalLevel() { + return technicalLevel; + } + + public void setTechnicalLevel(String technicalLevel) { + this.technicalLevel = technicalLevel; + } + + public String getUncertainty() { + return uncertainty; + } + + public void setUncertainty(String uncertainty) { + this.uncertainty = uncertainty; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getUseDept() { + return useDept; + } + + public void setUseDept(String useDept) { + this.useDept = useDept; + } + + public String getUseDeptName() { + return useDeptName; + } + + public void setUseDeptName(String useDeptName) { + this.useDeptName = useDeptName; + } + + public String getUsePerson() { + return usePerson; + } + + public void setUsePerson(String usePerson) { + this.usePerson = usePerson; + } + + public String getUsePersonName() { + return usePersonName; + } + + public void setUsePersonName(String usePersonName) { + this.usePersonName = usePersonName; + } + + public String getValidDate() { + return validDate; + } + + public void setValidDate(String validDate) { + this.validDate = validDate; + } + + public int getVersion() { + return version; + } + + public void setVersion(int version) { + this.version = version; + } + + public String getWeight() { + return weight; + } + + public void setWeight(String weight) { + this.weight = weight; + } + + public static class FileListModel { + private String assetId; + private String createTime; + private String createUser; + private String fileName; + private String id; + private int isDel; + private String minioFileName; + private String remark; + private String updateTime; + + public String getAssetId() { + return assetId; + } + + public void setAssetId(String assetId) { + this.assetId = assetId; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getFileName() { + return fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getMinioFileName() { + return minioFileName; + } + + public void setMinioFileName(String minioFileName) { + this.minioFileName = minioFileName; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + } + } +} diff --git a/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java b/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java new file mode 100644 index 0000000..15fc128 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java @@ -0,0 +1,697 @@ +package com.casic.xz.meterage.model; + +import java.util.List; + +public class EquipmentListModel { + + private int code; + private DataModel data; + private String message; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataModel getData() { + return data; + } + + public void setData(DataModel data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public static class DataModel { + private List rows; + private int total; + + public List getRows() { + return rows; + } + + public void setRows(List rows) { + this.rows = rows; + } + + public int getTotal() { + return total; + } + + public void setTotal(int total) { + this.total = total; + } + + public static class RowsModel { + private String abc; + private String abcName; + private String assetNo; + private String assetSource; + private String assetType; + private String assetTypeName; + private String attribute; + private String capitalSource; + private String capitalSourceName; + private String cardEstablishmentDate; + private String createTime; + private String createUser; + private String depreciationMethod; + private String depreciationMethodName; + private String depreciationPeriod; + private String enableDate; + private String equipmentCategory; + private String equipmentCategoryName; + private String equipmentName; + private String equipmentNo; + private String equipmentSpecifications; + private String equipmentType; + private String equipmentTypeName; + private String fileList; + private String id; + private String installIncidentalExpenses; + private String installPlace; + private String intactState; + private String isCalibrationTestEquipment; + private int isDel; + private String isFixedAssets; + private String isMeasureAccount; + private String isStandardSupportEquipment; + private String labelBind; + private String majorCategory; + private String majorCategoryName; + private String managerLevel; + private String managerLevelName; + private String managerState; + private String managerStateName; + private String manufacturer; + private String manufacturerCountry; + private String manufacturingDate; + private String manufacturingNo; + private String mesureCycle; + private String mesureDate; + private String mesureDept; + private String mesureRange; + private String mesureResult; + private String mesureResultName; + private String mesureType; + private String mesureTypeName; + private String modelNo; + private String originValue; + private String overallDimension; + private String presentOriginValue; + private String purpose; + private String remark; + private String singlePrice; + private String supportStandardEquipmentName; + private String supportStandardEquipmentNo; + private String technicalLevel; + private String uncertainty; + private String updateTime; + private String useDept; + private String useDeptName; + private String usePerson; + private String usePersonName; + private String validDate; + private int version; + private String weight; + + public String getAbc() { + return abc; + } + + public void setAbc(String abc) { + this.abc = abc; + } + + public String getAbcName() { + return abcName; + } + + public void setAbcName(String abcName) { + this.abcName = abcName; + } + + public String getAssetNo() { + return assetNo; + } + + public void setAssetNo(String assetNo) { + this.assetNo = assetNo; + } + + public String getAssetSource() { + return assetSource; + } + + public void setAssetSource(String assetSource) { + this.assetSource = assetSource; + } + + public String getAssetType() { + return assetType; + } + + public void setAssetType(String assetType) { + this.assetType = assetType; + } + + public String getAssetTypeName() { + return assetTypeName; + } + + public void setAssetTypeName(String assetTypeName) { + this.assetTypeName = assetTypeName; + } + + public String getAttribute() { + return attribute; + } + + public void setAttribute(String attribute) { + this.attribute = attribute; + } + + public String getCapitalSource() { + return capitalSource; + } + + public void setCapitalSource(String capitalSource) { + this.capitalSource = capitalSource; + } + + public String getCapitalSourceName() { + return capitalSourceName; + } + + public void setCapitalSourceName(String capitalSourceName) { + this.capitalSourceName = capitalSourceName; + } + + public String getCardEstablishmentDate() { + return cardEstablishmentDate; + } + + public void setCardEstablishmentDate(String cardEstablishmentDate) { + this.cardEstablishmentDate = cardEstablishmentDate; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getDepreciationMethod() { + return depreciationMethod; + } + + public void setDepreciationMethod(String depreciationMethod) { + this.depreciationMethod = depreciationMethod; + } + + public String getDepreciationMethodName() { + return depreciationMethodName; + } + + public void setDepreciationMethodName(String depreciationMethodName) { + this.depreciationMethodName = depreciationMethodName; + } + + public String getDepreciationPeriod() { + return depreciationPeriod; + } + + public void setDepreciationPeriod(String depreciationPeriod) { + this.depreciationPeriod = depreciationPeriod; + } + + public String getEnableDate() { + return enableDate; + } + + public void setEnableDate(String enableDate) { + this.enableDate = enableDate; + } + + public String getEquipmentCategory() { + return equipmentCategory; + } + + public void setEquipmentCategory(String equipmentCategory) { + this.equipmentCategory = equipmentCategory; + } + + public String getEquipmentCategoryName() { + return equipmentCategoryName; + } + + public void setEquipmentCategoryName(String equipmentCategoryName) { + this.equipmentCategoryName = equipmentCategoryName; + } + + public String getEquipmentName() { + return equipmentName; + } + + public void setEquipmentName(String equipmentName) { + this.equipmentName = equipmentName; + } + + public String getEquipmentNo() { + return equipmentNo; + } + + public void setEquipmentNo(String equipmentNo) { + this.equipmentNo = equipmentNo; + } + + public String getEquipmentSpecifications() { + return equipmentSpecifications; + } + + public void setEquipmentSpecifications(String equipmentSpecifications) { + this.equipmentSpecifications = equipmentSpecifications; + } + + public String getEquipmentType() { + return equipmentType; + } + + public void setEquipmentType(String equipmentType) { + this.equipmentType = equipmentType; + } + + public String getEquipmentTypeName() { + return equipmentTypeName; + } + + public void setEquipmentTypeName(String equipmentTypeName) { + this.equipmentTypeName = equipmentTypeName; + } + + public String getFileList() { + return fileList; + } + + public void setFileList(String fileList) { + this.fileList = fileList; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getInstallIncidentalExpenses() { + return installIncidentalExpenses; + } + + public void setInstallIncidentalExpenses(String installIncidentalExpenses) { + this.installIncidentalExpenses = installIncidentalExpenses; + } + + public String getInstallPlace() { + return installPlace; + } + + public void setInstallPlace(String installPlace) { + this.installPlace = installPlace; + } + + public String getIntactState() { + return intactState; + } + + public void setIntactState(String intactState) { + this.intactState = intactState; + } + + public String getIsCalibrationTestEquipment() { + return isCalibrationTestEquipment; + } + + public void setIsCalibrationTestEquipment(String isCalibrationTestEquipment) { + this.isCalibrationTestEquipment = isCalibrationTestEquipment; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getIsFixedAssets() { + return isFixedAssets; + } + + public void setIsFixedAssets(String isFixedAssets) { + this.isFixedAssets = isFixedAssets; + } + + public String getIsMeasureAccount() { + return isMeasureAccount; + } + + public void setIsMeasureAccount(String isMeasureAccount) { + this.isMeasureAccount = isMeasureAccount; + } + + public String getIsStandardSupportEquipment() { + return isStandardSupportEquipment; + } + + public void setIsStandardSupportEquipment(String isStandardSupportEquipment) { + this.isStandardSupportEquipment = isStandardSupportEquipment; + } + + public String getLabelBind() { + return labelBind; + } + + public void setLabelBind(String labelBind) { + this.labelBind = labelBind; + } + + public String getMajorCategory() { + return majorCategory; + } + + public void setMajorCategory(String majorCategory) { + this.majorCategory = majorCategory; + } + + public String getMajorCategoryName() { + return majorCategoryName; + } + + public void setMajorCategoryName(String majorCategoryName) { + this.majorCategoryName = majorCategoryName; + } + + public String getManagerLevel() { + return managerLevel; + } + + public void setManagerLevel(String managerLevel) { + this.managerLevel = managerLevel; + } + + public String getManagerLevelName() { + return managerLevelName; + } + + public void setManagerLevelName(String managerLevelName) { + this.managerLevelName = managerLevelName; + } + + public String getManagerState() { + return managerState; + } + + public void setManagerState(String managerState) { + this.managerState = managerState; + } + + public String getManagerStateName() { + return managerStateName; + } + + public void setManagerStateName(String managerStateName) { + this.managerStateName = managerStateName; + } + + public String getManufacturer() { + return manufacturer; + } + + public void setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + } + + public String getManufacturerCountry() { + return manufacturerCountry; + } + + public void setManufacturerCountry(String manufacturerCountry) { + this.manufacturerCountry = manufacturerCountry; + } + + public String getManufacturingDate() { + return manufacturingDate; + } + + public void setManufacturingDate(String manufacturingDate) { + this.manufacturingDate = manufacturingDate; + } + + public String getManufacturingNo() { + return manufacturingNo; + } + + public void setManufacturingNo(String manufacturingNo) { + this.manufacturingNo = manufacturingNo; + } + + public String getMesureCycle() { + return mesureCycle; + } + + public void setMesureCycle(String mesureCycle) { + this.mesureCycle = mesureCycle; + } + + public String getMesureDate() { + return mesureDate; + } + + public void setMesureDate(String mesureDate) { + this.mesureDate = mesureDate; + } + + public String getMesureDept() { + return mesureDept; + } + + public void setMesureDept(String mesureDept) { + this.mesureDept = mesureDept; + } + + public String getMesureRange() { + return mesureRange; + } + + public void setMesureRange(String mesureRange) { + this.mesureRange = mesureRange; + } + + public String getMesureResult() { + return mesureResult; + } + + public void setMesureResult(String mesureResult) { + this.mesureResult = mesureResult; + } + + public String getMesureResultName() { + return mesureResultName; + } + + public void setMesureResultName(String mesureResultName) { + this.mesureResultName = mesureResultName; + } + + public String getMesureType() { + return mesureType; + } + + public void setMesureType(String mesureType) { + this.mesureType = mesureType; + } + + public String getMesureTypeName() { + return mesureTypeName; + } + + public void setMesureTypeName(String mesureTypeName) { + this.mesureTypeName = mesureTypeName; + } + + public String getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getOriginValue() { + return originValue; + } + + public void setOriginValue(String originValue) { + this.originValue = originValue; + } + + public String getOverallDimension() { + return overallDimension; + } + + public void setOverallDimension(String overallDimension) { + this.overallDimension = overallDimension; + } + + public String getPresentOriginValue() { + return presentOriginValue; + } + + public void setPresentOriginValue(String presentOriginValue) { + this.presentOriginValue = presentOriginValue; + } + + public String getPurpose() { + return purpose; + } + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getSinglePrice() { + return singlePrice; + } + + public void setSinglePrice(String singlePrice) { + this.singlePrice = singlePrice; + } + + public String getSupportStandardEquipmentName() { + return supportStandardEquipmentName; + } + + public void setSupportStandardEquipmentName(String supportStandardEquipmentName) { + this.supportStandardEquipmentName = supportStandardEquipmentName; + } + + public String getSupportStandardEquipmentNo() { + return supportStandardEquipmentNo; + } + + public void setSupportStandardEquipmentNo(String supportStandardEquipmentNo) { + this.supportStandardEquipmentNo = supportStandardEquipmentNo; + } + + public String getTechnicalLevel() { + return technicalLevel; + } + + public void setTechnicalLevel(String technicalLevel) { + this.technicalLevel = technicalLevel; + } + + public String getUncertainty() { + return uncertainty; + } + + public void setUncertainty(String uncertainty) { + this.uncertainty = uncertainty; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getUseDept() { + return useDept; + } + + public void setUseDept(String useDept) { + this.useDept = useDept; + } + + public String getUseDeptName() { + return useDeptName; + } + + public void setUseDeptName(String useDeptName) { + this.useDeptName = useDeptName; + } + + public String getUsePerson() { + return usePerson; + } + + public void setUsePerson(String usePerson) { + this.usePerson = usePerson; + } + + public String getUsePersonName() { + return usePersonName; + } + + public void setUsePersonName(String usePersonName) { + this.usePersonName = usePersonName; + } + + public String getValidDate() { + return validDate; + } + + public void setValidDate(String validDate) { + this.validDate = validDate; + } + + public int getVersion() { + return version; + } + + public void setVersion(int version) { + this.version = version; + } + + public String getWeight() { + return weight; + } + + public void setWeight(String weight) { + this.weight = weight; + } + } + } +} diff --git a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt index a3f514f..46e5eef 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt @@ -35,4 +35,24 @@ @QueryMap limit: Map, @QueryMap offset: Map ): String + + /** + * 获取设备列表 + */ + @POST("/meter/assets/listPage") + suspend fun getEquipmentList( + @Header("token") token: String, + @Body requestBody: RequestBody, + @QueryMap limit: Map, + @QueryMap offset: Map + ): String + + /** + * 获取设备详情 + */ + @POST("/meter/assets/detail") + suspend fun getEquipmentDetail( + @Header("token") token: String, + @Body requestBody: RequestBody + ): String } \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt index 444a872..386a1d8 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt @@ -6,8 +6,10 @@ import com.pengxh.kt.lite.utils.SaveKeyValues import okhttp3.MediaType.Companion.toMediaType import okhttp3.RequestBody.Companion.toRequestBody +import org.json.JSONArray import org.json.JSONObject + object RetrofitServiceManager { private val api by lazy { @@ -73,4 +75,71 @@ offsetMap["offset"] = offset return api.getNoticeList(AuthenticationHelper.token!!, requestBody, limitMap, offsetMap) } + + /** + * 获取设备列表 + */ + suspend fun getEquipmentList( + equipmentNo: String, + equipmentName: String, + mesureType: String, + managerState: String, + useDept: String, + assetType: String, + equipmentCategory: String, + isCalibrationTestEquipment: String, + isMeasureAccount: String, + isStandardSupportEquipment: String, + isFixedAssets: String, + validStartDate: String, + validEndDate: String, + abc: String, + ids: Array, + offset: Int + ): String { + val paramObject = JSONObject() + paramObject.put("equipmentNo", equipmentNo) + paramObject.put("equipmentName", equipmentName) + paramObject.put("mesureType", mesureType) + paramObject.put("managerState", managerState) + paramObject.put("useDept", useDept) + paramObject.put("assetType", assetType) + paramObject.put("equipmentCategory", equipmentCategory) + paramObject.put("isCalibrationTestEquipment", isCalibrationTestEquipment) + paramObject.put("isMeasureAccount", isMeasureAccount) + paramObject.put("isStandardSupportEquipment", isStandardSupportEquipment) + paramObject.put("isFixedAssets", isFixedAssets) + paramObject.put("validStartDate", validStartDate) + paramObject.put("validEndDate", validEndDate) + paramObject.put("abc", abc) + + val jsonArray = JSONArray() + ids.forEach { + jsonArray.put(it) + } + paramObject.put("ids", jsonArray) + + val requestBody = paramObject.toString().toRequestBody( + "application/json;charset=UTF-8".toMediaType() + ) + + val limitMap = HashMap() + limitMap["limit"] = LocaleConstant.PAGE_LIMIT + + val offsetMap = HashMap() + offsetMap["offset"] = offset + return api.getEquipmentList(AuthenticationHelper.token!!, requestBody, limitMap, offsetMap) + } + + /** + * 获取设备详情 + */ + suspend fun getEquipmentDetail(id: String): String { + val paramObject = JSONObject() + paramObject.put("id", id) + val requestBody = paramObject.toString().toRequestBody( + "application/json;charset=UTF-8".toMediaType() + ) + return api.getEquipmentDetail(AuthenticationHelper.token!!, requestBody) + } } \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt deleted file mode 100644 index a5bb60b..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt +++ /dev/null @@ -1,104 +0,0 @@ -package com.casic.xz.meterage.view - -import android.annotation.SuppressLint -import android.graphics.Paint -import androidx.lifecycle.ViewModelProvider -import com.casic.xz.meterage.R -import com.casic.xz.meterage.extensions.combineImagePath -import com.casic.xz.meterage.extensions.formatTextFromHtml -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.vm.NoticeViewModel -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.extensions.convertColor -import com.pengxh.kt.lite.extensions.navigatePageTo -import com.pengxh.kt.lite.extensions.obtainScreenWidth -import com.pengxh.kt.lite.extensions.show -import com.pengxh.kt.lite.utils.Constant -import kotlinx.android.synthetic.main.activity_notice_detail.* -import kotlinx.android.synthetic.main.include_base_title.* -import java.util.* - -@SuppressLint("SetTextI18n") -class NoticeDetailActivity : KotlinBaseActivity() { - - private lateinit var noticeViewModel: NoticeViewModel - - override fun initData() { - leftBackView.setOnClickListener { finish() } - titleView.text = "通知公告" - - val args = intent.getStringArrayListExtra(Constant.INTENT_PARAM)!! - - noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] - noticeViewModel.getNoticeList(args[0], args[1], args[2], "", "", 1) - noticeViewModel.noticeResult.observe(this, { - if (it.code == 200) { - val dataRow = it.data?.rows!![0] - - noticeDateView.text = dataRow.noticeTime - noticePublisherView.text = "发布人 ${dataRow.noticePublisher}" - noticeCompanyView.text = "发布单位 ${dataRow.noticeCompany}" - - noticeNoView.text = dataRow.noticeNo - noticeTitleView.text = dataRow.noticeTitle - noticeSketchView.text = dataRow.noticeSketch - - dataRow.noticeContent.formatTextFromHtml( - this, noticeContentView, obtainScreenWidth() - ) - - if (dataRow.minioFileName.isNullOrBlank()) { - minioFileView.text = "暂无附件" - } else { - val minioFileName = dataRow.minioFileName - - minioFileView.text = minioFileName - val textPaint = minioFileView.paint - textPaint.flags = Paint.UNDERLINE_TEXT_FLAG - textPaint.isAntiAlias = true - minioFileView.setTextColor(R.color.themeColor.convertColor(this)) - - minioFileView.setOnClickListener { - //查看附件 - if (minioFileName.endsWith("pdf")) { - navigatePageTo(minioFileName) - } else if ( - minioFileName.endsWith("doc") || - minioFileName.endsWith("docx") - ) { - navigatePageTo(minioFileName) - } else if (minioFileName.endsWith("txt")) { - navigatePageTo(minioFileName) - } else if ( - minioFileName.endsWith("png") || - minioFileName.endsWith("jpeg") || - minioFileName.endsWith("jpg") - ) { - val urls = ArrayList() - urls.add(minioFileName.combineImagePath()) - navigatePageTo(0, urls) - } else { - "文件类型未知,无法打开附件".show(this) - } - } - } - } - }) - } - - override fun initEvent() { - - } - - override fun initLayoutView(): Int = R.layout.activity_notice_detail - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/NoticeListActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/NoticeListActivity.kt deleted file mode 100644 index 15f6a16..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/NoticeListActivity.kt +++ /dev/null @@ -1,180 +0,0 @@ -package com.casic.xz.meterage.view - -import android.os.Handler -import android.util.Log -import android.view.View -import androidx.lifecycle.ViewModelProvider -import com.casic.xz.meterage.R -import com.casic.xz.meterage.adapter.NoticeListAdapter -import com.casic.xz.meterage.extensions.addAll -import com.casic.xz.meterage.extensions.combineFilePath -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.extensions.showEmptyPage -import com.casic.xz.meterage.model.NoticeListModel -import com.casic.xz.meterage.vm.NoticeViewModel -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.extensions.navigatePageTo -import com.pengxh.kt.lite.extensions.show -import com.pengxh.kt.lite.utils.WeakReferenceHandler -import com.pengxh.kt.lite.widget.dialog.AlertControlDialog -import kotlinx.android.synthetic.main.activity_notice_list.* -import kotlinx.android.synthetic.main.include_empty_view.* - -class NoticeListActivity : KotlinBaseActivity() { - - private lateinit var weakReferenceHandler: WeakReferenceHandler - private lateinit var noticeViewModel: NoticeViewModel - private lateinit var noticeListAdapter: NoticeListAdapter - private var dataBeans: MutableList = ArrayList() - private var pageIndex = 1 - private var isRefresh = false - private var isLoadMore = false - - override fun initData() { - weakReferenceHandler = WeakReferenceHandler(callback) - noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] - noticeViewModel.noticeResult.observe(this, { - if (it.code == 200) { - val dataRows = it.data?.rows!! -// countBadeNumber(dataRows) - when { - isRefresh -> { - dataBeans.clear() - dataBeans = dataRows - noticeLayout.finishRefresh() - isRefresh = false - } - isLoadMore -> { - if (dataRows.size == 0) { - "到底了,别拉了".show(this) - } - dataBeans.addAll(dataRows) - noticeLayout.finishLoadMore() - isLoadMore = false - } - else -> { - dataBeans = dataRows - } - } - weakReferenceHandler.sendEmptyMessage(2023013101) - } - }) - } - - override fun initEvent() { - leftBackView.setOnClickListener { finish() } - rightOperateView.setOnClickListener { - AlertControlDialog.Builder() - .setContext(this) - .setTitle("提示") - .setMessage("确定将所有未读消息标为已读?") - .setNegativeButton("取消") - .setPositiveButton("确定") - .setOnDialogButtonClickListener(object : - AlertControlDialog.OnDialogButtonClickListener { - override fun onCancelClick() { - - } - - override fun onConfirmClick() { - //TODO 设置为已读 - } - }).build().show() - } - - if (hasNoticePermission()) { - openSystemNoticeLayout.visibility = View.GONE - openSystemNoticeLayout.visibility = View.GONE - } else { - openSystemNoticeLayout.setOnClickListener { - - } - - - closeLayoutView.setOnClickListener { - openSystemNoticeLayout.visibility = View.GONE - } - } - - noticeLayout.setOnRefreshListener { - isRefresh = true - //刷新之后页码重置 - pageIndex = 1 - getNoticeListByPage() - } - - noticeLayout.setOnLoadMoreListener { - isLoadMore = true - pageIndex++ - getNoticeListByPage() - } - } - - override fun onResume() { - super.onResume() - pageIndex = 1 - getNoticeListByPage() - } - - private fun getNoticeListByPage() { - noticeViewModel.getNoticeList("", "", "", "", "", pageIndex) - } - - private val callback = Handler.Callback { - when (it.what) { - 2023013101 -> { - if (isRefresh || isLoadMore) { - noticeListAdapter.notifyDataSetChanged() - } else { - if (dataBeans.size == 0) { - emptyView!!.showEmptyPage("没有任何消息") { - pageIndex = 1 - getNoticeListByPage() - } - } else { - emptyView!!.hide() - noticeListAdapter = NoticeListAdapter(this, dataBeans) - noticeRecyclerView.adapter = noticeListAdapter - noticeListAdapter.setOnItemClickListener(object : - NoticeListAdapter.OnItemClickListener { - override fun onItemClicked(position: Int) { - val rowsModel = dataBeans[position] - val allArgs = addAll( - rowsModel.noticeNo, - rowsModel.noticeTitle, - rowsModel.noticePublisher, - "", - "" - ) - Log.d( - "Casic", - "NoticeListActivity => onItemClicked: ${rowsModel.minioFileName.combineFilePath()}" - ) - navigatePageTo(allArgs) - } - }) - } - } - } - } - true - } - - //TODO 判断是否开启通知权限 - private fun hasNoticePermission(): Boolean { - - return false - } - - override fun initLayoutView(): Int = R.layout.activity_notice_list - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/PreviewDocumentActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/PreviewDocumentActivity.kt deleted file mode 100644 index e233ddc..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/PreviewDocumentActivity.kt +++ /dev/null @@ -1,24 +0,0 @@ -package com.casic.xz.meterage.view - -import com.casic.xz.meterage.R -import com.pengxh.kt.lite.base.KotlinBaseActivity - -class PreviewDocumentActivity : KotlinBaseActivity() { - override fun initData() { - - } - - override fun initEvent() { - - } - - override fun initLayoutView(): Int = R.layout.activity_preview_doc - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/PreviewPdfActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/PreviewPdfActivity.kt deleted file mode 100644 index 39f8ac2..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/PreviewPdfActivity.kt +++ /dev/null @@ -1,62 +0,0 @@ -package com.casic.xz.meterage.view - -import com.casic.xz.meterage.R -import com.casic.xz.meterage.extensions.combineFilePath -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.utils.LoadingDialogHub -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.callback.OnDownloadListener -import com.pengxh.kt.lite.extensions.createDownloadFileDir -import com.pengxh.kt.lite.extensions.downloadFile -import com.pengxh.kt.lite.utils.Constant -import kotlinx.android.synthetic.main.activity_preview_pdf.* -import kotlinx.android.synthetic.main.include_base_title.* -import java.io.File -import java.io.FileInputStream - - -class PreviewPdfActivity : KotlinBaseActivity() { - - override fun initData() { - val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! - titleView.text = minioFileName - - val url = minioFileName.combineFilePath() - url.downloadFile(createDownloadFileDir().toString(), - object : OnDownloadListener { - override fun onDownloadStart(totalBytes: Long) { - runOnUiThread { - LoadingDialogHub.show(this@PreviewPdfActivity, "附件加载中") - } - } - - override fun onProgressChanged(currentBytes: Long) { - - } - - override fun onDownloadEnd(file: File?) { - runOnUiThread { - LoadingDialogHub.dismiss() - } - val inputStream = FileInputStream(file) - pdfView.fromStream(inputStream).load() - } - }) - } - - override fun initEvent() { - leftBackView.setOnClickListener { finish() } - } - - override fun initLayoutView(): Int = R.layout.activity_preview_pdf - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/PreviewTextActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/PreviewTextActivity.kt deleted file mode 100644 index d634ca3..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/PreviewTextActivity.kt +++ /dev/null @@ -1,60 +0,0 @@ -package com.casic.xz.meterage.view - -import com.casic.xz.meterage.R -import com.casic.xz.meterage.extensions.combineFilePath -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.utils.LoadingDialogHub -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.callback.OnDownloadListener -import com.pengxh.kt.lite.extensions.createDownloadFileDir -import com.pengxh.kt.lite.extensions.downloadFile -import com.pengxh.kt.lite.extensions.read -import com.pengxh.kt.lite.utils.Constant -import kotlinx.android.synthetic.main.activity_preview_txt.* -import kotlinx.android.synthetic.main.include_base_title.* -import java.io.File - -class PreviewTextActivity : KotlinBaseActivity() { - - override fun initData() { - val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! - titleView.text = minioFileName - - val url = minioFileName.combineFilePath() - url.downloadFile(createDownloadFileDir().toString(), - object : OnDownloadListener { - override fun onDownloadStart(totalBytes: Long) { - runOnUiThread { - LoadingDialogHub.show(this@PreviewTextActivity, "附件加载中") - } - } - - override fun onProgressChanged(currentBytes: Long) { - - } - - override fun onDownloadEnd(file: File?) { - runOnUiThread { - LoadingDialogHub.dismiss() - textView.text = file?.read() - } - } - }) - } - - override fun initEvent() { - leftBackView.setOnClickListener { finish() } - } - - override fun initLayoutView(): Int = R.layout.activity_preview_txt - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentActivity.kt new file mode 100644 index 0000000..35ca098 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentActivity.kt @@ -0,0 +1,158 @@ +package com.casic.xz.meterage.view.home + +import android.os.Handler +import androidx.lifecycle.ViewModelProvider +import androidx.recyclerview.widget.DividerItemDecoration +import com.casic.xz.meterage.R +import com.casic.xz.meterage.adapter.EquipmentListAdapter +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.extensions.showEmptyPage +import com.casic.xz.meterage.model.EquipmentListModel +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.casic.xz.meterage.vm.EquipmentViewModel +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.extensions.navigatePageTo +import com.pengxh.kt.lite.extensions.show +import com.pengxh.kt.lite.utils.WeakReferenceHandler +import com.pengxh.kt.lite.vm.LoadState +import kotlinx.android.synthetic.main.activity_equipment.* +import kotlinx.android.synthetic.main.include_empty_view.* +import kotlinx.android.synthetic.main.include_search_title.* + +class EquipmentActivity : KotlinBaseActivity() { + + private lateinit var weakReferenceHandler: WeakReferenceHandler + private lateinit var equipmentViewModel: EquipmentViewModel + private lateinit var equipmentListAdapter: EquipmentListAdapter + private var dataBeans: MutableList = ArrayList() + private var pageIndex = 1 + private var isRefresh = false + private var isLoadMore = false + + override fun initData() { + weakReferenceHandler = WeakReferenceHandler(callback) + equipmentViewModel = ViewModelProvider(this)[EquipmentViewModel::class.java] + equipmentViewModel.equipmentResult.observe(this, { + if (it.code == 200) { + val dataRows = it.data?.rows!! + when { + isRefresh -> { + dataBeans.clear() + dataBeans = dataRows + equipmentLayout.finishRefresh() + isRefresh = false + } + isLoadMore -> { + if (dataRows.size == 0) { + "到底了,别拉了".show(this) + } + dataBeans.addAll(dataRows) + equipmentLayout.finishLoadMore() + isLoadMore = false + } + else -> { + dataBeans = dataRows + } + } + weakReferenceHandler.sendEmptyMessage(2023020801) + } + }) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + rightOperateView.setOnClickListener { + + } + + equipmentLayout.setOnRefreshListener { + isRefresh = true + //刷新之后页码重置 + pageIndex = 1 + getEquipmentListByPage() + } + + equipmentLayout.setOnLoadMoreListener { + isLoadMore = true + pageIndex++ + getEquipmentListByPage() + } + } + + override fun initLayoutView(): Int = R.layout.activity_equipment + + override fun observeRequestState() { + equipmentViewModel.loadState.observe(this, { + when (it) { + LoadState.Loading -> LoadingDialogHub.show(this, "数据加载中...") + else -> LoadingDialogHub.dismiss() + } + }) + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + titleView.text = "仪器设备" + } + + override fun onResume() { + super.onResume() + pageIndex = 1 + getEquipmentListByPage() + } + + private fun getEquipmentListByPage() { + equipmentViewModel.getEquipmentList( + "", + "", + "", + "", + "", + "1", + "", + "", + "", + "", + "", + "", + "", + "", + arrayOf(), + pageIndex + ) + } + + private val callback = Handler.Callback { + when (it.what) { + 2023020801 -> { + if (isRefresh || isLoadMore) { + equipmentListAdapter.notifyDataSetChanged() + } else { + if (dataBeans.size == 0) { + emptyView!!.showEmptyPage("无设备") { + pageIndex = 1 + getEquipmentListByPage() + } + } else { + emptyView!!.hide() + equipmentListAdapter = EquipmentListAdapter(this, dataBeans) + equipmentRecyclerView.addItemDecoration( + DividerItemDecoration(this, DividerItemDecoration.VERTICAL) + ) + equipmentRecyclerView.adapter = equipmentListAdapter + equipmentListAdapter.setOnItemClickListener(object : + EquipmentListAdapter.OnItemClickListener { + override fun onItemClicked(position: Int) { + val rowsModel = dataBeans[position] + navigatePageTo(rowsModel.id) + } + }) + } + } + } + } + true + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentDetailActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentDetailActivity.kt new file mode 100644 index 0000000..7dee13c --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentDetailActivity.kt @@ -0,0 +1,53 @@ +package com.casic.xz.meterage.view.home + +import androidx.fragment.app.Fragment +import com.casic.xz.meterage.R +import com.casic.xz.meterage.adapter.SubViewPagerAdapter +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.fragment.equipment.* +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.utils.Constant +import kotlinx.android.synthetic.main.activity_equipment.rootView +import kotlinx.android.synthetic.main.activity_equipment_detail.* +import kotlinx.android.synthetic.main.include_base_title.* + +class EquipmentDetailActivity : KotlinBaseActivity() { + + private var fragmentPages: ArrayList = ArrayList() + + override fun initData() { + val equipmentId = intent.getStringExtra(Constant.INTENT_PARAM)!! + + fragmentPages.add(BasicInformationFragment(equipmentId)) + fragmentPages.add(InspectionRecordFragment()) + fragmentPages.add(ChangeRecordFragment()) + fragmentPages.add(UsageRecordFragment()) + fragmentPages.add(CertificateFragment()) + + val equipmentPageTitles = arrayOf("基础信息", "周检记录", "状态变更记录", "使用记录", "检定证书") + + equipmentViewPager.adapter = SubViewPagerAdapter( + supportFragmentManager, fragmentPages, equipmentPageTitles + ) + equipmentViewPager.offscreenPageLimit = fragmentPages.size + //绑定 + topTabLayout.setupWithViewPager(equipmentViewPager) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + } + + override fun initLayoutView(): Int = R.layout.activity_equipment_detail + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + titleView.text = "仪器设备" + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeDetailActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeDetailActivity.kt new file mode 100644 index 0000000..6fe0022 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeDetailActivity.kt @@ -0,0 +1,105 @@ +package com.casic.xz.meterage.view.notice + +import android.annotation.SuppressLint +import android.graphics.Paint +import androidx.lifecycle.ViewModelProvider +import com.casic.xz.meterage.R +import com.casic.xz.meterage.extensions.combineImagePath +import com.casic.xz.meterage.extensions.formatTextFromHtml +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.view.BigImageActivity +import com.casic.xz.meterage.vm.NoticeViewModel +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.extensions.convertColor +import com.pengxh.kt.lite.extensions.navigatePageTo +import com.pengxh.kt.lite.extensions.obtainScreenWidth +import com.pengxh.kt.lite.extensions.show +import com.pengxh.kt.lite.utils.Constant +import kotlinx.android.synthetic.main.activity_notice_detail.* +import kotlinx.android.synthetic.main.include_base_title.* +import java.util.* + +@SuppressLint("SetTextI18n") +class NoticeDetailActivity : KotlinBaseActivity() { + + private lateinit var noticeViewModel: NoticeViewModel + + override fun initData() { + leftBackView.setOnClickListener { finish() } + titleView.text = "通知公告" + + val args = intent.getStringArrayListExtra(Constant.INTENT_PARAM)!! + + noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] + noticeViewModel.getNoticeList(args[0], args[1], args[2], "", "", 1) + noticeViewModel.noticeResult.observe(this, { + if (it.code == 200) { + val dataRow = it.data?.rows!![0] + + noticeDateView.text = dataRow.noticeTime + noticePublisherView.text = "发布人 ${dataRow.noticePublisher}" + noticeCompanyView.text = "发布单位 ${dataRow.noticeCompany}" + + noticeNoView.text = dataRow.noticeNo + noticeTitleView.text = dataRow.noticeTitle + noticeSketchView.text = dataRow.noticeSketch + + dataRow.noticeContent.formatTextFromHtml( + this, noticeContentView, obtainScreenWidth() + ) + + if (dataRow.minioFileName.isNullOrBlank()) { + minioFileView.text = "暂无附件" + } else { + val minioFileName = dataRow.minioFileName + + minioFileView.text = minioFileName + val textPaint = minioFileView.paint + textPaint.flags = Paint.UNDERLINE_TEXT_FLAG + textPaint.isAntiAlias = true + minioFileView.setTextColor(R.color.themeColor.convertColor(this)) + + minioFileView.setOnClickListener { + //查看附件 + if (minioFileName.endsWith("pdf")) { + navigatePageTo(minioFileName) + } else if ( + minioFileName.endsWith("doc") || + minioFileName.endsWith("docx") + ) { + navigatePageTo(minioFileName) + } else if (minioFileName.endsWith("txt")) { + navigatePageTo(minioFileName) + } else if ( + minioFileName.endsWith("png") || + minioFileName.endsWith("jpeg") || + minioFileName.endsWith("jpg") + ) { + val urls = ArrayList() + urls.add(minioFileName.combineImagePath()) + navigatePageTo(0, urls) + } else { + "文件类型未知,无法打开附件".show(this) + } + } + } + } + }) + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.activity_notice_detail + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeListActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeListActivity.kt new file mode 100644 index 0000000..31c0490 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeListActivity.kt @@ -0,0 +1,180 @@ +package com.casic.xz.meterage.view.notice + +import android.os.Handler +import android.util.Log +import android.view.View +import androidx.lifecycle.ViewModelProvider +import com.casic.xz.meterage.R +import com.casic.xz.meterage.adapter.NoticeListAdapter +import com.casic.xz.meterage.extensions.addAll +import com.casic.xz.meterage.extensions.combineFilePath +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.extensions.showEmptyPage +import com.casic.xz.meterage.model.NoticeListModel +import com.casic.xz.meterage.vm.NoticeViewModel +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.extensions.navigatePageTo +import com.pengxh.kt.lite.extensions.show +import com.pengxh.kt.lite.utils.WeakReferenceHandler +import com.pengxh.kt.lite.widget.dialog.AlertControlDialog +import kotlinx.android.synthetic.main.activity_notice_list.* +import kotlinx.android.synthetic.main.include_empty_view.* + +class NoticeListActivity : KotlinBaseActivity() { + + private lateinit var weakReferenceHandler: WeakReferenceHandler + private lateinit var noticeViewModel: NoticeViewModel + private lateinit var noticeListAdapter: NoticeListAdapter + private var dataBeans: MutableList = ArrayList() + private var pageIndex = 1 + private var isRefresh = false + private var isLoadMore = false + + override fun initData() { + weakReferenceHandler = WeakReferenceHandler(callback) + noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] + noticeViewModel.noticeResult.observe(this, { + if (it.code == 200) { + val dataRows = it.data?.rows!! +// countBadeNumber(dataRows) + when { + isRefresh -> { + dataBeans.clear() + dataBeans = dataRows + noticeLayout.finishRefresh() + isRefresh = false + } + isLoadMore -> { + if (dataRows.size == 0) { + "到底了,别拉了".show(this) + } + dataBeans.addAll(dataRows) + noticeLayout.finishLoadMore() + isLoadMore = false + } + else -> { + dataBeans = dataRows + } + } + weakReferenceHandler.sendEmptyMessage(2023013101) + } + }) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + rightOperateView.setOnClickListener { + AlertControlDialog.Builder() + .setContext(this) + .setTitle("提示") + .setMessage("确定将所有未读消息标为已读?") + .setNegativeButton("取消") + .setPositiveButton("确定") + .setOnDialogButtonClickListener(object : + AlertControlDialog.OnDialogButtonClickListener { + override fun onCancelClick() { + + } + + override fun onConfirmClick() { + //TODO 设置为已读 + } + }).build().show() + } + + if (hasNoticePermission()) { + openSystemNoticeLayout.visibility = View.GONE + openSystemNoticeLayout.visibility = View.GONE + } else { + openSystemNoticeLayout.setOnClickListener { + + } + + + closeLayoutView.setOnClickListener { + openSystemNoticeLayout.visibility = View.GONE + } + } + + noticeLayout.setOnRefreshListener { + isRefresh = true + //刷新之后页码重置 + pageIndex = 1 + getNoticeListByPage() + } + + noticeLayout.setOnLoadMoreListener { + isLoadMore = true + pageIndex++ + getNoticeListByPage() + } + } + + override fun onResume() { + super.onResume() + pageIndex = 1 + getNoticeListByPage() + } + + private fun getNoticeListByPage() { + noticeViewModel.getNoticeList("", "", "", "", "", pageIndex) + } + + private val callback = Handler.Callback { + when (it.what) { + 2023013101 -> { + if (isRefresh || isLoadMore) { + noticeListAdapter.notifyDataSetChanged() + } else { + if (dataBeans.size == 0) { + emptyView!!.showEmptyPage("没有任何消息") { + pageIndex = 1 + getNoticeListByPage() + } + } else { + emptyView!!.hide() + noticeListAdapter = NoticeListAdapter(this, dataBeans) + noticeRecyclerView.adapter = noticeListAdapter + noticeListAdapter.setOnItemClickListener(object : + NoticeListAdapter.OnItemClickListener { + override fun onItemClicked(position: Int) { + val rowsModel = dataBeans[position] + val allArgs = addAll( + rowsModel.noticeNo, + rowsModel.noticeTitle, + rowsModel.noticePublisher, + "", + "" + ) + Log.d( + "Casic", + "NoticeListActivity => onItemClicked: ${rowsModel.minioFileName.combineFilePath()}" + ) + navigatePageTo(allArgs) + } + }) + } + } + } + } + true + } + + //TODO 判断是否开启通知权限 + private fun hasNoticePermission(): Boolean { + + return false + } + + override fun initLayoutView(): Int = R.layout.activity_notice_list + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewDocumentActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewDocumentActivity.kt new file mode 100644 index 0000000..4b16ae8 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewDocumentActivity.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.view.notice + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseActivity + +class PreviewDocumentActivity : KotlinBaseActivity() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.activity_preview_doc + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewPdfActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewPdfActivity.kt new file mode 100644 index 0000000..fad73b6 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewPdfActivity.kt @@ -0,0 +1,62 @@ +package com.casic.xz.meterage.view.notice + +import com.casic.xz.meterage.R +import com.casic.xz.meterage.extensions.combineFilePath +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.callback.OnDownloadListener +import com.pengxh.kt.lite.extensions.createDownloadFileDir +import com.pengxh.kt.lite.extensions.downloadFile +import com.pengxh.kt.lite.utils.Constant +import kotlinx.android.synthetic.main.activity_preview_pdf.* +import kotlinx.android.synthetic.main.include_base_title.* +import java.io.File +import java.io.FileInputStream + + +class PreviewPdfActivity : KotlinBaseActivity() { + + override fun initData() { + val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! + titleView.text = minioFileName + + val url = minioFileName.combineFilePath() + url.downloadFile(createDownloadFileDir().toString(), + object : OnDownloadListener { + override fun onDownloadStart(totalBytes: Long) { + runOnUiThread { + LoadingDialogHub.show(this@PreviewPdfActivity, "附件加载中") + } + } + + override fun onProgressChanged(currentBytes: Long) { + + } + + override fun onDownloadEnd(file: File?) { + runOnUiThread { + LoadingDialogHub.dismiss() + } + val inputStream = FileInputStream(file) + pdfView.fromStream(inputStream).load() + } + }) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + } + + override fun initLayoutView(): Int = R.layout.activity_preview_pdf + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewTextActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewTextActivity.kt new file mode 100644 index 0000000..d7850fb --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewTextActivity.kt @@ -0,0 +1,60 @@ +package com.casic.xz.meterage.view.notice + +import com.casic.xz.meterage.R +import com.casic.xz.meterage.extensions.combineFilePath +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.callback.OnDownloadListener +import com.pengxh.kt.lite.extensions.createDownloadFileDir +import com.pengxh.kt.lite.extensions.downloadFile +import com.pengxh.kt.lite.extensions.read +import com.pengxh.kt.lite.utils.Constant +import kotlinx.android.synthetic.main.activity_preview_txt.* +import kotlinx.android.synthetic.main.include_base_title.* +import java.io.File + +class PreviewTextActivity : KotlinBaseActivity() { + + override fun initData() { + val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! + titleView.text = minioFileName + + val url = minioFileName.combineFilePath() + url.downloadFile(createDownloadFileDir().toString(), + object : OnDownloadListener { + override fun onDownloadStart(totalBytes: Long) { + runOnUiThread { + LoadingDialogHub.show(this@PreviewTextActivity, "附件加载中") + } + } + + override fun onProgressChanged(currentBytes: Long) { + + } + + override fun onDownloadEnd(file: File?) { + runOnUiThread { + LoadingDialogHub.dismiss() + textView.text = file?.read() + } + } + }) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + } + + override fun initLayoutView(): Int = R.layout.activity_preview_txt + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/vm/EquipmentViewModel.kt b/app/src/main/java/com/casic/xz/meterage/vm/EquipmentViewModel.kt new file mode 100644 index 0000000..b5f21f6 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/vm/EquipmentViewModel.kt @@ -0,0 +1,92 @@ +package com.casic.xz.meterage.vm + +import androidx.lifecycle.MutableLiveData +import com.casic.xz.meterage.base.BaseApplication +import com.casic.xz.meterage.extensions.separateResponseCode +import com.casic.xz.meterage.extensions.toErrorMessage +import com.casic.xz.meterage.model.EquipmentDetailModel +import com.casic.xz.meterage.model.EquipmentListModel +import com.casic.xz.meterage.utils.retrofit.RetrofitServiceManager +import com.google.gson.Gson +import com.google.gson.reflect.TypeToken +import com.pengxh.kt.lite.extensions.launch +import com.pengxh.kt.lite.extensions.show +import com.pengxh.kt.lite.vm.BaseViewModel +import com.pengxh.kt.lite.vm.LoadState + +class EquipmentViewModel : BaseViewModel() { + + private val gson by lazy { Gson() } + val equipmentResult = MutableLiveData() + val equipmentDetailResult = MutableLiveData() + + fun getEquipmentList( + equipmentNo: String, + equipmentName: String, + mesureType: String, + managerState: String, + useDept: String, + assetType: String, + equipmentCategory: String, + isCalibrationTestEquipment: String, + isMeasureAccount: String, + isStandardSupportEquipment: String, + isFixedAssets: String, + validStartDate: String, + validEndDate: String, + abc: String, + ids: Array, + offset: Int + ) = launch({ + loadState.value = LoadState.Loading + val response = RetrofitServiceManager.getEquipmentList( + equipmentNo, + equipmentName, + mesureType, + managerState, + useDept, + assetType, + equipmentCategory, + isCalibrationTestEquipment, + isMeasureAccount, + isStandardSupportEquipment, + isFixedAssets, + validStartDate, + validEndDate, + abc, + ids, + offset + ) + val responseCode = response.separateResponseCode() + if (responseCode == 200) { + loadState.value = LoadState.Success + equipmentResult.value = gson.fromJson( + response, object : TypeToken() {}.type + ) + } else { + loadState.value = LoadState.Fail + response.toErrorMessage().show(BaseApplication.get()) + } + }, { + loadState.value = LoadState.Fail + it.printStackTrace() + }) + + fun getEquipmentDetail(id: String) = launch({ + loadState.value = LoadState.Loading + val response = RetrofitServiceManager.getEquipmentDetail(id) + val responseCode = response.separateResponseCode() + if (responseCode == 200) { + loadState.value = LoadState.Success + equipmentDetailResult.value = gson.fromJson( + response, object : TypeToken() {}.type + ) + } else { + loadState.value = LoadState.Fail + response.toErrorMessage().show(BaseApplication.get()) + } + }, { + loadState.value = LoadState.Fail + it.printStackTrace() + }) +} \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_sorting.xml b/app/src/main/res/drawable/ic_sorting.xml new file mode 100644 index 0000000..252bfe6 --- /dev/null +++ b/app/src/main/res/drawable/ic_sorting.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/layout/activity_equipment.xml b/app/src/main/res/layout/activity_equipment.xml new file mode 100644 index 0000000..d6a64b1 --- /dev/null +++ b/app/src/main/res/layout/activity_equipment.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_equipment_detail.xml b/app/src/main/res/layout/activity_equipment_detail.xml new file mode 100644 index 0000000..7254762 --- /dev/null +++ b/app/src/main/res/layout/activity_equipment_detail.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_basic_information.xml b/app/src/main/res/layout/fragment_basic_information.xml new file mode 100644 index 0000000..4a3c1c7 --- /dev/null +++ b/app/src/main/res/layout/fragment_basic_information.xml @@ -0,0 +1,390 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_certificate.xml b/app/src/main/res/layout/fragment_certificate.xml new file mode 100644 index 0000000..77d9ef6 --- /dev/null +++ b/app/src/main/res/layout/fragment_certificate.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_change_record.xml b/app/src/main/res/layout/fragment_change_record.xml new file mode 100644 index 0000000..77d9ef6 --- /dev/null +++ b/app/src/main/res/layout/fragment_change_record.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_home.xml b/app/src/main/res/layout/fragment_home.xml index 41b32a9..e1ab759 100644 --- a/app/src/main/res/layout/fragment_home.xml +++ b/app/src/main/res/layout/fragment_home.xml @@ -71,7 +71,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" app:layoutManager="androidx.recyclerview.widget.GridLayoutManager" - app:spanCount="5" /> + app:spanCount="4" /> + + + \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 3892b5a..02160cd 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -34,16 +34,18 @@ - - - - - - - + + + + + + + + + +) : RecyclerView.Adapter() { + + private var layoutInflater: LayoutInflater = LayoutInflater.from(context) + + override fun getItemCount(): Int = dataRows.size + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = ItemViewHolder( + layoutInflater.inflate(R.layout.item_equipment_rv_l, parent, false) + ) + + override fun onBindViewHolder(holder: ItemViewHolder, position: Int) { + //绑定数据 + val rowsBean = dataRows[position] + holder.equipmentNameView.text = rowsBean.equipmentName + holder.equipmentCodeView.text = rowsBean.equipmentNo + holder.equipmentDateView.text = rowsBean.enableDate + holder.equipmentLibView.text = rowsBean.useDeptName + + //绑定事件 + holder.itemView.setOnClickListener { + listener?.onItemClicked(position) + } + } + + inner class ItemViewHolder(view: View) : RecyclerView.ViewHolder(view) { + var equipmentNameView: TextView = view.findViewById(R.id.equipmentNameView) + var equipmentCodeView: TextView = view.findViewById(R.id.equipmentCodeView) + var equipmentDateView: TextView = view.findViewById(R.id.equipmentDateView) + var equipmentLibView: TextView = view.findViewById(R.id.equipmentLibView) + } + + private var listener: OnItemClickListener? = null + + interface OnItemClickListener { + fun onItemClicked(position: Int) + } + + fun setOnItemClickListener(onClickListener: OnItemClickListener?) { + this.listener = onClickListener + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt index b4628f3..d970b55 100644 --- a/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt +++ b/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt @@ -5,7 +5,8 @@ import com.casic.xz.meterage.R import com.casic.xz.meterage.adapter.HomeGridAdapter import com.casic.xz.meterage.utils.LocaleConstant -import com.casic.xz.meterage.view.NoticeListActivity +import com.casic.xz.meterage.view.home.EquipmentActivity +import com.casic.xz.meterage.view.notice.NoticeListActivity import com.casic.xz.meterage.vm.NoticeViewModel import com.pengxh.kt.lite.base.KotlinBaseFragment import com.pengxh.kt.lite.extensions.navigatePageTo @@ -36,8 +37,19 @@ homeFuncRecyclerView.adapter = homeAdapter homeAdapter.setOnGridItemClickListener(object : HomeGridAdapter.OnGridItemClickListener { override fun onItemClick(position: Int) { - when (position) { - + when (LocaleConstant.HOME_FUNC_OPERATE[position]) { + "仪器设备" -> requireContext().navigatePageTo() +// "标准装置" -> requireContext().navigatePageTo() +// "证书报告" -> requireContext().navigatePageTo() +// "委托需求" -> requireContext().navigatePageTo() +// "访客" -> requireContext().navigatePageTo() +// "标准规范" -> requireContext().navigatePageTo() +// "能力列表" -> requireContext().navigatePageTo() +// "计量培训" -> requireContext().navigatePageTo() +// "合同发票" -> requireContext().navigatePageTo() +// "业务统计" -> requireContext().navigatePageTo() +// "客户列表" -> requireContext().navigatePageTo() +// "外场检测" -> requireContext().navigatePageTo() } } }) diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt index 7e75abe..56dc5ec 100644 --- a/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt +++ b/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt @@ -2,9 +2,11 @@ import android.view.View import androidx.lifecycle.ViewModelProvider +import com.bumptech.glide.Glide +import com.bumptech.glide.request.RequestOptions import com.casic.xz.meterage.R import com.casic.xz.meterage.utils.LocaleConstant -import com.casic.xz.meterage.view.NoticeListActivity +import com.casic.xz.meterage.view.notice.NoticeListActivity import com.casic.xz.meterage.vm.NoticeViewModel import com.casic.xz.meterage.vm.UserViewModel import com.pengxh.kt.lite.base.KotlinBaseFragment @@ -23,6 +25,12 @@ val data = it.data userNameView.text = data.name userUnitView.text = data.deptName + +// Glide.with(requireContext()) +// .load(R.mipmap.default_avatar) +// .apply(RequestOptions.circleCropTransform()) +// .placeholder(R.mipmap.load_image_error) +// .into(userAvatarView) } }) diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt new file mode 100644 index 0000000..cf22646 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt @@ -0,0 +1,103 @@ +package com.casic.xz.meterage.fragment.equipment + +import android.graphics.Paint +import androidx.lifecycle.ViewModelProvider +import com.casic.xz.meterage.R +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.casic.xz.meterage.vm.EquipmentViewModel +import com.pengxh.kt.lite.base.KotlinBaseFragment +import com.pengxh.kt.lite.extensions.convertColor +import com.pengxh.kt.lite.vm.LoadState +import kotlinx.android.synthetic.main.fragment_basic_information.* + +class BasicInformationFragment(private val id: String) : KotlinBaseFragment() { + + private lateinit var equipmentViewModel: EquipmentViewModel + + override fun initData() { + equipmentViewModel = ViewModelProvider(this)[EquipmentViewModel::class.java] + equipmentViewModel.getEquipmentDetail(id) + equipmentViewModel.equipmentDetailResult.observe(this, { + if (it.code == 200) { + val data = it.data!! + + equipmentCodeView.text = data.equipmentNo + equipmentNameView.text = data.equipmentName + manufacturerView.text = data.manufacturer + factoryNumberView.text = data.manufacturingNo + modelView.text = data.modelNo + verificationMethodView.text = data.mesureTypeName + measuringRangeView.text = data.mesureRange + uncertaintyView.text = data.uncertainty + firstUseView.text = data.createTime + originalValueView.text = data.originValue + usageDeptView.text = data.useDeptName + userView.text = data.usePersonName + managementStatusView.text = data.managerStateName + verificationDeptView.text = data.useDeptName +// nextVerificationDeptView.text = data. + verificationPeriodView.text = data.mesureCycle + verificationDateView.text = data.mesureDate + effectiveDateView.text = data.validDate + verificationResultsView.text = data.mesureResultName + abcView.text = data.abcName + isNeedTechnicalView.text = if ( + data.isCalibrationTestEquipment.isNullOrBlank() || data.isCalibrationTestEquipment == "0" + ) { + "否" + } else { + "是" + } + + isStandingBook.text = if ( + data.isMeasureAccount.isNullOrBlank() || data.isMeasureAccount == "0" + ) { + "否" + } else { + "是" + } + + isStandardView.text = if ( + data.isStandardSupportEquipment.isNullOrBlank() || data.isStandardSupportEquipment == "0" + ) { + "否" + } else { + "是" + } + remarkView.text = data.remark + if (data.fileList.size == 0) { + instructionsView.text = "暂无" + } else { + instructionsView.text = "查看附件列表" + val textPaint = instructionsView.paint + textPaint.flags = Paint.UNDERLINE_TEXT_FLAG + textPaint.isAntiAlias = true + instructionsView.setTextColor(R.color.themeColor.convertColor(requireContext())) + + instructionsView.setOnClickListener { + + } + } + } + }) + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_basic_information + + override fun observeRequestState() { + equipmentViewModel.loadState.observe(this, { + when (it) { + LoadState.Loading -> LoadingDialogHub.show(requireActivity(), "数据加载中...") + else -> LoadingDialogHub.dismiss() + } + }) + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt new file mode 100644 index 0000000..0b4a747 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class CertificateFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_certificate + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt new file mode 100644 index 0000000..f05c491 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class ChangeRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_change_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt new file mode 100644 index 0000000..849ffa5 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class InspectionRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_inspection_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt new file mode 100644 index 0000000..aa4edd9 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class UsageRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_usage_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java b/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java new file mode 100644 index 0000000..0b9124e --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java @@ -0,0 +1,760 @@ +package com.casic.xz.meterage.model; + +import java.util.List; + +public class EquipmentDetailModel { + + private int code; + private DataModel data; + private String message; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataModel getData() { + return data; + } + + public void setData(DataModel data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public static class DataModel { + private String abc; + private String abcName; + private String assetNo; + private String assetSource; + private String assetType; + private String assetTypeName; + private String attribute; + private String capitalSource; + private String capitalSourceName; + private String cardEstablishmentDate; + private String createTime; + private String createUser; + private String depreciationMethod; + private String depreciationMethodName; + private String depreciationPeriod; + private String enableDate; + private String equipmentCategory; + private String equipmentCategoryName; + private String equipmentName; + private String equipmentNo; + private String equipmentSpecifications; + private String equipmentType; + private String equipmentTypeName; + private List fileList; + private String id; + private String installIncidentalExpenses; + private String installPlace; + private String intactState; + private String isCalibrationTestEquipment; + private int isDel; + private String isFixedAssets; + private String isMeasureAccount; + private String isStandardSupportEquipment; + private String labelBind; + private String majorCategory; + private String majorCategoryName; + private String managerLevel; + private String managerLevelName; + private String managerState; + private String managerStateName; + private String manufacturer; + private String manufacturerCountry; + private String manufacturingDate; + private String manufacturingNo; + private String mesureCycle; + private String mesureDate; + private String mesureDept; + private String mesureRange; + private String mesureResult; + private String mesureResultName; + private String mesureType; + private String mesureTypeName; + private String modelNo; + private String originValue; + private String overallDimension; + private String presentOriginValue; + private String purpose; + private String remark; + private String singlePrice; + private String supportStandardEquipmentName; + private String supportStandardEquipmentNo; + private String technicalLevel; + private String uncertainty; + private String updateTime; + private String useDept; + private String useDeptName; + private String usePerson; + private String usePersonName; + private String validDate; + private int version; + private String weight; + + public String getAbc() { + return abc; + } + + public void setAbc(String abc) { + this.abc = abc; + } + + public String getAbcName() { + return abcName; + } + + public void setAbcName(String abcName) { + this.abcName = abcName; + } + + public String getAssetNo() { + return assetNo; + } + + public void setAssetNo(String assetNo) { + this.assetNo = assetNo; + } + + public String getAssetSource() { + return assetSource; + } + + public void setAssetSource(String assetSource) { + this.assetSource = assetSource; + } + + public String getAssetType() { + return assetType; + } + + public void setAssetType(String assetType) { + this.assetType = assetType; + } + + public String getAssetTypeName() { + return assetTypeName; + } + + public void setAssetTypeName(String assetTypeName) { + this.assetTypeName = assetTypeName; + } + + public String getAttribute() { + return attribute; + } + + public void setAttribute(String attribute) { + this.attribute = attribute; + } + + public String getCapitalSource() { + return capitalSource; + } + + public void setCapitalSource(String capitalSource) { + this.capitalSource = capitalSource; + } + + public String getCapitalSourceName() { + return capitalSourceName; + } + + public void setCapitalSourceName(String capitalSourceName) { + this.capitalSourceName = capitalSourceName; + } + + public String getCardEstablishmentDate() { + return cardEstablishmentDate; + } + + public void setCardEstablishmentDate(String cardEstablishmentDate) { + this.cardEstablishmentDate = cardEstablishmentDate; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getDepreciationMethod() { + return depreciationMethod; + } + + public void setDepreciationMethod(String depreciationMethod) { + this.depreciationMethod = depreciationMethod; + } + + public String getDepreciationMethodName() { + return depreciationMethodName; + } + + public void setDepreciationMethodName(String depreciationMethodName) { + this.depreciationMethodName = depreciationMethodName; + } + + public String getDepreciationPeriod() { + return depreciationPeriod; + } + + public void setDepreciationPeriod(String depreciationPeriod) { + this.depreciationPeriod = depreciationPeriod; + } + + public String getEnableDate() { + return enableDate; + } + + public void setEnableDate(String enableDate) { + this.enableDate = enableDate; + } + + public String getEquipmentCategory() { + return equipmentCategory; + } + + public void setEquipmentCategory(String equipmentCategory) { + this.equipmentCategory = equipmentCategory; + } + + public String getEquipmentCategoryName() { + return equipmentCategoryName; + } + + public void setEquipmentCategoryName(String equipmentCategoryName) { + this.equipmentCategoryName = equipmentCategoryName; + } + + public String getEquipmentName() { + return equipmentName; + } + + public void setEquipmentName(String equipmentName) { + this.equipmentName = equipmentName; + } + + public String getEquipmentNo() { + return equipmentNo; + } + + public void setEquipmentNo(String equipmentNo) { + this.equipmentNo = equipmentNo; + } + + public String getEquipmentSpecifications() { + return equipmentSpecifications; + } + + public void setEquipmentSpecifications(String equipmentSpecifications) { + this.equipmentSpecifications = equipmentSpecifications; + } + + public String getEquipmentType() { + return equipmentType; + } + + public void setEquipmentType(String equipmentType) { + this.equipmentType = equipmentType; + } + + public String getEquipmentTypeName() { + return equipmentTypeName; + } + + public void setEquipmentTypeName(String equipmentTypeName) { + this.equipmentTypeName = equipmentTypeName; + } + + public List getFileList() { + return fileList; + } + + public void setFileList(List fileList) { + this.fileList = fileList; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getInstallIncidentalExpenses() { + return installIncidentalExpenses; + } + + public void setInstallIncidentalExpenses(String installIncidentalExpenses) { + this.installIncidentalExpenses = installIncidentalExpenses; + } + + public String getInstallPlace() { + return installPlace; + } + + public void setInstallPlace(String installPlace) { + this.installPlace = installPlace; + } + + public String getIntactState() { + return intactState; + } + + public void setIntactState(String intactState) { + this.intactState = intactState; + } + + public String getIsCalibrationTestEquipment() { + return isCalibrationTestEquipment; + } + + public void setIsCalibrationTestEquipment(String isCalibrationTestEquipment) { + this.isCalibrationTestEquipment = isCalibrationTestEquipment; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getIsFixedAssets() { + return isFixedAssets; + } + + public void setIsFixedAssets(String isFixedAssets) { + this.isFixedAssets = isFixedAssets; + } + + public String getIsMeasureAccount() { + return isMeasureAccount; + } + + public void setIsMeasureAccount(String isMeasureAccount) { + this.isMeasureAccount = isMeasureAccount; + } + + public String getIsStandardSupportEquipment() { + return isStandardSupportEquipment; + } + + public void setIsStandardSupportEquipment(String isStandardSupportEquipment) { + this.isStandardSupportEquipment = isStandardSupportEquipment; + } + + public String getLabelBind() { + return labelBind; + } + + public void setLabelBind(String labelBind) { + this.labelBind = labelBind; + } + + public String getMajorCategory() { + return majorCategory; + } + + public void setMajorCategory(String majorCategory) { + this.majorCategory = majorCategory; + } + + public String getMajorCategoryName() { + return majorCategoryName; + } + + public void setMajorCategoryName(String majorCategoryName) { + this.majorCategoryName = majorCategoryName; + } + + public String getManagerLevel() { + return managerLevel; + } + + public void setManagerLevel(String managerLevel) { + this.managerLevel = managerLevel; + } + + public String getManagerLevelName() { + return managerLevelName; + } + + public void setManagerLevelName(String managerLevelName) { + this.managerLevelName = managerLevelName; + } + + public String getManagerState() { + return managerState; + } + + public void setManagerState(String managerState) { + this.managerState = managerState; + } + + public String getManagerStateName() { + return managerStateName; + } + + public void setManagerStateName(String managerStateName) { + this.managerStateName = managerStateName; + } + + public String getManufacturer() { + return manufacturer; + } + + public void setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + } + + public String getManufacturerCountry() { + return manufacturerCountry; + } + + public void setManufacturerCountry(String manufacturerCountry) { + this.manufacturerCountry = manufacturerCountry; + } + + public String getManufacturingDate() { + return manufacturingDate; + } + + public void setManufacturingDate(String manufacturingDate) { + this.manufacturingDate = manufacturingDate; + } + + public String getManufacturingNo() { + return manufacturingNo; + } + + public void setManufacturingNo(String manufacturingNo) { + this.manufacturingNo = manufacturingNo; + } + + public String getMesureCycle() { + return mesureCycle; + } + + public void setMesureCycle(String mesureCycle) { + this.mesureCycle = mesureCycle; + } + + public String getMesureDate() { + return mesureDate; + } + + public void setMesureDate(String mesureDate) { + this.mesureDate = mesureDate; + } + + public String getMesureDept() { + return mesureDept; + } + + public void setMesureDept(String mesureDept) { + this.mesureDept = mesureDept; + } + + public String getMesureRange() { + return mesureRange; + } + + public void setMesureRange(String mesureRange) { + this.mesureRange = mesureRange; + } + + public String getMesureResult() { + return mesureResult; + } + + public void setMesureResult(String mesureResult) { + this.mesureResult = mesureResult; + } + + public String getMesureResultName() { + return mesureResultName; + } + + public void setMesureResultName(String mesureResultName) { + this.mesureResultName = mesureResultName; + } + + public String getMesureType() { + return mesureType; + } + + public void setMesureType(String mesureType) { + this.mesureType = mesureType; + } + + public String getMesureTypeName() { + return mesureTypeName; + } + + public void setMesureTypeName(String mesureTypeName) { + this.mesureTypeName = mesureTypeName; + } + + public String getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getOriginValue() { + return originValue; + } + + public void setOriginValue(String originValue) { + this.originValue = originValue; + } + + public String getOverallDimension() { + return overallDimension; + } + + public void setOverallDimension(String overallDimension) { + this.overallDimension = overallDimension; + } + + public String getPresentOriginValue() { + return presentOriginValue; + } + + public void setPresentOriginValue(String presentOriginValue) { + this.presentOriginValue = presentOriginValue; + } + + public String getPurpose() { + return purpose; + } + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getSinglePrice() { + return singlePrice; + } + + public void setSinglePrice(String singlePrice) { + this.singlePrice = singlePrice; + } + + public String getSupportStandardEquipmentName() { + return supportStandardEquipmentName; + } + + public void setSupportStandardEquipmentName(String supportStandardEquipmentName) { + this.supportStandardEquipmentName = supportStandardEquipmentName; + } + + public String getSupportStandardEquipmentNo() { + return supportStandardEquipmentNo; + } + + public void setSupportStandardEquipmentNo(String supportStandardEquipmentNo) { + this.supportStandardEquipmentNo = supportStandardEquipmentNo; + } + + public String getTechnicalLevel() { + return technicalLevel; + } + + public void setTechnicalLevel(String technicalLevel) { + this.technicalLevel = technicalLevel; + } + + public String getUncertainty() { + return uncertainty; + } + + public void setUncertainty(String uncertainty) { + this.uncertainty = uncertainty; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getUseDept() { + return useDept; + } + + public void setUseDept(String useDept) { + this.useDept = useDept; + } + + public String getUseDeptName() { + return useDeptName; + } + + public void setUseDeptName(String useDeptName) { + this.useDeptName = useDeptName; + } + + public String getUsePerson() { + return usePerson; + } + + public void setUsePerson(String usePerson) { + this.usePerson = usePerson; + } + + public String getUsePersonName() { + return usePersonName; + } + + public void setUsePersonName(String usePersonName) { + this.usePersonName = usePersonName; + } + + public String getValidDate() { + return validDate; + } + + public void setValidDate(String validDate) { + this.validDate = validDate; + } + + public int getVersion() { + return version; + } + + public void setVersion(int version) { + this.version = version; + } + + public String getWeight() { + return weight; + } + + public void setWeight(String weight) { + this.weight = weight; + } + + public static class FileListModel { + private String assetId; + private String createTime; + private String createUser; + private String fileName; + private String id; + private int isDel; + private String minioFileName; + private String remark; + private String updateTime; + + public String getAssetId() { + return assetId; + } + + public void setAssetId(String assetId) { + this.assetId = assetId; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getFileName() { + return fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getMinioFileName() { + return minioFileName; + } + + public void setMinioFileName(String minioFileName) { + this.minioFileName = minioFileName; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + } + } +} diff --git a/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java b/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java new file mode 100644 index 0000000..15fc128 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java @@ -0,0 +1,697 @@ +package com.casic.xz.meterage.model; + +import java.util.List; + +public class EquipmentListModel { + + private int code; + private DataModel data; + private String message; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataModel getData() { + return data; + } + + public void setData(DataModel data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public static class DataModel { + private List rows; + private int total; + + public List getRows() { + return rows; + } + + public void setRows(List rows) { + this.rows = rows; + } + + public int getTotal() { + return total; + } + + public void setTotal(int total) { + this.total = total; + } + + public static class RowsModel { + private String abc; + private String abcName; + private String assetNo; + private String assetSource; + private String assetType; + private String assetTypeName; + private String attribute; + private String capitalSource; + private String capitalSourceName; + private String cardEstablishmentDate; + private String createTime; + private String createUser; + private String depreciationMethod; + private String depreciationMethodName; + private String depreciationPeriod; + private String enableDate; + private String equipmentCategory; + private String equipmentCategoryName; + private String equipmentName; + private String equipmentNo; + private String equipmentSpecifications; + private String equipmentType; + private String equipmentTypeName; + private String fileList; + private String id; + private String installIncidentalExpenses; + private String installPlace; + private String intactState; + private String isCalibrationTestEquipment; + private int isDel; + private String isFixedAssets; + private String isMeasureAccount; + private String isStandardSupportEquipment; + private String labelBind; + private String majorCategory; + private String majorCategoryName; + private String managerLevel; + private String managerLevelName; + private String managerState; + private String managerStateName; + private String manufacturer; + private String manufacturerCountry; + private String manufacturingDate; + private String manufacturingNo; + private String mesureCycle; + private String mesureDate; + private String mesureDept; + private String mesureRange; + private String mesureResult; + private String mesureResultName; + private String mesureType; + private String mesureTypeName; + private String modelNo; + private String originValue; + private String overallDimension; + private String presentOriginValue; + private String purpose; + private String remark; + private String singlePrice; + private String supportStandardEquipmentName; + private String supportStandardEquipmentNo; + private String technicalLevel; + private String uncertainty; + private String updateTime; + private String useDept; + private String useDeptName; + private String usePerson; + private String usePersonName; + private String validDate; + private int version; + private String weight; + + public String getAbc() { + return abc; + } + + public void setAbc(String abc) { + this.abc = abc; + } + + public String getAbcName() { + return abcName; + } + + public void setAbcName(String abcName) { + this.abcName = abcName; + } + + public String getAssetNo() { + return assetNo; + } + + public void setAssetNo(String assetNo) { + this.assetNo = assetNo; + } + + public String getAssetSource() { + return assetSource; + } + + public void setAssetSource(String assetSource) { + this.assetSource = assetSource; + } + + public String getAssetType() { + return assetType; + } + + public void setAssetType(String assetType) { + this.assetType = assetType; + } + + public String getAssetTypeName() { + return assetTypeName; + } + + public void setAssetTypeName(String assetTypeName) { + this.assetTypeName = assetTypeName; + } + + public String getAttribute() { + return attribute; + } + + public void setAttribute(String attribute) { + this.attribute = attribute; + } + + public String getCapitalSource() { + return capitalSource; + } + + public void setCapitalSource(String capitalSource) { + this.capitalSource = capitalSource; + } + + public String getCapitalSourceName() { + return capitalSourceName; + } + + public void setCapitalSourceName(String capitalSourceName) { + this.capitalSourceName = capitalSourceName; + } + + public String getCardEstablishmentDate() { + return cardEstablishmentDate; + } + + public void setCardEstablishmentDate(String cardEstablishmentDate) { + this.cardEstablishmentDate = cardEstablishmentDate; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getDepreciationMethod() { + return depreciationMethod; + } + + public void setDepreciationMethod(String depreciationMethod) { + this.depreciationMethod = depreciationMethod; + } + + public String getDepreciationMethodName() { + return depreciationMethodName; + } + + public void setDepreciationMethodName(String depreciationMethodName) { + this.depreciationMethodName = depreciationMethodName; + } + + public String getDepreciationPeriod() { + return depreciationPeriod; + } + + public void setDepreciationPeriod(String depreciationPeriod) { + this.depreciationPeriod = depreciationPeriod; + } + + public String getEnableDate() { + return enableDate; + } + + public void setEnableDate(String enableDate) { + this.enableDate = enableDate; + } + + public String getEquipmentCategory() { + return equipmentCategory; + } + + public void setEquipmentCategory(String equipmentCategory) { + this.equipmentCategory = equipmentCategory; + } + + public String getEquipmentCategoryName() { + return equipmentCategoryName; + } + + public void setEquipmentCategoryName(String equipmentCategoryName) { + this.equipmentCategoryName = equipmentCategoryName; + } + + public String getEquipmentName() { + return equipmentName; + } + + public void setEquipmentName(String equipmentName) { + this.equipmentName = equipmentName; + } + + public String getEquipmentNo() { + return equipmentNo; + } + + public void setEquipmentNo(String equipmentNo) { + this.equipmentNo = equipmentNo; + } + + public String getEquipmentSpecifications() { + return equipmentSpecifications; + } + + public void setEquipmentSpecifications(String equipmentSpecifications) { + this.equipmentSpecifications = equipmentSpecifications; + } + + public String getEquipmentType() { + return equipmentType; + } + + public void setEquipmentType(String equipmentType) { + this.equipmentType = equipmentType; + } + + public String getEquipmentTypeName() { + return equipmentTypeName; + } + + public void setEquipmentTypeName(String equipmentTypeName) { + this.equipmentTypeName = equipmentTypeName; + } + + public String getFileList() { + return fileList; + } + + public void setFileList(String fileList) { + this.fileList = fileList; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getInstallIncidentalExpenses() { + return installIncidentalExpenses; + } + + public void setInstallIncidentalExpenses(String installIncidentalExpenses) { + this.installIncidentalExpenses = installIncidentalExpenses; + } + + public String getInstallPlace() { + return installPlace; + } + + public void setInstallPlace(String installPlace) { + this.installPlace = installPlace; + } + + public String getIntactState() { + return intactState; + } + + public void setIntactState(String intactState) { + this.intactState = intactState; + } + + public String getIsCalibrationTestEquipment() { + return isCalibrationTestEquipment; + } + + public void setIsCalibrationTestEquipment(String isCalibrationTestEquipment) { + this.isCalibrationTestEquipment = isCalibrationTestEquipment; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getIsFixedAssets() { + return isFixedAssets; + } + + public void setIsFixedAssets(String isFixedAssets) { + this.isFixedAssets = isFixedAssets; + } + + public String getIsMeasureAccount() { + return isMeasureAccount; + } + + public void setIsMeasureAccount(String isMeasureAccount) { + this.isMeasureAccount = isMeasureAccount; + } + + public String getIsStandardSupportEquipment() { + return isStandardSupportEquipment; + } + + public void setIsStandardSupportEquipment(String isStandardSupportEquipment) { + this.isStandardSupportEquipment = isStandardSupportEquipment; + } + + public String getLabelBind() { + return labelBind; + } + + public void setLabelBind(String labelBind) { + this.labelBind = labelBind; + } + + public String getMajorCategory() { + return majorCategory; + } + + public void setMajorCategory(String majorCategory) { + this.majorCategory = majorCategory; + } + + public String getMajorCategoryName() { + return majorCategoryName; + } + + public void setMajorCategoryName(String majorCategoryName) { + this.majorCategoryName = majorCategoryName; + } + + public String getManagerLevel() { + return managerLevel; + } + + public void setManagerLevel(String managerLevel) { + this.managerLevel = managerLevel; + } + + public String getManagerLevelName() { + return managerLevelName; + } + + public void setManagerLevelName(String managerLevelName) { + this.managerLevelName = managerLevelName; + } + + public String getManagerState() { + return managerState; + } + + public void setManagerState(String managerState) { + this.managerState = managerState; + } + + public String getManagerStateName() { + return managerStateName; + } + + public void setManagerStateName(String managerStateName) { + this.managerStateName = managerStateName; + } + + public String getManufacturer() { + return manufacturer; + } + + public void setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + } + + public String getManufacturerCountry() { + return manufacturerCountry; + } + + public void setManufacturerCountry(String manufacturerCountry) { + this.manufacturerCountry = manufacturerCountry; + } + + public String getManufacturingDate() { + return manufacturingDate; + } + + public void setManufacturingDate(String manufacturingDate) { + this.manufacturingDate = manufacturingDate; + } + + public String getManufacturingNo() { + return manufacturingNo; + } + + public void setManufacturingNo(String manufacturingNo) { + this.manufacturingNo = manufacturingNo; + } + + public String getMesureCycle() { + return mesureCycle; + } + + public void setMesureCycle(String mesureCycle) { + this.mesureCycle = mesureCycle; + } + + public String getMesureDate() { + return mesureDate; + } + + public void setMesureDate(String mesureDate) { + this.mesureDate = mesureDate; + } + + public String getMesureDept() { + return mesureDept; + } + + public void setMesureDept(String mesureDept) { + this.mesureDept = mesureDept; + } + + public String getMesureRange() { + return mesureRange; + } + + public void setMesureRange(String mesureRange) { + this.mesureRange = mesureRange; + } + + public String getMesureResult() { + return mesureResult; + } + + public void setMesureResult(String mesureResult) { + this.mesureResult = mesureResult; + } + + public String getMesureResultName() { + return mesureResultName; + } + + public void setMesureResultName(String mesureResultName) { + this.mesureResultName = mesureResultName; + } + + public String getMesureType() { + return mesureType; + } + + public void setMesureType(String mesureType) { + this.mesureType = mesureType; + } + + public String getMesureTypeName() { + return mesureTypeName; + } + + public void setMesureTypeName(String mesureTypeName) { + this.mesureTypeName = mesureTypeName; + } + + public String getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getOriginValue() { + return originValue; + } + + public void setOriginValue(String originValue) { + this.originValue = originValue; + } + + public String getOverallDimension() { + return overallDimension; + } + + public void setOverallDimension(String overallDimension) { + this.overallDimension = overallDimension; + } + + public String getPresentOriginValue() { + return presentOriginValue; + } + + public void setPresentOriginValue(String presentOriginValue) { + this.presentOriginValue = presentOriginValue; + } + + public String getPurpose() { + return purpose; + } + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getSinglePrice() { + return singlePrice; + } + + public void setSinglePrice(String singlePrice) { + this.singlePrice = singlePrice; + } + + public String getSupportStandardEquipmentName() { + return supportStandardEquipmentName; + } + + public void setSupportStandardEquipmentName(String supportStandardEquipmentName) { + this.supportStandardEquipmentName = supportStandardEquipmentName; + } + + public String getSupportStandardEquipmentNo() { + return supportStandardEquipmentNo; + } + + public void setSupportStandardEquipmentNo(String supportStandardEquipmentNo) { + this.supportStandardEquipmentNo = supportStandardEquipmentNo; + } + + public String getTechnicalLevel() { + return technicalLevel; + } + + public void setTechnicalLevel(String technicalLevel) { + this.technicalLevel = technicalLevel; + } + + public String getUncertainty() { + return uncertainty; + } + + public void setUncertainty(String uncertainty) { + this.uncertainty = uncertainty; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getUseDept() { + return useDept; + } + + public void setUseDept(String useDept) { + this.useDept = useDept; + } + + public String getUseDeptName() { + return useDeptName; + } + + public void setUseDeptName(String useDeptName) { + this.useDeptName = useDeptName; + } + + public String getUsePerson() { + return usePerson; + } + + public void setUsePerson(String usePerson) { + this.usePerson = usePerson; + } + + public String getUsePersonName() { + return usePersonName; + } + + public void setUsePersonName(String usePersonName) { + this.usePersonName = usePersonName; + } + + public String getValidDate() { + return validDate; + } + + public void setValidDate(String validDate) { + this.validDate = validDate; + } + + public int getVersion() { + return version; + } + + public void setVersion(int version) { + this.version = version; + } + + public String getWeight() { + return weight; + } + + public void setWeight(String weight) { + this.weight = weight; + } + } + } +} diff --git a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt index a3f514f..46e5eef 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt @@ -35,4 +35,24 @@ @QueryMap limit: Map, @QueryMap offset: Map ): String + + /** + * 获取设备列表 + */ + @POST("/meter/assets/listPage") + suspend fun getEquipmentList( + @Header("token") token: String, + @Body requestBody: RequestBody, + @QueryMap limit: Map, + @QueryMap offset: Map + ): String + + /** + * 获取设备详情 + */ + @POST("/meter/assets/detail") + suspend fun getEquipmentDetail( + @Header("token") token: String, + @Body requestBody: RequestBody + ): String } \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt index 444a872..386a1d8 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt @@ -6,8 +6,10 @@ import com.pengxh.kt.lite.utils.SaveKeyValues import okhttp3.MediaType.Companion.toMediaType import okhttp3.RequestBody.Companion.toRequestBody +import org.json.JSONArray import org.json.JSONObject + object RetrofitServiceManager { private val api by lazy { @@ -73,4 +75,71 @@ offsetMap["offset"] = offset return api.getNoticeList(AuthenticationHelper.token!!, requestBody, limitMap, offsetMap) } + + /** + * 获取设备列表 + */ + suspend fun getEquipmentList( + equipmentNo: String, + equipmentName: String, + mesureType: String, + managerState: String, + useDept: String, + assetType: String, + equipmentCategory: String, + isCalibrationTestEquipment: String, + isMeasureAccount: String, + isStandardSupportEquipment: String, + isFixedAssets: String, + validStartDate: String, + validEndDate: String, + abc: String, + ids: Array, + offset: Int + ): String { + val paramObject = JSONObject() + paramObject.put("equipmentNo", equipmentNo) + paramObject.put("equipmentName", equipmentName) + paramObject.put("mesureType", mesureType) + paramObject.put("managerState", managerState) + paramObject.put("useDept", useDept) + paramObject.put("assetType", assetType) + paramObject.put("equipmentCategory", equipmentCategory) + paramObject.put("isCalibrationTestEquipment", isCalibrationTestEquipment) + paramObject.put("isMeasureAccount", isMeasureAccount) + paramObject.put("isStandardSupportEquipment", isStandardSupportEquipment) + paramObject.put("isFixedAssets", isFixedAssets) + paramObject.put("validStartDate", validStartDate) + paramObject.put("validEndDate", validEndDate) + paramObject.put("abc", abc) + + val jsonArray = JSONArray() + ids.forEach { + jsonArray.put(it) + } + paramObject.put("ids", jsonArray) + + val requestBody = paramObject.toString().toRequestBody( + "application/json;charset=UTF-8".toMediaType() + ) + + val limitMap = HashMap() + limitMap["limit"] = LocaleConstant.PAGE_LIMIT + + val offsetMap = HashMap() + offsetMap["offset"] = offset + return api.getEquipmentList(AuthenticationHelper.token!!, requestBody, limitMap, offsetMap) + } + + /** + * 获取设备详情 + */ + suspend fun getEquipmentDetail(id: String): String { + val paramObject = JSONObject() + paramObject.put("id", id) + val requestBody = paramObject.toString().toRequestBody( + "application/json;charset=UTF-8".toMediaType() + ) + return api.getEquipmentDetail(AuthenticationHelper.token!!, requestBody) + } } \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt deleted file mode 100644 index a5bb60b..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt +++ /dev/null @@ -1,104 +0,0 @@ -package com.casic.xz.meterage.view - -import android.annotation.SuppressLint -import android.graphics.Paint -import androidx.lifecycle.ViewModelProvider -import com.casic.xz.meterage.R -import com.casic.xz.meterage.extensions.combineImagePath -import com.casic.xz.meterage.extensions.formatTextFromHtml -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.vm.NoticeViewModel -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.extensions.convertColor -import com.pengxh.kt.lite.extensions.navigatePageTo -import com.pengxh.kt.lite.extensions.obtainScreenWidth -import com.pengxh.kt.lite.extensions.show -import com.pengxh.kt.lite.utils.Constant -import kotlinx.android.synthetic.main.activity_notice_detail.* -import kotlinx.android.synthetic.main.include_base_title.* -import java.util.* - -@SuppressLint("SetTextI18n") -class NoticeDetailActivity : KotlinBaseActivity() { - - private lateinit var noticeViewModel: NoticeViewModel - - override fun initData() { - leftBackView.setOnClickListener { finish() } - titleView.text = "通知公告" - - val args = intent.getStringArrayListExtra(Constant.INTENT_PARAM)!! - - noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] - noticeViewModel.getNoticeList(args[0], args[1], args[2], "", "", 1) - noticeViewModel.noticeResult.observe(this, { - if (it.code == 200) { - val dataRow = it.data?.rows!![0] - - noticeDateView.text = dataRow.noticeTime - noticePublisherView.text = "发布人 ${dataRow.noticePublisher}" - noticeCompanyView.text = "发布单位 ${dataRow.noticeCompany}" - - noticeNoView.text = dataRow.noticeNo - noticeTitleView.text = dataRow.noticeTitle - noticeSketchView.text = dataRow.noticeSketch - - dataRow.noticeContent.formatTextFromHtml( - this, noticeContentView, obtainScreenWidth() - ) - - if (dataRow.minioFileName.isNullOrBlank()) { - minioFileView.text = "暂无附件" - } else { - val minioFileName = dataRow.minioFileName - - minioFileView.text = minioFileName - val textPaint = minioFileView.paint - textPaint.flags = Paint.UNDERLINE_TEXT_FLAG - textPaint.isAntiAlias = true - minioFileView.setTextColor(R.color.themeColor.convertColor(this)) - - minioFileView.setOnClickListener { - //查看附件 - if (minioFileName.endsWith("pdf")) { - navigatePageTo(minioFileName) - } else if ( - minioFileName.endsWith("doc") || - minioFileName.endsWith("docx") - ) { - navigatePageTo(minioFileName) - } else if (minioFileName.endsWith("txt")) { - navigatePageTo(minioFileName) - } else if ( - minioFileName.endsWith("png") || - minioFileName.endsWith("jpeg") || - minioFileName.endsWith("jpg") - ) { - val urls = ArrayList() - urls.add(minioFileName.combineImagePath()) - navigatePageTo(0, urls) - } else { - "文件类型未知,无法打开附件".show(this) - } - } - } - } - }) - } - - override fun initEvent() { - - } - - override fun initLayoutView(): Int = R.layout.activity_notice_detail - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/NoticeListActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/NoticeListActivity.kt deleted file mode 100644 index 15f6a16..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/NoticeListActivity.kt +++ /dev/null @@ -1,180 +0,0 @@ -package com.casic.xz.meterage.view - -import android.os.Handler -import android.util.Log -import android.view.View -import androidx.lifecycle.ViewModelProvider -import com.casic.xz.meterage.R -import com.casic.xz.meterage.adapter.NoticeListAdapter -import com.casic.xz.meterage.extensions.addAll -import com.casic.xz.meterage.extensions.combineFilePath -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.extensions.showEmptyPage -import com.casic.xz.meterage.model.NoticeListModel -import com.casic.xz.meterage.vm.NoticeViewModel -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.extensions.navigatePageTo -import com.pengxh.kt.lite.extensions.show -import com.pengxh.kt.lite.utils.WeakReferenceHandler -import com.pengxh.kt.lite.widget.dialog.AlertControlDialog -import kotlinx.android.synthetic.main.activity_notice_list.* -import kotlinx.android.synthetic.main.include_empty_view.* - -class NoticeListActivity : KotlinBaseActivity() { - - private lateinit var weakReferenceHandler: WeakReferenceHandler - private lateinit var noticeViewModel: NoticeViewModel - private lateinit var noticeListAdapter: NoticeListAdapter - private var dataBeans: MutableList = ArrayList() - private var pageIndex = 1 - private var isRefresh = false - private var isLoadMore = false - - override fun initData() { - weakReferenceHandler = WeakReferenceHandler(callback) - noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] - noticeViewModel.noticeResult.observe(this, { - if (it.code == 200) { - val dataRows = it.data?.rows!! -// countBadeNumber(dataRows) - when { - isRefresh -> { - dataBeans.clear() - dataBeans = dataRows - noticeLayout.finishRefresh() - isRefresh = false - } - isLoadMore -> { - if (dataRows.size == 0) { - "到底了,别拉了".show(this) - } - dataBeans.addAll(dataRows) - noticeLayout.finishLoadMore() - isLoadMore = false - } - else -> { - dataBeans = dataRows - } - } - weakReferenceHandler.sendEmptyMessage(2023013101) - } - }) - } - - override fun initEvent() { - leftBackView.setOnClickListener { finish() } - rightOperateView.setOnClickListener { - AlertControlDialog.Builder() - .setContext(this) - .setTitle("提示") - .setMessage("确定将所有未读消息标为已读?") - .setNegativeButton("取消") - .setPositiveButton("确定") - .setOnDialogButtonClickListener(object : - AlertControlDialog.OnDialogButtonClickListener { - override fun onCancelClick() { - - } - - override fun onConfirmClick() { - //TODO 设置为已读 - } - }).build().show() - } - - if (hasNoticePermission()) { - openSystemNoticeLayout.visibility = View.GONE - openSystemNoticeLayout.visibility = View.GONE - } else { - openSystemNoticeLayout.setOnClickListener { - - } - - - closeLayoutView.setOnClickListener { - openSystemNoticeLayout.visibility = View.GONE - } - } - - noticeLayout.setOnRefreshListener { - isRefresh = true - //刷新之后页码重置 - pageIndex = 1 - getNoticeListByPage() - } - - noticeLayout.setOnLoadMoreListener { - isLoadMore = true - pageIndex++ - getNoticeListByPage() - } - } - - override fun onResume() { - super.onResume() - pageIndex = 1 - getNoticeListByPage() - } - - private fun getNoticeListByPage() { - noticeViewModel.getNoticeList("", "", "", "", "", pageIndex) - } - - private val callback = Handler.Callback { - when (it.what) { - 2023013101 -> { - if (isRefresh || isLoadMore) { - noticeListAdapter.notifyDataSetChanged() - } else { - if (dataBeans.size == 0) { - emptyView!!.showEmptyPage("没有任何消息") { - pageIndex = 1 - getNoticeListByPage() - } - } else { - emptyView!!.hide() - noticeListAdapter = NoticeListAdapter(this, dataBeans) - noticeRecyclerView.adapter = noticeListAdapter - noticeListAdapter.setOnItemClickListener(object : - NoticeListAdapter.OnItemClickListener { - override fun onItemClicked(position: Int) { - val rowsModel = dataBeans[position] - val allArgs = addAll( - rowsModel.noticeNo, - rowsModel.noticeTitle, - rowsModel.noticePublisher, - "", - "" - ) - Log.d( - "Casic", - "NoticeListActivity => onItemClicked: ${rowsModel.minioFileName.combineFilePath()}" - ) - navigatePageTo(allArgs) - } - }) - } - } - } - } - true - } - - //TODO 判断是否开启通知权限 - private fun hasNoticePermission(): Boolean { - - return false - } - - override fun initLayoutView(): Int = R.layout.activity_notice_list - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/PreviewDocumentActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/PreviewDocumentActivity.kt deleted file mode 100644 index e233ddc..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/PreviewDocumentActivity.kt +++ /dev/null @@ -1,24 +0,0 @@ -package com.casic.xz.meterage.view - -import com.casic.xz.meterage.R -import com.pengxh.kt.lite.base.KotlinBaseActivity - -class PreviewDocumentActivity : KotlinBaseActivity() { - override fun initData() { - - } - - override fun initEvent() { - - } - - override fun initLayoutView(): Int = R.layout.activity_preview_doc - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/PreviewPdfActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/PreviewPdfActivity.kt deleted file mode 100644 index 39f8ac2..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/PreviewPdfActivity.kt +++ /dev/null @@ -1,62 +0,0 @@ -package com.casic.xz.meterage.view - -import com.casic.xz.meterage.R -import com.casic.xz.meterage.extensions.combineFilePath -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.utils.LoadingDialogHub -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.callback.OnDownloadListener -import com.pengxh.kt.lite.extensions.createDownloadFileDir -import com.pengxh.kt.lite.extensions.downloadFile -import com.pengxh.kt.lite.utils.Constant -import kotlinx.android.synthetic.main.activity_preview_pdf.* -import kotlinx.android.synthetic.main.include_base_title.* -import java.io.File -import java.io.FileInputStream - - -class PreviewPdfActivity : KotlinBaseActivity() { - - override fun initData() { - val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! - titleView.text = minioFileName - - val url = minioFileName.combineFilePath() - url.downloadFile(createDownloadFileDir().toString(), - object : OnDownloadListener { - override fun onDownloadStart(totalBytes: Long) { - runOnUiThread { - LoadingDialogHub.show(this@PreviewPdfActivity, "附件加载中") - } - } - - override fun onProgressChanged(currentBytes: Long) { - - } - - override fun onDownloadEnd(file: File?) { - runOnUiThread { - LoadingDialogHub.dismiss() - } - val inputStream = FileInputStream(file) - pdfView.fromStream(inputStream).load() - } - }) - } - - override fun initEvent() { - leftBackView.setOnClickListener { finish() } - } - - override fun initLayoutView(): Int = R.layout.activity_preview_pdf - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/PreviewTextActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/PreviewTextActivity.kt deleted file mode 100644 index d634ca3..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/PreviewTextActivity.kt +++ /dev/null @@ -1,60 +0,0 @@ -package com.casic.xz.meterage.view - -import com.casic.xz.meterage.R -import com.casic.xz.meterage.extensions.combineFilePath -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.utils.LoadingDialogHub -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.callback.OnDownloadListener -import com.pengxh.kt.lite.extensions.createDownloadFileDir -import com.pengxh.kt.lite.extensions.downloadFile -import com.pengxh.kt.lite.extensions.read -import com.pengxh.kt.lite.utils.Constant -import kotlinx.android.synthetic.main.activity_preview_txt.* -import kotlinx.android.synthetic.main.include_base_title.* -import java.io.File - -class PreviewTextActivity : KotlinBaseActivity() { - - override fun initData() { - val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! - titleView.text = minioFileName - - val url = minioFileName.combineFilePath() - url.downloadFile(createDownloadFileDir().toString(), - object : OnDownloadListener { - override fun onDownloadStart(totalBytes: Long) { - runOnUiThread { - LoadingDialogHub.show(this@PreviewTextActivity, "附件加载中") - } - } - - override fun onProgressChanged(currentBytes: Long) { - - } - - override fun onDownloadEnd(file: File?) { - runOnUiThread { - LoadingDialogHub.dismiss() - textView.text = file?.read() - } - } - }) - } - - override fun initEvent() { - leftBackView.setOnClickListener { finish() } - } - - override fun initLayoutView(): Int = R.layout.activity_preview_txt - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentActivity.kt new file mode 100644 index 0000000..35ca098 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentActivity.kt @@ -0,0 +1,158 @@ +package com.casic.xz.meterage.view.home + +import android.os.Handler +import androidx.lifecycle.ViewModelProvider +import androidx.recyclerview.widget.DividerItemDecoration +import com.casic.xz.meterage.R +import com.casic.xz.meterage.adapter.EquipmentListAdapter +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.extensions.showEmptyPage +import com.casic.xz.meterage.model.EquipmentListModel +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.casic.xz.meterage.vm.EquipmentViewModel +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.extensions.navigatePageTo +import com.pengxh.kt.lite.extensions.show +import com.pengxh.kt.lite.utils.WeakReferenceHandler +import com.pengxh.kt.lite.vm.LoadState +import kotlinx.android.synthetic.main.activity_equipment.* +import kotlinx.android.synthetic.main.include_empty_view.* +import kotlinx.android.synthetic.main.include_search_title.* + +class EquipmentActivity : KotlinBaseActivity() { + + private lateinit var weakReferenceHandler: WeakReferenceHandler + private lateinit var equipmentViewModel: EquipmentViewModel + private lateinit var equipmentListAdapter: EquipmentListAdapter + private var dataBeans: MutableList = ArrayList() + private var pageIndex = 1 + private var isRefresh = false + private var isLoadMore = false + + override fun initData() { + weakReferenceHandler = WeakReferenceHandler(callback) + equipmentViewModel = ViewModelProvider(this)[EquipmentViewModel::class.java] + equipmentViewModel.equipmentResult.observe(this, { + if (it.code == 200) { + val dataRows = it.data?.rows!! + when { + isRefresh -> { + dataBeans.clear() + dataBeans = dataRows + equipmentLayout.finishRefresh() + isRefresh = false + } + isLoadMore -> { + if (dataRows.size == 0) { + "到底了,别拉了".show(this) + } + dataBeans.addAll(dataRows) + equipmentLayout.finishLoadMore() + isLoadMore = false + } + else -> { + dataBeans = dataRows + } + } + weakReferenceHandler.sendEmptyMessage(2023020801) + } + }) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + rightOperateView.setOnClickListener { + + } + + equipmentLayout.setOnRefreshListener { + isRefresh = true + //刷新之后页码重置 + pageIndex = 1 + getEquipmentListByPage() + } + + equipmentLayout.setOnLoadMoreListener { + isLoadMore = true + pageIndex++ + getEquipmentListByPage() + } + } + + override fun initLayoutView(): Int = R.layout.activity_equipment + + override fun observeRequestState() { + equipmentViewModel.loadState.observe(this, { + when (it) { + LoadState.Loading -> LoadingDialogHub.show(this, "数据加载中...") + else -> LoadingDialogHub.dismiss() + } + }) + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + titleView.text = "仪器设备" + } + + override fun onResume() { + super.onResume() + pageIndex = 1 + getEquipmentListByPage() + } + + private fun getEquipmentListByPage() { + equipmentViewModel.getEquipmentList( + "", + "", + "", + "", + "", + "1", + "", + "", + "", + "", + "", + "", + "", + "", + arrayOf(), + pageIndex + ) + } + + private val callback = Handler.Callback { + when (it.what) { + 2023020801 -> { + if (isRefresh || isLoadMore) { + equipmentListAdapter.notifyDataSetChanged() + } else { + if (dataBeans.size == 0) { + emptyView!!.showEmptyPage("无设备") { + pageIndex = 1 + getEquipmentListByPage() + } + } else { + emptyView!!.hide() + equipmentListAdapter = EquipmentListAdapter(this, dataBeans) + equipmentRecyclerView.addItemDecoration( + DividerItemDecoration(this, DividerItemDecoration.VERTICAL) + ) + equipmentRecyclerView.adapter = equipmentListAdapter + equipmentListAdapter.setOnItemClickListener(object : + EquipmentListAdapter.OnItemClickListener { + override fun onItemClicked(position: Int) { + val rowsModel = dataBeans[position] + navigatePageTo(rowsModel.id) + } + }) + } + } + } + } + true + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentDetailActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentDetailActivity.kt new file mode 100644 index 0000000..7dee13c --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentDetailActivity.kt @@ -0,0 +1,53 @@ +package com.casic.xz.meterage.view.home + +import androidx.fragment.app.Fragment +import com.casic.xz.meterage.R +import com.casic.xz.meterage.adapter.SubViewPagerAdapter +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.fragment.equipment.* +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.utils.Constant +import kotlinx.android.synthetic.main.activity_equipment.rootView +import kotlinx.android.synthetic.main.activity_equipment_detail.* +import kotlinx.android.synthetic.main.include_base_title.* + +class EquipmentDetailActivity : KotlinBaseActivity() { + + private var fragmentPages: ArrayList = ArrayList() + + override fun initData() { + val equipmentId = intent.getStringExtra(Constant.INTENT_PARAM)!! + + fragmentPages.add(BasicInformationFragment(equipmentId)) + fragmentPages.add(InspectionRecordFragment()) + fragmentPages.add(ChangeRecordFragment()) + fragmentPages.add(UsageRecordFragment()) + fragmentPages.add(CertificateFragment()) + + val equipmentPageTitles = arrayOf("基础信息", "周检记录", "状态变更记录", "使用记录", "检定证书") + + equipmentViewPager.adapter = SubViewPagerAdapter( + supportFragmentManager, fragmentPages, equipmentPageTitles + ) + equipmentViewPager.offscreenPageLimit = fragmentPages.size + //绑定 + topTabLayout.setupWithViewPager(equipmentViewPager) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + } + + override fun initLayoutView(): Int = R.layout.activity_equipment_detail + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + titleView.text = "仪器设备" + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeDetailActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeDetailActivity.kt new file mode 100644 index 0000000..6fe0022 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeDetailActivity.kt @@ -0,0 +1,105 @@ +package com.casic.xz.meterage.view.notice + +import android.annotation.SuppressLint +import android.graphics.Paint +import androidx.lifecycle.ViewModelProvider +import com.casic.xz.meterage.R +import com.casic.xz.meterage.extensions.combineImagePath +import com.casic.xz.meterage.extensions.formatTextFromHtml +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.view.BigImageActivity +import com.casic.xz.meterage.vm.NoticeViewModel +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.extensions.convertColor +import com.pengxh.kt.lite.extensions.navigatePageTo +import com.pengxh.kt.lite.extensions.obtainScreenWidth +import com.pengxh.kt.lite.extensions.show +import com.pengxh.kt.lite.utils.Constant +import kotlinx.android.synthetic.main.activity_notice_detail.* +import kotlinx.android.synthetic.main.include_base_title.* +import java.util.* + +@SuppressLint("SetTextI18n") +class NoticeDetailActivity : KotlinBaseActivity() { + + private lateinit var noticeViewModel: NoticeViewModel + + override fun initData() { + leftBackView.setOnClickListener { finish() } + titleView.text = "通知公告" + + val args = intent.getStringArrayListExtra(Constant.INTENT_PARAM)!! + + noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] + noticeViewModel.getNoticeList(args[0], args[1], args[2], "", "", 1) + noticeViewModel.noticeResult.observe(this, { + if (it.code == 200) { + val dataRow = it.data?.rows!![0] + + noticeDateView.text = dataRow.noticeTime + noticePublisherView.text = "发布人 ${dataRow.noticePublisher}" + noticeCompanyView.text = "发布单位 ${dataRow.noticeCompany}" + + noticeNoView.text = dataRow.noticeNo + noticeTitleView.text = dataRow.noticeTitle + noticeSketchView.text = dataRow.noticeSketch + + dataRow.noticeContent.formatTextFromHtml( + this, noticeContentView, obtainScreenWidth() + ) + + if (dataRow.minioFileName.isNullOrBlank()) { + minioFileView.text = "暂无附件" + } else { + val minioFileName = dataRow.minioFileName + + minioFileView.text = minioFileName + val textPaint = minioFileView.paint + textPaint.flags = Paint.UNDERLINE_TEXT_FLAG + textPaint.isAntiAlias = true + minioFileView.setTextColor(R.color.themeColor.convertColor(this)) + + minioFileView.setOnClickListener { + //查看附件 + if (minioFileName.endsWith("pdf")) { + navigatePageTo(minioFileName) + } else if ( + minioFileName.endsWith("doc") || + minioFileName.endsWith("docx") + ) { + navigatePageTo(minioFileName) + } else if (minioFileName.endsWith("txt")) { + navigatePageTo(minioFileName) + } else if ( + minioFileName.endsWith("png") || + minioFileName.endsWith("jpeg") || + minioFileName.endsWith("jpg") + ) { + val urls = ArrayList() + urls.add(minioFileName.combineImagePath()) + navigatePageTo(0, urls) + } else { + "文件类型未知,无法打开附件".show(this) + } + } + } + } + }) + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.activity_notice_detail + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeListActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeListActivity.kt new file mode 100644 index 0000000..31c0490 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeListActivity.kt @@ -0,0 +1,180 @@ +package com.casic.xz.meterage.view.notice + +import android.os.Handler +import android.util.Log +import android.view.View +import androidx.lifecycle.ViewModelProvider +import com.casic.xz.meterage.R +import com.casic.xz.meterage.adapter.NoticeListAdapter +import com.casic.xz.meterage.extensions.addAll +import com.casic.xz.meterage.extensions.combineFilePath +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.extensions.showEmptyPage +import com.casic.xz.meterage.model.NoticeListModel +import com.casic.xz.meterage.vm.NoticeViewModel +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.extensions.navigatePageTo +import com.pengxh.kt.lite.extensions.show +import com.pengxh.kt.lite.utils.WeakReferenceHandler +import com.pengxh.kt.lite.widget.dialog.AlertControlDialog +import kotlinx.android.synthetic.main.activity_notice_list.* +import kotlinx.android.synthetic.main.include_empty_view.* + +class NoticeListActivity : KotlinBaseActivity() { + + private lateinit var weakReferenceHandler: WeakReferenceHandler + private lateinit var noticeViewModel: NoticeViewModel + private lateinit var noticeListAdapter: NoticeListAdapter + private var dataBeans: MutableList = ArrayList() + private var pageIndex = 1 + private var isRefresh = false + private var isLoadMore = false + + override fun initData() { + weakReferenceHandler = WeakReferenceHandler(callback) + noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] + noticeViewModel.noticeResult.observe(this, { + if (it.code == 200) { + val dataRows = it.data?.rows!! +// countBadeNumber(dataRows) + when { + isRefresh -> { + dataBeans.clear() + dataBeans = dataRows + noticeLayout.finishRefresh() + isRefresh = false + } + isLoadMore -> { + if (dataRows.size == 0) { + "到底了,别拉了".show(this) + } + dataBeans.addAll(dataRows) + noticeLayout.finishLoadMore() + isLoadMore = false + } + else -> { + dataBeans = dataRows + } + } + weakReferenceHandler.sendEmptyMessage(2023013101) + } + }) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + rightOperateView.setOnClickListener { + AlertControlDialog.Builder() + .setContext(this) + .setTitle("提示") + .setMessage("确定将所有未读消息标为已读?") + .setNegativeButton("取消") + .setPositiveButton("确定") + .setOnDialogButtonClickListener(object : + AlertControlDialog.OnDialogButtonClickListener { + override fun onCancelClick() { + + } + + override fun onConfirmClick() { + //TODO 设置为已读 + } + }).build().show() + } + + if (hasNoticePermission()) { + openSystemNoticeLayout.visibility = View.GONE + openSystemNoticeLayout.visibility = View.GONE + } else { + openSystemNoticeLayout.setOnClickListener { + + } + + + closeLayoutView.setOnClickListener { + openSystemNoticeLayout.visibility = View.GONE + } + } + + noticeLayout.setOnRefreshListener { + isRefresh = true + //刷新之后页码重置 + pageIndex = 1 + getNoticeListByPage() + } + + noticeLayout.setOnLoadMoreListener { + isLoadMore = true + pageIndex++ + getNoticeListByPage() + } + } + + override fun onResume() { + super.onResume() + pageIndex = 1 + getNoticeListByPage() + } + + private fun getNoticeListByPage() { + noticeViewModel.getNoticeList("", "", "", "", "", pageIndex) + } + + private val callback = Handler.Callback { + when (it.what) { + 2023013101 -> { + if (isRefresh || isLoadMore) { + noticeListAdapter.notifyDataSetChanged() + } else { + if (dataBeans.size == 0) { + emptyView!!.showEmptyPage("没有任何消息") { + pageIndex = 1 + getNoticeListByPage() + } + } else { + emptyView!!.hide() + noticeListAdapter = NoticeListAdapter(this, dataBeans) + noticeRecyclerView.adapter = noticeListAdapter + noticeListAdapter.setOnItemClickListener(object : + NoticeListAdapter.OnItemClickListener { + override fun onItemClicked(position: Int) { + val rowsModel = dataBeans[position] + val allArgs = addAll( + rowsModel.noticeNo, + rowsModel.noticeTitle, + rowsModel.noticePublisher, + "", + "" + ) + Log.d( + "Casic", + "NoticeListActivity => onItemClicked: ${rowsModel.minioFileName.combineFilePath()}" + ) + navigatePageTo(allArgs) + } + }) + } + } + } + } + true + } + + //TODO 判断是否开启通知权限 + private fun hasNoticePermission(): Boolean { + + return false + } + + override fun initLayoutView(): Int = R.layout.activity_notice_list + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewDocumentActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewDocumentActivity.kt new file mode 100644 index 0000000..4b16ae8 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewDocumentActivity.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.view.notice + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseActivity + +class PreviewDocumentActivity : KotlinBaseActivity() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.activity_preview_doc + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewPdfActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewPdfActivity.kt new file mode 100644 index 0000000..fad73b6 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewPdfActivity.kt @@ -0,0 +1,62 @@ +package com.casic.xz.meterage.view.notice + +import com.casic.xz.meterage.R +import com.casic.xz.meterage.extensions.combineFilePath +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.callback.OnDownloadListener +import com.pengxh.kt.lite.extensions.createDownloadFileDir +import com.pengxh.kt.lite.extensions.downloadFile +import com.pengxh.kt.lite.utils.Constant +import kotlinx.android.synthetic.main.activity_preview_pdf.* +import kotlinx.android.synthetic.main.include_base_title.* +import java.io.File +import java.io.FileInputStream + + +class PreviewPdfActivity : KotlinBaseActivity() { + + override fun initData() { + val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! + titleView.text = minioFileName + + val url = minioFileName.combineFilePath() + url.downloadFile(createDownloadFileDir().toString(), + object : OnDownloadListener { + override fun onDownloadStart(totalBytes: Long) { + runOnUiThread { + LoadingDialogHub.show(this@PreviewPdfActivity, "附件加载中") + } + } + + override fun onProgressChanged(currentBytes: Long) { + + } + + override fun onDownloadEnd(file: File?) { + runOnUiThread { + LoadingDialogHub.dismiss() + } + val inputStream = FileInputStream(file) + pdfView.fromStream(inputStream).load() + } + }) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + } + + override fun initLayoutView(): Int = R.layout.activity_preview_pdf + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewTextActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewTextActivity.kt new file mode 100644 index 0000000..d7850fb --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewTextActivity.kt @@ -0,0 +1,60 @@ +package com.casic.xz.meterage.view.notice + +import com.casic.xz.meterage.R +import com.casic.xz.meterage.extensions.combineFilePath +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.callback.OnDownloadListener +import com.pengxh.kt.lite.extensions.createDownloadFileDir +import com.pengxh.kt.lite.extensions.downloadFile +import com.pengxh.kt.lite.extensions.read +import com.pengxh.kt.lite.utils.Constant +import kotlinx.android.synthetic.main.activity_preview_txt.* +import kotlinx.android.synthetic.main.include_base_title.* +import java.io.File + +class PreviewTextActivity : KotlinBaseActivity() { + + override fun initData() { + val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! + titleView.text = minioFileName + + val url = minioFileName.combineFilePath() + url.downloadFile(createDownloadFileDir().toString(), + object : OnDownloadListener { + override fun onDownloadStart(totalBytes: Long) { + runOnUiThread { + LoadingDialogHub.show(this@PreviewTextActivity, "附件加载中") + } + } + + override fun onProgressChanged(currentBytes: Long) { + + } + + override fun onDownloadEnd(file: File?) { + runOnUiThread { + LoadingDialogHub.dismiss() + textView.text = file?.read() + } + } + }) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + } + + override fun initLayoutView(): Int = R.layout.activity_preview_txt + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/vm/EquipmentViewModel.kt b/app/src/main/java/com/casic/xz/meterage/vm/EquipmentViewModel.kt new file mode 100644 index 0000000..b5f21f6 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/vm/EquipmentViewModel.kt @@ -0,0 +1,92 @@ +package com.casic.xz.meterage.vm + +import androidx.lifecycle.MutableLiveData +import com.casic.xz.meterage.base.BaseApplication +import com.casic.xz.meterage.extensions.separateResponseCode +import com.casic.xz.meterage.extensions.toErrorMessage +import com.casic.xz.meterage.model.EquipmentDetailModel +import com.casic.xz.meterage.model.EquipmentListModel +import com.casic.xz.meterage.utils.retrofit.RetrofitServiceManager +import com.google.gson.Gson +import com.google.gson.reflect.TypeToken +import com.pengxh.kt.lite.extensions.launch +import com.pengxh.kt.lite.extensions.show +import com.pengxh.kt.lite.vm.BaseViewModel +import com.pengxh.kt.lite.vm.LoadState + +class EquipmentViewModel : BaseViewModel() { + + private val gson by lazy { Gson() } + val equipmentResult = MutableLiveData() + val equipmentDetailResult = MutableLiveData() + + fun getEquipmentList( + equipmentNo: String, + equipmentName: String, + mesureType: String, + managerState: String, + useDept: String, + assetType: String, + equipmentCategory: String, + isCalibrationTestEquipment: String, + isMeasureAccount: String, + isStandardSupportEquipment: String, + isFixedAssets: String, + validStartDate: String, + validEndDate: String, + abc: String, + ids: Array, + offset: Int + ) = launch({ + loadState.value = LoadState.Loading + val response = RetrofitServiceManager.getEquipmentList( + equipmentNo, + equipmentName, + mesureType, + managerState, + useDept, + assetType, + equipmentCategory, + isCalibrationTestEquipment, + isMeasureAccount, + isStandardSupportEquipment, + isFixedAssets, + validStartDate, + validEndDate, + abc, + ids, + offset + ) + val responseCode = response.separateResponseCode() + if (responseCode == 200) { + loadState.value = LoadState.Success + equipmentResult.value = gson.fromJson( + response, object : TypeToken() {}.type + ) + } else { + loadState.value = LoadState.Fail + response.toErrorMessage().show(BaseApplication.get()) + } + }, { + loadState.value = LoadState.Fail + it.printStackTrace() + }) + + fun getEquipmentDetail(id: String) = launch({ + loadState.value = LoadState.Loading + val response = RetrofitServiceManager.getEquipmentDetail(id) + val responseCode = response.separateResponseCode() + if (responseCode == 200) { + loadState.value = LoadState.Success + equipmentDetailResult.value = gson.fromJson( + response, object : TypeToken() {}.type + ) + } else { + loadState.value = LoadState.Fail + response.toErrorMessage().show(BaseApplication.get()) + } + }, { + loadState.value = LoadState.Fail + it.printStackTrace() + }) +} \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_sorting.xml b/app/src/main/res/drawable/ic_sorting.xml new file mode 100644 index 0000000..252bfe6 --- /dev/null +++ b/app/src/main/res/drawable/ic_sorting.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/layout/activity_equipment.xml b/app/src/main/res/layout/activity_equipment.xml new file mode 100644 index 0000000..d6a64b1 --- /dev/null +++ b/app/src/main/res/layout/activity_equipment.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_equipment_detail.xml b/app/src/main/res/layout/activity_equipment_detail.xml new file mode 100644 index 0000000..7254762 --- /dev/null +++ b/app/src/main/res/layout/activity_equipment_detail.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_basic_information.xml b/app/src/main/res/layout/fragment_basic_information.xml new file mode 100644 index 0000000..4a3c1c7 --- /dev/null +++ b/app/src/main/res/layout/fragment_basic_information.xml @@ -0,0 +1,390 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_certificate.xml b/app/src/main/res/layout/fragment_certificate.xml new file mode 100644 index 0000000..77d9ef6 --- /dev/null +++ b/app/src/main/res/layout/fragment_certificate.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_change_record.xml b/app/src/main/res/layout/fragment_change_record.xml new file mode 100644 index 0000000..77d9ef6 --- /dev/null +++ b/app/src/main/res/layout/fragment_change_record.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_home.xml b/app/src/main/res/layout/fragment_home.xml index 41b32a9..e1ab759 100644 --- a/app/src/main/res/layout/fragment_home.xml +++ b/app/src/main/res/layout/fragment_home.xml @@ -71,7 +71,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" app:layoutManager="androidx.recyclerview.widget.GridLayoutManager" - app:spanCount="5" /> + app:spanCount="4" /> + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_mine.xml b/app/src/main/res/layout/fragment_mine.xml index 0643064..d9f57b3 100644 --- a/app/src/main/res/layout/fragment_mine.xml +++ b/app/src/main/res/layout/fragment_mine.xml @@ -22,10 +22,10 @@ android:orientation="horizontal"> + android:src="@mipmap/default_avatar" /> @@ -122,7 +122,7 @@ android:background="@drawable/ic_collection" /> @@ -145,7 +145,7 @@ android:background="@drawable/ic_push_setting" /> @@ -166,7 +166,7 @@ android:background="@drawable/ic_privacy" /> @@ -189,7 +189,7 @@ android:background="@drawable/ic_help" /> @@ -210,7 +210,7 @@ android:background="@drawable/ic_update" /> @@ -231,7 +231,7 @@ android:background="@drawable/ic_about" /> @@ -252,7 +252,7 @@ android:background="@drawable/ic_back" /> diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 3892b5a..02160cd 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -34,16 +34,18 @@ - - - - - - - + + + + + + + + + +) : RecyclerView.Adapter() { + + private var layoutInflater: LayoutInflater = LayoutInflater.from(context) + + override fun getItemCount(): Int = dataRows.size + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = ItemViewHolder( + layoutInflater.inflate(R.layout.item_equipment_rv_l, parent, false) + ) + + override fun onBindViewHolder(holder: ItemViewHolder, position: Int) { + //绑定数据 + val rowsBean = dataRows[position] + holder.equipmentNameView.text = rowsBean.equipmentName + holder.equipmentCodeView.text = rowsBean.equipmentNo + holder.equipmentDateView.text = rowsBean.enableDate + holder.equipmentLibView.text = rowsBean.useDeptName + + //绑定事件 + holder.itemView.setOnClickListener { + listener?.onItemClicked(position) + } + } + + inner class ItemViewHolder(view: View) : RecyclerView.ViewHolder(view) { + var equipmentNameView: TextView = view.findViewById(R.id.equipmentNameView) + var equipmentCodeView: TextView = view.findViewById(R.id.equipmentCodeView) + var equipmentDateView: TextView = view.findViewById(R.id.equipmentDateView) + var equipmentLibView: TextView = view.findViewById(R.id.equipmentLibView) + } + + private var listener: OnItemClickListener? = null + + interface OnItemClickListener { + fun onItemClicked(position: Int) + } + + fun setOnItemClickListener(onClickListener: OnItemClickListener?) { + this.listener = onClickListener + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt index b4628f3..d970b55 100644 --- a/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt +++ b/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt @@ -5,7 +5,8 @@ import com.casic.xz.meterage.R import com.casic.xz.meterage.adapter.HomeGridAdapter import com.casic.xz.meterage.utils.LocaleConstant -import com.casic.xz.meterage.view.NoticeListActivity +import com.casic.xz.meterage.view.home.EquipmentActivity +import com.casic.xz.meterage.view.notice.NoticeListActivity import com.casic.xz.meterage.vm.NoticeViewModel import com.pengxh.kt.lite.base.KotlinBaseFragment import com.pengxh.kt.lite.extensions.navigatePageTo @@ -36,8 +37,19 @@ homeFuncRecyclerView.adapter = homeAdapter homeAdapter.setOnGridItemClickListener(object : HomeGridAdapter.OnGridItemClickListener { override fun onItemClick(position: Int) { - when (position) { - + when (LocaleConstant.HOME_FUNC_OPERATE[position]) { + "仪器设备" -> requireContext().navigatePageTo() +// "标准装置" -> requireContext().navigatePageTo() +// "证书报告" -> requireContext().navigatePageTo() +// "委托需求" -> requireContext().navigatePageTo() +// "访客" -> requireContext().navigatePageTo() +// "标准规范" -> requireContext().navigatePageTo() +// "能力列表" -> requireContext().navigatePageTo() +// "计量培训" -> requireContext().navigatePageTo() +// "合同发票" -> requireContext().navigatePageTo() +// "业务统计" -> requireContext().navigatePageTo() +// "客户列表" -> requireContext().navigatePageTo() +// "外场检测" -> requireContext().navigatePageTo() } } }) diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt index 7e75abe..56dc5ec 100644 --- a/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt +++ b/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt @@ -2,9 +2,11 @@ import android.view.View import androidx.lifecycle.ViewModelProvider +import com.bumptech.glide.Glide +import com.bumptech.glide.request.RequestOptions import com.casic.xz.meterage.R import com.casic.xz.meterage.utils.LocaleConstant -import com.casic.xz.meterage.view.NoticeListActivity +import com.casic.xz.meterage.view.notice.NoticeListActivity import com.casic.xz.meterage.vm.NoticeViewModel import com.casic.xz.meterage.vm.UserViewModel import com.pengxh.kt.lite.base.KotlinBaseFragment @@ -23,6 +25,12 @@ val data = it.data userNameView.text = data.name userUnitView.text = data.deptName + +// Glide.with(requireContext()) +// .load(R.mipmap.default_avatar) +// .apply(RequestOptions.circleCropTransform()) +// .placeholder(R.mipmap.load_image_error) +// .into(userAvatarView) } }) diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt new file mode 100644 index 0000000..cf22646 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt @@ -0,0 +1,103 @@ +package com.casic.xz.meterage.fragment.equipment + +import android.graphics.Paint +import androidx.lifecycle.ViewModelProvider +import com.casic.xz.meterage.R +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.casic.xz.meterage.vm.EquipmentViewModel +import com.pengxh.kt.lite.base.KotlinBaseFragment +import com.pengxh.kt.lite.extensions.convertColor +import com.pengxh.kt.lite.vm.LoadState +import kotlinx.android.synthetic.main.fragment_basic_information.* + +class BasicInformationFragment(private val id: String) : KotlinBaseFragment() { + + private lateinit var equipmentViewModel: EquipmentViewModel + + override fun initData() { + equipmentViewModel = ViewModelProvider(this)[EquipmentViewModel::class.java] + equipmentViewModel.getEquipmentDetail(id) + equipmentViewModel.equipmentDetailResult.observe(this, { + if (it.code == 200) { + val data = it.data!! + + equipmentCodeView.text = data.equipmentNo + equipmentNameView.text = data.equipmentName + manufacturerView.text = data.manufacturer + factoryNumberView.text = data.manufacturingNo + modelView.text = data.modelNo + verificationMethodView.text = data.mesureTypeName + measuringRangeView.text = data.mesureRange + uncertaintyView.text = data.uncertainty + firstUseView.text = data.createTime + originalValueView.text = data.originValue + usageDeptView.text = data.useDeptName + userView.text = data.usePersonName + managementStatusView.text = data.managerStateName + verificationDeptView.text = data.useDeptName +// nextVerificationDeptView.text = data. + verificationPeriodView.text = data.mesureCycle + verificationDateView.text = data.mesureDate + effectiveDateView.text = data.validDate + verificationResultsView.text = data.mesureResultName + abcView.text = data.abcName + isNeedTechnicalView.text = if ( + data.isCalibrationTestEquipment.isNullOrBlank() || data.isCalibrationTestEquipment == "0" + ) { + "否" + } else { + "是" + } + + isStandingBook.text = if ( + data.isMeasureAccount.isNullOrBlank() || data.isMeasureAccount == "0" + ) { + "否" + } else { + "是" + } + + isStandardView.text = if ( + data.isStandardSupportEquipment.isNullOrBlank() || data.isStandardSupportEquipment == "0" + ) { + "否" + } else { + "是" + } + remarkView.text = data.remark + if (data.fileList.size == 0) { + instructionsView.text = "暂无" + } else { + instructionsView.text = "查看附件列表" + val textPaint = instructionsView.paint + textPaint.flags = Paint.UNDERLINE_TEXT_FLAG + textPaint.isAntiAlias = true + instructionsView.setTextColor(R.color.themeColor.convertColor(requireContext())) + + instructionsView.setOnClickListener { + + } + } + } + }) + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_basic_information + + override fun observeRequestState() { + equipmentViewModel.loadState.observe(this, { + when (it) { + LoadState.Loading -> LoadingDialogHub.show(requireActivity(), "数据加载中...") + else -> LoadingDialogHub.dismiss() + } + }) + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt new file mode 100644 index 0000000..0b4a747 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class CertificateFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_certificate + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt new file mode 100644 index 0000000..f05c491 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class ChangeRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_change_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt new file mode 100644 index 0000000..849ffa5 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class InspectionRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_inspection_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt new file mode 100644 index 0000000..aa4edd9 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class UsageRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_usage_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java b/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java new file mode 100644 index 0000000..0b9124e --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java @@ -0,0 +1,760 @@ +package com.casic.xz.meterage.model; + +import java.util.List; + +public class EquipmentDetailModel { + + private int code; + private DataModel data; + private String message; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataModel getData() { + return data; + } + + public void setData(DataModel data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public static class DataModel { + private String abc; + private String abcName; + private String assetNo; + private String assetSource; + private String assetType; + private String assetTypeName; + private String attribute; + private String capitalSource; + private String capitalSourceName; + private String cardEstablishmentDate; + private String createTime; + private String createUser; + private String depreciationMethod; + private String depreciationMethodName; + private String depreciationPeriod; + private String enableDate; + private String equipmentCategory; + private String equipmentCategoryName; + private String equipmentName; + private String equipmentNo; + private String equipmentSpecifications; + private String equipmentType; + private String equipmentTypeName; + private List fileList; + private String id; + private String installIncidentalExpenses; + private String installPlace; + private String intactState; + private String isCalibrationTestEquipment; + private int isDel; + private String isFixedAssets; + private String isMeasureAccount; + private String isStandardSupportEquipment; + private String labelBind; + private String majorCategory; + private String majorCategoryName; + private String managerLevel; + private String managerLevelName; + private String managerState; + private String managerStateName; + private String manufacturer; + private String manufacturerCountry; + private String manufacturingDate; + private String manufacturingNo; + private String mesureCycle; + private String mesureDate; + private String mesureDept; + private String mesureRange; + private String mesureResult; + private String mesureResultName; + private String mesureType; + private String mesureTypeName; + private String modelNo; + private String originValue; + private String overallDimension; + private String presentOriginValue; + private String purpose; + private String remark; + private String singlePrice; + private String supportStandardEquipmentName; + private String supportStandardEquipmentNo; + private String technicalLevel; + private String uncertainty; + private String updateTime; + private String useDept; + private String useDeptName; + private String usePerson; + private String usePersonName; + private String validDate; + private int version; + private String weight; + + public String getAbc() { + return abc; + } + + public void setAbc(String abc) { + this.abc = abc; + } + + public String getAbcName() { + return abcName; + } + + public void setAbcName(String abcName) { + this.abcName = abcName; + } + + public String getAssetNo() { + return assetNo; + } + + public void setAssetNo(String assetNo) { + this.assetNo = assetNo; + } + + public String getAssetSource() { + return assetSource; + } + + public void setAssetSource(String assetSource) { + this.assetSource = assetSource; + } + + public String getAssetType() { + return assetType; + } + + public void setAssetType(String assetType) { + this.assetType = assetType; + } + + public String getAssetTypeName() { + return assetTypeName; + } + + public void setAssetTypeName(String assetTypeName) { + this.assetTypeName = assetTypeName; + } + + public String getAttribute() { + return attribute; + } + + public void setAttribute(String attribute) { + this.attribute = attribute; + } + + public String getCapitalSource() { + return capitalSource; + } + + public void setCapitalSource(String capitalSource) { + this.capitalSource = capitalSource; + } + + public String getCapitalSourceName() { + return capitalSourceName; + } + + public void setCapitalSourceName(String capitalSourceName) { + this.capitalSourceName = capitalSourceName; + } + + public String getCardEstablishmentDate() { + return cardEstablishmentDate; + } + + public void setCardEstablishmentDate(String cardEstablishmentDate) { + this.cardEstablishmentDate = cardEstablishmentDate; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getDepreciationMethod() { + return depreciationMethod; + } + + public void setDepreciationMethod(String depreciationMethod) { + this.depreciationMethod = depreciationMethod; + } + + public String getDepreciationMethodName() { + return depreciationMethodName; + } + + public void setDepreciationMethodName(String depreciationMethodName) { + this.depreciationMethodName = depreciationMethodName; + } + + public String getDepreciationPeriod() { + return depreciationPeriod; + } + + public void setDepreciationPeriod(String depreciationPeriod) { + this.depreciationPeriod = depreciationPeriod; + } + + public String getEnableDate() { + return enableDate; + } + + public void setEnableDate(String enableDate) { + this.enableDate = enableDate; + } + + public String getEquipmentCategory() { + return equipmentCategory; + } + + public void setEquipmentCategory(String equipmentCategory) { + this.equipmentCategory = equipmentCategory; + } + + public String getEquipmentCategoryName() { + return equipmentCategoryName; + } + + public void setEquipmentCategoryName(String equipmentCategoryName) { + this.equipmentCategoryName = equipmentCategoryName; + } + + public String getEquipmentName() { + return equipmentName; + } + + public void setEquipmentName(String equipmentName) { + this.equipmentName = equipmentName; + } + + public String getEquipmentNo() { + return equipmentNo; + } + + public void setEquipmentNo(String equipmentNo) { + this.equipmentNo = equipmentNo; + } + + public String getEquipmentSpecifications() { + return equipmentSpecifications; + } + + public void setEquipmentSpecifications(String equipmentSpecifications) { + this.equipmentSpecifications = equipmentSpecifications; + } + + public String getEquipmentType() { + return equipmentType; + } + + public void setEquipmentType(String equipmentType) { + this.equipmentType = equipmentType; + } + + public String getEquipmentTypeName() { + return equipmentTypeName; + } + + public void setEquipmentTypeName(String equipmentTypeName) { + this.equipmentTypeName = equipmentTypeName; + } + + public List getFileList() { + return fileList; + } + + public void setFileList(List fileList) { + this.fileList = fileList; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getInstallIncidentalExpenses() { + return installIncidentalExpenses; + } + + public void setInstallIncidentalExpenses(String installIncidentalExpenses) { + this.installIncidentalExpenses = installIncidentalExpenses; + } + + public String getInstallPlace() { + return installPlace; + } + + public void setInstallPlace(String installPlace) { + this.installPlace = installPlace; + } + + public String getIntactState() { + return intactState; + } + + public void setIntactState(String intactState) { + this.intactState = intactState; + } + + public String getIsCalibrationTestEquipment() { + return isCalibrationTestEquipment; + } + + public void setIsCalibrationTestEquipment(String isCalibrationTestEquipment) { + this.isCalibrationTestEquipment = isCalibrationTestEquipment; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getIsFixedAssets() { + return isFixedAssets; + } + + public void setIsFixedAssets(String isFixedAssets) { + this.isFixedAssets = isFixedAssets; + } + + public String getIsMeasureAccount() { + return isMeasureAccount; + } + + public void setIsMeasureAccount(String isMeasureAccount) { + this.isMeasureAccount = isMeasureAccount; + } + + public String getIsStandardSupportEquipment() { + return isStandardSupportEquipment; + } + + public void setIsStandardSupportEquipment(String isStandardSupportEquipment) { + this.isStandardSupportEquipment = isStandardSupportEquipment; + } + + public String getLabelBind() { + return labelBind; + } + + public void setLabelBind(String labelBind) { + this.labelBind = labelBind; + } + + public String getMajorCategory() { + return majorCategory; + } + + public void setMajorCategory(String majorCategory) { + this.majorCategory = majorCategory; + } + + public String getMajorCategoryName() { + return majorCategoryName; + } + + public void setMajorCategoryName(String majorCategoryName) { + this.majorCategoryName = majorCategoryName; + } + + public String getManagerLevel() { + return managerLevel; + } + + public void setManagerLevel(String managerLevel) { + this.managerLevel = managerLevel; + } + + public String getManagerLevelName() { + return managerLevelName; + } + + public void setManagerLevelName(String managerLevelName) { + this.managerLevelName = managerLevelName; + } + + public String getManagerState() { + return managerState; + } + + public void setManagerState(String managerState) { + this.managerState = managerState; + } + + public String getManagerStateName() { + return managerStateName; + } + + public void setManagerStateName(String managerStateName) { + this.managerStateName = managerStateName; + } + + public String getManufacturer() { + return manufacturer; + } + + public void setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + } + + public String getManufacturerCountry() { + return manufacturerCountry; + } + + public void setManufacturerCountry(String manufacturerCountry) { + this.manufacturerCountry = manufacturerCountry; + } + + public String getManufacturingDate() { + return manufacturingDate; + } + + public void setManufacturingDate(String manufacturingDate) { + this.manufacturingDate = manufacturingDate; + } + + public String getManufacturingNo() { + return manufacturingNo; + } + + public void setManufacturingNo(String manufacturingNo) { + this.manufacturingNo = manufacturingNo; + } + + public String getMesureCycle() { + return mesureCycle; + } + + public void setMesureCycle(String mesureCycle) { + this.mesureCycle = mesureCycle; + } + + public String getMesureDate() { + return mesureDate; + } + + public void setMesureDate(String mesureDate) { + this.mesureDate = mesureDate; + } + + public String getMesureDept() { + return mesureDept; + } + + public void setMesureDept(String mesureDept) { + this.mesureDept = mesureDept; + } + + public String getMesureRange() { + return mesureRange; + } + + public void setMesureRange(String mesureRange) { + this.mesureRange = mesureRange; + } + + public String getMesureResult() { + return mesureResult; + } + + public void setMesureResult(String mesureResult) { + this.mesureResult = mesureResult; + } + + public String getMesureResultName() { + return mesureResultName; + } + + public void setMesureResultName(String mesureResultName) { + this.mesureResultName = mesureResultName; + } + + public String getMesureType() { + return mesureType; + } + + public void setMesureType(String mesureType) { + this.mesureType = mesureType; + } + + public String getMesureTypeName() { + return mesureTypeName; + } + + public void setMesureTypeName(String mesureTypeName) { + this.mesureTypeName = mesureTypeName; + } + + public String getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getOriginValue() { + return originValue; + } + + public void setOriginValue(String originValue) { + this.originValue = originValue; + } + + public String getOverallDimension() { + return overallDimension; + } + + public void setOverallDimension(String overallDimension) { + this.overallDimension = overallDimension; + } + + public String getPresentOriginValue() { + return presentOriginValue; + } + + public void setPresentOriginValue(String presentOriginValue) { + this.presentOriginValue = presentOriginValue; + } + + public String getPurpose() { + return purpose; + } + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getSinglePrice() { + return singlePrice; + } + + public void setSinglePrice(String singlePrice) { + this.singlePrice = singlePrice; + } + + public String getSupportStandardEquipmentName() { + return supportStandardEquipmentName; + } + + public void setSupportStandardEquipmentName(String supportStandardEquipmentName) { + this.supportStandardEquipmentName = supportStandardEquipmentName; + } + + public String getSupportStandardEquipmentNo() { + return supportStandardEquipmentNo; + } + + public void setSupportStandardEquipmentNo(String supportStandardEquipmentNo) { + this.supportStandardEquipmentNo = supportStandardEquipmentNo; + } + + public String getTechnicalLevel() { + return technicalLevel; + } + + public void setTechnicalLevel(String technicalLevel) { + this.technicalLevel = technicalLevel; + } + + public String getUncertainty() { + return uncertainty; + } + + public void setUncertainty(String uncertainty) { + this.uncertainty = uncertainty; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getUseDept() { + return useDept; + } + + public void setUseDept(String useDept) { + this.useDept = useDept; + } + + public String getUseDeptName() { + return useDeptName; + } + + public void setUseDeptName(String useDeptName) { + this.useDeptName = useDeptName; + } + + public String getUsePerson() { + return usePerson; + } + + public void setUsePerson(String usePerson) { + this.usePerson = usePerson; + } + + public String getUsePersonName() { + return usePersonName; + } + + public void setUsePersonName(String usePersonName) { + this.usePersonName = usePersonName; + } + + public String getValidDate() { + return validDate; + } + + public void setValidDate(String validDate) { + this.validDate = validDate; + } + + public int getVersion() { + return version; + } + + public void setVersion(int version) { + this.version = version; + } + + public String getWeight() { + return weight; + } + + public void setWeight(String weight) { + this.weight = weight; + } + + public static class FileListModel { + private String assetId; + private String createTime; + private String createUser; + private String fileName; + private String id; + private int isDel; + private String minioFileName; + private String remark; + private String updateTime; + + public String getAssetId() { + return assetId; + } + + public void setAssetId(String assetId) { + this.assetId = assetId; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getFileName() { + return fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getMinioFileName() { + return minioFileName; + } + + public void setMinioFileName(String minioFileName) { + this.minioFileName = minioFileName; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + } + } +} diff --git a/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java b/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java new file mode 100644 index 0000000..15fc128 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java @@ -0,0 +1,697 @@ +package com.casic.xz.meterage.model; + +import java.util.List; + +public class EquipmentListModel { + + private int code; + private DataModel data; + private String message; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataModel getData() { + return data; + } + + public void setData(DataModel data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public static class DataModel { + private List rows; + private int total; + + public List getRows() { + return rows; + } + + public void setRows(List rows) { + this.rows = rows; + } + + public int getTotal() { + return total; + } + + public void setTotal(int total) { + this.total = total; + } + + public static class RowsModel { + private String abc; + private String abcName; + private String assetNo; + private String assetSource; + private String assetType; + private String assetTypeName; + private String attribute; + private String capitalSource; + private String capitalSourceName; + private String cardEstablishmentDate; + private String createTime; + private String createUser; + private String depreciationMethod; + private String depreciationMethodName; + private String depreciationPeriod; + private String enableDate; + private String equipmentCategory; + private String equipmentCategoryName; + private String equipmentName; + private String equipmentNo; + private String equipmentSpecifications; + private String equipmentType; + private String equipmentTypeName; + private String fileList; + private String id; + private String installIncidentalExpenses; + private String installPlace; + private String intactState; + private String isCalibrationTestEquipment; + private int isDel; + private String isFixedAssets; + private String isMeasureAccount; + private String isStandardSupportEquipment; + private String labelBind; + private String majorCategory; + private String majorCategoryName; + private String managerLevel; + private String managerLevelName; + private String managerState; + private String managerStateName; + private String manufacturer; + private String manufacturerCountry; + private String manufacturingDate; + private String manufacturingNo; + private String mesureCycle; + private String mesureDate; + private String mesureDept; + private String mesureRange; + private String mesureResult; + private String mesureResultName; + private String mesureType; + private String mesureTypeName; + private String modelNo; + private String originValue; + private String overallDimension; + private String presentOriginValue; + private String purpose; + private String remark; + private String singlePrice; + private String supportStandardEquipmentName; + private String supportStandardEquipmentNo; + private String technicalLevel; + private String uncertainty; + private String updateTime; + private String useDept; + private String useDeptName; + private String usePerson; + private String usePersonName; + private String validDate; + private int version; + private String weight; + + public String getAbc() { + return abc; + } + + public void setAbc(String abc) { + this.abc = abc; + } + + public String getAbcName() { + return abcName; + } + + public void setAbcName(String abcName) { + this.abcName = abcName; + } + + public String getAssetNo() { + return assetNo; + } + + public void setAssetNo(String assetNo) { + this.assetNo = assetNo; + } + + public String getAssetSource() { + return assetSource; + } + + public void setAssetSource(String assetSource) { + this.assetSource = assetSource; + } + + public String getAssetType() { + return assetType; + } + + public void setAssetType(String assetType) { + this.assetType = assetType; + } + + public String getAssetTypeName() { + return assetTypeName; + } + + public void setAssetTypeName(String assetTypeName) { + this.assetTypeName = assetTypeName; + } + + public String getAttribute() { + return attribute; + } + + public void setAttribute(String attribute) { + this.attribute = attribute; + } + + public String getCapitalSource() { + return capitalSource; + } + + public void setCapitalSource(String capitalSource) { + this.capitalSource = capitalSource; + } + + public String getCapitalSourceName() { + return capitalSourceName; + } + + public void setCapitalSourceName(String capitalSourceName) { + this.capitalSourceName = capitalSourceName; + } + + public String getCardEstablishmentDate() { + return cardEstablishmentDate; + } + + public void setCardEstablishmentDate(String cardEstablishmentDate) { + this.cardEstablishmentDate = cardEstablishmentDate; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getDepreciationMethod() { + return depreciationMethod; + } + + public void setDepreciationMethod(String depreciationMethod) { + this.depreciationMethod = depreciationMethod; + } + + public String getDepreciationMethodName() { + return depreciationMethodName; + } + + public void setDepreciationMethodName(String depreciationMethodName) { + this.depreciationMethodName = depreciationMethodName; + } + + public String getDepreciationPeriod() { + return depreciationPeriod; + } + + public void setDepreciationPeriod(String depreciationPeriod) { + this.depreciationPeriod = depreciationPeriod; + } + + public String getEnableDate() { + return enableDate; + } + + public void setEnableDate(String enableDate) { + this.enableDate = enableDate; + } + + public String getEquipmentCategory() { + return equipmentCategory; + } + + public void setEquipmentCategory(String equipmentCategory) { + this.equipmentCategory = equipmentCategory; + } + + public String getEquipmentCategoryName() { + return equipmentCategoryName; + } + + public void setEquipmentCategoryName(String equipmentCategoryName) { + this.equipmentCategoryName = equipmentCategoryName; + } + + public String getEquipmentName() { + return equipmentName; + } + + public void setEquipmentName(String equipmentName) { + this.equipmentName = equipmentName; + } + + public String getEquipmentNo() { + return equipmentNo; + } + + public void setEquipmentNo(String equipmentNo) { + this.equipmentNo = equipmentNo; + } + + public String getEquipmentSpecifications() { + return equipmentSpecifications; + } + + public void setEquipmentSpecifications(String equipmentSpecifications) { + this.equipmentSpecifications = equipmentSpecifications; + } + + public String getEquipmentType() { + return equipmentType; + } + + public void setEquipmentType(String equipmentType) { + this.equipmentType = equipmentType; + } + + public String getEquipmentTypeName() { + return equipmentTypeName; + } + + public void setEquipmentTypeName(String equipmentTypeName) { + this.equipmentTypeName = equipmentTypeName; + } + + public String getFileList() { + return fileList; + } + + public void setFileList(String fileList) { + this.fileList = fileList; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getInstallIncidentalExpenses() { + return installIncidentalExpenses; + } + + public void setInstallIncidentalExpenses(String installIncidentalExpenses) { + this.installIncidentalExpenses = installIncidentalExpenses; + } + + public String getInstallPlace() { + return installPlace; + } + + public void setInstallPlace(String installPlace) { + this.installPlace = installPlace; + } + + public String getIntactState() { + return intactState; + } + + public void setIntactState(String intactState) { + this.intactState = intactState; + } + + public String getIsCalibrationTestEquipment() { + return isCalibrationTestEquipment; + } + + public void setIsCalibrationTestEquipment(String isCalibrationTestEquipment) { + this.isCalibrationTestEquipment = isCalibrationTestEquipment; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getIsFixedAssets() { + return isFixedAssets; + } + + public void setIsFixedAssets(String isFixedAssets) { + this.isFixedAssets = isFixedAssets; + } + + public String getIsMeasureAccount() { + return isMeasureAccount; + } + + public void setIsMeasureAccount(String isMeasureAccount) { + this.isMeasureAccount = isMeasureAccount; + } + + public String getIsStandardSupportEquipment() { + return isStandardSupportEquipment; + } + + public void setIsStandardSupportEquipment(String isStandardSupportEquipment) { + this.isStandardSupportEquipment = isStandardSupportEquipment; + } + + public String getLabelBind() { + return labelBind; + } + + public void setLabelBind(String labelBind) { + this.labelBind = labelBind; + } + + public String getMajorCategory() { + return majorCategory; + } + + public void setMajorCategory(String majorCategory) { + this.majorCategory = majorCategory; + } + + public String getMajorCategoryName() { + return majorCategoryName; + } + + public void setMajorCategoryName(String majorCategoryName) { + this.majorCategoryName = majorCategoryName; + } + + public String getManagerLevel() { + return managerLevel; + } + + public void setManagerLevel(String managerLevel) { + this.managerLevel = managerLevel; + } + + public String getManagerLevelName() { + return managerLevelName; + } + + public void setManagerLevelName(String managerLevelName) { + this.managerLevelName = managerLevelName; + } + + public String getManagerState() { + return managerState; + } + + public void setManagerState(String managerState) { + this.managerState = managerState; + } + + public String getManagerStateName() { + return managerStateName; + } + + public void setManagerStateName(String managerStateName) { + this.managerStateName = managerStateName; + } + + public String getManufacturer() { + return manufacturer; + } + + public void setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + } + + public String getManufacturerCountry() { + return manufacturerCountry; + } + + public void setManufacturerCountry(String manufacturerCountry) { + this.manufacturerCountry = manufacturerCountry; + } + + public String getManufacturingDate() { + return manufacturingDate; + } + + public void setManufacturingDate(String manufacturingDate) { + this.manufacturingDate = manufacturingDate; + } + + public String getManufacturingNo() { + return manufacturingNo; + } + + public void setManufacturingNo(String manufacturingNo) { + this.manufacturingNo = manufacturingNo; + } + + public String getMesureCycle() { + return mesureCycle; + } + + public void setMesureCycle(String mesureCycle) { + this.mesureCycle = mesureCycle; + } + + public String getMesureDate() { + return mesureDate; + } + + public void setMesureDate(String mesureDate) { + this.mesureDate = mesureDate; + } + + public String getMesureDept() { + return mesureDept; + } + + public void setMesureDept(String mesureDept) { + this.mesureDept = mesureDept; + } + + public String getMesureRange() { + return mesureRange; + } + + public void setMesureRange(String mesureRange) { + this.mesureRange = mesureRange; + } + + public String getMesureResult() { + return mesureResult; + } + + public void setMesureResult(String mesureResult) { + this.mesureResult = mesureResult; + } + + public String getMesureResultName() { + return mesureResultName; + } + + public void setMesureResultName(String mesureResultName) { + this.mesureResultName = mesureResultName; + } + + public String getMesureType() { + return mesureType; + } + + public void setMesureType(String mesureType) { + this.mesureType = mesureType; + } + + public String getMesureTypeName() { + return mesureTypeName; + } + + public void setMesureTypeName(String mesureTypeName) { + this.mesureTypeName = mesureTypeName; + } + + public String getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getOriginValue() { + return originValue; + } + + public void setOriginValue(String originValue) { + this.originValue = originValue; + } + + public String getOverallDimension() { + return overallDimension; + } + + public void setOverallDimension(String overallDimension) { + this.overallDimension = overallDimension; + } + + public String getPresentOriginValue() { + return presentOriginValue; + } + + public void setPresentOriginValue(String presentOriginValue) { + this.presentOriginValue = presentOriginValue; + } + + public String getPurpose() { + return purpose; + } + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getSinglePrice() { + return singlePrice; + } + + public void setSinglePrice(String singlePrice) { + this.singlePrice = singlePrice; + } + + public String getSupportStandardEquipmentName() { + return supportStandardEquipmentName; + } + + public void setSupportStandardEquipmentName(String supportStandardEquipmentName) { + this.supportStandardEquipmentName = supportStandardEquipmentName; + } + + public String getSupportStandardEquipmentNo() { + return supportStandardEquipmentNo; + } + + public void setSupportStandardEquipmentNo(String supportStandardEquipmentNo) { + this.supportStandardEquipmentNo = supportStandardEquipmentNo; + } + + public String getTechnicalLevel() { + return technicalLevel; + } + + public void setTechnicalLevel(String technicalLevel) { + this.technicalLevel = technicalLevel; + } + + public String getUncertainty() { + return uncertainty; + } + + public void setUncertainty(String uncertainty) { + this.uncertainty = uncertainty; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getUseDept() { + return useDept; + } + + public void setUseDept(String useDept) { + this.useDept = useDept; + } + + public String getUseDeptName() { + return useDeptName; + } + + public void setUseDeptName(String useDeptName) { + this.useDeptName = useDeptName; + } + + public String getUsePerson() { + return usePerson; + } + + public void setUsePerson(String usePerson) { + this.usePerson = usePerson; + } + + public String getUsePersonName() { + return usePersonName; + } + + public void setUsePersonName(String usePersonName) { + this.usePersonName = usePersonName; + } + + public String getValidDate() { + return validDate; + } + + public void setValidDate(String validDate) { + this.validDate = validDate; + } + + public int getVersion() { + return version; + } + + public void setVersion(int version) { + this.version = version; + } + + public String getWeight() { + return weight; + } + + public void setWeight(String weight) { + this.weight = weight; + } + } + } +} diff --git a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt index a3f514f..46e5eef 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt @@ -35,4 +35,24 @@ @QueryMap limit: Map, @QueryMap offset: Map ): String + + /** + * 获取设备列表 + */ + @POST("/meter/assets/listPage") + suspend fun getEquipmentList( + @Header("token") token: String, + @Body requestBody: RequestBody, + @QueryMap limit: Map, + @QueryMap offset: Map + ): String + + /** + * 获取设备详情 + */ + @POST("/meter/assets/detail") + suspend fun getEquipmentDetail( + @Header("token") token: String, + @Body requestBody: RequestBody + ): String } \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt index 444a872..386a1d8 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt @@ -6,8 +6,10 @@ import com.pengxh.kt.lite.utils.SaveKeyValues import okhttp3.MediaType.Companion.toMediaType import okhttp3.RequestBody.Companion.toRequestBody +import org.json.JSONArray import org.json.JSONObject + object RetrofitServiceManager { private val api by lazy { @@ -73,4 +75,71 @@ offsetMap["offset"] = offset return api.getNoticeList(AuthenticationHelper.token!!, requestBody, limitMap, offsetMap) } + + /** + * 获取设备列表 + */ + suspend fun getEquipmentList( + equipmentNo: String, + equipmentName: String, + mesureType: String, + managerState: String, + useDept: String, + assetType: String, + equipmentCategory: String, + isCalibrationTestEquipment: String, + isMeasureAccount: String, + isStandardSupportEquipment: String, + isFixedAssets: String, + validStartDate: String, + validEndDate: String, + abc: String, + ids: Array, + offset: Int + ): String { + val paramObject = JSONObject() + paramObject.put("equipmentNo", equipmentNo) + paramObject.put("equipmentName", equipmentName) + paramObject.put("mesureType", mesureType) + paramObject.put("managerState", managerState) + paramObject.put("useDept", useDept) + paramObject.put("assetType", assetType) + paramObject.put("equipmentCategory", equipmentCategory) + paramObject.put("isCalibrationTestEquipment", isCalibrationTestEquipment) + paramObject.put("isMeasureAccount", isMeasureAccount) + paramObject.put("isStandardSupportEquipment", isStandardSupportEquipment) + paramObject.put("isFixedAssets", isFixedAssets) + paramObject.put("validStartDate", validStartDate) + paramObject.put("validEndDate", validEndDate) + paramObject.put("abc", abc) + + val jsonArray = JSONArray() + ids.forEach { + jsonArray.put(it) + } + paramObject.put("ids", jsonArray) + + val requestBody = paramObject.toString().toRequestBody( + "application/json;charset=UTF-8".toMediaType() + ) + + val limitMap = HashMap() + limitMap["limit"] = LocaleConstant.PAGE_LIMIT + + val offsetMap = HashMap() + offsetMap["offset"] = offset + return api.getEquipmentList(AuthenticationHelper.token!!, requestBody, limitMap, offsetMap) + } + + /** + * 获取设备详情 + */ + suspend fun getEquipmentDetail(id: String): String { + val paramObject = JSONObject() + paramObject.put("id", id) + val requestBody = paramObject.toString().toRequestBody( + "application/json;charset=UTF-8".toMediaType() + ) + return api.getEquipmentDetail(AuthenticationHelper.token!!, requestBody) + } } \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt deleted file mode 100644 index a5bb60b..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt +++ /dev/null @@ -1,104 +0,0 @@ -package com.casic.xz.meterage.view - -import android.annotation.SuppressLint -import android.graphics.Paint -import androidx.lifecycle.ViewModelProvider -import com.casic.xz.meterage.R -import com.casic.xz.meterage.extensions.combineImagePath -import com.casic.xz.meterage.extensions.formatTextFromHtml -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.vm.NoticeViewModel -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.extensions.convertColor -import com.pengxh.kt.lite.extensions.navigatePageTo -import com.pengxh.kt.lite.extensions.obtainScreenWidth -import com.pengxh.kt.lite.extensions.show -import com.pengxh.kt.lite.utils.Constant -import kotlinx.android.synthetic.main.activity_notice_detail.* -import kotlinx.android.synthetic.main.include_base_title.* -import java.util.* - -@SuppressLint("SetTextI18n") -class NoticeDetailActivity : KotlinBaseActivity() { - - private lateinit var noticeViewModel: NoticeViewModel - - override fun initData() { - leftBackView.setOnClickListener { finish() } - titleView.text = "通知公告" - - val args = intent.getStringArrayListExtra(Constant.INTENT_PARAM)!! - - noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] - noticeViewModel.getNoticeList(args[0], args[1], args[2], "", "", 1) - noticeViewModel.noticeResult.observe(this, { - if (it.code == 200) { - val dataRow = it.data?.rows!![0] - - noticeDateView.text = dataRow.noticeTime - noticePublisherView.text = "发布人 ${dataRow.noticePublisher}" - noticeCompanyView.text = "发布单位 ${dataRow.noticeCompany}" - - noticeNoView.text = dataRow.noticeNo - noticeTitleView.text = dataRow.noticeTitle - noticeSketchView.text = dataRow.noticeSketch - - dataRow.noticeContent.formatTextFromHtml( - this, noticeContentView, obtainScreenWidth() - ) - - if (dataRow.minioFileName.isNullOrBlank()) { - minioFileView.text = "暂无附件" - } else { - val minioFileName = dataRow.minioFileName - - minioFileView.text = minioFileName - val textPaint = minioFileView.paint - textPaint.flags = Paint.UNDERLINE_TEXT_FLAG - textPaint.isAntiAlias = true - minioFileView.setTextColor(R.color.themeColor.convertColor(this)) - - minioFileView.setOnClickListener { - //查看附件 - if (minioFileName.endsWith("pdf")) { - navigatePageTo(minioFileName) - } else if ( - minioFileName.endsWith("doc") || - minioFileName.endsWith("docx") - ) { - navigatePageTo(minioFileName) - } else if (minioFileName.endsWith("txt")) { - navigatePageTo(minioFileName) - } else if ( - minioFileName.endsWith("png") || - minioFileName.endsWith("jpeg") || - minioFileName.endsWith("jpg") - ) { - val urls = ArrayList() - urls.add(minioFileName.combineImagePath()) - navigatePageTo(0, urls) - } else { - "文件类型未知,无法打开附件".show(this) - } - } - } - } - }) - } - - override fun initEvent() { - - } - - override fun initLayoutView(): Int = R.layout.activity_notice_detail - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/NoticeListActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/NoticeListActivity.kt deleted file mode 100644 index 15f6a16..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/NoticeListActivity.kt +++ /dev/null @@ -1,180 +0,0 @@ -package com.casic.xz.meterage.view - -import android.os.Handler -import android.util.Log -import android.view.View -import androidx.lifecycle.ViewModelProvider -import com.casic.xz.meterage.R -import com.casic.xz.meterage.adapter.NoticeListAdapter -import com.casic.xz.meterage.extensions.addAll -import com.casic.xz.meterage.extensions.combineFilePath -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.extensions.showEmptyPage -import com.casic.xz.meterage.model.NoticeListModel -import com.casic.xz.meterage.vm.NoticeViewModel -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.extensions.navigatePageTo -import com.pengxh.kt.lite.extensions.show -import com.pengxh.kt.lite.utils.WeakReferenceHandler -import com.pengxh.kt.lite.widget.dialog.AlertControlDialog -import kotlinx.android.synthetic.main.activity_notice_list.* -import kotlinx.android.synthetic.main.include_empty_view.* - -class NoticeListActivity : KotlinBaseActivity() { - - private lateinit var weakReferenceHandler: WeakReferenceHandler - private lateinit var noticeViewModel: NoticeViewModel - private lateinit var noticeListAdapter: NoticeListAdapter - private var dataBeans: MutableList = ArrayList() - private var pageIndex = 1 - private var isRefresh = false - private var isLoadMore = false - - override fun initData() { - weakReferenceHandler = WeakReferenceHandler(callback) - noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] - noticeViewModel.noticeResult.observe(this, { - if (it.code == 200) { - val dataRows = it.data?.rows!! -// countBadeNumber(dataRows) - when { - isRefresh -> { - dataBeans.clear() - dataBeans = dataRows - noticeLayout.finishRefresh() - isRefresh = false - } - isLoadMore -> { - if (dataRows.size == 0) { - "到底了,别拉了".show(this) - } - dataBeans.addAll(dataRows) - noticeLayout.finishLoadMore() - isLoadMore = false - } - else -> { - dataBeans = dataRows - } - } - weakReferenceHandler.sendEmptyMessage(2023013101) - } - }) - } - - override fun initEvent() { - leftBackView.setOnClickListener { finish() } - rightOperateView.setOnClickListener { - AlertControlDialog.Builder() - .setContext(this) - .setTitle("提示") - .setMessage("确定将所有未读消息标为已读?") - .setNegativeButton("取消") - .setPositiveButton("确定") - .setOnDialogButtonClickListener(object : - AlertControlDialog.OnDialogButtonClickListener { - override fun onCancelClick() { - - } - - override fun onConfirmClick() { - //TODO 设置为已读 - } - }).build().show() - } - - if (hasNoticePermission()) { - openSystemNoticeLayout.visibility = View.GONE - openSystemNoticeLayout.visibility = View.GONE - } else { - openSystemNoticeLayout.setOnClickListener { - - } - - - closeLayoutView.setOnClickListener { - openSystemNoticeLayout.visibility = View.GONE - } - } - - noticeLayout.setOnRefreshListener { - isRefresh = true - //刷新之后页码重置 - pageIndex = 1 - getNoticeListByPage() - } - - noticeLayout.setOnLoadMoreListener { - isLoadMore = true - pageIndex++ - getNoticeListByPage() - } - } - - override fun onResume() { - super.onResume() - pageIndex = 1 - getNoticeListByPage() - } - - private fun getNoticeListByPage() { - noticeViewModel.getNoticeList("", "", "", "", "", pageIndex) - } - - private val callback = Handler.Callback { - when (it.what) { - 2023013101 -> { - if (isRefresh || isLoadMore) { - noticeListAdapter.notifyDataSetChanged() - } else { - if (dataBeans.size == 0) { - emptyView!!.showEmptyPage("没有任何消息") { - pageIndex = 1 - getNoticeListByPage() - } - } else { - emptyView!!.hide() - noticeListAdapter = NoticeListAdapter(this, dataBeans) - noticeRecyclerView.adapter = noticeListAdapter - noticeListAdapter.setOnItemClickListener(object : - NoticeListAdapter.OnItemClickListener { - override fun onItemClicked(position: Int) { - val rowsModel = dataBeans[position] - val allArgs = addAll( - rowsModel.noticeNo, - rowsModel.noticeTitle, - rowsModel.noticePublisher, - "", - "" - ) - Log.d( - "Casic", - "NoticeListActivity => onItemClicked: ${rowsModel.minioFileName.combineFilePath()}" - ) - navigatePageTo(allArgs) - } - }) - } - } - } - } - true - } - - //TODO 判断是否开启通知权限 - private fun hasNoticePermission(): Boolean { - - return false - } - - override fun initLayoutView(): Int = R.layout.activity_notice_list - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/PreviewDocumentActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/PreviewDocumentActivity.kt deleted file mode 100644 index e233ddc..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/PreviewDocumentActivity.kt +++ /dev/null @@ -1,24 +0,0 @@ -package com.casic.xz.meterage.view - -import com.casic.xz.meterage.R -import com.pengxh.kt.lite.base.KotlinBaseActivity - -class PreviewDocumentActivity : KotlinBaseActivity() { - override fun initData() { - - } - - override fun initEvent() { - - } - - override fun initLayoutView(): Int = R.layout.activity_preview_doc - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/PreviewPdfActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/PreviewPdfActivity.kt deleted file mode 100644 index 39f8ac2..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/PreviewPdfActivity.kt +++ /dev/null @@ -1,62 +0,0 @@ -package com.casic.xz.meterage.view - -import com.casic.xz.meterage.R -import com.casic.xz.meterage.extensions.combineFilePath -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.utils.LoadingDialogHub -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.callback.OnDownloadListener -import com.pengxh.kt.lite.extensions.createDownloadFileDir -import com.pengxh.kt.lite.extensions.downloadFile -import com.pengxh.kt.lite.utils.Constant -import kotlinx.android.synthetic.main.activity_preview_pdf.* -import kotlinx.android.synthetic.main.include_base_title.* -import java.io.File -import java.io.FileInputStream - - -class PreviewPdfActivity : KotlinBaseActivity() { - - override fun initData() { - val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! - titleView.text = minioFileName - - val url = minioFileName.combineFilePath() - url.downloadFile(createDownloadFileDir().toString(), - object : OnDownloadListener { - override fun onDownloadStart(totalBytes: Long) { - runOnUiThread { - LoadingDialogHub.show(this@PreviewPdfActivity, "附件加载中") - } - } - - override fun onProgressChanged(currentBytes: Long) { - - } - - override fun onDownloadEnd(file: File?) { - runOnUiThread { - LoadingDialogHub.dismiss() - } - val inputStream = FileInputStream(file) - pdfView.fromStream(inputStream).load() - } - }) - } - - override fun initEvent() { - leftBackView.setOnClickListener { finish() } - } - - override fun initLayoutView(): Int = R.layout.activity_preview_pdf - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/PreviewTextActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/PreviewTextActivity.kt deleted file mode 100644 index d634ca3..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/PreviewTextActivity.kt +++ /dev/null @@ -1,60 +0,0 @@ -package com.casic.xz.meterage.view - -import com.casic.xz.meterage.R -import com.casic.xz.meterage.extensions.combineFilePath -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.utils.LoadingDialogHub -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.callback.OnDownloadListener -import com.pengxh.kt.lite.extensions.createDownloadFileDir -import com.pengxh.kt.lite.extensions.downloadFile -import com.pengxh.kt.lite.extensions.read -import com.pengxh.kt.lite.utils.Constant -import kotlinx.android.synthetic.main.activity_preview_txt.* -import kotlinx.android.synthetic.main.include_base_title.* -import java.io.File - -class PreviewTextActivity : KotlinBaseActivity() { - - override fun initData() { - val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! - titleView.text = minioFileName - - val url = minioFileName.combineFilePath() - url.downloadFile(createDownloadFileDir().toString(), - object : OnDownloadListener { - override fun onDownloadStart(totalBytes: Long) { - runOnUiThread { - LoadingDialogHub.show(this@PreviewTextActivity, "附件加载中") - } - } - - override fun onProgressChanged(currentBytes: Long) { - - } - - override fun onDownloadEnd(file: File?) { - runOnUiThread { - LoadingDialogHub.dismiss() - textView.text = file?.read() - } - } - }) - } - - override fun initEvent() { - leftBackView.setOnClickListener { finish() } - } - - override fun initLayoutView(): Int = R.layout.activity_preview_txt - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentActivity.kt new file mode 100644 index 0000000..35ca098 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentActivity.kt @@ -0,0 +1,158 @@ +package com.casic.xz.meterage.view.home + +import android.os.Handler +import androidx.lifecycle.ViewModelProvider +import androidx.recyclerview.widget.DividerItemDecoration +import com.casic.xz.meterage.R +import com.casic.xz.meterage.adapter.EquipmentListAdapter +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.extensions.showEmptyPage +import com.casic.xz.meterage.model.EquipmentListModel +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.casic.xz.meterage.vm.EquipmentViewModel +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.extensions.navigatePageTo +import com.pengxh.kt.lite.extensions.show +import com.pengxh.kt.lite.utils.WeakReferenceHandler +import com.pengxh.kt.lite.vm.LoadState +import kotlinx.android.synthetic.main.activity_equipment.* +import kotlinx.android.synthetic.main.include_empty_view.* +import kotlinx.android.synthetic.main.include_search_title.* + +class EquipmentActivity : KotlinBaseActivity() { + + private lateinit var weakReferenceHandler: WeakReferenceHandler + private lateinit var equipmentViewModel: EquipmentViewModel + private lateinit var equipmentListAdapter: EquipmentListAdapter + private var dataBeans: MutableList = ArrayList() + private var pageIndex = 1 + private var isRefresh = false + private var isLoadMore = false + + override fun initData() { + weakReferenceHandler = WeakReferenceHandler(callback) + equipmentViewModel = ViewModelProvider(this)[EquipmentViewModel::class.java] + equipmentViewModel.equipmentResult.observe(this, { + if (it.code == 200) { + val dataRows = it.data?.rows!! + when { + isRefresh -> { + dataBeans.clear() + dataBeans = dataRows + equipmentLayout.finishRefresh() + isRefresh = false + } + isLoadMore -> { + if (dataRows.size == 0) { + "到底了,别拉了".show(this) + } + dataBeans.addAll(dataRows) + equipmentLayout.finishLoadMore() + isLoadMore = false + } + else -> { + dataBeans = dataRows + } + } + weakReferenceHandler.sendEmptyMessage(2023020801) + } + }) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + rightOperateView.setOnClickListener { + + } + + equipmentLayout.setOnRefreshListener { + isRefresh = true + //刷新之后页码重置 + pageIndex = 1 + getEquipmentListByPage() + } + + equipmentLayout.setOnLoadMoreListener { + isLoadMore = true + pageIndex++ + getEquipmentListByPage() + } + } + + override fun initLayoutView(): Int = R.layout.activity_equipment + + override fun observeRequestState() { + equipmentViewModel.loadState.observe(this, { + when (it) { + LoadState.Loading -> LoadingDialogHub.show(this, "数据加载中...") + else -> LoadingDialogHub.dismiss() + } + }) + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + titleView.text = "仪器设备" + } + + override fun onResume() { + super.onResume() + pageIndex = 1 + getEquipmentListByPage() + } + + private fun getEquipmentListByPage() { + equipmentViewModel.getEquipmentList( + "", + "", + "", + "", + "", + "1", + "", + "", + "", + "", + "", + "", + "", + "", + arrayOf(), + pageIndex + ) + } + + private val callback = Handler.Callback { + when (it.what) { + 2023020801 -> { + if (isRefresh || isLoadMore) { + equipmentListAdapter.notifyDataSetChanged() + } else { + if (dataBeans.size == 0) { + emptyView!!.showEmptyPage("无设备") { + pageIndex = 1 + getEquipmentListByPage() + } + } else { + emptyView!!.hide() + equipmentListAdapter = EquipmentListAdapter(this, dataBeans) + equipmentRecyclerView.addItemDecoration( + DividerItemDecoration(this, DividerItemDecoration.VERTICAL) + ) + equipmentRecyclerView.adapter = equipmentListAdapter + equipmentListAdapter.setOnItemClickListener(object : + EquipmentListAdapter.OnItemClickListener { + override fun onItemClicked(position: Int) { + val rowsModel = dataBeans[position] + navigatePageTo(rowsModel.id) + } + }) + } + } + } + } + true + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentDetailActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentDetailActivity.kt new file mode 100644 index 0000000..7dee13c --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentDetailActivity.kt @@ -0,0 +1,53 @@ +package com.casic.xz.meterage.view.home + +import androidx.fragment.app.Fragment +import com.casic.xz.meterage.R +import com.casic.xz.meterage.adapter.SubViewPagerAdapter +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.fragment.equipment.* +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.utils.Constant +import kotlinx.android.synthetic.main.activity_equipment.rootView +import kotlinx.android.synthetic.main.activity_equipment_detail.* +import kotlinx.android.synthetic.main.include_base_title.* + +class EquipmentDetailActivity : KotlinBaseActivity() { + + private var fragmentPages: ArrayList = ArrayList() + + override fun initData() { + val equipmentId = intent.getStringExtra(Constant.INTENT_PARAM)!! + + fragmentPages.add(BasicInformationFragment(equipmentId)) + fragmentPages.add(InspectionRecordFragment()) + fragmentPages.add(ChangeRecordFragment()) + fragmentPages.add(UsageRecordFragment()) + fragmentPages.add(CertificateFragment()) + + val equipmentPageTitles = arrayOf("基础信息", "周检记录", "状态变更记录", "使用记录", "检定证书") + + equipmentViewPager.adapter = SubViewPagerAdapter( + supportFragmentManager, fragmentPages, equipmentPageTitles + ) + equipmentViewPager.offscreenPageLimit = fragmentPages.size + //绑定 + topTabLayout.setupWithViewPager(equipmentViewPager) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + } + + override fun initLayoutView(): Int = R.layout.activity_equipment_detail + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + titleView.text = "仪器设备" + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeDetailActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeDetailActivity.kt new file mode 100644 index 0000000..6fe0022 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeDetailActivity.kt @@ -0,0 +1,105 @@ +package com.casic.xz.meterage.view.notice + +import android.annotation.SuppressLint +import android.graphics.Paint +import androidx.lifecycle.ViewModelProvider +import com.casic.xz.meterage.R +import com.casic.xz.meterage.extensions.combineImagePath +import com.casic.xz.meterage.extensions.formatTextFromHtml +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.view.BigImageActivity +import com.casic.xz.meterage.vm.NoticeViewModel +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.extensions.convertColor +import com.pengxh.kt.lite.extensions.navigatePageTo +import com.pengxh.kt.lite.extensions.obtainScreenWidth +import com.pengxh.kt.lite.extensions.show +import com.pengxh.kt.lite.utils.Constant +import kotlinx.android.synthetic.main.activity_notice_detail.* +import kotlinx.android.synthetic.main.include_base_title.* +import java.util.* + +@SuppressLint("SetTextI18n") +class NoticeDetailActivity : KotlinBaseActivity() { + + private lateinit var noticeViewModel: NoticeViewModel + + override fun initData() { + leftBackView.setOnClickListener { finish() } + titleView.text = "通知公告" + + val args = intent.getStringArrayListExtra(Constant.INTENT_PARAM)!! + + noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] + noticeViewModel.getNoticeList(args[0], args[1], args[2], "", "", 1) + noticeViewModel.noticeResult.observe(this, { + if (it.code == 200) { + val dataRow = it.data?.rows!![0] + + noticeDateView.text = dataRow.noticeTime + noticePublisherView.text = "发布人 ${dataRow.noticePublisher}" + noticeCompanyView.text = "发布单位 ${dataRow.noticeCompany}" + + noticeNoView.text = dataRow.noticeNo + noticeTitleView.text = dataRow.noticeTitle + noticeSketchView.text = dataRow.noticeSketch + + dataRow.noticeContent.formatTextFromHtml( + this, noticeContentView, obtainScreenWidth() + ) + + if (dataRow.minioFileName.isNullOrBlank()) { + minioFileView.text = "暂无附件" + } else { + val minioFileName = dataRow.minioFileName + + minioFileView.text = minioFileName + val textPaint = minioFileView.paint + textPaint.flags = Paint.UNDERLINE_TEXT_FLAG + textPaint.isAntiAlias = true + minioFileView.setTextColor(R.color.themeColor.convertColor(this)) + + minioFileView.setOnClickListener { + //查看附件 + if (minioFileName.endsWith("pdf")) { + navigatePageTo(minioFileName) + } else if ( + minioFileName.endsWith("doc") || + minioFileName.endsWith("docx") + ) { + navigatePageTo(minioFileName) + } else if (minioFileName.endsWith("txt")) { + navigatePageTo(minioFileName) + } else if ( + minioFileName.endsWith("png") || + minioFileName.endsWith("jpeg") || + minioFileName.endsWith("jpg") + ) { + val urls = ArrayList() + urls.add(minioFileName.combineImagePath()) + navigatePageTo(0, urls) + } else { + "文件类型未知,无法打开附件".show(this) + } + } + } + } + }) + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.activity_notice_detail + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeListActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeListActivity.kt new file mode 100644 index 0000000..31c0490 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeListActivity.kt @@ -0,0 +1,180 @@ +package com.casic.xz.meterage.view.notice + +import android.os.Handler +import android.util.Log +import android.view.View +import androidx.lifecycle.ViewModelProvider +import com.casic.xz.meterage.R +import com.casic.xz.meterage.adapter.NoticeListAdapter +import com.casic.xz.meterage.extensions.addAll +import com.casic.xz.meterage.extensions.combineFilePath +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.extensions.showEmptyPage +import com.casic.xz.meterage.model.NoticeListModel +import com.casic.xz.meterage.vm.NoticeViewModel +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.extensions.navigatePageTo +import com.pengxh.kt.lite.extensions.show +import com.pengxh.kt.lite.utils.WeakReferenceHandler +import com.pengxh.kt.lite.widget.dialog.AlertControlDialog +import kotlinx.android.synthetic.main.activity_notice_list.* +import kotlinx.android.synthetic.main.include_empty_view.* + +class NoticeListActivity : KotlinBaseActivity() { + + private lateinit var weakReferenceHandler: WeakReferenceHandler + private lateinit var noticeViewModel: NoticeViewModel + private lateinit var noticeListAdapter: NoticeListAdapter + private var dataBeans: MutableList = ArrayList() + private var pageIndex = 1 + private var isRefresh = false + private var isLoadMore = false + + override fun initData() { + weakReferenceHandler = WeakReferenceHandler(callback) + noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] + noticeViewModel.noticeResult.observe(this, { + if (it.code == 200) { + val dataRows = it.data?.rows!! +// countBadeNumber(dataRows) + when { + isRefresh -> { + dataBeans.clear() + dataBeans = dataRows + noticeLayout.finishRefresh() + isRefresh = false + } + isLoadMore -> { + if (dataRows.size == 0) { + "到底了,别拉了".show(this) + } + dataBeans.addAll(dataRows) + noticeLayout.finishLoadMore() + isLoadMore = false + } + else -> { + dataBeans = dataRows + } + } + weakReferenceHandler.sendEmptyMessage(2023013101) + } + }) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + rightOperateView.setOnClickListener { + AlertControlDialog.Builder() + .setContext(this) + .setTitle("提示") + .setMessage("确定将所有未读消息标为已读?") + .setNegativeButton("取消") + .setPositiveButton("确定") + .setOnDialogButtonClickListener(object : + AlertControlDialog.OnDialogButtonClickListener { + override fun onCancelClick() { + + } + + override fun onConfirmClick() { + //TODO 设置为已读 + } + }).build().show() + } + + if (hasNoticePermission()) { + openSystemNoticeLayout.visibility = View.GONE + openSystemNoticeLayout.visibility = View.GONE + } else { + openSystemNoticeLayout.setOnClickListener { + + } + + + closeLayoutView.setOnClickListener { + openSystemNoticeLayout.visibility = View.GONE + } + } + + noticeLayout.setOnRefreshListener { + isRefresh = true + //刷新之后页码重置 + pageIndex = 1 + getNoticeListByPage() + } + + noticeLayout.setOnLoadMoreListener { + isLoadMore = true + pageIndex++ + getNoticeListByPage() + } + } + + override fun onResume() { + super.onResume() + pageIndex = 1 + getNoticeListByPage() + } + + private fun getNoticeListByPage() { + noticeViewModel.getNoticeList("", "", "", "", "", pageIndex) + } + + private val callback = Handler.Callback { + when (it.what) { + 2023013101 -> { + if (isRefresh || isLoadMore) { + noticeListAdapter.notifyDataSetChanged() + } else { + if (dataBeans.size == 0) { + emptyView!!.showEmptyPage("没有任何消息") { + pageIndex = 1 + getNoticeListByPage() + } + } else { + emptyView!!.hide() + noticeListAdapter = NoticeListAdapter(this, dataBeans) + noticeRecyclerView.adapter = noticeListAdapter + noticeListAdapter.setOnItemClickListener(object : + NoticeListAdapter.OnItemClickListener { + override fun onItemClicked(position: Int) { + val rowsModel = dataBeans[position] + val allArgs = addAll( + rowsModel.noticeNo, + rowsModel.noticeTitle, + rowsModel.noticePublisher, + "", + "" + ) + Log.d( + "Casic", + "NoticeListActivity => onItemClicked: ${rowsModel.minioFileName.combineFilePath()}" + ) + navigatePageTo(allArgs) + } + }) + } + } + } + } + true + } + + //TODO 判断是否开启通知权限 + private fun hasNoticePermission(): Boolean { + + return false + } + + override fun initLayoutView(): Int = R.layout.activity_notice_list + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewDocumentActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewDocumentActivity.kt new file mode 100644 index 0000000..4b16ae8 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewDocumentActivity.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.view.notice + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseActivity + +class PreviewDocumentActivity : KotlinBaseActivity() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.activity_preview_doc + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewPdfActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewPdfActivity.kt new file mode 100644 index 0000000..fad73b6 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewPdfActivity.kt @@ -0,0 +1,62 @@ +package com.casic.xz.meterage.view.notice + +import com.casic.xz.meterage.R +import com.casic.xz.meterage.extensions.combineFilePath +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.callback.OnDownloadListener +import com.pengxh.kt.lite.extensions.createDownloadFileDir +import com.pengxh.kt.lite.extensions.downloadFile +import com.pengxh.kt.lite.utils.Constant +import kotlinx.android.synthetic.main.activity_preview_pdf.* +import kotlinx.android.synthetic.main.include_base_title.* +import java.io.File +import java.io.FileInputStream + + +class PreviewPdfActivity : KotlinBaseActivity() { + + override fun initData() { + val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! + titleView.text = minioFileName + + val url = minioFileName.combineFilePath() + url.downloadFile(createDownloadFileDir().toString(), + object : OnDownloadListener { + override fun onDownloadStart(totalBytes: Long) { + runOnUiThread { + LoadingDialogHub.show(this@PreviewPdfActivity, "附件加载中") + } + } + + override fun onProgressChanged(currentBytes: Long) { + + } + + override fun onDownloadEnd(file: File?) { + runOnUiThread { + LoadingDialogHub.dismiss() + } + val inputStream = FileInputStream(file) + pdfView.fromStream(inputStream).load() + } + }) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + } + + override fun initLayoutView(): Int = R.layout.activity_preview_pdf + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewTextActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewTextActivity.kt new file mode 100644 index 0000000..d7850fb --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewTextActivity.kt @@ -0,0 +1,60 @@ +package com.casic.xz.meterage.view.notice + +import com.casic.xz.meterage.R +import com.casic.xz.meterage.extensions.combineFilePath +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.callback.OnDownloadListener +import com.pengxh.kt.lite.extensions.createDownloadFileDir +import com.pengxh.kt.lite.extensions.downloadFile +import com.pengxh.kt.lite.extensions.read +import com.pengxh.kt.lite.utils.Constant +import kotlinx.android.synthetic.main.activity_preview_txt.* +import kotlinx.android.synthetic.main.include_base_title.* +import java.io.File + +class PreviewTextActivity : KotlinBaseActivity() { + + override fun initData() { + val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! + titleView.text = minioFileName + + val url = minioFileName.combineFilePath() + url.downloadFile(createDownloadFileDir().toString(), + object : OnDownloadListener { + override fun onDownloadStart(totalBytes: Long) { + runOnUiThread { + LoadingDialogHub.show(this@PreviewTextActivity, "附件加载中") + } + } + + override fun onProgressChanged(currentBytes: Long) { + + } + + override fun onDownloadEnd(file: File?) { + runOnUiThread { + LoadingDialogHub.dismiss() + textView.text = file?.read() + } + } + }) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + } + + override fun initLayoutView(): Int = R.layout.activity_preview_txt + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/vm/EquipmentViewModel.kt b/app/src/main/java/com/casic/xz/meterage/vm/EquipmentViewModel.kt new file mode 100644 index 0000000..b5f21f6 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/vm/EquipmentViewModel.kt @@ -0,0 +1,92 @@ +package com.casic.xz.meterage.vm + +import androidx.lifecycle.MutableLiveData +import com.casic.xz.meterage.base.BaseApplication +import com.casic.xz.meterage.extensions.separateResponseCode +import com.casic.xz.meterage.extensions.toErrorMessage +import com.casic.xz.meterage.model.EquipmentDetailModel +import com.casic.xz.meterage.model.EquipmentListModel +import com.casic.xz.meterage.utils.retrofit.RetrofitServiceManager +import com.google.gson.Gson +import com.google.gson.reflect.TypeToken +import com.pengxh.kt.lite.extensions.launch +import com.pengxh.kt.lite.extensions.show +import com.pengxh.kt.lite.vm.BaseViewModel +import com.pengxh.kt.lite.vm.LoadState + +class EquipmentViewModel : BaseViewModel() { + + private val gson by lazy { Gson() } + val equipmentResult = MutableLiveData() + val equipmentDetailResult = MutableLiveData() + + fun getEquipmentList( + equipmentNo: String, + equipmentName: String, + mesureType: String, + managerState: String, + useDept: String, + assetType: String, + equipmentCategory: String, + isCalibrationTestEquipment: String, + isMeasureAccount: String, + isStandardSupportEquipment: String, + isFixedAssets: String, + validStartDate: String, + validEndDate: String, + abc: String, + ids: Array, + offset: Int + ) = launch({ + loadState.value = LoadState.Loading + val response = RetrofitServiceManager.getEquipmentList( + equipmentNo, + equipmentName, + mesureType, + managerState, + useDept, + assetType, + equipmentCategory, + isCalibrationTestEquipment, + isMeasureAccount, + isStandardSupportEquipment, + isFixedAssets, + validStartDate, + validEndDate, + abc, + ids, + offset + ) + val responseCode = response.separateResponseCode() + if (responseCode == 200) { + loadState.value = LoadState.Success + equipmentResult.value = gson.fromJson( + response, object : TypeToken() {}.type + ) + } else { + loadState.value = LoadState.Fail + response.toErrorMessage().show(BaseApplication.get()) + } + }, { + loadState.value = LoadState.Fail + it.printStackTrace() + }) + + fun getEquipmentDetail(id: String) = launch({ + loadState.value = LoadState.Loading + val response = RetrofitServiceManager.getEquipmentDetail(id) + val responseCode = response.separateResponseCode() + if (responseCode == 200) { + loadState.value = LoadState.Success + equipmentDetailResult.value = gson.fromJson( + response, object : TypeToken() {}.type + ) + } else { + loadState.value = LoadState.Fail + response.toErrorMessage().show(BaseApplication.get()) + } + }, { + loadState.value = LoadState.Fail + it.printStackTrace() + }) +} \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_sorting.xml b/app/src/main/res/drawable/ic_sorting.xml new file mode 100644 index 0000000..252bfe6 --- /dev/null +++ b/app/src/main/res/drawable/ic_sorting.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/layout/activity_equipment.xml b/app/src/main/res/layout/activity_equipment.xml new file mode 100644 index 0000000..d6a64b1 --- /dev/null +++ b/app/src/main/res/layout/activity_equipment.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_equipment_detail.xml b/app/src/main/res/layout/activity_equipment_detail.xml new file mode 100644 index 0000000..7254762 --- /dev/null +++ b/app/src/main/res/layout/activity_equipment_detail.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_basic_information.xml b/app/src/main/res/layout/fragment_basic_information.xml new file mode 100644 index 0000000..4a3c1c7 --- /dev/null +++ b/app/src/main/res/layout/fragment_basic_information.xml @@ -0,0 +1,390 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_certificate.xml b/app/src/main/res/layout/fragment_certificate.xml new file mode 100644 index 0000000..77d9ef6 --- /dev/null +++ b/app/src/main/res/layout/fragment_certificate.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_change_record.xml b/app/src/main/res/layout/fragment_change_record.xml new file mode 100644 index 0000000..77d9ef6 --- /dev/null +++ b/app/src/main/res/layout/fragment_change_record.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_home.xml b/app/src/main/res/layout/fragment_home.xml index 41b32a9..e1ab759 100644 --- a/app/src/main/res/layout/fragment_home.xml +++ b/app/src/main/res/layout/fragment_home.xml @@ -71,7 +71,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" app:layoutManager="androidx.recyclerview.widget.GridLayoutManager" - app:spanCount="5" /> + app:spanCount="4" /> + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_mine.xml b/app/src/main/res/layout/fragment_mine.xml index 0643064..d9f57b3 100644 --- a/app/src/main/res/layout/fragment_mine.xml +++ b/app/src/main/res/layout/fragment_mine.xml @@ -22,10 +22,10 @@ android:orientation="horizontal"> + android:src="@mipmap/default_avatar" /> @@ -122,7 +122,7 @@ android:background="@drawable/ic_collection" /> @@ -145,7 +145,7 @@ android:background="@drawable/ic_push_setting" /> @@ -166,7 +166,7 @@ android:background="@drawable/ic_privacy" /> @@ -189,7 +189,7 @@ android:background="@drawable/ic_help" /> @@ -210,7 +210,7 @@ android:background="@drawable/ic_update" /> @@ -231,7 +231,7 @@ android:background="@drawable/ic_about" /> @@ -252,7 +252,7 @@ android:background="@drawable/ic_back" /> diff --git a/app/src/main/res/layout/fragment_usage_record.xml b/app/src/main/res/layout/fragment_usage_record.xml new file mode 100644 index 0000000..77d9ef6 --- /dev/null +++ b/app/src/main/res/layout/fragment_usage_record.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 3892b5a..02160cd 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -34,16 +34,18 @@ - - - - - - - + + + + + + + + + +) : RecyclerView.Adapter() { + + private var layoutInflater: LayoutInflater = LayoutInflater.from(context) + + override fun getItemCount(): Int = dataRows.size + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = ItemViewHolder( + layoutInflater.inflate(R.layout.item_equipment_rv_l, parent, false) + ) + + override fun onBindViewHolder(holder: ItemViewHolder, position: Int) { + //绑定数据 + val rowsBean = dataRows[position] + holder.equipmentNameView.text = rowsBean.equipmentName + holder.equipmentCodeView.text = rowsBean.equipmentNo + holder.equipmentDateView.text = rowsBean.enableDate + holder.equipmentLibView.text = rowsBean.useDeptName + + //绑定事件 + holder.itemView.setOnClickListener { + listener?.onItemClicked(position) + } + } + + inner class ItemViewHolder(view: View) : RecyclerView.ViewHolder(view) { + var equipmentNameView: TextView = view.findViewById(R.id.equipmentNameView) + var equipmentCodeView: TextView = view.findViewById(R.id.equipmentCodeView) + var equipmentDateView: TextView = view.findViewById(R.id.equipmentDateView) + var equipmentLibView: TextView = view.findViewById(R.id.equipmentLibView) + } + + private var listener: OnItemClickListener? = null + + interface OnItemClickListener { + fun onItemClicked(position: Int) + } + + fun setOnItemClickListener(onClickListener: OnItemClickListener?) { + this.listener = onClickListener + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt index b4628f3..d970b55 100644 --- a/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt +++ b/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt @@ -5,7 +5,8 @@ import com.casic.xz.meterage.R import com.casic.xz.meterage.adapter.HomeGridAdapter import com.casic.xz.meterage.utils.LocaleConstant -import com.casic.xz.meterage.view.NoticeListActivity +import com.casic.xz.meterage.view.home.EquipmentActivity +import com.casic.xz.meterage.view.notice.NoticeListActivity import com.casic.xz.meterage.vm.NoticeViewModel import com.pengxh.kt.lite.base.KotlinBaseFragment import com.pengxh.kt.lite.extensions.navigatePageTo @@ -36,8 +37,19 @@ homeFuncRecyclerView.adapter = homeAdapter homeAdapter.setOnGridItemClickListener(object : HomeGridAdapter.OnGridItemClickListener { override fun onItemClick(position: Int) { - when (position) { - + when (LocaleConstant.HOME_FUNC_OPERATE[position]) { + "仪器设备" -> requireContext().navigatePageTo() +// "标准装置" -> requireContext().navigatePageTo() +// "证书报告" -> requireContext().navigatePageTo() +// "委托需求" -> requireContext().navigatePageTo() +// "访客" -> requireContext().navigatePageTo() +// "标准规范" -> requireContext().navigatePageTo() +// "能力列表" -> requireContext().navigatePageTo() +// "计量培训" -> requireContext().navigatePageTo() +// "合同发票" -> requireContext().navigatePageTo() +// "业务统计" -> requireContext().navigatePageTo() +// "客户列表" -> requireContext().navigatePageTo() +// "外场检测" -> requireContext().navigatePageTo() } } }) diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt index 7e75abe..56dc5ec 100644 --- a/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt +++ b/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt @@ -2,9 +2,11 @@ import android.view.View import androidx.lifecycle.ViewModelProvider +import com.bumptech.glide.Glide +import com.bumptech.glide.request.RequestOptions import com.casic.xz.meterage.R import com.casic.xz.meterage.utils.LocaleConstant -import com.casic.xz.meterage.view.NoticeListActivity +import com.casic.xz.meterage.view.notice.NoticeListActivity import com.casic.xz.meterage.vm.NoticeViewModel import com.casic.xz.meterage.vm.UserViewModel import com.pengxh.kt.lite.base.KotlinBaseFragment @@ -23,6 +25,12 @@ val data = it.data userNameView.text = data.name userUnitView.text = data.deptName + +// Glide.with(requireContext()) +// .load(R.mipmap.default_avatar) +// .apply(RequestOptions.circleCropTransform()) +// .placeholder(R.mipmap.load_image_error) +// .into(userAvatarView) } }) diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt new file mode 100644 index 0000000..cf22646 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt @@ -0,0 +1,103 @@ +package com.casic.xz.meterage.fragment.equipment + +import android.graphics.Paint +import androidx.lifecycle.ViewModelProvider +import com.casic.xz.meterage.R +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.casic.xz.meterage.vm.EquipmentViewModel +import com.pengxh.kt.lite.base.KotlinBaseFragment +import com.pengxh.kt.lite.extensions.convertColor +import com.pengxh.kt.lite.vm.LoadState +import kotlinx.android.synthetic.main.fragment_basic_information.* + +class BasicInformationFragment(private val id: String) : KotlinBaseFragment() { + + private lateinit var equipmentViewModel: EquipmentViewModel + + override fun initData() { + equipmentViewModel = ViewModelProvider(this)[EquipmentViewModel::class.java] + equipmentViewModel.getEquipmentDetail(id) + equipmentViewModel.equipmentDetailResult.observe(this, { + if (it.code == 200) { + val data = it.data!! + + equipmentCodeView.text = data.equipmentNo + equipmentNameView.text = data.equipmentName + manufacturerView.text = data.manufacturer + factoryNumberView.text = data.manufacturingNo + modelView.text = data.modelNo + verificationMethodView.text = data.mesureTypeName + measuringRangeView.text = data.mesureRange + uncertaintyView.text = data.uncertainty + firstUseView.text = data.createTime + originalValueView.text = data.originValue + usageDeptView.text = data.useDeptName + userView.text = data.usePersonName + managementStatusView.text = data.managerStateName + verificationDeptView.text = data.useDeptName +// nextVerificationDeptView.text = data. + verificationPeriodView.text = data.mesureCycle + verificationDateView.text = data.mesureDate + effectiveDateView.text = data.validDate + verificationResultsView.text = data.mesureResultName + abcView.text = data.abcName + isNeedTechnicalView.text = if ( + data.isCalibrationTestEquipment.isNullOrBlank() || data.isCalibrationTestEquipment == "0" + ) { + "否" + } else { + "是" + } + + isStandingBook.text = if ( + data.isMeasureAccount.isNullOrBlank() || data.isMeasureAccount == "0" + ) { + "否" + } else { + "是" + } + + isStandardView.text = if ( + data.isStandardSupportEquipment.isNullOrBlank() || data.isStandardSupportEquipment == "0" + ) { + "否" + } else { + "是" + } + remarkView.text = data.remark + if (data.fileList.size == 0) { + instructionsView.text = "暂无" + } else { + instructionsView.text = "查看附件列表" + val textPaint = instructionsView.paint + textPaint.flags = Paint.UNDERLINE_TEXT_FLAG + textPaint.isAntiAlias = true + instructionsView.setTextColor(R.color.themeColor.convertColor(requireContext())) + + instructionsView.setOnClickListener { + + } + } + } + }) + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_basic_information + + override fun observeRequestState() { + equipmentViewModel.loadState.observe(this, { + when (it) { + LoadState.Loading -> LoadingDialogHub.show(requireActivity(), "数据加载中...") + else -> LoadingDialogHub.dismiss() + } + }) + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt new file mode 100644 index 0000000..0b4a747 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class CertificateFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_certificate + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt new file mode 100644 index 0000000..f05c491 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class ChangeRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_change_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt new file mode 100644 index 0000000..849ffa5 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class InspectionRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_inspection_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt new file mode 100644 index 0000000..aa4edd9 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class UsageRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_usage_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java b/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java new file mode 100644 index 0000000..0b9124e --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java @@ -0,0 +1,760 @@ +package com.casic.xz.meterage.model; + +import java.util.List; + +public class EquipmentDetailModel { + + private int code; + private DataModel data; + private String message; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataModel getData() { + return data; + } + + public void setData(DataModel data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public static class DataModel { + private String abc; + private String abcName; + private String assetNo; + private String assetSource; + private String assetType; + private String assetTypeName; + private String attribute; + private String capitalSource; + private String capitalSourceName; + private String cardEstablishmentDate; + private String createTime; + private String createUser; + private String depreciationMethod; + private String depreciationMethodName; + private String depreciationPeriod; + private String enableDate; + private String equipmentCategory; + private String equipmentCategoryName; + private String equipmentName; + private String equipmentNo; + private String equipmentSpecifications; + private String equipmentType; + private String equipmentTypeName; + private List fileList; + private String id; + private String installIncidentalExpenses; + private String installPlace; + private String intactState; + private String isCalibrationTestEquipment; + private int isDel; + private String isFixedAssets; + private String isMeasureAccount; + private String isStandardSupportEquipment; + private String labelBind; + private String majorCategory; + private String majorCategoryName; + private String managerLevel; + private String managerLevelName; + private String managerState; + private String managerStateName; + private String manufacturer; + private String manufacturerCountry; + private String manufacturingDate; + private String manufacturingNo; + private String mesureCycle; + private String mesureDate; + private String mesureDept; + private String mesureRange; + private String mesureResult; + private String mesureResultName; + private String mesureType; + private String mesureTypeName; + private String modelNo; + private String originValue; + private String overallDimension; + private String presentOriginValue; + private String purpose; + private String remark; + private String singlePrice; + private String supportStandardEquipmentName; + private String supportStandardEquipmentNo; + private String technicalLevel; + private String uncertainty; + private String updateTime; + private String useDept; + private String useDeptName; + private String usePerson; + private String usePersonName; + private String validDate; + private int version; + private String weight; + + public String getAbc() { + return abc; + } + + public void setAbc(String abc) { + this.abc = abc; + } + + public String getAbcName() { + return abcName; + } + + public void setAbcName(String abcName) { + this.abcName = abcName; + } + + public String getAssetNo() { + return assetNo; + } + + public void setAssetNo(String assetNo) { + this.assetNo = assetNo; + } + + public String getAssetSource() { + return assetSource; + } + + public void setAssetSource(String assetSource) { + this.assetSource = assetSource; + } + + public String getAssetType() { + return assetType; + } + + public void setAssetType(String assetType) { + this.assetType = assetType; + } + + public String getAssetTypeName() { + return assetTypeName; + } + + public void setAssetTypeName(String assetTypeName) { + this.assetTypeName = assetTypeName; + } + + public String getAttribute() { + return attribute; + } + + public void setAttribute(String attribute) { + this.attribute = attribute; + } + + public String getCapitalSource() { + return capitalSource; + } + + public void setCapitalSource(String capitalSource) { + this.capitalSource = capitalSource; + } + + public String getCapitalSourceName() { + return capitalSourceName; + } + + public void setCapitalSourceName(String capitalSourceName) { + this.capitalSourceName = capitalSourceName; + } + + public String getCardEstablishmentDate() { + return cardEstablishmentDate; + } + + public void setCardEstablishmentDate(String cardEstablishmentDate) { + this.cardEstablishmentDate = cardEstablishmentDate; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getDepreciationMethod() { + return depreciationMethod; + } + + public void setDepreciationMethod(String depreciationMethod) { + this.depreciationMethod = depreciationMethod; + } + + public String getDepreciationMethodName() { + return depreciationMethodName; + } + + public void setDepreciationMethodName(String depreciationMethodName) { + this.depreciationMethodName = depreciationMethodName; + } + + public String getDepreciationPeriod() { + return depreciationPeriod; + } + + public void setDepreciationPeriod(String depreciationPeriod) { + this.depreciationPeriod = depreciationPeriod; + } + + public String getEnableDate() { + return enableDate; + } + + public void setEnableDate(String enableDate) { + this.enableDate = enableDate; + } + + public String getEquipmentCategory() { + return equipmentCategory; + } + + public void setEquipmentCategory(String equipmentCategory) { + this.equipmentCategory = equipmentCategory; + } + + public String getEquipmentCategoryName() { + return equipmentCategoryName; + } + + public void setEquipmentCategoryName(String equipmentCategoryName) { + this.equipmentCategoryName = equipmentCategoryName; + } + + public String getEquipmentName() { + return equipmentName; + } + + public void setEquipmentName(String equipmentName) { + this.equipmentName = equipmentName; + } + + public String getEquipmentNo() { + return equipmentNo; + } + + public void setEquipmentNo(String equipmentNo) { + this.equipmentNo = equipmentNo; + } + + public String getEquipmentSpecifications() { + return equipmentSpecifications; + } + + public void setEquipmentSpecifications(String equipmentSpecifications) { + this.equipmentSpecifications = equipmentSpecifications; + } + + public String getEquipmentType() { + return equipmentType; + } + + public void setEquipmentType(String equipmentType) { + this.equipmentType = equipmentType; + } + + public String getEquipmentTypeName() { + return equipmentTypeName; + } + + public void setEquipmentTypeName(String equipmentTypeName) { + this.equipmentTypeName = equipmentTypeName; + } + + public List getFileList() { + return fileList; + } + + public void setFileList(List fileList) { + this.fileList = fileList; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getInstallIncidentalExpenses() { + return installIncidentalExpenses; + } + + public void setInstallIncidentalExpenses(String installIncidentalExpenses) { + this.installIncidentalExpenses = installIncidentalExpenses; + } + + public String getInstallPlace() { + return installPlace; + } + + public void setInstallPlace(String installPlace) { + this.installPlace = installPlace; + } + + public String getIntactState() { + return intactState; + } + + public void setIntactState(String intactState) { + this.intactState = intactState; + } + + public String getIsCalibrationTestEquipment() { + return isCalibrationTestEquipment; + } + + public void setIsCalibrationTestEquipment(String isCalibrationTestEquipment) { + this.isCalibrationTestEquipment = isCalibrationTestEquipment; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getIsFixedAssets() { + return isFixedAssets; + } + + public void setIsFixedAssets(String isFixedAssets) { + this.isFixedAssets = isFixedAssets; + } + + public String getIsMeasureAccount() { + return isMeasureAccount; + } + + public void setIsMeasureAccount(String isMeasureAccount) { + this.isMeasureAccount = isMeasureAccount; + } + + public String getIsStandardSupportEquipment() { + return isStandardSupportEquipment; + } + + public void setIsStandardSupportEquipment(String isStandardSupportEquipment) { + this.isStandardSupportEquipment = isStandardSupportEquipment; + } + + public String getLabelBind() { + return labelBind; + } + + public void setLabelBind(String labelBind) { + this.labelBind = labelBind; + } + + public String getMajorCategory() { + return majorCategory; + } + + public void setMajorCategory(String majorCategory) { + this.majorCategory = majorCategory; + } + + public String getMajorCategoryName() { + return majorCategoryName; + } + + public void setMajorCategoryName(String majorCategoryName) { + this.majorCategoryName = majorCategoryName; + } + + public String getManagerLevel() { + return managerLevel; + } + + public void setManagerLevel(String managerLevel) { + this.managerLevel = managerLevel; + } + + public String getManagerLevelName() { + return managerLevelName; + } + + public void setManagerLevelName(String managerLevelName) { + this.managerLevelName = managerLevelName; + } + + public String getManagerState() { + return managerState; + } + + public void setManagerState(String managerState) { + this.managerState = managerState; + } + + public String getManagerStateName() { + return managerStateName; + } + + public void setManagerStateName(String managerStateName) { + this.managerStateName = managerStateName; + } + + public String getManufacturer() { + return manufacturer; + } + + public void setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + } + + public String getManufacturerCountry() { + return manufacturerCountry; + } + + public void setManufacturerCountry(String manufacturerCountry) { + this.manufacturerCountry = manufacturerCountry; + } + + public String getManufacturingDate() { + return manufacturingDate; + } + + public void setManufacturingDate(String manufacturingDate) { + this.manufacturingDate = manufacturingDate; + } + + public String getManufacturingNo() { + return manufacturingNo; + } + + public void setManufacturingNo(String manufacturingNo) { + this.manufacturingNo = manufacturingNo; + } + + public String getMesureCycle() { + return mesureCycle; + } + + public void setMesureCycle(String mesureCycle) { + this.mesureCycle = mesureCycle; + } + + public String getMesureDate() { + return mesureDate; + } + + public void setMesureDate(String mesureDate) { + this.mesureDate = mesureDate; + } + + public String getMesureDept() { + return mesureDept; + } + + public void setMesureDept(String mesureDept) { + this.mesureDept = mesureDept; + } + + public String getMesureRange() { + return mesureRange; + } + + public void setMesureRange(String mesureRange) { + this.mesureRange = mesureRange; + } + + public String getMesureResult() { + return mesureResult; + } + + public void setMesureResult(String mesureResult) { + this.mesureResult = mesureResult; + } + + public String getMesureResultName() { + return mesureResultName; + } + + public void setMesureResultName(String mesureResultName) { + this.mesureResultName = mesureResultName; + } + + public String getMesureType() { + return mesureType; + } + + public void setMesureType(String mesureType) { + this.mesureType = mesureType; + } + + public String getMesureTypeName() { + return mesureTypeName; + } + + public void setMesureTypeName(String mesureTypeName) { + this.mesureTypeName = mesureTypeName; + } + + public String getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getOriginValue() { + return originValue; + } + + public void setOriginValue(String originValue) { + this.originValue = originValue; + } + + public String getOverallDimension() { + return overallDimension; + } + + public void setOverallDimension(String overallDimension) { + this.overallDimension = overallDimension; + } + + public String getPresentOriginValue() { + return presentOriginValue; + } + + public void setPresentOriginValue(String presentOriginValue) { + this.presentOriginValue = presentOriginValue; + } + + public String getPurpose() { + return purpose; + } + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getSinglePrice() { + return singlePrice; + } + + public void setSinglePrice(String singlePrice) { + this.singlePrice = singlePrice; + } + + public String getSupportStandardEquipmentName() { + return supportStandardEquipmentName; + } + + public void setSupportStandardEquipmentName(String supportStandardEquipmentName) { + this.supportStandardEquipmentName = supportStandardEquipmentName; + } + + public String getSupportStandardEquipmentNo() { + return supportStandardEquipmentNo; + } + + public void setSupportStandardEquipmentNo(String supportStandardEquipmentNo) { + this.supportStandardEquipmentNo = supportStandardEquipmentNo; + } + + public String getTechnicalLevel() { + return technicalLevel; + } + + public void setTechnicalLevel(String technicalLevel) { + this.technicalLevel = technicalLevel; + } + + public String getUncertainty() { + return uncertainty; + } + + public void setUncertainty(String uncertainty) { + this.uncertainty = uncertainty; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getUseDept() { + return useDept; + } + + public void setUseDept(String useDept) { + this.useDept = useDept; + } + + public String getUseDeptName() { + return useDeptName; + } + + public void setUseDeptName(String useDeptName) { + this.useDeptName = useDeptName; + } + + public String getUsePerson() { + return usePerson; + } + + public void setUsePerson(String usePerson) { + this.usePerson = usePerson; + } + + public String getUsePersonName() { + return usePersonName; + } + + public void setUsePersonName(String usePersonName) { + this.usePersonName = usePersonName; + } + + public String getValidDate() { + return validDate; + } + + public void setValidDate(String validDate) { + this.validDate = validDate; + } + + public int getVersion() { + return version; + } + + public void setVersion(int version) { + this.version = version; + } + + public String getWeight() { + return weight; + } + + public void setWeight(String weight) { + this.weight = weight; + } + + public static class FileListModel { + private String assetId; + private String createTime; + private String createUser; + private String fileName; + private String id; + private int isDel; + private String minioFileName; + private String remark; + private String updateTime; + + public String getAssetId() { + return assetId; + } + + public void setAssetId(String assetId) { + this.assetId = assetId; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getFileName() { + return fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getMinioFileName() { + return minioFileName; + } + + public void setMinioFileName(String minioFileName) { + this.minioFileName = minioFileName; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + } + } +} diff --git a/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java b/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java new file mode 100644 index 0000000..15fc128 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java @@ -0,0 +1,697 @@ +package com.casic.xz.meterage.model; + +import java.util.List; + +public class EquipmentListModel { + + private int code; + private DataModel data; + private String message; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataModel getData() { + return data; + } + + public void setData(DataModel data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public static class DataModel { + private List rows; + private int total; + + public List getRows() { + return rows; + } + + public void setRows(List rows) { + this.rows = rows; + } + + public int getTotal() { + return total; + } + + public void setTotal(int total) { + this.total = total; + } + + public static class RowsModel { + private String abc; + private String abcName; + private String assetNo; + private String assetSource; + private String assetType; + private String assetTypeName; + private String attribute; + private String capitalSource; + private String capitalSourceName; + private String cardEstablishmentDate; + private String createTime; + private String createUser; + private String depreciationMethod; + private String depreciationMethodName; + private String depreciationPeriod; + private String enableDate; + private String equipmentCategory; + private String equipmentCategoryName; + private String equipmentName; + private String equipmentNo; + private String equipmentSpecifications; + private String equipmentType; + private String equipmentTypeName; + private String fileList; + private String id; + private String installIncidentalExpenses; + private String installPlace; + private String intactState; + private String isCalibrationTestEquipment; + private int isDel; + private String isFixedAssets; + private String isMeasureAccount; + private String isStandardSupportEquipment; + private String labelBind; + private String majorCategory; + private String majorCategoryName; + private String managerLevel; + private String managerLevelName; + private String managerState; + private String managerStateName; + private String manufacturer; + private String manufacturerCountry; + private String manufacturingDate; + private String manufacturingNo; + private String mesureCycle; + private String mesureDate; + private String mesureDept; + private String mesureRange; + private String mesureResult; + private String mesureResultName; + private String mesureType; + private String mesureTypeName; + private String modelNo; + private String originValue; + private String overallDimension; + private String presentOriginValue; + private String purpose; + private String remark; + private String singlePrice; + private String supportStandardEquipmentName; + private String supportStandardEquipmentNo; + private String technicalLevel; + private String uncertainty; + private String updateTime; + private String useDept; + private String useDeptName; + private String usePerson; + private String usePersonName; + private String validDate; + private int version; + private String weight; + + public String getAbc() { + return abc; + } + + public void setAbc(String abc) { + this.abc = abc; + } + + public String getAbcName() { + return abcName; + } + + public void setAbcName(String abcName) { + this.abcName = abcName; + } + + public String getAssetNo() { + return assetNo; + } + + public void setAssetNo(String assetNo) { + this.assetNo = assetNo; + } + + public String getAssetSource() { + return assetSource; + } + + public void setAssetSource(String assetSource) { + this.assetSource = assetSource; + } + + public String getAssetType() { + return assetType; + } + + public void setAssetType(String assetType) { + this.assetType = assetType; + } + + public String getAssetTypeName() { + return assetTypeName; + } + + public void setAssetTypeName(String assetTypeName) { + this.assetTypeName = assetTypeName; + } + + public String getAttribute() { + return attribute; + } + + public void setAttribute(String attribute) { + this.attribute = attribute; + } + + public String getCapitalSource() { + return capitalSource; + } + + public void setCapitalSource(String capitalSource) { + this.capitalSource = capitalSource; + } + + public String getCapitalSourceName() { + return capitalSourceName; + } + + public void setCapitalSourceName(String capitalSourceName) { + this.capitalSourceName = capitalSourceName; + } + + public String getCardEstablishmentDate() { + return cardEstablishmentDate; + } + + public void setCardEstablishmentDate(String cardEstablishmentDate) { + this.cardEstablishmentDate = cardEstablishmentDate; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getDepreciationMethod() { + return depreciationMethod; + } + + public void setDepreciationMethod(String depreciationMethod) { + this.depreciationMethod = depreciationMethod; + } + + public String getDepreciationMethodName() { + return depreciationMethodName; + } + + public void setDepreciationMethodName(String depreciationMethodName) { + this.depreciationMethodName = depreciationMethodName; + } + + public String getDepreciationPeriod() { + return depreciationPeriod; + } + + public void setDepreciationPeriod(String depreciationPeriod) { + this.depreciationPeriod = depreciationPeriod; + } + + public String getEnableDate() { + return enableDate; + } + + public void setEnableDate(String enableDate) { + this.enableDate = enableDate; + } + + public String getEquipmentCategory() { + return equipmentCategory; + } + + public void setEquipmentCategory(String equipmentCategory) { + this.equipmentCategory = equipmentCategory; + } + + public String getEquipmentCategoryName() { + return equipmentCategoryName; + } + + public void setEquipmentCategoryName(String equipmentCategoryName) { + this.equipmentCategoryName = equipmentCategoryName; + } + + public String getEquipmentName() { + return equipmentName; + } + + public void setEquipmentName(String equipmentName) { + this.equipmentName = equipmentName; + } + + public String getEquipmentNo() { + return equipmentNo; + } + + public void setEquipmentNo(String equipmentNo) { + this.equipmentNo = equipmentNo; + } + + public String getEquipmentSpecifications() { + return equipmentSpecifications; + } + + public void setEquipmentSpecifications(String equipmentSpecifications) { + this.equipmentSpecifications = equipmentSpecifications; + } + + public String getEquipmentType() { + return equipmentType; + } + + public void setEquipmentType(String equipmentType) { + this.equipmentType = equipmentType; + } + + public String getEquipmentTypeName() { + return equipmentTypeName; + } + + public void setEquipmentTypeName(String equipmentTypeName) { + this.equipmentTypeName = equipmentTypeName; + } + + public String getFileList() { + return fileList; + } + + public void setFileList(String fileList) { + this.fileList = fileList; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getInstallIncidentalExpenses() { + return installIncidentalExpenses; + } + + public void setInstallIncidentalExpenses(String installIncidentalExpenses) { + this.installIncidentalExpenses = installIncidentalExpenses; + } + + public String getInstallPlace() { + return installPlace; + } + + public void setInstallPlace(String installPlace) { + this.installPlace = installPlace; + } + + public String getIntactState() { + return intactState; + } + + public void setIntactState(String intactState) { + this.intactState = intactState; + } + + public String getIsCalibrationTestEquipment() { + return isCalibrationTestEquipment; + } + + public void setIsCalibrationTestEquipment(String isCalibrationTestEquipment) { + this.isCalibrationTestEquipment = isCalibrationTestEquipment; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getIsFixedAssets() { + return isFixedAssets; + } + + public void setIsFixedAssets(String isFixedAssets) { + this.isFixedAssets = isFixedAssets; + } + + public String getIsMeasureAccount() { + return isMeasureAccount; + } + + public void setIsMeasureAccount(String isMeasureAccount) { + this.isMeasureAccount = isMeasureAccount; + } + + public String getIsStandardSupportEquipment() { + return isStandardSupportEquipment; + } + + public void setIsStandardSupportEquipment(String isStandardSupportEquipment) { + this.isStandardSupportEquipment = isStandardSupportEquipment; + } + + public String getLabelBind() { + return labelBind; + } + + public void setLabelBind(String labelBind) { + this.labelBind = labelBind; + } + + public String getMajorCategory() { + return majorCategory; + } + + public void setMajorCategory(String majorCategory) { + this.majorCategory = majorCategory; + } + + public String getMajorCategoryName() { + return majorCategoryName; + } + + public void setMajorCategoryName(String majorCategoryName) { + this.majorCategoryName = majorCategoryName; + } + + public String getManagerLevel() { + return managerLevel; + } + + public void setManagerLevel(String managerLevel) { + this.managerLevel = managerLevel; + } + + public String getManagerLevelName() { + return managerLevelName; + } + + public void setManagerLevelName(String managerLevelName) { + this.managerLevelName = managerLevelName; + } + + public String getManagerState() { + return managerState; + } + + public void setManagerState(String managerState) { + this.managerState = managerState; + } + + public String getManagerStateName() { + return managerStateName; + } + + public void setManagerStateName(String managerStateName) { + this.managerStateName = managerStateName; + } + + public String getManufacturer() { + return manufacturer; + } + + public void setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + } + + public String getManufacturerCountry() { + return manufacturerCountry; + } + + public void setManufacturerCountry(String manufacturerCountry) { + this.manufacturerCountry = manufacturerCountry; + } + + public String getManufacturingDate() { + return manufacturingDate; + } + + public void setManufacturingDate(String manufacturingDate) { + this.manufacturingDate = manufacturingDate; + } + + public String getManufacturingNo() { + return manufacturingNo; + } + + public void setManufacturingNo(String manufacturingNo) { + this.manufacturingNo = manufacturingNo; + } + + public String getMesureCycle() { + return mesureCycle; + } + + public void setMesureCycle(String mesureCycle) { + this.mesureCycle = mesureCycle; + } + + public String getMesureDate() { + return mesureDate; + } + + public void setMesureDate(String mesureDate) { + this.mesureDate = mesureDate; + } + + public String getMesureDept() { + return mesureDept; + } + + public void setMesureDept(String mesureDept) { + this.mesureDept = mesureDept; + } + + public String getMesureRange() { + return mesureRange; + } + + public void setMesureRange(String mesureRange) { + this.mesureRange = mesureRange; + } + + public String getMesureResult() { + return mesureResult; + } + + public void setMesureResult(String mesureResult) { + this.mesureResult = mesureResult; + } + + public String getMesureResultName() { + return mesureResultName; + } + + public void setMesureResultName(String mesureResultName) { + this.mesureResultName = mesureResultName; + } + + public String getMesureType() { + return mesureType; + } + + public void setMesureType(String mesureType) { + this.mesureType = mesureType; + } + + public String getMesureTypeName() { + return mesureTypeName; + } + + public void setMesureTypeName(String mesureTypeName) { + this.mesureTypeName = mesureTypeName; + } + + public String getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getOriginValue() { + return originValue; + } + + public void setOriginValue(String originValue) { + this.originValue = originValue; + } + + public String getOverallDimension() { + return overallDimension; + } + + public void setOverallDimension(String overallDimension) { + this.overallDimension = overallDimension; + } + + public String getPresentOriginValue() { + return presentOriginValue; + } + + public void setPresentOriginValue(String presentOriginValue) { + this.presentOriginValue = presentOriginValue; + } + + public String getPurpose() { + return purpose; + } + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getSinglePrice() { + return singlePrice; + } + + public void setSinglePrice(String singlePrice) { + this.singlePrice = singlePrice; + } + + public String getSupportStandardEquipmentName() { + return supportStandardEquipmentName; + } + + public void setSupportStandardEquipmentName(String supportStandardEquipmentName) { + this.supportStandardEquipmentName = supportStandardEquipmentName; + } + + public String getSupportStandardEquipmentNo() { + return supportStandardEquipmentNo; + } + + public void setSupportStandardEquipmentNo(String supportStandardEquipmentNo) { + this.supportStandardEquipmentNo = supportStandardEquipmentNo; + } + + public String getTechnicalLevel() { + return technicalLevel; + } + + public void setTechnicalLevel(String technicalLevel) { + this.technicalLevel = technicalLevel; + } + + public String getUncertainty() { + return uncertainty; + } + + public void setUncertainty(String uncertainty) { + this.uncertainty = uncertainty; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getUseDept() { + return useDept; + } + + public void setUseDept(String useDept) { + this.useDept = useDept; + } + + public String getUseDeptName() { + return useDeptName; + } + + public void setUseDeptName(String useDeptName) { + this.useDeptName = useDeptName; + } + + public String getUsePerson() { + return usePerson; + } + + public void setUsePerson(String usePerson) { + this.usePerson = usePerson; + } + + public String getUsePersonName() { + return usePersonName; + } + + public void setUsePersonName(String usePersonName) { + this.usePersonName = usePersonName; + } + + public String getValidDate() { + return validDate; + } + + public void setValidDate(String validDate) { + this.validDate = validDate; + } + + public int getVersion() { + return version; + } + + public void setVersion(int version) { + this.version = version; + } + + public String getWeight() { + return weight; + } + + public void setWeight(String weight) { + this.weight = weight; + } + } + } +} diff --git a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt index a3f514f..46e5eef 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt @@ -35,4 +35,24 @@ @QueryMap limit: Map, @QueryMap offset: Map ): String + + /** + * 获取设备列表 + */ + @POST("/meter/assets/listPage") + suspend fun getEquipmentList( + @Header("token") token: String, + @Body requestBody: RequestBody, + @QueryMap limit: Map, + @QueryMap offset: Map + ): String + + /** + * 获取设备详情 + */ + @POST("/meter/assets/detail") + suspend fun getEquipmentDetail( + @Header("token") token: String, + @Body requestBody: RequestBody + ): String } \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt index 444a872..386a1d8 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt @@ -6,8 +6,10 @@ import com.pengxh.kt.lite.utils.SaveKeyValues import okhttp3.MediaType.Companion.toMediaType import okhttp3.RequestBody.Companion.toRequestBody +import org.json.JSONArray import org.json.JSONObject + object RetrofitServiceManager { private val api by lazy { @@ -73,4 +75,71 @@ offsetMap["offset"] = offset return api.getNoticeList(AuthenticationHelper.token!!, requestBody, limitMap, offsetMap) } + + /** + * 获取设备列表 + */ + suspend fun getEquipmentList( + equipmentNo: String, + equipmentName: String, + mesureType: String, + managerState: String, + useDept: String, + assetType: String, + equipmentCategory: String, + isCalibrationTestEquipment: String, + isMeasureAccount: String, + isStandardSupportEquipment: String, + isFixedAssets: String, + validStartDate: String, + validEndDate: String, + abc: String, + ids: Array, + offset: Int + ): String { + val paramObject = JSONObject() + paramObject.put("equipmentNo", equipmentNo) + paramObject.put("equipmentName", equipmentName) + paramObject.put("mesureType", mesureType) + paramObject.put("managerState", managerState) + paramObject.put("useDept", useDept) + paramObject.put("assetType", assetType) + paramObject.put("equipmentCategory", equipmentCategory) + paramObject.put("isCalibrationTestEquipment", isCalibrationTestEquipment) + paramObject.put("isMeasureAccount", isMeasureAccount) + paramObject.put("isStandardSupportEquipment", isStandardSupportEquipment) + paramObject.put("isFixedAssets", isFixedAssets) + paramObject.put("validStartDate", validStartDate) + paramObject.put("validEndDate", validEndDate) + paramObject.put("abc", abc) + + val jsonArray = JSONArray() + ids.forEach { + jsonArray.put(it) + } + paramObject.put("ids", jsonArray) + + val requestBody = paramObject.toString().toRequestBody( + "application/json;charset=UTF-8".toMediaType() + ) + + val limitMap = HashMap() + limitMap["limit"] = LocaleConstant.PAGE_LIMIT + + val offsetMap = HashMap() + offsetMap["offset"] = offset + return api.getEquipmentList(AuthenticationHelper.token!!, requestBody, limitMap, offsetMap) + } + + /** + * 获取设备详情 + */ + suspend fun getEquipmentDetail(id: String): String { + val paramObject = JSONObject() + paramObject.put("id", id) + val requestBody = paramObject.toString().toRequestBody( + "application/json;charset=UTF-8".toMediaType() + ) + return api.getEquipmentDetail(AuthenticationHelper.token!!, requestBody) + } } \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt deleted file mode 100644 index a5bb60b..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt +++ /dev/null @@ -1,104 +0,0 @@ -package com.casic.xz.meterage.view - -import android.annotation.SuppressLint -import android.graphics.Paint -import androidx.lifecycle.ViewModelProvider -import com.casic.xz.meterage.R -import com.casic.xz.meterage.extensions.combineImagePath -import com.casic.xz.meterage.extensions.formatTextFromHtml -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.vm.NoticeViewModel -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.extensions.convertColor -import com.pengxh.kt.lite.extensions.navigatePageTo -import com.pengxh.kt.lite.extensions.obtainScreenWidth -import com.pengxh.kt.lite.extensions.show -import com.pengxh.kt.lite.utils.Constant -import kotlinx.android.synthetic.main.activity_notice_detail.* -import kotlinx.android.synthetic.main.include_base_title.* -import java.util.* - -@SuppressLint("SetTextI18n") -class NoticeDetailActivity : KotlinBaseActivity() { - - private lateinit var noticeViewModel: NoticeViewModel - - override fun initData() { - leftBackView.setOnClickListener { finish() } - titleView.text = "通知公告" - - val args = intent.getStringArrayListExtra(Constant.INTENT_PARAM)!! - - noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] - noticeViewModel.getNoticeList(args[0], args[1], args[2], "", "", 1) - noticeViewModel.noticeResult.observe(this, { - if (it.code == 200) { - val dataRow = it.data?.rows!![0] - - noticeDateView.text = dataRow.noticeTime - noticePublisherView.text = "发布人 ${dataRow.noticePublisher}" - noticeCompanyView.text = "发布单位 ${dataRow.noticeCompany}" - - noticeNoView.text = dataRow.noticeNo - noticeTitleView.text = dataRow.noticeTitle - noticeSketchView.text = dataRow.noticeSketch - - dataRow.noticeContent.formatTextFromHtml( - this, noticeContentView, obtainScreenWidth() - ) - - if (dataRow.minioFileName.isNullOrBlank()) { - minioFileView.text = "暂无附件" - } else { - val minioFileName = dataRow.minioFileName - - minioFileView.text = minioFileName - val textPaint = minioFileView.paint - textPaint.flags = Paint.UNDERLINE_TEXT_FLAG - textPaint.isAntiAlias = true - minioFileView.setTextColor(R.color.themeColor.convertColor(this)) - - minioFileView.setOnClickListener { - //查看附件 - if (minioFileName.endsWith("pdf")) { - navigatePageTo(minioFileName) - } else if ( - minioFileName.endsWith("doc") || - minioFileName.endsWith("docx") - ) { - navigatePageTo(minioFileName) - } else if (minioFileName.endsWith("txt")) { - navigatePageTo(minioFileName) - } else if ( - minioFileName.endsWith("png") || - minioFileName.endsWith("jpeg") || - minioFileName.endsWith("jpg") - ) { - val urls = ArrayList() - urls.add(minioFileName.combineImagePath()) - navigatePageTo(0, urls) - } else { - "文件类型未知,无法打开附件".show(this) - } - } - } - } - }) - } - - override fun initEvent() { - - } - - override fun initLayoutView(): Int = R.layout.activity_notice_detail - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/NoticeListActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/NoticeListActivity.kt deleted file mode 100644 index 15f6a16..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/NoticeListActivity.kt +++ /dev/null @@ -1,180 +0,0 @@ -package com.casic.xz.meterage.view - -import android.os.Handler -import android.util.Log -import android.view.View -import androidx.lifecycle.ViewModelProvider -import com.casic.xz.meterage.R -import com.casic.xz.meterage.adapter.NoticeListAdapter -import com.casic.xz.meterage.extensions.addAll -import com.casic.xz.meterage.extensions.combineFilePath -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.extensions.showEmptyPage -import com.casic.xz.meterage.model.NoticeListModel -import com.casic.xz.meterage.vm.NoticeViewModel -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.extensions.navigatePageTo -import com.pengxh.kt.lite.extensions.show -import com.pengxh.kt.lite.utils.WeakReferenceHandler -import com.pengxh.kt.lite.widget.dialog.AlertControlDialog -import kotlinx.android.synthetic.main.activity_notice_list.* -import kotlinx.android.synthetic.main.include_empty_view.* - -class NoticeListActivity : KotlinBaseActivity() { - - private lateinit var weakReferenceHandler: WeakReferenceHandler - private lateinit var noticeViewModel: NoticeViewModel - private lateinit var noticeListAdapter: NoticeListAdapter - private var dataBeans: MutableList = ArrayList() - private var pageIndex = 1 - private var isRefresh = false - private var isLoadMore = false - - override fun initData() { - weakReferenceHandler = WeakReferenceHandler(callback) - noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] - noticeViewModel.noticeResult.observe(this, { - if (it.code == 200) { - val dataRows = it.data?.rows!! -// countBadeNumber(dataRows) - when { - isRefresh -> { - dataBeans.clear() - dataBeans = dataRows - noticeLayout.finishRefresh() - isRefresh = false - } - isLoadMore -> { - if (dataRows.size == 0) { - "到底了,别拉了".show(this) - } - dataBeans.addAll(dataRows) - noticeLayout.finishLoadMore() - isLoadMore = false - } - else -> { - dataBeans = dataRows - } - } - weakReferenceHandler.sendEmptyMessage(2023013101) - } - }) - } - - override fun initEvent() { - leftBackView.setOnClickListener { finish() } - rightOperateView.setOnClickListener { - AlertControlDialog.Builder() - .setContext(this) - .setTitle("提示") - .setMessage("确定将所有未读消息标为已读?") - .setNegativeButton("取消") - .setPositiveButton("确定") - .setOnDialogButtonClickListener(object : - AlertControlDialog.OnDialogButtonClickListener { - override fun onCancelClick() { - - } - - override fun onConfirmClick() { - //TODO 设置为已读 - } - }).build().show() - } - - if (hasNoticePermission()) { - openSystemNoticeLayout.visibility = View.GONE - openSystemNoticeLayout.visibility = View.GONE - } else { - openSystemNoticeLayout.setOnClickListener { - - } - - - closeLayoutView.setOnClickListener { - openSystemNoticeLayout.visibility = View.GONE - } - } - - noticeLayout.setOnRefreshListener { - isRefresh = true - //刷新之后页码重置 - pageIndex = 1 - getNoticeListByPage() - } - - noticeLayout.setOnLoadMoreListener { - isLoadMore = true - pageIndex++ - getNoticeListByPage() - } - } - - override fun onResume() { - super.onResume() - pageIndex = 1 - getNoticeListByPage() - } - - private fun getNoticeListByPage() { - noticeViewModel.getNoticeList("", "", "", "", "", pageIndex) - } - - private val callback = Handler.Callback { - when (it.what) { - 2023013101 -> { - if (isRefresh || isLoadMore) { - noticeListAdapter.notifyDataSetChanged() - } else { - if (dataBeans.size == 0) { - emptyView!!.showEmptyPage("没有任何消息") { - pageIndex = 1 - getNoticeListByPage() - } - } else { - emptyView!!.hide() - noticeListAdapter = NoticeListAdapter(this, dataBeans) - noticeRecyclerView.adapter = noticeListAdapter - noticeListAdapter.setOnItemClickListener(object : - NoticeListAdapter.OnItemClickListener { - override fun onItemClicked(position: Int) { - val rowsModel = dataBeans[position] - val allArgs = addAll( - rowsModel.noticeNo, - rowsModel.noticeTitle, - rowsModel.noticePublisher, - "", - "" - ) - Log.d( - "Casic", - "NoticeListActivity => onItemClicked: ${rowsModel.minioFileName.combineFilePath()}" - ) - navigatePageTo(allArgs) - } - }) - } - } - } - } - true - } - - //TODO 判断是否开启通知权限 - private fun hasNoticePermission(): Boolean { - - return false - } - - override fun initLayoutView(): Int = R.layout.activity_notice_list - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/PreviewDocumentActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/PreviewDocumentActivity.kt deleted file mode 100644 index e233ddc..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/PreviewDocumentActivity.kt +++ /dev/null @@ -1,24 +0,0 @@ -package com.casic.xz.meterage.view - -import com.casic.xz.meterage.R -import com.pengxh.kt.lite.base.KotlinBaseActivity - -class PreviewDocumentActivity : KotlinBaseActivity() { - override fun initData() { - - } - - override fun initEvent() { - - } - - override fun initLayoutView(): Int = R.layout.activity_preview_doc - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/PreviewPdfActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/PreviewPdfActivity.kt deleted file mode 100644 index 39f8ac2..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/PreviewPdfActivity.kt +++ /dev/null @@ -1,62 +0,0 @@ -package com.casic.xz.meterage.view - -import com.casic.xz.meterage.R -import com.casic.xz.meterage.extensions.combineFilePath -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.utils.LoadingDialogHub -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.callback.OnDownloadListener -import com.pengxh.kt.lite.extensions.createDownloadFileDir -import com.pengxh.kt.lite.extensions.downloadFile -import com.pengxh.kt.lite.utils.Constant -import kotlinx.android.synthetic.main.activity_preview_pdf.* -import kotlinx.android.synthetic.main.include_base_title.* -import java.io.File -import java.io.FileInputStream - - -class PreviewPdfActivity : KotlinBaseActivity() { - - override fun initData() { - val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! - titleView.text = minioFileName - - val url = minioFileName.combineFilePath() - url.downloadFile(createDownloadFileDir().toString(), - object : OnDownloadListener { - override fun onDownloadStart(totalBytes: Long) { - runOnUiThread { - LoadingDialogHub.show(this@PreviewPdfActivity, "附件加载中") - } - } - - override fun onProgressChanged(currentBytes: Long) { - - } - - override fun onDownloadEnd(file: File?) { - runOnUiThread { - LoadingDialogHub.dismiss() - } - val inputStream = FileInputStream(file) - pdfView.fromStream(inputStream).load() - } - }) - } - - override fun initEvent() { - leftBackView.setOnClickListener { finish() } - } - - override fun initLayoutView(): Int = R.layout.activity_preview_pdf - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/PreviewTextActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/PreviewTextActivity.kt deleted file mode 100644 index d634ca3..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/PreviewTextActivity.kt +++ /dev/null @@ -1,60 +0,0 @@ -package com.casic.xz.meterage.view - -import com.casic.xz.meterage.R -import com.casic.xz.meterage.extensions.combineFilePath -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.utils.LoadingDialogHub -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.callback.OnDownloadListener -import com.pengxh.kt.lite.extensions.createDownloadFileDir -import com.pengxh.kt.lite.extensions.downloadFile -import com.pengxh.kt.lite.extensions.read -import com.pengxh.kt.lite.utils.Constant -import kotlinx.android.synthetic.main.activity_preview_txt.* -import kotlinx.android.synthetic.main.include_base_title.* -import java.io.File - -class PreviewTextActivity : KotlinBaseActivity() { - - override fun initData() { - val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! - titleView.text = minioFileName - - val url = minioFileName.combineFilePath() - url.downloadFile(createDownloadFileDir().toString(), - object : OnDownloadListener { - override fun onDownloadStart(totalBytes: Long) { - runOnUiThread { - LoadingDialogHub.show(this@PreviewTextActivity, "附件加载中") - } - } - - override fun onProgressChanged(currentBytes: Long) { - - } - - override fun onDownloadEnd(file: File?) { - runOnUiThread { - LoadingDialogHub.dismiss() - textView.text = file?.read() - } - } - }) - } - - override fun initEvent() { - leftBackView.setOnClickListener { finish() } - } - - override fun initLayoutView(): Int = R.layout.activity_preview_txt - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentActivity.kt new file mode 100644 index 0000000..35ca098 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentActivity.kt @@ -0,0 +1,158 @@ +package com.casic.xz.meterage.view.home + +import android.os.Handler +import androidx.lifecycle.ViewModelProvider +import androidx.recyclerview.widget.DividerItemDecoration +import com.casic.xz.meterage.R +import com.casic.xz.meterage.adapter.EquipmentListAdapter +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.extensions.showEmptyPage +import com.casic.xz.meterage.model.EquipmentListModel +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.casic.xz.meterage.vm.EquipmentViewModel +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.extensions.navigatePageTo +import com.pengxh.kt.lite.extensions.show +import com.pengxh.kt.lite.utils.WeakReferenceHandler +import com.pengxh.kt.lite.vm.LoadState +import kotlinx.android.synthetic.main.activity_equipment.* +import kotlinx.android.synthetic.main.include_empty_view.* +import kotlinx.android.synthetic.main.include_search_title.* + +class EquipmentActivity : KotlinBaseActivity() { + + private lateinit var weakReferenceHandler: WeakReferenceHandler + private lateinit var equipmentViewModel: EquipmentViewModel + private lateinit var equipmentListAdapter: EquipmentListAdapter + private var dataBeans: MutableList = ArrayList() + private var pageIndex = 1 + private var isRefresh = false + private var isLoadMore = false + + override fun initData() { + weakReferenceHandler = WeakReferenceHandler(callback) + equipmentViewModel = ViewModelProvider(this)[EquipmentViewModel::class.java] + equipmentViewModel.equipmentResult.observe(this, { + if (it.code == 200) { + val dataRows = it.data?.rows!! + when { + isRefresh -> { + dataBeans.clear() + dataBeans = dataRows + equipmentLayout.finishRefresh() + isRefresh = false + } + isLoadMore -> { + if (dataRows.size == 0) { + "到底了,别拉了".show(this) + } + dataBeans.addAll(dataRows) + equipmentLayout.finishLoadMore() + isLoadMore = false + } + else -> { + dataBeans = dataRows + } + } + weakReferenceHandler.sendEmptyMessage(2023020801) + } + }) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + rightOperateView.setOnClickListener { + + } + + equipmentLayout.setOnRefreshListener { + isRefresh = true + //刷新之后页码重置 + pageIndex = 1 + getEquipmentListByPage() + } + + equipmentLayout.setOnLoadMoreListener { + isLoadMore = true + pageIndex++ + getEquipmentListByPage() + } + } + + override fun initLayoutView(): Int = R.layout.activity_equipment + + override fun observeRequestState() { + equipmentViewModel.loadState.observe(this, { + when (it) { + LoadState.Loading -> LoadingDialogHub.show(this, "数据加载中...") + else -> LoadingDialogHub.dismiss() + } + }) + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + titleView.text = "仪器设备" + } + + override fun onResume() { + super.onResume() + pageIndex = 1 + getEquipmentListByPage() + } + + private fun getEquipmentListByPage() { + equipmentViewModel.getEquipmentList( + "", + "", + "", + "", + "", + "1", + "", + "", + "", + "", + "", + "", + "", + "", + arrayOf(), + pageIndex + ) + } + + private val callback = Handler.Callback { + when (it.what) { + 2023020801 -> { + if (isRefresh || isLoadMore) { + equipmentListAdapter.notifyDataSetChanged() + } else { + if (dataBeans.size == 0) { + emptyView!!.showEmptyPage("无设备") { + pageIndex = 1 + getEquipmentListByPage() + } + } else { + emptyView!!.hide() + equipmentListAdapter = EquipmentListAdapter(this, dataBeans) + equipmentRecyclerView.addItemDecoration( + DividerItemDecoration(this, DividerItemDecoration.VERTICAL) + ) + equipmentRecyclerView.adapter = equipmentListAdapter + equipmentListAdapter.setOnItemClickListener(object : + EquipmentListAdapter.OnItemClickListener { + override fun onItemClicked(position: Int) { + val rowsModel = dataBeans[position] + navigatePageTo(rowsModel.id) + } + }) + } + } + } + } + true + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentDetailActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentDetailActivity.kt new file mode 100644 index 0000000..7dee13c --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentDetailActivity.kt @@ -0,0 +1,53 @@ +package com.casic.xz.meterage.view.home + +import androidx.fragment.app.Fragment +import com.casic.xz.meterage.R +import com.casic.xz.meterage.adapter.SubViewPagerAdapter +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.fragment.equipment.* +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.utils.Constant +import kotlinx.android.synthetic.main.activity_equipment.rootView +import kotlinx.android.synthetic.main.activity_equipment_detail.* +import kotlinx.android.synthetic.main.include_base_title.* + +class EquipmentDetailActivity : KotlinBaseActivity() { + + private var fragmentPages: ArrayList = ArrayList() + + override fun initData() { + val equipmentId = intent.getStringExtra(Constant.INTENT_PARAM)!! + + fragmentPages.add(BasicInformationFragment(equipmentId)) + fragmentPages.add(InspectionRecordFragment()) + fragmentPages.add(ChangeRecordFragment()) + fragmentPages.add(UsageRecordFragment()) + fragmentPages.add(CertificateFragment()) + + val equipmentPageTitles = arrayOf("基础信息", "周检记录", "状态变更记录", "使用记录", "检定证书") + + equipmentViewPager.adapter = SubViewPagerAdapter( + supportFragmentManager, fragmentPages, equipmentPageTitles + ) + equipmentViewPager.offscreenPageLimit = fragmentPages.size + //绑定 + topTabLayout.setupWithViewPager(equipmentViewPager) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + } + + override fun initLayoutView(): Int = R.layout.activity_equipment_detail + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + titleView.text = "仪器设备" + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeDetailActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeDetailActivity.kt new file mode 100644 index 0000000..6fe0022 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeDetailActivity.kt @@ -0,0 +1,105 @@ +package com.casic.xz.meterage.view.notice + +import android.annotation.SuppressLint +import android.graphics.Paint +import androidx.lifecycle.ViewModelProvider +import com.casic.xz.meterage.R +import com.casic.xz.meterage.extensions.combineImagePath +import com.casic.xz.meterage.extensions.formatTextFromHtml +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.view.BigImageActivity +import com.casic.xz.meterage.vm.NoticeViewModel +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.extensions.convertColor +import com.pengxh.kt.lite.extensions.navigatePageTo +import com.pengxh.kt.lite.extensions.obtainScreenWidth +import com.pengxh.kt.lite.extensions.show +import com.pengxh.kt.lite.utils.Constant +import kotlinx.android.synthetic.main.activity_notice_detail.* +import kotlinx.android.synthetic.main.include_base_title.* +import java.util.* + +@SuppressLint("SetTextI18n") +class NoticeDetailActivity : KotlinBaseActivity() { + + private lateinit var noticeViewModel: NoticeViewModel + + override fun initData() { + leftBackView.setOnClickListener { finish() } + titleView.text = "通知公告" + + val args = intent.getStringArrayListExtra(Constant.INTENT_PARAM)!! + + noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] + noticeViewModel.getNoticeList(args[0], args[1], args[2], "", "", 1) + noticeViewModel.noticeResult.observe(this, { + if (it.code == 200) { + val dataRow = it.data?.rows!![0] + + noticeDateView.text = dataRow.noticeTime + noticePublisherView.text = "发布人 ${dataRow.noticePublisher}" + noticeCompanyView.text = "发布单位 ${dataRow.noticeCompany}" + + noticeNoView.text = dataRow.noticeNo + noticeTitleView.text = dataRow.noticeTitle + noticeSketchView.text = dataRow.noticeSketch + + dataRow.noticeContent.formatTextFromHtml( + this, noticeContentView, obtainScreenWidth() + ) + + if (dataRow.minioFileName.isNullOrBlank()) { + minioFileView.text = "暂无附件" + } else { + val minioFileName = dataRow.minioFileName + + minioFileView.text = minioFileName + val textPaint = minioFileView.paint + textPaint.flags = Paint.UNDERLINE_TEXT_FLAG + textPaint.isAntiAlias = true + minioFileView.setTextColor(R.color.themeColor.convertColor(this)) + + minioFileView.setOnClickListener { + //查看附件 + if (minioFileName.endsWith("pdf")) { + navigatePageTo(minioFileName) + } else if ( + minioFileName.endsWith("doc") || + minioFileName.endsWith("docx") + ) { + navigatePageTo(minioFileName) + } else if (minioFileName.endsWith("txt")) { + navigatePageTo(minioFileName) + } else if ( + minioFileName.endsWith("png") || + minioFileName.endsWith("jpeg") || + minioFileName.endsWith("jpg") + ) { + val urls = ArrayList() + urls.add(minioFileName.combineImagePath()) + navigatePageTo(0, urls) + } else { + "文件类型未知,无法打开附件".show(this) + } + } + } + } + }) + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.activity_notice_detail + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeListActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeListActivity.kt new file mode 100644 index 0000000..31c0490 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeListActivity.kt @@ -0,0 +1,180 @@ +package com.casic.xz.meterage.view.notice + +import android.os.Handler +import android.util.Log +import android.view.View +import androidx.lifecycle.ViewModelProvider +import com.casic.xz.meterage.R +import com.casic.xz.meterage.adapter.NoticeListAdapter +import com.casic.xz.meterage.extensions.addAll +import com.casic.xz.meterage.extensions.combineFilePath +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.extensions.showEmptyPage +import com.casic.xz.meterage.model.NoticeListModel +import com.casic.xz.meterage.vm.NoticeViewModel +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.extensions.navigatePageTo +import com.pengxh.kt.lite.extensions.show +import com.pengxh.kt.lite.utils.WeakReferenceHandler +import com.pengxh.kt.lite.widget.dialog.AlertControlDialog +import kotlinx.android.synthetic.main.activity_notice_list.* +import kotlinx.android.synthetic.main.include_empty_view.* + +class NoticeListActivity : KotlinBaseActivity() { + + private lateinit var weakReferenceHandler: WeakReferenceHandler + private lateinit var noticeViewModel: NoticeViewModel + private lateinit var noticeListAdapter: NoticeListAdapter + private var dataBeans: MutableList = ArrayList() + private var pageIndex = 1 + private var isRefresh = false + private var isLoadMore = false + + override fun initData() { + weakReferenceHandler = WeakReferenceHandler(callback) + noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] + noticeViewModel.noticeResult.observe(this, { + if (it.code == 200) { + val dataRows = it.data?.rows!! +// countBadeNumber(dataRows) + when { + isRefresh -> { + dataBeans.clear() + dataBeans = dataRows + noticeLayout.finishRefresh() + isRefresh = false + } + isLoadMore -> { + if (dataRows.size == 0) { + "到底了,别拉了".show(this) + } + dataBeans.addAll(dataRows) + noticeLayout.finishLoadMore() + isLoadMore = false + } + else -> { + dataBeans = dataRows + } + } + weakReferenceHandler.sendEmptyMessage(2023013101) + } + }) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + rightOperateView.setOnClickListener { + AlertControlDialog.Builder() + .setContext(this) + .setTitle("提示") + .setMessage("确定将所有未读消息标为已读?") + .setNegativeButton("取消") + .setPositiveButton("确定") + .setOnDialogButtonClickListener(object : + AlertControlDialog.OnDialogButtonClickListener { + override fun onCancelClick() { + + } + + override fun onConfirmClick() { + //TODO 设置为已读 + } + }).build().show() + } + + if (hasNoticePermission()) { + openSystemNoticeLayout.visibility = View.GONE + openSystemNoticeLayout.visibility = View.GONE + } else { + openSystemNoticeLayout.setOnClickListener { + + } + + + closeLayoutView.setOnClickListener { + openSystemNoticeLayout.visibility = View.GONE + } + } + + noticeLayout.setOnRefreshListener { + isRefresh = true + //刷新之后页码重置 + pageIndex = 1 + getNoticeListByPage() + } + + noticeLayout.setOnLoadMoreListener { + isLoadMore = true + pageIndex++ + getNoticeListByPage() + } + } + + override fun onResume() { + super.onResume() + pageIndex = 1 + getNoticeListByPage() + } + + private fun getNoticeListByPage() { + noticeViewModel.getNoticeList("", "", "", "", "", pageIndex) + } + + private val callback = Handler.Callback { + when (it.what) { + 2023013101 -> { + if (isRefresh || isLoadMore) { + noticeListAdapter.notifyDataSetChanged() + } else { + if (dataBeans.size == 0) { + emptyView!!.showEmptyPage("没有任何消息") { + pageIndex = 1 + getNoticeListByPage() + } + } else { + emptyView!!.hide() + noticeListAdapter = NoticeListAdapter(this, dataBeans) + noticeRecyclerView.adapter = noticeListAdapter + noticeListAdapter.setOnItemClickListener(object : + NoticeListAdapter.OnItemClickListener { + override fun onItemClicked(position: Int) { + val rowsModel = dataBeans[position] + val allArgs = addAll( + rowsModel.noticeNo, + rowsModel.noticeTitle, + rowsModel.noticePublisher, + "", + "" + ) + Log.d( + "Casic", + "NoticeListActivity => onItemClicked: ${rowsModel.minioFileName.combineFilePath()}" + ) + navigatePageTo(allArgs) + } + }) + } + } + } + } + true + } + + //TODO 判断是否开启通知权限 + private fun hasNoticePermission(): Boolean { + + return false + } + + override fun initLayoutView(): Int = R.layout.activity_notice_list + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewDocumentActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewDocumentActivity.kt new file mode 100644 index 0000000..4b16ae8 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewDocumentActivity.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.view.notice + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseActivity + +class PreviewDocumentActivity : KotlinBaseActivity() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.activity_preview_doc + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewPdfActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewPdfActivity.kt new file mode 100644 index 0000000..fad73b6 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewPdfActivity.kt @@ -0,0 +1,62 @@ +package com.casic.xz.meterage.view.notice + +import com.casic.xz.meterage.R +import com.casic.xz.meterage.extensions.combineFilePath +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.callback.OnDownloadListener +import com.pengxh.kt.lite.extensions.createDownloadFileDir +import com.pengxh.kt.lite.extensions.downloadFile +import com.pengxh.kt.lite.utils.Constant +import kotlinx.android.synthetic.main.activity_preview_pdf.* +import kotlinx.android.synthetic.main.include_base_title.* +import java.io.File +import java.io.FileInputStream + + +class PreviewPdfActivity : KotlinBaseActivity() { + + override fun initData() { + val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! + titleView.text = minioFileName + + val url = minioFileName.combineFilePath() + url.downloadFile(createDownloadFileDir().toString(), + object : OnDownloadListener { + override fun onDownloadStart(totalBytes: Long) { + runOnUiThread { + LoadingDialogHub.show(this@PreviewPdfActivity, "附件加载中") + } + } + + override fun onProgressChanged(currentBytes: Long) { + + } + + override fun onDownloadEnd(file: File?) { + runOnUiThread { + LoadingDialogHub.dismiss() + } + val inputStream = FileInputStream(file) + pdfView.fromStream(inputStream).load() + } + }) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + } + + override fun initLayoutView(): Int = R.layout.activity_preview_pdf + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewTextActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewTextActivity.kt new file mode 100644 index 0000000..d7850fb --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewTextActivity.kt @@ -0,0 +1,60 @@ +package com.casic.xz.meterage.view.notice + +import com.casic.xz.meterage.R +import com.casic.xz.meterage.extensions.combineFilePath +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.callback.OnDownloadListener +import com.pengxh.kt.lite.extensions.createDownloadFileDir +import com.pengxh.kt.lite.extensions.downloadFile +import com.pengxh.kt.lite.extensions.read +import com.pengxh.kt.lite.utils.Constant +import kotlinx.android.synthetic.main.activity_preview_txt.* +import kotlinx.android.synthetic.main.include_base_title.* +import java.io.File + +class PreviewTextActivity : KotlinBaseActivity() { + + override fun initData() { + val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! + titleView.text = minioFileName + + val url = minioFileName.combineFilePath() + url.downloadFile(createDownloadFileDir().toString(), + object : OnDownloadListener { + override fun onDownloadStart(totalBytes: Long) { + runOnUiThread { + LoadingDialogHub.show(this@PreviewTextActivity, "附件加载中") + } + } + + override fun onProgressChanged(currentBytes: Long) { + + } + + override fun onDownloadEnd(file: File?) { + runOnUiThread { + LoadingDialogHub.dismiss() + textView.text = file?.read() + } + } + }) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + } + + override fun initLayoutView(): Int = R.layout.activity_preview_txt + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/vm/EquipmentViewModel.kt b/app/src/main/java/com/casic/xz/meterage/vm/EquipmentViewModel.kt new file mode 100644 index 0000000..b5f21f6 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/vm/EquipmentViewModel.kt @@ -0,0 +1,92 @@ +package com.casic.xz.meterage.vm + +import androidx.lifecycle.MutableLiveData +import com.casic.xz.meterage.base.BaseApplication +import com.casic.xz.meterage.extensions.separateResponseCode +import com.casic.xz.meterage.extensions.toErrorMessage +import com.casic.xz.meterage.model.EquipmentDetailModel +import com.casic.xz.meterage.model.EquipmentListModel +import com.casic.xz.meterage.utils.retrofit.RetrofitServiceManager +import com.google.gson.Gson +import com.google.gson.reflect.TypeToken +import com.pengxh.kt.lite.extensions.launch +import com.pengxh.kt.lite.extensions.show +import com.pengxh.kt.lite.vm.BaseViewModel +import com.pengxh.kt.lite.vm.LoadState + +class EquipmentViewModel : BaseViewModel() { + + private val gson by lazy { Gson() } + val equipmentResult = MutableLiveData() + val equipmentDetailResult = MutableLiveData() + + fun getEquipmentList( + equipmentNo: String, + equipmentName: String, + mesureType: String, + managerState: String, + useDept: String, + assetType: String, + equipmentCategory: String, + isCalibrationTestEquipment: String, + isMeasureAccount: String, + isStandardSupportEquipment: String, + isFixedAssets: String, + validStartDate: String, + validEndDate: String, + abc: String, + ids: Array, + offset: Int + ) = launch({ + loadState.value = LoadState.Loading + val response = RetrofitServiceManager.getEquipmentList( + equipmentNo, + equipmentName, + mesureType, + managerState, + useDept, + assetType, + equipmentCategory, + isCalibrationTestEquipment, + isMeasureAccount, + isStandardSupportEquipment, + isFixedAssets, + validStartDate, + validEndDate, + abc, + ids, + offset + ) + val responseCode = response.separateResponseCode() + if (responseCode == 200) { + loadState.value = LoadState.Success + equipmentResult.value = gson.fromJson( + response, object : TypeToken() {}.type + ) + } else { + loadState.value = LoadState.Fail + response.toErrorMessage().show(BaseApplication.get()) + } + }, { + loadState.value = LoadState.Fail + it.printStackTrace() + }) + + fun getEquipmentDetail(id: String) = launch({ + loadState.value = LoadState.Loading + val response = RetrofitServiceManager.getEquipmentDetail(id) + val responseCode = response.separateResponseCode() + if (responseCode == 200) { + loadState.value = LoadState.Success + equipmentDetailResult.value = gson.fromJson( + response, object : TypeToken() {}.type + ) + } else { + loadState.value = LoadState.Fail + response.toErrorMessage().show(BaseApplication.get()) + } + }, { + loadState.value = LoadState.Fail + it.printStackTrace() + }) +} \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_sorting.xml b/app/src/main/res/drawable/ic_sorting.xml new file mode 100644 index 0000000..252bfe6 --- /dev/null +++ b/app/src/main/res/drawable/ic_sorting.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/layout/activity_equipment.xml b/app/src/main/res/layout/activity_equipment.xml new file mode 100644 index 0000000..d6a64b1 --- /dev/null +++ b/app/src/main/res/layout/activity_equipment.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_equipment_detail.xml b/app/src/main/res/layout/activity_equipment_detail.xml new file mode 100644 index 0000000..7254762 --- /dev/null +++ b/app/src/main/res/layout/activity_equipment_detail.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_basic_information.xml b/app/src/main/res/layout/fragment_basic_information.xml new file mode 100644 index 0000000..4a3c1c7 --- /dev/null +++ b/app/src/main/res/layout/fragment_basic_information.xml @@ -0,0 +1,390 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_certificate.xml b/app/src/main/res/layout/fragment_certificate.xml new file mode 100644 index 0000000..77d9ef6 --- /dev/null +++ b/app/src/main/res/layout/fragment_certificate.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_change_record.xml b/app/src/main/res/layout/fragment_change_record.xml new file mode 100644 index 0000000..77d9ef6 --- /dev/null +++ b/app/src/main/res/layout/fragment_change_record.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_home.xml b/app/src/main/res/layout/fragment_home.xml index 41b32a9..e1ab759 100644 --- a/app/src/main/res/layout/fragment_home.xml +++ b/app/src/main/res/layout/fragment_home.xml @@ -71,7 +71,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" app:layoutManager="androidx.recyclerview.widget.GridLayoutManager" - app:spanCount="5" /> + app:spanCount="4" /> + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_mine.xml b/app/src/main/res/layout/fragment_mine.xml index 0643064..d9f57b3 100644 --- a/app/src/main/res/layout/fragment_mine.xml +++ b/app/src/main/res/layout/fragment_mine.xml @@ -22,10 +22,10 @@ android:orientation="horizontal"> + android:src="@mipmap/default_avatar" /> @@ -122,7 +122,7 @@ android:background="@drawable/ic_collection" /> @@ -145,7 +145,7 @@ android:background="@drawable/ic_push_setting" /> @@ -166,7 +166,7 @@ android:background="@drawable/ic_privacy" /> @@ -189,7 +189,7 @@ android:background="@drawable/ic_help" /> @@ -210,7 +210,7 @@ android:background="@drawable/ic_update" /> @@ -231,7 +231,7 @@ android:background="@drawable/ic_about" /> @@ -252,7 +252,7 @@ android:background="@drawable/ic_back" /> diff --git a/app/src/main/res/layout/fragment_usage_record.xml b/app/src/main/res/layout/fragment_usage_record.xml new file mode 100644 index 0000000..77d9ef6 --- /dev/null +++ b/app/src/main/res/layout/fragment_usage_record.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/include_equipment_layout.xml b/app/src/main/res/layout/include_equipment_layout.xml new file mode 100644 index 0000000..ce846d5 --- /dev/null +++ b/app/src/main/res/layout/include_equipment_layout.xml @@ -0,0 +1,74 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 3892b5a..02160cd 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -34,16 +34,18 @@ - - - - - - - + + + + + + + + + +) : RecyclerView.Adapter() { + + private var layoutInflater: LayoutInflater = LayoutInflater.from(context) + + override fun getItemCount(): Int = dataRows.size + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = ItemViewHolder( + layoutInflater.inflate(R.layout.item_equipment_rv_l, parent, false) + ) + + override fun onBindViewHolder(holder: ItemViewHolder, position: Int) { + //绑定数据 + val rowsBean = dataRows[position] + holder.equipmentNameView.text = rowsBean.equipmentName + holder.equipmentCodeView.text = rowsBean.equipmentNo + holder.equipmentDateView.text = rowsBean.enableDate + holder.equipmentLibView.text = rowsBean.useDeptName + + //绑定事件 + holder.itemView.setOnClickListener { + listener?.onItemClicked(position) + } + } + + inner class ItemViewHolder(view: View) : RecyclerView.ViewHolder(view) { + var equipmentNameView: TextView = view.findViewById(R.id.equipmentNameView) + var equipmentCodeView: TextView = view.findViewById(R.id.equipmentCodeView) + var equipmentDateView: TextView = view.findViewById(R.id.equipmentDateView) + var equipmentLibView: TextView = view.findViewById(R.id.equipmentLibView) + } + + private var listener: OnItemClickListener? = null + + interface OnItemClickListener { + fun onItemClicked(position: Int) + } + + fun setOnItemClickListener(onClickListener: OnItemClickListener?) { + this.listener = onClickListener + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt index b4628f3..d970b55 100644 --- a/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt +++ b/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt @@ -5,7 +5,8 @@ import com.casic.xz.meterage.R import com.casic.xz.meterage.adapter.HomeGridAdapter import com.casic.xz.meterage.utils.LocaleConstant -import com.casic.xz.meterage.view.NoticeListActivity +import com.casic.xz.meterage.view.home.EquipmentActivity +import com.casic.xz.meterage.view.notice.NoticeListActivity import com.casic.xz.meterage.vm.NoticeViewModel import com.pengxh.kt.lite.base.KotlinBaseFragment import com.pengxh.kt.lite.extensions.navigatePageTo @@ -36,8 +37,19 @@ homeFuncRecyclerView.adapter = homeAdapter homeAdapter.setOnGridItemClickListener(object : HomeGridAdapter.OnGridItemClickListener { override fun onItemClick(position: Int) { - when (position) { - + when (LocaleConstant.HOME_FUNC_OPERATE[position]) { + "仪器设备" -> requireContext().navigatePageTo() +// "标准装置" -> requireContext().navigatePageTo() +// "证书报告" -> requireContext().navigatePageTo() +// "委托需求" -> requireContext().navigatePageTo() +// "访客" -> requireContext().navigatePageTo() +// "标准规范" -> requireContext().navigatePageTo() +// "能力列表" -> requireContext().navigatePageTo() +// "计量培训" -> requireContext().navigatePageTo() +// "合同发票" -> requireContext().navigatePageTo() +// "业务统计" -> requireContext().navigatePageTo() +// "客户列表" -> requireContext().navigatePageTo() +// "外场检测" -> requireContext().navigatePageTo() } } }) diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt index 7e75abe..56dc5ec 100644 --- a/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt +++ b/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt @@ -2,9 +2,11 @@ import android.view.View import androidx.lifecycle.ViewModelProvider +import com.bumptech.glide.Glide +import com.bumptech.glide.request.RequestOptions import com.casic.xz.meterage.R import com.casic.xz.meterage.utils.LocaleConstant -import com.casic.xz.meterage.view.NoticeListActivity +import com.casic.xz.meterage.view.notice.NoticeListActivity import com.casic.xz.meterage.vm.NoticeViewModel import com.casic.xz.meterage.vm.UserViewModel import com.pengxh.kt.lite.base.KotlinBaseFragment @@ -23,6 +25,12 @@ val data = it.data userNameView.text = data.name userUnitView.text = data.deptName + +// Glide.with(requireContext()) +// .load(R.mipmap.default_avatar) +// .apply(RequestOptions.circleCropTransform()) +// .placeholder(R.mipmap.load_image_error) +// .into(userAvatarView) } }) diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt new file mode 100644 index 0000000..cf22646 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt @@ -0,0 +1,103 @@ +package com.casic.xz.meterage.fragment.equipment + +import android.graphics.Paint +import androidx.lifecycle.ViewModelProvider +import com.casic.xz.meterage.R +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.casic.xz.meterage.vm.EquipmentViewModel +import com.pengxh.kt.lite.base.KotlinBaseFragment +import com.pengxh.kt.lite.extensions.convertColor +import com.pengxh.kt.lite.vm.LoadState +import kotlinx.android.synthetic.main.fragment_basic_information.* + +class BasicInformationFragment(private val id: String) : KotlinBaseFragment() { + + private lateinit var equipmentViewModel: EquipmentViewModel + + override fun initData() { + equipmentViewModel = ViewModelProvider(this)[EquipmentViewModel::class.java] + equipmentViewModel.getEquipmentDetail(id) + equipmentViewModel.equipmentDetailResult.observe(this, { + if (it.code == 200) { + val data = it.data!! + + equipmentCodeView.text = data.equipmentNo + equipmentNameView.text = data.equipmentName + manufacturerView.text = data.manufacturer + factoryNumberView.text = data.manufacturingNo + modelView.text = data.modelNo + verificationMethodView.text = data.mesureTypeName + measuringRangeView.text = data.mesureRange + uncertaintyView.text = data.uncertainty + firstUseView.text = data.createTime + originalValueView.text = data.originValue + usageDeptView.text = data.useDeptName + userView.text = data.usePersonName + managementStatusView.text = data.managerStateName + verificationDeptView.text = data.useDeptName +// nextVerificationDeptView.text = data. + verificationPeriodView.text = data.mesureCycle + verificationDateView.text = data.mesureDate + effectiveDateView.text = data.validDate + verificationResultsView.text = data.mesureResultName + abcView.text = data.abcName + isNeedTechnicalView.text = if ( + data.isCalibrationTestEquipment.isNullOrBlank() || data.isCalibrationTestEquipment == "0" + ) { + "否" + } else { + "是" + } + + isStandingBook.text = if ( + data.isMeasureAccount.isNullOrBlank() || data.isMeasureAccount == "0" + ) { + "否" + } else { + "是" + } + + isStandardView.text = if ( + data.isStandardSupportEquipment.isNullOrBlank() || data.isStandardSupportEquipment == "0" + ) { + "否" + } else { + "是" + } + remarkView.text = data.remark + if (data.fileList.size == 0) { + instructionsView.text = "暂无" + } else { + instructionsView.text = "查看附件列表" + val textPaint = instructionsView.paint + textPaint.flags = Paint.UNDERLINE_TEXT_FLAG + textPaint.isAntiAlias = true + instructionsView.setTextColor(R.color.themeColor.convertColor(requireContext())) + + instructionsView.setOnClickListener { + + } + } + } + }) + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_basic_information + + override fun observeRequestState() { + equipmentViewModel.loadState.observe(this, { + when (it) { + LoadState.Loading -> LoadingDialogHub.show(requireActivity(), "数据加载中...") + else -> LoadingDialogHub.dismiss() + } + }) + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt new file mode 100644 index 0000000..0b4a747 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class CertificateFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_certificate + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt new file mode 100644 index 0000000..f05c491 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class ChangeRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_change_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt new file mode 100644 index 0000000..849ffa5 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class InspectionRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_inspection_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt new file mode 100644 index 0000000..aa4edd9 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class UsageRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_usage_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java b/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java new file mode 100644 index 0000000..0b9124e --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java @@ -0,0 +1,760 @@ +package com.casic.xz.meterage.model; + +import java.util.List; + +public class EquipmentDetailModel { + + private int code; + private DataModel data; + private String message; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataModel getData() { + return data; + } + + public void setData(DataModel data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public static class DataModel { + private String abc; + private String abcName; + private String assetNo; + private String assetSource; + private String assetType; + private String assetTypeName; + private String attribute; + private String capitalSource; + private String capitalSourceName; + private String cardEstablishmentDate; + private String createTime; + private String createUser; + private String depreciationMethod; + private String depreciationMethodName; + private String depreciationPeriod; + private String enableDate; + private String equipmentCategory; + private String equipmentCategoryName; + private String equipmentName; + private String equipmentNo; + private String equipmentSpecifications; + private String equipmentType; + private String equipmentTypeName; + private List fileList; + private String id; + private String installIncidentalExpenses; + private String installPlace; + private String intactState; + private String isCalibrationTestEquipment; + private int isDel; + private String isFixedAssets; + private String isMeasureAccount; + private String isStandardSupportEquipment; + private String labelBind; + private String majorCategory; + private String majorCategoryName; + private String managerLevel; + private String managerLevelName; + private String managerState; + private String managerStateName; + private String manufacturer; + private String manufacturerCountry; + private String manufacturingDate; + private String manufacturingNo; + private String mesureCycle; + private String mesureDate; + private String mesureDept; + private String mesureRange; + private String mesureResult; + private String mesureResultName; + private String mesureType; + private String mesureTypeName; + private String modelNo; + private String originValue; + private String overallDimension; + private String presentOriginValue; + private String purpose; + private String remark; + private String singlePrice; + private String supportStandardEquipmentName; + private String supportStandardEquipmentNo; + private String technicalLevel; + private String uncertainty; + private String updateTime; + private String useDept; + private String useDeptName; + private String usePerson; + private String usePersonName; + private String validDate; + private int version; + private String weight; + + public String getAbc() { + return abc; + } + + public void setAbc(String abc) { + this.abc = abc; + } + + public String getAbcName() { + return abcName; + } + + public void setAbcName(String abcName) { + this.abcName = abcName; + } + + public String getAssetNo() { + return assetNo; + } + + public void setAssetNo(String assetNo) { + this.assetNo = assetNo; + } + + public String getAssetSource() { + return assetSource; + } + + public void setAssetSource(String assetSource) { + this.assetSource = assetSource; + } + + public String getAssetType() { + return assetType; + } + + public void setAssetType(String assetType) { + this.assetType = assetType; + } + + public String getAssetTypeName() { + return assetTypeName; + } + + public void setAssetTypeName(String assetTypeName) { + this.assetTypeName = assetTypeName; + } + + public String getAttribute() { + return attribute; + } + + public void setAttribute(String attribute) { + this.attribute = attribute; + } + + public String getCapitalSource() { + return capitalSource; + } + + public void setCapitalSource(String capitalSource) { + this.capitalSource = capitalSource; + } + + public String getCapitalSourceName() { + return capitalSourceName; + } + + public void setCapitalSourceName(String capitalSourceName) { + this.capitalSourceName = capitalSourceName; + } + + public String getCardEstablishmentDate() { + return cardEstablishmentDate; + } + + public void setCardEstablishmentDate(String cardEstablishmentDate) { + this.cardEstablishmentDate = cardEstablishmentDate; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getDepreciationMethod() { + return depreciationMethod; + } + + public void setDepreciationMethod(String depreciationMethod) { + this.depreciationMethod = depreciationMethod; + } + + public String getDepreciationMethodName() { + return depreciationMethodName; + } + + public void setDepreciationMethodName(String depreciationMethodName) { + this.depreciationMethodName = depreciationMethodName; + } + + public String getDepreciationPeriod() { + return depreciationPeriod; + } + + public void setDepreciationPeriod(String depreciationPeriod) { + this.depreciationPeriod = depreciationPeriod; + } + + public String getEnableDate() { + return enableDate; + } + + public void setEnableDate(String enableDate) { + this.enableDate = enableDate; + } + + public String getEquipmentCategory() { + return equipmentCategory; + } + + public void setEquipmentCategory(String equipmentCategory) { + this.equipmentCategory = equipmentCategory; + } + + public String getEquipmentCategoryName() { + return equipmentCategoryName; + } + + public void setEquipmentCategoryName(String equipmentCategoryName) { + this.equipmentCategoryName = equipmentCategoryName; + } + + public String getEquipmentName() { + return equipmentName; + } + + public void setEquipmentName(String equipmentName) { + this.equipmentName = equipmentName; + } + + public String getEquipmentNo() { + return equipmentNo; + } + + public void setEquipmentNo(String equipmentNo) { + this.equipmentNo = equipmentNo; + } + + public String getEquipmentSpecifications() { + return equipmentSpecifications; + } + + public void setEquipmentSpecifications(String equipmentSpecifications) { + this.equipmentSpecifications = equipmentSpecifications; + } + + public String getEquipmentType() { + return equipmentType; + } + + public void setEquipmentType(String equipmentType) { + this.equipmentType = equipmentType; + } + + public String getEquipmentTypeName() { + return equipmentTypeName; + } + + public void setEquipmentTypeName(String equipmentTypeName) { + this.equipmentTypeName = equipmentTypeName; + } + + public List getFileList() { + return fileList; + } + + public void setFileList(List fileList) { + this.fileList = fileList; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getInstallIncidentalExpenses() { + return installIncidentalExpenses; + } + + public void setInstallIncidentalExpenses(String installIncidentalExpenses) { + this.installIncidentalExpenses = installIncidentalExpenses; + } + + public String getInstallPlace() { + return installPlace; + } + + public void setInstallPlace(String installPlace) { + this.installPlace = installPlace; + } + + public String getIntactState() { + return intactState; + } + + public void setIntactState(String intactState) { + this.intactState = intactState; + } + + public String getIsCalibrationTestEquipment() { + return isCalibrationTestEquipment; + } + + public void setIsCalibrationTestEquipment(String isCalibrationTestEquipment) { + this.isCalibrationTestEquipment = isCalibrationTestEquipment; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getIsFixedAssets() { + return isFixedAssets; + } + + public void setIsFixedAssets(String isFixedAssets) { + this.isFixedAssets = isFixedAssets; + } + + public String getIsMeasureAccount() { + return isMeasureAccount; + } + + public void setIsMeasureAccount(String isMeasureAccount) { + this.isMeasureAccount = isMeasureAccount; + } + + public String getIsStandardSupportEquipment() { + return isStandardSupportEquipment; + } + + public void setIsStandardSupportEquipment(String isStandardSupportEquipment) { + this.isStandardSupportEquipment = isStandardSupportEquipment; + } + + public String getLabelBind() { + return labelBind; + } + + public void setLabelBind(String labelBind) { + this.labelBind = labelBind; + } + + public String getMajorCategory() { + return majorCategory; + } + + public void setMajorCategory(String majorCategory) { + this.majorCategory = majorCategory; + } + + public String getMajorCategoryName() { + return majorCategoryName; + } + + public void setMajorCategoryName(String majorCategoryName) { + this.majorCategoryName = majorCategoryName; + } + + public String getManagerLevel() { + return managerLevel; + } + + public void setManagerLevel(String managerLevel) { + this.managerLevel = managerLevel; + } + + public String getManagerLevelName() { + return managerLevelName; + } + + public void setManagerLevelName(String managerLevelName) { + this.managerLevelName = managerLevelName; + } + + public String getManagerState() { + return managerState; + } + + public void setManagerState(String managerState) { + this.managerState = managerState; + } + + public String getManagerStateName() { + return managerStateName; + } + + public void setManagerStateName(String managerStateName) { + this.managerStateName = managerStateName; + } + + public String getManufacturer() { + return manufacturer; + } + + public void setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + } + + public String getManufacturerCountry() { + return manufacturerCountry; + } + + public void setManufacturerCountry(String manufacturerCountry) { + this.manufacturerCountry = manufacturerCountry; + } + + public String getManufacturingDate() { + return manufacturingDate; + } + + public void setManufacturingDate(String manufacturingDate) { + this.manufacturingDate = manufacturingDate; + } + + public String getManufacturingNo() { + return manufacturingNo; + } + + public void setManufacturingNo(String manufacturingNo) { + this.manufacturingNo = manufacturingNo; + } + + public String getMesureCycle() { + return mesureCycle; + } + + public void setMesureCycle(String mesureCycle) { + this.mesureCycle = mesureCycle; + } + + public String getMesureDate() { + return mesureDate; + } + + public void setMesureDate(String mesureDate) { + this.mesureDate = mesureDate; + } + + public String getMesureDept() { + return mesureDept; + } + + public void setMesureDept(String mesureDept) { + this.mesureDept = mesureDept; + } + + public String getMesureRange() { + return mesureRange; + } + + public void setMesureRange(String mesureRange) { + this.mesureRange = mesureRange; + } + + public String getMesureResult() { + return mesureResult; + } + + public void setMesureResult(String mesureResult) { + this.mesureResult = mesureResult; + } + + public String getMesureResultName() { + return mesureResultName; + } + + public void setMesureResultName(String mesureResultName) { + this.mesureResultName = mesureResultName; + } + + public String getMesureType() { + return mesureType; + } + + public void setMesureType(String mesureType) { + this.mesureType = mesureType; + } + + public String getMesureTypeName() { + return mesureTypeName; + } + + public void setMesureTypeName(String mesureTypeName) { + this.mesureTypeName = mesureTypeName; + } + + public String getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getOriginValue() { + return originValue; + } + + public void setOriginValue(String originValue) { + this.originValue = originValue; + } + + public String getOverallDimension() { + return overallDimension; + } + + public void setOverallDimension(String overallDimension) { + this.overallDimension = overallDimension; + } + + public String getPresentOriginValue() { + return presentOriginValue; + } + + public void setPresentOriginValue(String presentOriginValue) { + this.presentOriginValue = presentOriginValue; + } + + public String getPurpose() { + return purpose; + } + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getSinglePrice() { + return singlePrice; + } + + public void setSinglePrice(String singlePrice) { + this.singlePrice = singlePrice; + } + + public String getSupportStandardEquipmentName() { + return supportStandardEquipmentName; + } + + public void setSupportStandardEquipmentName(String supportStandardEquipmentName) { + this.supportStandardEquipmentName = supportStandardEquipmentName; + } + + public String getSupportStandardEquipmentNo() { + return supportStandardEquipmentNo; + } + + public void setSupportStandardEquipmentNo(String supportStandardEquipmentNo) { + this.supportStandardEquipmentNo = supportStandardEquipmentNo; + } + + public String getTechnicalLevel() { + return technicalLevel; + } + + public void setTechnicalLevel(String technicalLevel) { + this.technicalLevel = technicalLevel; + } + + public String getUncertainty() { + return uncertainty; + } + + public void setUncertainty(String uncertainty) { + this.uncertainty = uncertainty; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getUseDept() { + return useDept; + } + + public void setUseDept(String useDept) { + this.useDept = useDept; + } + + public String getUseDeptName() { + return useDeptName; + } + + public void setUseDeptName(String useDeptName) { + this.useDeptName = useDeptName; + } + + public String getUsePerson() { + return usePerson; + } + + public void setUsePerson(String usePerson) { + this.usePerson = usePerson; + } + + public String getUsePersonName() { + return usePersonName; + } + + public void setUsePersonName(String usePersonName) { + this.usePersonName = usePersonName; + } + + public String getValidDate() { + return validDate; + } + + public void setValidDate(String validDate) { + this.validDate = validDate; + } + + public int getVersion() { + return version; + } + + public void setVersion(int version) { + this.version = version; + } + + public String getWeight() { + return weight; + } + + public void setWeight(String weight) { + this.weight = weight; + } + + public static class FileListModel { + private String assetId; + private String createTime; + private String createUser; + private String fileName; + private String id; + private int isDel; + private String minioFileName; + private String remark; + private String updateTime; + + public String getAssetId() { + return assetId; + } + + public void setAssetId(String assetId) { + this.assetId = assetId; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getFileName() { + return fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getMinioFileName() { + return minioFileName; + } + + public void setMinioFileName(String minioFileName) { + this.minioFileName = minioFileName; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + } + } +} diff --git a/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java b/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java new file mode 100644 index 0000000..15fc128 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java @@ -0,0 +1,697 @@ +package com.casic.xz.meterage.model; + +import java.util.List; + +public class EquipmentListModel { + + private int code; + private DataModel data; + private String message; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataModel getData() { + return data; + } + + public void setData(DataModel data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public static class DataModel { + private List rows; + private int total; + + public List getRows() { + return rows; + } + + public void setRows(List rows) { + this.rows = rows; + } + + public int getTotal() { + return total; + } + + public void setTotal(int total) { + this.total = total; + } + + public static class RowsModel { + private String abc; + private String abcName; + private String assetNo; + private String assetSource; + private String assetType; + private String assetTypeName; + private String attribute; + private String capitalSource; + private String capitalSourceName; + private String cardEstablishmentDate; + private String createTime; + private String createUser; + private String depreciationMethod; + private String depreciationMethodName; + private String depreciationPeriod; + private String enableDate; + private String equipmentCategory; + private String equipmentCategoryName; + private String equipmentName; + private String equipmentNo; + private String equipmentSpecifications; + private String equipmentType; + private String equipmentTypeName; + private String fileList; + private String id; + private String installIncidentalExpenses; + private String installPlace; + private String intactState; + private String isCalibrationTestEquipment; + private int isDel; + private String isFixedAssets; + private String isMeasureAccount; + private String isStandardSupportEquipment; + private String labelBind; + private String majorCategory; + private String majorCategoryName; + private String managerLevel; + private String managerLevelName; + private String managerState; + private String managerStateName; + private String manufacturer; + private String manufacturerCountry; + private String manufacturingDate; + private String manufacturingNo; + private String mesureCycle; + private String mesureDate; + private String mesureDept; + private String mesureRange; + private String mesureResult; + private String mesureResultName; + private String mesureType; + private String mesureTypeName; + private String modelNo; + private String originValue; + private String overallDimension; + private String presentOriginValue; + private String purpose; + private String remark; + private String singlePrice; + private String supportStandardEquipmentName; + private String supportStandardEquipmentNo; + private String technicalLevel; + private String uncertainty; + private String updateTime; + private String useDept; + private String useDeptName; + private String usePerson; + private String usePersonName; + private String validDate; + private int version; + private String weight; + + public String getAbc() { + return abc; + } + + public void setAbc(String abc) { + this.abc = abc; + } + + public String getAbcName() { + return abcName; + } + + public void setAbcName(String abcName) { + this.abcName = abcName; + } + + public String getAssetNo() { + return assetNo; + } + + public void setAssetNo(String assetNo) { + this.assetNo = assetNo; + } + + public String getAssetSource() { + return assetSource; + } + + public void setAssetSource(String assetSource) { + this.assetSource = assetSource; + } + + public String getAssetType() { + return assetType; + } + + public void setAssetType(String assetType) { + this.assetType = assetType; + } + + public String getAssetTypeName() { + return assetTypeName; + } + + public void setAssetTypeName(String assetTypeName) { + this.assetTypeName = assetTypeName; + } + + public String getAttribute() { + return attribute; + } + + public void setAttribute(String attribute) { + this.attribute = attribute; + } + + public String getCapitalSource() { + return capitalSource; + } + + public void setCapitalSource(String capitalSource) { + this.capitalSource = capitalSource; + } + + public String getCapitalSourceName() { + return capitalSourceName; + } + + public void setCapitalSourceName(String capitalSourceName) { + this.capitalSourceName = capitalSourceName; + } + + public String getCardEstablishmentDate() { + return cardEstablishmentDate; + } + + public void setCardEstablishmentDate(String cardEstablishmentDate) { + this.cardEstablishmentDate = cardEstablishmentDate; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getDepreciationMethod() { + return depreciationMethod; + } + + public void setDepreciationMethod(String depreciationMethod) { + this.depreciationMethod = depreciationMethod; + } + + public String getDepreciationMethodName() { + return depreciationMethodName; + } + + public void setDepreciationMethodName(String depreciationMethodName) { + this.depreciationMethodName = depreciationMethodName; + } + + public String getDepreciationPeriod() { + return depreciationPeriod; + } + + public void setDepreciationPeriod(String depreciationPeriod) { + this.depreciationPeriod = depreciationPeriod; + } + + public String getEnableDate() { + return enableDate; + } + + public void setEnableDate(String enableDate) { + this.enableDate = enableDate; + } + + public String getEquipmentCategory() { + return equipmentCategory; + } + + public void setEquipmentCategory(String equipmentCategory) { + this.equipmentCategory = equipmentCategory; + } + + public String getEquipmentCategoryName() { + return equipmentCategoryName; + } + + public void setEquipmentCategoryName(String equipmentCategoryName) { + this.equipmentCategoryName = equipmentCategoryName; + } + + public String getEquipmentName() { + return equipmentName; + } + + public void setEquipmentName(String equipmentName) { + this.equipmentName = equipmentName; + } + + public String getEquipmentNo() { + return equipmentNo; + } + + public void setEquipmentNo(String equipmentNo) { + this.equipmentNo = equipmentNo; + } + + public String getEquipmentSpecifications() { + return equipmentSpecifications; + } + + public void setEquipmentSpecifications(String equipmentSpecifications) { + this.equipmentSpecifications = equipmentSpecifications; + } + + public String getEquipmentType() { + return equipmentType; + } + + public void setEquipmentType(String equipmentType) { + this.equipmentType = equipmentType; + } + + public String getEquipmentTypeName() { + return equipmentTypeName; + } + + public void setEquipmentTypeName(String equipmentTypeName) { + this.equipmentTypeName = equipmentTypeName; + } + + public String getFileList() { + return fileList; + } + + public void setFileList(String fileList) { + this.fileList = fileList; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getInstallIncidentalExpenses() { + return installIncidentalExpenses; + } + + public void setInstallIncidentalExpenses(String installIncidentalExpenses) { + this.installIncidentalExpenses = installIncidentalExpenses; + } + + public String getInstallPlace() { + return installPlace; + } + + public void setInstallPlace(String installPlace) { + this.installPlace = installPlace; + } + + public String getIntactState() { + return intactState; + } + + public void setIntactState(String intactState) { + this.intactState = intactState; + } + + public String getIsCalibrationTestEquipment() { + return isCalibrationTestEquipment; + } + + public void setIsCalibrationTestEquipment(String isCalibrationTestEquipment) { + this.isCalibrationTestEquipment = isCalibrationTestEquipment; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getIsFixedAssets() { + return isFixedAssets; + } + + public void setIsFixedAssets(String isFixedAssets) { + this.isFixedAssets = isFixedAssets; + } + + public String getIsMeasureAccount() { + return isMeasureAccount; + } + + public void setIsMeasureAccount(String isMeasureAccount) { + this.isMeasureAccount = isMeasureAccount; + } + + public String getIsStandardSupportEquipment() { + return isStandardSupportEquipment; + } + + public void setIsStandardSupportEquipment(String isStandardSupportEquipment) { + this.isStandardSupportEquipment = isStandardSupportEquipment; + } + + public String getLabelBind() { + return labelBind; + } + + public void setLabelBind(String labelBind) { + this.labelBind = labelBind; + } + + public String getMajorCategory() { + return majorCategory; + } + + public void setMajorCategory(String majorCategory) { + this.majorCategory = majorCategory; + } + + public String getMajorCategoryName() { + return majorCategoryName; + } + + public void setMajorCategoryName(String majorCategoryName) { + this.majorCategoryName = majorCategoryName; + } + + public String getManagerLevel() { + return managerLevel; + } + + public void setManagerLevel(String managerLevel) { + this.managerLevel = managerLevel; + } + + public String getManagerLevelName() { + return managerLevelName; + } + + public void setManagerLevelName(String managerLevelName) { + this.managerLevelName = managerLevelName; + } + + public String getManagerState() { + return managerState; + } + + public void setManagerState(String managerState) { + this.managerState = managerState; + } + + public String getManagerStateName() { + return managerStateName; + } + + public void setManagerStateName(String managerStateName) { + this.managerStateName = managerStateName; + } + + public String getManufacturer() { + return manufacturer; + } + + public void setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + } + + public String getManufacturerCountry() { + return manufacturerCountry; + } + + public void setManufacturerCountry(String manufacturerCountry) { + this.manufacturerCountry = manufacturerCountry; + } + + public String getManufacturingDate() { + return manufacturingDate; + } + + public void setManufacturingDate(String manufacturingDate) { + this.manufacturingDate = manufacturingDate; + } + + public String getManufacturingNo() { + return manufacturingNo; + } + + public void setManufacturingNo(String manufacturingNo) { + this.manufacturingNo = manufacturingNo; + } + + public String getMesureCycle() { + return mesureCycle; + } + + public void setMesureCycle(String mesureCycle) { + this.mesureCycle = mesureCycle; + } + + public String getMesureDate() { + return mesureDate; + } + + public void setMesureDate(String mesureDate) { + this.mesureDate = mesureDate; + } + + public String getMesureDept() { + return mesureDept; + } + + public void setMesureDept(String mesureDept) { + this.mesureDept = mesureDept; + } + + public String getMesureRange() { + return mesureRange; + } + + public void setMesureRange(String mesureRange) { + this.mesureRange = mesureRange; + } + + public String getMesureResult() { + return mesureResult; + } + + public void setMesureResult(String mesureResult) { + this.mesureResult = mesureResult; + } + + public String getMesureResultName() { + return mesureResultName; + } + + public void setMesureResultName(String mesureResultName) { + this.mesureResultName = mesureResultName; + } + + public String getMesureType() { + return mesureType; + } + + public void setMesureType(String mesureType) { + this.mesureType = mesureType; + } + + public String getMesureTypeName() { + return mesureTypeName; + } + + public void setMesureTypeName(String mesureTypeName) { + this.mesureTypeName = mesureTypeName; + } + + public String getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getOriginValue() { + return originValue; + } + + public void setOriginValue(String originValue) { + this.originValue = originValue; + } + + public String getOverallDimension() { + return overallDimension; + } + + public void setOverallDimension(String overallDimension) { + this.overallDimension = overallDimension; + } + + public String getPresentOriginValue() { + return presentOriginValue; + } + + public void setPresentOriginValue(String presentOriginValue) { + this.presentOriginValue = presentOriginValue; + } + + public String getPurpose() { + return purpose; + } + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getSinglePrice() { + return singlePrice; + } + + public void setSinglePrice(String singlePrice) { + this.singlePrice = singlePrice; + } + + public String getSupportStandardEquipmentName() { + return supportStandardEquipmentName; + } + + public void setSupportStandardEquipmentName(String supportStandardEquipmentName) { + this.supportStandardEquipmentName = supportStandardEquipmentName; + } + + public String getSupportStandardEquipmentNo() { + return supportStandardEquipmentNo; + } + + public void setSupportStandardEquipmentNo(String supportStandardEquipmentNo) { + this.supportStandardEquipmentNo = supportStandardEquipmentNo; + } + + public String getTechnicalLevel() { + return technicalLevel; + } + + public void setTechnicalLevel(String technicalLevel) { + this.technicalLevel = technicalLevel; + } + + public String getUncertainty() { + return uncertainty; + } + + public void setUncertainty(String uncertainty) { + this.uncertainty = uncertainty; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getUseDept() { + return useDept; + } + + public void setUseDept(String useDept) { + this.useDept = useDept; + } + + public String getUseDeptName() { + return useDeptName; + } + + public void setUseDeptName(String useDeptName) { + this.useDeptName = useDeptName; + } + + public String getUsePerson() { + return usePerson; + } + + public void setUsePerson(String usePerson) { + this.usePerson = usePerson; + } + + public String getUsePersonName() { + return usePersonName; + } + + public void setUsePersonName(String usePersonName) { + this.usePersonName = usePersonName; + } + + public String getValidDate() { + return validDate; + } + + public void setValidDate(String validDate) { + this.validDate = validDate; + } + + public int getVersion() { + return version; + } + + public void setVersion(int version) { + this.version = version; + } + + public String getWeight() { + return weight; + } + + public void setWeight(String weight) { + this.weight = weight; + } + } + } +} diff --git a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt index a3f514f..46e5eef 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt @@ -35,4 +35,24 @@ @QueryMap limit: Map, @QueryMap offset: Map ): String + + /** + * 获取设备列表 + */ + @POST("/meter/assets/listPage") + suspend fun getEquipmentList( + @Header("token") token: String, + @Body requestBody: RequestBody, + @QueryMap limit: Map, + @QueryMap offset: Map + ): String + + /** + * 获取设备详情 + */ + @POST("/meter/assets/detail") + suspend fun getEquipmentDetail( + @Header("token") token: String, + @Body requestBody: RequestBody + ): String } \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt index 444a872..386a1d8 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt @@ -6,8 +6,10 @@ import com.pengxh.kt.lite.utils.SaveKeyValues import okhttp3.MediaType.Companion.toMediaType import okhttp3.RequestBody.Companion.toRequestBody +import org.json.JSONArray import org.json.JSONObject + object RetrofitServiceManager { private val api by lazy { @@ -73,4 +75,71 @@ offsetMap["offset"] = offset return api.getNoticeList(AuthenticationHelper.token!!, requestBody, limitMap, offsetMap) } + + /** + * 获取设备列表 + */ + suspend fun getEquipmentList( + equipmentNo: String, + equipmentName: String, + mesureType: String, + managerState: String, + useDept: String, + assetType: String, + equipmentCategory: String, + isCalibrationTestEquipment: String, + isMeasureAccount: String, + isStandardSupportEquipment: String, + isFixedAssets: String, + validStartDate: String, + validEndDate: String, + abc: String, + ids: Array, + offset: Int + ): String { + val paramObject = JSONObject() + paramObject.put("equipmentNo", equipmentNo) + paramObject.put("equipmentName", equipmentName) + paramObject.put("mesureType", mesureType) + paramObject.put("managerState", managerState) + paramObject.put("useDept", useDept) + paramObject.put("assetType", assetType) + paramObject.put("equipmentCategory", equipmentCategory) + paramObject.put("isCalibrationTestEquipment", isCalibrationTestEquipment) + paramObject.put("isMeasureAccount", isMeasureAccount) + paramObject.put("isStandardSupportEquipment", isStandardSupportEquipment) + paramObject.put("isFixedAssets", isFixedAssets) + paramObject.put("validStartDate", validStartDate) + paramObject.put("validEndDate", validEndDate) + paramObject.put("abc", abc) + + val jsonArray = JSONArray() + ids.forEach { + jsonArray.put(it) + } + paramObject.put("ids", jsonArray) + + val requestBody = paramObject.toString().toRequestBody( + "application/json;charset=UTF-8".toMediaType() + ) + + val limitMap = HashMap() + limitMap["limit"] = LocaleConstant.PAGE_LIMIT + + val offsetMap = HashMap() + offsetMap["offset"] = offset + return api.getEquipmentList(AuthenticationHelper.token!!, requestBody, limitMap, offsetMap) + } + + /** + * 获取设备详情 + */ + suspend fun getEquipmentDetail(id: String): String { + val paramObject = JSONObject() + paramObject.put("id", id) + val requestBody = paramObject.toString().toRequestBody( + "application/json;charset=UTF-8".toMediaType() + ) + return api.getEquipmentDetail(AuthenticationHelper.token!!, requestBody) + } } \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt deleted file mode 100644 index a5bb60b..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt +++ /dev/null @@ -1,104 +0,0 @@ -package com.casic.xz.meterage.view - -import android.annotation.SuppressLint -import android.graphics.Paint -import androidx.lifecycle.ViewModelProvider -import com.casic.xz.meterage.R -import com.casic.xz.meterage.extensions.combineImagePath -import com.casic.xz.meterage.extensions.formatTextFromHtml -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.vm.NoticeViewModel -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.extensions.convertColor -import com.pengxh.kt.lite.extensions.navigatePageTo -import com.pengxh.kt.lite.extensions.obtainScreenWidth -import com.pengxh.kt.lite.extensions.show -import com.pengxh.kt.lite.utils.Constant -import kotlinx.android.synthetic.main.activity_notice_detail.* -import kotlinx.android.synthetic.main.include_base_title.* -import java.util.* - -@SuppressLint("SetTextI18n") -class NoticeDetailActivity : KotlinBaseActivity() { - - private lateinit var noticeViewModel: NoticeViewModel - - override fun initData() { - leftBackView.setOnClickListener { finish() } - titleView.text = "通知公告" - - val args = intent.getStringArrayListExtra(Constant.INTENT_PARAM)!! - - noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] - noticeViewModel.getNoticeList(args[0], args[1], args[2], "", "", 1) - noticeViewModel.noticeResult.observe(this, { - if (it.code == 200) { - val dataRow = it.data?.rows!![0] - - noticeDateView.text = dataRow.noticeTime - noticePublisherView.text = "发布人 ${dataRow.noticePublisher}" - noticeCompanyView.text = "发布单位 ${dataRow.noticeCompany}" - - noticeNoView.text = dataRow.noticeNo - noticeTitleView.text = dataRow.noticeTitle - noticeSketchView.text = dataRow.noticeSketch - - dataRow.noticeContent.formatTextFromHtml( - this, noticeContentView, obtainScreenWidth() - ) - - if (dataRow.minioFileName.isNullOrBlank()) { - minioFileView.text = "暂无附件" - } else { - val minioFileName = dataRow.minioFileName - - minioFileView.text = minioFileName - val textPaint = minioFileView.paint - textPaint.flags = Paint.UNDERLINE_TEXT_FLAG - textPaint.isAntiAlias = true - minioFileView.setTextColor(R.color.themeColor.convertColor(this)) - - minioFileView.setOnClickListener { - //查看附件 - if (minioFileName.endsWith("pdf")) { - navigatePageTo(minioFileName) - } else if ( - minioFileName.endsWith("doc") || - minioFileName.endsWith("docx") - ) { - navigatePageTo(minioFileName) - } else if (minioFileName.endsWith("txt")) { - navigatePageTo(minioFileName) - } else if ( - minioFileName.endsWith("png") || - minioFileName.endsWith("jpeg") || - minioFileName.endsWith("jpg") - ) { - val urls = ArrayList() - urls.add(minioFileName.combineImagePath()) - navigatePageTo(0, urls) - } else { - "文件类型未知,无法打开附件".show(this) - } - } - } - } - }) - } - - override fun initEvent() { - - } - - override fun initLayoutView(): Int = R.layout.activity_notice_detail - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/NoticeListActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/NoticeListActivity.kt deleted file mode 100644 index 15f6a16..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/NoticeListActivity.kt +++ /dev/null @@ -1,180 +0,0 @@ -package com.casic.xz.meterage.view - -import android.os.Handler -import android.util.Log -import android.view.View -import androidx.lifecycle.ViewModelProvider -import com.casic.xz.meterage.R -import com.casic.xz.meterage.adapter.NoticeListAdapter -import com.casic.xz.meterage.extensions.addAll -import com.casic.xz.meterage.extensions.combineFilePath -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.extensions.showEmptyPage -import com.casic.xz.meterage.model.NoticeListModel -import com.casic.xz.meterage.vm.NoticeViewModel -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.extensions.navigatePageTo -import com.pengxh.kt.lite.extensions.show -import com.pengxh.kt.lite.utils.WeakReferenceHandler -import com.pengxh.kt.lite.widget.dialog.AlertControlDialog -import kotlinx.android.synthetic.main.activity_notice_list.* -import kotlinx.android.synthetic.main.include_empty_view.* - -class NoticeListActivity : KotlinBaseActivity() { - - private lateinit var weakReferenceHandler: WeakReferenceHandler - private lateinit var noticeViewModel: NoticeViewModel - private lateinit var noticeListAdapter: NoticeListAdapter - private var dataBeans: MutableList = ArrayList() - private var pageIndex = 1 - private var isRefresh = false - private var isLoadMore = false - - override fun initData() { - weakReferenceHandler = WeakReferenceHandler(callback) - noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] - noticeViewModel.noticeResult.observe(this, { - if (it.code == 200) { - val dataRows = it.data?.rows!! -// countBadeNumber(dataRows) - when { - isRefresh -> { - dataBeans.clear() - dataBeans = dataRows - noticeLayout.finishRefresh() - isRefresh = false - } - isLoadMore -> { - if (dataRows.size == 0) { - "到底了,别拉了".show(this) - } - dataBeans.addAll(dataRows) - noticeLayout.finishLoadMore() - isLoadMore = false - } - else -> { - dataBeans = dataRows - } - } - weakReferenceHandler.sendEmptyMessage(2023013101) - } - }) - } - - override fun initEvent() { - leftBackView.setOnClickListener { finish() } - rightOperateView.setOnClickListener { - AlertControlDialog.Builder() - .setContext(this) - .setTitle("提示") - .setMessage("确定将所有未读消息标为已读?") - .setNegativeButton("取消") - .setPositiveButton("确定") - .setOnDialogButtonClickListener(object : - AlertControlDialog.OnDialogButtonClickListener { - override fun onCancelClick() { - - } - - override fun onConfirmClick() { - //TODO 设置为已读 - } - }).build().show() - } - - if (hasNoticePermission()) { - openSystemNoticeLayout.visibility = View.GONE - openSystemNoticeLayout.visibility = View.GONE - } else { - openSystemNoticeLayout.setOnClickListener { - - } - - - closeLayoutView.setOnClickListener { - openSystemNoticeLayout.visibility = View.GONE - } - } - - noticeLayout.setOnRefreshListener { - isRefresh = true - //刷新之后页码重置 - pageIndex = 1 - getNoticeListByPage() - } - - noticeLayout.setOnLoadMoreListener { - isLoadMore = true - pageIndex++ - getNoticeListByPage() - } - } - - override fun onResume() { - super.onResume() - pageIndex = 1 - getNoticeListByPage() - } - - private fun getNoticeListByPage() { - noticeViewModel.getNoticeList("", "", "", "", "", pageIndex) - } - - private val callback = Handler.Callback { - when (it.what) { - 2023013101 -> { - if (isRefresh || isLoadMore) { - noticeListAdapter.notifyDataSetChanged() - } else { - if (dataBeans.size == 0) { - emptyView!!.showEmptyPage("没有任何消息") { - pageIndex = 1 - getNoticeListByPage() - } - } else { - emptyView!!.hide() - noticeListAdapter = NoticeListAdapter(this, dataBeans) - noticeRecyclerView.adapter = noticeListAdapter - noticeListAdapter.setOnItemClickListener(object : - NoticeListAdapter.OnItemClickListener { - override fun onItemClicked(position: Int) { - val rowsModel = dataBeans[position] - val allArgs = addAll( - rowsModel.noticeNo, - rowsModel.noticeTitle, - rowsModel.noticePublisher, - "", - "" - ) - Log.d( - "Casic", - "NoticeListActivity => onItemClicked: ${rowsModel.minioFileName.combineFilePath()}" - ) - navigatePageTo(allArgs) - } - }) - } - } - } - } - true - } - - //TODO 判断是否开启通知权限 - private fun hasNoticePermission(): Boolean { - - return false - } - - override fun initLayoutView(): Int = R.layout.activity_notice_list - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/PreviewDocumentActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/PreviewDocumentActivity.kt deleted file mode 100644 index e233ddc..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/PreviewDocumentActivity.kt +++ /dev/null @@ -1,24 +0,0 @@ -package com.casic.xz.meterage.view - -import com.casic.xz.meterage.R -import com.pengxh.kt.lite.base.KotlinBaseActivity - -class PreviewDocumentActivity : KotlinBaseActivity() { - override fun initData() { - - } - - override fun initEvent() { - - } - - override fun initLayoutView(): Int = R.layout.activity_preview_doc - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/PreviewPdfActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/PreviewPdfActivity.kt deleted file mode 100644 index 39f8ac2..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/PreviewPdfActivity.kt +++ /dev/null @@ -1,62 +0,0 @@ -package com.casic.xz.meterage.view - -import com.casic.xz.meterage.R -import com.casic.xz.meterage.extensions.combineFilePath -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.utils.LoadingDialogHub -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.callback.OnDownloadListener -import com.pengxh.kt.lite.extensions.createDownloadFileDir -import com.pengxh.kt.lite.extensions.downloadFile -import com.pengxh.kt.lite.utils.Constant -import kotlinx.android.synthetic.main.activity_preview_pdf.* -import kotlinx.android.synthetic.main.include_base_title.* -import java.io.File -import java.io.FileInputStream - - -class PreviewPdfActivity : KotlinBaseActivity() { - - override fun initData() { - val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! - titleView.text = minioFileName - - val url = minioFileName.combineFilePath() - url.downloadFile(createDownloadFileDir().toString(), - object : OnDownloadListener { - override fun onDownloadStart(totalBytes: Long) { - runOnUiThread { - LoadingDialogHub.show(this@PreviewPdfActivity, "附件加载中") - } - } - - override fun onProgressChanged(currentBytes: Long) { - - } - - override fun onDownloadEnd(file: File?) { - runOnUiThread { - LoadingDialogHub.dismiss() - } - val inputStream = FileInputStream(file) - pdfView.fromStream(inputStream).load() - } - }) - } - - override fun initEvent() { - leftBackView.setOnClickListener { finish() } - } - - override fun initLayoutView(): Int = R.layout.activity_preview_pdf - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/PreviewTextActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/PreviewTextActivity.kt deleted file mode 100644 index d634ca3..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/PreviewTextActivity.kt +++ /dev/null @@ -1,60 +0,0 @@ -package com.casic.xz.meterage.view - -import com.casic.xz.meterage.R -import com.casic.xz.meterage.extensions.combineFilePath -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.utils.LoadingDialogHub -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.callback.OnDownloadListener -import com.pengxh.kt.lite.extensions.createDownloadFileDir -import com.pengxh.kt.lite.extensions.downloadFile -import com.pengxh.kt.lite.extensions.read -import com.pengxh.kt.lite.utils.Constant -import kotlinx.android.synthetic.main.activity_preview_txt.* -import kotlinx.android.synthetic.main.include_base_title.* -import java.io.File - -class PreviewTextActivity : KotlinBaseActivity() { - - override fun initData() { - val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! - titleView.text = minioFileName - - val url = minioFileName.combineFilePath() - url.downloadFile(createDownloadFileDir().toString(), - object : OnDownloadListener { - override fun onDownloadStart(totalBytes: Long) { - runOnUiThread { - LoadingDialogHub.show(this@PreviewTextActivity, "附件加载中") - } - } - - override fun onProgressChanged(currentBytes: Long) { - - } - - override fun onDownloadEnd(file: File?) { - runOnUiThread { - LoadingDialogHub.dismiss() - textView.text = file?.read() - } - } - }) - } - - override fun initEvent() { - leftBackView.setOnClickListener { finish() } - } - - override fun initLayoutView(): Int = R.layout.activity_preview_txt - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentActivity.kt new file mode 100644 index 0000000..35ca098 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentActivity.kt @@ -0,0 +1,158 @@ +package com.casic.xz.meterage.view.home + +import android.os.Handler +import androidx.lifecycle.ViewModelProvider +import androidx.recyclerview.widget.DividerItemDecoration +import com.casic.xz.meterage.R +import com.casic.xz.meterage.adapter.EquipmentListAdapter +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.extensions.showEmptyPage +import com.casic.xz.meterage.model.EquipmentListModel +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.casic.xz.meterage.vm.EquipmentViewModel +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.extensions.navigatePageTo +import com.pengxh.kt.lite.extensions.show +import com.pengxh.kt.lite.utils.WeakReferenceHandler +import com.pengxh.kt.lite.vm.LoadState +import kotlinx.android.synthetic.main.activity_equipment.* +import kotlinx.android.synthetic.main.include_empty_view.* +import kotlinx.android.synthetic.main.include_search_title.* + +class EquipmentActivity : KotlinBaseActivity() { + + private lateinit var weakReferenceHandler: WeakReferenceHandler + private lateinit var equipmentViewModel: EquipmentViewModel + private lateinit var equipmentListAdapter: EquipmentListAdapter + private var dataBeans: MutableList = ArrayList() + private var pageIndex = 1 + private var isRefresh = false + private var isLoadMore = false + + override fun initData() { + weakReferenceHandler = WeakReferenceHandler(callback) + equipmentViewModel = ViewModelProvider(this)[EquipmentViewModel::class.java] + equipmentViewModel.equipmentResult.observe(this, { + if (it.code == 200) { + val dataRows = it.data?.rows!! + when { + isRefresh -> { + dataBeans.clear() + dataBeans = dataRows + equipmentLayout.finishRefresh() + isRefresh = false + } + isLoadMore -> { + if (dataRows.size == 0) { + "到底了,别拉了".show(this) + } + dataBeans.addAll(dataRows) + equipmentLayout.finishLoadMore() + isLoadMore = false + } + else -> { + dataBeans = dataRows + } + } + weakReferenceHandler.sendEmptyMessage(2023020801) + } + }) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + rightOperateView.setOnClickListener { + + } + + equipmentLayout.setOnRefreshListener { + isRefresh = true + //刷新之后页码重置 + pageIndex = 1 + getEquipmentListByPage() + } + + equipmentLayout.setOnLoadMoreListener { + isLoadMore = true + pageIndex++ + getEquipmentListByPage() + } + } + + override fun initLayoutView(): Int = R.layout.activity_equipment + + override fun observeRequestState() { + equipmentViewModel.loadState.observe(this, { + when (it) { + LoadState.Loading -> LoadingDialogHub.show(this, "数据加载中...") + else -> LoadingDialogHub.dismiss() + } + }) + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + titleView.text = "仪器设备" + } + + override fun onResume() { + super.onResume() + pageIndex = 1 + getEquipmentListByPage() + } + + private fun getEquipmentListByPage() { + equipmentViewModel.getEquipmentList( + "", + "", + "", + "", + "", + "1", + "", + "", + "", + "", + "", + "", + "", + "", + arrayOf(), + pageIndex + ) + } + + private val callback = Handler.Callback { + when (it.what) { + 2023020801 -> { + if (isRefresh || isLoadMore) { + equipmentListAdapter.notifyDataSetChanged() + } else { + if (dataBeans.size == 0) { + emptyView!!.showEmptyPage("无设备") { + pageIndex = 1 + getEquipmentListByPage() + } + } else { + emptyView!!.hide() + equipmentListAdapter = EquipmentListAdapter(this, dataBeans) + equipmentRecyclerView.addItemDecoration( + DividerItemDecoration(this, DividerItemDecoration.VERTICAL) + ) + equipmentRecyclerView.adapter = equipmentListAdapter + equipmentListAdapter.setOnItemClickListener(object : + EquipmentListAdapter.OnItemClickListener { + override fun onItemClicked(position: Int) { + val rowsModel = dataBeans[position] + navigatePageTo(rowsModel.id) + } + }) + } + } + } + } + true + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentDetailActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentDetailActivity.kt new file mode 100644 index 0000000..7dee13c --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentDetailActivity.kt @@ -0,0 +1,53 @@ +package com.casic.xz.meterage.view.home + +import androidx.fragment.app.Fragment +import com.casic.xz.meterage.R +import com.casic.xz.meterage.adapter.SubViewPagerAdapter +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.fragment.equipment.* +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.utils.Constant +import kotlinx.android.synthetic.main.activity_equipment.rootView +import kotlinx.android.synthetic.main.activity_equipment_detail.* +import kotlinx.android.synthetic.main.include_base_title.* + +class EquipmentDetailActivity : KotlinBaseActivity() { + + private var fragmentPages: ArrayList = ArrayList() + + override fun initData() { + val equipmentId = intent.getStringExtra(Constant.INTENT_PARAM)!! + + fragmentPages.add(BasicInformationFragment(equipmentId)) + fragmentPages.add(InspectionRecordFragment()) + fragmentPages.add(ChangeRecordFragment()) + fragmentPages.add(UsageRecordFragment()) + fragmentPages.add(CertificateFragment()) + + val equipmentPageTitles = arrayOf("基础信息", "周检记录", "状态变更记录", "使用记录", "检定证书") + + equipmentViewPager.adapter = SubViewPagerAdapter( + supportFragmentManager, fragmentPages, equipmentPageTitles + ) + equipmentViewPager.offscreenPageLimit = fragmentPages.size + //绑定 + topTabLayout.setupWithViewPager(equipmentViewPager) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + } + + override fun initLayoutView(): Int = R.layout.activity_equipment_detail + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + titleView.text = "仪器设备" + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeDetailActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeDetailActivity.kt new file mode 100644 index 0000000..6fe0022 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeDetailActivity.kt @@ -0,0 +1,105 @@ +package com.casic.xz.meterage.view.notice + +import android.annotation.SuppressLint +import android.graphics.Paint +import androidx.lifecycle.ViewModelProvider +import com.casic.xz.meterage.R +import com.casic.xz.meterage.extensions.combineImagePath +import com.casic.xz.meterage.extensions.formatTextFromHtml +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.view.BigImageActivity +import com.casic.xz.meterage.vm.NoticeViewModel +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.extensions.convertColor +import com.pengxh.kt.lite.extensions.navigatePageTo +import com.pengxh.kt.lite.extensions.obtainScreenWidth +import com.pengxh.kt.lite.extensions.show +import com.pengxh.kt.lite.utils.Constant +import kotlinx.android.synthetic.main.activity_notice_detail.* +import kotlinx.android.synthetic.main.include_base_title.* +import java.util.* + +@SuppressLint("SetTextI18n") +class NoticeDetailActivity : KotlinBaseActivity() { + + private lateinit var noticeViewModel: NoticeViewModel + + override fun initData() { + leftBackView.setOnClickListener { finish() } + titleView.text = "通知公告" + + val args = intent.getStringArrayListExtra(Constant.INTENT_PARAM)!! + + noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] + noticeViewModel.getNoticeList(args[0], args[1], args[2], "", "", 1) + noticeViewModel.noticeResult.observe(this, { + if (it.code == 200) { + val dataRow = it.data?.rows!![0] + + noticeDateView.text = dataRow.noticeTime + noticePublisherView.text = "发布人 ${dataRow.noticePublisher}" + noticeCompanyView.text = "发布单位 ${dataRow.noticeCompany}" + + noticeNoView.text = dataRow.noticeNo + noticeTitleView.text = dataRow.noticeTitle + noticeSketchView.text = dataRow.noticeSketch + + dataRow.noticeContent.formatTextFromHtml( + this, noticeContentView, obtainScreenWidth() + ) + + if (dataRow.minioFileName.isNullOrBlank()) { + minioFileView.text = "暂无附件" + } else { + val minioFileName = dataRow.minioFileName + + minioFileView.text = minioFileName + val textPaint = minioFileView.paint + textPaint.flags = Paint.UNDERLINE_TEXT_FLAG + textPaint.isAntiAlias = true + minioFileView.setTextColor(R.color.themeColor.convertColor(this)) + + minioFileView.setOnClickListener { + //查看附件 + if (minioFileName.endsWith("pdf")) { + navigatePageTo(minioFileName) + } else if ( + minioFileName.endsWith("doc") || + minioFileName.endsWith("docx") + ) { + navigatePageTo(minioFileName) + } else if (minioFileName.endsWith("txt")) { + navigatePageTo(minioFileName) + } else if ( + minioFileName.endsWith("png") || + minioFileName.endsWith("jpeg") || + minioFileName.endsWith("jpg") + ) { + val urls = ArrayList() + urls.add(minioFileName.combineImagePath()) + navigatePageTo(0, urls) + } else { + "文件类型未知,无法打开附件".show(this) + } + } + } + } + }) + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.activity_notice_detail + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeListActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeListActivity.kt new file mode 100644 index 0000000..31c0490 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeListActivity.kt @@ -0,0 +1,180 @@ +package com.casic.xz.meterage.view.notice + +import android.os.Handler +import android.util.Log +import android.view.View +import androidx.lifecycle.ViewModelProvider +import com.casic.xz.meterage.R +import com.casic.xz.meterage.adapter.NoticeListAdapter +import com.casic.xz.meterage.extensions.addAll +import com.casic.xz.meterage.extensions.combineFilePath +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.extensions.showEmptyPage +import com.casic.xz.meterage.model.NoticeListModel +import com.casic.xz.meterage.vm.NoticeViewModel +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.extensions.navigatePageTo +import com.pengxh.kt.lite.extensions.show +import com.pengxh.kt.lite.utils.WeakReferenceHandler +import com.pengxh.kt.lite.widget.dialog.AlertControlDialog +import kotlinx.android.synthetic.main.activity_notice_list.* +import kotlinx.android.synthetic.main.include_empty_view.* + +class NoticeListActivity : KotlinBaseActivity() { + + private lateinit var weakReferenceHandler: WeakReferenceHandler + private lateinit var noticeViewModel: NoticeViewModel + private lateinit var noticeListAdapter: NoticeListAdapter + private var dataBeans: MutableList = ArrayList() + private var pageIndex = 1 + private var isRefresh = false + private var isLoadMore = false + + override fun initData() { + weakReferenceHandler = WeakReferenceHandler(callback) + noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] + noticeViewModel.noticeResult.observe(this, { + if (it.code == 200) { + val dataRows = it.data?.rows!! +// countBadeNumber(dataRows) + when { + isRefresh -> { + dataBeans.clear() + dataBeans = dataRows + noticeLayout.finishRefresh() + isRefresh = false + } + isLoadMore -> { + if (dataRows.size == 0) { + "到底了,别拉了".show(this) + } + dataBeans.addAll(dataRows) + noticeLayout.finishLoadMore() + isLoadMore = false + } + else -> { + dataBeans = dataRows + } + } + weakReferenceHandler.sendEmptyMessage(2023013101) + } + }) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + rightOperateView.setOnClickListener { + AlertControlDialog.Builder() + .setContext(this) + .setTitle("提示") + .setMessage("确定将所有未读消息标为已读?") + .setNegativeButton("取消") + .setPositiveButton("确定") + .setOnDialogButtonClickListener(object : + AlertControlDialog.OnDialogButtonClickListener { + override fun onCancelClick() { + + } + + override fun onConfirmClick() { + //TODO 设置为已读 + } + }).build().show() + } + + if (hasNoticePermission()) { + openSystemNoticeLayout.visibility = View.GONE + openSystemNoticeLayout.visibility = View.GONE + } else { + openSystemNoticeLayout.setOnClickListener { + + } + + + closeLayoutView.setOnClickListener { + openSystemNoticeLayout.visibility = View.GONE + } + } + + noticeLayout.setOnRefreshListener { + isRefresh = true + //刷新之后页码重置 + pageIndex = 1 + getNoticeListByPage() + } + + noticeLayout.setOnLoadMoreListener { + isLoadMore = true + pageIndex++ + getNoticeListByPage() + } + } + + override fun onResume() { + super.onResume() + pageIndex = 1 + getNoticeListByPage() + } + + private fun getNoticeListByPage() { + noticeViewModel.getNoticeList("", "", "", "", "", pageIndex) + } + + private val callback = Handler.Callback { + when (it.what) { + 2023013101 -> { + if (isRefresh || isLoadMore) { + noticeListAdapter.notifyDataSetChanged() + } else { + if (dataBeans.size == 0) { + emptyView!!.showEmptyPage("没有任何消息") { + pageIndex = 1 + getNoticeListByPage() + } + } else { + emptyView!!.hide() + noticeListAdapter = NoticeListAdapter(this, dataBeans) + noticeRecyclerView.adapter = noticeListAdapter + noticeListAdapter.setOnItemClickListener(object : + NoticeListAdapter.OnItemClickListener { + override fun onItemClicked(position: Int) { + val rowsModel = dataBeans[position] + val allArgs = addAll( + rowsModel.noticeNo, + rowsModel.noticeTitle, + rowsModel.noticePublisher, + "", + "" + ) + Log.d( + "Casic", + "NoticeListActivity => onItemClicked: ${rowsModel.minioFileName.combineFilePath()}" + ) + navigatePageTo(allArgs) + } + }) + } + } + } + } + true + } + + //TODO 判断是否开启通知权限 + private fun hasNoticePermission(): Boolean { + + return false + } + + override fun initLayoutView(): Int = R.layout.activity_notice_list + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewDocumentActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewDocumentActivity.kt new file mode 100644 index 0000000..4b16ae8 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewDocumentActivity.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.view.notice + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseActivity + +class PreviewDocumentActivity : KotlinBaseActivity() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.activity_preview_doc + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewPdfActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewPdfActivity.kt new file mode 100644 index 0000000..fad73b6 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewPdfActivity.kt @@ -0,0 +1,62 @@ +package com.casic.xz.meterage.view.notice + +import com.casic.xz.meterage.R +import com.casic.xz.meterage.extensions.combineFilePath +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.callback.OnDownloadListener +import com.pengxh.kt.lite.extensions.createDownloadFileDir +import com.pengxh.kt.lite.extensions.downloadFile +import com.pengxh.kt.lite.utils.Constant +import kotlinx.android.synthetic.main.activity_preview_pdf.* +import kotlinx.android.synthetic.main.include_base_title.* +import java.io.File +import java.io.FileInputStream + + +class PreviewPdfActivity : KotlinBaseActivity() { + + override fun initData() { + val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! + titleView.text = minioFileName + + val url = minioFileName.combineFilePath() + url.downloadFile(createDownloadFileDir().toString(), + object : OnDownloadListener { + override fun onDownloadStart(totalBytes: Long) { + runOnUiThread { + LoadingDialogHub.show(this@PreviewPdfActivity, "附件加载中") + } + } + + override fun onProgressChanged(currentBytes: Long) { + + } + + override fun onDownloadEnd(file: File?) { + runOnUiThread { + LoadingDialogHub.dismiss() + } + val inputStream = FileInputStream(file) + pdfView.fromStream(inputStream).load() + } + }) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + } + + override fun initLayoutView(): Int = R.layout.activity_preview_pdf + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewTextActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewTextActivity.kt new file mode 100644 index 0000000..d7850fb --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewTextActivity.kt @@ -0,0 +1,60 @@ +package com.casic.xz.meterage.view.notice + +import com.casic.xz.meterage.R +import com.casic.xz.meterage.extensions.combineFilePath +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.callback.OnDownloadListener +import com.pengxh.kt.lite.extensions.createDownloadFileDir +import com.pengxh.kt.lite.extensions.downloadFile +import com.pengxh.kt.lite.extensions.read +import com.pengxh.kt.lite.utils.Constant +import kotlinx.android.synthetic.main.activity_preview_txt.* +import kotlinx.android.synthetic.main.include_base_title.* +import java.io.File + +class PreviewTextActivity : KotlinBaseActivity() { + + override fun initData() { + val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! + titleView.text = minioFileName + + val url = minioFileName.combineFilePath() + url.downloadFile(createDownloadFileDir().toString(), + object : OnDownloadListener { + override fun onDownloadStart(totalBytes: Long) { + runOnUiThread { + LoadingDialogHub.show(this@PreviewTextActivity, "附件加载中") + } + } + + override fun onProgressChanged(currentBytes: Long) { + + } + + override fun onDownloadEnd(file: File?) { + runOnUiThread { + LoadingDialogHub.dismiss() + textView.text = file?.read() + } + } + }) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + } + + override fun initLayoutView(): Int = R.layout.activity_preview_txt + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/vm/EquipmentViewModel.kt b/app/src/main/java/com/casic/xz/meterage/vm/EquipmentViewModel.kt new file mode 100644 index 0000000..b5f21f6 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/vm/EquipmentViewModel.kt @@ -0,0 +1,92 @@ +package com.casic.xz.meterage.vm + +import androidx.lifecycle.MutableLiveData +import com.casic.xz.meterage.base.BaseApplication +import com.casic.xz.meterage.extensions.separateResponseCode +import com.casic.xz.meterage.extensions.toErrorMessage +import com.casic.xz.meterage.model.EquipmentDetailModel +import com.casic.xz.meterage.model.EquipmentListModel +import com.casic.xz.meterage.utils.retrofit.RetrofitServiceManager +import com.google.gson.Gson +import com.google.gson.reflect.TypeToken +import com.pengxh.kt.lite.extensions.launch +import com.pengxh.kt.lite.extensions.show +import com.pengxh.kt.lite.vm.BaseViewModel +import com.pengxh.kt.lite.vm.LoadState + +class EquipmentViewModel : BaseViewModel() { + + private val gson by lazy { Gson() } + val equipmentResult = MutableLiveData() + val equipmentDetailResult = MutableLiveData() + + fun getEquipmentList( + equipmentNo: String, + equipmentName: String, + mesureType: String, + managerState: String, + useDept: String, + assetType: String, + equipmentCategory: String, + isCalibrationTestEquipment: String, + isMeasureAccount: String, + isStandardSupportEquipment: String, + isFixedAssets: String, + validStartDate: String, + validEndDate: String, + abc: String, + ids: Array, + offset: Int + ) = launch({ + loadState.value = LoadState.Loading + val response = RetrofitServiceManager.getEquipmentList( + equipmentNo, + equipmentName, + mesureType, + managerState, + useDept, + assetType, + equipmentCategory, + isCalibrationTestEquipment, + isMeasureAccount, + isStandardSupportEquipment, + isFixedAssets, + validStartDate, + validEndDate, + abc, + ids, + offset + ) + val responseCode = response.separateResponseCode() + if (responseCode == 200) { + loadState.value = LoadState.Success + equipmentResult.value = gson.fromJson( + response, object : TypeToken() {}.type + ) + } else { + loadState.value = LoadState.Fail + response.toErrorMessage().show(BaseApplication.get()) + } + }, { + loadState.value = LoadState.Fail + it.printStackTrace() + }) + + fun getEquipmentDetail(id: String) = launch({ + loadState.value = LoadState.Loading + val response = RetrofitServiceManager.getEquipmentDetail(id) + val responseCode = response.separateResponseCode() + if (responseCode == 200) { + loadState.value = LoadState.Success + equipmentDetailResult.value = gson.fromJson( + response, object : TypeToken() {}.type + ) + } else { + loadState.value = LoadState.Fail + response.toErrorMessage().show(BaseApplication.get()) + } + }, { + loadState.value = LoadState.Fail + it.printStackTrace() + }) +} \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_sorting.xml b/app/src/main/res/drawable/ic_sorting.xml new file mode 100644 index 0000000..252bfe6 --- /dev/null +++ b/app/src/main/res/drawable/ic_sorting.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/layout/activity_equipment.xml b/app/src/main/res/layout/activity_equipment.xml new file mode 100644 index 0000000..d6a64b1 --- /dev/null +++ b/app/src/main/res/layout/activity_equipment.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_equipment_detail.xml b/app/src/main/res/layout/activity_equipment_detail.xml new file mode 100644 index 0000000..7254762 --- /dev/null +++ b/app/src/main/res/layout/activity_equipment_detail.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_basic_information.xml b/app/src/main/res/layout/fragment_basic_information.xml new file mode 100644 index 0000000..4a3c1c7 --- /dev/null +++ b/app/src/main/res/layout/fragment_basic_information.xml @@ -0,0 +1,390 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_certificate.xml b/app/src/main/res/layout/fragment_certificate.xml new file mode 100644 index 0000000..77d9ef6 --- /dev/null +++ b/app/src/main/res/layout/fragment_certificate.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_change_record.xml b/app/src/main/res/layout/fragment_change_record.xml new file mode 100644 index 0000000..77d9ef6 --- /dev/null +++ b/app/src/main/res/layout/fragment_change_record.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_home.xml b/app/src/main/res/layout/fragment_home.xml index 41b32a9..e1ab759 100644 --- a/app/src/main/res/layout/fragment_home.xml +++ b/app/src/main/res/layout/fragment_home.xml @@ -71,7 +71,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" app:layoutManager="androidx.recyclerview.widget.GridLayoutManager" - app:spanCount="5" /> + app:spanCount="4" /> + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_mine.xml b/app/src/main/res/layout/fragment_mine.xml index 0643064..d9f57b3 100644 --- a/app/src/main/res/layout/fragment_mine.xml +++ b/app/src/main/res/layout/fragment_mine.xml @@ -22,10 +22,10 @@ android:orientation="horizontal"> + android:src="@mipmap/default_avatar" /> @@ -122,7 +122,7 @@ android:background="@drawable/ic_collection" /> @@ -145,7 +145,7 @@ android:background="@drawable/ic_push_setting" /> @@ -166,7 +166,7 @@ android:background="@drawable/ic_privacy" /> @@ -189,7 +189,7 @@ android:background="@drawable/ic_help" /> @@ -210,7 +210,7 @@ android:background="@drawable/ic_update" /> @@ -231,7 +231,7 @@ android:background="@drawable/ic_about" /> @@ -252,7 +252,7 @@ android:background="@drawable/ic_back" /> diff --git a/app/src/main/res/layout/fragment_usage_record.xml b/app/src/main/res/layout/fragment_usage_record.xml new file mode 100644 index 0000000..77d9ef6 --- /dev/null +++ b/app/src/main/res/layout/fragment_usage_record.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/include_equipment_layout.xml b/app/src/main/res/layout/include_equipment_layout.xml new file mode 100644 index 0000000..ce846d5 --- /dev/null +++ b/app/src/main/res/layout/include_equipment_layout.xml @@ -0,0 +1,74 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/include_line_view.xml b/app/src/main/res/layout/include_line_view.xml new file mode 100644 index 0000000..ff89de3 --- /dev/null +++ b/app/src/main/res/layout/include_line_view.xml @@ -0,0 +1,5 @@ + + \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 3892b5a..02160cd 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -34,16 +34,18 @@ - - - - - - - + + + + + + + + + +) : RecyclerView.Adapter() { + + private var layoutInflater: LayoutInflater = LayoutInflater.from(context) + + override fun getItemCount(): Int = dataRows.size + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = ItemViewHolder( + layoutInflater.inflate(R.layout.item_equipment_rv_l, parent, false) + ) + + override fun onBindViewHolder(holder: ItemViewHolder, position: Int) { + //绑定数据 + val rowsBean = dataRows[position] + holder.equipmentNameView.text = rowsBean.equipmentName + holder.equipmentCodeView.text = rowsBean.equipmentNo + holder.equipmentDateView.text = rowsBean.enableDate + holder.equipmentLibView.text = rowsBean.useDeptName + + //绑定事件 + holder.itemView.setOnClickListener { + listener?.onItemClicked(position) + } + } + + inner class ItemViewHolder(view: View) : RecyclerView.ViewHolder(view) { + var equipmentNameView: TextView = view.findViewById(R.id.equipmentNameView) + var equipmentCodeView: TextView = view.findViewById(R.id.equipmentCodeView) + var equipmentDateView: TextView = view.findViewById(R.id.equipmentDateView) + var equipmentLibView: TextView = view.findViewById(R.id.equipmentLibView) + } + + private var listener: OnItemClickListener? = null + + interface OnItemClickListener { + fun onItemClicked(position: Int) + } + + fun setOnItemClickListener(onClickListener: OnItemClickListener?) { + this.listener = onClickListener + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt index b4628f3..d970b55 100644 --- a/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt +++ b/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt @@ -5,7 +5,8 @@ import com.casic.xz.meterage.R import com.casic.xz.meterage.adapter.HomeGridAdapter import com.casic.xz.meterage.utils.LocaleConstant -import com.casic.xz.meterage.view.NoticeListActivity +import com.casic.xz.meterage.view.home.EquipmentActivity +import com.casic.xz.meterage.view.notice.NoticeListActivity import com.casic.xz.meterage.vm.NoticeViewModel import com.pengxh.kt.lite.base.KotlinBaseFragment import com.pengxh.kt.lite.extensions.navigatePageTo @@ -36,8 +37,19 @@ homeFuncRecyclerView.adapter = homeAdapter homeAdapter.setOnGridItemClickListener(object : HomeGridAdapter.OnGridItemClickListener { override fun onItemClick(position: Int) { - when (position) { - + when (LocaleConstant.HOME_FUNC_OPERATE[position]) { + "仪器设备" -> requireContext().navigatePageTo() +// "标准装置" -> requireContext().navigatePageTo() +// "证书报告" -> requireContext().navigatePageTo() +// "委托需求" -> requireContext().navigatePageTo() +// "访客" -> requireContext().navigatePageTo() +// "标准规范" -> requireContext().navigatePageTo() +// "能力列表" -> requireContext().navigatePageTo() +// "计量培训" -> requireContext().navigatePageTo() +// "合同发票" -> requireContext().navigatePageTo() +// "业务统计" -> requireContext().navigatePageTo() +// "客户列表" -> requireContext().navigatePageTo() +// "外场检测" -> requireContext().navigatePageTo() } } }) diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt index 7e75abe..56dc5ec 100644 --- a/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt +++ b/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt @@ -2,9 +2,11 @@ import android.view.View import androidx.lifecycle.ViewModelProvider +import com.bumptech.glide.Glide +import com.bumptech.glide.request.RequestOptions import com.casic.xz.meterage.R import com.casic.xz.meterage.utils.LocaleConstant -import com.casic.xz.meterage.view.NoticeListActivity +import com.casic.xz.meterage.view.notice.NoticeListActivity import com.casic.xz.meterage.vm.NoticeViewModel import com.casic.xz.meterage.vm.UserViewModel import com.pengxh.kt.lite.base.KotlinBaseFragment @@ -23,6 +25,12 @@ val data = it.data userNameView.text = data.name userUnitView.text = data.deptName + +// Glide.with(requireContext()) +// .load(R.mipmap.default_avatar) +// .apply(RequestOptions.circleCropTransform()) +// .placeholder(R.mipmap.load_image_error) +// .into(userAvatarView) } }) diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt new file mode 100644 index 0000000..cf22646 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt @@ -0,0 +1,103 @@ +package com.casic.xz.meterage.fragment.equipment + +import android.graphics.Paint +import androidx.lifecycle.ViewModelProvider +import com.casic.xz.meterage.R +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.casic.xz.meterage.vm.EquipmentViewModel +import com.pengxh.kt.lite.base.KotlinBaseFragment +import com.pengxh.kt.lite.extensions.convertColor +import com.pengxh.kt.lite.vm.LoadState +import kotlinx.android.synthetic.main.fragment_basic_information.* + +class BasicInformationFragment(private val id: String) : KotlinBaseFragment() { + + private lateinit var equipmentViewModel: EquipmentViewModel + + override fun initData() { + equipmentViewModel = ViewModelProvider(this)[EquipmentViewModel::class.java] + equipmentViewModel.getEquipmentDetail(id) + equipmentViewModel.equipmentDetailResult.observe(this, { + if (it.code == 200) { + val data = it.data!! + + equipmentCodeView.text = data.equipmentNo + equipmentNameView.text = data.equipmentName + manufacturerView.text = data.manufacturer + factoryNumberView.text = data.manufacturingNo + modelView.text = data.modelNo + verificationMethodView.text = data.mesureTypeName + measuringRangeView.text = data.mesureRange + uncertaintyView.text = data.uncertainty + firstUseView.text = data.createTime + originalValueView.text = data.originValue + usageDeptView.text = data.useDeptName + userView.text = data.usePersonName + managementStatusView.text = data.managerStateName + verificationDeptView.text = data.useDeptName +// nextVerificationDeptView.text = data. + verificationPeriodView.text = data.mesureCycle + verificationDateView.text = data.mesureDate + effectiveDateView.text = data.validDate + verificationResultsView.text = data.mesureResultName + abcView.text = data.abcName + isNeedTechnicalView.text = if ( + data.isCalibrationTestEquipment.isNullOrBlank() || data.isCalibrationTestEquipment == "0" + ) { + "否" + } else { + "是" + } + + isStandingBook.text = if ( + data.isMeasureAccount.isNullOrBlank() || data.isMeasureAccount == "0" + ) { + "否" + } else { + "是" + } + + isStandardView.text = if ( + data.isStandardSupportEquipment.isNullOrBlank() || data.isStandardSupportEquipment == "0" + ) { + "否" + } else { + "是" + } + remarkView.text = data.remark + if (data.fileList.size == 0) { + instructionsView.text = "暂无" + } else { + instructionsView.text = "查看附件列表" + val textPaint = instructionsView.paint + textPaint.flags = Paint.UNDERLINE_TEXT_FLAG + textPaint.isAntiAlias = true + instructionsView.setTextColor(R.color.themeColor.convertColor(requireContext())) + + instructionsView.setOnClickListener { + + } + } + } + }) + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_basic_information + + override fun observeRequestState() { + equipmentViewModel.loadState.observe(this, { + when (it) { + LoadState.Loading -> LoadingDialogHub.show(requireActivity(), "数据加载中...") + else -> LoadingDialogHub.dismiss() + } + }) + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt new file mode 100644 index 0000000..0b4a747 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class CertificateFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_certificate + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt new file mode 100644 index 0000000..f05c491 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class ChangeRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_change_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt new file mode 100644 index 0000000..849ffa5 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class InspectionRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_inspection_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt new file mode 100644 index 0000000..aa4edd9 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class UsageRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_usage_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java b/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java new file mode 100644 index 0000000..0b9124e --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java @@ -0,0 +1,760 @@ +package com.casic.xz.meterage.model; + +import java.util.List; + +public class EquipmentDetailModel { + + private int code; + private DataModel data; + private String message; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataModel getData() { + return data; + } + + public void setData(DataModel data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public static class DataModel { + private String abc; + private String abcName; + private String assetNo; + private String assetSource; + private String assetType; + private String assetTypeName; + private String attribute; + private String capitalSource; + private String capitalSourceName; + private String cardEstablishmentDate; + private String createTime; + private String createUser; + private String depreciationMethod; + private String depreciationMethodName; + private String depreciationPeriod; + private String enableDate; + private String equipmentCategory; + private String equipmentCategoryName; + private String equipmentName; + private String equipmentNo; + private String equipmentSpecifications; + private String equipmentType; + private String equipmentTypeName; + private List fileList; + private String id; + private String installIncidentalExpenses; + private String installPlace; + private String intactState; + private String isCalibrationTestEquipment; + private int isDel; + private String isFixedAssets; + private String isMeasureAccount; + private String isStandardSupportEquipment; + private String labelBind; + private String majorCategory; + private String majorCategoryName; + private String managerLevel; + private String managerLevelName; + private String managerState; + private String managerStateName; + private String manufacturer; + private String manufacturerCountry; + private String manufacturingDate; + private String manufacturingNo; + private String mesureCycle; + private String mesureDate; + private String mesureDept; + private String mesureRange; + private String mesureResult; + private String mesureResultName; + private String mesureType; + private String mesureTypeName; + private String modelNo; + private String originValue; + private String overallDimension; + private String presentOriginValue; + private String purpose; + private String remark; + private String singlePrice; + private String supportStandardEquipmentName; + private String supportStandardEquipmentNo; + private String technicalLevel; + private String uncertainty; + private String updateTime; + private String useDept; + private String useDeptName; + private String usePerson; + private String usePersonName; + private String validDate; + private int version; + private String weight; + + public String getAbc() { + return abc; + } + + public void setAbc(String abc) { + this.abc = abc; + } + + public String getAbcName() { + return abcName; + } + + public void setAbcName(String abcName) { + this.abcName = abcName; + } + + public String getAssetNo() { + return assetNo; + } + + public void setAssetNo(String assetNo) { + this.assetNo = assetNo; + } + + public String getAssetSource() { + return assetSource; + } + + public void setAssetSource(String assetSource) { + this.assetSource = assetSource; + } + + public String getAssetType() { + return assetType; + } + + public void setAssetType(String assetType) { + this.assetType = assetType; + } + + public String getAssetTypeName() { + return assetTypeName; + } + + public void setAssetTypeName(String assetTypeName) { + this.assetTypeName = assetTypeName; + } + + public String getAttribute() { + return attribute; + } + + public void setAttribute(String attribute) { + this.attribute = attribute; + } + + public String getCapitalSource() { + return capitalSource; + } + + public void setCapitalSource(String capitalSource) { + this.capitalSource = capitalSource; + } + + public String getCapitalSourceName() { + return capitalSourceName; + } + + public void setCapitalSourceName(String capitalSourceName) { + this.capitalSourceName = capitalSourceName; + } + + public String getCardEstablishmentDate() { + return cardEstablishmentDate; + } + + public void setCardEstablishmentDate(String cardEstablishmentDate) { + this.cardEstablishmentDate = cardEstablishmentDate; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getDepreciationMethod() { + return depreciationMethod; + } + + public void setDepreciationMethod(String depreciationMethod) { + this.depreciationMethod = depreciationMethod; + } + + public String getDepreciationMethodName() { + return depreciationMethodName; + } + + public void setDepreciationMethodName(String depreciationMethodName) { + this.depreciationMethodName = depreciationMethodName; + } + + public String getDepreciationPeriod() { + return depreciationPeriod; + } + + public void setDepreciationPeriod(String depreciationPeriod) { + this.depreciationPeriod = depreciationPeriod; + } + + public String getEnableDate() { + return enableDate; + } + + public void setEnableDate(String enableDate) { + this.enableDate = enableDate; + } + + public String getEquipmentCategory() { + return equipmentCategory; + } + + public void setEquipmentCategory(String equipmentCategory) { + this.equipmentCategory = equipmentCategory; + } + + public String getEquipmentCategoryName() { + return equipmentCategoryName; + } + + public void setEquipmentCategoryName(String equipmentCategoryName) { + this.equipmentCategoryName = equipmentCategoryName; + } + + public String getEquipmentName() { + return equipmentName; + } + + public void setEquipmentName(String equipmentName) { + this.equipmentName = equipmentName; + } + + public String getEquipmentNo() { + return equipmentNo; + } + + public void setEquipmentNo(String equipmentNo) { + this.equipmentNo = equipmentNo; + } + + public String getEquipmentSpecifications() { + return equipmentSpecifications; + } + + public void setEquipmentSpecifications(String equipmentSpecifications) { + this.equipmentSpecifications = equipmentSpecifications; + } + + public String getEquipmentType() { + return equipmentType; + } + + public void setEquipmentType(String equipmentType) { + this.equipmentType = equipmentType; + } + + public String getEquipmentTypeName() { + return equipmentTypeName; + } + + public void setEquipmentTypeName(String equipmentTypeName) { + this.equipmentTypeName = equipmentTypeName; + } + + public List getFileList() { + return fileList; + } + + public void setFileList(List fileList) { + this.fileList = fileList; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getInstallIncidentalExpenses() { + return installIncidentalExpenses; + } + + public void setInstallIncidentalExpenses(String installIncidentalExpenses) { + this.installIncidentalExpenses = installIncidentalExpenses; + } + + public String getInstallPlace() { + return installPlace; + } + + public void setInstallPlace(String installPlace) { + this.installPlace = installPlace; + } + + public String getIntactState() { + return intactState; + } + + public void setIntactState(String intactState) { + this.intactState = intactState; + } + + public String getIsCalibrationTestEquipment() { + return isCalibrationTestEquipment; + } + + public void setIsCalibrationTestEquipment(String isCalibrationTestEquipment) { + this.isCalibrationTestEquipment = isCalibrationTestEquipment; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getIsFixedAssets() { + return isFixedAssets; + } + + public void setIsFixedAssets(String isFixedAssets) { + this.isFixedAssets = isFixedAssets; + } + + public String getIsMeasureAccount() { + return isMeasureAccount; + } + + public void setIsMeasureAccount(String isMeasureAccount) { + this.isMeasureAccount = isMeasureAccount; + } + + public String getIsStandardSupportEquipment() { + return isStandardSupportEquipment; + } + + public void setIsStandardSupportEquipment(String isStandardSupportEquipment) { + this.isStandardSupportEquipment = isStandardSupportEquipment; + } + + public String getLabelBind() { + return labelBind; + } + + public void setLabelBind(String labelBind) { + this.labelBind = labelBind; + } + + public String getMajorCategory() { + return majorCategory; + } + + public void setMajorCategory(String majorCategory) { + this.majorCategory = majorCategory; + } + + public String getMajorCategoryName() { + return majorCategoryName; + } + + public void setMajorCategoryName(String majorCategoryName) { + this.majorCategoryName = majorCategoryName; + } + + public String getManagerLevel() { + return managerLevel; + } + + public void setManagerLevel(String managerLevel) { + this.managerLevel = managerLevel; + } + + public String getManagerLevelName() { + return managerLevelName; + } + + public void setManagerLevelName(String managerLevelName) { + this.managerLevelName = managerLevelName; + } + + public String getManagerState() { + return managerState; + } + + public void setManagerState(String managerState) { + this.managerState = managerState; + } + + public String getManagerStateName() { + return managerStateName; + } + + public void setManagerStateName(String managerStateName) { + this.managerStateName = managerStateName; + } + + public String getManufacturer() { + return manufacturer; + } + + public void setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + } + + public String getManufacturerCountry() { + return manufacturerCountry; + } + + public void setManufacturerCountry(String manufacturerCountry) { + this.manufacturerCountry = manufacturerCountry; + } + + public String getManufacturingDate() { + return manufacturingDate; + } + + public void setManufacturingDate(String manufacturingDate) { + this.manufacturingDate = manufacturingDate; + } + + public String getManufacturingNo() { + return manufacturingNo; + } + + public void setManufacturingNo(String manufacturingNo) { + this.manufacturingNo = manufacturingNo; + } + + public String getMesureCycle() { + return mesureCycle; + } + + public void setMesureCycle(String mesureCycle) { + this.mesureCycle = mesureCycle; + } + + public String getMesureDate() { + return mesureDate; + } + + public void setMesureDate(String mesureDate) { + this.mesureDate = mesureDate; + } + + public String getMesureDept() { + return mesureDept; + } + + public void setMesureDept(String mesureDept) { + this.mesureDept = mesureDept; + } + + public String getMesureRange() { + return mesureRange; + } + + public void setMesureRange(String mesureRange) { + this.mesureRange = mesureRange; + } + + public String getMesureResult() { + return mesureResult; + } + + public void setMesureResult(String mesureResult) { + this.mesureResult = mesureResult; + } + + public String getMesureResultName() { + return mesureResultName; + } + + public void setMesureResultName(String mesureResultName) { + this.mesureResultName = mesureResultName; + } + + public String getMesureType() { + return mesureType; + } + + public void setMesureType(String mesureType) { + this.mesureType = mesureType; + } + + public String getMesureTypeName() { + return mesureTypeName; + } + + public void setMesureTypeName(String mesureTypeName) { + this.mesureTypeName = mesureTypeName; + } + + public String getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getOriginValue() { + return originValue; + } + + public void setOriginValue(String originValue) { + this.originValue = originValue; + } + + public String getOverallDimension() { + return overallDimension; + } + + public void setOverallDimension(String overallDimension) { + this.overallDimension = overallDimension; + } + + public String getPresentOriginValue() { + return presentOriginValue; + } + + public void setPresentOriginValue(String presentOriginValue) { + this.presentOriginValue = presentOriginValue; + } + + public String getPurpose() { + return purpose; + } + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getSinglePrice() { + return singlePrice; + } + + public void setSinglePrice(String singlePrice) { + this.singlePrice = singlePrice; + } + + public String getSupportStandardEquipmentName() { + return supportStandardEquipmentName; + } + + public void setSupportStandardEquipmentName(String supportStandardEquipmentName) { + this.supportStandardEquipmentName = supportStandardEquipmentName; + } + + public String getSupportStandardEquipmentNo() { + return supportStandardEquipmentNo; + } + + public void setSupportStandardEquipmentNo(String supportStandardEquipmentNo) { + this.supportStandardEquipmentNo = supportStandardEquipmentNo; + } + + public String getTechnicalLevel() { + return technicalLevel; + } + + public void setTechnicalLevel(String technicalLevel) { + this.technicalLevel = technicalLevel; + } + + public String getUncertainty() { + return uncertainty; + } + + public void setUncertainty(String uncertainty) { + this.uncertainty = uncertainty; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getUseDept() { + return useDept; + } + + public void setUseDept(String useDept) { + this.useDept = useDept; + } + + public String getUseDeptName() { + return useDeptName; + } + + public void setUseDeptName(String useDeptName) { + this.useDeptName = useDeptName; + } + + public String getUsePerson() { + return usePerson; + } + + public void setUsePerson(String usePerson) { + this.usePerson = usePerson; + } + + public String getUsePersonName() { + return usePersonName; + } + + public void setUsePersonName(String usePersonName) { + this.usePersonName = usePersonName; + } + + public String getValidDate() { + return validDate; + } + + public void setValidDate(String validDate) { + this.validDate = validDate; + } + + public int getVersion() { + return version; + } + + public void setVersion(int version) { + this.version = version; + } + + public String getWeight() { + return weight; + } + + public void setWeight(String weight) { + this.weight = weight; + } + + public static class FileListModel { + private String assetId; + private String createTime; + private String createUser; + private String fileName; + private String id; + private int isDel; + private String minioFileName; + private String remark; + private String updateTime; + + public String getAssetId() { + return assetId; + } + + public void setAssetId(String assetId) { + this.assetId = assetId; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getFileName() { + return fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getMinioFileName() { + return minioFileName; + } + + public void setMinioFileName(String minioFileName) { + this.minioFileName = minioFileName; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + } + } +} diff --git a/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java b/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java new file mode 100644 index 0000000..15fc128 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java @@ -0,0 +1,697 @@ +package com.casic.xz.meterage.model; + +import java.util.List; + +public class EquipmentListModel { + + private int code; + private DataModel data; + private String message; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataModel getData() { + return data; + } + + public void setData(DataModel data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public static class DataModel { + private List rows; + private int total; + + public List getRows() { + return rows; + } + + public void setRows(List rows) { + this.rows = rows; + } + + public int getTotal() { + return total; + } + + public void setTotal(int total) { + this.total = total; + } + + public static class RowsModel { + private String abc; + private String abcName; + private String assetNo; + private String assetSource; + private String assetType; + private String assetTypeName; + private String attribute; + private String capitalSource; + private String capitalSourceName; + private String cardEstablishmentDate; + private String createTime; + private String createUser; + private String depreciationMethod; + private String depreciationMethodName; + private String depreciationPeriod; + private String enableDate; + private String equipmentCategory; + private String equipmentCategoryName; + private String equipmentName; + private String equipmentNo; + private String equipmentSpecifications; + private String equipmentType; + private String equipmentTypeName; + private String fileList; + private String id; + private String installIncidentalExpenses; + private String installPlace; + private String intactState; + private String isCalibrationTestEquipment; + private int isDel; + private String isFixedAssets; + private String isMeasureAccount; + private String isStandardSupportEquipment; + private String labelBind; + private String majorCategory; + private String majorCategoryName; + private String managerLevel; + private String managerLevelName; + private String managerState; + private String managerStateName; + private String manufacturer; + private String manufacturerCountry; + private String manufacturingDate; + private String manufacturingNo; + private String mesureCycle; + private String mesureDate; + private String mesureDept; + private String mesureRange; + private String mesureResult; + private String mesureResultName; + private String mesureType; + private String mesureTypeName; + private String modelNo; + private String originValue; + private String overallDimension; + private String presentOriginValue; + private String purpose; + private String remark; + private String singlePrice; + private String supportStandardEquipmentName; + private String supportStandardEquipmentNo; + private String technicalLevel; + private String uncertainty; + private String updateTime; + private String useDept; + private String useDeptName; + private String usePerson; + private String usePersonName; + private String validDate; + private int version; + private String weight; + + public String getAbc() { + return abc; + } + + public void setAbc(String abc) { + this.abc = abc; + } + + public String getAbcName() { + return abcName; + } + + public void setAbcName(String abcName) { + this.abcName = abcName; + } + + public String getAssetNo() { + return assetNo; + } + + public void setAssetNo(String assetNo) { + this.assetNo = assetNo; + } + + public String getAssetSource() { + return assetSource; + } + + public void setAssetSource(String assetSource) { + this.assetSource = assetSource; + } + + public String getAssetType() { + return assetType; + } + + public void setAssetType(String assetType) { + this.assetType = assetType; + } + + public String getAssetTypeName() { + return assetTypeName; + } + + public void setAssetTypeName(String assetTypeName) { + this.assetTypeName = assetTypeName; + } + + public String getAttribute() { + return attribute; + } + + public void setAttribute(String attribute) { + this.attribute = attribute; + } + + public String getCapitalSource() { + return capitalSource; + } + + public void setCapitalSource(String capitalSource) { + this.capitalSource = capitalSource; + } + + public String getCapitalSourceName() { + return capitalSourceName; + } + + public void setCapitalSourceName(String capitalSourceName) { + this.capitalSourceName = capitalSourceName; + } + + public String getCardEstablishmentDate() { + return cardEstablishmentDate; + } + + public void setCardEstablishmentDate(String cardEstablishmentDate) { + this.cardEstablishmentDate = cardEstablishmentDate; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getDepreciationMethod() { + return depreciationMethod; + } + + public void setDepreciationMethod(String depreciationMethod) { + this.depreciationMethod = depreciationMethod; + } + + public String getDepreciationMethodName() { + return depreciationMethodName; + } + + public void setDepreciationMethodName(String depreciationMethodName) { + this.depreciationMethodName = depreciationMethodName; + } + + public String getDepreciationPeriod() { + return depreciationPeriod; + } + + public void setDepreciationPeriod(String depreciationPeriod) { + this.depreciationPeriod = depreciationPeriod; + } + + public String getEnableDate() { + return enableDate; + } + + public void setEnableDate(String enableDate) { + this.enableDate = enableDate; + } + + public String getEquipmentCategory() { + return equipmentCategory; + } + + public void setEquipmentCategory(String equipmentCategory) { + this.equipmentCategory = equipmentCategory; + } + + public String getEquipmentCategoryName() { + return equipmentCategoryName; + } + + public void setEquipmentCategoryName(String equipmentCategoryName) { + this.equipmentCategoryName = equipmentCategoryName; + } + + public String getEquipmentName() { + return equipmentName; + } + + public void setEquipmentName(String equipmentName) { + this.equipmentName = equipmentName; + } + + public String getEquipmentNo() { + return equipmentNo; + } + + public void setEquipmentNo(String equipmentNo) { + this.equipmentNo = equipmentNo; + } + + public String getEquipmentSpecifications() { + return equipmentSpecifications; + } + + public void setEquipmentSpecifications(String equipmentSpecifications) { + this.equipmentSpecifications = equipmentSpecifications; + } + + public String getEquipmentType() { + return equipmentType; + } + + public void setEquipmentType(String equipmentType) { + this.equipmentType = equipmentType; + } + + public String getEquipmentTypeName() { + return equipmentTypeName; + } + + public void setEquipmentTypeName(String equipmentTypeName) { + this.equipmentTypeName = equipmentTypeName; + } + + public String getFileList() { + return fileList; + } + + public void setFileList(String fileList) { + this.fileList = fileList; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getInstallIncidentalExpenses() { + return installIncidentalExpenses; + } + + public void setInstallIncidentalExpenses(String installIncidentalExpenses) { + this.installIncidentalExpenses = installIncidentalExpenses; + } + + public String getInstallPlace() { + return installPlace; + } + + public void setInstallPlace(String installPlace) { + this.installPlace = installPlace; + } + + public String getIntactState() { + return intactState; + } + + public void setIntactState(String intactState) { + this.intactState = intactState; + } + + public String getIsCalibrationTestEquipment() { + return isCalibrationTestEquipment; + } + + public void setIsCalibrationTestEquipment(String isCalibrationTestEquipment) { + this.isCalibrationTestEquipment = isCalibrationTestEquipment; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getIsFixedAssets() { + return isFixedAssets; + } + + public void setIsFixedAssets(String isFixedAssets) { + this.isFixedAssets = isFixedAssets; + } + + public String getIsMeasureAccount() { + return isMeasureAccount; + } + + public void setIsMeasureAccount(String isMeasureAccount) { + this.isMeasureAccount = isMeasureAccount; + } + + public String getIsStandardSupportEquipment() { + return isStandardSupportEquipment; + } + + public void setIsStandardSupportEquipment(String isStandardSupportEquipment) { + this.isStandardSupportEquipment = isStandardSupportEquipment; + } + + public String getLabelBind() { + return labelBind; + } + + public void setLabelBind(String labelBind) { + this.labelBind = labelBind; + } + + public String getMajorCategory() { + return majorCategory; + } + + public void setMajorCategory(String majorCategory) { + this.majorCategory = majorCategory; + } + + public String getMajorCategoryName() { + return majorCategoryName; + } + + public void setMajorCategoryName(String majorCategoryName) { + this.majorCategoryName = majorCategoryName; + } + + public String getManagerLevel() { + return managerLevel; + } + + public void setManagerLevel(String managerLevel) { + this.managerLevel = managerLevel; + } + + public String getManagerLevelName() { + return managerLevelName; + } + + public void setManagerLevelName(String managerLevelName) { + this.managerLevelName = managerLevelName; + } + + public String getManagerState() { + return managerState; + } + + public void setManagerState(String managerState) { + this.managerState = managerState; + } + + public String getManagerStateName() { + return managerStateName; + } + + public void setManagerStateName(String managerStateName) { + this.managerStateName = managerStateName; + } + + public String getManufacturer() { + return manufacturer; + } + + public void setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + } + + public String getManufacturerCountry() { + return manufacturerCountry; + } + + public void setManufacturerCountry(String manufacturerCountry) { + this.manufacturerCountry = manufacturerCountry; + } + + public String getManufacturingDate() { + return manufacturingDate; + } + + public void setManufacturingDate(String manufacturingDate) { + this.manufacturingDate = manufacturingDate; + } + + public String getManufacturingNo() { + return manufacturingNo; + } + + public void setManufacturingNo(String manufacturingNo) { + this.manufacturingNo = manufacturingNo; + } + + public String getMesureCycle() { + return mesureCycle; + } + + public void setMesureCycle(String mesureCycle) { + this.mesureCycle = mesureCycle; + } + + public String getMesureDate() { + return mesureDate; + } + + public void setMesureDate(String mesureDate) { + this.mesureDate = mesureDate; + } + + public String getMesureDept() { + return mesureDept; + } + + public void setMesureDept(String mesureDept) { + this.mesureDept = mesureDept; + } + + public String getMesureRange() { + return mesureRange; + } + + public void setMesureRange(String mesureRange) { + this.mesureRange = mesureRange; + } + + public String getMesureResult() { + return mesureResult; + } + + public void setMesureResult(String mesureResult) { + this.mesureResult = mesureResult; + } + + public String getMesureResultName() { + return mesureResultName; + } + + public void setMesureResultName(String mesureResultName) { + this.mesureResultName = mesureResultName; + } + + public String getMesureType() { + return mesureType; + } + + public void setMesureType(String mesureType) { + this.mesureType = mesureType; + } + + public String getMesureTypeName() { + return mesureTypeName; + } + + public void setMesureTypeName(String mesureTypeName) { + this.mesureTypeName = mesureTypeName; + } + + public String getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getOriginValue() { + return originValue; + } + + public void setOriginValue(String originValue) { + this.originValue = originValue; + } + + public String getOverallDimension() { + return overallDimension; + } + + public void setOverallDimension(String overallDimension) { + this.overallDimension = overallDimension; + } + + public String getPresentOriginValue() { + return presentOriginValue; + } + + public void setPresentOriginValue(String presentOriginValue) { + this.presentOriginValue = presentOriginValue; + } + + public String getPurpose() { + return purpose; + } + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getSinglePrice() { + return singlePrice; + } + + public void setSinglePrice(String singlePrice) { + this.singlePrice = singlePrice; + } + + public String getSupportStandardEquipmentName() { + return supportStandardEquipmentName; + } + + public void setSupportStandardEquipmentName(String supportStandardEquipmentName) { + this.supportStandardEquipmentName = supportStandardEquipmentName; + } + + public String getSupportStandardEquipmentNo() { + return supportStandardEquipmentNo; + } + + public void setSupportStandardEquipmentNo(String supportStandardEquipmentNo) { + this.supportStandardEquipmentNo = supportStandardEquipmentNo; + } + + public String getTechnicalLevel() { + return technicalLevel; + } + + public void setTechnicalLevel(String technicalLevel) { + this.technicalLevel = technicalLevel; + } + + public String getUncertainty() { + return uncertainty; + } + + public void setUncertainty(String uncertainty) { + this.uncertainty = uncertainty; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getUseDept() { + return useDept; + } + + public void setUseDept(String useDept) { + this.useDept = useDept; + } + + public String getUseDeptName() { + return useDeptName; + } + + public void setUseDeptName(String useDeptName) { + this.useDeptName = useDeptName; + } + + public String getUsePerson() { + return usePerson; + } + + public void setUsePerson(String usePerson) { + this.usePerson = usePerson; + } + + public String getUsePersonName() { + return usePersonName; + } + + public void setUsePersonName(String usePersonName) { + this.usePersonName = usePersonName; + } + + public String getValidDate() { + return validDate; + } + + public void setValidDate(String validDate) { + this.validDate = validDate; + } + + public int getVersion() { + return version; + } + + public void setVersion(int version) { + this.version = version; + } + + public String getWeight() { + return weight; + } + + public void setWeight(String weight) { + this.weight = weight; + } + } + } +} diff --git a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt index a3f514f..46e5eef 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt @@ -35,4 +35,24 @@ @QueryMap limit: Map, @QueryMap offset: Map ): String + + /** + * 获取设备列表 + */ + @POST("/meter/assets/listPage") + suspend fun getEquipmentList( + @Header("token") token: String, + @Body requestBody: RequestBody, + @QueryMap limit: Map, + @QueryMap offset: Map + ): String + + /** + * 获取设备详情 + */ + @POST("/meter/assets/detail") + suspend fun getEquipmentDetail( + @Header("token") token: String, + @Body requestBody: RequestBody + ): String } \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt index 444a872..386a1d8 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt @@ -6,8 +6,10 @@ import com.pengxh.kt.lite.utils.SaveKeyValues import okhttp3.MediaType.Companion.toMediaType import okhttp3.RequestBody.Companion.toRequestBody +import org.json.JSONArray import org.json.JSONObject + object RetrofitServiceManager { private val api by lazy { @@ -73,4 +75,71 @@ offsetMap["offset"] = offset return api.getNoticeList(AuthenticationHelper.token!!, requestBody, limitMap, offsetMap) } + + /** + * 获取设备列表 + */ + suspend fun getEquipmentList( + equipmentNo: String, + equipmentName: String, + mesureType: String, + managerState: String, + useDept: String, + assetType: String, + equipmentCategory: String, + isCalibrationTestEquipment: String, + isMeasureAccount: String, + isStandardSupportEquipment: String, + isFixedAssets: String, + validStartDate: String, + validEndDate: String, + abc: String, + ids: Array, + offset: Int + ): String { + val paramObject = JSONObject() + paramObject.put("equipmentNo", equipmentNo) + paramObject.put("equipmentName", equipmentName) + paramObject.put("mesureType", mesureType) + paramObject.put("managerState", managerState) + paramObject.put("useDept", useDept) + paramObject.put("assetType", assetType) + paramObject.put("equipmentCategory", equipmentCategory) + paramObject.put("isCalibrationTestEquipment", isCalibrationTestEquipment) + paramObject.put("isMeasureAccount", isMeasureAccount) + paramObject.put("isStandardSupportEquipment", isStandardSupportEquipment) + paramObject.put("isFixedAssets", isFixedAssets) + paramObject.put("validStartDate", validStartDate) + paramObject.put("validEndDate", validEndDate) + paramObject.put("abc", abc) + + val jsonArray = JSONArray() + ids.forEach { + jsonArray.put(it) + } + paramObject.put("ids", jsonArray) + + val requestBody = paramObject.toString().toRequestBody( + "application/json;charset=UTF-8".toMediaType() + ) + + val limitMap = HashMap() + limitMap["limit"] = LocaleConstant.PAGE_LIMIT + + val offsetMap = HashMap() + offsetMap["offset"] = offset + return api.getEquipmentList(AuthenticationHelper.token!!, requestBody, limitMap, offsetMap) + } + + /** + * 获取设备详情 + */ + suspend fun getEquipmentDetail(id: String): String { + val paramObject = JSONObject() + paramObject.put("id", id) + val requestBody = paramObject.toString().toRequestBody( + "application/json;charset=UTF-8".toMediaType() + ) + return api.getEquipmentDetail(AuthenticationHelper.token!!, requestBody) + } } \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt deleted file mode 100644 index a5bb60b..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt +++ /dev/null @@ -1,104 +0,0 @@ -package com.casic.xz.meterage.view - -import android.annotation.SuppressLint -import android.graphics.Paint -import androidx.lifecycle.ViewModelProvider -import com.casic.xz.meterage.R -import com.casic.xz.meterage.extensions.combineImagePath -import com.casic.xz.meterage.extensions.formatTextFromHtml -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.vm.NoticeViewModel -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.extensions.convertColor -import com.pengxh.kt.lite.extensions.navigatePageTo -import com.pengxh.kt.lite.extensions.obtainScreenWidth -import com.pengxh.kt.lite.extensions.show -import com.pengxh.kt.lite.utils.Constant -import kotlinx.android.synthetic.main.activity_notice_detail.* -import kotlinx.android.synthetic.main.include_base_title.* -import java.util.* - -@SuppressLint("SetTextI18n") -class NoticeDetailActivity : KotlinBaseActivity() { - - private lateinit var noticeViewModel: NoticeViewModel - - override fun initData() { - leftBackView.setOnClickListener { finish() } - titleView.text = "通知公告" - - val args = intent.getStringArrayListExtra(Constant.INTENT_PARAM)!! - - noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] - noticeViewModel.getNoticeList(args[0], args[1], args[2], "", "", 1) - noticeViewModel.noticeResult.observe(this, { - if (it.code == 200) { - val dataRow = it.data?.rows!![0] - - noticeDateView.text = dataRow.noticeTime - noticePublisherView.text = "发布人 ${dataRow.noticePublisher}" - noticeCompanyView.text = "发布单位 ${dataRow.noticeCompany}" - - noticeNoView.text = dataRow.noticeNo - noticeTitleView.text = dataRow.noticeTitle - noticeSketchView.text = dataRow.noticeSketch - - dataRow.noticeContent.formatTextFromHtml( - this, noticeContentView, obtainScreenWidth() - ) - - if (dataRow.minioFileName.isNullOrBlank()) { - minioFileView.text = "暂无附件" - } else { - val minioFileName = dataRow.minioFileName - - minioFileView.text = minioFileName - val textPaint = minioFileView.paint - textPaint.flags = Paint.UNDERLINE_TEXT_FLAG - textPaint.isAntiAlias = true - minioFileView.setTextColor(R.color.themeColor.convertColor(this)) - - minioFileView.setOnClickListener { - //查看附件 - if (minioFileName.endsWith("pdf")) { - navigatePageTo(minioFileName) - } else if ( - minioFileName.endsWith("doc") || - minioFileName.endsWith("docx") - ) { - navigatePageTo(minioFileName) - } else if (minioFileName.endsWith("txt")) { - navigatePageTo(minioFileName) - } else if ( - minioFileName.endsWith("png") || - minioFileName.endsWith("jpeg") || - minioFileName.endsWith("jpg") - ) { - val urls = ArrayList() - urls.add(minioFileName.combineImagePath()) - navigatePageTo(0, urls) - } else { - "文件类型未知,无法打开附件".show(this) - } - } - } - } - }) - } - - override fun initEvent() { - - } - - override fun initLayoutView(): Int = R.layout.activity_notice_detail - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/NoticeListActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/NoticeListActivity.kt deleted file mode 100644 index 15f6a16..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/NoticeListActivity.kt +++ /dev/null @@ -1,180 +0,0 @@ -package com.casic.xz.meterage.view - -import android.os.Handler -import android.util.Log -import android.view.View -import androidx.lifecycle.ViewModelProvider -import com.casic.xz.meterage.R -import com.casic.xz.meterage.adapter.NoticeListAdapter -import com.casic.xz.meterage.extensions.addAll -import com.casic.xz.meterage.extensions.combineFilePath -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.extensions.showEmptyPage -import com.casic.xz.meterage.model.NoticeListModel -import com.casic.xz.meterage.vm.NoticeViewModel -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.extensions.navigatePageTo -import com.pengxh.kt.lite.extensions.show -import com.pengxh.kt.lite.utils.WeakReferenceHandler -import com.pengxh.kt.lite.widget.dialog.AlertControlDialog -import kotlinx.android.synthetic.main.activity_notice_list.* -import kotlinx.android.synthetic.main.include_empty_view.* - -class NoticeListActivity : KotlinBaseActivity() { - - private lateinit var weakReferenceHandler: WeakReferenceHandler - private lateinit var noticeViewModel: NoticeViewModel - private lateinit var noticeListAdapter: NoticeListAdapter - private var dataBeans: MutableList = ArrayList() - private var pageIndex = 1 - private var isRefresh = false - private var isLoadMore = false - - override fun initData() { - weakReferenceHandler = WeakReferenceHandler(callback) - noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] - noticeViewModel.noticeResult.observe(this, { - if (it.code == 200) { - val dataRows = it.data?.rows!! -// countBadeNumber(dataRows) - when { - isRefresh -> { - dataBeans.clear() - dataBeans = dataRows - noticeLayout.finishRefresh() - isRefresh = false - } - isLoadMore -> { - if (dataRows.size == 0) { - "到底了,别拉了".show(this) - } - dataBeans.addAll(dataRows) - noticeLayout.finishLoadMore() - isLoadMore = false - } - else -> { - dataBeans = dataRows - } - } - weakReferenceHandler.sendEmptyMessage(2023013101) - } - }) - } - - override fun initEvent() { - leftBackView.setOnClickListener { finish() } - rightOperateView.setOnClickListener { - AlertControlDialog.Builder() - .setContext(this) - .setTitle("提示") - .setMessage("确定将所有未读消息标为已读?") - .setNegativeButton("取消") - .setPositiveButton("确定") - .setOnDialogButtonClickListener(object : - AlertControlDialog.OnDialogButtonClickListener { - override fun onCancelClick() { - - } - - override fun onConfirmClick() { - //TODO 设置为已读 - } - }).build().show() - } - - if (hasNoticePermission()) { - openSystemNoticeLayout.visibility = View.GONE - openSystemNoticeLayout.visibility = View.GONE - } else { - openSystemNoticeLayout.setOnClickListener { - - } - - - closeLayoutView.setOnClickListener { - openSystemNoticeLayout.visibility = View.GONE - } - } - - noticeLayout.setOnRefreshListener { - isRefresh = true - //刷新之后页码重置 - pageIndex = 1 - getNoticeListByPage() - } - - noticeLayout.setOnLoadMoreListener { - isLoadMore = true - pageIndex++ - getNoticeListByPage() - } - } - - override fun onResume() { - super.onResume() - pageIndex = 1 - getNoticeListByPage() - } - - private fun getNoticeListByPage() { - noticeViewModel.getNoticeList("", "", "", "", "", pageIndex) - } - - private val callback = Handler.Callback { - when (it.what) { - 2023013101 -> { - if (isRefresh || isLoadMore) { - noticeListAdapter.notifyDataSetChanged() - } else { - if (dataBeans.size == 0) { - emptyView!!.showEmptyPage("没有任何消息") { - pageIndex = 1 - getNoticeListByPage() - } - } else { - emptyView!!.hide() - noticeListAdapter = NoticeListAdapter(this, dataBeans) - noticeRecyclerView.adapter = noticeListAdapter - noticeListAdapter.setOnItemClickListener(object : - NoticeListAdapter.OnItemClickListener { - override fun onItemClicked(position: Int) { - val rowsModel = dataBeans[position] - val allArgs = addAll( - rowsModel.noticeNo, - rowsModel.noticeTitle, - rowsModel.noticePublisher, - "", - "" - ) - Log.d( - "Casic", - "NoticeListActivity => onItemClicked: ${rowsModel.minioFileName.combineFilePath()}" - ) - navigatePageTo(allArgs) - } - }) - } - } - } - } - true - } - - //TODO 判断是否开启通知权限 - private fun hasNoticePermission(): Boolean { - - return false - } - - override fun initLayoutView(): Int = R.layout.activity_notice_list - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/PreviewDocumentActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/PreviewDocumentActivity.kt deleted file mode 100644 index e233ddc..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/PreviewDocumentActivity.kt +++ /dev/null @@ -1,24 +0,0 @@ -package com.casic.xz.meterage.view - -import com.casic.xz.meterage.R -import com.pengxh.kt.lite.base.KotlinBaseActivity - -class PreviewDocumentActivity : KotlinBaseActivity() { - override fun initData() { - - } - - override fun initEvent() { - - } - - override fun initLayoutView(): Int = R.layout.activity_preview_doc - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/PreviewPdfActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/PreviewPdfActivity.kt deleted file mode 100644 index 39f8ac2..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/PreviewPdfActivity.kt +++ /dev/null @@ -1,62 +0,0 @@ -package com.casic.xz.meterage.view - -import com.casic.xz.meterage.R -import com.casic.xz.meterage.extensions.combineFilePath -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.utils.LoadingDialogHub -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.callback.OnDownloadListener -import com.pengxh.kt.lite.extensions.createDownloadFileDir -import com.pengxh.kt.lite.extensions.downloadFile -import com.pengxh.kt.lite.utils.Constant -import kotlinx.android.synthetic.main.activity_preview_pdf.* -import kotlinx.android.synthetic.main.include_base_title.* -import java.io.File -import java.io.FileInputStream - - -class PreviewPdfActivity : KotlinBaseActivity() { - - override fun initData() { - val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! - titleView.text = minioFileName - - val url = minioFileName.combineFilePath() - url.downloadFile(createDownloadFileDir().toString(), - object : OnDownloadListener { - override fun onDownloadStart(totalBytes: Long) { - runOnUiThread { - LoadingDialogHub.show(this@PreviewPdfActivity, "附件加载中") - } - } - - override fun onProgressChanged(currentBytes: Long) { - - } - - override fun onDownloadEnd(file: File?) { - runOnUiThread { - LoadingDialogHub.dismiss() - } - val inputStream = FileInputStream(file) - pdfView.fromStream(inputStream).load() - } - }) - } - - override fun initEvent() { - leftBackView.setOnClickListener { finish() } - } - - override fun initLayoutView(): Int = R.layout.activity_preview_pdf - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/PreviewTextActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/PreviewTextActivity.kt deleted file mode 100644 index d634ca3..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/PreviewTextActivity.kt +++ /dev/null @@ -1,60 +0,0 @@ -package com.casic.xz.meterage.view - -import com.casic.xz.meterage.R -import com.casic.xz.meterage.extensions.combineFilePath -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.utils.LoadingDialogHub -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.callback.OnDownloadListener -import com.pengxh.kt.lite.extensions.createDownloadFileDir -import com.pengxh.kt.lite.extensions.downloadFile -import com.pengxh.kt.lite.extensions.read -import com.pengxh.kt.lite.utils.Constant -import kotlinx.android.synthetic.main.activity_preview_txt.* -import kotlinx.android.synthetic.main.include_base_title.* -import java.io.File - -class PreviewTextActivity : KotlinBaseActivity() { - - override fun initData() { - val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! - titleView.text = minioFileName - - val url = minioFileName.combineFilePath() - url.downloadFile(createDownloadFileDir().toString(), - object : OnDownloadListener { - override fun onDownloadStart(totalBytes: Long) { - runOnUiThread { - LoadingDialogHub.show(this@PreviewTextActivity, "附件加载中") - } - } - - override fun onProgressChanged(currentBytes: Long) { - - } - - override fun onDownloadEnd(file: File?) { - runOnUiThread { - LoadingDialogHub.dismiss() - textView.text = file?.read() - } - } - }) - } - - override fun initEvent() { - leftBackView.setOnClickListener { finish() } - } - - override fun initLayoutView(): Int = R.layout.activity_preview_txt - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentActivity.kt new file mode 100644 index 0000000..35ca098 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentActivity.kt @@ -0,0 +1,158 @@ +package com.casic.xz.meterage.view.home + +import android.os.Handler +import androidx.lifecycle.ViewModelProvider +import androidx.recyclerview.widget.DividerItemDecoration +import com.casic.xz.meterage.R +import com.casic.xz.meterage.adapter.EquipmentListAdapter +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.extensions.showEmptyPage +import com.casic.xz.meterage.model.EquipmentListModel +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.casic.xz.meterage.vm.EquipmentViewModel +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.extensions.navigatePageTo +import com.pengxh.kt.lite.extensions.show +import com.pengxh.kt.lite.utils.WeakReferenceHandler +import com.pengxh.kt.lite.vm.LoadState +import kotlinx.android.synthetic.main.activity_equipment.* +import kotlinx.android.synthetic.main.include_empty_view.* +import kotlinx.android.synthetic.main.include_search_title.* + +class EquipmentActivity : KotlinBaseActivity() { + + private lateinit var weakReferenceHandler: WeakReferenceHandler + private lateinit var equipmentViewModel: EquipmentViewModel + private lateinit var equipmentListAdapter: EquipmentListAdapter + private var dataBeans: MutableList = ArrayList() + private var pageIndex = 1 + private var isRefresh = false + private var isLoadMore = false + + override fun initData() { + weakReferenceHandler = WeakReferenceHandler(callback) + equipmentViewModel = ViewModelProvider(this)[EquipmentViewModel::class.java] + equipmentViewModel.equipmentResult.observe(this, { + if (it.code == 200) { + val dataRows = it.data?.rows!! + when { + isRefresh -> { + dataBeans.clear() + dataBeans = dataRows + equipmentLayout.finishRefresh() + isRefresh = false + } + isLoadMore -> { + if (dataRows.size == 0) { + "到底了,别拉了".show(this) + } + dataBeans.addAll(dataRows) + equipmentLayout.finishLoadMore() + isLoadMore = false + } + else -> { + dataBeans = dataRows + } + } + weakReferenceHandler.sendEmptyMessage(2023020801) + } + }) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + rightOperateView.setOnClickListener { + + } + + equipmentLayout.setOnRefreshListener { + isRefresh = true + //刷新之后页码重置 + pageIndex = 1 + getEquipmentListByPage() + } + + equipmentLayout.setOnLoadMoreListener { + isLoadMore = true + pageIndex++ + getEquipmentListByPage() + } + } + + override fun initLayoutView(): Int = R.layout.activity_equipment + + override fun observeRequestState() { + equipmentViewModel.loadState.observe(this, { + when (it) { + LoadState.Loading -> LoadingDialogHub.show(this, "数据加载中...") + else -> LoadingDialogHub.dismiss() + } + }) + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + titleView.text = "仪器设备" + } + + override fun onResume() { + super.onResume() + pageIndex = 1 + getEquipmentListByPage() + } + + private fun getEquipmentListByPage() { + equipmentViewModel.getEquipmentList( + "", + "", + "", + "", + "", + "1", + "", + "", + "", + "", + "", + "", + "", + "", + arrayOf(), + pageIndex + ) + } + + private val callback = Handler.Callback { + when (it.what) { + 2023020801 -> { + if (isRefresh || isLoadMore) { + equipmentListAdapter.notifyDataSetChanged() + } else { + if (dataBeans.size == 0) { + emptyView!!.showEmptyPage("无设备") { + pageIndex = 1 + getEquipmentListByPage() + } + } else { + emptyView!!.hide() + equipmentListAdapter = EquipmentListAdapter(this, dataBeans) + equipmentRecyclerView.addItemDecoration( + DividerItemDecoration(this, DividerItemDecoration.VERTICAL) + ) + equipmentRecyclerView.adapter = equipmentListAdapter + equipmentListAdapter.setOnItemClickListener(object : + EquipmentListAdapter.OnItemClickListener { + override fun onItemClicked(position: Int) { + val rowsModel = dataBeans[position] + navigatePageTo(rowsModel.id) + } + }) + } + } + } + } + true + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentDetailActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentDetailActivity.kt new file mode 100644 index 0000000..7dee13c --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentDetailActivity.kt @@ -0,0 +1,53 @@ +package com.casic.xz.meterage.view.home + +import androidx.fragment.app.Fragment +import com.casic.xz.meterage.R +import com.casic.xz.meterage.adapter.SubViewPagerAdapter +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.fragment.equipment.* +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.utils.Constant +import kotlinx.android.synthetic.main.activity_equipment.rootView +import kotlinx.android.synthetic.main.activity_equipment_detail.* +import kotlinx.android.synthetic.main.include_base_title.* + +class EquipmentDetailActivity : KotlinBaseActivity() { + + private var fragmentPages: ArrayList = ArrayList() + + override fun initData() { + val equipmentId = intent.getStringExtra(Constant.INTENT_PARAM)!! + + fragmentPages.add(BasicInformationFragment(equipmentId)) + fragmentPages.add(InspectionRecordFragment()) + fragmentPages.add(ChangeRecordFragment()) + fragmentPages.add(UsageRecordFragment()) + fragmentPages.add(CertificateFragment()) + + val equipmentPageTitles = arrayOf("基础信息", "周检记录", "状态变更记录", "使用记录", "检定证书") + + equipmentViewPager.adapter = SubViewPagerAdapter( + supportFragmentManager, fragmentPages, equipmentPageTitles + ) + equipmentViewPager.offscreenPageLimit = fragmentPages.size + //绑定 + topTabLayout.setupWithViewPager(equipmentViewPager) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + } + + override fun initLayoutView(): Int = R.layout.activity_equipment_detail + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + titleView.text = "仪器设备" + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeDetailActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeDetailActivity.kt new file mode 100644 index 0000000..6fe0022 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeDetailActivity.kt @@ -0,0 +1,105 @@ +package com.casic.xz.meterage.view.notice + +import android.annotation.SuppressLint +import android.graphics.Paint +import androidx.lifecycle.ViewModelProvider +import com.casic.xz.meterage.R +import com.casic.xz.meterage.extensions.combineImagePath +import com.casic.xz.meterage.extensions.formatTextFromHtml +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.view.BigImageActivity +import com.casic.xz.meterage.vm.NoticeViewModel +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.extensions.convertColor +import com.pengxh.kt.lite.extensions.navigatePageTo +import com.pengxh.kt.lite.extensions.obtainScreenWidth +import com.pengxh.kt.lite.extensions.show +import com.pengxh.kt.lite.utils.Constant +import kotlinx.android.synthetic.main.activity_notice_detail.* +import kotlinx.android.synthetic.main.include_base_title.* +import java.util.* + +@SuppressLint("SetTextI18n") +class NoticeDetailActivity : KotlinBaseActivity() { + + private lateinit var noticeViewModel: NoticeViewModel + + override fun initData() { + leftBackView.setOnClickListener { finish() } + titleView.text = "通知公告" + + val args = intent.getStringArrayListExtra(Constant.INTENT_PARAM)!! + + noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] + noticeViewModel.getNoticeList(args[0], args[1], args[2], "", "", 1) + noticeViewModel.noticeResult.observe(this, { + if (it.code == 200) { + val dataRow = it.data?.rows!![0] + + noticeDateView.text = dataRow.noticeTime + noticePublisherView.text = "发布人 ${dataRow.noticePublisher}" + noticeCompanyView.text = "发布单位 ${dataRow.noticeCompany}" + + noticeNoView.text = dataRow.noticeNo + noticeTitleView.text = dataRow.noticeTitle + noticeSketchView.text = dataRow.noticeSketch + + dataRow.noticeContent.formatTextFromHtml( + this, noticeContentView, obtainScreenWidth() + ) + + if (dataRow.minioFileName.isNullOrBlank()) { + minioFileView.text = "暂无附件" + } else { + val minioFileName = dataRow.minioFileName + + minioFileView.text = minioFileName + val textPaint = minioFileView.paint + textPaint.flags = Paint.UNDERLINE_TEXT_FLAG + textPaint.isAntiAlias = true + minioFileView.setTextColor(R.color.themeColor.convertColor(this)) + + minioFileView.setOnClickListener { + //查看附件 + if (minioFileName.endsWith("pdf")) { + navigatePageTo(minioFileName) + } else if ( + minioFileName.endsWith("doc") || + minioFileName.endsWith("docx") + ) { + navigatePageTo(minioFileName) + } else if (minioFileName.endsWith("txt")) { + navigatePageTo(minioFileName) + } else if ( + minioFileName.endsWith("png") || + minioFileName.endsWith("jpeg") || + minioFileName.endsWith("jpg") + ) { + val urls = ArrayList() + urls.add(minioFileName.combineImagePath()) + navigatePageTo(0, urls) + } else { + "文件类型未知,无法打开附件".show(this) + } + } + } + } + }) + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.activity_notice_detail + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeListActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeListActivity.kt new file mode 100644 index 0000000..31c0490 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeListActivity.kt @@ -0,0 +1,180 @@ +package com.casic.xz.meterage.view.notice + +import android.os.Handler +import android.util.Log +import android.view.View +import androidx.lifecycle.ViewModelProvider +import com.casic.xz.meterage.R +import com.casic.xz.meterage.adapter.NoticeListAdapter +import com.casic.xz.meterage.extensions.addAll +import com.casic.xz.meterage.extensions.combineFilePath +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.extensions.showEmptyPage +import com.casic.xz.meterage.model.NoticeListModel +import com.casic.xz.meterage.vm.NoticeViewModel +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.extensions.navigatePageTo +import com.pengxh.kt.lite.extensions.show +import com.pengxh.kt.lite.utils.WeakReferenceHandler +import com.pengxh.kt.lite.widget.dialog.AlertControlDialog +import kotlinx.android.synthetic.main.activity_notice_list.* +import kotlinx.android.synthetic.main.include_empty_view.* + +class NoticeListActivity : KotlinBaseActivity() { + + private lateinit var weakReferenceHandler: WeakReferenceHandler + private lateinit var noticeViewModel: NoticeViewModel + private lateinit var noticeListAdapter: NoticeListAdapter + private var dataBeans: MutableList = ArrayList() + private var pageIndex = 1 + private var isRefresh = false + private var isLoadMore = false + + override fun initData() { + weakReferenceHandler = WeakReferenceHandler(callback) + noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] + noticeViewModel.noticeResult.observe(this, { + if (it.code == 200) { + val dataRows = it.data?.rows!! +// countBadeNumber(dataRows) + when { + isRefresh -> { + dataBeans.clear() + dataBeans = dataRows + noticeLayout.finishRefresh() + isRefresh = false + } + isLoadMore -> { + if (dataRows.size == 0) { + "到底了,别拉了".show(this) + } + dataBeans.addAll(dataRows) + noticeLayout.finishLoadMore() + isLoadMore = false + } + else -> { + dataBeans = dataRows + } + } + weakReferenceHandler.sendEmptyMessage(2023013101) + } + }) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + rightOperateView.setOnClickListener { + AlertControlDialog.Builder() + .setContext(this) + .setTitle("提示") + .setMessage("确定将所有未读消息标为已读?") + .setNegativeButton("取消") + .setPositiveButton("确定") + .setOnDialogButtonClickListener(object : + AlertControlDialog.OnDialogButtonClickListener { + override fun onCancelClick() { + + } + + override fun onConfirmClick() { + //TODO 设置为已读 + } + }).build().show() + } + + if (hasNoticePermission()) { + openSystemNoticeLayout.visibility = View.GONE + openSystemNoticeLayout.visibility = View.GONE + } else { + openSystemNoticeLayout.setOnClickListener { + + } + + + closeLayoutView.setOnClickListener { + openSystemNoticeLayout.visibility = View.GONE + } + } + + noticeLayout.setOnRefreshListener { + isRefresh = true + //刷新之后页码重置 + pageIndex = 1 + getNoticeListByPage() + } + + noticeLayout.setOnLoadMoreListener { + isLoadMore = true + pageIndex++ + getNoticeListByPage() + } + } + + override fun onResume() { + super.onResume() + pageIndex = 1 + getNoticeListByPage() + } + + private fun getNoticeListByPage() { + noticeViewModel.getNoticeList("", "", "", "", "", pageIndex) + } + + private val callback = Handler.Callback { + when (it.what) { + 2023013101 -> { + if (isRefresh || isLoadMore) { + noticeListAdapter.notifyDataSetChanged() + } else { + if (dataBeans.size == 0) { + emptyView!!.showEmptyPage("没有任何消息") { + pageIndex = 1 + getNoticeListByPage() + } + } else { + emptyView!!.hide() + noticeListAdapter = NoticeListAdapter(this, dataBeans) + noticeRecyclerView.adapter = noticeListAdapter + noticeListAdapter.setOnItemClickListener(object : + NoticeListAdapter.OnItemClickListener { + override fun onItemClicked(position: Int) { + val rowsModel = dataBeans[position] + val allArgs = addAll( + rowsModel.noticeNo, + rowsModel.noticeTitle, + rowsModel.noticePublisher, + "", + "" + ) + Log.d( + "Casic", + "NoticeListActivity => onItemClicked: ${rowsModel.minioFileName.combineFilePath()}" + ) + navigatePageTo(allArgs) + } + }) + } + } + } + } + true + } + + //TODO 判断是否开启通知权限 + private fun hasNoticePermission(): Boolean { + + return false + } + + override fun initLayoutView(): Int = R.layout.activity_notice_list + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewDocumentActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewDocumentActivity.kt new file mode 100644 index 0000000..4b16ae8 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewDocumentActivity.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.view.notice + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseActivity + +class PreviewDocumentActivity : KotlinBaseActivity() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.activity_preview_doc + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewPdfActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewPdfActivity.kt new file mode 100644 index 0000000..fad73b6 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewPdfActivity.kt @@ -0,0 +1,62 @@ +package com.casic.xz.meterage.view.notice + +import com.casic.xz.meterage.R +import com.casic.xz.meterage.extensions.combineFilePath +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.callback.OnDownloadListener +import com.pengxh.kt.lite.extensions.createDownloadFileDir +import com.pengxh.kt.lite.extensions.downloadFile +import com.pengxh.kt.lite.utils.Constant +import kotlinx.android.synthetic.main.activity_preview_pdf.* +import kotlinx.android.synthetic.main.include_base_title.* +import java.io.File +import java.io.FileInputStream + + +class PreviewPdfActivity : KotlinBaseActivity() { + + override fun initData() { + val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! + titleView.text = minioFileName + + val url = minioFileName.combineFilePath() + url.downloadFile(createDownloadFileDir().toString(), + object : OnDownloadListener { + override fun onDownloadStart(totalBytes: Long) { + runOnUiThread { + LoadingDialogHub.show(this@PreviewPdfActivity, "附件加载中") + } + } + + override fun onProgressChanged(currentBytes: Long) { + + } + + override fun onDownloadEnd(file: File?) { + runOnUiThread { + LoadingDialogHub.dismiss() + } + val inputStream = FileInputStream(file) + pdfView.fromStream(inputStream).load() + } + }) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + } + + override fun initLayoutView(): Int = R.layout.activity_preview_pdf + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewTextActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewTextActivity.kt new file mode 100644 index 0000000..d7850fb --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewTextActivity.kt @@ -0,0 +1,60 @@ +package com.casic.xz.meterage.view.notice + +import com.casic.xz.meterage.R +import com.casic.xz.meterage.extensions.combineFilePath +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.callback.OnDownloadListener +import com.pengxh.kt.lite.extensions.createDownloadFileDir +import com.pengxh.kt.lite.extensions.downloadFile +import com.pengxh.kt.lite.extensions.read +import com.pengxh.kt.lite.utils.Constant +import kotlinx.android.synthetic.main.activity_preview_txt.* +import kotlinx.android.synthetic.main.include_base_title.* +import java.io.File + +class PreviewTextActivity : KotlinBaseActivity() { + + override fun initData() { + val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! + titleView.text = minioFileName + + val url = minioFileName.combineFilePath() + url.downloadFile(createDownloadFileDir().toString(), + object : OnDownloadListener { + override fun onDownloadStart(totalBytes: Long) { + runOnUiThread { + LoadingDialogHub.show(this@PreviewTextActivity, "附件加载中") + } + } + + override fun onProgressChanged(currentBytes: Long) { + + } + + override fun onDownloadEnd(file: File?) { + runOnUiThread { + LoadingDialogHub.dismiss() + textView.text = file?.read() + } + } + }) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + } + + override fun initLayoutView(): Int = R.layout.activity_preview_txt + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/vm/EquipmentViewModel.kt b/app/src/main/java/com/casic/xz/meterage/vm/EquipmentViewModel.kt new file mode 100644 index 0000000..b5f21f6 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/vm/EquipmentViewModel.kt @@ -0,0 +1,92 @@ +package com.casic.xz.meterage.vm + +import androidx.lifecycle.MutableLiveData +import com.casic.xz.meterage.base.BaseApplication +import com.casic.xz.meterage.extensions.separateResponseCode +import com.casic.xz.meterage.extensions.toErrorMessage +import com.casic.xz.meterage.model.EquipmentDetailModel +import com.casic.xz.meterage.model.EquipmentListModel +import com.casic.xz.meterage.utils.retrofit.RetrofitServiceManager +import com.google.gson.Gson +import com.google.gson.reflect.TypeToken +import com.pengxh.kt.lite.extensions.launch +import com.pengxh.kt.lite.extensions.show +import com.pengxh.kt.lite.vm.BaseViewModel +import com.pengxh.kt.lite.vm.LoadState + +class EquipmentViewModel : BaseViewModel() { + + private val gson by lazy { Gson() } + val equipmentResult = MutableLiveData() + val equipmentDetailResult = MutableLiveData() + + fun getEquipmentList( + equipmentNo: String, + equipmentName: String, + mesureType: String, + managerState: String, + useDept: String, + assetType: String, + equipmentCategory: String, + isCalibrationTestEquipment: String, + isMeasureAccount: String, + isStandardSupportEquipment: String, + isFixedAssets: String, + validStartDate: String, + validEndDate: String, + abc: String, + ids: Array, + offset: Int + ) = launch({ + loadState.value = LoadState.Loading + val response = RetrofitServiceManager.getEquipmentList( + equipmentNo, + equipmentName, + mesureType, + managerState, + useDept, + assetType, + equipmentCategory, + isCalibrationTestEquipment, + isMeasureAccount, + isStandardSupportEquipment, + isFixedAssets, + validStartDate, + validEndDate, + abc, + ids, + offset + ) + val responseCode = response.separateResponseCode() + if (responseCode == 200) { + loadState.value = LoadState.Success + equipmentResult.value = gson.fromJson( + response, object : TypeToken() {}.type + ) + } else { + loadState.value = LoadState.Fail + response.toErrorMessage().show(BaseApplication.get()) + } + }, { + loadState.value = LoadState.Fail + it.printStackTrace() + }) + + fun getEquipmentDetail(id: String) = launch({ + loadState.value = LoadState.Loading + val response = RetrofitServiceManager.getEquipmentDetail(id) + val responseCode = response.separateResponseCode() + if (responseCode == 200) { + loadState.value = LoadState.Success + equipmentDetailResult.value = gson.fromJson( + response, object : TypeToken() {}.type + ) + } else { + loadState.value = LoadState.Fail + response.toErrorMessage().show(BaseApplication.get()) + } + }, { + loadState.value = LoadState.Fail + it.printStackTrace() + }) +} \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_sorting.xml b/app/src/main/res/drawable/ic_sorting.xml new file mode 100644 index 0000000..252bfe6 --- /dev/null +++ b/app/src/main/res/drawable/ic_sorting.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/layout/activity_equipment.xml b/app/src/main/res/layout/activity_equipment.xml new file mode 100644 index 0000000..d6a64b1 --- /dev/null +++ b/app/src/main/res/layout/activity_equipment.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_equipment_detail.xml b/app/src/main/res/layout/activity_equipment_detail.xml new file mode 100644 index 0000000..7254762 --- /dev/null +++ b/app/src/main/res/layout/activity_equipment_detail.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_basic_information.xml b/app/src/main/res/layout/fragment_basic_information.xml new file mode 100644 index 0000000..4a3c1c7 --- /dev/null +++ b/app/src/main/res/layout/fragment_basic_information.xml @@ -0,0 +1,390 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_certificate.xml b/app/src/main/res/layout/fragment_certificate.xml new file mode 100644 index 0000000..77d9ef6 --- /dev/null +++ b/app/src/main/res/layout/fragment_certificate.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_change_record.xml b/app/src/main/res/layout/fragment_change_record.xml new file mode 100644 index 0000000..77d9ef6 --- /dev/null +++ b/app/src/main/res/layout/fragment_change_record.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_home.xml b/app/src/main/res/layout/fragment_home.xml index 41b32a9..e1ab759 100644 --- a/app/src/main/res/layout/fragment_home.xml +++ b/app/src/main/res/layout/fragment_home.xml @@ -71,7 +71,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" app:layoutManager="androidx.recyclerview.widget.GridLayoutManager" - app:spanCount="5" /> + app:spanCount="4" /> + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_mine.xml b/app/src/main/res/layout/fragment_mine.xml index 0643064..d9f57b3 100644 --- a/app/src/main/res/layout/fragment_mine.xml +++ b/app/src/main/res/layout/fragment_mine.xml @@ -22,10 +22,10 @@ android:orientation="horizontal"> + android:src="@mipmap/default_avatar" /> @@ -122,7 +122,7 @@ android:background="@drawable/ic_collection" /> @@ -145,7 +145,7 @@ android:background="@drawable/ic_push_setting" /> @@ -166,7 +166,7 @@ android:background="@drawable/ic_privacy" /> @@ -189,7 +189,7 @@ android:background="@drawable/ic_help" /> @@ -210,7 +210,7 @@ android:background="@drawable/ic_update" /> @@ -231,7 +231,7 @@ android:background="@drawable/ic_about" /> @@ -252,7 +252,7 @@ android:background="@drawable/ic_back" /> diff --git a/app/src/main/res/layout/fragment_usage_record.xml b/app/src/main/res/layout/fragment_usage_record.xml new file mode 100644 index 0000000..77d9ef6 --- /dev/null +++ b/app/src/main/res/layout/fragment_usage_record.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/include_equipment_layout.xml b/app/src/main/res/layout/include_equipment_layout.xml new file mode 100644 index 0000000..ce846d5 --- /dev/null +++ b/app/src/main/res/layout/include_equipment_layout.xml @@ -0,0 +1,74 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/include_line_view.xml b/app/src/main/res/layout/include_line_view.xml new file mode 100644 index 0000000..ff89de3 --- /dev/null +++ b/app/src/main/res/layout/include_line_view.xml @@ -0,0 +1,5 @@ + + \ No newline at end of file diff --git a/app/src/main/res/layout/include_search_title.xml b/app/src/main/res/layout/include_search_title.xml new file mode 100644 index 0000000..644fa4c --- /dev/null +++ b/app/src/main/res/layout/include_search_title.xml @@ -0,0 +1,35 @@ + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 3892b5a..02160cd 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -34,16 +34,18 @@ - - - - - - - + + + + + + + + + +) : RecyclerView.Adapter() { + + private var layoutInflater: LayoutInflater = LayoutInflater.from(context) + + override fun getItemCount(): Int = dataRows.size + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = ItemViewHolder( + layoutInflater.inflate(R.layout.item_equipment_rv_l, parent, false) + ) + + override fun onBindViewHolder(holder: ItemViewHolder, position: Int) { + //绑定数据 + val rowsBean = dataRows[position] + holder.equipmentNameView.text = rowsBean.equipmentName + holder.equipmentCodeView.text = rowsBean.equipmentNo + holder.equipmentDateView.text = rowsBean.enableDate + holder.equipmentLibView.text = rowsBean.useDeptName + + //绑定事件 + holder.itemView.setOnClickListener { + listener?.onItemClicked(position) + } + } + + inner class ItemViewHolder(view: View) : RecyclerView.ViewHolder(view) { + var equipmentNameView: TextView = view.findViewById(R.id.equipmentNameView) + var equipmentCodeView: TextView = view.findViewById(R.id.equipmentCodeView) + var equipmentDateView: TextView = view.findViewById(R.id.equipmentDateView) + var equipmentLibView: TextView = view.findViewById(R.id.equipmentLibView) + } + + private var listener: OnItemClickListener? = null + + interface OnItemClickListener { + fun onItemClicked(position: Int) + } + + fun setOnItemClickListener(onClickListener: OnItemClickListener?) { + this.listener = onClickListener + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt index b4628f3..d970b55 100644 --- a/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt +++ b/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt @@ -5,7 +5,8 @@ import com.casic.xz.meterage.R import com.casic.xz.meterage.adapter.HomeGridAdapter import com.casic.xz.meterage.utils.LocaleConstant -import com.casic.xz.meterage.view.NoticeListActivity +import com.casic.xz.meterage.view.home.EquipmentActivity +import com.casic.xz.meterage.view.notice.NoticeListActivity import com.casic.xz.meterage.vm.NoticeViewModel import com.pengxh.kt.lite.base.KotlinBaseFragment import com.pengxh.kt.lite.extensions.navigatePageTo @@ -36,8 +37,19 @@ homeFuncRecyclerView.adapter = homeAdapter homeAdapter.setOnGridItemClickListener(object : HomeGridAdapter.OnGridItemClickListener { override fun onItemClick(position: Int) { - when (position) { - + when (LocaleConstant.HOME_FUNC_OPERATE[position]) { + "仪器设备" -> requireContext().navigatePageTo() +// "标准装置" -> requireContext().navigatePageTo() +// "证书报告" -> requireContext().navigatePageTo() +// "委托需求" -> requireContext().navigatePageTo() +// "访客" -> requireContext().navigatePageTo() +// "标准规范" -> requireContext().navigatePageTo() +// "能力列表" -> requireContext().navigatePageTo() +// "计量培训" -> requireContext().navigatePageTo() +// "合同发票" -> requireContext().navigatePageTo() +// "业务统计" -> requireContext().navigatePageTo() +// "客户列表" -> requireContext().navigatePageTo() +// "外场检测" -> requireContext().navigatePageTo() } } }) diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt index 7e75abe..56dc5ec 100644 --- a/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt +++ b/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt @@ -2,9 +2,11 @@ import android.view.View import androidx.lifecycle.ViewModelProvider +import com.bumptech.glide.Glide +import com.bumptech.glide.request.RequestOptions import com.casic.xz.meterage.R import com.casic.xz.meterage.utils.LocaleConstant -import com.casic.xz.meterage.view.NoticeListActivity +import com.casic.xz.meterage.view.notice.NoticeListActivity import com.casic.xz.meterage.vm.NoticeViewModel import com.casic.xz.meterage.vm.UserViewModel import com.pengxh.kt.lite.base.KotlinBaseFragment @@ -23,6 +25,12 @@ val data = it.data userNameView.text = data.name userUnitView.text = data.deptName + +// Glide.with(requireContext()) +// .load(R.mipmap.default_avatar) +// .apply(RequestOptions.circleCropTransform()) +// .placeholder(R.mipmap.load_image_error) +// .into(userAvatarView) } }) diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt new file mode 100644 index 0000000..cf22646 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt @@ -0,0 +1,103 @@ +package com.casic.xz.meterage.fragment.equipment + +import android.graphics.Paint +import androidx.lifecycle.ViewModelProvider +import com.casic.xz.meterage.R +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.casic.xz.meterage.vm.EquipmentViewModel +import com.pengxh.kt.lite.base.KotlinBaseFragment +import com.pengxh.kt.lite.extensions.convertColor +import com.pengxh.kt.lite.vm.LoadState +import kotlinx.android.synthetic.main.fragment_basic_information.* + +class BasicInformationFragment(private val id: String) : KotlinBaseFragment() { + + private lateinit var equipmentViewModel: EquipmentViewModel + + override fun initData() { + equipmentViewModel = ViewModelProvider(this)[EquipmentViewModel::class.java] + equipmentViewModel.getEquipmentDetail(id) + equipmentViewModel.equipmentDetailResult.observe(this, { + if (it.code == 200) { + val data = it.data!! + + equipmentCodeView.text = data.equipmentNo + equipmentNameView.text = data.equipmentName + manufacturerView.text = data.manufacturer + factoryNumberView.text = data.manufacturingNo + modelView.text = data.modelNo + verificationMethodView.text = data.mesureTypeName + measuringRangeView.text = data.mesureRange + uncertaintyView.text = data.uncertainty + firstUseView.text = data.createTime + originalValueView.text = data.originValue + usageDeptView.text = data.useDeptName + userView.text = data.usePersonName + managementStatusView.text = data.managerStateName + verificationDeptView.text = data.useDeptName +// nextVerificationDeptView.text = data. + verificationPeriodView.text = data.mesureCycle + verificationDateView.text = data.mesureDate + effectiveDateView.text = data.validDate + verificationResultsView.text = data.mesureResultName + abcView.text = data.abcName + isNeedTechnicalView.text = if ( + data.isCalibrationTestEquipment.isNullOrBlank() || data.isCalibrationTestEquipment == "0" + ) { + "否" + } else { + "是" + } + + isStandingBook.text = if ( + data.isMeasureAccount.isNullOrBlank() || data.isMeasureAccount == "0" + ) { + "否" + } else { + "是" + } + + isStandardView.text = if ( + data.isStandardSupportEquipment.isNullOrBlank() || data.isStandardSupportEquipment == "0" + ) { + "否" + } else { + "是" + } + remarkView.text = data.remark + if (data.fileList.size == 0) { + instructionsView.text = "暂无" + } else { + instructionsView.text = "查看附件列表" + val textPaint = instructionsView.paint + textPaint.flags = Paint.UNDERLINE_TEXT_FLAG + textPaint.isAntiAlias = true + instructionsView.setTextColor(R.color.themeColor.convertColor(requireContext())) + + instructionsView.setOnClickListener { + + } + } + } + }) + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_basic_information + + override fun observeRequestState() { + equipmentViewModel.loadState.observe(this, { + when (it) { + LoadState.Loading -> LoadingDialogHub.show(requireActivity(), "数据加载中...") + else -> LoadingDialogHub.dismiss() + } + }) + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt new file mode 100644 index 0000000..0b4a747 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class CertificateFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_certificate + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt new file mode 100644 index 0000000..f05c491 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class ChangeRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_change_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt new file mode 100644 index 0000000..849ffa5 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class InspectionRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_inspection_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt new file mode 100644 index 0000000..aa4edd9 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class UsageRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_usage_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java b/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java new file mode 100644 index 0000000..0b9124e --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java @@ -0,0 +1,760 @@ +package com.casic.xz.meterage.model; + +import java.util.List; + +public class EquipmentDetailModel { + + private int code; + private DataModel data; + private String message; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataModel getData() { + return data; + } + + public void setData(DataModel data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public static class DataModel { + private String abc; + private String abcName; + private String assetNo; + private String assetSource; + private String assetType; + private String assetTypeName; + private String attribute; + private String capitalSource; + private String capitalSourceName; + private String cardEstablishmentDate; + private String createTime; + private String createUser; + private String depreciationMethod; + private String depreciationMethodName; + private String depreciationPeriod; + private String enableDate; + private String equipmentCategory; + private String equipmentCategoryName; + private String equipmentName; + private String equipmentNo; + private String equipmentSpecifications; + private String equipmentType; + private String equipmentTypeName; + private List fileList; + private String id; + private String installIncidentalExpenses; + private String installPlace; + private String intactState; + private String isCalibrationTestEquipment; + private int isDel; + private String isFixedAssets; + private String isMeasureAccount; + private String isStandardSupportEquipment; + private String labelBind; + private String majorCategory; + private String majorCategoryName; + private String managerLevel; + private String managerLevelName; + private String managerState; + private String managerStateName; + private String manufacturer; + private String manufacturerCountry; + private String manufacturingDate; + private String manufacturingNo; + private String mesureCycle; + private String mesureDate; + private String mesureDept; + private String mesureRange; + private String mesureResult; + private String mesureResultName; + private String mesureType; + private String mesureTypeName; + private String modelNo; + private String originValue; + private String overallDimension; + private String presentOriginValue; + private String purpose; + private String remark; + private String singlePrice; + private String supportStandardEquipmentName; + private String supportStandardEquipmentNo; + private String technicalLevel; + private String uncertainty; + private String updateTime; + private String useDept; + private String useDeptName; + private String usePerson; + private String usePersonName; + private String validDate; + private int version; + private String weight; + + public String getAbc() { + return abc; + } + + public void setAbc(String abc) { + this.abc = abc; + } + + public String getAbcName() { + return abcName; + } + + public void setAbcName(String abcName) { + this.abcName = abcName; + } + + public String getAssetNo() { + return assetNo; + } + + public void setAssetNo(String assetNo) { + this.assetNo = assetNo; + } + + public String getAssetSource() { + return assetSource; + } + + public void setAssetSource(String assetSource) { + this.assetSource = assetSource; + } + + public String getAssetType() { + return assetType; + } + + public void setAssetType(String assetType) { + this.assetType = assetType; + } + + public String getAssetTypeName() { + return assetTypeName; + } + + public void setAssetTypeName(String assetTypeName) { + this.assetTypeName = assetTypeName; + } + + public String getAttribute() { + return attribute; + } + + public void setAttribute(String attribute) { + this.attribute = attribute; + } + + public String getCapitalSource() { + return capitalSource; + } + + public void setCapitalSource(String capitalSource) { + this.capitalSource = capitalSource; + } + + public String getCapitalSourceName() { + return capitalSourceName; + } + + public void setCapitalSourceName(String capitalSourceName) { + this.capitalSourceName = capitalSourceName; + } + + public String getCardEstablishmentDate() { + return cardEstablishmentDate; + } + + public void setCardEstablishmentDate(String cardEstablishmentDate) { + this.cardEstablishmentDate = cardEstablishmentDate; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getDepreciationMethod() { + return depreciationMethod; + } + + public void setDepreciationMethod(String depreciationMethod) { + this.depreciationMethod = depreciationMethod; + } + + public String getDepreciationMethodName() { + return depreciationMethodName; + } + + public void setDepreciationMethodName(String depreciationMethodName) { + this.depreciationMethodName = depreciationMethodName; + } + + public String getDepreciationPeriod() { + return depreciationPeriod; + } + + public void setDepreciationPeriod(String depreciationPeriod) { + this.depreciationPeriod = depreciationPeriod; + } + + public String getEnableDate() { + return enableDate; + } + + public void setEnableDate(String enableDate) { + this.enableDate = enableDate; + } + + public String getEquipmentCategory() { + return equipmentCategory; + } + + public void setEquipmentCategory(String equipmentCategory) { + this.equipmentCategory = equipmentCategory; + } + + public String getEquipmentCategoryName() { + return equipmentCategoryName; + } + + public void setEquipmentCategoryName(String equipmentCategoryName) { + this.equipmentCategoryName = equipmentCategoryName; + } + + public String getEquipmentName() { + return equipmentName; + } + + public void setEquipmentName(String equipmentName) { + this.equipmentName = equipmentName; + } + + public String getEquipmentNo() { + return equipmentNo; + } + + public void setEquipmentNo(String equipmentNo) { + this.equipmentNo = equipmentNo; + } + + public String getEquipmentSpecifications() { + return equipmentSpecifications; + } + + public void setEquipmentSpecifications(String equipmentSpecifications) { + this.equipmentSpecifications = equipmentSpecifications; + } + + public String getEquipmentType() { + return equipmentType; + } + + public void setEquipmentType(String equipmentType) { + this.equipmentType = equipmentType; + } + + public String getEquipmentTypeName() { + return equipmentTypeName; + } + + public void setEquipmentTypeName(String equipmentTypeName) { + this.equipmentTypeName = equipmentTypeName; + } + + public List getFileList() { + return fileList; + } + + public void setFileList(List fileList) { + this.fileList = fileList; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getInstallIncidentalExpenses() { + return installIncidentalExpenses; + } + + public void setInstallIncidentalExpenses(String installIncidentalExpenses) { + this.installIncidentalExpenses = installIncidentalExpenses; + } + + public String getInstallPlace() { + return installPlace; + } + + public void setInstallPlace(String installPlace) { + this.installPlace = installPlace; + } + + public String getIntactState() { + return intactState; + } + + public void setIntactState(String intactState) { + this.intactState = intactState; + } + + public String getIsCalibrationTestEquipment() { + return isCalibrationTestEquipment; + } + + public void setIsCalibrationTestEquipment(String isCalibrationTestEquipment) { + this.isCalibrationTestEquipment = isCalibrationTestEquipment; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getIsFixedAssets() { + return isFixedAssets; + } + + public void setIsFixedAssets(String isFixedAssets) { + this.isFixedAssets = isFixedAssets; + } + + public String getIsMeasureAccount() { + return isMeasureAccount; + } + + public void setIsMeasureAccount(String isMeasureAccount) { + this.isMeasureAccount = isMeasureAccount; + } + + public String getIsStandardSupportEquipment() { + return isStandardSupportEquipment; + } + + public void setIsStandardSupportEquipment(String isStandardSupportEquipment) { + this.isStandardSupportEquipment = isStandardSupportEquipment; + } + + public String getLabelBind() { + return labelBind; + } + + public void setLabelBind(String labelBind) { + this.labelBind = labelBind; + } + + public String getMajorCategory() { + return majorCategory; + } + + public void setMajorCategory(String majorCategory) { + this.majorCategory = majorCategory; + } + + public String getMajorCategoryName() { + return majorCategoryName; + } + + public void setMajorCategoryName(String majorCategoryName) { + this.majorCategoryName = majorCategoryName; + } + + public String getManagerLevel() { + return managerLevel; + } + + public void setManagerLevel(String managerLevel) { + this.managerLevel = managerLevel; + } + + public String getManagerLevelName() { + return managerLevelName; + } + + public void setManagerLevelName(String managerLevelName) { + this.managerLevelName = managerLevelName; + } + + public String getManagerState() { + return managerState; + } + + public void setManagerState(String managerState) { + this.managerState = managerState; + } + + public String getManagerStateName() { + return managerStateName; + } + + public void setManagerStateName(String managerStateName) { + this.managerStateName = managerStateName; + } + + public String getManufacturer() { + return manufacturer; + } + + public void setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + } + + public String getManufacturerCountry() { + return manufacturerCountry; + } + + public void setManufacturerCountry(String manufacturerCountry) { + this.manufacturerCountry = manufacturerCountry; + } + + public String getManufacturingDate() { + return manufacturingDate; + } + + public void setManufacturingDate(String manufacturingDate) { + this.manufacturingDate = manufacturingDate; + } + + public String getManufacturingNo() { + return manufacturingNo; + } + + public void setManufacturingNo(String manufacturingNo) { + this.manufacturingNo = manufacturingNo; + } + + public String getMesureCycle() { + return mesureCycle; + } + + public void setMesureCycle(String mesureCycle) { + this.mesureCycle = mesureCycle; + } + + public String getMesureDate() { + return mesureDate; + } + + public void setMesureDate(String mesureDate) { + this.mesureDate = mesureDate; + } + + public String getMesureDept() { + return mesureDept; + } + + public void setMesureDept(String mesureDept) { + this.mesureDept = mesureDept; + } + + public String getMesureRange() { + return mesureRange; + } + + public void setMesureRange(String mesureRange) { + this.mesureRange = mesureRange; + } + + public String getMesureResult() { + return mesureResult; + } + + public void setMesureResult(String mesureResult) { + this.mesureResult = mesureResult; + } + + public String getMesureResultName() { + return mesureResultName; + } + + public void setMesureResultName(String mesureResultName) { + this.mesureResultName = mesureResultName; + } + + public String getMesureType() { + return mesureType; + } + + public void setMesureType(String mesureType) { + this.mesureType = mesureType; + } + + public String getMesureTypeName() { + return mesureTypeName; + } + + public void setMesureTypeName(String mesureTypeName) { + this.mesureTypeName = mesureTypeName; + } + + public String getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getOriginValue() { + return originValue; + } + + public void setOriginValue(String originValue) { + this.originValue = originValue; + } + + public String getOverallDimension() { + return overallDimension; + } + + public void setOverallDimension(String overallDimension) { + this.overallDimension = overallDimension; + } + + public String getPresentOriginValue() { + return presentOriginValue; + } + + public void setPresentOriginValue(String presentOriginValue) { + this.presentOriginValue = presentOriginValue; + } + + public String getPurpose() { + return purpose; + } + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getSinglePrice() { + return singlePrice; + } + + public void setSinglePrice(String singlePrice) { + this.singlePrice = singlePrice; + } + + public String getSupportStandardEquipmentName() { + return supportStandardEquipmentName; + } + + public void setSupportStandardEquipmentName(String supportStandardEquipmentName) { + this.supportStandardEquipmentName = supportStandardEquipmentName; + } + + public String getSupportStandardEquipmentNo() { + return supportStandardEquipmentNo; + } + + public void setSupportStandardEquipmentNo(String supportStandardEquipmentNo) { + this.supportStandardEquipmentNo = supportStandardEquipmentNo; + } + + public String getTechnicalLevel() { + return technicalLevel; + } + + public void setTechnicalLevel(String technicalLevel) { + this.technicalLevel = technicalLevel; + } + + public String getUncertainty() { + return uncertainty; + } + + public void setUncertainty(String uncertainty) { + this.uncertainty = uncertainty; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getUseDept() { + return useDept; + } + + public void setUseDept(String useDept) { + this.useDept = useDept; + } + + public String getUseDeptName() { + return useDeptName; + } + + public void setUseDeptName(String useDeptName) { + this.useDeptName = useDeptName; + } + + public String getUsePerson() { + return usePerson; + } + + public void setUsePerson(String usePerson) { + this.usePerson = usePerson; + } + + public String getUsePersonName() { + return usePersonName; + } + + public void setUsePersonName(String usePersonName) { + this.usePersonName = usePersonName; + } + + public String getValidDate() { + return validDate; + } + + public void setValidDate(String validDate) { + this.validDate = validDate; + } + + public int getVersion() { + return version; + } + + public void setVersion(int version) { + this.version = version; + } + + public String getWeight() { + return weight; + } + + public void setWeight(String weight) { + this.weight = weight; + } + + public static class FileListModel { + private String assetId; + private String createTime; + private String createUser; + private String fileName; + private String id; + private int isDel; + private String minioFileName; + private String remark; + private String updateTime; + + public String getAssetId() { + return assetId; + } + + public void setAssetId(String assetId) { + this.assetId = assetId; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getFileName() { + return fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getMinioFileName() { + return minioFileName; + } + + public void setMinioFileName(String minioFileName) { + this.minioFileName = minioFileName; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + } + } +} diff --git a/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java b/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java new file mode 100644 index 0000000..15fc128 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java @@ -0,0 +1,697 @@ +package com.casic.xz.meterage.model; + +import java.util.List; + +public class EquipmentListModel { + + private int code; + private DataModel data; + private String message; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataModel getData() { + return data; + } + + public void setData(DataModel data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public static class DataModel { + private List rows; + private int total; + + public List getRows() { + return rows; + } + + public void setRows(List rows) { + this.rows = rows; + } + + public int getTotal() { + return total; + } + + public void setTotal(int total) { + this.total = total; + } + + public static class RowsModel { + private String abc; + private String abcName; + private String assetNo; + private String assetSource; + private String assetType; + private String assetTypeName; + private String attribute; + private String capitalSource; + private String capitalSourceName; + private String cardEstablishmentDate; + private String createTime; + private String createUser; + private String depreciationMethod; + private String depreciationMethodName; + private String depreciationPeriod; + private String enableDate; + private String equipmentCategory; + private String equipmentCategoryName; + private String equipmentName; + private String equipmentNo; + private String equipmentSpecifications; + private String equipmentType; + private String equipmentTypeName; + private String fileList; + private String id; + private String installIncidentalExpenses; + private String installPlace; + private String intactState; + private String isCalibrationTestEquipment; + private int isDel; + private String isFixedAssets; + private String isMeasureAccount; + private String isStandardSupportEquipment; + private String labelBind; + private String majorCategory; + private String majorCategoryName; + private String managerLevel; + private String managerLevelName; + private String managerState; + private String managerStateName; + private String manufacturer; + private String manufacturerCountry; + private String manufacturingDate; + private String manufacturingNo; + private String mesureCycle; + private String mesureDate; + private String mesureDept; + private String mesureRange; + private String mesureResult; + private String mesureResultName; + private String mesureType; + private String mesureTypeName; + private String modelNo; + private String originValue; + private String overallDimension; + private String presentOriginValue; + private String purpose; + private String remark; + private String singlePrice; + private String supportStandardEquipmentName; + private String supportStandardEquipmentNo; + private String technicalLevel; + private String uncertainty; + private String updateTime; + private String useDept; + private String useDeptName; + private String usePerson; + private String usePersonName; + private String validDate; + private int version; + private String weight; + + public String getAbc() { + return abc; + } + + public void setAbc(String abc) { + this.abc = abc; + } + + public String getAbcName() { + return abcName; + } + + public void setAbcName(String abcName) { + this.abcName = abcName; + } + + public String getAssetNo() { + return assetNo; + } + + public void setAssetNo(String assetNo) { + this.assetNo = assetNo; + } + + public String getAssetSource() { + return assetSource; + } + + public void setAssetSource(String assetSource) { + this.assetSource = assetSource; + } + + public String getAssetType() { + return assetType; + } + + public void setAssetType(String assetType) { + this.assetType = assetType; + } + + public String getAssetTypeName() { + return assetTypeName; + } + + public void setAssetTypeName(String assetTypeName) { + this.assetTypeName = assetTypeName; + } + + public String getAttribute() { + return attribute; + } + + public void setAttribute(String attribute) { + this.attribute = attribute; + } + + public String getCapitalSource() { + return capitalSource; + } + + public void setCapitalSource(String capitalSource) { + this.capitalSource = capitalSource; + } + + public String getCapitalSourceName() { + return capitalSourceName; + } + + public void setCapitalSourceName(String capitalSourceName) { + this.capitalSourceName = capitalSourceName; + } + + public String getCardEstablishmentDate() { + return cardEstablishmentDate; + } + + public void setCardEstablishmentDate(String cardEstablishmentDate) { + this.cardEstablishmentDate = cardEstablishmentDate; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getDepreciationMethod() { + return depreciationMethod; + } + + public void setDepreciationMethod(String depreciationMethod) { + this.depreciationMethod = depreciationMethod; + } + + public String getDepreciationMethodName() { + return depreciationMethodName; + } + + public void setDepreciationMethodName(String depreciationMethodName) { + this.depreciationMethodName = depreciationMethodName; + } + + public String getDepreciationPeriod() { + return depreciationPeriod; + } + + public void setDepreciationPeriod(String depreciationPeriod) { + this.depreciationPeriod = depreciationPeriod; + } + + public String getEnableDate() { + return enableDate; + } + + public void setEnableDate(String enableDate) { + this.enableDate = enableDate; + } + + public String getEquipmentCategory() { + return equipmentCategory; + } + + public void setEquipmentCategory(String equipmentCategory) { + this.equipmentCategory = equipmentCategory; + } + + public String getEquipmentCategoryName() { + return equipmentCategoryName; + } + + public void setEquipmentCategoryName(String equipmentCategoryName) { + this.equipmentCategoryName = equipmentCategoryName; + } + + public String getEquipmentName() { + return equipmentName; + } + + public void setEquipmentName(String equipmentName) { + this.equipmentName = equipmentName; + } + + public String getEquipmentNo() { + return equipmentNo; + } + + public void setEquipmentNo(String equipmentNo) { + this.equipmentNo = equipmentNo; + } + + public String getEquipmentSpecifications() { + return equipmentSpecifications; + } + + public void setEquipmentSpecifications(String equipmentSpecifications) { + this.equipmentSpecifications = equipmentSpecifications; + } + + public String getEquipmentType() { + return equipmentType; + } + + public void setEquipmentType(String equipmentType) { + this.equipmentType = equipmentType; + } + + public String getEquipmentTypeName() { + return equipmentTypeName; + } + + public void setEquipmentTypeName(String equipmentTypeName) { + this.equipmentTypeName = equipmentTypeName; + } + + public String getFileList() { + return fileList; + } + + public void setFileList(String fileList) { + this.fileList = fileList; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getInstallIncidentalExpenses() { + return installIncidentalExpenses; + } + + public void setInstallIncidentalExpenses(String installIncidentalExpenses) { + this.installIncidentalExpenses = installIncidentalExpenses; + } + + public String getInstallPlace() { + return installPlace; + } + + public void setInstallPlace(String installPlace) { + this.installPlace = installPlace; + } + + public String getIntactState() { + return intactState; + } + + public void setIntactState(String intactState) { + this.intactState = intactState; + } + + public String getIsCalibrationTestEquipment() { + return isCalibrationTestEquipment; + } + + public void setIsCalibrationTestEquipment(String isCalibrationTestEquipment) { + this.isCalibrationTestEquipment = isCalibrationTestEquipment; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getIsFixedAssets() { + return isFixedAssets; + } + + public void setIsFixedAssets(String isFixedAssets) { + this.isFixedAssets = isFixedAssets; + } + + public String getIsMeasureAccount() { + return isMeasureAccount; + } + + public void setIsMeasureAccount(String isMeasureAccount) { + this.isMeasureAccount = isMeasureAccount; + } + + public String getIsStandardSupportEquipment() { + return isStandardSupportEquipment; + } + + public void setIsStandardSupportEquipment(String isStandardSupportEquipment) { + this.isStandardSupportEquipment = isStandardSupportEquipment; + } + + public String getLabelBind() { + return labelBind; + } + + public void setLabelBind(String labelBind) { + this.labelBind = labelBind; + } + + public String getMajorCategory() { + return majorCategory; + } + + public void setMajorCategory(String majorCategory) { + this.majorCategory = majorCategory; + } + + public String getMajorCategoryName() { + return majorCategoryName; + } + + public void setMajorCategoryName(String majorCategoryName) { + this.majorCategoryName = majorCategoryName; + } + + public String getManagerLevel() { + return managerLevel; + } + + public void setManagerLevel(String managerLevel) { + this.managerLevel = managerLevel; + } + + public String getManagerLevelName() { + return managerLevelName; + } + + public void setManagerLevelName(String managerLevelName) { + this.managerLevelName = managerLevelName; + } + + public String getManagerState() { + return managerState; + } + + public void setManagerState(String managerState) { + this.managerState = managerState; + } + + public String getManagerStateName() { + return managerStateName; + } + + public void setManagerStateName(String managerStateName) { + this.managerStateName = managerStateName; + } + + public String getManufacturer() { + return manufacturer; + } + + public void setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + } + + public String getManufacturerCountry() { + return manufacturerCountry; + } + + public void setManufacturerCountry(String manufacturerCountry) { + this.manufacturerCountry = manufacturerCountry; + } + + public String getManufacturingDate() { + return manufacturingDate; + } + + public void setManufacturingDate(String manufacturingDate) { + this.manufacturingDate = manufacturingDate; + } + + public String getManufacturingNo() { + return manufacturingNo; + } + + public void setManufacturingNo(String manufacturingNo) { + this.manufacturingNo = manufacturingNo; + } + + public String getMesureCycle() { + return mesureCycle; + } + + public void setMesureCycle(String mesureCycle) { + this.mesureCycle = mesureCycle; + } + + public String getMesureDate() { + return mesureDate; + } + + public void setMesureDate(String mesureDate) { + this.mesureDate = mesureDate; + } + + public String getMesureDept() { + return mesureDept; + } + + public void setMesureDept(String mesureDept) { + this.mesureDept = mesureDept; + } + + public String getMesureRange() { + return mesureRange; + } + + public void setMesureRange(String mesureRange) { + this.mesureRange = mesureRange; + } + + public String getMesureResult() { + return mesureResult; + } + + public void setMesureResult(String mesureResult) { + this.mesureResult = mesureResult; + } + + public String getMesureResultName() { + return mesureResultName; + } + + public void setMesureResultName(String mesureResultName) { + this.mesureResultName = mesureResultName; + } + + public String getMesureType() { + return mesureType; + } + + public void setMesureType(String mesureType) { + this.mesureType = mesureType; + } + + public String getMesureTypeName() { + return mesureTypeName; + } + + public void setMesureTypeName(String mesureTypeName) { + this.mesureTypeName = mesureTypeName; + } + + public String getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getOriginValue() { + return originValue; + } + + public void setOriginValue(String originValue) { + this.originValue = originValue; + } + + public String getOverallDimension() { + return overallDimension; + } + + public void setOverallDimension(String overallDimension) { + this.overallDimension = overallDimension; + } + + public String getPresentOriginValue() { + return presentOriginValue; + } + + public void setPresentOriginValue(String presentOriginValue) { + this.presentOriginValue = presentOriginValue; + } + + public String getPurpose() { + return purpose; + } + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getSinglePrice() { + return singlePrice; + } + + public void setSinglePrice(String singlePrice) { + this.singlePrice = singlePrice; + } + + public String getSupportStandardEquipmentName() { + return supportStandardEquipmentName; + } + + public void setSupportStandardEquipmentName(String supportStandardEquipmentName) { + this.supportStandardEquipmentName = supportStandardEquipmentName; + } + + public String getSupportStandardEquipmentNo() { + return supportStandardEquipmentNo; + } + + public void setSupportStandardEquipmentNo(String supportStandardEquipmentNo) { + this.supportStandardEquipmentNo = supportStandardEquipmentNo; + } + + public String getTechnicalLevel() { + return technicalLevel; + } + + public void setTechnicalLevel(String technicalLevel) { + this.technicalLevel = technicalLevel; + } + + public String getUncertainty() { + return uncertainty; + } + + public void setUncertainty(String uncertainty) { + this.uncertainty = uncertainty; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getUseDept() { + return useDept; + } + + public void setUseDept(String useDept) { + this.useDept = useDept; + } + + public String getUseDeptName() { + return useDeptName; + } + + public void setUseDeptName(String useDeptName) { + this.useDeptName = useDeptName; + } + + public String getUsePerson() { + return usePerson; + } + + public void setUsePerson(String usePerson) { + this.usePerson = usePerson; + } + + public String getUsePersonName() { + return usePersonName; + } + + public void setUsePersonName(String usePersonName) { + this.usePersonName = usePersonName; + } + + public String getValidDate() { + return validDate; + } + + public void setValidDate(String validDate) { + this.validDate = validDate; + } + + public int getVersion() { + return version; + } + + public void setVersion(int version) { + this.version = version; + } + + public String getWeight() { + return weight; + } + + public void setWeight(String weight) { + this.weight = weight; + } + } + } +} diff --git a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt index a3f514f..46e5eef 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt @@ -35,4 +35,24 @@ @QueryMap limit: Map, @QueryMap offset: Map ): String + + /** + * 获取设备列表 + */ + @POST("/meter/assets/listPage") + suspend fun getEquipmentList( + @Header("token") token: String, + @Body requestBody: RequestBody, + @QueryMap limit: Map, + @QueryMap offset: Map + ): String + + /** + * 获取设备详情 + */ + @POST("/meter/assets/detail") + suspend fun getEquipmentDetail( + @Header("token") token: String, + @Body requestBody: RequestBody + ): String } \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt index 444a872..386a1d8 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt @@ -6,8 +6,10 @@ import com.pengxh.kt.lite.utils.SaveKeyValues import okhttp3.MediaType.Companion.toMediaType import okhttp3.RequestBody.Companion.toRequestBody +import org.json.JSONArray import org.json.JSONObject + object RetrofitServiceManager { private val api by lazy { @@ -73,4 +75,71 @@ offsetMap["offset"] = offset return api.getNoticeList(AuthenticationHelper.token!!, requestBody, limitMap, offsetMap) } + + /** + * 获取设备列表 + */ + suspend fun getEquipmentList( + equipmentNo: String, + equipmentName: String, + mesureType: String, + managerState: String, + useDept: String, + assetType: String, + equipmentCategory: String, + isCalibrationTestEquipment: String, + isMeasureAccount: String, + isStandardSupportEquipment: String, + isFixedAssets: String, + validStartDate: String, + validEndDate: String, + abc: String, + ids: Array, + offset: Int + ): String { + val paramObject = JSONObject() + paramObject.put("equipmentNo", equipmentNo) + paramObject.put("equipmentName", equipmentName) + paramObject.put("mesureType", mesureType) + paramObject.put("managerState", managerState) + paramObject.put("useDept", useDept) + paramObject.put("assetType", assetType) + paramObject.put("equipmentCategory", equipmentCategory) + paramObject.put("isCalibrationTestEquipment", isCalibrationTestEquipment) + paramObject.put("isMeasureAccount", isMeasureAccount) + paramObject.put("isStandardSupportEquipment", isStandardSupportEquipment) + paramObject.put("isFixedAssets", isFixedAssets) + paramObject.put("validStartDate", validStartDate) + paramObject.put("validEndDate", validEndDate) + paramObject.put("abc", abc) + + val jsonArray = JSONArray() + ids.forEach { + jsonArray.put(it) + } + paramObject.put("ids", jsonArray) + + val requestBody = paramObject.toString().toRequestBody( + "application/json;charset=UTF-8".toMediaType() + ) + + val limitMap = HashMap() + limitMap["limit"] = LocaleConstant.PAGE_LIMIT + + val offsetMap = HashMap() + offsetMap["offset"] = offset + return api.getEquipmentList(AuthenticationHelper.token!!, requestBody, limitMap, offsetMap) + } + + /** + * 获取设备详情 + */ + suspend fun getEquipmentDetail(id: String): String { + val paramObject = JSONObject() + paramObject.put("id", id) + val requestBody = paramObject.toString().toRequestBody( + "application/json;charset=UTF-8".toMediaType() + ) + return api.getEquipmentDetail(AuthenticationHelper.token!!, requestBody) + } } \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt deleted file mode 100644 index a5bb60b..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt +++ /dev/null @@ -1,104 +0,0 @@ -package com.casic.xz.meterage.view - -import android.annotation.SuppressLint -import android.graphics.Paint -import androidx.lifecycle.ViewModelProvider -import com.casic.xz.meterage.R -import com.casic.xz.meterage.extensions.combineImagePath -import com.casic.xz.meterage.extensions.formatTextFromHtml -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.vm.NoticeViewModel -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.extensions.convertColor -import com.pengxh.kt.lite.extensions.navigatePageTo -import com.pengxh.kt.lite.extensions.obtainScreenWidth -import com.pengxh.kt.lite.extensions.show -import com.pengxh.kt.lite.utils.Constant -import kotlinx.android.synthetic.main.activity_notice_detail.* -import kotlinx.android.synthetic.main.include_base_title.* -import java.util.* - -@SuppressLint("SetTextI18n") -class NoticeDetailActivity : KotlinBaseActivity() { - - private lateinit var noticeViewModel: NoticeViewModel - - override fun initData() { - leftBackView.setOnClickListener { finish() } - titleView.text = "通知公告" - - val args = intent.getStringArrayListExtra(Constant.INTENT_PARAM)!! - - noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] - noticeViewModel.getNoticeList(args[0], args[1], args[2], "", "", 1) - noticeViewModel.noticeResult.observe(this, { - if (it.code == 200) { - val dataRow = it.data?.rows!![0] - - noticeDateView.text = dataRow.noticeTime - noticePublisherView.text = "发布人 ${dataRow.noticePublisher}" - noticeCompanyView.text = "发布单位 ${dataRow.noticeCompany}" - - noticeNoView.text = dataRow.noticeNo - noticeTitleView.text = dataRow.noticeTitle - noticeSketchView.text = dataRow.noticeSketch - - dataRow.noticeContent.formatTextFromHtml( - this, noticeContentView, obtainScreenWidth() - ) - - if (dataRow.minioFileName.isNullOrBlank()) { - minioFileView.text = "暂无附件" - } else { - val minioFileName = dataRow.minioFileName - - minioFileView.text = minioFileName - val textPaint = minioFileView.paint - textPaint.flags = Paint.UNDERLINE_TEXT_FLAG - textPaint.isAntiAlias = true - minioFileView.setTextColor(R.color.themeColor.convertColor(this)) - - minioFileView.setOnClickListener { - //查看附件 - if (minioFileName.endsWith("pdf")) { - navigatePageTo(minioFileName) - } else if ( - minioFileName.endsWith("doc") || - minioFileName.endsWith("docx") - ) { - navigatePageTo(minioFileName) - } else if (minioFileName.endsWith("txt")) { - navigatePageTo(minioFileName) - } else if ( - minioFileName.endsWith("png") || - minioFileName.endsWith("jpeg") || - minioFileName.endsWith("jpg") - ) { - val urls = ArrayList() - urls.add(minioFileName.combineImagePath()) - navigatePageTo(0, urls) - } else { - "文件类型未知,无法打开附件".show(this) - } - } - } - } - }) - } - - override fun initEvent() { - - } - - override fun initLayoutView(): Int = R.layout.activity_notice_detail - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/NoticeListActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/NoticeListActivity.kt deleted file mode 100644 index 15f6a16..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/NoticeListActivity.kt +++ /dev/null @@ -1,180 +0,0 @@ -package com.casic.xz.meterage.view - -import android.os.Handler -import android.util.Log -import android.view.View -import androidx.lifecycle.ViewModelProvider -import com.casic.xz.meterage.R -import com.casic.xz.meterage.adapter.NoticeListAdapter -import com.casic.xz.meterage.extensions.addAll -import com.casic.xz.meterage.extensions.combineFilePath -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.extensions.showEmptyPage -import com.casic.xz.meterage.model.NoticeListModel -import com.casic.xz.meterage.vm.NoticeViewModel -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.extensions.navigatePageTo -import com.pengxh.kt.lite.extensions.show -import com.pengxh.kt.lite.utils.WeakReferenceHandler -import com.pengxh.kt.lite.widget.dialog.AlertControlDialog -import kotlinx.android.synthetic.main.activity_notice_list.* -import kotlinx.android.synthetic.main.include_empty_view.* - -class NoticeListActivity : KotlinBaseActivity() { - - private lateinit var weakReferenceHandler: WeakReferenceHandler - private lateinit var noticeViewModel: NoticeViewModel - private lateinit var noticeListAdapter: NoticeListAdapter - private var dataBeans: MutableList = ArrayList() - private var pageIndex = 1 - private var isRefresh = false - private var isLoadMore = false - - override fun initData() { - weakReferenceHandler = WeakReferenceHandler(callback) - noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] - noticeViewModel.noticeResult.observe(this, { - if (it.code == 200) { - val dataRows = it.data?.rows!! -// countBadeNumber(dataRows) - when { - isRefresh -> { - dataBeans.clear() - dataBeans = dataRows - noticeLayout.finishRefresh() - isRefresh = false - } - isLoadMore -> { - if (dataRows.size == 0) { - "到底了,别拉了".show(this) - } - dataBeans.addAll(dataRows) - noticeLayout.finishLoadMore() - isLoadMore = false - } - else -> { - dataBeans = dataRows - } - } - weakReferenceHandler.sendEmptyMessage(2023013101) - } - }) - } - - override fun initEvent() { - leftBackView.setOnClickListener { finish() } - rightOperateView.setOnClickListener { - AlertControlDialog.Builder() - .setContext(this) - .setTitle("提示") - .setMessage("确定将所有未读消息标为已读?") - .setNegativeButton("取消") - .setPositiveButton("确定") - .setOnDialogButtonClickListener(object : - AlertControlDialog.OnDialogButtonClickListener { - override fun onCancelClick() { - - } - - override fun onConfirmClick() { - //TODO 设置为已读 - } - }).build().show() - } - - if (hasNoticePermission()) { - openSystemNoticeLayout.visibility = View.GONE - openSystemNoticeLayout.visibility = View.GONE - } else { - openSystemNoticeLayout.setOnClickListener { - - } - - - closeLayoutView.setOnClickListener { - openSystemNoticeLayout.visibility = View.GONE - } - } - - noticeLayout.setOnRefreshListener { - isRefresh = true - //刷新之后页码重置 - pageIndex = 1 - getNoticeListByPage() - } - - noticeLayout.setOnLoadMoreListener { - isLoadMore = true - pageIndex++ - getNoticeListByPage() - } - } - - override fun onResume() { - super.onResume() - pageIndex = 1 - getNoticeListByPage() - } - - private fun getNoticeListByPage() { - noticeViewModel.getNoticeList("", "", "", "", "", pageIndex) - } - - private val callback = Handler.Callback { - when (it.what) { - 2023013101 -> { - if (isRefresh || isLoadMore) { - noticeListAdapter.notifyDataSetChanged() - } else { - if (dataBeans.size == 0) { - emptyView!!.showEmptyPage("没有任何消息") { - pageIndex = 1 - getNoticeListByPage() - } - } else { - emptyView!!.hide() - noticeListAdapter = NoticeListAdapter(this, dataBeans) - noticeRecyclerView.adapter = noticeListAdapter - noticeListAdapter.setOnItemClickListener(object : - NoticeListAdapter.OnItemClickListener { - override fun onItemClicked(position: Int) { - val rowsModel = dataBeans[position] - val allArgs = addAll( - rowsModel.noticeNo, - rowsModel.noticeTitle, - rowsModel.noticePublisher, - "", - "" - ) - Log.d( - "Casic", - "NoticeListActivity => onItemClicked: ${rowsModel.minioFileName.combineFilePath()}" - ) - navigatePageTo(allArgs) - } - }) - } - } - } - } - true - } - - //TODO 判断是否开启通知权限 - private fun hasNoticePermission(): Boolean { - - return false - } - - override fun initLayoutView(): Int = R.layout.activity_notice_list - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/PreviewDocumentActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/PreviewDocumentActivity.kt deleted file mode 100644 index e233ddc..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/PreviewDocumentActivity.kt +++ /dev/null @@ -1,24 +0,0 @@ -package com.casic.xz.meterage.view - -import com.casic.xz.meterage.R -import com.pengxh.kt.lite.base.KotlinBaseActivity - -class PreviewDocumentActivity : KotlinBaseActivity() { - override fun initData() { - - } - - override fun initEvent() { - - } - - override fun initLayoutView(): Int = R.layout.activity_preview_doc - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/PreviewPdfActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/PreviewPdfActivity.kt deleted file mode 100644 index 39f8ac2..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/PreviewPdfActivity.kt +++ /dev/null @@ -1,62 +0,0 @@ -package com.casic.xz.meterage.view - -import com.casic.xz.meterage.R -import com.casic.xz.meterage.extensions.combineFilePath -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.utils.LoadingDialogHub -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.callback.OnDownloadListener -import com.pengxh.kt.lite.extensions.createDownloadFileDir -import com.pengxh.kt.lite.extensions.downloadFile -import com.pengxh.kt.lite.utils.Constant -import kotlinx.android.synthetic.main.activity_preview_pdf.* -import kotlinx.android.synthetic.main.include_base_title.* -import java.io.File -import java.io.FileInputStream - - -class PreviewPdfActivity : KotlinBaseActivity() { - - override fun initData() { - val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! - titleView.text = minioFileName - - val url = minioFileName.combineFilePath() - url.downloadFile(createDownloadFileDir().toString(), - object : OnDownloadListener { - override fun onDownloadStart(totalBytes: Long) { - runOnUiThread { - LoadingDialogHub.show(this@PreviewPdfActivity, "附件加载中") - } - } - - override fun onProgressChanged(currentBytes: Long) { - - } - - override fun onDownloadEnd(file: File?) { - runOnUiThread { - LoadingDialogHub.dismiss() - } - val inputStream = FileInputStream(file) - pdfView.fromStream(inputStream).load() - } - }) - } - - override fun initEvent() { - leftBackView.setOnClickListener { finish() } - } - - override fun initLayoutView(): Int = R.layout.activity_preview_pdf - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/PreviewTextActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/PreviewTextActivity.kt deleted file mode 100644 index d634ca3..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/PreviewTextActivity.kt +++ /dev/null @@ -1,60 +0,0 @@ -package com.casic.xz.meterage.view - -import com.casic.xz.meterage.R -import com.casic.xz.meterage.extensions.combineFilePath -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.utils.LoadingDialogHub -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.callback.OnDownloadListener -import com.pengxh.kt.lite.extensions.createDownloadFileDir -import com.pengxh.kt.lite.extensions.downloadFile -import com.pengxh.kt.lite.extensions.read -import com.pengxh.kt.lite.utils.Constant -import kotlinx.android.synthetic.main.activity_preview_txt.* -import kotlinx.android.synthetic.main.include_base_title.* -import java.io.File - -class PreviewTextActivity : KotlinBaseActivity() { - - override fun initData() { - val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! - titleView.text = minioFileName - - val url = minioFileName.combineFilePath() - url.downloadFile(createDownloadFileDir().toString(), - object : OnDownloadListener { - override fun onDownloadStart(totalBytes: Long) { - runOnUiThread { - LoadingDialogHub.show(this@PreviewTextActivity, "附件加载中") - } - } - - override fun onProgressChanged(currentBytes: Long) { - - } - - override fun onDownloadEnd(file: File?) { - runOnUiThread { - LoadingDialogHub.dismiss() - textView.text = file?.read() - } - } - }) - } - - override fun initEvent() { - leftBackView.setOnClickListener { finish() } - } - - override fun initLayoutView(): Int = R.layout.activity_preview_txt - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentActivity.kt new file mode 100644 index 0000000..35ca098 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentActivity.kt @@ -0,0 +1,158 @@ +package com.casic.xz.meterage.view.home + +import android.os.Handler +import androidx.lifecycle.ViewModelProvider +import androidx.recyclerview.widget.DividerItemDecoration +import com.casic.xz.meterage.R +import com.casic.xz.meterage.adapter.EquipmentListAdapter +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.extensions.showEmptyPage +import com.casic.xz.meterage.model.EquipmentListModel +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.casic.xz.meterage.vm.EquipmentViewModel +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.extensions.navigatePageTo +import com.pengxh.kt.lite.extensions.show +import com.pengxh.kt.lite.utils.WeakReferenceHandler +import com.pengxh.kt.lite.vm.LoadState +import kotlinx.android.synthetic.main.activity_equipment.* +import kotlinx.android.synthetic.main.include_empty_view.* +import kotlinx.android.synthetic.main.include_search_title.* + +class EquipmentActivity : KotlinBaseActivity() { + + private lateinit var weakReferenceHandler: WeakReferenceHandler + private lateinit var equipmentViewModel: EquipmentViewModel + private lateinit var equipmentListAdapter: EquipmentListAdapter + private var dataBeans: MutableList = ArrayList() + private var pageIndex = 1 + private var isRefresh = false + private var isLoadMore = false + + override fun initData() { + weakReferenceHandler = WeakReferenceHandler(callback) + equipmentViewModel = ViewModelProvider(this)[EquipmentViewModel::class.java] + equipmentViewModel.equipmentResult.observe(this, { + if (it.code == 200) { + val dataRows = it.data?.rows!! + when { + isRefresh -> { + dataBeans.clear() + dataBeans = dataRows + equipmentLayout.finishRefresh() + isRefresh = false + } + isLoadMore -> { + if (dataRows.size == 0) { + "到底了,别拉了".show(this) + } + dataBeans.addAll(dataRows) + equipmentLayout.finishLoadMore() + isLoadMore = false + } + else -> { + dataBeans = dataRows + } + } + weakReferenceHandler.sendEmptyMessage(2023020801) + } + }) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + rightOperateView.setOnClickListener { + + } + + equipmentLayout.setOnRefreshListener { + isRefresh = true + //刷新之后页码重置 + pageIndex = 1 + getEquipmentListByPage() + } + + equipmentLayout.setOnLoadMoreListener { + isLoadMore = true + pageIndex++ + getEquipmentListByPage() + } + } + + override fun initLayoutView(): Int = R.layout.activity_equipment + + override fun observeRequestState() { + equipmentViewModel.loadState.observe(this, { + when (it) { + LoadState.Loading -> LoadingDialogHub.show(this, "数据加载中...") + else -> LoadingDialogHub.dismiss() + } + }) + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + titleView.text = "仪器设备" + } + + override fun onResume() { + super.onResume() + pageIndex = 1 + getEquipmentListByPage() + } + + private fun getEquipmentListByPage() { + equipmentViewModel.getEquipmentList( + "", + "", + "", + "", + "", + "1", + "", + "", + "", + "", + "", + "", + "", + "", + arrayOf(), + pageIndex + ) + } + + private val callback = Handler.Callback { + when (it.what) { + 2023020801 -> { + if (isRefresh || isLoadMore) { + equipmentListAdapter.notifyDataSetChanged() + } else { + if (dataBeans.size == 0) { + emptyView!!.showEmptyPage("无设备") { + pageIndex = 1 + getEquipmentListByPage() + } + } else { + emptyView!!.hide() + equipmentListAdapter = EquipmentListAdapter(this, dataBeans) + equipmentRecyclerView.addItemDecoration( + DividerItemDecoration(this, DividerItemDecoration.VERTICAL) + ) + equipmentRecyclerView.adapter = equipmentListAdapter + equipmentListAdapter.setOnItemClickListener(object : + EquipmentListAdapter.OnItemClickListener { + override fun onItemClicked(position: Int) { + val rowsModel = dataBeans[position] + navigatePageTo(rowsModel.id) + } + }) + } + } + } + } + true + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentDetailActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentDetailActivity.kt new file mode 100644 index 0000000..7dee13c --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentDetailActivity.kt @@ -0,0 +1,53 @@ +package com.casic.xz.meterage.view.home + +import androidx.fragment.app.Fragment +import com.casic.xz.meterage.R +import com.casic.xz.meterage.adapter.SubViewPagerAdapter +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.fragment.equipment.* +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.utils.Constant +import kotlinx.android.synthetic.main.activity_equipment.rootView +import kotlinx.android.synthetic.main.activity_equipment_detail.* +import kotlinx.android.synthetic.main.include_base_title.* + +class EquipmentDetailActivity : KotlinBaseActivity() { + + private var fragmentPages: ArrayList = ArrayList() + + override fun initData() { + val equipmentId = intent.getStringExtra(Constant.INTENT_PARAM)!! + + fragmentPages.add(BasicInformationFragment(equipmentId)) + fragmentPages.add(InspectionRecordFragment()) + fragmentPages.add(ChangeRecordFragment()) + fragmentPages.add(UsageRecordFragment()) + fragmentPages.add(CertificateFragment()) + + val equipmentPageTitles = arrayOf("基础信息", "周检记录", "状态变更记录", "使用记录", "检定证书") + + equipmentViewPager.adapter = SubViewPagerAdapter( + supportFragmentManager, fragmentPages, equipmentPageTitles + ) + equipmentViewPager.offscreenPageLimit = fragmentPages.size + //绑定 + topTabLayout.setupWithViewPager(equipmentViewPager) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + } + + override fun initLayoutView(): Int = R.layout.activity_equipment_detail + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + titleView.text = "仪器设备" + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeDetailActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeDetailActivity.kt new file mode 100644 index 0000000..6fe0022 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeDetailActivity.kt @@ -0,0 +1,105 @@ +package com.casic.xz.meterage.view.notice + +import android.annotation.SuppressLint +import android.graphics.Paint +import androidx.lifecycle.ViewModelProvider +import com.casic.xz.meterage.R +import com.casic.xz.meterage.extensions.combineImagePath +import com.casic.xz.meterage.extensions.formatTextFromHtml +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.view.BigImageActivity +import com.casic.xz.meterage.vm.NoticeViewModel +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.extensions.convertColor +import com.pengxh.kt.lite.extensions.navigatePageTo +import com.pengxh.kt.lite.extensions.obtainScreenWidth +import com.pengxh.kt.lite.extensions.show +import com.pengxh.kt.lite.utils.Constant +import kotlinx.android.synthetic.main.activity_notice_detail.* +import kotlinx.android.synthetic.main.include_base_title.* +import java.util.* + +@SuppressLint("SetTextI18n") +class NoticeDetailActivity : KotlinBaseActivity() { + + private lateinit var noticeViewModel: NoticeViewModel + + override fun initData() { + leftBackView.setOnClickListener { finish() } + titleView.text = "通知公告" + + val args = intent.getStringArrayListExtra(Constant.INTENT_PARAM)!! + + noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] + noticeViewModel.getNoticeList(args[0], args[1], args[2], "", "", 1) + noticeViewModel.noticeResult.observe(this, { + if (it.code == 200) { + val dataRow = it.data?.rows!![0] + + noticeDateView.text = dataRow.noticeTime + noticePublisherView.text = "发布人 ${dataRow.noticePublisher}" + noticeCompanyView.text = "发布单位 ${dataRow.noticeCompany}" + + noticeNoView.text = dataRow.noticeNo + noticeTitleView.text = dataRow.noticeTitle + noticeSketchView.text = dataRow.noticeSketch + + dataRow.noticeContent.formatTextFromHtml( + this, noticeContentView, obtainScreenWidth() + ) + + if (dataRow.minioFileName.isNullOrBlank()) { + minioFileView.text = "暂无附件" + } else { + val minioFileName = dataRow.minioFileName + + minioFileView.text = minioFileName + val textPaint = minioFileView.paint + textPaint.flags = Paint.UNDERLINE_TEXT_FLAG + textPaint.isAntiAlias = true + minioFileView.setTextColor(R.color.themeColor.convertColor(this)) + + minioFileView.setOnClickListener { + //查看附件 + if (minioFileName.endsWith("pdf")) { + navigatePageTo(minioFileName) + } else if ( + minioFileName.endsWith("doc") || + minioFileName.endsWith("docx") + ) { + navigatePageTo(minioFileName) + } else if (minioFileName.endsWith("txt")) { + navigatePageTo(minioFileName) + } else if ( + minioFileName.endsWith("png") || + minioFileName.endsWith("jpeg") || + minioFileName.endsWith("jpg") + ) { + val urls = ArrayList() + urls.add(minioFileName.combineImagePath()) + navigatePageTo(0, urls) + } else { + "文件类型未知,无法打开附件".show(this) + } + } + } + } + }) + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.activity_notice_detail + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeListActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeListActivity.kt new file mode 100644 index 0000000..31c0490 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeListActivity.kt @@ -0,0 +1,180 @@ +package com.casic.xz.meterage.view.notice + +import android.os.Handler +import android.util.Log +import android.view.View +import androidx.lifecycle.ViewModelProvider +import com.casic.xz.meterage.R +import com.casic.xz.meterage.adapter.NoticeListAdapter +import com.casic.xz.meterage.extensions.addAll +import com.casic.xz.meterage.extensions.combineFilePath +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.extensions.showEmptyPage +import com.casic.xz.meterage.model.NoticeListModel +import com.casic.xz.meterage.vm.NoticeViewModel +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.extensions.navigatePageTo +import com.pengxh.kt.lite.extensions.show +import com.pengxh.kt.lite.utils.WeakReferenceHandler +import com.pengxh.kt.lite.widget.dialog.AlertControlDialog +import kotlinx.android.synthetic.main.activity_notice_list.* +import kotlinx.android.synthetic.main.include_empty_view.* + +class NoticeListActivity : KotlinBaseActivity() { + + private lateinit var weakReferenceHandler: WeakReferenceHandler + private lateinit var noticeViewModel: NoticeViewModel + private lateinit var noticeListAdapter: NoticeListAdapter + private var dataBeans: MutableList = ArrayList() + private var pageIndex = 1 + private var isRefresh = false + private var isLoadMore = false + + override fun initData() { + weakReferenceHandler = WeakReferenceHandler(callback) + noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] + noticeViewModel.noticeResult.observe(this, { + if (it.code == 200) { + val dataRows = it.data?.rows!! +// countBadeNumber(dataRows) + when { + isRefresh -> { + dataBeans.clear() + dataBeans = dataRows + noticeLayout.finishRefresh() + isRefresh = false + } + isLoadMore -> { + if (dataRows.size == 0) { + "到底了,别拉了".show(this) + } + dataBeans.addAll(dataRows) + noticeLayout.finishLoadMore() + isLoadMore = false + } + else -> { + dataBeans = dataRows + } + } + weakReferenceHandler.sendEmptyMessage(2023013101) + } + }) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + rightOperateView.setOnClickListener { + AlertControlDialog.Builder() + .setContext(this) + .setTitle("提示") + .setMessage("确定将所有未读消息标为已读?") + .setNegativeButton("取消") + .setPositiveButton("确定") + .setOnDialogButtonClickListener(object : + AlertControlDialog.OnDialogButtonClickListener { + override fun onCancelClick() { + + } + + override fun onConfirmClick() { + //TODO 设置为已读 + } + }).build().show() + } + + if (hasNoticePermission()) { + openSystemNoticeLayout.visibility = View.GONE + openSystemNoticeLayout.visibility = View.GONE + } else { + openSystemNoticeLayout.setOnClickListener { + + } + + + closeLayoutView.setOnClickListener { + openSystemNoticeLayout.visibility = View.GONE + } + } + + noticeLayout.setOnRefreshListener { + isRefresh = true + //刷新之后页码重置 + pageIndex = 1 + getNoticeListByPage() + } + + noticeLayout.setOnLoadMoreListener { + isLoadMore = true + pageIndex++ + getNoticeListByPage() + } + } + + override fun onResume() { + super.onResume() + pageIndex = 1 + getNoticeListByPage() + } + + private fun getNoticeListByPage() { + noticeViewModel.getNoticeList("", "", "", "", "", pageIndex) + } + + private val callback = Handler.Callback { + when (it.what) { + 2023013101 -> { + if (isRefresh || isLoadMore) { + noticeListAdapter.notifyDataSetChanged() + } else { + if (dataBeans.size == 0) { + emptyView!!.showEmptyPage("没有任何消息") { + pageIndex = 1 + getNoticeListByPage() + } + } else { + emptyView!!.hide() + noticeListAdapter = NoticeListAdapter(this, dataBeans) + noticeRecyclerView.adapter = noticeListAdapter + noticeListAdapter.setOnItemClickListener(object : + NoticeListAdapter.OnItemClickListener { + override fun onItemClicked(position: Int) { + val rowsModel = dataBeans[position] + val allArgs = addAll( + rowsModel.noticeNo, + rowsModel.noticeTitle, + rowsModel.noticePublisher, + "", + "" + ) + Log.d( + "Casic", + "NoticeListActivity => onItemClicked: ${rowsModel.minioFileName.combineFilePath()}" + ) + navigatePageTo(allArgs) + } + }) + } + } + } + } + true + } + + //TODO 判断是否开启通知权限 + private fun hasNoticePermission(): Boolean { + + return false + } + + override fun initLayoutView(): Int = R.layout.activity_notice_list + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewDocumentActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewDocumentActivity.kt new file mode 100644 index 0000000..4b16ae8 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewDocumentActivity.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.view.notice + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseActivity + +class PreviewDocumentActivity : KotlinBaseActivity() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.activity_preview_doc + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewPdfActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewPdfActivity.kt new file mode 100644 index 0000000..fad73b6 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewPdfActivity.kt @@ -0,0 +1,62 @@ +package com.casic.xz.meterage.view.notice + +import com.casic.xz.meterage.R +import com.casic.xz.meterage.extensions.combineFilePath +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.callback.OnDownloadListener +import com.pengxh.kt.lite.extensions.createDownloadFileDir +import com.pengxh.kt.lite.extensions.downloadFile +import com.pengxh.kt.lite.utils.Constant +import kotlinx.android.synthetic.main.activity_preview_pdf.* +import kotlinx.android.synthetic.main.include_base_title.* +import java.io.File +import java.io.FileInputStream + + +class PreviewPdfActivity : KotlinBaseActivity() { + + override fun initData() { + val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! + titleView.text = minioFileName + + val url = minioFileName.combineFilePath() + url.downloadFile(createDownloadFileDir().toString(), + object : OnDownloadListener { + override fun onDownloadStart(totalBytes: Long) { + runOnUiThread { + LoadingDialogHub.show(this@PreviewPdfActivity, "附件加载中") + } + } + + override fun onProgressChanged(currentBytes: Long) { + + } + + override fun onDownloadEnd(file: File?) { + runOnUiThread { + LoadingDialogHub.dismiss() + } + val inputStream = FileInputStream(file) + pdfView.fromStream(inputStream).load() + } + }) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + } + + override fun initLayoutView(): Int = R.layout.activity_preview_pdf + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewTextActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewTextActivity.kt new file mode 100644 index 0000000..d7850fb --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewTextActivity.kt @@ -0,0 +1,60 @@ +package com.casic.xz.meterage.view.notice + +import com.casic.xz.meterage.R +import com.casic.xz.meterage.extensions.combineFilePath +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.callback.OnDownloadListener +import com.pengxh.kt.lite.extensions.createDownloadFileDir +import com.pengxh.kt.lite.extensions.downloadFile +import com.pengxh.kt.lite.extensions.read +import com.pengxh.kt.lite.utils.Constant +import kotlinx.android.synthetic.main.activity_preview_txt.* +import kotlinx.android.synthetic.main.include_base_title.* +import java.io.File + +class PreviewTextActivity : KotlinBaseActivity() { + + override fun initData() { + val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! + titleView.text = minioFileName + + val url = minioFileName.combineFilePath() + url.downloadFile(createDownloadFileDir().toString(), + object : OnDownloadListener { + override fun onDownloadStart(totalBytes: Long) { + runOnUiThread { + LoadingDialogHub.show(this@PreviewTextActivity, "附件加载中") + } + } + + override fun onProgressChanged(currentBytes: Long) { + + } + + override fun onDownloadEnd(file: File?) { + runOnUiThread { + LoadingDialogHub.dismiss() + textView.text = file?.read() + } + } + }) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + } + + override fun initLayoutView(): Int = R.layout.activity_preview_txt + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/vm/EquipmentViewModel.kt b/app/src/main/java/com/casic/xz/meterage/vm/EquipmentViewModel.kt new file mode 100644 index 0000000..b5f21f6 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/vm/EquipmentViewModel.kt @@ -0,0 +1,92 @@ +package com.casic.xz.meterage.vm + +import androidx.lifecycle.MutableLiveData +import com.casic.xz.meterage.base.BaseApplication +import com.casic.xz.meterage.extensions.separateResponseCode +import com.casic.xz.meterage.extensions.toErrorMessage +import com.casic.xz.meterage.model.EquipmentDetailModel +import com.casic.xz.meterage.model.EquipmentListModel +import com.casic.xz.meterage.utils.retrofit.RetrofitServiceManager +import com.google.gson.Gson +import com.google.gson.reflect.TypeToken +import com.pengxh.kt.lite.extensions.launch +import com.pengxh.kt.lite.extensions.show +import com.pengxh.kt.lite.vm.BaseViewModel +import com.pengxh.kt.lite.vm.LoadState + +class EquipmentViewModel : BaseViewModel() { + + private val gson by lazy { Gson() } + val equipmentResult = MutableLiveData() + val equipmentDetailResult = MutableLiveData() + + fun getEquipmentList( + equipmentNo: String, + equipmentName: String, + mesureType: String, + managerState: String, + useDept: String, + assetType: String, + equipmentCategory: String, + isCalibrationTestEquipment: String, + isMeasureAccount: String, + isStandardSupportEquipment: String, + isFixedAssets: String, + validStartDate: String, + validEndDate: String, + abc: String, + ids: Array, + offset: Int + ) = launch({ + loadState.value = LoadState.Loading + val response = RetrofitServiceManager.getEquipmentList( + equipmentNo, + equipmentName, + mesureType, + managerState, + useDept, + assetType, + equipmentCategory, + isCalibrationTestEquipment, + isMeasureAccount, + isStandardSupportEquipment, + isFixedAssets, + validStartDate, + validEndDate, + abc, + ids, + offset + ) + val responseCode = response.separateResponseCode() + if (responseCode == 200) { + loadState.value = LoadState.Success + equipmentResult.value = gson.fromJson( + response, object : TypeToken() {}.type + ) + } else { + loadState.value = LoadState.Fail + response.toErrorMessage().show(BaseApplication.get()) + } + }, { + loadState.value = LoadState.Fail + it.printStackTrace() + }) + + fun getEquipmentDetail(id: String) = launch({ + loadState.value = LoadState.Loading + val response = RetrofitServiceManager.getEquipmentDetail(id) + val responseCode = response.separateResponseCode() + if (responseCode == 200) { + loadState.value = LoadState.Success + equipmentDetailResult.value = gson.fromJson( + response, object : TypeToken() {}.type + ) + } else { + loadState.value = LoadState.Fail + response.toErrorMessage().show(BaseApplication.get()) + } + }, { + loadState.value = LoadState.Fail + it.printStackTrace() + }) +} \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_sorting.xml b/app/src/main/res/drawable/ic_sorting.xml new file mode 100644 index 0000000..252bfe6 --- /dev/null +++ b/app/src/main/res/drawable/ic_sorting.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/layout/activity_equipment.xml b/app/src/main/res/layout/activity_equipment.xml new file mode 100644 index 0000000..d6a64b1 --- /dev/null +++ b/app/src/main/res/layout/activity_equipment.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_equipment_detail.xml b/app/src/main/res/layout/activity_equipment_detail.xml new file mode 100644 index 0000000..7254762 --- /dev/null +++ b/app/src/main/res/layout/activity_equipment_detail.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_basic_information.xml b/app/src/main/res/layout/fragment_basic_information.xml new file mode 100644 index 0000000..4a3c1c7 --- /dev/null +++ b/app/src/main/res/layout/fragment_basic_information.xml @@ -0,0 +1,390 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_certificate.xml b/app/src/main/res/layout/fragment_certificate.xml new file mode 100644 index 0000000..77d9ef6 --- /dev/null +++ b/app/src/main/res/layout/fragment_certificate.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_change_record.xml b/app/src/main/res/layout/fragment_change_record.xml new file mode 100644 index 0000000..77d9ef6 --- /dev/null +++ b/app/src/main/res/layout/fragment_change_record.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_home.xml b/app/src/main/res/layout/fragment_home.xml index 41b32a9..e1ab759 100644 --- a/app/src/main/res/layout/fragment_home.xml +++ b/app/src/main/res/layout/fragment_home.xml @@ -71,7 +71,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" app:layoutManager="androidx.recyclerview.widget.GridLayoutManager" - app:spanCount="5" /> + app:spanCount="4" /> + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_mine.xml b/app/src/main/res/layout/fragment_mine.xml index 0643064..d9f57b3 100644 --- a/app/src/main/res/layout/fragment_mine.xml +++ b/app/src/main/res/layout/fragment_mine.xml @@ -22,10 +22,10 @@ android:orientation="horizontal"> + android:src="@mipmap/default_avatar" /> @@ -122,7 +122,7 @@ android:background="@drawable/ic_collection" /> @@ -145,7 +145,7 @@ android:background="@drawable/ic_push_setting" /> @@ -166,7 +166,7 @@ android:background="@drawable/ic_privacy" /> @@ -189,7 +189,7 @@ android:background="@drawable/ic_help" /> @@ -210,7 +210,7 @@ android:background="@drawable/ic_update" /> @@ -231,7 +231,7 @@ android:background="@drawable/ic_about" /> @@ -252,7 +252,7 @@ android:background="@drawable/ic_back" /> diff --git a/app/src/main/res/layout/fragment_usage_record.xml b/app/src/main/res/layout/fragment_usage_record.xml new file mode 100644 index 0000000..77d9ef6 --- /dev/null +++ b/app/src/main/res/layout/fragment_usage_record.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/include_equipment_layout.xml b/app/src/main/res/layout/include_equipment_layout.xml new file mode 100644 index 0000000..ce846d5 --- /dev/null +++ b/app/src/main/res/layout/include_equipment_layout.xml @@ -0,0 +1,74 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/include_line_view.xml b/app/src/main/res/layout/include_line_view.xml new file mode 100644 index 0000000..ff89de3 --- /dev/null +++ b/app/src/main/res/layout/include_line_view.xml @@ -0,0 +1,5 @@ + + \ No newline at end of file diff --git a/app/src/main/res/layout/include_search_title.xml b/app/src/main/res/layout/include_search_title.xml new file mode 100644 index 0000000..644fa4c --- /dev/null +++ b/app/src/main/res/layout/include_search_title.xml @@ -0,0 +1,35 @@ + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/item_equipment_rv_l.xml b/app/src/main/res/layout/item_equipment_rv_l.xml new file mode 100644 index 0000000..796f4b1 --- /dev/null +++ b/app/src/main/res/layout/item_equipment_rv_l.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 3892b5a..02160cd 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -34,16 +34,18 @@ - - - - - - - + + + + + + + + + +) : RecyclerView.Adapter() { + + private var layoutInflater: LayoutInflater = LayoutInflater.from(context) + + override fun getItemCount(): Int = dataRows.size + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = ItemViewHolder( + layoutInflater.inflate(R.layout.item_equipment_rv_l, parent, false) + ) + + override fun onBindViewHolder(holder: ItemViewHolder, position: Int) { + //绑定数据 + val rowsBean = dataRows[position] + holder.equipmentNameView.text = rowsBean.equipmentName + holder.equipmentCodeView.text = rowsBean.equipmentNo + holder.equipmentDateView.text = rowsBean.enableDate + holder.equipmentLibView.text = rowsBean.useDeptName + + //绑定事件 + holder.itemView.setOnClickListener { + listener?.onItemClicked(position) + } + } + + inner class ItemViewHolder(view: View) : RecyclerView.ViewHolder(view) { + var equipmentNameView: TextView = view.findViewById(R.id.equipmentNameView) + var equipmentCodeView: TextView = view.findViewById(R.id.equipmentCodeView) + var equipmentDateView: TextView = view.findViewById(R.id.equipmentDateView) + var equipmentLibView: TextView = view.findViewById(R.id.equipmentLibView) + } + + private var listener: OnItemClickListener? = null + + interface OnItemClickListener { + fun onItemClicked(position: Int) + } + + fun setOnItemClickListener(onClickListener: OnItemClickListener?) { + this.listener = onClickListener + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt index b4628f3..d970b55 100644 --- a/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt +++ b/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt @@ -5,7 +5,8 @@ import com.casic.xz.meterage.R import com.casic.xz.meterage.adapter.HomeGridAdapter import com.casic.xz.meterage.utils.LocaleConstant -import com.casic.xz.meterage.view.NoticeListActivity +import com.casic.xz.meterage.view.home.EquipmentActivity +import com.casic.xz.meterage.view.notice.NoticeListActivity import com.casic.xz.meterage.vm.NoticeViewModel import com.pengxh.kt.lite.base.KotlinBaseFragment import com.pengxh.kt.lite.extensions.navigatePageTo @@ -36,8 +37,19 @@ homeFuncRecyclerView.adapter = homeAdapter homeAdapter.setOnGridItemClickListener(object : HomeGridAdapter.OnGridItemClickListener { override fun onItemClick(position: Int) { - when (position) { - + when (LocaleConstant.HOME_FUNC_OPERATE[position]) { + "仪器设备" -> requireContext().navigatePageTo() +// "标准装置" -> requireContext().navigatePageTo() +// "证书报告" -> requireContext().navigatePageTo() +// "委托需求" -> requireContext().navigatePageTo() +// "访客" -> requireContext().navigatePageTo() +// "标准规范" -> requireContext().navigatePageTo() +// "能力列表" -> requireContext().navigatePageTo() +// "计量培训" -> requireContext().navigatePageTo() +// "合同发票" -> requireContext().navigatePageTo() +// "业务统计" -> requireContext().navigatePageTo() +// "客户列表" -> requireContext().navigatePageTo() +// "外场检测" -> requireContext().navigatePageTo() } } }) diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt index 7e75abe..56dc5ec 100644 --- a/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt +++ b/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt @@ -2,9 +2,11 @@ import android.view.View import androidx.lifecycle.ViewModelProvider +import com.bumptech.glide.Glide +import com.bumptech.glide.request.RequestOptions import com.casic.xz.meterage.R import com.casic.xz.meterage.utils.LocaleConstant -import com.casic.xz.meterage.view.NoticeListActivity +import com.casic.xz.meterage.view.notice.NoticeListActivity import com.casic.xz.meterage.vm.NoticeViewModel import com.casic.xz.meterage.vm.UserViewModel import com.pengxh.kt.lite.base.KotlinBaseFragment @@ -23,6 +25,12 @@ val data = it.data userNameView.text = data.name userUnitView.text = data.deptName + +// Glide.with(requireContext()) +// .load(R.mipmap.default_avatar) +// .apply(RequestOptions.circleCropTransform()) +// .placeholder(R.mipmap.load_image_error) +// .into(userAvatarView) } }) diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt new file mode 100644 index 0000000..cf22646 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt @@ -0,0 +1,103 @@ +package com.casic.xz.meterage.fragment.equipment + +import android.graphics.Paint +import androidx.lifecycle.ViewModelProvider +import com.casic.xz.meterage.R +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.casic.xz.meterage.vm.EquipmentViewModel +import com.pengxh.kt.lite.base.KotlinBaseFragment +import com.pengxh.kt.lite.extensions.convertColor +import com.pengxh.kt.lite.vm.LoadState +import kotlinx.android.synthetic.main.fragment_basic_information.* + +class BasicInformationFragment(private val id: String) : KotlinBaseFragment() { + + private lateinit var equipmentViewModel: EquipmentViewModel + + override fun initData() { + equipmentViewModel = ViewModelProvider(this)[EquipmentViewModel::class.java] + equipmentViewModel.getEquipmentDetail(id) + equipmentViewModel.equipmentDetailResult.observe(this, { + if (it.code == 200) { + val data = it.data!! + + equipmentCodeView.text = data.equipmentNo + equipmentNameView.text = data.equipmentName + manufacturerView.text = data.manufacturer + factoryNumberView.text = data.manufacturingNo + modelView.text = data.modelNo + verificationMethodView.text = data.mesureTypeName + measuringRangeView.text = data.mesureRange + uncertaintyView.text = data.uncertainty + firstUseView.text = data.createTime + originalValueView.text = data.originValue + usageDeptView.text = data.useDeptName + userView.text = data.usePersonName + managementStatusView.text = data.managerStateName + verificationDeptView.text = data.useDeptName +// nextVerificationDeptView.text = data. + verificationPeriodView.text = data.mesureCycle + verificationDateView.text = data.mesureDate + effectiveDateView.text = data.validDate + verificationResultsView.text = data.mesureResultName + abcView.text = data.abcName + isNeedTechnicalView.text = if ( + data.isCalibrationTestEquipment.isNullOrBlank() || data.isCalibrationTestEquipment == "0" + ) { + "否" + } else { + "是" + } + + isStandingBook.text = if ( + data.isMeasureAccount.isNullOrBlank() || data.isMeasureAccount == "0" + ) { + "否" + } else { + "是" + } + + isStandardView.text = if ( + data.isStandardSupportEquipment.isNullOrBlank() || data.isStandardSupportEquipment == "0" + ) { + "否" + } else { + "是" + } + remarkView.text = data.remark + if (data.fileList.size == 0) { + instructionsView.text = "暂无" + } else { + instructionsView.text = "查看附件列表" + val textPaint = instructionsView.paint + textPaint.flags = Paint.UNDERLINE_TEXT_FLAG + textPaint.isAntiAlias = true + instructionsView.setTextColor(R.color.themeColor.convertColor(requireContext())) + + instructionsView.setOnClickListener { + + } + } + } + }) + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_basic_information + + override fun observeRequestState() { + equipmentViewModel.loadState.observe(this, { + when (it) { + LoadState.Loading -> LoadingDialogHub.show(requireActivity(), "数据加载中...") + else -> LoadingDialogHub.dismiss() + } + }) + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt new file mode 100644 index 0000000..0b4a747 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class CertificateFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_certificate + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt new file mode 100644 index 0000000..f05c491 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class ChangeRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_change_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt new file mode 100644 index 0000000..849ffa5 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class InspectionRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_inspection_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt new file mode 100644 index 0000000..aa4edd9 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class UsageRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_usage_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java b/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java new file mode 100644 index 0000000..0b9124e --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java @@ -0,0 +1,760 @@ +package com.casic.xz.meterage.model; + +import java.util.List; + +public class EquipmentDetailModel { + + private int code; + private DataModel data; + private String message; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataModel getData() { + return data; + } + + public void setData(DataModel data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public static class DataModel { + private String abc; + private String abcName; + private String assetNo; + private String assetSource; + private String assetType; + private String assetTypeName; + private String attribute; + private String capitalSource; + private String capitalSourceName; + private String cardEstablishmentDate; + private String createTime; + private String createUser; + private String depreciationMethod; + private String depreciationMethodName; + private String depreciationPeriod; + private String enableDate; + private String equipmentCategory; + private String equipmentCategoryName; + private String equipmentName; + private String equipmentNo; + private String equipmentSpecifications; + private String equipmentType; + private String equipmentTypeName; + private List fileList; + private String id; + private String installIncidentalExpenses; + private String installPlace; + private String intactState; + private String isCalibrationTestEquipment; + private int isDel; + private String isFixedAssets; + private String isMeasureAccount; + private String isStandardSupportEquipment; + private String labelBind; + private String majorCategory; + private String majorCategoryName; + private String managerLevel; + private String managerLevelName; + private String managerState; + private String managerStateName; + private String manufacturer; + private String manufacturerCountry; + private String manufacturingDate; + private String manufacturingNo; + private String mesureCycle; + private String mesureDate; + private String mesureDept; + private String mesureRange; + private String mesureResult; + private String mesureResultName; + private String mesureType; + private String mesureTypeName; + private String modelNo; + private String originValue; + private String overallDimension; + private String presentOriginValue; + private String purpose; + private String remark; + private String singlePrice; + private String supportStandardEquipmentName; + private String supportStandardEquipmentNo; + private String technicalLevel; + private String uncertainty; + private String updateTime; + private String useDept; + private String useDeptName; + private String usePerson; + private String usePersonName; + private String validDate; + private int version; + private String weight; + + public String getAbc() { + return abc; + } + + public void setAbc(String abc) { + this.abc = abc; + } + + public String getAbcName() { + return abcName; + } + + public void setAbcName(String abcName) { + this.abcName = abcName; + } + + public String getAssetNo() { + return assetNo; + } + + public void setAssetNo(String assetNo) { + this.assetNo = assetNo; + } + + public String getAssetSource() { + return assetSource; + } + + public void setAssetSource(String assetSource) { + this.assetSource = assetSource; + } + + public String getAssetType() { + return assetType; + } + + public void setAssetType(String assetType) { + this.assetType = assetType; + } + + public String getAssetTypeName() { + return assetTypeName; + } + + public void setAssetTypeName(String assetTypeName) { + this.assetTypeName = assetTypeName; + } + + public String getAttribute() { + return attribute; + } + + public void setAttribute(String attribute) { + this.attribute = attribute; + } + + public String getCapitalSource() { + return capitalSource; + } + + public void setCapitalSource(String capitalSource) { + this.capitalSource = capitalSource; + } + + public String getCapitalSourceName() { + return capitalSourceName; + } + + public void setCapitalSourceName(String capitalSourceName) { + this.capitalSourceName = capitalSourceName; + } + + public String getCardEstablishmentDate() { + return cardEstablishmentDate; + } + + public void setCardEstablishmentDate(String cardEstablishmentDate) { + this.cardEstablishmentDate = cardEstablishmentDate; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getDepreciationMethod() { + return depreciationMethod; + } + + public void setDepreciationMethod(String depreciationMethod) { + this.depreciationMethod = depreciationMethod; + } + + public String getDepreciationMethodName() { + return depreciationMethodName; + } + + public void setDepreciationMethodName(String depreciationMethodName) { + this.depreciationMethodName = depreciationMethodName; + } + + public String getDepreciationPeriod() { + return depreciationPeriod; + } + + public void setDepreciationPeriod(String depreciationPeriod) { + this.depreciationPeriod = depreciationPeriod; + } + + public String getEnableDate() { + return enableDate; + } + + public void setEnableDate(String enableDate) { + this.enableDate = enableDate; + } + + public String getEquipmentCategory() { + return equipmentCategory; + } + + public void setEquipmentCategory(String equipmentCategory) { + this.equipmentCategory = equipmentCategory; + } + + public String getEquipmentCategoryName() { + return equipmentCategoryName; + } + + public void setEquipmentCategoryName(String equipmentCategoryName) { + this.equipmentCategoryName = equipmentCategoryName; + } + + public String getEquipmentName() { + return equipmentName; + } + + public void setEquipmentName(String equipmentName) { + this.equipmentName = equipmentName; + } + + public String getEquipmentNo() { + return equipmentNo; + } + + public void setEquipmentNo(String equipmentNo) { + this.equipmentNo = equipmentNo; + } + + public String getEquipmentSpecifications() { + return equipmentSpecifications; + } + + public void setEquipmentSpecifications(String equipmentSpecifications) { + this.equipmentSpecifications = equipmentSpecifications; + } + + public String getEquipmentType() { + return equipmentType; + } + + public void setEquipmentType(String equipmentType) { + this.equipmentType = equipmentType; + } + + public String getEquipmentTypeName() { + return equipmentTypeName; + } + + public void setEquipmentTypeName(String equipmentTypeName) { + this.equipmentTypeName = equipmentTypeName; + } + + public List getFileList() { + return fileList; + } + + public void setFileList(List fileList) { + this.fileList = fileList; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getInstallIncidentalExpenses() { + return installIncidentalExpenses; + } + + public void setInstallIncidentalExpenses(String installIncidentalExpenses) { + this.installIncidentalExpenses = installIncidentalExpenses; + } + + public String getInstallPlace() { + return installPlace; + } + + public void setInstallPlace(String installPlace) { + this.installPlace = installPlace; + } + + public String getIntactState() { + return intactState; + } + + public void setIntactState(String intactState) { + this.intactState = intactState; + } + + public String getIsCalibrationTestEquipment() { + return isCalibrationTestEquipment; + } + + public void setIsCalibrationTestEquipment(String isCalibrationTestEquipment) { + this.isCalibrationTestEquipment = isCalibrationTestEquipment; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getIsFixedAssets() { + return isFixedAssets; + } + + public void setIsFixedAssets(String isFixedAssets) { + this.isFixedAssets = isFixedAssets; + } + + public String getIsMeasureAccount() { + return isMeasureAccount; + } + + public void setIsMeasureAccount(String isMeasureAccount) { + this.isMeasureAccount = isMeasureAccount; + } + + public String getIsStandardSupportEquipment() { + return isStandardSupportEquipment; + } + + public void setIsStandardSupportEquipment(String isStandardSupportEquipment) { + this.isStandardSupportEquipment = isStandardSupportEquipment; + } + + public String getLabelBind() { + return labelBind; + } + + public void setLabelBind(String labelBind) { + this.labelBind = labelBind; + } + + public String getMajorCategory() { + return majorCategory; + } + + public void setMajorCategory(String majorCategory) { + this.majorCategory = majorCategory; + } + + public String getMajorCategoryName() { + return majorCategoryName; + } + + public void setMajorCategoryName(String majorCategoryName) { + this.majorCategoryName = majorCategoryName; + } + + public String getManagerLevel() { + return managerLevel; + } + + public void setManagerLevel(String managerLevel) { + this.managerLevel = managerLevel; + } + + public String getManagerLevelName() { + return managerLevelName; + } + + public void setManagerLevelName(String managerLevelName) { + this.managerLevelName = managerLevelName; + } + + public String getManagerState() { + return managerState; + } + + public void setManagerState(String managerState) { + this.managerState = managerState; + } + + public String getManagerStateName() { + return managerStateName; + } + + public void setManagerStateName(String managerStateName) { + this.managerStateName = managerStateName; + } + + public String getManufacturer() { + return manufacturer; + } + + public void setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + } + + public String getManufacturerCountry() { + return manufacturerCountry; + } + + public void setManufacturerCountry(String manufacturerCountry) { + this.manufacturerCountry = manufacturerCountry; + } + + public String getManufacturingDate() { + return manufacturingDate; + } + + public void setManufacturingDate(String manufacturingDate) { + this.manufacturingDate = manufacturingDate; + } + + public String getManufacturingNo() { + return manufacturingNo; + } + + public void setManufacturingNo(String manufacturingNo) { + this.manufacturingNo = manufacturingNo; + } + + public String getMesureCycle() { + return mesureCycle; + } + + public void setMesureCycle(String mesureCycle) { + this.mesureCycle = mesureCycle; + } + + public String getMesureDate() { + return mesureDate; + } + + public void setMesureDate(String mesureDate) { + this.mesureDate = mesureDate; + } + + public String getMesureDept() { + return mesureDept; + } + + public void setMesureDept(String mesureDept) { + this.mesureDept = mesureDept; + } + + public String getMesureRange() { + return mesureRange; + } + + public void setMesureRange(String mesureRange) { + this.mesureRange = mesureRange; + } + + public String getMesureResult() { + return mesureResult; + } + + public void setMesureResult(String mesureResult) { + this.mesureResult = mesureResult; + } + + public String getMesureResultName() { + return mesureResultName; + } + + public void setMesureResultName(String mesureResultName) { + this.mesureResultName = mesureResultName; + } + + public String getMesureType() { + return mesureType; + } + + public void setMesureType(String mesureType) { + this.mesureType = mesureType; + } + + public String getMesureTypeName() { + return mesureTypeName; + } + + public void setMesureTypeName(String mesureTypeName) { + this.mesureTypeName = mesureTypeName; + } + + public String getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getOriginValue() { + return originValue; + } + + public void setOriginValue(String originValue) { + this.originValue = originValue; + } + + public String getOverallDimension() { + return overallDimension; + } + + public void setOverallDimension(String overallDimension) { + this.overallDimension = overallDimension; + } + + public String getPresentOriginValue() { + return presentOriginValue; + } + + public void setPresentOriginValue(String presentOriginValue) { + this.presentOriginValue = presentOriginValue; + } + + public String getPurpose() { + return purpose; + } + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getSinglePrice() { + return singlePrice; + } + + public void setSinglePrice(String singlePrice) { + this.singlePrice = singlePrice; + } + + public String getSupportStandardEquipmentName() { + return supportStandardEquipmentName; + } + + public void setSupportStandardEquipmentName(String supportStandardEquipmentName) { + this.supportStandardEquipmentName = supportStandardEquipmentName; + } + + public String getSupportStandardEquipmentNo() { + return supportStandardEquipmentNo; + } + + public void setSupportStandardEquipmentNo(String supportStandardEquipmentNo) { + this.supportStandardEquipmentNo = supportStandardEquipmentNo; + } + + public String getTechnicalLevel() { + return technicalLevel; + } + + public void setTechnicalLevel(String technicalLevel) { + this.technicalLevel = technicalLevel; + } + + public String getUncertainty() { + return uncertainty; + } + + public void setUncertainty(String uncertainty) { + this.uncertainty = uncertainty; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getUseDept() { + return useDept; + } + + public void setUseDept(String useDept) { + this.useDept = useDept; + } + + public String getUseDeptName() { + return useDeptName; + } + + public void setUseDeptName(String useDeptName) { + this.useDeptName = useDeptName; + } + + public String getUsePerson() { + return usePerson; + } + + public void setUsePerson(String usePerson) { + this.usePerson = usePerson; + } + + public String getUsePersonName() { + return usePersonName; + } + + public void setUsePersonName(String usePersonName) { + this.usePersonName = usePersonName; + } + + public String getValidDate() { + return validDate; + } + + public void setValidDate(String validDate) { + this.validDate = validDate; + } + + public int getVersion() { + return version; + } + + public void setVersion(int version) { + this.version = version; + } + + public String getWeight() { + return weight; + } + + public void setWeight(String weight) { + this.weight = weight; + } + + public static class FileListModel { + private String assetId; + private String createTime; + private String createUser; + private String fileName; + private String id; + private int isDel; + private String minioFileName; + private String remark; + private String updateTime; + + public String getAssetId() { + return assetId; + } + + public void setAssetId(String assetId) { + this.assetId = assetId; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getFileName() { + return fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getMinioFileName() { + return minioFileName; + } + + public void setMinioFileName(String minioFileName) { + this.minioFileName = minioFileName; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + } + } +} diff --git a/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java b/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java new file mode 100644 index 0000000..15fc128 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java @@ -0,0 +1,697 @@ +package com.casic.xz.meterage.model; + +import java.util.List; + +public class EquipmentListModel { + + private int code; + private DataModel data; + private String message; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataModel getData() { + return data; + } + + public void setData(DataModel data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public static class DataModel { + private List rows; + private int total; + + public List getRows() { + return rows; + } + + public void setRows(List rows) { + this.rows = rows; + } + + public int getTotal() { + return total; + } + + public void setTotal(int total) { + this.total = total; + } + + public static class RowsModel { + private String abc; + private String abcName; + private String assetNo; + private String assetSource; + private String assetType; + private String assetTypeName; + private String attribute; + private String capitalSource; + private String capitalSourceName; + private String cardEstablishmentDate; + private String createTime; + private String createUser; + private String depreciationMethod; + private String depreciationMethodName; + private String depreciationPeriod; + private String enableDate; + private String equipmentCategory; + private String equipmentCategoryName; + private String equipmentName; + private String equipmentNo; + private String equipmentSpecifications; + private String equipmentType; + private String equipmentTypeName; + private String fileList; + private String id; + private String installIncidentalExpenses; + private String installPlace; + private String intactState; + private String isCalibrationTestEquipment; + private int isDel; + private String isFixedAssets; + private String isMeasureAccount; + private String isStandardSupportEquipment; + private String labelBind; + private String majorCategory; + private String majorCategoryName; + private String managerLevel; + private String managerLevelName; + private String managerState; + private String managerStateName; + private String manufacturer; + private String manufacturerCountry; + private String manufacturingDate; + private String manufacturingNo; + private String mesureCycle; + private String mesureDate; + private String mesureDept; + private String mesureRange; + private String mesureResult; + private String mesureResultName; + private String mesureType; + private String mesureTypeName; + private String modelNo; + private String originValue; + private String overallDimension; + private String presentOriginValue; + private String purpose; + private String remark; + private String singlePrice; + private String supportStandardEquipmentName; + private String supportStandardEquipmentNo; + private String technicalLevel; + private String uncertainty; + private String updateTime; + private String useDept; + private String useDeptName; + private String usePerson; + private String usePersonName; + private String validDate; + private int version; + private String weight; + + public String getAbc() { + return abc; + } + + public void setAbc(String abc) { + this.abc = abc; + } + + public String getAbcName() { + return abcName; + } + + public void setAbcName(String abcName) { + this.abcName = abcName; + } + + public String getAssetNo() { + return assetNo; + } + + public void setAssetNo(String assetNo) { + this.assetNo = assetNo; + } + + public String getAssetSource() { + return assetSource; + } + + public void setAssetSource(String assetSource) { + this.assetSource = assetSource; + } + + public String getAssetType() { + return assetType; + } + + public void setAssetType(String assetType) { + this.assetType = assetType; + } + + public String getAssetTypeName() { + return assetTypeName; + } + + public void setAssetTypeName(String assetTypeName) { + this.assetTypeName = assetTypeName; + } + + public String getAttribute() { + return attribute; + } + + public void setAttribute(String attribute) { + this.attribute = attribute; + } + + public String getCapitalSource() { + return capitalSource; + } + + public void setCapitalSource(String capitalSource) { + this.capitalSource = capitalSource; + } + + public String getCapitalSourceName() { + return capitalSourceName; + } + + public void setCapitalSourceName(String capitalSourceName) { + this.capitalSourceName = capitalSourceName; + } + + public String getCardEstablishmentDate() { + return cardEstablishmentDate; + } + + public void setCardEstablishmentDate(String cardEstablishmentDate) { + this.cardEstablishmentDate = cardEstablishmentDate; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getDepreciationMethod() { + return depreciationMethod; + } + + public void setDepreciationMethod(String depreciationMethod) { + this.depreciationMethod = depreciationMethod; + } + + public String getDepreciationMethodName() { + return depreciationMethodName; + } + + public void setDepreciationMethodName(String depreciationMethodName) { + this.depreciationMethodName = depreciationMethodName; + } + + public String getDepreciationPeriod() { + return depreciationPeriod; + } + + public void setDepreciationPeriod(String depreciationPeriod) { + this.depreciationPeriod = depreciationPeriod; + } + + public String getEnableDate() { + return enableDate; + } + + public void setEnableDate(String enableDate) { + this.enableDate = enableDate; + } + + public String getEquipmentCategory() { + return equipmentCategory; + } + + public void setEquipmentCategory(String equipmentCategory) { + this.equipmentCategory = equipmentCategory; + } + + public String getEquipmentCategoryName() { + return equipmentCategoryName; + } + + public void setEquipmentCategoryName(String equipmentCategoryName) { + this.equipmentCategoryName = equipmentCategoryName; + } + + public String getEquipmentName() { + return equipmentName; + } + + public void setEquipmentName(String equipmentName) { + this.equipmentName = equipmentName; + } + + public String getEquipmentNo() { + return equipmentNo; + } + + public void setEquipmentNo(String equipmentNo) { + this.equipmentNo = equipmentNo; + } + + public String getEquipmentSpecifications() { + return equipmentSpecifications; + } + + public void setEquipmentSpecifications(String equipmentSpecifications) { + this.equipmentSpecifications = equipmentSpecifications; + } + + public String getEquipmentType() { + return equipmentType; + } + + public void setEquipmentType(String equipmentType) { + this.equipmentType = equipmentType; + } + + public String getEquipmentTypeName() { + return equipmentTypeName; + } + + public void setEquipmentTypeName(String equipmentTypeName) { + this.equipmentTypeName = equipmentTypeName; + } + + public String getFileList() { + return fileList; + } + + public void setFileList(String fileList) { + this.fileList = fileList; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getInstallIncidentalExpenses() { + return installIncidentalExpenses; + } + + public void setInstallIncidentalExpenses(String installIncidentalExpenses) { + this.installIncidentalExpenses = installIncidentalExpenses; + } + + public String getInstallPlace() { + return installPlace; + } + + public void setInstallPlace(String installPlace) { + this.installPlace = installPlace; + } + + public String getIntactState() { + return intactState; + } + + public void setIntactState(String intactState) { + this.intactState = intactState; + } + + public String getIsCalibrationTestEquipment() { + return isCalibrationTestEquipment; + } + + public void setIsCalibrationTestEquipment(String isCalibrationTestEquipment) { + this.isCalibrationTestEquipment = isCalibrationTestEquipment; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getIsFixedAssets() { + return isFixedAssets; + } + + public void setIsFixedAssets(String isFixedAssets) { + this.isFixedAssets = isFixedAssets; + } + + public String getIsMeasureAccount() { + return isMeasureAccount; + } + + public void setIsMeasureAccount(String isMeasureAccount) { + this.isMeasureAccount = isMeasureAccount; + } + + public String getIsStandardSupportEquipment() { + return isStandardSupportEquipment; + } + + public void setIsStandardSupportEquipment(String isStandardSupportEquipment) { + this.isStandardSupportEquipment = isStandardSupportEquipment; + } + + public String getLabelBind() { + return labelBind; + } + + public void setLabelBind(String labelBind) { + this.labelBind = labelBind; + } + + public String getMajorCategory() { + return majorCategory; + } + + public void setMajorCategory(String majorCategory) { + this.majorCategory = majorCategory; + } + + public String getMajorCategoryName() { + return majorCategoryName; + } + + public void setMajorCategoryName(String majorCategoryName) { + this.majorCategoryName = majorCategoryName; + } + + public String getManagerLevel() { + return managerLevel; + } + + public void setManagerLevel(String managerLevel) { + this.managerLevel = managerLevel; + } + + public String getManagerLevelName() { + return managerLevelName; + } + + public void setManagerLevelName(String managerLevelName) { + this.managerLevelName = managerLevelName; + } + + public String getManagerState() { + return managerState; + } + + public void setManagerState(String managerState) { + this.managerState = managerState; + } + + public String getManagerStateName() { + return managerStateName; + } + + public void setManagerStateName(String managerStateName) { + this.managerStateName = managerStateName; + } + + public String getManufacturer() { + return manufacturer; + } + + public void setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + } + + public String getManufacturerCountry() { + return manufacturerCountry; + } + + public void setManufacturerCountry(String manufacturerCountry) { + this.manufacturerCountry = manufacturerCountry; + } + + public String getManufacturingDate() { + return manufacturingDate; + } + + public void setManufacturingDate(String manufacturingDate) { + this.manufacturingDate = manufacturingDate; + } + + public String getManufacturingNo() { + return manufacturingNo; + } + + public void setManufacturingNo(String manufacturingNo) { + this.manufacturingNo = manufacturingNo; + } + + public String getMesureCycle() { + return mesureCycle; + } + + public void setMesureCycle(String mesureCycle) { + this.mesureCycle = mesureCycle; + } + + public String getMesureDate() { + return mesureDate; + } + + public void setMesureDate(String mesureDate) { + this.mesureDate = mesureDate; + } + + public String getMesureDept() { + return mesureDept; + } + + public void setMesureDept(String mesureDept) { + this.mesureDept = mesureDept; + } + + public String getMesureRange() { + return mesureRange; + } + + public void setMesureRange(String mesureRange) { + this.mesureRange = mesureRange; + } + + public String getMesureResult() { + return mesureResult; + } + + public void setMesureResult(String mesureResult) { + this.mesureResult = mesureResult; + } + + public String getMesureResultName() { + return mesureResultName; + } + + public void setMesureResultName(String mesureResultName) { + this.mesureResultName = mesureResultName; + } + + public String getMesureType() { + return mesureType; + } + + public void setMesureType(String mesureType) { + this.mesureType = mesureType; + } + + public String getMesureTypeName() { + return mesureTypeName; + } + + public void setMesureTypeName(String mesureTypeName) { + this.mesureTypeName = mesureTypeName; + } + + public String getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getOriginValue() { + return originValue; + } + + public void setOriginValue(String originValue) { + this.originValue = originValue; + } + + public String getOverallDimension() { + return overallDimension; + } + + public void setOverallDimension(String overallDimension) { + this.overallDimension = overallDimension; + } + + public String getPresentOriginValue() { + return presentOriginValue; + } + + public void setPresentOriginValue(String presentOriginValue) { + this.presentOriginValue = presentOriginValue; + } + + public String getPurpose() { + return purpose; + } + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getSinglePrice() { + return singlePrice; + } + + public void setSinglePrice(String singlePrice) { + this.singlePrice = singlePrice; + } + + public String getSupportStandardEquipmentName() { + return supportStandardEquipmentName; + } + + public void setSupportStandardEquipmentName(String supportStandardEquipmentName) { + this.supportStandardEquipmentName = supportStandardEquipmentName; + } + + public String getSupportStandardEquipmentNo() { + return supportStandardEquipmentNo; + } + + public void setSupportStandardEquipmentNo(String supportStandardEquipmentNo) { + this.supportStandardEquipmentNo = supportStandardEquipmentNo; + } + + public String getTechnicalLevel() { + return technicalLevel; + } + + public void setTechnicalLevel(String technicalLevel) { + this.technicalLevel = technicalLevel; + } + + public String getUncertainty() { + return uncertainty; + } + + public void setUncertainty(String uncertainty) { + this.uncertainty = uncertainty; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getUseDept() { + return useDept; + } + + public void setUseDept(String useDept) { + this.useDept = useDept; + } + + public String getUseDeptName() { + return useDeptName; + } + + public void setUseDeptName(String useDeptName) { + this.useDeptName = useDeptName; + } + + public String getUsePerson() { + return usePerson; + } + + public void setUsePerson(String usePerson) { + this.usePerson = usePerson; + } + + public String getUsePersonName() { + return usePersonName; + } + + public void setUsePersonName(String usePersonName) { + this.usePersonName = usePersonName; + } + + public String getValidDate() { + return validDate; + } + + public void setValidDate(String validDate) { + this.validDate = validDate; + } + + public int getVersion() { + return version; + } + + public void setVersion(int version) { + this.version = version; + } + + public String getWeight() { + return weight; + } + + public void setWeight(String weight) { + this.weight = weight; + } + } + } +} diff --git a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt index a3f514f..46e5eef 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt @@ -35,4 +35,24 @@ @QueryMap limit: Map, @QueryMap offset: Map ): String + + /** + * 获取设备列表 + */ + @POST("/meter/assets/listPage") + suspend fun getEquipmentList( + @Header("token") token: String, + @Body requestBody: RequestBody, + @QueryMap limit: Map, + @QueryMap offset: Map + ): String + + /** + * 获取设备详情 + */ + @POST("/meter/assets/detail") + suspend fun getEquipmentDetail( + @Header("token") token: String, + @Body requestBody: RequestBody + ): String } \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt index 444a872..386a1d8 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt @@ -6,8 +6,10 @@ import com.pengxh.kt.lite.utils.SaveKeyValues import okhttp3.MediaType.Companion.toMediaType import okhttp3.RequestBody.Companion.toRequestBody +import org.json.JSONArray import org.json.JSONObject + object RetrofitServiceManager { private val api by lazy { @@ -73,4 +75,71 @@ offsetMap["offset"] = offset return api.getNoticeList(AuthenticationHelper.token!!, requestBody, limitMap, offsetMap) } + + /** + * 获取设备列表 + */ + suspend fun getEquipmentList( + equipmentNo: String, + equipmentName: String, + mesureType: String, + managerState: String, + useDept: String, + assetType: String, + equipmentCategory: String, + isCalibrationTestEquipment: String, + isMeasureAccount: String, + isStandardSupportEquipment: String, + isFixedAssets: String, + validStartDate: String, + validEndDate: String, + abc: String, + ids: Array, + offset: Int + ): String { + val paramObject = JSONObject() + paramObject.put("equipmentNo", equipmentNo) + paramObject.put("equipmentName", equipmentName) + paramObject.put("mesureType", mesureType) + paramObject.put("managerState", managerState) + paramObject.put("useDept", useDept) + paramObject.put("assetType", assetType) + paramObject.put("equipmentCategory", equipmentCategory) + paramObject.put("isCalibrationTestEquipment", isCalibrationTestEquipment) + paramObject.put("isMeasureAccount", isMeasureAccount) + paramObject.put("isStandardSupportEquipment", isStandardSupportEquipment) + paramObject.put("isFixedAssets", isFixedAssets) + paramObject.put("validStartDate", validStartDate) + paramObject.put("validEndDate", validEndDate) + paramObject.put("abc", abc) + + val jsonArray = JSONArray() + ids.forEach { + jsonArray.put(it) + } + paramObject.put("ids", jsonArray) + + val requestBody = paramObject.toString().toRequestBody( + "application/json;charset=UTF-8".toMediaType() + ) + + val limitMap = HashMap() + limitMap["limit"] = LocaleConstant.PAGE_LIMIT + + val offsetMap = HashMap() + offsetMap["offset"] = offset + return api.getEquipmentList(AuthenticationHelper.token!!, requestBody, limitMap, offsetMap) + } + + /** + * 获取设备详情 + */ + suspend fun getEquipmentDetail(id: String): String { + val paramObject = JSONObject() + paramObject.put("id", id) + val requestBody = paramObject.toString().toRequestBody( + "application/json;charset=UTF-8".toMediaType() + ) + return api.getEquipmentDetail(AuthenticationHelper.token!!, requestBody) + } } \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt deleted file mode 100644 index a5bb60b..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt +++ /dev/null @@ -1,104 +0,0 @@ -package com.casic.xz.meterage.view - -import android.annotation.SuppressLint -import android.graphics.Paint -import androidx.lifecycle.ViewModelProvider -import com.casic.xz.meterage.R -import com.casic.xz.meterage.extensions.combineImagePath -import com.casic.xz.meterage.extensions.formatTextFromHtml -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.vm.NoticeViewModel -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.extensions.convertColor -import com.pengxh.kt.lite.extensions.navigatePageTo -import com.pengxh.kt.lite.extensions.obtainScreenWidth -import com.pengxh.kt.lite.extensions.show -import com.pengxh.kt.lite.utils.Constant -import kotlinx.android.synthetic.main.activity_notice_detail.* -import kotlinx.android.synthetic.main.include_base_title.* -import java.util.* - -@SuppressLint("SetTextI18n") -class NoticeDetailActivity : KotlinBaseActivity() { - - private lateinit var noticeViewModel: NoticeViewModel - - override fun initData() { - leftBackView.setOnClickListener { finish() } - titleView.text = "通知公告" - - val args = intent.getStringArrayListExtra(Constant.INTENT_PARAM)!! - - noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] - noticeViewModel.getNoticeList(args[0], args[1], args[2], "", "", 1) - noticeViewModel.noticeResult.observe(this, { - if (it.code == 200) { - val dataRow = it.data?.rows!![0] - - noticeDateView.text = dataRow.noticeTime - noticePublisherView.text = "发布人 ${dataRow.noticePublisher}" - noticeCompanyView.text = "发布单位 ${dataRow.noticeCompany}" - - noticeNoView.text = dataRow.noticeNo - noticeTitleView.text = dataRow.noticeTitle - noticeSketchView.text = dataRow.noticeSketch - - dataRow.noticeContent.formatTextFromHtml( - this, noticeContentView, obtainScreenWidth() - ) - - if (dataRow.minioFileName.isNullOrBlank()) { - minioFileView.text = "暂无附件" - } else { - val minioFileName = dataRow.minioFileName - - minioFileView.text = minioFileName - val textPaint = minioFileView.paint - textPaint.flags = Paint.UNDERLINE_TEXT_FLAG - textPaint.isAntiAlias = true - minioFileView.setTextColor(R.color.themeColor.convertColor(this)) - - minioFileView.setOnClickListener { - //查看附件 - if (minioFileName.endsWith("pdf")) { - navigatePageTo(minioFileName) - } else if ( - minioFileName.endsWith("doc") || - minioFileName.endsWith("docx") - ) { - navigatePageTo(minioFileName) - } else if (minioFileName.endsWith("txt")) { - navigatePageTo(minioFileName) - } else if ( - minioFileName.endsWith("png") || - minioFileName.endsWith("jpeg") || - minioFileName.endsWith("jpg") - ) { - val urls = ArrayList() - urls.add(minioFileName.combineImagePath()) - navigatePageTo(0, urls) - } else { - "文件类型未知,无法打开附件".show(this) - } - } - } - } - }) - } - - override fun initEvent() { - - } - - override fun initLayoutView(): Int = R.layout.activity_notice_detail - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/NoticeListActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/NoticeListActivity.kt deleted file mode 100644 index 15f6a16..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/NoticeListActivity.kt +++ /dev/null @@ -1,180 +0,0 @@ -package com.casic.xz.meterage.view - -import android.os.Handler -import android.util.Log -import android.view.View -import androidx.lifecycle.ViewModelProvider -import com.casic.xz.meterage.R -import com.casic.xz.meterage.adapter.NoticeListAdapter -import com.casic.xz.meterage.extensions.addAll -import com.casic.xz.meterage.extensions.combineFilePath -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.extensions.showEmptyPage -import com.casic.xz.meterage.model.NoticeListModel -import com.casic.xz.meterage.vm.NoticeViewModel -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.extensions.navigatePageTo -import com.pengxh.kt.lite.extensions.show -import com.pengxh.kt.lite.utils.WeakReferenceHandler -import com.pengxh.kt.lite.widget.dialog.AlertControlDialog -import kotlinx.android.synthetic.main.activity_notice_list.* -import kotlinx.android.synthetic.main.include_empty_view.* - -class NoticeListActivity : KotlinBaseActivity() { - - private lateinit var weakReferenceHandler: WeakReferenceHandler - private lateinit var noticeViewModel: NoticeViewModel - private lateinit var noticeListAdapter: NoticeListAdapter - private var dataBeans: MutableList = ArrayList() - private var pageIndex = 1 - private var isRefresh = false - private var isLoadMore = false - - override fun initData() { - weakReferenceHandler = WeakReferenceHandler(callback) - noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] - noticeViewModel.noticeResult.observe(this, { - if (it.code == 200) { - val dataRows = it.data?.rows!! -// countBadeNumber(dataRows) - when { - isRefresh -> { - dataBeans.clear() - dataBeans = dataRows - noticeLayout.finishRefresh() - isRefresh = false - } - isLoadMore -> { - if (dataRows.size == 0) { - "到底了,别拉了".show(this) - } - dataBeans.addAll(dataRows) - noticeLayout.finishLoadMore() - isLoadMore = false - } - else -> { - dataBeans = dataRows - } - } - weakReferenceHandler.sendEmptyMessage(2023013101) - } - }) - } - - override fun initEvent() { - leftBackView.setOnClickListener { finish() } - rightOperateView.setOnClickListener { - AlertControlDialog.Builder() - .setContext(this) - .setTitle("提示") - .setMessage("确定将所有未读消息标为已读?") - .setNegativeButton("取消") - .setPositiveButton("确定") - .setOnDialogButtonClickListener(object : - AlertControlDialog.OnDialogButtonClickListener { - override fun onCancelClick() { - - } - - override fun onConfirmClick() { - //TODO 设置为已读 - } - }).build().show() - } - - if (hasNoticePermission()) { - openSystemNoticeLayout.visibility = View.GONE - openSystemNoticeLayout.visibility = View.GONE - } else { - openSystemNoticeLayout.setOnClickListener { - - } - - - closeLayoutView.setOnClickListener { - openSystemNoticeLayout.visibility = View.GONE - } - } - - noticeLayout.setOnRefreshListener { - isRefresh = true - //刷新之后页码重置 - pageIndex = 1 - getNoticeListByPage() - } - - noticeLayout.setOnLoadMoreListener { - isLoadMore = true - pageIndex++ - getNoticeListByPage() - } - } - - override fun onResume() { - super.onResume() - pageIndex = 1 - getNoticeListByPage() - } - - private fun getNoticeListByPage() { - noticeViewModel.getNoticeList("", "", "", "", "", pageIndex) - } - - private val callback = Handler.Callback { - when (it.what) { - 2023013101 -> { - if (isRefresh || isLoadMore) { - noticeListAdapter.notifyDataSetChanged() - } else { - if (dataBeans.size == 0) { - emptyView!!.showEmptyPage("没有任何消息") { - pageIndex = 1 - getNoticeListByPage() - } - } else { - emptyView!!.hide() - noticeListAdapter = NoticeListAdapter(this, dataBeans) - noticeRecyclerView.adapter = noticeListAdapter - noticeListAdapter.setOnItemClickListener(object : - NoticeListAdapter.OnItemClickListener { - override fun onItemClicked(position: Int) { - val rowsModel = dataBeans[position] - val allArgs = addAll( - rowsModel.noticeNo, - rowsModel.noticeTitle, - rowsModel.noticePublisher, - "", - "" - ) - Log.d( - "Casic", - "NoticeListActivity => onItemClicked: ${rowsModel.minioFileName.combineFilePath()}" - ) - navigatePageTo(allArgs) - } - }) - } - } - } - } - true - } - - //TODO 判断是否开启通知权限 - private fun hasNoticePermission(): Boolean { - - return false - } - - override fun initLayoutView(): Int = R.layout.activity_notice_list - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/PreviewDocumentActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/PreviewDocumentActivity.kt deleted file mode 100644 index e233ddc..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/PreviewDocumentActivity.kt +++ /dev/null @@ -1,24 +0,0 @@ -package com.casic.xz.meterage.view - -import com.casic.xz.meterage.R -import com.pengxh.kt.lite.base.KotlinBaseActivity - -class PreviewDocumentActivity : KotlinBaseActivity() { - override fun initData() { - - } - - override fun initEvent() { - - } - - override fun initLayoutView(): Int = R.layout.activity_preview_doc - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/PreviewPdfActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/PreviewPdfActivity.kt deleted file mode 100644 index 39f8ac2..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/PreviewPdfActivity.kt +++ /dev/null @@ -1,62 +0,0 @@ -package com.casic.xz.meterage.view - -import com.casic.xz.meterage.R -import com.casic.xz.meterage.extensions.combineFilePath -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.utils.LoadingDialogHub -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.callback.OnDownloadListener -import com.pengxh.kt.lite.extensions.createDownloadFileDir -import com.pengxh.kt.lite.extensions.downloadFile -import com.pengxh.kt.lite.utils.Constant -import kotlinx.android.synthetic.main.activity_preview_pdf.* -import kotlinx.android.synthetic.main.include_base_title.* -import java.io.File -import java.io.FileInputStream - - -class PreviewPdfActivity : KotlinBaseActivity() { - - override fun initData() { - val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! - titleView.text = minioFileName - - val url = minioFileName.combineFilePath() - url.downloadFile(createDownloadFileDir().toString(), - object : OnDownloadListener { - override fun onDownloadStart(totalBytes: Long) { - runOnUiThread { - LoadingDialogHub.show(this@PreviewPdfActivity, "附件加载中") - } - } - - override fun onProgressChanged(currentBytes: Long) { - - } - - override fun onDownloadEnd(file: File?) { - runOnUiThread { - LoadingDialogHub.dismiss() - } - val inputStream = FileInputStream(file) - pdfView.fromStream(inputStream).load() - } - }) - } - - override fun initEvent() { - leftBackView.setOnClickListener { finish() } - } - - override fun initLayoutView(): Int = R.layout.activity_preview_pdf - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/PreviewTextActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/PreviewTextActivity.kt deleted file mode 100644 index d634ca3..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/PreviewTextActivity.kt +++ /dev/null @@ -1,60 +0,0 @@ -package com.casic.xz.meterage.view - -import com.casic.xz.meterage.R -import com.casic.xz.meterage.extensions.combineFilePath -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.utils.LoadingDialogHub -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.callback.OnDownloadListener -import com.pengxh.kt.lite.extensions.createDownloadFileDir -import com.pengxh.kt.lite.extensions.downloadFile -import com.pengxh.kt.lite.extensions.read -import com.pengxh.kt.lite.utils.Constant -import kotlinx.android.synthetic.main.activity_preview_txt.* -import kotlinx.android.synthetic.main.include_base_title.* -import java.io.File - -class PreviewTextActivity : KotlinBaseActivity() { - - override fun initData() { - val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! - titleView.text = minioFileName - - val url = minioFileName.combineFilePath() - url.downloadFile(createDownloadFileDir().toString(), - object : OnDownloadListener { - override fun onDownloadStart(totalBytes: Long) { - runOnUiThread { - LoadingDialogHub.show(this@PreviewTextActivity, "附件加载中") - } - } - - override fun onProgressChanged(currentBytes: Long) { - - } - - override fun onDownloadEnd(file: File?) { - runOnUiThread { - LoadingDialogHub.dismiss() - textView.text = file?.read() - } - } - }) - } - - override fun initEvent() { - leftBackView.setOnClickListener { finish() } - } - - override fun initLayoutView(): Int = R.layout.activity_preview_txt - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentActivity.kt new file mode 100644 index 0000000..35ca098 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentActivity.kt @@ -0,0 +1,158 @@ +package com.casic.xz.meterage.view.home + +import android.os.Handler +import androidx.lifecycle.ViewModelProvider +import androidx.recyclerview.widget.DividerItemDecoration +import com.casic.xz.meterage.R +import com.casic.xz.meterage.adapter.EquipmentListAdapter +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.extensions.showEmptyPage +import com.casic.xz.meterage.model.EquipmentListModel +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.casic.xz.meterage.vm.EquipmentViewModel +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.extensions.navigatePageTo +import com.pengxh.kt.lite.extensions.show +import com.pengxh.kt.lite.utils.WeakReferenceHandler +import com.pengxh.kt.lite.vm.LoadState +import kotlinx.android.synthetic.main.activity_equipment.* +import kotlinx.android.synthetic.main.include_empty_view.* +import kotlinx.android.synthetic.main.include_search_title.* + +class EquipmentActivity : KotlinBaseActivity() { + + private lateinit var weakReferenceHandler: WeakReferenceHandler + private lateinit var equipmentViewModel: EquipmentViewModel + private lateinit var equipmentListAdapter: EquipmentListAdapter + private var dataBeans: MutableList = ArrayList() + private var pageIndex = 1 + private var isRefresh = false + private var isLoadMore = false + + override fun initData() { + weakReferenceHandler = WeakReferenceHandler(callback) + equipmentViewModel = ViewModelProvider(this)[EquipmentViewModel::class.java] + equipmentViewModel.equipmentResult.observe(this, { + if (it.code == 200) { + val dataRows = it.data?.rows!! + when { + isRefresh -> { + dataBeans.clear() + dataBeans = dataRows + equipmentLayout.finishRefresh() + isRefresh = false + } + isLoadMore -> { + if (dataRows.size == 0) { + "到底了,别拉了".show(this) + } + dataBeans.addAll(dataRows) + equipmentLayout.finishLoadMore() + isLoadMore = false + } + else -> { + dataBeans = dataRows + } + } + weakReferenceHandler.sendEmptyMessage(2023020801) + } + }) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + rightOperateView.setOnClickListener { + + } + + equipmentLayout.setOnRefreshListener { + isRefresh = true + //刷新之后页码重置 + pageIndex = 1 + getEquipmentListByPage() + } + + equipmentLayout.setOnLoadMoreListener { + isLoadMore = true + pageIndex++ + getEquipmentListByPage() + } + } + + override fun initLayoutView(): Int = R.layout.activity_equipment + + override fun observeRequestState() { + equipmentViewModel.loadState.observe(this, { + when (it) { + LoadState.Loading -> LoadingDialogHub.show(this, "数据加载中...") + else -> LoadingDialogHub.dismiss() + } + }) + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + titleView.text = "仪器设备" + } + + override fun onResume() { + super.onResume() + pageIndex = 1 + getEquipmentListByPage() + } + + private fun getEquipmentListByPage() { + equipmentViewModel.getEquipmentList( + "", + "", + "", + "", + "", + "1", + "", + "", + "", + "", + "", + "", + "", + "", + arrayOf(), + pageIndex + ) + } + + private val callback = Handler.Callback { + when (it.what) { + 2023020801 -> { + if (isRefresh || isLoadMore) { + equipmentListAdapter.notifyDataSetChanged() + } else { + if (dataBeans.size == 0) { + emptyView!!.showEmptyPage("无设备") { + pageIndex = 1 + getEquipmentListByPage() + } + } else { + emptyView!!.hide() + equipmentListAdapter = EquipmentListAdapter(this, dataBeans) + equipmentRecyclerView.addItemDecoration( + DividerItemDecoration(this, DividerItemDecoration.VERTICAL) + ) + equipmentRecyclerView.adapter = equipmentListAdapter + equipmentListAdapter.setOnItemClickListener(object : + EquipmentListAdapter.OnItemClickListener { + override fun onItemClicked(position: Int) { + val rowsModel = dataBeans[position] + navigatePageTo(rowsModel.id) + } + }) + } + } + } + } + true + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentDetailActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentDetailActivity.kt new file mode 100644 index 0000000..7dee13c --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentDetailActivity.kt @@ -0,0 +1,53 @@ +package com.casic.xz.meterage.view.home + +import androidx.fragment.app.Fragment +import com.casic.xz.meterage.R +import com.casic.xz.meterage.adapter.SubViewPagerAdapter +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.fragment.equipment.* +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.utils.Constant +import kotlinx.android.synthetic.main.activity_equipment.rootView +import kotlinx.android.synthetic.main.activity_equipment_detail.* +import kotlinx.android.synthetic.main.include_base_title.* + +class EquipmentDetailActivity : KotlinBaseActivity() { + + private var fragmentPages: ArrayList = ArrayList() + + override fun initData() { + val equipmentId = intent.getStringExtra(Constant.INTENT_PARAM)!! + + fragmentPages.add(BasicInformationFragment(equipmentId)) + fragmentPages.add(InspectionRecordFragment()) + fragmentPages.add(ChangeRecordFragment()) + fragmentPages.add(UsageRecordFragment()) + fragmentPages.add(CertificateFragment()) + + val equipmentPageTitles = arrayOf("基础信息", "周检记录", "状态变更记录", "使用记录", "检定证书") + + equipmentViewPager.adapter = SubViewPagerAdapter( + supportFragmentManager, fragmentPages, equipmentPageTitles + ) + equipmentViewPager.offscreenPageLimit = fragmentPages.size + //绑定 + topTabLayout.setupWithViewPager(equipmentViewPager) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + } + + override fun initLayoutView(): Int = R.layout.activity_equipment_detail + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + titleView.text = "仪器设备" + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeDetailActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeDetailActivity.kt new file mode 100644 index 0000000..6fe0022 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeDetailActivity.kt @@ -0,0 +1,105 @@ +package com.casic.xz.meterage.view.notice + +import android.annotation.SuppressLint +import android.graphics.Paint +import androidx.lifecycle.ViewModelProvider +import com.casic.xz.meterage.R +import com.casic.xz.meterage.extensions.combineImagePath +import com.casic.xz.meterage.extensions.formatTextFromHtml +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.view.BigImageActivity +import com.casic.xz.meterage.vm.NoticeViewModel +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.extensions.convertColor +import com.pengxh.kt.lite.extensions.navigatePageTo +import com.pengxh.kt.lite.extensions.obtainScreenWidth +import com.pengxh.kt.lite.extensions.show +import com.pengxh.kt.lite.utils.Constant +import kotlinx.android.synthetic.main.activity_notice_detail.* +import kotlinx.android.synthetic.main.include_base_title.* +import java.util.* + +@SuppressLint("SetTextI18n") +class NoticeDetailActivity : KotlinBaseActivity() { + + private lateinit var noticeViewModel: NoticeViewModel + + override fun initData() { + leftBackView.setOnClickListener { finish() } + titleView.text = "通知公告" + + val args = intent.getStringArrayListExtra(Constant.INTENT_PARAM)!! + + noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] + noticeViewModel.getNoticeList(args[0], args[1], args[2], "", "", 1) + noticeViewModel.noticeResult.observe(this, { + if (it.code == 200) { + val dataRow = it.data?.rows!![0] + + noticeDateView.text = dataRow.noticeTime + noticePublisherView.text = "发布人 ${dataRow.noticePublisher}" + noticeCompanyView.text = "发布单位 ${dataRow.noticeCompany}" + + noticeNoView.text = dataRow.noticeNo + noticeTitleView.text = dataRow.noticeTitle + noticeSketchView.text = dataRow.noticeSketch + + dataRow.noticeContent.formatTextFromHtml( + this, noticeContentView, obtainScreenWidth() + ) + + if (dataRow.minioFileName.isNullOrBlank()) { + minioFileView.text = "暂无附件" + } else { + val minioFileName = dataRow.minioFileName + + minioFileView.text = minioFileName + val textPaint = minioFileView.paint + textPaint.flags = Paint.UNDERLINE_TEXT_FLAG + textPaint.isAntiAlias = true + minioFileView.setTextColor(R.color.themeColor.convertColor(this)) + + minioFileView.setOnClickListener { + //查看附件 + if (minioFileName.endsWith("pdf")) { + navigatePageTo(minioFileName) + } else if ( + minioFileName.endsWith("doc") || + minioFileName.endsWith("docx") + ) { + navigatePageTo(minioFileName) + } else if (minioFileName.endsWith("txt")) { + navigatePageTo(minioFileName) + } else if ( + minioFileName.endsWith("png") || + minioFileName.endsWith("jpeg") || + minioFileName.endsWith("jpg") + ) { + val urls = ArrayList() + urls.add(minioFileName.combineImagePath()) + navigatePageTo(0, urls) + } else { + "文件类型未知,无法打开附件".show(this) + } + } + } + } + }) + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.activity_notice_detail + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeListActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeListActivity.kt new file mode 100644 index 0000000..31c0490 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeListActivity.kt @@ -0,0 +1,180 @@ +package com.casic.xz.meterage.view.notice + +import android.os.Handler +import android.util.Log +import android.view.View +import androidx.lifecycle.ViewModelProvider +import com.casic.xz.meterage.R +import com.casic.xz.meterage.adapter.NoticeListAdapter +import com.casic.xz.meterage.extensions.addAll +import com.casic.xz.meterage.extensions.combineFilePath +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.extensions.showEmptyPage +import com.casic.xz.meterage.model.NoticeListModel +import com.casic.xz.meterage.vm.NoticeViewModel +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.extensions.navigatePageTo +import com.pengxh.kt.lite.extensions.show +import com.pengxh.kt.lite.utils.WeakReferenceHandler +import com.pengxh.kt.lite.widget.dialog.AlertControlDialog +import kotlinx.android.synthetic.main.activity_notice_list.* +import kotlinx.android.synthetic.main.include_empty_view.* + +class NoticeListActivity : KotlinBaseActivity() { + + private lateinit var weakReferenceHandler: WeakReferenceHandler + private lateinit var noticeViewModel: NoticeViewModel + private lateinit var noticeListAdapter: NoticeListAdapter + private var dataBeans: MutableList = ArrayList() + private var pageIndex = 1 + private var isRefresh = false + private var isLoadMore = false + + override fun initData() { + weakReferenceHandler = WeakReferenceHandler(callback) + noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] + noticeViewModel.noticeResult.observe(this, { + if (it.code == 200) { + val dataRows = it.data?.rows!! +// countBadeNumber(dataRows) + when { + isRefresh -> { + dataBeans.clear() + dataBeans = dataRows + noticeLayout.finishRefresh() + isRefresh = false + } + isLoadMore -> { + if (dataRows.size == 0) { + "到底了,别拉了".show(this) + } + dataBeans.addAll(dataRows) + noticeLayout.finishLoadMore() + isLoadMore = false + } + else -> { + dataBeans = dataRows + } + } + weakReferenceHandler.sendEmptyMessage(2023013101) + } + }) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + rightOperateView.setOnClickListener { + AlertControlDialog.Builder() + .setContext(this) + .setTitle("提示") + .setMessage("确定将所有未读消息标为已读?") + .setNegativeButton("取消") + .setPositiveButton("确定") + .setOnDialogButtonClickListener(object : + AlertControlDialog.OnDialogButtonClickListener { + override fun onCancelClick() { + + } + + override fun onConfirmClick() { + //TODO 设置为已读 + } + }).build().show() + } + + if (hasNoticePermission()) { + openSystemNoticeLayout.visibility = View.GONE + openSystemNoticeLayout.visibility = View.GONE + } else { + openSystemNoticeLayout.setOnClickListener { + + } + + + closeLayoutView.setOnClickListener { + openSystemNoticeLayout.visibility = View.GONE + } + } + + noticeLayout.setOnRefreshListener { + isRefresh = true + //刷新之后页码重置 + pageIndex = 1 + getNoticeListByPage() + } + + noticeLayout.setOnLoadMoreListener { + isLoadMore = true + pageIndex++ + getNoticeListByPage() + } + } + + override fun onResume() { + super.onResume() + pageIndex = 1 + getNoticeListByPage() + } + + private fun getNoticeListByPage() { + noticeViewModel.getNoticeList("", "", "", "", "", pageIndex) + } + + private val callback = Handler.Callback { + when (it.what) { + 2023013101 -> { + if (isRefresh || isLoadMore) { + noticeListAdapter.notifyDataSetChanged() + } else { + if (dataBeans.size == 0) { + emptyView!!.showEmptyPage("没有任何消息") { + pageIndex = 1 + getNoticeListByPage() + } + } else { + emptyView!!.hide() + noticeListAdapter = NoticeListAdapter(this, dataBeans) + noticeRecyclerView.adapter = noticeListAdapter + noticeListAdapter.setOnItemClickListener(object : + NoticeListAdapter.OnItemClickListener { + override fun onItemClicked(position: Int) { + val rowsModel = dataBeans[position] + val allArgs = addAll( + rowsModel.noticeNo, + rowsModel.noticeTitle, + rowsModel.noticePublisher, + "", + "" + ) + Log.d( + "Casic", + "NoticeListActivity => onItemClicked: ${rowsModel.minioFileName.combineFilePath()}" + ) + navigatePageTo(allArgs) + } + }) + } + } + } + } + true + } + + //TODO 判断是否开启通知权限 + private fun hasNoticePermission(): Boolean { + + return false + } + + override fun initLayoutView(): Int = R.layout.activity_notice_list + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewDocumentActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewDocumentActivity.kt new file mode 100644 index 0000000..4b16ae8 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewDocumentActivity.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.view.notice + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseActivity + +class PreviewDocumentActivity : KotlinBaseActivity() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.activity_preview_doc + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewPdfActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewPdfActivity.kt new file mode 100644 index 0000000..fad73b6 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewPdfActivity.kt @@ -0,0 +1,62 @@ +package com.casic.xz.meterage.view.notice + +import com.casic.xz.meterage.R +import com.casic.xz.meterage.extensions.combineFilePath +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.callback.OnDownloadListener +import com.pengxh.kt.lite.extensions.createDownloadFileDir +import com.pengxh.kt.lite.extensions.downloadFile +import com.pengxh.kt.lite.utils.Constant +import kotlinx.android.synthetic.main.activity_preview_pdf.* +import kotlinx.android.synthetic.main.include_base_title.* +import java.io.File +import java.io.FileInputStream + + +class PreviewPdfActivity : KotlinBaseActivity() { + + override fun initData() { + val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! + titleView.text = minioFileName + + val url = minioFileName.combineFilePath() + url.downloadFile(createDownloadFileDir().toString(), + object : OnDownloadListener { + override fun onDownloadStart(totalBytes: Long) { + runOnUiThread { + LoadingDialogHub.show(this@PreviewPdfActivity, "附件加载中") + } + } + + override fun onProgressChanged(currentBytes: Long) { + + } + + override fun onDownloadEnd(file: File?) { + runOnUiThread { + LoadingDialogHub.dismiss() + } + val inputStream = FileInputStream(file) + pdfView.fromStream(inputStream).load() + } + }) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + } + + override fun initLayoutView(): Int = R.layout.activity_preview_pdf + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewTextActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewTextActivity.kt new file mode 100644 index 0000000..d7850fb --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewTextActivity.kt @@ -0,0 +1,60 @@ +package com.casic.xz.meterage.view.notice + +import com.casic.xz.meterage.R +import com.casic.xz.meterage.extensions.combineFilePath +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.callback.OnDownloadListener +import com.pengxh.kt.lite.extensions.createDownloadFileDir +import com.pengxh.kt.lite.extensions.downloadFile +import com.pengxh.kt.lite.extensions.read +import com.pengxh.kt.lite.utils.Constant +import kotlinx.android.synthetic.main.activity_preview_txt.* +import kotlinx.android.synthetic.main.include_base_title.* +import java.io.File + +class PreviewTextActivity : KotlinBaseActivity() { + + override fun initData() { + val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! + titleView.text = minioFileName + + val url = minioFileName.combineFilePath() + url.downloadFile(createDownloadFileDir().toString(), + object : OnDownloadListener { + override fun onDownloadStart(totalBytes: Long) { + runOnUiThread { + LoadingDialogHub.show(this@PreviewTextActivity, "附件加载中") + } + } + + override fun onProgressChanged(currentBytes: Long) { + + } + + override fun onDownloadEnd(file: File?) { + runOnUiThread { + LoadingDialogHub.dismiss() + textView.text = file?.read() + } + } + }) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + } + + override fun initLayoutView(): Int = R.layout.activity_preview_txt + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/vm/EquipmentViewModel.kt b/app/src/main/java/com/casic/xz/meterage/vm/EquipmentViewModel.kt new file mode 100644 index 0000000..b5f21f6 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/vm/EquipmentViewModel.kt @@ -0,0 +1,92 @@ +package com.casic.xz.meterage.vm + +import androidx.lifecycle.MutableLiveData +import com.casic.xz.meterage.base.BaseApplication +import com.casic.xz.meterage.extensions.separateResponseCode +import com.casic.xz.meterage.extensions.toErrorMessage +import com.casic.xz.meterage.model.EquipmentDetailModel +import com.casic.xz.meterage.model.EquipmentListModel +import com.casic.xz.meterage.utils.retrofit.RetrofitServiceManager +import com.google.gson.Gson +import com.google.gson.reflect.TypeToken +import com.pengxh.kt.lite.extensions.launch +import com.pengxh.kt.lite.extensions.show +import com.pengxh.kt.lite.vm.BaseViewModel +import com.pengxh.kt.lite.vm.LoadState + +class EquipmentViewModel : BaseViewModel() { + + private val gson by lazy { Gson() } + val equipmentResult = MutableLiveData() + val equipmentDetailResult = MutableLiveData() + + fun getEquipmentList( + equipmentNo: String, + equipmentName: String, + mesureType: String, + managerState: String, + useDept: String, + assetType: String, + equipmentCategory: String, + isCalibrationTestEquipment: String, + isMeasureAccount: String, + isStandardSupportEquipment: String, + isFixedAssets: String, + validStartDate: String, + validEndDate: String, + abc: String, + ids: Array, + offset: Int + ) = launch({ + loadState.value = LoadState.Loading + val response = RetrofitServiceManager.getEquipmentList( + equipmentNo, + equipmentName, + mesureType, + managerState, + useDept, + assetType, + equipmentCategory, + isCalibrationTestEquipment, + isMeasureAccount, + isStandardSupportEquipment, + isFixedAssets, + validStartDate, + validEndDate, + abc, + ids, + offset + ) + val responseCode = response.separateResponseCode() + if (responseCode == 200) { + loadState.value = LoadState.Success + equipmentResult.value = gson.fromJson( + response, object : TypeToken() {}.type + ) + } else { + loadState.value = LoadState.Fail + response.toErrorMessage().show(BaseApplication.get()) + } + }, { + loadState.value = LoadState.Fail + it.printStackTrace() + }) + + fun getEquipmentDetail(id: String) = launch({ + loadState.value = LoadState.Loading + val response = RetrofitServiceManager.getEquipmentDetail(id) + val responseCode = response.separateResponseCode() + if (responseCode == 200) { + loadState.value = LoadState.Success + equipmentDetailResult.value = gson.fromJson( + response, object : TypeToken() {}.type + ) + } else { + loadState.value = LoadState.Fail + response.toErrorMessage().show(BaseApplication.get()) + } + }, { + loadState.value = LoadState.Fail + it.printStackTrace() + }) +} \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_sorting.xml b/app/src/main/res/drawable/ic_sorting.xml new file mode 100644 index 0000000..252bfe6 --- /dev/null +++ b/app/src/main/res/drawable/ic_sorting.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/layout/activity_equipment.xml b/app/src/main/res/layout/activity_equipment.xml new file mode 100644 index 0000000..d6a64b1 --- /dev/null +++ b/app/src/main/res/layout/activity_equipment.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_equipment_detail.xml b/app/src/main/res/layout/activity_equipment_detail.xml new file mode 100644 index 0000000..7254762 --- /dev/null +++ b/app/src/main/res/layout/activity_equipment_detail.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_basic_information.xml b/app/src/main/res/layout/fragment_basic_information.xml new file mode 100644 index 0000000..4a3c1c7 --- /dev/null +++ b/app/src/main/res/layout/fragment_basic_information.xml @@ -0,0 +1,390 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_certificate.xml b/app/src/main/res/layout/fragment_certificate.xml new file mode 100644 index 0000000..77d9ef6 --- /dev/null +++ b/app/src/main/res/layout/fragment_certificate.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_change_record.xml b/app/src/main/res/layout/fragment_change_record.xml new file mode 100644 index 0000000..77d9ef6 --- /dev/null +++ b/app/src/main/res/layout/fragment_change_record.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_home.xml b/app/src/main/res/layout/fragment_home.xml index 41b32a9..e1ab759 100644 --- a/app/src/main/res/layout/fragment_home.xml +++ b/app/src/main/res/layout/fragment_home.xml @@ -71,7 +71,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" app:layoutManager="androidx.recyclerview.widget.GridLayoutManager" - app:spanCount="5" /> + app:spanCount="4" /> + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_mine.xml b/app/src/main/res/layout/fragment_mine.xml index 0643064..d9f57b3 100644 --- a/app/src/main/res/layout/fragment_mine.xml +++ b/app/src/main/res/layout/fragment_mine.xml @@ -22,10 +22,10 @@ android:orientation="horizontal"> + android:src="@mipmap/default_avatar" /> @@ -122,7 +122,7 @@ android:background="@drawable/ic_collection" /> @@ -145,7 +145,7 @@ android:background="@drawable/ic_push_setting" /> @@ -166,7 +166,7 @@ android:background="@drawable/ic_privacy" /> @@ -189,7 +189,7 @@ android:background="@drawable/ic_help" /> @@ -210,7 +210,7 @@ android:background="@drawable/ic_update" /> @@ -231,7 +231,7 @@ android:background="@drawable/ic_about" /> @@ -252,7 +252,7 @@ android:background="@drawable/ic_back" /> diff --git a/app/src/main/res/layout/fragment_usage_record.xml b/app/src/main/res/layout/fragment_usage_record.xml new file mode 100644 index 0000000..77d9ef6 --- /dev/null +++ b/app/src/main/res/layout/fragment_usage_record.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/include_equipment_layout.xml b/app/src/main/res/layout/include_equipment_layout.xml new file mode 100644 index 0000000..ce846d5 --- /dev/null +++ b/app/src/main/res/layout/include_equipment_layout.xml @@ -0,0 +1,74 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/include_line_view.xml b/app/src/main/res/layout/include_line_view.xml new file mode 100644 index 0000000..ff89de3 --- /dev/null +++ b/app/src/main/res/layout/include_line_view.xml @@ -0,0 +1,5 @@ + + \ No newline at end of file diff --git a/app/src/main/res/layout/include_search_title.xml b/app/src/main/res/layout/include_search_title.xml new file mode 100644 index 0000000..644fa4c --- /dev/null +++ b/app/src/main/res/layout/include_search_title.xml @@ -0,0 +1,35 @@ + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/item_equipment_rv_l.xml b/app/src/main/res/layout/item_equipment_rv_l.xml new file mode 100644 index 0000000..796f4b1 --- /dev/null +++ b/app/src/main/res/layout/item_equipment_rv_l.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-xxxhdpi/default_avatar.jpg b/app/src/main/res/mipmap-xxxhdpi/default_avatar.jpg new file mode 100644 index 0000000..5f1e521 --- /dev/null +++ b/app/src/main/res/mipmap-xxxhdpi/default_avatar.jpg Binary files differ diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 3892b5a..02160cd 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -34,16 +34,18 @@ - - - - - - - + + + + + + + + + +) : RecyclerView.Adapter() { + + private var layoutInflater: LayoutInflater = LayoutInflater.from(context) + + override fun getItemCount(): Int = dataRows.size + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = ItemViewHolder( + layoutInflater.inflate(R.layout.item_equipment_rv_l, parent, false) + ) + + override fun onBindViewHolder(holder: ItemViewHolder, position: Int) { + //绑定数据 + val rowsBean = dataRows[position] + holder.equipmentNameView.text = rowsBean.equipmentName + holder.equipmentCodeView.text = rowsBean.equipmentNo + holder.equipmentDateView.text = rowsBean.enableDate + holder.equipmentLibView.text = rowsBean.useDeptName + + //绑定事件 + holder.itemView.setOnClickListener { + listener?.onItemClicked(position) + } + } + + inner class ItemViewHolder(view: View) : RecyclerView.ViewHolder(view) { + var equipmentNameView: TextView = view.findViewById(R.id.equipmentNameView) + var equipmentCodeView: TextView = view.findViewById(R.id.equipmentCodeView) + var equipmentDateView: TextView = view.findViewById(R.id.equipmentDateView) + var equipmentLibView: TextView = view.findViewById(R.id.equipmentLibView) + } + + private var listener: OnItemClickListener? = null + + interface OnItemClickListener { + fun onItemClicked(position: Int) + } + + fun setOnItemClickListener(onClickListener: OnItemClickListener?) { + this.listener = onClickListener + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt index b4628f3..d970b55 100644 --- a/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt +++ b/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt @@ -5,7 +5,8 @@ import com.casic.xz.meterage.R import com.casic.xz.meterage.adapter.HomeGridAdapter import com.casic.xz.meterage.utils.LocaleConstant -import com.casic.xz.meterage.view.NoticeListActivity +import com.casic.xz.meterage.view.home.EquipmentActivity +import com.casic.xz.meterage.view.notice.NoticeListActivity import com.casic.xz.meterage.vm.NoticeViewModel import com.pengxh.kt.lite.base.KotlinBaseFragment import com.pengxh.kt.lite.extensions.navigatePageTo @@ -36,8 +37,19 @@ homeFuncRecyclerView.adapter = homeAdapter homeAdapter.setOnGridItemClickListener(object : HomeGridAdapter.OnGridItemClickListener { override fun onItemClick(position: Int) { - when (position) { - + when (LocaleConstant.HOME_FUNC_OPERATE[position]) { + "仪器设备" -> requireContext().navigatePageTo() +// "标准装置" -> requireContext().navigatePageTo() +// "证书报告" -> requireContext().navigatePageTo() +// "委托需求" -> requireContext().navigatePageTo() +// "访客" -> requireContext().navigatePageTo() +// "标准规范" -> requireContext().navigatePageTo() +// "能力列表" -> requireContext().navigatePageTo() +// "计量培训" -> requireContext().navigatePageTo() +// "合同发票" -> requireContext().navigatePageTo() +// "业务统计" -> requireContext().navigatePageTo() +// "客户列表" -> requireContext().navigatePageTo() +// "外场检测" -> requireContext().navigatePageTo() } } }) diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt index 7e75abe..56dc5ec 100644 --- a/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt +++ b/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt @@ -2,9 +2,11 @@ import android.view.View import androidx.lifecycle.ViewModelProvider +import com.bumptech.glide.Glide +import com.bumptech.glide.request.RequestOptions import com.casic.xz.meterage.R import com.casic.xz.meterage.utils.LocaleConstant -import com.casic.xz.meterage.view.NoticeListActivity +import com.casic.xz.meterage.view.notice.NoticeListActivity import com.casic.xz.meterage.vm.NoticeViewModel import com.casic.xz.meterage.vm.UserViewModel import com.pengxh.kt.lite.base.KotlinBaseFragment @@ -23,6 +25,12 @@ val data = it.data userNameView.text = data.name userUnitView.text = data.deptName + +// Glide.with(requireContext()) +// .load(R.mipmap.default_avatar) +// .apply(RequestOptions.circleCropTransform()) +// .placeholder(R.mipmap.load_image_error) +// .into(userAvatarView) } }) diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt new file mode 100644 index 0000000..cf22646 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt @@ -0,0 +1,103 @@ +package com.casic.xz.meterage.fragment.equipment + +import android.graphics.Paint +import androidx.lifecycle.ViewModelProvider +import com.casic.xz.meterage.R +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.casic.xz.meterage.vm.EquipmentViewModel +import com.pengxh.kt.lite.base.KotlinBaseFragment +import com.pengxh.kt.lite.extensions.convertColor +import com.pengxh.kt.lite.vm.LoadState +import kotlinx.android.synthetic.main.fragment_basic_information.* + +class BasicInformationFragment(private val id: String) : KotlinBaseFragment() { + + private lateinit var equipmentViewModel: EquipmentViewModel + + override fun initData() { + equipmentViewModel = ViewModelProvider(this)[EquipmentViewModel::class.java] + equipmentViewModel.getEquipmentDetail(id) + equipmentViewModel.equipmentDetailResult.observe(this, { + if (it.code == 200) { + val data = it.data!! + + equipmentCodeView.text = data.equipmentNo + equipmentNameView.text = data.equipmentName + manufacturerView.text = data.manufacturer + factoryNumberView.text = data.manufacturingNo + modelView.text = data.modelNo + verificationMethodView.text = data.mesureTypeName + measuringRangeView.text = data.mesureRange + uncertaintyView.text = data.uncertainty + firstUseView.text = data.createTime + originalValueView.text = data.originValue + usageDeptView.text = data.useDeptName + userView.text = data.usePersonName + managementStatusView.text = data.managerStateName + verificationDeptView.text = data.useDeptName +// nextVerificationDeptView.text = data. + verificationPeriodView.text = data.mesureCycle + verificationDateView.text = data.mesureDate + effectiveDateView.text = data.validDate + verificationResultsView.text = data.mesureResultName + abcView.text = data.abcName + isNeedTechnicalView.text = if ( + data.isCalibrationTestEquipment.isNullOrBlank() || data.isCalibrationTestEquipment == "0" + ) { + "否" + } else { + "是" + } + + isStandingBook.text = if ( + data.isMeasureAccount.isNullOrBlank() || data.isMeasureAccount == "0" + ) { + "否" + } else { + "是" + } + + isStandardView.text = if ( + data.isStandardSupportEquipment.isNullOrBlank() || data.isStandardSupportEquipment == "0" + ) { + "否" + } else { + "是" + } + remarkView.text = data.remark + if (data.fileList.size == 0) { + instructionsView.text = "暂无" + } else { + instructionsView.text = "查看附件列表" + val textPaint = instructionsView.paint + textPaint.flags = Paint.UNDERLINE_TEXT_FLAG + textPaint.isAntiAlias = true + instructionsView.setTextColor(R.color.themeColor.convertColor(requireContext())) + + instructionsView.setOnClickListener { + + } + } + } + }) + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_basic_information + + override fun observeRequestState() { + equipmentViewModel.loadState.observe(this, { + when (it) { + LoadState.Loading -> LoadingDialogHub.show(requireActivity(), "数据加载中...") + else -> LoadingDialogHub.dismiss() + } + }) + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt new file mode 100644 index 0000000..0b4a747 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class CertificateFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_certificate + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt new file mode 100644 index 0000000..f05c491 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class ChangeRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_change_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt new file mode 100644 index 0000000..849ffa5 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class InspectionRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_inspection_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt new file mode 100644 index 0000000..aa4edd9 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class UsageRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_usage_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java b/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java new file mode 100644 index 0000000..0b9124e --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java @@ -0,0 +1,760 @@ +package com.casic.xz.meterage.model; + +import java.util.List; + +public class EquipmentDetailModel { + + private int code; + private DataModel data; + private String message; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataModel getData() { + return data; + } + + public void setData(DataModel data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public static class DataModel { + private String abc; + private String abcName; + private String assetNo; + private String assetSource; + private String assetType; + private String assetTypeName; + private String attribute; + private String capitalSource; + private String capitalSourceName; + private String cardEstablishmentDate; + private String createTime; + private String createUser; + private String depreciationMethod; + private String depreciationMethodName; + private String depreciationPeriod; + private String enableDate; + private String equipmentCategory; + private String equipmentCategoryName; + private String equipmentName; + private String equipmentNo; + private String equipmentSpecifications; + private String equipmentType; + private String equipmentTypeName; + private List fileList; + private String id; + private String installIncidentalExpenses; + private String installPlace; + private String intactState; + private String isCalibrationTestEquipment; + private int isDel; + private String isFixedAssets; + private String isMeasureAccount; + private String isStandardSupportEquipment; + private String labelBind; + private String majorCategory; + private String majorCategoryName; + private String managerLevel; + private String managerLevelName; + private String managerState; + private String managerStateName; + private String manufacturer; + private String manufacturerCountry; + private String manufacturingDate; + private String manufacturingNo; + private String mesureCycle; + private String mesureDate; + private String mesureDept; + private String mesureRange; + private String mesureResult; + private String mesureResultName; + private String mesureType; + private String mesureTypeName; + private String modelNo; + private String originValue; + private String overallDimension; + private String presentOriginValue; + private String purpose; + private String remark; + private String singlePrice; + private String supportStandardEquipmentName; + private String supportStandardEquipmentNo; + private String technicalLevel; + private String uncertainty; + private String updateTime; + private String useDept; + private String useDeptName; + private String usePerson; + private String usePersonName; + private String validDate; + private int version; + private String weight; + + public String getAbc() { + return abc; + } + + public void setAbc(String abc) { + this.abc = abc; + } + + public String getAbcName() { + return abcName; + } + + public void setAbcName(String abcName) { + this.abcName = abcName; + } + + public String getAssetNo() { + return assetNo; + } + + public void setAssetNo(String assetNo) { + this.assetNo = assetNo; + } + + public String getAssetSource() { + return assetSource; + } + + public void setAssetSource(String assetSource) { + this.assetSource = assetSource; + } + + public String getAssetType() { + return assetType; + } + + public void setAssetType(String assetType) { + this.assetType = assetType; + } + + public String getAssetTypeName() { + return assetTypeName; + } + + public void setAssetTypeName(String assetTypeName) { + this.assetTypeName = assetTypeName; + } + + public String getAttribute() { + return attribute; + } + + public void setAttribute(String attribute) { + this.attribute = attribute; + } + + public String getCapitalSource() { + return capitalSource; + } + + public void setCapitalSource(String capitalSource) { + this.capitalSource = capitalSource; + } + + public String getCapitalSourceName() { + return capitalSourceName; + } + + public void setCapitalSourceName(String capitalSourceName) { + this.capitalSourceName = capitalSourceName; + } + + public String getCardEstablishmentDate() { + return cardEstablishmentDate; + } + + public void setCardEstablishmentDate(String cardEstablishmentDate) { + this.cardEstablishmentDate = cardEstablishmentDate; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getDepreciationMethod() { + return depreciationMethod; + } + + public void setDepreciationMethod(String depreciationMethod) { + this.depreciationMethod = depreciationMethod; + } + + public String getDepreciationMethodName() { + return depreciationMethodName; + } + + public void setDepreciationMethodName(String depreciationMethodName) { + this.depreciationMethodName = depreciationMethodName; + } + + public String getDepreciationPeriod() { + return depreciationPeriod; + } + + public void setDepreciationPeriod(String depreciationPeriod) { + this.depreciationPeriod = depreciationPeriod; + } + + public String getEnableDate() { + return enableDate; + } + + public void setEnableDate(String enableDate) { + this.enableDate = enableDate; + } + + public String getEquipmentCategory() { + return equipmentCategory; + } + + public void setEquipmentCategory(String equipmentCategory) { + this.equipmentCategory = equipmentCategory; + } + + public String getEquipmentCategoryName() { + return equipmentCategoryName; + } + + public void setEquipmentCategoryName(String equipmentCategoryName) { + this.equipmentCategoryName = equipmentCategoryName; + } + + public String getEquipmentName() { + return equipmentName; + } + + public void setEquipmentName(String equipmentName) { + this.equipmentName = equipmentName; + } + + public String getEquipmentNo() { + return equipmentNo; + } + + public void setEquipmentNo(String equipmentNo) { + this.equipmentNo = equipmentNo; + } + + public String getEquipmentSpecifications() { + return equipmentSpecifications; + } + + public void setEquipmentSpecifications(String equipmentSpecifications) { + this.equipmentSpecifications = equipmentSpecifications; + } + + public String getEquipmentType() { + return equipmentType; + } + + public void setEquipmentType(String equipmentType) { + this.equipmentType = equipmentType; + } + + public String getEquipmentTypeName() { + return equipmentTypeName; + } + + public void setEquipmentTypeName(String equipmentTypeName) { + this.equipmentTypeName = equipmentTypeName; + } + + public List getFileList() { + return fileList; + } + + public void setFileList(List fileList) { + this.fileList = fileList; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getInstallIncidentalExpenses() { + return installIncidentalExpenses; + } + + public void setInstallIncidentalExpenses(String installIncidentalExpenses) { + this.installIncidentalExpenses = installIncidentalExpenses; + } + + public String getInstallPlace() { + return installPlace; + } + + public void setInstallPlace(String installPlace) { + this.installPlace = installPlace; + } + + public String getIntactState() { + return intactState; + } + + public void setIntactState(String intactState) { + this.intactState = intactState; + } + + public String getIsCalibrationTestEquipment() { + return isCalibrationTestEquipment; + } + + public void setIsCalibrationTestEquipment(String isCalibrationTestEquipment) { + this.isCalibrationTestEquipment = isCalibrationTestEquipment; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getIsFixedAssets() { + return isFixedAssets; + } + + public void setIsFixedAssets(String isFixedAssets) { + this.isFixedAssets = isFixedAssets; + } + + public String getIsMeasureAccount() { + return isMeasureAccount; + } + + public void setIsMeasureAccount(String isMeasureAccount) { + this.isMeasureAccount = isMeasureAccount; + } + + public String getIsStandardSupportEquipment() { + return isStandardSupportEquipment; + } + + public void setIsStandardSupportEquipment(String isStandardSupportEquipment) { + this.isStandardSupportEquipment = isStandardSupportEquipment; + } + + public String getLabelBind() { + return labelBind; + } + + public void setLabelBind(String labelBind) { + this.labelBind = labelBind; + } + + public String getMajorCategory() { + return majorCategory; + } + + public void setMajorCategory(String majorCategory) { + this.majorCategory = majorCategory; + } + + public String getMajorCategoryName() { + return majorCategoryName; + } + + public void setMajorCategoryName(String majorCategoryName) { + this.majorCategoryName = majorCategoryName; + } + + public String getManagerLevel() { + return managerLevel; + } + + public void setManagerLevel(String managerLevel) { + this.managerLevel = managerLevel; + } + + public String getManagerLevelName() { + return managerLevelName; + } + + public void setManagerLevelName(String managerLevelName) { + this.managerLevelName = managerLevelName; + } + + public String getManagerState() { + return managerState; + } + + public void setManagerState(String managerState) { + this.managerState = managerState; + } + + public String getManagerStateName() { + return managerStateName; + } + + public void setManagerStateName(String managerStateName) { + this.managerStateName = managerStateName; + } + + public String getManufacturer() { + return manufacturer; + } + + public void setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + } + + public String getManufacturerCountry() { + return manufacturerCountry; + } + + public void setManufacturerCountry(String manufacturerCountry) { + this.manufacturerCountry = manufacturerCountry; + } + + public String getManufacturingDate() { + return manufacturingDate; + } + + public void setManufacturingDate(String manufacturingDate) { + this.manufacturingDate = manufacturingDate; + } + + public String getManufacturingNo() { + return manufacturingNo; + } + + public void setManufacturingNo(String manufacturingNo) { + this.manufacturingNo = manufacturingNo; + } + + public String getMesureCycle() { + return mesureCycle; + } + + public void setMesureCycle(String mesureCycle) { + this.mesureCycle = mesureCycle; + } + + public String getMesureDate() { + return mesureDate; + } + + public void setMesureDate(String mesureDate) { + this.mesureDate = mesureDate; + } + + public String getMesureDept() { + return mesureDept; + } + + public void setMesureDept(String mesureDept) { + this.mesureDept = mesureDept; + } + + public String getMesureRange() { + return mesureRange; + } + + public void setMesureRange(String mesureRange) { + this.mesureRange = mesureRange; + } + + public String getMesureResult() { + return mesureResult; + } + + public void setMesureResult(String mesureResult) { + this.mesureResult = mesureResult; + } + + public String getMesureResultName() { + return mesureResultName; + } + + public void setMesureResultName(String mesureResultName) { + this.mesureResultName = mesureResultName; + } + + public String getMesureType() { + return mesureType; + } + + public void setMesureType(String mesureType) { + this.mesureType = mesureType; + } + + public String getMesureTypeName() { + return mesureTypeName; + } + + public void setMesureTypeName(String mesureTypeName) { + this.mesureTypeName = mesureTypeName; + } + + public String getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getOriginValue() { + return originValue; + } + + public void setOriginValue(String originValue) { + this.originValue = originValue; + } + + public String getOverallDimension() { + return overallDimension; + } + + public void setOverallDimension(String overallDimension) { + this.overallDimension = overallDimension; + } + + public String getPresentOriginValue() { + return presentOriginValue; + } + + public void setPresentOriginValue(String presentOriginValue) { + this.presentOriginValue = presentOriginValue; + } + + public String getPurpose() { + return purpose; + } + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getSinglePrice() { + return singlePrice; + } + + public void setSinglePrice(String singlePrice) { + this.singlePrice = singlePrice; + } + + public String getSupportStandardEquipmentName() { + return supportStandardEquipmentName; + } + + public void setSupportStandardEquipmentName(String supportStandardEquipmentName) { + this.supportStandardEquipmentName = supportStandardEquipmentName; + } + + public String getSupportStandardEquipmentNo() { + return supportStandardEquipmentNo; + } + + public void setSupportStandardEquipmentNo(String supportStandardEquipmentNo) { + this.supportStandardEquipmentNo = supportStandardEquipmentNo; + } + + public String getTechnicalLevel() { + return technicalLevel; + } + + public void setTechnicalLevel(String technicalLevel) { + this.technicalLevel = technicalLevel; + } + + public String getUncertainty() { + return uncertainty; + } + + public void setUncertainty(String uncertainty) { + this.uncertainty = uncertainty; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getUseDept() { + return useDept; + } + + public void setUseDept(String useDept) { + this.useDept = useDept; + } + + public String getUseDeptName() { + return useDeptName; + } + + public void setUseDeptName(String useDeptName) { + this.useDeptName = useDeptName; + } + + public String getUsePerson() { + return usePerson; + } + + public void setUsePerson(String usePerson) { + this.usePerson = usePerson; + } + + public String getUsePersonName() { + return usePersonName; + } + + public void setUsePersonName(String usePersonName) { + this.usePersonName = usePersonName; + } + + public String getValidDate() { + return validDate; + } + + public void setValidDate(String validDate) { + this.validDate = validDate; + } + + public int getVersion() { + return version; + } + + public void setVersion(int version) { + this.version = version; + } + + public String getWeight() { + return weight; + } + + public void setWeight(String weight) { + this.weight = weight; + } + + public static class FileListModel { + private String assetId; + private String createTime; + private String createUser; + private String fileName; + private String id; + private int isDel; + private String minioFileName; + private String remark; + private String updateTime; + + public String getAssetId() { + return assetId; + } + + public void setAssetId(String assetId) { + this.assetId = assetId; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getFileName() { + return fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getMinioFileName() { + return minioFileName; + } + + public void setMinioFileName(String minioFileName) { + this.minioFileName = minioFileName; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + } + } +} diff --git a/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java b/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java new file mode 100644 index 0000000..15fc128 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java @@ -0,0 +1,697 @@ +package com.casic.xz.meterage.model; + +import java.util.List; + +public class EquipmentListModel { + + private int code; + private DataModel data; + private String message; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataModel getData() { + return data; + } + + public void setData(DataModel data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public static class DataModel { + private List rows; + private int total; + + public List getRows() { + return rows; + } + + public void setRows(List rows) { + this.rows = rows; + } + + public int getTotal() { + return total; + } + + public void setTotal(int total) { + this.total = total; + } + + public static class RowsModel { + private String abc; + private String abcName; + private String assetNo; + private String assetSource; + private String assetType; + private String assetTypeName; + private String attribute; + private String capitalSource; + private String capitalSourceName; + private String cardEstablishmentDate; + private String createTime; + private String createUser; + private String depreciationMethod; + private String depreciationMethodName; + private String depreciationPeriod; + private String enableDate; + private String equipmentCategory; + private String equipmentCategoryName; + private String equipmentName; + private String equipmentNo; + private String equipmentSpecifications; + private String equipmentType; + private String equipmentTypeName; + private String fileList; + private String id; + private String installIncidentalExpenses; + private String installPlace; + private String intactState; + private String isCalibrationTestEquipment; + private int isDel; + private String isFixedAssets; + private String isMeasureAccount; + private String isStandardSupportEquipment; + private String labelBind; + private String majorCategory; + private String majorCategoryName; + private String managerLevel; + private String managerLevelName; + private String managerState; + private String managerStateName; + private String manufacturer; + private String manufacturerCountry; + private String manufacturingDate; + private String manufacturingNo; + private String mesureCycle; + private String mesureDate; + private String mesureDept; + private String mesureRange; + private String mesureResult; + private String mesureResultName; + private String mesureType; + private String mesureTypeName; + private String modelNo; + private String originValue; + private String overallDimension; + private String presentOriginValue; + private String purpose; + private String remark; + private String singlePrice; + private String supportStandardEquipmentName; + private String supportStandardEquipmentNo; + private String technicalLevel; + private String uncertainty; + private String updateTime; + private String useDept; + private String useDeptName; + private String usePerson; + private String usePersonName; + private String validDate; + private int version; + private String weight; + + public String getAbc() { + return abc; + } + + public void setAbc(String abc) { + this.abc = abc; + } + + public String getAbcName() { + return abcName; + } + + public void setAbcName(String abcName) { + this.abcName = abcName; + } + + public String getAssetNo() { + return assetNo; + } + + public void setAssetNo(String assetNo) { + this.assetNo = assetNo; + } + + public String getAssetSource() { + return assetSource; + } + + public void setAssetSource(String assetSource) { + this.assetSource = assetSource; + } + + public String getAssetType() { + return assetType; + } + + public void setAssetType(String assetType) { + this.assetType = assetType; + } + + public String getAssetTypeName() { + return assetTypeName; + } + + public void setAssetTypeName(String assetTypeName) { + this.assetTypeName = assetTypeName; + } + + public String getAttribute() { + return attribute; + } + + public void setAttribute(String attribute) { + this.attribute = attribute; + } + + public String getCapitalSource() { + return capitalSource; + } + + public void setCapitalSource(String capitalSource) { + this.capitalSource = capitalSource; + } + + public String getCapitalSourceName() { + return capitalSourceName; + } + + public void setCapitalSourceName(String capitalSourceName) { + this.capitalSourceName = capitalSourceName; + } + + public String getCardEstablishmentDate() { + return cardEstablishmentDate; + } + + public void setCardEstablishmentDate(String cardEstablishmentDate) { + this.cardEstablishmentDate = cardEstablishmentDate; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getDepreciationMethod() { + return depreciationMethod; + } + + public void setDepreciationMethod(String depreciationMethod) { + this.depreciationMethod = depreciationMethod; + } + + public String getDepreciationMethodName() { + return depreciationMethodName; + } + + public void setDepreciationMethodName(String depreciationMethodName) { + this.depreciationMethodName = depreciationMethodName; + } + + public String getDepreciationPeriod() { + return depreciationPeriod; + } + + public void setDepreciationPeriod(String depreciationPeriod) { + this.depreciationPeriod = depreciationPeriod; + } + + public String getEnableDate() { + return enableDate; + } + + public void setEnableDate(String enableDate) { + this.enableDate = enableDate; + } + + public String getEquipmentCategory() { + return equipmentCategory; + } + + public void setEquipmentCategory(String equipmentCategory) { + this.equipmentCategory = equipmentCategory; + } + + public String getEquipmentCategoryName() { + return equipmentCategoryName; + } + + public void setEquipmentCategoryName(String equipmentCategoryName) { + this.equipmentCategoryName = equipmentCategoryName; + } + + public String getEquipmentName() { + return equipmentName; + } + + public void setEquipmentName(String equipmentName) { + this.equipmentName = equipmentName; + } + + public String getEquipmentNo() { + return equipmentNo; + } + + public void setEquipmentNo(String equipmentNo) { + this.equipmentNo = equipmentNo; + } + + public String getEquipmentSpecifications() { + return equipmentSpecifications; + } + + public void setEquipmentSpecifications(String equipmentSpecifications) { + this.equipmentSpecifications = equipmentSpecifications; + } + + public String getEquipmentType() { + return equipmentType; + } + + public void setEquipmentType(String equipmentType) { + this.equipmentType = equipmentType; + } + + public String getEquipmentTypeName() { + return equipmentTypeName; + } + + public void setEquipmentTypeName(String equipmentTypeName) { + this.equipmentTypeName = equipmentTypeName; + } + + public String getFileList() { + return fileList; + } + + public void setFileList(String fileList) { + this.fileList = fileList; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getInstallIncidentalExpenses() { + return installIncidentalExpenses; + } + + public void setInstallIncidentalExpenses(String installIncidentalExpenses) { + this.installIncidentalExpenses = installIncidentalExpenses; + } + + public String getInstallPlace() { + return installPlace; + } + + public void setInstallPlace(String installPlace) { + this.installPlace = installPlace; + } + + public String getIntactState() { + return intactState; + } + + public void setIntactState(String intactState) { + this.intactState = intactState; + } + + public String getIsCalibrationTestEquipment() { + return isCalibrationTestEquipment; + } + + public void setIsCalibrationTestEquipment(String isCalibrationTestEquipment) { + this.isCalibrationTestEquipment = isCalibrationTestEquipment; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getIsFixedAssets() { + return isFixedAssets; + } + + public void setIsFixedAssets(String isFixedAssets) { + this.isFixedAssets = isFixedAssets; + } + + public String getIsMeasureAccount() { + return isMeasureAccount; + } + + public void setIsMeasureAccount(String isMeasureAccount) { + this.isMeasureAccount = isMeasureAccount; + } + + public String getIsStandardSupportEquipment() { + return isStandardSupportEquipment; + } + + public void setIsStandardSupportEquipment(String isStandardSupportEquipment) { + this.isStandardSupportEquipment = isStandardSupportEquipment; + } + + public String getLabelBind() { + return labelBind; + } + + public void setLabelBind(String labelBind) { + this.labelBind = labelBind; + } + + public String getMajorCategory() { + return majorCategory; + } + + public void setMajorCategory(String majorCategory) { + this.majorCategory = majorCategory; + } + + public String getMajorCategoryName() { + return majorCategoryName; + } + + public void setMajorCategoryName(String majorCategoryName) { + this.majorCategoryName = majorCategoryName; + } + + public String getManagerLevel() { + return managerLevel; + } + + public void setManagerLevel(String managerLevel) { + this.managerLevel = managerLevel; + } + + public String getManagerLevelName() { + return managerLevelName; + } + + public void setManagerLevelName(String managerLevelName) { + this.managerLevelName = managerLevelName; + } + + public String getManagerState() { + return managerState; + } + + public void setManagerState(String managerState) { + this.managerState = managerState; + } + + public String getManagerStateName() { + return managerStateName; + } + + public void setManagerStateName(String managerStateName) { + this.managerStateName = managerStateName; + } + + public String getManufacturer() { + return manufacturer; + } + + public void setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + } + + public String getManufacturerCountry() { + return manufacturerCountry; + } + + public void setManufacturerCountry(String manufacturerCountry) { + this.manufacturerCountry = manufacturerCountry; + } + + public String getManufacturingDate() { + return manufacturingDate; + } + + public void setManufacturingDate(String manufacturingDate) { + this.manufacturingDate = manufacturingDate; + } + + public String getManufacturingNo() { + return manufacturingNo; + } + + public void setManufacturingNo(String manufacturingNo) { + this.manufacturingNo = manufacturingNo; + } + + public String getMesureCycle() { + return mesureCycle; + } + + public void setMesureCycle(String mesureCycle) { + this.mesureCycle = mesureCycle; + } + + public String getMesureDate() { + return mesureDate; + } + + public void setMesureDate(String mesureDate) { + this.mesureDate = mesureDate; + } + + public String getMesureDept() { + return mesureDept; + } + + public void setMesureDept(String mesureDept) { + this.mesureDept = mesureDept; + } + + public String getMesureRange() { + return mesureRange; + } + + public void setMesureRange(String mesureRange) { + this.mesureRange = mesureRange; + } + + public String getMesureResult() { + return mesureResult; + } + + public void setMesureResult(String mesureResult) { + this.mesureResult = mesureResult; + } + + public String getMesureResultName() { + return mesureResultName; + } + + public void setMesureResultName(String mesureResultName) { + this.mesureResultName = mesureResultName; + } + + public String getMesureType() { + return mesureType; + } + + public void setMesureType(String mesureType) { + this.mesureType = mesureType; + } + + public String getMesureTypeName() { + return mesureTypeName; + } + + public void setMesureTypeName(String mesureTypeName) { + this.mesureTypeName = mesureTypeName; + } + + public String getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getOriginValue() { + return originValue; + } + + public void setOriginValue(String originValue) { + this.originValue = originValue; + } + + public String getOverallDimension() { + return overallDimension; + } + + public void setOverallDimension(String overallDimension) { + this.overallDimension = overallDimension; + } + + public String getPresentOriginValue() { + return presentOriginValue; + } + + public void setPresentOriginValue(String presentOriginValue) { + this.presentOriginValue = presentOriginValue; + } + + public String getPurpose() { + return purpose; + } + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getSinglePrice() { + return singlePrice; + } + + public void setSinglePrice(String singlePrice) { + this.singlePrice = singlePrice; + } + + public String getSupportStandardEquipmentName() { + return supportStandardEquipmentName; + } + + public void setSupportStandardEquipmentName(String supportStandardEquipmentName) { + this.supportStandardEquipmentName = supportStandardEquipmentName; + } + + public String getSupportStandardEquipmentNo() { + return supportStandardEquipmentNo; + } + + public void setSupportStandardEquipmentNo(String supportStandardEquipmentNo) { + this.supportStandardEquipmentNo = supportStandardEquipmentNo; + } + + public String getTechnicalLevel() { + return technicalLevel; + } + + public void setTechnicalLevel(String technicalLevel) { + this.technicalLevel = technicalLevel; + } + + public String getUncertainty() { + return uncertainty; + } + + public void setUncertainty(String uncertainty) { + this.uncertainty = uncertainty; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getUseDept() { + return useDept; + } + + public void setUseDept(String useDept) { + this.useDept = useDept; + } + + public String getUseDeptName() { + return useDeptName; + } + + public void setUseDeptName(String useDeptName) { + this.useDeptName = useDeptName; + } + + public String getUsePerson() { + return usePerson; + } + + public void setUsePerson(String usePerson) { + this.usePerson = usePerson; + } + + public String getUsePersonName() { + return usePersonName; + } + + public void setUsePersonName(String usePersonName) { + this.usePersonName = usePersonName; + } + + public String getValidDate() { + return validDate; + } + + public void setValidDate(String validDate) { + this.validDate = validDate; + } + + public int getVersion() { + return version; + } + + public void setVersion(int version) { + this.version = version; + } + + public String getWeight() { + return weight; + } + + public void setWeight(String weight) { + this.weight = weight; + } + } + } +} diff --git a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt index a3f514f..46e5eef 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt @@ -35,4 +35,24 @@ @QueryMap limit: Map, @QueryMap offset: Map ): String + + /** + * 获取设备列表 + */ + @POST("/meter/assets/listPage") + suspend fun getEquipmentList( + @Header("token") token: String, + @Body requestBody: RequestBody, + @QueryMap limit: Map, + @QueryMap offset: Map + ): String + + /** + * 获取设备详情 + */ + @POST("/meter/assets/detail") + suspend fun getEquipmentDetail( + @Header("token") token: String, + @Body requestBody: RequestBody + ): String } \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt index 444a872..386a1d8 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt @@ -6,8 +6,10 @@ import com.pengxh.kt.lite.utils.SaveKeyValues import okhttp3.MediaType.Companion.toMediaType import okhttp3.RequestBody.Companion.toRequestBody +import org.json.JSONArray import org.json.JSONObject + object RetrofitServiceManager { private val api by lazy { @@ -73,4 +75,71 @@ offsetMap["offset"] = offset return api.getNoticeList(AuthenticationHelper.token!!, requestBody, limitMap, offsetMap) } + + /** + * 获取设备列表 + */ + suspend fun getEquipmentList( + equipmentNo: String, + equipmentName: String, + mesureType: String, + managerState: String, + useDept: String, + assetType: String, + equipmentCategory: String, + isCalibrationTestEquipment: String, + isMeasureAccount: String, + isStandardSupportEquipment: String, + isFixedAssets: String, + validStartDate: String, + validEndDate: String, + abc: String, + ids: Array, + offset: Int + ): String { + val paramObject = JSONObject() + paramObject.put("equipmentNo", equipmentNo) + paramObject.put("equipmentName", equipmentName) + paramObject.put("mesureType", mesureType) + paramObject.put("managerState", managerState) + paramObject.put("useDept", useDept) + paramObject.put("assetType", assetType) + paramObject.put("equipmentCategory", equipmentCategory) + paramObject.put("isCalibrationTestEquipment", isCalibrationTestEquipment) + paramObject.put("isMeasureAccount", isMeasureAccount) + paramObject.put("isStandardSupportEquipment", isStandardSupportEquipment) + paramObject.put("isFixedAssets", isFixedAssets) + paramObject.put("validStartDate", validStartDate) + paramObject.put("validEndDate", validEndDate) + paramObject.put("abc", abc) + + val jsonArray = JSONArray() + ids.forEach { + jsonArray.put(it) + } + paramObject.put("ids", jsonArray) + + val requestBody = paramObject.toString().toRequestBody( + "application/json;charset=UTF-8".toMediaType() + ) + + val limitMap = HashMap() + limitMap["limit"] = LocaleConstant.PAGE_LIMIT + + val offsetMap = HashMap() + offsetMap["offset"] = offset + return api.getEquipmentList(AuthenticationHelper.token!!, requestBody, limitMap, offsetMap) + } + + /** + * 获取设备详情 + */ + suspend fun getEquipmentDetail(id: String): String { + val paramObject = JSONObject() + paramObject.put("id", id) + val requestBody = paramObject.toString().toRequestBody( + "application/json;charset=UTF-8".toMediaType() + ) + return api.getEquipmentDetail(AuthenticationHelper.token!!, requestBody) + } } \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt deleted file mode 100644 index a5bb60b..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt +++ /dev/null @@ -1,104 +0,0 @@ -package com.casic.xz.meterage.view - -import android.annotation.SuppressLint -import android.graphics.Paint -import androidx.lifecycle.ViewModelProvider -import com.casic.xz.meterage.R -import com.casic.xz.meterage.extensions.combineImagePath -import com.casic.xz.meterage.extensions.formatTextFromHtml -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.vm.NoticeViewModel -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.extensions.convertColor -import com.pengxh.kt.lite.extensions.navigatePageTo -import com.pengxh.kt.lite.extensions.obtainScreenWidth -import com.pengxh.kt.lite.extensions.show -import com.pengxh.kt.lite.utils.Constant -import kotlinx.android.synthetic.main.activity_notice_detail.* -import kotlinx.android.synthetic.main.include_base_title.* -import java.util.* - -@SuppressLint("SetTextI18n") -class NoticeDetailActivity : KotlinBaseActivity() { - - private lateinit var noticeViewModel: NoticeViewModel - - override fun initData() { - leftBackView.setOnClickListener { finish() } - titleView.text = "通知公告" - - val args = intent.getStringArrayListExtra(Constant.INTENT_PARAM)!! - - noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] - noticeViewModel.getNoticeList(args[0], args[1], args[2], "", "", 1) - noticeViewModel.noticeResult.observe(this, { - if (it.code == 200) { - val dataRow = it.data?.rows!![0] - - noticeDateView.text = dataRow.noticeTime - noticePublisherView.text = "发布人 ${dataRow.noticePublisher}" - noticeCompanyView.text = "发布单位 ${dataRow.noticeCompany}" - - noticeNoView.text = dataRow.noticeNo - noticeTitleView.text = dataRow.noticeTitle - noticeSketchView.text = dataRow.noticeSketch - - dataRow.noticeContent.formatTextFromHtml( - this, noticeContentView, obtainScreenWidth() - ) - - if (dataRow.minioFileName.isNullOrBlank()) { - minioFileView.text = "暂无附件" - } else { - val minioFileName = dataRow.minioFileName - - minioFileView.text = minioFileName - val textPaint = minioFileView.paint - textPaint.flags = Paint.UNDERLINE_TEXT_FLAG - textPaint.isAntiAlias = true - minioFileView.setTextColor(R.color.themeColor.convertColor(this)) - - minioFileView.setOnClickListener { - //查看附件 - if (minioFileName.endsWith("pdf")) { - navigatePageTo(minioFileName) - } else if ( - minioFileName.endsWith("doc") || - minioFileName.endsWith("docx") - ) { - navigatePageTo(minioFileName) - } else if (minioFileName.endsWith("txt")) { - navigatePageTo(minioFileName) - } else if ( - minioFileName.endsWith("png") || - minioFileName.endsWith("jpeg") || - minioFileName.endsWith("jpg") - ) { - val urls = ArrayList() - urls.add(minioFileName.combineImagePath()) - navigatePageTo(0, urls) - } else { - "文件类型未知,无法打开附件".show(this) - } - } - } - } - }) - } - - override fun initEvent() { - - } - - override fun initLayoutView(): Int = R.layout.activity_notice_detail - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/NoticeListActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/NoticeListActivity.kt deleted file mode 100644 index 15f6a16..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/NoticeListActivity.kt +++ /dev/null @@ -1,180 +0,0 @@ -package com.casic.xz.meterage.view - -import android.os.Handler -import android.util.Log -import android.view.View -import androidx.lifecycle.ViewModelProvider -import com.casic.xz.meterage.R -import com.casic.xz.meterage.adapter.NoticeListAdapter -import com.casic.xz.meterage.extensions.addAll -import com.casic.xz.meterage.extensions.combineFilePath -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.extensions.showEmptyPage -import com.casic.xz.meterage.model.NoticeListModel -import com.casic.xz.meterage.vm.NoticeViewModel -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.extensions.navigatePageTo -import com.pengxh.kt.lite.extensions.show -import com.pengxh.kt.lite.utils.WeakReferenceHandler -import com.pengxh.kt.lite.widget.dialog.AlertControlDialog -import kotlinx.android.synthetic.main.activity_notice_list.* -import kotlinx.android.synthetic.main.include_empty_view.* - -class NoticeListActivity : KotlinBaseActivity() { - - private lateinit var weakReferenceHandler: WeakReferenceHandler - private lateinit var noticeViewModel: NoticeViewModel - private lateinit var noticeListAdapter: NoticeListAdapter - private var dataBeans: MutableList = ArrayList() - private var pageIndex = 1 - private var isRefresh = false - private var isLoadMore = false - - override fun initData() { - weakReferenceHandler = WeakReferenceHandler(callback) - noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] - noticeViewModel.noticeResult.observe(this, { - if (it.code == 200) { - val dataRows = it.data?.rows!! -// countBadeNumber(dataRows) - when { - isRefresh -> { - dataBeans.clear() - dataBeans = dataRows - noticeLayout.finishRefresh() - isRefresh = false - } - isLoadMore -> { - if (dataRows.size == 0) { - "到底了,别拉了".show(this) - } - dataBeans.addAll(dataRows) - noticeLayout.finishLoadMore() - isLoadMore = false - } - else -> { - dataBeans = dataRows - } - } - weakReferenceHandler.sendEmptyMessage(2023013101) - } - }) - } - - override fun initEvent() { - leftBackView.setOnClickListener { finish() } - rightOperateView.setOnClickListener { - AlertControlDialog.Builder() - .setContext(this) - .setTitle("提示") - .setMessage("确定将所有未读消息标为已读?") - .setNegativeButton("取消") - .setPositiveButton("确定") - .setOnDialogButtonClickListener(object : - AlertControlDialog.OnDialogButtonClickListener { - override fun onCancelClick() { - - } - - override fun onConfirmClick() { - //TODO 设置为已读 - } - }).build().show() - } - - if (hasNoticePermission()) { - openSystemNoticeLayout.visibility = View.GONE - openSystemNoticeLayout.visibility = View.GONE - } else { - openSystemNoticeLayout.setOnClickListener { - - } - - - closeLayoutView.setOnClickListener { - openSystemNoticeLayout.visibility = View.GONE - } - } - - noticeLayout.setOnRefreshListener { - isRefresh = true - //刷新之后页码重置 - pageIndex = 1 - getNoticeListByPage() - } - - noticeLayout.setOnLoadMoreListener { - isLoadMore = true - pageIndex++ - getNoticeListByPage() - } - } - - override fun onResume() { - super.onResume() - pageIndex = 1 - getNoticeListByPage() - } - - private fun getNoticeListByPage() { - noticeViewModel.getNoticeList("", "", "", "", "", pageIndex) - } - - private val callback = Handler.Callback { - when (it.what) { - 2023013101 -> { - if (isRefresh || isLoadMore) { - noticeListAdapter.notifyDataSetChanged() - } else { - if (dataBeans.size == 0) { - emptyView!!.showEmptyPage("没有任何消息") { - pageIndex = 1 - getNoticeListByPage() - } - } else { - emptyView!!.hide() - noticeListAdapter = NoticeListAdapter(this, dataBeans) - noticeRecyclerView.adapter = noticeListAdapter - noticeListAdapter.setOnItemClickListener(object : - NoticeListAdapter.OnItemClickListener { - override fun onItemClicked(position: Int) { - val rowsModel = dataBeans[position] - val allArgs = addAll( - rowsModel.noticeNo, - rowsModel.noticeTitle, - rowsModel.noticePublisher, - "", - "" - ) - Log.d( - "Casic", - "NoticeListActivity => onItemClicked: ${rowsModel.minioFileName.combineFilePath()}" - ) - navigatePageTo(allArgs) - } - }) - } - } - } - } - true - } - - //TODO 判断是否开启通知权限 - private fun hasNoticePermission(): Boolean { - - return false - } - - override fun initLayoutView(): Int = R.layout.activity_notice_list - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/PreviewDocumentActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/PreviewDocumentActivity.kt deleted file mode 100644 index e233ddc..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/PreviewDocumentActivity.kt +++ /dev/null @@ -1,24 +0,0 @@ -package com.casic.xz.meterage.view - -import com.casic.xz.meterage.R -import com.pengxh.kt.lite.base.KotlinBaseActivity - -class PreviewDocumentActivity : KotlinBaseActivity() { - override fun initData() { - - } - - override fun initEvent() { - - } - - override fun initLayoutView(): Int = R.layout.activity_preview_doc - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/PreviewPdfActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/PreviewPdfActivity.kt deleted file mode 100644 index 39f8ac2..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/PreviewPdfActivity.kt +++ /dev/null @@ -1,62 +0,0 @@ -package com.casic.xz.meterage.view - -import com.casic.xz.meterage.R -import com.casic.xz.meterage.extensions.combineFilePath -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.utils.LoadingDialogHub -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.callback.OnDownloadListener -import com.pengxh.kt.lite.extensions.createDownloadFileDir -import com.pengxh.kt.lite.extensions.downloadFile -import com.pengxh.kt.lite.utils.Constant -import kotlinx.android.synthetic.main.activity_preview_pdf.* -import kotlinx.android.synthetic.main.include_base_title.* -import java.io.File -import java.io.FileInputStream - - -class PreviewPdfActivity : KotlinBaseActivity() { - - override fun initData() { - val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! - titleView.text = minioFileName - - val url = minioFileName.combineFilePath() - url.downloadFile(createDownloadFileDir().toString(), - object : OnDownloadListener { - override fun onDownloadStart(totalBytes: Long) { - runOnUiThread { - LoadingDialogHub.show(this@PreviewPdfActivity, "附件加载中") - } - } - - override fun onProgressChanged(currentBytes: Long) { - - } - - override fun onDownloadEnd(file: File?) { - runOnUiThread { - LoadingDialogHub.dismiss() - } - val inputStream = FileInputStream(file) - pdfView.fromStream(inputStream).load() - } - }) - } - - override fun initEvent() { - leftBackView.setOnClickListener { finish() } - } - - override fun initLayoutView(): Int = R.layout.activity_preview_pdf - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/PreviewTextActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/PreviewTextActivity.kt deleted file mode 100644 index d634ca3..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/PreviewTextActivity.kt +++ /dev/null @@ -1,60 +0,0 @@ -package com.casic.xz.meterage.view - -import com.casic.xz.meterage.R -import com.casic.xz.meterage.extensions.combineFilePath -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.utils.LoadingDialogHub -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.callback.OnDownloadListener -import com.pengxh.kt.lite.extensions.createDownloadFileDir -import com.pengxh.kt.lite.extensions.downloadFile -import com.pengxh.kt.lite.extensions.read -import com.pengxh.kt.lite.utils.Constant -import kotlinx.android.synthetic.main.activity_preview_txt.* -import kotlinx.android.synthetic.main.include_base_title.* -import java.io.File - -class PreviewTextActivity : KotlinBaseActivity() { - - override fun initData() { - val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! - titleView.text = minioFileName - - val url = minioFileName.combineFilePath() - url.downloadFile(createDownloadFileDir().toString(), - object : OnDownloadListener { - override fun onDownloadStart(totalBytes: Long) { - runOnUiThread { - LoadingDialogHub.show(this@PreviewTextActivity, "附件加载中") - } - } - - override fun onProgressChanged(currentBytes: Long) { - - } - - override fun onDownloadEnd(file: File?) { - runOnUiThread { - LoadingDialogHub.dismiss() - textView.text = file?.read() - } - } - }) - } - - override fun initEvent() { - leftBackView.setOnClickListener { finish() } - } - - override fun initLayoutView(): Int = R.layout.activity_preview_txt - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentActivity.kt new file mode 100644 index 0000000..35ca098 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentActivity.kt @@ -0,0 +1,158 @@ +package com.casic.xz.meterage.view.home + +import android.os.Handler +import androidx.lifecycle.ViewModelProvider +import androidx.recyclerview.widget.DividerItemDecoration +import com.casic.xz.meterage.R +import com.casic.xz.meterage.adapter.EquipmentListAdapter +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.extensions.showEmptyPage +import com.casic.xz.meterage.model.EquipmentListModel +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.casic.xz.meterage.vm.EquipmentViewModel +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.extensions.navigatePageTo +import com.pengxh.kt.lite.extensions.show +import com.pengxh.kt.lite.utils.WeakReferenceHandler +import com.pengxh.kt.lite.vm.LoadState +import kotlinx.android.synthetic.main.activity_equipment.* +import kotlinx.android.synthetic.main.include_empty_view.* +import kotlinx.android.synthetic.main.include_search_title.* + +class EquipmentActivity : KotlinBaseActivity() { + + private lateinit var weakReferenceHandler: WeakReferenceHandler + private lateinit var equipmentViewModel: EquipmentViewModel + private lateinit var equipmentListAdapter: EquipmentListAdapter + private var dataBeans: MutableList = ArrayList() + private var pageIndex = 1 + private var isRefresh = false + private var isLoadMore = false + + override fun initData() { + weakReferenceHandler = WeakReferenceHandler(callback) + equipmentViewModel = ViewModelProvider(this)[EquipmentViewModel::class.java] + equipmentViewModel.equipmentResult.observe(this, { + if (it.code == 200) { + val dataRows = it.data?.rows!! + when { + isRefresh -> { + dataBeans.clear() + dataBeans = dataRows + equipmentLayout.finishRefresh() + isRefresh = false + } + isLoadMore -> { + if (dataRows.size == 0) { + "到底了,别拉了".show(this) + } + dataBeans.addAll(dataRows) + equipmentLayout.finishLoadMore() + isLoadMore = false + } + else -> { + dataBeans = dataRows + } + } + weakReferenceHandler.sendEmptyMessage(2023020801) + } + }) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + rightOperateView.setOnClickListener { + + } + + equipmentLayout.setOnRefreshListener { + isRefresh = true + //刷新之后页码重置 + pageIndex = 1 + getEquipmentListByPage() + } + + equipmentLayout.setOnLoadMoreListener { + isLoadMore = true + pageIndex++ + getEquipmentListByPage() + } + } + + override fun initLayoutView(): Int = R.layout.activity_equipment + + override fun observeRequestState() { + equipmentViewModel.loadState.observe(this, { + when (it) { + LoadState.Loading -> LoadingDialogHub.show(this, "数据加载中...") + else -> LoadingDialogHub.dismiss() + } + }) + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + titleView.text = "仪器设备" + } + + override fun onResume() { + super.onResume() + pageIndex = 1 + getEquipmentListByPage() + } + + private fun getEquipmentListByPage() { + equipmentViewModel.getEquipmentList( + "", + "", + "", + "", + "", + "1", + "", + "", + "", + "", + "", + "", + "", + "", + arrayOf(), + pageIndex + ) + } + + private val callback = Handler.Callback { + when (it.what) { + 2023020801 -> { + if (isRefresh || isLoadMore) { + equipmentListAdapter.notifyDataSetChanged() + } else { + if (dataBeans.size == 0) { + emptyView!!.showEmptyPage("无设备") { + pageIndex = 1 + getEquipmentListByPage() + } + } else { + emptyView!!.hide() + equipmentListAdapter = EquipmentListAdapter(this, dataBeans) + equipmentRecyclerView.addItemDecoration( + DividerItemDecoration(this, DividerItemDecoration.VERTICAL) + ) + equipmentRecyclerView.adapter = equipmentListAdapter + equipmentListAdapter.setOnItemClickListener(object : + EquipmentListAdapter.OnItemClickListener { + override fun onItemClicked(position: Int) { + val rowsModel = dataBeans[position] + navigatePageTo(rowsModel.id) + } + }) + } + } + } + } + true + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentDetailActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentDetailActivity.kt new file mode 100644 index 0000000..7dee13c --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentDetailActivity.kt @@ -0,0 +1,53 @@ +package com.casic.xz.meterage.view.home + +import androidx.fragment.app.Fragment +import com.casic.xz.meterage.R +import com.casic.xz.meterage.adapter.SubViewPagerAdapter +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.fragment.equipment.* +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.utils.Constant +import kotlinx.android.synthetic.main.activity_equipment.rootView +import kotlinx.android.synthetic.main.activity_equipment_detail.* +import kotlinx.android.synthetic.main.include_base_title.* + +class EquipmentDetailActivity : KotlinBaseActivity() { + + private var fragmentPages: ArrayList = ArrayList() + + override fun initData() { + val equipmentId = intent.getStringExtra(Constant.INTENT_PARAM)!! + + fragmentPages.add(BasicInformationFragment(equipmentId)) + fragmentPages.add(InspectionRecordFragment()) + fragmentPages.add(ChangeRecordFragment()) + fragmentPages.add(UsageRecordFragment()) + fragmentPages.add(CertificateFragment()) + + val equipmentPageTitles = arrayOf("基础信息", "周检记录", "状态变更记录", "使用记录", "检定证书") + + equipmentViewPager.adapter = SubViewPagerAdapter( + supportFragmentManager, fragmentPages, equipmentPageTitles + ) + equipmentViewPager.offscreenPageLimit = fragmentPages.size + //绑定 + topTabLayout.setupWithViewPager(equipmentViewPager) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + } + + override fun initLayoutView(): Int = R.layout.activity_equipment_detail + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + titleView.text = "仪器设备" + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeDetailActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeDetailActivity.kt new file mode 100644 index 0000000..6fe0022 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeDetailActivity.kt @@ -0,0 +1,105 @@ +package com.casic.xz.meterage.view.notice + +import android.annotation.SuppressLint +import android.graphics.Paint +import androidx.lifecycle.ViewModelProvider +import com.casic.xz.meterage.R +import com.casic.xz.meterage.extensions.combineImagePath +import com.casic.xz.meterage.extensions.formatTextFromHtml +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.view.BigImageActivity +import com.casic.xz.meterage.vm.NoticeViewModel +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.extensions.convertColor +import com.pengxh.kt.lite.extensions.navigatePageTo +import com.pengxh.kt.lite.extensions.obtainScreenWidth +import com.pengxh.kt.lite.extensions.show +import com.pengxh.kt.lite.utils.Constant +import kotlinx.android.synthetic.main.activity_notice_detail.* +import kotlinx.android.synthetic.main.include_base_title.* +import java.util.* + +@SuppressLint("SetTextI18n") +class NoticeDetailActivity : KotlinBaseActivity() { + + private lateinit var noticeViewModel: NoticeViewModel + + override fun initData() { + leftBackView.setOnClickListener { finish() } + titleView.text = "通知公告" + + val args = intent.getStringArrayListExtra(Constant.INTENT_PARAM)!! + + noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] + noticeViewModel.getNoticeList(args[0], args[1], args[2], "", "", 1) + noticeViewModel.noticeResult.observe(this, { + if (it.code == 200) { + val dataRow = it.data?.rows!![0] + + noticeDateView.text = dataRow.noticeTime + noticePublisherView.text = "发布人 ${dataRow.noticePublisher}" + noticeCompanyView.text = "发布单位 ${dataRow.noticeCompany}" + + noticeNoView.text = dataRow.noticeNo + noticeTitleView.text = dataRow.noticeTitle + noticeSketchView.text = dataRow.noticeSketch + + dataRow.noticeContent.formatTextFromHtml( + this, noticeContentView, obtainScreenWidth() + ) + + if (dataRow.minioFileName.isNullOrBlank()) { + minioFileView.text = "暂无附件" + } else { + val minioFileName = dataRow.minioFileName + + minioFileView.text = minioFileName + val textPaint = minioFileView.paint + textPaint.flags = Paint.UNDERLINE_TEXT_FLAG + textPaint.isAntiAlias = true + minioFileView.setTextColor(R.color.themeColor.convertColor(this)) + + minioFileView.setOnClickListener { + //查看附件 + if (minioFileName.endsWith("pdf")) { + navigatePageTo(minioFileName) + } else if ( + minioFileName.endsWith("doc") || + minioFileName.endsWith("docx") + ) { + navigatePageTo(minioFileName) + } else if (minioFileName.endsWith("txt")) { + navigatePageTo(minioFileName) + } else if ( + minioFileName.endsWith("png") || + minioFileName.endsWith("jpeg") || + minioFileName.endsWith("jpg") + ) { + val urls = ArrayList() + urls.add(minioFileName.combineImagePath()) + navigatePageTo(0, urls) + } else { + "文件类型未知,无法打开附件".show(this) + } + } + } + } + }) + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.activity_notice_detail + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeListActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeListActivity.kt new file mode 100644 index 0000000..31c0490 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeListActivity.kt @@ -0,0 +1,180 @@ +package com.casic.xz.meterage.view.notice + +import android.os.Handler +import android.util.Log +import android.view.View +import androidx.lifecycle.ViewModelProvider +import com.casic.xz.meterage.R +import com.casic.xz.meterage.adapter.NoticeListAdapter +import com.casic.xz.meterage.extensions.addAll +import com.casic.xz.meterage.extensions.combineFilePath +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.extensions.showEmptyPage +import com.casic.xz.meterage.model.NoticeListModel +import com.casic.xz.meterage.vm.NoticeViewModel +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.extensions.navigatePageTo +import com.pengxh.kt.lite.extensions.show +import com.pengxh.kt.lite.utils.WeakReferenceHandler +import com.pengxh.kt.lite.widget.dialog.AlertControlDialog +import kotlinx.android.synthetic.main.activity_notice_list.* +import kotlinx.android.synthetic.main.include_empty_view.* + +class NoticeListActivity : KotlinBaseActivity() { + + private lateinit var weakReferenceHandler: WeakReferenceHandler + private lateinit var noticeViewModel: NoticeViewModel + private lateinit var noticeListAdapter: NoticeListAdapter + private var dataBeans: MutableList = ArrayList() + private var pageIndex = 1 + private var isRefresh = false + private var isLoadMore = false + + override fun initData() { + weakReferenceHandler = WeakReferenceHandler(callback) + noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] + noticeViewModel.noticeResult.observe(this, { + if (it.code == 200) { + val dataRows = it.data?.rows!! +// countBadeNumber(dataRows) + when { + isRefresh -> { + dataBeans.clear() + dataBeans = dataRows + noticeLayout.finishRefresh() + isRefresh = false + } + isLoadMore -> { + if (dataRows.size == 0) { + "到底了,别拉了".show(this) + } + dataBeans.addAll(dataRows) + noticeLayout.finishLoadMore() + isLoadMore = false + } + else -> { + dataBeans = dataRows + } + } + weakReferenceHandler.sendEmptyMessage(2023013101) + } + }) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + rightOperateView.setOnClickListener { + AlertControlDialog.Builder() + .setContext(this) + .setTitle("提示") + .setMessage("确定将所有未读消息标为已读?") + .setNegativeButton("取消") + .setPositiveButton("确定") + .setOnDialogButtonClickListener(object : + AlertControlDialog.OnDialogButtonClickListener { + override fun onCancelClick() { + + } + + override fun onConfirmClick() { + //TODO 设置为已读 + } + }).build().show() + } + + if (hasNoticePermission()) { + openSystemNoticeLayout.visibility = View.GONE + openSystemNoticeLayout.visibility = View.GONE + } else { + openSystemNoticeLayout.setOnClickListener { + + } + + + closeLayoutView.setOnClickListener { + openSystemNoticeLayout.visibility = View.GONE + } + } + + noticeLayout.setOnRefreshListener { + isRefresh = true + //刷新之后页码重置 + pageIndex = 1 + getNoticeListByPage() + } + + noticeLayout.setOnLoadMoreListener { + isLoadMore = true + pageIndex++ + getNoticeListByPage() + } + } + + override fun onResume() { + super.onResume() + pageIndex = 1 + getNoticeListByPage() + } + + private fun getNoticeListByPage() { + noticeViewModel.getNoticeList("", "", "", "", "", pageIndex) + } + + private val callback = Handler.Callback { + when (it.what) { + 2023013101 -> { + if (isRefresh || isLoadMore) { + noticeListAdapter.notifyDataSetChanged() + } else { + if (dataBeans.size == 0) { + emptyView!!.showEmptyPage("没有任何消息") { + pageIndex = 1 + getNoticeListByPage() + } + } else { + emptyView!!.hide() + noticeListAdapter = NoticeListAdapter(this, dataBeans) + noticeRecyclerView.adapter = noticeListAdapter + noticeListAdapter.setOnItemClickListener(object : + NoticeListAdapter.OnItemClickListener { + override fun onItemClicked(position: Int) { + val rowsModel = dataBeans[position] + val allArgs = addAll( + rowsModel.noticeNo, + rowsModel.noticeTitle, + rowsModel.noticePublisher, + "", + "" + ) + Log.d( + "Casic", + "NoticeListActivity => onItemClicked: ${rowsModel.minioFileName.combineFilePath()}" + ) + navigatePageTo(allArgs) + } + }) + } + } + } + } + true + } + + //TODO 判断是否开启通知权限 + private fun hasNoticePermission(): Boolean { + + return false + } + + override fun initLayoutView(): Int = R.layout.activity_notice_list + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewDocumentActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewDocumentActivity.kt new file mode 100644 index 0000000..4b16ae8 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewDocumentActivity.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.view.notice + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseActivity + +class PreviewDocumentActivity : KotlinBaseActivity() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.activity_preview_doc + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewPdfActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewPdfActivity.kt new file mode 100644 index 0000000..fad73b6 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewPdfActivity.kt @@ -0,0 +1,62 @@ +package com.casic.xz.meterage.view.notice + +import com.casic.xz.meterage.R +import com.casic.xz.meterage.extensions.combineFilePath +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.callback.OnDownloadListener +import com.pengxh.kt.lite.extensions.createDownloadFileDir +import com.pengxh.kt.lite.extensions.downloadFile +import com.pengxh.kt.lite.utils.Constant +import kotlinx.android.synthetic.main.activity_preview_pdf.* +import kotlinx.android.synthetic.main.include_base_title.* +import java.io.File +import java.io.FileInputStream + + +class PreviewPdfActivity : KotlinBaseActivity() { + + override fun initData() { + val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! + titleView.text = minioFileName + + val url = minioFileName.combineFilePath() + url.downloadFile(createDownloadFileDir().toString(), + object : OnDownloadListener { + override fun onDownloadStart(totalBytes: Long) { + runOnUiThread { + LoadingDialogHub.show(this@PreviewPdfActivity, "附件加载中") + } + } + + override fun onProgressChanged(currentBytes: Long) { + + } + + override fun onDownloadEnd(file: File?) { + runOnUiThread { + LoadingDialogHub.dismiss() + } + val inputStream = FileInputStream(file) + pdfView.fromStream(inputStream).load() + } + }) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + } + + override fun initLayoutView(): Int = R.layout.activity_preview_pdf + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewTextActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewTextActivity.kt new file mode 100644 index 0000000..d7850fb --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewTextActivity.kt @@ -0,0 +1,60 @@ +package com.casic.xz.meterage.view.notice + +import com.casic.xz.meterage.R +import com.casic.xz.meterage.extensions.combineFilePath +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.callback.OnDownloadListener +import com.pengxh.kt.lite.extensions.createDownloadFileDir +import com.pengxh.kt.lite.extensions.downloadFile +import com.pengxh.kt.lite.extensions.read +import com.pengxh.kt.lite.utils.Constant +import kotlinx.android.synthetic.main.activity_preview_txt.* +import kotlinx.android.synthetic.main.include_base_title.* +import java.io.File + +class PreviewTextActivity : KotlinBaseActivity() { + + override fun initData() { + val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! + titleView.text = minioFileName + + val url = minioFileName.combineFilePath() + url.downloadFile(createDownloadFileDir().toString(), + object : OnDownloadListener { + override fun onDownloadStart(totalBytes: Long) { + runOnUiThread { + LoadingDialogHub.show(this@PreviewTextActivity, "附件加载中") + } + } + + override fun onProgressChanged(currentBytes: Long) { + + } + + override fun onDownloadEnd(file: File?) { + runOnUiThread { + LoadingDialogHub.dismiss() + textView.text = file?.read() + } + } + }) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + } + + override fun initLayoutView(): Int = R.layout.activity_preview_txt + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/vm/EquipmentViewModel.kt b/app/src/main/java/com/casic/xz/meterage/vm/EquipmentViewModel.kt new file mode 100644 index 0000000..b5f21f6 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/vm/EquipmentViewModel.kt @@ -0,0 +1,92 @@ +package com.casic.xz.meterage.vm + +import androidx.lifecycle.MutableLiveData +import com.casic.xz.meterage.base.BaseApplication +import com.casic.xz.meterage.extensions.separateResponseCode +import com.casic.xz.meterage.extensions.toErrorMessage +import com.casic.xz.meterage.model.EquipmentDetailModel +import com.casic.xz.meterage.model.EquipmentListModel +import com.casic.xz.meterage.utils.retrofit.RetrofitServiceManager +import com.google.gson.Gson +import com.google.gson.reflect.TypeToken +import com.pengxh.kt.lite.extensions.launch +import com.pengxh.kt.lite.extensions.show +import com.pengxh.kt.lite.vm.BaseViewModel +import com.pengxh.kt.lite.vm.LoadState + +class EquipmentViewModel : BaseViewModel() { + + private val gson by lazy { Gson() } + val equipmentResult = MutableLiveData() + val equipmentDetailResult = MutableLiveData() + + fun getEquipmentList( + equipmentNo: String, + equipmentName: String, + mesureType: String, + managerState: String, + useDept: String, + assetType: String, + equipmentCategory: String, + isCalibrationTestEquipment: String, + isMeasureAccount: String, + isStandardSupportEquipment: String, + isFixedAssets: String, + validStartDate: String, + validEndDate: String, + abc: String, + ids: Array, + offset: Int + ) = launch({ + loadState.value = LoadState.Loading + val response = RetrofitServiceManager.getEquipmentList( + equipmentNo, + equipmentName, + mesureType, + managerState, + useDept, + assetType, + equipmentCategory, + isCalibrationTestEquipment, + isMeasureAccount, + isStandardSupportEquipment, + isFixedAssets, + validStartDate, + validEndDate, + abc, + ids, + offset + ) + val responseCode = response.separateResponseCode() + if (responseCode == 200) { + loadState.value = LoadState.Success + equipmentResult.value = gson.fromJson( + response, object : TypeToken() {}.type + ) + } else { + loadState.value = LoadState.Fail + response.toErrorMessage().show(BaseApplication.get()) + } + }, { + loadState.value = LoadState.Fail + it.printStackTrace() + }) + + fun getEquipmentDetail(id: String) = launch({ + loadState.value = LoadState.Loading + val response = RetrofitServiceManager.getEquipmentDetail(id) + val responseCode = response.separateResponseCode() + if (responseCode == 200) { + loadState.value = LoadState.Success + equipmentDetailResult.value = gson.fromJson( + response, object : TypeToken() {}.type + ) + } else { + loadState.value = LoadState.Fail + response.toErrorMessage().show(BaseApplication.get()) + } + }, { + loadState.value = LoadState.Fail + it.printStackTrace() + }) +} \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_sorting.xml b/app/src/main/res/drawable/ic_sorting.xml new file mode 100644 index 0000000..252bfe6 --- /dev/null +++ b/app/src/main/res/drawable/ic_sorting.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/layout/activity_equipment.xml b/app/src/main/res/layout/activity_equipment.xml new file mode 100644 index 0000000..d6a64b1 --- /dev/null +++ b/app/src/main/res/layout/activity_equipment.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_equipment_detail.xml b/app/src/main/res/layout/activity_equipment_detail.xml new file mode 100644 index 0000000..7254762 --- /dev/null +++ b/app/src/main/res/layout/activity_equipment_detail.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_basic_information.xml b/app/src/main/res/layout/fragment_basic_information.xml new file mode 100644 index 0000000..4a3c1c7 --- /dev/null +++ b/app/src/main/res/layout/fragment_basic_information.xml @@ -0,0 +1,390 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_certificate.xml b/app/src/main/res/layout/fragment_certificate.xml new file mode 100644 index 0000000..77d9ef6 --- /dev/null +++ b/app/src/main/res/layout/fragment_certificate.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_change_record.xml b/app/src/main/res/layout/fragment_change_record.xml new file mode 100644 index 0000000..77d9ef6 --- /dev/null +++ b/app/src/main/res/layout/fragment_change_record.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_home.xml b/app/src/main/res/layout/fragment_home.xml index 41b32a9..e1ab759 100644 --- a/app/src/main/res/layout/fragment_home.xml +++ b/app/src/main/res/layout/fragment_home.xml @@ -71,7 +71,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" app:layoutManager="androidx.recyclerview.widget.GridLayoutManager" - app:spanCount="5" /> + app:spanCount="4" /> + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_mine.xml b/app/src/main/res/layout/fragment_mine.xml index 0643064..d9f57b3 100644 --- a/app/src/main/res/layout/fragment_mine.xml +++ b/app/src/main/res/layout/fragment_mine.xml @@ -22,10 +22,10 @@ android:orientation="horizontal"> + android:src="@mipmap/default_avatar" /> @@ -122,7 +122,7 @@ android:background="@drawable/ic_collection" /> @@ -145,7 +145,7 @@ android:background="@drawable/ic_push_setting" /> @@ -166,7 +166,7 @@ android:background="@drawable/ic_privacy" /> @@ -189,7 +189,7 @@ android:background="@drawable/ic_help" /> @@ -210,7 +210,7 @@ android:background="@drawable/ic_update" /> @@ -231,7 +231,7 @@ android:background="@drawable/ic_about" /> @@ -252,7 +252,7 @@ android:background="@drawable/ic_back" /> diff --git a/app/src/main/res/layout/fragment_usage_record.xml b/app/src/main/res/layout/fragment_usage_record.xml new file mode 100644 index 0000000..77d9ef6 --- /dev/null +++ b/app/src/main/res/layout/fragment_usage_record.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/include_equipment_layout.xml b/app/src/main/res/layout/include_equipment_layout.xml new file mode 100644 index 0000000..ce846d5 --- /dev/null +++ b/app/src/main/res/layout/include_equipment_layout.xml @@ -0,0 +1,74 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/include_line_view.xml b/app/src/main/res/layout/include_line_view.xml new file mode 100644 index 0000000..ff89de3 --- /dev/null +++ b/app/src/main/res/layout/include_line_view.xml @@ -0,0 +1,5 @@ + + \ No newline at end of file diff --git a/app/src/main/res/layout/include_search_title.xml b/app/src/main/res/layout/include_search_title.xml new file mode 100644 index 0000000..644fa4c --- /dev/null +++ b/app/src/main/res/layout/include_search_title.xml @@ -0,0 +1,35 @@ + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/item_equipment_rv_l.xml b/app/src/main/res/layout/item_equipment_rv_l.xml new file mode 100644 index 0000000..796f4b1 --- /dev/null +++ b/app/src/main/res/layout/item_equipment_rv_l.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-xxxhdpi/default_avatar.jpg b/app/src/main/res/mipmap-xxxhdpi/default_avatar.jpg new file mode 100644 index 0000000..5f1e521 --- /dev/null +++ b/app/src/main/res/mipmap-xxxhdpi/default_avatar.jpg Binary files differ diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 7c3ab14..791bf8c 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1,4 +1,5 @@ 智慧计量移动业务平台 中国航天科工二〇三所 + 数据加载中… \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 3892b5a..02160cd 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -34,16 +34,18 @@ - - - - - - - + + + + + + + + + +) : RecyclerView.Adapter() { + + private var layoutInflater: LayoutInflater = LayoutInflater.from(context) + + override fun getItemCount(): Int = dataRows.size + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = ItemViewHolder( + layoutInflater.inflate(R.layout.item_equipment_rv_l, parent, false) + ) + + override fun onBindViewHolder(holder: ItemViewHolder, position: Int) { + //绑定数据 + val rowsBean = dataRows[position] + holder.equipmentNameView.text = rowsBean.equipmentName + holder.equipmentCodeView.text = rowsBean.equipmentNo + holder.equipmentDateView.text = rowsBean.enableDate + holder.equipmentLibView.text = rowsBean.useDeptName + + //绑定事件 + holder.itemView.setOnClickListener { + listener?.onItemClicked(position) + } + } + + inner class ItemViewHolder(view: View) : RecyclerView.ViewHolder(view) { + var equipmentNameView: TextView = view.findViewById(R.id.equipmentNameView) + var equipmentCodeView: TextView = view.findViewById(R.id.equipmentCodeView) + var equipmentDateView: TextView = view.findViewById(R.id.equipmentDateView) + var equipmentLibView: TextView = view.findViewById(R.id.equipmentLibView) + } + + private var listener: OnItemClickListener? = null + + interface OnItemClickListener { + fun onItemClicked(position: Int) + } + + fun setOnItemClickListener(onClickListener: OnItemClickListener?) { + this.listener = onClickListener + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt index b4628f3..d970b55 100644 --- a/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt +++ b/app/src/main/java/com/casic/xz/meterage/fragment/HomePageFragment.kt @@ -5,7 +5,8 @@ import com.casic.xz.meterage.R import com.casic.xz.meterage.adapter.HomeGridAdapter import com.casic.xz.meterage.utils.LocaleConstant -import com.casic.xz.meterage.view.NoticeListActivity +import com.casic.xz.meterage.view.home.EquipmentActivity +import com.casic.xz.meterage.view.notice.NoticeListActivity import com.casic.xz.meterage.vm.NoticeViewModel import com.pengxh.kt.lite.base.KotlinBaseFragment import com.pengxh.kt.lite.extensions.navigatePageTo @@ -36,8 +37,19 @@ homeFuncRecyclerView.adapter = homeAdapter homeAdapter.setOnGridItemClickListener(object : HomeGridAdapter.OnGridItemClickListener { override fun onItemClick(position: Int) { - when (position) { - + when (LocaleConstant.HOME_FUNC_OPERATE[position]) { + "仪器设备" -> requireContext().navigatePageTo() +// "标准装置" -> requireContext().navigatePageTo() +// "证书报告" -> requireContext().navigatePageTo() +// "委托需求" -> requireContext().navigatePageTo() +// "访客" -> requireContext().navigatePageTo() +// "标准规范" -> requireContext().navigatePageTo() +// "能力列表" -> requireContext().navigatePageTo() +// "计量培训" -> requireContext().navigatePageTo() +// "合同发票" -> requireContext().navigatePageTo() +// "业务统计" -> requireContext().navigatePageTo() +// "客户列表" -> requireContext().navigatePageTo() +// "外场检测" -> requireContext().navigatePageTo() } } }) diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt index 7e75abe..56dc5ec 100644 --- a/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt +++ b/app/src/main/java/com/casic/xz/meterage/fragment/MinePageFragment.kt @@ -2,9 +2,11 @@ import android.view.View import androidx.lifecycle.ViewModelProvider +import com.bumptech.glide.Glide +import com.bumptech.glide.request.RequestOptions import com.casic.xz.meterage.R import com.casic.xz.meterage.utils.LocaleConstant -import com.casic.xz.meterage.view.NoticeListActivity +import com.casic.xz.meterage.view.notice.NoticeListActivity import com.casic.xz.meterage.vm.NoticeViewModel import com.casic.xz.meterage.vm.UserViewModel import com.pengxh.kt.lite.base.KotlinBaseFragment @@ -23,6 +25,12 @@ val data = it.data userNameView.text = data.name userUnitView.text = data.deptName + +// Glide.with(requireContext()) +// .load(R.mipmap.default_avatar) +// .apply(RequestOptions.circleCropTransform()) +// .placeholder(R.mipmap.load_image_error) +// .into(userAvatarView) } }) diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt new file mode 100644 index 0000000..cf22646 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/BasicInformationFragment.kt @@ -0,0 +1,103 @@ +package com.casic.xz.meterage.fragment.equipment + +import android.graphics.Paint +import androidx.lifecycle.ViewModelProvider +import com.casic.xz.meterage.R +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.casic.xz.meterage.vm.EquipmentViewModel +import com.pengxh.kt.lite.base.KotlinBaseFragment +import com.pengxh.kt.lite.extensions.convertColor +import com.pengxh.kt.lite.vm.LoadState +import kotlinx.android.synthetic.main.fragment_basic_information.* + +class BasicInformationFragment(private val id: String) : KotlinBaseFragment() { + + private lateinit var equipmentViewModel: EquipmentViewModel + + override fun initData() { + equipmentViewModel = ViewModelProvider(this)[EquipmentViewModel::class.java] + equipmentViewModel.getEquipmentDetail(id) + equipmentViewModel.equipmentDetailResult.observe(this, { + if (it.code == 200) { + val data = it.data!! + + equipmentCodeView.text = data.equipmentNo + equipmentNameView.text = data.equipmentName + manufacturerView.text = data.manufacturer + factoryNumberView.text = data.manufacturingNo + modelView.text = data.modelNo + verificationMethodView.text = data.mesureTypeName + measuringRangeView.text = data.mesureRange + uncertaintyView.text = data.uncertainty + firstUseView.text = data.createTime + originalValueView.text = data.originValue + usageDeptView.text = data.useDeptName + userView.text = data.usePersonName + managementStatusView.text = data.managerStateName + verificationDeptView.text = data.useDeptName +// nextVerificationDeptView.text = data. + verificationPeriodView.text = data.mesureCycle + verificationDateView.text = data.mesureDate + effectiveDateView.text = data.validDate + verificationResultsView.text = data.mesureResultName + abcView.text = data.abcName + isNeedTechnicalView.text = if ( + data.isCalibrationTestEquipment.isNullOrBlank() || data.isCalibrationTestEquipment == "0" + ) { + "否" + } else { + "是" + } + + isStandingBook.text = if ( + data.isMeasureAccount.isNullOrBlank() || data.isMeasureAccount == "0" + ) { + "否" + } else { + "是" + } + + isStandardView.text = if ( + data.isStandardSupportEquipment.isNullOrBlank() || data.isStandardSupportEquipment == "0" + ) { + "否" + } else { + "是" + } + remarkView.text = data.remark + if (data.fileList.size == 0) { + instructionsView.text = "暂无" + } else { + instructionsView.text = "查看附件列表" + val textPaint = instructionsView.paint + textPaint.flags = Paint.UNDERLINE_TEXT_FLAG + textPaint.isAntiAlias = true + instructionsView.setTextColor(R.color.themeColor.convertColor(requireContext())) + + instructionsView.setOnClickListener { + + } + } + } + }) + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_basic_information + + override fun observeRequestState() { + equipmentViewModel.loadState.observe(this, { + when (it) { + LoadState.Loading -> LoadingDialogHub.show(requireActivity(), "数据加载中...") + else -> LoadingDialogHub.dismiss() + } + }) + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt new file mode 100644 index 0000000..0b4a747 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/CertificateFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class CertificateFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_certificate + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt new file mode 100644 index 0000000..f05c491 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/ChangeRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class ChangeRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_change_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt new file mode 100644 index 0000000..849ffa5 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/InspectionRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class InspectionRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_inspection_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt new file mode 100644 index 0000000..aa4edd9 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/fragment/equipment/UsageRecordFragment.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.fragment.equipment + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseFragment + +class UsageRecordFragment : KotlinBaseFragment() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.fragment_usage_record + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java b/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java new file mode 100644 index 0000000..0b9124e --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/model/EquipmentDetailModel.java @@ -0,0 +1,760 @@ +package com.casic.xz.meterage.model; + +import java.util.List; + +public class EquipmentDetailModel { + + private int code; + private DataModel data; + private String message; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataModel getData() { + return data; + } + + public void setData(DataModel data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public static class DataModel { + private String abc; + private String abcName; + private String assetNo; + private String assetSource; + private String assetType; + private String assetTypeName; + private String attribute; + private String capitalSource; + private String capitalSourceName; + private String cardEstablishmentDate; + private String createTime; + private String createUser; + private String depreciationMethod; + private String depreciationMethodName; + private String depreciationPeriod; + private String enableDate; + private String equipmentCategory; + private String equipmentCategoryName; + private String equipmentName; + private String equipmentNo; + private String equipmentSpecifications; + private String equipmentType; + private String equipmentTypeName; + private List fileList; + private String id; + private String installIncidentalExpenses; + private String installPlace; + private String intactState; + private String isCalibrationTestEquipment; + private int isDel; + private String isFixedAssets; + private String isMeasureAccount; + private String isStandardSupportEquipment; + private String labelBind; + private String majorCategory; + private String majorCategoryName; + private String managerLevel; + private String managerLevelName; + private String managerState; + private String managerStateName; + private String manufacturer; + private String manufacturerCountry; + private String manufacturingDate; + private String manufacturingNo; + private String mesureCycle; + private String mesureDate; + private String mesureDept; + private String mesureRange; + private String mesureResult; + private String mesureResultName; + private String mesureType; + private String mesureTypeName; + private String modelNo; + private String originValue; + private String overallDimension; + private String presentOriginValue; + private String purpose; + private String remark; + private String singlePrice; + private String supportStandardEquipmentName; + private String supportStandardEquipmentNo; + private String technicalLevel; + private String uncertainty; + private String updateTime; + private String useDept; + private String useDeptName; + private String usePerson; + private String usePersonName; + private String validDate; + private int version; + private String weight; + + public String getAbc() { + return abc; + } + + public void setAbc(String abc) { + this.abc = abc; + } + + public String getAbcName() { + return abcName; + } + + public void setAbcName(String abcName) { + this.abcName = abcName; + } + + public String getAssetNo() { + return assetNo; + } + + public void setAssetNo(String assetNo) { + this.assetNo = assetNo; + } + + public String getAssetSource() { + return assetSource; + } + + public void setAssetSource(String assetSource) { + this.assetSource = assetSource; + } + + public String getAssetType() { + return assetType; + } + + public void setAssetType(String assetType) { + this.assetType = assetType; + } + + public String getAssetTypeName() { + return assetTypeName; + } + + public void setAssetTypeName(String assetTypeName) { + this.assetTypeName = assetTypeName; + } + + public String getAttribute() { + return attribute; + } + + public void setAttribute(String attribute) { + this.attribute = attribute; + } + + public String getCapitalSource() { + return capitalSource; + } + + public void setCapitalSource(String capitalSource) { + this.capitalSource = capitalSource; + } + + public String getCapitalSourceName() { + return capitalSourceName; + } + + public void setCapitalSourceName(String capitalSourceName) { + this.capitalSourceName = capitalSourceName; + } + + public String getCardEstablishmentDate() { + return cardEstablishmentDate; + } + + public void setCardEstablishmentDate(String cardEstablishmentDate) { + this.cardEstablishmentDate = cardEstablishmentDate; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getDepreciationMethod() { + return depreciationMethod; + } + + public void setDepreciationMethod(String depreciationMethod) { + this.depreciationMethod = depreciationMethod; + } + + public String getDepreciationMethodName() { + return depreciationMethodName; + } + + public void setDepreciationMethodName(String depreciationMethodName) { + this.depreciationMethodName = depreciationMethodName; + } + + public String getDepreciationPeriod() { + return depreciationPeriod; + } + + public void setDepreciationPeriod(String depreciationPeriod) { + this.depreciationPeriod = depreciationPeriod; + } + + public String getEnableDate() { + return enableDate; + } + + public void setEnableDate(String enableDate) { + this.enableDate = enableDate; + } + + public String getEquipmentCategory() { + return equipmentCategory; + } + + public void setEquipmentCategory(String equipmentCategory) { + this.equipmentCategory = equipmentCategory; + } + + public String getEquipmentCategoryName() { + return equipmentCategoryName; + } + + public void setEquipmentCategoryName(String equipmentCategoryName) { + this.equipmentCategoryName = equipmentCategoryName; + } + + public String getEquipmentName() { + return equipmentName; + } + + public void setEquipmentName(String equipmentName) { + this.equipmentName = equipmentName; + } + + public String getEquipmentNo() { + return equipmentNo; + } + + public void setEquipmentNo(String equipmentNo) { + this.equipmentNo = equipmentNo; + } + + public String getEquipmentSpecifications() { + return equipmentSpecifications; + } + + public void setEquipmentSpecifications(String equipmentSpecifications) { + this.equipmentSpecifications = equipmentSpecifications; + } + + public String getEquipmentType() { + return equipmentType; + } + + public void setEquipmentType(String equipmentType) { + this.equipmentType = equipmentType; + } + + public String getEquipmentTypeName() { + return equipmentTypeName; + } + + public void setEquipmentTypeName(String equipmentTypeName) { + this.equipmentTypeName = equipmentTypeName; + } + + public List getFileList() { + return fileList; + } + + public void setFileList(List fileList) { + this.fileList = fileList; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getInstallIncidentalExpenses() { + return installIncidentalExpenses; + } + + public void setInstallIncidentalExpenses(String installIncidentalExpenses) { + this.installIncidentalExpenses = installIncidentalExpenses; + } + + public String getInstallPlace() { + return installPlace; + } + + public void setInstallPlace(String installPlace) { + this.installPlace = installPlace; + } + + public String getIntactState() { + return intactState; + } + + public void setIntactState(String intactState) { + this.intactState = intactState; + } + + public String getIsCalibrationTestEquipment() { + return isCalibrationTestEquipment; + } + + public void setIsCalibrationTestEquipment(String isCalibrationTestEquipment) { + this.isCalibrationTestEquipment = isCalibrationTestEquipment; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getIsFixedAssets() { + return isFixedAssets; + } + + public void setIsFixedAssets(String isFixedAssets) { + this.isFixedAssets = isFixedAssets; + } + + public String getIsMeasureAccount() { + return isMeasureAccount; + } + + public void setIsMeasureAccount(String isMeasureAccount) { + this.isMeasureAccount = isMeasureAccount; + } + + public String getIsStandardSupportEquipment() { + return isStandardSupportEquipment; + } + + public void setIsStandardSupportEquipment(String isStandardSupportEquipment) { + this.isStandardSupportEquipment = isStandardSupportEquipment; + } + + public String getLabelBind() { + return labelBind; + } + + public void setLabelBind(String labelBind) { + this.labelBind = labelBind; + } + + public String getMajorCategory() { + return majorCategory; + } + + public void setMajorCategory(String majorCategory) { + this.majorCategory = majorCategory; + } + + public String getMajorCategoryName() { + return majorCategoryName; + } + + public void setMajorCategoryName(String majorCategoryName) { + this.majorCategoryName = majorCategoryName; + } + + public String getManagerLevel() { + return managerLevel; + } + + public void setManagerLevel(String managerLevel) { + this.managerLevel = managerLevel; + } + + public String getManagerLevelName() { + return managerLevelName; + } + + public void setManagerLevelName(String managerLevelName) { + this.managerLevelName = managerLevelName; + } + + public String getManagerState() { + return managerState; + } + + public void setManagerState(String managerState) { + this.managerState = managerState; + } + + public String getManagerStateName() { + return managerStateName; + } + + public void setManagerStateName(String managerStateName) { + this.managerStateName = managerStateName; + } + + public String getManufacturer() { + return manufacturer; + } + + public void setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + } + + public String getManufacturerCountry() { + return manufacturerCountry; + } + + public void setManufacturerCountry(String manufacturerCountry) { + this.manufacturerCountry = manufacturerCountry; + } + + public String getManufacturingDate() { + return manufacturingDate; + } + + public void setManufacturingDate(String manufacturingDate) { + this.manufacturingDate = manufacturingDate; + } + + public String getManufacturingNo() { + return manufacturingNo; + } + + public void setManufacturingNo(String manufacturingNo) { + this.manufacturingNo = manufacturingNo; + } + + public String getMesureCycle() { + return mesureCycle; + } + + public void setMesureCycle(String mesureCycle) { + this.mesureCycle = mesureCycle; + } + + public String getMesureDate() { + return mesureDate; + } + + public void setMesureDate(String mesureDate) { + this.mesureDate = mesureDate; + } + + public String getMesureDept() { + return mesureDept; + } + + public void setMesureDept(String mesureDept) { + this.mesureDept = mesureDept; + } + + public String getMesureRange() { + return mesureRange; + } + + public void setMesureRange(String mesureRange) { + this.mesureRange = mesureRange; + } + + public String getMesureResult() { + return mesureResult; + } + + public void setMesureResult(String mesureResult) { + this.mesureResult = mesureResult; + } + + public String getMesureResultName() { + return mesureResultName; + } + + public void setMesureResultName(String mesureResultName) { + this.mesureResultName = mesureResultName; + } + + public String getMesureType() { + return mesureType; + } + + public void setMesureType(String mesureType) { + this.mesureType = mesureType; + } + + public String getMesureTypeName() { + return mesureTypeName; + } + + public void setMesureTypeName(String mesureTypeName) { + this.mesureTypeName = mesureTypeName; + } + + public String getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getOriginValue() { + return originValue; + } + + public void setOriginValue(String originValue) { + this.originValue = originValue; + } + + public String getOverallDimension() { + return overallDimension; + } + + public void setOverallDimension(String overallDimension) { + this.overallDimension = overallDimension; + } + + public String getPresentOriginValue() { + return presentOriginValue; + } + + public void setPresentOriginValue(String presentOriginValue) { + this.presentOriginValue = presentOriginValue; + } + + public String getPurpose() { + return purpose; + } + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getSinglePrice() { + return singlePrice; + } + + public void setSinglePrice(String singlePrice) { + this.singlePrice = singlePrice; + } + + public String getSupportStandardEquipmentName() { + return supportStandardEquipmentName; + } + + public void setSupportStandardEquipmentName(String supportStandardEquipmentName) { + this.supportStandardEquipmentName = supportStandardEquipmentName; + } + + public String getSupportStandardEquipmentNo() { + return supportStandardEquipmentNo; + } + + public void setSupportStandardEquipmentNo(String supportStandardEquipmentNo) { + this.supportStandardEquipmentNo = supportStandardEquipmentNo; + } + + public String getTechnicalLevel() { + return technicalLevel; + } + + public void setTechnicalLevel(String technicalLevel) { + this.technicalLevel = technicalLevel; + } + + public String getUncertainty() { + return uncertainty; + } + + public void setUncertainty(String uncertainty) { + this.uncertainty = uncertainty; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getUseDept() { + return useDept; + } + + public void setUseDept(String useDept) { + this.useDept = useDept; + } + + public String getUseDeptName() { + return useDeptName; + } + + public void setUseDeptName(String useDeptName) { + this.useDeptName = useDeptName; + } + + public String getUsePerson() { + return usePerson; + } + + public void setUsePerson(String usePerson) { + this.usePerson = usePerson; + } + + public String getUsePersonName() { + return usePersonName; + } + + public void setUsePersonName(String usePersonName) { + this.usePersonName = usePersonName; + } + + public String getValidDate() { + return validDate; + } + + public void setValidDate(String validDate) { + this.validDate = validDate; + } + + public int getVersion() { + return version; + } + + public void setVersion(int version) { + this.version = version; + } + + public String getWeight() { + return weight; + } + + public void setWeight(String weight) { + this.weight = weight; + } + + public static class FileListModel { + private String assetId; + private String createTime; + private String createUser; + private String fileName; + private String id; + private int isDel; + private String minioFileName; + private String remark; + private String updateTime; + + public String getAssetId() { + return assetId; + } + + public void setAssetId(String assetId) { + this.assetId = assetId; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getFileName() { + return fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getMinioFileName() { + return minioFileName; + } + + public void setMinioFileName(String minioFileName) { + this.minioFileName = minioFileName; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + } + } +} diff --git a/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java b/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java new file mode 100644 index 0000000..15fc128 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/model/EquipmentListModel.java @@ -0,0 +1,697 @@ +package com.casic.xz.meterage.model; + +import java.util.List; + +public class EquipmentListModel { + + private int code; + private DataModel data; + private String message; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataModel getData() { + return data; + } + + public void setData(DataModel data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public static class DataModel { + private List rows; + private int total; + + public List getRows() { + return rows; + } + + public void setRows(List rows) { + this.rows = rows; + } + + public int getTotal() { + return total; + } + + public void setTotal(int total) { + this.total = total; + } + + public static class RowsModel { + private String abc; + private String abcName; + private String assetNo; + private String assetSource; + private String assetType; + private String assetTypeName; + private String attribute; + private String capitalSource; + private String capitalSourceName; + private String cardEstablishmentDate; + private String createTime; + private String createUser; + private String depreciationMethod; + private String depreciationMethodName; + private String depreciationPeriod; + private String enableDate; + private String equipmentCategory; + private String equipmentCategoryName; + private String equipmentName; + private String equipmentNo; + private String equipmentSpecifications; + private String equipmentType; + private String equipmentTypeName; + private String fileList; + private String id; + private String installIncidentalExpenses; + private String installPlace; + private String intactState; + private String isCalibrationTestEquipment; + private int isDel; + private String isFixedAssets; + private String isMeasureAccount; + private String isStandardSupportEquipment; + private String labelBind; + private String majorCategory; + private String majorCategoryName; + private String managerLevel; + private String managerLevelName; + private String managerState; + private String managerStateName; + private String manufacturer; + private String manufacturerCountry; + private String manufacturingDate; + private String manufacturingNo; + private String mesureCycle; + private String mesureDate; + private String mesureDept; + private String mesureRange; + private String mesureResult; + private String mesureResultName; + private String mesureType; + private String mesureTypeName; + private String modelNo; + private String originValue; + private String overallDimension; + private String presentOriginValue; + private String purpose; + private String remark; + private String singlePrice; + private String supportStandardEquipmentName; + private String supportStandardEquipmentNo; + private String technicalLevel; + private String uncertainty; + private String updateTime; + private String useDept; + private String useDeptName; + private String usePerson; + private String usePersonName; + private String validDate; + private int version; + private String weight; + + public String getAbc() { + return abc; + } + + public void setAbc(String abc) { + this.abc = abc; + } + + public String getAbcName() { + return abcName; + } + + public void setAbcName(String abcName) { + this.abcName = abcName; + } + + public String getAssetNo() { + return assetNo; + } + + public void setAssetNo(String assetNo) { + this.assetNo = assetNo; + } + + public String getAssetSource() { + return assetSource; + } + + public void setAssetSource(String assetSource) { + this.assetSource = assetSource; + } + + public String getAssetType() { + return assetType; + } + + public void setAssetType(String assetType) { + this.assetType = assetType; + } + + public String getAssetTypeName() { + return assetTypeName; + } + + public void setAssetTypeName(String assetTypeName) { + this.assetTypeName = assetTypeName; + } + + public String getAttribute() { + return attribute; + } + + public void setAttribute(String attribute) { + this.attribute = attribute; + } + + public String getCapitalSource() { + return capitalSource; + } + + public void setCapitalSource(String capitalSource) { + this.capitalSource = capitalSource; + } + + public String getCapitalSourceName() { + return capitalSourceName; + } + + public void setCapitalSourceName(String capitalSourceName) { + this.capitalSourceName = capitalSourceName; + } + + public String getCardEstablishmentDate() { + return cardEstablishmentDate; + } + + public void setCardEstablishmentDate(String cardEstablishmentDate) { + this.cardEstablishmentDate = cardEstablishmentDate; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getDepreciationMethod() { + return depreciationMethod; + } + + public void setDepreciationMethod(String depreciationMethod) { + this.depreciationMethod = depreciationMethod; + } + + public String getDepreciationMethodName() { + return depreciationMethodName; + } + + public void setDepreciationMethodName(String depreciationMethodName) { + this.depreciationMethodName = depreciationMethodName; + } + + public String getDepreciationPeriod() { + return depreciationPeriod; + } + + public void setDepreciationPeriod(String depreciationPeriod) { + this.depreciationPeriod = depreciationPeriod; + } + + public String getEnableDate() { + return enableDate; + } + + public void setEnableDate(String enableDate) { + this.enableDate = enableDate; + } + + public String getEquipmentCategory() { + return equipmentCategory; + } + + public void setEquipmentCategory(String equipmentCategory) { + this.equipmentCategory = equipmentCategory; + } + + public String getEquipmentCategoryName() { + return equipmentCategoryName; + } + + public void setEquipmentCategoryName(String equipmentCategoryName) { + this.equipmentCategoryName = equipmentCategoryName; + } + + public String getEquipmentName() { + return equipmentName; + } + + public void setEquipmentName(String equipmentName) { + this.equipmentName = equipmentName; + } + + public String getEquipmentNo() { + return equipmentNo; + } + + public void setEquipmentNo(String equipmentNo) { + this.equipmentNo = equipmentNo; + } + + public String getEquipmentSpecifications() { + return equipmentSpecifications; + } + + public void setEquipmentSpecifications(String equipmentSpecifications) { + this.equipmentSpecifications = equipmentSpecifications; + } + + public String getEquipmentType() { + return equipmentType; + } + + public void setEquipmentType(String equipmentType) { + this.equipmentType = equipmentType; + } + + public String getEquipmentTypeName() { + return equipmentTypeName; + } + + public void setEquipmentTypeName(String equipmentTypeName) { + this.equipmentTypeName = equipmentTypeName; + } + + public String getFileList() { + return fileList; + } + + public void setFileList(String fileList) { + this.fileList = fileList; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getInstallIncidentalExpenses() { + return installIncidentalExpenses; + } + + public void setInstallIncidentalExpenses(String installIncidentalExpenses) { + this.installIncidentalExpenses = installIncidentalExpenses; + } + + public String getInstallPlace() { + return installPlace; + } + + public void setInstallPlace(String installPlace) { + this.installPlace = installPlace; + } + + public String getIntactState() { + return intactState; + } + + public void setIntactState(String intactState) { + this.intactState = intactState; + } + + public String getIsCalibrationTestEquipment() { + return isCalibrationTestEquipment; + } + + public void setIsCalibrationTestEquipment(String isCalibrationTestEquipment) { + this.isCalibrationTestEquipment = isCalibrationTestEquipment; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getIsFixedAssets() { + return isFixedAssets; + } + + public void setIsFixedAssets(String isFixedAssets) { + this.isFixedAssets = isFixedAssets; + } + + public String getIsMeasureAccount() { + return isMeasureAccount; + } + + public void setIsMeasureAccount(String isMeasureAccount) { + this.isMeasureAccount = isMeasureAccount; + } + + public String getIsStandardSupportEquipment() { + return isStandardSupportEquipment; + } + + public void setIsStandardSupportEquipment(String isStandardSupportEquipment) { + this.isStandardSupportEquipment = isStandardSupportEquipment; + } + + public String getLabelBind() { + return labelBind; + } + + public void setLabelBind(String labelBind) { + this.labelBind = labelBind; + } + + public String getMajorCategory() { + return majorCategory; + } + + public void setMajorCategory(String majorCategory) { + this.majorCategory = majorCategory; + } + + public String getMajorCategoryName() { + return majorCategoryName; + } + + public void setMajorCategoryName(String majorCategoryName) { + this.majorCategoryName = majorCategoryName; + } + + public String getManagerLevel() { + return managerLevel; + } + + public void setManagerLevel(String managerLevel) { + this.managerLevel = managerLevel; + } + + public String getManagerLevelName() { + return managerLevelName; + } + + public void setManagerLevelName(String managerLevelName) { + this.managerLevelName = managerLevelName; + } + + public String getManagerState() { + return managerState; + } + + public void setManagerState(String managerState) { + this.managerState = managerState; + } + + public String getManagerStateName() { + return managerStateName; + } + + public void setManagerStateName(String managerStateName) { + this.managerStateName = managerStateName; + } + + public String getManufacturer() { + return manufacturer; + } + + public void setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + } + + public String getManufacturerCountry() { + return manufacturerCountry; + } + + public void setManufacturerCountry(String manufacturerCountry) { + this.manufacturerCountry = manufacturerCountry; + } + + public String getManufacturingDate() { + return manufacturingDate; + } + + public void setManufacturingDate(String manufacturingDate) { + this.manufacturingDate = manufacturingDate; + } + + public String getManufacturingNo() { + return manufacturingNo; + } + + public void setManufacturingNo(String manufacturingNo) { + this.manufacturingNo = manufacturingNo; + } + + public String getMesureCycle() { + return mesureCycle; + } + + public void setMesureCycle(String mesureCycle) { + this.mesureCycle = mesureCycle; + } + + public String getMesureDate() { + return mesureDate; + } + + public void setMesureDate(String mesureDate) { + this.mesureDate = mesureDate; + } + + public String getMesureDept() { + return mesureDept; + } + + public void setMesureDept(String mesureDept) { + this.mesureDept = mesureDept; + } + + public String getMesureRange() { + return mesureRange; + } + + public void setMesureRange(String mesureRange) { + this.mesureRange = mesureRange; + } + + public String getMesureResult() { + return mesureResult; + } + + public void setMesureResult(String mesureResult) { + this.mesureResult = mesureResult; + } + + public String getMesureResultName() { + return mesureResultName; + } + + public void setMesureResultName(String mesureResultName) { + this.mesureResultName = mesureResultName; + } + + public String getMesureType() { + return mesureType; + } + + public void setMesureType(String mesureType) { + this.mesureType = mesureType; + } + + public String getMesureTypeName() { + return mesureTypeName; + } + + public void setMesureTypeName(String mesureTypeName) { + this.mesureTypeName = mesureTypeName; + } + + public String getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getOriginValue() { + return originValue; + } + + public void setOriginValue(String originValue) { + this.originValue = originValue; + } + + public String getOverallDimension() { + return overallDimension; + } + + public void setOverallDimension(String overallDimension) { + this.overallDimension = overallDimension; + } + + public String getPresentOriginValue() { + return presentOriginValue; + } + + public void setPresentOriginValue(String presentOriginValue) { + this.presentOriginValue = presentOriginValue; + } + + public String getPurpose() { + return purpose; + } + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getSinglePrice() { + return singlePrice; + } + + public void setSinglePrice(String singlePrice) { + this.singlePrice = singlePrice; + } + + public String getSupportStandardEquipmentName() { + return supportStandardEquipmentName; + } + + public void setSupportStandardEquipmentName(String supportStandardEquipmentName) { + this.supportStandardEquipmentName = supportStandardEquipmentName; + } + + public String getSupportStandardEquipmentNo() { + return supportStandardEquipmentNo; + } + + public void setSupportStandardEquipmentNo(String supportStandardEquipmentNo) { + this.supportStandardEquipmentNo = supportStandardEquipmentNo; + } + + public String getTechnicalLevel() { + return technicalLevel; + } + + public void setTechnicalLevel(String technicalLevel) { + this.technicalLevel = technicalLevel; + } + + public String getUncertainty() { + return uncertainty; + } + + public void setUncertainty(String uncertainty) { + this.uncertainty = uncertainty; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getUseDept() { + return useDept; + } + + public void setUseDept(String useDept) { + this.useDept = useDept; + } + + public String getUseDeptName() { + return useDeptName; + } + + public void setUseDeptName(String useDeptName) { + this.useDeptName = useDeptName; + } + + public String getUsePerson() { + return usePerson; + } + + public void setUsePerson(String usePerson) { + this.usePerson = usePerson; + } + + public String getUsePersonName() { + return usePersonName; + } + + public void setUsePersonName(String usePersonName) { + this.usePersonName = usePersonName; + } + + public String getValidDate() { + return validDate; + } + + public void setValidDate(String validDate) { + this.validDate = validDate; + } + + public int getVersion() { + return version; + } + + public void setVersion(int version) { + this.version = version; + } + + public String getWeight() { + return weight; + } + + public void setWeight(String weight) { + this.weight = weight; + } + } + } +} diff --git a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt index a3f514f..46e5eef 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt @@ -35,4 +35,24 @@ @QueryMap limit: Map, @QueryMap offset: Map ): String + + /** + * 获取设备列表 + */ + @POST("/meter/assets/listPage") + suspend fun getEquipmentList( + @Header("token") token: String, + @Body requestBody: RequestBody, + @QueryMap limit: Map, + @QueryMap offset: Map + ): String + + /** + * 获取设备详情 + */ + @POST("/meter/assets/detail") + suspend fun getEquipmentDetail( + @Header("token") token: String, + @Body requestBody: RequestBody + ): String } \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt index 444a872..386a1d8 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt @@ -6,8 +6,10 @@ import com.pengxh.kt.lite.utils.SaveKeyValues import okhttp3.MediaType.Companion.toMediaType import okhttp3.RequestBody.Companion.toRequestBody +import org.json.JSONArray import org.json.JSONObject + object RetrofitServiceManager { private val api by lazy { @@ -73,4 +75,71 @@ offsetMap["offset"] = offset return api.getNoticeList(AuthenticationHelper.token!!, requestBody, limitMap, offsetMap) } + + /** + * 获取设备列表 + */ + suspend fun getEquipmentList( + equipmentNo: String, + equipmentName: String, + mesureType: String, + managerState: String, + useDept: String, + assetType: String, + equipmentCategory: String, + isCalibrationTestEquipment: String, + isMeasureAccount: String, + isStandardSupportEquipment: String, + isFixedAssets: String, + validStartDate: String, + validEndDate: String, + abc: String, + ids: Array, + offset: Int + ): String { + val paramObject = JSONObject() + paramObject.put("equipmentNo", equipmentNo) + paramObject.put("equipmentName", equipmentName) + paramObject.put("mesureType", mesureType) + paramObject.put("managerState", managerState) + paramObject.put("useDept", useDept) + paramObject.put("assetType", assetType) + paramObject.put("equipmentCategory", equipmentCategory) + paramObject.put("isCalibrationTestEquipment", isCalibrationTestEquipment) + paramObject.put("isMeasureAccount", isMeasureAccount) + paramObject.put("isStandardSupportEquipment", isStandardSupportEquipment) + paramObject.put("isFixedAssets", isFixedAssets) + paramObject.put("validStartDate", validStartDate) + paramObject.put("validEndDate", validEndDate) + paramObject.put("abc", abc) + + val jsonArray = JSONArray() + ids.forEach { + jsonArray.put(it) + } + paramObject.put("ids", jsonArray) + + val requestBody = paramObject.toString().toRequestBody( + "application/json;charset=UTF-8".toMediaType() + ) + + val limitMap = HashMap() + limitMap["limit"] = LocaleConstant.PAGE_LIMIT + + val offsetMap = HashMap() + offsetMap["offset"] = offset + return api.getEquipmentList(AuthenticationHelper.token!!, requestBody, limitMap, offsetMap) + } + + /** + * 获取设备详情 + */ + suspend fun getEquipmentDetail(id: String): String { + val paramObject = JSONObject() + paramObject.put("id", id) + val requestBody = paramObject.toString().toRequestBody( + "application/json;charset=UTF-8".toMediaType() + ) + return api.getEquipmentDetail(AuthenticationHelper.token!!, requestBody) + } } \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt deleted file mode 100644 index a5bb60b..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/NoticeDetailActivity.kt +++ /dev/null @@ -1,104 +0,0 @@ -package com.casic.xz.meterage.view - -import android.annotation.SuppressLint -import android.graphics.Paint -import androidx.lifecycle.ViewModelProvider -import com.casic.xz.meterage.R -import com.casic.xz.meterage.extensions.combineImagePath -import com.casic.xz.meterage.extensions.formatTextFromHtml -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.vm.NoticeViewModel -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.extensions.convertColor -import com.pengxh.kt.lite.extensions.navigatePageTo -import com.pengxh.kt.lite.extensions.obtainScreenWidth -import com.pengxh.kt.lite.extensions.show -import com.pengxh.kt.lite.utils.Constant -import kotlinx.android.synthetic.main.activity_notice_detail.* -import kotlinx.android.synthetic.main.include_base_title.* -import java.util.* - -@SuppressLint("SetTextI18n") -class NoticeDetailActivity : KotlinBaseActivity() { - - private lateinit var noticeViewModel: NoticeViewModel - - override fun initData() { - leftBackView.setOnClickListener { finish() } - titleView.text = "通知公告" - - val args = intent.getStringArrayListExtra(Constant.INTENT_PARAM)!! - - noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] - noticeViewModel.getNoticeList(args[0], args[1], args[2], "", "", 1) - noticeViewModel.noticeResult.observe(this, { - if (it.code == 200) { - val dataRow = it.data?.rows!![0] - - noticeDateView.text = dataRow.noticeTime - noticePublisherView.text = "发布人 ${dataRow.noticePublisher}" - noticeCompanyView.text = "发布单位 ${dataRow.noticeCompany}" - - noticeNoView.text = dataRow.noticeNo - noticeTitleView.text = dataRow.noticeTitle - noticeSketchView.text = dataRow.noticeSketch - - dataRow.noticeContent.formatTextFromHtml( - this, noticeContentView, obtainScreenWidth() - ) - - if (dataRow.minioFileName.isNullOrBlank()) { - minioFileView.text = "暂无附件" - } else { - val minioFileName = dataRow.minioFileName - - minioFileView.text = minioFileName - val textPaint = minioFileView.paint - textPaint.flags = Paint.UNDERLINE_TEXT_FLAG - textPaint.isAntiAlias = true - minioFileView.setTextColor(R.color.themeColor.convertColor(this)) - - minioFileView.setOnClickListener { - //查看附件 - if (minioFileName.endsWith("pdf")) { - navigatePageTo(minioFileName) - } else if ( - minioFileName.endsWith("doc") || - minioFileName.endsWith("docx") - ) { - navigatePageTo(minioFileName) - } else if (minioFileName.endsWith("txt")) { - navigatePageTo(minioFileName) - } else if ( - minioFileName.endsWith("png") || - minioFileName.endsWith("jpeg") || - minioFileName.endsWith("jpg") - ) { - val urls = ArrayList() - urls.add(minioFileName.combineImagePath()) - navigatePageTo(0, urls) - } else { - "文件类型未知,无法打开附件".show(this) - } - } - } - } - }) - } - - override fun initEvent() { - - } - - override fun initLayoutView(): Int = R.layout.activity_notice_detail - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/NoticeListActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/NoticeListActivity.kt deleted file mode 100644 index 15f6a16..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/NoticeListActivity.kt +++ /dev/null @@ -1,180 +0,0 @@ -package com.casic.xz.meterage.view - -import android.os.Handler -import android.util.Log -import android.view.View -import androidx.lifecycle.ViewModelProvider -import com.casic.xz.meterage.R -import com.casic.xz.meterage.adapter.NoticeListAdapter -import com.casic.xz.meterage.extensions.addAll -import com.casic.xz.meterage.extensions.combineFilePath -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.extensions.showEmptyPage -import com.casic.xz.meterage.model.NoticeListModel -import com.casic.xz.meterage.vm.NoticeViewModel -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.extensions.navigatePageTo -import com.pengxh.kt.lite.extensions.show -import com.pengxh.kt.lite.utils.WeakReferenceHandler -import com.pengxh.kt.lite.widget.dialog.AlertControlDialog -import kotlinx.android.synthetic.main.activity_notice_list.* -import kotlinx.android.synthetic.main.include_empty_view.* - -class NoticeListActivity : KotlinBaseActivity() { - - private lateinit var weakReferenceHandler: WeakReferenceHandler - private lateinit var noticeViewModel: NoticeViewModel - private lateinit var noticeListAdapter: NoticeListAdapter - private var dataBeans: MutableList = ArrayList() - private var pageIndex = 1 - private var isRefresh = false - private var isLoadMore = false - - override fun initData() { - weakReferenceHandler = WeakReferenceHandler(callback) - noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] - noticeViewModel.noticeResult.observe(this, { - if (it.code == 200) { - val dataRows = it.data?.rows!! -// countBadeNumber(dataRows) - when { - isRefresh -> { - dataBeans.clear() - dataBeans = dataRows - noticeLayout.finishRefresh() - isRefresh = false - } - isLoadMore -> { - if (dataRows.size == 0) { - "到底了,别拉了".show(this) - } - dataBeans.addAll(dataRows) - noticeLayout.finishLoadMore() - isLoadMore = false - } - else -> { - dataBeans = dataRows - } - } - weakReferenceHandler.sendEmptyMessage(2023013101) - } - }) - } - - override fun initEvent() { - leftBackView.setOnClickListener { finish() } - rightOperateView.setOnClickListener { - AlertControlDialog.Builder() - .setContext(this) - .setTitle("提示") - .setMessage("确定将所有未读消息标为已读?") - .setNegativeButton("取消") - .setPositiveButton("确定") - .setOnDialogButtonClickListener(object : - AlertControlDialog.OnDialogButtonClickListener { - override fun onCancelClick() { - - } - - override fun onConfirmClick() { - //TODO 设置为已读 - } - }).build().show() - } - - if (hasNoticePermission()) { - openSystemNoticeLayout.visibility = View.GONE - openSystemNoticeLayout.visibility = View.GONE - } else { - openSystemNoticeLayout.setOnClickListener { - - } - - - closeLayoutView.setOnClickListener { - openSystemNoticeLayout.visibility = View.GONE - } - } - - noticeLayout.setOnRefreshListener { - isRefresh = true - //刷新之后页码重置 - pageIndex = 1 - getNoticeListByPage() - } - - noticeLayout.setOnLoadMoreListener { - isLoadMore = true - pageIndex++ - getNoticeListByPage() - } - } - - override fun onResume() { - super.onResume() - pageIndex = 1 - getNoticeListByPage() - } - - private fun getNoticeListByPage() { - noticeViewModel.getNoticeList("", "", "", "", "", pageIndex) - } - - private val callback = Handler.Callback { - when (it.what) { - 2023013101 -> { - if (isRefresh || isLoadMore) { - noticeListAdapter.notifyDataSetChanged() - } else { - if (dataBeans.size == 0) { - emptyView!!.showEmptyPage("没有任何消息") { - pageIndex = 1 - getNoticeListByPage() - } - } else { - emptyView!!.hide() - noticeListAdapter = NoticeListAdapter(this, dataBeans) - noticeRecyclerView.adapter = noticeListAdapter - noticeListAdapter.setOnItemClickListener(object : - NoticeListAdapter.OnItemClickListener { - override fun onItemClicked(position: Int) { - val rowsModel = dataBeans[position] - val allArgs = addAll( - rowsModel.noticeNo, - rowsModel.noticeTitle, - rowsModel.noticePublisher, - "", - "" - ) - Log.d( - "Casic", - "NoticeListActivity => onItemClicked: ${rowsModel.minioFileName.combineFilePath()}" - ) - navigatePageTo(allArgs) - } - }) - } - } - } - } - true - } - - //TODO 判断是否开启通知权限 - private fun hasNoticePermission(): Boolean { - - return false - } - - override fun initLayoutView(): Int = R.layout.activity_notice_list - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/PreviewDocumentActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/PreviewDocumentActivity.kt deleted file mode 100644 index e233ddc..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/PreviewDocumentActivity.kt +++ /dev/null @@ -1,24 +0,0 @@ -package com.casic.xz.meterage.view - -import com.casic.xz.meterage.R -import com.pengxh.kt.lite.base.KotlinBaseActivity - -class PreviewDocumentActivity : KotlinBaseActivity() { - override fun initData() { - - } - - override fun initEvent() { - - } - - override fun initLayoutView(): Int = R.layout.activity_preview_doc - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/PreviewPdfActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/PreviewPdfActivity.kt deleted file mode 100644 index 39f8ac2..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/PreviewPdfActivity.kt +++ /dev/null @@ -1,62 +0,0 @@ -package com.casic.xz.meterage.view - -import com.casic.xz.meterage.R -import com.casic.xz.meterage.extensions.combineFilePath -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.utils.LoadingDialogHub -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.callback.OnDownloadListener -import com.pengxh.kt.lite.extensions.createDownloadFileDir -import com.pengxh.kt.lite.extensions.downloadFile -import com.pengxh.kt.lite.utils.Constant -import kotlinx.android.synthetic.main.activity_preview_pdf.* -import kotlinx.android.synthetic.main.include_base_title.* -import java.io.File -import java.io.FileInputStream - - -class PreviewPdfActivity : KotlinBaseActivity() { - - override fun initData() { - val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! - titleView.text = minioFileName - - val url = minioFileName.combineFilePath() - url.downloadFile(createDownloadFileDir().toString(), - object : OnDownloadListener { - override fun onDownloadStart(totalBytes: Long) { - runOnUiThread { - LoadingDialogHub.show(this@PreviewPdfActivity, "附件加载中") - } - } - - override fun onProgressChanged(currentBytes: Long) { - - } - - override fun onDownloadEnd(file: File?) { - runOnUiThread { - LoadingDialogHub.dismiss() - } - val inputStream = FileInputStream(file) - pdfView.fromStream(inputStream).load() - } - }) - } - - override fun initEvent() { - leftBackView.setOnClickListener { finish() } - } - - override fun initLayoutView(): Int = R.layout.activity_preview_pdf - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/PreviewTextActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/PreviewTextActivity.kt deleted file mode 100644 index d634ca3..0000000 --- a/app/src/main/java/com/casic/xz/meterage/view/PreviewTextActivity.kt +++ /dev/null @@ -1,60 +0,0 @@ -package com.casic.xz.meterage.view - -import com.casic.xz.meterage.R -import com.casic.xz.meterage.extensions.combineFilePath -import com.casic.xz.meterage.extensions.initLayoutImmersionBar -import com.casic.xz.meterage.utils.LoadingDialogHub -import com.gyf.immersionbar.ImmersionBar -import com.pengxh.kt.lite.base.KotlinBaseActivity -import com.pengxh.kt.lite.callback.OnDownloadListener -import com.pengxh.kt.lite.extensions.createDownloadFileDir -import com.pengxh.kt.lite.extensions.downloadFile -import com.pengxh.kt.lite.extensions.read -import com.pengxh.kt.lite.utils.Constant -import kotlinx.android.synthetic.main.activity_preview_txt.* -import kotlinx.android.synthetic.main.include_base_title.* -import java.io.File - -class PreviewTextActivity : KotlinBaseActivity() { - - override fun initData() { - val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! - titleView.text = minioFileName - - val url = minioFileName.combineFilePath() - url.downloadFile(createDownloadFileDir().toString(), - object : OnDownloadListener { - override fun onDownloadStart(totalBytes: Long) { - runOnUiThread { - LoadingDialogHub.show(this@PreviewTextActivity, "附件加载中") - } - } - - override fun onProgressChanged(currentBytes: Long) { - - } - - override fun onDownloadEnd(file: File?) { - runOnUiThread { - LoadingDialogHub.dismiss() - textView.text = file?.read() - } - } - }) - } - - override fun initEvent() { - leftBackView.setOnClickListener { finish() } - } - - override fun initLayoutView(): Int = R.layout.activity_preview_txt - - override fun observeRequestState() { - - } - - override fun setupTopBarLayout() { - ImmersionBar.with(this).statusBarDarkFont(true).init() - initLayoutImmersionBar(rootView) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentActivity.kt new file mode 100644 index 0000000..35ca098 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentActivity.kt @@ -0,0 +1,158 @@ +package com.casic.xz.meterage.view.home + +import android.os.Handler +import androidx.lifecycle.ViewModelProvider +import androidx.recyclerview.widget.DividerItemDecoration +import com.casic.xz.meterage.R +import com.casic.xz.meterage.adapter.EquipmentListAdapter +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.extensions.showEmptyPage +import com.casic.xz.meterage.model.EquipmentListModel +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.casic.xz.meterage.vm.EquipmentViewModel +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.extensions.navigatePageTo +import com.pengxh.kt.lite.extensions.show +import com.pengxh.kt.lite.utils.WeakReferenceHandler +import com.pengxh.kt.lite.vm.LoadState +import kotlinx.android.synthetic.main.activity_equipment.* +import kotlinx.android.synthetic.main.include_empty_view.* +import kotlinx.android.synthetic.main.include_search_title.* + +class EquipmentActivity : KotlinBaseActivity() { + + private lateinit var weakReferenceHandler: WeakReferenceHandler + private lateinit var equipmentViewModel: EquipmentViewModel + private lateinit var equipmentListAdapter: EquipmentListAdapter + private var dataBeans: MutableList = ArrayList() + private var pageIndex = 1 + private var isRefresh = false + private var isLoadMore = false + + override fun initData() { + weakReferenceHandler = WeakReferenceHandler(callback) + equipmentViewModel = ViewModelProvider(this)[EquipmentViewModel::class.java] + equipmentViewModel.equipmentResult.observe(this, { + if (it.code == 200) { + val dataRows = it.data?.rows!! + when { + isRefresh -> { + dataBeans.clear() + dataBeans = dataRows + equipmentLayout.finishRefresh() + isRefresh = false + } + isLoadMore -> { + if (dataRows.size == 0) { + "到底了,别拉了".show(this) + } + dataBeans.addAll(dataRows) + equipmentLayout.finishLoadMore() + isLoadMore = false + } + else -> { + dataBeans = dataRows + } + } + weakReferenceHandler.sendEmptyMessage(2023020801) + } + }) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + rightOperateView.setOnClickListener { + + } + + equipmentLayout.setOnRefreshListener { + isRefresh = true + //刷新之后页码重置 + pageIndex = 1 + getEquipmentListByPage() + } + + equipmentLayout.setOnLoadMoreListener { + isLoadMore = true + pageIndex++ + getEquipmentListByPage() + } + } + + override fun initLayoutView(): Int = R.layout.activity_equipment + + override fun observeRequestState() { + equipmentViewModel.loadState.observe(this, { + when (it) { + LoadState.Loading -> LoadingDialogHub.show(this, "数据加载中...") + else -> LoadingDialogHub.dismiss() + } + }) + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + titleView.text = "仪器设备" + } + + override fun onResume() { + super.onResume() + pageIndex = 1 + getEquipmentListByPage() + } + + private fun getEquipmentListByPage() { + equipmentViewModel.getEquipmentList( + "", + "", + "", + "", + "", + "1", + "", + "", + "", + "", + "", + "", + "", + "", + arrayOf(), + pageIndex + ) + } + + private val callback = Handler.Callback { + when (it.what) { + 2023020801 -> { + if (isRefresh || isLoadMore) { + equipmentListAdapter.notifyDataSetChanged() + } else { + if (dataBeans.size == 0) { + emptyView!!.showEmptyPage("无设备") { + pageIndex = 1 + getEquipmentListByPage() + } + } else { + emptyView!!.hide() + equipmentListAdapter = EquipmentListAdapter(this, dataBeans) + equipmentRecyclerView.addItemDecoration( + DividerItemDecoration(this, DividerItemDecoration.VERTICAL) + ) + equipmentRecyclerView.adapter = equipmentListAdapter + equipmentListAdapter.setOnItemClickListener(object : + EquipmentListAdapter.OnItemClickListener { + override fun onItemClicked(position: Int) { + val rowsModel = dataBeans[position] + navigatePageTo(rowsModel.id) + } + }) + } + } + } + } + true + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentDetailActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentDetailActivity.kt new file mode 100644 index 0000000..7dee13c --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/home/EquipmentDetailActivity.kt @@ -0,0 +1,53 @@ +package com.casic.xz.meterage.view.home + +import androidx.fragment.app.Fragment +import com.casic.xz.meterage.R +import com.casic.xz.meterage.adapter.SubViewPagerAdapter +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.fragment.equipment.* +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.utils.Constant +import kotlinx.android.synthetic.main.activity_equipment.rootView +import kotlinx.android.synthetic.main.activity_equipment_detail.* +import kotlinx.android.synthetic.main.include_base_title.* + +class EquipmentDetailActivity : KotlinBaseActivity() { + + private var fragmentPages: ArrayList = ArrayList() + + override fun initData() { + val equipmentId = intent.getStringExtra(Constant.INTENT_PARAM)!! + + fragmentPages.add(BasicInformationFragment(equipmentId)) + fragmentPages.add(InspectionRecordFragment()) + fragmentPages.add(ChangeRecordFragment()) + fragmentPages.add(UsageRecordFragment()) + fragmentPages.add(CertificateFragment()) + + val equipmentPageTitles = arrayOf("基础信息", "周检记录", "状态变更记录", "使用记录", "检定证书") + + equipmentViewPager.adapter = SubViewPagerAdapter( + supportFragmentManager, fragmentPages, equipmentPageTitles + ) + equipmentViewPager.offscreenPageLimit = fragmentPages.size + //绑定 + topTabLayout.setupWithViewPager(equipmentViewPager) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + } + + override fun initLayoutView(): Int = R.layout.activity_equipment_detail + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + titleView.text = "仪器设备" + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeDetailActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeDetailActivity.kt new file mode 100644 index 0000000..6fe0022 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeDetailActivity.kt @@ -0,0 +1,105 @@ +package com.casic.xz.meterage.view.notice + +import android.annotation.SuppressLint +import android.graphics.Paint +import androidx.lifecycle.ViewModelProvider +import com.casic.xz.meterage.R +import com.casic.xz.meterage.extensions.combineImagePath +import com.casic.xz.meterage.extensions.formatTextFromHtml +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.view.BigImageActivity +import com.casic.xz.meterage.vm.NoticeViewModel +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.extensions.convertColor +import com.pengxh.kt.lite.extensions.navigatePageTo +import com.pengxh.kt.lite.extensions.obtainScreenWidth +import com.pengxh.kt.lite.extensions.show +import com.pengxh.kt.lite.utils.Constant +import kotlinx.android.synthetic.main.activity_notice_detail.* +import kotlinx.android.synthetic.main.include_base_title.* +import java.util.* + +@SuppressLint("SetTextI18n") +class NoticeDetailActivity : KotlinBaseActivity() { + + private lateinit var noticeViewModel: NoticeViewModel + + override fun initData() { + leftBackView.setOnClickListener { finish() } + titleView.text = "通知公告" + + val args = intent.getStringArrayListExtra(Constant.INTENT_PARAM)!! + + noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] + noticeViewModel.getNoticeList(args[0], args[1], args[2], "", "", 1) + noticeViewModel.noticeResult.observe(this, { + if (it.code == 200) { + val dataRow = it.data?.rows!![0] + + noticeDateView.text = dataRow.noticeTime + noticePublisherView.text = "发布人 ${dataRow.noticePublisher}" + noticeCompanyView.text = "发布单位 ${dataRow.noticeCompany}" + + noticeNoView.text = dataRow.noticeNo + noticeTitleView.text = dataRow.noticeTitle + noticeSketchView.text = dataRow.noticeSketch + + dataRow.noticeContent.formatTextFromHtml( + this, noticeContentView, obtainScreenWidth() + ) + + if (dataRow.minioFileName.isNullOrBlank()) { + minioFileView.text = "暂无附件" + } else { + val minioFileName = dataRow.minioFileName + + minioFileView.text = minioFileName + val textPaint = minioFileView.paint + textPaint.flags = Paint.UNDERLINE_TEXT_FLAG + textPaint.isAntiAlias = true + minioFileView.setTextColor(R.color.themeColor.convertColor(this)) + + minioFileView.setOnClickListener { + //查看附件 + if (minioFileName.endsWith("pdf")) { + navigatePageTo(minioFileName) + } else if ( + minioFileName.endsWith("doc") || + minioFileName.endsWith("docx") + ) { + navigatePageTo(minioFileName) + } else if (minioFileName.endsWith("txt")) { + navigatePageTo(minioFileName) + } else if ( + minioFileName.endsWith("png") || + minioFileName.endsWith("jpeg") || + minioFileName.endsWith("jpg") + ) { + val urls = ArrayList() + urls.add(minioFileName.combineImagePath()) + navigatePageTo(0, urls) + } else { + "文件类型未知,无法打开附件".show(this) + } + } + } + } + }) + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.activity_notice_detail + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeListActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeListActivity.kt new file mode 100644 index 0000000..31c0490 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/NoticeListActivity.kt @@ -0,0 +1,180 @@ +package com.casic.xz.meterage.view.notice + +import android.os.Handler +import android.util.Log +import android.view.View +import androidx.lifecycle.ViewModelProvider +import com.casic.xz.meterage.R +import com.casic.xz.meterage.adapter.NoticeListAdapter +import com.casic.xz.meterage.extensions.addAll +import com.casic.xz.meterage.extensions.combineFilePath +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.extensions.showEmptyPage +import com.casic.xz.meterage.model.NoticeListModel +import com.casic.xz.meterage.vm.NoticeViewModel +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.extensions.navigatePageTo +import com.pengxh.kt.lite.extensions.show +import com.pengxh.kt.lite.utils.WeakReferenceHandler +import com.pengxh.kt.lite.widget.dialog.AlertControlDialog +import kotlinx.android.synthetic.main.activity_notice_list.* +import kotlinx.android.synthetic.main.include_empty_view.* + +class NoticeListActivity : KotlinBaseActivity() { + + private lateinit var weakReferenceHandler: WeakReferenceHandler + private lateinit var noticeViewModel: NoticeViewModel + private lateinit var noticeListAdapter: NoticeListAdapter + private var dataBeans: MutableList = ArrayList() + private var pageIndex = 1 + private var isRefresh = false + private var isLoadMore = false + + override fun initData() { + weakReferenceHandler = WeakReferenceHandler(callback) + noticeViewModel = ViewModelProvider(this)[NoticeViewModel::class.java] + noticeViewModel.noticeResult.observe(this, { + if (it.code == 200) { + val dataRows = it.data?.rows!! +// countBadeNumber(dataRows) + when { + isRefresh -> { + dataBeans.clear() + dataBeans = dataRows + noticeLayout.finishRefresh() + isRefresh = false + } + isLoadMore -> { + if (dataRows.size == 0) { + "到底了,别拉了".show(this) + } + dataBeans.addAll(dataRows) + noticeLayout.finishLoadMore() + isLoadMore = false + } + else -> { + dataBeans = dataRows + } + } + weakReferenceHandler.sendEmptyMessage(2023013101) + } + }) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + rightOperateView.setOnClickListener { + AlertControlDialog.Builder() + .setContext(this) + .setTitle("提示") + .setMessage("确定将所有未读消息标为已读?") + .setNegativeButton("取消") + .setPositiveButton("确定") + .setOnDialogButtonClickListener(object : + AlertControlDialog.OnDialogButtonClickListener { + override fun onCancelClick() { + + } + + override fun onConfirmClick() { + //TODO 设置为已读 + } + }).build().show() + } + + if (hasNoticePermission()) { + openSystemNoticeLayout.visibility = View.GONE + openSystemNoticeLayout.visibility = View.GONE + } else { + openSystemNoticeLayout.setOnClickListener { + + } + + + closeLayoutView.setOnClickListener { + openSystemNoticeLayout.visibility = View.GONE + } + } + + noticeLayout.setOnRefreshListener { + isRefresh = true + //刷新之后页码重置 + pageIndex = 1 + getNoticeListByPage() + } + + noticeLayout.setOnLoadMoreListener { + isLoadMore = true + pageIndex++ + getNoticeListByPage() + } + } + + override fun onResume() { + super.onResume() + pageIndex = 1 + getNoticeListByPage() + } + + private fun getNoticeListByPage() { + noticeViewModel.getNoticeList("", "", "", "", "", pageIndex) + } + + private val callback = Handler.Callback { + when (it.what) { + 2023013101 -> { + if (isRefresh || isLoadMore) { + noticeListAdapter.notifyDataSetChanged() + } else { + if (dataBeans.size == 0) { + emptyView!!.showEmptyPage("没有任何消息") { + pageIndex = 1 + getNoticeListByPage() + } + } else { + emptyView!!.hide() + noticeListAdapter = NoticeListAdapter(this, dataBeans) + noticeRecyclerView.adapter = noticeListAdapter + noticeListAdapter.setOnItemClickListener(object : + NoticeListAdapter.OnItemClickListener { + override fun onItemClicked(position: Int) { + val rowsModel = dataBeans[position] + val allArgs = addAll( + rowsModel.noticeNo, + rowsModel.noticeTitle, + rowsModel.noticePublisher, + "", + "" + ) + Log.d( + "Casic", + "NoticeListActivity => onItemClicked: ${rowsModel.minioFileName.combineFilePath()}" + ) + navigatePageTo(allArgs) + } + }) + } + } + } + } + true + } + + //TODO 判断是否开启通知权限 + private fun hasNoticePermission(): Boolean { + + return false + } + + override fun initLayoutView(): Int = R.layout.activity_notice_list + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewDocumentActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewDocumentActivity.kt new file mode 100644 index 0000000..4b16ae8 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewDocumentActivity.kt @@ -0,0 +1,24 @@ +package com.casic.xz.meterage.view.notice + +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.base.KotlinBaseActivity + +class PreviewDocumentActivity : KotlinBaseActivity() { + override fun initData() { + + } + + override fun initEvent() { + + } + + override fun initLayoutView(): Int = R.layout.activity_preview_doc + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewPdfActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewPdfActivity.kt new file mode 100644 index 0000000..fad73b6 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewPdfActivity.kt @@ -0,0 +1,62 @@ +package com.casic.xz.meterage.view.notice + +import com.casic.xz.meterage.R +import com.casic.xz.meterage.extensions.combineFilePath +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.callback.OnDownloadListener +import com.pengxh.kt.lite.extensions.createDownloadFileDir +import com.pengxh.kt.lite.extensions.downloadFile +import com.pengxh.kt.lite.utils.Constant +import kotlinx.android.synthetic.main.activity_preview_pdf.* +import kotlinx.android.synthetic.main.include_base_title.* +import java.io.File +import java.io.FileInputStream + + +class PreviewPdfActivity : KotlinBaseActivity() { + + override fun initData() { + val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! + titleView.text = minioFileName + + val url = minioFileName.combineFilePath() + url.downloadFile(createDownloadFileDir().toString(), + object : OnDownloadListener { + override fun onDownloadStart(totalBytes: Long) { + runOnUiThread { + LoadingDialogHub.show(this@PreviewPdfActivity, "附件加载中") + } + } + + override fun onProgressChanged(currentBytes: Long) { + + } + + override fun onDownloadEnd(file: File?) { + runOnUiThread { + LoadingDialogHub.dismiss() + } + val inputStream = FileInputStream(file) + pdfView.fromStream(inputStream).load() + } + }) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + } + + override fun initLayoutView(): Int = R.layout.activity_preview_pdf + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewTextActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewTextActivity.kt new file mode 100644 index 0000000..d7850fb --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/notice/PreviewTextActivity.kt @@ -0,0 +1,60 @@ +package com.casic.xz.meterage.view.notice + +import com.casic.xz.meterage.R +import com.casic.xz.meterage.extensions.combineFilePath +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.callback.OnDownloadListener +import com.pengxh.kt.lite.extensions.createDownloadFileDir +import com.pengxh.kt.lite.extensions.downloadFile +import com.pengxh.kt.lite.extensions.read +import com.pengxh.kt.lite.utils.Constant +import kotlinx.android.synthetic.main.activity_preview_txt.* +import kotlinx.android.synthetic.main.include_base_title.* +import java.io.File + +class PreviewTextActivity : KotlinBaseActivity() { + + override fun initData() { + val minioFileName = intent.getStringExtra(Constant.INTENT_PARAM)!! + titleView.text = minioFileName + + val url = minioFileName.combineFilePath() + url.downloadFile(createDownloadFileDir().toString(), + object : OnDownloadListener { + override fun onDownloadStart(totalBytes: Long) { + runOnUiThread { + LoadingDialogHub.show(this@PreviewTextActivity, "附件加载中") + } + } + + override fun onProgressChanged(currentBytes: Long) { + + } + + override fun onDownloadEnd(file: File?) { + runOnUiThread { + LoadingDialogHub.dismiss() + textView.text = file?.read() + } + } + }) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + } + + override fun initLayoutView(): Int = R.layout.activity_preview_txt + + override fun observeRequestState() { + + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/vm/EquipmentViewModel.kt b/app/src/main/java/com/casic/xz/meterage/vm/EquipmentViewModel.kt new file mode 100644 index 0000000..b5f21f6 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/vm/EquipmentViewModel.kt @@ -0,0 +1,92 @@ +package com.casic.xz.meterage.vm + +import androidx.lifecycle.MutableLiveData +import com.casic.xz.meterage.base.BaseApplication +import com.casic.xz.meterage.extensions.separateResponseCode +import com.casic.xz.meterage.extensions.toErrorMessage +import com.casic.xz.meterage.model.EquipmentDetailModel +import com.casic.xz.meterage.model.EquipmentListModel +import com.casic.xz.meterage.utils.retrofit.RetrofitServiceManager +import com.google.gson.Gson +import com.google.gson.reflect.TypeToken +import com.pengxh.kt.lite.extensions.launch +import com.pengxh.kt.lite.extensions.show +import com.pengxh.kt.lite.vm.BaseViewModel +import com.pengxh.kt.lite.vm.LoadState + +class EquipmentViewModel : BaseViewModel() { + + private val gson by lazy { Gson() } + val equipmentResult = MutableLiveData() + val equipmentDetailResult = MutableLiveData() + + fun getEquipmentList( + equipmentNo: String, + equipmentName: String, + mesureType: String, + managerState: String, + useDept: String, + assetType: String, + equipmentCategory: String, + isCalibrationTestEquipment: String, + isMeasureAccount: String, + isStandardSupportEquipment: String, + isFixedAssets: String, + validStartDate: String, + validEndDate: String, + abc: String, + ids: Array, + offset: Int + ) = launch({ + loadState.value = LoadState.Loading + val response = RetrofitServiceManager.getEquipmentList( + equipmentNo, + equipmentName, + mesureType, + managerState, + useDept, + assetType, + equipmentCategory, + isCalibrationTestEquipment, + isMeasureAccount, + isStandardSupportEquipment, + isFixedAssets, + validStartDate, + validEndDate, + abc, + ids, + offset + ) + val responseCode = response.separateResponseCode() + if (responseCode == 200) { + loadState.value = LoadState.Success + equipmentResult.value = gson.fromJson( + response, object : TypeToken() {}.type + ) + } else { + loadState.value = LoadState.Fail + response.toErrorMessage().show(BaseApplication.get()) + } + }, { + loadState.value = LoadState.Fail + it.printStackTrace() + }) + + fun getEquipmentDetail(id: String) = launch({ + loadState.value = LoadState.Loading + val response = RetrofitServiceManager.getEquipmentDetail(id) + val responseCode = response.separateResponseCode() + if (responseCode == 200) { + loadState.value = LoadState.Success + equipmentDetailResult.value = gson.fromJson( + response, object : TypeToken() {}.type + ) + } else { + loadState.value = LoadState.Fail + response.toErrorMessage().show(BaseApplication.get()) + } + }, { + loadState.value = LoadState.Fail + it.printStackTrace() + }) +} \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_sorting.xml b/app/src/main/res/drawable/ic_sorting.xml new file mode 100644 index 0000000..252bfe6 --- /dev/null +++ b/app/src/main/res/drawable/ic_sorting.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/layout/activity_equipment.xml b/app/src/main/res/layout/activity_equipment.xml new file mode 100644 index 0000000..d6a64b1 --- /dev/null +++ b/app/src/main/res/layout/activity_equipment.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_equipment_detail.xml b/app/src/main/res/layout/activity_equipment_detail.xml new file mode 100644 index 0000000..7254762 --- /dev/null +++ b/app/src/main/res/layout/activity_equipment_detail.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_basic_information.xml b/app/src/main/res/layout/fragment_basic_information.xml new file mode 100644 index 0000000..4a3c1c7 --- /dev/null +++ b/app/src/main/res/layout/fragment_basic_information.xml @@ -0,0 +1,390 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_certificate.xml b/app/src/main/res/layout/fragment_certificate.xml new file mode 100644 index 0000000..77d9ef6 --- /dev/null +++ b/app/src/main/res/layout/fragment_certificate.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_change_record.xml b/app/src/main/res/layout/fragment_change_record.xml new file mode 100644 index 0000000..77d9ef6 --- /dev/null +++ b/app/src/main/res/layout/fragment_change_record.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_home.xml b/app/src/main/res/layout/fragment_home.xml index 41b32a9..e1ab759 100644 --- a/app/src/main/res/layout/fragment_home.xml +++ b/app/src/main/res/layout/fragment_home.xml @@ -71,7 +71,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" app:layoutManager="androidx.recyclerview.widget.GridLayoutManager" - app:spanCount="5" /> + app:spanCount="4" /> + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_mine.xml b/app/src/main/res/layout/fragment_mine.xml index 0643064..d9f57b3 100644 --- a/app/src/main/res/layout/fragment_mine.xml +++ b/app/src/main/res/layout/fragment_mine.xml @@ -22,10 +22,10 @@ android:orientation="horizontal"> + android:src="@mipmap/default_avatar" /> @@ -122,7 +122,7 @@ android:background="@drawable/ic_collection" /> @@ -145,7 +145,7 @@ android:background="@drawable/ic_push_setting" /> @@ -166,7 +166,7 @@ android:background="@drawable/ic_privacy" /> @@ -189,7 +189,7 @@ android:background="@drawable/ic_help" /> @@ -210,7 +210,7 @@ android:background="@drawable/ic_update" /> @@ -231,7 +231,7 @@ android:background="@drawable/ic_about" /> @@ -252,7 +252,7 @@ android:background="@drawable/ic_back" /> diff --git a/app/src/main/res/layout/fragment_usage_record.xml b/app/src/main/res/layout/fragment_usage_record.xml new file mode 100644 index 0000000..77d9ef6 --- /dev/null +++ b/app/src/main/res/layout/fragment_usage_record.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/include_equipment_layout.xml b/app/src/main/res/layout/include_equipment_layout.xml new file mode 100644 index 0000000..ce846d5 --- /dev/null +++ b/app/src/main/res/layout/include_equipment_layout.xml @@ -0,0 +1,74 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/include_line_view.xml b/app/src/main/res/layout/include_line_view.xml new file mode 100644 index 0000000..ff89de3 --- /dev/null +++ b/app/src/main/res/layout/include_line_view.xml @@ -0,0 +1,5 @@ + + \ No newline at end of file diff --git a/app/src/main/res/layout/include_search_title.xml b/app/src/main/res/layout/include_search_title.xml new file mode 100644 index 0000000..644fa4c --- /dev/null +++ b/app/src/main/res/layout/include_search_title.xml @@ -0,0 +1,35 @@ + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/item_equipment_rv_l.xml b/app/src/main/res/layout/item_equipment_rv_l.xml new file mode 100644 index 0000000..796f4b1 --- /dev/null +++ b/app/src/main/res/layout/item_equipment_rv_l.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-xxxhdpi/default_avatar.jpg b/app/src/main/res/mipmap-xxxhdpi/default_avatar.jpg new file mode 100644 index 0000000..5f1e521 --- /dev/null +++ b/app/src/main/res/mipmap-xxxhdpi/default_avatar.jpg Binary files differ diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 7c3ab14..791bf8c 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1,4 +1,5 @@ 智慧计量移动业务平台 中国航天科工二〇三所 + 数据加载中… \ No newline at end of file diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 50d2ad3..3d3f7ed 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -34,8 +34,7 @@ @drawable/ic_right - - + + + + +