|
|
@@ -3,11 +3,13 @@ package com.usoftchina.saas.document.service.impl;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
import com.usoftchina.saas.base.service.CommonBaseServiceImpl;
|
|
|
+import com.usoftchina.saas.commons.api.MaxnumberService;
|
|
|
import com.usoftchina.saas.commons.api.MessageLogService;
|
|
|
import com.usoftchina.saas.commons.dto.ComboDTO;
|
|
|
import com.usoftchina.saas.commons.dto.DocBaseDTO;
|
|
|
import com.usoftchina.saas.commons.dto.ListReqDTO;
|
|
|
import com.usoftchina.saas.commons.exception.BizExceptionCode;
|
|
|
+import com.usoftchina.saas.commons.po.BillCodeSeq;
|
|
|
import com.usoftchina.saas.context.BaseContextHolder;
|
|
|
import com.usoftchina.saas.document.entities.Bankinformation;
|
|
|
import com.usoftchina.saas.document.entities.Banksubledger;
|
|
|
@@ -17,6 +19,7 @@ import com.usoftchina.saas.document.service.BankinformationService;
|
|
|
import com.usoftchina.saas.exception.BizException;
|
|
|
import com.usoftchina.saas.page.PageRequest;
|
|
|
import com.usoftchina.saas.utils.DateUtils;
|
|
|
+import com.usoftchina.saas.utils.RegexpUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
@@ -41,6 +44,8 @@ public class BankinformationServiceImpl extends CommonBaseServiceImpl<Bankinform
|
|
|
private BanksubledgerMapper banksubledgerMapper;
|
|
|
@Autowired
|
|
|
private MessageLogService messageLogService;
|
|
|
+ @Autowired
|
|
|
+ private MaxnumberService maxnumberService;
|
|
|
|
|
|
@Transactional
|
|
|
@Override
|
|
|
@@ -53,6 +58,9 @@ public class BankinformationServiceImpl extends CommonBaseServiceImpl<Bankinform
|
|
|
bankinformation.setCreatorName(BaseContextHolder.getUserName());
|
|
|
int bid = Math.toIntExact(bankinformation.getId());
|
|
|
|
|
|
+ String bk_code = RegexpUtils.replaceSpecCharacter(bankinformation.getBk_bankcode());
|
|
|
+ String code = pushMaxnubmer(bk_code, bankinformation.getId());
|
|
|
+
|
|
|
String bktion = bankinformationMapper.selectBankcode(bankinformation.getBk_bankcode() ,BaseContextHolder.getCompanyId());
|
|
|
//先判断ID,再判断编号
|
|
|
if (bankinformation.getId() == 0)
|
|
|
@@ -61,6 +69,7 @@ public class BankinformationServiceImpl extends CommonBaseServiceImpl<Bankinform
|
|
|
throw new BizException(500, BizExceptionCode.ACCOUNT_EXISTS.getMessage());
|
|
|
}
|
|
|
bankinformation.setBk_thisamount(bankinformation.getBk_beginamount());
|
|
|
+ bankinformation.setBk_bankcode(code);
|
|
|
bankinformationMapper.insertSelective(bankinformation);
|
|
|
Banksubledger banksubledger = this.changBanksubledger(bankinformation);
|
|
|
banksubledgerMapper.insertSelective(banksubledger);
|
|
|
@@ -220,4 +229,21 @@ public class BankinformationServiceImpl extends CommonBaseServiceImpl<Bankinform
|
|
|
}
|
|
|
return null;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @Description: 检验获取并更新单号
|
|
|
+ * @Param: [code, id]
|
|
|
+ * @return: java.lang.String
|
|
|
+ * @Author: chenwei
|
|
|
+ * @Date: 2018/10/26
|
|
|
+ */
|
|
|
+ private String pushMaxnubmer(String code, Long id) {
|
|
|
+ if (null == code) {
|
|
|
+ throw new BizException(BizExceptionCode.NULL_CODE);
|
|
|
+ }
|
|
|
+ Long companyId = BaseContextHolder.getCompanyId();
|
|
|
+ Integer count = "0".equals(String.valueOf(id)) ? getMapper().validateCodeWhenInsert(code, companyId) :
|
|
|
+ getMapper().validateCodeWhenUpdate(code, id, companyId);
|
|
|
+ return maxnumberService.pushMaxnubmer(count, code, BillCodeSeq.BANKINFORMATION.getCaller()).getData();
|
|
|
+ }
|
|
|
}
|