优化了部分代码解决 warning
diff --git a/payapi/src/main/kotlin/com/supwisdom/dlpay/api/controller/dali_datasync_api_controller.kt b/payapi/src/main/kotlin/com/supwisdom/dlpay/api/controller/dali_datasync_api_controller.kt
index 3f909c5..dade3f2 100644
--- a/payapi/src/main/kotlin/com/supwisdom/dlpay/api/controller/dali_datasync_api_controller.kt
+++ b/payapi/src/main/kotlin/com/supwisdom/dlpay/api/controller/dali_datasync_api_controller.kt
@@ -49,7 +49,7 @@
TODO("更新数据逻辑")
}
- return return ResponseEntity.ok(mapOf("retcode" to "0000", "retmsg" to "SUCCESS"))
+ return ResponseEntity.ok(mapOf("retcode" to "0000", "retmsg" to "SUCCESS"))
} catch (ex: RequestParamCheckException) {
return ResponseEntity.ok(ResponseBodyBuilder.create()
.fail(ex.errCode, ex.message ?: "请求参数错误"))
diff --git a/payapi/src/main/kotlin/com/supwisdom/dlpay/mobile/AuthLoginHandler.kt b/payapi/src/main/kotlin/com/supwisdom/dlpay/mobile/AuthLoginHandler.kt
index b4f11a1..19d96ea 100644
--- a/payapi/src/main/kotlin/com/supwisdom/dlpay/mobile/AuthLoginHandler.kt
+++ b/payapi/src/main/kotlin/com/supwisdom/dlpay/mobile/AuthLoginHandler.kt
@@ -46,8 +46,8 @@
override fun onAuthenticationSuccess(request: HttpServletRequest, response: HttpServletResponse, authentication: Authentication) {
logger.error(request.getParameter("platform"))
- var temp = authentication.principal as TBMobileUser
- var user = mobileUserDao.findByPhone(temp.phone)
+ val temp = authentication.principal as TBMobileUser
+ val user = mobileUserDao.findByPhone(temp.phone)
val exp = systemUtilService.getSysparaValueAsInt(SysparaUtil.SYSPARAID_NO3,60*60*24*3)
jwtConfig.expiration = exp.toLong()
if (user != null) {
@@ -77,15 +77,13 @@
user.jti = jwt.jti
mobileUserDao.save(user)
var payseted = false
- if(!user!!.paypwd.isNullOrEmpty()){
+ if(!user.paypwd.isNullOrEmpty()){
payseted = true
}
var name = ""
if (!user.userid.isNullOrEmpty()) {
- var person = userService.findOnePersonByUserid(user.userid!!)
- if (person != null) {
- name = person.name
- }
+ val person = userService.findOnePersonByUserid(user.userid!!)
+ name = person.name
}
response.status = HttpStatus.OK.value()
@@ -124,10 +122,10 @@
is LockedException -> "账户被锁定"
else -> exception.message!!
}
- var temp = request.getParameter("username")
+ val temp = request.getParameter("username")
if(!temp.isNullOrEmpty()) {
mobileUserDao.findByPhone(temp)?.let {
- if (it.loginpwderror == null || it.loginpwderror == 0) {
+ if (it.loginpwderror == 0) {
it.loginpwderror = 0
it.loginpwderrortime = System.currentTimeMillis()
}
diff --git a/payapi/src/main/kotlin/com/supwisdom/dlpay/mobile/MobileApi.kt b/payapi/src/main/kotlin/com/supwisdom/dlpay/mobile/MobileApi.kt
index ecc01ab..cf9247c 100644
--- a/payapi/src/main/kotlin/com/supwisdom/dlpay/mobile/MobileApi.kt
+++ b/payapi/src/main/kotlin/com/supwisdom/dlpay/mobile/MobileApi.kt
@@ -65,12 +65,12 @@
* */
@RequestMapping("/code")
fun code(@RequestParam phone: String, @RequestParam type: String?): JsonResult {
- if (phone.isNullOrEmpty() || phone.length != 11 || !StringUtil.isMobile(phone)) {
+ if (phone.isEmpty() || phone.length != 11 || !StringUtil.isMobile(phone)) {
return JsonResult.error("手机号有误")
}
- var user = mobileApiService.findUserByPhone(phone)
+ val user = mobileApiService.findUserByPhone(phone)
if (type.isNullOrEmpty() || "new" == type) {
- if (user != null && !user.loginpwd.isNullOrEmpty()) {
+ if (user != null && !user.loginpwd.isEmpty()) {
return JsonResult.error("该手机号已注册,请登录或找回密码")
}
} else {
@@ -83,10 +83,9 @@
}
}
// 如果未设置密码
- var temp = redisTemplate.opsForValue().get(phone)
+ val temp = redisTemplate.opsForValue().get(phone)
if (temp.isNullOrEmpty()) {
- var code = RandomUtils.randomNumber(6)
- System.out.println(code)
+ val code = RandomUtils.randomNumber(6)
redisTemplate.opsForValue().set(phone, code, Duration.ofMinutes(5))
}
//TODO call send code sdk
@@ -101,7 +100,7 @@
@RequestParam code: String,
@RequestParam platform: String?,
@RequestParam uuid: String?): JsonResult {
- var temp = redisTemplate.opsForValue().get(phone)
+ val temp = redisTemplate.opsForValue().get(phone)
if (!temp.isNullOrEmpty()) {
if (temp != code) {
return JsonResult.error("验证码错误")
@@ -122,10 +121,10 @@
user.registerplatform = platform
user.devuid = uuid
user = mobileApiService.saveUser(user)
- var code = RandomUtils.getRandomString(30)
- redisTemplate.opsForValue().set(user.uid, code, Duration.ofHours(1))
+ val newCode = RandomUtils.getRandomString(30)
+ redisTemplate.opsForValue().set(user.uid, newCode, Duration.ofHours(1))
redisTemplate.delete(phone)
- return JsonResult.ok("OK").put("uid", user.uid)?.put("randcode", code)!!
+ return JsonResult.ok("OK").put("uid", user.uid)?.put("randcode", newCode)!!
} else {
return JsonResult.error(-1, "验证码无效或已过期,请重新获取")
}
@@ -139,32 +138,32 @@
@RequestParam pwd: String,
@RequestParam repwd: String,
@RequestParam random: String): JsonResult {
- if (random.isNullOrEmpty()) {
+ if (random.isEmpty()) {
return JsonResult.error("信息有误,请返回上一步")
}
- if (pwd.isNullOrEmpty() || repwd.isNullOrEmpty() || pwd.length < 6) {
+ if (pwd.isEmpty() || repwd.isEmpty() || pwd.length < 6) {
return JsonResult.error("请重新设置密码,密码不能小于6位字符")
}
if (pwd != repwd) {
return JsonResult.error("两次密码不一致")
}
- var user: TBMobileUser? = mobileApiService.findUserById(id) ?: return JsonResult.error("用户不存在,请注册")
- var code = redisTemplate.opsForValue().get(id)
+ val user: TBMobileUser? = mobileApiService.findUserById(id) ?: return JsonResult.error("用户不存在,请注册")
+ val code = redisTemplate.opsForValue().get(id)
if (random != code) {
return JsonResult.error("信息有误,请返回上一步,并重新发送验证码")
}
val encoder = BCryptPasswordEncoder()
user!!.loginpwd = encoder.encode(pwd)
- var exp = systemUtilService.getSysparaValueAsInt(SysparaUtil.SYSPARAID_NO3, 60 * 60 * 24 * 3)
+ val exp = systemUtilService.getSysparaValueAsInt(SysparaUtil.SYSPARAID_NO3, 60 * 60 * 24 * 3)
jwtConfig.expiration = exp.toLong()
- var authorities: Collection<GrantedAuthority> = AuthorityUtils.createAuthorityList("ROLE_USER")
+ val authorities: Collection<GrantedAuthority> = AuthorityUtils.createAuthorityList("ROLE_USER")
user.auths = authorities
val token = JwtTokenUtil(jwtConfig).generateToken(
mapOf("uid" to user.uid, "issuer" to "payapi",
"audience" to user.phone,
Constants.JWT_CLAIM_TENANTID to "mobile",
Constants.JWT_CLAIM_AUTHORITIES to user.authorities))
- var jwt = JwtRedis().apply {
+ val jwt = JwtRedis().apply {
jti = token.jti
uid = user.phone
status = TradeDict.JWT_STATUS_NORMAL
@@ -176,7 +175,7 @@
}
apiJwtRepository.save(this)
}
- if (user.loginpwderror != null && user.loginpwderror!! > 0) {
+ if (user.loginpwderror > 0) {
user.loginpwderror = 0
user.loginpwderrortime = null
}
@@ -185,7 +184,7 @@
mobileApiService.saveUser(user)
redisTemplate.delete(user.uid)
var payseted = false
- if (!user!!.paypwd.isNullOrEmpty()) {
+ if (!user.paypwd.isNullOrEmpty()) {
payseted = true
}
return JsonResult.ok("OK").put("token", token.jwtToken)
@@ -218,7 +217,8 @@
@RequestMapping("/infor")
fun getUserInfor(): JsonResult {
val p = SecurityContextHolder.getContext().authentication
- var user: TBMobileUser? = mobileApiService.findUserById(p.name) ?: return JsonResult.error("用户不存在,请注册")
+ mobileApiService.findUserById(p.name)
+ ?: return JsonResult.error("用户不存在,请注册")
return JsonResult.ok("OK").put("now", System.currentTimeMillis())!!
}
@@ -228,15 +228,14 @@
@RequestMapping("/code")
fun code(): JsonResult {
val p = SecurityContextHolder.getContext().authentication
- var user: TBMobileUser? = mobileApiService.findUserById(p.name) ?: return JsonResult.error("用户不存在,请注册")
- if (user!!.phone.isNullOrEmpty()) {
+ val user = mobileApiService.findUserById(p.name) ?: return JsonResult.error("用户不存在,请注册")
+ if (user.phone.isEmpty()) {
return JsonResult.error("用户不存在,请注册")
}
- var temp = redisTemplate.opsForValue().get(user!!.phone)
+ val temp = redisTemplate.opsForValue().get(user.phone)
if (temp.isNullOrEmpty()) {
- var code = RandomUtils.randomNumber(6)
- System.out.println(code)
- redisTemplate.opsForValue().set(user!!.phone, code, Duration.ofMinutes(5))
+ val code = RandomUtils.randomNumber(6)
+ redisTemplate.opsForValue().set(user.phone, code, Duration.ofMinutes(5))
}
//TODO call send code sdk
return JsonResult.ok("验证码已发送")
@@ -246,16 +245,17 @@
fun check(@RequestParam code: String
): JsonResult {
val p = SecurityContextHolder.getContext().authentication
- var user: TBMobileUser? = mobileApiService.findUserById(p.name) ?: return JsonResult.error("用户不存在,请注册")
- var temp = redisTemplate.opsForValue().get(user!!.phone)
+ val user = mobileApiService.findUserById(p.name)
+ ?: return JsonResult.error("用户不存在,请注册")
+ val temp = redisTemplate.opsForValue().get(user.phone)
if (!temp.isNullOrEmpty()) {
if (temp != code) {
return JsonResult.error("验证码错误")
}
- var code = RandomUtils.getRandomString(30)
- redisTemplate.opsForValue().set(user.uid, code, Duration.ofHours(1))
- redisTemplate.delete(user!!.phone)
- return JsonResult.ok("OK").put("randcode", code)!!
+ val newCode = RandomUtils.getRandomString(30)
+ redisTemplate.opsForValue().set(user.uid, newCode, Duration.ofHours(1))
+ redisTemplate.delete(user.phone)
+ return JsonResult.ok("OK").put("randcode", newCode)!!
} else {
return JsonResult.error(-1, "验证码无效或已过期,请重新获取")
}
@@ -267,23 +267,25 @@
@RequestMapping("/bindcard")
fun bindcard(card: String, name: String, code: String): JsonResult {
val p = SecurityContextHolder.getContext().authentication
- var user: TBMobileUser? = mobileApiService.findUserById(p.name) ?: return JsonResult.error("用户不存在,请注册")
- var phone = user!!.phone
- var temp = redisTemplate.opsForValue().get(phone)
+ val user = mobileApiService.findUserById(p.name)
+ ?: return JsonResult.error("用户不存在,请注册")
+ val phone = user.phone
+ val temp = redisTemplate.opsForValue().get(phone)
if (!temp.isNullOrEmpty()) {
if (temp != code) {
return JsonResult.error("验证码错误")
}
- if (user!!.userid.isNullOrEmpty()) {
- var identy: TPersonIdentity? = userService.findPersonIdentity(card) ?: return JsonResult.error("银行卡号有误")
+ if (user.userid.isNullOrEmpty()) {
+ val identy: TPersonIdentity? = userService.findPersonIdentity(card)
+ ?: return JsonResult.error("银行卡号有误")
if (identy!!.person == null || identy.status != TradeDict.STATUS_NORMAL) {
return JsonResult.error("银行卡号信息有误")
}
- if (identy!!.person.name != name) {
+ if (identy.person.name != name) {
return JsonResult.error("姓名有误")
}
- var temp: TBMobileUser? = mobileApiService.findUserById(identy!!.person.userid)
- if (temp != null) {
+ val exsitUser = mobileApiService.findUserById(identy.person.userid)
+ if (exsitUser != null) {
return JsonResult.error("该银行卡号已被绑定,如有疑问,请联系客服")
}
user.bindtime = DateUtil.getNow()
@@ -312,7 +314,8 @@
@RequestMapping("/paypwd")
fun paypwd(pwd: String, repwd: String, oldpwd: String?, type: String, randcode: String?): JsonResult {
val p = SecurityContextHolder.getContext().authentication
- var user: TBMobileUser? = mobileApiService.findUserById(p.name) ?: return JsonResult.error("用户不存在,请注册")
+ val user = mobileApiService.findUserById(p.name)
+ ?: return JsonResult.error("用户不存在,请注册")
if (pwd != repwd) {
return JsonResult.error("两次密码不一致,请确认")
}
@@ -323,8 +326,8 @@
return JsonResult.error("支付密码为6位数字")
}
val encoder = BCryptPasswordEncoder()
- if (user!!.paypwd.isNullOrEmpty()) {
- user!!.paypwd = encoder.encode(pwd)
+ if (user.paypwd.isNullOrEmpty()) {
+ user.paypwd = encoder.encode(pwd)
mobileApiService.saveUser(user)
return JsonResult.ok("OK")
?.put("paypwdset", true)!!
@@ -335,17 +338,15 @@
if (oldpwd.isNullOrEmpty()) {
return JsonResult.error("原支付密码错误")
}
- if (user.paypwderror != null && user.paypwderror!! >= 5 && (System.currentTimeMillis() - user.paypwderrortime!!) < 1000 * 60 * 30) {
+ if (user.paypwderror >= 5 && (System.currentTimeMillis() - user.paypwderrortime!!) < 1000 * 60 * 30) {
return JsonResult.error("密码错误次数过多,请30分钟后再试")
- }else if (user.paypwderror != null && user.paypwderror!! >= 5 && (System.currentTimeMillis() - user.paypwderrortime!!) > 1000 * 60 * 30) {
+ } else if (user.paypwderror >= 5 && (System.currentTimeMillis() - user.paypwderrortime!!) > 1000 * 60 * 30) {
//更新时间
user.paypwderror = 0
user.paypwderrortime = null
}
- val encoder = BCryptPasswordEncoder()
- var b = encoder.encode(oldpwd)
- if (!encoder.matches(oldpwd,user.paypwd)) {
- if (user.paypwderror == null || user.paypwderror == 0) {
+ if (!encoder.matches(oldpwd, user.paypwd)) {
+ if (user.paypwderror == 0) {
user.paypwderror = 0
user.paypwderrortime = System.currentTimeMillis()
}
@@ -353,7 +354,7 @@
mobileApiService.saveUser(user)
return JsonResult.error("原支付密码错误")
}
- user!!.paypwd = encoder.encode(pwd)
+ user.paypwd = encoder.encode(pwd)
mobileApiService.saveUser(user)
return JsonResult.ok("OK")
?.put("paypwdset", true)!!
@@ -362,15 +363,14 @@
if (randcode.isNullOrEmpty()) {
return JsonResult.error("信息有误,请返回并重新设置")
}
- var code = redisTemplate.opsForValue().get(user.uid)
+ val code = redisTemplate.opsForValue().get(user.uid)
if (randcode != code) {
return JsonResult.error(-1, "长时间未操作,请返回上一步,并重新发送验证码")
}
- user!!.paypwd = encoder.encode(pwd)
+ user.paypwd = encoder.encode(pwd)
mobileApiService.saveUser(user)
redisTemplate.delete(user.uid)
- return JsonResult.ok("OK")
- ?.put("paypwdset", true)!!
+ return JsonResult.ok("OK").put("paypwdset", true)!!
}
else -> return JsonResult.error("请求错误")
}
@@ -383,7 +383,7 @@
* */
@RequestMapping("/bxy")
fun xieyi(): JsonResult {
- var page = mobileApiService.findPageById(ConstantUtil.PAGE_BANKXIEYI)
+ val page = mobileApiService.findPageById(ConstantUtil.PAGE_BANKXIEYI)
if (page != null) {
return JsonResult.ok("OK").put("page", page.pageContent)!!
}
@@ -397,9 +397,10 @@
@RequestMapping("/signbxy")
fun signbxy(agree: String): JsonResult {
val p = SecurityContextHolder.getContext().authentication
- var user: TBMobileUser? = mobileApiService.findUserById(p.name) ?: return JsonResult.error("用户不存在,请注册")
- user!!.issigned = TradeDict.STATUS_YES
- user!!.signedtime = DateUtil.getNow()
+ val user = mobileApiService.findUserById(p.name)
+ ?: return JsonResult.error("用户不存在,请注册")
+ user.issigned = TradeDict.STATUS_YES
+ user.signedtime = DateUtil.getNow()
mobileApiService.saveUser(user)
//TODO 调用第三方接口签约
return JsonResult.ok("ok")
@@ -412,7 +413,8 @@
@RequestMapping("/bills")
fun bills(pageno: Int): JsonResult {
val p = SecurityContextHolder.getContext().authentication
- var user: TBMobileUser? = mobileApiService.findUserById(p.name) ?: return JsonResult.error("用户不存在,请注册")
+ val user = mobileApiService.findUserById(p.name)
+ ?: return JsonResult.error("用户不存在,请注册")
val c = Calendar.getInstance()
val timeOfDay = c.get(Calendar.HOUR_OF_DAY)
var t = ""
@@ -422,18 +424,14 @@
in 13..17 -> t = "下午好"
in 18..23 -> t = "晚上好"
}
- if (user!!.userid.isNullOrEmpty()) {
+ if (user.userid.isNullOrEmpty()) {
return JsonResult.ok("OK").put("t", t)!!
}
- var no = if (pageno <= 0) {
- 1
- } else {
- pageno
- }
- var today = DateUtil.getNow("yyyyMMdd")
- var yester = DateUtil.getNowInterDay(-1)
- var acc = userService.findAccountByUserid(user.userid!!, null)
- var point = userService.findPointsAccountByUserid(user.userid!!)
+ val no = if (pageno <= 0) 1 else pageno
+ val today = DateUtil.getNow("yyyyMMdd")
+ val yester = DateUtil.getNowInterDay(-1)
+ val acc = userService.findAccountByUserid(user.userid!!, null)
+ val point = userService.findPointsAccountByUserid(user.userid!!)
var amount = 0.0;
var pi = 0L
if (acc != null && acc.availbal != null) {
@@ -443,15 +441,12 @@
pi = point.points
}
var payseted = false
- if (!user!!.paypwd.isNullOrEmpty()) {
+ if (!user.paypwd.isNullOrEmpty()) {
payseted = true
}
- var name = ""
- var person = userService.findOnePersonByUserid(user.userid!!)
- if (person != null) {
- name = person.name
- }
- var page = userService.findPersondtlByUserid(user!!.userid!!, no)
+ val person = userService.findOnePersonByUserid(user.userid!!)
+ var name = person.name
+ val page = userService.findPersondtlByUserid(user.userid!!, no)
return JsonResult.ok("OK").put("page", page)
?.put("today", today)
?.put("yesterday", yester)
@@ -460,8 +455,7 @@
?.put("paypwdset", payseted)
?.put("name", name)
?.put("signed", if (user.issigned.isNullOrEmpty()) "" else user.issigned)
- ?.put("userid", if (user?.userid.isNullOrEmpty()) "" else user?.userid)!!
- ?.put("t", t)!!
+ ?.put("userid", if (user.userid.isNullOrEmpty()) "" else user.userid)!!.put("t", t)!!
}
/**
@@ -470,11 +464,12 @@
@RequestMapping("/billdetail")
fun billdetail(billid: String): JsonResult {
val p = SecurityContextHolder.getContext().authentication
- var user: TBMobileUser? = mobileApiService.findUserById(p.name) ?: return JsonResult.error("用户不存在,请注册")
+ val user: TBMobileUser? = mobileApiService.findUserById(p.name)
+ ?: return JsonResult.error("用户不存在,请注册")
if (user!!.userid.isNullOrEmpty()) {
return JsonResult.ok("OK")
}
- var dtl = userService.findPersondtlDetailByUserid(user?.userid!!, billid)
+ val dtl = userService.findPersondtlDetailByUserid(user.userid!!, billid)
return JsonResult.ok("OK").put("dtl", dtl)!!
}
@@ -484,23 +479,24 @@
@RequestMapping("/pwdset")
fun pwdset(oldpwd: String, newpwd: String, renewpwd: String): JsonResult {
val p = SecurityContextHolder.getContext().authentication
- var user: TBMobileUser? = mobileApiService.findUserById(p.name) ?: return JsonResult.error("用户不存在,请注册")
+ val user = mobileApiService.findUserById(p.name)
+ ?: return JsonResult.error("用户不存在,请注册")
if (newpwd != renewpwd) {
return JsonResult.error("两次密码不一致,请确认")
}
- if (newpwd.isNullOrEmpty() || newpwd.length < 6) {
+ if (newpwd.isEmpty() || newpwd.length < 6) {
return JsonResult.error("请重新设置密码,密码不能小于6位字符")
}
- if (user!!.loginpwderror > 5) {
+ if (user.loginpwderror > 5) {
return JsonResult.error(-1, "原密码错误次数过多,将退出系统,请重新登录系统或点击忘记密码功能找回密码")
}
val encoder = BCryptPasswordEncoder()
- if (!encoder.matches(oldpwd,user!!.loginpwd)) {
+ if (!encoder.matches(oldpwd, user.loginpwd)) {
user.loginpwderror += 1
mobileApiService.saveUser(user)
return JsonResult.error("原密码错误")
}
- if (user.loginpwderror != null && user.loginpwderror!! > 0) {
+ if (user.loginpwderror > 0) {
user.loginpwderror = 0
user.loginpwderrortime = null
}
@@ -516,7 +512,8 @@
@RequestMapping("/cardlost")
fun cardlost(paypwd: String): JsonResult {
val p = SecurityContextHolder.getContext().authentication
- var user: TBMobileUser? = mobileApiService.findUserById(p.name) ?: return JsonResult.error("用户不存在,请注册")
+ mobileApiService.findUserById(p.name)
+ ?: return JsonResult.error("用户不存在,请注册")
//TODO cardlost
return JsonResult.ok("ok")
}
@@ -528,7 +525,8 @@
@RequestMapping("/qrcode")
fun qrcode(): JsonResult {
val p = SecurityContextHolder.getContext().authentication
- var user: TBMobileUser? = mobileApiService.findUserById(p.name) ?: return JsonResult.error("用户不存在,请注册")
+ mobileApiService.findUserById(p.name)
+ ?: return JsonResult.error("用户不存在,请注册")
//TODO cardlost
return JsonResult.ok("ok")
}
diff --git a/payapi/src/main/kotlin/com/supwisdom/dlpay/mobile/service/impl/MobileApiServiceImpl.kt b/payapi/src/main/kotlin/com/supwisdom/dlpay/mobile/service/impl/MobileApiServiceImpl.kt
index 21cd2ee..1dfea56 100644
--- a/payapi/src/main/kotlin/com/supwisdom/dlpay/mobile/service/impl/MobileApiServiceImpl.kt
+++ b/payapi/src/main/kotlin/com/supwisdom/dlpay/mobile/service/impl/MobileApiServiceImpl.kt
@@ -21,11 +21,9 @@
}
override fun findPageById(pageid: String): TBPages? {
- var t = pagesDao.findById(pageid)
- if (t.isPresent) {
- return t.get()
+ return pagesDao.findById(pageid).let {
+ if (it.isPresent) it.get() else null
}
- return null
}
override fun findUserByPhone(phone: String): TBMobileUser? {
@@ -33,10 +31,8 @@
}
override fun findUserById(id: String): TBMobileUser? {
- var t = mobileUserDao.findById(id)
- if(t.isPresent){
- return t.get()
+ return mobileUserDao.findById(id).let {
+ if (it.isPresent) it.get() else null
}
- return null
}
}
\ No newline at end of file