Browse Source

1.做资金账户修改金额限制

heqinwei 7 years ago
parent
commit
d936448580

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

@@ -29,4 +29,6 @@ public interface BankinformationMapper extends CommonBaseMapper<Bankinformation>
 
     void check(Map<String, Object> map);
 
+    Double selectamount(Long id);
+
 }

+ 19 - 0
applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/BankinformationServiceImpl.java

@@ -47,6 +47,7 @@ public class BankinformationServiceImpl extends CommonBaseServiceImpl<Bankinform
         bankinformation.setCompanyId(BaseContextHolder.getCompanyId());
         bankinformation.setBk_income(new Double(0));
         bankinformation.setBk_spending(new Double(0));
+        int bid = Math.toIntExact(bankinformation.getId());
 
         String bktion = bankinformationMapper.selectBankcode(bankinformation.getBk_bankcode());
         //先判断ID,再判断编号
@@ -58,6 +59,24 @@ public class BankinformationServiceImpl extends CommonBaseServiceImpl<Bankinform
             bankinformation.setBk_thisamount(bankinformation.getBk_beginamount());
             bankinformationMapper.insertSelective(bankinformation);
         }else {
+            //判断是否能修改期初金额
+            Double beginamount = bankinformationMapper.selectamount(bankinformation.getId());
+            Double fbeginamount = bankinformation.getBk_beginamount();
+            if (!(fbeginamount.equals(beginamount))){
+                DocBaseDTO docBaseDTO = getBaseDTOById(bid);
+                Map<String, Object> map = new HashMap<String, Object>();
+                map.put("v_id",bid);
+                map.put("v_code", docBaseDTO.getCode());
+                map.put("v_type","bank");
+                map.put("v_companyid",BaseContextHolder.getCompanyId());
+                map.put("v_res","");
+                bankinformationMapper.check(map);
+                Object result =  map.get("v_res");
+                if(!StringUtils.isEmpty(result)){
+                    throw new BizException(BizExceptionCode.USING_EXISTS.getCode(),result.toString());
+                }
+            }
+
             Long id = bankinformationMapper.selectBankId(bankinformation.getBk_bankcode());
             if (bktion != null){
                 if (id.equals(bankinformation.getId())){

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

@@ -344,6 +344,10 @@
         select bk_id from bankinformation where bk_bankcode = #{bk_bankcode,jdbcType=VARCHAR}
    </select>
 
+  <select id="selectamount" parameterType="java.lang.Long" resultType="java.lang.Double">
+        select bk_beginamount from bankinformation where bk_id = #{bk_id,jdbcType=INTEGER}
+   </select>
+
   <select id="check" parameterMap="checkParamMap" statementType="CALLABLE">
         CALL SP_LIMITBASE(?, ?, ?, ?,?)
     </select>