| | |
| | | userId: String, |
| | | userName: String, |
| | | ): BaseResponse<String> { |
| | | if (action !in 0..3) { |
| | | if (action !in 0..5) { |
| | | return BaseResponse(false, "非法的操作指令") |
| | | } |
| | | val p = problemlistMapper.selectByPrimaryKey(pId) ?: return BaseResponse(false, "问题不存在") |
| | |
| | | response.success = false |
| | | response.message = "问题提交还未审核,无法进行整改审核!" |
| | | } |
| | | 4.toByte() -> { |
| | | response.success = false |
| | | response.message = "问题提交还未审核,无法进行撤回审核!" |
| | | } |
| | | 5.toByte() -> { |
| | | response.success = false |
| | | response.message = "问题整改还未提交,无法进行撤回审核!" |
| | | } |
| | | } |
| | | } else if (extension3 == Constant.PROBLEM_CHECK_PASS || extension3 == Constant.PROBLEM_CHECK_FAIL) { |
| | | when (action) { |
| | |
| | | response.message = "问题还未整改,无法进行整改审核!操作无效" |
| | | } |
| | | } |
| | | 4.toByte() -> { |
| | | extension3 = Constant.PROBLEM_UNCHECKED |
| | | } |
| | | 5.toByte() -> { |
| | | response.success = false |
| | | response.message = "问题整改还未审核,无法进行整改审核撤回操作!操作无效" |
| | | } |
| | | } |
| | | } else if (extension3 == Constant.CHANGE_UNCHECKED) { |
| | | event = "在${subtask?.scensename}审核了一个整改" |
| | |
| | | } |
| | | 2.toByte() -> extension3 = Constant.CHANGE_CHECK_PASS |
| | | 3.toByte() -> extension3 = Constant.CHANGE_CHECK_FAIL |
| | | 4.toByte() -> { |
| | | response.success = false |
| | | response.message = "问题整改还未审核,无法进行撤回审核!" |
| | | } |
| | | 5.toByte() -> { |
| | | response.success = false |
| | | response.message = "问题提交已审核,并且已被整改。操作无效" |
| | | } |
| | | } |
| | | } else if (extension3 == Constant.CHANGE_CHECK_PASS || extension3 == Constant.CHANGE_CHECK_FAIL) { |
| | | when (action) { |
| | |
| | | } |
| | | 2.toByte() -> extension3 = Constant.CHANGE_CHECK_PASS |
| | | 3.toByte() -> extension3 = Constant.CHANGE_CHECK_FAIL |
| | | 4.toByte() -> { |
| | | response.success = false |
| | | response.message = "问题提交已审核,并且已被整改,无法进行问题审核撤销操作。操作无效" |
| | | } |
| | | 5.toByte() -> { |
| | | extension3 = Constant.CHANGE_UNCHECKED |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | override fun newProblem(problem: String, files: Array<MultipartFile>): BaseResponse<String> { |
| | | val mapper = ObjectMapper() |
| | | |
| | | //json转object |
| | | val problemVo = mapper.readValue(problem, object : TypeReference<ProblemVo>() {}) |
| | | val problemVo = ObjectMapper().readValue(problem, object : TypeReference<ProblemVo>() {}) |
| | | |
| | | val inspection = inspectionMapper.selectByPrimaryKey(problemVo.insGuid) ?: return BaseResponse(false, "巡查记录不存在") |
| | | val scene = scenseMapper.selectByPrimaryKey(inspection.sguid) ?: return BaseResponse(false, "巡查记录对应场景不存在") |
| | | |
| | | // 保存问题 |
| | | val problemlist = ProblemListVo.newPro(inspection, problemVo, scene) |
| | | problemlistMapper.insert(problemlist) |
| | | |
| | | // 保存图片 |
| | | saveProFile(problemlist, inspection, scene, files) |
| | | mediafileService.saveMediaFile(files) { MediaFileVo.newProFile(inspection, problemlist, scene) } |
| | | |
| | | //更新巡查信息的问题数 |
| | | if (inspection.problemcount != null) { |
| | |
| | | |
| | | override fun updateProblem(problem: ProblemListVo, deleteImg: List<String>, files: Array<MultipartFile>): String { |
| | | problemRep.findOne(problem.guid) ?: throw BizException("该问题不存在") |
| | | val inspection = inspectionMapper.selectByPrimaryKey(problem.guid) ?: throw BizException("巡查记录不存在") |
| | | problemRep.update(problem) |
| | | val inspection = inspectionMapper.selectByPrimaryKey(problem.iguid) ?: throw BizException("巡查记录不存在") |
| | | val scene = scenseMapper.selectByPrimaryKey(inspection.sguid) ?: throw BizException("巡查记录对应场景不存在") |
| | | saveProFile(problem, inspection, scene, files) |
| | | mediafileService.saveMediaFile(files) { MediaFileVo.newProFile(inspection, problem, scene) } |
| | | mediafileService.deleteList(deleteImg) |
| | | return "success" |
| | | } |
| | | |
| | | override fun saveProFile( |
| | | problemlist: Problemlist, |
| | | inspection: Inspection, |
| | | scene: Scense, |
| | | files: Array<MultipartFile>, |
| | | ): Int { |
| | | var res = 0 |
| | | // 保存图片 |
| | | for (image in files) { |
| | | val mediaFile = MediaFileVo.newProFile(inspection, problemlist, scene) |
| | | res += mediafileMapper.insert(mediaFile) |
| | | |
| | | val path = mediaFile.extension1 |
| | | val fileName = mediaFile.guid + ".jpg" |
| | | val filePath = "${imgPath}/$path/" |
| | | try { |
| | | //调用文件保存方法 |
| | | FileUtil.uploadFile(image.bytes, filePath, fileName) |
| | | } catch (e: Exception) { |
| | | // TODO: handle exception |
| | | } |
| | | } |
| | | return res |
| | | } |
| | | |
| | | override fun changeProblem(problemId: String, files: Array<MultipartFile>): BaseResponse<String> { |
| | | // 更新问题 |
| | | // 问题和问题图片合法性检查 |
| | | val p = problemlistMapper.selectByPrimaryKey(problemId) ?: return BaseResponse(false, "问题不存在") |
| | | 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, "问题不存在或已整改,无法重复整改") |
| | | |
| | | // 更新问题 |
| | | p.apply { |
| | | ischanged = true |
| | | changedtime = Date() |
| | |
| | | } |
| | | 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) { |
| | | mediafileService.saveMediaFile(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\\第三方监管app\\自动评分\\餐饮\\" |
| | | val filePath = "${imgPath}/$path" |
| | | try { |
| | | //调用文件保存方法 |
| | | FileUtil.uploadFile(image.bytes, filePath, fileName) |
| | | } catch (e: Exception) { |
| | | println(e) |
| | | } |
| | | } |
| | | |
| | | return BaseResponse(true) |
| | | } |
| | | |
| | | override fun updateChange(problemId: String, deleteImg: List<String>, files: Array<MultipartFile>): String { |
| | | val p = problemRep.findOne(problemId) ?: throw BizException("该问题不存在") |
| | | val mediaFiles = mediafileMapper.selectByExample(Example(Mediafile::class.java).apply { |
| | | createCriteria().andEqualTo("businessguid", problemId) |
| | | .andEqualTo("businesstypeid", 1) |
| | | .andEqualTo("ischanged", true) |
| | | }) |
| | | if (mediaFiles.isEmpty()) throw BizException("问题还未整改,无法修改整改") |
| | | |
| | | // 保存新的整改图片 |
| | | val m = mediaFiles[0] |
| | | m.savetime = Date() |
| | | mediafileService.saveMediaFile(files) { |
| | | m.apply { |
| | | guid = UUIDGenerator.generate16ShortUUID() |
| | | description = p.problemname + " " + p.location + " 整改 " + UUIDGenerator.generateUUID(4) + ".jpg" |
| | | } |
| | | } |
| | | mediafileService.deleteList(deleteImg) |
| | | return "success" |
| | | } |
| | | |
| | | override fun getBySubTask(stGuid: String, all: Boolean?): List<ProblemListVo> { |
| | | //根据子任务ID获取问题列表 |
| | | val problemListVo = mutableListOf<ProblemListVo>() |