Browse Source

1.添加资金模块业务逻辑

heqinwei 7 years ago
parent
commit
4a3a3b957e

+ 1 - 2
applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/BankinformationMapper.java

@@ -20,9 +20,8 @@ public interface BankinformationMapper extends CommonBaseMapper<Bankinformation>
 
 
     int updateByPrimaryKeyWithBLOBs(Bankinformation record);
     int updateByPrimaryKeyWithBLOBs(Bankinformation record);
 
 
-    int updateByPrimaryKey(Bankinformation record);
-
     List<Bankinformation> selectBankinformationBycondition(@Param("con") String con, @Param("companyId") Long companyId);
     List<Bankinformation> selectBankinformationBycondition(@Param("con") String con, @Param("companyId") Long companyId);
 
 
     List<ComboDTO> getCombo(@Param("companyId") Long companyId);
     List<ComboDTO> getCombo(@Param("companyId") Long companyId);
+
 }
 }

+ 0 - 10
applications/document/document-server/src/main/resources/mapper/BankinformationMapper.xml

@@ -292,16 +292,6 @@
       bk_remark = #{bkRemark,jdbcType=LONGVARCHAR}
       bk_remark = #{bkRemark,jdbcType=LONGVARCHAR}
     where bk_id = #{bkId,jdbcType=INTEGER}
     where bk_id = #{bkId,jdbcType=INTEGER}
   </update>
   </update>
-  <update id="updateBankcode">
-    update bankinformation
-    set bk_thisamount = nvl(#{bk_thisamount,jdbcType=DOUBLE},0) ${symbol} #{nowbalance}
-    where bk_bankcode = #{bankcode,jdbcType=VARCHAR}
-  </update>
-
-  <select id="selectThisamount" resultType="java.lang.Double" parameterType="com.usoftchina.saas.document.entities.Bankinformation">
-   select bk_thisamount from bankinformation
-    where bk_bankcode = #{bankcode,jdbcType=VARCHAR}
-  </select>
 
 
   <select id="selectAll" resultMap="BaseResultMap">
   <select id="selectAll" resultMap="BaseResultMap">
     SELECT * FROM bankinformation
     SELECT * FROM bankinformation

+ 4 - 0
applications/money/money-server/src/main/java/com/usoftchina/saas/money/mapper/BanksubledgerMapper.java

@@ -35,4 +35,8 @@ public interface BanksubledgerMapper extends CommonBaseMapper<Banksubledger> {
     int updateByPrimaryKeySelective(Banksubledger record);
     int updateByPrimaryKeySelective(Banksubledger record);
 
 
     int updateByPrimaryKey(Banksubledger record);
     int updateByPrimaryKey(Banksubledger record);
+
+    int updateBankcode(@Param("bk_thisamount") Double bk_thisamount, @Param("nowbalance") Double nowbalance,
+                       @Param("bankcode") String bankcode, @Param("symbol") String symbol);
+    Double selectThisamount(String bankcode);
 }
 }

+ 30 - 1
applications/money/money-server/src/main/java/com/usoftchina/saas/money/service/impl/FundtransferServiceImpl.java

@@ -93,6 +93,20 @@ public class FundtransferServiceImpl implements FundtransferService {
         }else {
         }else {
             fundtransferMapper.updateByPrimaryKeySelective(fundtransfer);
             fundtransferMapper.updateByPrimaryKeySelective(fundtransfer);
         }
         }
+
+
+        //取从表金额
+        List<Fundtransferdetail> fundtransferdetailList = fundtran.getItems();
+        Iterator isList = fundtransferdetailList.iterator();
+        while (isList.hasNext()){
+            Fundtransferdetail fundtransferdetail = (Fundtransferdetail) isList.next();
+            Double amount = banksubledgerMapper.selectThisamount(fundtransferdetail.getFtd_bankcode());
+            Double inamount = banksubledgerMapper.selectThisamount(fundtransferdetail.getFtd_inbankcode());
+            banksubledgerMapper.updateBankcode(amount, fundtransferdetail.getFtd_nowbalance(),
+                    fundtransferdetail.getFtd_bankcode(), "-");
+            banksubledgerMapper.updateBankcode(inamount, fundtransferdetail.getFtd_nowbalance(),
+                    fundtransferdetail.getFtd_bankcode(), "+");
+        }
     }
     }
 
 
     @Override
     @Override
