riku
2025-10-31 1897c4ad5fa73b3f0a36e1aa0e1e9000302a6ace
2025.10.31
1. 新增巡查场景历史详情相关数据逻辑(待完成);
已修改8个文件
已删除1个文件
已添加7个文件
880 ■■■■ 文件已修改
.idea/libraries/Gradle__com_android_databinding_adapters_4_2_0_aar.xml 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.idea/libraries/Gradle__com_android_databinding_baseLibrary_4_2_0.xml 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.idea/libraries/Gradle__com_android_databinding_library_4_2_0_aar.xml 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.idea/libraries/Gradle__com_android_databinding_viewbinding_4_2_0_aar.xml 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.idea/libraries/Gradle__com_squareup_okhttp3_okhttp_3_8_0.xml 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.idea/libraries/Gradle__com_squareup_okio_okio_1_13_0.xml 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.idea/misc.xml 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/cn/flightfeather/thirdappmodule/databinding/SceneHistoryViewModel.kt 67 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/cn/flightfeather/thirdappmodule/httpservice/DataProdSingleSceneService.kt 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/cn/flightfeather/thirdappmodule/module/base/BaseActivity.kt 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/cn/flightfeather/thirdappmodule/module/inspection/MenuSceneHistoryActivity.kt 114 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/cn/flightfeather/thirdappmodule/module/inspection/MenuSceneHistoryActivity_backup.kt 136 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/cn/flightfeather/thirdappmodule/repository/DataProdSingleSceneRepository.kt 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/cn/flightfeather/thirdappmodule/util/DateUtil.kt 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/res/layout/dialog_scene_history_2.xml 313 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/res/layout/layout_scene_history.xml 151 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.idea/libraries/Gradle__com_android_databinding_adapters_4_2_0_aar.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,13 @@
<component name="libraryTable">
  <library name="Gradle: com.android.databinding:adapters:4.2.0@aar">
    <CLASSES>
      <root url="jar://$USER_HOME$/.gradle/caches/transforms-3/77362f090f3736827f6496ac41c054b9/transformed/adapters-4.2.0/jars/classes.jar!/" />
      <root url="file://$USER_HOME$/.gradle/caches/transforms-3/77362f090f3736827f6496ac41c054b9/transformed/adapters-4.2.0/res" />
      <root url="file://$USER_HOME$/.gradle/caches/transforms-3/77362f090f3736827f6496ac41c054b9/transformed/adapters-4.2.0/AndroidManifest.xml" />
    </CLASSES>
    <JAVADOC />
    <SOURCES>
      <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.android.databinding/adapters/4.2.0/57135f758b69caf36461e12e37a9437899ac9681/adapters-4.2.0-sources.jar!/" />
    </SOURCES>
  </library>
</component>
.idea/libraries/Gradle__com_android_databinding_baseLibrary_4_2_0.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,13 @@
<component name="libraryTable">
  <library name="Gradle: com.android.databinding:baseLibrary:4.2.0">
    <CLASSES>
      <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.android.databinding/baseLibrary/4.2.0/60a87775da182d9d6156d6e0fd7da74a9aced2ed/baseLibrary-4.2.0.jar!/" />
    </CLASSES>
    <JAVADOC>
      <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.android.databinding/baseLibrary/4.2.0/721f959dffa8f516abc493e31a2416821d52e041/baseLibrary-4.2.0-javadoc.jar!/" />
    </JAVADOC>
    <SOURCES>
      <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.android.databinding/baseLibrary/4.2.0/f719fafa4a07e0cf70dc4f868214a4b14c22ca3a/baseLibrary-4.2.0-sources.jar!/" />
    </SOURCES>
  </library>
</component>
.idea/libraries/Gradle__com_android_databinding_library_4_2_0_aar.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,13 @@
<component name="libraryTable">
  <library name="Gradle: com.android.databinding:library:4.2.0@aar">
    <CLASSES>
      <root url="jar://$USER_HOME$/.gradle/caches/transforms-3/515aec787bd894183db38a3d7db71513/transformed/library-4.2.0/jars/classes.jar!/" />
      <root url="file://$USER_HOME$/.gradle/caches/transforms-3/515aec787bd894183db38a3d7db71513/transformed/library-4.2.0/res" />
      <root url="file://$USER_HOME$/.gradle/caches/transforms-3/515aec787bd894183db38a3d7db71513/transformed/library-4.2.0/AndroidManifest.xml" />
    </CLASSES>
    <JAVADOC />
    <SOURCES>
      <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.android.databinding/library/4.2.0/539bf2f876e2165951cfa398bafe2b01c46fdb35/library-4.2.0-sources.jar!/" />
    </SOURCES>
  </library>
