From b6c29718e10e25a6a49fe9538f554371e1560720 Mon Sep 17 00:00:00 2001 From: feiyu02 <risaku@163.com> Date: 星期一, 25 七月 2022 15:50:22 +0800 Subject: [PATCH] 1. 调试监管统计文件下载接口; 2. 新增自动评分刷新接口; 3. 针对前端页面,调整部分接口 --- src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ProblemlistServiceImpl.kt | 90 ++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 89 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..d49e29f 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.* @@ -321,6 +323,12 @@ mediafileMapper.deleteByExample(Example(Mediafile::class.java).apply { createCriteria().andEqualTo("businessguid", id) }) + //鏇存柊宸℃煡淇℃伅涓殑闂鏁伴噺 + val inspection = inspectionMapper.selectByPrimaryKey(p.iguid) + if (inspection.problemcount != null && inspection.problemcount!! > 0) { + inspection.problemcount = inspection.problemcount!! - 1 + inspectionMapper.updateByPrimaryKey(inspection) + } BaseResponse(true, "闂鍒犻櫎鎴愬姛", data = i) } } @@ -478,12 +486,92 @@ 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 } } + //鏇存柊宸℃煡淇℃伅鐨勯棶棰樻暟 + if (inspection.problemcount != null) { + inspection.problemcount = inspection.problemcount!! + 1 + inspectionMapper.updateByPrimaryKey(inspection) + } + 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) + } + + override fun getBySubTask(stGuid: String): List<ProblemlistVo> { + //鏍规嵁瀛愪换鍔D鑾峰彇闂鍒楄〃 + val problemListVo = findBySubtaskId(stGuid) + //鍒ゆ柇鏄惁鏈夐棶棰樺垪琛� + if (!problemListVo.isEmpty()) { + //鏍规嵁姣忎釜闂,鑾峰彇濯掍綋鏂囦欢 + problemListVo.forEach { + val mediafileVo = mediafileService.findByBusinessGUID(it.guid!!) + //鍒ゆ柇鏄惁鏈夊獟浣撹祫鏂� + if (!mediafileVo.isEmpty()) { + //璧嬪�� + it.mediafileList = mediafileVo + } + } + } + return problemListVo + } } \ No newline at end of file -- Gitblit v1.9.3