From 196bb14112448857a885e32dc4149e308e00b01a Mon Sep 17 00:00:00 2001
From: feiyu02 <risaku@163.com>
Date: 星期四, 15 八月 2024 11:57:15 +0800
Subject: [PATCH] 2024.8.15 各项修正

---
 src/main/kotlin/cn/flightfeather/supervision/common/score/AutoScore.kt |   84 ++++++++++-------------------------------
 1 files changed, 21 insertions(+), 63 deletions(-)

diff --git a/src/main/kotlin/cn/flightfeather/supervision/common/score/AutoScore.kt b/src/main/kotlin/cn/flightfeather/supervision/common/score/AutoScore.kt
index d100e3a..62138e6 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/common/score/AutoScore.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/common/score/AutoScore.kt
@@ -38,6 +38,8 @@
 
 //        private val SCENE_TYPE = SceneType.Restaurant
         private val SCENE_TYPE = SceneType.VehicleRepair
+
+        private val district = "寰愭眹鍖�"
     }
 
     @PostConstruct
@@ -94,19 +96,19 @@
     }
 
     fun go(_year: Int? = null, _month: Int? = null) {
-        val fileName = "姹戒慨鑷姩璇勫垎-${DateUtil().DateToString(Date(), "yyyy-MM-ddhhmmss")}.xls"
-        val filePath = "E:\\宸ヤ綔\\寮�鍙慭\椋炵窘鐜app\\鑷姩璇勫垎\\姹戒慨\\$fileName"
+        val fileName = "${district}${SCENE_TYPE.des}鑷姩璇勫垎-${DateUtil.DateToString(Date(), "yyyy-MM-ddhhmmss")}.xls"
+//        val filePath = "E:\\宸ヤ綔\\寮�鍙慭\椋炵窘鐜app\\鑷姩璇勫垎\\${SCENE_TYPE.des}\\$fileName"
+        val filePath = "C:\\work\\宸ヤ綔\\绗笁鏂圭洃绠\鑷姩璇勫垎\\${SCENE_TYPE.des}\\$fileName"
         val out = FileOutputStream(File(filePath))
 
         getScoreItem()
 
         val userList = userinfoMapper.selectByExample(Example(Userinfo::class.java).apply {
             createCriteria().andEqualTo("usertypeid", UserType.Enterprise.value.toByte())
-                // FIXME: 2021/4/28 鍦烘櫙绫诲瀷 
-//                    姹戒慨绫诲瀷
+                .andEqualTo("extension1", district)
                 .andEqualTo("extension2", SCENE_TYPE.value.toString())
-//            椁愰ギ绫诲瀷
-//                .andEqualTo("extension2", SCENE_TYPE.value.toString())
+                .andEqualTo("isenable", true)
+            and(createCriteria().orNotEqualTo("workno", "test").orIsNull("workno"))
 //            orderBy("workno")
         })
 
@@ -149,7 +151,7 @@
         val now = LocalDate.now()
         val year = _year ?: now.year
         val month = _month ?: now.monthValue
-        val sMonth = DateUtil().getStartMonthByPeriod(month, 3) ?: 1
+        val sMonth = DateUtil.getStartMonthByPeriod(month, 3) ?: 1
         val eMonth = sMonth + 2
         val period = "${year}/$sMonth-$eMonth"
 
@@ -161,12 +163,13 @@
             }
 
             val info = Info(
-                it.guid,
-                it.acountname,
-                it.realname,
+                it?.guid,
+                it?.acountname,
+                it?.realname,
                 SCENE_TYPE,
                 year,
-                month
+                month,
+                now
             )
 
             var score = 0
@@ -280,21 +283,17 @@
                 }
             } ?: 0
             // 鍐欏叆鏁版嵁搴�
-//            if (r > 0) {
-//                evaluationList.forEach { el -> evaluationMapper.insert(el) }
-//                itemevaluationList.forEach { il -> itemevaluationMapper.insert(il) }
-                for (e in evaluationList) {
-                    if (e.ertype?.toInt()?.equals(0) == true) {
-                        finalScore(e, year, eMonth, period)
-                        break
-                    }
-                }
+//            for (e in evaluationList) {
+//                if (e.ertype?.toInt()?.equals(0) == true) {
+//                    finalScore(e, year, eMonth, period)
+//                    break
+//                }
 //            }
         }
 
         // 鍐欏叆鏂囨。
-//        ExcelUtil.write2(emptyList(), contents, workbook)
-//        workbook.write(out)
+        ExcelUtil.write2(emptyList(), contents, workbook)
+        workbook.write(out)
         workbook.close()
         out.flush()
         out.close()
@@ -379,47 +378,6 @@
         name = itemRule.itemname
         value = itemRule.extension1 ?: "0"
         extension1 = (itemRule.extension1 != null).toString()
-    }
-
-    private fun write2File(info: Info, evaluations: List<Evaluation>, topItems: MutableList<Evaluationsubrule>,
-                           rules: MutableList<Pair<Evaluationsubrule, MutableList<Evaluationsubrule>>>) {
-
-        val heads = mutableListOf<Array<String>>()
-        val contents = mutableListOf<Array<Any>>()
-        topItems.forEach {
-            val cList = mutableListOf<Any>()
-            cList.add(it.itemname ?: "")
-            val array1 = mutableListOf<ExcelUtil.MyCell>()
-            val array2 = mutableListOf<ExcelUtil.MyCell>()
-            val array3 = mutableListOf<ExcelUtil.MyCell>()
-            for (r in rules) {
-                if (r.first.fatherid == it.guid || r.first.guid == it.guid) {
-                    array1.add(ExcelUtil.MyCell(r.first.itemname?:"", 0))
-
-                    r.second.forEach { s ->
-                        if (s.fatherid == r.first.guid) {
-                            array2.add(ExcelUtil.MyCell(s.itemname?:"", 1))
-                            array3.add(ExcelUtil.MyCell(s.extension1?:"", 1))
-                            array1.last().rowSpan++
-                        }
-                    }
-                }
-            }
-            cList.add(array1.toTypedArray())
-            cList.add(array2.toTypedArray())
-            cList.add(array3.toTypedArray())
-            contents.add(cList.toTypedArray())
-        }
-        evaluations.forEach {
-            if ((it.ertype?.toInt() == 0)) {
-                val totalScoreList = mutableListOf<Any>()
-                totalScoreList.add("鎬诲垎")
-                totalScoreList.add(it.resultscorebef ?: "0")
-                contents.add(totalScoreList.toTypedArray())
-            }
-        }
-
-        ExcelUtil.write2(heads, contents, workbook!!, info.userName ?: "鏈煡鐢ㄦ埛")
     }
 
     private fun addToFile(contents: MutableList<Array<Any>>, info: Info, evaluations: List<Evaluation>, topItems: MutableList<Evaluationsubrule>,

--
Gitblit v1.9.3