@@ -106,6 +120,20 @@ public class FundtransferServiceImpl implements FundtransferService {
         //删除中间表
         //删除中间表
         fundtransfer = fundtransferMapper.selectByPrimaryKey(id);
         fundtransfer = fundtransferMapper.selectByPrimaryKey(id);
         banksubledgerMapper.deleteByPrimaryKey(fundtransfer.getFt_code(), "其他收入单");
         banksubledgerMapper.deleteByPrimaryKey(fundtransfer.getFt_code(), "其他收入单");
+
+        //资金
+        //取从表金额
+        List<Fundtransferdetail> fundtransferdetailList = fundtransferdetailMapper.selectByPrimaryKey(id);
+        Iterator isList = fundtransferdetailList.iterator();
+        while (isList.hasNext()){
+            Fundtransferdetail fundtransferdetail = (Fundtransferdetail) isList.next();
+            Double amount = banksubledgerMapper.selectThisamount(fundtransferdetail.getFtd_bankcode());
+            Double inamount = banksubledgerMapper.selectThisamount(fundtransferdetail.getFtd_inbankcode());
+            banksubledgerMapper.updateBankcode(amount, fundtransferdetail.getFtd_nowbalance(),
+                    fundtransferdetail.getFtd_bankcode(), "+");
+            banksubledgerMapper.updateBankcode(inamount, fundtransferdetail.getFtd_nowbalance(),
+                    fundtransferdetail.getFtd_bankcode(), "-");
+        }
     }
     }
 
 
 
 
@@ -140,7 +168,8 @@ public class FundtransferServiceImpl implements FundtransferService {
             fundtransfer.setFt_statuscode(Status.AUDITED.name());
             fundtransfer.setFt_statuscode(Status.AUDITED.name());
             Fundtran fundtran = this.select(Math.toIntExact(fundtransfer.getId()));
             Fundtran fundtran = this.select(Math.toIntExact(fundtransfer.getId()));
             this.changBankUntil(fundtran);
             this.changBankUntil(fundtran);
-            fundtransferMapper.updateByPrimaryKeySelective(fundtransfer);
+            this.insert(fundtran);
+//            fundtransferMapper.updateByPrimaryKeySelective(fundtransfer);
         }
         }
     }
     }
 
 

+ 4 - 6
applications/money/money-server/src/main/java/com/usoftchina/saas/money/service/impl/OthreceiptsServiceImpl.java

@@ -40,8 +40,6 @@ public class OthreceiptsServiceImpl implements OthreceiptsService {
     private MaxnumberService maxnumberService;
     private MaxnumberService maxnumberService;
     @Autowired
     @Autowired
     private BanksubledgerMapper banksubledgerMapper;
     private BanksubledgerMapper banksubledgerMapper;
-    @Autowired
-    private BankinformationMapper bankinformationMapper;
 
 
     @Override
     @Override
     public DocBaseDTO insert(Othte othte) {
     public DocBaseDTO insert(Othte othte) {
@@ -98,13 +96,13 @@ public class OthreceiptsServiceImpl implements OthreceiptsService {
             othreceiptsMapper.updateByPrimaryKeySelective(othreceipts);
             othreceiptsMapper.updateByPrimaryKeySelective(othreceipts);
         }
         }
 
 
-        Double amount = bankinformationMapper.selectThisamount(othreceipts.getOr_bankcode());
+        Double amount = banksubledgerMapper.selectThisamount(othreceipts.getOr_bankcode());
         //取从表金额
         //取从表金额
         List<Othreceiptsdetail> othreceiptsdetailList = othte.getItems();
         List<Othreceiptsdetail> othreceiptsdetailList = othte.getItems();
         Iterator isList = othreceiptsdetailList.iterator();
         Iterator isList = othreceiptsdetailList.iterator();
         while (isList.hasNext()){
         while (isList.hasNext()){
             Othreceiptsdetail othreceiptsdetail = (Othreceiptsdetail) isList.next();
             Othreceiptsdetail othreceiptsdetail = (Othreceiptsdetail) isList.next();
-            bankinformationMapper.updateBankcode(amount, othreceiptsdetail.getOrd_nowbalance(),
+            banksubledgerMapper.updateBankcode(amount, othreceiptsdetail.getOrd_nowbalance(),
                     othreceipts.getOr_bankcode(), "+");
                     othreceipts.getOr_bankcode(), "+");
         }
         }
     }
     }
