Commit 56674333 authored by Data-王博's avatar Data-王博

Merge remote-tracking branch 'origin/release'

# Conflicts:
#	src/main/java/cn/quantgroup/financial/controller/ApiCommonController.java
parents 89361c4c cf3681ef
......@@ -31,6 +31,11 @@
</parent>
<dependencies>
<dependency>
<groupId>cn.quantgroup</groupId>
<artifactId>quantgroup-sms-sdk</artifactId>
<version>1.0.6.3</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
......@@ -71,6 +76,10 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-amqp</artifactId>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
......@@ -99,13 +108,25 @@
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.3.3</version>
<version>4.4.5</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpmime -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
<version>4.5.2</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-io/commons-io -->
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.5</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
......@@ -116,43 +137,42 @@
<artifactId>commons-lang3</artifactId>
<version>3.4</version>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-codec/commons-codec -->
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.10</version>
</dependency>
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.9.2</version>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.2.1</version>
</dependency>
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<version>3.1</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.5.3</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.5.3</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.5.3</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
......@@ -178,7 +198,12 @@
<artifactId>lombok</artifactId>
<version>1.16.4</version>
</dependency>
<!-- https://mvnrepository.com/artifact/dom4j/dom4j -->
<dependency>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>1.6</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
......@@ -224,9 +249,6 @@
<resource>
<directory>${project.basedir}/src/main/resources</directory>
</resource>
<resource>
<directory>${project.build.directory}/target/classes</directory>
</resource>
</resources>
<plugins>
<plugin>
......
......@@ -11,18 +11,19 @@ import org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerA
import org.springframework.boot.autoconfigure.web.HttpMessageConverters;
import org.springframework.context.annotation.*;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.transaction.annotation.EnableTransactionManagement;
@ImportResource(value={"classpath:applicationContext.xml"})
@SpringBootApplication
@ComponentScan("cn.quantgroup.financial")
@EnableAutoConfiguration(exclude={
DataSourceAutoConfiguration.class,//不让spring boot 自动加载xml中所有dataSource
DataSourceTransactionManagerAutoConfiguration.class,
})
@PropertySource({"classpath:application.properties"})
@EnableAutoConfiguration
@EnableTransactionManagement
@PropertySource({"classpath:application.properties","classpath:financial_api.properties"})
@EnableScheduling
@Configuration
@EnableAsync
public class BootStarter {
@Bean
......
......@@ -18,7 +18,7 @@ public class DataSourceContextHolder {
}
public static boolean isSystemDB() {
if(!StringUtils.isEmpty(dataSourceName.get())&& dataSourceName.get().toLowerCase().equals(DataBaseType.System_DB.get())){
if(!StringUtils.isEmpty(dataSourceName.get())&& dataSourceName.get().equals(DataBaseType.System_DB.get())){
return true;
}else {
return false;
......
package cn.quantgroup.financial.aspect.data;
import cn.quantgroup.financial.constant.DataBaseType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource;
......@@ -10,8 +11,8 @@ import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource;
public class RoutingDataSourceProxy extends AbstractRoutingDataSource {
private static final Logger logger = LoggerFactory.getLogger(RoutingDataSourceProxy.class);
private String systemDBName;
private String apiDBName;
private static String systemDBName = DataBaseType.System_DB.get();
private static String apiDBName = DataBaseType.Api_DB.get();
/**
* 决定使用哪个数据源
......
......@@ -7,7 +7,6 @@ import cn.quantgroup.financial.exception.ServerErrorException;
import cn.quantgroup.financial.json.JsonResult;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
......@@ -47,8 +46,8 @@ public class ExceptionHandlingAdvice {
return JsonResult.ERROR_SERVER();
}
@ExceptionHandler({Throwable.class})
public JsonResult exception(Throwable e){
@ExceptionHandler({Exception.class})
public JsonResult exception(Exception e){
logger.error(e.getMessage(),e);
return JsonResult.ERROR_SERVER();
}
......
......@@ -30,6 +30,7 @@ import java.util.Properties;
public class MyBatisConfig {
private static final Logger logger = LoggerFactory.getLogger(MyBatisConfig.class);
@Autowired
private Environment env;
......@@ -38,28 +39,42 @@ public class MyBatisConfig {
*/
@Bean
public DataSource apiDBDataSource() throws Exception {
logger.error("api jdbc url={}",env.getProperty("api.jdbc.url"));
Properties props = new Properties();
props.put("driverClassName", env.getProperty("api.jdbc.driverClassName"));
props.put("url", env.getProperty("api.jdbc.url"));
props.put("username", env.getProperty("api.jdbc.username"));
props.put("password", env.getProperty("api.jdbc.password"));
props.put("maxActive",env.getProperty("api.jdbc.maxActive"));
props.put("minIdle",env.getProperty("api.jdbc.minIdle"));
return DruidDataSourceFactory.createDataSource(props);
try {
logger.error("finance api config-------------------api jdbc url={}",env.getProperty("api.jdbc.url"));
Properties props = new Properties();
props.put("driverClassName", env.getProperty("api.jdbc.driverClassName"));
props.put("url", env.getProperty("api.jdbc.url"));
props.put("username", env.getProperty("api.jdbc.username"));
props.put("password", env.getProperty("api.jdbc.password"));
props.put("maxActive",env.getProperty("api.jdbc.maxActive"));
props.put("minIdle",env.getProperty("api.jdbc.minIdle"));
props.put("maxWait","600");
props.put("validationQuery","select 1 ");
return DruidDataSourceFactory.createDataSource(props);
} catch (Exception e) {
logger.error(e.getMessage(),e);
}
return null;
}
@Bean
public DataSource systemDBDataSource() throws Exception {
logger.error("system jdbc url={}",env.getProperty("system.jdbc.url"));
Properties props = new Properties();
props.put("driverClassName", env.getProperty("system.jdbc.driverClassName"));
props.put("url", env.getProperty("system.jdbc.url"));
props.put("username", env.getProperty("system.jdbc.username"));
props.put("password", env.getProperty("system.jdbc.password"));
props.put("maxActive",env.getProperty("system.jdbc.maxActive"));
props.put("minIdle",env.getProperty("system.jdbc.minIdle"));
return DruidDataSourceFactory.createDataSource(props);
try {
logger.error("finance api config-------------------system jdbc url={}",env.getProperty("system.jdbc.url"));
Properties props = new Properties();
props.put("driverClassName", env.getProperty("system.jdbc.driverClassName"));
props.put("url", env.getProperty("system.jdbc.url"));
props.put("username", env.getProperty("system.jdbc.username"));
props.put("password", env.getProperty("system.jdbc.password"));
props.put("maxActive",env.getProperty("system.jdbc.maxActive"));
props.put("minIdle",env.getProperty("system.jdbc.minIdle"));
props.put("maxWait","600");
props.put("validationQuery","select 1 ");
return DruidDataSourceFactory.createDataSource(props);
} catch (Exception e) {
logger.error(e.getMessage(),e);
}
return null;
}
/**
......@@ -70,15 +85,20 @@ public class MyBatisConfig {
@Primary
public RoutingDataSourceProxy dataSource(@Qualifier("apiDBDataSource") DataSource apiDbDataSource,
@Qualifier("systemDBDataSource") DataSource systemDb2DataSource) {
Map<Object, Object> targetDataSources = new HashMap<>();
targetDataSources.put(DataBaseType.Api_DB.get(), apiDbDataSource);
targetDataSources.put(DataBaseType.System_DB.get(), systemDb2DataSource);
try {
Map<Object, Object> targetDataSources = new HashMap<>();
targetDataSources.put(DataBaseType.Api_DB.get(), apiDbDataSource);
targetDataSources.put(DataBaseType.System_DB.get(), systemDb2DataSource);
RoutingDataSourceProxy dataSource = new RoutingDataSourceProxy();
dataSource.setTargetDataSources(targetDataSources);// 该方法是AbstractRoutingDataSource的方法
dataSource.setDefaultTargetDataSource(apiDbDataSource);// 默认的datasource设置为myTestDbDataSource
RoutingDataSourceProxy dataSource = new RoutingDataSourceProxy();
dataSource.setTargetDataSources(targetDataSources);// 该方法是AbstractRoutingDataSource的方法
dataSource.setDefaultTargetDataSource(apiDbDataSource);// 默认的datasource设置为myTestDbDataSource
return dataSource;
return dataSource;
} catch (Exception e) {
logger.error(e.getMessage(),e);
}
return null;
}
/**
......@@ -86,14 +106,20 @@ public class MyBatisConfig {
*/
@Bean
public SqlSessionFactory sqlSessionFactory(RoutingDataSourceProxy ds) throws Exception {
SqlSessionFactoryBean fb = new SqlSessionFactoryBean();
fb.setDataSource(ds);// 指定数据源(这个必须有,否则报错)
// 下边两句仅仅用于*.xml文件,如果整个持久层操作不需要使用到xml文件的话(只用注解就可以搞定),则不加
fb.setTypeAliasesPackage(env.getProperty("mybatis.typeAliasesPackage"));// 指定基包
fb.setMapperLocations(
new PathMatchingResourcePatternResolver().getResources(env.getProperty("mybatis.mapperLocations")));//
try {
SqlSessionFactoryBean fb = new SqlSessionFactoryBean();
fb.setDataSource(ds);// 指定数据源(这个必须有,否则报错)
// 下边两句仅仅用于*.xml文件,如果整个持久层操作不需要使用到xml文件的话(只用注解就可以搞定),则不加
fb.setTypeAliasesPackage(env.getProperty("mybatis.typeAliasesPackage"));// 指定基包
fb.setTypeHandlersPackage(env.getProperty("mybatis.typeHandlersPackage"));//指定扫描typeHandler包
fb.setMapperLocations(
new PathMatchingResourcePatternResolver().getResources(env.getProperty("mybatis.mapperLocations")));//
return fb.getObject();
return fb.getObject();
} catch (Exception e) {
logger.error(e.getMessage(),e);
}
return null;
}
/**
......
package cn.quantgroup.financial.constant;
import java.nio.charset.Charset;
/**
* 默认配置编码
* Created by WuKong on 2017/1/19.
*/
public class EncodingConfig {
public static final Charset defaultCharset = Charset.forName("UTF-8");
public static final String defaultEncoding = "UTF-8";
public static final Charset GBKCharset = Charset.forName("GBK");
public static final String GBKEncoding = "GBK";
}
package cn.quantgroup.financial.constant;
/**
* Created by WuKong on 2017/1/18.
*/
public class FormatConfig {
public static final String TIME = "yyyy-MM-dd HH:mm:ss";
public static final String OTHER_TIME="yyyy/MM/dd HH:mm:ss";
public static final String DATE ="yyyy-MM-dd";
public static final String OTHER_DATE="yyyy/MM/dd";
public static final String SAMPLE_TIME="yyyyMMddHHmmss";
public static final String SAMPLE_DATE="yyyyMMdd";
public static final String SAMPLE_DATE_YEAR ="yy-MM-dd";
public static final String SHORTSAMPLE_DATE="yyMMddHHmmss";
public static final String ONLY_TIME="HH:mm:ss";
public static final String SAMPLE1_DATE="yyyy-MM-dd";
public static final String SHORTDATETIME="yyyy-MM-dd HH:mm";
public static final String ONLY_SHORTTIME="HH:mm";
public static final String SAMPLE_MONTHDAY="MM.dd";
public static final String CN_TIME1="yyyy年MM月dd日HH:mm";
public static final String CN_DATE="yyyy年MM月dd日";
public static final String TIME_UTC="yyyy-MM-dd'T'HH:mm:ss.SSS";
public static final String TIME_UTC_H = "MM-dd HH:mm";
public static final String RUNKEEP_TIME="EEE, dd MMM yyyy HH:mm:ss";
public static final String TIME_UTC1="yyyy-MM-dd'T'HH:mm:ss+mm:ss.SSS";
public static final String TIME_UTCZ="yyyy-MM-dd'Z'HH:mm:ss+mm:ss.SSS";
public static final String SIMPLE_MONTH = "yyyy-MM";
public static final String ENDOMONDO_TIME="MMM dd, yyyy KK:mm aa";
public static final String TIMESTAMP = "yyyy-MM-dd HH:mm:ss.SSS";
}
package cn.quantgroup.financial.constant;
/**
* 资金方类型
* Created by WuKong on 2017/1/23.
*/
public enum FundCorpType {
HuBeiCFC(290L,"湖北消金");
private Long id;
private String name;
FundCorpType(Long id, String name) {
this.id = id;
this.name = name;
}
public long getId(){
return id;
}
public String getName(){
return name;
}
}
package cn.quantgroup.financial.constant;
/**
* 湖北消金 数据类型
* Created by WuKong on 2017/1/19.
*/
public enum HubeiCFCDataType {
SEND_DEBIT(Integer.valueOf(0).byteValue(),"0"),//扣款送盘文件
SEND_ADVANCE_REPAYMENT_CHECK(Integer.valueOf(1).byteValue(),"1"),//提前还款校验结果文件
RETURN_BATCH_DEBIT(Integer.valueOf(2).byteValue(),"0"),//批扣文件
RETURN_BATCH_COMPENSATION(Integer.valueOf(3).byteValue(),"1"),//代偿明细文件
RETURN_ADVANCE_REPAYMENT(Integer.valueOf(4).byteValue(),"2");//提前还款
private Byte type;
private String flag;
HubeiCFCDataType(Byte type,String flag) {
this.type = type;
this.flag = flag;
}
public Byte get(){
return type;
}
public String getFlag(){
return flag;
}
}
package cn.quantgroup.financial.constant;
import org.apache.commons.lang3.StringUtils;
import java.util.HashMap;
import java.util.Map;
/**
* Created by WuKong on 2017/1/18.
*/
public class HubeiCFCField {
public static final String root = "root";
public static final String ec = "ec";
public static final String em = "em";
public static final String Resp = "Resp";
public static final String head = "head";
public static final String channel = "channel";
public static final String currentBusinessCode = "currentBusinessCode";
public static final String flowNo = "flowNo";
public static final String reqTime = "reqTime";
public static final String sign = "sign";
public static final String signFlag = "signFlag";
public static final String reqdata = "reqdata";
public static final String xmlString = "xmlString";
public static final String applCde = "applCde";
public static final String cstno = "cstno";
public static final String typGrp= "typGrp";
/**
* 当前机器时间
* 格式:yyMMdd
*/
public static final String applyDt = "applyDt";
/**
* 文件种类
* 回盘:
* 0:扣款文件
* 1:代偿明细文件
* 2:提前还款文件
* 送盘:
* 0:扣款送盘文件
* 1:提前还款校验结果文件
*/
public static final String flag = "flag";
/**
* 资料文件名称
* 批扣文件:yyyymmdd_9009_P01.txt
* 代偿明细:
* yyyymmdd_9009_ D01.txt
* 提前还款文件:
* yyyymmdd_9009_ T01.txt
* 9009 :渠道标识;
* 01:是指同类文件的批次;
* P:批扣文件;
* D:代偿文件;
* T:提前还款文件
*/
public static final String docName = "docName";
/**
* 影像资料文件流
* 流:Base64编码过的字节数组字符串
*/
public static final String picUploadFile = "picUploadFile";
/**
* 送盘文件业务码
*/
public static final String SendDiscBusinessCode = "CF004053";
/**
* 回盘文件业务码
*/
public static final String ReturnDiscBusinessCode = "CF004052";
public static final Map<HubeiCFCDataType,String> businessMap = new HashMap<HubeiCFCDataType,String>(){
{
put(HubeiCFCDataType.RETURN_BATCH_DEBIT,ReturnDiscBusinessCode);
put(HubeiCFCDataType.RETURN_BATCH_COMPENSATION,ReturnDiscBusinessCode);
put(HubeiCFCDataType.RETURN_ADVANCE_REPAYMENT,ReturnDiscBusinessCode);
put(HubeiCFCDataType.SEND_DEBIT,SendDiscBusinessCode);
put(HubeiCFCDataType.SEND_ADVANCE_REPAYMENT_CHECK,SendDiscBusinessCode);
}
};
public static final Map<Byte,HubeiCFCDataType> HubeiTypeMap = new HashMap<Byte,HubeiCFCDataType>(){
{
put(HubeiCFCDataType.RETURN_BATCH_DEBIT.get(),HubeiCFCDataType.RETURN_BATCH_DEBIT);
put(HubeiCFCDataType.RETURN_BATCH_COMPENSATION.get(),HubeiCFCDataType.RETURN_BATCH_COMPENSATION);
put(HubeiCFCDataType.RETURN_ADVANCE_REPAYMENT.get(),HubeiCFCDataType.RETURN_ADVANCE_REPAYMENT);
put(HubeiCFCDataType.SEND_DEBIT.get(),HubeiCFCDataType.SEND_DEBIT);
put(HubeiCFCDataType.SEND_ADVANCE_REPAYMENT_CHECK.get(),HubeiCFCDataType.SEND_ADVANCE_REPAYMENT_CHECK);
}
};
public static final String chanel_9009 = "9009";
/**
* ec状态 成功码
*/
public static final String EC_SUCCESS_CODE = "0";
/**
* 文件不存在
*/
public static final String EC_FILENOTEXIST = "CFLN4053";
/**
* 交易码
*/
public static final String tradeCodeSuccess = "0000";
public static final String tradeCodeNoTrade = "0001";
public static final String tradeCodeWrongPrice = "2222";
/**
* 交易结果
*/
public static final String tradeMsgSuccess = "交易成功";
public static final String tradeMsgNoTrade = "未还款";
public static final String tradeMsgWrongPrice = "金额不正确";
public static final Map<String,String> codeMappingMsg = new HashMap<String,String>(){
{
put(tradeCodeSuccess,tradeMsgSuccess);
put(tradeCodeNoTrade,tradeMsgNoTrade);
put(tradeCodeWrongPrice,tradeMsgWrongPrice);
}
};
/**
* 还款模式
*/
public static final String repayType = "NF";
/**
* 还款渠道
*/
public static final String repayChannel = "09";
/**
* 回盘文件后缀名
*/
public static final Map<HubeiCFCDataType,String> fileAlias = new HashMap<HubeiCFCDataType,String>(){
{
put(HubeiCFCDataType.RETURN_BATCH_DEBIT,"P");
put(HubeiCFCDataType.RETURN_BATCH_COMPENSATION,"D");
put(HubeiCFCDataType.RETURN_ADVANCE_REPAYMENT,"T");
}};
/**
* ec状态码
*/
public static class EcCode {
public static final String defaultCode = "-1";
}
public static Integer thirtyMintes = 30;
public static Integer tenMinutes = 10;
}
package cn.quantgroup.financial.constant;
/**
* Created by WuKong on 2017/1/19.
*/
public class SysConstant {
public static class DeletedStatus{
public static final Byte NO_DELETED = 0;
public static final Byte DELETED = 1;
}
/**
* mailinfo 表中的mailType 类型
*/
public static class MailType{
public static final Byte HUBEI_ERROR = 0;//湖北对账接口报错
public static final Byte HUBEI_FILE = 1;//湖北每日送盘对账文件
}
/**
* 还款状态
*/
public static class RepayStatus{
/**
* 未还款
*/
public static final Byte YET_REPAY =0;
/**
* 已还款
*/
public static final Byte ALREADY_REPAY = 1;
}
/**
* 重试1次数
*/
public static final Integer retryOneNums = 1;
public static final String vertical = "|";
public static final String verticalRegx = "\\|";
}
package cn.quantgroup.financial.controller;
import cn.quantgroup.financial.constant.CompensationStatus;
import cn.quantgroup.financial.constant.HubeiCFCDataType;
import cn.quantgroup.financial.exception.ArgsInvaildException;
import cn.quantgroup.financial.exception.FieldInsufficientException;
import cn.quantgroup.financial.json.JsonResult;
import cn.quantgroup.financial.mapper.PaymentDetailMapper;
import cn.quantgroup.financial.model.PaymentDetail;
import cn.quantgroup.financial.model.RepaymentPlanStatus;
import cn.quantgroup.financial.scheduler.HuBeiReturnDiscScheduler;
import cn.quantgroup.financial.scheduler.HuBeiSendDiscScheduler;
import cn.quantgroup.financial.service.IApiCommonService;
import cn.quantgroup.financial.service.IHuBeiService;
import cn.quantgroup.financial.util.MD5Util;
import com.alibaba.fastjson.JSON;
import org.apache.commons.collections.CollectionUtils;
......@@ -33,6 +38,18 @@ public class ApiCommonController {
@Autowired
IApiCommonService iApiCommonService;
@Autowired
PaymentDetailMapper paymentDetailMapper;
@Autowired
IHuBeiService huBeiService;
@Autowired
HuBeiSendDiscScheduler huBeiDayScheduler;
@Autowired
HuBeiReturnDiscScheduler huBeiReturnDiscScheduler;
/**
* 放款 通知包含还款计划
* @return
......@@ -78,7 +95,6 @@ public class ApiCommonController {
logger.error(e.getMessage(),e);
return JsonResult.ERROR_ARGS();
}
logger.info("getPlansStatus={}",JSON.toJSONString(repaymentPlanStatusList));
return JsonResult.SUCCESS(repaymentPlanStatusList);
}
......@@ -88,15 +104,18 @@ public class ApiCommonController {
for(Long loanId: list){
try {
logger.info("repairOldData loanId={}",loanId);
iApiCommonService.queryData(loanId,null);
PaymentDetail paymentDetailOld = paymentDetailMapper.getByLoanHistoryId(loanId);
if(paymentDetailOld==null){
iApiCommonService.queryData(loanId,null);
}
} catch (Exception e) {
logger.error(e.getMessage(),e);
}
}
Date date = new Date();
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.MONTH,0);
calendar.set(Calendar.DAY_OF_MONTH,27);
calendar.set(Calendar.MONTH,0);
calendar.set(Calendar.HOUR_OF_DAY,0);
calendar.set(Calendar.MINUTE,0);
calendar.set(Calendar.SECOND,0);
......@@ -107,4 +126,52 @@ public class ApiCommonController {
}
@RequestMapping(value = "/hubei/sendDisc", method = {RequestMethod.POST,RequestMethod.GET})
public @ResponseBody JsonResult getSendDisc(@RequestParam("applyDt") String applyDt){
try {
huBeiService.handleDiscData(HubeiCFCDataType.SEND_DEBIT,null,null,new Integer(1).byteValue(),applyDt);
} catch (Exception e) {
logger.error(e.getMessage(),e);
}
return JsonResult.SUCCESS();
}
@RequestMapping(value = "/hubei/checkDisc", method = {RequestMethod.POST,RequestMethod.GET})
public @ResponseBody JsonResult checkDisc(@RequestParam("applyDt") String applyDt,@RequestParam("docName") String docName){
try {
huBeiService.handleDiscData(HubeiCFCDataType.SEND_ADVANCE_REPAYMENT_CHECK,docName,null,new Integer(1).byteValue(),applyDt);
} catch (Exception e) {
logger.error(e.getMessage(),e);
}
return JsonResult.SUCCESS();
}
@RequestMapping(value = "/hubei/returnDiscScheduler", method = {RequestMethod.POST,RequestMethod.GET})
public @ResponseBody JsonResult getReturnDisc(){
try {
huBeiReturnDiscScheduler.dayScheduler();
} catch (Exception e) {
logger.error(e.getMessage());
}
return JsonResult.SUCCESS();
}
@RequestMapping(value = "/hubei/handleReturnDisc", method = {RequestMethod.POST,RequestMethod.GET})
public @ResponseBody JsonResult handleReturnDisc(@RequestParam("applyDt") String applyDt,@RequestParam("type") Integer type,@RequestParam("docId") Long docId){
try {
if(type.intValue()==HubeiCFCDataType.RETURN_ADVANCE_REPAYMENT.get().intValue()){
// huBeiService.handleDiscData(HubeiCFCDataType.RETURN_ADVANCE_REPAYMENT,null,docId,new Integer(1).byteValue(),applyDt);
}else if(type.intValue()==HubeiCFCDataType.RETURN_BATCH_COMPENSATION.get().intValue()){
huBeiService.handleDiscData(HubeiCFCDataType.RETURN_BATCH_COMPENSATION,null,docId,new Integer(1).byteValue(),applyDt);
}else if(type.intValue()==HubeiCFCDataType.RETURN_BATCH_DEBIT.get().intValue()){
huBeiService.handleDiscData(HubeiCFCDataType.RETURN_BATCH_DEBIT,null,docId,new Integer(1).byteValue(),applyDt);
}
} catch (Exception e) {
logger.error(e.getMessage());
}
return JsonResult.SUCCESS();
}
}
package cn.quantgroup.financial.controller;
import cn.quantgroup.financial.json.JsonResult;
import cn.quantgroup.financial.model.MailInfo;
import cn.quantgroup.financial.model.PaymentDetail;
import cn.quantgroup.financial.service.IApiCommonService;
import cn.quantgroup.financial.service.sys.IMailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
/**
* Created by WuKong on 2017/2/19.
*/
@Controller
@RequestMapping("/system")
public class SystemToolsController {
@Autowired
private IMailService mailService;
@Autowired
private IApiCommonService apiCommonService;
@RequestMapping(value = "/mailinfo/save", method = RequestMethod.POST)
public @ResponseBody JsonResult saveMailInfo(@RequestBody MailInfo mailInfo){
Long mailId = null;
if(mailInfo !=null){
mailId = mailService.saveMailInfo(mailInfo);
}
return JsonResult.SUCCESS(mailId);
}
@RequestMapping(value = "/mailinfo/delete", method = {RequestMethod.GET,RequestMethod.POST,RequestMethod.DELETE})
public @ResponseBody JsonResult paymentNotify(@RequestParam("mailId") Long mailId){
Integer row = null;
if(mailId!=null){
// row = mailService.deleteMailInfo(mailId);
}
return JsonResult.SUCCESS(row);
}
@RequestMapping(value = "/payment/update", method = {RequestMethod.GET,RequestMethod.POST,RequestMethod.DELETE})
public @ResponseBody JsonResult updateContractNo(@RequestParam("contractNo") String contractNo,@RequestParam("loanHistoryId") Long loanHistoryId){
Integer row = null;
// row = apiCommonService.updateMerchantContractNo(contractNo,loanHistoryId);
return JsonResult.SUCCESS(row);
}
}
package cn.quantgroup.financial.dao;
import cn.quantgroup.financial.constant.HubeiCFCDataType;
import cn.quantgroup.financial.model.MailInfo;
import cn.quantgroup.financial.model.huibeicfc.HuBeiDocName;
import cn.quantgroup.financial.model.huibeicfc.HuBeiHistory;
import java.util.Date;
import java.util.List;
/**
* Created by WuKong on 2017/1/19.
*/
public interface IHuBeiCFCDao {
void saveHistoryAndDocName(HuBeiHistory history,HuBeiDocName docName);
Long saveHistory(HuBeiHistory huBeiHistory);
Long saveDocName(HuBeiDocName huBeiDocName);
HuBeiDocName getDocNameById(Long docId);
/**
* 通过 happenTime时间范围查询
* @param beforeTime
* @param afterTime
* @return
*/
List<HuBeiHistory> getListByTimeScope(Date beforeTime, Date afterTime,HubeiCFCDataType hubeiCFCDataType);
Integer updateDocName(HuBeiDocName huBeiDocName);
List<HuBeiHistory> getListByDocNameId(Long docNameId);
List<HuBeiHistory> getListByDocNameIdAndSeqNo(Long docNameId,Byte seqNo);
HuBeiDocName getByDataTypeAndCreateTime(HubeiCFCDataType hubeiCFCDataType,Date dayDate);
/**
* 根据日期和类型查询同一天最近的文件
* @param hubeiCFCDataType
* @param queryDate
* @return
*/
HuBeiDocName getLastestDocByDataAndType(HubeiCFCDataType hubeiCFCDataType,Date queryDate);
/**
* 通过文件名和类型查找文件
* @param docName
* @param hubeiCFCDataType
* @return
*/
HuBeiDocName getByDocNameAndType(String docName,HubeiCFCDataType hubeiCFCDataType);
Integer getMaxSeqNoByDocId(Long docId);
List<MailInfo> getListByType(Byte type);
/**
* 通过合同号查询flow不为空的
* @param contactNoList
* @return
*/
List<HuBeiHistory> getFlowByContractNoList(List<String> contactNoList);
}
......@@ -2,6 +2,7 @@ package cn.quantgroup.financial.dao;
import cn.quantgroup.financial.exception.ArgsInvaildException;
import cn.quantgroup.financial.model.PaymentDetail;
import cn.quantgroup.financial.model.RepaymentPlanDetail;
import cn.quantgroup.financial.model.RepaymentPlanStatus;
import org.springframework.stereotype.Repository;
......@@ -31,6 +32,18 @@ public interface IPaymentDao {
Integer savePaymentDetailAndRepaymentPlan(PaymentDetail paymentDetail);
/**
* 通过
* @param loanHistoryIdList
* @return
*/
List<RepaymentPlanDetail> getRepaymentPlanListByLoanIds(List<Long> loanHistoryIdList);
List<RepaymentPlanDetail> getListByLoanIdsAndCompensationStatus(List<Long> loanHistoryIdList,Byte compensationStatus);
List<RepaymentPlanDetail> getListByCompensationDateAndLoanIds(List<Long> loanHistoryIdList,Date compensationDate);
/**
* 通过代偿日 查询id list
* @param compensationDate
......@@ -38,6 +51,21 @@ public interface IPaymentDao {
*/
List<Long> getIdListByCompensationDate(Date compensationDate);
/**
* 通过合同号返回paymentDetail
* @param contractNoList
* @return
*/
List<PaymentDetail> getListByMerchantContractNo(List<String> contractNoList);
PaymentDetail getByLoanId(Long loanHistoryId);
/**
*
* @param loanHistoryId
* @param term
* @return
*/
RepaymentPlanDetail getByLoanIdAndTerm(Long loanHistoryId,Integer term);
/**
* 批量更新代偿状态
* @param idList
......@@ -49,4 +77,6 @@ public interface IPaymentDao {
List<Long> getIdListBeforeCompensationDate(Date compensationDate);
Integer updateBatchCompensationStatusBeforeDate(Date beforeDate,Byte compensationStatus);
Integer updateMerchantContractNo(String contractNo,Long loanHistoryId);
}
package cn.quantgroup.financial.dao;
import cn.quantgroup.financial.aspect.data.DataSourceConfig;
import cn.quantgroup.financial.constant.DataBaseType;
import cn.quantgroup.financial.model.RepayXyqbDetail;
import java.util.Date;
import java.util.List;
/**
* Created by WuKong on 2017/1/23.
*/
@DataSourceConfig(DataBaseType.System_DB)
public interface IRepayRecordDao {
/**
* 通过还款时间间隔以及资金方id查询 还款信息
* @param fundingCorpId
* @param beforeTime
* @param afterTime
* @return
*/
List<RepayXyqbDetail> getRepayXyqbDetailList(Long fundingCorpId, Date beforeTime, Date afterTime);
List<RepayXyqbDetail> getListByLoanHistroyIds(Long fundingCorpId,List<Long> loanHistoryIdList);
/**
* 排除loanId list之后 时间段内的某一资金方 还款记录
* @param fundingCorpId
* @param loanHistoryIdList
* @param gtDate
* @param ltDate
* @return
*/
List<RepayXyqbDetail> getListNotLoanIdBetweenDate(Long fundingCorpId,List<Long> loanHistoryIdList,Date gtDate,Date ltDate);
}
package cn.quantgroup.financial.dao;
import cn.quantgroup.financial.model.MailInfo;
/**
* Created by WuKong on 2017/2/19.
*/
public interface ISystemDao {
Long saveMailInfo(MailInfo mailInfo);
Integer deleteMailInfo(Long mailId);
}
package cn.quantgroup.financial.dao.impl;
import cn.quantgroup.financial.constant.HubeiCFCDataType;
import cn.quantgroup.financial.dao.IHuBeiCFCDao;
import cn.quantgroup.financial.mapper.HuBeiDocNameMapper;
import cn.quantgroup.financial.mapper.HuBeiHistoryMapper;
import cn.quantgroup.financial.mapper.MailInfoMapper;
import cn.quantgroup.financial.mapper.PaymentDetailMapper;
import cn.quantgroup.financial.model.MailInfo;
import cn.quantgroup.financial.model.PaymentDetail;
import cn.quantgroup.financial.model.huibeicfc.HuBeiDocName;
import cn.quantgroup.financial.model.huibeicfc.HuBeiHistory;
import org.apache.commons.collections.CollectionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* Created by WuKong on 2017/1/19.
*/
@Service
public class HuBeiCFCDaoImpl implements IHuBeiCFCDao {
private static final Logger logger = LoggerFactory.getLogger(HuBeiCFCDaoImpl.class);
@Autowired
HuBeiDocNameMapper huBeiDocNameMapper;
@Autowired
HuBeiHistoryMapper huBeiHistoryMapper;
@Autowired
PaymentDetailMapper paymentDetailMapper;
@Autowired
MailInfoMapper mailInfoMapper;
@Transactional(rollbackFor=Exception.class)
@Override
public void saveHistoryAndDocName(HuBeiHistory history,HuBeiDocName docName){
saveDocName(docName);
history.setDocNameId(docName.getId());
PaymentDetail paymentDetail = paymentDetailMapper.getByUserIdNo(history.getUserIdNo());
if(paymentDetail!=null){
history.setUserId(paymentDetail.getUserId());
}else {
logger.info("can`t query payment info, userIdNo={}",history.getUserIdNo());
}
saveHistory(history);
}
@Override
public HuBeiDocName getByDocNameAndType(String docName,HubeiCFCDataType hubeiCFCDataType){
return huBeiDocNameMapper.getByDocNameAndType(docName,hubeiCFCDataType.get());
}
@Override
public List<HuBeiHistory> getListByTimeScope(Date beforeTime, Date afterTime, HubeiCFCDataType hubeiCFCDataType){
List<HuBeiHistory> huBeiHistoryList = huBeiHistoryMapper.getListByTimeScope(beforeTime,afterTime,hubeiCFCDataType.get());
return huBeiHistoryList;
}
@Override
public List<HuBeiHistory> getListByDocNameId(Long docNameId){
if(docNameId==null){
return new ArrayList<HuBeiHistory>();
}
return huBeiHistoryMapper.getListByDocNameId(docNameId);
}
@Override
public List<HuBeiHistory> getListByDocNameIdAndSeqNo(Long docNameId,Byte seqNo){
if(docNameId==null||seqNo==null){
return new ArrayList<HuBeiHistory>();
}
return huBeiHistoryMapper.getListByDocNameIdAndSeqNo(docNameId,seqNo);
}
@Override
public HuBeiDocName getByDataTypeAndCreateTime(HubeiCFCDataType hubeiCFCDataType,Date dayDate){
return huBeiDocNameMapper.getByDataTypeAndCreateTime(dayDate,hubeiCFCDataType.get());
}
/**
* 根据日期和类型查询同一天最近的文件
* @param hubeiCFCDataType
* @param queryDate
* @return
*/
@Override
public HuBeiDocName getLastestDocByDataAndType(HubeiCFCDataType hubeiCFCDataType,Date queryDate){
return huBeiDocNameMapper.getLastestDocByDataAndType(queryDate,hubeiCFCDataType.get());
}
@Override
@Transactional(rollbackFor=Exception.class)
public Long saveHistory(HuBeiHistory huBeiHistory){
huBeiHistory.setCreateTime(new Date());
huBeiHistory.setUpdateTime(new Date());
int row = huBeiHistoryMapper.insert(huBeiHistory);
return huBeiHistory.getId();
}
@Override
public Integer getMaxSeqNoByDocId(Long docId){
if(docId==null){
return null;
}
return huBeiHistoryMapper.getMaxSeqNoByDocId(docId);
}
@Transactional(rollbackFor=Exception.class)
@Override
public Long saveDocName(HuBeiDocName huBeiDocName){
huBeiDocName.setCreateTime(new Date());
huBeiDocName.setUpdateTime(new Date());
long row = huBeiDocNameMapper.insert(huBeiDocName);
return huBeiDocName.getId();
}
@Override
public HuBeiDocName getDocNameById(Long docId){
return huBeiDocNameMapper.selectByPrimaryKey(docId);
}
@Override
public Integer updateDocName(HuBeiDocName huBeiDocName){
return huBeiDocNameMapper.updateByPrimaryKeySelective(huBeiDocName);
}
@Override
public List<MailInfo> getListByType(Byte type){
return mailInfoMapper.getByType(type);
}
@Override
public List<HuBeiHistory> getFlowByContractNoList(List<String> contactNoList){
if(CollectionUtils.isEmpty(contactNoList)){
return new ArrayList<HuBeiHistory>();
}
return huBeiHistoryMapper.getFlowByContractNoList(contactNoList);
}
}
package cn.quantgroup.financial.dao.impl;
import cn.quantgroup.financial.aspect.data.DataSourceConfig;
import cn.quantgroup.financial.constant.DataBaseType;
import cn.quantgroup.financial.dao.IPaymentDao;
import cn.quantgroup.financial.exception.ArgsInvaildException;
import cn.quantgroup.financial.mapper.PaymentDetailMapper;
......@@ -9,6 +7,7 @@ import cn.quantgroup.financial.mapper.RepaymentPlanDetailMapper;
import cn.quantgroup.financial.model.PaymentDetail;
import cn.quantgroup.financial.model.RepaymentPlanDetail;
import cn.quantgroup.financial.model.RepaymentPlanStatus;
import cn.quantgroup.financial.util.DateUtil;
import com.alibaba.fastjson.JSON;
import org.apache.commons.collections.CollectionUtils;
import org.slf4j.Logger;
......@@ -16,6 +15,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
......@@ -26,6 +26,7 @@ import java.util.List;
public class PaymentDaoImpl implements IPaymentDao {
private static final Logger logger = LoggerFactory.getLogger(PaymentDaoImpl.class);
@Autowired
private PaymentDetailMapper paymentDetailMapper;
......@@ -40,6 +41,7 @@ public class PaymentDaoImpl implements IPaymentDao {
* @return
* @throws ArgsInvaildException
*/
@Override
public List<RepaymentPlanStatus> getRepaymentPlanStatus(Long loanHistoryId,Long repaymentPlanId) throws ArgsInvaildException {
if(loanHistoryId==null&&repaymentPlanId==null){
throw new ArgsInvaildException("loanHistoryId and repaymentPlanId both is null");
......@@ -47,6 +49,50 @@ public class PaymentDaoImpl implements IPaymentDao {
return repaymentPlanDetailMapper.getRepaymentPlanStatus(loanHistoryId,repaymentPlanId);
}
@Override
public List<RepaymentPlanDetail> getRepaymentPlanListByLoanIds(List<Long> loanHistoryIdList){
if(CollectionUtils.isEmpty(loanHistoryIdList)){
return new ArrayList<RepaymentPlanDetail>();
}
return repaymentPlanDetailMapper.getRepaymentPlanListByLoanIds(loanHistoryIdList);
}
@Override
public PaymentDetail getByLoanId(Long loanHistoryId){
return paymentDetailMapper.getByLoanHistoryId(loanHistoryId);
}
@Override
public List<RepaymentPlanDetail> getListByLoanIdsAndCompensationStatus(List<Long> loanHistoryIdList,Byte compensationStatus){
if(org.springframework.util.CollectionUtils.isEmpty(loanHistoryIdList)){
return new ArrayList<RepaymentPlanDetail>();
}
return repaymentPlanDetailMapper.getListByLoanIdsAndCompensationStatus(loanHistoryIdList,compensationStatus);
}
/**
* 通过代偿日以及loanIds 来查询一组代偿的还款计划
* @param loanHistoryIdList
* @param compensationDate
* @return
*/
@Override
public List<RepaymentPlanDetail> getListByCompensationDateAndLoanIds(List<Long> loanHistoryIdList,Date compensationDate){
if(CollectionUtils.isEmpty(loanHistoryIdList)||compensationDate==null){
return null;
}
return repaymentPlanDetailMapper.getListByCompensationDateAndLoanIds(compensationDate,loanHistoryIdList);
}
@Override
public RepaymentPlanDetail getByLoanIdAndTerm(Long loanHistoryId,Integer term){
if(loanHistoryId==null||term==null){
return null;
}
return repaymentPlanDetailMapper.getByLoanIdAndTerm(loanHistoryId,term);
}
/**
*
* 保存放款信息 和 还款计划信息
......@@ -83,6 +129,12 @@ public class PaymentDaoImpl implements IPaymentDao {
return idList;
}
@Override
public List<PaymentDetail> getListByMerchantContractNo(List<String> contractNoList){
return paymentDetailMapper.getByMerchantContractNo(contractNoList);
}
@Override
public List<Long> getIdListBeforeCompensationDate(Date compensationDate){
if(compensationDate==null){
......@@ -102,9 +154,16 @@ public class PaymentDaoImpl implements IPaymentDao {
return row;
}
@Override
public Integer updateBatchCompensationStatusBeforeDate(Date beforeDate,Byte compensationStatus){
Integer row = repaymentPlanDetailMapper.updateBatchCompensationStatusBeforeDate(beforeDate,compensationStatus);
return row;
}
@Override
public Integer updateMerchantContractNo(String contractNo,Long loanHistoryId){
return paymentDetailMapper.updateMerchantContractNoByLoanHistoryId(contractNo,loanHistoryId);
}
}
package cn.quantgroup.financial.dao.impl;
import cn.quantgroup.financial.aspect.data.DataSourceConfig;
import cn.quantgroup.financial.constant.DataBaseType;
import cn.quantgroup.financial.dao.IRepayRecordDao;
import cn.quantgroup.financial.mapper.RepayRecordMapper;
import cn.quantgroup.financial.mapper.RepayXyqbDetailMapper;
import cn.quantgroup.financial.model.RepayXyqbDetail;
import org.apache.commons.collections.CollectionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* Created by WuKong on 2017/1/23.
*/
@DataSourceConfig(DataBaseType.System_DB)
@Service
public class RepayRecordDaoImpl implements IRepayRecordDao {
@Autowired
private RepayRecordMapper repayRecordMapper;
@Autowired
private RepayXyqbDetailMapper repayXyqbDetailMapper;
private static final Logger logger = LoggerFactory.getLogger(RepayRecordDaoImpl.class);
/**
* 通过还款时间间隔以及资金方id查询 还款信息
* @param fundingCorpId
* @param beforeTime
* @param afterTime
* @return
*/
@Override
public List<RepayXyqbDetail> getRepayXyqbDetailList(Long fundingCorpId,Date beforeTime,Date afterTime){
return repayXyqbDetailMapper.getRepayXyqbDetailList(fundingCorpId,beforeTime,afterTime);
}
@Override
public List<RepayXyqbDetail> getListByLoanHistroyIds(Long fundingCorpId,List<Long> loanHistoryIdList){
if(fundingCorpId==null||CollectionUtils.isEmpty(loanHistoryIdList)){
return new ArrayList<RepayXyqbDetail>();
}
return repayXyqbDetailMapper.getListByLoanHistroyIds(fundingCorpId,loanHistoryIdList);
}
/**
* 排除loanId list之后 时间段内的某一资金方 还款记录
* order by loan_application_history_id curr_term_no ASC
* @param fundingCorpId
* @param loanHistoryIdList
* @param gtDate
* @param ltDate
* @return
*/
@Override
public List<RepayXyqbDetail> getListNotLoanIdBetweenDate(Long fundingCorpId,List<Long> loanHistoryIdList,Date gtDate,Date ltDate){
if(loanHistoryIdList==null){
loanHistoryIdList = new ArrayList<Long>();
}
return repayXyqbDetailMapper.getListNotLoanIdBetweenDate(fundingCorpId,loanHistoryIdList,gtDate,ltDate);
}
}
package cn.quantgroup.financial.dao.impl;
import cn.quantgroup.financial.dao.ISystemDao;
import cn.quantgroup.financial.mapper.MailInfoMapper;
import cn.quantgroup.financial.model.MailInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
/**
* Created by WuKong on 2017/2/19.
*/
@Service
public class SystemDaoImpl implements ISystemDao {
@Autowired
MailInfoMapper mailInfoMapper;
@Transactional(rollbackFor=Exception.class)
@Override
public Long saveMailInfo(MailInfo mailInfo){
mailInfo.setCreatetime(new Date());
mailInfo.setUpdatetime(new Date());
mailInfoMapper.insert(mailInfo);
return mailInfo.getId();
}
@Transactional(rollbackFor=Exception.class)
@Override
public Integer deleteMailInfo(Long mailId){
return mailInfoMapper.deleteByPrimaryKey(mailId);
}
}
package cn.quantgroup.financial.exception;
/**
* Created by WuKong on 2017/1/22.
*/
public class BaseException extends Exception{
public BaseException() {
super();
}
public BaseException(String message) {
super(message);
}
}
package cn.quantgroup.financial.exception;
/**
* 请求失败异常
* Created by WuKong on 2017/1/22.
*/
public class RequestException extends BaseException{
public RequestException() {
}
public RequestException(String message) {
super(message);
}
}
package cn.quantgroup.financial.handler;
import cn.quantgroup.financial.constant.HubeiCFCDataType;
import cn.quantgroup.financial.model.huibeicfc.HuBeiHistory;
/**
* Created by WuKong on 2017/1/20.
*/
public interface IHuBeiDispatcher {
HuBeiHistory parse(HubeiCFCDataType hubeiCFCDataType, String line);
String builder(HubeiCFCDataType hubeiCFCDataType,HuBeiHistory huBeiHistory);
}
package cn.quantgroup.financial.handler.hubei;
import cn.quantgroup.financial.constant.HubeiCFCDataType;
import cn.quantgroup.financial.model.huibeicfc.HuBeiHistory;
/**
* Created by WuKong on 2017/1/19.
*/
public interface HubeiContentHandler {
/**
* 解析
* @param line
* @return
*/
HuBeiHistory parse(String line);
HubeiCFCDataType getType();
/**
* 生成
* @param huBeiHistory
* @return
*/
String builder(HuBeiHistory huBeiHistory);
}
package cn.quantgroup.financial.handler.hubei.impl;
import cn.quantgroup.financial.constant.HubeiCFCDataType;
import cn.quantgroup.financial.handler.IHuBeiDispatcher;
import cn.quantgroup.financial.handler.hubei.HubeiContentHandler;
import cn.quantgroup.financial.model.huibeicfc.HuBeiHistory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Created by WuKong on 2017/1/19.
*/
@Service
public class HuBeiHandlerDispatcher implements IHuBeiDispatcher{
private static final Map<HubeiCFCDataType,HubeiContentHandler> handlerMap = new HashMap<HubeiCFCDataType,HubeiContentHandler>();
@Autowired(required = false)
public HuBeiHandlerDispatcher(List<HubeiContentHandler> handlers){
if(handlers!=null){
for (HubeiContentHandler handler: handlers){
handlerMap.put(handler.getType(),handler);
}
}
}
@Override
public HuBeiHistory parse(HubeiCFCDataType hubeiCFCDataType,String line){
return handlerMap.get(hubeiCFCDataType).parse(line);
}
@Override
public String builder(HubeiCFCDataType hubeiCFCDataType,HuBeiHistory huBeiHistory){
return handlerMap.get(hubeiCFCDataType).builder(huBeiHistory);
}
}
package cn.quantgroup.financial.handler.hubei.impl;
import cn.quantgroup.financial.constant.HubeiCFCDataType;
import cn.quantgroup.financial.constant.SysConstant;
import cn.quantgroup.financial.handler.hubei.HubeiContentHandler;
import cn.quantgroup.financial.model.huibeicfc.HuBeiHistory;
import cn.quantgroup.financial.model.huibeicfc.HuBeiJsonBean;
import cn.quantgroup.financial.util.HubeiCFCUtil;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
/**
* Created by WuKong on 2017/1/19.
*/
@Service
public class ReturnAdvanceHandler implements HubeiContentHandler {
@Override
public HuBeiHistory parse(String line) {
String[] args = line.split(SysConstant.verticalRegx);
HuBeiHistory history = new HuBeiHistory();
int index =0;
history.setContactNo(args[index++]);
history.setUserName(args[index++]);
history.setUserIdType(HubeiCFCUtil.getIDType(args[index++]));
history.setUserIdNo(args[index++]);
history.setDataType(getType().get());
HuBeiJsonBean jsonBean = new HuBeiJsonBean();
HubeiCFCUtil.copy(history,jsonBean);
jsonBean.setRepayType(args[index++]);
jsonBean.setRepayDate(args[index++]);
jsonBean.setShortenTerm(Integer.valueOf(args[index++]));
jsonBean.setRepayTotalAmount(new BigDecimal(args[index++]));
jsonBean.setChannel(args[index++]);
jsonBean.setApplyRepayDate(args[index++]);
history.setData(jsonBean);
return history;
}
@Override
public HubeiCFCDataType getType() {
return HubeiCFCDataType.RETURN_ADVANCE_REPAYMENT;
}
@Override
public String builder(HuBeiHistory huBeiHistory) {
return new StringBuilder(huBeiHistory.getContactNo())
.append(SysConstant.vertical).append(huBeiHistory.getUserName())
.append(SysConstant.vertical).append(HubeiCFCUtil.getHuBeiType(huBeiHistory.getUserIdType()))
.append(SysConstant.vertical).append(huBeiHistory.getUserIdNo())
.append(SysConstant.vertical).append(huBeiHistory.getData().getRepayType())
.append(SysConstant.vertical).append(huBeiHistory.getData().getRepayDate())
.append(SysConstant.vertical).append("0")//缩期期数 默认0
// .append(SysConstant.vertical).append(huBeiHistory.getData().getShortenTerm())
.append(SysConstant.vertical).append(huBeiHistory.getData().getRepayTotalAmount().toString())
.append(SysConstant.vertical).append(huBeiHistory.getData().getChannel())
.append(SysConstant.vertical).append(huBeiHistory.getData().getApplyRepayDate())
.toString();
}
}
package cn.quantgroup.financial.handler.hubei.impl;
import cn.quantgroup.financial.constant.HubeiCFCDataType;
import cn.quantgroup.financial.handler.hubei.HubeiContentHandler;
import cn.quantgroup.financial.model.huibeicfc.HuBeiHistory;
import org.springframework.stereotype.Service;
/**
* 批扣文件及代偿明细文件 处理模式相同
* Created by WuKong on 2017/1/19.
*/
@Service
public class ReturnCompensationHandler extends ReturnDebitHandler {
@Override
public HubeiCFCDataType getType() {
return HubeiCFCDataType.RETURN_BATCH_COMPENSATION;
}
}
package cn.quantgroup.financial.handler.hubei.impl;
import cn.quantgroup.financial.constant.HubeiCFCDataType;
import cn.quantgroup.financial.constant.SysConstant;
import cn.quantgroup.financial.handler.hubei.HubeiContentHandler;
import cn.quantgroup.financial.model.huibeicfc.HuBeiHistory;
import cn.quantgroup.financial.model.huibeicfc.HuBeiJsonBean;
import cn.quantgroup.financial.util.HubeiCFCUtil;
import cn.quantgroup.financial.util.NumberUtils;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
/**
* Created by WuKong on 2017/1/19.
*/
@Service
public class ReturnDebitHandler implements HubeiContentHandler {
@Override
public HuBeiHistory parse(String line) {
String[] args = line.split(SysConstant.verticalRegx);
HuBeiHistory history = new HuBeiHistory();
history.setFlowNo(args[0]);
history.setContactNo(args[1]);
history.setUserName(args[2]);
history.setUserIdType(HubeiCFCUtil.getIDType(args[3]));
history.setUserIdNo(args[4]);
history.setDataType(getType().get());
HuBeiJsonBean jsonBean = new HuBeiJsonBean();
HubeiCFCUtil.copy(history,jsonBean);
jsonBean.setRepayAmount(new BigDecimal(args[5]));
jsonBean.setReallyRepayAmount(NumberUtils.getNotNull(args[6]));//没有则为0
jsonBean.setTradeCode(args[7]);
jsonBean.setTradeMsg(args[8]);
history.setData(jsonBean);
return history;
}
@Override
public HubeiCFCDataType getType() {
return HubeiCFCDataType.RETURN_BATCH_DEBIT;
}
@Override
public String builder(HuBeiHistory huBeiHistory) {
return new StringBuilder(huBeiHistory.getFlowNo())
.append(SysConstant.vertical).append(huBeiHistory.getContactNo())
.append(SysConstant.vertical).append(huBeiHistory.getUserName())
.append(SysConstant.vertical).append(HubeiCFCUtil.getHuBeiType(huBeiHistory.getUserIdType()))
.append(SysConstant.vertical).append(huBeiHistory.getUserIdNo())
.append(SysConstant.vertical).append(huBeiHistory.getData().getRepayAmount().toString())
.append(SysConstant.vertical).append(huBeiHistory.getData().getReallyRepayAmount().toString())
.append(SysConstant.vertical).append(huBeiHistory.getData().getTradeCode())
.append(SysConstant.vertical).append(huBeiHistory.getData().getTradeMsg()).toString();
}
}
package cn.quantgroup.financial.handler.hubei.impl;
import cn.quantgroup.financial.constant.HubeiCFCDataType;
import cn.quantgroup.financial.constant.SysConstant;
import cn.quantgroup.financial.handler.hubei.HubeiContentHandler;
import cn.quantgroup.financial.model.huibeicfc.HuBeiHistory;
import cn.quantgroup.financial.model.huibeicfc.HuBeiJsonBean;
import cn.quantgroup.financial.util.HubeiCFCUtil;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
/**
* 提前还款校验
* Created by WuKong on 2017/1/19.
*/
@Service
public class SendCheckHandler implements HubeiContentHandler {
@Override
public HuBeiHistory parse(String line) {
String[] args = line.split(SysConstant.verticalRegx);
HuBeiHistory history = new HuBeiHistory();
int index =0;
history.setContactNo(args[index++]);
history.setUserName(args[index++]);
history.setUserIdType(HubeiCFCUtil.getIDType(args[index++]));
history.setUserIdNo(args[index++]);
history.setDataType(getType().get());
HuBeiJsonBean jsonBean = new HuBeiJsonBean();
HubeiCFCUtil.copy(history,jsonBean);
jsonBean.setRepayType(args[index++]);
jsonBean.setRepayDate(args[index++]);
jsonBean.setShortenTerm(Integer.valueOf(args[index++]));
jsonBean.setRepayTotalAmount(new BigDecimal(args[index++]));
jsonBean.setChannel(args[index++]);
jsonBean.setApplyRepayDate(args[index++]);
jsonBean.setTradeCode(args[index++]);
jsonBean.setTradeMsg(args[index++]);
history.setData(jsonBean);
return history;
}
@Override
public HubeiCFCDataType getType() {
return HubeiCFCDataType.SEND_ADVANCE_REPAYMENT_CHECK;
}
@Override
public String builder(HuBeiHistory huBeiHistory) {
return new StringBuilder(huBeiHistory.getContactNo())
.append(SysConstant.vertical).append(huBeiHistory.getUserName())
.append(SysConstant.vertical).append(HubeiCFCUtil.getHuBeiType(huBeiHistory.getUserIdType()))
.append(SysConstant.vertical).append(huBeiHistory.getUserIdNo())
.append(SysConstant.vertical).append(huBeiHistory.getData().getRepayType())
.append(SysConstant.vertical).append(huBeiHistory.getData().getRepayDate())
.append(SysConstant.vertical).append(huBeiHistory.getData().getShortenTerm())
.append(SysConstant.vertical).append(huBeiHistory.getData().getRepayTotalAmount().toString())
.append(SysConstant.vertical).append(huBeiHistory.getData().getChannel())
.append(SysConstant.vertical).append(huBeiHistory.getData().getApplyRepayDate())
.append(SysConstant.vertical).append(huBeiHistory.getData().getTradeCode())
.append(SysConstant.vertical).append(huBeiHistory.getData().getTradeMsg()).toString();
}
}
package cn.quantgroup.financial.handler.hubei.impl;
import cn.quantgroup.financial.constant.HubeiCFCDataType;
import cn.quantgroup.financial.constant.SysConstant;
import cn.quantgroup.financial.handler.hubei.HubeiContentHandler;
import cn.quantgroup.financial.model.huibeicfc.HuBeiHistory;
import cn.quantgroup.financial.model.huibeicfc.HuBeiJsonBean;
import cn.quantgroup.financial.util.HubeiCFCUtil;
import cn.quantgroup.financial.util.NumberUtils;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
/**
* 扣款送盘
* Created by WuKong on 2017/1/19.
*/
@Service
public class SendDebitHandler implements HubeiContentHandler {
@Override
public HuBeiHistory parse(String line) {
String[] args = line.split(SysConstant.verticalRegx);
HuBeiHistory history = new HuBeiHistory();
history.setFlowNo(args[0]);
history.setContactNo(args[1]);
history.setUserName(args[2]);
history.setUserIdType(HubeiCFCUtil.getIDType(args[3]));
history.setUserIdNo(args[4]);
history.setDataType(getType().get());
HuBeiJsonBean jsonBean = new HuBeiJsonBean();
HubeiCFCUtil.copy(history,jsonBean);
jsonBean.setRepayAmount(new BigDecimal(args[5]));
jsonBean.setTradeCode(args[6]);
if(args.length==13){
jsonBean.setShouldRepayDate(args[7]);
jsonBean.setShouldRepayPrincipal(new BigDecimal(args[8]));
jsonBean.setShouldRepayInterest(new BigDecimal(args[9]));
jsonBean.setShouldRepayOverdueInterest(new BigDecimal(args[10]));
jsonBean.setShouldRepayCompoundInterest(new BigDecimal(args[11]));
jsonBean.setShouldRepayTotalFee(new BigDecimal(args[12]));
}
history.setData(jsonBean);
return history;
}
@Override
public HubeiCFCDataType getType() {
return HubeiCFCDataType.SEND_DEBIT;
}
@Override
public String builder(HuBeiHistory huBeiHistory) {
return new StringBuilder(huBeiHistory.getFlowNo())
.append(SysConstant.vertical).append(huBeiHistory.getContactNo())
.append(SysConstant.vertical).append(huBeiHistory.getUserName())
.append(SysConstant.vertical).append(HubeiCFCUtil.getHuBeiType(huBeiHistory.getUserIdType()))
.append(SysConstant.vertical).append(huBeiHistory.getUserIdNo())
.append(SysConstant.vertical).append(NumberUtils.getNotNullToString(huBeiHistory.getData().getRepayAmount()))
.append(SysConstant.vertical).append(huBeiHistory.getData().getTradeCode())
.append(SysConstant.vertical).append(huBeiHistory.getData().getShouldRepayDate())
.append(SysConstant.vertical).append(NumberUtils.getNotNullToString(huBeiHistory.getData().getShouldRepayPrincipal()))
.append(SysConstant.vertical).append(NumberUtils.getNotNullToString(huBeiHistory.getData().getShouldRepayInterest()))
.append(SysConstant.vertical).append(NumberUtils.getNotNullToString(huBeiHistory.getData().getShouldRepayOverdueInterest()))
.append(SysConstant.vertical).append(NumberUtils.getNotNullToString(huBeiHistory.getData().getShouldRepayCompoundInterest()))
.append(SysConstant.vertical).append(NumberUtils.getNotNullToString(huBeiHistory.getData().getShouldRepayTotalFee())).toString();
}
}
package cn.quantgroup.financial.handler.mybatis;
import cn.quantgroup.financial.model.huibeicfc.HuBeiJsonBean;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.apache.ibatis.type.JdbcType;
import org.apache.ibatis.type.MappedJdbcTypes;
import org.apache.ibatis.type.MappedTypes;
import org.apache.ibatis.type.TypeHandler;
import java.sql.CallableStatement;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
/**
* http://www.cnblogs.com/waterystone/p/5547254.html
* mapper里json型字段到类的映射。
* 用法一:
* 入库:#{jsonDataField, typeHandler=com.adu.spring_test.mybatis.typehandler.JsonTypeHandler}
* 出库:
* <resultMap>
* <result property="jsonDataField" column="json_data_field" javaType="com.xxx.MyClass" typeHandler="com.adu.spring_test.mybatis.typehandler.JsonTypeHandler"/>
* </resultMap>
*
* 用法二:
* 1)在mybatis-config.xml中指定handler:
* <typeHandlers>
* <typeHandler handler="com.adu.spring_test.mybatis.typehandler.JsonTypeHandler" javaType="com.xxx.MyClass"/>
* </typeHandlers>
* 2)在MyClassMapper.xml里直接select/update/insert。
*
*
* @author yunjie.du
* @date 2016/5/31 19:33
*/
/**
* Created by WuKong on 2017/1/19.
*/
@MappedTypes(HuBeiJsonBean.class)
@MappedJdbcTypes(JdbcType.VARCHAR)
public class JsonMybatisHandler implements TypeHandler<HuBeiJsonBean> {
@Override
public void setParameter(PreparedStatement preparedStatement, int i, HuBeiJsonBean huBeiJsonBean, JdbcType jdbcType) throws SQLException {
preparedStatement.setString(i,JSON.toJSONString(huBeiJsonBean));
}
@Override
public HuBeiJsonBean getResult(ResultSet resultSet, String s) throws SQLException {
return JSONObject.parseObject(resultSet.getString(s), HuBeiJsonBean.class);
}
@Override
public HuBeiJsonBean getResult(ResultSet resultSet, int i) throws SQLException {
return JSONObject.parseObject(resultSet.getString(i), HuBeiJsonBean.class);
}
@Override
public HuBeiJsonBean getResult(CallableStatement callableStatement, int i) throws SQLException {
return JSONObject.parseObject(callableStatement.getString(i),HuBeiJsonBean.class);
}
}
package cn.quantgroup.financial.init;
import cn.quantgroup.financial.service.sys.ICompensationDayService;
import cn.quantgroup.financial.service.sys.IScheduledJudgeService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -17,10 +18,25 @@ public class InitRunner implements CommandLineRunner {
@Autowired
private ICompensationDayService compensationDayService;
@Autowired
private IScheduledJudgeService scheduledJudgeService;
@Override
public void run(String... strings) throws Exception {
logger.info("start prepare compenstationDaysData ");
compensationDayService.prepareCompenstationDaysData();
logger.info("end prepare compenstationDaysData ");
if(scheduledJudgeService.isOpenScheduled()){
logger.error("finance api config-------------------scheduled task is opened");
}else {
logger.error("finance api config-------------------scheduled task is closed");
}
if(scheduledJudgeService.isOpenHuBeiRequest()){
logger.error("finance api config-------------------HuBei push request is opened");
}else {
logger.error("finance api config-------------------HuBei push request is closed");
}
}
}
package cn.quantgroup.financial.mapper;
import cn.quantgroup.financial.model.huibeicfc.HuBeiDocName;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
public interface HuBeiDocNameMapper {
int deleteByPrimaryKey(Long id);
int insert(HuBeiDocName record);
int insertSelective(HuBeiDocName record);
HuBeiDocName getByDocNameAndType(@Param("docName") String docName,@Param("dataType") Byte dataType);
HuBeiDocName getByDataTypeAndCreateTime(@Param("queryTime")Date queryTime,@Param("dataType") Byte dataType);
HuBeiDocName selectByPrimaryKey(Long id);
/**
* 查询指定日期 类型 最近的一个文件
* @param queryDate
* @param dataType
* @return
*/
HuBeiDocName getLastestDocByDataAndType(@Param("queryDate")Date queryDate,@Param("dataType") Byte dataType);
int updateByPrimaryKeySelective(HuBeiDocName record);
int updateByPrimaryKey(HuBeiDocName record);
}
\ No newline at end of file
package cn.quantgroup.financial.mapper;
import cn.quantgroup.financial.model.huibeicfc.HuBeiHistory;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
public interface HuBeiHistoryMapper {
int deleteByPrimaryKey(Long id);
int insert(HuBeiHistory record);
List<HuBeiHistory> getListByTimeScope(@Param("beforeTime") Date beforeTime, @Param("afterTime")Date afterTime, @Param("dataType")Byte dataType);
List<HuBeiHistory> getListByDocNameId(@Param("docNameId") Long docNameId);
List<HuBeiHistory> getFlowByContractNoList(@Param("contractNoList") List<String> contractNoList);
/**
* 通过文档id 以及批次序号查询
* @param docNameId
* @param seqNo
* @return
*/
List<HuBeiHistory> getListByDocNameIdAndSeqNo(@Param("docNameId") Long docNameId,@Param("seqNo") Byte seqNo);
int insertSelective(HuBeiHistory record);
HuBeiHistory selectByPrimaryKey(Long id);
int updateByPrimaryKeySelective(HuBeiHistory record);
int updateByPrimaryKey(HuBeiHistory record);
Integer getMaxSeqNoByDocId(@Param("docNameId") Long docId);
}
\ No newline at end of file
package cn.quantgroup.financial.mapper;
import cn.quantgroup.financial.model.MailInfo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface MailInfoMapper {
int deleteByPrimaryKey(Long id);
int insert(MailInfo record);
int insertSelective(MailInfo record);
MailInfo selectByPrimaryKey(Long id);
int updateByPrimaryKeySelective(MailInfo record);
int updateByPrimaryKey(MailInfo record);
List<MailInfo> getByType(@Param("mailtype") Byte mailtype);
}
\ No newline at end of file
......@@ -4,17 +4,24 @@ import cn.quantgroup.financial.model.PaymentDetail;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
public interface PaymentDetailMapper {
int deleteByPrimaryKey(Long id);
int insert(PaymentDetail record);
PaymentDetail getByUserIdNo(@Param("userIdNo") String userIdNo);
PaymentDetail getByLoanHistoryId(@Param("loanHistoryId") Long loanHistoryId);
int insertSelective(PaymentDetail record);
int updateMerchantContractNoByLoanHistoryId(@Param("contractNo") String contractNo,@Param("loanHistoryId") Long loanHistoryId);
PaymentDetail selectByPrimaryKey(Long id);
int updateByPrimaryKeySelective(PaymentDetail record);
int updateByPrimaryKey(PaymentDetail record);
List<PaymentDetail> getByMerchantContractNo(@Param("contractNos") List<String> contractNos);
}
\ No newline at end of file
package cn.quantgroup.financial.mapper;
import cn.quantgroup.financial.model.RepayRecord;
public interface RepayRecordMapper {
int deleteByPrimaryKey(Long id);
int insert(RepayRecord record);
int insertSelective(RepayRecord record);
RepayRecord selectByPrimaryKey(Long id);
int updateByPrimaryKeySelective(RepayRecord record);
int updateByPrimaryKey(RepayRecord record);
}
\ No newline at end of file
package cn.quantgroup.financial.mapper;
import cn.quantgroup.financial.model.RepayXyqbDetail;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
public interface RepayXyqbDetailMapper {
int insert(RepayXyqbDetail record);
int insertSelective(RepayXyqbDetail record);
RepayXyqbDetail selectByPrimaryKey(Long id);
int updateByPrimaryKeySelective(RepayXyqbDetail record);
int updateByPrimaryKeyWithBLOBs(RepayXyqbDetail record);
int updateByPrimaryKey(RepayXyqbDetail record);
List<RepayXyqbDetail> getRepayXyqbDetailList(@Param("fundingCorpId") Long fundingCorpId, @Param("beforeTime") Date beforeTime, @Param("afterTime") Date afterTime);
List<RepayXyqbDetail> getListByLoanHistroyIds(@Param("fundingCorpId") Long fundingCorpId,@Param("loanHistoryIdList")List<Long> loanHistoryIdList);
/**
* 排除loanId list之后 时间段内的某一资金方 还款记录
* order by loan_application_history_id curr_term_no ASC
* @param fundingCorpId
* @param loanHistoryIdList
* @param beforeTime
* @param afterTime
* @return
*/
List<RepayXyqbDetail> getListNotLoanIdBetweenDate(@Param("fundingCorpId") Long fundingCorpId,@Param("loanHistoryIdList")List<Long> loanHistoryIdList, @Param("gtDate") Date beforeTime, @Param("ltDate") Date afterTime);
}
\ No newline at end of file
......@@ -9,7 +9,6 @@ import java.util.Date;
import java.util.List;
public interface RepaymentPlanDetailMapper {
int deleteByPrimaryKey(Long id);
int insert(RepaymentPlanDetail record);
......@@ -21,7 +20,11 @@ public interface RepaymentPlanDetailMapper {
int updateBatchCompensationStatusBeforeDate(@Param("beforeDate") Date beforeDate,@Param("compensationStatus") Byte compensationStatus);
int updateByPrimaryKeySelective(RepaymentPlanDetail record);
int updateByPrimaryKey(RepaymentPlanDetail record);
RepaymentPlanDetail getByLoanIdAndTerm(@Param("loanHistoryId") Long loanHistoryId,@Param("currentTerm") Integer currentTerm);
List<Long> getIdListByCompensationDate(@Param("compensationDate") Date compensationDate);
List<Long> getIdListByNotYetCompensation(@Param("compensationDate") Date compensationDate);
List<RepaymentPlanDetail> getListByCompensationDateAndLoanIds(@Param("compensationDate") Date compensationDate,@Param("loanHistoryIdList") List<Long> loanHistoryIdList);
List<RepaymentPlanStatus> getRepaymentPlanStatus(@Param("loanHistoryId") Long loanHistoryId, @Param("repaymentPlanId") Long repaymentPlanId);
List<RepaymentPlanDetail> getRepaymentPlanListByLoanIds(@Param("loanHistoryIdList") List<Long> loanHistoryIdList);
List<RepaymentPlanDetail> getListByLoanIdsAndCompensationStatus(@Param("loanHistoryIdList") List<Long> loanHistoryIdList,@Param("compensationStatus") Byte compensationStatus);
}
\ No newline at end of file
package cn.quantgroup.financial.model;
import cn.quantgroup.financial.util.NetUtil;
import java.io.Serializable;
/**
* Created by WuKong on 2017/1/18.
*/
public class HttpResult implements Serializable {
private int httpCode;
private int status = NetUtil.RequestStatus.SUCCESS_STATUS;
private String result;
private String cookies;
public int getHttpCode() {
return httpCode;
}
public void setHttpCode(int httpCode) {
this.httpCode = httpCode;
}
public String getResult() {
return result;
}
public void setResult(String result) {
this.result = result;
}
public String getCookies() {
return cookies;
}
public void setCookies(String cookies) {
this.cookies = cookies;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
}
package cn.quantgroup.financial.model;
import java.io.Serializable;
import java.util.Date;
public class MailInfo implements Serializable {
private Long id;
private String mail;
private Byte mailtype;
private Date createtime;
private Date updatetime;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getMail() {
return mail;
}
public void setMail(String mail) {
this.mail = mail == null ? null : mail.trim();
}
public Byte getMailtype() {
return mailtype;
}
public void setMailtype(Byte mailtype) {
this.mailtype = mailtype;
}
public Date getCreatetime() {
return createtime;
}
public void setCreatetime(Date createtime) {
this.createtime = createtime;
}
public Date getUpdatetime() {
return updatetime;
}
public void setUpdatetime(Date updatetime) {
this.updatetime = updatetime;
}
}
\ No newline at end of file
package cn.quantgroup.financial.model;
import java.math.BigDecimal;
import java.util.Date;
public class RepayRecord {
private Long id;
private Long merchantId;
private Date dealedAt;
private String paymentPlatform;
private String orderId;
private BigDecimal incoming;
private BigDecimal commission;
private String merchantOrderNo;
private String merchantRepayOrderNo;
private BigDecimal merchantRepaidAmount;
private Date merchantRepaidAt;
private String cardNo;
private String bankName;
private String userName;
private String userPhone;
private String idNo;
private Byte balanceStatus;
private BigDecimal errFee;
private Byte errType;
private Date createdAt;
private Date updatedAt;
private String yOrderId;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getMerchantId() {
return merchantId;
}
public void setMerchantId(Long merchantId) {
this.merchantId = merchantId;
}
public Date getDealedAt() {
return dealedAt;
}
public void setDealedAt(Date dealedAt) {
this.dealedAt = dealedAt;
}
public String getPaymentPlatform() {
return paymentPlatform;
}
public void setPaymentPlatform(String paymentPlatform) {
this.paymentPlatform = paymentPlatform == null ? null : paymentPlatform.trim();
}
public String getOrderId() {
return orderId;
}
public void setOrderId(String orderId) {
this.orderId = orderId == null ? null : orderId.trim();
}
public BigDecimal getIncoming() {
return incoming;
}
public void setIncoming(BigDecimal incoming) {
this.incoming = incoming;
}
public BigDecimal getCommission() {
return commission;
}
public void setCommission(BigDecimal commission) {
this.commission = commission;
}
public String getMerchantOrderNo() {
return merchantOrderNo;
}
public void setMerchantOrderNo(String merchantOrderNo) {
this.merchantOrderNo = merchantOrderNo == null ? null : merchantOrderNo.trim();
}
public String getMerchantRepayOrderNo() {
return merchantRepayOrderNo;
}
public void setMerchantRepayOrderNo(String merchantRepayOrderNo) {
this.merchantRepayOrderNo = merchantRepayOrderNo == null ? null : merchantRepayOrderNo.trim();
}
public BigDecimal getMerchantRepaidAmount() {
return merchantRepaidAmount;
}
public void setMerchantRepaidAmount(BigDecimal merchantRepaidAmount) {
this.merchantRepaidAmount = merchantRepaidAmount;
}
public Date getMerchantRepaidAt() {
return merchantRepaidAt;
}
public void setMerchantRepaidAt(Date merchantRepaidAt) {
this.merchantRepaidAt = merchantRepaidAt;
}
public String getCardNo() {
return cardNo;
}
public void setCardNo(String cardNo) {
this.cardNo = cardNo == null ? null : cardNo.trim();
}
public String getBankName() {
return bankName;
}
public void setBankName(String bankName) {
this.bankName = bankName == null ? null : bankName.trim();
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName == null ? null : userName.trim();
}
public String getUserPhone() {
return userPhone;
}
public void setUserPhone(String userPhone) {
this.userPhone = userPhone == null ? null : userPhone.trim();
}
public String getIdNo() {
return idNo;
}
public void setIdNo(String idNo) {
this.idNo = idNo == null ? null : idNo.trim();
}
public Byte getBalanceStatus() {
return balanceStatus;
}
public void setBalanceStatus(Byte balanceStatus) {
this.balanceStatus = balanceStatus;
}
public BigDecimal getErrFee() {
return errFee;
}
public void setErrFee(BigDecimal errFee) {
this.errFee = errFee;
}
public Byte getErrType() {
return errType;
}
public void setErrType(Byte errType) {
this.errType = errType;
}
public Date getCreatedAt() {
return createdAt;
}
public void setCreatedAt(Date createdAt) {
this.createdAt = createdAt;
}
public Date getUpdatedAt() {
return updatedAt;
}
public void setUpdatedAt(Date updatedAt) {
this.updatedAt = updatedAt;
}
public String getyOrderId() {
return yOrderId;
}
public void setyOrderId(String yOrderId) {
this.yOrderId = yOrderId == null ? null : yOrderId.trim();
}
}
\ No newline at end of file
package cn.quantgroup.financial.model;
import java.math.BigDecimal;
import java.util.Date;
public class RepayXyqbDetail {
private Long id;
private String merchantRepayOrderNo;
private String orderId;
private BigDecimal requiredPayAmount;
private BigDecimal actualPayAmount;
private Date deadline;
private Integer termNo;
private Integer currTermNo;
private Date loanPaidAt;
private BigDecimal requiredRepayment;
private Date payCenterRepayAt;
private BigDecimal principal;
private BigDecimal interest;
private BigDecimal overdueInterest;
private BigDecimal serviceFeePerTerm;
private BigDecimal discount;
private BigDecimal collectionRelief;
private Long fundingCorpId;
private String fundingCorp;
private String debtFundingCorp;
private Date createdAt;
private Date updatedAt;
private String userName;
private String userPhone;
private String idNo;
private Date dealedAt;
private Long loanApplicationManifestHistoryId;
private Long loanApplicationHistoryId;
private String paymentPlatform;
private Byte errType;
private BigDecimal actuaRepayAmount;
private String yOrderId;
private String channelName;
private Long channelId;
private String contractNo;
private String cardNo;
private String remark;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getMerchantRepayOrderNo() {
return merchantRepayOrderNo;
}
public void setMerchantRepayOrderNo(String merchantRepayOrderNo) {
this.merchantRepayOrderNo = merchantRepayOrderNo == null ? null : merchantRepayOrderNo.trim();
}
public String getOrderId() {
return orderId;
}
public void setOrderId(String orderId) {
this.orderId = orderId == null ? null : orderId.trim();
}
public BigDecimal getRequiredPayAmount() {
return requiredPayAmount;
}
public void setRequiredPayAmount(BigDecimal requiredPayAmount) {
this.requiredPayAmount = requiredPayAmount;
}
public BigDecimal getActualPayAmount() {
return actualPayAmount;
}
public void setActualPayAmount(BigDecimal actualPayAmount) {
this.actualPayAmount = actualPayAmount;
}
public Date getDeadline() {
return deadline;
}
public void setDeadline(Date deadline) {
this.deadline = deadline;
}
public Integer getTermNo() {
return termNo;
}
public void setTermNo(Integer termNo) {
this.termNo = termNo;
}
public Integer getCurrTermNo() {
return currTermNo;
}
public void setCurrTermNo(Integer currTermNo) {
this.currTermNo = currTermNo;
}
public Date getLoanPaidAt() {
return loanPaidAt;
}
public void setLoanPaidAt(Date loanPaidAt) {
this.loanPaidAt = loanPaidAt;
}
public BigDecimal getRequiredRepayment() {
return requiredRepayment;
}
public void setRequiredRepayment(BigDecimal requiredRepayment) {
this.requiredRepayment = requiredRepayment;
}
public Date getPayCenterRepayAt() {
return payCenterRepayAt;
}
public void setPayCenterRepayAt(Date payCenterRepayAt) {
this.payCenterRepayAt = payCenterRepayAt;
}
public BigDecimal getPrincipal() {
return principal;
}
public void setPrincipal(BigDecimal principal) {
this.principal = principal;
}
public BigDecimal getInterest() {
return interest;
}
public void setInterest(BigDecimal interest) {
this.interest = interest;
}
public BigDecimal getOverdueInterest() {
return overdueInterest;
}
public void setOverdueInterest(BigDecimal overdueInterest) {
this.overdueInterest = overdueInterest;
}
public BigDecimal getServiceFeePerTerm() {
return serviceFeePerTerm;
}
public void setServiceFeePerTerm(BigDecimal serviceFeePerTerm) {
this.serviceFeePerTerm = serviceFeePerTerm;
}
public BigDecimal getDiscount() {
return discount;
}
public void setDiscount(BigDecimal discount) {
this.discount = discount;
}
public BigDecimal getCollectionRelief() {
return collectionRelief;
}
public void setCollectionRelief(BigDecimal collectionRelief) {
this.collectionRelief = collectionRelief;
}
public Long getFundingCorpId() {
return fundingCorpId;
}
public void setFundingCorpId(Long fundingCorpId) {
this.fundingCorpId = fundingCorpId;
}
public String getFundingCorp() {
return fundingCorp;
}
public void setFundingCorp(String fundingCorp) {
this.fundingCorp = fundingCorp == null ? null : fundingCorp.trim();
}
public String getDebtFundingCorp() {
return debtFundingCorp;
}
public void setDebtFundingCorp(String debtFundingCorp) {
this.debtFundingCorp = debtFundingCorp == null ? null : debtFundingCorp.trim();
}
public Date getCreatedAt() {
return createdAt;
}
public void setCreatedAt(Date createdAt) {
this.createdAt = createdAt;
}
public Date getUpdatedAt() {
return updatedAt;
}
public void setUpdatedAt(Date updatedAt) {
this.updatedAt = updatedAt;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName == null ? null : userName.trim();
}
public String getUserPhone() {
return userPhone;
}
public void setUserPhone(String userPhone) {
this.userPhone = userPhone == null ? null : userPhone.trim();
}
public String getIdNo() {
return idNo;
}
public void setIdNo(String idNo) {
this.idNo = idNo == null ? null : idNo.trim();
}
public Date getDealedAt() {
return dealedAt;
}
public void setDealedAt(Date dealedAt) {
this.dealedAt = dealedAt;
}
public Long getLoanApplicationManifestHistoryId() {
return loanApplicationManifestHistoryId;
}
public void setLoanApplicationManifestHistoryId(Long loanApplicationManifestHistoryId) {
this.loanApplicationManifestHistoryId = loanApplicationManifestHistoryId;
}
public Long getLoanApplicationHistoryId() {
return loanApplicationHistoryId;
}
public void setLoanApplicationHistoryId(Long loanApplicationHistoryId) {
this.loanApplicationHistoryId = loanApplicationHistoryId;
}
public String getPaymentPlatform() {
return paymentPlatform;
}
public void setPaymentPlatform(String paymentPlatform) {
this.paymentPlatform = paymentPlatform == null ? null : paymentPlatform.trim();
}
public Byte getErrType() {
return errType;
}
public void setErrType(Byte errType) {
this.errType = errType;
}
public BigDecimal getActuaRepayAmount() {
return actuaRepayAmount;
}
public void setActuaRepayAmount(BigDecimal actuaRepayAmount) {
this.actuaRepayAmount = actuaRepayAmount;
}
public String getyOrderId() {
return yOrderId;
}
public void setyOrderId(String yOrderId) {
this.yOrderId = yOrderId == null ? null : yOrderId.trim();
}
public String getChannelName() {
return channelName;
}
public void setChannelName(String channelName) {
this.channelName = channelName == null ? null : channelName.trim();
}
public Long getChannelId() {
return channelId;
}
public void setChannelId(Long channelId) {
this.channelId = channelId;
}
public String getContractNo() {
return contractNo;
}
public void setContractNo(String contractNo) {
this.contractNo = contractNo == null ? null : contractNo.trim();
}
public String getCardNo() {
return cardNo;
}
public void setCardNo(String cardNo) {
this.cardNo = cardNo == null ? null : cardNo.trim();
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark == null ? null : remark.trim();
}
}
\ No newline at end of file
package cn.quantgroup.financial.model;
import com.alibaba.fastjson.annotation.JSONField;
import com.alibaba.fastjson.serializer.SerializerFeature;
import java.io.Serializable;
import java.math.BigDecimal;
......@@ -42,6 +41,7 @@ public class RepaymentPlanDetail implements Serializable{
private Date updateTime;
//要求不为空的字段名
@JSONField(serialize=false)
public static List<String> notNullField = new ArrayList<>(Arrays.asList("loanHistoryId", "repaymentPlanId", "currentTerm","deadLine","principal"));
......
package cn.quantgroup.financial.model.huibeicfc;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
/**
* 消息队列解析
* Created by WuKong on 2017/1/23.
*/
public class HuBeiCFCMessage implements Serializable {
private Long loanHistoryId;
private List<Long> repaymentPlanIdList;
//还款日期
private Date repaymentDate;
private String flowNo;
private String contactNo;
private String userName;
private String userIdNo;
//应扣金额 批扣和代偿 需要
private BigDecimal repayAmount;
//实际还款金额 提前还款,则是总计还款金额
private BigDecimal reallyRepayAmount;
//0 批扣 1代偿 2提前还款
private Integer dataType;
private Long applyRepayDate;
public Long getApplyRepayDate() {
return applyRepayDate;
}
public void setApplyRepayDate(Long applyRepayDate) {
this.applyRepayDate = applyRepayDate;
}
public Long getLoanHistoryId() {
return loanHistoryId;
}
public void setLoanHistoryId(Long loanHistoryId) {
this.loanHistoryId = loanHistoryId;
}
public List<Long> getRepaymentPlanIdList() {
return repaymentPlanIdList;
}
public void setRepaymentPlanIdList(List<Long> repaymentPlanIdList) {
this.repaymentPlanIdList = repaymentPlanIdList;
}
public Date getRepaymentDate() {
return repaymentDate;
}
public void setRepaymentDate(Date repaymentDate) {
this.repaymentDate = repaymentDate;
}
public String getFlowNo() {
return flowNo;
}
public void setFlowNo(String flowNo) {
this.flowNo = flowNo;
}
public String getContactNo() {
return contactNo;
}
public void setContactNo(String contactNo) {
this.contactNo = contactNo;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getUserIdNo() {
return userIdNo;
}
public void setUserIdNo(String userIdNo) {
this.userIdNo = userIdNo;
}
public BigDecimal getRepayAmount() {
return repayAmount;
}
public void setRepayAmount(BigDecimal repayAmount) {
this.repayAmount = repayAmount;
}
public BigDecimal getReallyRepayAmount() {
return reallyRepayAmount;
}
public void setReallyRepayAmount(BigDecimal reallyRepayAmount) {
this.reallyRepayAmount = reallyRepayAmount;
}
public Integer getDataType() {
return dataType;
}
public void setDataType(Integer dataType) {
this.dataType = dataType;
}
}
package cn.quantgroup.financial.model.huibeicfc;
import cn.quantgroup.financial.constant.HubeiCFCDataType;
import java.io.Serializable;
/**
* Created by WuKong on 2017/1/22. */
public class HuBeiCFCRequest implements Serializable {
private String fileName;
private String fileConent;
//请求时间 格式yyyyMMdd
private String applyDt;
private HubeiCFCDataType hubeiCFCDataType;
/**
* 标识是否需要保存返回数据结果
*/
private Boolean isSaveRepData;
public static HuBeiCFCRequest build(HubeiCFCDataType hubeiCFCDataType,String fileName,String fileConent,String applyDt,Boolean isSaveRepData){
return new HuBeiCFCRequest(fileName,fileConent,applyDt,hubeiCFCDataType,isSaveRepData);
}
public HuBeiCFCRequest(String fileName, String fileConent, String applyDt, HubeiCFCDataType hubeiCFCDataType, Boolean isSaveRepData) {
this.fileName = fileName;
this.fileConent = fileConent;
this.applyDt = applyDt;
this.hubeiCFCDataType = hubeiCFCDataType;
this.isSaveRepData = isSaveRepData;
}
public String getFileName() {
return fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
public String getFileConent() {
return fileConent;
}
public void setFileConent(String fileConent) {
this.fileConent = fileConent;
}
public HubeiCFCDataType getHubeiCFCDataType() {
return hubeiCFCDataType;
}
public void setHubeiCFCDataType(HubeiCFCDataType hubeiCFCDataType) {
this.hubeiCFCDataType = hubeiCFCDataType;
}
public Boolean getSaveRepData() {
return isSaveRepData;
}
public void setSaveRepData(Boolean saveRepData) {
isSaveRepData = saveRepData;
}
public String getApplyDt() {
return applyDt;
}
public void setApplyDt(String applyDt) {
this.applyDt = applyDt;
}
}
package cn.quantgroup.financial.model.huibeicfc;
import java.io.Serializable;
/**
* Created by WuKong on 2017/1/19.
*/
public class HuBeiCFCResponse implements Serializable{
private String ec;
private String em;
private String fileName;
private String fileConent;
//docName id
private Long fileId;
public String getEc() {
return ec;
}
public void setEc(String ec) {
this.ec = ec;
}
public String getEm() {
return em;
}
public void setEm(String em) {
this.em = em;
}
public String getFileName() {
return fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
public String getFileConent() {
return fileConent;
}
public void setFileConent(String fileConent) {
this.fileConent = fileConent;
}
public Long getFileId() {
return fileId;
}
public void setFileId(Long fileId) {
this.fileId = fileId;
}
@Override
public String toString() {
return "HuBeiCFCResponse{" +
"ec='" + ec + '\'' +
", em='" + em + '\'' +
", fileName='" + fileName + '\'' +
", fileConent='" + fileConent + '\'' +
", fileId=" + fileId +
'}';
}
}
package cn.quantgroup.financial.model.huibeicfc;
import cn.quantgroup.financial.constant.SysConstant;
import java.io.Serializable;
import java.util.Date;
public class HuBeiDocName implements Serializable{
private Long id;
private String docName;
private Byte dataType;
private String ecCode;
private String emMsg;
private Byte deleted = SysConstant.DeletedStatus.NO_DELETED;
private Date createTime;
private Date updateTime;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getDocName() {
return docName;
}
public void setDocName(String docName) {
this.docName = docName == null ? null : docName.trim();
}
public Byte getDataType() {
return dataType;
}
public void setDataType(Byte dataType) {
this.dataType = dataType;
}
public Byte getDeleted() {
return deleted;
}
public void setDeleted(Byte deleted) {
this.deleted = deleted;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public String getEcCode() {
return ecCode;
}
public void setEcCode(String ecCode) {
this.ecCode = ecCode;
}
public String getEmMsg() {
return emMsg;
}
public void setEmMsg(String emMsg) {
this.emMsg = emMsg;
}
}
\ No newline at end of file
package cn.quantgroup.financial.model.huibeicfc;
import cn.quantgroup.financial.constant.SysConstant;
import java.io.Serializable;
import java.util.Date;
public class HuBeiHistory implements Serializable{
private Long id;
private String flowNo;
private String contactNo;
private Integer currTermNo;//当前期数
private Long userId;
private String userName;
private String userIdNo;
private Byte userIdType;
private Long docNameId;
private HuBeiJsonBean data;
private Byte dataType;
private Date createTime;
private Date updateTime;
private Date happenTime;
private Byte deleted= SysConstant.DeletedStatus.NO_DELETED;
/**
* 序号 批次
*/
private Byte seqNo;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getFlowNo() {
return flowNo;
}
public void setFlowNo(String flowNo) {
this.flowNo = flowNo == null ? null : flowNo.trim();
}
public String getContactNo() {
return contactNo;
}
public void setContactNo(String contactNo) {
this.contactNo = contactNo == null ? null : contactNo.trim();
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName == null ? null : userName.trim();
}
public String getUserIdNo() {
return userIdNo;
}
public void setUserIdNo(String userIdNo) {
this.userIdNo = userIdNo == null ? null : userIdNo.trim();
}
public Byte getUserIdType() {
return userIdType;
}
public void setUserIdType(Byte userIdType) {
this.userIdType = userIdType;
}
public Long getDocNameId() {
return docNameId;
}
public void setDocNameId(Long docNameId) {
this.docNameId = docNameId;
}
public HuBeiJsonBean getData() {
return data;
}
public void setData(HuBeiJsonBean data) {
this.data = data;
}
public Byte getDataType() {
return dataType;
}
public void setDataType(Byte dataType) {
this.dataType = dataType;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public Byte getDeleted() {
return deleted;
}
public void setDeleted(Byte deleted) {
this.deleted = deleted;
}
public Date getHappenTime() {
return happenTime;
}
public void setHappenTime(Date happenTime) {
this.happenTime = happenTime;
}
public Integer getCurrTermNo() {
return currTermNo;
}
public void setCurrTermNo(Integer currTermNo) {
this.currTermNo = currTermNo;
}
public Byte getSeqNo() {
return seqNo;
}
public void setSeqNo(Byte seqNo) {
this.seqNo = seqNo;
}
}
\ No newline at end of file
package cn.quantgroup.financial.model.huibeicfc;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* Created by WuKong on 2017/1/19.
*/
public class HuBeiJsonBean implements Serializable{
//流水号
private String flowNo;
//合同号
private String contactNo;
//客户名称
private String userName;
//用户证件号
private String userIdNo;
//用户证件类型
private Byte userIdType;
//应扣金额
private BigDecimal repayAmount;
//实扣金额
private BigDecimal reallyRepayAmount;
//交易码
private String tradeCode;
//应还日期 yyyy-MM-dd
private String shouldRepayDate;
//应还本金
private BigDecimal shouldRepayPrincipal;
//应还利息
private BigDecimal shouldRepayInterest;
//应还罚息
private BigDecimal shouldRepayOverdueInterest;
//应还复利
private BigDecimal shouldRepayCompoundInterest;
//应还费用
private BigDecimal shouldRepayTotalFee;
//交易结果
private String tradeMsg;
//还款模式
private String repayType;
//还款日期
private String repayDate;
//主动还款渠道
private String channel;
//本次总计还款金额
private BigDecimal repayTotalAmount;
//缩期期数
private Integer shortenTerm;
//主动还款申请日期
private String applyRepayDate;
public String getShouldRepayDate() {
return shouldRepayDate;
}
public void setShouldRepayDate(String shouldRepayDate) {
this.shouldRepayDate = shouldRepayDate;
}
public BigDecimal getShouldRepayPrincipal() {
return shouldRepayPrincipal;
}
public void setShouldRepayPrincipal(BigDecimal shouldRepayPrincipal) {
this.shouldRepayPrincipal = shouldRepayPrincipal;
}
public BigDecimal getShouldRepayInterest() {
return shouldRepayInterest;
}
public void setShouldRepayInterest(BigDecimal shouldRepayInterest) {
this.shouldRepayInterest = shouldRepayInterest;
}
public BigDecimal getShouldRepayOverdueInterest() {
return shouldRepayOverdueInterest;
}
public void setShouldRepayOverdueInterest(BigDecimal shouldRepayOverdueInterest) {
this.shouldRepayOverdueInterest = shouldRepayOverdueInterest;
}
public BigDecimal getShouldRepayCompoundInterest() {
return shouldRepayCompoundInterest;
}
public void setShouldRepayCompoundInterest(BigDecimal shouldRepayCompoundInterest) {
this.shouldRepayCompoundInterest = shouldRepayCompoundInterest;
}
public BigDecimal getShouldRepayTotalFee() {
return shouldRepayTotalFee;
}
public void setShouldRepayTotalFee(BigDecimal shouldRepayTotalFee) {
this.shouldRepayTotalFee = shouldRepayTotalFee;
}
public String getFlowNo() {
return flowNo;
}
public void setFlowNo(String flowNo) {
this.flowNo = flowNo;
}
public String getContactNo() {
return contactNo;
}
public void setContactNo(String contactNo) {
this.contactNo = contactNo;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getUserIdNo() {
return userIdNo;
}
public void setUserIdNo(String userIdNo) {
this.userIdNo = userIdNo;
}
public Byte getUserIdType() {
return userIdType;
}
public void setUserIdType(Byte userIdType) {
this.userIdType = userIdType;
}
public BigDecimal getRepayAmount() {
return repayAmount;
}
public void setRepayAmount(BigDecimal repayAmount) {
this.repayAmount = repayAmount;
}
public BigDecimal getReallyRepayAmount() {
return reallyRepayAmount;
}
public void setReallyRepayAmount(BigDecimal reallyRepayAmount) {
this.reallyRepayAmount = reallyRepayAmount;
}
public String getTradeCode() {
return tradeCode;
}
public void setTradeCode(String tradeCode) {
this.tradeCode = tradeCode;
}
public String getTradeMsg() {
return tradeMsg;
}
public void setTradeMsg(String tradeMsg) {
this.tradeMsg = tradeMsg;
}
public String getRepayType() {
return repayType;
}
public void setRepayType(String repayType) {
this.repayType = repayType;
}
public String getRepayDate() {
return repayDate;
}
public void setRepayDate(String repayDate) {
this.repayDate = repayDate;
}
public String getChannel() {
return channel;
}
public void setChannel(String channel) {
this.channel = channel;
}
public BigDecimal getRepayTotalAmount() {
return repayTotalAmount;
}
public void setRepayTotalAmount(BigDecimal repayTotalAmount) {
this.repayTotalAmount = repayTotalAmount;
}
public Integer getShortenTerm() {
return shortenTerm;
}
public void setShortenTerm(Integer shortenTerm) {
this.shortenTerm = shortenTerm;
}
public String getApplyRepayDate() {
return applyRepayDate;
}
public void setApplyRepayDate(String applyRepayDate) {
this.applyRepayDate = applyRepayDate;
}
}
......@@ -3,6 +3,7 @@ package cn.quantgroup.financial.scheduler;
import cn.quantgroup.financial.constant.CompensationStatus;
import cn.quantgroup.financial.dao.IPaymentDao;
import cn.quantgroup.financial.service.sys.ICompensationDayService;
import cn.quantgroup.financial.service.sys.IScheduledJudgeService;
import com.alibaba.fastjson.JSON;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -30,32 +31,37 @@ public class CompensationDayScheduler {
@Autowired
IPaymentDao iPaymentDao;
@Autowired
private IScheduledJudgeService scheduledJudgeService;
/**
* Seconds Minutes Hours DayofMonth Month DayofWeek
*/
@Scheduled(cron = "1 0 0 * * ?")
public void handleCompensationDay(){
try {
logger.info("handleCompensationDay start");
Calendar calendar = Calendar.getInstance();
logger.info("current day time ={}",calendar.getTime());
if(compensationDayService.isCompensationDay()){
//代偿日做处理
//查询所有上一个代偿日到现在的数据 判断是否代偿
int year = calendar.get(Calendar.YEAR);
//1-12
int month = calendar.get(Calendar.MONTH)+1;
Date compensationDate = compensationDayService.getCompensationDay(year,month);
List<Long> idList = iPaymentDao.getIdListBeforeCompensationDate(compensationDate);
logger.info("compensationDate={}, idList={}", compensationDate,JSON.toJSONString(idList));
Integer row = iPaymentDao.updateBatchCompensationStatusById(idList, CompensationStatus.already_status.get());
logger.info("update row = {}",row);
}else {
logger.info("it is not compensationDay");
if(scheduledJudgeService.isOpenScheduled()){
try {
logger.info("handleCompensationDay start");
Calendar calendar = Calendar.getInstance();
logger.info("current day time ={}",calendar.getTime());
if(compensationDayService.isCompensationDay()){
//代偿日做处理
//查询所有上一个代偿日到现在的数据 判断是否代偿
int year = calendar.get(Calendar.YEAR);
//1-12
int month = calendar.get(Calendar.MONTH)+1;
Date compensationDate = compensationDayService.getCompensationDay(year,month);
List<Long> idList = iPaymentDao.getIdListBeforeCompensationDate(compensationDate);
logger.info("compensationDate={}, idList={}", compensationDate,JSON.toJSONString(idList));
Integer row = iPaymentDao.updateBatchCompensationStatusById(idList, CompensationStatus.already_status.get());
logger.info("update row = {}",row);
}else {
logger.info("it is not compensationDay");
}
logger.info("handleCompensationDay end");
} catch (Exception e) {
logger.error(e.getMessage(),e);
}
logger.info("handleCompensationDay end");
} catch (Exception e) {
logger.error(e.getMessage(),e);
}
}
}
package cn.quantgroup.financial.scheduler;
import cn.quantgroup.financial.constant.HubeiCFCDataType;
import cn.quantgroup.financial.constant.HubeiCFCField;
import cn.quantgroup.financial.model.huibeicfc.HuBeiCFCResponse;
import cn.quantgroup.financial.service.IHuBeiService;
import cn.quantgroup.financial.service.sys.IScheduledJudgeService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
/**
* 湖北每天的送盘文件每日定时任务
* Created by WuKong on 2017/2/3.
*/
@Lazy(false)
@Component
public class HuBeiSendDiscScheduler {
private static final Logger logger = LoggerFactory.getLogger(HuBeiSendDiscScheduler.class);
@Autowired
private IHuBeiService iHuBeiService;
@Autowired
private IScheduledJudgeService scheduledJudgeService;
/**
* Seconds Minutes Hours DayofMonth Month DayofWeek
*/
@Scheduled(cron = "0 0 8 * * ?")
public void dayScheduler(){
if(scheduledJudgeService.isOpenScheduled()){
try {
logger.info("sendDisc HuBeiDayScheduler start ");
//送盘文件
HuBeiCFCResponse response = iHuBeiService.handleDiscData(HubeiCFCDataType.SEND_DEBIT,null,null,null);
if(response!=null&& HubeiCFCField.EC_SUCCESS_CODE.equals(response.getEc())){
logger.info("get sendDisc response success");
}else {
if(response==null){
iHuBeiService.sendErrorMailNotice("没有成功获取到送盘文件,响应为null");
}else {
iHuBeiService.sendErrorMailNotice("没有成功获取到送盘文件,错误码="+response.getEc()+"|错误信息="+response.getEm());
}
logger.info("response is null or don`t return result={}",response);
}
} catch (Exception e) {
iHuBeiService.sendErrorMailNotice(e.getMessage());
logger.error(e.getMessage(),e);
}
}
}
}
......@@ -15,6 +15,7 @@ public interface IApiCommonService {
List<RepaymentPlanStatus> getRepaymentPlanStatus(Long loanHistoryId, Long repaymentPlanId) throws ArgsInvaildException;
Integer savePaymentDetailAndRepaymentPlan(PaymentDetail paymentDetail) throws FieldInsufficientException;
void queryData(Long loanHistoryId, Long repaymentPlanId);
PaymentDetail queryData(Long loanHistoryId, Long repaymentPlanId);
Integer updateBatchStatus(Date beforeDate, Byte compensationStatus);
Integer updateMerchantContractNo(String contractNo,Long loanHistoryId);
}
package cn.quantgroup.financial.service;
import cn.quantgroup.financial.constant.HubeiCFCDataType;
import cn.quantgroup.financial.exception.RequestException;
import cn.quantgroup.financial.model.huibeicfc.HuBeiCFCRequest;
import cn.quantgroup.financial.model.huibeicfc.HuBeiCFCResponse;
import cn.quantgroup.financial.model.huibeicfc.HuBeiDocName;
import cn.quantgroup.financial.model.huibeicfc.HuBeiHistory;
import org.dom4j.DocumentException;
import org.springframework.scheduling.annotation.Async;
import org.xml.sax.SAXException;
import javax.activation.DataSource;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.TransformerException;
import java.io.File;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;
/**
* Created by WuKong on 2017/1/19.
*/
public interface IHuBeiService {
HuBeiCFCResponse handleDiscData(HubeiCFCDataType hubeiCFCDataType,String docName,Long docId,Byte seqNo);
/**
* 时间当做参数接收 方便联调
* @param hubeiCFCDataType
* @param docName
* @param docId
* @param applyDt
* @return
*/
HuBeiCFCResponse handleDiscData(HubeiCFCDataType hubeiCFCDataType,String docName,Long docId,Byte seqNo,String applyDt);
/**
* 通过送盘文件 获取回盘数据
* @param huBeiDocName
* @return
*/
List<HuBeiHistory> getReturnDisc(HuBeiDocName huBeiDocName);
/**
* 异常邮件通知
* @param messageString
*/
@Async
void sendErrorMailNotice(String messageString);
@Async
void sendErrorMailNotice(List<HuBeiHistory> huBeiHistoryList, String noticeMessage);
/**
* 每日附件发送
* @param hubeiCFCDataType
* @param attachedBytes
*/
void sendMailAttachment(HubeiCFCDataType hubeiCFCDataType, ArrayList<File> attachedBytes);
/**
*
* @param attachedBytes
* @param toUserArray
*/
void sendErrorMailAttachment(ArrayList<File> attachedBytes, String[] toUserArray, String text, String subject);
HuBeiDocName generateHuBeiDoc(HubeiCFCDataType hubeiCFCDataType,Byte seqNo);
}
package cn.quantgroup.financial.service.impl;
import cn.quantgroup.financial.constant.CompensationStatus;
import cn.quantgroup.financial.constant.EncodingConfig;
import cn.quantgroup.financial.constant.HubeiCFCField;
import cn.quantgroup.financial.dao.IPaymentDao;
import cn.quantgroup.financial.exception.ArgsInvaildException;
import cn.quantgroup.financial.exception.FieldInsufficientException;
import cn.quantgroup.financial.model.PaymentDetail;
import cn.quantgroup.financial.model.RepaymentPlanDetail;
import cn.quantgroup.financial.model.RepaymentPlanStatus;
import cn.quantgroup.financial.model.XyqbResult;
import cn.quantgroup.financial.model.*;
import cn.quantgroup.financial.model.huibeicfc.HuBeiCFCResponse;
import cn.quantgroup.financial.service.IApiCommonService;
import cn.quantgroup.financial.service.http.IHttpService;
import cn.quantgroup.financial.service.sys.ICompensationDayService;
import cn.quantgroup.financial.util.CheckUtil;
import cn.quantgroup.financial.util.*;
import com.alibaba.fastjson.JSON;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -20,8 +21,11 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.io.ByteArrayInputStream;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Created by WuKong on 2017/1/6.
......@@ -42,6 +46,8 @@ public class ApiCommonServiceImpl implements IApiCommonService {
@Value("${rapi.xyqb.plans}")
private String queryPlansUrl;
@Override
public List<RepaymentPlanStatus> getRepaymentPlanStatus(Long loanHistoryId, Long repaymentPlanId) throws ArgsInvaildException {
return iPaymentDao.getRepaymentPlanStatus(loanHistoryId,repaymentPlanId);
......@@ -73,27 +79,33 @@ public class ApiCommonServiceImpl implements IApiCommonService {
}
@Override
public void queryData(Long loanHistoryId, Long repaymentPlanId){
public PaymentDetail queryData(Long loanHistoryId, Long repaymentPlanId){
logger.info("queryDate loanHistoryId={},repaymentPlanId={}",loanHistoryId,repaymentPlanId);
if(loanHistoryId!=null){
String response = httpService.get(queryPlansUrl+"?loanId="+loanHistoryId);
if(!StringUtils.isEmpty(response)){
logger.info("response={}",response);
XyqbResult jsonResult = JSON.parseObject(response, XyqbResult.class);
if(jsonResult!=null&&jsonResult.getSuccess()!=null&&jsonResult.getSuccess()){
PaymentDetail paymentDetail = (PaymentDetail)jsonResult.getData();
try {
savePaymentDetailAndRepaymentPlan(paymentDetail);
} catch (FieldInsufficientException e) {
logger.error(e.getMessage(),e);
try {
if(loanHistoryId!=null){
String response = httpService.get(queryPlansUrl+"?loanId="+loanHistoryId);
if(!StringUtils.isEmpty(response)){
logger.info("response={}",response);
XyqbResult jsonResult = JSON.parseObject(response, XyqbResult.class);
if(jsonResult!=null&&jsonResult.getSuccess()!=null&&jsonResult.getSuccess()){
PaymentDetail paymentDetail = (PaymentDetail)jsonResult.getData();
try {
savePaymentDetailAndRepaymentPlan(paymentDetail);
} catch (FieldInsufficientException e) {
logger.error(e.getMessage(),e);
}
return paymentDetail;
}else {
logger.info("result is not success");
}
}else {
logger.info("result is not success");
logger.info("response is empty");
}
}else {
logger.info("response is empty");
}
} catch (Exception e) {
logger.error(e.getMessage(),e);
}
return null;
}
......@@ -102,4 +114,12 @@ public class ApiCommonServiceImpl implements IApiCommonService {
return iPaymentDao.updateBatchCompensationStatusBeforeDate(beforeDate,compensationStatus);
}
@Override
public Integer updateMerchantContractNo(String contractNo, Long loanHistoryId) {
if(StringUtils.isEmpty(contractNo)||loanHistoryId==null){
return 0;
}
return iPaymentDao.updateMerchantContractNo(contractNo,loanHistoryId);
}
}
package cn.quantgroup.financial.service.sys;
import java.util.Calendar;
import java.util.Date;
/**
......@@ -14,6 +15,9 @@ public interface ICompensationDayService {
*/
boolean isCompensationDay();
boolean isCompensationDay(Calendar calendar);
/**
* 通过月查询代偿日
* @param month 1-12
......
package cn.quantgroup.financial.service.sys;
import cn.quantgroup.financial.model.MailInfo;
import cn.quantgroup.sms.IMailSendCallback;
import cn.quantgroup.sms.MailSendBean;
import org.springframework.mail.SimpleMailMessage;
import javax.activation.DataSource;
import java.io.File;
import java.util.ArrayList;
public interface IMailService {
void sendAttachmentMailAsync(String from, String[] sendTo, String[] ccTo, String subject, String text,
ArrayList<String> attachedFileList, IMailSendCallback mailSendCallback);
void sendAttachmentMailAsync(String from, String sendTo, String[] ccTo, String subject, String text, ArrayList<File> attachedFileList, IMailSendCallback mailSendCallback);
void sendMailAsync(MailSendBean mailSendBean, IMailSendCallback... callbacks);
DataSource getDataSource(String content,String fileName);
Long saveMailInfo(MailInfo mailInfo);
File createAttachMailFile(String fileContent, String fileName);
}
package cn.quantgroup.financial.service.sys;
/**
* Created by WuKong on 2017/2/16.
*/
public interface IScheduledJudgeService {
/**
* 判断是否开启定时任务
* @return
*/
Boolean isOpenScheduled();
/**
* 判断是否开启湖北请求
* @return
*/
Boolean isOpenHuBeiRequest();
}
......@@ -44,6 +44,16 @@ public class CompensationDayServiceImpl implements ICompensationDayService {
return compensationDayBean.isCompensationDay(calendar);
}
@Override
public boolean isCompensationDay(Calendar calendar) {
int year = calendar.get(Calendar.YEAR);
CompensationDayBean compensationDayBean = compensationDayBeanMap.get("y" + year);
if(compensationDayBean==null){
LOGGER.error("can`t find year={} compensation days information",year);
return false;
}
return compensationDayBean.isCompensationDay(calendar);
}
/**
* 通过月查询代偿日
* @param month 1-12
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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