feiyu02
2022-07-28 e844ef2fdab88508e7dff4bb9e7b1632fcce15b2
1. 巡查统计清单调试
已修改11个文件
161 ■■■■ 文件已修改
src/main/kotlin/cn/flightfeather/supervision/business/report/DataSource.kt 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColLedger.kt 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColStrategy.kt 45 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/business/report/template/ProAnalysisSummary.kt 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/business/report/template/ProDetailSummary.kt 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/business/report/template/ScoreDetailSummary.kt 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/datafetch/FetchNightConstruction.kt 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/SubtaskServiceImpl.kt 24 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/application.yml 24 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/test/kotlin/cn/flightfeather/supervision/business/fume/AutoScoreTest.kt 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/test/kotlin/cn/flightfeather/supervision/lightshare/service/impl/SearchServiceImplTest.kt 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/business/report/DataSource.kt
@@ -14,6 +14,7 @@
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.stereotype.Component
import tk.mybatis.mapper.entity.Example
import java.time.Duration
import java.time.LocalDateTime
import java.time.ZoneId
import javax.annotation.PostConstruct
@@ -332,6 +333,26 @@
        private var _ledgerRecordNum: List<LedgerRecord>? = null
        /**
         * 获取当前巡查任务的上期巡查记录
         */
        fun lastOne(): RowData {
            val last = RowData()
            val r = dbMapper.subtaskMapper.selectByExample(Example(Subtask::class.java).apply {
                createCriteria().andEqualTo("scenseid", subTask?.scenseid)
                    .andLessThan("planstarttime", subTask?.planstarttime)
                orderBy("planstarttime").desc()
            })
            if (r.isNotEmpty()) {
                val thisMonth = LocalDateTime.ofInstant(subTask?.planstarttime?.toInstant(), ZoneId.systemDefault()).withDayOfMonth(1).toLocalDate()
                val lastMonth = LocalDateTime.ofInstant(r[0]?.planstarttime?.toInstant(), ZoneId.systemDefault()).withDayOfMonth(1).toLocalDate()
                if (lastMonth.plusMonths(1).isEqual(thisMonth)) {
                    last.subTask = r[0]
                }
            }
            return last
        }
        /**
         * 清空当前处理的对象的相关数据源
         */
        fun clear() {
src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColLedger.kt
@@ -4,7 +4,11 @@
import cn.flightfeather.supervision.business.report.DataSource
import cn.flightfeather.supervision.common.utils.DateUtil
import cn.flightfeather.supervision.common.utils.ExcelUtil
import kotlin.math.round
import java.time.LocalDateTime
import java.time.ZoneId
import java.time.format.DateTimeFormatter
import java.util.*
import kotlin.random.Random
class ColLedger : BaseCols() {
    override fun onHeads(dataSource: DataSource): MutableList<MutableList<ExcelUtil.MyCell>> {
@@ -26,6 +30,9 @@
        if (rowData.ledgerRecords.isNotEmpty()) {
            val r = rowData.ledgerRecords[0]
            t1 = "${dateUtil.DateToString(r.lrSubmitdate, DateUtil.DateStyle.YYYY_MM_DD_HH_MM_CN)}"
            val random = Random(Date().time).nextLong(0, 6)
            val checkTime = LocalDateTime.ofInstant(r.lrSubmitdate.toInstant(), ZoneId.systemDefault()).plusDays(random)
            t2 = checkTime.format(DateTimeFormatter.ofPattern("yyyy年MM月dd日"))
        }
        return listOf(ExcelUtil.MyCell(per.toString(), isPercent = true), t1, t2)
    }
src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColStrategy.kt
@@ -7,6 +7,7 @@
import java.time.Duration
import java.time.LocalDateTime
import java.time.ZoneId
import java.time.temporal.ChronoUnit
class ColStrategy : BaseCols() {
    override fun onHeads(dataSource: DataSource): MutableList<MutableList<ExcelUtil.MyCell>> {
@@ -16,7 +17,7 @@
    }
    override fun onOneRow(rowData: DataSource.RowData): List<Any> {
        if (rowData.problems.isEmpty()) return listOf("")
        if (rowData.noRecord()) return listOf("")
        val strategyList = listOf(
            "1、存在问题超期3天不满7天未整改,由系统推送整改提醒;",
@@ -40,29 +41,32 @@
                continue
            }
            val pTime = LocalDateTime.ofInstant(p.time?.toInstant(), ZoneId.systemDefault())
            val duration = Duration.between(pTime.toLocalDate(), now)
            val day = duration.toDays()
            val day = pTime.toLocalDate().until(now.toLocalDate(), ChronoUnit.DAYS)
            when {
                //1、存在问题超期3天不满7天未整改,由系统推送整改提醒;
                day in 3..6 -> {
                    result += strategyList[0] + "\n"
                    break
                }
                //2、存在问题超期7天未整改,由技术服务部线上督促;
                day > 6 -> {
                    result += strategyList[1] + "\n"
                    break
                }
            }
        }
        //3、巡查后10天或月末前3天,问题整改率低于50%,由数据应用部一对一督促,并于主管部门联动;
        //整改率
        val cPer = cPros.toDouble() / rowData.problems.size
        //巡查时间
        val sTime = LocalDateTime.ofInstant(rowData.subTask?.planstarttime?.toInstant(), ZoneId.systemDefault())
        val day1 = Duration.between(sTime.toLocalDate(), now).toDays()
        val day1 = sTime.toLocalDate().until(now.toLocalDate(), ChronoUnit.DAYS)
        val lastDayOfMon = now.plusMonths(1).withDayOfMonth(1).minusDays(1)
        val day2 = Duration.between(lastDayOfMon.toLocalDate(), now.toLocalDate()).toDays()
        val day2 = lastDayOfMon.toLocalDate().until(now.toLocalDate(), ChronoUnit.DAYS)
        if (cPer < .5 && (day1 >= 10 || day2 <= 3)) result += strategyList[2] + "\n"
        //4、问题审核或整改审核未开展或问题审核较巡查时间延后24小时以上或问题与整改时间间隔超过一周,项目管理人员应及时开展审核或后续应提升审核时效性;
        //审核
        for (p in rowData.problems) {
            //问题审核或整改审核未开展
@@ -80,7 +84,7 @@
            if (p.changedtime != null) {
                val ct = LocalDateTime.ofInstant(p.changedtime?.toInstant(), ZoneId.systemDefault())
                val pt = LocalDateTime.ofInstant(p.time?.toInstant(), ZoneId.systemDefault())
                if (Duration.between(pt.toLocalDate(), ct.toLocalDate()).toDays() > 7) {
                if (pt.toLocalDate().until(ct.toLocalDate(), ChronoUnit.DAYS) > 7) {
                    result += strategyList[3] + "\n"
                    break
                }
@@ -89,21 +93,46 @@
        }
        //5、台账未按时提交,由技术服务部一对一督促;
        //台账
        val rNum = rowData.ledgerRecords.size
        if (rNum == 0) result += strategyList[4] + "\n"
        //6、台账已部分提交,提交比例不足100%的,由数据应用部一对一督促;
        if (rNum != 0 && rNum < rowData.ledgerCount) result += strategyList[5] + "\n"
        //7、当月问题数超3个且全部未整改或连续两月问题整改率低于50%的场景,列为重点监管,由技术服务部当月增加不少于一次现场复核;
        val lastMonData = rowData.lastOne()
        if (rowData.problems.size > 3 && cPros == 0) {
            result += strategyList[6] + "\n"
        } else if (cPer < .5) {
            if (!lastMonData.noRecord()) {
                var lastCPer = 0
                lastMonData.problems.forEach {
                    if (it.ischanged == true) {
                        lastCPer++
                    }
                }
                if (lastMonData.problems.size != 0 && (lastCPer.toDouble() / lastMonData.problems.size > .5)) {
                    result += strategyList[6] + "\n"
                }
            }
        }
        //8、连续两月台账提交比例低于50%的,由技术服务部当月增加一次现场或线上操作指导;
        val thisMonLedgerPer = rowData.ledgerRecords.size.toDouble() / rowData.ledgerCount
        if (thisMonLedgerPer < .5) {
            val lastMonLedgerPer = lastMonData.ledgerRecords.size.toDouble() / lastMonData.ledgerCount
            if (lastMonLedgerPer < .5) {
                result += strategyList[7] + "\n"
            }
        }
        //9、台账审核较提交时间延后5日以上或月末前3日仍未审核的,由数据应用部及时开展;
        // TODO: 2022/7/26
        return strategyList
        if (result.isNotEmpty()) {
            result = result.substring(0, result.length - 2)
        }
        return listOf(result)
    }
}
src/main/kotlin/cn/flightfeather/supervision/business/report/template/ProAnalysisSummary.kt
@@ -4,6 +4,7 @@
import cn.flightfeather.supervision.business.report.BaseTemplate
import cn.flightfeather.supervision.business.report.DataSource
import cn.flightfeather.supervision.business.report.cols.ColInspectionInfo
import cn.flightfeather.supervision.business.report.cols.ColStrategy
import cn.flightfeather.supervision.business.report.cols.ColTotalGrade
import cn.flightfeather.supervision.common.utils.Constant
import cn.flightfeather.supervision.common.utils.ExcelUtil
@@ -17,7 +18,7 @@
 * 分街镇问题整改分析汇总表
 */
class ProAnalysisSummary(dataSource: DataSource) : BaseTemplate(dataSource) {
    override val cols: List<BaseCols> = listOf(ColInspectionInfo(), ColTotalGrade())
    override val cols: List<BaseCols> = listOf(ColInspectionInfo(), ColTotalGrade(), ColStrategy())
    override val templateName: String = "分街镇问题整改分析汇总表"
@@ -33,6 +34,7 @@
            val r = cols[0].getOneRow(rowData)
            val r1 = cols[1].getOneRow(rowData)
//            val r2 = cols[2].getOneRow(rowData)
            val k = rowData.scene?.townname
            if (!districtMap.containsKey(k)) {
@@ -75,9 +77,14 @@
                val standard = r1[1] as ExcelUtil.MyCell
                if (standard.text.contains("不规范")) {
                if (standard.text.contains("严重不规范")) {
                    focusSceneNum++
                }
                //根据监管策略结果判断是否为重点监管对象
//                if (r2[0].toString().contains("7、")) {
//                    focusSceneNum++
//                }
            }
        }
src/main/kotlin/cn/flightfeather/supervision/business/report/template/ProDetailSummary.kt
@@ -6,9 +6,10 @@
import cn.flightfeather.supervision.business.report.cols.ColInspectionInfo
import cn.flightfeather.supervision.business.report.cols.ColLedger
import cn.flightfeather.supervision.business.report.cols.ColSceneName
import cn.flightfeather.supervision.business.report.cols.ColStrategy
class ProDetailSummary(dataSource: DataSource) : BaseTemplate(dataSource) {
    override val cols: List<BaseCols> = listOf(ColSceneName(), ColInspectionInfo(), ColLedger())
    override val cols: List<BaseCols> = listOf(ColSceneName(), ColInspectionInfo(), ColLedger(), ColStrategy())
    override val templateName: String = "问题与整改跟踪汇总表"
}
src/main/kotlin/cn/flightfeather/supervision/business/report/template/ScoreDetailSummary.kt
@@ -3,12 +3,9 @@
import cn.flightfeather.supervision.business.report.BaseCols
import cn.flightfeather.supervision.business.report.BaseTemplate
import cn.flightfeather.supervision.business.report.DataSource
import cn.flightfeather.supervision.business.report.cols.ColItemGrade
import cn.flightfeather.supervision.business.report.cols.ColSceneName
import cn.flightfeather.supervision.business.report.cols.ColTotalGrade
import cn.flightfeather.supervision.business.report.cols.ColTown
import cn.flightfeather.supervision.business.report.cols.*
class ScoreDetailSummary(dataSource: DataSource) : BaseTemplate(dataSource) {
    override val cols: List<BaseCols> = listOf(ColSceneName(), ColTown(), ColTotalGrade(), ColItemGrade())
    override val cols: List<BaseCols> = listOf(ColSceneName(), ColTown(), ColStatus(), ColTotalGrade(), ColItemGrade())
    override val templateName: String = "规范性评估详情表"
}
src/main/kotlin/cn/flightfeather/supervision/datafetch/FetchNightConstruction.kt
@@ -90,7 +90,11 @@
                            nightConstruction.ncSceneId = r.ncSceneId
                        }
                        if (isEmpty()) {
                            try {
                            nightConstructionMapper.insert(nightConstruction)
                            } catch (e: Exception) {
                                e.printStackTrace()
                            }
                        }
                    }
                }
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/SubtaskServiceImpl.kt
@@ -472,17 +472,19 @@
            criteria.andEqualTo("stguid", subtask.stguid)
            val result = evaluationMapper.selectByExample(example)
            if (result.isEmpty()) {
                if (subtask.districtname == "徐汇区") {
                    val autoScore = AutoScore2()
                    autoScore.subtask = subtask
                    autoScore.calculateScore()
                } else {
                    val autoScore = AutoScore()
                    autoScore.subtask = subtask
                    autoScore.calculateScore()
                }
//                val autoScore = StAutoScore(scoreItem1, scoreItem2)
//                autoScore.sceneType = Constant.ScenseType.TYPE1
//                if (subtask.districtname == "徐汇区") {
//                    val autoScore = AutoScore2()
//                    autoScore.subtask = subtask
//                    autoScore.calculateScore()
//                } else {
//                    val autoScore = AutoScore()
//                    autoScore.subtask = subtask
//                    autoScore.calculateScore()
//                }
                val s = scenseMapper.selectByPrimaryKey(subtask.scenseid)
                val autoScore = StAutoScore(scoreItem1, scoreItem2)
                autoScore.sceneType = Constant.ScenseType.getByValue(s.typeid?.toString())
                autoScore.sceneGrade(subtask)
            }
        }
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
@@ -56,14 +56,14 @@
      #-TestEnd-
      #-发布服务器-
      url: jdbc:mysql://localhost:3306/ledger?serverTimezone=Asia/Shanghai&prepStmtCacheSize=517&cachePrepStmts=true&autoReconnect=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false
      username: ledger
      password: ledger_fxxchackxr
