refactor
authorTang Cheng <cheng.tang@supwisdom.com>
Mon, 22 Apr 2019 01:21:26 +0000 (09:21 +0800)
committerTang Cheng <cheng.tang@supwisdom.com>
Mon, 22 Apr 2019 01:51:19 +0000 (09:51 +0800)
src/main/kotlin/com/supwisdom/dlpay/user/service/impl/user_service_impl.kt

index 4f04d2c..7870e13 100644 (file)
@@ -25,20 +25,20 @@ class UserServiceImpl : UserService {
     override fun save(person: TPerson): TPerson {
         //TODO check tac
         personDao.save(person)
-        var account = accountDao.findByUserid(person.userid)
-        if (account == null) {
-            var systemdatetime = systemUtilService.sysdatetime
-            account = TAccount()
-            account.accname = person.name
-            account.opendate = systemdatetime.hostdate
-            account.userid = person.userid
-            account.status = person.status
-            account.subjno = Subject.SUBJNO_PERSONAL_DEPOSIT
-            account.balance = 0.0
-            account.availbal = 0.0
-            account.frozebal = 0.0
-            account.lowfreeFlag = false
-            accountDao.save(account)
+        if (accountDao.findByUserid(person.userid) == null) {
+            val systemdatetime = systemUtilService.sysdatetime
+            TAccount().apply {
+                accname = person.name
+                opendate = systemdatetime.hostdate
+                userid = person.userid
+                status = person.status
+                subjno = Subject.SUBJNO_PERSONAL_DEPOSIT
+                balance = 0.0
+                availbal = 0.0
+                frozebal = 0.0
+                lowfreeFlag = false
+                accountDao.save(this)
+            }
         }
         return person
     }