</component>
.idea/libraries/Gradle__com_android_databinding_viewbinding_4_2_0_aar.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,13 @@
<component name="libraryTable">
  <library name="Gradle: com.android.databinding:viewbinding:4.2.0@aar">
    <CLASSES>
      <root url="jar://$USER_HOME$/.gradle/caches/transforms-3/ff08e615976def9f0c8d9eb7219771c6/transformed/viewbinding-4.2.0/jars/classes.jar!/" />
      <root url="file://$USER_HOME$/.gradle/caches/transforms-3/ff08e615976def9f0c8d9eb7219771c6/transformed/viewbinding-4.2.0/res" />
      <root url="file://$USER_HOME$/.gradle/caches/transforms-3/ff08e615976def9f0c8d9eb7219771c6/transformed/viewbinding-4.2.0/AndroidManifest.xml" />
    </CLASSES>
    <JAVADOC />
    <SOURCES>
      <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.android.databinding/viewbinding/4.2.0/d152d79d617c68782e49416ebab745215327e5fc/viewbinding-4.2.0-sources.jar!/" />
    </SOURCES>
  </library>
</component>
.idea/libraries/Gradle__com_squareup_okhttp3_okhttp_3_8_0.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,13 @@
<component name="libraryTable">
  <library name="Gradle: com.squareup.okhttp3:okhttp:3.8.0">
    <CLASSES>
      <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.squareup.okhttp3/okhttp/3.8.0/5a11f020cce2d11eb71ba916700600e18c4547e7/okhttp-3.8.0.jar!/" />
    </CLASSES>
    <JAVADOC>
      <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.squareup.okhttp3/okhttp/3.8.0/4b6ef933f65760047e694e1495a9853ca594a695/okhttp-3.8.0-javadoc.jar!/" />
    </JAVADOC>
    <SOURCES>
      <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.squareup.okhttp3/okhttp/3.8.0/db21293949e200f08d5325e8a8eefdcc9134b752/okhttp-3.8.0-sources.jar!/" />
    </SOURCES>
  </library>
</component>
.idea/libraries/Gradle__com_squareup_okio_okio_1_13_0.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,13 @@
<component name="libraryTable">
  <library name="Gradle: com.squareup.okio:okio:1.13.0">
    <CLASSES>
      <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.squareup.okio/okio/1.13.0/a9283170b7305c8d92d25aff02a6ab7e45d06cbe/okio-1.13.0.jar!/" />
    </CLASSES>
    <JAVADOC>
      <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.squareup.okio/okio/1.13.0/d4275e004f2d6e405f3ad866cc64131a17e3b60e/okio-1.13.0-javadoc.jar!/" />
    </JAVADOC>
    <SOURCES>
      <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.squareup.okio/okio/1.13.0/f4c91e12121af963e3ef76e81c82aa75ba6e8533/okio-1.13.0-sources.jar!/" />
    </SOURCES>
  </library>
</component>
.idea/misc.xml
@@ -141,6 +141,7 @@
        <entry key="..\:/AndroidStudioProjects/supervision_online/branches/customer_pollution_scene/app/src/main/res/layout/layout_night_work_empty.xml" value="0.3338541666666667" />
        <entry key="..\:/AndroidStudioProjects/supervision_online/branches/customer_pollution_scene/app/src/main/res/layout/layout_recycler_view_refresh.xml" value="0.3338541666666667" />
        <entry key="..\:/AndroidStudioProjects/supervision_online/branches/customer_pollution_scene/app/src/main/res/layout/layout_scene_history.xml" value="0.3338541666666667" />
        <entry key="..\:/AndroidStudioProjects/supervision_online/branches/customer_pollution_scene/app/src/main/res/layout/layout_scenseinfo.xml" value="0.3338541666666667" />
        <entry key="..\:/AndroidStudioProjects/supervision_online/branches/customer_pollution_scene/app/src/main/res/layout/layout_search.xml" value="0.21145833333333333" />
        <entry key="..\:/AndroidStudioProjects/supervision_online/branches/customer_pollution_scene/app/src/main/res/layout/layout_search_2.xml" value="0.5" />
        <entry key="..\:/AndroidStudioProjects/supervision_online/branches/customer_pollution_scene/app/src/main/res/layout/layout_search_bar.xml" value="0.21145833333333333" />
app/src/main/java/cn/flightfeather/thirdappmodule/databinding/SceneHistoryViewModel.kt
@@ -1,7 +1,9 @@
package cn.flightfeather.thirdappmodule.databinding
import android.arch.lifecycle.MutableLiveData
import android.view.View
import cn.flightfeather.thirdappmodule.bean.vo.DPChangeInfo
import cn.flightfeather.thirdappmodule.bean.vo.DPProblemRecurrence
import cn.flightfeather.thirdappmodule.bean.vo.QueryOptSingle
import cn.flightfeather.thirdappmodule.common.net.ResultCallBack
import cn.flightfeather.thirdappmodule.module.base.BaseViewModel
@@ -9,6 +11,7 @@
import cn.flightfeather.thirdappmodule.util.DateUtil
import org.jetbrains.anko.toast
import java.util.*
import kotlin.math.round
/**
 * åœºæ™¯åŽ†å²æƒ…å†µ
@@ -16,16 +19,40 @@
 * Date: 2025/10/30
 */
