补充提交问题
parent
b96d705dab
commit
b4c5e6ee6f
@ -0,0 +1,38 @@
|
||||
package com.sztzjy.bank.service;
|
||||
|
||||
import com.sztzjy.bank.entity.BankCardInformation;
|
||||
import com.sztzjy.bank.entity.CustomerInformation;
|
||||
import com.sztzjy.bank.util.ResultDataEntity;
|
||||
import com.sztzjy.bank.util.ResultEntity;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
/**
|
||||
* @author 17803
|
||||
* @date 2025-01-11 14:24
|
||||
*/
|
||||
public interface PersonalBankCardService {
|
||||
/**
|
||||
* 提交/保存
|
||||
* @param customerInformation
|
||||
* @return
|
||||
*/
|
||||
|
||||
ResultEntity submitByPersonBankCard(@Valid CustomerInformation customerInformation);
|
||||
|
||||
/**
|
||||
* 查询回显
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
|
||||
ResultDataEntity<CustomerInformation> getBaseInfoByPersonBankCard(String userId,Integer number);
|
||||
|
||||
/**
|
||||
* 开设银行卡-提交/保存
|
||||
* @param bankCardInformation
|
||||
* @return
|
||||
*/
|
||||
|
||||
ResultEntity submitByCreateCard(@Valid BankCardInformation bankCardInformation);
|
||||
}
|
@ -0,0 +1,338 @@
|
||||
package com.sztzjy.bank.service.impl;
|
||||
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.sztzjy.bank.entity.*;
|
||||
import com.sztzjy.bank.entity.dto.BankCardInformationAnswerDTO;
|
||||
import com.sztzjy.bank.entity.dto.CustomerInformationAnswerDTO;
|
||||
import com.sztzjy.bank.mapper.BankCardInformationMapper;
|
||||
import com.sztzjy.bank.mapper.CaseAnswerInfoMapper;
|
||||
import com.sztzjy.bank.mapper.CaseInfoMapper;
|
||||
import com.sztzjy.bank.mapper.CustomerInformationMapper;
|
||||
import com.sztzjy.bank.service.PersonalBankCardService;
|
||||
import com.sztzjy.bank.util.RedisUtil;
|
||||
import com.sztzjy.bank.util.ResultDataEntity;
|
||||
import com.sztzjy.bank.util.ResultEntity;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 17803
|
||||
* @date 2025-01-11 14:24
|
||||
*/
|
||||
@Service
|
||||
public class PersonalBankCardServiceImpl implements PersonalBankCardService {
|
||||
|
||||
@Autowired
|
||||
private CustomerInformationMapper customerInformationMapper;
|
||||
|
||||
@Autowired
|
||||
private BankCardInformationMapper bankCardInformationMapper;
|
||||
|
||||
@Autowired
|
||||
RedisUtil redisUtil;
|
||||
|
||||
@Autowired
|
||||
private CaseInfoMapper caseInfoMapper;
|
||||
|
||||
@Autowired
|
||||
private CaseAnswerInfoMapper caseAnswerInfoMapper;
|
||||
|
||||
|
||||
|
||||
|
||||
//提交/保存
|
||||
@Override
|
||||
public ResultEntity submitByPersonBankCard(CustomerInformation customerInformation) {
|
||||
|
||||
//判断是报错还是提交
|
||||
CustomerInformationExample example = new CustomerInformationExample();
|
||||
example.createCriteria().andUserIdEqualTo(customerInformation.getUserId()).andNumberEqualTo(customerInformation.getNumber());
|
||||
List<CustomerInformation> informationList = customerInformationMapper.selectByExample(example);
|
||||
|
||||
if (CollectionUtils.isEmpty(informationList)) {
|
||||
//首次提交
|
||||
customerInformation.setId(IdUtil.simpleUUID());
|
||||
|
||||
if (customerInformation.getSubState()==1)
|
||||
{
|
||||
customerInformation = submitByPersonBankCardCaculate(customerInformation);
|
||||
customerInformation.setHandlingAgency("0000100");
|
||||
customerInformation.setSerialNumber("0000000150101");
|
||||
customerInformation.setHandlingTeller("000000015");
|
||||
}
|
||||
//数据保存
|
||||
customerInformationMapper.insertSelective(customerInformation);
|
||||
|
||||
return new ResultEntity<>(HttpStatus.OK);
|
||||
|
||||
}else {
|
||||
CustomerInformation information = informationList.get(0);
|
||||
|
||||
//校验时候已经提交
|
||||
if (information.getSubState()==1)
|
||||
{
|
||||
return new ResultEntity<>(HttpStatus.OK,"提交成功",2);
|
||||
}
|
||||
|
||||
if (customerInformation.getSubState()==1)
|
||||
{
|
||||
customerInformation = submitByPersonBankCardCaculate(customerInformation);
|
||||
customerInformation.setHandlingAgency("0000100");
|
||||
customerInformation.setSerialNumber("0000000150101");
|
||||
customerInformation.setHandlingTeller("000000015");
|
||||
}
|
||||
|
||||
|
||||
String id = information.getId();
|
||||
|
||||
BeanUtils.copyProperties(customerInformation, information);
|
||||
//当值ID为空被覆盖
|
||||
information.setId(id);
|
||||
customerInformationMapper.updateByPrimaryKeySelective(information);
|
||||
|
||||
return new ResultEntity<>(HttpStatus.OK,"提交成功",1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private CustomerInformation submitByPersonBankCardCaculate(CustomerInformation customerInformation) {
|
||||
|
||||
String answer = redisUtil.get("bank" + "-个人银行卡业务" + "-录入客户信息");
|
||||
if (answer == null) {
|
||||
CaseInfoExample caseInfoExample = new CaseInfoExample();
|
||||
caseInfoExample.createCriteria().andLargeModuleEqualTo("个人银行卡业务").andModuleEqualTo("录入客户信息").andNumberEqualTo(customerInformation.getNumber());
|
||||
List<CaseInfo> caseInfoList = caseInfoMapper.selectByExampleWithBLOBs(caseInfoExample);
|
||||
if (!CollectionUtils.isEmpty(caseInfoList)) {
|
||||
CaseInfo caseInfo = caseInfoList.get(0);
|
||||
CaseAnswerInfoExample caseAnswerInfoExample = new CaseAnswerInfoExample();
|
||||
caseAnswerInfoExample.createCriteria().andCaseIdEqualTo(caseInfo.getCaseId());
|
||||
List<CaseAnswerInfo> answerInfoList = caseAnswerInfoMapper.selectByExampleWithBLOBs(caseAnswerInfoExample);
|
||||
if (!CollectionUtils.isEmpty(answerInfoList)) {
|
||||
String info = answerInfoList.get(0).getAnswer();
|
||||
redisUtil.set("bank" + "-个人银行卡业务" + "-录入客户信息",info,3600);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 解析 JSON 字符串
|
||||
CustomerInformationAnswerDTO answerDTO = JSON.parseObject(answer, CustomerInformationAnswerDTO.class);
|
||||
|
||||
int errorNumber = 0;
|
||||
//中文名称
|
||||
if (!answerDTO.getChName().equals(customerInformation.getChName())) {
|
||||
errorNumber++;
|
||||
}
|
||||
//性别
|
||||
if (answerDTO.getSex()!=customerInformation.getSex()) {
|
||||
errorNumber++;
|
||||
}
|
||||
//民群
|
||||
if (!answerDTO.getNationality().equals(customerInformation.getNationality())) {
|
||||
errorNumber++;
|
||||
}
|
||||
|
||||
//证件类型
|
||||
if (!answerDTO.getIdType().equals(customerInformation.getIdType())) {
|
||||
errorNumber++;
|
||||
}
|
||||
|
||||
//证件号码
|
||||
if (!answerDTO.getIdNumber().equals(customerInformation.getIdNumber())) {
|
||||
errorNumber++;
|
||||
}
|
||||
|
||||
//期限类型
|
||||
if (!answerDTO.getDeadlineType().equals(customerInformation.getDeadlineType())) {
|
||||
errorNumber++;
|
||||
}
|
||||
|
||||
//出生日期
|
||||
if (answerDTO.getBirthday().compareTo(customerInformation.getBirthday()) != 0) {
|
||||
errorNumber++;
|
||||
}
|
||||
|
||||
|
||||
//发证机关
|
||||
if (!answerDTO.getLicenceIssuAuth().equals(customerInformation.getLicenceIssuAuth())) {
|
||||
errorNumber++;
|
||||
}
|
||||
|
||||
//有效开始日期
|
||||
if (answerDTO.getEffectiveStartDate().compareTo(answerDTO.getEffectiveStartDate()) != 0) {
|
||||
errorNumber++;
|
||||
}
|
||||
|
||||
//有效终止日期
|
||||
if (answerDTO.getEffectiveEndDate().compareTo(answerDTO.getEffectiveEndDate()) != 0) {
|
||||
errorNumber++;
|
||||
}
|
||||
|
||||
//户籍地址
|
||||
if (!answerDTO.getAddress().equals(customerInformation.getAddress())) {
|
||||
errorNumber++;
|
||||
}
|
||||
|
||||
//通讯地址
|
||||
if (!answerDTO.getMailAddress().equals(customerInformation.getMailAddress())) {
|
||||
errorNumber++;
|
||||
}
|
||||
//联系电话
|
||||
if (!answerDTO.getTel().equals(customerInformation.getTel())) {
|
||||
errorNumber++;
|
||||
}
|
||||
|
||||
//错误次数
|
||||
customerInformation.setErrorNumber(errorNumber);
|
||||
|
||||
return customerInformation;
|
||||
|
||||
}
|
||||
|
||||
//查询回显
|
||||
@Override
|
||||
public ResultDataEntity<CustomerInformation> getBaseInfoByPersonBankCard(String userId,Integer number) {
|
||||
CustomerInformationExample example = new CustomerInformationExample();
|
||||
example.createCriteria().andUserIdEqualTo(userId).andNumberEqualTo(number);
|
||||
List<CustomerInformation> informationList = customerInformationMapper.selectByExample(example);
|
||||
|
||||
if (CollectionUtils.isEmpty(informationList)) {
|
||||
return new ResultDataEntity<>(HttpStatus.OK);
|
||||
}else {
|
||||
return new ResultDataEntity<>(HttpStatus.OK,"查询成功",informationList.get(0));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 开设银行卡-提交/保存
|
||||
* @param null
|
||||
* @return
|
||||
*/
|
||||
|
||||
@Override
|
||||
public ResultEntity submitByCreateCard(BankCardInformation bankCardInformation) {
|
||||
|
||||
BankCardInformationExample example = new BankCardInformationExample();
|
||||
example.createCriteria().andUserIdEqualTo(bankCardInformation.getUserId());
|
||||
List<BankCardInformation> bankCardInformationList = bankCardInformationMapper.selectByExample(example);
|
||||
if (CollectionUtils.isEmpty(bankCardInformationList)) {
|
||||
//首次提交
|
||||
bankCardInformation.setId(IdUtil.simpleUUID());
|
||||
if (bankCardInformation.getSubState()==1)
|
||||
{
|
||||
bankCardInformation = submitByCreateCardCaculate(bankCardInformation);
|
||||
}
|
||||
|
||||
bankCardInformationMapper.insertSelective(bankCardInformation);
|
||||
return new ResultEntity<>(HttpStatus.OK,"提交成功");
|
||||
}else {
|
||||
BankCardInformation bankCardInfo = bankCardInformationList.get(0);
|
||||
|
||||
//校验时候已经提交
|
||||
if (bankCardInfo.getSubState()==1)
|
||||
{
|
||||
return new ResultEntity<>(HttpStatus.OK,"提交成功",2);
|
||||
}
|
||||
|
||||
if (bankCardInformation.getSubState()==1)
|
||||
{
|
||||
bankCardInformation = submitByCreateCardCaculate(bankCardInformation);
|
||||
}
|
||||
|
||||
|
||||
String id = bankCardInfo.getId();
|
||||
|
||||
BeanUtils.copyProperties(bankCardInformation, bankCardInfo);
|
||||
//当值ID为空被覆盖
|
||||
bankCardInfo.setId(id);
|
||||
bankCardInformationMapper.updateByPrimaryKeySelective(bankCardInfo);
|
||||
|
||||
return new ResultEntity<>(HttpStatus.OK,"提交成功",1);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
//开设银行卡-提交计算
|
||||
private BankCardInformation submitByCreateCardCaculate(BankCardInformation bankCardInformation){
|
||||
|
||||
String answer = redisUtil.get("bank" + "-个人银行卡业务" + "-开设银行卡");
|
||||
if (answer == null) {
|
||||
CaseInfoExample caseInfoExample = new CaseInfoExample();
|
||||
caseInfoExample.createCriteria().andLargeModuleEqualTo("个人银行卡业务").andModuleEqualTo("开设银行卡").andNumberEqualTo(bankCardInformation.getNumber());
|
||||
List<CaseInfo> caseInfoList = caseInfoMapper.selectByExampleWithBLOBs(caseInfoExample);
|
||||
if (!CollectionUtils.isEmpty(caseInfoList)) {
|
||||
CaseInfo caseInfo = caseInfoList.get(0);
|
||||
CaseAnswerInfoExample caseAnswerInfoExample = new CaseAnswerInfoExample();
|
||||
caseAnswerInfoExample.createCriteria().andCaseIdEqualTo(caseInfo.getCaseId());
|
||||
List<CaseAnswerInfo> answerInfoList = caseAnswerInfoMapper.selectByExampleWithBLOBs(caseAnswerInfoExample);
|
||||
if (!CollectionUtils.isEmpty(answerInfoList)) {
|
||||
String info = answerInfoList.get(0).getAnswer();
|
||||
redisUtil.set("bank" + "-个人银行卡业务" + "-开设银行卡",info,3600);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 解析 JSON 字符串
|
||||
BankCardInformationAnswerDTO answerDTO = JSON.parseObject(answer, BankCardInformationAnswerDTO.class);
|
||||
|
||||
if (bankCardInformation.getErrorNumber()==null)
|
||||
{
|
||||
bankCardInformation.setErrorNumber(0);
|
||||
}
|
||||
|
||||
int errorNumber = bankCardInformation.getErrorNumber();
|
||||
//币种
|
||||
if (!answerDTO.getCurrency().equals(bankCardInformation.getCurrency())) {
|
||||
errorNumber++;
|
||||
}
|
||||
|
||||
//钞汇标志
|
||||
if (!answerDTO.getCurrencyExchangeSymbol().equals(bankCardInformation.getCurrencyExchangeSymbol())) {
|
||||
errorNumber++;
|
||||
}
|
||||
|
||||
//分级类型
|
||||
if (!answerDTO.getClassifyType().equals(bankCardInformation.getClassifyType())) {
|
||||
errorNumber++;
|
||||
}
|
||||
|
||||
//账户性质
|
||||
if (!answerDTO.getNatureAccount().equals(bankCardInformation.getNatureAccount())) {
|
||||
errorNumber++;
|
||||
}
|
||||
|
||||
//凭证类型
|
||||
if (!answerDTO.getVoucherType().equals(bankCardInformation.getVoucherType())) {
|
||||
errorNumber++;
|
||||
}
|
||||
|
||||
//支取密码
|
||||
if (!answerDTO.getWithdrawalPwd().equals(bankCardInformation.getWithdrawalPwd())) {
|
||||
errorNumber++;
|
||||
}
|
||||
|
||||
//确认密码
|
||||
if (!answerDTO.getConfirmPassword().equals(bankCardInformation.getConfirmPassword())) {
|
||||
errorNumber++;
|
||||
}
|
||||
|
||||
//错误次数
|
||||
bankCardInformation.setErrorNumber(errorNumber);
|
||||
|
||||
return bankCardInformation;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue