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:\\å·¥ä½\\å¼å\\ç¬¬ä¸æ¹ç管app\\èªå¨è¯å\\é¤é¥®\\$fileName" // val filePath = "C:\\work\\å·¥ä½\\ç¬¬ä¸æ¹ç管\\èªå¨è¯å\\é¤é¥®\\$fileName" // val filePath = "E:\\å·¥ä½\\å¼å\\ç¬¬ä¸æ¹ç管app\\èªå¨è¯å\\é¤é¥®\\$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) 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 } /** 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> src/main/kotlin/cn/flightfeather/supervision/business/report/BaseExcel.kt
@@ -8,6 +8,7 @@ /** * 忍¡æ¿åå¹¶è¾åºä¸ºæ´ä½ææ¡£ * åä¸ªæ°æ®æº */ abstract class BaseExcel(val dataSource: DataSource) { 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() } } 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) } 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) } } //åºå®åç»å //åºæ¬ä¿¡æ¯ //é®é¢æ£ååå¸ 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) } } 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() src/main/kotlin/cn/flightfeather/supervision/business/report/ReportUtil.kt
@@ -4,4 +4,5 @@ * æ¥åçæå·¥å · */ class ReportUtil { } 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 ) ) } 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>() 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("å°è´¦æäº¤ç¾åæ¯"), 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)), 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>() 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 ?: "" ) } } 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 ?: "" ) } } 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("æ½å·¥/è¥è¿ç¶æ"), 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("æ´æ¹è·è¸ªæé") 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>() 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("è¡é/å·¥ä¸åº"))) } 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 = "é®é¢ä¸æ´æ¹åå¸åææ¸ å" } 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 = "æ¥æ¥ç»è®¡" } 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++ // } } } 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>) { //æåé åçmax个é®é¢è¢«è®¤å®ä¸ºä¸»è¦æå ¸åé®é¢ val max = when (dataSource.config.sceneType.toString()) { Constant.ScenseType.TYPE1.value -> 5 else -> 4 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() 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) { } 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 } } } src/main/kotlin/cn/flightfeather/supervision/business/storage/item/CsScoreItem_2.kt
ÎļþÃû´Ó src/main/kotlin/cn/flightfeather/supervision/business/storage/item/StScoreItem_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 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 } } } src/main/kotlin/cn/flightfeather/supervision/business/storage/item/MpScoreItem_2.ktcopy 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
Îļþ´Ó src/main/kotlin/cn/flightfeather/supervision/business/storage/item/StScoreItem_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 = "æ¬å°å¨çº¿çæµæ°æ®é级" 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 = "æ´æ¹æªæ½åææ" 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 } } } src/main/kotlin/cn/flightfeather/supervision/business/storage/item/WhScoreItem_2.ktcopy 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
Îļþ´Ó src/main/kotlin/cn/flightfeather/supervision/business/storage/item/StScoreItem_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 = "æ¬å°å¨çº¿çæµæ°æ®é级" 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() } } } 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> } 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 } 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("ç管æ¶é´", "鲿²»èæ ¸è¯å", "鲿²»è§èæ§", "æ£å项","é®é¢ç±»å", "é®é¢æè¿°", "é®é¢ä½ç½®", "é®é¢æ°", "æ´æ¹æ åµ", "æ´æ¹æ°", "å®¡æ ¸æ åµ") } // 表头ï¼å ·ä½é®é¢åå¸ 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("ç管æ¶é´", "鲿²»èæ ¸è¯å", "鲿²»è§èæ§", "æ£å项","é®é¢ç±»å", "é®é¢æè¿°", "é®é¢ä½ç½®", "é®é¢æ°", "æ´æ¹æ åµ", "æ´æ¹æ°", "å®¡æ ¸æ åµ") 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) } } 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) } 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 } 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>> ) 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, 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) } 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 #-ç¯å¢ç£å¯æµè¯æå¡å¨- # 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 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> 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() 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") } } 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) } }