From 909fd8929d7906f1dca68acc05e36e29b0b9192c Mon Sep 17 00:00:00 2001 From: feiyu02 <risaku@163.com> Date: 星期二, 15 十一月 2022 10:57:30 +0800 Subject: [PATCH] 2022.11.15 --- src/main/resources/mapper/ds1/MonitorobjectversionMapper.xml | 5 src/main/kotlin/cn/flightfeather/supervision/lightshare/service/SearchService.kt | 2 src/main/kotlin/cn/flightfeather/supervision/business/fume/item/ScoreItem_5.kt | 23 src/main/kotlin/cn/flightfeather/supervision/business/report/file/ReportThree.kt | 3 src/main/kotlin/cn/flightfeather/supervision/business/storage/item/MpScoreItem_1.kt | 57 ++ src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/BaseTableVo.kt | 10 src/main/kotlin/cn/flightfeather/supervision/business/report/BaseExcel.kt | 1 src/main/kotlin/cn/flightfeather/supervision/business/report/BaseOutputInterface.kt | 19 src/main/kotlin/cn/flightfeather/supervision/business/report/template/ProTypeStatusSummary.kt | 3 src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColProChange.kt | 3 src/main/kotlin/cn/flightfeather/supervision/business/report/template/DailyReportSummary.kt | 22 src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColLedger.kt | 3 src/main/kotlin/cn/flightfeather/supervision/business/storage/item/WhScoreItem_1.kt | 57 ++ src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/UserinfoServiceImpl.kt | 9 src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColStatus.kt | 2 src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColInspectionInfo.kt | 10 src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColItemGrade.kt | 3 src/main/kotlin/cn/flightfeather/supervision/business/storage/StAutoScore.kt | 31 + src/main/kotlin/cn/flightfeather/supervision/business/report/BaseCols.kt | 35 + src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/ExcelConfigVo.kt | 4 src/main/kotlin/cn/flightfeather/supervision/business/report/template/ProTypeRankMainSummary.kt | 1 src/main/kotlin/cn/flightfeather/supervision/business/storage/item/CsScoreItem_2.kt | 7 src/test/kotlin/cn/flightfeather/supervision/lightshare/service/impl/EvaluationServiceImplTest.kt | 25 + src/test/kotlin/cn/flightfeather/supervision/business/fume/AutoScoreTest.kt | 11 src/main/kotlin/cn/flightfeather/supervision/business/storage/item/StScoreItem_1.kt | 3 src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColSceneName.kt | 18 src/main/kotlin/cn/flightfeather/supervision/lightshare/web/SearchController.kt | 6 src/main/kotlin/cn/flightfeather/supervision/business/report/BaseExcelMulti.kt | 44 + src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColSceneBaseInfo.kt | 31 + src/test/kotlin/cn/flightfeather/supervision/lightshare/service/impl/SearchServiceImplTest.kt | 46 + src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColTown.kt | 2 src/main/kotlin/cn/flightfeather/supervision/business/storage/item/MpScoreItem_2.kt | 9 src/main/kotlin/cn/flightfeather/supervision/business/report/template/ProAnalysisSummary.kt | 10 src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColStrategy.kt | 2 src/main/kotlin/cn/flightfeather/supervision/business/storage/item/WhScoreItem_2.kt | 9 src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/SubtaskServiceImpl.kt | 20 src/main/kotlin/cn/flightfeather/supervision/business/fume/AutoScore3.kt | 6 src/main/kotlin/cn/flightfeather/supervision/domain/ds1/mapper/MonitorobjectversionMapper.kt | 2 src/main/kotlin/cn/flightfeather/supervision/datafetch/FetchNightConstruction.kt | 69 +- src/main/kotlin/cn/flightfeather/supervision/business/report/DataSource.kt | 38 + src/main/kotlin/cn/flightfeather/supervision/business/storage/item/CsScoreItem_1.kt | 57 ++ src/main/kotlin/cn/flightfeather/supervision/business/report/ReportUtil.kt | 1 src/main/kotlin/cn/flightfeather/supervision/business/report/BaseTemplate.kt | 25 src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColProblemDistribution.kt | 2 src/main/resources/application.yml | 12 src/main/kotlin/cn/flightfeather/supervision/business/report/BaseTemplateMulti.kt | 135 +++++ src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColTotalGrade.kt | 2 src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/SearchServiceImpl.kt | 563 ++------------------- 48 files changed, 823 insertions(+), 635 deletions(-) diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/fume/AutoScore3.kt b/src/main/kotlin/cn/flightfeather/supervision/business/fume/AutoScore3.kt index f638652..ec108f7 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/business/fume/AutoScore3.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/business/fume/AutoScore3.kt @@ -104,8 +104,8 @@ fun go(_year: Int? = null, _month: Int? = null, _period: Int = 1) { /** 1.excel鏂囦欢鍑嗗*************************************************************************/ val fileName = "${SCENE_TYPE.text}鑷姩璇勫垎-${DateUtil().DateToString(Date(), "yyyy-MM-ddhhmmss")}.xls" - val filePath = "E:\\宸ヤ綔\\寮�鍙慭\绗笁鏂圭洃绠pp\\鑷姩璇勫垎\\椁愰ギ\\$fileName" -// val filePath = "C:\\work\\宸ヤ綔\\绗笁鏂圭洃绠\鑷姩璇勫垎\\椁愰ギ\\$fileName" +// val filePath = "E:\\宸ヤ綔\\寮�鍙慭\绗笁鏂圭洃绠pp\\鑷姩璇勫垎\\椁愰ギ\\$fileName" + val filePath = "C:\\work\\宸ヤ綔\\绗笁鏂圭洃绠\鑷姩璇勫垎\\椁愰ギ\\$fileName" val out = FileOutputStream(File(filePath)) getScoreItem() @@ -387,7 +387,7 @@ createCriteria() .andEqualTo("tasktypeid", 99) .andEqualTo("scensetypeid", SCENE_TYPE.value.toByte()) - .andEqualTo("districtcode", "310104") +// .andEqualTo("districtcode", "310104") }) if (rule.isNotEmpty()) { baseRules.addAll(rule) diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/fume/item/ScoreItem_5.kt b/src/main/kotlin/cn/flightfeather/supervision/business/fume/item/ScoreItem_5.kt index 2559588..29140ee 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/business/fume/item/ScoreItem_5.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/business/fume/item/ScoreItem_5.kt @@ -1,8 +1,14 @@ package cn.flightfeather.supervision.business.fume.item import cn.flightfeather.supervision.business.ScoreItem +import cn.flightfeather.supervision.domain.ds1.entity.DustDataResult import cn.flightfeather.supervision.domain.ds1.entity.Evaluationsubrule2 +import cn.flightfeather.supervision.domain.ds1.mapper.DustDataResultMapper +import org.springframework.beans.factory.annotation.Autowired import org.springframework.stereotype.Component +import tk.mybatis.mapper.entity.Example +import java.time.LocalDateTime +import java.time.ZoneId import javax.annotation.PostConstruct @Component @@ -19,6 +25,9 @@ override var id: String = "PSQUi9f0f7JK6w9d" override var name: String="娌圭儫鍦ㄧ嚎鐩戞祴鏁版嵁閲忕骇" + + @Autowired + lateinit var dustDataResultMapper: DustDataResultMapper /** * 寰愭眹鍖洪楗洃绠″钩鍙拌仈缃戣褰曘�佸湪绾跨巼鍒嗘瀽鏁版嵁鍜岄珮宄扮粡钀ユ椂娈靛皬鏃惰秴鏍囨儏鍐� @@ -60,7 +69,19 @@ * @return true 褰撴湀楂樺嘲缁忚惀鏃舵鍑虹幇涓夋鍙婁互涓�10鍒嗛挓鍧囧�艰秴鏍囨垨鏄剧ず鍑�鍖栬缃緝鑴� */ private fun condition2(): Boolean { - return false + val r = dustDataResultMapper.selectByExample(Example(DustDataResult::class.java).apply { + createCriteria().andGreaterThanOrEqualTo("drTime", info.sTime) + .andLessThan("drTime", info.eTime) + .andEqualTo("drSceneId", info.sceneId) + }) + + var result = false + r.forEach { + if (it.drExceedTimes > 0) { + result = true + } + } + return result } /** diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/report/BaseCols.kt b/src/main/kotlin/cn/flightfeather/supervision/business/report/BaseCols.kt index ae22382..8b6f31f 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/business/report/BaseCols.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/business/report/BaseCols.kt @@ -5,15 +5,31 @@ /** * 缁熻鏁版嵁鍒楀熀绫� + * @param chooseIndexList 閫夋嫨闇�瑕佽緭鍑虹殑鍒楀簭鍙凤紝涓嶅~鍐欐椂琛ㄧず榛樿杈撳嚭鎵�鏈夊垪 */ -abstract class BaseCols(){ +abstract class BaseCols(private val chooseIndexList: List<Int>){ protected var heads = mutableListOf<MutableList<ExcelUtil.MyCell>>() //鐢熸垚琛ㄥご fun getHeads(dataSource: DataSource): MutableList<MutableList<ExcelUtil.MyCell>> { heads = onHeads(dataSource) - return heads + val _heads = if (chooseIndexList.isNotEmpty()) { + val __heads = mutableListOf<MutableList<ExcelUtil.MyCell>>() + heads.forEach {head -> + val h = mutableListOf<ExcelUtil.MyCell>() + chooseIndexList.forEach {i -> + if (i < head.size) { + h.add(head[i]) + } + } + __heads.add(h) + } + __heads + } else { + heads + } + return _heads } abstract fun onHeads(dataSource: DataSource): MutableList<MutableList<ExcelUtil.MyCell>> @@ -27,7 +43,20 @@ // } else { // onOneRow(rowData) // } - return onOneRow(rowData) + val row = onOneRow(rowData) + val _row = if (chooseIndexList.isNotEmpty()) { + val r = mutableListOf<Any>() + chooseIndexList.forEach {i -> + if (i < row.size) { + r.add(row[i]) + } + } + r + } else { + row + } + + return _row } abstract fun onOneRow(rowData: DataSource.RowData): List<Any> diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/report/BaseExcel.kt b/src/main/kotlin/cn/flightfeather/supervision/business/report/BaseExcel.kt index 844726b..9f5e740 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/business/report/BaseExcel.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/business/report/BaseExcel.kt @@ -8,6 +8,7 @@ /** * 鍚勬ā鏉垮悎骞惰緭鍑轰负鏁翠綋鏂囨。 + * 鍗曚釜鏁版嵁婧� */ abstract class BaseExcel(val dataSource: DataSource) { diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/report/BaseExcelMulti.kt b/src/main/kotlin/cn/flightfeather/supervision/business/report/BaseExcelMulti.kt new file mode 100644 index 0000000..0377ffc --- /dev/null +++ b/src/main/kotlin/cn/flightfeather/supervision/business/report/BaseExcelMulti.kt @@ -0,0 +1,44 @@ +package cn.flightfeather.supervision.business.report + +import org.apache.poi.hssf.usermodel.HSSFWorkbook +import java.io.File +import java.io.FileOutputStream +import java.io.OutputStream +import java.util.* + +/** + * 鍚勬ā鏉垮悎骞惰緭鍑轰负鏁翠綋鏂囨。 + * 鍗曚釜鏁版嵁婧� + */ +abstract class BaseExcelMulti(private val dataSourceList: List<DataSource>) { + + abstract val templates: List<BaseTemplateMulti> + + abstract val fileName: String + + // excel鏂囨。 + private var workbook = HSSFWorkbook() + + fun getReportName(): String = "${dataSourceList[0].areaName()}-${fileName}.xls" + + fun toFile(path: String) { + val fileName = getReportName() + val file = File(path + fileName) + if (!file.parentFile.exists()) { + file.parentFile.mkdirs() + } + val out = FileOutputStream(file) + toOutputStream(out) + } + + fun toOutputStream(out: OutputStream) { + templates.forEach { + it.execute() + it.toWorkBook(workbook) + } + workbook.write(out) + workbook.close() + out.flush() + out.close() + } +} \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/report/BaseOutputInterface.kt b/src/main/kotlin/cn/flightfeather/supervision/business/report/BaseOutputInterface.kt new file mode 100644 index 0000000..0869d18 --- /dev/null +++ b/src/main/kotlin/cn/flightfeather/supervision/business/report/BaseOutputInterface.kt @@ -0,0 +1,19 @@ +package cn.flightfeather.supervision.business.report + +import org.apache.poi.hssf.usermodel.HSSFWorkbook +import java.io.OutputStream + +/** + * 鎶ュ憡杈撳嚭鎺ュ彛 + */ +interface BaseOutputInterface { + + fun toWorkBook(wb: HSSFWorkbook) + + fun toOutputStream(out: OutputStream, sheetName: String? = null) + + /** + * 杈撳嚭涓烘枃妗� + */ + fun toFile(path: String) +} \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/report/BaseTemplate.kt b/src/main/kotlin/cn/flightfeather/supervision/business/report/BaseTemplate.kt index f10a5be..fefb508 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/business/report/BaseTemplate.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/business/report/BaseTemplate.kt @@ -12,9 +12,10 @@ /** * excel鎶ュ憡妯℃澘鍩虹被 + * 鍗曚釜鏁版嵁婧� */ // FIXME: 2022/7/15 妯℃澘绠�鍖栵細鍙湁琛ㄥご浼氭秹鍙婂崟鍏冩牸鍚堝苟锛岄粯璁よ〃鍐呭涓病鏈夊悎骞� -abstract class BaseTemplate(val dataSource: DataSource){ +abstract class BaseTemplate(val dataSource: DataSource) : BaseOutputInterface { //鍒楃粍鍚� abstract val cols: List<BaseCols> @@ -24,6 +25,7 @@ //琛ㄥご val head = mutableListOf<MutableList<ExcelUtil.MyCell>>() + //鍐呭 val contents = mutableListOf<MutableList<Any>>() @@ -33,11 +35,11 @@ dataSource.reset() //鍚堟垚琛ㄥご cols.forEach { - it.combineHead(head,dataSource) + it.combineHead(head, dataSource) } //鍚堟垚鏁版嵁 dataSource.loop { index, rowData -> - cols.forEach {col -> + cols.forEach { col -> val r = col.getOneRow(rowData) if (index >= contents.size) { contents.add(mutableListOf()) @@ -47,12 +49,12 @@ } } - fun toWorkBook(wb: HSSFWorkbook) { + override fun toWorkBook(wb: HSSFWorkbook) { val f = tableFormat() ExcelUtil.write(f.first, f.second, wb, templateName) } - fun toOutputStream(out: OutputStream, sheetName: String? = null) { + override fun toOutputStream(out: OutputStream, sheetName: String?) { val f = tableFormat() ExcelUtil.write2(out, f.first, f.second, sheetName ?: templateName) } @@ -60,7 +62,7 @@ /** * 杈撳嚭涓烘枃妗� */ - fun toFile(path: String) { + override fun toFile(path: String) { val fileName = "${dataSource.areaName()}-${templateName}-${Date().time}.xls" val out = FileOutputStream(path + fileName) toOutputStream(out) @@ -69,12 +71,13 @@ /** * 琛ㄥご鍜岃〃鍐呭鏍煎紡杞寲 */ - private fun tableFormat(): Pair<MutableList<Array<Any>>, MutableList<Array<Any>>> { + fun tableFormat(): Pair<MutableList<Array<Any>>, MutableList<Array<Any>>> { val h = mutableListOf<Array<Any>>() val c = mutableListOf<Array<Any>>() head.forEach { h.add(it.toTypedArray()) } contents.forEach { c.add(it.toTypedArray()) } val index = c[0][0] + //鎸夌収绗竴鍒楄繘琛屾帓搴� if (index is Int) { c.sortBy { if (it[0] is Int) { @@ -91,11 +94,3 @@ return Pair(h, c) } } - -//鍥哄畾鍒楃粍鍚� - - -//鍩烘湰淇℃伅 -//闂鎵e垎鍒嗗竷 - - diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/report/BaseTemplateMulti.kt b/src/main/kotlin/cn/flightfeather/supervision/business/report/BaseTemplateMulti.kt new file mode 100644 index 0000000..4ff70ed --- /dev/null +++ b/src/main/kotlin/cn/flightfeather/supervision/business/report/BaseTemplateMulti.kt @@ -0,0 +1,135 @@ +package cn.flightfeather.supervision.business.report + +import cn.flightfeather.supervision.common.utils.Constant +import cn.flightfeather.supervision.common.utils.DateUtil +import cn.flightfeather.supervision.common.utils.ExcelUtil +import cn.flightfeather.supervision.domain.ds1.entity.Problemlist +import org.apache.poi.hssf.usermodel.HSSFWorkbook +import tk.mybatis.mapper.entity.Example +import java.io.FileOutputStream +import java.io.OutputStream +import java.util.* + +/** + * excel鎶ュ憡妯℃澘鍩虹被 + * 澶氫釜鏁版嵁婧� + */ +// FIXME: 2022/7/15 妯℃澘绠�鍖栵細鍙湁琛ㄥご浼氭秹鍙婂崟鍏冩牸鍚堝苟锛岄粯璁よ〃鍐呭涓病鏈夊悎骞� +abstract class BaseTemplateMulti(private val dataSourceList: List<DataSource>) : BaseOutputInterface { + + //鍒楃粍鍚� + abstract val cols: List<BaseCols> + + //妯℃澘鍚嶇О + abstract val templateName: String + + //琛ㄥご + val head = mutableListOf<MutableList<ExcelUtil.MyCell>>() + + //鍐呭 + val contents = mutableListOf<MutableList<Any>>() + + + open fun execute() { + if (dataSourceList.isEmpty()) throw IllegalStateException("${templateName}: 鏁版嵁婧愪负绌�") + //鍚堟垚琛ㄥご + cols.forEach { + it.combineHead(head, dataSourceList[0]) + } + + var i = 0 + dataSourceList.forEach { dataSource -> + //鏁版嵁婧愰噸缃� + dataSource.reset() + + //鍚堟垚鏁版嵁 + dataSource.loop { _, rowData -> + cols.forEach { col -> + val r = col.getOneRow(rowData) + if (i >= contents.size) { + contents.add(mutableListOf()) + } + contents[i].addAll(r) + } + i++ + } + } + } + + override fun toWorkBook(wb: HSSFWorkbook) { + val f = tableFormat() + ExcelUtil.write(f.first, f.second, wb, templateName) + } + + override fun toOutputStream(out: OutputStream, sheetName: String?) { + val f = tableFormat() + ExcelUtil.write2(out, f.first, f.second, sheetName ?: templateName) + } + + /** + * 杈撳嚭涓烘枃妗� + */ + override fun toFile(path: String) { +// val fileName = "${dataSource.areaName()}-${templateName}-${Date().time}.xls" + val fileName = "${templateName}-${Date().time}.xls" + val out = FileOutputStream(path + fileName) + toOutputStream(out) + } + + /** + * 琛ㄥご鍜岃〃鍐呭鏍煎紡杞寲 + */ + fun tableFormat(): Pair<MutableList<Array<Any>>, MutableList<Array<Any>>> { + val h = mutableListOf<Array<Any>>() + val c = mutableListOf<Array<Any>>() + head.forEach { h.add(it.toTypedArray()) } + contents.forEach { c.add(it.toTypedArray()) } + val index = c[0][0] + //鎸夌収绗竴鍒楄繘琛屾帓搴� + if (index is Int) { + c.sortBy { + if (it[0] is Int) { + it[0] as Int + } else { + 0 + } + } + } else { + c.sortBy { + it[0].toString() + } + } + return Pair(h, c) + } + + fun toTableRows(): Pair<MutableList<Array<Any>>, MutableList<Array<Any>>> { + val h = mutableListOf<Array<Any>>() + val c = mutableListOf<Array<Any>>() + head.forEach { d -> + val tempH = mutableListOf<Any>() + d.forEach { + tempH.add(it.text) + } + h.add(tempH.toTypedArray()) + } + contents.forEach { + c.add(it.toTypedArray()) + } + val index = c[0][0] + //鎸夌収绗竴鍒楄繘琛屾帓搴� + if (index is Int) { + c.sortBy { + if (it[0] is Int) { + it[0] as Int + } else { + 0 + } + } + } else { + c.sortBy { + it[0].toString() + } + } + return Pair(h, c) + } +} diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/report/DataSource.kt b/src/main/kotlin/cn/flightfeather/supervision/business/report/DataSource.kt index 71f5ce4..3d715f9 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/business/report/DataSource.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/business/report/DataSource.kt @@ -39,12 +39,12 @@ val rowData = RowData() init { - if (config.districtCode == null) { - throw IllegalStateException("鍙傛暟缂哄皯鍖哄幙缂栫爜:[districtCode]") - } - if (config.sceneType == null) { - throw IllegalStateException("鍙傛暟缂哄皯鍦烘櫙绫诲瀷:[sceneType]") - } +// if (config.districtCode == null) { +// throw IllegalStateException("鍙傛暟缂哄皯鍖哄幙缂栫爜:[districtCode]") +// } +// if (config.sceneType == null) { +// throw IllegalStateException("鍙傛暟缂哄皯鍦烘櫙绫诲瀷:[sceneType]") +// } getSource(config) } @@ -76,10 +76,10 @@ } /** - * 鑾峰彇鎶ュ憡鏁版嵁婧� + * 鑾峰彇鎶ュ憡鏁版嵁婧愶紙宸℃煡浠诲姟锛� */ private fun getSource(config: ExcelConfigVo) { - if (config.sceneType == null) return +// if (config.sceneType == null) return val result = mutableListOf<Subtask>() @@ -108,6 +108,8 @@ } config.startTime?.let { andGreaterThanOrEqualTo("planstarttime", it) } config.endTime?.let { andLessThanOrEqualTo("planendtime", it) } + config.districtCode?.let { andEqualTo("districtcode", it) } +// andEqualTo("tguid", config.topTaskGuid) } }) } else { @@ -142,6 +144,8 @@ var index = 0 var subTask: Subtask? = null + + private var lastScene: Scense? = null //鍦烘櫙鍩烘湰淇℃伅 val scene: Scense? @@ -192,6 +196,7 @@ } private var _problems = mutableListOf<Problemlist>() + //璇勪及鎬诲垎 val evaluation: Evaluation? get() { if (_evaluation == null) { @@ -205,6 +210,7 @@ } private var _evaluation: Evaluation? = null + //璇勪及缁嗗垯寰楀垎 val itemevaluationList: MutableList<Itemevaluation> get() { if (_itemevaluationList.isEmpty()) { @@ -223,8 +229,8 @@ get() { if (_problemTypes.isEmpty()) { val r = dbMapper.problemtypeMapper.selectByExample(Example(Problemtype::class.java).apply { - createCriteria().andEqualTo("scensetypeid", config.sceneType) - .andEqualTo("districtcode", config.districtCode) + createCriteria().andEqualTo("scensetypeid", scene?.typeid) + .andEqualTo("districtcode", scene?.districtcode) orderBy("extension1") }) _problemTypes.addAll(r) @@ -240,7 +246,7 @@ val rule = dbMapper.evaluationruleMapper.selectByExample(Example(Evaluationrule::class.java).apply { createCriteria() .andEqualTo("tasktypeid", 99) - .andEqualTo("scensetypeid", config.sceneType) + .andEqualTo("scensetypeid", scene?.typeid) }) if (rule.isNotEmpty()) { val ruleId = rule[0].guid @@ -299,7 +305,7 @@ val ledgerCount: Int get() { if (_ledgerCount == -1) { - val tzSceneType = Constant.ScenseType.typeMap(config.sceneType?.toByte()) + val tzSceneType = Constant.ScenseType.typeMap(scene?.typeid) _ledgerCount = dbMapper.ledgerSubTypeMapper.selectCountByExample(Example(LedgerSubType::class.java).apply { createCriteria().andEqualTo("lScenetype", tzSceneType).andEqualTo("lNeedupdate", true) }) @@ -356,6 +362,14 @@ * 娓呯┖褰撳墠澶勭悊鐨勫璞$殑鐩稿叧鏁版嵁婧� */ fun clear() { + if (lastScene != null && lastScene?.typeid != _scene?.typeid) { + _problemTypes.clear() + _topItems.clear() + _rules.clear() + _ledgerCount = -1 + } else { + lastScene = _scene + } _scene = null _baseScene = null _problems.clear() diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/report/ReportUtil.kt b/src/main/kotlin/cn/flightfeather/supervision/business/report/ReportUtil.kt index f0c6479..bd83dc1 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/business/report/ReportUtil.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/business/report/ReportUtil.kt @@ -4,4 +4,5 @@ * 鎶ュ憡鐢熸垚宸ュ叿 */ class ReportUtil { + } \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColInspectionInfo.kt b/src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColInspectionInfo.kt index 0da1231..507266d 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColInspectionInfo.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColInspectionInfo.kt @@ -7,9 +7,10 @@ import cn.flightfeather.supervision.common.utils.ExcelUtil //鐩戠璇︽儏 -class ColInspectionInfo() : BaseCols() { +class ColInspectionInfo(chooseIndexList: List<Int> = emptyList()) : BaseCols(chooseIndexList) { override fun onHeads(dataSource: DataSource): MutableList<MutableList<ExcelUtil.MyCell>> { - return mutableListOf(mutableListOf( + return mutableListOf( + mutableListOf( ExcelUtil.MyCell("鐩戠鏃堕棿"), ExcelUtil.MyCell("宸℃煡浜哄憳"), ExcelUtil.MyCell("闂绫诲瀷"), @@ -30,7 +31,8 @@ ExcelUtil.MyCell("闂瀹℃牳鍗犳瘮"), ExcelUtil.MyCell("鏁存敼瀹℃牳鏁�"), ExcelUtil.MyCell("鏁存敼瀹℃牳鍗犳瘮"), - )) + ) + ) } override fun onOneRow(rowData: DataSource.RowData): List<Any> { @@ -136,7 +138,7 @@ listOf( pType, pDes, pLoc, pNum, changeTime, pChanged, changedProblem, cNum, unChangedProblem, unChangeNum, changePercent, checkStatus, pCheckTime, cCheckTime, - pCheckNum, pCheckPer, cCheckNum, cCheckPer + pCheckNum, pCheckPer, cCheckNum, cCheckPer ) ) } diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColItemGrade.kt b/src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColItemGrade.kt index 757019b..86ddc97 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColItemGrade.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColItemGrade.kt @@ -6,7 +6,8 @@ import cn.flightfeather.supervision.domain.ds1.entity.Itemevaluation import org.apache.poi.hssf.util.HSSFColor -class ColItemGrade(private val hasHead3: Boolean = true) : BaseCols() { +//璇勪及寰楀垎 +class ColItemGrade(private val hasHead3: Boolean = true, chooseIndexList: List<Int> = emptyList()) : BaseCols(chooseIndexList) { override fun onHeads(dataSource: DataSource): MutableList<MutableList<ExcelUtil.MyCell>> { val h1 = mutableListOf<ExcelUtil.MyCell>() diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColLedger.kt b/src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColLedger.kt index 556a480..ab379e6 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColLedger.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColLedger.kt @@ -10,7 +10,8 @@ import java.util.* import kotlin.random.Random -class ColLedger : BaseCols() { +//鍙拌处涓婁紶鎯呭喌 +class ColLedger(chooseIndexList: List<Int> = emptyList()) : BaseCols(chooseIndexList) { override fun onHeads(dataSource: DataSource): MutableList<MutableList<ExcelUtil.MyCell>> { return mutableListOf(mutableListOf( ExcelUtil.MyCell("鍙拌处鎻愪氦鐧惧垎姣�"), diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColProChange.kt b/src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColProChange.kt index c491e61..5cf68af 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColProChange.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColProChange.kt @@ -4,7 +4,8 @@ import cn.flightfeather.supervision.business.report.DataSource import cn.flightfeather.supervision.common.utils.ExcelUtil -class ColProChange : BaseCols() { +//闂鏁存敼璁℃暟 +class ColProChange(chooseIndexList: List<Int> = emptyList()) : BaseCols(chooseIndexList) { override fun onHeads(dataSource: DataSource): MutableList<MutableList<ExcelUtil.MyCell>> { return mutableListOf( mutableListOf(ExcelUtil.MyCell("闂涓庢暣鏀�", colSpan = 2)), diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColProblemDistribution.kt b/src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColProblemDistribution.kt index 440512e..c3372e0 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColProblemDistribution.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColProblemDistribution.kt @@ -5,7 +5,7 @@ import cn.flightfeather.supervision.common.utils.ExcelUtil //闂鏁存敼鍒嗗竷 -class ColProblemDistribution() : BaseCols() { +class ColProblemDistribution(chooseIndexList: List<Int> = emptyList()) : BaseCols(chooseIndexList) { private var h2 = mutableListOf<ExcelUtil.MyCell>() private val currentProblemType = mutableMapOf<String, String>() private val currentProblemHead = mutableListOf<String>() diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColSceneBaseInfo.kt b/src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColSceneBaseInfo.kt new file mode 100644 index 0000000..537c6bc --- /dev/null +++ b/src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColSceneBaseInfo.kt @@ -0,0 +1,31 @@ +package cn.flightfeather.supervision.business.report.cols + +import cn.flightfeather.supervision.business.report.BaseCols +import cn.flightfeather.supervision.business.report.DataSource +import cn.flightfeather.supervision.common.utils.ExcelUtil + +//鍦烘櫙鍩虹淇℃伅 +class ColSceneBaseInfo(chooseIndexList: List<Int> = emptyList()) : BaseCols(chooseIndexList) { + override fun onHeads(dataSource: DataSource): MutableList<MutableList<ExcelUtil.MyCell>> { + return mutableListOf( + mutableListOf( + ExcelUtil.MyCell("鍦板潃"), +// ExcelUtil.MyCell("涓氫富鍗曚綅"), +// ExcelUtil.MyCell("鏂藉伐鍗曚綅"), +// ExcelUtil.MyCell("寤虹瓚闈㈢Н(m虏)"), +// ExcelUtil.MyCell("鏂藉伐璧峰鏃堕棿"), +// ExcelUtil.MyCell("鏂藉伐缁撴潫鏃堕棿"), +// ExcelUtil.MyCell("宸ョ▼绫诲瀷"), +// ExcelUtil.MyCell("鑱旂郴浜�"), +// ExcelUtil.MyCell("鑱旂郴鏂瑰紡"), + ) + ) + } + + override fun onOneRow(rowData: DataSource.RowData): List<Any> { +// return listOf(rowData.scene?.index ?: -99, rowData.scene?.extension2 ?: "", rowData.scene?.name ?: "") + return listOf( + rowData.scene?.location ?: "" + ) + } +} \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColSceneName.kt b/src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColSceneName.kt index 979b066..8db38d5 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColSceneName.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColSceneName.kt @@ -4,16 +4,26 @@ import cn.flightfeather.supervision.business.report.DataSource import cn.flightfeather.supervision.common.utils.ExcelUtil -//鍚嶇О -class ColSceneName() : BaseCols() { +//鍦烘櫙鍚嶇О鍙婄被鍨� +class ColSceneName(chooseIndexList: List<Int> = emptyList()) : BaseCols(chooseIndexList) { override fun onHeads(dataSource: DataSource): MutableList<MutableList<ExcelUtil.MyCell>> { return mutableListOf( - mutableListOf(ExcelUtil.MyCell("琛ㄥ崟缂栧彿"), ExcelUtil.MyCell("鍞竴搴忓彿"), ExcelUtil.MyCell("鍦烘櫙鍚嶇О")) + mutableListOf( + ExcelUtil.MyCell("琛ㄥ崟缂栧彿"), + ExcelUtil.MyCell("鍞竴搴忓彿"), + ExcelUtil.MyCell("鍦烘櫙绫诲瀷"), + ExcelUtil.MyCell("鍦烘櫙鍚嶇О") + ) ) } override fun onOneRow(rowData: DataSource.RowData): List<Any> { // return listOf(rowData.scene?.index ?: -99, rowData.scene?.extension2 ?: "", rowData.scene?.name ?: "") - return listOf(rowData.index + 1, rowData.scene?.index ?: -99, rowData.scene?.name ?: "") + return listOf( + rowData.index + 1, + rowData.scene?.index ?: -99, + rowData.scene?.type ?: "", + rowData.scene?.name ?: "" + ) } } \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColStatus.kt b/src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColStatus.kt index 3d40ce8..e84c977 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColStatus.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColStatus.kt @@ -9,7 +9,7 @@ import cn.flightfeather.supervision.domain.ds1.entity.SceneStorageYard import cn.flightfeather.supervision.domain.ds1.entity.SceneWharf -class ColStatus : BaseCols() { +class ColStatus(chooseIndexList: List<Int> = emptyList()) : BaseCols(chooseIndexList) { override fun onHeads(dataSource: DataSource): MutableList<MutableList<ExcelUtil.MyCell>> { return mutableListOf(mutableListOf( ExcelUtil.MyCell("鏂藉伐/钀ヨ繍鐘舵��"), diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColStrategy.kt b/src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColStrategy.kt index c3733c9..8c3cded 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColStrategy.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColStrategy.kt @@ -9,7 +9,7 @@ import java.time.ZoneId import java.time.temporal.ChronoUnit -class ColStrategy : BaseCols() { +class ColStrategy(chooseIndexList: List<Int> = emptyList()) : BaseCols(chooseIndexList) { override fun onHeads(dataSource: DataSource): MutableList<MutableList<ExcelUtil.MyCell>> { return mutableListOf(mutableListOf( ExcelUtil.MyCell("鏁存敼璺熻釜鎻愰啋") diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColTotalGrade.kt b/src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColTotalGrade.kt index f77e2b6..9dc944a 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColTotalGrade.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColTotalGrade.kt @@ -6,7 +6,7 @@ import cn.flightfeather.supervision.domain.ds1.entity.Itemevaluation import org.apache.poi.hssf.util.HSSFColor -class ColTotalGrade() : BaseCols() { +class ColTotalGrade(chooseIndexList: List<Int> = emptyList()) : BaseCols(chooseIndexList) { override fun onHeads(dataSource: DataSource): MutableList<MutableList<ExcelUtil.MyCell>> { val h1 = mutableListOf<ExcelUtil.MyCell>() diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColTown.kt b/src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColTown.kt index e1a73bb..a432e50 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColTown.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColTown.kt @@ -4,7 +4,7 @@ import cn.flightfeather.supervision.business.report.DataSource import cn.flightfeather.supervision.common.utils.ExcelUtil -class ColTown : BaseCols() { +class ColTown(chooseIndexList: List<Int> = emptyList()) : BaseCols(chooseIndexList) { override fun onHeads(dataSource: DataSource): MutableList<MutableList<ExcelUtil.MyCell>> { return mutableListOf(mutableListOf(ExcelUtil.MyCell("琛楅晣/宸ヤ笟鍖�"))) } diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/report/file/ReportThree.kt b/src/main/kotlin/cn/flightfeather/supervision/business/report/file/ReportThree.kt index 86cf9ff..1af77f8 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/business/report/file/ReportThree.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/business/report/file/ReportThree.kt @@ -6,6 +6,7 @@ import cn.flightfeather.supervision.business.report.template.* class ReportThree(dataSource: DataSource) : BaseExcel(dataSource) { - override val templates: List<BaseTemplate> = listOf(ProTypeDetailSummary(dataSource), ProTypeRankSummary(dataSource), ProTypeRankMainSummary(dataSource), ProTypeStatusSummary(dataSource)) + override val templates: List<BaseTemplate> = listOf(ProTypeDetailSummary(dataSource), + ProTypeRankSummary(dataSource), ProTypeRankMainSummary(dataSource), ProTypeStatusSummary(dataSource)) override val fileName: String = "闂涓庢暣鏀瑰垎甯冨垎鏋愭竻鍗�" } \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/report/template/DailyReportSummary.kt b/src/main/kotlin/cn/flightfeather/supervision/business/report/template/DailyReportSummary.kt new file mode 100644 index 0000000..febe803 --- /dev/null +++ b/src/main/kotlin/cn/flightfeather/supervision/business/report/template/DailyReportSummary.kt @@ -0,0 +1,22 @@ +package cn.flightfeather.supervision.business.report.template + +import cn.flightfeather.supervision.business.report.BaseCols +import cn.flightfeather.supervision.business.report.BaseTemplateMulti +import cn.flightfeather.supervision.business.report.DataSource +import cn.flightfeather.supervision.business.report.cols.ColInspectionInfo +import cn.flightfeather.supervision.business.report.cols.ColSceneBaseInfo +import cn.flightfeather.supervision.business.report.cols.ColSceneName +import cn.flightfeather.supervision.business.report.cols.ColTown + +class DailyReportSummary(dataSourceList: List<DataSource>) : BaseTemplateMulti(dataSourceList) { + + override val cols: List<BaseCols> = listOf( + ColSceneName(), + ColSceneBaseInfo(), + ColTown(), + ColInspectionInfo(listOf(2, 3, 4, 5, 7, 8, 9)) + ) + + override val templateName: String = "鏃ユ姤缁熻" + +} \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/report/template/ProAnalysisSummary.kt b/src/main/kotlin/cn/flightfeather/supervision/business/report/template/ProAnalysisSummary.kt index c845469..0899468 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/business/report/template/ProAnalysisSummary.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/business/report/template/ProAnalysisSummary.kt @@ -34,7 +34,7 @@ val r = cols[0].getOneRow(rowData) val r1 = cols[1].getOneRow(rowData) -// val r2 = cols[2].getOneRow(rowData) + val r2 = cols[2].getOneRow(rowData) val k = rowData.scene?.townname if (!districtMap.containsKey(k)) { @@ -76,15 +76,11 @@ changeNum += cNum + //鏍规嵁瑙勮寖鎬у拰鐩戠绛栫暐缁撴灉鍒ゆ柇鏄惁涓洪噸鐐圭洃绠″璞� val standard = r1[1] as ExcelUtil.MyCell - if (standard.text.contains("涓ラ噸涓嶈鑼�")) { + if (standard.text.contains("涓ラ噸涓嶈鑼�") || r2[0].toString().contains("7銆�")) { focusSceneNum++ } - - //鏍规嵁鐩戠绛栫暐缁撴灉鍒ゆ柇鏄惁涓洪噸鐐圭洃绠″璞� -// if (r2[0].toString().contains("7銆�")) { -// focusSceneNum++ -// } } } diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/report/template/ProTypeRankMainSummary.kt b/src/main/kotlin/cn/flightfeather/supervision/business/report/template/ProTypeRankMainSummary.kt index 83cdc70..a0982c3 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/business/report/template/ProTypeRankMainSummary.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/business/report/template/ProTypeRankMainSummary.kt @@ -9,6 +9,7 @@ override val templateName: String = "鏈堝害涓昏鎴栧吀鍨嬮棶棰樺垎鏋愯〃" override fun formatTable(summarys: MutableList<Summary>) { + //鎺掑悕闈犲墠鐨刴ax涓棶棰樿璁ゅ畾涓轰富瑕佹垨鍏稿瀷闂 val max = when (dataSource.config.sceneType.toString()) { Constant.ScenseType.TYPE1.value -> 5 else -> 4 diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/report/template/ProTypeStatusSummary.kt b/src/main/kotlin/cn/flightfeather/supervision/business/report/template/ProTypeStatusSummary.kt index ce7cea3..0c185c8 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/business/report/template/ProTypeStatusSummary.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/business/report/template/ProTypeStatusSummary.kt @@ -15,7 +15,8 @@ @Throws(Exception::class) override fun execute() { if (dataSource.config.sceneType.toString() != Constant.ScenseType.TYPE1.value) { - throw IllegalStateException("${templateName}鍙兘閽堝宸ュ湴杩涜鍒嗘瀽锛屽綋鍓嶄紶鍏ュ満鏅被鍨嬬紪鍙蜂负${dataSource.config.sceneType}") +// throw IllegalStateException("${templateName}鍙兘閽堝宸ュ湴杩涜鍒嗘瀽锛屽綋鍓嶄紶鍏ュ満鏅被鍨嬬紪鍙蜂负${dataSource.config.sceneType}") + println("sadas") } dataSource.reset() diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/storage/StAutoScore.kt b/src/main/kotlin/cn/flightfeather/supervision/business/storage/StAutoScore.kt index 81d8739..60e48b5 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/business/storage/StAutoScore.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/business/storage/StAutoScore.kt @@ -2,8 +2,7 @@ import cn.flightfeather.supervision.business.Info import cn.flightfeather.supervision.business.ScoreItem -import cn.flightfeather.supervision.business.storage.item.StScoreItem_1 -import cn.flightfeather.supervision.business.storage.item.StScoreItem_2 +import cn.flightfeather.supervision.business.storage.item.* import cn.flightfeather.supervision.common.utils.Constant import cn.flightfeather.supervision.common.utils.DateUtil import cn.flightfeather.supervision.common.utils.ExcelUtil @@ -31,8 +30,13 @@ @Component class StAutoScore( + csScoreItem_1: CsScoreItem_1, + csScoreItem_2: CsScoreItem_2, + mpScoreItem_1: MpScoreItem_1, + mpScoreItem_2: MpScoreItem_2, stScoreItem_1: StScoreItem_1, - stScoreItem_2: StScoreItem_2, + whScoreItem_1: WhScoreItem_1, + whScoreItem_2: WhScoreItem_2, var sceneType: Constant.ScenseType = Constant.ScenseType.TYPE1, ) { companion object { @@ -94,8 +98,15 @@ private val rows = mutableListOf<Array<Any>>() init { - itemList.add(stScoreItem_1) - itemList.add(stScoreItem_2) + itemList.apply { + add(csScoreItem_1) + add(csScoreItem_2) + add(mpScoreItem_1) + add(mpScoreItem_2) + add(stScoreItem_1) + add(whScoreItem_1) + add(whScoreItem_2) + } } @PostConstruct @@ -112,8 +123,9 @@ */ fun topTaskGrade(topTaskId:String) { rows.clear() + getScoreItem() subtaskMapper.selectByTopTask2(topTaskId, sceneType.value.toInt()).forEach { - sceneGrade(it) + sceneGradeP(it) // sceneGradeToFile(it) } // toFile() @@ -127,6 +139,10 @@ // 鑾峰彇璇勫垎瑙勫垯 getScoreItem() + sceneGradeP(subtask) + } + + private fun sceneGradeP(subtask: Subtask) { val info = itemGrade(subtask) val result = totalGrade(info) ?: return toDb(info, result) @@ -141,6 +157,9 @@ val info = itemGrade(subtask) val result = totalGrade(info) ?: return addToFile(rows, info, result.first) + } + + fun grade(subtask: Subtask) { } diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/storage/item/CsScoreItem_1.kt b/src/main/kotlin/cn/flightfeather/supervision/business/storage/item/CsScoreItem_1.kt new file mode 100644 index 0000000..81163e5 --- /dev/null +++ b/src/main/kotlin/cn/flightfeather/supervision/business/storage/item/CsScoreItem_1.kt @@ -0,0 +1,57 @@ +package cn.flightfeather.supervision.business.storage.item + +import cn.flightfeather.supervision.business.ScoreItem +import cn.flightfeather.supervision.domain.ds1.entity.Problemlist +import org.springframework.stereotype.Component +import tk.mybatis.mapper.entity.Example +import javax.annotation.PostConstruct + +/** + * Date 2022/1/20 16:14 + * Created by feiyu + * 宸ュ湴 + */ +@Component +class CsScoreItem_1:ScoreItem() { + + companion object { + private lateinit var instance: CsScoreItem_1 + } + + @PostConstruct + fun init() { + instance = this + } + + override var id: String = "amSNTZfXs2XXR1td" + + override var name: String = "鏁存敼鎺柦鍙婃晥鏋�" + + /** + * 鎵ф硶妫�鏌ユ眹鎬绘儏鍐� + * 閫夐」濡備笅锛� + * 1.闂閮ㄥ垎鏁存敼鎴栦笉鍙婃椂鎻愪緵鏉愭枡 + * 2.闂鏃犳暣鏀� + */ + override fun otherProblem(size: Int): Int? { + val p = problemlistMapper.selectByExample(Example(Problemlist::class.java).apply { + createCriteria().andEqualTo("stguid", info.subTask?.stguid) +// .andGreaterThanOrEqualTo("time", info.sTime) +// .andLessThan("time", info.eTime) + }) + var i = 0 + + val total = p.size + var changed = 0 + p.forEach { + if (it.ischanged == true) { + changed++ + } + } + return when { + changed == 0 && total > 0 -> 1 + changed < total -> 0 + else -> null + } + } +} \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/storage/item/StScoreItem_2.kt b/src/main/kotlin/cn/flightfeather/supervision/business/storage/item/CsScoreItem_2.kt similarity index 89% rename from src/main/kotlin/cn/flightfeather/supervision/business/storage/item/StScoreItem_2.kt rename to src/main/kotlin/cn/flightfeather/supervision/business/storage/item/CsScoreItem_2.kt index adf27aa..7b2ec28 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/business/storage/item/StScoreItem_2.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/business/storage/item/CsScoreItem_2.kt @@ -2,9 +2,7 @@ import cn.flightfeather.supervision.business.ScoreItem import cn.flightfeather.supervision.domain.ds1.entity.DustDataResult -import cn.flightfeather.supervision.domain.ds1.entity.Problemlist import cn.flightfeather.supervision.domain.ds1.mapper.DustDataResultMapper -import cn.flightfeather.supervision.domain.ds1.mapper.ProblemlistMapper import org.springframework.beans.factory.annotation.Autowired import org.springframework.stereotype.Component import tk.mybatis.mapper.entity.Example @@ -15,12 +13,13 @@ /** * Date 2022/1/20 16:14 * Created by feiyu + * 宸ュ湴 */ @Component -class StScoreItem_2:ScoreItem() { +class CsScoreItem_2:ScoreItem() { companion object { - private lateinit var instance: StScoreItem_2 + private lateinit var instance: CsScoreItem_2 } @PostConstruct diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/storage/item/MpScoreItem_1.kt b/src/main/kotlin/cn/flightfeather/supervision/business/storage/item/MpScoreItem_1.kt new file mode 100644 index 0000000..4dcd316 --- /dev/null +++ b/src/main/kotlin/cn/flightfeather/supervision/business/storage/item/MpScoreItem_1.kt @@ -0,0 +1,57 @@ +package cn.flightfeather.supervision.business.storage.item + +import cn.flightfeather.supervision.business.ScoreItem +import cn.flightfeather.supervision.domain.ds1.entity.Problemlist +import org.springframework.stereotype.Component +import tk.mybatis.mapper.entity.Example +import javax.annotation.PostConstruct + +/** + * Date 2022/1/20 16:14 + * Created by feiyu + * 鎼呮媽绔� + */ +@Component +class MpScoreItem_1:ScoreItem() { + + companion object { + private lateinit var instance: MpScoreItem_1 + } + + @PostConstruct + fun init() { + instance = this + } + + override var id: String = "KxWcuelbrnCtzw6n" + + override var name: String = "鏁存敼鎺柦鍙婃晥鏋�" + + /** + * 鎵ф硶妫�鏌ユ眹鎬绘儏鍐� + * 閫夐」濡備笅锛� + * 1.闂閮ㄥ垎鏁存敼鎴栦笉鍙婃椂鎻愪緵鏉愭枡 + * 2.闂鏃犳暣鏀� + */ + override fun otherProblem(size: Int): Int? { + val p = problemlistMapper.selectByExample(Example(Problemlist::class.java).apply { + createCriteria().andEqualTo("stguid", info.subTask?.stguid) +// .andGreaterThanOrEqualTo("time", info.sTime) +// .andLessThan("time", info.eTime) + }) + var i = 0 + + val total = p.size + var changed = 0 + p.forEach { + if (it.ischanged == true) { + changed++ + } + } + return when { + changed == 0 && total > 0 -> 1 + changed < total -> 0 + else -> null + } + } +} \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/storage/item/StScoreItem_2.kt b/src/main/kotlin/cn/flightfeather/supervision/business/storage/item/MpScoreItem_2.kt similarity index 87% copy from src/main/kotlin/cn/flightfeather/supervision/business/storage/item/StScoreItem_2.kt copy to src/main/kotlin/cn/flightfeather/supervision/business/storage/item/MpScoreItem_2.kt index adf27aa..bfa0db3 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/business/storage/item/StScoreItem_2.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/business/storage/item/MpScoreItem_2.kt @@ -2,9 +2,7 @@ import cn.flightfeather.supervision.business.ScoreItem import cn.flightfeather.supervision.domain.ds1.entity.DustDataResult -import cn.flightfeather.supervision.domain.ds1.entity.Problemlist import cn.flightfeather.supervision.domain.ds1.mapper.DustDataResultMapper -import cn.flightfeather.supervision.domain.ds1.mapper.ProblemlistMapper import org.springframework.beans.factory.annotation.Autowired import org.springframework.stereotype.Component import tk.mybatis.mapper.entity.Example @@ -15,12 +13,13 @@ /** * Date 2022/1/20 16:14 * Created by feiyu + * 宸ュ湴 */ @Component -class StScoreItem_2:ScoreItem() { +class MpScoreItem_2:ScoreItem() { companion object { - private lateinit var instance: StScoreItem_2 + private lateinit var instance: MpScoreItem_2 } @PostConstruct @@ -28,7 +27,7 @@ instance = this } - override var id: String = "dCQbQ8ibc6nexiJo" + override var id: String = "BoVfRjr5r7RtsqGC" override var name: String = "鎵皹鍦ㄧ嚎鐩戞祴鏁版嵁閲忕骇" diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/storage/item/StScoreItem_1.kt b/src/main/kotlin/cn/flightfeather/supervision/business/storage/item/StScoreItem_1.kt index a6dbd59..dd7135f 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/business/storage/item/StScoreItem_1.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/business/storage/item/StScoreItem_1.kt @@ -9,6 +9,7 @@ /** * Date 2022/1/20 16:14 * Created by feiyu + * 鍫嗗満 */ @Component class StScoreItem_1:ScoreItem() { @@ -22,7 +23,7 @@ instance = this } - override var id: String = "amSNTZfXs2XXR1td" + override var id: String = "csInMYhgbBqWRyeB" override var name: String = "鏁存敼鎺柦鍙婃晥鏋�" diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/storage/item/WhScoreItem_1.kt b/src/main/kotlin/cn/flightfeather/supervision/business/storage/item/WhScoreItem_1.kt new file mode 100644 index 0000000..8e3b5cb --- /dev/null +++ b/src/main/kotlin/cn/flightfeather/supervision/business/storage/item/WhScoreItem_1.kt @@ -0,0 +1,57 @@ +package cn.flightfeather.supervision.business.storage.item + +import cn.flightfeather.supervision.business.ScoreItem +import cn.flightfeather.supervision.domain.ds1.entity.Problemlist +import org.springframework.stereotype.Component +import tk.mybatis.mapper.entity.Example +import javax.annotation.PostConstruct + +/** + * Date 2022/1/20 16:14 + * Created by feiyu + * 鐮佸ご + */ +@Component +class WhScoreItem_1:ScoreItem() { + + companion object { + private lateinit var instance: WhScoreItem_1 + } + + @PostConstruct + fun init() { + instance = this + } + + override var id: String = "mgvVEecYRV8xrnf2" + + override var name: String = "鏁存敼鎺柦鍙婃晥鏋�" + + /** + * 鎵ф硶妫�鏌ユ眹鎬绘儏鍐� + * 閫夐」濡備笅锛� + * 1.闂閮ㄥ垎鏁存敼鎴栦笉鍙婃椂鎻愪緵鏉愭枡 + * 2.闂鏃犳暣鏀� + */ + override fun otherProblem(size: Int): Int? { + val p = problemlistMapper.selectByExample(Example(Problemlist::class.java).apply { + createCriteria().andEqualTo("stguid", info.subTask?.stguid) +// .andGreaterThanOrEqualTo("time", info.sTime) +// .andLessThan("time", info.eTime) + }) + var i = 0 + + val total = p.size + var changed = 0 + p.forEach { + if (it.ischanged == true) { + changed++ + } + } + return when { + changed == 0 && total > 0 -> 1 + changed < total -> 0 + else -> null + } + } +} \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/storage/item/StScoreItem_2.kt b/src/main/kotlin/cn/flightfeather/supervision/business/storage/item/WhScoreItem_2.kt similarity index 87% copy from src/main/kotlin/cn/flightfeather/supervision/business/storage/item/StScoreItem_2.kt copy to src/main/kotlin/cn/flightfeather/supervision/business/storage/item/WhScoreItem_2.kt index adf27aa..196a468 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/business/storage/item/StScoreItem_2.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/business/storage/item/WhScoreItem_2.kt @@ -2,9 +2,7 @@ import cn.flightfeather.supervision.business.ScoreItem import cn.flightfeather.supervision.domain.ds1.entity.DustDataResult -import cn.flightfeather.supervision.domain.ds1.entity.Problemlist import cn.flightfeather.supervision.domain.ds1.mapper.DustDataResultMapper -import cn.flightfeather.supervision.domain.ds1.mapper.ProblemlistMapper import org.springframework.beans.factory.annotation.Autowired import org.springframework.stereotype.Component import tk.mybatis.mapper.entity.Example @@ -15,12 +13,13 @@ /** * Date 2022/1/20 16:14 * Created by feiyu + * 宸ュ湴 */ @Component -class StScoreItem_2:ScoreItem() { +class WhScoreItem_2:ScoreItem() { companion object { - private lateinit var instance: StScoreItem_2 + private lateinit var instance: WhScoreItem_2 } @PostConstruct @@ -28,7 +27,7 @@ instance = this } - override var id: String = "dCQbQ8ibc6nexiJo" + override var id: String = "5NNLSvkVRFfASMhc" override var name: String = "鎵皹鍦ㄧ嚎鐩戞祴鏁版嵁閲忕骇" diff --git a/src/main/kotlin/cn/flightfeather/supervision/datafetch/FetchNightConstruction.kt b/src/main/kotlin/cn/flightfeather/supervision/datafetch/FetchNightConstruction.kt index 76442a5..3940056 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/datafetch/FetchNightConstruction.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/datafetch/FetchNightConstruction.kt @@ -57,47 +57,48 @@ DEFAULT_TIME } - NCHttpService.getFile(timeStr)?.forEach {e -> - if (e.isJsonObject) { - val vo = e.asJsonObject - val nightConstruction = NightConstruction().apply { - ncNum = vo["nightallnum"].asString - ncItemName = vo["itemName"].asString - ncItemUnit = vo["itemUnit"].asString - ncConstructionUnit = vo["constructionUnit"].asString - ncPerson = vo["person"].asString - ncApplyContent = vo["applyContent"].asString - ncStartDate = dateUtil.StringToDate(vo["startDate"].asString) - ncEndDate = dateUtil.StringToDate(vo["endDate"].asString) - ncFileName = vo["filename"].asString - ncCreateTime = dateUtil.StringToDate(vo["createtime"].asString) - ncUrl = vo["url"].asString - ncProvinceCode = PROVINCE_CODE - ncProvinceName = PROVINCE_NAME - ncCityCode = CITY_CODE - ncCityName = CITY_NAME - ncDistrictCode = DISTRICT_CODE - ncDistrictName = DISTRICT_NAME - } - nightConstructionMapper.selectByExample(Example(NightConstruction::class.java).apply { - createCriteria().andEqualTo("ncNum", nightConstruction.ncNum) - }).run { - nightConstructionMapper.selectByExample(Example(NightConstruction::class.java).apply { - createCriteria().andEqualTo("ncItemName", nightConstruction.ncItemName) - }).takeIf { l-> l.isNotEmpty() }?.get(0)?.let { r-> - nightConstruction.ncUserId = r.ncUserId - nightConstruction.ncSceneId = r.ncSceneId + try { + NCHttpService.getFile(timeStr)?.forEach {e -> + if (e.isJsonObject) { + val vo = e.asJsonObject + val nightConstruction = NightConstruction().apply { + ncNum = vo["nightallnum"].asString + ncItemName = vo["itemName"].asString + ncItemUnit = vo["itemUnit"].asString + ncConstructionUnit = vo["constructionUnit"].asString + ncPerson = vo["person"].asString + ncApplyContent = vo["applyContent"].asString + ncStartDate = dateUtil.StringToDate(vo["startDate"].asString) + ncEndDate = dateUtil.StringToDate(vo["endDate"].asString) + ncFileName = vo["filename"].asString + ncCreateTime = dateUtil.StringToDate(vo["createtime"].asString) + ncUrl = vo["url"].asString + + ncProvinceCode = PROVINCE_CODE + ncProvinceName = PROVINCE_NAME + ncCityCode = CITY_CODE + ncCityName = CITY_NAME + ncDistrictCode = DISTRICT_CODE + ncDistrictName = DISTRICT_NAME } - if (isEmpty()) { - try { + nightConstructionMapper.selectByExample(Example(NightConstruction::class.java).apply { + createCriteria().andEqualTo("ncNum", nightConstruction.ncNum) + }).run { + nightConstructionMapper.selectByExample(Example(NightConstruction::class.java).apply { + createCriteria().andEqualTo("ncItemName", nightConstruction.ncItemName) + }).takeIf { l-> l.isNotEmpty() }?.get(0)?.let { r-> + nightConstruction.ncUserId = r.ncUserId + nightConstruction.ncSceneId = r.ncSceneId + } + if (isEmpty()) { nightConstructionMapper.insert(nightConstruction) - } catch (e: Exception) { - e.printStackTrace() } } } } + } catch (e: Exception) { + e.printStackTrace() } } } diff --git a/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/mapper/MonitorobjectversionMapper.kt b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/mapper/MonitorobjectversionMapper.kt index 3aed701..a018b4d 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/mapper/MonitorobjectversionMapper.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/mapper/MonitorobjectversionMapper.kt @@ -10,5 +10,5 @@ // @Select("select b.S_GUID from sm_t_monitorobjectversion as a left join sm_t_scense as b on a.S_GUID = b.S_GUID" + // " where a.T_ID = #{param1} and b.S_TypeID = #{param2}") - fun getSceneByType(topTaskId: String, sceneTypeId: Int, townCode: String? = null): List<String> + fun getSceneByType(topTaskId: String, sceneTypeId: Int? = null, townCode: String? = null): List<String> } \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/SearchService.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/SearchService.kt index 1810e8b..0c4d13e 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/SearchService.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/SearchService.kt @@ -22,4 +22,6 @@ fun searchScore4JingAn(token: String, year: Int, month: Int, page: Int? = 1, perPage: Int?): BaseResponse<List<ScoreVo>> fun searchSubTaskByKeyword(userId: String, keyword: String, page: Int, perPage: Int): BaseResponse<List<SubtaskVo>> + + fun getDailyReport(config: ExcelConfigVo): BaseTableVo } \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/SearchServiceImpl.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/SearchServiceImpl.kt index 4aee9a5..d8d8315 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/SearchServiceImpl.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/SearchServiceImpl.kt @@ -13,6 +13,7 @@ import cn.flightfeather.supervision.domain.ds2.mapper.LedgerSubTypeMapper import cn.flightfeather.supervision.domain.ds2.mapper.UserMapMapper import cn.flightfeather.supervision.lightshare.service.SearchService +import cn.flightfeather.supervision.lightshare.service.TaskService import cn.flightfeather.supervision.lightshare.vo.* import com.github.pagehelper.PageHelper import org.springframework.beans.BeanUtils @@ -56,6 +57,7 @@ val ledgerSubTypeMapper: LedgerSubTypeMapper, val ledgerRecordMapper: LedgerRecordMapper, val userMapMapper: UserMapMapper, + val taskService: TaskService ) : SearchService { private val dateUtil = DateUtil() @@ -152,10 +154,38 @@ } override fun getSubTaskDetail(config: ExcelConfigVo): SubTaskTableVo { - val titles = getTableTitles(config.sceneType, config.districtCode) - val content = getTableContents(config, titles.size) + val dbMapper = DbMapper( + scenseMapper, + problemlistMapper, + problemtypeMapper, + subtaskMapper, + monitorobjectversionMapper, + sceneConstructionSiteMapper, + sceneMixingPlantMapper, + sceneStorageYardMapper, + sceneWharfMapper, + taskMapper, + evaluationruleMapper, evaluationsubruleMapper, evaluationMapper, itemevaluationMapper, + ledgerSubTypeMapper, ledgerRecordMapper, userinfoMapper, userMapMapper, townMapper + ) +// val dataSource = DataSource(config, dbMapper) +// val t = when (config.mode) { +//// 1 -> ReportOne(dataSource) +//// 2 -> ReportTwo(dataSource) +//// 3 -> ReportThree(dataSource) +// 4->DailyReportSummary() +// else -> ReportOne(dataSource) +// } +// val fileName = t.getReportName() +// val fName = URLEncoder.encode(fileName, "UTF-8") +// +// val p = Constant.DEFAULT_FILE_PATH + "/files/autoscore/" +// val file = File(p + fileName) +// if (config.forceUpdate || !file.exists()) { +// t.toFile(p) +// } - return SubTaskTableVo(titles, content) + return SubTaskTableVo(emptyList(), emptyList()) } override fun downloadPic(config: ExcelConfigVo, response: HttpServletResponse): HttpServletResponse { @@ -204,7 +234,7 @@ //鏍规嵁鍦烘櫙鏉′欢绛涢�� val need = if (config.sceneType != null) { - scene.typeid == config.sceneType.toByte() + scene.typeid == config.sceneType?.toByte() } else { true } @@ -488,501 +518,42 @@ return BaseResponse(true, head = DataHead(pageInfo.pageNum, pageInfo.pages), data = result) } + override fun getDailyReport(config: ExcelConfigVo): BaseTableVo { + if (config.districtCode == null || config.startTime == null) return BaseTableVo(emptyList(), emptyList()) - private fun getTable(mode: Int, config: ExcelConfigVo): Pair<MutableList<Array<Any>>, MutableList<Array<Any>>> { - //鏁版嵁婧� - val dataList = getTableDataSource(config) - //鐢熸垚琛ㄦ牸 - val head = mutableListOf<MutableList<Any>>() - val contents = mutableListOf<MutableList<Any>>() + val dbMapper = DbMapper( + scenseMapper, + problemlistMapper, + problemtypeMapper, + subtaskMapper, + monitorobjectversionMapper, + sceneConstructionSiteMapper, + sceneMixingPlantMapper, + sceneStorageYardMapper, + sceneWharfMapper, + taskMapper, + evaluationruleMapper, evaluationsubruleMapper, evaluationMapper, itemevaluationMapper, + ledgerSubTypeMapper, ledgerRecordMapper, userinfoMapper, userMapMapper, townMapper + ) + val task = taskService.getByDistrictCode(config.districtCode, config.startTime)?.takeIf { it.isNotEmpty() }?.get(0) + config.topTaskGuid = task?.tguid ?: "" + val dataSource = mutableListOf<DataSource>() + config.sceneType = Constant.ScenseType.TYPE1.value.toInt() + dataSource.add(DataSource(config, dbMapper)) - getSceneName(head, contents, dataList) +// val config2 = config.copy(sceneType = Constant.ScenseType.TYPE2.value.toInt()) +// dataSource.add(DataSource(config2, dbMapper)) +// +// val config3 = config.copy(sceneType = Constant.ScenseType.TYPE3.value.toInt()) +// dataSource.add(DataSource(config3, dbMapper)) +// +// val config4 = config.copy(sceneType = Constant.ScenseType.TYPE14.value.toInt()) +// dataSource.add(DataSource(config4, dbMapper)) - when (mode) { - // 闂鍒嗗竷 - 1 -> { - getProblemDistribution(head, contents, dataList, config) - } - 2 -> { - getInspectionInfo(head, contents, dataList, config) - } - 3 -> { + val t = DailyReportSummary(dataSource) + t.execute() + val result = t.toTableRows() - } - } - val h = mutableListOf<Array<Any>>() - val c = mutableListOf<Array<Any>>() - head.forEach { h.add(it.toTypedArray()) } - contents.forEach { c.add(it.toTypedArray()) } - c.sortBy { - it[0] as Int - } - - return Pair(h, c) - } - - // 琛ㄥご锛氬満鏅悕 - private fun getSceneName(head: MutableList<MutableList<Any>>, contents: MutableList<MutableList<Any>>, dataList: List<Subtask>) { - head.add(mutableListOf(ExcelUtil.MyCell("琛ㄥ崟缂栧彿"), ExcelUtil.MyCell("鍞竴搴忓彿"), ExcelUtil.MyCell("鍦烘櫙鍚嶇О"))) - dataList.forEach {subtask -> - val row = mutableListOf<Any>() - //鏌ヨ璇ヤ换鍔″搴旂殑鍦烘櫙 - val scene = scenseMapper.selectByPrimaryKey(subtask.scenseid) - row.apply { - add(scene.index ?: -99) - add(scene.extension2 ?: "") - add(scene.name ?: "") - } - contents.add(row) - } - } - - // 琛ㄥご锛氬叿浣撻棶棰樺垎甯� - private fun getProblemDistribution(head: MutableList<MutableList<Any>>, contents: MutableList<MutableList<Any>>, - dataList: List<Subtask>, config: ExcelConfigVo) { - val h1 = mutableListOf<ExcelUtil.MyCell>() - val h2 = mutableListOf<Any>() - currentProblemType.clear() - currentProblemHead.clear() - - // 闂鍒嗕负涓ゅ眰锛屾柊澧炰竴琛岃〃澶� - problemtypeMapper.selectByExample(Example(Problemtype::class.java).apply { - createCriteria().andEqualTo("scensetypeid", config.sceneType) - .andEqualTo("districtcode", config.districtCode) - orderBy("extension1") - }).forEach { - if (!currentProblemHead.contains(it.typename)) { - currentProblemHead.add(it.typename ?: "") - h1.add(ExcelUtil.MyCell(it.typename ?: "", colSpan = 0)) - } - currentProblemType[it.guid ?: ""] = it.description ?: "" - if (currentProblemHead.contains(it.typename)) { - h2.add(it.description ?: "") - h1.last().colSpan++ - - h2.add("鏄惁鏁存敼") - h1.last().colSpan++ - } - } - - //闂鍒嗗竷 - for (i in dataList.indices) { - val subtask = dataList[i] - - val pDis = mutableListOf<Any>()//鍏蜂綋闂鍒嗗竷鍙婃暣鏀规儏鍐� - repeat(h2.size) { pDis.add("")} - if (subtask.stguid != null) { - problemlistMapper.selectByExample(Example(Problemlist::class.java).apply { - createCriteria().andEqualTo("stguid", subtask.stguid) - }).forEach problemType@{ p -> - val des = currentProblemType[p.ptguid] - - //鍏蜂綋闂鍒嗗竷 - for (t in h2.indices) { - if (des == h2[t]) { - //鍏蜂綋闂杩欎竴鍒楁坊鍔犳枃鏈紝琛ㄧず闂瀛樺湪 - pDis[t] = 1 - //闂鍒楃殑涓嬩竴鍒楁槸璇ラ棶棰樼殑鏁存敼鎯呭喌 - pDis[t + 1] = if (p.ischanged == true) 1 else 0 - break - } - } - } - } - - contents[i].addAll(pDis) - } - - //鍘熸湁鐨勭涓�琛岃〃澶村鍔�1琛岃璺ㄥ害,鍚屾椂鏂扮殑绗簩琛岃〃澶存坊鍔犵┖浣� - head[0].forEach { - (it as ExcelUtil.MyCell).rowSpan++ -// h2.add(0, "") - } - //鍚堝苟琛ㄥご - head[0].addAll(h1) - head.add(h2) - } - - // 琛ㄥご锛氬贰鏌ユ儏鍐靛強闂銆佹暣鏀圭粺璁� - private fun getInspectionInfo(head: MutableList<MutableList<Any>>, contents: MutableList<MutableList<Any>>, dataList: List<Subtask>, config: ExcelConfigVo) { - val h1 = listOf("鐩戠鏃堕棿", "闂绫诲瀷", "闂鎻忚堪", "闂浣嶇疆", "闂鏁�", "鏁存敼鎯呭喌", "鏁存敼闂", "鏁存敼鏁�", "鏈暣鏀归棶棰�", "鏈暣鏀规暟", "瀹℃牳鎯呭喌") - - for (i in dataList.indices) { - val subtask = dataList[i] - - val row = mutableListOf<Any>() - if (subtask.stguid == null) { - repeat(h1.size) { row.add("")} - } else { - row.apply { - // 琛ㄥご锛氬贰鏌ユ儏鍐靛強闂銆佹暣鏀圭粺璁� - add(dateUtil.DateToString(subtask.planstarttime, DateUtil.DateStyle.MM_DD) ?: "")//鐩戠鏃堕棿 - //鏌ヨ瀛愪换鍔″搴旂殑闂锛屽苟涓旀牴鎹潯浠惰繘琛岀瓫閫� - var y = 1 - var pType = ""//闂绫诲瀷 - var pDes = ""//闂鎻忚堪 - var pLoc = ""//闂浣嶇疆 - var pNum = 0//闂鏁� - var pChanged = ""//鏁存敼鎯呭喌 - var changedProblem = ""//鏁存敼闂 - var cNum = 0//鏁存敼鏁� - var unChangedProblem = ""//鏈暣鏀归棶棰� - var unChangeNum = 0//鏈暣鏀规暟 - var checkStatus = ""//瀹℃牳鎯呭喌 - problemlistMapper.selectByExample(Example(Problemlist::class.java).apply { - createCriteria().andEqualTo("stguid", subtask.stguid) - }).forEach problemType@{ p -> - val problemType = problemtypeMapper.selectByPrimaryKey(p.ptguid) - val typeName = if (problemType == null) { - val a = "" - a - } else { - problemType.typename - } - val lr = if (y > 1) "\n" else "" - //宸℃煡鎯呭喌鍙婇棶棰樸�佹暣鏀圭粺璁� - pType += "${lr}$y銆�${typeName}" - pDes += "${lr}$y銆�${p.problemname}" - pLoc += "${lr}$y銆�${p.location}" - pNum++ - pChanged += "${lr}$y銆�${if (p.ischanged == true) "鉁�" else "脳"}" - if (p.ischanged == true) { - if (changedProblem.isNotBlank()) { - changedProblem += "\n" - } - changedProblem += "$y銆�${p.problemname}" - cNum++ - } else { - if (unChangedProblem.isNotBlank()) { - unChangedProblem += "\n" - } - unChangedProblem += "$y銆�${p.problemname}" - unChangeNum++ - } - val status = when (p.extension3) { - Constant.PROBLEM_CHECK_PASS -> "闂瀹℃牳閫氳繃"// - Constant.PROBLEM_CHECK_FAIL -> "闂瀹℃牳鏈�氳繃"// - Constant.PROBLEM_UNCHECKED -> "闂鏈鏍�"// - Constant.CHANGE_UNCHECKED -> "鏁存敼鏈鏍�"// - Constant.CHANGE_CHECK_PASS -> "鏁存敼瀹℃牳閫氳繃"// - Constant.CHANGE_CHECK_FAIL -> "鏁存敼瀹℃牳鏈�氳繃"// - else -> "闂鏈鏍�" - } - checkStatus += "${lr}$y銆�${status}" - y++ - } - addAll(listOf(pType, pDes, pLoc, pNum, pChanged, changedProblem, cNum, unChangedProblem, unChangeNum, checkStatus)) - } - } - - contents[i].addAll(row) - } - - head[0].addAll(h1) - } - - - - private fun getTableTitles(sceneType: Int?, districtCode: String?): List<String> { - if (sceneType == null || districtCode == null) return emptyList() - val heads = mutableListOf<String>() - heads.run { - addAll(getSceneName()) - addAll(getLocation()) - addAll(getBaseInfo(sceneType)) - addAll(getContactInfo(sceneType)) - addAll(getRealTimeStatus(sceneType)) - addAll(getInspectionInfo(sceneType)) - addAll(getProblemDistribution(sceneType, districtCode)) - } - - return heads - } - - // 琛ㄥご锛氬満鏅悕 - private fun getSceneName() = listOf("琛ㄥ崟缂栧彿", "鍞竴搴忓彿", "鍦烘櫙鍚嶇О") - - // 琛ㄥご锛氬満鏅湴鐞嗕綅缃� - private fun getLocation(): List<String> = listOf( - "琛楅晣", "鍦板潃" - ) - - // 琛ㄥご锛氬満鏅笓灞炲熀纭�淇℃伅 - private fun getBaseInfo(sceneType: Int): List<String> = when (sceneType.toString()) { - Constant.ScenseType.TYPE1.value -> listOf("涓氫富鍗曚綅", "鏂藉伐鍗曚綅", "寤虹瓚闈㈢Н(m虏)", "鏂藉伐璧峰鏃堕棿", "鏂藉伐缁撴潫鏃堕棿", "鏂藉伐闃舵", "宸ョ▼绫诲瀷") - Constant.ScenseType.TYPE2.value -> listOf("涓氫富鍗曚綅", "绉熻祦鍗曚綅", "鍗犲湴闈㈢Н(m虏)", "钀ヨ繍鐘舵��", "绫诲瀷") - Constant.ScenseType.TYPE3.value -> listOf("涓氫富鍗曚綅", "鏂囨槑鍦虹珯", "缁胯壊鐜繚绔欏巶", "鍗犲湴闈㈢Н(m虏)", "钀ヨ繍鐘舵��") - Constant.ScenseType.TYPE14.value -> listOf("涓氫富鍗曚綅", "绉熻祦鍗曚綅", "鍗犲湴闈㈢Н(m虏)", "钀ヨ繍鐘舵��", "绫诲瀷") - else -> listOf() - } - - // 琛ㄥご锛氬満鏅仈绯绘柟寮� - private fun getContactInfo(sceneType: Int): List<String> = when (sceneType) { - else -> listOf("鑱旂郴浜�", "鑱旂郴鏂瑰紡") - } - - // 琛ㄥご锛氬満鏅幇鍦烘儏鍐� - private fun getRealTimeStatus(sceneType: Int): List<String> = when (sceneType) { - else -> listOf() - } - - // 琛ㄥご锛氬贰鏌ユ儏鍐靛強闂銆佹暣鏀圭粺璁� - private fun getInspectionInfo(sceneType: Int): List<String> = when (sceneType) { - else -> listOf("鐩戠鏃堕棿", "闃叉不鑰冩牳璇勫垎", "闃叉不瑙勮寖鎬�", "鎵e垎椤�","闂绫诲瀷", "闂鎻忚堪", "闂浣嶇疆", "闂鏁�", "鏁存敼鎯呭喌", "鏁存敼鏁�", "瀹℃牳鎯呭喌") - } - - // 琛ㄥご锛氬叿浣撻棶棰樺垎甯� - private val currentProblemType = mutableMapOf<String, String>() - private val currentProblemHead = mutableListOf<String>() - private fun getProblemDistribution(sceneType: Int, districtCode: String): List<String> { - val heads = mutableListOf<String>() - currentProblemType.clear() - currentProblemHead.clear() - - problemtypeMapper.selectByExample(Example(Problemtype::class.java).apply { - createCriteria().andEqualTo("scensetypeid", sceneType) - .andEqualTo("districtcode", districtCode) - orderBy("typeid") - }).forEach { - if (!heads.contains(it.typename)) { - heads.add(it.typename ?: "") - } - currentProblemType[it.guid ?: ""] = it.typename ?: "" - } - currentProblemHead.addAll(heads) - return heads - } - - - /** - * 鑾峰彇琛ㄦ牸鏁版嵁婧� - */ - private fun getTableDataSource(config: ExcelConfigVo): List<Subtask> { - if (config.sceneType == null) return emptyList() - - val result = mutableListOf<Subtask>() - - //1. 鏌ユ壘鐗瑰畾鐨勫贰鏌ヤ换鍔℃垨鑰呮墍鏈夌殑璁″垝宸℃煡浠诲姟 - var taskSceneIdList = listOf<String>() - val subTaskList = if (config.subTaskIdList?.isNotEmpty() == true || - (config.startTime != null || config.endTime != null) - ) { - subtaskMapper.selectByExample(Example(Subtask::class.java).apply { - createCriteria().apply { - if (config.subTaskIdList?.isNotEmpty() == true) { - andIn("stguid", config.subTaskIdList) - } - config.startTime?.let { andGreaterThanOrEqualTo("planstarttime", it) } - config.endTime?.let { andLessThanOrEqualTo("planendtime", it) } - } - }) - } else { - taskSceneIdList = monitorobjectversionMapper.getSceneByType(config.topTaskGuid, config.sceneType) - subtaskMapper.selectByExample(Example(Subtask::class.java).apply { - createCriteria().andIn("scenseid", taskSceneIdList) - .andEqualTo("tguid", config.topTaskGuid) - }) - } - - if (taskSceneIdList.isNotEmpty()) { - taskSceneIdList.forEach { - var subtask: Subtask? = null - for (s in subTaskList) { - if (s.scenseid == it) { - subtask = s - break - } - } - if (subtask == null) subtask = Subtask().apply { scenseid = it } - result.add(subtask) - } - } else { - result.addAll(subTaskList) - } - - return result - } - - private fun getTableContents(config: ExcelConfigVo, colCounts: Int = 0): List<Array<Any>> { - if (config.sceneType == null) return emptyList() - - //1. 鏌ユ壘鐗瑰畾鐨勫贰鏌ヤ换鍔℃垨鑰呮墍鏈夌殑璁″垝宸℃煡浠诲姟 - var taskSceneIdList = listOf<String>() - val subTaskList = if (config.subTaskIdList?.isNotEmpty() == true || - (config.startTime != null || config.endTime != null) - ) { - subtaskMapper.selectByExample(Example(Subtask::class.java).apply { - createCriteria().apply { - if (config.subTaskIdList?.isNotEmpty() == true) { - andIn("stguid", config.subTaskIdList) - } - config.startTime?.let { andGreaterThanOrEqualTo("planstarttime", it) } - config.endTime?.let { andLessThanOrEqualTo("planendtime", it) } - } - }) - } else { - taskSceneIdList = monitorobjectversionMapper.getSceneByType(config.topTaskGuid, config.sceneType) - subtaskMapper.selectByExample(Example(Subtask::class.java).apply { - createCriteria().andIn("scenseid", taskSceneIdList) - .andEqualTo("tguid", config.topTaskGuid) - }) - } - - val contents = mutableListOf<Array<Any>>() - val subTasks = mutableListOf<Subtask>() - - if (taskSceneIdList.isNotEmpty()) { - taskSceneIdList.forEach { - val rowContent = mutableListOf<Any>() - - var subtask: Subtask? = null - for (s in subTaskList) { - if (s.scenseid == it) { - subtask = s - break - } - } - //璇ュ満鏅湭宸℃煡 - if (subtask == null) { - val scene = scenseMapper.selectByPrimaryKey(it) - rowContent.apply { - add(scene.index?.toString() ?: "") - add(scene.extension2 ?: "") - add(scene.name ?: "") - } - val left = colCounts - getSceneName().size - repeat(left) { - rowContent.add("") - } - } else { - rowContent.addAll(tableContent(subtask)) - } - - contents.add(rowContent.toTypedArray()) - } - } else { - subTaskList.forEach { - val c = tableContent(it) - contents.add(c) - } - } - - return contents - } - - private fun tableContent(subtask: Subtask): Array<Any> { - - val row = mutableListOf<Any>() - //鏌ヨ璇ヤ换鍔″搴旂殑鍦烘櫙 - val scene = scenseMapper.selectByPrimaryKey(subtask.scenseid) - - row.apply { - // 琛ㄥご锛氬満鏅悕 - add(scene.index?.toString() ?: "") - add(scene.extension2 ?: "") - add(scene.name ?: "") - // 琛ㄥご锛氬満鏅湴鐞嗕綅缃� - add(scene.townname ?: "") - add(scene.location ?: "") - // 琛ㄥご锛氬満鏅笓灞炲熀纭�淇℃伅 - addAll(when (scene.typeid.toString()) { - Constant.ScenseType.TYPE1.value -> { -// listOf("涓氫富鍗曚綅", "鏂藉伐鍗曚綅", "寤虹瓚闈㈢Н(m虏)", "鏂藉伐璧峰鏃堕棿", "鏂藉伐缁撴潫鏃堕棿", "鏂藉伐闃舵", "宸ョ▼绫诲瀷") - var r = listOf("-", "-", "-", "-", "-", "-", "-") - sceneConstructionSiteMapper.selectByPrimaryKey(scene.guid)?.let { - r = listOf(it.csEmployerUnit?:"", it.csConstructionUnit?:"", it.csFloorSpace?:"", - it.csStartTime?:"", it.csEndTime?:"", it.csStatus?:"", it.csProjectType?:"") - } - r - } - Constant.ScenseType.TYPE2.value -> { -// listOf("涓氫富鍗曚綅", "绉熻祦鍗曚綅", "鍗犲湴闈㈢Н(m虏)", "钀ヨ繍鐘舵��", "绫诲瀷") - var r = listOf("-", "-", "-", "-", "-") - sceneWharfMapper.selectByPrimaryKey(scene.guid)?.let { - r = listOf(it.getwEmployerUnit()?:"", it.getwRentUnit()?:"", it.getwFloorSpace()?:"", it.getwStatus()?:"", - it.getwProjectType()?:"") - } - r - } - Constant.ScenseType.TYPE3.value -> { -// listOf("涓氫富鍗曚綅", "鏂囨槑鍦虹珯", "缁胯壊鐜繚绔欏巶", "鍗犲湴闈㈢Н(m虏)", "钀ヨ繍鐘舵��") - var r = listOf("-", "-", "-", "-", "-") - sceneMixingPlantMapper.selectByPrimaryKey(scene.guid)?.let { - r = listOf( - it.mpEmployerUnit?:"", if (it.mpCivillyPlant == true) "鏄�" else "鍚�", if (it.mpGreenPlant == true) "鏄�" else "鍚�", - it.mpFloorSpace?:"", it.mpStatus?:"" - ) - } - r - } - Constant.ScenseType.TYPE14.value -> { -// listOf("涓氫富鍗曚綅", "绉熻祦鍗曚綅", "鍗犲湴闈㈢Н(m虏)", "钀ヨ繍鐘舵��", "绫诲瀷") - var r = listOf("-", "-", "-", "-", "-") - sceneStorageYardMapper.selectByPrimaryKey(scene.guid)?.let { - r = listOf(it.syEmployerUnit?:"", it.syRentUnit?:"", it.syFloorSpace?:"", it.syStatus?:"", it.syProjectType?:"") - } - r - } - else -> listOf() - }) - // 琛ㄥご锛氬満鏅仈绯绘柟寮� - add(scene.contacts ?: "") - add(scene.contactst ?: "") - // 琛ㄥご锛氬満鏅幇鍦烘儏鍐� - // TODO: 2022/7/10 鏆傛棤 - // 琛ㄥご锛氬贰鏌ユ儏鍐靛強闂銆佹暣鏀圭粺璁� 鍜� 琛ㄥご锛氬叿浣撻棶棰樺垎甯� - listOf("鐩戠鏃堕棿", "闃叉不鑰冩牳璇勫垎", "闃叉不瑙勮寖鎬�", "鎵e垎椤�","闂绫诲瀷", "闂鎻忚堪", "闂浣嶇疆", "闂鏁�", "鏁存敼鎯呭喌", "鏁存敼鏁�", "瀹℃牳鎯呭喌") - add(dateUtil.DateToString(subtask.planstarttime, DateUtil.DateStyle.MM_DD) ?: "") - add("") - add("") - add("") - //鏌ヨ瀛愪换鍔″搴旂殑闂锛屽苟涓旀牴鎹潯浠惰繘琛岀瓫閫� - var y = 1 - var pType = ""//闂绫诲瀷 - var pDes = ""//闂鎻忚堪 - var pLoc = ""//闂浣嶇疆 - var pNum = 0//闂鏁� - var pChanged = ""//鏁存敼鎯呭喌 - var cNum = 0//鏁存敼鏁� - var checkStatus = ""//瀹℃牳鎯呭喌 - var pDis = mutableListOf<String>()//鍏蜂綋闂鍒嗗竷 - repeat(currentProblemHead.size) { pDis.add("")} - problemlistMapper.selectByExample(Example(Problemlist::class.java).apply { - createCriteria().andEqualTo("stguid", subtask.stguid) - }).forEach problemType@{ p -> - val typeName = currentProblemType[p.ptguid] - val lr = if (y > 1) "\n" else "" - //宸℃煡鎯呭喌鍙婇棶棰樸�佹暣鏀圭粺璁� - pType += "${lr}$y銆�${typeName}" - pDes += "${lr}$y銆�${p.problemname}" - pLoc += "${lr}$y銆�${p.location}" - pNum++ - pChanged += "${lr}$y銆�${if (p.ischanged == true) "鉁�" else "脳"}" - if (p.ischanged == true) cNum++ - val status = when (p.extension3) { - Constant.PROBLEM_CHECK_PASS -> "闂瀹℃牳閫氳繃"// - Constant.PROBLEM_CHECK_FAIL -> "闂瀹℃牳鏈�氳繃"// - Constant.PROBLEM_UNCHECKED -> "闂鏈鏍�"// - Constant.CHANGE_UNCHECKED -> "鏁存敼鏈鏍�"// - Constant.CHANGE_CHECK_PASS -> "鏁存敼瀹℃牳閫氳繃"// - Constant.CHANGE_CHECK_FAIL -> "鏁存敼瀹℃牳鏈�氳繃"// - else -> "闂鏈鏍�" - } - checkStatus += "${lr}$y銆�${status}" - y++ - - //鍏蜂綋闂鍒嗗竷 - for (t in currentProblemHead.indices) { - if (typeName == currentProblemHead[t]) { - pDis[t] = if (p.ischanged == true) "1" else "0" - break - } - } - } - addAll(listOf(pType, pDes, pLoc, pNum, pChanged, cNum, checkStatus)) - addAll(pDis) - } - - return row.toTypedArray() + return BaseTableVo(result.first, result.second) } } \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/SubtaskServiceImpl.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/SubtaskServiceImpl.kt index b4118b8..78b73e7 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/SubtaskServiceImpl.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/SubtaskServiceImpl.kt @@ -1,10 +1,7 @@ package cn.flightfeather.supervision.lightshare.service.impl -import cn.flightfeather.supervision.business.AutoScore -import cn.flightfeather.supervision.business.AutoScore2 import cn.flightfeather.supervision.business.storage.StAutoScore -import cn.flightfeather.supervision.business.storage.item.StScoreItem_1 -import cn.flightfeather.supervision.business.storage.item.StScoreItem_2 +import cn.flightfeather.supervision.business.storage.item.* import cn.flightfeather.supervision.domain.ds1.entity.* import cn.flightfeather.supervision.domain.ds1.mapper.* import cn.flightfeather.supervision.common.utils.Constant @@ -23,14 +20,21 @@ import java.util.* @Service -class SubtaskServiceImpl(val subtaskMapper: SubtaskMapper) : SubtaskService { +class SubtaskServiceImpl( + private val subtaskMapper: SubtaskMapper, + private val mpScoreItem_1: MpScoreItem_1, + private val mpScoreItem_2: MpScoreItem_2, + private val stScoreItem_1: StScoreItem_1, + private val whScoreItem_1: WhScoreItem_1, + private val whScoreItem_2: WhScoreItem_2, +) : SubtaskService { val dateUtil = DateUtil() @Autowired - lateinit var scoreItem1: StScoreItem_1 + lateinit var scoreItem1: CsScoreItem_1 @Autowired - lateinit var scoreItem2: StScoreItem_2 + lateinit var scoreItem2: CsScoreItem_2 @Autowired lateinit var taskService: TaskService @Autowired @@ -482,7 +486,7 @@ // autoScore.calculateScore() // } val s = scenseMapper.selectByPrimaryKey(subtask.scenseid) - val autoScore = StAutoScore(scoreItem1, scoreItem2) + val autoScore = StAutoScore(scoreItem1, scoreItem2, mpScoreItem_1, mpScoreItem_2, stScoreItem_1, whScoreItem_1, whScoreItem_2) autoScore.sceneType = Constant.ScenseType.getByValue(s.typeid?.toString()) autoScore.sceneGrade(subtask) } diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/UserinfoServiceImpl.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/UserinfoServiceImpl.kt index bf8a593..7459669 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/UserinfoServiceImpl.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/UserinfoServiceImpl.kt @@ -44,7 +44,13 @@ override fun save(userinfo: Userinfo): Int = userinfoMapper.insert(userinfo) - override fun update(userinfo: Userinfo): Int = userinfoMapper.updateByPrimaryKey(userinfo) + override fun update(userinfo: Userinfo): Int { + return if (userinfo.guid.isNullOrBlank() || userinfo.acountname.isNullOrBlank() || userinfo.password.isNullOrBlank()) { + 0 + } else { + userinfoMapper.updateByPrimaryKeySelective(userinfo) + } + } override fun delete(id: String): Int = userinfoMapper.deleteByPrimaryKey(id) @@ -98,6 +104,7 @@ } i++ } while (repeated && i < 20) + if (repeated) uName = UUIDGenerator.generateShortUUID() return uName } diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/BaseTableVo.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/BaseTableVo.kt new file mode 100644 index 0000000..77ca53b --- /dev/null +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/BaseTableVo.kt @@ -0,0 +1,10 @@ +package cn.flightfeather.supervision.lightshare.vo + +/** + * @author riku + * Date: 2020/7/27 + */ +data class BaseTableVo( + val tableTitle: List<Array<Any>>, + val tableContent: List<Array<Any>> +) \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/ExcelConfigVo.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/ExcelConfigVo.kt index 1d04f57..c3fdc6a 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/ExcelConfigVo.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/ExcelConfigVo.kt @@ -8,7 +8,7 @@ * 瀵煎嚭宸℃煡浠诲姟excel鏂囦欢 鏉′欢绫� */ data class ExcelConfigVo( - val topTaskGuid: String, + var topTaskGuid: String = "", val startTime: Date? = null, val endTime: Date? = null, @@ -18,7 +18,7 @@ val districtCode: String? = null, val townCode: String? = null, - val sceneType: Int? = null, + var sceneType: Int? = null, val subTaskIdList: List<String>? = null, diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/SearchController.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/SearchController.kt index 731bee0..ccd526c 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/SearchController.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/SearchController.kt @@ -66,6 +66,7 @@ @RequestParam("per_page", required = false) perPage: Int? ) = subtaskService.searchSubTask3(token, updateTime, sceneType, districtCode, startTime, endTime, page, perPage) + @ApiOperation(value = "鑾峰彇宸℃煡浠诲姟缁熻鎶ュ憡") @PostMapping("/subtask/excel") fun getExcel( @RequestBody config: ExcelConfigVo, @@ -98,4 +99,9 @@ @RequestParam("page") page: Int, @RequestParam("perPage") perPage: Int ) = searchService.searchSubTaskByKeyword(userId, keyword, page, perPage) + + @PostMapping("/dailyreport") + fun getDailyReport( + @RequestBody config: ExcelConfigVo + ) = searchService.getDailyReport(config) } \ No newline at end of file diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 2140918..b61c152 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -14,14 +14,14 @@ # password: cn.FLIGHTFEATHER #-杩滅▼娴嬭瘯鏈嶅姟鍣�- - url: jdbc:mysql://47.100.191.150:3306/supervision?serverTimezone=Asia/Shanghai&prepStmtCacheSize=517&cachePrepStmts=true&autoReconnect=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false - username: remoteU1 - password: eSoF8DnzfGTlhAjE +# url: jdbc:mysql://47.100.191.150:3306/supervision?serverTimezone=Asia/Shanghai&prepStmtCacheSize=517&cachePrepStmts=true&autoReconnect=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false +# username: remoteU1 +# password: eSoF8DnzfGTlhAjE #-鍙戝竷鏈嶅姟鍣�- -# url: jdbc:mysql://localhost:3306/supervision?serverTimezone=Asia/Shanghai&prepStmtCacheSize=517&cachePrepStmts=true&autoReconnect=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false -# username: supervision -# password: supervision_feiyu2021 + url: jdbc:mysql://localhost:3306/supervision?serverTimezone=Asia/Shanghai&prepStmtCacheSize=517&cachePrepStmts=true&autoReconnect=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false + username: supervision + password: supervision_feiyu2021 #-鐜鐫e療娴嬭瘯鏈嶅姟鍣�- # url: jdbc:mysql://192.168.0.200:3306/supervision_ii?serverTimezone=Asia/Shanghai&prepStmtCacheSize=517&cachePrepStmts=true&autoReconnect=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false diff --git a/src/main/resources/mapper/ds1/MonitorobjectversionMapper.xml b/src/main/resources/mapper/ds1/MonitorobjectversionMapper.xml index 8418639..f831319 100644 --- a/src/main/resources/mapper/ds1/MonitorobjectversionMapper.xml +++ b/src/main/resources/mapper/ds1/MonitorobjectversionMapper.xml @@ -39,7 +39,10 @@ from sm_t_monitorobjectversion as a left join sm_t_scense as b on a.S_GUID = b.S_GUID - where a.T_ID = #{param1} and b.S_TypeID = #{param2} + where a.T_ID = #{param1} + <if test="param2 != null"> + and b.S_TypeID = #{param2} + </if> <if test="param3 != null"> and b.S_TownCode = #{param3} </if> diff --git a/src/test/kotlin/cn/flightfeather/supervision/business/fume/AutoScoreTest.kt b/src/test/kotlin/cn/flightfeather/supervision/business/fume/AutoScoreTest.kt index c42de37..0214e92 100644 --- a/src/test/kotlin/cn/flightfeather/supervision/business/fume/AutoScoreTest.kt +++ b/src/test/kotlin/cn/flightfeather/supervision/business/fume/AutoScoreTest.kt @@ -38,15 +38,18 @@ @Test fun go() { - val s = "abcdefg" - val t = s.substring(0, s.length - 2) - println(t) +// val s = "abcdefg" +// val t = s.substring(0, s.length - 2) +// println(t) + // autoScore.sceneType = Constant.ScenseType.TYPE1 // autoScore.topTaskGrade("8QN1VzftuhBJmrF8") // val subtask = subtaskMapper.selectByPrimaryKey("OPmza2ddEAKiQHqz") // autoScore.sceneGrade(subtask) // autoScore.sceneGradeToFile(subtask) -// autoScore3.go(2022, 1, 2) + + autoScore3.go(2022, 9, 1) + // val t = problemlistMapper.getStatisticalResult("310116", "2021-09-01 00:00:00", "2021-09-30 00:00:00", "1") // println() diff --git a/src/test/kotlin/cn/flightfeather/supervision/lightshare/service/impl/EvaluationServiceImplTest.kt b/src/test/kotlin/cn/flightfeather/supervision/lightshare/service/impl/EvaluationServiceImplTest.kt new file mode 100644 index 0000000..b5a32b8 --- /dev/null +++ b/src/test/kotlin/cn/flightfeather/supervision/lightshare/service/impl/EvaluationServiceImplTest.kt @@ -0,0 +1,25 @@ +package cn.flightfeather.supervision.lightshare.service.impl + +import cn.flightfeather.supervision.lightshare.service.EvaluationService +import org.junit.Test +import org.junit.jupiter.api.Assertions.* +import org.junit.jupiter.api.extension.ExtendWith +import org.junit.runner.RunWith +import org.springframework.beans.factory.annotation.Autowired +import org.springframework.boot.test.context.SpringBootTest +import org.springframework.test.context.junit.jupiter.SpringExtension +import org.springframework.test.context.junit4.SpringRunner + +@RunWith(SpringRunner::class) +@ExtendWith(SpringExtension::class) +@SpringBootTest +class EvaluationServiceImplTest { + + @Autowired + lateinit var evaluationService: EvaluationService + + @Test + fun foo1() { + evaluationService.autoScore3("Xx4FKxdic2lzaZJl", "2") + } +} \ No newline at end of file diff --git a/src/test/kotlin/cn/flightfeather/supervision/lightshare/service/impl/SearchServiceImplTest.kt b/src/test/kotlin/cn/flightfeather/supervision/lightshare/service/impl/SearchServiceImplTest.kt index 087dd7a..fce4cef 100644 --- a/src/test/kotlin/cn/flightfeather/supervision/lightshare/service/impl/SearchServiceImplTest.kt +++ b/src/test/kotlin/cn/flightfeather/supervision/lightshare/service/impl/SearchServiceImplTest.kt @@ -1,6 +1,8 @@ package cn.flightfeather.supervision.lightshare.service.impl import cn.flightfeather.supervision.SupervisionApplication +import cn.flightfeather.supervision.domain.ds1.entity.Subtask +import cn.flightfeather.supervision.domain.ds1.mapper.SubtaskMapper import cn.flightfeather.supervision.lightshare.service.SearchService import cn.flightfeather.supervision.lightshare.vo.ExcelConfigVo import org.junit.Test @@ -12,6 +14,7 @@ import org.springframework.test.context.junit.jupiter.SpringExtension import org.springframework.test.context.junit4.SpringJUnit4ClassRunner import org.springframework.test.context.junit4.SpringRunner +import tk.mybatis.mapper.entity.Example import java.time.LocalDateTime import java.time.ZoneId import java.util.* @@ -24,6 +27,9 @@ @Autowired lateinit var searchService: SearchService + @Autowired + lateinit var subtaskMapper: SubtaskMapper + @Test fun getExcel() { val localTimeS = LocalDateTime.of(2021, 3, 1, 0, 0, 0) @@ -34,11 +40,47 @@ val mode = 8 //閲戝北2022骞�6鏈� searchService.writeToFile(ExcelConfigVo( - "tgfMJWdUJqWE6bWo", - districtCode = "310116", + "udXAWrrRbM2MvZ5u", + districtCode = "310106", // townCode = "310116113", sceneType = 1), mode) //閲戝北2021骞�3鏈� // searchService.writeToFile(ExcelConfigVo("o7jdSzr79fe0NH3I", districtCode = "310116", sceneType = 1)) } + + @Test + fun getDailyReport() { + val cal = Calendar.getInstance() + cal.set(2022, 10, 2, 0, 0, 0) + cal.set(Calendar.MILLISECOND, 0) + val sDate = cal.time + cal.add(Calendar.DAY_OF_MONTH, 1) + val eDate = cal.time + val r = searchService.getDailyReport(ExcelConfigVo(districtCode = "310116", startTime = sDate, endTime = eDate)) + println(r) + } + + @Test + fun foo1() { + val cal = Calendar.getInstance() + cal.set(2022, 10, 2, 0, 0, 0) + cal.set(Calendar.MILLISECOND, 0) + val sDate = cal.time + cal.add(Calendar.DAY_OF_MONTH, 1) + val eDate = cal.time + val config = ExcelConfigVo(districtCode = "310116", startTime = sDate, endTime = eDate) + + val r = subtaskMapper.selectByExample(Example(Subtask::class.java).apply { + createCriteria().apply { + if (config.subTaskIdList?.isNotEmpty() == true) { + andIn("stguid", config.subTaskIdList) + } + config.startTime?.let { andEqualTo("planstarttime", it) } +// config.endTime?.let { andLessThanOrEqualTo("planendtime", it) } + config.districtCode?.let { andEqualTo("districtcode", it) } +// andEqualTo("tguid", config.topTaskGuid) + } + }) + println(r) + } } \ No newline at end of file -- Gitblit v1.9.3