Commit 685353ae authored by 王向伟's avatar 王向伟

迭代功能

parent 309dd2d7
......@@ -18,4 +18,6 @@ public class ChannelConfAddModel {
private String repaymentPlanCallBackUrl;
private String message;
private String extendData;
private String publicKey;
}
package cn.quantgroup.cashloanflowboss.api.channel.model;
import cn.quantgroup.cashloanflowboss.spi.clf.entity.ChannelApplyInfoStrategy;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.util.List;
/**
......@@ -21,7 +19,7 @@ public class ChannelConfBaseModel {
private Integer fundId;
private Integer p2pFundId;
private List<ChannelApplyInfoStrategy> channelApplyInfoStrategyList;
/**
* 对应productId
*/
......
package cn.quantgroup.cashloanflowboss.api.channel.model;
import cn.quantgroup.cashloanflowboss.spi.clf.entity.ChannelApplyInfoStrategy;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.util.List;
/**
* function:
......@@ -17,4 +19,6 @@ public class ChannelConfVo {
private ChannelConfBaseModel basicInfo;
@NotNull(message = "回调地址配置信息不能为空")
private ChannelConfAddModel addInfo;
private List<ChannelApplyInfoStrategy> applyConf;
}
......@@ -25,4 +25,6 @@ public interface ChannelConfService {
String exportChannelConf(Long channelId);
}
......@@ -78,7 +78,12 @@ public class ChannelConfServiceImpl implements ChannelConfService {
channelConfVo = ChannelConfUtil.getChannelConfVoByClf(channelConfiguration, approve, orderStatus, repaymentPlan);
}
List<ChannelApplyInfoStrategy> channelApplyInfoStrategyByChannelId = clfCenterService.findChannelApplyInfoStrategyByChannelId(channelId);
channelConfVo.getBasicInfo().setChannelApplyInfoStrategyList(channelApplyInfoStrategyByChannelId);
channelConfVo.setApplyConf(channelApplyInfoStrategyByChannelId);
ChannelSecurityKey channelSecurityKey = clfCenterService.findChannelSecurityByChannelId(channelId);
if(Objects.nonNull(channelSecurityKey)){
channelConfVo.getAddInfo().setPublicKey(channelSecurityKey.getChannelPublicKey());
}
return channelConfVo;
}
......@@ -109,6 +114,8 @@ public class ChannelConfServiceImpl implements ChannelConfService {
ClfChannelConfiguration channelConfiguration = ChannelConfUtil.convert2ClfChannelConfiguration(basicInfo);
List<ClfOrderCallBack> clfOrderCallBackList = ChannelConfUtil.convert2ClfOrderCallback(basicInfo.getChannelId(), addInfo);
ClfChannelConfiguration channelConfigurationExsit = clfCenterService.findChannelConfigurationByChannelId(basicInfo.getChannelId());
if (channelConfigurationExsit == null) {
// 新保存
channelConfiguration.setCreatedAt(new Timestamp(System.currentTimeMillis()));
......@@ -135,14 +142,24 @@ public class ChannelConfServiceImpl implements ChannelConfService {
}
//保存进件配置项
Long channelId = basicInfo.getChannelId();
List<ChannelApplyInfoStrategy> channelApplyInfoStrategyList = basicInfo.getChannelApplyInfoStrategyList();
List<ChannelApplyInfoStrategy> channelApplyInfoStrategyList = confVo.getApplyConf();
if (CollectionUtils.isNotEmpty(channelApplyInfoStrategyList)) {
for (ChannelApplyInfoStrategy strategy : channelApplyInfoStrategyList) {
clfCenterService.saveChannelApplyInfoStrategy(strategy);
}
}
String channelPublicKey = addInfo.getPublicKey();
ChannelSecurityKey channelSecurityKey = clfCenterService.findChannelSecurityByChannelId(channelConf.getChannelId());
if(Objects.isNull(channelSecurityKey)){
channelSecurityKey = new ChannelSecurityKey();
channelSecurityKey.setIsActive(true);
channelSecurityKey.setCreatedAt(new Timestamp(System.currentTimeMillis()));
}
channelSecurityKey.setChannelPublicKey(channelPublicKey);
clfCenterService.saveChannelSecurityKey(channelSecurityKey);
return true;
}
......@@ -168,9 +185,12 @@ public class ChannelConfServiceImpl implements ChannelConfService {
ClfChannelConfiguration channelConfiguration= clfCenterService.findChannelConfigurationByChannelId(channelId);
List<CallbackConfiguration> callbackConfigurations = clfCenterService.findCallbackConfigurationByChannelId(channelId);
List<ChannelApplyInfoStrategy> channelApplyInfoStrategies = clfCenterService.findChannelApplyInfoStrategyByChannelId(channelId);
ChannelSecurityKey channelSecurityKey = clfCenterService.findChannelSecurityByChannelId(channelId);
StringJoiner joiner = new StringJoiner("\n");
joiner.add(generateInsertSql(channelConfiguration));
if(Objects.nonNull(channelConfiguration)){
joiner.add(generateInsertSql(channelConfiguration));
}
if(CollectionUtils.isNotEmpty(callbackConfigurations)){
for (CallbackConfiguration callbackConfiguration : callbackConfigurations) {
......@@ -183,6 +203,9 @@ public class ChannelConfServiceImpl implements ChannelConfService {
joiner.add(generateInsertSql(channelApplyInfoStrategy));
}
}
if(Objects.nonNull(channelSecurityKey)){
joiner.add(generateInsertSql(channelSecurityKey));
}
return joiner.toString();
}
......@@ -192,7 +215,7 @@ public class ChannelConfServiceImpl implements ChannelConfService {
private String generateInsertSql(Object obj){
if(Objects.isNull(obj)){
throw new RuntimeException("对象为空,无法解析");
return null;
}
Class<?> clazz = obj.getClass();
Annotation[] annotations = clazz.getAnnotations();
......
package cn.quantgroup.cashloanflowboss.spi.clf.entity;
import lombok.Getter;
import lombok.Setter;
import javax.persistence.*;
import java.sql.Timestamp;
/**
* Created by liqing on 2017/7/12 0012.
*/
@Setter
@Getter
@Entity
@Table(name = "channel_security_key", catalog = "cash_loan_flow")
public class ChannelSecurityKey {
@Id
@Column(name = "id")
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(name = "channel_id")
private Long channelId;
@Column(name = "private_key")
private String privateKey;
@Column(name = "public_key")
private String publicKey;
@Column(name = "channel_private_key")
private String channelPrivateKey;
@Column(name = "channel_public_key")
private String channelPublicKey;
@Column(name = "aes_key")
private String aesKey;
@Column(name = "md5_key")
private String md5Key;
@Column(name = "ex_data")
private String exData;
@Column(name = "is_active")
private Boolean isActive;
@Column(name = "created_at")
private Timestamp createdAt;
}
package cn.quantgroup.cashloanflowboss.spi.clf.repository;
import cn.quantgroup.cashloanflowboss.core.persistence.CashLoanFlowDataSource;
import cn.quantgroup.cashloanflowboss.spi.clf.entity.ApplyRequestHistory;
import cn.quantgroup.cashloanflowboss.spi.clf.entity.ChannelSecurityKey;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.stereotype.Repository;
@CashLoanFlowDataSource
@Repository
public interface ChannelSecurityKeyRepository extends PagingAndSortingRepository<ChannelSecurityKey, Long>, JpaSpecificationExecutor<ApplyRequestHistory> {
ChannelSecurityKey findByChannelId(Long channelId);
}
\ No newline at end of file
......@@ -47,5 +47,9 @@ public interface CLFCenterService {
List<ClfChannelConfiguration> findAll();
void saveChannelSecurityKey(ChannelSecurityKey securityKey);
ChannelSecurityKey findChannelSecurityByChannelId(Long channelId);
}
......@@ -52,6 +52,9 @@ public class CLFCenterServiceImpl implements CLFCenterService {
@Autowired
private ICallbackConfigurationRepository callbackConfigurationRepository;
@Autowired
private ChannelSecurityKeyRepository channelSecurityKeyRepository;
@Override
public List<CallbackFailRecord> findCallbackFailRecordByApplyNo(String applyNo) {
......@@ -178,4 +181,14 @@ public class CLFCenterServiceImpl implements CLFCenterService {
return callbackConfigurationRepository.findByChannelId(channelId);
}
@Override
public void saveChannelSecurityKey(ChannelSecurityKey securityKey) {
channelSecurityKeyRepository.save(securityKey);
}
@Override
public ChannelSecurityKey findChannelSecurityByChannelId(Long channelId) {
return channelSecurityKeyRepository.findByChannelId(channelId);
}
}
......@@ -47,8 +47,7 @@ public class ChannelApplyInfoStrategyTest extends CashLoanFlowBossApplicationTes
@Test
public void testGetChannelInfo(){
ChannelConfVo channelConf = channelConfService.getChannelConf(159881L);
ChannelConfVo channelConf = channelConfService.getChannelConf(159889L);
//ChannelApplyInfoStrategy channelApplyInfoStrategy = channelConf.getBasicInfo().getChannelApplyInfoStrategyList();
//channelApplyInfoStrategy.setChannelUserId(true);
......
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