class SceneHistoryViewModel : BaseViewModel() {
    companion object {
        const val CHANGE_PER = 0.8
    }
    private val dataProdSingleSceneRepository = DataProdSingleSceneRepository.instance
    // ä¸Šä¸ªæœˆæ•´æ”¹çŽ‡æœ€å·®çš„æƒ…å†µ
    var worstChangeInfo = MutableLiveData<DPChangeInfo>()
    fun getChangeInfoList(sceneId: String) {
    var changeInfoTxt = MutableLiveData<String>()
    var changeEfficiencyTxt = MutableLiveData<String>()
    // é—®é¢˜å¤å‘情况
//    var problemRecurrenceList = MutableLiveData<List<DPProblemRecurrence>>()
    var worstProblemRecurrence = MutableLiveData<DPProblemRecurrence>()
    //
    fun fetchChangeInfoList(sceneId: String) {
        val queryOpts = getQueryOptSingleList(sceneId)
        dataProdSingleSceneRepository.getChangeInfoList(queryOpts, object : ResultCallBack<List<DPChangeInfo>> {
            override fun onSuccess(result: List<DPChangeInfo>?) {
                if (!result.isNullOrEmpty()) {
                    changeInfoTxt.value = result.mapIndexed { i, info ->
                        // ç­›é€‰å­˜åœ¨é—®é¢˜ï¼Œå¹¶ä¸”整改率小于80%的月份
                        if (info.subTasks.isNullOrEmpty() && info.changePer >= CHANGE_PER) {
                            ""
                        } else {
                            val time = DateUtil.parseYearMonth(queryOpts[i].startTime) ?: return@mapIndexed ""
                            val cal = Calendar.getInstance().apply { setTime(time) }
                            "${cal.get(Calendar.MONTH) + 1}月整改率为${round(info.changePer * 100)}%"
                        }
                    }.filter { it.isNotBlank() }.joinToString(",") + ",整改率较低,需加强监管。"
                    worstChangeInfo.value = result[0]
                }
            }
@@ -36,6 +63,44 @@
        })
    }
    fun fetchProblemRecurrence(sceneId:String) {
        // èŽ·å–å‰ä¸‰ä¸ªæœˆçš„å†…çš„è®°å½•
        val queryOpt = QueryOptSingle().apply {
            this.sceneId = sceneId
            val now = Calendar.getInstance().apply {
                set(Calendar.DAY_OF_MONTH, 1)
                set(Calendar.HOUR_OF_DAY, 0)
                set(Calendar.MINUTE, 0)
                set(Calendar.SECOND, 0)
            }
            // å¾—到上月最后一天
            now.add(Calendar.SECOND, -1)
            endTime = DateUtil.getDateStr(now.time)
            // å¾—到前4个月第一天
            now.apply {
                set(Calendar.DAY_OF_MONTH, 1)
                set(Calendar.HOUR_OF_DAY, 0)
                set(Calendar.MINUTE, 0)
                set(Calendar.SECOND, 0)
            }
            now.add(Calendar.MONTH, 2)
            startTime = DateUtil.getDateStr(now.time)
        }
        dataProdSingleSceneRepository.getProblemRecurrence(queryOpt, object : ResultCallBack<List<DPProblemRecurrence>> {
            override fun onSuccess(result: List<DPProblemRecurrence>?) {
                if (!result.isNullOrEmpty()) {
                    worstProblemRecurrence.value = result[0]
                }
            }
            override fun onFailure() {
                application.toast("获取问题复发情况失败")
            }
        })
    }
    private fun getQueryOptSingleList(sceneId: String): List<QueryOptSingle> {
        val queryOpts = mutableListOf<QueryOptSingle>()
app/src/main/java/cn/flightfeather/thirdappmodule/httpservice/DataProdSingleSceneService.kt
@@ -37,5 +37,5 @@
    @POST("dataProd/singleScene/problemRecurrence/get")
    fun getProblemRecurrence(
        @Body queryOptSingle: QueryOptSingle
    ): Observable<Response<BaseResponse<DPProblemRecurrence>>>
    ): Observable<Response<BaseResponse<List<DPProblemRecurrence>>>>
}
app/src/main/java/cn/flightfeather/thirdappmodule/module/base/BaseActivity.kt
@@ -40,7 +40,7 @@
        } catch (e: Exception) {
            e.printStackTrace()
        }
        setContentView(getLayoutId())
        getLayoutId()?.let { setContentView(it) }
        rootView = findViewById<ViewGroup>(android.R.id.content).getChildAt(0) as ViewGroup
    }
