| | |
| | | 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 |
| | |
| | | } |
| | | }) |
| | | } else { |
| | | taskSceneIdList = dbMapper.monitorobjectversionMapper.getSceneByType(config.topTaskGuid, config.sceneType) |
| | | taskSceneIdList = dbMapper.monitorobjectversionMapper.getSceneByType(config.topTaskGuid, config.sceneType, config.townCode) |
| | | dbMapper.subtaskMapper.selectByExample(Example(Subtask::class.java).apply { |
| | | createCriteria().andIn("scenseid", taskSceneIdList) |
| | | .andEqualTo("tguid", config.topTaskGuid) |
| | |
| | | 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() { |