From b041775dae4438e428d2b70d2b22cfe8c49844fe Mon Sep 17 00:00:00 2001 From: feiyu02 <risaku@163.com> Date: 星期二, 19 七月 2022 16:22:36 +0800 Subject: [PATCH] 1. 巡查汇总报告功能编写基本完成 --- src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ProblemlistServiceImpl.kt | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 59 insertions(+), 1 deletions(-) diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ProblemlistServiceImpl.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ProblemlistServiceImpl.kt index f2a1191..bf7ef44 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ProblemlistServiceImpl.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ProblemlistServiceImpl.kt @@ -21,7 +21,9 @@ import java.text.SimpleDateFormat import javax.annotation.Resource import java.math.BigDecimal +import java.time.LocalDate import java.time.LocalDateTime +import java.time.ZoneId import java.time.format.DateTimeFormatter import java.util.* @@ -478,7 +480,7 @@ val filePath = "${Constant.DEFAULT_FILE_PATH}/images/$path/" try { //璋冪敤鏂囦欢淇濆瓨鏂规硶 - FileUtil().uploadFile(image.bytes, filePath, fileName) + FileUtil.uploadFile(image.bytes, filePath, fileName) } catch (e: Exception) { // TODO: handle exception } @@ -486,4 +488,60 @@ return BaseResponse(true) } + + override fun changeProblem(problemId: String, files: Array<MultipartFile>): BaseResponse<String> { + // 鏇存柊闂 + val p = problemlistMapper.selectByPrimaryKey(problemId) ?: return BaseResponse(false, "闂涓嶅瓨鍦�") + p.apply { + ischanged = true + changedtime = Date() + extension3 = Constant.CHANGE_UNCHECKED + val today = LocalDate.now() + val pTime = LocalDateTime.ofInstant(time?.toInstant(), ZoneId.systemDefault()).toLocalDate() + changecatalog = if (p.extension1 != null) { + if (today.isAfter(pTime)) { + Constant.PROMISE_CHANGE + } else { + Constant.LOCAL_CHANGE + } + } else { + Constant.UN_PROMISE_CHANGE + } + } + problemlistMapper.updateByPrimaryKey(p) + + // 淇濆瓨鍥剧墖 + val now = LocalDateTime.now() + val mediaFiles = mediafileMapper.selectByExample(Example(Mediafile::class.java).apply { + createCriteria().andEqualTo("businessguid", p.guid) + .andEqualTo("businesstypeid", 1) + .andEqualTo("ischanged", false) + }) + if (mediaFiles.isEmpty()) return BaseResponse(false, "鍦烘櫙闂鏁伴噺涓�0锛屾棤娉曟暣鏀�") + val m = mediaFiles[0] + m.path = m.path + "鏁存敼/" + m.savetime = Date() + m.ischanged = true + + for (image in files) { + m.apply { + guid = UUIDGenerator.generate16ShortUUID() + description = p.problemname + " " + p.location + " 鏁存敼 " + UUIDGenerator.generateUUID(4) + ".jpg" + } + mediafileMapper.insert(m) + + val path = m.extension1 + val fileName = m.guid + ".jpg" +// val filePath = "E:\\work\\绗笁鏂圭洃绠pp\\鑷姩璇勫垎\\椁愰ギ\\" + val filePath = "${Constant.DEFAULT_FILE_PATH}/images/$path" + try { + //璋冪敤鏂囦欢淇濆瓨鏂规硶 + FileUtil.uploadFile(image.bytes, filePath, fileName) + } catch (e: Exception) { + println(e) + } + } + + return BaseResponse(true) + } } \ No newline at end of file -- Gitblit v1.9.3