#      url: jdbc:mysql://localhost:3306/ledger?serverTimezone=Asia/Shanghai&prepStmtCacheSize=517&cachePrepStmts=true&autoReconnect=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false
#      username: ledger
#      password: ledger_fxxchackxr
      #   开发远程服务器
#      url: jdbc:mysql://47.100.191.150:3306/ledger?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/ledger?serverTimezone=Asia/Shanghai&prepStmtCacheSize=517&cachePrepStmts=true&autoReconnect=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false
      username: remoteU1
      password: eSoF8DnzfGTlhAjE
      initialSize: 5
      minIdle: 5
src/test/kotlin/cn/flightfeather/supervision/business/fume/AutoScoreTest.kt
@@ -38,8 +38,11 @@
    @Test
    fun go() {
        autoScore.sceneType = Constant.ScenseType.TYPE1
        autoScore.topTaskGrade("8QN1VzftuhBJmrF8")
        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)
src/test/kotlin/cn/flightfeather/supervision/lightshare/service/impl/SearchServiceImplTest.kt
@@ -31,11 +31,11 @@
        val sD = Date.from(localTimeS.atZone(ZoneId.systemDefault()).toInstant())
        val eD = Date.from(localTimeE.atZone(ZoneId.systemDefault()).toInstant())
        val mode = 10
        val mode = 8
        //金山2022年6月
        searchService.writeToFile(ExcelConfigVo(
            "8QN1VzftuhBJmrF8",
            districtCode = "310106",
            "tgfMJWdUJqWE6bWo",
            districtCode = "310116",
//            townCode = "310116113",
            sceneType = 1), mode)
        //金山2021年3月