|
|
@@ -43,12 +43,28 @@ public class BankinformationServiceImpl extends CommonBaseServiceImpl<Bankinform
|
|
|
bankinformation.setBk_income(new Double(0));
|
|
|
bankinformation.setBk_spending(new Double(0));
|
|
|
|
|
|
- //判断编号
|
|
|
String bktion = bankinformationMapper.selectBankcode(bankinformation.getBk_bankcode());
|
|
|
- if (bktion != null){
|
|
|
- throw new BizException(500, BizExceptionCode.ACCOUNT_EXISTS.getMessage());
|
|
|
+ //先判断ID,再判断编号
|
|
|
+ if (bankinformation.getId() == 0)
|
|
|
+ {
|
|
|
+ if (bktion != null){
|
|
|
+ throw new BizException(500, BizExceptionCode.ACCOUNT_EXISTS.getMessage());
|
|
|
+ }
|
|
|
+ bankinformationMapper.insertSelective(bankinformation);
|
|
|
+ }else {
|
|
|
+ if (bktion != null){
|
|
|
+ Long id = bankinformationMapper.selectBankId(bankinformation.getBk_bankcode());
|
|
|
+ if (id.equals(bankinformation.getId())){
|
|
|
+ bankinformationMapper.updateByPrimaryKeySelective(bankinformation);
|
|
|
+ }else {
|
|
|
+ throw new BizException(500, BizExceptionCode.ACCOUNT_EXISTS.getMessage());
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ bankinformationMapper.updateByPrimaryKeySelective(bankinformation);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
+
|
|
|
//中间表
|
|
|
Banksubledger banksubledger = new Banksubledger();
|
|
|
Date date = bankinformation.getBk_date();
|
|
|
@@ -75,10 +91,8 @@ public class BankinformationServiceImpl extends CommonBaseServiceImpl<Bankinform
|
|
|
banksubledger.setBl_orderamount(bankinformation.getBk_beginamount());
|
|
|
|
|
|
if(bankinformation.getId() == 0){
|
|
|
- bankinformationMapper.insertSelective(bankinformation);
|
|
|
banksubledgerMapper.insertSelective(banksubledger);
|
|
|
}else{
|
|
|
- bankinformationMapper.updateByPrimaryKeySelective(bankinformation);
|
|
|
banksubledgerMapper.updateByPrimaryKeySelective(banksubledger);
|
|
|
}
|
|
|
return true;
|