From 497475defd5d0ebf90ae6a8e2b080a16d78043ab Mon Sep 17 00:00:00 2001 From: feiyu02 <risaku@163.com> Date: 星期五, 23 九月 2022 17:49:34 +0800 Subject: [PATCH] 2022.9.23 --- src/main/kotlin/cn/flightfeather/supervision/lightshare/service/Impl/LedgerServiceImpl.kt | 66 ++++++++++++++++++--------------- 1 files changed, 36 insertions(+), 30 deletions(-) diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/Impl/LedgerServiceImpl.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/Impl/LedgerServiceImpl.kt index 5aa39e2..f05ae65 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/Impl/LedgerServiceImpl.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/Impl/LedgerServiceImpl.kt @@ -106,8 +106,8 @@ return result } - val startDate = DateUtil().StringToDate(startTime) - val endDate = DateUtil().StringToDate(endTime) + val startDate = DateUtil.StringToDate(startTime) + val endDate = DateUtil.StringToDate(endTime) val cal = Calendar.getInstance().apply { time = startDate } val year = cal.get(Calendar.YEAR) val month = cal.get(Calendar.MONTH) + 1 @@ -215,41 +215,22 @@ val ledgerVos = mapper.readValue<List<LedgerVo>>(ledgerVoList, object :TypeReference<List<LedgerVo>>(){}) ledgerVos.forEach { + it.id = it.id ?: UUIDGenerator.generate16ShortUUID() + it.fileType = it.fileType ?: 1 + val userInfo = userinfoMapper.selectByPrimaryKey(userId) + userInfo.extension2?.toInt()?.let {s-> it.sceneType = s } + val today = Calendar.getInstance().apply { time = Date() } .get(Calendar.DAY_OF_MONTH) - val cal = Calendar.getInstance().apply { time = it.updateDate } + val cal = Calendar.getInstance().apply { time = it.updateDate ?: Date() } val updateYear = cal.get(Calendar.YEAR) val updateMonth = cal.get(Calendar.MONTH) + 1 val updateDay = cal.get(Calendar.DAY_OF_MONTH) - //鐢熸垚鍙拌处鏇存柊璁板綍 - val ledgerRecord = LedgerRecord().apply { - lrGuid = it.id - lsSubtypeid = it.ledgerSubTypeId - lsSubtypename = it.ledgerName - lrYear = updateYear - lrMonth = updateMonth.toByte() - lrDay = updateDay.toByte() - lrEasubmitkind = it.fileType?.toByte() ?: 1 - lrSubmitid = userId - lrSubmitname = userInfo?.acountname ?: "" - lrIssubmitontime = today <= 10 - lrSubmitdate = Date() - lrUpdatetype = it.updateType - lrExtension1 = it.sceneType.toString() - } - - //妫�鏌ユ暟鎹簱鏄惁宸叉湁璁板綍锛岄�夋嫨鎻掑叆鎴栨洿鏂� - val tmp = ledgerRecordMapper.selectByPrimaryKey(ledgerRecord.lrGuid) - if (tmp == null || tmp.lrGuid == null) { - ledgerRecordMapper.insert(ledgerRecord) - } else { - ledgerRecordMapper.updateByPrimaryKey(ledgerRecord) - } //瀵规瘡寮犲浘鐗囩敓鎴愮浉搴旂殑璺緞骞朵繚瀛� var picPath = "" - val time = DateUtil().DateToString(Date(), DateUtil.DateStyle.YYYY_MM) + val time = DateUtil.DateToString(Date(), DateUtil.DateStyle.YYYY_MM) files.forEach {file-> val fileName = file.originalFilename //TODO 姝ゅ鐨勬枃浠惰矾寰勯渶瑕佷慨鏀逛负鍔ㄦ�侀厤缃� @@ -262,7 +243,7 @@ } try { //璋冪敤鏂囦欢淇濆瓨鏂规硶 - FileUtil().uploadFile(file.bytes, basePath + path, fileName!!) + FileUtil.uploadFile(file.bytes, basePath + path, fileName!!) } catch (e: Exception) { e.printStackTrace() } @@ -292,6 +273,31 @@ //鎻掑叆鏂扮殑澶氬獟浣撴枃浠惰褰曟暟鎹� ledgerMediaFileMapper.insert(ledgerMedia) + + //鐢熸垚鍙拌处鏇存柊璁板綍 + val ledgerRecord = LedgerRecord().apply { + lrGuid = it.id + lsSubtypeid = it.ledgerSubTypeId + lsSubtypename = it.ledgerName + lrYear = updateYear + lrMonth = updateMonth.toByte() + lrDay = updateDay.toByte() + lrEasubmitkind = it.fileType?.toByte() ?: 1 + lrSubmitid = userId + lrSubmitname = userInfo?.acountname ?: "" + lrIssubmitontime = today <= 10 + lrSubmitdate = Date() + lrUpdatetype = it.updateType + lrExtension1 = it.sceneType.toString() + } + + //妫�鏌ユ暟鎹簱鏄惁宸叉湁璁板綍锛岄�夋嫨鎻掑叆鎴栨洿鏂� + val tmp = ledgerRecordMapper.selectByPrimaryKey(ledgerRecord.lrGuid) + if (tmp == null || tmp.lrGuid == null) { + ledgerRecordMapper.insert(ledgerRecord) + } else { + ledgerRecordMapper.updateByPrimaryKey(ledgerRecord) + } return true } @@ -343,7 +349,7 @@ createCriteria().andEqualTo("lScenetype", sceneType) } }) - val c = Calendar.getInstance().apply { this.time = DateUtil().StringToDate(time) } + val c = Calendar.getInstance().apply { this.time = DateUtil.StringToDate(time) } val year = c.get(Calendar.YEAR) val month = c.get(Calendar.MONTH) + 1 val map = mutableMapOf<Int, MutableList<Int>>() -- Gitblit v1.9.3