Commit 3582f187 authored by shangying's avatar shangying

增加940流程

parent fec99cb8
......@@ -120,6 +120,11 @@ public class OneClickDataController {
OneClickData oneClickData=oneClickDataRespository.findByOrderNo(orderNo);
return cashWithdrawalService.applyLoan(oneClickData);
}
public Result onlyCashWithdrawal(String orderNo){
log.info("打印一下orderNo={}", orderNo);
OneClickData oneClickData=oneClickDataRespository.findByOrderNo(orderNo);
return cashWithdrawalService.applyLoan(oneClickData);
}
@GetMapping("/v1/selectprogress")
public Result oneClickDataSelectProgress(@RequestParam (value = "userId") String userId,@RequestParam (value = "businessType") String businessType){
......
package cn.quantgroup.cashloanflowboss.api.oneclickdata.service;
import cn.quantgroup.cashloanflowboss.api.oneclickdata.entity.OneClickData;
/**
* Created by shang on 2019/12/3.
*/
......@@ -7,7 +9,7 @@ public interface H5BindingCardAndWithdrawDeposit {
/**
* 前往提现页
*/
void accountPro();
void accountPro(OneClickData oneClickData);
/**
* 查询用户额度表(获取 accountId)
......
......@@ -10,6 +10,9 @@ import cn.quantgroup.cashloanflowboss.core.base.Result;
import cn.quantgroup.cashloanflowboss.core.dictionary.ApplicationStatus;
import cn.quantgroup.cashloanflowboss.spi.clf.entity.ClfChannelConfiguration;
import cn.quantgroup.cashloanflowboss.spi.clf.service.CLFCenterServiceImpl;
import cn.quantgroup.cashloanflowboss.spi.paycenter.entity.CardCheckRecordEntity;
import cn.quantgroup.cashloanflowboss.spi.paycenter.model.CardType;
import cn.quantgroup.cashloanflowboss.spi.paycenter.repository.ICardCheckRecordRepository;
import cn.quantgroup.cashloanflowboss.spi.xyqb.entity.LoanApplicationHistory;
import cn.quantgroup.cashloanflowboss.utils.*;
import cn.quantgroup.cashloanflowboss.utils.http.HttpRequest;
......@@ -40,7 +43,8 @@ public class CashWithdrawalServiceImpl implements CashWithdrawalService{
private PhoneInfoService phoneInfoService;
@Autowired
private LoanOperationService loanOperationService;
@Autowired
private ICardCheckRecordRepository iCardCheckRecordRepository;
private ClfChannelConfiguration clfChannelConfiguration;
private String md5Keywy = "qEAxMJBv";
private String aesKeywy = "sxD8KO79EDK0N0AJ";
......@@ -51,17 +55,17 @@ public class CashWithdrawalServiceImpl implements CashWithdrawalService{
* */
@Override
public Result applyLoan(OneClickData oneClickData) {
JSONObject result;
JSONObject result=null;
//通过用户id获取产品信息
// QuotaCredit quotaCredit=phoneInfoService.selectUserAuditRecords(Long.valueOf(oneClickData.getUserId()), Long.parseLong(oneClickData.getChannelCode()));
// log.info("打印quotaCredit={}",quotaCredit);
//获取当前的渠道秘钥
clfChannelConfiguration=clfCenterService.findChannelConfigurationByChannelId(Long.parseLong(oneClickData.getChannelCode().trim()));
log.info("oneClickData={}",oneClickData);
md5Keywy=clfChannelConfiguration.getMd5Key();
aesKeywy=clfChannelConfiguration.getAesKey();
result= applyLoan(oneClickData, md5Keywy, aesKeywy);
// clfChannelConfiguration=clfCenterService.findChannelConfigurationByChannelId(Long.parseLong(oneClickData.getChannelCode().trim()));
// log.info("oneClickData={}",oneClickData);
// md5Keywy=clfChannelConfiguration.getMd5Key();
// aesKeywy=clfChannelConfiguration.getAesKey();
// result= applyLoan(oneClickData, md5Keywy, aesKeywy);
result=reApplyLoan(oneClickData);
String context=result.get("context").toString().trim();
if(!StringUtils.isBlank(context)){
String getDecryption = AESUtil.decryptAfterBase64Decode(context, aesKeywy);
......@@ -100,6 +104,20 @@ public class CashWithdrawalServiceImpl implements CashWithdrawalService{
}
}
public JSONObject reApplyLoan(OneClickData oneClickData){
JSONObject result=null;
//通过用户id获取产品信息
// QuotaCredit quotaCredit=phoneInfoService.selectUserAuditRecords(Long.valueOf(oneClickData.getUserId()), Long.parseLong(oneClickData.getChannelCode()));
// log.info("打印quotaCredit={}",quotaCredit);
//获取当前的渠道秘钥
clfChannelConfiguration=clfCenterService.findChannelConfigurationByChannelId(Long.parseLong(oneClickData.getChannelCode().trim()));
log.info("oneClickData={}",oneClickData);
md5Keywy=clfChannelConfiguration.getMd5Key();
aesKeywy=clfChannelConfiguration.getAesKey();
result= applyLoan(oneClickData, md5Keywy, aesKeywy);
return result;
}
public LoanApplicationHistory verificationApplicationHistory(LoanApplicationHistory applicationHistory,Long userId,Integer businessType,int num){
if(Objects.isNull(applicationHistory)){
......@@ -125,8 +143,21 @@ public class CashWithdrawalServiceImpl implements CashWithdrawalService{
bankCardNumber=getBankCardNumberLasterNumberIsEvenNumbers();
bankCode="PAB";
bankName="平安银行";
log.info("在提现之前在payment_center`.`card_check_record`插入银行卡,去报gu-bei是非mock哦={}", bankCardNumber);
CardCheckRecordEntity cardCheckRecordEntity=new CardCheckRecordEntity();
cardCheckRecordEntity.setCardNo(bankCardNumber);
cardCheckRecordEntity.setBankCode(bankCode);
cardCheckRecordEntity.setBankName(bankName);
cardCheckRecordEntity.setCardType(CardType.DEBIT_CARD);
CardCheckRecordEntity cardCheckRecordEntityReslut=iCardCheckRecordRepository.save(cardCheckRecordEntity);
// result=getH5CashWithdrawal(oneClickData,md5Keywy,aesKeywy,bankCardNumber,bankCode,bankName);
result=getAPICashWithdrawal(oneClickData, md5Keywy, aesKeywy, bankCardNumber, bankCode, bankName);
log.info("获取当前的卡信息={}",cardCheckRecordEntityReslut);
if(Objects.nonNull(cardCheckRecordEntityReslut)){
result=getAPICashWithdrawal(oneClickData, md5Keywy, aesKeywy, bankCardNumber, bankCode, bankName);
}else {
log.info("插入支付中心卡信息失败了");
}
}else{
log.info("非云信的资方");
......
package cn.quantgroup.cashloanflowboss.api.oneclickdata.service.impl;
import cn.quantgroup.cashloanflowboss.api.oneclickdata.entity.OneClickData;
import cn.quantgroup.cashloanflowboss.api.oneclickdata.service.H5BindingCardAndWithdrawDeposit;
import cn.quantgroup.cashloanflowboss.utils.CommonConstant;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.testng.Assert;
import java.util.HashMap;
import java.util.Map;
/**
* Created by shang on 2020/1/21.
*/
@Slf4j
@Service
public class H5BindingCardAndWithdrawDepositImpl implements H5BindingCardAndWithdrawDeposit {
@Override
public void accountPro() {
public void accountPro(OneClickData oneClickData) {
log.info("打印一下productid: " + oneClickData.getProductId());
// String url= CommonConstant.API_NAMESPACE+"/v3/quota/account/pro/"+LoginApi.productId;
// Map<String, String> paras =new HashMap<String, String>();
// Map<String, String> header =new HashMap<String, String>();
// header.put("Content-Type", "application/x-www-form-urlencoded");
// header.put("x-auth-token", LoginApi.token);
//
//
// JSONObject result= HttpRequest.doPostReturnResponseJson(url, paras, header);
// Logger.log("打印result" + result);
// if(!result.get("businessCode").toString().trim().equals("0000")){
// FundsAllocationplan fundsallocationplan= new FundsAllocationplan();
// fundsallocationplan.resetData();
// fundsallocationplan.testloginOP();
// fundsallocationplan.testFundingPlan();
// fundsallocationplan.testFundingPolicySave();
// num++;
// if(num<=3) {
// testAccountPro();
// }
// }
}
......
package cn.quantgroup.cashloanflowboss.spi.paycenter.entity;
import cn.quantgroup.cashloanflowboss.spi.paycenter.model.CardType;
import lombok.Data;
import javax.persistence.*;
import java.sql.Timestamp;
/**
* 卡号效验表
* @author wudi
*/
@Data
@Entity
@Table(name = "card_check_record")
public class CardCheckRecordEntity {
/**
* id
*/
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private Long id;
/**
* 卡号
*/
@Column(name = "card_no")
private String cardNo;
/**
* 银行编码
*/
@Column(name = "bank_code")
private String bankCode;
/**
* 银行名称
*/
@Column(name = "bank_name")
private String bankName;
/**
* 支行编码
*/
@Column(name = "branch_no")
private String branchNo;
/**
* 支行名称
*/
@Column(name = "branch_name")
private String branchName;
/**
* 省份
*/
@Column(name = "province")
private String province;
/**
* 城市
*/
@Column(name = "city")
private String city;
@Column(name = "card_type")
private CardType cardType;
/**
* 是否可用
*/
@Column(name = "is_active")
private Boolean isActive = Boolean.TRUE;
/**
* createdAt
*/
@Column(name = "created_at")
private Timestamp createdAt;
/**
* updatedAt
*/
@Column(name = "updated_at")
private Timestamp updatedAt;
@PrePersist
public void prePersist() {
Timestamp timestamp = new Timestamp(System.currentTimeMillis());
createdAt = timestamp;
updatedAt = timestamp;
}
@PreUpdate
public void preUpdate() {
updatedAt = new Timestamp(System.currentTimeMillis());
}
}
package cn.quantgroup.cashloanflowboss.spi.paycenter.model;
import lombok.Getter;
/**
* Created by FrankChow on 16/3/8.
*/
@Getter
public enum CardType {
//银行卡类型
UNKNOW("未知类型", "UNKNOWN"),
CRIDIT_CARD("信用卡", "CREDIT"),
DEBIT_CARD("借记卡", "DEBIT"),
PRE_PAID_CARD("预付费卡", "PREPAID"),
SEMI_CREDIT_CARD("准贷记卡", "SEMI_CREDIT"),
OTHER("其它", "OTHER");
private String desc;
private String name;
CardType(String desc, String name) {
this.desc = desc;
this.name = name;
}
public static CardType fromCardType(String name) {
CardType[] types = CardType.values();
for (CardType type : types) {
if (type.getName().equals(name)) {
return type;
}
}
return UNKNOW;
}
}
package cn.quantgroup.cashloanflowboss.spi.paycenter.repository;
import cn.quantgroup.cashloanflowboss.spi.paycenter.entity.CardCheckRecordEntity;
import cn.quantgroup.cashloanflowboss.spi.paycenter.source.GuBeiDataSource;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
/**
* 卡号效验表
* @author wudi
*/
@GuBeiDataSource
@Repository
public interface ICardCheckRecordRepository extends JpaRepository<CardCheckRecordEntity, Long> {
/**
* 根据银行卡号获取卡信息
* @param cardNo
* @return
*/
CardCheckRecordEntity findByCardNo(String cardNo);
/**
* 查询最后一条记录
* @return
*/
@Query(value = "select * from card_check_record order by id desc limit 1", nativeQuery = true)
CardCheckRecordEntity findLastRecord();
}
//package cn.quantgroup.cashloanflowboss.spi.paycenter.source;
//
//import org.springframework.context.annotation.ComponentScan;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
//import org.springframework.transaction.annotation.EnableTransactionManagement;
//
///**
// * Created by shang on 2020/2/20.
// */
//@Configuration
//@EnableTransactionManagement
//@EnableJpaRepositories(basePackages = {"cn.quantgroup"}, entityManagerFactoryRef = "guBeiEntityManager", transactionManagerRef = "guBeiTransactionManager", includeFilters = @ComponentScan.Filter(GuBeiDataSource.class))
//public class GuBeiBataSourceConfiguration {
//}
package cn.quantgroup.cashloanflowboss.spi.paycenter.source;
import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceBuilder;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.orm.jpa.JpaTransactionManager;
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import javax.persistence.EntityManagerFactory;
import javax.sql.DataSource;
/**
* Created by shang on 2020/2/20.
*/
@Configuration
@EnableTransactionManagement
@EnableJpaRepositories(basePackages = {"cn.quantgroup"}, entityManagerFactoryRef = "guBeiEntityManager", transactionManagerRef = "guBeiTransactionManager", includeFilters = @ComponentScan.Filter(GuBeiDataSource.class))
public class GuBeiBataSourceConfiguration {
@Value("${data.payment.url}")
private String jdbcUrl;
@Value("${data.payment.password}")
private String password;
@Value("${data.payment.username}")
private String user;
private String uniquename = "paymentDS";
@Value("${data.payment.pool-size}")
private Integer poolSize;
@Bean(name = "GuBeiDataSource")
@ConfigurationProperties(prefix = "data.payment")
public DataSource createDataSource() {
DruidDataSource source = DruidDataSourceBuilder.create().build();
source.setMaxActive(200);
source.setInitialSize(10);
source.setMinIdle(10);
source.setMaxWait(500000);
source.setTimeBetweenEvictionRunsMillis(60000);
source.setMinEvictableIdleTimeMillis(300000);
source.setValidationQuery("SELECT 'x'");
source.setTestWhileIdle(true);
source.setTestOnBorrow(false);
source.setTestOnReturn(false);
source.setPoolPreparedStatements(Boolean.FALSE);
return source;
}
@Bean(name = "guBeiEntityManager")
public LocalContainerEntityManagerFactoryBean entityManager(EntityManagerFactoryBuilder builder) {
return builder.dataSource(createDataSource())
.packages("cn.quantgroup.cashloanflowboss.spi.paycenter.entity")
.persistenceUnit(uniquename)
.build();
}
@Bean(name = "guBeiTransactionManager")
public PlatformTransactionManager transactionManager(@Qualifier("guBeiEntityManager") EntityManagerFactory entityManagerFactory) {
return new JpaTransactionManager(entityManagerFactory);
}
}
//package cn.quantgroup.cashloanflowboss.spi.paycenter.source;
//
//import java.lang.annotation.ElementType;
//import java.lang.annotation.Retention;
//import java.lang.annotation.RetentionPolicy;
//import java.lang.annotation.Target;
//
///**
// * Created by shang on 2020/2/20.
// */
//@Target({ElementType.TYPE})
//@Retention(RetentionPolicy.RUNTIME)
//public @interface GuBeiDataSource {
//}
package cn.quantgroup.cashloanflowboss.spi.paycenter.source;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Created by shang on 2020/2/20.
*/
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
public @interface GuBeiDataSource {
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment