| | |
| | | |
| | | //根据区县、场景类型、时间获取各个问题数量 |
| | | 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 delete(id: String): Int = problemlistMapper.deleteByPrimaryKey(id) |
| | | |
| | | override fun setDeleteStatus(id: String): BaseResponse<Int> { |
| | | override fun setDeleteStatus(id: String): Int { |
| | | val p = problemlistMapper.selectByPrimaryKey(id) |
| | | |
| | | return when { |
| | | p.ischanged == true -> BaseResponse(false, "问题已整改,无法删除", data = 0) |
| | | p.extension3 != Constant.PROBLEM_UNCHECKED -> BaseResponse(false, "问题已审核,无法删除", data = 0) |
| | | p.ischanged == true -> throw BizException("问题已整改,无法删除") |
| | | p.extension3 != Constant.PROBLEM_UNCHECKED -> throw BizException("问题已审核,无法删除") |
| | | else -> { |
| | | // 2021/4/25 将原来的添加删除状态改为直接删除 |
| | | // p.remark = Constant.PROBLEM_DELETED |
| | |
| | | inspection.problemcount = inspection.problemcount!! - 1 |
| | | inspectionMapper.updateByPrimaryKey(inspection) |
| | | } |
| | | BaseResponse(true, "问题删除成功", data = i) |
| | | i |
| | | } |
| | | } |
| | | } |
| | |
| | | remark: String, |
| | | userId: String, |
| | | userName: String, |
| | | ): BaseResponse<String> { |
| | | if (action !in 0..3) { |
| | | return BaseResponse(false, "非法的操作指令") |
| | | ): String { |
| | | if (action !in 0..5) { |
| | | throw BizException("非法的操作指令") |
| | | } |
| | | val p = problemlistMapper.selectByPrimaryKey(pId) ?: return BaseResponse(false, "问题不存在") |
| | | val p = problemlistMapper.selectByPrimaryKey(pId) ?: throw BizException("问题不存在") |
| | | val subtask = p.stguid?.let { subTaskRep.findOne(it) } |
| | | val response = BaseResponse<String>(true) |
| | | var event = "" |
| | |
| | | -> { |
| | | 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) { |
| | |
| | | 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 |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | bizLog.info(WorkStreamLogInfo(userId, userName, event)) |
| | | } |
| | | } |
| | | return response |
| | | return if (response.success) "问题审核成功" else throw BizException(response.message) |
| | | } |
| | | |
| | | override fun newProblem(problem: String, files: Array<MultipartFile>): BaseResponse<String> { |
| | | val mapper = ObjectMapper() |
| | | |
| | | override fun newProblem(problem: String, files: Array<MultipartFile>): String { |
| | | //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 inspection = inspectionMapper.selectByPrimaryKey(problemVo.insGuid) ?: throw BizException("巡查记录不存在") |
| | | val scene = scenseMapper.selectByPrimaryKey(inspection.sguid) ?: throw BizException("巡查记录对应场景不存在") |
| | | // 保存问题 |
| | | 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) { |
| | |
| | | bizLog.info(WorkStreamLogInfo(subtask?.executorguids, subtask?.executorrealtimes, event)) |
| | | } |
| | | |
| | | return BaseResponse(true) |
| | | return "success" |
| | | } |
| | | |
| | | 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>): String { |
| | | // 问题和问题图片合法性检查 |
| | | val p = problemlistMapper.selectByPrimaryKey(problemId) ?: throw BizException("问题不存在") |
| | | val mediaFiles = mediafileMapper.selectByExample(Example(Mediafile::class.java).apply { |
| | | createCriteria().andEqualTo("businessguid", p.guid) |
| | | .andEqualTo("businesstypeid", 1) |
| | | .andEqualTo("ischanged", false) |
| | | }) |
| | | if (mediaFiles.isEmpty()) throw BizException("问题不存在或已整改,无法重复整改") |
| | | |
| | | override fun changeProblem(problemId: String, files: Array<MultipartFile>): BaseResponse<String> { |
| | | // 更新问题 |
| | | val p = problemlistMapper.selectByPrimaryKey(problemId) ?: 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) |
| | | return "success" |
| | | } |
| | | |
| | | 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> { |
| | |
| | | |
| | | 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 |
| | | } |
| | | } |