fix: 修改 taccountdaybal @version 问题
diff --git a/src/main/java/com/supwisdom/dlpay/api/domain/TAccountDayBal.java b/src/main/java/com/supwisdom/dlpay/api/domain/TAccountDayBal.java
index f31adb3..c5bd5f4 100644
--- a/src/main/java/com/supwisdom/dlpay/api/domain/TAccountDayBal.java
+++ b/src/main/java/com/supwisdom/dlpay/api/domain/TAccountDayBal.java
@@ -19,6 +19,7 @@
   @Column(name = "amount", precision = 15, scale = 2)
   private Double amount;
 
+  @Version
   @Column(name = "update_time", nullable = false)
   private Timestamp updateTime;
 
@@ -31,9 +32,6 @@
   @Column(name = "checked")
   private Boolean checked;
 
-  @Version
-  @Column(name = "optlock", columnDefinition = "integer DEFAULT 0", nullable = false)
-  private Long version;
 
   public String getAccno() {
     return accno;
@@ -91,11 +89,4 @@
     this.checked = checked;
   }
 
-  public Long getVersion() {
-    return version;
-  }
-
-  public void setVersion(Long version) {
-    this.version = version;
-  }
 }
diff --git a/src/main/kotlin/com/supwisdom/dlpay/account_process_async.kt b/src/main/kotlin/com/supwisdom/dlpay/account_process_async.kt
index 462cb7a..51be41f 100644
--- a/src/main/kotlin/com/supwisdom/dlpay/account_process_async.kt
+++ b/src/main/kotlin/com/supwisdom/dlpay/account_process_async.kt
@@ -11,7 +11,6 @@
 import org.springframework.scheduling.annotation.EnableAsync
 import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
 import org.springframework.stereotype.Component
-import org.springframework.transaction.annotation.Transactional
 import java.lang.reflect.Method
 import java.util.concurrent.Executor
 
@@ -21,8 +20,8 @@
     @Bean("shopAccBalanceUpdater")
     fun threadPoolExecutor(): Executor {
         return ThreadPoolTaskExecutor().apply {
-            corePoolSize = 10
-            maxPoolSize = 30
+            corePoolSize = 5
+            maxPoolSize = 10
             setWaitForTasksToCompleteOnShutdown(true)
         }
     }
@@ -48,7 +47,6 @@
     private lateinit var shopaccService: ShopaccService
 
     @Async("shopAccBalanceUpdater")
-    @Transactional
     fun updateShopBalance(shopdtlRefno: String) {
         shopaccService.recalcShopBalance(shopdtlRefno, true)
     }
diff --git a/src/main/kotlin/com/supwisdom/dlpay/api/scheduler_task.kt b/src/main/kotlin/com/supwisdom/dlpay/api/scheduler_task.kt
index 1034dab..a5846bb 100644
--- a/src/main/kotlin/com/supwisdom/dlpay/api/scheduler_task.kt
+++ b/src/main/kotlin/com/supwisdom/dlpay/api/scheduler_task.kt
@@ -5,7 +5,6 @@
 import org.springframework.beans.factory.annotation.Autowired
 import org.springframework.scheduling.annotation.Scheduled
 import org.springframework.stereotype.Service
-import org.springframework.transaction.annotation.Transactional
 
 @Service
 class MySchedulerTask {
@@ -17,7 +16,6 @@
     }
 
     @Scheduled(fixedRate = 5000)
-    @Transactional
     fun dealShopUnupdatedDtl() {
         shopaccService.findUnupdatedShopDtl(100).forEach {
             doShopBlanceUpdate(it)
diff --git a/src/main/kotlin/com/supwisdom/dlpay/api/service/impl/account_service_impl.kt b/src/main/kotlin/com/supwisdom/dlpay/api/service/impl/account_service_impl.kt
index 6e72082..fb88e55 100644
--- a/src/main/kotlin/com/supwisdom/dlpay/api/service/impl/account_service_impl.kt
+++ b/src/main/kotlin/com/supwisdom/dlpay/api/service/impl/account_service_impl.kt
@@ -12,6 +12,7 @@
 import com.supwisdom.dlpay.framework.util.TradeErrorCode
 import org.springframework.beans.factory.annotation.Autowired
 import org.springframework.stereotype.Repository
+import java.sql.Timestamp
 import javax.persistence.EntityManager
 import javax.persistence.LockModeType
 import javax.persistence.OptimisticLockException
@@ -33,7 +34,7 @@
         checked = false
     }
 
-    private fun doRecalcAccountBalance(dtl: TPersondtl, account: TAccount): TAccountDayBal {
+    private fun doRecalcAccountBalance(dtl: TPersondtl, amount: Double, account: TAccount): TAccountDayBal {
         val accountDayBal = entityManager.find(TAccountDayBal::class.java,
                 TAccountDayBalPk().also {
                     it.accno = account.accno
@@ -42,8 +43,7 @@
 
         accountDayBal.also {
             it.lastRefno = dtl.refno
-            it.amount += dtl.amount
-            it.updateTime = systemUtilServcie.sysdatetime.currentTimestamp
+            it.amount += amount
         }.also {
             entityManager.persist(it)
         }
@@ -58,7 +58,7 @@
                         throw TransactionProcessException(TradeErrorCode.SHORT_BALANCE_ERROR, "个人账户余额不足")
                     }
                     dtl.befbal = account.availbal
-                    doRecalcAccountBalance(dtl, account)
+                    doRecalcAccountBalance(dtl, amount, account)
                     account.availbal += dtl.amount
                     account.balance += dtl.amount
 
@@ -87,10 +87,12 @@
 
 @Repository
 class ShopaccServiceImpl : ShopaccService {
-
     @PersistenceContext
     private lateinit var entityManager: EntityManager
 
+    @Autowired
+    private lateinit var systemUtilService: SystemUtilService
+
     override fun recalcShopBalance(dtl: TShopdtl, amount: Double, overdraft: Boolean) {
         val shopacc = entityManager.find(TShopacc::class.java, dtl.shopaccno, LockModeType.OPTIMISTIC)
                 ?: throw TransactionProcessException(TradeErrorCode.ACCOUNT_NOT_EXISTS,
@@ -117,9 +119,15 @@
     }
 
     override fun findUnupdatedShopDtl(maxCount: Int): List<TShopdtl> {
+        val startTime = Timestamp(systemUtilService.sysdatetime.sysdate.time - TIME_MINITUES)
         return entityManager.createQuery("""
-            SELECT p FROM TShopdtl p
-            WHERE p.status='$DTL_STATUS_SUCCESS' and p.updateBala=false
+            SELECT p FROM TShopdtl p, TTransactionMain m
+            WHERE m.refno=p.refno and p.status='$DTL_STATUS_SUCCESS' and p.updateBala=false
+            and m.endTime < '$startTime'
             ORDER BY p.refno""", TShopdtl::class.java).setMaxResults(maxCount).resultList
     }
+
+    companion object {
+        private const val TIME_MINITUES = 5 * 60 * 1000
+    }
 }
\ No newline at end of file