删除了部分无用代码
diff --git a/src/main/java/com/supwisdom/dlpay/api/controller/TestAction.java b/src/main/java/com/supwisdom/dlpay/api/controller/TestAction.java
deleted file mode 100644
index 9a2d51b..0000000
--- a/src/main/java/com/supwisdom/dlpay/api/controller/TestAction.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package com.supwisdom.dlpay.api.controller;
-
-import com.supwisdom.dlpay.api.bean.BaseResp;
-import com.supwisdom.dlpay.framework.data.SystemDateTime;
-import com.supwisdom.dlpay.framework.service.SystemUtilService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.ResponseBody;
-
-@Controller //将所有方法标识@ResponseBody注解
-@RequestMapping("/test")
-public class TestAction {
- @Autowired
- private SystemUtilService systemUtilService;
-
- @RequestMapping("/demo")
- @ResponseBody
- public BaseResp test() {
- SystemDateTime dt = systemUtilService.getSysdatetime();
-
- BaseResp resp = new BaseResp();
- resp.setRetcode("0");
- resp.setRetmsg("OK");
- resp.setData("hostdate=["+dt.getHostdate()+"],hosttime=["+dt.getHosttime()+"],hostdatetime=["+dt.getHostdatetime()+"],date=["+dt.getSysdate()+"]");
- return resp;
- }
-}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/dao/FeetypeConfigDao.java b/src/main/java/com/supwisdom/dlpay/framework/dao/FeetypeConfigDao.java
deleted file mode 100644
index b626087..0000000
--- a/src/main/java/com/supwisdom/dlpay/framework/dao/FeetypeConfigDao.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package com.supwisdom.dlpay.framework.dao;
-
-import com.supwisdom.dlpay.framework.domain.TFeetypeConfig;
-import com.supwisdom.dlpay.framework.domain.TFeetypeConfigPK;
-import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.data.jpa.repository.Query;
-import org.springframework.stereotype.Repository;
-
-@Repository
-public interface FeetypeConfigDao extends JpaRepository<TFeetypeConfig, TFeetypeConfigPK> {
- @Query("select a from TFeetypeConfig a where a.feetype=?1 and a.paytype=?2 ")
- TFeetypeConfig getById(String feetype, String paytype);
-}
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/TranstypeDao.java b/src/main/java/com/supwisdom/dlpay/framework/dao/TranstypeDao.java
deleted file mode 100644
index a276c61..0000000
--- a/src/main/java/com/supwisdom/dlpay/framework/dao/TranstypeDao.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package com.supwisdom.dlpay.framework.dao;
-
-import com.supwisdom.dlpay.framework.domain.TTranstype;
-import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.stereotype.Repository;
-
-@Repository
-public interface TranstypeDao extends JpaRepository<TTranstype, Integer> {
- TTranstype findByTranstype(Integer transtype);
-}
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/DayendSettleService.java b/src/main/java/com/supwisdom/dlpay/framework/service/DayendSettleService.java
deleted file mode 100644
index d3318f0..0000000
--- a/src/main/java/com/supwisdom/dlpay/framework/service/DayendSettleService.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package com.supwisdom.dlpay.framework.service;
-
-import com.supwisdom.dlpay.framework.domain.TSettleLog;
-import org.springframework.transaction.annotation.Propagation;
-import org.springframework.transaction.annotation.Transactional;
-
-/**
- * 日终结算
- * */
-public interface DayendSettleService {
- TSettleLog doCreateSettleLog();
- TSettleLog doUpdateSettleLog(TSettleLog log);
-
- @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
- boolean doDayendSettle() throws Exception; //日结
-
- @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
- boolean doVoucherSettle(String voucherid) throws Exception; //指定凭证入账
-}
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/SystemUtilServiceImpl.java b/src/main/java/com/supwisdom/dlpay/framework/service/impl/SystemUtilServiceImpl.java
deleted file mode 100644
index eee9e5a..0000000
--- a/src/main/java/com/supwisdom/dlpay/framework/service/impl/SystemUtilServiceImpl.java
+++ /dev/null
@@ -1,243 +0,0 @@
-package com.supwisdom.dlpay.framework.service.impl;
-
-import com.supwisdom.dlpay.framework.core.DatabaseConfig;
-import com.supwisdom.dlpay.framework.dao.*;
-import com.supwisdom.dlpay.framework.data.SystemDateTime;
-import com.supwisdom.dlpay.framework.domain.*;
-import com.supwisdom.dlpay.framework.service.SystemUtilService;
-import com.supwisdom.dlpay.framework.util.DateUtil;
-import com.supwisdom.dlpay.framework.util.NumberUtil;
-import com.supwisdom.dlpay.framework.util.StringUtil;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-@Service
-public class SystemUtilServiceImpl implements SystemUtilService {
- @Autowired
- private DatabaseConfig databaseConfig;
-
- @Autowired
- private TaskLockDao taskLockDao;
- @Autowired
- private SettleCtlDao settleCtlDao;
- @Autowired
- private TranscodeDao transcodeDao;
- @Autowired
- private SysparaDao sysparaDao;
- @Autowired
- private BusinessparaDao businessparaDao;
-
- private static final Logger logger = LoggerFactory.getLogger(SystemUtilServiceImpl.class);
-
- public static class SystemDateTimeImpl implements SystemDateTime {
- private Date now;
- private static final SimpleDateFormat sdft = new SimpleDateFormat("yyyyMMddHHmmss");
-
- public SystemDateTimeImpl(Date now) {
- this.now = now;
- }
-
- @Override
- public String getHostdate() {
- return sdft.format(this.now).substring(0, 8);
- }
-
- @Override
- public String getHosttime() {
- return sdft.format(this.now).substring(8, 14);
- }
-
- @Override
- public String getHostdatetime() {
- return sdft.format(this.now);
- }
-
- @Override
- public Date getSysdate() {
- return this.now;
- }
- }
-
- /**
- * 获取oracle数据库时间
- */
- private SystemDateTime getOracleDatetime() {
- return taskLockDao.getOracleDatetime();
- }
-
- private SystemDateTime getPGDatetime() {
- return taskLockDao.getPGDatetime();
- }
-
- @Override
- public SystemDateTime getSysdatetime() {
- switch (databaseConfig.getPlatform()) {
- case "postgresql":
- return getPGDatetime();
- default:
- return getOracleDatetime();
- }
- }
-
- @Override
- public TTaskLock updateTaskLock(TTaskLock lock) {
- return taskLockDao.save(lock);
- }
-
- @Override
- public TTaskLock doLockTask(String taskcode, Integer minRecover, String remark) {
- if (null == minRecover) minRecover = 10; //默认10分钟
- String hostdatetime = getSysdatetime().getHostdatetime(); //yyyyMMddHHmmss
- TTaskLock lock = taskLockDao.getTaskLockWithLock(taskcode);
- if (lock != null) {
- if (lock.getTaskstatus() == 1 && DateUtil.compareDatetime(DateUtil.getNewTime(hostdatetime, -60 * minRecover), lock.getTasktime()) < 0) {
- // 被锁,正在执行操作
- return null;
- } else {
- lock.setTaskstatus(1);
- lock.setTasktime(hostdatetime);
- taskLockDao.save(lock);
- return lock;
- }
- } else {
- lock = new TTaskLock();
- lock.setTaskcode(taskcode);
- lock.setTaskstatus(1);
- lock.setTasktime(hostdatetime);
- lock.setRemark(remark);
- taskLockDao.save(lock);
- }
- 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();
- }
-
- @Override
- public String getRefno() {
- switch (databaseConfig.getPlatform()) {
- case "postgresql":
- return taskLockDao.getPgRefno();
- default:
- return taskLockDao.getOracleRefno();
- }
- }
-
- @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) {
- TSyspara syspara = sysparaDao.findByParaid(paraid);
- if (null != syspara) return syspara.getParaval();
- return null;
- }
-
- @Override
- public String getSysparaValue(int paraid, String defaultValue) {
- String paraval = getSysparaValue(paraid);
- if (null != paraval) return paraval;
- return defaultValue;
- }
-
- @Override
- public boolean getSysparaValueAsBoolean(int paraid) {
- TSyspara syspara = sysparaDao.findByParaid(paraid);
- if (null != syspara && "1".equals(syspara.getParaval())) return true;
- return false;
- }
-
- @Override
- public int getSysparaValueAsInt(int paraid, int defaultValue) {
- TSyspara syspara = sysparaDao.findByParaid(paraid);
- if (null != syspara && NumberUtil.isNumber(syspara.getParaval())) return Integer.parseInt(syspara.getParaval());
- return defaultValue;
- }
-
- @Override
- public double getSysparaValueAsDouble(int paraid, double defaultValue) {
- TSyspara syspara = sysparaDao.findByParaid(paraid);
- if (null != syspara && NumberUtil.isDecimal(syspara.getParaval())) return Double.parseDouble(syspara.getParaval());
- return defaultValue;
- }
-
- @Override
- public TSyspara getSyspara(int paraid){
- return sysparaDao.findByParaid(paraid);
- }
-
- @Override
- public TSyspara getSysparaValueForUpdate(int paraid){
- return sysparaDao.findByParaidWithLock(paraid);
- }
-
- @Override
- public TSyspara getSysparaValueForUpdateNowait(int paraid){
- return sysparaDao.findByParaidWithLockNowait(paraid);
- }
-
- @Override
- public String getBusinessValue(String parakey) {
- if (!StringUtil.isEmpty(parakey)) {
- TBusinesspara businesspara = businessparaDao.findByParakey(parakey.trim());
- if (null != businesspara) return businesspara.getParaval();
- }
- return null;
- }
-
- @Override
- public String getBusinessValue(String parakey, String defaultValue) {
- String paraval = getBusinessValue(parakey);
- if (!StringUtil.isEmpty(paraval)) return paraval;
- return defaultValue;
- }
-
- @Override
- public TBusinesspara getBusiness(String parakey) {
- if (!StringUtil.isEmpty(parakey)) return businessparaDao.findByParakey(parakey.trim());
- return null;
- }
-
- @Override
- public TBusinesspara getBusinessValueForUpdate(String parakey){
- if (!StringUtil.isEmpty(parakey)) return businessparaDao.findByParakeyForUpdate(parakey.trim());
- return null;
- }
-
- @Override
- public TBusinesspara getBusinessValueForUpdateNowait(String parakey) {
- if (!StringUtil.isEmpty(parakey)) return businessparaDao.findByParakeyForUpdateNowait(parakey.trim());
- return null;
- }
-
- @Override
- public String getSubsystemSignKey(String syscode){
- // fixme: 验证数据无误性签名秘钥
- return "";
- }
-
-}
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/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/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/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/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/kotlin/com/supwisdom/dlpay/api/advices.kt b/src/main/kotlin/com/supwisdom/dlpay/api/advices.kt
deleted file mode 100644
index f47651d..0000000
--- a/src/main/kotlin/com/supwisdom/dlpay/api/advices.kt
+++ /dev/null
@@ -1,59 +0,0 @@
-package com.supwisdom.dlpay.api
-
-import com.supwisdom.dlpay.framework.ResponseBodyBuilder
-import com.supwisdom.dlpay.framework.util.APIRequestParam
-import com.supwisdom.dlpay.framework.util.TradeErrorCode
-import mu.KotlinLogging
-import org.aspectj.lang.ProceedingJoinPoint
-import org.aspectj.lang.annotation.Around
-import org.aspectj.lang.annotation.Aspect
-import org.aspectj.lang.annotation.Pointcut
-import org.springframework.http.ResponseEntity
-import org.springframework.stereotype.Component
-import org.springframework.web.bind.annotation.ExceptionHandler
-import org.springframework.web.bind.annotation.RestControllerAdvice
-import javax.servlet.http.HttpServletRequest
-
-
-@RestControllerAdvice("com.supwisdom.dlpay.api")
-class RestControllerAdvice {
- val logger = KotlinLogging.logger { }
-
- @ExceptionHandler
- fun handleException(ex: Exception, request: HttpServletRequest): ResponseEntity<Any> {
- logger.error { "Request unhandler exception, url<${request.requestURI}>, ex<${ex.cause}>" }
- return ResponseEntity.ok().body(ResponseBodyBuilder.create()
- .exception(TradeErrorCode.BUSINESS_DEAL_ERROR, ex.cause))
- }
-}
-
-@Component
-@Aspect
-class RestControllerAspect {
-
- private val logger = KotlinLogging.logger { }
-
- @Pointcut("@within(org.springframework.web.bind.annotation.RestController)")
- fun restcontroller() {
- }
-
- @Pointcut("@annotation(org.springframework.web.bind.annotation.PostMapping)")
- fun postmapping() {
- }
-
- @Around("restcontroller() && postmapping() && args(.., @RequestBody body)")
- @Throws(Throwable::class)
- fun logPostMethods(joinPoint: ProceedingJoinPoint, body: Any): Any {
- return try {
- if (body is APIRequestParam) {
- body.checkParam()
- }
- val result = joinPoint.proceed()
- logger.debug(result.toString())
- result
- } catch (t: Throwable) {
- logger.error { "request error , ex<${t.message}>" }
- throw t
- }
- }
-}
diff --git a/src/main/kotlin/com/supwisdom/dlpay/api/controller/shop_api_controller.kt b/src/main/kotlin/com/supwisdom/dlpay/api/controller/shop_api_controller.kt
deleted file mode 100644
index 475a42a..0000000
--- a/src/main/kotlin/com/supwisdom/dlpay/api/controller/shop_api_controller.kt
+++ /dev/null
@@ -1,81 +0,0 @@
-package com.supwisdom.dlpay.api.controller
-
-import com.supwisdom.dlpay.api.bean.OpenShopParam
-import com.supwisdom.dlpay.api.bean.QueryShopParam
-import com.supwisdom.dlpay.framework.ResponseBodyBuilder
-import com.supwisdom.dlpay.api.service.ShopService
-import com.supwisdom.dlpay.exception.RequestParamCheckException
-import com.supwisdom.dlpay.exception.TransactionException
-import com.supwisdom.dlpay.framework.service.CommonService
-import com.supwisdom.dlpay.framework.util.TradeErrorCode
-import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.http.ResponseEntity
-import org.springframework.web.bind.annotation.*
-import java.net.URLDecoder
-import javax.servlet.http.HttpServletRequest
-import javax.servlet.http.HttpServletResponse
-
-@RestController
-@RequestMapping("/api/shop")
-class ShopAPIController {
- @Autowired
- private lateinit var shopService: ShopService
- @Autowired
- private lateinit var commonService: CommonService
-
- @PostMapping("/open")
- fun openAccount(@RequestBody param: OpenShopParam, request: HttpServletRequest, response: HttpServletResponse): ResponseEntity<Any> {
- try {
- if (!param.checkParam() || !param.checkSign(commonService.getAppidSecretByRequest(request))) {
- return ResponseEntity.ok(ResponseBodyBuilder.create()
- .fail(TradeErrorCode.REQUEST_SIGN_ERROR, "参数签名错误"))
- }
- shopService.findByThirdUniqueId(param.shopUniqueId)?.let {
- return ResponseEntity.ok(ResponseBodyBuilder.create()
- .fail(TradeErrorCode.BUSINESS_SHOP_EXISTS, "该商户唯一号[${param.shopUniqueId}]已经存在"))
- }
-
- param.shopname = param.shopname.let { URLDecoder.decode(param.shopname, Charsets.UTF_8.toString()) } //解码
- param.contactman = param.contactman?.let { URLDecoder.decode(param.contactman, Charsets.UTF_8.toString()) } //解码
- param.address = param.address?.let { URLDecoder.decode(param.address, Charsets.UTF_8.toString()) } //解码
- shopService.registerShop(param).let {
- return ResponseEntity.ok(ResponseBodyBuilder.create()
- .data("shopid", it.shopid)
- .data("shopaccno", it.shopaccno ?: "")
- .success("注册成功"))
- }
-
- } catch (ex: RequestParamCheckException) {
- return ResponseEntity.ok(ResponseBodyBuilder.create()
- .requestException(ex, "请求参数错误"))
- } catch (et: TransactionException) {
- return ResponseEntity.ok(ResponseBodyBuilder.create()
- .transException(et, "业务处理错误"))
- }
- }
-
- @GetMapping("/query")
- fun queryShop(@RequestBody param: QueryShopParam, request: HttpServletRequest, response: HttpServletResponse): ResponseEntity<Any> {
- try {
- if (param.checkParam() && param.checkSign(commonService.getAppidSecretByRequest(request))) {
- return ResponseEntity.ok(ResponseBodyBuilder.create()
- .fail(TradeErrorCode.REQUEST_SIGN_ERROR, "参数签名错误"))
- }
-
- shopService.findByShopBySearch(param.shopid, param.shopaccno, param.shopUniqueId)?.let {
- return ResponseEntity.ok(ResponseBodyBuilder.create()
- .data("shop", it)
- .success())
- }
-
- return ResponseEntity.ok(ResponseBodyBuilder.create()
- .fail(TradeErrorCode.SHOP_NOT_EXISTS, "商户不存在"))
- } catch (ex: RequestParamCheckException) {
- return ResponseEntity.ok(ResponseBodyBuilder.create()
- .requestException(ex, "请求参数错误"))
- } catch (et: TransactionException) {
- return ResponseEntity.ok(ResponseBodyBuilder.create()
- .transException(et, "业务处理错误"))
- }
- }
-}
\ No newline at end of file
diff --git a/src/main/kotlin/com/supwisdom/dlpay/api/repositories/repository_impl.kt b/src/main/kotlin/com/supwisdom/dlpay/api/repositories/repository_impl.kt
deleted file mode 100644
index e14f947..0000000
--- a/src/main/kotlin/com/supwisdom/dlpay/api/repositories/repository_impl.kt
+++ /dev/null
@@ -1,74 +0,0 @@
-package com.supwisdom.dlpay.api.repositories
-
-import com.supwisdom.dlpay.api.domain.TAccount
-import com.supwisdom.dlpay.api.domain.TPersondtl
-import com.supwisdom.dlpay.api.domain.TShopdtl
-import com.supwisdom.dlpay.exception.TransactionProcessException
-import com.supwisdom.dlpay.framework.domain.TShopacc
-import com.supwisdom.dlpay.framework.util.TradeErrorCode
-import org.springframework.stereotype.Repository
-import org.springframework.transaction.annotation.Transactional
-import javax.persistence.EntityManager
-import javax.persistence.PersistenceContext
-
-@Repository
-@Transactional
-class TAccountRepositoryImpl : TAccountRepository {
-
- @PersistenceContext
- private lateinit var entityManager: EntityManager
-
- override fun recalcAccountBalance(accno: String, avaibal: Double, amount: Double, overdraft: Boolean): Int {
- val account = entityManager.find(TAccount::class.java, accno) ?: return 0
- if (avaibal.compareTo(account.availbal!!) != 0) {
- throw TransactionProcessException(TradeErrorCode.ACCOUNT_TRADE_BUSY,
- "账户余额已被更新")
- }
-
- return entityManager.createQuery("update TAccount a set a.availbal=a.availbal+?1, a.balance=a.balance+?1 " +
- "where a.accno=?2 and a.availbal=?3")?.run {
- setParameter(1, amount)
- setParameter(2, accno)
- setParameter(3, avaibal)
- executeUpdate()
- } ?: throw TransactionProcessException(TradeErrorCode.BUSINESS_DEAL_ERROR, "更新个人账户余额错误")
- }
-
- override fun recalcAccountBalance(account: TAccount, amount: Double, overdraft: Boolean): Int {
- return recalcAccountBalance(account.accno, account.availbal, amount, overdraft)
- }
-
- override fun recalcAccountBalance(dtl: TPersondtl, amount: Double, overdraft: Boolean): Int {
- return entityManager.find(TAccount::class.java, dtl.accountNo)?.let {
- recalcAccountBalance(it, amount, overdraft).also { count ->
- if (count == 1) {
- dtl.befbal = it.availbal
- }
- }
- } ?: throw TransactionProcessException(TradeErrorCode.BUSINESS_DEAL_ERROR,
- "交易流水<${dtl.refno}>未找到指定个人账户")
- }
-}
-
-@Repository
-@Transactional
-class ShopaccRepositoryImpl : TShopaccRepository {
-
- @PersistenceContext
- private lateinit var entityManager: EntityManager
-
- override fun recalcShopBalance(dtl: TShopdtl, amount: Double, overdraft: Boolean): Int {
- val shopacc = entityManager.find(TShopacc::class.java, dtl.shopaccno)
- ?: throw TransactionProcessException(TradeErrorCode.ACCOUNT_NOT_EXISTS,
- "交易流水<${dtl.refno}>商户账户不存在")
-
- return entityManager.createQuery("update TShopacc c set c.balance=c.balance+?1" +
- " where c.shopaccno=?2 and c.balance=?3")?.run {
- setParameter(1, amount)
- setParameter(2, dtl.shopaccno)
- setParameter(3, shopacc.balance)
- executeUpdate()
- } ?: throw TransactionProcessException(TradeErrorCode.BUSINESS_DEAL_ERROR,
- "交易流水<${dtl.refno}>未找到指定商户账户")
- }
-}
\ No newline at end of file
diff --git a/src/main/kotlin/com/supwisdom/dlpay/api/service/impl/shop_service_impl.kt b/src/main/kotlin/com/supwisdom/dlpay/api/service/impl/shop_service_impl.kt
deleted file mode 100644
index 07c6c40..0000000
--- a/src/main/kotlin/com/supwisdom/dlpay/api/service/impl/shop_service_impl.kt
+++ /dev/null
@@ -1,94 +0,0 @@
-package com.supwisdom.dlpay.api.service.impl
-
-import com.supwisdom.dlpay.api.bean.OpenShopParam
-import com.supwisdom.dlpay.framework.dao.ShopDao
-import com.supwisdom.dlpay.framework.dao.ShopaccDao
-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.Subject
-import com.supwisdom.dlpay.api.service.ShopService
-import com.supwisdom.dlpay.exception.TransactionProcessException
-import com.supwisdom.dlpay.framework.util.StringUtil
-import com.supwisdom.dlpay.framework.util.TradeDict
-import com.supwisdom.dlpay.framework.util.TradeErrorCode
-import com.supwisdom.dlpay.util.ConstantUtil
-import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.stereotype.Service
-
-/**
- * Created by shuwei on 2019/4/15.
- */
-@Service
-class ShopServiceImpl : ShopService {
- @Autowired
- private lateinit var shopDao: ShopDao
- @Autowired
- private lateinit var shopaccDao: ShopaccDao
- @Autowired
- private lateinit var systemUtilService: SystemUtilService
-
- override fun findByThirdUniqueId(uniqueId: String): TShop? {
- return shopDao.getByThirdUniqueIdenty(uniqueId)
- }
-
- override fun registerShop(param: OpenShopParam): TShop {
- val systemdatetime = systemUtilService.sysdatetime
- var shop = shopDao.getByThirdUniqueIdentyForUpdate(param.shopUniqueId)
- if (null != shop) {
- throw TransactionProcessException(TradeErrorCode.BUSINESS_SHOP_EXISTS, "该商户唯一号[${param.shopUniqueId}]已经存在")
- }
- if (null != param.fshopid) {
- shopDao.getTShopByShopid(param.fshopid).let {
- if (null == it) {
- throw TransactionProcessException(TradeErrorCode.SHOP_NOT_EXISTS, "上级商户不存在已经存在")
- }
- }
- }
- shop = shopDao.save(TShop().apply {
- fshopid = param.fshopid
- shopname = param.shopname
- shoptype = param.shoptype
- status = TradeDict.STATUS_NORMAL
- contactman = param.contactman
- idtype = param.idtype
- idno = param.idno
- mobile = param.mobile
- email = param.email
- addr = param.address
- zipcode = param.zipcode
- opendate = systemdatetime.hostdate
- thirdUniqueIdenty = param.shopUniqueId
- })
- if (ConstantUtil.SHOPTYPE_GROUP != shop.shoptype) {
- //非商户组要创建账号
- val shopaccno = String.format("2%09d", shop.shopid)
- shopaccDao.save(TShopacc().apply {
- this.shopaccno = shopaccno
- this.shopid = shop.shopid
- this.shopname = shop.shopname
- this.subjno = Subject.SUBJNO_MACHANT_INCOME
- this.status = TradeDict.STATUS_NORMAL
- this.opendate = shop.opendate
- })
- shop.shopaccno = shopaccno
- shopDao.save(shop) //更新账号
- }
- return shop
- }
-
- override fun findByShopId(shopid: Int): TShop {
- return shopDao.getTShopByShopid(shopid)
- ?: throw TransactionProcessException(TradeErrorCode.SHOP_NOT_EXISTS, "商户[ID=$shopid]不存在")
- }
-
- override fun findByShopBySearch(shopid: Int?, shopaccno: String?, shopUniqueId: String?): TShop? {
- return if (null != shopid) {
- shopDao.getTShopByShopid(shopid)
- } else if (!StringUtil.isEmpty(shopaccno)) {
- shopDao.getTShopByShopaccno(shopaccno)
- } else {
- shopDao.getByThirdUniqueIdenty(shopUniqueId)
- }
- }
-}
\ No newline at end of file
diff --git a/src/main/kotlin/com/supwisdom/dlpay/api/service/pay_service.kt b/src/main/kotlin/com/supwisdom/dlpay/api/service/pay_service.kt
deleted file mode 100644
index f10c1a3..0000000
--- a/src/main/kotlin/com/supwisdom/dlpay/api/service/pay_service.kt
+++ /dev/null
@@ -1,25 +0,0 @@
-package com.supwisdom.dlpay.api.service
-
-import com.supwisdom.dlpay.api.domain.TAccount
-import com.supwisdom.dlpay.framework.domain.TFeetypeConfig
-import com.supwisdom.dlpay.framework.domain.TShopacc
-import com.supwisdom.dlpay.framework.domain.TSubject
-import org.springframework.transaction.annotation.Propagation
-import org.springframework.transaction.annotation.Transactional
-
-interface AccountUtilServcie {
-
- @Transactional(propagation = Propagation.REQUIRED, rollbackFor = arrayOf(Exception::class))
- fun readAccountForUpdateNowait(userid: String): TAccount
-
-
- fun readAccount(userid: String): TAccount
-
- fun readShopAcc(shopId: Int): TShopacc
-
- fun readShopbyShopaccno(shopaccno: String): TShopacc
-
- fun readSubject(subjno: String): TSubject
-
- fun readFeetype(feetype: String, paytype: String): TFeetypeConfig
-}
diff --git a/src/main/kotlin/com/supwisdom/dlpay/api/service/shop_service.kt b/src/main/kotlin/com/supwisdom/dlpay/api/service/shop_service.kt
deleted file mode 100644
index 697bc11..0000000
--- a/src/main/kotlin/com/supwisdom/dlpay/api/service/shop_service.kt
+++ /dev/null
@@ -1,23 +0,0 @@
-package com.supwisdom.dlpay.api.service
-
-import com.supwisdom.dlpay.api.bean.OpenShopParam
-import com.supwisdom.dlpay.framework.domain.TShop
-import org.springframework.transaction.annotation.Propagation
-import org.springframework.transaction.annotation.Transactional
-
-/**
- * Created by shuwei on 2019/4/15.
- */
-interface ShopService {
- @Transactional(propagation = Propagation.REQUIRED, rollbackFor = arrayOf(Exception::class))
- fun registerShop(param: OpenShopParam): TShop
-
- @Transactional(propagation = Propagation.REQUIRED, rollbackFor = arrayOf(Exception::class), readOnly = true)
- fun findByThirdUniqueId(uniqueId: String): TShop?
-
- @Transactional(propagation = Propagation.REQUIRED, rollbackFor = arrayOf(Exception::class), readOnly = true)
- fun findByShopId(shopid: Int): TShop
-
- @Transactional(propagation = Propagation.REQUIRED, rollbackFor = arrayOf(Exception::class), readOnly = true)
- fun findByShopBySearch(shopid: Int?, shopaccno: String?, shopUniqueId: String?): TShop?
-}
\ No newline at end of file
diff --git a/src/main/resources/db/migration/V1.3__init_data.sql b/src/main/resources/db/migration/V1.3__init_data.sql
index 46f944d..307edb1 100644
--- a/src/main/resources/db/migration/V1.3__init_data.sql
+++ b/src/main/resources/db/migration/V1.3__init_data.sql
@@ -4,49 +4,3 @@
INSERT INTO "public"."tb_role_function"("id", "functionid", "permissions", "roleid") VALUES ('6', 6, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs');
INSERT INTO "public"."tb_role_function"("id", "functionid", "permissions", "roleid") VALUES ('7', 7, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs');
-CREATE SEQUENCE "public"."seq_regi" INCREMENT 1 MINVALUE 1 MAXVALUE 9223372036854775807 START 1 CACHE 1;
-ALTER SEQUENCE "public"."seq_regi" OWNER TO "watermanager";
-CREATE TABLE "public"."tb_region" (
- "areano" int4 NOT NULL DEFAULT nextval('seq_regi'::regclass),
- "address" varchar(255) COLLATE "pg_catalog"."default",
- "level" int4,
- "parentid" int4,
- "areaname" varchar(200) COLLATE "pg_catalog"."default",
- "remarks" varchar(255) COLLATE "pg_catalog"."default",
- "parentname" varchar(200) COLLATE "pg_catalog"."default",
- "available" int4,
- CONSTRAINT "tb_region_pkey" PRIMARY KEY ("areano")
-);
-ALTER TABLE "public"."tb_region" OWNER TO "watermanager";
-COMMENT ON COLUMN "public"."tb_region"."areano" IS '区域编号';
-COMMENT ON COLUMN "public"."tb_region"."address" IS '详细地址';
-COMMENT ON COLUMN "public"."tb_region"."level" IS '区域级别';
-COMMENT ON COLUMN "public"."tb_region"."parentid" IS '父区域编号,根节点为0';
-COMMENT ON COLUMN "public"."tb_region"."areaname" IS '区域名';
-COMMENT ON COLUMN "public"."tb_region"."remarks" IS '备注';
-COMMENT ON COLUMN "public"."tb_region"."parentname" IS '父区域名';
-COMMENT ON COLUMN "public"."tb_region"."available" IS '是否可用,0否1是';
-INSERT INTO "public"."tb_region"("address", "level", "parentid", "areaname", "remarks", "parentname","available") VALUES (NULL, 1, 0, '杨浦区', NULL, '无',1);
-INSERT INTO "public"."tb_region"("address", "level", "parentid", "areaname", "remarks", "parentname","available") VALUES (NULL, 1, 0, '虹口区', NULL, '无',1);
-INSERT INTO "public"."tb_region"("address", "level", "parentid", "areaname", "remarks", "parentname","available") VALUES ('隆昌路18号', 2, 1, '测试小区1', NULL, '杨浦区',1);
-INSERT INTO "public"."tb_region"("address", "level", "parentid", "areaname", "remarks", "parentname","available") VALUES ('宁国路77号', 2, 1, '测试小区2', NULL, '杨浦区',1);
-INSERT INTO "public"."tb_region"("address", "level", "parentid", "areaname", "remarks", "parentname","available") VALUES ('四川北路20号', 2, 2, '虹口小区1', NULL, '虹口区',1);
-INSERT INTO "public"."tb_region"("address", "level", "parentid", "areaname", "remarks", "parentname","available") VALUES ('测试小区1一号楼', 3, 3, '一号楼', NULL, '测试小区1',1);
-INSERT INTO "public"."tb_region"("address", "level", "parentid", "areaname", "remarks", "parentname","available") VALUES ('测试小区1二号楼', 3, 3, '二号楼', NULL, '测试小区1',0);
-
-
-CREATE TABLE "public"."tb_device" (
- "deviceno" int4 NOT NULL,
- "devicename" varchar(200) COLLATE "pg_catalog"."default",
- "deviceStatus" varchar(100) COLLATE "pg_catalog"."default",
- "areano" int4,
- "areaname" varchar(200) COLLATE "pg_catalog"."default",
- CONSTRAINT "tb_device_pkey" PRIMARY KEY ("deviceno")
-);
-ALTER TABLE "public"."tb_device" OWNER TO "watermanager";
-COMMENT ON COLUMN "public"."tb_device"."deviceno" IS '设备编号';
-COMMENT ON COLUMN "public"."tb_device"."devicename" IS '设备名称';
-COMMENT ON COLUMN "public"."tb_device"."deviceStatus" IS '设备状态';
-COMMENT ON COLUMN "public"."tb_device"."areano" IS '所属区域编号';
-COMMENT ON COLUMN "public"."tb_device"."areaname" IS '所属区域名';
-INSERT INTO "public"."tb_device"("deviceno","devicename", "deviceStatus", "areano", "areaname") VALUES (10000001,'食堂POS01', '正常', 10, '三号楼');