| | |
| | | */ |
| | | fun areaName(): String { |
| | | val t = dbMapper.taskMapper.selectByPrimaryKey(config.topTaskGuid) |
| | | return "${DateUtil.DateToString(t.starttime, DateUtil.DateStyle.YYYY_MM_CN)}${t.districtname}${if (area != t.districtname) area else ""}${Constant.SceneType.getDes(config.sceneType)}" |
| | | return "${DateUtil.DateToString(config.startTime, DateUtil.DateStyle.YYYY_MM_CN)}${t.districtname}${if (area != t.districtname) area else ""}${Constant.SceneType.getDes(config.sceneType)}" |
| | | } |
| | | |
| | | /** |
| | |
| | | if (area.isBlank()) area = it.districtname ?: "" |
| | | } |
| | | |
| | | // 统计总任务下所有场景 |
| | | if (config.allScene) { |
| | | //1. 查找特定的巡查任务或者所有的计划巡查任务 |
| | | val taskSceneIdList = dbMapper.scenseMapper.getSceneByType(config.topTaskGuid, config.sceneType, |
| | | config.townCode).map { it.guid ?: "" } |
| | | |
| | | // 统计总任务下所有场景 |
| | | if (config.allScene) { |
| | | val subTaskList = dbMapper.subtaskMapper.selectByExample(Example(Subtask::class.java).apply { |
| | | createCriteria().apply { |
| | | if (taskSceneIdList.isNotEmpty()) andIn("scenseid", taskSceneIdList) |
| | |
| | | |
| | | import cn.flightfeather.supervision.domain.ds1.entity.Problemlist |
| | | import cn.flightfeather.supervision.domain.util.MyMapper |
| | | import cn.flightfeather.supervision.lightshare.vo.AreaVo |
| | | import cn.flightfeather.supervision.lightshare.vo.SceneProblemSummary |
| | | import cn.flightfeather.supervision.lightshare.vo.StatisticsVo |
| | | import cn.flightfeather.supervision.lightshare.vo.UnChangedPro |
| | |
| | | |
| | | /** |
| | | * 获取某时间段内、某个区县的某种场景下,各类型的问题数量统计 |
| | | * @param districtCode 区县行政编码 |
| | | * @param startTime 开始时间 |
| | | * @param endTime 结束时间 |
| | | * @param sceneType 场景类型 |
| | | */ |
| | | fun getStatisticalResult( |
| | | districtCode: String?, |
| | | startTime: String?, |
| | | endTime: String?, |
| | | sceneType: String?, |
| | | sceneId: String?, |
| | | ): List<StatisticsVo> |
| | | fun getStatisticalResult(areaVo: AreaVo): List<StatisticsVo> |
| | | |
| | | fun getStatisticalResultById(topTaskId: String?, sceneTypeId: String?): List<Map<String, JvmType.Object>> |
| | | |
| | |
| | | fun getUnChangedProblem(deadLine: String): List<UnChangedPro> |
| | | |
| | | /** |
| | | * 获取总任务 |
| | | * 获取场景问题统计 |
| | | */ |
| | | fun getSceneProSummary( |
| | | topTaskId: String, |
| | | sceneTypeId: String?, |
| | | sort: String?, |
| | | sortBy: String, |
| | | ): List<SceneProblemSummary> |
| | | fun getSceneProSummary(areaVo: AreaVo): List<SceneProblemSummary> |
| | | } |
| | |
| | | |
| | | import cn.flightfeather.supervision.domain.ds1.entity.Problemlist |
| | | import cn.flightfeather.supervision.domain.ds1.mapper.ProblemlistMapper |
| | | import cn.flightfeather.supervision.lightshare.vo.AreaVo |
| | | import cn.flightfeather.supervision.lightshare.vo.SceneProblemSummary |
| | | import org.springframework.stereotype.Repository |
| | | |
| | |
| | | /** |
| | | * 获取各场景的问题和整改数量统计 |
| | | */ |
| | | fun selectSceneProSummary(topTaskId: String, sceneTypeId: String?, sort: String?, sortBy: String): |
| | | List<SceneProblemSummary> { |
| | | return problemlistMapper.getSceneProSummary(topTaskId, sceneTypeId, sort, sortBy) |
| | | fun selectSceneProSummary(areaVo: AreaVo): List<SceneProblemSummary> { |
| | | return problemlistMapper.getSceneProSummary(areaVo) |
| | | } |
| | | |
| | | fun findOne(guid: String?): Problemlist? { |
| | |
| | | @Repository |
| | | class TaskRep(private val taskMapper: TaskMapper, private val monitorobjectversionMapper: MonitorobjectversionMapper) { |
| | | |
| | | private fun exampleTask(areaVo: AreaVo): Task?{ |
| | | private fun exampleTask(areaVo: AreaVo, levelNum: Int? = null): Example? { |
| | | areaVo.starttime ?: return null |
| | | val mStart = areaVo.starttime!!.withDayOfMonth(1).withHour(0).withMinute(0).withSecond(0) |
| | | val mEnd = mStart.plusMonths(1).minusSeconds(1) |
| | | return Task().apply { |
| | | provincecode = areaVo.provincecode |
| | | citycode = areaVo.citycode |
| | | districtcode = areaVo.districtcode |
| | | starttime = Date.from(mStart.atZone(ZoneId.systemDefault()).toInstant()) |
| | | endtime = Date.from(mEnd.atZone(ZoneId.systemDefault()).toInstant()) |
| | | // return Task().apply { |
| | | // provincecode = areaVo.provincecode |
| | | // citycode = areaVo.citycode |
| | | // districtcode = areaVo.districtcode |
| | | // starttime = Date.from(mStart.atZone(ZoneId.systemDefault()).toInstant()) |
| | | // endtime = Date.from(mEnd.atZone(ZoneId.systemDefault()).toInstant()) |
| | | // } |
| | | |
| | | return Example(Task::class.java).apply { |
| | | createCriteria() |
| | | .apply { |
| | | if (levelNum != null) { |
| | | andEqualTo("levelnum", levelNum) |
| | | } else { |
| | | andIsNull("levelnum") |
| | | } |
| | | } |
| | | .andEqualTo("provincecode", areaVo.provincecode) |
| | | .andEqualTo("citycode", areaVo.citycode) |
| | | .andEqualTo("districtcode", areaVo.districtcode) |
| | | .andGreaterThanOrEqualTo("starttime", mStart) |
| | | .andLessThanOrEqualTo("endtime", mEnd) |
| | | orderBy("starttime") |
| | | } |
| | | } |
| | | |
| | |
| | | * 查找一个总任务 |
| | | */ |
| | | fun findOneTask(areaVo: AreaVo): Task? { |
| | | val example = exampleTask(areaVo) ?: return null |
| | | return taskMapper.selectOne(example) |
| | | val list = findTasks(areaVo) |
| | | return if (list.isEmpty()) { |
| | | null |
| | | } else { |
| | | list[0] |
| | | } |
| | | } |
| | | |
| | | fun findTasks(areaVo: AreaVo): List<Task?> { |
| | | val example = exampleTask(areaVo) ?: return emptyList() |
| | | return taskMapper.select(example) |
| | | val example = exampleTask(areaVo, 2) ?: return emptyList() |
| | | return taskMapper.selectByExample(example) |
| | | } |
| | | |
| | | fun findTasks(task: Task): List<Task?> { |
| | |
| | | |
| | | fun getSceneByProType(areaVo: AreaVo, pType:String):List<Subtask?> |
| | | |
| | | fun getSceneProSummary(areaVo: AreaVo, sortBy: String, page: Int, per_page: Int): Pair<DataHead?, |
| | | List<SceneProblemSummary>?> |
| | | fun getSceneProSummary(areaVo: AreaVo, page: Int, per_page: Int): Pair<DataHead?, List<SceneProblemSummary>?> |
| | | } |
| | |
| | | |
| | | //根据区县、场景类型、时间获取各个问题数量 |
| | | override fun getStatisticalResult(areaVo: AreaVo): List<StatisticsVo> { |
| | | val districtcode = areaVo.districtcode |
| | | val sceneType = areaVo.scensetypeid |
| | | val startTime = areaVo.starttime?.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")) |
| | | val endTime = areaVo.endtime?.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")) |
| | | return problemlistMapper.getStatisticalResult(districtcode, startTime, endTime, sceneType, areaVo.sceneId) |
| | | // val districtcode = areaVo.districtcode |
| | | // val sceneType = areaVo.scensetypeid |
| | | // val startTime = areaVo.starttime?.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")) |
| | | // val endTime = areaVo.endtime?.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")) |
| | | return problemlistMapper.getStatisticalResult(areaVo) |
| | | } |
| | | |
| | | override fun getChargeResult(areaVo: AreaVo): ChargeInfoVo { |
| | |
| | | |
| | | override fun getSceneProSummary( |
| | | areaVo: AreaVo, |
| | | sortBy: String, |
| | | page: Int, |
| | | per_page: Int, |
| | | ): Pair<DataHead?, List<SceneProblemSummary>?> { |
| | | areaVo.scensetypeid ?: throw BizException("缺少场景类型参数") |
| | | val task = taskRep.findOneTask(areaVo) ?: throw BizException("未找到对应的巡查总任务") |
| | | // areaVo.scensetypeid ?: throw BizException("缺少场景类型参数") |
| | | // val task = taskRep.findOneTask(areaVo) ?: throw BizException("未找到对应的巡查总任务") |
| | | val p = PageHelper.startPage<SceneProblemSummary>(page, per_page) |
| | | val res = problemRep.selectSceneProSummary(task.tguid!!, areaVo.scensetypeid!!, areaVo.sort, sortBy) |
| | | val res = problemRep.selectSceneProSummary(areaVo) |
| | | return DataHead(p.pageNum, p.pages, p.total) to res |
| | | } |
| | | } |
| | |
| | | districtName = t.districtname |
| | | townCode = t.towncode |
| | | townName = t.townname |
| | | subTaskSummary = subtaskMapper.getSummary(t.tguid!!, areaVo.scensetypeid?.toIntOrNull()) |
| | | areaVo.topTaskId = t.tguid |
| | | subTaskSummary = subTaskRep.findSummary(areaVo) |
| | | } |
| | | res.add(pro) |
| | | } |
| | |
| | | @JsonInclude(JsonInclude.Include.NON_NULL) |
| | | @ApiModel("区域条件") |
| | | open class AreaVo { |
| | | @ApiModelProperty("总任务id") |
| | | var topTaskId: String? = null |
| | | |
| | | @ApiModelProperty("省份编码") |
| | | var provincecode: String? = null |
| | | |
| | |
| | | @PostMapping("/summary/scene") |
| | | fun getSceneProSummary( |
| | | @RequestBody areaVo: AreaVo, |
| | | @ApiParam(value = "排序字段", allowableValues = "pro, changePer") @RequestParam sortBy: String, |
| | | @ApiParam(value = "页码") @RequestParam(value = "page") page: Int, |
| | | @ApiParam(value = "单页数据量") @RequestParam(value = "per_page") perPage: Int, |
| | | ) = resPack { problemlistService.getSceneProSummary(areaVo, sortBy, page, perPage) } |
| | | ) = resPack { problemlistService.getSceneProSummary(areaVo, page, perPage) } |
| | | } |
| | |
| | | LEFT JOIN sm_t_scense AS f ON a.S_GUID = f.S_GUID |
| | | LEFT JOIN tm_t_subtask AS c ON a.ST_GUID = c.ST_GUID |
| | | <where> |
| | | <if test="startTime != null"> |
| | | AND c.ST_PlanStartTime >= #{startTime} |
| | | </if> |
| | | <if test="endTime != null"> |
| | | AND c.ST_PlanStartTime <= #{endTime} |
| | | </if> |
| | | <if test="districtCode != null"> |
| | | AND f.S_DistrictCode = #{districtCode} |
| | | </if> |
| | | <if test="sceneType != null"> |
| | | AND f.S_TypeID = #{sceneType} |
| | | <!-- <if test="startTime != null">--> |
| | | <!-- AND c.ST_PlanStartTime >= #{startTime}--> |
| | | <!-- </if>--> |
| | | <!-- <if test="endTime != null">--> |
| | | <!-- AND c.ST_PlanStartTime <= #{endTime}--> |
| | | <!-- </if>--> |
| | | <!-- <if test="districtCode != null">--> |
| | | <!-- AND f.S_DistrictCode = #{districtCode}--> |
| | | <!-- </if>--> |
| | | <if test="scensetypeid != null"> |
| | | AND f.S_TypeID = #{scensetypeid} |
| | | </if> |
| | | <if test="sceneId != null"> |
| | | AND a.S_GUID = #{sceneId} |
| | | </if> |
| | | <include refid="cn.flightfeather.supervision.domain.ds1.mapper.ScenseMapper.Where_Area"> |
| | | <property name="tableAlias" value="f"/> |
| | | </include> |
| | | <include refid="cn.flightfeather.supervision.domain.ds1.mapper.SubtaskMapper.Where_Plan_Time"> |
| | | <property name="tableAlias" value="c"/> |
| | | </include> |
| | | </where> |
| | | GROUP BY |
| | | b.PT_TypeName |
| | |
| | | sm_t_scense AS b |
| | | LEFT JOIN tm_t_subtask AS a ON a.ST_ScenseID = b.S_GUID |
| | | LEFT JOIN im_t_problemlist AS d ON a.ST_GUID = d.ST_GUID |
| | | WHERE |
| | | a.T_GUID = #{topTaskId} |
| | | <if test="sceneTypeId != null"> |
| | | and b.S_TypeID = #{sceneTypeId} |
| | | <where> |
| | | <include refid="cn.flightfeather.supervision.domain.ds1.mapper.ScenseMapper.Where_Area"> |
| | | <property name="tableAlias" value="b"/> |
| | | </include> |
| | | <include refid="cn.flightfeather.supervision.domain.ds1.mapper.SubtaskMapper.Where_Plan_Time"> |
| | | <property name="tableAlias" value="a"/> |
| | | </include> |
| | | <!-- a.T_GUID = #{topTaskId}--> |
| | | <if test="scensetypeid != null"> |
| | | and b.S_TypeID = #{scensetypeid} |
| | | </if> |
| | | </where> |
| | | GROUP BY |
| | | b.S_GUID |
| | | ) as t_p |
| | |
| | | S_Contacts, S_CreateDate, S_UpdateDate, S_Extension1, S_Extension2, S_Index, S_Remark |
| | | </sql> |
| | | |
| | | <!-- 行政区划条件 --> |
| | | <sql id="Where_Area"> |
| | | <if test="provincecode != null"> |
| | | AND ${tableAlias}.S_ProvinceCode = #{provincecode} |
| | | </if> |
| | | <if test="provincename != null"> |
| | | AND ${tableAlias}.S_ProvinceName = #{provincename} |
| | | </if> |
| | | <if test="citycode != null"> |
| | | AND ${tableAlias}.S_CityCode = #{citycode} |
| | | </if> |
| | | <if test="cityname != null"> |
| | | AND ${tableAlias}.S_CityName = #{cityname} |
| | | </if> |
| | | <if test="districtcode != null"> |
| | | AND ${tableAlias}.S_DistrictCode = #{districtcode} |
| | | </if> |
| | | <if test="districtname != null"> |
| | | AND ${tableAlias}.S_DistrictName = #{districtname} |
| | | </if> |
| | | <if test="towncode != null"> |
| | | AND ${tableAlias}.S_TownCode = #{towncode} |
| | | </if> |
| | | <if test="townname != null"> |
| | | AND ${tableAlias}.S_TownName = #{townname} |
| | | </if> |
| | | </sql> |
| | | |
| | | <select id="selectNoAccountScene" resultMap="BaseResultMap"> |
| | | select a.* FROM sm_t_scense as a LEFT JOIN sm_t_userinfo as b on a.S_GUID = b.D_GUID WHERE b.UI_GUID is null |
| | | </select> |
| | |
| | | <select id="getSummaryByArea" resultMap="SubTaskSummary"> |
| | | <include refid="Sub_Task_Summary_Column_List"/> |
| | | <where> |
| | | <include refid="Where_Area"> |
| | | <property name="tableAlias" value="a"/> |
| | | <include refid="cn.flightfeather.supervision.domain.ds1.mapper.ScenseMapper.Where_Area"> |
| | | <property name="tableAlias" value="b"/> |
| | | </include> |
| | | <include refid="Where_Plan_Time"> |
| | | <property name="tableAlias" value="a"/> |
| | | </include> |
| | | <if test="scensetypeid != null"> |
| | | AND b.S_TypeID = #{scensetypeid} |
| | | </if> |
| | | <if test="topTaskId != null"> |
| | | AND a.T_GUID = #{topTaskId} |
| | | </if> |
| | | </where> |
| | | GROUP BY |
| | | a.ST_GUID |