|
|
@@ -53,7 +53,8 @@ public class BankinformationServiceImpl extends CommonBaseServiceImpl<Bankinform
|
|
|
@Transactional
|
|
|
@Override
|
|
|
public boolean save(Bankinformation bankinformation){
|
|
|
- bankinformation.setCompanyId(BaseContextHolder.getCompanyId());
|
|
|
+ Long companyId = BaseContextHolder.getCompanyId();
|
|
|
+ bankinformation.setCompanyId(companyId);
|
|
|
bankinformation.setBk_income(new Double(0));
|
|
|
bankinformation.setBk_spending(new Double(0));
|
|
|
bankinformation.setCreateTime(new Date());
|
|
|
@@ -95,6 +96,12 @@ public class BankinformationServiceImpl extends CommonBaseServiceImpl<Bankinform
|
|
|
bankinformation.setUpdaterId(BaseContextHolder.getUserId());
|
|
|
bankinformation.setUpdaterName(BaseContextHolder.getUserName());
|
|
|
bankinformation.setUpdateTime(new Date());
|
|
|
+ //判断是否已修改账户名称
|
|
|
+ String oldBankName = bankinformationMapper.selectByPrimaryKey(bid).getBk_bankname();
|
|
|
+ if (!bankinformation.getBk_bankname().equals(oldBankName)) {
|
|
|
+ enableUpdateBankName(oldBankName, companyId);
|
|
|
+ }
|
|
|
+
|
|
|
//判断是否能修改期初金额
|
|
|
Double beginamount = bankinformationMapper.selectamount(bankinformation.getId());
|
|
|
Double fbeginamount = bankinformation.getBk_beginamount();
|
|
|
@@ -139,6 +146,40 @@ public class BankinformationServiceImpl extends CommonBaseServiceImpl<Bankinform
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 判断是否可以更新资金账户名称
|
|
|
+ * @param oldBankName
|
|
|
+ * @param companyId
|
|
|
+ */
|
|
|
+ private void enableUpdateBankName(String oldBankName, Long companyId){
|
|
|
+ int count = 0;
|
|
|
+ //收款单 recbalanceDet
|
|
|
+ count = bankinformationMapper.selectCountFromRecbalanceDet(oldBankName, companyId);
|
|
|
+ if (count > 0) {
|
|
|
+ throw new BizException(BizExceptionCode.BIZ_RELUPDATE_CODEANDNAME);
|
|
|
+ }
|
|
|
+ //付款单 paybalanceDet
|
|
|
+ count = bankinformationMapper.selectCountFromPaybalanceDet(oldBankName, companyId);
|
|
|
+ if (count > 0) {
|
|
|
+ throw new BizException(BizExceptionCode.BIZ_RELUPDATE_CODEANDNAME);
|
|
|
+ }
|
|
|
+ //其他收入单 othreceipts
|
|
|
+ count = bankinformationMapper.selectCountFromOthreceipts(oldBankName, companyId);
|
|
|
+ if (count > 0) {
|
|
|
+ throw new BizException(BizExceptionCode.BIZ_RELUPDATE_CODEANDNAME);
|
|
|
+ }
|
|
|
+ //其他支出单 othspendings
|
|
|
+ count = bankinformationMapper.selectCountFromOthspendings(oldBankName, companyId);
|
|
|
+ if (count > 0) {
|
|
|
+ throw new BizException(BizExceptionCode.BIZ_RELUPDATE_CODEANDNAME);
|
|
|
+ }
|
|
|
+ //资金转存 fundtransferdetail
|
|
|
+ count = bankinformationMapper.selectCountFromFundtransferDetail(oldBankName, companyId);
|
|
|
+ if (count > 0) {
|
|
|
+ throw new BizException(BizExceptionCode.BIZ_RELUPDATE_CODEANDNAME);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
@Transactional
|
|
|
@Override
|
|
|
public boolean removeByPrimaryKey(int id){
|