@@ -122,12 +120,12 @@ public class OthreceiptsServiceImpl implements OthreceiptsService {
         banksubledgerMapper.deleteByPrimaryKey(othreceipts.getOr_code(), "其他收入单");
         banksubledgerMapper.deleteByPrimaryKey(othreceipts.getOr_code(), "其他收入单");
 
 
         //更新资金
         //更新资金
-        Double amount = bankinformationMapper.selectThisamount(othreceipts.getOr_bankcode());
+        Double amount = banksubledgerMapper.selectThisamount(othreceipts.getOr_bankcode());
         List<Othreceiptsdetail> othreceiptsdetailList = othreceiptsdetailMapper.selectByPrimaryKey(id);
         List<Othreceiptsdetail> othreceiptsdetailList = othreceiptsdetailMapper.selectByPrimaryKey(id);
         Iterator isList = othreceiptsdetailList.iterator();
         Iterator isList = othreceiptsdetailList.iterator();
         while (isList.hasNext()){
         while (isList.hasNext()){
             Othreceiptsdetail othreceiptsdetail = (Othreceiptsdetail) isList.next();
             Othreceiptsdetail othreceiptsdetail = (Othreceiptsdetail) isList.next();
-            bankinformationMapper.updateBankcode(amount, othreceiptsdetail.getOrd_nowbalance(),
+            banksubledgerMapper.updateBankcode(amount, othreceiptsdetail.getOrd_nowbalance(),
                     othreceipts.getOr_bankcode(), "-");
                     othreceipts.getOr_bankcode(), "-");
         }
         }
 
 

+ 24 - 1
applications/money/money-server/src/main/java/com/usoftchina/saas/money/service/impl/OthspendingsServiceImpl.java

@@ -10,6 +10,7 @@ import com.usoftchina.saas.commons.exception.BizExceptionCode;
 import com.usoftchina.saas.commons.po.BillCodeSeq;
 import com.usoftchina.saas.commons.po.BillCodeSeq;
 import com.usoftchina.saas.commons.po.Status;
 import com.usoftchina.saas.commons.po.Status;
 import com.usoftchina.saas.context.BaseContextHolder;
 import com.usoftchina.saas.context.BaseContextHolder;
+import com.usoftchina.saas.document.mapper.BankinformationMapper;
 import com.usoftchina.saas.exception.BizException;
 import com.usoftchina.saas.exception.BizException;
 import com.usoftchina.saas.money.mapper.*;
 import com.usoftchina.saas.money.mapper.*;
 import com.usoftchina.saas.money.po.*;
 import com.usoftchina.saas.money.po.*;
@@ -122,6 +123,16 @@ public class OthspendingsServiceImpl implements OthspendingsService {
         }else {
         }else {
             othspendingsMapper.updateByPrimaryKeySelective(othspendings);
             othspendingsMapper.updateByPrimaryKeySelective(othspendings);
         }
         }
+
+        Double amount = banksubledgerMapper.selectThisamount(othspendings.getOs_bankcode());
+        //取从表金额
+        List<Othspendingsdetail> othspendingsdetailList = othsp.getItems();
+        Iterator isList = othspendingsdetailList.iterator();
+        while (isList.hasNext()){
+            Othspendingsdetail othspendingsdetail = (Othspendingsdetail) isList.next();
+            banksubledgerMapper.updateBankcode(amount, othspendingsdetail.getOsd_nowbalance(),
+                    othspendings.getOs_bankcode(), "+");
+        }
     }
     }
 
 
     @Override
     @Override
@@ -135,6 +146,17 @@ public class OthspendingsServiceImpl implements OthspendingsService {
         //删除中间表
         //删除中间表
         othspendings = othspendingsMapper.selectByPrimaryKey(id);
         othspendings = othspendingsMapper.selectByPrimaryKey(id);
         banksubledgerMapper.deleteByPrimaryKey(othspendings.getOs_code(), "其他收入单");
         banksubledgerMapper.deleteByPrimaryKey(othspendings.getOs_code(), "其他收入单");
+
+        //资金
+        Double amount = banksubledgerMapper.selectThisamount(othspendings.getOs_bankcode());
+        //取从表金额
+        List<Othspendingsdetail> othspendingsdetailList = othspendingsdetailMapper.selectByPrimaryKey(id);
+        Iterator isList = othspendingsdetailList.iterator();
+        while (isList.hasNext()){
+            Othspendingsdetail othspendingsdetail = (Othspendingsdetail) isList.next();
+            banksubledgerMapper.updateBankcode(amount, othspendingsdetail.getOsd_nowbalance(),
+                    othspendings.getOs_bankcode(), "-");
+        }
     }
     }
 
 
     @Override
     @Override
@@ -157,7 +179,8 @@ public class OthspendingsServiceImpl implements OthspendingsService {
             othspendings.setOs_statuscode(Status.AUDITED.name());
             othspendings.setOs_statuscode(Status.AUDITED.name());
             Othsp othsp = this.select(Math.toIntExact(othspendings.getId()));
             Othsp othsp = this.select(Math.toIntExact(othspendings.getId()));
             this.changBankUntil(othsp);
             this.changBankUntil(othsp);
-            othspendingsMapper.updateByPrimaryKeySelective(othspendings);
+            this.insert(othsp);
+//            othspendingsMapper.updateByPrimaryKeySelective(othspendings);
         }
         }
     }
     }
 
 

+ 12 - 1
applications/money/money-server/src/main/resources/mapper/BanksubledgerMapper.xml