@@ -62,7 +62,7 @@
    }
    abstract fun getLayoutId(): Int
    abstract fun getLayoutId(): Int?
    /**
     * æ‹“展activity中自动显示软键盘的方法
app/src/main/java/cn/flightfeather/thirdappmodule/module/inspection/MenuSceneHistoryActivity.kt
@@ -1,16 +1,15 @@
package cn.flightfeather.thirdappmodule.module.inspection
import android.arch.lifecycle.Observer
import android.arch.lifecycle.ViewModelProviders
import android.databinding.DataBindingUtil
import android.os.Bundle
import android.support.v4.content.ContextCompat
import android.view.View
import android.widget.TextView
import cn.flightfeather.thirdappmodule.R
import cn.flightfeather.thirdappmodule.bean.entity.Scense
import cn.flightfeather.thirdappmodule.databinding.DialogSceneHistory2Binding
import cn.flightfeather.thirdappmodule.databinding.SceneHistoryViewModel
import cn.flightfeather.thirdappmodule.module.base.BaseActivity
import kotlinx.android.synthetic.main.dialog_scene_history.*
import kotlinx.android.synthetic.main.fragment_analysis_over_view.*
/**
 * åœºæ™¯åŽ†å²æƒ…å†µæç¤ºç•Œé¢
@@ -22,115 +21,26 @@
    // ä¼ å…¥çš„场景对象
    private var scene: Scense? = null
    override fun getLayoutId(): Int = R.layout.dialog_scene_history
//    override fun getLayoutId(): Int = R.layout.dialog_scene_history_2
    override fun getLayoutId(): Int? = null
    lateinit var viewModel: MenuSceneHistoryViewModel
    lateinit var viewModel: SceneHistoryViewModel
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        viewModel = ViewModelProviders.of(this).get(MenuSceneHistoryViewModel::class.java)
        viewModel = ViewModelProviders.of(this).get(SceneHistoryViewModel::class.java)
        scene = intent.getSerializableExtra("scene") as Scense?
        initUI()
        initObserver()
        initListener()
        // 2025.10.31 åœºæ™¯é£Žé™©æç¤º
        val dialogSceneHistory2Binding = DataBindingUtil.setContentView<DialogSceneHistory2Binding>(this, R.layout.dialog_scene_history_2)
        dialogSceneHistory2Binding.viewModel = viewModel
        dialogSceneHistory2Binding.fabClose.setOnClickListener { this.finish() }
//        viewModel.getSceneStatus {
//            scene?.let { viewModel.getSceneDetail(it) }
//        }
    }
    private fun initUI() {
        // ç»Ÿè®¡é¡¹ç›®
        val itemList = listOf(
            HistoryItemView("现场评分", true, cl_1, tv_title_1),
            HistoryItemView("典型工地", true, cl_2, tv_title_2),
            HistoryItemView("重点区域", true, cl_3, tv_title_3),
            HistoryItemView("联合执法", true, cl_4, tv_title_4),
            HistoryItemView("整改效率", true, cl_5, tv_title_5),
            HistoryItemView("问题复发", true, cl_6, tv_title_6),
            HistoryItemView("施工阶段", true, cl_7, tv_title_7),
            HistoryItemView("监测数据", true, cl_8, tv_title_8),
            HistoryItemView("应急巡查", false, cl_9, tv_title_9)
        )
        // æ˜¾ç¤º åŠ è½½å›¾æ ‡
        view_waiting.visibility = View.GONE
        // æ ¹æ®é…ç½®æ˜¾ç¤ºå¯¹åº”的项目,并自动匹配序号
        var index = 1
        itemList.forEach { item ->
            if (item.show) {
                val title = "${index}. ${item.title}"
                item.parentView.visibility = View.VISIBLE
                item.titleView.text = title
                index++
            } else {
                item.parentView.visibility = View.GONE
            }
        }
        // æ˜¾ç¤º åœºæ™¯åç§°
        scene?.let {
            tv_title.text = it.name
        }
    }
    private fun initObserver() {
        // åŽ†å²è¯„ä¼°æƒ…å†µ
        viewModel.evaluationList.observe(this, Observer {
        })
        // å…¸åž‹åœºæ™¯æƒ…况
        viewModel.typicalScene.observe(this, Observer {
        })
        tv_title_2.setTextColor(ContextCompat.getColor(this, R.color.red_btn_bg_color))
        // é‡ç‚¹åŒºåŸŸï¼ˆåœ¨å›½æŽ§ç‚¹ã€å¸‚控点周边)
        viewModel.keyArea.observe(this, Observer {
        })
        tv_title_3.setTextColor(ContextCompat.getColor(this, R.color.red_btn_bg_color))
        // è”合执法
        viewModel.jointLawEnforcement.observe(this, Observer {
        })
        tv_title_4.setTextColor(ContextCompat.getColor(this, R.color.main_color_3))
        tv_summary_4.setTextColor(ContextCompat.getColor(this, R.color.main_color_3))
        // æ•´æ”¹æ•ˆçއ
        viewModel.changeRate.observe(this, Observer {
        })
        tv_title_5.setTextColor(ContextCompat.getColor(this, R.color.red_btn_bg_color))
        // é—®é¢˜å¤å‘
        viewModel.problemRecurrence.observe(this, Observer {
        })
        tv_title_6.setTextColor(ContextCompat.getColor(this, R.color.red_btn_bg_color))
        // æ–½å·¥é˜¶æ®µ
        viewModel.constructionPhase.observe(this, Observer {
        })
        tv_title_7.setTextColor(ContextCompat.getColor(this, R.color.main_color_2))
        // åœ¨çº¿ç›‘测数据
        viewModel.monitorData.observe(this, Observer {
        })
        tv_title_8.setTextColor(ContextCompat.getColor(this, R.color.main_color_3))
        tv_summary_8.setTextColor(ContextCompat.getColor(this, R.color.main_color_3))
        // åº”急巡查
        viewModel.emergencyInspection.observe(this, Observer {
        })
        tv_title_9.setTextColor(ContextCompat.getColor(this, R.color.main_color_3))
    }
    private fun initListener() {
        fab_close.setOnClickListener {
            this.finish()
        }
    }
}
app/src/main/java/cn/flightfeather/thirdappmodule/module/inspection/MenuSceneHistoryActivity_backup.kt
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,136 @@
package cn.flightfeather.thirdappmodule.module.inspection
import android.arch.lifecycle.Observer
import android.arch.lifecycle.ViewModelProviders
import android.os.Bundle
import android.support.v4.content.ContextCompat
import android.view.View
import android.widget.TextView
import cn.flightfeather.thirdappmodule.R
import cn.flightfeather.thirdappmodule.bean.entity.Scense
import cn.flightfeather.thirdappmodule.module.base.BaseActivity
import kotlinx.android.synthetic.main.dialog_scene_history.*
import kotlinx.android.synthetic.main.fragment_analysis_over_view.*
/**
 * åœºæ™¯åŽ†å²æƒ…å†µæç¤ºç•Œé¢
 * Date: 2025/10/27
 */
