删除代码
diff --git a/src/main/java/com/supwisdom/dlpay/api/dao/AccountDao.java b/src/main/java/com/supwisdom/dlpay/api/dao/AccountDao.java
deleted file mode 100644
index ee43852..0000000
--- a/src/main/java/com/supwisdom/dlpay/api/dao/AccountDao.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package com.supwisdom.dlpay.api.dao;
-
-import com.supwisdom.dlpay.api.domain.TAccount;
-import com.supwisdom.dlpay.api.repositories.TAccountRepository;
-import org.springframework.data.domain.Page;
-import org.springframework.data.domain.Pageable;
-import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.data.jpa.repository.Lock;
-import org.springframework.data.jpa.repository.Query;
-import org.springframework.data.jpa.repository.QueryHints;
-import org.springframework.data.repository.query.Param;
-
-import javax.persistence.LockModeType;
-import javax.persistence.QueryHint;
-
-public interface AccountDao extends JpaRepository<TAccount, String> {
-
- @Lock(LockModeType.PESSIMISTIC_WRITE)
- @Query("select a from TAccount a where a.accno = ?1")
- TAccount getByAccnoForUpdate(String accno);
-
- @Lock(LockModeType.PESSIMISTIC_WRITE)
- @QueryHints({@QueryHint(name = "javax.persistence.lock.timeout", value = "0")})
- @Query("select a from TAccount a where a.accno = ?1")
- TAccount getByAccnoForUpdateNowait(String accno);
-
- TAccount findByUserid(String userid);
-
- @Lock(LockModeType.PESSIMISTIC_WRITE)
- @Query("select a from TAccount a where a.userid = ?1")
- TAccount getByUseridForUpdate(String userid);
-
- @Lock(LockModeType.PESSIMISTIC_WRITE)
- @QueryHints({@QueryHint(name = "javax.persistence.lock.timeout", value = "0")})
- @Query("select a from TAccount a where a.userid = ?1")
- TAccount getByUseridForUpdateNowait(String userid);
-
- @Query("select a from TAccount a where a.userid = ?1 and a.subjno=?2")
- TAccount findByUseridAndSubjno(String userid, String subjno);
-
- @Query("select a from TAccount a where a.person.name like CONCAT('%',:accname,'%') ")
- Page<TAccount> findAllByAccnameContaining(@Param("accname") String accname, Pageable pageable);
-}
diff --git a/src/main/java/com/supwisdom/dlpay/api/dao/DebitCreditDtlDao.java b/src/main/java/com/supwisdom/dlpay/api/dao/DebitCreditDtlDao.java
deleted file mode 100644
index 0b5e733..0000000
--- a/src/main/java/com/supwisdom/dlpay/api/dao/DebitCreditDtlDao.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package com.supwisdom.dlpay.api.dao;
-
-import com.supwisdom.dlpay.api.domain.TDebitCreditDtl;
-import com.supwisdom.dlpay.api.domain.TDebitCreditDtlPK;
-import com.supwisdom.dlpay.framework.data.VoucherTemp;
-import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.data.jpa.repository.Query;
-import org.springframework.data.repository.query.Param;
-import org.springframework.stereotype.Repository;
-
-import java.util.List;
-
-@Repository
-public interface DebitCreditDtlDao extends JpaRepository<TDebitCreditDtl, TDebitCreditDtlPK> {
-
- @Query(value = "select a.drsubjno,case when a.drsubjno='220201' then '220201' else a.draccno end as draccno, a.crsubjno,case when a.crsubjno='220201' then '220201' else a.craccno end as craccno," +
- "a.summary,count(distinct a.refno) as transcnt,sum(a.amount) as transamt " +
- "from TB_USERDTL_DEBITCREDIT a left join TB_TRANSACTIONMAIN b on a.refno=b.refno " +
- "where b.status='success' and b.accdate=:settledate " +
- "group by a.drsubjno,case when a.drsubjno='220201' then '220201' else a.draccno end,a.crsubjno,case when a.crsubjno='220201' then '220201' else a.craccno end,a.summary ", nativeQuery = true)
- List<VoucherTemp> getVoucherData(@Param("settledate") String settledate);
-
- List<TDebitCreditDtl> findByRefno(String refno);
-}
diff --git a/src/main/java/com/supwisdom/dlpay/api/dao/PaytypeConfigDao.java b/src/main/java/com/supwisdom/dlpay/api/dao/PaytypeConfigDao.java
deleted file mode 100644
index 50cf1e1..0000000
--- a/src/main/java/com/supwisdom/dlpay/api/dao/PaytypeConfigDao.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package com.supwisdom.dlpay.api.dao;
-
-import com.supwisdom.dlpay.api.domain.TPaytypeConfig;
-import com.supwisdom.dlpay.api.domain.TPaytypeConfigPK;
-import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.stereotype.Repository;
-
-import java.util.List;
-
-/**
- * Created by shuwei on 2019/4/9.
- */
-@Repository
-public interface PaytypeConfigDao extends JpaRepository<TPaytypeConfig, TPaytypeConfigPK> {
- List<TPaytypeConfig> getByPaytype(String paytype);
-
- TPaytypeConfig getByPaytypeAndAndConfigid(String paytype, String configid);
-
- List<TPaytypeConfig> getByPaytypeOrderByConfigid(String paytype);
-}
diff --git a/src/main/java/com/supwisdom/dlpay/api/dao/PersondtlDao.java b/src/main/java/com/supwisdom/dlpay/api/dao/PersondtlDao.java
deleted file mode 100644
index 467ac47..0000000
--- a/src/main/java/com/supwisdom/dlpay/api/dao/PersondtlDao.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package com.supwisdom.dlpay.api.dao;
-
-import com.supwisdom.dlpay.api.domain.TPersondtl;
-import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
-import org.springframework.stereotype.Repository;
-
-@Repository
-public interface PersondtlDao extends JpaRepository<TPersondtl, String>,JpaSpecificationExecutor<TPersondtl> {
-}
diff --git a/src/main/java/com/supwisdom/dlpay/api/dao/PointsAccountDao.java b/src/main/java/com/supwisdom/dlpay/api/dao/PointsAccountDao.java
deleted file mode 100644
index 96940b9..0000000
--- a/src/main/java/com/supwisdom/dlpay/api/dao/PointsAccountDao.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.supwisdom.dlpay.api.dao;
-
-import com.supwisdom.dlpay.api.domain.TPointsAccount;
-import org.springframework.data.domain.Page;
-import org.springframework.data.domain.Pageable;
-import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.data.jpa.repository.Query;
-import org.springframework.data.repository.query.Param;
-import org.springframework.stereotype.Repository;
-
-@Repository
-public interface PointsAccountDao extends JpaRepository<TPointsAccount, String> {
- TPointsAccount findByUserid(String userid);
-
- @Query("select a from TPointsAccount a where a.person.name like CONCAT('%',:name,'%') ")
- Page<TPointsAccount> findAllByNameContaining(@Param("name") String name, Pageable pageable);
-
-}
diff --git a/src/main/java/com/supwisdom/dlpay/api/dao/PointsTransdtlDao.java b/src/main/java/com/supwisdom/dlpay/api/dao/PointsTransdtlDao.java
deleted file mode 100644
index cf3c404..0000000
--- a/src/main/java/com/supwisdom/dlpay/api/dao/PointsTransdtlDao.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package com.supwisdom.dlpay.api.dao;
-
-import com.supwisdom.dlpay.api.domain.TPointsTransdtl;
-import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.stereotype.Repository;
-
-@Repository
-public interface PointsTransdtlDao extends JpaRepository<TPointsTransdtl, String> {
-}
diff --git a/src/main/java/com/supwisdom/dlpay/api/dao/ShopPaytypeConfigDao.java b/src/main/java/com/supwisdom/dlpay/api/dao/ShopPaytypeConfigDao.java
deleted file mode 100644
index a7164c8..0000000
--- a/src/main/java/com/supwisdom/dlpay/api/dao/ShopPaytypeConfigDao.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package com.supwisdom.dlpay.api.dao;
-
-import com.supwisdom.dlpay.api.domain.TShopPaytypeConfig;
-import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.data.jpa.repository.Query;
-import org.springframework.stereotype.Repository;
-
-import java.util.List;
-
-@Repository
-public interface ShopPaytypeConfigDao extends JpaRepository<TShopPaytypeConfig, String> {
- @Query("select a from TShopPaytypeConfig a where a.paytype=?1 and a.shopaccno=?2 ")
- List<TShopPaytypeConfig> getShopPaytypeConfigs(String paytype, String shopaccno);
-
- @Query("select a from TShopPaytypeConfig a where a.shopaccno=?1 and a.paytype=?2 and a.configid=?3 ")
- TShopPaytypeConfig getShopPaytypeConfigById(String shopaccno,String paytype, String configid);
-}
diff --git a/src/main/java/com/supwisdom/dlpay/api/dao/ShopPaytypeDao.java b/src/main/java/com/supwisdom/dlpay/api/dao/ShopPaytypeDao.java
deleted file mode 100644
index 03196e1..0000000
--- a/src/main/java/com/supwisdom/dlpay/api/dao/ShopPaytypeDao.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.supwisdom.dlpay.api.dao;
-
-import com.supwisdom.dlpay.api.domain.TShopPaytype;
-import com.supwisdom.dlpay.api.domain.TShopPaytypePK;
-import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
-import org.springframework.data.jpa.repository.Query;
-import org.springframework.stereotype.Repository;
-
-@Repository
-public interface ShopPaytypeDao extends JpaRepository<TShopPaytype, TShopPaytypePK>, JpaSpecificationExecutor<TShopPaytype> {
- @Query("select a from TShopPaytype a where a.paytype=?1 and a.shopaccno=?2 ")
- TShopPaytype getById(String paytype, String shopaccno);
-
-}
diff --git a/src/main/java/com/supwisdom/dlpay/api/dao/ShopdtlDao.java b/src/main/java/com/supwisdom/dlpay/api/dao/ShopdtlDao.java
deleted file mode 100644
index d8dda28..0000000
--- a/src/main/java/com/supwisdom/dlpay/api/dao/ShopdtlDao.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package com.supwisdom.dlpay.api.dao;
-
-import com.supwisdom.dlpay.api.domain.TShopdtl;
-import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
-import org.springframework.stereotype.Repository;
-
-@Repository
-public interface ShopdtlDao extends JpaRepository<TShopdtl, String>,JpaSpecificationExecutor<TShopdtl> {
-}
diff --git a/src/main/java/com/supwisdom/dlpay/api/dao/SourceTypeDao.java b/src/main/java/com/supwisdom/dlpay/api/dao/SourceTypeDao.java
deleted file mode 100644
index b823f3d..0000000
--- a/src/main/java/com/supwisdom/dlpay/api/dao/SourceTypeDao.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package com.supwisdom.dlpay.api.dao;
-
-import com.supwisdom.dlpay.api.domain.TSourceType;
-import org.springframework.data.domain.Page;
-import org.springframework.data.domain.Pageable;
-import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.data.jpa.repository.Query;
-import org.springframework.stereotype.Repository;
-
-import java.util.List;
-
-/**
- * Created by shuwei on 2019/4/9.
- */
-@Repository
-public interface SourceTypeDao extends JpaRepository<TSourceType, String> {
- TSourceType getBySourceType(String paytype);
-
- Page<TSourceType> findBySourceTypeContaining(String paytype, Pageable pageable);
-
- @Query("select t from TSourceType t")
- List<TSourceType> getConsumeSourceTypes();
-}
diff --git a/src/main/java/com/supwisdom/dlpay/api/dao/SubjectdtlDao.java b/src/main/java/com/supwisdom/dlpay/api/dao/SubjectdtlDao.java
deleted file mode 100644
index 968a031..0000000
--- a/src/main/java/com/supwisdom/dlpay/api/dao/SubjectdtlDao.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package com.supwisdom.dlpay.api.dao;
-
-import com.supwisdom.dlpay.api.domain.TSubjectdtl;
-import org.springframework.data.repository.CrudRepository;
-
-public interface SubjectdtlDao extends CrudRepository<TSubjectdtl, String> {
-}
diff --git a/src/main/java/com/supwisdom/dlpay/api/dao/TransactionMainDao.java b/src/main/java/com/supwisdom/dlpay/api/dao/TransactionMainDao.java
deleted file mode 100644
index 649758d..0000000
--- a/src/main/java/com/supwisdom/dlpay/api/dao/TransactionMainDao.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.supwisdom.dlpay.api.dao;
-
-import com.supwisdom.dlpay.api.domain.TTransactionMain;
-import org.springframework.data.jpa.repository.Lock;
-import org.springframework.data.jpa.repository.Query;
-import org.springframework.data.jpa.repository.QueryHints;
-import org.springframework.data.repository.CrudRepository;
-
-import javax.persistence.LockModeType;
-import javax.persistence.QueryHint;
-
-public interface TransactionMainDao extends CrudRepository<TTransactionMain, String> {
-
- @Lock(LockModeType.PESSIMISTIC_WRITE)
- @QueryHints({@QueryHint(name = "javax.persistence.lock.timeout", value = "0")})
- @Query(value = "select t from TTransactionMain t where t.refno = ?1")
- TTransactionMain findByRefnoForUpdate(String refno);
-}
diff --git a/src/main/java/com/supwisdom/dlpay/api/repositories/TAccountRepository.java b/src/main/java/com/supwisdom/dlpay/api/repositories/TAccountRepository.java
deleted file mode 100644
index 222391f..0000000
--- a/src/main/java/com/supwisdom/dlpay/api/repositories/TAccountRepository.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package com.supwisdom.dlpay.api.repositories;
-
-import com.supwisdom.dlpay.api.domain.TAccount;
-import com.supwisdom.dlpay.api.domain.TPersondtl;
-
-public interface TAccountRepository {
- int recalcAccountBalance(String accno, Double avaibal, Double amount, boolean overdraft);
-
- int recalcAccountBalance(TAccount account, Double amount, boolean overdraft);
-
- int recalcAccountBalance(TPersondtl dtl, Double amount, boolean overdraft);
-}
diff --git a/src/main/java/com/supwisdom/dlpay/api/repositories/TShopaccRepository.java b/src/main/java/com/supwisdom/dlpay/api/repositories/TShopaccRepository.java
deleted file mode 100644
index 291bd1c..0000000
--- a/src/main/java/com/supwisdom/dlpay/api/repositories/TShopaccRepository.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package com.supwisdom.dlpay.api.repositories;
-
-import com.supwisdom.dlpay.api.domain.TShopdtl;
-
-public interface TShopaccRepository {
- int recalcShopBalance(TShopdtl dtl, Double amount, boolean overdraft);
-}
diff --git a/src/main/java/com/supwisdom/dlpay/api/service/SourceTypeService.java b/src/main/java/com/supwisdom/dlpay/api/service/SourceTypeService.java
deleted file mode 100644
index 86a9841..0000000
--- a/src/main/java/com/supwisdom/dlpay/api/service/SourceTypeService.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package com.supwisdom.dlpay.api.service;
-
-import com.supwisdom.dlpay.api.domain.TSourceType;
-import org.springframework.cache.annotation.Cacheable;
-import org.springframework.transaction.annotation.Propagation;
-import org.springframework.transaction.annotation.Transactional;
-
-import java.util.Map;
-
-/**
- * Created by shuwei on 2019/4/9.
- */
-public interface SourceTypeService {
-
- @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, readOnly = true)
- TSourceType getByPaytype(String paytype);
-
- @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, readOnly = true)
- Map<String, String> getPaytypeConfigByPaytype(String pattype);
-
-}
diff --git a/src/main/java/com/supwisdom/dlpay/api/service/impl/SourceTypeServiceImpl.java b/src/main/java/com/supwisdom/dlpay/api/service/impl/SourceTypeServiceImpl.java
deleted file mode 100644
index 60cf1a5..0000000
--- a/src/main/java/com/supwisdom/dlpay/api/service/impl/SourceTypeServiceImpl.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package com.supwisdom.dlpay.api.service.impl;
-
-import com.supwisdom.dlpay.api.dao.PaytypeConfigDao;
-import com.supwisdom.dlpay.api.dao.SourceTypeDao;
-import com.supwisdom.dlpay.api.domain.TSourceType;
-import com.supwisdom.dlpay.api.domain.TPaytypeConfig;
-import com.supwisdom.dlpay.api.service.SourceTypeService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.cache.annotation.CacheConfig;
-import org.springframework.cache.annotation.Cacheable;
-import org.springframework.stereotype.Service;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Created by shuwei on 2019/4/9.
- */
-@Service
-@CacheConfig(cacheNames = "sourcetypeCache")
-public class SourceTypeServiceImpl implements SourceTypeService {
- @Autowired
- private SourceTypeDao paytypeDao;
- @Autowired
- private PaytypeConfigDao paytypeConfigDao;
-
- @Override
- @Cacheable
- public TSourceType getByPaytype(String paytype) {
- return paytypeDao.getOne(paytype);
- }
-
- @Override
- @Cacheable
- public Map<String, String> getPaytypeConfigByPaytype(String pattype) {
- List<TPaytypeConfig> list = paytypeConfigDao.getByPaytype(pattype);
- Map<String, String> map = new HashMap<>(list.size());
- for (TPaytypeConfig paytypeConfig : list) {
- map.put(paytypeConfig.getConfigid(), paytypeConfig.getConfigValue());
- }
- return map;
- }
-}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/dao/SettleCtlDao.java b/src/main/java/com/supwisdom/dlpay/framework/dao/SettleCtlDao.java
deleted file mode 100644
index ec8fadc..0000000
--- a/src/main/java/com/supwisdom/dlpay/framework/dao/SettleCtlDao.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package com.supwisdom.dlpay.framework.dao;
-
-import com.supwisdom.dlpay.framework.domain.TSettlectl;
-import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.data.jpa.repository.Lock;
-import org.springframework.data.jpa.repository.Modifying;
-import org.springframework.data.jpa.repository.Query;
-import org.springframework.data.repository.query.Param;
-import org.springframework.stereotype.Repository;
-
-import javax.persistence.LockModeType;
-
-@Repository
-public interface SettleCtlDao extends JpaRepository<TSettlectl, Integer> {
- @Lock(value = LockModeType.PESSIMISTIC_WRITE)
- TSettlectl findByBooksetno(Integer booksetno);
-
- @Lock(value = LockModeType.PESSIMISTIC_WRITE)
- @Query(value = "from TSettlectl where booksetno=:booksetno ")
- TSettlectl findByBooksetnoWithLock(@Param("booksetno") Integer booksetno);
-
- @Modifying(clearAutomatically = true)
- @Query(value = "update TB_SETTLECTL set PERIODYEAR=:peridyear,PERIODMONTH=:peridmonth where BOOKSETNO=1 ", nativeQuery = true)
- void updateSettlePeriod(@Param("peridyear") int peridyear, @Param("peridmonth") int peridmonth);
-
-}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/dao/SettleLogDao.java b/src/main/java/com/supwisdom/dlpay/framework/dao/SettleLogDao.java
deleted file mode 100644
index 30de1ae..0000000
--- a/src/main/java/com/supwisdom/dlpay/framework/dao/SettleLogDao.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package com.supwisdom.dlpay.framework.dao;
-
-import com.supwisdom.dlpay.framework.domain.TSettleLog;
-import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.stereotype.Repository;
-
-@Repository
-public interface SettleLogDao extends JpaRepository<TSettleLog, String> {
-}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/dao/ShopDao.java b/src/main/java/com/supwisdom/dlpay/framework/dao/ShopDao.java
deleted file mode 100644
index e7cc15f..0000000
--- a/src/main/java/com/supwisdom/dlpay/framework/dao/ShopDao.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package com.supwisdom.dlpay.framework.dao;
-
-import com.supwisdom.dlpay.framework.domain.TShop;
-import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.data.jpa.repository.Lock;
-import org.springframework.data.jpa.repository.Query;
-
-import javax.persistence.LockModeType;
-import java.util.List;
-
-/**
- * Created by shuwei on 2019/4/15.
- */
-public interface ShopDao extends JpaRepository<TShop, Integer> {
- TShop getByThirdUniqueIdenty(String thirdUniqueIdenty);
-
- @Lock(LockModeType.PESSIMISTIC_WRITE)
- @Query("select a from TShop a where a.thirdUniqueIdenty=?1")
- TShop getByThirdUniqueIdentyForUpdate(String thirdUniqueIdenty);
-
- TShop getTShopByShopid(Integer shopid);
-
- TShop getTShopByShopaccno(String shopaccno);
-
- @Query("from TShop where status='normal' and fshopid=?1 ")
- List<TShop> getChildShopsByShopid(Integer shopid);
-
- @Query(value = "select count(t.shopid) from TB_SHOP t where t.status='normal' and t.shopname=?1 and t.fshopid=?2 and t.shopid!=?3", nativeQuery = true)
- long checkShopnameExist(String shopname, int fshopid, int oldShopid);
-
- @Query("from TShop where status='normal' order by shopid asc ")
- List<TShop> getNormalShops();
-}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/dao/ShopaccDao.java b/src/main/java/com/supwisdom/dlpay/framework/dao/ShopaccDao.java
deleted file mode 100644
index 303a3b0..0000000
--- a/src/main/java/com/supwisdom/dlpay/framework/dao/ShopaccDao.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package com.supwisdom.dlpay.framework.dao;
-
-import com.supwisdom.dlpay.framework.domain.TShopacc;
-import org.springframework.data.jpa.repository.*;
-import org.springframework.data.repository.query.Param;
-import org.springframework.stereotype.Repository;
-import org.springframework.transaction.annotation.Transactional;
-
-import javax.persistence.LockModeType;
-
-import javax.persistence.QueryHint;
-import java.util.List;
-
-@Repository
-public interface ShopaccDao extends JpaRepository<TShopacc, String> {
-
- @Query(value = "select t.SHOPACCNO from TB_SHOPACC t left join TB_SHOPACCDAY a on t.SHOPACCNO=a.SHOPACCNO and a.accdate=:lastsettday where a.SHOPACCNO is null ", nativeQuery = true)
- List<String> getNewShopacc(@Param("lastsettday") String lastsettday);
-
-
- @Query(value = "select shopname from TShopacc where shopaccno=:shopaccno ")
- String getShopname(@Param("shopaccno") String shopaccno);
-
- @Query(value = "select t.SHOPACCNO as accno from TB_SHOPACC t left join TB_SHOPACCBAL a on t.SHOPACCNO=a.SHOPACCNO where a.SHOPACCNO is null and t.opendate>=:settday ", nativeQuery = true)
- List<String> getNewAddShopacc(@Param("settday") String settday);
-
- TShopacc findByShopid(Integer shopid);
-
- @Lock(LockModeType.PESSIMISTIC_WRITE)
- @QueryHints({@QueryHint(name = "javax.persistence.lock.timeout", value = "0")})
- @Query("select a from TShopacc a where a.shopid=?1")
- TShopacc getShopaccWithLockNowait(Integer shopid);
-
- @Lock(LockModeType.PESSIMISTIC_WRITE)
- @Query("select a from TShopacc a where a.shopid=?1")
- TShopacc getShopaccWithLock(Integer shopid);
-
- TShopacc getByShopaccno(String shopaccno);
-
- @Transactional
- @Modifying(clearAutomatically = true)
- @Query("update TShopacc set shopname=?1 where shopaccno=?2")
- void updateShopnameByShopaccno(String shopname, String shopaccno);
-
-
- TShopacc findByShopaccno(String acc);
-}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/dao/ShopaccdayDao.java b/src/main/java/com/supwisdom/dlpay/framework/dao/ShopaccdayDao.java
deleted file mode 100644
index ddc0265..0000000
--- a/src/main/java/com/supwisdom/dlpay/framework/dao/ShopaccdayDao.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package com.supwisdom.dlpay.framework.dao;
-
-import com.supwisdom.dlpay.framework.domain.TShopaccday;
-import com.supwisdom.dlpay.framework.domain.TShopaccdayPK;
-import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.data.jpa.repository.Modifying;
-import org.springframework.data.jpa.repository.Query;
-import org.springframework.data.repository.query.Param;
-import org.springframework.stereotype.Repository;
-
-import java.util.List;
-
-@Repository
-public interface ShopaccdayDao extends JpaRepository<TShopaccday, TShopaccdayPK> {
-
- @Query(value = "from TShopaccday t where t.accdate=:accdate ")
- List<TShopaccday> getShopaccdayByAccdate(@Param("accdate") String accdate);
-
- @Query(value = "from TShopaccday t where t.accdate=:accdate and t.shopaccno=:shopaccno ")
- TShopaccday getTShopaccdayById(@Param("accdate") String accdate, @Param("shopaccno") String shopaccno);
-
- @Modifying(clearAutomatically = true)
- @Query(value = "update TB_SHOPACCDAY set balance=beginbal-dramt+cramt,updtime=:updtime where accdate=:accdate ", nativeQuery = true)
- void updateShopaccdayBalance(@Param("accdate") String accdate,@Param("updtime")String updtime);
-
- @Query(value = "select sum(balance) as amount from TShopaccday where accdate=:accdate ")
- Double getSumBalance(@Param("accdate") String accdate);
-
-}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/dao/SubjectDao.java b/src/main/java/com/supwisdom/dlpay/framework/dao/SubjectDao.java
deleted file mode 100644
index 2c0fae9..0000000
--- a/src/main/java/com/supwisdom/dlpay/framework/dao/SubjectDao.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package com.supwisdom.dlpay.framework.dao;
-
-import com.supwisdom.dlpay.framework.data.ExistBean;
-import com.supwisdom.dlpay.framework.domain.TSubject;
-import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.data.jpa.repository.Query;
-import org.springframework.data.repository.query.Param;
-import org.springframework.stereotype.Repository;
-
-import java.util.List;
-
-@Repository
-public interface SubjectDao extends JpaRepository<TSubject, String> {
-
- @Query(value = "select t.SUBJNO from TB_SUBJECT t left join TB_SUBJECTBAL a on t.SUBJNO=a.SUBJNO where t.ENDFLAG=1 and a.SUBJNO is null ", nativeQuery = true)
- List<String> getNewSubject();
-
- @Query(value = "select count(t.subjno) as existed from TB_SUBJECT t left join TB_SUBJECTBAL a on t.SUBJNO=a.SUBJNO where t.ENDFLAG=1 and a.SUBJNO is null ", nativeQuery = true)
- ExistBean checkSettleSubject();
-
- @Query(value = "select a.subjno as accno from TB_SUBJECT a left join (select subjno from TB_SUBJECTDAY where accdate =:accdate ) b on a.subjno=b.subjno where a.subjlevel=1 and b.subjno is null ", nativeQuery = true)
- List<String> getNewSubjnos(@Param("accdate") String accdate);
-
- @Query(value = "select subjname from TSubject where subjno=:subjno ")
- String getSubjectname(@Param("subjno") String subjno);
-
- TSubject findBySubjno(String subjno);
-}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/dao/SubjectbalDao.java b/src/main/java/com/supwisdom/dlpay/framework/dao/SubjectbalDao.java
deleted file mode 100644
index 73b01cf..0000000
--- a/src/main/java/com/supwisdom/dlpay/framework/dao/SubjectbalDao.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package com.supwisdom.dlpay.framework.dao;
-
-import com.supwisdom.dlpay.framework.data.MerchBean;
-import com.supwisdom.dlpay.framework.data.SubjectInfoBean;
-import com.supwisdom.dlpay.framework.domain.TSubjectbal;
-import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.data.jpa.repository.Lock;
-import org.springframework.data.jpa.repository.Query;
-import org.springframework.data.repository.query.Param;
-import org.springframework.stereotype.Repository;
-
-import javax.persistence.LockModeType;
-import java.util.List;
-
-@Repository
-public interface SubjectbalDao extends JpaRepository<TSubjectbal, String> {
-
- @Query(value = "select t.* from TB_SUBJECTBAL t left join ( select subjno from TB_SUBJECTDAY where accdate =:lastsettday) a on t.subjno=a.subjno where a.subjno is null ", nativeQuery = true)
- List<TSubjectbal> getUnsettleSubjectbal(@Param("lastsettday") String lastsettday);
-
- @Query(value = "select sum(BEGINDRBAL) as dramt,sum(BEGINCRBAL) as cramt from TB_SUBJECTBAL where SUBJNO in (select SUBJNO from TB_SUBJECT where fsubjno=:fsubjno) ", nativeQuery = true)
- MerchBean getSubjectInfo(@Param("fsubjno") String fsubjno);
-
- @Query(value = "select sa.subjno,sa.drbal,crbal,sb.subjtype,sb.balflag from TB_SUBJECTBAL sa,TB_SUBJECT sb where sa.subjno=sb.subjno and sb.endflag=1 order by sa.subjno ", nativeQuery = true)
- List<SubjectInfoBean> getSubjectbalAndFlag();
-
- @Query(value = "select case when :balflag=1 then sum(drbal) else sum(crbal) end as amount from tb_subjectbal where subjno in (select subjno from tb_subject where endflag=1 and balflag=:balflag )",nativeQuery = true)
- Double getSumEndsubjectBalByEndflag(@Param("balflag")Integer balflag);
-
- @Lock(LockModeType.PESSIMISTIC_WRITE)
- @Query("from TSubjectbal where subjno=:subjno ")
- TSubjectbal getTSubjectbalBySubjnoWithLock(@Param("subjno")String subjno);
-}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/dao/SubjectdayDao.java b/src/main/java/com/supwisdom/dlpay/framework/dao/SubjectdayDao.java
deleted file mode 100644
index fb10362..0000000
--- a/src/main/java/com/supwisdom/dlpay/framework/dao/SubjectdayDao.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package com.supwisdom.dlpay.framework.dao;
-
-import com.supwisdom.dlpay.framework.data.FSubjectInfoBean;
-import com.supwisdom.dlpay.framework.data.MerchBean;
-import com.supwisdom.dlpay.framework.domain.TSubjectday;
-import com.supwisdom.dlpay.framework.domain.TSubjectdayPK;
-import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.data.jpa.repository.Query;
-import org.springframework.data.repository.query.Param;
-import org.springframework.stereotype.Repository;
-
-import java.util.List;
-
-@Repository
-public interface SubjectdayDao extends JpaRepository<TSubjectday, TSubjectdayPK> {
-
- @Query(value = "from TSubjectday where accdate=:accdate ")
- List<TSubjectday> getAllByAccdate(@Param("accdate") String accdate);
-
- @Query(value = "select a.subjno as shopaccno,a.begindrbal as dramt,a.begincrbal as cramt from TB_SUBJECTDAY a left join (select subjno from TB_SUBJECT where endflag=1) b on a.subjno=b.subjno where a.accdate=:accdate and b.subjno is not null ", nativeQuery = true)
- List<MerchBean> getEndSubjectbalInfos(@Param("accdate") String accdate);
-
- @Query(value = "from TSubjectday where accdate=:accdate and subjno=:subjno")
- TSubjectday getSubjectDayById(@Param("accdate") String accdate, @Param("subjno") String subjno);
-
- @Query(value = "from TSubjectday t where t.accdate=:accdate and t.subjno in (select subjno from TSubject where subjlevel=1 and endflag=0 ) ")
- List<TSubjectday> getParentSubjectday(@Param("accdate") String accdate);
-
- @Query(value = "select sum(sb.begindrbal) as begindrbal,sum(sb.begincrbal) as begincrbal,sum(sb.dramt) as dramt,sum(sb.cramt) as cramt,sum(sb.drbal) as drbal,sum(sb.crbal) as crbal " +
- "from TB_SUBJECTDAY sb, TB_SUBJECT s " +
- "where sb.accdate =:accdate and sb.subjno=s.subjno and s.subjlevel=2 and s.fsubjno=:fsubjno ",nativeQuery = true)
- FSubjectInfoBean getParentSumInfo(@Param("accdate") String accdate, @Param("fsubjno") String fsubjno);
-
- @Query(value = "select sum(begindrbal) as begindrbal,sum(begincrbal) as begincrbal,sum(dramt) as dramt,sum(cramt) as cramt,sum(drbal) as drbal,sum(crbal) as crbal " +
- "from tb_subjectday where accdate=:accdate and subjno in (select subjno from tb_subject where subjlevel=1) ", nativeQuery = true)
- FSubjectInfoBean getAllParentSubjectSumInfo(@Param("accdate") String accdate);
-}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/dao/TranscodeDao.java b/src/main/java/com/supwisdom/dlpay/framework/dao/TranscodeDao.java
deleted file mode 100644
index d40f266..0000000
--- a/src/main/java/com/supwisdom/dlpay/framework/dao/TranscodeDao.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package com.supwisdom.dlpay.framework.dao;
-
-import com.supwisdom.dlpay.framework.domain.TTranscode;
-import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.stereotype.Repository;
-
-@Repository
-public interface TranscodeDao extends JpaRepository<TTranscode, Integer> {
-}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/dao/VoucherDao.java b/src/main/java/com/supwisdom/dlpay/framework/dao/VoucherDao.java
deleted file mode 100644
index e839c01..0000000
--- a/src/main/java/com/supwisdom/dlpay/framework/dao/VoucherDao.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package com.supwisdom.dlpay.framework.dao;
-
-import com.supwisdom.dlpay.framework.data.ExistBean;
-import com.supwisdom.dlpay.framework.data.MerchBean;
-import com.supwisdom.dlpay.framework.domain.TVoucher;
-import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.data.jpa.repository.Lock;
-import org.springframework.data.jpa.repository.Modifying;
-import org.springframework.data.jpa.repository.Query;
-import org.springframework.data.repository.query.Param;
-
-import javax.persistence.LockModeType;
-import java.util.List;
-
-public interface VoucherDao extends JpaRepository<TVoucher, Integer> {
-
- @Query(value = "select count(t.voucherid) as existed from TB_VOUCHER t where t.POSTFLAG=0 ", nativeQuery = true)
- ExistBean checkExistUnpostVouhcer();
-
- @Modifying
- @Query(value="delete from TB_VOUCHER where POSTFLAG=0 ",nativeQuery = true)
- void deleteUnpostVoucher();
-
- @Lock(LockModeType.PESSIMISTIC_WRITE)
- @Query(value = "from TVoucher where postflag=0 order by voucherid ")
- List<TVoucher> getSettleVouchers();
-
- @Query(value="select va.accno as shopaccno,sum(va.dramt) as dramt,sum(va.cramt) as cramt " +
- "from tb_voucherentry va,tb_voucher vb " +
- "where va.voucherid=vb.voucherid and vb.voucherdate=:settledate and va.subjno='2004' and va.accno is not null " +
- "group by va.accno order by va.accno ", nativeQuery = true)
- List<MerchBean> getShopVoucherByAccdate(@Param("settledate")Integer settledate);
-
- @Query(value = "select sum(va.dramt) as dramt, sum(va.cramt) as cramt from TB_VOUCHERENTRY va,TB_VOUCHER vb where va.voucherid=vb.voucherid and vb.voucherdate=:voucherdate and va.subjno=:subjno ", nativeQuery = true)
- MerchBean getSettleSuminfo(@Param("voucherdate") Integer voucherdate, @Param("subjno") String subjno);
-
- @Lock(LockModeType.PESSIMISTIC_WRITE)
- @Query(value = "from TVoucher where voucherid=:voucherid ")
- TVoucher findByVoucheridWithLock(@Param("voucherid") Integer voucherid);
-}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/dao/VoucherEntryDao.java b/src/main/java/com/supwisdom/dlpay/framework/dao/VoucherEntryDao.java
deleted file mode 100644
index cfb8cfd..0000000
--- a/src/main/java/com/supwisdom/dlpay/framework/dao/VoucherEntryDao.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package com.supwisdom.dlpay.framework.dao;
-
-import com.supwisdom.dlpay.framework.domain.TVoucherEntry;
-import com.supwisdom.dlpay.framework.domain.TVoucherEntryPK;
-import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.data.jpa.repository.Lock;
-import org.springframework.data.jpa.repository.Modifying;
-import org.springframework.data.jpa.repository.Query;
-import org.springframework.data.repository.query.Param;
-import org.springframework.stereotype.Repository;
-import javax.persistence.LockModeType;
-import java.util.List;
-
-@Repository
-public interface VoucherEntryDao extends JpaRepository<TVoucherEntry,TVoucherEntryPK> {
- @Modifying
- @Query(value = "delete from TB_VOUCHERENTRY where VOUCHERID in (select VOUCHERID from TB_VOUCHER where POSTFLAG=0)", nativeQuery = true)
- void deleteUnpostVoucherentry();
-
- @Query(value = "from TVoucherEntry where voucherid in (select voucherid from TVoucher where voucherdate=:voucherdate) order by subjno,accno,voucherid ")
- List<TVoucherEntry> getVoucherEntryByVoucherdate(@Param("voucherdate") Integer voucherdate);
-
- @Lock(LockModeType.PESSIMISTIC_WRITE)
- @Query(value = "from TVoucherEntry t where t.voucherid=:voucherid ")
- List<TVoucherEntry> getVoucherEntryByVoucherid(@Param("voucherid")Integer voucherid);
-}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/dao/VouchernoCtlDao.java b/src/main/java/com/supwisdom/dlpay/framework/dao/VouchernoCtlDao.java
deleted file mode 100644
index 7f81bf9..0000000
--- a/src/main/java/com/supwisdom/dlpay/framework/dao/VouchernoCtlDao.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package com.supwisdom.dlpay.framework.dao;
-
-import com.supwisdom.dlpay.framework.domain.TVouchernoCtl;
-import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.data.jpa.repository.Lock;
-import org.springframework.data.jpa.repository.Modifying;
-import org.springframework.data.jpa.repository.Query;
-import org.springframework.data.repository.query.Param;
-import org.springframework.stereotype.Repository;
-
-import javax.persistence.LockModeType;
-
-@Repository
-public interface VouchernoCtlDao extends JpaRepository<TVouchernoCtl, Integer> {
- @Modifying(clearAutomatically = true)
- @Query(value = "update TB_VOUCHERNOCTL set PERIODMONTH=:peridmonth,VOUCHERNO=:voucherno where VOUCHERTYPE=1 ", nativeQuery = true)
- void updateVoucherno(@Param("peridmonth") int peridmonth, @Param("voucherno") int voucherno);
-
- @Lock(LockModeType.PESSIMISTIC_WRITE)
- @Query(value = "from TVouchernoCtl where vouchertype=1 ")
- TVouchernoCtl getVoucherno();
-}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/service/SystemUtilService.java b/src/main/java/com/supwisdom/dlpay/framework/service/SystemUtilService.java
index af90257..d8557f3 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/service/SystemUtilService.java
+++ b/src/main/java/com/supwisdom/dlpay/framework/service/SystemUtilService.java
@@ -27,20 +27,10 @@
TTaskLock doLockTask(String taskcode, Integer minRecover, String remark);
/**
- * 获取记账日期
- * */
- String getAccdate();
-
- /**
* 获取流水号
* */
String getRefno();
- /**
- * 按交易码取交易名称
- */
- String getTranscodeName(int transocde, String defaultValue);
-
/********************** 获取【系统参数】【业务参数】通用方法 **********************/
String getSysparaValue(int paraid);
diff --git a/src/main/java/com/supwisdom/dlpay/framework/service/impl/DayendSettleServiceImpl.java b/src/main/java/com/supwisdom/dlpay/framework/service/impl/DayendSettleServiceImpl.java
deleted file mode 100644
index 2f4959b..0000000
--- a/src/main/java/com/supwisdom/dlpay/framework/service/impl/DayendSettleServiceImpl.java
+++ /dev/null
@@ -1,541 +0,0 @@
-package com.supwisdom.dlpay.framework.service.impl;
-
-import com.supwisdom.dlpay.api.dao.DebitCreditDtlDao;
-import com.supwisdom.dlpay.framework.dao.*;
-import com.supwisdom.dlpay.framework.data.FSubjectInfoBean;
-import com.supwisdom.dlpay.framework.data.MerchBean;
-import com.supwisdom.dlpay.framework.data.SubjectInfoBean;
-import com.supwisdom.dlpay.framework.data.VoucherTemp;
-import com.supwisdom.dlpay.framework.domain.*;
-import com.supwisdom.dlpay.framework.service.DayendSettleService;
-import com.supwisdom.dlpay.framework.service.SystemUtilService;
-import com.supwisdom.dlpay.framework.util.DateUtil;
-import com.supwisdom.dlpay.framework.util.MoneyUtil;
-import com.supwisdom.dlpay.framework.util.StringUtil;
-import com.supwisdom.dlpay.framework.util.Subject;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-@Service
-public class DayendSettleServiceImpl implements DayendSettleService {
- @Autowired
- private SystemUtilService systemUtilService;
- @Autowired
- private SettleLogDao settleLogDao;
- @Autowired
- private SettleCtlDao settleCtlDao;
- @Autowired
- private PeriodDao periodDao;
- @Autowired
- private VouchernoCtlDao vouchernoCtlDao;
- @Autowired
- private ShopaccDao shopaccDao;
- @Autowired
- private SubjectDao subjectDao;
- @Autowired
- private SubjectbalDao subjectbalDao;
- @Autowired
- private VoucherDao voucherDao;
- @Autowired
- private VoucherEntryDao voucherEntryDao;
-
- @Autowired
- private ShopaccdayDao shopaccdayDao;
- @Autowired
- private SubjectdayDao subjectdayDao;
- @Autowired
- private DebitCreditDtlDao debitCreditDtlDao;
-
-
- private static final Logger logger = LoggerFactory.getLogger(DayendSettleServiceImpl.class);
-
- private int hostdate;
- private int periodYear; // 记账年份
- private int periodMonth; // 记账月份
- private int settledate; //结算日期
- private int lastsettday; //结算前一天
-
- @Override
- public TSettleLog doCreateSettleLog() {
- TSettleLog log = new TSettleLog();
- log.setStarttime(systemUtilService.getSysdatetime().getHostdatetime());
- return settleLogDao.save(log);
- }
-
- @Override
- public TSettleLog doUpdateSettleLog(TSettleLog log) {
- if (null == log) return null;
- log.setEndtime(systemUtilService.getSysdatetime().getHostdatetime());
- return settleLogDao.save(log);
- }
-
- private boolean doSwitchPeriod() throws Exception {
- TPeriod period = periodDao.getTPeriodWithLock(periodYear, periodMonth);
- if (period.getSettleflag() == 1) {
- throw new Exception("月末结转已完成");
- }
- period.setSettleflag(1);
- periodDao.save(period); //已结
-
- if (periodMonth >= 12) {
- periodMonth = 1;
- periodYear = periodYear + 1; //年份加一
- } else {
- periodMonth = periodMonth + 1; //year不变
- }
-
- TPeriod nextPerid = periodDao.getPeriod(periodYear, periodMonth);
- if (null != nextPerid) {
- if (settledate != Integer.valueOf(nextPerid.getStartdate())) {
- throw new Exception("下一个会计期间的开始日期不正确");
- } else if (nextPerid.getSettleflag() == 1) {
- throw new Exception("下一个会计期间的月末结转已完成");
- }
- } else {
- Integer startdate = periodYear * 10000 + periodMonth * 100 + 1;
- Integer enddate = DateUtil.getLastDayOfMonth(periodYear, periodMonth);
- if (settledate != startdate) {
- throw new Exception("下一个会计期间的开始日期不正确");
- }
- nextPerid = new TPeriod();
- nextPerid.setPeriodYear(periodYear);
- nextPerid.setPeriodMonth(periodMonth);
- nextPerid.setStartdate(startdate.toString());
- nextPerid.setEnddate(enddate.toString());
- nextPerid.setSettleflag(0);
- periodDao.save(nextPerid); //保存下个会计期间
- }
-
- settleCtlDao.updateSettlePeriod(periodYear, periodMonth);
- vouchernoCtlDao.updateVoucherno(periodMonth, 0);
- return true;
- }
-
- private void saveVoucher(VoucherTemp voucherTemp) {
- TVoucher voucher = new TVoucher(periodYear, periodMonth, 0, settledate, settledate, voucherTemp.getTranscnt(), Math.abs(voucherTemp.getTransamt()), voucherTemp.getSummary(), "auto", hostdate);
- voucher = voucherDao.save(voucher);
- TVoucherEntry entry1;
- TVoucherEntry entry2;
- if (voucherTemp.getTransamt() >= 0) {
- entry1 = new TVoucherEntry(voucher.getVoucherid(), 1, voucherTemp.getDrsubjno(), voucherTemp.getDraccno(), Math.abs(voucherTemp.getTransamt()), 0D, voucherTemp.getSummary(), voucherTemp.getCrsubjno(), voucherTemp.getCraccno());
- entry2 = new TVoucherEntry(voucher.getVoucherid(), 2, voucherTemp.getCrsubjno(), voucherTemp.getCraccno(), 0D, Math.abs(voucherTemp.getTransamt()), voucherTemp.getSummary(), voucherTemp.getDrsubjno(), voucherTemp.getDraccno());
- } else {
- entry1 = new TVoucherEntry(voucher.getVoucherid(), 1, voucherTemp.getDrsubjno(), voucherTemp.getDraccno(), 0D, Math.abs(voucherTemp.getTransamt()), voucherTemp.getSummary(), voucherTemp.getCrsubjno(), voucherTemp.getCraccno());
- entry2 = new TVoucherEntry(voucher.getVoucherid(), 2, voucherTemp.getCrsubjno(), voucherTemp.getCraccno(), Math.abs(voucherTemp.getTransamt()), 0D, voucherTemp.getSummary(), voucherTemp.getDrsubjno(), voucherTemp.getDraccno());
- }
- voucherEntryDao.save(entry1);
- voucherEntryDao.save(entry2);
- }
-
- @Override
- public boolean doDayendSettle() throws Exception {
- TSettlectl tSettlectl = settleCtlDao.findByBooksetnoWithLock(1);
- if (null == tSettlectl || null == tSettlectl.getBooksetno()) {
- throw new Exception("初始化错误,T_SETTLECTL 无初始化数据");
- }
- tSettlectl.setStatus(1); //结算标记
- settleCtlDao.save(tSettlectl);
-
- hostdate = Integer.valueOf(systemUtilService.getSysdatetime().getHostdate());
- periodYear = tSettlectl.getPeriodYear();
- periodMonth = tSettlectl.getPeriodMonth();
- settledate = tSettlectl.getSettledate();
- lastsettday = Integer.valueOf(DateUtil.getNewDay(tSettlectl.getSettledate().toString(), -1));
-
- if (settledate >= hostdate) {
- throw new Exception("日终结算已完成");
- }
-
- TPeriod period = periodDao.getPeriod(periodYear, periodMonth);
- if (null == period) throw new Exception("year=[" + periodYear + "],month=[" + periodMonth + "] t_period not find ");
- if (settledate > Integer.valueOf(period.getEnddate())) {
- //月切
- if (!doSwitchPeriod()) {
- throw new Exception("月切失败");
- }
- }
-
- //新增科目插入科目余额表(末级科目)
- List<String> newEndsubjectList = subjectDao.getNewSubject();
- if (!StringUtil.isEmpty(newEndsubjectList)) {
- for (String subjno : newEndsubjectList) {
- TSubjectbal subjectbal = new TSubjectbal(subjno);
- subjectbalDao.save(subjectbal);
- }
- }
- if (subjectDao.checkSettleSubject().getExisted() > 0) {
- throw new Exception("初始化数据错误:科目余额表数据没有包含所有的科目余额");
- }
-
- //删除未入账凭证
- if (voucherDao.checkExistUnpostVouhcer().getExisted() > 0) {
- voucherEntryDao.deleteUnpostVoucherentry();
- voucherDao.deleteUnpostVoucher();
- }
-
- //用户交易凭证
- List<VoucherTemp> userList = debitCreditDtlDao.getVoucherData(String.valueOf(settledate));
- if (!StringUtil.isEmpty(userList)) {
- for (VoucherTemp temp : userList) {
- saveVoucher(temp);
- }
- }
-
- //凭证号
- TVouchernoCtl vouchernoCtl = vouchernoCtlDao.getVoucherno();
- if (null == vouchernoCtl) {
- vouchernoCtl = new TVouchernoCtl();
- vouchernoCtl.setVouchertype(1);
- vouchernoCtl.setPeriodMonth(periodMonth);
- vouchernoCtl.setVoucherno(0);
- vouchernoCtlDao.save(vouchernoCtl);
- }
- int voucherno = vouchernoCtl.getVoucherno();
- List<TVoucher> voucherList = voucherDao.getSettleVouchers();
- if (!StringUtil.isEmpty(voucherList)) {
- for (TVoucher voucher : voucherList) {
- voucherno++;
- voucher.setVoucherno(voucherno);
- voucher.setPostflag(1);
- voucherDao.save(voucher);
- }
- vouchernoCtl.setVoucherno(voucherno);
- vouchernoCtlDao.save(vouchernoCtl);
- }
-
- Map<String, Double> v_merchbaldict = new HashMap<String, Double>(0);
- //根据商户昨天日结表生成当天日结表(交易前余额), 新增商户添加记录
- List<TShopaccday> lastShopaccdays = shopaccdayDao.getShopaccdayByAccdate(String.valueOf(lastsettday));
- if (!StringUtil.isEmpty(lastShopaccdays)) {
- for (TShopaccday lastday : lastShopaccdays) {
- TShopaccday today = new TShopaccday(String.valueOf(settledate), lastday.getShopaccno(), periodYear, periodMonth, lastday.getBalance(), 0D, 0D, 0D);
- shopaccdayDao.save(today);
- v_merchbaldict.put(lastday.getShopaccno(), lastday.getBalance());
- }
- }
- List<String> newShopaccs = shopaccDao.getNewShopacc(String.valueOf(lastsettday)); //新增商户
- if(!StringUtil.isEmpty(newShopaccs)){
- for(String accno:newShopaccs){
- TShopaccday today = new TShopaccday(String.valueOf(settledate), accno, periodYear, periodMonth, 0D, 0D, 0D, 0D);
- shopaccdayDao.save(today);
- v_merchbaldict.put(accno, 0D);
- }
- }
-
- List<MerchBean> merchBeanList = voucherDao.getShopVoucherByAccdate(settledate);
- if (!StringUtil.isEmpty(merchBeanList)) {
- for (MerchBean merch : merchBeanList) {
- TShopaccday merchday = shopaccdayDao.getTShopaccdayById(String.valueOf(settledate), merch.getShopaccno());
- if (null == merchday) {
- throw new Exception("商户余额表无此商户账号[" + merch.getShopaccno() + "]");
- }
- merchday.setDramt(merch.getDramt() == null ? 0D : merch.getDramt());
- merchday.setCramt(merch.getCramt() == null ? 0D : merch.getCramt());
- shopaccdayDao.save(merchday);
- }
- }
- shopaccdayDao.updateShopaccdayBalance(String.valueOf(settledate), systemUtilService.getSysdatetime().getHostdatetime()); //批量更新余额,商户日结表生成
-
- //根据科目昨天日结表生成当天日结表(交易前借贷方余额),新增末级科目插入记录(交易前余额为科目贷方余额)
- List<TSubjectday> lastSubjectDays = subjectdayDao.getAllByAccdate(String.valueOf(lastsettday));
- if (!StringUtil.isEmpty(lastSubjectDays)) {
- for (TSubjectday lastday : lastSubjectDays) {
- TSubjectday today = new TSubjectday(String.valueOf(settledate), lastday.getSubjno(), periodYear, periodMonth, lastday.getDrbal(), lastday.getCrbal(), 0D, 0D, 0D, 0D);
- subjectdayDao.save(today);
- }
- }
- List<TSubjectbal> newSubjectBals = subjectbalDao.getUnsettleSubjectbal(String.valueOf(lastsettday));
- if (!StringUtil.isEmpty(newSubjectBals)) {
- for (TSubjectbal newSubject : newSubjectBals) {
- TSubjectday today = new TSubjectday(String.valueOf(settledate), newSubject.getSubjno(), periodYear, periodMonth, newSubject.getBegindrbal(), newSubject.getBegincrbal(), 0D, 0D, 0D, 0D);
- subjectdayDao.save(today);
- }
- }
- List<String> newFSubjnos = subjectDao.getNewSubjnos(String.valueOf(settledate)); //新增非末级科目
- if (!StringUtil.isEmpty(newFSubjnos)) {
- for (String subjno : newFSubjnos) {
- double beginDrbal = 0;
- double beginCrbal = 0;
- MerchBean balInfo = subjectbalDao.getSubjectInfo(subjno); //统计下级所有科目的交易前余额
- if (null != balInfo) {
- beginDrbal = (balInfo.getDramt() == null ? 0 : balInfo.getDramt().doubleValue());
- beginCrbal = (balInfo.getCramt() == null ? 0 : balInfo.getCramt().doubleValue());
- }
- TSubjectday today = new TSubjectday(String.valueOf(settledate), subjno, periodYear, periodMonth, beginDrbal, beginCrbal, 0D, 0D, 0D, 0D);
- subjectdayDao.save(today);
- }
- }
-
- //初始化末级科目期初余额(包含商户科目)
- Map<String, Double> v_subjbaldict = new HashMap<String, Double>(0);
- Map<String, Integer> v_subjbalflagdict = new HashMap<String, Integer>(0);
- List<MerchBean> subjectList = subjectdayDao.getEndSubjectbalInfos(String.valueOf(settledate));
- if (!StringUtil.isEmpty(subjectList)) {
- for (MerchBean bean : subjectList) {
- v_subjbaldict.put(bean.getShopaccno(), MoneyUtil.formatYuan(bean.getDramt() + bean.getCramt()));
- }
- }
-
- List<SubjectInfoBean> subjInfoList = subjectbalDao.getSubjectbalAndFlag();
- for (SubjectInfoBean subj : subjInfoList) {
- TSubjectday tSubjectday = subjectdayDao.getSubjectDayById(String.valueOf(settledate), subj.getSubjno());
- if (null == tSubjectday) {
- throw new Exception("科目日结表无此科目记录[" + subj.getSubjno() + "]");
- }
-
- v_subjbalflagdict.put(subj.getSubjno(), subj.getBalflag());
- MerchBean suminfo = voucherDao.getSettleSuminfo(settledate, subj.getSubjno());
- double sumDramt = ((null == suminfo || null == suminfo.getDramt()) ? 0 : suminfo.getDramt().doubleValue());
- double sumCramt = ((null == suminfo || null == suminfo.getCramt()) ? 0 : suminfo.getCramt().doubleValue());
- tSubjectday.setDramt(sumDramt);
- tSubjectday.setCramt(sumCramt);
- tSubjectday.setUpdtime(systemUtilService.getSysdatetime().getHostdatetime());
- if (subj.getBalflag() == 1) {
- tSubjectday.setDrbal(MoneyUtil.formatYuan(tSubjectday.getBegindrbal() + sumDramt - sumCramt));
- } else {
- tSubjectday.setCrbal(MoneyUtil.formatYuan(tSubjectday.getBegincrbal() - sumDramt + sumCramt));
- }
- subjectdayDao.save(tSubjectday);
- }
- //根据二级更新一级科目日结
- List<TSubjectday> parentSubject = subjectdayDao.getParentSubjectday(String.valueOf(settledate));
- for (TSubjectday fsub : parentSubject) {
- FSubjectInfoBean sumInfo = subjectdayDao.getParentSumInfo(String.valueOf(settledate), fsub.getSubjno());
- fsub.setBegindrbal((null == sumInfo || null == sumInfo.getBegindrbal()) ? 0D : sumInfo.getBegindrbal());
- fsub.setBegincrbal((null == sumInfo || null == sumInfo.getBegincrbal()) ? 0D : sumInfo.getBegincrbal());
- fsub.setDramt((null == sumInfo || null == sumInfo.getDramt()) ? 0D : sumInfo.getDramt());
- fsub.setCramt((null == sumInfo || null == sumInfo.getCramt()) ? 0D : sumInfo.getCramt());
- fsub.setDrbal((null == sumInfo || null == sumInfo.getDrbal()) ? 0D : sumInfo.getDrbal());
- fsub.setCrbal((null == sumInfo || null == sumInfo.getCrbal()) ? 0D : sumInfo.getCrbal());
- fsub.setUpdtime(systemUtilService.getSysdatetime().getHostdatetime());
- subjectdayDao.save(fsub);
- }
-
- //批量更新凭证明细中商户或科目账户的余额
- List<TVoucherEntry> entryList = voucherEntryDao.getVoucherEntryByVoucherdate(settledate);
- if (!StringUtil.isEmpty(entryList)) {
- for (TVoucherEntry vce : entryList) {
- if (Subject.SUBJNO_MACHANT_INCOME.equals(vce.getSubjno())) {
- //商户科目
- Double befbal = v_merchbaldict.get(vce.getAccno());
- if (null == befbal) throw new Exception("商户表商户账号[" + vce.getAccno() + "]不存在");
- v_merchbaldict.put(vce.getAccno(), MoneyUtil.formatYuan(befbal + vce.getCramt() - vce.getDramt())); //更新余额
- vce.setBalflag(2);
- vce.setBalance(v_merchbaldict.get(vce.getAccno()));
- if (Subject.SUBJNO_MACHANT_INCOME.equals(vce.getOppsubjno())) {
- vce.setOppname(shopaccDao.getShopname(vce.getOppaccno()));
- } else {
- vce.setOppname(subjectDao.getSubjectname(vce.getOppsubjno()));
- }
- voucherEntryDao.save(vce);
- Double befMerchbal = v_subjbaldict.get(vce.getSubjno());
- if (null == befMerchbal) throw new Exception("商户科目号[" + vce.getSubjno() + "]不存在");
- v_subjbaldict.put(vce.getSubjno(), MoneyUtil.formatYuan(befMerchbal - vce.getDramt() + vce.getCramt())); //商户科目总余额更新
- } else {
- //其他科目
- Integer balflag = v_subjbalflagdict.get(vce.getSubjno());
- Double befbal = v_subjbaldict.get(vce.getSubjno());
- if (null == balflag || null == befbal) throw new Exception("科目表科目号[" + vce.getSubjno() + "]不存在");
- if (balflag == 1) {
- v_subjbaldict.put(vce.getSubjno(), MoneyUtil.formatYuan(befbal + vce.getDramt() - vce.getCramt()));
- } else {
- v_subjbaldict.put(vce.getSubjno(), MoneyUtil.formatYuan(befbal - vce.getDramt() + vce.getCramt()));
- }
- vce.setBalflag(balflag);
- vce.setBalance(v_subjbaldict.get(vce.getSubjno()));
- if (Subject.SUBJNO_MACHANT_INCOME.equals(vce.getOppsubjno())) {
- vce.setOppname(shopaccDao.getShopname(vce.getOppaccno()));
- } else {
- vce.setOppname(subjectDao.getSubjectname(vce.getOppsubjno()));
- }
- voucherEntryDao.save(vce);
- }
- }
- }
-
- //开始校验
- //核算商户日结表商户余额 和凭证明细余额是否一致 TODO(新商户收入校验逻辑)
- for (String shopaccno : v_merchbaldict.keySet()) {
- TShopaccday tShopaccday = shopaccdayDao.getTShopaccdayById(String.valueOf(settledate), shopaccno);
- if (!MoneyUtil.moneyEqual(v_merchbaldict.get(shopaccno), tShopaccday.getBalance())) {
- throw new Exception("结算后检查失败:商户["+shopaccno+"]余额不等,商户日结余额[" + tShopaccday.getBalance() + "]凭证商户余额[" + v_merchbaldict.get(shopaccno) + "]");
- }
-// TShopaccbal tShopaccbal = shopaccbalDao.getOne(shopaccno);
-// tShopaccbal.setBalance(tShopaccday.getBalance());
-// tShopaccbal.setUpdtime(systemUtilService.getSysdatetime().getHostdatetime());
-// shopaccbalDao.save(tShopaccbal); //商户期末余额
- }
-
- //核算科目日结表科目余额和凭证明细余额是否一致
- for (String subjno : v_subjbaldict.keySet()) {
- TSubjectday tSubjectday = subjectdayDao.getSubjectDayById(String.valueOf(settledate), subjno);
- if (!MoneyUtil.moneyEqual(v_subjbaldict.get(subjno), tSubjectday.getDrbal() + tSubjectday.getCrbal())) {
- throw new Exception("结算后检查失败:科目日结表期末余额不等,科目号[" + subjno + "],科目余额[" + (tSubjectday.getDrbal() + tSubjectday.getCrbal()) + "],凭证科目余额[" + v_subjbaldict.get(subjno) + "]");
- }
- TSubjectbal tSubjectbal = subjectbalDao.getOne(subjno);
- tSubjectbal.setBegindrbal(tSubjectday.getBegindrbal());
- tSubjectbal.setBegincrbal(tSubjectday.getBegincrbal());
- tSubjectbal.setDramt(tSubjectday.getDramt());
- tSubjectbal.setCramt(tSubjectday.getCramt());
- tSubjectbal.setDrbal(tSubjectday.getDrbal());
- tSubjectbal.setCrbal(tSubjectday.getCrbal());
- tSubjectbal.setUpdtime(systemUtilService.getSysdatetime().getHostdatetime());
- subjectbalDao.save(tSubjectbal);
- }
-
- //核对商户日结表余额表和科目日结表商户余额是否一致
- TSubjectday shopSubjectday = subjectdayDao.getSubjectDayById(String.valueOf(settledate), Subject.SUBJNO_MACHANT_INCOME);
- Double merchbal = shopaccdayDao.getSumBalance(String.valueOf(settledate));
- double shopSubbal = (shopSubjectday == null ? 0 : shopSubjectday.getCrbal());
- double shopMerchbal = (merchbal == null ? 0 : merchbal);
- if (!MoneyUtil.moneyEqual(shopSubbal, shopMerchbal)) {
- throw new Exception("结算后检查失败:商户日结表和科目日结表期末余额不平衡,商户[" + shopMerchbal + "] 科目[" + shopSubbal + "]");
- }
-
- //核算一级科目余额是否平衡
- FSubjectInfoBean allParentSubjbal = subjectdayDao.getAllParentSubjectSumInfo(String.valueOf(settledate));
- if (!MoneyUtil.moneyEqual(allParentSubjbal.getBegindrbal(), allParentSubjbal.getBegincrbal())) {
- throw new Exception("结算后检查失败:一级科目余额表期初余额不平衡,借方[" + allParentSubjbal.getBegindrbal() + "],贷方[" + allParentSubjbal.getBegincrbal() + "]");
- }
- if (!MoneyUtil.moneyEqual(allParentSubjbal.getDramt(), allParentSubjbal.getCramt())) {
- throw new Exception("结算后检查失败:一级科目余额表发生额不平衡,借方[" + allParentSubjbal.getDramt() + "],贷方[" + allParentSubjbal.getCramt() + "]");
- }
- if (!MoneyUtil.moneyEqual(allParentSubjbal.getDrbal(), allParentSubjbal.getCrbal())) {
- throw new Exception("结算后检查失败:一级科目余额表期末额不平衡,借方[" + allParentSubjbal.getDrbal() + "]贷方[" + allParentSubjbal.getCrbal() + "]");
- }
- //校验科目余额表的balflag=1的总期末余额和balflag=2的总期末余额是否一致
- Double balflag_1_sumbal = subjectbalDao.getSumEndsubjectBalByEndflag(1);
- Double balflag_2_sumbal = subjectbalDao.getSumEndsubjectBalByEndflag(2);
- if (null == balflag_1_sumbal || null == balflag_1_sumbal) throw new Exception("结算后检查失败:科目余额表无数据");
- if (!MoneyUtil.moneyEqual(balflag_1_sumbal, balflag_2_sumbal)) {
- throw new Exception("结算后检查失败:科目余额表期末余额不平衡,借方[" + balflag_1_sumbal + "],贷方[" + balflag_2_sumbal + "]");
- }
- //TODO: 校验 账户余额汇总值和科目日结表值是否一致
-
- //日切
- tSettlectl.setStatus(0); //清标记
- tSettlectl.setPeriodYear(periodYear);
- tSettlectl.setPeriodMonth(periodMonth);
- tSettlectl.setSettledate(Integer.valueOf(DateUtil.getNewDay(String.valueOf(settledate), 1)));
- tSettlectl.setUpdtime(systemUtilService.getSysdatetime().getHostdatetime());
- settleCtlDao.save(tSettlectl);
- return true;
- }
-
- @Override
- public boolean doVoucherSettle(String voucherid) throws Exception {
- if (StringUtil.isEmpty(voucherid)) throw new Exception("参数为空");
-
- TSettlectl settlectl = settleCtlDao.findByBooksetno(1);
- if (null == settlectl || null == settlectl.getBooksetno()) {
- throw new Exception("系统初始化参数错误");
- }
-
-// int hostDate = Integer.valueOf(systemUtilService.getSysdatetime().getHostdatetime());
-// int prdyear = settlectl.getPeriodYear();
-// int prdmonth = settlectl.getPeriodMonth();
-// int settday = settlectl.getSettledate();
-//
-// List<String> newShopList = shopaccDao.getNewAddShopacc(String.valueOf(settday));
-// if (!StringUtil.isEmpty(newShopList)) {
-// for (String accno : newShopList) {
-// TShopaccbal shopBal = new TShopaccbal(accno);
-// shopaccbalDao.save(shopBal);
-// }
-// }
-// if (shopaccDao.checkSettleShopacc().getExisted() > 0) {
-// throw new Exception("初始化数据错误:商户余额表数据没有包含所有有效的商户账户余额");
-// }
-//
-// //新增科目插入科目余额表(末级科目)
-// List<String> newEndsubjectList = subjectDao.getNewSubject();
-// if (!StringUtil.isEmpty(newEndsubjectList)) {
-// for (String subjno : newEndsubjectList) {
-// TSubjectbal subjectbal = new TSubjectbal(subjno);
-// subjectbalDao.save(subjectbal);
-// }
-// }
-// if (subjectDao.checkSettleSubject().getExisted() > 0) {
-// throw new Exception("初始化数据错误:科目余额表数据没有包含所有的科目余额");
-// }
-//
-// TVoucher voucher = voucherDao.findByVoucheridWithLock(voucherid);
-// List<TVoucherEntry> entryList = voucherEntryDao.getVoucherEntryByVoucherid(voucherid);
-// if (null == voucher) {
-// throw new Exception("凭证查询无记录");
-// } else if ("auto".equals(voucher.getSourcetype())) {
-// throw new Exception("该凭证不是手工录入凭证");
-// } else if (voucher.getCheckflag() != 1) {
-// throw new Exception("该凭证未审核");
-// } else if (StringUtil.isEmpty(voucher.getSummary())) {
-// throw new Exception("摘要不能为空");
-// } else if (voucher.getPostflag() == 1) {
-// throw new Exception("凭证已入账");
-// }
-//
-// if (StringUtil.isEmpty(entryList)) {
-// throw new Exception("凭证无借贷明细!");
-// }
-//
-// //凭证号
-// TVouchernoCtl vouchernoCtl = vouchernoCtlDao.getVoucherno();
-// if (null == vouchernoCtl) {
-// vouchernoCtl = new TVouchernoCtl(1, periodMonth, 0);
-// vouchernoCtlDao.save(vouchernoCtl);
-// }
-// int voucherno = vouchernoCtl.getVoucherno() + 1;
-// vouchernoCtl.setVoucherno(voucherno);
-// vouchernoCtlDao.save(vouchernoCtl);
-//
-// voucher.setVoucherno(voucherno);
-// voucher.setPostflag(1);
-// voucherDao.save(voucher); //修改凭证表凭证号、入账标志
-//
-// //明细
-// for (TVoucherEntry entry : entryList) {
-// if (Subject.SUBJNO_MACHANT_INCOME.equals(entry.getSubjno())) {
-// TShopaccbal tShopaccbal = shopaccbalDao.getTShopaccbalByIdWithLock(entry.getAccno());
-// if (null == tShopaccbal) {
-// throw new Exception("商户表商户账号[" + entry.getAccno() + "]不存在");
-// }
-// tShopaccbal.setBalance(tShopaccbal.getBeginbal() + entry.getCramt() - entry.getDramt());
-// shopaccbalDao.save(tShopaccbal);
-// entry.setBalflag(2);
-// entry.setBalance(tShopaccbal.getBalance());
-// } else {
-// TSubjectbal tSubjectbal = subjectbalDao.getTSubjectbalBySubjnoWithLock(entry.getSubjno());
-// TSubject subject = subjectDao.getOne(entry.getSubjno());
-// if (null == tSubjectbal || null == subject) {
-// throw new Exception("科目表科目号[" + entry.getSubjno() + "]不存在");
-// } else if (subject.getEndflag() != 1) {
-// throw new Exception("科目[" + entry.getSubjno() + "]非末级科目");
-// }
-// entry.setBalflag(subject.getBalflag());
-// if (subject.getBalflag() == 1) {
-// tSubjectbal.setDrbal(tSubjectbal.getDrbal() + entry.getDramt() - entry.getCramt());
-// entry.setBalance(tSubjectbal.getDrbal());
-// } else {
-// tSubjectbal.setCrbal(tSubjectbal.getCrbal() - entry.getDramt() + entry.getCramt());
-// entry.setBalance(tSubjectbal.getCrbal());
-// }
-// subjectbalDao.save(tSubjectbal);
-// }
-//
-// if (!StringUtil.isEmpty(entry.getOppaccno())) {
-// entry.setOppname(shopaccDao.getShopname(entry.getOppaccno()));
-// } else {
-// entry.setOppname(subjectDao.getSubjectname(entry.getOppsubjno()));
-// }
-// voucherEntryDao.save(entry);
-// }
-
- return true;
- }
-
-}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/service/impl/DayendStatisticsServiceImpl.java b/src/main/java/com/supwisdom/dlpay/framework/service/impl/DayendStatisticsServiceImpl.java
deleted file mode 100644
index b7d5c1b..0000000
--- a/src/main/java/com/supwisdom/dlpay/framework/service/impl/DayendStatisticsServiceImpl.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package com.supwisdom.dlpay.framework.service.impl;
-
-import com.supwisdom.dlpay.framework.service.DayendStatisticsService;
-import org.springframework.stereotype.Service;
-
-@Service
-public class DayendStatisticsServiceImpl implements DayendStatisticsService {
-
- @Override
- public boolean doDayendStatistics() throws Exception {
- return false;
- }
-}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/service/impl/SystemUtilServiceImpl.java b/src/main/java/com/supwisdom/dlpay/framework/service/impl/SystemUtilServiceImpl.java
index eee9e5a..98e526f 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/service/impl/SystemUtilServiceImpl.java
+++ b/src/main/java/com/supwisdom/dlpay/framework/service/impl/SystemUtilServiceImpl.java
@@ -24,10 +24,6 @@
@Autowired
private TaskLockDao taskLockDao;
@Autowired
- private SettleCtlDao settleCtlDao;
- @Autowired
- private TranscodeDao transcodeDao;
- @Autowired
private SysparaDao sysparaDao;
@Autowired
private BusinessparaDao businessparaDao;
@@ -115,17 +111,6 @@
return lock;
}
- @Override
- public String getAccdate() {
- String hostdate = getSysdatetime().getHostdate();
- TSettlectl settlectl = settleCtlDao.getOne(1);
- if (null != settlectl && null != settlectl.getSettledate()) {
- if (Integer.valueOf(hostdate) < settlectl.getSettledate().intValue()) {
- return settlectl.getSettledate().toString();
- }
- }
- return hostdate;
- }
private String getOracleRefno() {
return taskLockDao.getOracleRefno();
@@ -141,14 +126,6 @@
}
}
- @Override
- public String getTranscodeName(int transocde, String defaultValue) {
- TTranscode tTranscode = transcodeDao.getOne(transocde);
- if (null != tTranscode && !StringUtil.isEmpty(tTranscode.getTransname())) {
- return tTranscode.getTransname();
- }
- return defaultValue;
- }
@Override
public String getSysparaValue(int paraid) {
diff --git a/src/main/java/com/supwisdom/dlpay/system/controller/DtlController.java b/src/main/java/com/supwisdom/dlpay/system/controller/DtlController.java
deleted file mode 100644
index 1bd3bd8..0000000
--- a/src/main/java/com/supwisdom/dlpay/system/controller/DtlController.java
+++ /dev/null
@@ -1,93 +0,0 @@
-package com.supwisdom.dlpay.system.controller;
-
-import com.supwisdom.dlpay.api.domain.TPersondtl;
-import com.supwisdom.dlpay.api.domain.TShopdtl;
-import com.supwisdom.dlpay.framework.util.PageResult;
-import com.supwisdom.dlpay.framework.util.WebConstant;
-import com.supwisdom.dlpay.system.bean.ShopdtlSearchBean;
-import com.supwisdom.dlpay.system.bean.TreeSelectNode;
-import com.supwisdom.dlpay.system.bean.UserdtlSearchBean;
-import com.supwisdom.dlpay.system.service.DtlDataService;
-import com.supwisdom.dlpay.system.service.ShopDataService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.stereotype.Controller;
-import org.springframework.ui.Model;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.List;
-
-@Controller
-public class DtlController {
- @Autowired
- private ShopDataService shopDataService;
- @Autowired
- private DtlDataService dtlDataService;
-
- /**
- * ====================================================
- * 个人流水查询
- * ====================================================
- */
- @GetMapping("/dtl/userdtl")
- public String userdtlView(Model model) {
- model.addAttribute("paytypelist", shopDataService.getConsumePaytypes());
- model.addAttribute("transcodelist", dtlDataService.getAllTranscodes());
- model.addAttribute("dtlstatuslist", dtlDataService.getAllDtlStatus());
- return "system/dtl/userdtl";
- }
-
- @GetMapping("/dtl/userdtllist")
- @PreAuthorize("hasPermission('/dtl/userdtl','')")
- @ResponseBody
- public PageResult<TPersondtl> searchUserdtlPage(@ModelAttribute UserdtlSearchBean searchBean) {
- try {
- Integer pageNo = searchBean.getPage();
- Integer pageSize = searchBean.getLimit();
- if (null == pageNo || pageNo < 1) pageNo = WebConstant.PAGENO_DEFAULT;
- if (null == pageSize || pageSize < 1) pageSize = WebConstant.PAGESIZE_DEFAULT;
- return dtlDataService.getPersondtlPage(searchBean, pageNo, pageSize);
- } catch (Exception e) {
- e.printStackTrace();
- return new PageResult<>(99, "系统查询错误");
- }
- }
-
- /**
- * ====================================================
- * 商户流水查询
- * ====================================================
- */
- @GetMapping("/dtl/shopdtl")
- public String shopdtlView(Model model) {
- model.addAttribute("paytypelist", shopDataService.getConsumePaytypes());
- model.addAttribute("transcodelist", dtlDataService.getAllTranscodes());
- model.addAttribute("dtlstatuslist", dtlDataService.getAllDtlStatus());
- return "system/dtl/shopdtl";
- }
-
- @GetMapping("/dtl/shopdtllist")
- @PreAuthorize("hasPermission('/dtl/shopdtl','')")
- @ResponseBody
- public PageResult<TShopdtl> searchUserdtlPage(@ModelAttribute ShopdtlSearchBean searchBean) {
- try {
- Integer pageNo = searchBean.getPage();
- Integer pageSize = searchBean.getLimit();
- if (null == pageNo || pageNo < 1) pageNo = WebConstant.PAGENO_DEFAULT;
- if (null == pageSize || pageSize < 1) pageSize = WebConstant.PAGESIZE_DEFAULT;
- return dtlDataService.getShopdtlPage(searchBean, pageNo, pageSize);
- } catch (Exception e) {
- e.printStackTrace();
- return new PageResult<>(99, "系统查询错误");
- }
- }
-
- @GetMapping("/dtl/shoptreeselect")
- @PreAuthorize("hasPermission('/dtl/shopdtl','')")
- @ResponseBody
- public List<TreeSelectNode> searchShopTree() {
- List<TreeSelectNode> tree = dtlDataService.getTreeSelectShops();
- return tree;
- }
-
-}
diff --git a/src/main/java/com/supwisdom/dlpay/system/controller/ParamController.java b/src/main/java/com/supwisdom/dlpay/system/controller/ParamController.java
deleted file mode 100644
index 24da8e3..0000000
--- a/src/main/java/com/supwisdom/dlpay/system/controller/ParamController.java
+++ /dev/null
@@ -1,555 +0,0 @@
-package com.supwisdom.dlpay.system.controller;
-
-import com.supwisdom.dlpay.api.bean.JsonResult;
-import com.supwisdom.dlpay.api.domain.TSourceType;
-import com.supwisdom.dlpay.api.domain.TPaytypeConfig;
-import com.supwisdom.dlpay.framework.domain.TApiClient;
-import com.supwisdom.dlpay.framework.domain.TBusinesspara;
-import com.supwisdom.dlpay.framework.domain.TSyspara;
-import com.supwisdom.dlpay.framework.service.SystemUtilService;
-import com.supwisdom.dlpay.framework.util.*;
-import com.supwisdom.dlpay.system.service.ParamService;
-import com.supwisdom.dlpay.util.ConstantUtil;
-import com.supwisdom.dlpay.util.WebCheckException;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.stereotype.Controller;
-import org.springframework.ui.Model;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-@Controller
-public class ParamController {
- @Autowired
- private ParamService paramService;
- @Autowired
- private SystemUtilService systemUtilService;
-
- @GetMapping("/param/syspara")
- public String sysparaView() {
- return "system/param/syspara";
- }
-
- @GetMapping("/param/sysparalist")
- @PreAuthorize("hasPermission('/param/syspara','')")
- @ResponseBody
- public PageResult<TSyspara> getDataList(@RequestParam("page") Integer pageNo,
- @RequestParam("limit") Integer pageSize,
- @RequestParam(value = "paraid", required = false) Integer paraid,
- @RequestParam(value = "paraname", required = false) String paraname) {
- try {
- if (null == pageNo || pageNo < 1) pageNo = WebConstant.PAGENO_DEFAULT;
- if (null == pageSize || pageSize < 1) pageSize = WebConstant.PAGESIZE_DEFAULT;
- return paramService.getSysparaPage(paraid, paraname, pageNo, pageSize);
- } catch (Exception e) {
- e.printStackTrace();
- return new PageResult<>(99, "系统查询错误");
- }
- }
-
- @PostMapping("/param/sysparaupdate")
- @PreAuthorize("hasPermission('/param/sysparaupdate','')")
- @ResponseBody
- public JsonResult updateSyspara(@RequestParam("paraid") Integer paraid,
- @RequestParam("paraval") String paraval) {
- if (null == paraid || null == paraval) {
- return JsonResult.error("参数传递错误");
- } else if (paraval.length() > 30) {
- return JsonResult.error("参数值过长");
- }
- TSyspara syspara = paramService.getSysparaByParaid(paraid);
- if (null == syspara) {
- return JsonResult.error("全局参数不存在");
- }
- syspara.setParaval(paraval);
- syspara.setLastsaved(systemUtilService.getSysdatetime().getHostdatetime());
- if (syspara.checkValueInvalid()) {
- return JsonResult.error("参数值格式错误");
- }
- try {
- if (paramService.updateSyspara(syspara)) {
- return JsonResult.ok("修改成功");
- } else {
- return JsonResult.error("修改失败");
- }
- } catch (Exception e) {
- e.printStackTrace();
- return JsonResult.error("系统处理异常").put("exception", e);
- }
- }
-
-
- /**
- * ====================================================
- * 业务参数配置
- * ====================================================
- */
- @GetMapping("/param/businesspara")
- public String busiparaView() {
- return "system/param/businesspara";
- }
-
- @GetMapping("/param/businessparalist")
- @PreAuthorize("hasPermission('/param/businesspara','')")
- @ResponseBody
- public PageResult<TBusinesspara> getBusinessDataList(@RequestParam("page") Integer pageNo,
- @RequestParam("limit") Integer pageSize,
- @RequestParam(value = "paraname", required = false) String paraname) {
- try {
- if (null == pageNo || pageNo < 1) pageNo = WebConstant.PAGENO_DEFAULT;
- if (null == pageSize || pageSize < 1) pageSize = WebConstant.PAGESIZE_DEFAULT;
- return paramService.getBusinessparaPage(paraname, pageNo, pageSize);
- } catch (Exception e) {
- e.printStackTrace();
- return new PageResult<>(99, "系统查询错误");
- }
- }
-
- @PostMapping("/param/deletebusinesspara")
- @PreAuthorize("hasPermission('/param/deletebusinesspara','')")
- @ResponseBody
- public JsonResult deleteBusinesspara(@RequestParam("parakey") String parakey) {
- try {
- if (StringUtil.isEmpty(parakey)) {
- return JsonResult.error("参数名为空");
- }
- TBusinesspara businesspara = paramService.getBusinessparaByParakey(parakey);
- if (null == businesspara) {
- return JsonResult.error("业务参数[" + parakey + "]不存在!");
- }
- if (paramService.deleteBusinesspara(businesspara)) {
- return JsonResult.ok("删除成功!");
- } else {
- return JsonResult.error("删除失败!");
- }
- } catch (Exception e) {
- e.printStackTrace();
- return JsonResult.error("系统处理异常").put("exception", e);
- }
- }
-
- @PostMapping("/param/businessparaupdate")
- @PreAuthorize("hasPermission('/param/businessparaupdate','')")
- @ResponseBody
- public JsonResult updateBusinesspara(@RequestParam("parakey") String parakey, @RequestParam("paraval") String paraval) {
- try {
- if (StringUtil.isEmpty(parakey) || null == paraval) {
- return JsonResult.error("参数传递错误");
- }
- TBusinesspara businesspara = paramService.getBusinessparaByParakey(parakey);
- if (null == businesspara) {
- return JsonResult.error("业务参数[" + parakey + "]不存在!");
- }
- businesspara.setParaval(paraval);
- if (paramService.saveOrUpdateBusinesspara(businesspara)) {
- return JsonResult.ok("修改成功!");
- } else {
- return JsonResult.error("修改失败!");
- }
- } catch (Exception e) {
- e.printStackTrace();
- return JsonResult.error("系统处理异常").put("exception", e);
- }
- }
-
- @GetMapping("/param/load4addbuspara")
- @PreAuthorize("hasPermission('/param/load4addbuspara','')")
- public String loadadd() {
- return "system/param/busparaform";
- }
-
- @GetMapping("/param/checkbusname")
- @ResponseBody
- public JsonResult checkname(@RequestParam("parakey") String parakey) {
- TBusinesspara businesspara = paramService.getBusinessparaByParakey(parakey);
- if (businesspara == null) {
- return JsonResult.ok();
- } else {
- return JsonResult.error("参数名重复");
- }
- }
-
- @PostMapping("/param/addbusinesspara")
- @PreAuthorize("hasPermission('/param/addbusinesspara','')")
- @ResponseBody
- public JsonResult addBusinesspara(@RequestParam("parakey") String parakey, @RequestParam("paraval") String paraval) {
- if (StringUtil.isEmpty(parakey) || null == paraval) {
- return JsonResult.error("参数传递错误");
- }
- try {
- TBusinesspara businesspara = paramService.getBusinessparaByParakey(parakey);
- if (null != businesspara) {
- return JsonResult.error("参数名重复");
- }
- businesspara = new TBusinesspara();
- businesspara.setParakey(parakey.trim());
- businesspara.setParaval(paraval.trim());
- if (paramService.saveOrUpdateBusinesspara(businesspara)) {
- return JsonResult.ok("新增成功!");
- } else {
- return JsonResult.error("新增失败!");
- }
- } catch (Exception e) {
- e.printStackTrace();
- return JsonResult.error("系统处理异常").put("exception", e);
- }
- }
-
-
- /**
- * ====================================================
- * APPID应用权限参数管理
- * ====================================================
- */
- @GetMapping("/param/apiclientpara")
- public String appidParaView() {
- return "system/param/apiclientpara";
- }
-
- @GetMapping("/param/apiclientparalist")
- @PreAuthorize("hasPermission('/param/apiclientpara','')")
- @ResponseBody
- public PageResult<TApiClient> getApiclientDataList(@RequestParam("page") Integer pageNo,
- @RequestParam("limit") Integer pageSize,
- @RequestParam(value = "appid", required = false) String appid) {
- try {
- if (null == pageNo || pageNo < 1) pageNo = WebConstant.PAGENO_DEFAULT;
- if (null == pageSize || pageSize < 1) pageSize = WebConstant.PAGESIZE_DEFAULT;
- return paramService.getApiClientparaPage(appid, pageNo, pageSize);
- } catch (Exception e) {
- e.printStackTrace();
- return new PageResult<>(99, "系统查询错误");
- }
- }
-
- @GetMapping("/param/load4addapiclient")
- @PreAuthorize("hasPermission('/param/load4addapiclient','')")
- public String load4AddApiclientPara(Model model) {
- Map<String, String> roles = new HashMap<>(0);
- roles.put("ROLE_THIRD_COMMON", "ROLE_THIRD_COMMON");
- roles.put("ROLE_THIRD_CONSUME", "ROLE_THIRD_CONSUME");
- roles.put("ROLE_THIRD_DEPOSIT", "ROLE_THIRD_DEPOSIT");
- roles.put("ROLE_THIRD_SHOP", "ROLE_THIRD_SHOP");
- roles.put("ROLE_THIRD_ADMIN", "ROLE_THIRD_ADMIN");
- model.addAttribute("rolelist", roles);
- return "system/param/apiclientform";
- }
-
- @PostMapping("/param/updateapiclientstate")
- @PreAuthorize("hasPermission('/param/updateapiclientstate','')")
- @ResponseBody
- public JsonResult updateApiclientState(@RequestParam("appid") String appid, @RequestParam("state") String state) {
- if (StringUtil.isEmpty(appid) || (!TradeDict.STATUS_NORMAL.equals(state) && !TradeDict.STATUS_CLOSED.equals(state))) {
- return JsonResult.error("参数传递错误");
- }
- try {
- TApiClient apiClient = paramService.getApiClientByAppid(appid);
- if (null == apiClient) {
- return JsonResult.error("应用参数不存在");
- } else if (state.equals(apiClient.getStatus())) {
- return JsonResult.error("状态修改错误,请刷新查询");
- }
- apiClient.setStatus(state);
- if (paramService.saveOrUpdateApiClient(apiClient)) {
- return JsonResult.ok(TradeDict.STATUS_NORMAL.equals(state) ? "启用成功" : "关闭成功");
- } else {
- return JsonResult.error(TradeDict.STATUS_NORMAL.equals(state) ? "启用失败" : "关闭失败");
- }
- } catch (Exception e) {
- e.printStackTrace();
- return JsonResult.error("系统处理异常").put("exception", e);
- }
- }
-
- @PostMapping("/param/deleteapiclient")
- @PreAuthorize("hasPermission('/param/deleteapiclient','')")
- @ResponseBody
- public JsonResult deleteApiclientParam(@RequestParam("appid") String appid) {
- if (StringUtil.isEmpty(appid)) {
- return JsonResult.error("参数传递错误");
- }
- try {
- TApiClient apiClient = paramService.getApiClientByAppid(appid);
- if (null == apiClient) {
- return JsonResult.error("应用参数不存在");
- }
-
- if (paramService.deleteApiClient(apiClient)) {
- return JsonResult.ok("删除成功");
- } else {
- return JsonResult.error("删除失败");
- }
- } catch (Exception e) {
- e.printStackTrace();
- return JsonResult.error("系统处理异常").put("exception", e);
- }
- }
-
- @PostMapping("/param/updateapiclientpara")
- @PreAuthorize("hasPermission('/param/updateapiclientpara','')")
- @ResponseBody
- public JsonResult updateApiclientSecret(@RequestParam("appid") String appid,
- @RequestParam(value = "secret", required = false) String secret,
- @RequestParam(value = "roles", required = false) String roles) {
- if (StringUtil.isEmpty(appid) || (StringUtil.isEmpty(secret) && StringUtil.isEmpty(roles))) {
- return JsonResult.error("参数传递错误");
- }
- try {
- TApiClient apiClient = paramService.getApiClientByAppid(appid);
- if (null == apiClient) {
- return JsonResult.error("应用参数不存在");
- }
- if (!StringUtil.isEmpty(secret)) {
- apiClient.setSecret(secret);
- }
- if (!StringUtil.isEmpty(roles)) {
- apiClient.setRoles(roles);
- }
- if (paramService.saveOrUpdateApiClient(apiClient)) {
- return JsonResult.ok("修改成功");
- } else {
- return JsonResult.error("修改失败");
- }
- } catch (Exception e) {
- e.printStackTrace();
- return JsonResult.error("系统处理异常").put("exception", e);
- }
- }
-
- @PostMapping("/param/addapiclientpara")
- @PreAuthorize("hasPermission('/param/addapiclientpara','')")
- @ResponseBody
- public JsonResult addApiclientPara(@RequestParam("appid") String appid,
- @RequestParam("roles") String roles) {
- if (StringUtil.isEmpty(appid) || StringUtil.isEmpty(roles)) {
- return JsonResult.error("参数传递错误");
- }
- try {
- TApiClient apiClient = paramService.getApiClientByAppid(appid);
- if (null != apiClient) {
- return JsonResult.error("APPID重复");
- }
- apiClient = new TApiClient();
- apiClient.setAppid(appid.trim());
- apiClient.setSecret(RandomUtils.getUUIDStr());
- apiClient.setStatus(TradeDict.STATUS_NORMAL);
- apiClient.setRoles(roles);
- if (paramService.saveOrUpdateApiClient(apiClient)) {
- return JsonResult.ok("新增成功");
- } else {
- return JsonResult.error("新增失败");
- }
- } catch (Exception e) {
- e.printStackTrace();
- return JsonResult.error("系统处理异常").put("exception", e);
- }
- }
-
- /**
- * ====================================================
- * 支付能力配置
- * ====================================================
- */
- @GetMapping("/param/paytype")
- public String paytypeView() {
- return "system/param/paytype";
- }
-
- @GetMapping("/param/paytypelist")
- @PreAuthorize("hasPermission('/param/paytype','')")
- @ResponseBody
- public PageResult<TSourceType> getPaytypeDataList(@RequestParam("page") Integer pageNo,
- @RequestParam("limit") Integer pageSize,
- @RequestParam(value = "paytype", required = false) String paytype) {
- try {
- if (null == pageNo || pageNo < 1) pageNo = WebConstant.PAGENO_DEFAULT;
- if (null == pageSize || pageSize < 1) pageSize = WebConstant.PAGESIZE_DEFAULT;
- return paramService.getPaytypePage(paytype, pageNo, pageSize);
- } catch (Exception e) {
- e.printStackTrace();
- return new PageResult<>(99, "系统查询错误");
- }
- }
-
- @GetMapping("/param/load4addpaytype")
- @PreAuthorize("hasPermission('/param/load4addpaytype','')")
- public String load4AddPaytype(Model model) {
- return "system/param/paytypeform";
- }
-
- @PostMapping("/param/updatepaytypestate")
- @PreAuthorize("hasPermission('/param/updatepaytypestate','')")
- @ResponseBody
- public JsonResult updatePaytypeState(@RequestParam("paytype") String paytype,
- @RequestParam("state") Boolean state,
- @RequestParam(value = "optype", required = false) String optype) {
- if (StringUtil.isEmpty(paytype)
- || (!StringUtil.isEmpty(optype) && !"charge".equals(optype) && !"consume".equals(optype) && !"anonymous".equals(optype))) {
- return JsonResult.error("参数传递错误");
- }
- try {
- TSourceType tPaytype = paramService.getPaytype(paytype);
- if (null == tPaytype) {
- return JsonResult.error("支付方式不存在!");
- }
- if ("charge".equals(optype)) {
- if (state.equals(tPaytype.isChargeEnable())) {
- return JsonResult.error("状态错误,请重新查询后操作");
- }
- tPaytype.setChargeEnable(state);
- } else if ("consume".equals(optype)) {
- if (state.equals(tPaytype.getConsumeEnable())) {
- return JsonResult.error("状态错误,请重新查询后操作");
- }
- tPaytype.setConsumeEnable(state);
- } else if ("anonymous".equals(optype)) {
- if (state.equals(tPaytype.getAnonymousEnable())) {
- return JsonResult.error("状态错误,请重新查询后操作");
- }
- tPaytype.setAnonymousEnable(state);
- } else {
- if (state.equals(tPaytype.getEnable())) {
- return JsonResult.error("状态错误,请重新查询后操作");
- }
- tPaytype.setEnable(state); //默认切换主状态
- }
-
- if (paramService.saveOrUpdatePaytype(tPaytype)) {
- return JsonResult.ok(state ? "启用成功" : "关闭成功");
- } else {
- return JsonResult.error(!state ? "启用失败" : "关闭失败");
- }
- } catch (Exception e) {
- e.printStackTrace();
- return JsonResult.error("系统处理异常").put("exception", e);
- }
- }
-
- @PostMapping("/param/updatepaytypename")
- @PreAuthorize("hasPermission('/param/updatepaytypename','')")
- @ResponseBody
- public JsonResult updatePaytypeName(@RequestParam("paytype") String paytype,
- @RequestParam("paydesc") String paydesc) {
- if (StringUtil.isEmpty(paytype) || StringUtil.isEmpty(paydesc)) {
- return JsonResult.error("参数传递错误");
- }
- try {
- TSourceType tPaytype = paramService.getPaytype(paytype);
- if (null == tPaytype) {
- return JsonResult.error("支付方式不存在!");
- }
- tPaytype.setPaydesc(paydesc.trim());
- if (paramService.saveOrUpdatePaytype(tPaytype)) {
- return JsonResult.ok("修改成功");
- } else {
- return JsonResult.error("修改失败");
- }
- } catch (Exception e) {
- e.printStackTrace();
- return JsonResult.error("系统处理异常").put("exception", e);
- }
- }
-
- @PostMapping("/param/deletepaytype")
- @PreAuthorize("hasPermission('/param/deletepaytype','')")
- @ResponseBody
- public JsonResult deletePaytype(@RequestParam("paytype") String paytype) {
- try {
- TSourceType tPaytype = paramService.getPaytype(paytype);
- if (null == tPaytype) {
- return JsonResult.error("支付方式不存在!");
- }
- if (paramService.deletePaytype(tPaytype)) {
- return JsonResult.ok("删除成功");
- } else {
- return JsonResult.error("删除失败");
- }
- } catch (Exception e) {
- e.printStackTrace();
- return JsonResult.error("系统处理异常").put("exception", e);
- }
- }
-
- @PostMapping("/param/addpaytype")
- @PreAuthorize("hasPermission('/param/addpaytype','')")
- @ResponseBody
- public JsonResult addPaytype(@RequestParam("paytype") String paytype,
- @RequestParam(value = "enable", required = false, defaultValue = "no") String enable,
- @RequestParam(value = "chargeEnable", required = false, defaultValue = "no") String chargeEnable,
- @RequestParam(value = "consumeEnable", required = false, defaultValue = "no") String consumeEnable,
- @RequestParam(value = "anonymousEnable", required = false, defaultValue = "no") String anonymousEnable,
- @RequestParam("paydesc") String paydesc) {
- try {
- TSourceType tPaytype = paramService.getPaytype(paytype);
- if (null != tPaytype) {
- return JsonResult.error("支付方式已经存在");
- }
- tPaytype = new TSourceType();
- tPaytype.setSourceType(paytype.trim());
- if (StringUtil.isEmpty(paydesc)) return JsonResult.error("支付名称不能为空!");
- tPaytype.setPaydesc(paydesc.trim());
- tPaytype.setEnable(ConstantUtil.ENABLE_YES.equalsIgnoreCase(enable));
- tPaytype.setChargeEnable(ConstantUtil.ENABLE_YES.equalsIgnoreCase(chargeEnable));
- tPaytype.setConsumeEnable(ConstantUtil.ENABLE_YES.equalsIgnoreCase(consumeEnable));
- tPaytype.setAnonymousEnable(ConstantUtil.ENABLE_YES.equalsIgnoreCase(anonymousEnable));
- if (paramService.saveOrUpdatePaytype(tPaytype)) {
- return JsonResult.ok("新增成功");
- } else {
- return JsonResult.error("新增失败");
- }
- } catch (Exception e) {
- e.printStackTrace();
- return JsonResult.error("系统处理异常").put("exception", e);
- }
- }
-
- @GetMapping("/param/checkpaytype")
- @ResponseBody
- public JsonResult checkPaytype(@RequestParam("paytype") String paytype) {
- TSourceType tPaytype = paramService.getPaytype(paytype);
- if (null != tPaytype) {
- return JsonResult.error("支付方式已经存在");
- } else {
- return JsonResult.ok("可以使用");
- }
- }
-
- @GetMapping("/param/load4paytypeconfig")
- @PreAuthorize("hasPermission('/param/load4paytypeconfig','')")
- public String load4PaytypeConfig(@RequestParam("paytype") String paytype, Model model) {
- List<TPaytypeConfig> configList = paramService.getPaytypeConfigList(paytype);
- model.addAttribute("configlist", configList);
- model.addAttribute("paytype", paytype);
- return "system/param/paytypeconfig";
- }
-
- @PostMapping("/param/addpaytypeconfig")
- @PreAuthorize("hasPermission('/param/addpaytypeconfig','')")
- @ResponseBody
- public JsonResult addPaytypeConfig(@RequestBody Map<String, String> param) {
- String paytypeHtmlKey = "hid_paytype"; //页面上传来paytype的KEY
- if (null == param || StringUtil.isEmpty(param.get(paytypeHtmlKey))) {
- return JsonResult.error("参数传递错误");
- }
-
- try {
- String paytype = param.get(paytypeHtmlKey).trim();
- param.remove(paytypeHtmlKey);
- if (paramService.savePaytypeConfig(paytype, param)) {
- return JsonResult.ok("配置成功");
- } else {
- return JsonResult.error("配置失败");
- }
- } catch (WebCheckException ex) {
- return JsonResult.error(ex.getMessage());
- } catch (Exception e) {
- e.printStackTrace();
- return JsonResult.error("系统处理异常").put("exception", e);
- }
- }
-
-
-}
diff --git a/src/main/java/com/supwisdom/dlpay/system/controller/ShopController.java b/src/main/java/com/supwisdom/dlpay/system/controller/ShopController.java
deleted file mode 100644
index f64753f..0000000
--- a/src/main/java/com/supwisdom/dlpay/system/controller/ShopController.java
+++ /dev/null
@@ -1,322 +0,0 @@
-package com.supwisdom.dlpay.system.controller;
-
-import com.supwisdom.dlpay.api.bean.JsonResult;
-import com.supwisdom.dlpay.api.domain.TSourceType;
-import com.supwisdom.dlpay.api.domain.TShopPaytype;
-import com.supwisdom.dlpay.api.domain.TShopPaytypeConfig;
-import com.supwisdom.dlpay.framework.domain.TShop;
-import com.supwisdom.dlpay.framework.domain.TShopacc;
-import com.supwisdom.dlpay.framework.service.SystemUtilService;
-import com.supwisdom.dlpay.framework.util.PageResult;
-import com.supwisdom.dlpay.framework.util.StringUtil;
-import com.supwisdom.dlpay.framework.util.TradeDict;
-import com.supwisdom.dlpay.framework.util.WebConstant;
-import com.supwisdom.dlpay.system.bean.ShopConfigBean;
-import com.supwisdom.dlpay.system.service.ParamService;
-import com.supwisdom.dlpay.system.service.ShopDataService;
-import com.supwisdom.dlpay.util.ConstantUtil;
-import com.supwisdom.dlpay.util.WebCheckException;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.stereotype.Controller;
-import org.springframework.ui.Model;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.List;
-import java.util.Map;
-
-@Controller
-public class ShopController {
- @Autowired
- private ShopDataService shopDataService;
- @Autowired
- private ParamService paramService;
- @Autowired
- private SystemUtilService systemUtilService;
-
- @GetMapping("/shop/index")
- public String shopView() {
- return "system/shop/index";
- }
-
- @GetMapping("/shop/shoptree")
- @PreAuthorize("hasPermission('/shop/index','')")
- @ResponseBody
- public JsonResult shopTreeData() {
- return JsonResult.ok("OK").put("data", shopDataService.getAllShopNodes());
- }
-
- @PostMapping("/shop/deleteshop")
- @PreAuthorize("hasPermission('/shop/deleteshop','')")
- @ResponseBody
- public JsonResult deleteShop(@RequestParam("shopid") Integer shopid) {
- TShop shop = shopDataService.getShopByShopid(shopid);
- if (null == shop) {
- return JsonResult.error("商户不存在,请重新查询"); //商户不存在,请重新查询
- }
-
- try {
- if (shopDataService.deleteShop(shop)) {
- return JsonResult.ok("删除成功");
- } else {
- return JsonResult.error("删除失败");
- }
- } catch (WebCheckException ex) {
- return JsonResult.error(ex.getMessage());
- } catch (Exception e) {
- return JsonResult.error("系统处理异常").put("exception", e);
- }
- }
-
- @GetMapping("/shop/getshopinfo")
- @PreAuthorize("hasPermission('/shop/getshopinfo','')")
- @ResponseBody
- public JsonResult getShopInfo(@RequestParam("shopid") Integer shopid) {
- TShop shop = shopDataService.getShopByShopid(shopid);
- if (null == shop) {
- return JsonResult.error("商户不存在,请重新查询"); //商户不存在,请重新查询
- }
- return JsonResult.ok("查询成功").put("shop", shop);
- }
-
- @PostMapping("/shop/saveorupdate")
- @PreAuthorize("hasPermission('/shop/saveorupdate','')")
- @ResponseBody
- public JsonResult saveOrUpdateShop(@RequestParam("shopid") Integer shopid, @RequestParam("shopname") String shopname,
- @RequestParam("fshopid") Integer fshopid, @RequestParam("shoptype") Integer shoptype,
- @RequestParam(value = "contactman", required = false) String contactman,
- @RequestParam(value = "idtype", required = false) String idtype,
- @RequestParam(value = "idno", required = false) String idno,
- @RequestParam(value = "mobile", required = false) String mobile,
- @RequestParam(value = "tel", required = false) String tel,
- @RequestParam(value = "email", required = false) String email,
- @RequestParam(value = "addr", required = false) String addr,
- @RequestParam(value = "zipcode", required = false) String zipcode) {
- if (null == shopid || StringUtil.isEmpty(shopname) || null == fshopid || (shoptype != 0 && shoptype != 1)) {
- return JsonResult.error("参数传递错误");
- }
-
- TShop shop;
- boolean addflag = false;
- if (shopid == 0) {
- //新增
- addflag = true;
- shop = new TShop();
- shop.setFshopid(fshopid);
- shop.setShopname(shopname);
- shop.setShoptype(shoptype);
- shop.setStatus(TradeDict.STATUS_NORMAL);
- } else {
- //修改
- shop = shopDataService.getShopByShopid(shopid);
- if (null == shop) {
- return JsonResult.error("商户不存在,修改失败!请重新查询");
- }
- shop.setFshopid(fshopid);
- shop.setShopname(shopname);
-// shop.setShoptype(shoptype); //商户类型不能改
- }
- shop.setContactman(contactman == null ? null : contactman.trim());
- shop.setIdno(idno == null ? null : idno.trim());
- shop.setIdtype(idtype == null ? null : idtype.trim());
- if (!StringUtil.isEmpty(shop.getIdno()) && StringUtil.isEmpty(shop.getIdtype())) {
- return JsonResult.error("填写证件号时必须制定证件类型!");
- } else if (!StringUtil.isEmpty(shop.getIdno()) && "1".equals(shop.getIdtype()) && !StringUtil.isIdentity(shop.getIdno())) {
- return JsonResult.error("身份证格式错误!");
- }
- shop.setMobile(mobile == null ? null : mobile);
- if (!StringUtil.isEmpty(shop.getMobile()) && !StringUtil.isMobile(shop.getMobile())) {
- return JsonResult.error("请正确填写手机号!");
- }
- shop.setTel(tel == null ? null : tel.trim());
- shop.setEmail(email == null ? null : email.trim());
- if (!StringUtil.isEmpty(shop.getEmail()) && !StringUtil.isEmail(shop.getEmail())) {
- return JsonResult.error("请正确填写邮箱地址!");
- }
- shop.setAddr(addr == null ? null : addr.trim());
- shop.setZipcode(zipcode == null ? null : zipcode.trim());
-
- try {
- if (shopDataService.saveOrUpdateShop(shop)) {
- return JsonResult.ok(addflag ? "新增成功" : "修改成功").put("shop", shop);
- } else {
- return JsonResult.error(addflag ? "新增失败" : "修改失败");
- }
- } catch (WebCheckException ex) {
- return JsonResult.error(ex.getMessage());
- } catch (Exception e) {
- e.printStackTrace();
- return JsonResult.error("系统处理异常").put("exception", e);
- }
- }
-
- /**
- * ====================================================
- * 商户支付能力配置
- * ====================================================
- */
- @GetMapping("/shop/config")
- public String shopConfigView(Model model) {
- model.addAttribute("paytypelist", shopDataService.getConsumePaytypes());
- return "system/shop/config";
- }
-
- @GetMapping("/shop/shopacctree")
- @PreAuthorize("hasPermission('/shop/config','')")
- @ResponseBody
- public JsonResult shopaccTreeData() {
- return JsonResult.ok("OK").put("data", shopDataService.getAllShopNodes());
- }
-
- @GetMapping("/shop/shoppaytypelist")
- @PreAuthorize("hasPermission('/shop/shoppaytypelist','')")
- @ResponseBody
- public PageResult<ShopConfigBean> getShopPaytypeList(@RequestParam("page") Integer pageNo,
- @RequestParam("limit") Integer pageSize,
- @RequestParam(value = "paytype", required = false) String paytype,
- @RequestParam(value = "shopaccno", required = false) String shopaccno) {
- try {
- if (null == pageNo || pageNo < 1) pageNo = WebConstant.PAGENO_DEFAULT;
- if (null == pageSize || pageSize < 1) pageSize = WebConstant.PAGESIZE_DEFAULT;
- return shopDataService.getShopPaytypeInfos(shopaccno, paytype, pageNo, pageSize);
- } catch (Exception e) {
- e.printStackTrace();
- return new PageResult<>(99, "系统查询错误");
- }
- }
-
- @PostMapping("/shop/updatepaytypestat")
- @PreAuthorize("hasPermission('/shop/updatepaytypestat','')")
- @ResponseBody
- public JsonResult updateShopPaytypeStat(@RequestParam("shopaccno") String shopaccno, @RequestParam("paytype") String paytype,
- @RequestParam("state") String state, @RequestParam("optype") String optype) {
- if (StringUtil.isEmpty(shopaccno) || StringUtil.isEmpty(paytype)
- || (!ConstantUtil.ENABLE_NO.equals(state) && !ConstantUtil.ENABLE_YES.equals(state))
- || (!"consume".equals(optype) && !"anonymous".equals(optype) && !"reverse".equals(optype))) {
- return JsonResult.error("参数传递错误");
- }
-
- try {
- TShopPaytype shopPaytype = shopDataService.getShopPaytype(shopaccno.trim(), paytype.trim());
- if (null == shopPaytype) {
- return JsonResult.error("商户支付能力不存在!");
- }
-
- if ("consume".equals(optype)) {
- if (state.equals(shopPaytype.getConsumeEnable())) {
- return JsonResult.error("状态错误,请重新查询后操作");
- }
- shopPaytype.setConsumeEnable(ConstantUtil.ENABLE_YES.equals(state));
- } else if ("anonymous".equals(optype)) {
- if (state.equals(shopPaytype.getAnonymousEnable())) {
- return JsonResult.error("状态错误,请重新查询后操作");
- }
- shopPaytype.setAnonymousEnable(ConstantUtil.ENABLE_YES.equals(state));
- } else if ("reverse".equals(optype)) {
- if (state.equals(shopPaytype.getReverseEnable())) {
- return JsonResult.error("状态错误,请重新查询后操作");
- }
- shopPaytype.setReverseEnable(ConstantUtil.ENABLE_YES.equals(state));
- }
-
- if (shopDataService.saveOrUpdateShopPaytype(shopPaytype)) {
- return JsonResult.ok(ConstantUtil.ENABLE_YES.equals(state) ? "启用成功" : "关闭成功");
- } else {
- return JsonResult.error(ConstantUtil.ENABLE_YES.equals(state) ? "启用失败" : "关闭失败");
- }
- } catch (Exception e) {
- e.printStackTrace();
- return JsonResult.error("系统处理异常").put("exception", e);
- }
- }
-
- @GetMapping("/shop/load4addpaytype")
- @PreAuthorize("hasPermission('/shop/load4addpaytype','')")
- public String load4AddShopPaytype(Model model) {
- model.addAttribute("paytypelist", shopDataService.getConsumePaytypes());
- return "system/shop/configform";
- }
-
- @PostMapping("/shop/addshoppaytype")
- @PreAuthorize("hasPermission('/shop/addshoppaytype','')")
- @ResponseBody
- public JsonResult addShoppaytype(@RequestParam("shopaccno") String shopaccno,
- @RequestParam("paytype") String paytype,
- @RequestParam(value = "consumeEnable", required = false, defaultValue = "no") String consumeEnable,
- @RequestParam(value = "anonymousEnable", required = false, defaultValue = "no") String anonymousEnable,
- @RequestParam(value = "reverseEnable", required = false, defaultValue = "no") String reverseEnable) {
- if (StringUtil.isEmpty(shopaccno) || StringUtil.isEmpty(paytype)) {
- return JsonResult.error("参数传递错误");
- }
- try {
- TShopacc shopacc = shopDataService.getShopaccByAccno(shopaccno.trim());
- TSourceType tPaytype = paramService.getPaytype(paytype.trim());
- if (null == shopacc) {
- return JsonResult.error("商户账户不存在!");
- }
- if (null == tPaytype) {
- return JsonResult.error("支付方式在系统中不存在!");
- }
- TShopPaytype shopPaytype = shopDataService.getShopPaytype(shopaccno.trim(), paytype.trim());
- if (null != shopPaytype) {
- return JsonResult.error("商户该支付能力已经存在!");
- }
- shopPaytype = new TShopPaytype();
- shopPaytype.setShopaccno(shopacc.getShopaccno());
- shopPaytype.setPaytype(tPaytype.getSourceType());
- shopPaytype.setConsumeEnable(ConstantUtil.ENABLE_YES.equalsIgnoreCase(consumeEnable));
- shopPaytype.setAnonymousEnable(ConstantUtil.ENABLE_YES.equalsIgnoreCase(anonymousEnable));
- shopPaytype.setReverseEnable(ConstantUtil.ENABLE_YES.equalsIgnoreCase(reverseEnable));
- shopPaytype.setCreatetime(systemUtilService.getSysdatetime().getHostdatetime());
- if (shopDataService.saveOrUpdateShopPaytype(shopPaytype)) {
- return JsonResult.ok("新增成功");
- } else {
- return JsonResult.error("新增失败");
- }
- } catch (Exception e) {
- e.printStackTrace();
- return JsonResult.error("系统处理异常").put("exception", e);
- }
- }
-
- @GetMapping("/shop/load4paytypepara")
- @PreAuthorize("hasPermission('/shop/load4paytypepara','')")
- public String load4AddShopPaytypePara(@RequestParam("shopaccno") String shopaccno,
- @RequestParam("paytype") String paytype,
- Model model) {
- List<TShopPaytypeConfig> configList = shopDataService.getShopPaytypeConfigs(shopaccno, paytype);
- model.addAttribute("configlist", configList);
- model.addAttribute("shopaccno", shopaccno);
- model.addAttribute("paytype", paytype);
- return "system/shop/configpara";
- }
-
- @PostMapping("/shop/addpaytypepara")
- @PreAuthorize("hasPermission('/shop/addpaytypepara','')")
- @ResponseBody
- public JsonResult addShopPaytypePara(@RequestBody Map<String, String> param) {
- String shopaccnoHtmlKey = "hid_shopaccno"; //页面上传来shopaccno的KEY
- String paytypeHtmlKey = "hid_paytype"; //页面上传来paytype的KEY
- if (null == param || StringUtil.isEmpty(param.get(paytypeHtmlKey)) || StringUtil.isEmpty(param.get(shopaccnoHtmlKey))) {
- return JsonResult.error("参数传递错误");
- }
- try {
- String shopaccno = param.get(shopaccnoHtmlKey).trim();
- String paytype = param.get(paytypeHtmlKey).trim();
- param.remove(shopaccnoHtmlKey);
- param.remove(paytypeHtmlKey);
- if (shopDataService.saveOrUpdateShopPaytypeConfig(shopaccno, paytype, param)) {
- return JsonResult.ok("配置成功");
- } else {
- return JsonResult.error("配置失败");
- }
- } catch (WebCheckException ex) {
- return JsonResult.error(ex.getMessage());
- } catch (Exception e) {
- e.printStackTrace();
- return JsonResult.error("系统处理异常").put("exception", e);
- }
- }
-
-
-}
diff --git a/src/main/java/com/supwisdom/dlpay/system/controller/UserController.java b/src/main/java/com/supwisdom/dlpay/system/controller/UserController.java
deleted file mode 100644
index a39aa52..0000000
--- a/src/main/java/com/supwisdom/dlpay/system/controller/UserController.java
+++ /dev/null
@@ -1,164 +0,0 @@
-package com.supwisdom.dlpay.system.controller;
-
-import com.supwisdom.dlpay.api.bean.JsonResult;
-import com.supwisdom.dlpay.api.domain.TAccount;
-import com.supwisdom.dlpay.api.domain.TPerson;
-import com.supwisdom.dlpay.api.domain.TPersonIdentity;
-import com.supwisdom.dlpay.api.domain.TPointsAccount;
-import com.supwisdom.dlpay.framework.domain.TOperator;
-import com.supwisdom.dlpay.framework.util.PageResult;
-import com.supwisdom.dlpay.framework.util.StringUtil;
-import com.supwisdom.dlpay.framework.util.WebConstant;
-import com.supwisdom.dlpay.system.bean.IdTypeBean;
-import com.supwisdom.dlpay.system.bean.PersonParamBean;
-import com.supwisdom.dlpay.system.service.UserDataService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.stereotype.Controller;
-import org.springframework.ui.ModelMap;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.ArrayList;
-import java.util.List;
-
-@Controller
-public class UserController {
- @Autowired
- private UserDataService userDataService;
-
- @GetMapping("/user/index")
- public String index() {
- return "system/user/index";
- }
-
- @GetMapping("/user/list")
- @PreAuthorize("hasPermission('/user/list','')")
- @ResponseBody
- public PageResult<TPerson> getDataList(@RequestParam("page") Integer pageNo,
- @RequestParam("limit") Integer pageSize,
- @RequestParam(value = "searchkey", required = false) String searchKey) {
- try {
- if (null == pageNo || pageNo < 1) pageNo = WebConstant.PAGENO_DEFAULT;
- if (null == pageSize || pageSize < 1) pageSize = WebConstant.PAGESIZE_DEFAULT;
- PersonParamBean searchBean = new PersonParamBean();
- searchBean.setPageNo(pageNo);
- searchBean.setName(searchKey);
- searchBean.setPageSize(pageSize);
- return userDataService.getPersonsByKey(searchBean);
- } catch (Exception e) {
- e.printStackTrace();
- return new PageResult<>(99, "系统查询错误");
- }
- }
-
- @GetMapping("/user/loadadd")
- public String add(ModelMap map) {
- List<IdTypeBean> list = new ArrayList<>();
- list.add(new IdTypeBean("1", "身份证"));
- list.add(new IdTypeBean("2", "护照"));
- list.add(new IdTypeBean("3", "驾照"));
- list.add(new IdTypeBean("4", "港澳通行证"));
- list.add(new IdTypeBean("5", "学工号"));
- list.add(new IdTypeBean("9", "其他"));
- map.put("idtypes", list);
- return "system/user/add";
- }
-
- @PostMapping("/user/add")
- @PreAuthorize("hasPermission('/user/add','')")
- @ResponseBody
- public JsonResult add(@RequestBody TPerson person) {
- if (StringUtil.isEmpty(person.getName())
- || StringUtil.isEmpty(person.getSex())
- || StringUtil.isEmpty(person.getIdno())
- || StringUtil.isEmpty(person.getIdtype())
- || StringUtil.isEmpty(person.getMobile())) {
- return JsonResult.error("参数错误");
- }
- return userDataService.saveUser(person);
- }
-
- @PostMapping("/user/del")
- @PreAuthorize("hasPermission('/user/del','')")
- @ResponseBody
- public JsonResult del(@RequestParam String userid) {
- if (StringUtil.isEmpty(userid)) {
- return JsonResult.error("参数错误");
- }
- return userDataService.deleteUser(userid);
- }
-
- @GetMapping("/user/acc")
- public String acc() {
- return "system/user/account";
- }
-
- @GetMapping("/user/account")
- @PreAuthorize("hasPermission('/user/account','')")
- @ResponseBody
- public PageResult<TAccount> getDataAccountList(@RequestParam("page") Integer pageNo,
- @RequestParam("limit") Integer pageSize,
- @RequestParam(value = "searchkey", required = false) String searchKey) {
- try {
- if (null == pageNo || pageNo < 1) pageNo = WebConstant.PAGENO_DEFAULT;
- if (null == pageSize || pageSize < 1) pageSize = WebConstant.PAGESIZE_DEFAULT;
- PersonParamBean searchBean = new PersonParamBean();
- searchBean.setPageNo(pageNo);
- searchBean.setName(searchKey);
- searchBean.setPageSize(pageSize);
- return userDataService.getAccountsByKey(searchBean);
- } catch (Exception e) {
- e.printStackTrace();
- return new PageResult<>(99, "系统查询错误");
- }
- }
-
- @GetMapping("/user/point")
- public String point() {
- return "system/user/point";
- }
-
- @GetMapping("/user/pointlist")
- @PreAuthorize("hasPermission('/user/pointlist','')")
- @ResponseBody
- public PageResult<TPointsAccount> getDataPointList(@RequestParam("page") Integer pageNo,
- @RequestParam("limit") Integer pageSize,
- @RequestParam(value = "searchkey", required = false) String searchKey) {
- try {
- if (null == pageNo || pageNo < 1) pageNo = WebConstant.PAGENO_DEFAULT;
- if (null == pageSize || pageSize < 1) pageSize = WebConstant.PAGESIZE_DEFAULT;
- PersonParamBean searchBean = new PersonParamBean();
- searchBean.setPageNo(pageNo);
- searchBean.setName(searchKey);
- searchBean.setPageSize(pageSize);
- return userDataService.getPointsByKey(searchBean);
- } catch (Exception e) {
- e.printStackTrace();
- return new PageResult<>(99, "系统查询错误");
- }
- }
-
- @PostMapping("/user/delacc")
- @PreAuthorize("hasPermission('/user/delacc','')")
- @ResponseBody
- public JsonResult delacc(@RequestParam String accno) {
- if (StringUtil.isEmpty(accno)) {
- return JsonResult.error("参数错误");
- }
- return userDataService.closeAccount(accno);
- }
- @PostMapping("/user/delpoint")
- @PreAuthorize("hasPermission('/user/delpoint','')")
- @ResponseBody
- public JsonResult delpoint(@RequestParam String userid) {
- if (StringUtil.isEmpty(userid)) {
- return JsonResult.error("参数错误");
- }
- return userDataService.deletePoint(userid);
- }
- @GetMapping("/user/pointdtl")
- public String pointdtl(@RequestParam String userid,ModelMap map) {
- map.put("userid",userid);
- return "system/user/pointdtl";
- }
-}
diff --git a/src/main/java/com/supwisdom/dlpay/system/service/DtlDataService.java b/src/main/java/com/supwisdom/dlpay/system/service/DtlDataService.java
deleted file mode 100644
index fa0affe..0000000
--- a/src/main/java/com/supwisdom/dlpay/system/service/DtlDataService.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package com.supwisdom.dlpay.system.service;
-
-import com.supwisdom.dlpay.api.domain.TPersondtl;
-import com.supwisdom.dlpay.api.domain.TShopdtl;
-import com.supwisdom.dlpay.framework.domain.TDictionary;
-import com.supwisdom.dlpay.framework.domain.TTranscode;
-import com.supwisdom.dlpay.framework.util.PageResult;
-import com.supwisdom.dlpay.system.bean.ShopdtlSearchBean;
-import com.supwisdom.dlpay.system.bean.TreeSelectNode;
-import com.supwisdom.dlpay.system.bean.UserdtlSearchBean;
-import org.springframework.transaction.annotation.Propagation;
-import org.springframework.transaction.annotation.Transactional;
-
-import java.util.List;
-
-public interface DtlDataService {
- @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, readOnly = true)
- PageResult<TPersondtl> getPersondtlPage(UserdtlSearchBean searchBean, int pageNo, int pageSize);
-
- @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, readOnly = true)
- PageResult<TShopdtl> getShopdtlPage(ShopdtlSearchBean searchBean, int pageNo, int pageSize);
-
- @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, readOnly = true)
- List<TTranscode> getAllTranscodes();
-
- @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, readOnly = true)
- List<TDictionary> getAllDtlStatus();
-
- @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, readOnly = true)
- List<TreeSelectNode> getTreeSelectShops();
-}
diff --git a/src/main/java/com/supwisdom/dlpay/system/service/ParamService.java b/src/main/java/com/supwisdom/dlpay/system/service/ParamService.java
deleted file mode 100644
index 3d2b0e8..0000000
--- a/src/main/java/com/supwisdom/dlpay/system/service/ParamService.java
+++ /dev/null
@@ -1,71 +0,0 @@
-package com.supwisdom.dlpay.system.service;
-
-import com.supwisdom.dlpay.api.domain.TSourceType;
-import com.supwisdom.dlpay.api.domain.TPaytypeConfig;
-import com.supwisdom.dlpay.framework.domain.TApiClient;
-import com.supwisdom.dlpay.framework.domain.TBusinesspara;
-import com.supwisdom.dlpay.framework.domain.TSyspara;
-import com.supwisdom.dlpay.framework.util.PageResult;
-import com.supwisdom.dlpay.util.WebCheckException;
-import org.springframework.transaction.annotation.Propagation;
-import org.springframework.transaction.annotation.Transactional;
-
-import java.util.List;
-import java.util.Map;
-
-
-public interface ParamService {
- @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, readOnly = true)
- PageResult<TSyspara> getSysparaPage(Integer paraid, String paraname, int pageNo, int pageSize);
-
- @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, readOnly = true)
- TSyspara getSysparaByParaid(int paraid);
-
- @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
- boolean updateSyspara(TSyspara syspara);
-
- @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, readOnly = true)
- PageResult<TBusinesspara> getBusinessparaPage(String paraname, int pageNo, int pageSize);
-
- @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, readOnly = true)
- TBusinesspara getBusinessparaByParakey(String parakey);
-
- @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
- boolean deleteBusinesspara(TBusinesspara businesspara);
-
- @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
- boolean saveOrUpdateBusinesspara(TBusinesspara businesspara);
-
- @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, readOnly = true)
- PageResult<TApiClient> getApiClientparaPage(String appid, int pageNo, int pageSize);
-
- @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, readOnly = true)
- TApiClient getApiClientByAppid(String appid);
-
- @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
- boolean saveOrUpdateApiClient(TApiClient apiClient);
-
- @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
- boolean deleteApiClient(TApiClient apiClient);
-
- @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, readOnly = true)
- PageResult<TSourceType> getPaytypePage(String paytype, int pageNo, int pageSize);
-
- @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, readOnly = true)
- TSourceType getPaytype(String paytype);
-
- @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
- boolean saveOrUpdatePaytype(TSourceType paytype);
-
- @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
- boolean deletePaytype(TSourceType paytype);
-
- @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, readOnly = true)
- List<TPaytypeConfig> getPaytypeConfigList(String paytype);
-
- @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
- boolean savePaytypeConfig(String paytype, Map<String, String> param) throws WebCheckException;
-
-
-
-}
diff --git a/src/main/java/com/supwisdom/dlpay/system/service/ShopDataService.java b/src/main/java/com/supwisdom/dlpay/system/service/ShopDataService.java
deleted file mode 100644
index b2eb69b..0000000
--- a/src/main/java/com/supwisdom/dlpay/system/service/ShopDataService.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package com.supwisdom.dlpay.system.service;
-
-import com.supwisdom.dlpay.api.domain.TSourceType;
-import com.supwisdom.dlpay.api.domain.TShopPaytype;
-import com.supwisdom.dlpay.api.domain.TShopPaytypeConfig;
-import com.supwisdom.dlpay.framework.domain.TShop;
-import com.supwisdom.dlpay.framework.domain.TShopacc;
-import com.supwisdom.dlpay.framework.util.PageResult;
-import com.supwisdom.dlpay.system.bean.ShopConfigBean;
-import com.supwisdom.dlpay.system.bean.ZTreeNode;
-import com.supwisdom.dlpay.util.WebCheckException;
-import org.springframework.transaction.annotation.Propagation;
-import org.springframework.transaction.annotation.Transactional;
-
-import java.util.List;
-import java.util.Map;
-
-public interface ShopDataService {
- @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class,readOnly = true)
- List<ZTreeNode> getAllShopNodes();
-
- @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class,readOnly = true)
- TShop getShopByShopid(Integer shopid);
-
- @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
- boolean deleteShop(TShop shop) throws WebCheckException;
-
- @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
- boolean saveOrUpdateShop(TShop shop) throws WebCheckException;
-
- @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class,readOnly = true)
- List<TSourceType> getConsumePaytypes();
-
- @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class,readOnly = true)
- PageResult<ShopConfigBean> getShopPaytypeInfos(String shopaccno, String paytype, int pageNo, int pageSize);
-
- @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class,readOnly = true)
- TShopPaytype getShopPaytype(String shopaccno, String paytype);
-
- @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class,readOnly = true)
- TShopacc getShopaccByAccno(String shopaccno);
-
- @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
- boolean saveOrUpdateShopPaytype(TShopPaytype shopPaytype);
-
- @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class,readOnly = true)
- List<TShopPaytypeConfig> getShopPaytypeConfigs(String shopaccno, String paytype);
-
- @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
- boolean saveOrUpdateShopPaytypeConfig(String shopaccno, String paytype, Map<String, String> param) throws WebCheckException;
-
-
-}
diff --git a/src/main/java/com/supwisdom/dlpay/system/service/UserDataService.java b/src/main/java/com/supwisdom/dlpay/system/service/UserDataService.java
deleted file mode 100644
index 942196e..0000000
--- a/src/main/java/com/supwisdom/dlpay/system/service/UserDataService.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package com.supwisdom.dlpay.system.service;
-
-import com.supwisdom.dlpay.api.bean.JsonResult;
-import com.supwisdom.dlpay.api.domain.TAccount;
-import com.supwisdom.dlpay.api.domain.TPerson;
-import com.supwisdom.dlpay.api.domain.TPersonIdentity;
-import com.supwisdom.dlpay.api.domain.TPointsAccount;
-import com.supwisdom.dlpay.framework.util.PageResult;
-import com.supwisdom.dlpay.system.bean.PersonParamBean;
-import org.springframework.transaction.annotation.Propagation;
-import org.springframework.transaction.annotation.Transactional;
-
-import java.util.List;
-
-public interface UserDataService {
- @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class,readOnly = true)
- PageResult<TPerson> getPersonsByKey(PersonParamBean param);
-
- @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class,readOnly = true)
- PageResult<TAccount> getAccountsByKey(PersonParamBean param);
-
- @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class,readOnly = true)
- PageResult<TPointsAccount> getPointsByKey(PersonParamBean param);
-
- @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
- JsonResult saveUser(TPerson person);
-
- @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
- JsonResult deleteUser(String userid);
-
- @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
- JsonResult closeAccount(String accno);
-
- @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
- JsonResult deletePoint(String userid);
-
- @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class,readOnly = true)
- List<TPersonIdentity> getPersonIdentity(String userid);
-
- @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class,readOnly = true)
- PageResult<TPointsAccount> getUserPointDTL(PersonParamBean param);
-}
diff --git a/src/main/java/com/supwisdom/dlpay/system/service/impl/DictionaryDataServiceImpl.java b/src/main/java/com/supwisdom/dlpay/system/service/impl/DictionaryDataServiceImpl.java
index 85e9438..f328529 100644
--- a/src/main/java/com/supwisdom/dlpay/system/service/impl/DictionaryDataServiceImpl.java
+++ b/src/main/java/com/supwisdom/dlpay/system/service/impl/DictionaryDataServiceImpl.java
@@ -1,7 +1,5 @@
package com.supwisdom.dlpay.system.service.impl;
-import com.supwisdom.dlpay.api.dao.SourceTypeDao;
-import com.supwisdom.dlpay.api.domain.TSourceType;
import com.supwisdom.dlpay.framework.dao.DictionaryDao;
import com.supwisdom.dlpay.framework.domain.TDictionary;
import com.supwisdom.dlpay.framework.util.StringUtil;
@@ -15,20 +13,12 @@
@Service
public class DictionaryDataServiceImpl implements DictionaryDataService {
@Autowired
- private SourceTypeDao sourceTypeDao;
- @Autowired
private DictionaryDao dictionaryDao;
+
@Override
public HashMap<String, Object> getSystemAllSourcetype() {
- HashMap<String, Object> result = new HashMap<>(0);
- List<TSourceType> list = sourceTypeDao.findAll();
- if (!StringUtil.isEmpty(list)) {
- for (TSourceType tst : list) {
- result.put(tst.getSourceType(), tst.getPaydesc());
- }
- }
- return result;
+ return null;
}
@Override
diff --git a/src/main/java/com/supwisdom/dlpay/system/service/impl/DtlDataServiceImpl.java b/src/main/java/com/supwisdom/dlpay/system/service/impl/DtlDataServiceImpl.java
deleted file mode 100644
index 869bf31..0000000
--- a/src/main/java/com/supwisdom/dlpay/system/service/impl/DtlDataServiceImpl.java
+++ /dev/null
@@ -1,181 +0,0 @@
-package com.supwisdom.dlpay.system.service.impl;
-
-import com.supwisdom.dlpay.api.dao.PersondtlDao;
-import com.supwisdom.dlpay.api.dao.ShopdtlDao;
-import com.supwisdom.dlpay.api.domain.TPersondtl;
-import com.supwisdom.dlpay.api.domain.TShopdtl;
-import com.supwisdom.dlpay.framework.dao.DictionaryDao;
-import com.supwisdom.dlpay.framework.dao.ShopDao;
-import com.supwisdom.dlpay.framework.dao.TranscodeDao;
-import com.supwisdom.dlpay.framework.domain.TDictionary;
-import com.supwisdom.dlpay.framework.domain.TShop;
-import com.supwisdom.dlpay.framework.domain.TTranscode;
-import com.supwisdom.dlpay.framework.util.DateUtil;
-import com.supwisdom.dlpay.framework.util.PageResult;
-import com.supwisdom.dlpay.framework.util.StringUtil;
-import com.supwisdom.dlpay.system.bean.ShopdtlSearchBean;
-import com.supwisdom.dlpay.system.bean.TreeSelectNode;
-import com.supwisdom.dlpay.system.bean.UserdtlSearchBean;
-import com.supwisdom.dlpay.system.service.DtlDataService;
-import com.supwisdom.dlpay.util.ConstantUtil;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.domain.Page;
-import org.springframework.data.domain.PageRequest;
-import org.springframework.data.domain.Pageable;
-import org.springframework.data.domain.Sort;
-import org.springframework.data.jpa.domain.Specification;
-import org.springframework.stereotype.Service;
-
-import javax.persistence.criteria.CriteriaBuilder;
-import javax.persistence.criteria.CriteriaQuery;
-import javax.persistence.criteria.Predicate;
-import javax.persistence.criteria.Root;
-import java.util.ArrayList;
-import java.util.List;
-
-@Service
-public class DtlDataServiceImpl implements DtlDataService {
- @Autowired
- private PersondtlDao persondtlDao;
- @Autowired
- private ShopdtlDao shopdtlDao;
- @Autowired
- private TranscodeDao transcodeDao;
- @Autowired
- private DictionaryDao dictionaryDao;
- @Autowired
- private ShopDao shopDao;
-
- @Override
- public PageResult<TPersondtl> getPersondtlPage(UserdtlSearchBean searchBean, int pageNo, int pageSize) {
- Pageable pageable = PageRequest.of(pageNo - 1, pageSize, Sort.by(Sort.Direction.DESC, "refno"));
- Page<TPersondtl> page = persondtlDao.findAll(new Specification<TPersondtl>() {
- @Override
- public Predicate toPredicate(Root<TPersondtl> root, CriteriaQuery<?> query, CriteriaBuilder criteriaBuilder) {
- List<Predicate> predicates = new ArrayList<>();
- if(!StringUtil.isEmpty(searchBean.getStartAccdate())){
- predicates.add(criteriaBuilder.ge(root.get("accdate").as(Integer.class),Integer.valueOf(DateUtil.unParseToDateFormat(searchBean.getStartAccdate()))));
- }
- if(!StringUtil.isEmpty(searchBean.getEndAccdate())){
- predicates.add(criteriaBuilder.le(root.get("accdate").as(Integer.class),Integer.valueOf(DateUtil.unParseToDateFormat(searchBean.getEndAccdate()))));
- }
- if(!StringUtil.isEmpty(searchBean.getStartTransdate())){
- predicates.add(criteriaBuilder.ge(root.get("transdate").as(Integer.class),Integer.valueOf(DateUtil.unParseToDateFormat(searchBean.getStartTransdate()))));
-
- }
- if(!StringUtil.isEmpty(searchBean.getEndTransdate())){
- predicates.add(criteriaBuilder.le(root.get("transdate").as(Integer.class),Integer.valueOf(DateUtil.unParseToDateFormat(searchBean.getEndTransdate()))));
- }
- if(!StringUtil.isEmpty(searchBean.getPersonname())){
- predicates.add(criteriaBuilder.like(root.get("userName").as(String.class), "%" + searchBean.getPersonname().trim() + "%"));
- }
- if(!StringUtil.isEmpty(searchBean.getSourcetype())){
- predicates.add(criteriaBuilder.equal(root.get("sourceType").as(String.class), searchBean.getSourcetype().trim()));
- }
- if(!StringUtil.isEmpty(searchBean.getTradeflag())){
- predicates.add(criteriaBuilder.equal(root.get("tradeflag").as(String.class), searchBean.getTradeflag().trim()));
- }
- if(!StringUtil.isEmpty(searchBean.getTranscode())){
- predicates.add(criteriaBuilder.equal(root.get("transcode").as(String.class), searchBean.getTranscode().trim()));
- }
- if(!StringUtil.isEmpty(searchBean.getStatus())){
- predicates.add(criteriaBuilder.equal(root.get("status").as(String.class), searchBean.getStatus().trim()));
- }
- return criteriaBuilder.and(predicates.toArray(new Predicate[0]));
- }
- }, pageable);
- return new PageResult<>(page);
- }
-
- @Override
- public PageResult<TShopdtl> getShopdtlPage(ShopdtlSearchBean searchBean, int pageNo, int pageSize) {
- Pageable pageable = PageRequest.of(pageNo - 1, pageSize, Sort.by(Sort.Direction.DESC, "refno"));
- Page<TShopdtl> page = shopdtlDao.findAll(new Specification<TShopdtl>() {
- @Override
- public Predicate toPredicate(Root<TShopdtl> root, CriteriaQuery<?> query, CriteriaBuilder criteriaBuilder) {
- List<Predicate> predicates = new ArrayList<>();
- if(!StringUtil.isEmpty(searchBean.getStartAccdate())){
- predicates.add(criteriaBuilder.ge(root.get("accdate").as(Integer.class),Integer.valueOf(DateUtil.unParseToDateFormat(searchBean.getStartAccdate()))));
- }
- if(!StringUtil.isEmpty(searchBean.getEndAccdate())){
- predicates.add(criteriaBuilder.le(root.get("accdate").as(Integer.class),Integer.valueOf(DateUtil.unParseToDateFormat(searchBean.getEndAccdate()))));
- }
- if(!StringUtil.isEmpty(searchBean.getStartTransdate())){
- predicates.add(criteriaBuilder.ge(root.get("transdate").as(Integer.class),Integer.valueOf(DateUtil.unParseToDateFormat(searchBean.getStartTransdate()))));
-
- }
- if(!StringUtil.isEmpty(searchBean.getEndTransdate())){
- predicates.add(criteriaBuilder.le(root.get("transdate").as(Integer.class),Integer.valueOf(DateUtil.unParseToDateFormat(searchBean.getEndTransdate()))));
- }
- if(!StringUtil.isEmpty(searchBean.getShopname())){
- predicates.add(criteriaBuilder.like(root.get("shopname").as(String.class), "%" + searchBean.getShopname().trim() + "%"));
- }
- if(!StringUtil.isEmpty(searchBean.getShopaccno())){
- predicates.add(criteriaBuilder.equal(root.get("shopaccno").as(String.class), searchBean.getShopaccno().trim()));
- }
- if(!StringUtil.isEmpty(searchBean.getSourcetype())){
- predicates.add(criteriaBuilder.equal(root.get("sourceType").as(String.class), searchBean.getSourcetype().trim()));
- }
- if(!StringUtil.isEmpty(searchBean.getTradeflag())){
- predicates.add(criteriaBuilder.equal(root.get("tradeflag").as(String.class), searchBean.getTradeflag().trim()));
- }
- if(!StringUtil.isEmpty(searchBean.getTranscode())){
- predicates.add(criteriaBuilder.equal(root.get("transcode").as(String.class), searchBean.getTranscode().trim()));
- }
- if(!StringUtil.isEmpty(searchBean.getStatus())){
- predicates.add(criteriaBuilder.equal(root.get("status").as(String.class), searchBean.getStatus().trim()));
- }
- return criteriaBuilder.and(predicates.toArray(new Predicate[0]));
- }
- }, pageable);
- return new PageResult<>(page);
- }
-
- @Override
- public List<TTranscode> getAllTranscodes(){
- return transcodeDao.findAll();
- }
-
- @Override
- public List<TDictionary> getAllDtlStatus(){
- List<TDictionary> list = dictionaryDao.findAllByDicttype(ConstantUtil.DICTTYPE_NO2);
- if(!StringUtil.isEmpty(list)){
- return list;
- }
- return new ArrayList<>(0);
- }
-
- @Override
- public List<TreeSelectNode> getTreeSelectShops() {
- List<TShop> shoplist = shopDao.getNormalShops();
- if (StringUtil.isEmpty(shoplist)) {
- return new ArrayList<>(0);
- }
- return getShopSelectTree(shoplist, 0);
- }
-
- private List<TreeSelectNode> getShopSelectTree(List<TShop> shoplist, Integer fshopid) {
- List<TreeSelectNode> result = new ArrayList<>(0);
- for (TShop shop : shoplist) {
- if (fshopid.equals(shop.getFshopid())) {
- TreeSelectNode node = new TreeSelectNode();
- node.setId(String.valueOf(shop.getShopid()));
- if(!StringUtil.isEmpty(shop.getShopaccno())){
- node.setId(shop.getShopaccno()); //替换商户账号
- }
- node.setName(shop.getShopname());
- node.setOpen(StringUtil.isEmpty(shop.getShopaccno()));
- node.setChecked(false);
- node.setAccno(shop.getShopaccno());
- List<TreeSelectNode> children = getShopSelectTree(shoplist, shop.getShopid());
- if(null!=children && children.size()>0){
- node.setChildren(children);
- }else{
- node.setChildren(null);
- }
- result.add(node);
- }
- }
- return result;
- }
-}
diff --git a/src/main/java/com/supwisdom/dlpay/system/service/impl/ParamServiceImpl.java b/src/main/java/com/supwisdom/dlpay/system/service/impl/ParamServiceImpl.java
deleted file mode 100644
index f774582..0000000
--- a/src/main/java/com/supwisdom/dlpay/system/service/impl/ParamServiceImpl.java
+++ /dev/null
@@ -1,213 +0,0 @@
-package com.supwisdom.dlpay.system.service.impl;
-
-import com.supwisdom.dlpay.api.dao.PaytypeConfigDao;
-import com.supwisdom.dlpay.api.dao.SourceTypeDao;
-import com.supwisdom.dlpay.api.domain.TSourceType;
-import com.supwisdom.dlpay.api.domain.TPaytypeConfig;
-import com.supwisdom.dlpay.framework.dao.ApiClientDao;
-import com.supwisdom.dlpay.framework.dao.BusinessparaDao;
-import com.supwisdom.dlpay.framework.dao.SysparaDao;
-import com.supwisdom.dlpay.framework.domain.TApiClient;
-import com.supwisdom.dlpay.framework.domain.TBusinesspara;
-import com.supwisdom.dlpay.framework.domain.TSyspara;
-import com.supwisdom.dlpay.framework.util.PageResult;
-import com.supwisdom.dlpay.framework.util.StringUtil;
-import com.supwisdom.dlpay.system.service.ParamService;
-import com.supwisdom.dlpay.util.ConstantUtil;
-import com.supwisdom.dlpay.util.WebCheckException;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.domain.Page;
-import org.springframework.data.domain.PageRequest;
-import org.springframework.data.domain.Pageable;
-import org.springframework.data.domain.Sort;
-import org.springframework.data.jpa.domain.Specification;
-import org.springframework.stereotype.Service;
-
-import javax.persistence.criteria.CriteriaBuilder;
-import javax.persistence.criteria.CriteriaQuery;
-import javax.persistence.criteria.Predicate;
-import javax.persistence.criteria.Root;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-
-@Service
-public class ParamServiceImpl implements ParamService {
- @Autowired
- private SysparaDao sysparaDao;
- @Autowired
- private BusinessparaDao businessparaDao;
- @Autowired
- private ApiClientDao apiClientDao;
- @Autowired
- private SourceTypeDao paytypeDao;
- @Autowired
- private PaytypeConfigDao paytypeConfigDao;
-
- @Override
- public PageResult<TSyspara> getSysparaPage(Integer paraid, String paraname, int pageNo, int pageSize) {
- Pageable pageable = PageRequest.of(pageNo - 1, pageSize, Sort.by("paraid"));
- Page<TSyspara> page = sysparaDao.findAll(new Specification<TSyspara>() {
- @Override
- public Predicate toPredicate(Root<TSyspara> root, CriteriaQuery<?> query, CriteriaBuilder criteriaBuilder) {
- List<Predicate> predicates = new ArrayList<>();
- if (null != paraid) {
- predicates.add(criteriaBuilder.equal(root.get("paraid").as(Integer.class), paraid));
- }
- if (!StringUtil.isEmpty(paraname)) {
- predicates.add(criteriaBuilder.like(root.get("paraname").as(String.class), "%" + paraname.trim() + "%"));
- }
- predicates.add(criteriaBuilder.equal(root.get("displayflag").as(String.class), ConstantUtil.ENABLE_YES));
- return criteriaBuilder.and(predicates.toArray(new Predicate[0]));
- }
- }, pageable);
- return new PageResult<>(page);
- }
-
- @Override
- public TSyspara getSysparaByParaid(int paraid) {
- return sysparaDao.findByParaid(paraid);
- }
-
- @Override
- public boolean updateSyspara(TSyspara syspara) {
- if (null != syspara) {
- sysparaDao.save(syspara);
- return true;
- }
- return false;
- }
-
- @Override
- public PageResult<TBusinesspara> getBusinessparaPage(String paraname, int pageNo, int pageSize) {
- Pageable pageable = PageRequest.of(pageNo - 1, pageSize, Sort.by("parakey"));
- if (!StringUtil.isEmpty(paraname)) {
- return new PageResult<>(businessparaDao.findAllByParakeyContaining(paraname.trim(), pageable));
- }
- return new PageResult<>(businessparaDao.findAll(pageable));
- }
-
- @Override
- public TBusinesspara getBusinessparaByParakey(String parakey) {
- if (!StringUtil.isEmpty(parakey)) {
- return businessparaDao.findByParakey(parakey.trim());
- }
- return null;
- }
-
- @Override
- public boolean deleteBusinesspara(TBusinesspara businesspara) {
- if (null != businesspara) {
- businessparaDao.delete(businesspara);
- return true;
- }
- return false;
- }
-
- @Override
- public boolean saveOrUpdateBusinesspara(TBusinesspara businesspara) {
- if (null != businesspara) {
- businessparaDao.save(businesspara);
- return true;
- }
- return false;
- }
-
- @Override
- public PageResult<TApiClient> getApiClientparaPage(String appid, int pageNo, int pageSize) {
- Pageable pageable = PageRequest.of(pageNo - 1, pageSize, Sort.by("appid"));
- if (!StringUtil.isEmpty(appid)) {
- return new PageResult<>(apiClientDao.findByAppidContaining(appid.trim(), pageable));
- }
- return new PageResult<>(apiClientDao.findAll(pageable));
- }
-
- @Override
- public TApiClient getApiClientByAppid(String appid) {
- if (!StringUtil.isEmpty(appid)) {
- return apiClientDao.findByAppid(appid.trim());
- }
- return null;
- }
-
- @Override
- public boolean saveOrUpdateApiClient(TApiClient apiClient){
- if(null!=apiClient){
- apiClientDao.save(apiClient);
- return true;
- }
- return false;
- }
-
- @Override
- public boolean deleteApiClient(TApiClient apiClient) {
- if (null != apiClient) {
- apiClientDao.delete(apiClient);
- return true;
- }
- return false;
- }
-
- @Override
- public PageResult<TSourceType> getPaytypePage(String paytype, int pageNo, int pageSize) {
- Pageable pageable = PageRequest.of(pageNo - 1, pageSize, Sort.by("sourceType"));
- if (!StringUtil.isEmpty(paytype)) {
- return new PageResult<>(paytypeDao.findBySourceTypeContaining(paytype.trim(), pageable));
- }
- return new PageResult<>(paytypeDao.findAll(pageable));
- }
-
- @Override
- public TSourceType getPaytype(String paytype) {
- if (!StringUtil.isEmpty(paytype)) {
- return paytypeDao.getBySourceType(paytype.trim());
- }
- return null;
- }
-
- @Override
- public boolean saveOrUpdatePaytype(TSourceType paytype){
- if(null!=paytype){
- paytypeDao.save(paytype);
- return true;
- }
- return false;
- }
-
- @Override
- public boolean deletePaytype(TSourceType paytype){
- if(null!=paytype){
- paytypeDao.delete(paytype);
- return true;
- }
- return false;
- }
-
- @Override
- public List<TPaytypeConfig> getPaytypeConfigList(String paytype) {
- if (!StringUtil.isEmpty(paytype)) {
- List<TPaytypeConfig> list = paytypeConfigDao.getByPaytypeOrderByConfigid(paytype.trim());
- if (!StringUtil.isEmpty(list))
- return list;
- }
- return new ArrayList<>(0);
- }
-
- @Override
- public boolean savePaytypeConfig(String paytype, Map<String, String> param) throws WebCheckException {
- TSourceType tPaytype = getPaytype(paytype);
- if (null == tPaytype) throw new WebCheckException("支付能力[" + paytype + "]不存在");
- for (String key : param.keySet()) {
- String value = param.get(key);
- TPaytypeConfig config = paytypeConfigDao.getByPaytypeAndAndConfigid(tPaytype.getSourceType(), key);
- if (null == config) throw new WebCheckException("支付能力[" + tPaytype.getSourceType() + "]不存在配置项[" + key + "],请重新查询");
- config.setConfigValue(StringUtil.isEmpty(value) ? null : value.trim());
- paytypeConfigDao.save(config);
- }
- return true;
- }
-
-
-
-}
diff --git a/src/main/java/com/supwisdom/dlpay/system/service/impl/ShopDataServiceImpl.java b/src/main/java/com/supwisdom/dlpay/system/service/impl/ShopDataServiceImpl.java
deleted file mode 100644
index d474e2c..0000000
--- a/src/main/java/com/supwisdom/dlpay/system/service/impl/ShopDataServiceImpl.java
+++ /dev/null
@@ -1,278 +0,0 @@
-package com.supwisdom.dlpay.system.service.impl;
-
-import com.supwisdom.dlpay.api.dao.PaytypeConfigDao;
-import com.supwisdom.dlpay.api.dao.SourceTypeDao;
-import com.supwisdom.dlpay.api.dao.ShopPaytypeConfigDao;
-import com.supwisdom.dlpay.api.dao.ShopPaytypeDao;
-import com.supwisdom.dlpay.api.domain.TSourceType;
-import com.supwisdom.dlpay.api.domain.TPaytypeConfig;
-import com.supwisdom.dlpay.api.domain.TShopPaytype;
-import com.supwisdom.dlpay.api.domain.TShopPaytypeConfig;
-import com.supwisdom.dlpay.framework.dao.ShopDao;
-import com.supwisdom.dlpay.framework.dao.ShopaccDao;
-import com.supwisdom.dlpay.framework.data.SystemDateTime;
-import com.supwisdom.dlpay.framework.domain.TShop;
-import com.supwisdom.dlpay.framework.domain.TShopacc;
-import com.supwisdom.dlpay.framework.service.SystemUtilService;
-import com.supwisdom.dlpay.framework.util.PageResult;
-import com.supwisdom.dlpay.framework.util.StringUtil;
-import com.supwisdom.dlpay.framework.util.Subject;
-import com.supwisdom.dlpay.framework.util.TradeDict;
-import com.supwisdom.dlpay.system.bean.ShopConfigBean;
-import com.supwisdom.dlpay.system.bean.ZTreeNode;
-import com.supwisdom.dlpay.system.service.ShopDataService;
-import com.supwisdom.dlpay.util.ConstantUtil;
-import com.supwisdom.dlpay.util.WebCheckException;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.domain.Page;
-import org.springframework.data.domain.PageRequest;
-import org.springframework.data.domain.Pageable;
-import org.springframework.data.domain.Sort;
-import org.springframework.stereotype.Service;
-import org.springframework.data.jpa.domain.Specification;
-
-import javax.persistence.criteria.*;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-@Service
-public class ShopDataServiceImpl implements ShopDataService {
- @Autowired
- private ShopDao shopDao;
- @Autowired
- private ShopaccDao shopaccDao;
- @Autowired
- private ShopPaytypeDao shopPaytypeDao;
- @Autowired
- private SystemUtilService systemUtilService;
- @Autowired
- private SourceTypeDao paytypeDao;
- @Autowired
- private PaytypeConfigDao paytypeConfigDao;
- @Autowired
- private ShopPaytypeConfigDao shopPaytypeConfigDao;
-
- @Override
- public List<ZTreeNode> getAllShopNodes() {
- List<ZTreeNode> result = new ArrayList<>(0);
- List<TShop> shoplist = shopDao.getNormalShops();
- if (!StringUtil.isEmpty(shoplist)) {
- for (TShop shop : shoplist) {
- if (null == shop || !TradeDict.STATUS_NORMAL.equals(shop.getStatus())) continue; //跳过注销商户
- ZTreeNode node = new ZTreeNode();
- node.setId(shop.getShopid().toString());
- node.setName(shop.getShopid() + "_" + shop.getShopname());
- node.setpId(shop.getFshopid() == null ? "" : shop.getFshopid().toString());
- node.setChecked(false);
- node.setOpen(true);
- node.setShoptype(shop.getShoptype());
- node.setShopaccno(StringUtil.isEmpty(shop.getShopaccno()) ? "" : shop.getShopaccno());
- node.setIconSkin(shop.getShoptype() == 0 ? "pIcon01" : "pIcon02");
- result.add(node);
- }
- }
- return result;
- }
-
- @Override
- public TShop getShopByShopid(Integer shopid) {
- if (null != shopid) {
- return shopDao.getTShopByShopid(shopid);
- }
- return null;
- }
-
- @Override
- public boolean deleteShop(TShop shop) throws WebCheckException {
- if (null != shop) {
- List<TShop> childShops = shopDao.getChildShopsByShopid(shop.getShopid());
- if (!StringUtil.isEmpty(childShops))
- throw new WebCheckException("请先删除下级商户");
- shop.setStatus(TradeDict.STATUS_CLOSED);
- shop.setClosedate(systemUtilService.getSysdatetime().getHostdate());
- shopDao.save(shop);
- if (!StringUtil.isEmpty(shop.getShopaccno())) {
- TShopacc shopacc = shopaccDao.getByShopaccno(shop.getShopaccno());
- if (null == shopacc) throw new WebCheckException("数据异常!对应的商户账户不存在!");
- shopacc.setStatus(TradeDict.STATUS_CLOSED);
- shopacc.setClosedate(shop.getClosedate());
- shopaccDao.save(shopacc);
- }
- return true;
- }
- return false;
- }
-
- @Override
- public boolean saveOrUpdateShop(TShop shop) throws WebCheckException {
- if (shop.getFshopid() != 0) {
- TShop fshop = shopDao.getTShopByShopid(shop.getFshopid());
- if (null == fshop) {
- throw new WebCheckException("上级商户不存在!");
- } else if (fshop.getShoptype() == 1) {
- throw new WebCheckException("上级商户不是商户组!");
- }
- }
- if (shopDao.checkShopnameExist(shop.getShopname(), shop.getFshopid(), shop.getShopid() == null ? 0 : shop.getShopid()) > 0) {
- throw new WebCheckException("商户名称在同级下已经存在!");
- }
- if (null != shop.getShopid() && shop.getShopid() > 0) {
- //修改
- shopDao.save(shop);
- if (!StringUtil.isEmpty(shop.getShopaccno())) {
- shopaccDao.updateShopnameByShopaccno(shop.getShopname(), shop.getShopaccno()); //更新商户名
- }
- return true;
- } else {
- //新增
- SystemDateTime dt = systemUtilService.getSysdatetime();
- shop.setOpendate(dt.getHostdate());
- shopDao.save(shop);
- if (shop.getShoptype() == 1) {
- TShopacc shopacc = new TShopacc();
- shopacc.setShopaccno(String.format("2%09d", shop.getShopid()));
- shopacc.setShopid(shop.getShopid());
- shopacc.setShopname(shop.getShopname());
- shopacc.setSubjno(Subject.SUBJNO_MACHANT_INCOME);
- shopacc.setStatus(TradeDict.STATUS_NORMAL);
- shopacc.setOpendate(dt.getHostdate());
- shopacc.setBalance(0D);
- shopaccDao.save(shopacc);
-
- shop.setShopaccno(shopacc.getShopaccno());
- shopDao.save(shop);
-
- TShopPaytype shopPaytype = new TShopPaytype();
- shopPaytype.setShopaccno(shopacc.getShopaccno());
- shopPaytype.setPaytype(TradeDict.PAYTYPE_BALANCE);
- shopPaytype.setConsumeEnable(true);
- shopPaytype.setAnonymousEnable(false);
- shopPaytype.setReverseEnable(false);
- shopPaytype.setCreatetime(dt.getHostdatetime());
- shopPaytypeDao.save(shopPaytype); //默认增加余额支付方式
- }
- return true;
- }
- }
-
- @Override
- public List<TSourceType> getConsumePaytypes() {
- List<TSourceType> list = paytypeDao.getConsumeSourceTypes();
- if (!StringUtil.isEmpty(list)) {
- return list;
- }
- return new ArrayList<TSourceType>(0);
- }
-
- @Override
- public PageResult<ShopConfigBean> getShopPaytypeInfos(String shopaccno, String paytype, int pageNo, int pageSize) {
- Pageable pageable = PageRequest.of(pageNo - 1, pageSize, Sort.by("shopaccno", "paytype"));
-
- Page<TShopPaytype> page = shopPaytypeDao.findAll(new Specification<TShopPaytype>() {
- @Override
- public Predicate toPredicate(Root<TShopPaytype> root, CriteriaQuery<?> query, CriteriaBuilder criteriaBuilder) {
- List<Predicate> predicates = new ArrayList<>();
- if (!StringUtil.isEmpty(shopaccno)) {
- predicates.add(criteriaBuilder.equal(root.get("shopaccno").as(String.class), shopaccno.trim()));
- }
- if (!StringUtil.isEmpty(paytype)) {
- predicates.add(criteriaBuilder.equal(root.get("paytype").as(String.class), paytype.trim()));
- }
- return criteriaBuilder.and(predicates.toArray(new Predicate[0]));
- }
- }, pageable);
-
- if (null == page || page.getTotalElements() == 0) {
- return new PageResult<>(99, "无数据");
- }
- List<ShopConfigBean> list = new ArrayList<>(0);
- for (TShopPaytype pt : page.getContent()) {
- ShopConfigBean bean = new ShopConfigBean();
- bean.setShopaccno(pt.getShopaccno());
- TShopacc shopacc = shopaccDao.getByShopaccno(pt.getShopaccno());
- bean.setShopname(shopacc == null ? "" : shopacc.getShopname());
- bean.setPaytype(pt.getPaytype());
- TSourceType tPaytype = paytypeDao.getBySourceType(pt.getPaytype());
- bean.setPaydesc(tPaytype == null ? "" : tPaytype.getPaydesc());
- bean.setConsumeEnable(pt.getConsumeEnable());
- bean.setAnonymousEnable(pt.getAnonymousEnable());
- bean.setReverseEnable(pt.getReverseEnable());
- list.add(bean);
- }
- return new PageResult<>(page.getTotalElements(), list);
- }
-
- @Override
- public TShopPaytype getShopPaytype(String shopaccno, String paytype) {
- return shopPaytypeDao.getById(paytype, shopaccno);
- }
-
- @Override
- public TShopacc getShopaccByAccno(String shopaccno) {
- if (!StringUtil.isEmpty(shopaccno)) {
- return shopaccDao.getByShopaccno(shopaccno.trim());
- }
- return null;
- }
-
- @Override
- public boolean saveOrUpdateShopPaytype(TShopPaytype shopPaytype) {
- if (null != shopPaytype) {
- shopPaytypeDao.save(shopPaytype);
- return true;
- }
- return false;
- }
-
- @Override
- public List<TShopPaytypeConfig> getShopPaytypeConfigs(String shopaccno, String paytype) {
- List<TShopPaytypeConfig> result = new ArrayList<>(0);
- if (!StringUtil.isEmpty(paytype)) {
- List<TPaytypeConfig> list = paytypeConfigDao.getByPaytypeOrderByConfigid(paytype.trim());
- if (!StringUtil.isEmpty(list)) {
- for (TPaytypeConfig pt : list) {
- TShopPaytypeConfig spc = shopPaytypeConfigDao.getShopPaytypeConfigById(shopaccno, pt.getPaytype(), pt.getConfigid());
- if (null == spc) {
- spc = new TShopPaytypeConfig();
- spc.setShopaccno(shopaccno);
- spc.setPaytype(pt.getPaytype());
- spc.setConfigid(pt.getConfigid());
- spc.setConfigName(pt.getConfigName());
- spc.setConfigValue(null);
- }
- result.add(spc);
- }
- }
- }
- return result;
- }
-
- @Override
- public boolean saveOrUpdateShopPaytypeConfig(String shopaccno, String paytype, Map<String, String> param) throws WebCheckException {
- TShopPaytype shopPaytype = getShopPaytype(shopaccno, paytype);
- if (null == shopPaytype) {
- throw new WebCheckException("此商户[" + shopaccno + "]还不具有该支付能力[" + paytype + "]");
- }
- for (String key : param.keySet()) {
- String value = param.get(key);
- TShopPaytypeConfig spc = shopPaytypeConfigDao.getShopPaytypeConfigById(shopPaytype.getShopaccno(), shopPaytype.getPaytype(), key);
- if (null != spc) {
- spc.setConfigValue(StringUtil.isEmpty(value) ? null : value.trim());
- } else {
- spc = new TShopPaytypeConfig();
- spc.setShopaccno(shopPaytype.getShopaccno());
- spc.setPaytype(shopPaytype.getPaytype());
- spc.setConfigid(key);
- spc.setConfigValue(StringUtil.isEmpty(value) ? null : value.trim());
- TPaytypeConfig paytypeConfig = paytypeConfigDao.getByPaytypeAndAndConfigid(shopPaytype.getPaytype(), key);
- if (null != paytypeConfig) {
- spc.setConfigName(paytypeConfig.getConfigName());
- }
- }
- shopPaytypeConfigDao.save(spc);
- }
- return true;
- }
-
-}
diff --git a/src/main/java/com/supwisdom/dlpay/system/service/impl/UserDataServiceImpl.java b/src/main/java/com/supwisdom/dlpay/system/service/impl/UserDataServiceImpl.java
deleted file mode 100644
index 54694f5..0000000
--- a/src/main/java/com/supwisdom/dlpay/system/service/impl/UserDataServiceImpl.java
+++ /dev/null
@@ -1,178 +0,0 @@
-package com.supwisdom.dlpay.system.service.impl;
-
-import com.supwisdom.dlpay.api.bean.JsonResult;
-import com.supwisdom.dlpay.api.dao.AccountDao;
-import com.supwisdom.dlpay.api.dao.PersonDao;
-import com.supwisdom.dlpay.api.dao.PersonIdentityDao;
-import com.supwisdom.dlpay.api.dao.PointsAccountDao;
-import com.supwisdom.dlpay.api.domain.TAccount;
-import com.supwisdom.dlpay.api.domain.TPerson;
-import com.supwisdom.dlpay.api.domain.TPersonIdentity;
-import com.supwisdom.dlpay.api.domain.TPointsAccount;
-import com.supwisdom.dlpay.framework.data.SystemDateTime;
-import com.supwisdom.dlpay.framework.service.SystemUtilService;
-import com.supwisdom.dlpay.framework.util.*;
-import com.supwisdom.dlpay.system.bean.PersonParamBean;
-import com.supwisdom.dlpay.system.service.UserDataService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.domain.PageRequest;
-import org.springframework.data.domain.Pageable;
-import org.springframework.data.domain.Sort;
-import org.springframework.stereotype.Service;
-
-import java.util.List;
-import java.util.Optional;
-
-@Service
-public class UserDataServiceImpl implements UserDataService {
- @Autowired
- private PersonDao personDao;
- @Autowired
- private AccountDao accountDao;
- @Autowired
- private PointsAccountDao pointsAccountDao;
- @Autowired
- private SystemUtilService systemUtilService;
- @Autowired
- private PersonIdentityDao personIdentityDao;
-
- @Override
- public PageResult<TPerson> getPersonsByKey(PersonParamBean param) {
- Pageable pageable = PageRequest.of(param.getPageNo() - 1, param.getPageSize()
- , Sort.by(Sort.Direction.DESC, "lastsaved"));
- if (!StringUtil.isEmpty(param.getName())) {
- return new PageResult<>(personDao.findAllByNameContaining(param.getName(), pageable));
- }
- return new PageResult<>(personDao.findAll(pageable));
- }
-
- @Override
- public PageResult<TAccount> getAccountsByKey(PersonParamBean param) {
- Pageable pageable = PageRequest.of(param.getPageNo() - 1, param.getPageSize());
- if (!StringUtil.isEmpty(param.getName())) {
- return new PageResult<>(accountDao.findAllByAccnameContaining(param.getName(), pageable));
- }
- return new PageResult<>(accountDao.findAll(pageable));
- }
-
- @Override
- public PageResult<TPointsAccount> getPointsByKey(PersonParamBean param) {
- Pageable pageable = PageRequest.of(param.getPageNo() - 1, param.getPageSize());
- if (!StringUtil.isEmpty(param.getName())) {
- return new PageResult<>(pointsAccountDao.findAllByNameContaining(param.getName(), pageable));
- }
- return new PageResult<>(pointsAccountDao.findAll(pageable));
- }
-
- @Override
- public JsonResult saveUser(TPerson person) {
- if (!StringUtil.isEmpty(person.getUserid())) {
- Optional<TPerson> temp = personDao.findById(person.getUserid());
- if (!temp.isPresent()) {
- return JsonResult.error("参数错误");
- }
- TPerson it = temp.get();
- if (!person.getIdno().equals(it.getIdno())
- || !person.getIdtype().equals(it.getIdtype())) {
- TPerson has = personDao.findByIdentity(person.getIdtype(), person.getIdno());
- if (has != null && !has.getUserid().equals(person.getUserid())) {
- return JsonResult.error("证件类型、证件号已存在");
- }
- }
- if (!person.getName().equals(it.getName())) {
- TAccount account = accountDao.findByUserid(person.getUserid());
- if (account != null) {
- account.setAccname(person.getName());
- accountDao.save(account);
- }
- }
- if (StringUtil.isEmpty(person.getStatus())) {
- person.setStatus(TradeDict.STATUS_NORMAL);
- }
- personDao.save(person);
- } else {
- TPerson has = personDao.findByIdentity(person.getIdtype(), person.getIdno());
- if (has != null) {
- return JsonResult.error("证件类型、证件号已存在");
- }
- SystemDateTime systemDateTime = systemUtilService.getSysdatetime();
- person.setStatus(TradeDict.STATUS_NORMAL);
- person.setLastsaved(systemDateTime.getHostdatetime());
- person = personDao.save(person);
-
- TAccount account = new TAccount();
- account.setAccname(person.getName());
- account.setSubjno(Subject.SUBJNO_PERSONAL_DEPOSIT);
- account.setUserid(person.getUserid());
- account.setStatus(person.getStatus());
- account.setBalance(0.0);
- account.setAvailbal(0.0);
- account.setFrozebal(0.0);
- account.setLowfreeFlag(false);
- account.setMaxbal(systemUtilService.getSysparaValueAsDouble(SysparaUtil.SYSPARAID_NO1, SysparaUtil.SYSPARA_NO1_DEFAULT));
- account.setLasttransdate(systemDateTime.getHostdate());
- account.setLastdayDpsamt(0.0);
- account.setLastdayTransamt(0.0);
- account.setOpendate(systemDateTime.getHostdate());
- account.setTac(account.generateTac());
- accountDao.save(account);
- }
- return JsonResult.ok("添加成功");
- }
-
- @Override
- public JsonResult deleteUser(String userid) {
- TAccount account = accountDao.findByUserid(userid);
- if (account != null) {
- if (!TradeDict.STATUS_CLOSED.equals(account.getStatus()) && account.getBalance() != 0) {
- return JsonResult.error("该用户账户未注销且余额不为0,无法删除");
- } else {
- accountDao.delete(account);
- }
- }
- TPointsAccount pointsAccount = pointsAccountDao.findByUserid(userid);
- if (pointsAccount != null) {
- if (pointsAccount.getPoints() != 0) {
- return JsonResult.error("该用户账户积分不为0,无法删除,若要删除请先删除积分账户");
- } else {
- pointsAccountDao.delete(pointsAccount);
- }
- }
- personDao.deleteById(userid);
- return JsonResult.ok("操作成功");
- }
-
- @Override
- public JsonResult closeAccount(String accno) {
- Optional<TAccount> opt = accountDao.findById(accno);
- if (opt.isPresent()) {
- TAccount acc = opt.get();
- acc.setStatus(TradeDict.STATUS_CLOSED);
- accountDao.save(acc);
- return JsonResult.ok("操作成功");
- } else {
- return JsonResult.error("参数错误");
- }
- }
-
- @Override
- public JsonResult deletePoint(String userid) {
- Optional<TPointsAccount> pointsAccount = pointsAccountDao.findById(userid);
- if (pointsAccount.isPresent()) {
- pointsAccountDao.delete(pointsAccount.get());
- return JsonResult.ok("操作成功");
- }else {
- return JsonResult.error("参数错误");
- }
- }
-
- @Override
- public List<TPersonIdentity> getPersonIdentity(String userid) {
- return null;
- }
-
- @Override
- public PageResult<TPointsAccount> getUserPointDTL(PersonParamBean param) {
- return null;
- }
-}
diff --git a/src/test/kotlin/com/supwisdom/dlpay/controller/ShopControllerTest.kt b/src/test/kotlin/com/supwisdom/dlpay/controller/ShopControllerTest.kt
deleted file mode 100644
index c8fd5ec..0000000
--- a/src/test/kotlin/com/supwisdom/dlpay/controller/ShopControllerTest.kt
+++ /dev/null
@@ -1,79 +0,0 @@
-package com.supwisdom.dlpay.controller
-
-import com.google.gson.Gson
-import com.supwisdom.dlpay.MvcBaseTest
-import com.supwisdom.dlpay.api.bean.OpenShopParam
-import com.supwisdom.dlpay.api.bean.QueryShopParam
-import com.supwisdom.dlpay.framework.domain.TShop
-import org.junit.Assert
-import org.junit.Test
-import org.springframework.http.MediaType
-import org.springframework.test.context.ActiveProfiles
-
-import org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get
-import org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post
-import org.springframework.test.web.servlet.result.MockMvcResultHandlers.print
-import org.springframework.test.web.servlet.result.MockMvcResultMatchers.status
-
-/**
- * Created by shuwei on 2019/4/15.
- */
-@ActiveProfiles("devel-pg")
-class ShopControllerTest : MvcBaseTest() {
- class RetBean {
- var shopid: Int = 0
- var retcode: Int = 0
- lateinit var shop: TShop
- }
-
- @Test
- fun open() {
- val shopParam = OpenShopParam()
- shopParam.shopUniqueId = "ykt_shop_20001"
- shopParam.shopname = "测试名称"
- val gson = Gson()
- val ret = mvc.perform(post("/api/shop/open").content(gson.toJson(shopParam))
- .contentType(MediaType.APPLICATION_JSON))
- .andExpect(status().isOk)
- .andDo(print())
- .andReturn()
- val res = ret.response.contentAsString
- Assert.assertNotNull(res)
- val retBean = gson.fromJson(res, RetBean::class.java)
- Assert.assertNotNull(retBean)
- Assert.assertEquals(0, retBean.retcode)
- Assert.assertNotNull(retBean.shopid)
- Assert.assertNotEquals(0, retBean.shopid)
- }
-
- @Test
- fun get() {
- val shopParam = QueryShopParam()
- shopParam.shopUniqueId = "ykt_shop_20001"
- val gson = Gson()
- val ret = mvc.perform(post("/shop/open").content(gson.toJson(shopParam))
- .contentType(MediaType.APPLICATION_JSON))
- .andExpect(status().isOk)
- .andDo(print())
- .andReturn()
- val resOpen = ret.response.contentAsString
- Assert.assertNotNull(resOpen)
- val retBeanOpen = gson.fromJson(resOpen, RetBean::class.java)
- Assert.assertNotNull(retBeanOpen)
- Assert.assertNotNull(retBeanOpen.shopid)
- shopParam.shopid = retBeanOpen.shopid
-
- val retGet = mvc.perform(get("/shop/get").content(gson.toJson(shopParam))
- .contentType(MediaType.APPLICATION_JSON))
- .andExpect(status().isOk)
- .andDo(print())
- .andReturn()
- val res = retGet.response.contentAsString
- Assert.assertNotNull(res)
- val retBean = gson.fromJson(res, RetBean::class.java)
- Assert.assertNotNull(retBean)
- Assert.assertEquals(0, retBean.retcode)
- Assert.assertNotNull(retBean.shop)
- Assert.assertEquals(retBeanOpen.shopid, retBean.shop.shopid)
- }
-}
\ No newline at end of file
diff --git a/src/test/kotlin/com/supwisdom/dlpay/controller/UserControllerTest.kt b/src/test/kotlin/com/supwisdom/dlpay/controller/UserControllerTest.kt
deleted file mode 100644
index c76eb14..0000000
--- a/src/test/kotlin/com/supwisdom/dlpay/controller/UserControllerTest.kt
+++ /dev/null
@@ -1,80 +0,0 @@
-package com.supwisdom.dlpay.controller
-
-import com.google.gson.Gson
-import com.supwisdom.dlpay.MvcBaseTest
-import com.supwisdom.dlpay.api.bean.OpenUserParam
-import com.supwisdom.dlpay.api.bean.QueryUserParam
-import com.supwisdom.dlpay.api.domain.TAccount
-import com.supwisdom.dlpay.api.domain.TPerson
-import org.junit.Assert
-import org.junit.Test
-import org.springframework.http.MediaType
-import org.springframework.test.web.servlet.request.MockMvcRequestBuilders
-import org.springframework.test.web.servlet.result.MockMvcResultHandlers
-import org.springframework.test.web.servlet.result.MockMvcResultMatchers
-
-
-class UserControllerTest : MvcBaseTest() {
-
- class RetBean {
- var userid: String = ""
- var retcode: Int = 0
- lateinit var person: TPerson
- lateinit var account: TAccount
- }
-
- @Test
- fun open() {
- val userParam = OpenUserParam()
- userParam.uid = ""//random req
- userParam.name = "测试名称"
-
- val ret = mvc.perform(MockMvcRequestBuilders.post("/api/user/open").content(gson.toJson(userParam))
- .contentType(MediaType.APPLICATION_JSON))
- .andExpect(MockMvcResultMatchers.status().isOk)
- .andDo(MockMvcResultHandlers.print())
- .andReturn()
- val res = ret.response.contentAsString
- Assert.assertNotNull(res)
- val retBean = gson.fromJson(res, RetBean::class.java)
- Assert.assertNotNull(retBean)
- Assert.assertEquals(0, retBean.retcode)
- Assert.assertNotNull(retBean.userid)
- Assert.assertNotEquals("", retBean.userid)
- }
-
- @Test
- fun get() {
-
- val userParam = QueryUserParam()
- userParam.uid = "testuseruniqueId"//测试用
- val gson = Gson()
- val ret = mvc.perform(MockMvcRequestBuilders.post("/api/user/open").content(gson.toJson(userParam))
- .contentType(MediaType.APPLICATION_JSON))
- .andExpect(MockMvcResultMatchers.status().isOk)
- .andDo(MockMvcResultHandlers.print())
- .andReturn()
- val resOpen = ret.response.contentAsString
- Assert.assertNotNull(resOpen)
- val retBeanOpen = gson.fromJson(resOpen, RetBean::class.java)
- Assert.assertNotNull(retBeanOpen)
- Assert.assertNotNull(retBeanOpen.userid)
- userParam.userid = retBeanOpen.userid
-
- val retGet = mvc.perform(MockMvcRequestBuilders.get("/api/user/query").content(gson.toJson(userParam))
- .contentType(MediaType.APPLICATION_JSON))
- .andExpect(MockMvcResultMatchers.status().isOk)
- .andDo(MockMvcResultHandlers.print())
- .andReturn()
- val res = retGet.response.contentAsString
- Assert.assertNotNull(res)
- val retBean = gson.fromJson(res, RetBean::class.java)
- Assert.assertNotNull(retBean)
- Assert.assertEquals(0, retBean.retcode)
- Assert.assertNotNull(retBean.person)
- Assert.assertEquals(retBeanOpen.userid, retBean.person.userid)
- Assert.assertNotNull(retBeanOpen.account)
- Assert.assertEquals(retBeanOpen.person.userid, retBean.account.userid)
- }
-
-}
\ No newline at end of file