@@ -430,10 +430,21 @@
       updatedate = #{updatedate,jdbcType=TIMESTAMP}
       updatedate = #{updatedate,jdbcType=TIMESTAMP}
     where bl_id = #{bl_id,jdbcType=INTEGER}
     where bl_id = #{bl_id,jdbcType=INTEGER}
   </update>
   </update>
-    <select id="selectCode" parameterType="java.lang.String" resultMap="BaseResultMap">
+    <select id="selectCode" parameterType="java.lang.String" resultType="java.lang.String">
         select bl_code
         select bl_code
         from banksubledger
         from banksubledger
         where bl_code = #{bl_code,jdbcType=VARCHAR}
         where bl_code = #{bl_code,jdbcType=VARCHAR}
     </select>
     </select>
 
 
+    <update id="updateBankcode">
+    update bankinformation
+    set bk_thisamount = (IFNULL(#{bk_thisamount,jdbcType=DOUBLE},0) ${symbol} #{nowbalance})
+    where bk_bankcode = #{bankcode,jdbcType=VARCHAR}
+  </update>
+
+    <select id="selectThisamount" resultType="java.lang.Double" parameterType="java.lang.String">
+   select bk_thisamount from bankinformation
+    where bk_bankcode = #{bankcode,jdbcType=VARCHAR}
+  </select>
+
 </mapper>
 </mapper>

+ 1 - 5
applications/money/money-server/src/main/resources/mapper/FundtransferMapper.xml

@@ -88,9 +88,7 @@
       <if test="updaterId != null" >
       <if test="updaterId != null" >
         updaterId,
         updaterId,
       </if>
       </if>
-      <if test="updatedate != null" >
         updatedate,
         updatedate,
-      </if>
       <if test="ft_text1 != null" >
       <if test="ft_text1 != null" >
         ft_text1,
         ft_text1,
       </if>
       </if>
@@ -138,9 +136,7 @@
       <if test="updaterId != null" >
       <if test="updaterId != null" >
         #{updaterId,jdbcType=INTEGER},
         #{updaterId,jdbcType=INTEGER},
       </if>
       </if>
-      <if test="updatedate != null" >
-        #{updatedate,jdbcType=TIMESTAMP},
-      </if>
+        #{now(),jdbcType=TIMESTAMP},
       <if test="ft_text1 != null" >
       <if test="ft_text1 != null" >
         #{ft_text1,jdbcType=VARCHAR},
         #{ft_text1,jdbcType=VARCHAR},
       </if>
       </if>

+ 1 - 1
applications/money/money-server/src/main/resources/mapper/FundtransferdetailMapper.xml

@@ -208,7 +208,7 @@
         ftd_detno = #{ftd_detno,jdbcType=INTEGER},
         ftd_detno = #{ftd_detno,jdbcType=INTEGER},
       </if>
       </if>
       <if test="ftd_ym != null" >
       <if test="ftd_ym != null" >
-        ftd_ym = #{ftd_ym,jdbcType=INTEGER},
+        ftd_ym = to_char(#{ftd_ym,jdbcType=INTEGER},'yyyymm'),
       </if>
       </if>
       <if test="ftd_bankid != null" >
       <if test="ftd_bankid != null" >
         ftd_bankid = #{ftd_bankid,jdbcType=INTEGER},
         ftd_bankid = #{ftd_bankid,jdbcType=INTEGER},

+ 1 - 1
applications/money/money-server/src/main/resources/mapper/OthreceiptsdetailMapper.xml

@@ -150,7 +150,7 @@
         ord_detno = #{ord_detno,jdbcType=INTEGER},
         ord_detno = #{ord_detno,jdbcType=INTEGER},
       </if>
       </if>
       <if test="ord_ym != null" >
       <if test="ord_ym != null" >
-        ord_ym = #{ord_ym,jdbcType=INTEGER},
+        ord_ym = to_char(#{ord_ym,jdbcType=INTEGER},'yyyymm'),
       </if>
       </if>
       <if test="ord_type != null" >
       <if test="ord_type != null" >
         ord_type = #{ord_type,jdbcType=VARCHAR},
         ord_type = #{ord_type,jdbcType=VARCHAR},

+ 1 - 1
applications/money/money-server/src/main/resources/mapper/OthspendingsdetailMapper.xml

@@ -156,7 +156,7 @@
         osd_detno = #{osd_detno,jdbcType=INTEGER},
         osd_detno = #{osd_detno,jdbcType=INTEGER},
       </if>
       </if>
       <if test="osd_ym != null" >
       <if test="osd_ym != null" >
-        osd_ym = #{osd_ym,jdbcType=INTEGER},
+        osd_ym = to_char(#{osd_ym,jdbcType=INTEGER}, 'yyyymm'),
       </if>
       </if>
       <if test="osd_type != null" >
       <if test="osd_type != null" >
         osd_type = #{osd_type,jdbcType=VARCHAR},
         osd_type = #{osd_type,jdbcType=VARCHAR},