class MenuSceneHistoryActivity_backup : BaseActivity() {
    inner class HistoryItemView(val title: String, val show: Boolean, val parentView: View, val titleView: TextView)
    // ä¼ å…¥çš„场景对象
    private var scene: Scense? = null
    override fun getLayoutId(): Int = R.layout.dialog_scene_history
    lateinit var viewModel: MenuSceneHistoryViewModel
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        viewModel = ViewModelProviders.of(this).get(MenuSceneHistoryViewModel::class.java)
        scene = intent.getSerializableExtra("scene") as Scense?
        initUI()
        initObserver()
        initListener()
//        viewModel.getSceneStatus {
//            scene?.let { viewModel.getSceneDetail(it) }
//        }
    }
    private fun initUI() {
        // ç»Ÿè®¡é¡¹ç›®
        val itemList = listOf(
            HistoryItemView("现场评分", true, cl_1, tv_title_1),
            HistoryItemView("典型工地", true, cl_2, tv_title_2),
            HistoryItemView("重点区域", true, cl_3, tv_title_3),
            HistoryItemView("联合执法", true, cl_4, tv_title_4),
            HistoryItemView("整改效率", true, cl_5, tv_title_5),
            HistoryItemView("问题复发", true, cl_6, tv_title_6),
            HistoryItemView("施工阶段", true, cl_7, tv_title_7),
            HistoryItemView("监测数据", true, cl_8, tv_title_8),
            HistoryItemView("应急巡查", false, cl_9, tv_title_9)
        )
        // æ˜¾ç¤º åŠ è½½å›¾æ ‡
        view_waiting.visibility = View.GONE
        // æ ¹æ®é…ç½®æ˜¾ç¤ºå¯¹åº”的项目,并自动匹配序号
        var index = 1
        itemList.forEach { item ->
            if (item.show) {
                val title = "${index}. ${item.title}"
                item.parentView.visibility = View.VISIBLE
                item.titleView.text = title
                index++
            } else {
                item.parentView.visibility = View.GONE
            }
        }
        // æ˜¾ç¤º åœºæ™¯åç§°
        scene?.let {
            tv_title.text = it.name
        }
    }
    private fun initObserver() {
        // åŽ†å²è¯„ä¼°æƒ…å†µ
        viewModel.evaluationList.observe(this, Observer {
        })
        // å…¸åž‹åœºæ™¯æƒ…况
        viewModel.typicalScene.observe(this, Observer {
        })
        tv_title_2.setTextColor(ContextCompat.getColor(this, R.color.red_btn_bg_color))
        // é‡ç‚¹åŒºåŸŸï¼ˆåœ¨å›½æŽ§ç‚¹ã€å¸‚控点周边)
        viewModel.keyArea.observe(this, Observer {
        })
        tv_title_3.setTextColor(ContextCompat.getColor(this, R.color.red_btn_bg_color))
        // è”合执法
        viewModel.jointLawEnforcement.observe(this, Observer {
        })
        tv_title_4.setTextColor(ContextCompat.getColor(this, R.color.main_color_3))
        tv_summary_4.setTextColor(ContextCompat.getColor(this, R.color.main_color_3))
        // æ•´æ”¹æ•ˆçއ
        viewModel.changeRate.observe(this, Observer {
        })
        tv_title_5.setTextColor(ContextCompat.getColor(this, R.color.red_btn_bg_color))
        // é—®é¢˜å¤å‘
        viewModel.problemRecurrence.observe(this, Observer {
        })
        tv_title_6.setTextColor(ContextCompat.getColor(this, R.color.red_btn_bg_color))
        // æ–½å·¥é˜¶æ®µ
        viewModel.constructionPhase.observe(this, Observer {
        })
        tv_title_7.setTextColor(ContextCompat.getColor(this, R.color.main_color_2))
        // åœ¨çº¿ç›‘测数据
        viewModel.monitorData.observe(this, Observer {
        })
        tv_title_8.setTextColor(ContextCompat.getColor(this, R.color.main_color_3))
        tv_summary_8.setTextColor(ContextCompat.getColor(this, R.color.main_color_3))
        // åº”急巡查
        viewModel.emergencyInspection.observe(this, Observer {
        })
        tv_title_9.setTextColor(ContextCompat.getColor(this, R.color.main_color_3))
    }
    private fun initListener() {
        fab_close.setOnClickListener {
            this.finish()
        }
    }
}
app/src/main/java/cn/flightfeather/thirdappmodule/repository/DataProdSingleSceneRepository.kt
@@ -60,12 +60,12 @@
    /**
     * é—®é¢˜é‡å¤æƒ…况
     */
    fun getProblemRecurrence(queryOptSingle: QueryOptSingle, resultCallBack: ResultCallBack<DPProblemRecurrence>) {
    fun getProblemRecurrence(queryOptSingle: QueryOptSingle, resultCallBack: ResultCallBack<List<DPProblemRecurrence>>) {
        val service = retrofit.create(DataProdSingleSceneService::class.java).getProblemRecurrence(queryOptSingle)
        RetrofitFactory.executeResult(service, object : ResultObserver<BaseResponse<DPProblemRecurrence>>() {
            override fun onSuccess(result: BaseResponse<DPProblemRecurrence>?) {
        RetrofitFactory.executeResult(service, object : ResultObserver<BaseResponse<List<DPProblemRecurrence>>>() {
            override fun onSuccess(result: BaseResponse<List<DPProblemRecurrence>>?) {
                resultCallBack.onSuccess(result?.data)
            }
app/src/main/java/cn/flightfeather/thirdappmodule/util/DateUtil.kt
@@ -151,13 +151,13 @@
        return weekDays[index]
    }
    fun parseYearMonth(str: String): Date {
        try {
            return SimpleDateFormat("yyyy-MM", Locale.getDefault()).parse(str)
    fun parseYearMonth(str: String?): Date? {
        return try {
            SimpleDateFormat("yyyy-MM", Locale.getDefault()).parse(str)
        } catch (e: Exception) {
            e.printStackTrace()
            null
        }
        return Date()
    }
    fun parseYearToMin(str: String): Date {
app/src/main/res/layout/dialog_scene_history_2.xml
@@ -1,167 +1,186 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
<layout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">
    xmlns:tools="http://schemas.android.com/tools">
    <android.support.v7.widget.CardView
        android:id="@+id/cv_dialog_main"
    <data >
        <import type="android.view.View" alias="View"/>
        <variable
            name="viewModel"
            type="cn.flightfeather.thirdappmodule.databinding.SceneHistoryViewModel" />
    </data>
    <android.support.design.widget.CoordinatorLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginLeft="12dp"
        android:layout_marginTop="30dp"
        android:layout_marginRight="12dp"
        android:layout_marginBottom="40dp"
        app:cardCornerRadius="6dp"
        app:cardElevation="7dp">
        android:orientation="vertical">
        <ScrollView
        <android.support.v7.widget.CardView
            android:id="@+id/cv_dialog_main"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_marginBottom="30dp">
            <LinearLayout
            android:layout_marginLeft="12dp"
            android:layout_marginTop="30dp"
            android:layout_marginRight="12dp"
            android:layout_marginBottom="40dp"
            app:cardCornerRadius="6dp"
            app:cardElevation="7dp">
            <ScrollView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical">
                android:layout_height="match_parent"
                android:layout_marginBottom="30dp">
            <android.support.constraint.ConstraintLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:padding="@dimen/dimen16">
                <ImageView
                    android:id="@+id/img_risk_warn"
                    android:layout_width="20dp"
                    android:layout_height="20dp"
                    android:src="@drawable/icon_task_alert"
                    android:layout_marginBottom="@dimen/dimen4"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toTopOf="@id/tv_risk_warn"
                    app:layout_constraintBottom_toBottomOf="@id/tv_risk_warn"
                    android:contentDescription="风险提示" />
                <TextView
                    android:id="@+id/tv_risk_warn"
                    android:layout_width="0dp"
                    android:layout_height="30dp"
                    android:textColor="@color/red_btn_bg_color"
                    android:textSize="@dimen/textSize_18"
                    android:textStyle="bold"
                    app:layout_constraintStart_toEndOf="@id/img_risk_warn"
                    app:layout_constraintTop_toTopOf="parent"
                    android:text="风险提示" />
                <TextView
                    android:id="@+id/tv_change_rate"
                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:textColor="@color/main_color_1"
                    android:textSize="@dimen/textSize_16"
                    android:paddingStart="20dp"
                    android:paddingEnd="0dp"
                    tools:text="整改率情况,如果整改率较低,则作为风险提示展示"
                    app:layout_constraintTop_toBottomOf="@id/tv_risk_warn"/>
                <TextView
                    android:id="@+id/tv_change_efficiency"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:textColor="@color/main_color_1"
                    android:textSize="@dimen/textSize_16"
                    android:paddingStart="20dp"
                    android:paddingEnd="0dp"
                    tools:text="整改效率情况,整改效率为要求整改的期限(天数)除以实际整改的用时(天数),如果效率低于60%,则作为风险提示展示"
                    app:layout_constraintTop_toBottomOf="@id/tv_change_rate"/>
                <TextView
                    android:id="@+id/tv_problem_recurrence"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:textColor="@color/main_color_1"
                    android:textSize="@dimen/textSize_16"
                    android:paddingStart="20dp"
                    android:paddingEnd="0dp"
                    tools:text="问题复发情况,若前三个月内有相同类型的问题出现两次及以上时,提醒展示,并给出对应的整改率"
                    app:layout_constraintTop_toBottomOf="@id/tv_change_efficiency"/>
                    android:orientation="vertical">
            </android.support.constraint.ConstraintLayout>
            <android.support.constraint.ConstraintLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:padding="@dimen/dimen16">
                <ImageView
                    android:id="@+id/img_inspection_key_point"
                    android:layout_width="20dp"
                    android:layout_height="20dp"
                    android:src="@drawable/icon_consult"
                    android:layout_marginBottom="@dimen/dimen4"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toTopOf="@id/tv_risk_warn"
                    app:layout_constraintBottom_toBottomOf="@id/tv_inspection_key_point"
                    android:contentDescription="巡查要点" />
                <TextView
                    android:id="@+id/tv_inspection_key_point"
                    android:layout_width="0dp"
                    android:layout_height="30dp"
                    android:textColor="@color/primary_text"
                    android:textSize="@dimen/textSize_18"
                    app:layout_constraintStart_toEndOf="@id/img_inspection_key_point"
                    app:layout_constraintTop_toTopOf="parent"
                    android:text="巡查要点" />
                    <android.support.constraint.ConstraintLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:visibility="@{viewModel.worstChangeInfo == null ? View.GONE : View.VISIBLE}"
                        android:padding="@dimen/dimen16">
                <TextView
                    android:id="@+id/tv_change_rate"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:textColor="@color/main_color_1"
                    android:textSize="@dimen/textSize_16"
                    android:paddingStart="20dp"
                    android:paddingEnd="0dp"
                    tools:text="巡查要点,注意需要检查的位置、设备和问题等"
                    app:layout_constraintTop_toBottomOf="@id/img_inspection_key_point"/>
                        <ImageView
                            android:id="@+id/img_risk_warn"
                            android:layout_width="20dp"
                            android:layout_height="20dp"
                            android:layout_marginBottom="@dimen/dimen4"
                            android:contentDescription="风险提示"
                            android:src="@drawable/icon_task_alert"
                            app:layout_constraintBottom_toBottomOf="@id/tv_risk_warn"
                            app:layout_constraintStart_toStartOf="parent"
                            app:layout_constraintTop_toTopOf="@id/tv_risk_warn" />
            </android.support.constraint.ConstraintLayout>
            <android.support.constraint.ConstraintLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:padding="@dimen/dimen16">
                <ImageView
                    android:id="@+id/img_risk_warn"
                    android:layout_width="20dp"
                    android:layout_height="20dp"
                    android:src="@drawable/ic_emergency"
                    android:layout_marginBottom="@dimen/dimen4"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toTopOf="@id/tv_risk_warn"
                    app:layout_constraintBottom_toBottomOf="@id/tv_risk_warn"
                    android:contentDescription="应急巡查" />
                        <TextView
                            android:id="@+id/tv_risk_warn"
                            android:layout_width="0dp"
                            android:layout_height="30dp"
                            android:text="风险提示"
                            android:textColor="@color/red_btn_bg_color"
                            android:textSize="@dimen/textSize_18"
                            android:textStyle="bold"
                            app:layout_constraintStart_toEndOf="@id/img_risk_warn"
                            app:layout_constraintTop_toTopOf="parent" />
                <TextView
                    android:id="@+id/tv_risk_warn"
                    android:layout_width="0dp"
                    android:layout_height="30dp"
                    android:textColor="@color/primary_text"
                    android:textSize="@dimen/textSize_18"
                    app:layout_constraintStart_toEndOf="@id/img_risk_warn"
                    app:layout_constraintTop_toTopOf="parent"
                    android:text="应急巡查" />
                        <TextView
                            android:id="@+id/tv_change_rate"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:paddingStart="20dp"
                            android:paddingEnd="0dp"
                            android:textColor="@color/main_color_1"
                            android:textSize="@dimen/textSize_16"
                            app:layout_constraintTop_toBottomOf="@id/tv_risk_warn"
                            android:text="@{viewModel.changeInfoTxt}"
                            tools:text="整改率情况,如果整改率较低,则作为风险提示展示" />
            </android.support.constraint.ConstraintLayout>
            </LinearLayout>
        </ScrollView>
    </android.support.v7.widget.CardView>
                        <TextView
                            android:id="@+id/tv_change_efficiency"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:paddingStart="20dp"
                            android:paddingEnd="0dp"
                            android:textColor="@color/main_color_1"
                            android:textSize="@dimen/textSize_16"
                            app:layout_constraintTop_toBottomOf="@id/tv_change_rate"
                            tools:text="整改效率情况,整改效率为要求整改的期限(天数)除以实际整改的用时(天数),如果效率低于60%,则作为风险提示展示" />
    <android.support.design.widget.FloatingActionButton
        android:id="@+id/fab_close"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:contentDescription="@string/cancel"
        android:src="@drawable/icon_close_white"
        app:elevation="8dp"
        app:fabSize="normal"
        app:layout_anchor="@id/cv_dialog_main"
        app:layout_anchorGravity="bottom|center" />
                        <TextView
                            android:id="@+id/tv_problem_recurrence"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:paddingStart="20dp"
                            android:paddingEnd="0dp"
                            android:textColor="@color/main_color_1"
                            android:textSize="@dimen/textSize_16"
                            app:layout_constraintTop_toBottomOf="@id/tv_change_efficiency"
                            tools:text="问题复发情况,若前三个月内有相同类型的问题出现两次及以上时,提醒展示,并给出对应的整改率" />
</android.support.design.widget.CoordinatorLayout>
                    </android.support.constraint.ConstraintLayout>
                    <android.support.constraint.ConstraintLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:padding="@dimen/dimen16">
                        <ImageView
                            android:id="@+id/img_inspection_key_point"
                            android:layout_width="20dp"
                            android:layout_height="20dp"
                            android:layout_marginBottom="@dimen/dimen4"
                            android:contentDescription="巡查要点"
                            android:src="@drawable/icon_consult"
                            app:layout_constraintBottom_toBottomOf="@id/tv_inspection_key_point"
                            app:layout_constraintStart_toStartOf="parent"
                            app:layout_constraintTop_toTopOf="@id/tv_risk_warn" />
                        <TextView
                            android:id="@+id/tv_inspection_key_point"
                            android:layout_width="0dp"
                            android:layout_height="30dp"
                            android:text="巡查要点"
                            android:textColor="@color/primary_text"
                            android:textSize="@dimen/textSize_18"
                            app:layout_constraintStart_toEndOf="@id/img_inspection_key_point"
                            app:layout_constraintTop_toTopOf="parent" />
                        <TextView
                            android:id="@+id/tv_key_point"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:paddingStart="20dp"
                            android:paddingEnd="0dp"
                            android:textColor="@color/main_color_1"
                            android:textSize="@dimen/textSize_16"
                            app:layout_constraintTop_toBottomOf="@id/img_inspection_key_point"
                            tools:text="巡查要点,注意需要检查的位置、设备和问题等" />
                    </android.support.constraint.ConstraintLayout>
                    <android.support.constraint.ConstraintLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:padding="@dimen/dimen16">
                        <ImageView
                            android:id="@+id/img_temp_inspection"
                            android:layout_width="20dp"
                            android:layout_height="20dp"
                            android:layout_marginBottom="@dimen/dimen4"
                            android:contentDescription="应急巡查"
                            android:src="@drawable/ic_emergency"
                            app:layout_constraintBottom_toBottomOf="@id/tv_risk_warn"
                            app:layout_constraintStart_toStartOf="parent"
                            app:layout_constraintTop_toTopOf="@id/tv_risk_warn" />
                        <TextView
                            android:id="@+id/tv_temp_inspection"
                            android:layout_width="0dp"
                            android:layout_height="30dp"
                            android:text="应急巡查"
                            android:textColor="@color/primary_text"
                            android:textSize="@dimen/textSize_18"
                            app:layout_constraintStart_toEndOf="@id/img_temp_inspection"
                            app:layout_constraintTop_toTopOf="parent" />
                    </android.support.constraint.ConstraintLayout>
                </LinearLayout>
            </ScrollView>
        </android.support.v7.widget.CardView>
        <android.support.design.widget.FloatingActionButton
            android:id="@+id/fab_close"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:contentDescription="@string/cancel"
            android:src="@drawable/icon_close_white"
            app:elevation="8dp"
            app:fabSize="normal"
            app:layout_anchor="@id/cv_dialog_main"
            app:layout_anchorGravity="bottom|center" />
    </android.support.design.widget.CoordinatorLayout>
</layout>
app/src/main/res/layout/layout_scene_history.xml
ÎļþÒÑɾ³ý