|
|
@@ -5,23 +5,32 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import com.muchinfo.mtp.proto.BankMI1;
|
|
|
+import com.muchinfo.mtp.proto.Common;
|
|
|
import com.muchinfo.mtp3century.exception.GlobalException;
|
|
|
import com.muchinfo.mtp3century.service.IBankBusinessService;
|
|
|
import com.muchinfo.mtp3century.service.ICommonService;
|
|
|
import com.muchinfo.mtp3century.utils.AjaxResult;
|
|
|
import com.muchinfo.mtp3common.enumtype.Constants;
|
|
|
+import com.muchinfo.mtp3common.enumtype.FunCodeConstants;
|
|
|
import com.muchinfo.mtp3common.enumtype.MessageType;
|
|
|
import com.muchinfo.mtp3common.enumtype.SysConstants;
|
|
|
import com.muchinfo.mtp3common.utils.DateTimeUtils;
|
|
|
import com.muchinfo.mtp3common.utils.EncryptionUtils;
|
|
|
import com.muchinfo.mtp3common.utils.ExportUtil;
|
|
|
+import com.muchinfo.mtp3common.utils.SerialNumberUtils;
|
|
|
+import com.muchinfo.mtp3common.vo.Calculator;
|
|
|
import com.muchinfo.mtp3common.vo.ExportResult;
|
|
|
import com.muchinfo.mtp3common.vo.PageResult;
|
|
|
+import com.muchinfo.mtp3common.vo.ProtoHelper;
|
|
|
import com.muchinfo.mtp3interface.mapper.*;
|
|
|
import com.muchinfo.mtp3pojos.entity.*;
|
|
|
import com.muchinfo.mtp3pojos.vo.bankbusiness.*;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
+import org.springframework.amqp.core.Message;
|
|
|
+import org.springframework.amqp.core.MessageProperties;
|
|
|
+import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
@@ -34,6 +43,7 @@ import java.util.*;
|
|
|
@Service
|
|
|
public class BankBusinessServiceImpl implements IBankBusinessService {
|
|
|
|
|
|
+ private final String BANK_TYPE_JDJS = "jdjs";
|
|
|
private final Logger log = LoggerFactory.getLogger(this.getClass());
|
|
|
@Resource
|
|
|
private IBankSystemconfigMapper iBankSystemconfigMapper;
|
|
|
@@ -69,7 +79,14 @@ public class BankBusinessServiceImpl implements IBankBusinessService {
|
|
|
private IHybridChannelConfigMapper iHybridChannelConfigMapper;
|
|
|
@Resource
|
|
|
private IHybridBankinfoMapper iHybridBankinfoMapper;
|
|
|
-
|
|
|
+ @Resource
|
|
|
+ private ITaaccountMapper iTaaccountMapper;
|
|
|
+ @Resource
|
|
|
+ private RabbitTemplate rabbitTemplate;
|
|
|
+ @Resource
|
|
|
+ private IBankAmounttransferMapper iBankAmounttransferMapper;
|
|
|
+ @Resource
|
|
|
+ private IMarketrunMapper iMarketrunMapper;
|
|
|
@Override
|
|
|
public AjaxResult<BankSystemconfig> banksystemconfig(HttpServletRequest request) {
|
|
|
List<BankSystemconfig> bankSystemconfigs = iBankSystemconfigMapper.selectList(new QueryWrapper<>());
|
|
|
@@ -221,7 +238,7 @@ public class BankBusinessServiceImpl implements IBankBusinessService {
|
|
|
if (!cusbankinfo.equals(param.getCusbankid())) {
|
|
|
BankCusbankinfo bankCus = iBankCusbankinfoMapper.selectOne(new QueryWrapper<BankCusbankinfo>().eq("cusbankid", param.getCusbankid()));
|
|
|
if (bankCus != null) {
|
|
|
- return AjaxResult.error(Constants.Error_Code_Design, MessageType.MESSAGE_ERROR_CODE_SYSTEM030.getCode(), request.getHeader("Accept-Language"));
|
|
|
+ return AjaxResult.error(Constants.Error_Code_Design, MessageType.MESSAGE_ERROR_CODE_SYSTEM031.getCode(), request.getHeader("Accept-Language"));
|
|
|
}
|
|
|
|
|
|
BankCusbankstatus bankCusbankstatus = iBankCusbankstatusMapper.selectOne(new QueryWrapper<BankCusbankstatus>()
|
|
|
@@ -251,7 +268,7 @@ public class BankBusinessServiceImpl implements IBankBusinessService {
|
|
|
private AjaxResult saveBankInfo(BankCusBankInfoParam param, HttpServletRequest request) {
|
|
|
BankCusbankinfo bankCus = iBankCusbankinfoMapper.selectOne(new QueryWrapper<BankCusbankinfo>().eq("cusbankid", param.getCusbankid()));
|
|
|
if (bankCus != null) {
|
|
|
- return AjaxResult.error(Constants.Error_Code_Design, MessageType.MESSAGE_ERROR_CODE_SYSTEM030.getCode(), request.getHeader("Accept-Language"));
|
|
|
+ return AjaxResult.error(Constants.Error_Code_Design, MessageType.MESSAGE_ERROR_CODE_SYSTEM031.getCode(), request.getHeader("Accept-Language"));
|
|
|
}
|
|
|
BankCusbankinfo bankCusBankInfo = insertBankInfo(param);
|
|
|
iBankCusbankinfoMapper.insert(bankCusBankInfo);
|
|
|
@@ -590,5 +607,209 @@ public class BankBusinessServiceImpl implements IBankBusinessService {
|
|
|
return pageResult;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public AjaxResult<BankQueryAccInfoResult> bankQueryAccInfo(Integer accountid, HttpServletRequest request) {
|
|
|
+ BankQueryAccInfoResult result = iTaaccountMapper.bankQueryAccInfo(accountid);
|
|
|
+ if (!Objects.isNull(result)) {
|
|
|
+ double canUserAccount;
|
|
|
+ BankAccountsign bankAccSign = iBankAccountsignMapper.selectOne(new QueryWrapper<BankAccountsign>()
|
|
|
+ .eq("accountcode", String.valueOf(accountid)));
|
|
|
+ Long uuid = SerialNumberUtils.getNewSerialNumber(SerialNumberUtils.prefix_bank);
|
|
|
+
|
|
|
+ Calculator ca = new Calculator(uuid);
|
|
|
+ SerialNumberUtils.lockMap.put(uuid, ca);
|
|
|
+ BankMI1.t2bQueryAccInfosReq.Builder builder = BankMI1.t2bQueryAccInfosReq.newBuilder();
|
|
|
+ Common.MessageHead.Builder hd = Common.MessageHead.newBuilder();
|
|
|
+ hd.setUUID(uuid.toString());
|
|
|
+ hd.setFunCode(FunCodeConstants.FunCode_Trade_t2bQueryAccInfosReq);
|
|
|
+
|
|
|
+ builder.setExtOperatorID(uuid);
|
|
|
+ if (bankAccSign != null) {
|
|
|
+ hd.setAccountID(Long.parseLong(bankAccSign.getAccountcode()));
|
|
|
+ builder.setHeader(hd);
|
|
|
+ builder.setCusBankID(bankAccSign.getCusbankid());
|
|
|
+ builder.setAccountCode(bankAccSign.getAccountcode());
|
|
|
+ if (StringUtils.isNotBlank(bankAccSign.getAccountname())) {
|
|
|
+ builder.setBankChildAccountName(bankAccSign.getAccountname());
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotBlank(bankAccSign.getBankchildaccount())) {
|
|
|
+ builder.setBankChildAccount(bankAccSign.getBankchildaccount());
|
|
|
+ }
|
|
|
+ // 查询类别[1-查询所有信息;2-查询余额;3-查询银行卡]
|
|
|
+ builder.setQueryType("2");
|
|
|
+ } else {
|
|
|
+ builder.setHeader(hd);
|
|
|
+ builder.setCusBankID("");
|
|
|
+ builder.setAccountCode("");
|
|
|
+ builder.setBankChildAccountName("");
|
|
|
+ builder.setBankChildAccount("");
|
|
|
+ builder.setQueryType("2");
|
|
|
+ }
|
|
|
+ log.debug(builder.build().toString());
|
|
|
+ byte[] body = ProtoHelper.getNTAS(builder.build().toByteArray(),
|
|
|
+ FunCodeConstants.FunCode_Trade_t2bQueryAccInfosReq);
|
|
|
+ rabbitTemplate.send(SysConstants.RabbitBankNtfKey,
|
|
|
+ new Message(body, new MessageProperties()));
|
|
|
+ synchronized (ca) {
|
|
|
+ try {
|
|
|
+ ca.wait(10000);
|
|
|
+ Object rsp = ca.obj;
|
|
|
+ if (rsp != null) {
|
|
|
+ BankMI1.t2bQueryAccInfosRsp rsp_ = (BankMI1.t2bQueryAccInfosRsp) rsp;
|
|
|
+ canUserAccount = rsp_.getCanUseAmount();
|
|
|
+ result.setCanUserAccount(BigDecimal.valueOf(canUserAccount));
|
|
|
+ } else {
|
|
|
+ result.setCanUserAccount(BigDecimal.ZERO);
|
|
|
+ }
|
|
|
+ } catch (InterruptedException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ } finally {
|
|
|
+ SerialNumberUtils.lockMap.remove(uuid);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return AjaxResult.success(Constants.Success_Code_Design, MessageType.MESSAGE_CODE_SYSTEM001.getCode(), request.getHeader("Accept-Language"), result);
|
|
|
+ }
|
|
|
|
|
|
+ @Override
|
|
|
+ public PageResult<BankAmounttransfer> queryCommission(BankCommissionParam param, HttpServletRequest request) {
|
|
|
+ IPage<BankAmounttransfer> page = new Page<>(param.getPageNum(), param.getPageSize());
|
|
|
+ IPage<BankAmounttransfer> resultIPage = iBankAmounttransferMapper.selectPage(page, new QueryWrapper<BankAmounttransfer>()
|
|
|
+ .eq(StringUtils.isNotBlank(param.getCusbankid()), "cusbankid", param.getCusbankid())
|
|
|
+ .eq(param.getApplystatus() != null, "applystatus", param.getApplystatus()));
|
|
|
+ PageResult<BankAmounttransfer> pageResult = new PageResult<>();
|
|
|
+ pageResult.setCode(Constants.Success_Code_Design);
|
|
|
+ pageResult.setMessage(AjaxResult.dealMsg(MessageType.MESSAGE_CODE_SYSTEM001.getCode(), request.getHeader("Accept-Language")));
|
|
|
+ pageResult.setPages(resultIPage.getPages());
|
|
|
+ pageResult.setCurrent(resultIPage.getCurrent());
|
|
|
+ pageResult.setTotal(resultIPage.getTotal());
|
|
|
+ pageResult.setPageSize(resultIPage.getSize());
|
|
|
+ pageResult.setData(resultIPage.getRecords());
|
|
|
+ return pageResult;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public AjaxResult<BigDecimal> queryMoneyjdjs(String cusbankid, String acctype, HttpServletRequest request) {
|
|
|
+ String bankNo;
|
|
|
+ Long uuid = SerialNumberUtils.getNewSerialNumber(SerialNumberUtils.prefix_bank);
|
|
|
+ BankMI1.t2bQueryAccInfosReq.Builder builder = BankMI1.t2bQueryAccInfosReq.newBuilder();
|
|
|
+ BankCusbankinfo info = iBankCusbankinfoMapper.selectOne(new QueryWrapper<BankCusbankinfo>()
|
|
|
+ .eq("CUSBANKID", cusbankid));
|
|
|
+ //数据检查
|
|
|
+ if (StringUtils.isBlank(info.getExputbankid()) || StringUtils.isBlank(info.getExputpaybankaccname()) || StringUtils.isBlank(info.getExputpaybankaccno())) {
|
|
|
+ return AjaxResult.error(Constants.Error_Code_Design, MessageType.MESSAGE_ERROR_CODE_SYSTEM032.getCode(), request.getHeader("Accept-Language"));
|
|
|
+ }
|
|
|
+ if (BANK_TYPE_JDJS.equals(info.getCusbankid())) {
|
|
|
+ bankNo = info.getExputpaybankaccsubno();
|
|
|
+ } else {
|
|
|
+ bankNo = info.getExchpaybankaccno();
|
|
|
+ }
|
|
|
+ Common.MessageHead.Builder hd = Common.MessageHead.newBuilder();
|
|
|
+ hd.setFunCode(FunCodeConstants.FunCode_Trade_t2bQueryAccInfosReq);
|
|
|
+ builder.setHeader(hd);
|
|
|
+ builder.setCusBankID(cusbankid);
|
|
|
+ builder.setExtOperatorID(uuid);
|
|
|
+ builder.setTradeDate(DateTimeUtils.format(new Date(), DateTimeUtils.DATE_CHAR_PATTERN));
|
|
|
+ //光大没有查询账户要求,特殊处理,金登需要配置查询账户
|
|
|
+ builder.setAccountCode(bankNo);
|
|
|
+ builder.setQueryType(acctype.toString());
|
|
|
+
|
|
|
+ byte[] body = ProtoHelper.getNTAS(builder.build().toByteArray(),
|
|
|
+ FunCodeConstants.FunCode_Trade_t2bQueryAccInfosReq);
|
|
|
+ log.debug(builder.build().toString());
|
|
|
+ Calculator ca = new Calculator(uuid);
|
|
|
+ SerialNumberUtils.lockMap.put(uuid, ca);
|
|
|
+
|
|
|
+ rabbitTemplate.send(SysConstants.RabbitBankNtfKey, new Message(body, new MessageProperties()));
|
|
|
+
|
|
|
+ synchronized (ca) {
|
|
|
+ try {
|
|
|
+ ca.wait(10000);
|
|
|
+ Object rsp = ca.obj;
|
|
|
+ if (rsp != null) {
|
|
|
+ BankMI1.t2bQueryAccInfosRsp rsp_ = (BankMI1.t2bQueryAccInfosRsp) rsp;
|
|
|
+ return AjaxResult.success(Constants.Success_Code_Design, MessageType.MESSAGE_CODE_SYSTEM001.getCode(), request.getHeader("Accept-Language"), rsp_.getCanUseAmount());
|
|
|
+
|
|
|
+ } else {
|
|
|
+ return AjaxResult.error(Constants.Error_Code_Design, MessageType.MESSAGE_ERROR_CODE_SYSTEM006.getCode(), request.getHeader("Accept-Language"));
|
|
|
+ }
|
|
|
+ } catch (InterruptedException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ } finally {
|
|
|
+ SerialNumberUtils.lockMap.remove(uuid);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public AjaxResult addjdjs(BankAmounttransfer transfer, HttpServletRequest request) {
|
|
|
+ BankCusbankinfo info = iBankCusbankinfoMapper.selectOne(new QueryWrapper<BankCusbankinfo>()
|
|
|
+ .eq("CUSBANKID", transfer.getCusbankid()));
|
|
|
+ Marketrun marketRun = iMarketrunMapper.selectOne(new QueryWrapper<Marketrun>().eq("marketid",6L));
|
|
|
+ if(transfer.getAmount().compareTo(BigDecimal.ZERO) == 0){
|
|
|
+ return AjaxResult.error(Constants.Error_Code_Design, MessageType.MESSAGE_ERROR_CODE_SYSTEM033.getCode(), request.getHeader("Accept-Language"));
|
|
|
+ }
|
|
|
+ if (StringUtils.isBlank(info.getExputbankid()) || StringUtils.isBlank(info.getExputpaybankaccname()) || StringUtils.isBlank(info.getExputpaybankaccno())) {
|
|
|
+ return AjaxResult.error(Constants.Error_Code_Design, MessageType.MESSAGE_ERROR_CODE_SYSTEM032.getCode(), request.getHeader("Accept-Language"));
|
|
|
+ }
|
|
|
+ if(41 != marketRun.getRunstatus()){
|
|
|
+ return AjaxResult.error(Constants.Error_Code_Design, MessageType.MESSAGE_ERROR_CODE_SYSTEM034.getCode(), request.getHeader("Accept-Language"));
|
|
|
+ }
|
|
|
+ //金登查询时间特殊处理
|
|
|
+ int time = 10000;
|
|
|
+ if(BANK_TYPE_JDJS.equals(info.getCusbankid())){
|
|
|
+ time = 60000;
|
|
|
+ }
|
|
|
+
|
|
|
+ Long uuid = SerialNumberUtils.getNewSerialNumber(SerialNumberUtils.prefix_bank);
|
|
|
+
|
|
|
+ BankMI1.t2bExchOutInBankReq.Builder builder = BankMI1.t2bExchOutInBankReq.newBuilder();
|
|
|
+
|
|
|
+ Common.MessageHead.Builder hd = Common.MessageHead.newBuilder();
|
|
|
+ hd.setFunCode(FunCodeConstants.FunCode_Trade_t2bExchOutInBankReq);
|
|
|
+ builder.setHeader(hd);
|
|
|
+
|
|
|
+ builder.setCusBankID(transfer.getCusbankid());
|
|
|
+ builder.setExtOperatorID(uuid);
|
|
|
+ builder.setTradeDate(DateTimeUtils.format(new Date(), DateTimeUtils.DATE_CHAR_PATTERN));
|
|
|
+ builder.setTransferType(transfer.getTransfertype());
|
|
|
+ builder.setAmount(transfer.getAmount().doubleValue());
|
|
|
+ builder.setCurrency(info.getCurrency());
|
|
|
+ builder.setBankAccNo(info.getExchpaybankaccno());
|
|
|
+ builder.setBankAccName(info.getExchpaybankaccname());
|
|
|
+ builder.setTargetBankId(info.getExputbankid());
|
|
|
+ builder.setTargetBankAccNo(info.getExputpaybankaccno());
|
|
|
+ builder.setTargetBankAccName(info.getExputpaybankaccname());
|
|
|
+
|
|
|
+ byte[] body = ProtoHelper.getNTAS(builder.build().toByteArray(),
|
|
|
+ FunCodeConstants.FunCode_Trade_t2bExchOutInBankReq);
|
|
|
+
|
|
|
+ Calculator ca = new Calculator(uuid);
|
|
|
+ SerialNumberUtils.lockMap.put(uuid, ca);
|
|
|
+ log.debug(builder.build().toString());
|
|
|
+ rabbitTemplate.send(SysConstants.RabbitBankNtfKey, new Message(body, new MessageProperties()));
|
|
|
+
|
|
|
+ synchronized (ca) {
|
|
|
+ try {
|
|
|
+ ca.wait(time);
|
|
|
+ Object rsp = ca.obj;
|
|
|
+ if (rsp != null) {
|
|
|
+ BankMI1.t2bExchOutInBankRsp rsp_ = (BankMI1.t2bExchOutInBankRsp) rsp;
|
|
|
+ if (rsp_.getStatus() == 0) {
|
|
|
+ return AjaxResult.success(Constants.Success_Code_Design, MessageType.MESSAGE_CODE_SYSTEM001.getCode(), request.getHeader("Accept-Language"));
|
|
|
+ } else {
|
|
|
+ return AjaxResult.error(Constants.Error_Code_Design, MessageType.MESSAGE_ERROR_CODE_SYSTEM002.getCode(), request.getHeader("Accept-Language"),rsp_.getBankRetMsg());
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ return AjaxResult.error(Constants.Error_Code_Design, MessageType.MESSAGE_ERROR_CODE_SYSTEM006.getCode(), request.getHeader("Accept-Language"));
|
|
|
+ }
|
|
|
+ } catch (InterruptedException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ } finally {
|
|
|
+ SerialNumberUtils.lockMap.remove(uuid);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
}
|