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

Merge branch 'develop' of http://gitabc.xyqb.com/bo.wang/finance-api into develop

parents 26ed7be9 428d760c
......@@ -238,9 +238,6 @@
<resource>
<directory>${project.basedir}/src/main/resources</directory>
</resource>
<resource>
<directory>${project.build.directory}/target/classes</directory>
</resource>
</resources>
<plugins>
<plugin>
......
......@@ -11,15 +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
@PropertySource({"classpath:application.properties"})
@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();
/**
* 决定使用哪个数据源
......
......@@ -40,7 +40,7 @@ public class MyBatisConfig {
@Bean
public DataSource apiDBDataSource() throws Exception {
try {
logger.error("api jdbc url={}",env.getProperty("api.jdbc.url"));
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"));
......@@ -48,6 +48,8 @@ public class MyBatisConfig {
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);
......@@ -58,7 +60,7 @@ public class MyBatisConfig {
@Bean
public DataSource systemDBDataSource() throws Exception {
try {
logger.error("system jdbc url={}",env.getProperty("system.jdbc.url"));
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"));
......@@ -66,6 +68,8 @@ public class MyBatisConfig {
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);
......
......@@ -6,7 +6,7 @@ package cn.quantgroup.financial.constant;
*/
public enum FundCorpType {
HuBeiCFC(290l,"湖北消金");
HuBeiCFC(290L,"湖北消金");
private Long id;
private String name;
......
......@@ -25,4 +25,5 @@ public enum HubeiCFCDataType {
public String getFlag(){
return flag;
}
}
......@@ -73,23 +73,57 @@ public class HubeiCFCField {
*/
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 = "1111";
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);
}
};
/**
* 还款模式
......@@ -117,4 +151,7 @@ public class HubeiCFCField {
public static class EcCode {
public static final String defaultCode = "-1";
}
public static Integer thirtyMintes = 30;
public static Integer tenMinutes = 10;
}
......@@ -10,6 +10,14 @@ public class SysConstant {
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;//湖北每日送盘对账文件
}
/**
* 还款状态
*/
......
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;
......@@ -14,6 +15,7 @@ public interface IHuBeiCFCDao {
void saveHistoryAndDocName(HuBeiHistory history,HuBeiDocName docName);
Long saveHistory(HuBeiHistory huBeiHistory);
Long saveDocName(HuBeiDocName huBeiDocName);
HuBeiDocName getDocNameById(Long docId);
/**
* 通过 happenTime时间范围查询
......@@ -24,5 +26,34 @@ public interface IHuBeiCFCDao {
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);
}
......@@ -57,6 +57,7 @@ public interface IPaymentDao {
* @return
*/
List<PaymentDetail> getListByMerchantContractNo(List<String> contractNoList);
PaymentDetail getByLoanId(Long loanHistoryId);
/**
*
......@@ -76,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;
......@@ -8,6 +10,7 @@ import java.util.List;
/**
* Created by WuKong on 2017/1/23.
*/
@DataSourceConfig(DataBaseType.System_DB)
public interface IRepayRecordDao {
/**
* 通过还款时间间隔以及资金方id查询 还款信息
......@@ -19,4 +22,13 @@ public interface IRepayRecordDao {
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);
}
......@@ -4,16 +4,21 @@ 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;
......@@ -33,7 +38,10 @@ public class HuBeiCFCDaoImpl implements IHuBeiCFCDao {
@Autowired
PaymentDetailMapper paymentDetailMapper;
@Transactional
@Autowired
MailInfoMapper mailInfoMapper;
@Transactional(rollbackFor=Exception.class)
@Override
public void saveHistoryAndDocName(HuBeiHistory history,HuBeiDocName docName){
saveDocName(docName);
......@@ -47,6 +55,11 @@ public class HuBeiCFCDaoImpl implements IHuBeiCFCDao {
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());
......@@ -55,16 +68,37 @@ public class HuBeiCFCDaoImpl implements IHuBeiCFCDao {
@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());
}
@Transactional
/**
* 根据日期和类型查询同一天最近的文件
* @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());
......@@ -72,7 +106,15 @@ public class HuBeiCFCDaoImpl implements IHuBeiCFCDao {
return huBeiHistory.getId();
}
@Transactional
@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());
......@@ -81,8 +123,27 @@ public class HuBeiCFCDaoImpl implements IHuBeiCFCDao {
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);
}
}
......@@ -15,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;
......@@ -52,13 +53,21 @@ public class PaymentDaoImpl implements IPaymentDao {
@Override
public List<RepaymentPlanDetail> getRepaymentPlanListByLoanIds(List<Long> loanHistoryIdList){
if(CollectionUtils.isEmpty(loanHistoryIdList)){
return null;
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);
}
......@@ -152,4 +161,9 @@ public class PaymentDaoImpl implements IPaymentDao {
Integer row = repaymentPlanDetailMapper.updateBatchCompensationStatusBeforeDate(beforeDate,compensationStatus);
return row;
}
@Override
public Integer updateMerchantContractNo(String contractNo,Long loanHistoryId){
return paymentDetailMapper.updateMerchantContractNoByLoanHistoryId(contractNo,loanHistoryId);
}
}
......@@ -6,11 +6,13 @@ 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;
......@@ -43,6 +45,26 @@ public class RepayRecordDaoImpl implements IRepayRecordDao {
@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);
}
}
......@@ -53,7 +53,8 @@ public class ReturnAdvanceHandler implements HubeiContentHandler {
.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("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())
......
......@@ -6,6 +6,7 @@ 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;
......@@ -32,6 +33,16 @@ public class SendDebitHandler implements HubeiContentHandler {
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;
}
......@@ -48,7 +59,13 @@ public class SendDebitHandler implements HubeiContentHandler {
.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().getTradeCode()).toString();
.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.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,19 @@ 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");
}
}
}
......@@ -11,10 +11,18 @@ public interface HuBeiDocNameMapper {
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);
......
......@@ -14,6 +14,15 @@ public interface HuBeiHistoryMapper {
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);
......@@ -21,4 +30,6 @@ public interface HuBeiHistoryMapper {
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
......@@ -15,6 +15,7 @@ public interface PaymentDetailMapper {
PaymentDetail getByLoanHistoryId(@Param("loanHistoryId") Long loanHistoryId);
int insertSelective(PaymentDetail record);
int updateMerchantContractNoByLoanHistoryId(@Param("contractNo") String contractNo,@Param("loanHistoryId") Long loanHistoryId);
PaymentDetail selectByPrimaryKey(Long id);
......
......@@ -22,4 +22,15 @@ public interface RepayXyqbDetailMapper {
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
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
......@@ -10,6 +10,8 @@ public class HuBeiCFCResponse implements Serializable{
private String em;
private String fileName;
private String fileConent;
//docName id
private Long fileId;
public String getEc() {
return ec;
......@@ -42,4 +44,23 @@ public class HuBeiCFCResponse implements Serializable{
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 +
'}';
}
}
......@@ -36,6 +36,11 @@ public class HuBeiHistory implements Serializable{
private Byte deleted= SysConstant.DeletedStatus.NO_DELETED;
/**
* 序号 批次
*/
private Byte seqNo;
public Long getId() {
return id;
}
......@@ -155,4 +160,12 @@ public class HuBeiHistory implements Serializable{
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
......@@ -31,6 +31,23 @@ public class HuBeiJsonBean implements Serializable{
//交易码
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;
......@@ -50,6 +67,54 @@ public class HuBeiJsonBean implements Serializable{
//主动还款申请日期
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;
}
......
......@@ -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);
}
......@@ -4,18 +4,66 @@ 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.IOException;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;
/**
* Created by WuKong on 2017/1/19.
*/
public interface IHuBeiService {
void handleDiscData(HubeiCFCDataType hubeiCFCDataType,String docName);
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<DataSource> attachedBytes);
/**
*
* @param attachedBytes
* @param toUserArray
*/
void sendErrorMailAttachment(ArrayList<DataSource> attachedBytes, String[] toUserArray, String text, String subject);
HuBeiDocName generateHuBeiDoc(HubeiCFCDataType hubeiCFCDataType,Byte seqNo);
}
......@@ -79,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;
}
......@@ -108,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;
public interface IMailSendCallback {
default void doWhenMailSendComplete(Throwable e) {
if (e != null) {
onError(e);
} else {
onSuccess();
}
}
default void onError(Throwable e) {
}
default void onSuccess() {
}
}
package cn.quantgroup.financial.service.sys;
import cn.quantgroup.financial.model.MailInfo;
import org.springframework.mail.MailException;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.MimeMessagePreparator;
import javax.activation.DataSource;
import javax.mail.internet.MimeMessage;
import java.io.InputStream;
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<String> attachedFileList, IMailSendCallback mailSendCallback);
void sendAttachmentMailWithBytesAsync(String from,String sendTo,String ccTo,String subject,String text,
ArrayList<DataSource> attachedBytes ,IMailSendCallback mailSendCallback);
void sendAttachmentMailWithBytesAsync(String from,String[] sendTo,String[] ccTo,String subject,String text,
ArrayList<DataSource> attachedBytes ,IMailSendCallback mailSendCallback);
void sendSimpleMailAsync(String from, String sendTo, String ccTo, String subject, String text);
void sendSimpleMailAsync(String from, String[] sendTo, String[] ccTo, String subject, String text);
void sendMailAsync(SimpleMailMessage[] simpleMailMessages, IMailSendCallback... callbacks);
void sendMailAsync(SimpleMailMessage simpleMailMessage, IMailSendCallback... callbacks);
void sendMailAsync(MimeMessage mimeMessage, IMailSendCallback... callbacks);
void sendMailAsync(MimeMessage[] mimeMessages, IMailSendCallback... callbacks);
void sendMailAsync(MimeMessagePreparator message, IMailSendCallback... callbacks);
void sendMailAsync(MimeMessagePreparator[] messages, IMailSendCallback... callbacks);
void sendMail(SimpleMailMessage... simpleMailMessages);
void sendMail(SimpleMailMessage simpleMailMessage);
void sendMail(MimeMessage mimeMessage);
void sendMail(MimeMessage... mimeMessages);
void sendMail(MimeMessagePreparator message);
void sendMail(MimeMessagePreparator... messages);
void sendSimpleMail(SimpleMailMessage message);
void sendMailQuietly(SimpleMailMessage... simpleMailMessages);
void sendMailQuietly(SimpleMailMessage simpleMailMessage);
void sendMailQuietly(MimeMessage mimeMessage);
void sendMailQuietly(MimeMessage... mimeMessages);
void sendMailQuietly(MimeMessagePreparator message);
void sendMailQuietly(MimeMessagePreparator... messages);
MimeMessage createMimeMessage();
MimeMessage createMimeMessage(InputStream var1) throws MailException;
DataSource getDataSource(String content,String fileName);
Long saveMailInfo(MailInfo mailInfo);
Integer deleteMailInfo(Long id);
}
package cn.quantgroup.financial.service.sys;
/**
* Created by WuKong on 2017/2/16.
*/
public interface IScheduledJudgeService {
/**
* 判断是否开启定时任务
* @return
*/
Boolean isOpenScheduled();
}
......@@ -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
......
package cn.quantgroup.financial.service.sys.impl;
import cn.quantgroup.financial.constant.SysConstant;
import cn.quantgroup.financial.service.sys.IScheduledJudgeService;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
/**
* Created by WuKong on 2017/2/16.
*/
@Service
public class ScheduledJudgeServiceImpl implements IScheduledJudgeService {
@Value("scheduled_trigger")
private String scheduled_trigger_name;
private static Logger logger = LoggerFactory.getLogger(ScheduledJudgeServiceImpl.class);
/**
* 判断是否开启定时任务
* @return
*/
@Override
public Boolean isOpenScheduled(){
try {
String trigger = System.getenv(scheduled_trigger_name);
if(StringUtils.isEmpty(trigger)){
trigger = System.getProperty(scheduled_trigger_name);
}
logger.info("trigger name={}, value={}",scheduled_trigger_name,trigger);
if(!StringUtils.isEmpty(trigger)&&"2".equals(trigger)){
return false;
}
} catch (Exception e) {
logger.error(e.getMessage());
}
return true;
}
}
package cn.quantgroup.financial.service.thread;
import java.util.concurrent.Callable;
import java.util.concurrent.RejectedExecutionException;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
/**
* Created by WuKong on 2017/2/13.
*/
public interface IApiScheduledExecutorService {
ScheduledFuture<?> schedule(Runnable command,
long delay, TimeUnit unit);
<V> ScheduledFuture<V> schedule(Callable<V> callable,
long delay, TimeUnit unit);
}
package cn.quantgroup.financial.service.thread.impl;
import cn.quantgroup.financial.service.thread.IApiScheduledExecutorService;
import org.springframework.stereotype.Service;
import java.util.concurrent.*;
/**
* Created by WuKong on 2017/2/13.
*/
@Service
public class ApiScheduledExecutorServiceImpl implements IApiScheduledExecutorService {
ScheduledExecutorService scheduledThreadPool = Executors.newScheduledThreadPool(15);
@Override
public ScheduledFuture<?> schedule(Runnable command, long delay, TimeUnit unit) {
return scheduledThreadPool.schedule(command,delay,unit);
}
@Override
public <V> ScheduledFuture<V> schedule(Callable<V> callable, long delay, TimeUnit unit) {
return scheduledThreadPool.schedule(callable,delay,unit);
}
}
......@@ -19,6 +19,8 @@ import javax.xml.transform.TransformerException;
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
......@@ -43,13 +45,47 @@ public class HubeiCFCUtil {
HuBeiHistory huBeiHistory = new HuBeiHistory();
huBeiHistory.setFlowNo(history.getFlowNo());
huBeiHistory.setContactNo(history.getContactNo());
huBeiHistory.setCurrTermNo(huBeiHistory.getCurrTermNo());
huBeiHistory.setUserIdType(huBeiHistory.getUserIdType());
huBeiHistory.setUserId(huBeiHistory.getUserId());
huBeiHistory.setUserName(huBeiHistory.getUserName());
huBeiHistory.setCurrTermNo(history.getCurrTermNo());
huBeiHistory.setUserIdType(history.getUserIdType());
huBeiHistory.setUserIdNo(history.getUserIdNo());
huBeiHistory.setUserId(history.getUserId());
huBeiHistory.setUserName(history.getUserName());
huBeiHistory.setHappenTime(new Date());
return huBeiHistory;
}
/**
* 计算逾期费
* @param deadline
* @param principal
* @return
*/
public static BigDecimal caculateOverDueFee(Date deadline,Date repayDate,BigDecimal principal){
int overdueDays = caculateDays(deadline,repayDate);
if(overdueDays<=3){
//小于等于3天没有湖北罚息
return BigDecimal.ZERO;
}
BigDecimal overDueFee = principal.multiply(BigDecimal.valueOf(overdueDays)).multiply(new BigDecimal("0.1401"));
overDueFee = overDueFee.divide(BigDecimal.valueOf(360),6, RoundingMode.HALF_UP);
return overDueFee;
}
/*
* 计算今天到过去某一天的总共天数
*/
public static int caculateDays(Date compareDay,Date repayDate) {
long todayMilliseconds = repayDate.getTime();
long compareMilliseconds = compareDay.getTime();
// 获得两个日期之间的毫秒差。
long differenceMilliseconds = todayMilliseconds - compareMilliseconds;
// 一天的毫秒数
long oneDayMilliseconds = 86400000;
// 除以一天的毫秒数,就是相差的天数。
int result = (int) (differenceMilliseconds / oneDayMilliseconds);
return result;
}
/**
* 解析证件号类型 内部用
* @param idType
......@@ -122,22 +158,38 @@ public class HubeiCFCUtil {
return document.asXML();
}
/**
* 构建文件名
* @param hubeiCFCDataType
* 每天还款信息要查询的范围
* @return
*/
public static String getDocName(HubeiCFCDataType hubeiCFCDataType){
public static Date[] getDateScope(){
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.MILLISECOND,0);
calendar.set(Calendar.SECOND,0);
calendar.set(Calendar.MINUTE,0);
calendar.set(Calendar.HOUR_OF_DAY,0);
calendar.set(Calendar.DATE,calendar.get(Calendar.DATE) - 1);
Date gtDate = calendar.getTime();
calendar.set(Calendar.DATE,calendar.get(Calendar.DATE) + 1);
Date ltDate = calendar.getTime();
Date[] dates = new Date[]{gtDate,ltDate};
return dates;
}
public static String getDocName(HubeiCFCDataType hubeiCFCDataType,Byte seqNo){
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.DATE,calendar.get(Calendar.DATE)-1);
int hour = calendar.get(Calendar.HOUR);
int minute = calendar.get(Calendar.MINUTE);
//yyyyMMdd DateUtil.sampleDateFormatFormat(calendar.getTime())
//20170222
String docName = new StringBuilder(DateUtil.sampleDateFormatFormat(calendar.getTime()))
.append("_").append(HubeiCFCField.chanel_9009)
.append("_").append(HubeiCFCField.fileAlias.get(hubeiCFCDataType)).append(hour).append(minute).toString();
.append("_").append(HubeiCFCField.fileAlias.get(hubeiCFCDataType)).append(StringFormat.format0Right(seqNo,2)).append(".txt").toString();
return docName;
}
/**
* 解析返回的数据
* @param inputStream
......@@ -163,7 +215,9 @@ public class HubeiCFCUtil {
logger.info("file name={}",fileName);
Element picUploadFileElement = respElement.element(HubeiCFCField.picUploadFile);
String fileContent = picUploadFileElement==null?null:picUploadFileElement.getText();
logger.info("file content={} ",fileContent);
if(logger.isDebugEnabled()){
logger.info("file content={} ",fileContent);
}
response.setFileName(fileName);
response.setFileConent(fileContent);
}
......
......@@ -12,4 +12,8 @@ public class NumberUtils {
public static BigDecimal getNotNull(String number){
return StringUtils.isEmpty(number)?BigDecimal.ZERO:new BigDecimal(number);
}
public static String getNotNullToString(BigDecimal number){
return number==null?BigDecimal.ZERO.toString():number.toString();
}
}
\ No newline at end of file
package cn.quantgroup.financial.util;
/**
* Created by WuKong on 2017/2/13.
*/
public class StringFormat {
/**
* 格式化输出 字符串
* [*]左对齐,右补空格
*
* @param str
* @param min_length : 最小输出长度
* @return
*/
public static String formatLeftS(String str, int min_length) {
String format = "%-" + (min_length < 1 ? 1 : min_length) + "s";
return String.format(format, str);
}
/**
* 格式化输出 整数
* [*]右对齐,左补0
*
* @param num
* @param min_length : 最小输出长度
* @return
*/
public static String format0Right(long num, int min_length) {
String format = "%0" + (min_length < 1 ? 1 : min_length) + "d";
return String.format(format, num);
}
/**
* 格式化输出 浮点数
* [*]右对齐,左补0
*
* @param d
* @param min_length : 最小输出长度
* @param precision : 小数点后保留位数
* @return
*/
public static String format0Right(double d, int min_length, int precision) {
String format = "%0" + (min_length < 1 ? 1 : min_length) + "."
+ (precision < 0 ? 0 : precision) + "f";
return String.format(format, d);
}
public static void main(String[] args) {
System.out.println(format0Right(1L,2));
}
}
......@@ -4,13 +4,14 @@ server.session-timeout=5184000
compensationday.file.path=compensation-days.json
rapi.xyqb.plans=http://192.168.4.6:7005/external/hubei/plans
#测试环境 湖北消金通信接口
thirdparty.api.hubei=http://116.211.134.215/Gateway/servlet/OutsiteReqServlet
#thirdparty.api.hubei=http://116.211.134.215/Gateway/servlet/OutsiteReqServlet
thirdparty.api.hubei=http://127.0.0.1/Gateway/servlet/OutsiteReqServlet
api.jdbc.driverClassName=com.mysql.jdbc.Driver
api.jdbc.url=jdbc:mysql://127.0.0.1:3306/financial_system_api?useUnicode=true&characterEncoding=UTF8
api.jdbc.username=root
api.jdbc.password=root
api.jdbc.maxActive=200
api.jdbc.maxActive=500
api.jdbc.minIdle=20
system.jdbc.driverClassName=com.mysql.jdbc.Driver
......@@ -24,5 +25,13 @@ mybatis.typeAliasesPackage=cn.quantgroup.financial.model
mybatis.mapperLocations=classpath:mapper/*.xml
mybatis.typeHandlersPackage=cn.quantgroup.financial.handler.mybatis
#邮件服务
spring.mail.default-encoding=UTF-8
spring.mail.host=smtp.exmail.qq.com
spring.mail.password=comlkb001
spring.mail.username=fd@quantgroup.cn
spring.mail.properties.mail.smtp.auth=true
spring.mail.properties.mail.smtp.host=smtp.exmail.qq.com
multipart.max-file-size=30Mb
multipart.max-request-size=30Mb
hubei.mail.touser=bo.wang@quantgroup.cn
#存储每次请求响应的日志文件
hubei.history.filepath=E:/hubeitest/
log_dir=quant_group
#定时任务环境变量的名 系统变量为2表示关闭定时任务 其他为开启
scheduled_trigger=scheduled_trigger
\ No newline at end of file
......@@ -3,25 +3,34 @@
server.session-timeout=5184000
compensationday.file.path=compensation-days.json
rapi.xyqb.plans=http://rapi.xyqb.com/external/hubei/plans
#测试环境 湖北消金通信接口
thirdparty.api.hubei=http://116.211.134.215/Gateway/servlet/OutsiteReqServlet
#生产环境 湖北消金通信接口
thirdparty.api.hubei=http://116.211.134.205/Gateway/servlet/OutsiteReqServlet
api.jdbc.driverClassName=com.mysql.jdbc.Driver
api.jdbc.url=jdbc:mysql://financial-dbw.quantgroups.com:3306/financial_system_api?useUnicode=true&characterEncoding=UTF8
api.jdbc.username=finacial_api_w
api.jdbc.password=RwuSld9PcCtkfk48mdOUYnb8xXnNOPIT
api.jdbc.maxActive=200
api.jdbc.maxActive=500
api.jdbc.minIdle=20
system.jdbc.driverClassName=com.mysql.jdbc.Driver
system.jdbc.url=jdbc:mysql://fsdb.xyqb.com:3306/financial_system?useUnicode=true&characterEncoding=UTF8
system.jdbc.username=financial_pro
system.jdbc.password=g26Vd@*CyTKNNf9K
system.jdbc.username=financial_sys_w
system.jdbc.password=ZKsGOU6dqgpXfQ68hqXsDEuZoamZMJj4
system.jdbc.maxActive=200
system.jdbc.minIdle=20
mybatis.typeAliasesPackage=cn.quantgroup.financial.model
mybatis.mapperLocations=classpath:mapper/*.xml
mybatis.typeHandlersPackage=cn.quantgroup.financial.handler.mybatis
#邮件服务
spring.mail.default-encoding=UTF-8
spring.mail.host=smtp.exmail.qq.com
spring.mail.password=comlkb001
spring.mail.username=fd@quantgroup.cn
spring.mail.properties.mail.smtp.auth=true
spring.mail.properties.mail.smtp.host=smtp.exmail.qq.com
multipart.max-file-size=30Mb
multipart.max-request-size=30Mb
......
hubei.mail.touser=bo.wang@quantgroup.cn
#存储每次请求响应的日志文件
hubei.history.filepath=/vpants/hubeifiles/
log_dir=quant_group
#定时任务环境变量的名 系统变量为2表示关闭定时任务 其他为开启
scheduled_trigger=scheduled_trigger
\ No newline at end of file
......@@ -3,25 +3,35 @@
server.session-timeout=5184000
compensationday.file.path=compensation-days.json
rapi.xyqb.plans=http://rapi.xyqb.com/external/hubei/plans
#正式环境 湖北消金通信接口
thirdparty.api.hubei=http://116.211.134.205/Gateway/servlet/OutsiteReqServlet
#测试环境 湖北消金通信接口
thirdparty.api.hubei=http://116.211.134.215/Gateway/servlet/OutsiteReqServlet
#thirdparty.api.hubei=http://127.0.0.1/Gateway/servlet/OutsiteReqServlet
api.jdbc.driverClassName=com.mysql.jdbc.Driver
api.jdbc.url=jdbc:mysql://127.0.0.1:3306/financial_system_api?useUnicode=true&characterEncoding=UTF8
api.jdbc.username=root
api.jdbc.password=quantgroup_api
api.jdbc.maxActive=200
api.jdbc.url=jdbc:mysql://192.168.4.190:3306/financial_system_api?useUnicode=true&characterEncoding=UTF8
api.jdbc.username=financial_user_rw
api.jdbc.password=quant_financial_rw
api.jdbc.maxActive=500
api.jdbc.minIdle=20
system.jdbc.driverClassName=com.mysql.jdbc.Driver
system.jdbc.url=jdbc:mysql://127.0.0.1:3306/financial_system?useUnicode=true&characterEncoding=UTF8
system.jdbc.username=root
system.jdbc.password=quantgroup_api
system.jdbc.url=jdbc:mysql://192.168.4.190:3306/financial_system?useUnicode=true&characterEncoding=UTF8
system.jdbc.username=financial_user_rw
system.jdbc.password=quant_financial_rw
system.jdbc.maxActive=200
system.jdbc.minIdle=20
mybatis.typeAliasesPackage=cn.quantgroup.financial.model
mybatis.mapperLocations=classpath:mapper/*.xml
mybatis.typeHandlersPackage=cn.quantgroup.financial.handler.mybatis
#邮件服务
spring.mail.default-encoding=UTF-8
spring.mail.host=smtp.exmail.qq.com
spring.mail.password=comlkb001
spring.mail.username=fd@quantgroup.cn
spring.mail.properties.mail.smtp.auth=true
spring.mail.properties.mail.smtp.host=smtp.exmail.qq.com
multipart.max-file-size=30Mb
multipart.max-request-size=30Mb
......
hubei.mail.touser=bo.wang@quantgroup.cn
#存储每次请求响应的日志文件
hubei.history.filepath=/home/results/
log_dir=quant_group
#定时任务环境变量的名 系统变量为2表示关闭定时任务 其他为开启
scheduled_trigger=scheduled_trigger
\ No newline at end of file
......@@ -14,7 +14,7 @@
</commentGenerator>
<jdbcConnection driverClass="com.mysql.jdbc.Driver"
connectionURL="jdbc:mysql://127.0.0.1:3306/financial_system" userId="root" password="root">
connectionURL="jdbc:mysql://127.0.0.1:3306/financial_system_api" userId="root" password="root">
</jdbcConnection>
<javaTypeResolver>
......@@ -46,7 +46,7 @@
</javaClientGenerator>
<table tableName="repay_record" domainObjectName="RepayRecord" enableUpdateByExample="false" enableCountByExample="false"
<table tableName="mailinfo" domainObjectName="MailInfo" enableUpdateByExample="false" enableCountByExample="false"
enableDeleteByExample="false" enableSelectByExample="false" >
</table>
</context>
......
......@@ -7,9 +7,9 @@
</appender>
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>/home/${log_dir}/logs/financial_system_api.log</file>
<file>/home/quant_group/logs/${log_name}financial_system_api.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>/home/${log_dir}/logs/financial_system_api.log.%d{yyyy-MM-dd}.bak</fileNamePattern>
<fileNamePattern>/home/quant_group/logs/${log_name}financial_system_api.log.%d{yyyy-MM-dd}.bak</fileNamePattern>
<maxHistory>30</maxHistory>
</rollingPolicy>
<layout class="ch.qos.logback.classic.PatternLayout">
......
......@@ -20,6 +20,18 @@
from hubeidocname
where dataType=#{dataType} AND createTime &gt;= #{queryTime,jdbcType=TIMESTAMP} ORDER BY createTime DESC limit 1;
</select>
<select id="getLastestDocByDataAndType" resultMap="BaseResultMap" parameterType="java.util.Map">
select
<include refid="Base_Column_List" />
from hubeidocname
where dataType=#{dataType} AND TO_DAYS(createTime) = TO_DAYS(#{queryDate,jdbcType=TIMESTAMP}) ORDER BY createTime DESC limit 1;
</select>
<select id="getByDocNameAndType" resultMap="BaseResultMap" parameterType="java.util.Map">
select
<include refid="Base_Column_List" />
from hubeidocname
where dataType=#{dataType} AND docName = #{docName,jdbcType=VARCHAR} limit 1;
</select>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
select
<include refid="Base_Column_List" />
......
......@@ -17,10 +17,11 @@
<result column="updateTime" property="updateTime" jdbcType="TIMESTAMP" />
<result column="happenTime" property="happenTime" jdbcType="TIMESTAMP" />
<result column="deleted" property="deleted" jdbcType="TINYINT" />
<result column="seqNo" property="seqNo" jdbcType="TINYINT" />
</resultMap>
<sql id="Base_Column_List" >
id, flowNo, contactNo, userId, userName, userIdNo, userIdType, docNameId, data, dataType,
createTime, updateTime, deleted, happenTime,currTermNo
createTime, updateTime, deleted, happenTime,currTermNo,seqNo
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
select
......@@ -28,12 +29,33 @@
from hubeihistory
where id = #{id,jdbcType=BIGINT}
</select>
<select id="getFlowByContractNoList" resultMap="BaseResultMap" parameterType="java.util.List">
select
<include refid="Base_Column_List" />
from hubeihistory
where flowNo IS NOT NULL AND contactNo IN
<foreach collection="contractNoList" item="contactNo" separator="," open="(" close=")" index="index">
#{contactNo}
</foreach>
</select>
<select id="getListByDocNameId" resultMap="BaseResultMap" parameterType="java.lang.Long">
select
<include refid="Base_Column_List" />
from hubeihistory
where docNameId = #{docNameId,jdbcType=BIGINT}
</select>
<select id="getListByDocNameIdAndSeqNo" resultMap="BaseResultMap" parameterType="java.util.Map">
select
<include refid="Base_Column_List" />
from hubeihistory
where docNameId = #{docNameId,jdbcType=BIGINT} AND seqNo=#{seqNo,jdbcType=TINYINT}
</select>
<select id="getMaxSeqNoByDocId" parameterType="java.util.Map" resultType="java.lang.Integer">
select
max(seqNo)
from hubeihistory
where docNameId = #{docNameId,jdbcType=BIGINT}
</select>
<select id="getListByTimeScope" parameterType="java.util.Map" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List" />
......@@ -49,12 +71,12 @@
userId, userName, userIdNo,
userIdType, docNameId, data,
dataType, createTime, updateTime,happenTime,
deleted,currTermNo)
deleted,currTermNo,seqNo)
values (#{id,jdbcType=BIGINT}, #{flowNo,jdbcType=VARCHAR}, #{contactNo,jdbcType=VARCHAR},
#{userId,jdbcType=BIGINT}, #{userName,jdbcType=VARCHAR}, #{userIdNo,jdbcType=VARCHAR},
#{userIdType,jdbcType=TINYINT}, #{docNameId,jdbcType=BIGINT}, #{data,jdbcType=VARCHAR ,javaType=cn.quantgroup.financial.model.huibeicfc.HuBeiJsonBean},
#{dataType,jdbcType=TINYINT}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP},#{happenTime,jdbcType=TIMESTAMP}
#{deleted,jdbcType=TINYINT},#{currTermNo,jdbcType=TINYINT})
#{dataType,jdbcType=TINYINT}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP},#{happenTime,jdbcType=TIMESTAMP},
#{deleted,jdbcType=TINYINT},#{currTermNo,jdbcType=TINYINT},#{seqNo,jdbcType=TINYINT})
</insert>
<insert id="insertSelective" parameterType="cn.quantgroup.financial.model.huibeicfc.HuBeiHistory" useGeneratedKeys="true" keyProperty="id">
insert into hubeihistory
......@@ -104,6 +126,9 @@
<if test="currTermNo != null">
currTermNo,
</if>
<if test="seqNo != null">
seqNo,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="id != null" >
......@@ -151,6 +176,9 @@
<if test="currTermNo != null">
#{currTermNo,jdbcType=TINYINT},
</if>
<if test="seqNo != null">
#{seqNo,jdbcTyp=TINYINT},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="cn.quantgroup.financial.model.huibeicfc.HuBeiHistory" >
......@@ -198,6 +226,9 @@
<if test="currTermNo != null">
currTermNo = #{currTermNo,jdbcType=TINYINT},
</if>
<if test="seqNo != null">
seqNo = #{seqNo,jdbcType=TINYINT},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
......@@ -216,7 +247,8 @@
updateTime = #{updateTime,jdbcType=TIMESTAMP},
deleted = #{deleted,jdbcType=TINYINT},
happenTime = #{happenTime,jdbcType=TIMESTAMP},
currTermNo = #{currTermNo,jdbcType=TINYINT}
currTermNo = #{currTermNo,jdbcType=TINYINT},
seqNo = #{seqNo,jdbcType=TINYINT}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="cn.quantgroup.financial.mapper.MailInfoMapper" >
<resultMap id="BaseResultMap" type="cn.quantgroup.financial.model.MailInfo" >
<id column="id" property="id" jdbcType="BIGINT" />
<result column="mail" property="mail" jdbcType="VARCHAR" />
<result column="mailType" property="mailtype" jdbcType="TINYINT" />
<result column="createTime" property="createtime" jdbcType="TIMESTAMP" />
<result column="updateTime" property="updatetime" jdbcType="TIMESTAMP" />
</resultMap>
<sql id="Base_Column_List" >
id, mail, mailType, createTime, updateTime
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
select
<include refid="Base_Column_List" />
from mailinfo
where id = #{id,jdbcType=BIGINT}
</select>
<select id="getByType" resultMap="BaseResultMap" parameterType="java.util.Map">
select
<include refid="Base_Column_List" />
from mailinfo
where mailtype = #{mailtype,jdbcType=TINYINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
delete from mailinfo
where id = #{id,jdbcType=BIGINT}
</delete>
<insert id="insert" parameterType="cn.quantgroup.financial.model.MailInfo" useGeneratedKeys="true" keyProperty="id">
insert into mailinfo (id, mail, mailType,
createTime, updateTime)
values (#{id,jdbcType=BIGINT}, #{mail,jdbcType=VARCHAR}, #{mailtype,jdbcType=TINYINT},
#{createtime,jdbcType=TIMESTAMP}, #{updatetime,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" parameterType="cn.quantgroup.financial.model.MailInfo" >
insert into mailinfo
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="id != null" >
id,
</if>
<if test="mail != null" >
mail,
</if>
<if test="mailtype != null" >
mailType,
</if>
<if test="createtime != null" >
createTime,
</if>
<if test="updatetime != null" >
updateTime,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="id != null" >
#{id,jdbcType=BIGINT},
</if>
<if test="mail != null" >
#{mail,jdbcType=VARCHAR},
</if>
<if test="mailtype != null" >
#{mailtype,jdbcType=TINYINT},
</if>
<if test="createtime != null" >
#{createtime,jdbcType=TIMESTAMP},
</if>
<if test="updatetime != null" >
#{updatetime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="cn.quantgroup.financial.model.MailInfo" >
update mailinfo
<set >
<if test="mail != null" >
mail = #{mail,jdbcType=VARCHAR},
</if>
<if test="mailtype != null" >
mailType = #{mailtype,jdbcType=TINYINT},
</if>
<if test="createtime != null" >
createTime = #{createtime,jdbcType=TIMESTAMP},
</if>
<if test="updatetime != null" >
updateTime = #{updatetime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="cn.quantgroup.financial.model.MailInfo" >
update mailinfo
set mail = #{mail,jdbcType=VARCHAR},
mailType = #{mailtype,jdbcType=TINYINT},
createTime = #{createtime,jdbcType=TIMESTAMP},
updateTime = #{updatetime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>
\ No newline at end of file
......@@ -74,6 +74,9 @@
#{loanCreateAt,jdbcType=TIMESTAMP}, #{contractTotalTerm,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP})
</insert>
<update id="updateMerchantContractNoByLoanHistoryId" parameterType="java.util.Map">
UPDATE paymentdetail SET merchantContractNo=#{contractNo} WHERE loanHistoryId=#{loanHistoryId} LIMIT 1;
</update>
<insert id="insertSelective" parameterType="cn.quantgroup.financial.model.PaymentDetail" useGeneratedKeys="true" keyProperty="id">
insert into paymentdetail
<trim prefix="(" suffix=")" suffixOverrides=",">
......
......@@ -66,11 +66,25 @@
select
<include refid="Base_Column_List" />
from repay_xyqb_detail
where funding_corp_id = #{fundingCorpId,jdbcType=BIGINT} AND
where funding_corp_id = #{fundingCorpId,jdbcType=BIGINT} AND loan_application_history_id IN
<foreach collection="loanHistoryIdList" item="loanHistoryId" index="index" separator="," open="(" close=")">
#{loanHistoryId}
</foreach>
</select>
<select id="getListNotLoanIdBetweenDate" parameterType="java.util.Map" resultMap="ResultMapWithBLOBs">
select
<include refid="Base_Column_List" />
from repay_xyqb_detail
where funding_corp_id = #{fundingCorpId,jdbcType=BIGINT}
<if test="loanHistoryIdList != null and loanHistoryIdList.size()>0">
AND loan_application_history_id NOT IN
<foreach collection="loanHistoryIdList" item="loanHistoryId" index="index" separator="," open="(" close=")">
#{loanHistoryId}
</foreach>
</if>
AND pay_center_repay_at BETWEEN #{gtDate,jdbcType=TIMESTAMP} AND #{ltDate,jdbcType=TIMESTAMP}
ORDER BY loan_application_history_id, curr_term_no ASC
</select>
<select id="getRepayXyqbDetailList" parameterType="java.util.Map" resultMap="ResultMapWithBLOBs">
select
<include refid="Base_Column_List" />
......
......@@ -11,5 +11,8 @@ maven打包 三种选项:
手动指定日志目录文件夹 如:
``` -Dlog_dir=financial_system_api```
指定是否开启定时任务 集群状态下配置 2为不开启 默认都是开启 只开启一台
```-Dscheduled_trigger=2```
启动命令
```SCREEN -Am -S financialapi java -Dfile.encoding=UTF-8 -server -Dserver.port=9010 -Dlog_dir=financial_system_api -Xmx1024m -XX:+UseG1GC -XX:+HeapDumpOnOutOfMemoryError -XX:ErrorFile=/home/test_financial_system_api/jars/gclog/get_data_error.log -XX:HeapDumpPath=/home/test_financial_system_api/jars/gclog/heapdump.hprof -XX:-OmitStackTraceInFastThrow -Xloggc:/home/test_financial_system_api/jars/gclog/jvmgc.log -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCApplicationConcurrentTime -XX:+PrintGCApplicationStoppedTime -Djava.security.egd=file:/dev/./urandom -Djdk.tls.allowUnsafeServerCertChange=true -Dsun.security.ssl.allowUnsafeRenegotiation=true -jar /home/test_financial_system_api/testfinance-api-0.0.1-SNAPSHOT.jar```
\ No newline at end of file
......@@ -161,4 +161,88 @@ CREATE TABLE `fundingrepaymentplan` (
PRIMARY KEY (`id`),
KEY `idx_loanHistoryId` (`loanHistoryId`) USING BTREE,
KEY `idx_planId` (`repaymentPlanId`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
\ No newline at end of file
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
ALTER TABLE `fundingrepaymentplan`
DROP COLUMN `repaymentPlanId`,
DROP INDEX `idx_planId`;
ALTER TABLE `fundingpaymentdetail`
ADD COLUMN `fundingCorpId` bigint(20) NULL COMMENT '资金方id' AFTER `fundingCorpLoanId`;
-----150720
ALTER TABLE `pay_xyqb_detail`
ADD INDEX `idx_loanhistoryid` (`loan_application_history_id`) USING BTREE ,
ADD INDEX `idx_loanmanifest_id` (`loan_application_manifest_history_id`) USING BTREE ;
-----1134943
ALTER TABLE `repay_baitiao_detail`
ADD INDEX `idx_merchant_order_no` (`merchant_order_no`) USING BTREE ,
ADD INDEX `idx_order_id` (`order_id`) USING BTREE ;
----1720020
ALTER TABLE `repay_xyqb_detail`
ADD INDEX `idx_loan_application_manifest_history_id` (`loan_application_manifest_history_id`) USING BTREE ,
ADD INDEX `idx_loan_application_history_id` (`loan_application_history_id`) USING BTREE ;
CREATE TABLE `hubeidocname` (
`id` bigint(20) NOT NULL AUTO_INCREMENT ,
`docName` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL ,
`dataType` tinyint(4) NULL DEFAULT NULL ,
`deleted` tinyint(2) NULL DEFAULT 0 ,
`ecCode` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '请求结果状态码' ,
`emMsg` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '请求结果' ,
`createTime` datetime NULL DEFAULT NULL ,
`updateTime` datetime NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP ,
PRIMARY KEY (`id`),
INDEX `idx_creatTime` (`createTime`) USING BTREE
)
ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8mb4 COLLATE=utf8mb4_general_ci;
CREATE TABLE `hubeihistory` (
`id` bigint(20) NOT NULL AUTO_INCREMENT ,
`flowNo` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '流水号' ,
`contactNo` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '商户合同号' ,
`userId` bigint(20) NULL DEFAULT NULL COMMENT '用户id' ,
`userName` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '客户名' ,
`userIdNo` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '证件号' ,
`userIdType` tinyint(4) NULL DEFAULT NULL COMMENT '证件类型' ,
`docNameId` bigint(20) NULL DEFAULT NULL COMMENT '文件名' ,
`data` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '把传过来的数据存储' ,
`dataType` tinyint(4) NULL DEFAULT NULL COMMENT '数据类型' ,
`currTermNo` tinyint(4) NULL DEFAULT 0 COMMENT '当前期数' ,
`happenTime` datetime NULL DEFAULT NULL COMMENT '操作发生时间' ,
`createTime` datetime NULL DEFAULT NULL COMMENT '创建时间' ,
`updateTime` datetime NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '记录更新时间' ,
`deleted` tinyint(2) NULL DEFAULT 0 COMMENT '删除状态0 正常 1被删除' ,
`seqNo` tinyint(2) NULL DEFAULT 1 ,
PRIMARY KEY (`id`),
INDEX `idx_contactNo` (`contactNo`) USING BTREE ,
INDEX `idx_userId` (`userId`) USING BTREE ,
INDEX `idx_userIdNo` (`userIdNo`) USING BTREE ,
INDEX `idx_happenTime` (`happenTime`) USING BTREE
)
ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8mb4 COLLATE=utf8mb4_general_ci;
CREATE TABLE `mailinfo` (
`id` bigint(20) NOT NULL AUTO_INCREMENT ,
`mail` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL ,
`mailType` tinyint(2) NULL DEFAULT NULL ,
`createTime` datetime NULL DEFAULT NULL ,
`updateTime` datetime NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP ,
PRIMARY KEY (`id`),
INDEX `idx_mail` (`mail`) USING BTREE
)
ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8 COLLATE=utf8_general_ci
AUTO_INCREMENT=3
;
......@@ -18,6 +18,8 @@ import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
......@@ -27,7 +29,7 @@ import java.util.List;
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = BootStarter.class)
@WebAppConfiguration
@ActiveProfiles("local")
@ActiveProfiles("test")
public class ApiCommonServiceTest {
@Autowired
......@@ -108,7 +110,11 @@ public class ApiCommonServiceTest {
@Test
public void testQueryData(){
iApiCommonService.queryData(35636088l,null);
List<Long> loanList = new ArrayList<>(Arrays.asList(32633136L,32633504L,32237770L,33125582L,33126528L,33126870L,31084840L,33127912L,20145793L,33129568L,33130092L,33129446L,33130418L,33250214L,33250888L,33250906L,33250850L,33265960L,33266094L,33266796L,33266682L,33267226L,33249432L,33267754L,33267570L,33266972L,33267902L,33268030L,29867298L,33270350L,33270828L,33266464L,33271306L,33482662L,26931928L,33483488L,10816919L,33115276L,33487826L,33487676L,33488120L,33489440L,33489864L,33489546L,33490170L,33490608L,33490922L,33368040L,33491868L,33493080L,33931620L,33931660L,33933850L,34431958L,34489392L,34493358L,34687078L,34688706L,34688732L,34688962L,34689274L,34684686L,34689730L,34689556L,34686742L,34687372L,23958002L,34690298L,34690576L,34690846L,34691030L,34691422L,34691654L,34691244L,34660512L,34692028L,34692204L,34692288L,34692128L,34692292L,34692854L,34692080L,34014972L,34693444L,34693398L,33216386L,34693166L,34693562L,34693774L,34693948L,34694026L,34694282L,34694034L,34694624L,34694290L,34694662L,34694618L,34695020L,34695578L,34695644L,34695216L,34696006L,34696054L,34695996L,34695154L,34695880L,34696374L,34696522L,34696614L,34696896L,33240240L,34696964L,34697134L,34696712L,34697256L,34697566L,34697858L,35268644L,35293372L,35393774L,35609626L,36575410L,36576290L,36576860L,36572208L,36577032L,36624432L,36625316L,32949658L,36518106L,36625634L,36564606L,36668552L,36696080L,34031028L,36799792L,36800964L,36800972L,36801380L,36801500L,36801344L,36755260L,36803482L,36803588L,36804052L,36869442L,36869900L,36867562L,36870236L,36870500L,36871064L,36871308L,36871422L,36871618L,36871852L,36872732L,36874112L,36874424L,22032478L,36894518L,36910110L,36997088L,36997070L,36629792L,36997648L,36997600L,36998092L,36990890L,36992972L,36999876L,36999990L,37000814L,37016578L,37016626L,37017074L,37017384L,37017552L,37018242L,37018386L,37018750L,36651866L,37034118L,37032792L,37034860L,37034912L,37034574L,37036454L,33238590L,35609246L,37035078L,37036894L,37037362L,37038342L,37105218L,37105320L,37105248L,37105822L,37126462L,37126514L,37126876L,37127166L,37127710L,37128190L,37128376L,37128464L,37233954L,37234848L,37236042L,37236714L,37224598L,17426513L,37232194L,37239294L,37239854L,37239786L,37239484L,37240118L,37240764L,37240942L,37257068L,37245260L,37266356L,37267518L,37274184L,37274428L,37240428L,37274940L,37263232L,37274994L,37307560L,37382084L,37383668L,37382446L,37285570L,37384162L,37383998L,37050414L,37385942L,36666226L,37386820L,37347932L,37387306L,37295294L,37387472L,37387500L,37410015L,37360290L,37410859L,37411037L,37411061L,37411085L,37411431L,37461747L,25770978L,37462727L,37462371L,37462999L,37462631L,37460101L,37463805L,37463847L,37464213L,37464405L,37459987L,37465585L,37465027L,37465977L,37491765L,37453241L,37493225L,37494335L,37495187L,37494727L,37495973L,34268692L,37496177L,37496207L,37495643L,37233842L,37498087L,37498723L,37498831L,37500243L,37595403L,37595715L,37532143L,37596063L,37596227L,37596281L,37596487L,37560547L,37038568L,37597145L,37596597L,37597301L,37598153L,36193818L,37597827L,37625937L,37626911L,37637367L,37637547L,37638291L,37639289L,37639527L,37639851L,35638960L,37566891L,37601137L,37610905L,37613107L,37613393L,37615491L,37625533L,37631033L,37637665L,37639533L,37640661L,37641971L,37642661L,37643267L,37643297L,37644595L,37630553L,37644859L,37151236L,37735493L,37735195L,37736245L,37736597L,37512699L,37672295L,37736907L,37737153L,37735997L,37736935L,37737667L,37738369L,37738425L,37736443L,37737319L,37738713L,37738911L,37738605L,37738705L,37738955L,37739141L,37739289L,37738773L,37739931L,37739899L,37739955L,37740933L,37740877L,37741181L,37740711L,37741245L,37741001L,37740575L,37741465L,37620067L,37741825L,37741737L,37737609L,37741797L,37742173L,37741079L,37742881L,10996907L,37782195L,37794355L,37794961L,37800929L,37803891L,37783025L,37804861L,37804869L,37805107L,37854093L,37853069L,37418955L,37861035L,37441147L,37861759L,36363026L,37862083L,37862471L,37861481L,37868117L,37871581L,37871457L,37912505L,37920913L,37924225L,37920991L,37922799L,37675573L,37924511L,37924435L,37929793L,37860829L,37928703L,37929819L,37930219L,37930675L,37930981L,37931069L,37930595L,37597265L,37931175L,37913511L,37931883L,37932103L,37931569L,37932225L,37933129L,37951749L,37952287L,37952141L,37952269L,37951983L,37952399L,37952447L,37952291L,37951307L,37952709L,37951001L,37952617L,37952195L,37952769L,37953121L,37953157L,36038378L,37953655L,37671585L,37953359L,37952521L,37953867L,37952787L,37954097L,25888154L,37979923L,37981333L,37981663L,34221146L,37983267L,37908171L,37384026L,37985289L,37985857L,37987927L,37987907L,37996397L,37995945L,37997197L,37997675L,37997939L,37998199L,37898531L,37995685L,37998347L,37998821L,37982637L,37999313L,37996319L,37999219L,37999481L,37999599L,38004283L,38007617L,38007795L,38007819L,38008075L,38011943L,38012415L,38041165L,38041251L,38041195L,38041297L,38015857L,38041067L,38068827L,38068107L,38069435L,38068703L,38069369L,38069721L,38069155L,38068547L,38081091L,38081271L,38081445L,38080563L,38079551L,38081399L,38081961L,38082239L,38082243L,38082029L,38082265L,32167242L,38081483L,38082413L,38082673L,38102693L,38101885L,38102579L,38101457L,38102483L,38101435L,38103063L,38100939L,38103903L,38103633L,38104273L,38104511L,38104813L,38104911L,38201071L,38200771L,38201161L,38200859L,38201349L,38201353L,38201299L,38201459L,38201357L,38201507L,38201611L,38201455L,38201909L,38201505L,38201999L,38201703L,37473435L,38201755L,38201931L,38202171L,38202185L,38226967L,38227201L,36843862L,38226555L,38227165L,38226575L,38227433L,38227441L,38227449L,32287860L,38226571L,38226355L,37849645L,38227477L,38226943L,38227911L,38227917L,38225549L,38227841L,38227071L,38227759L,38227679L,38227737L,37638381L,38196555L,38228171L,38227879L,36212074L,38228319L,38228373L,38227877L,38228173L,37587393L,38228469L,38240319L,38239357L,38240241L,38236493L,38240457L,38239305L,38240793L,38238641L,38240383L,38240423L,25421980L,38241319L,38241423L,38240615L,38241413L,38240499L,38241977L,38240689L,38242173L,38241917L,36066020L,22051792L,38243405L,38242841L,38243005L,38243245L,38242717L,38243903L,38244173L,38243937L,38244055L,38244409L,38243745L,38245153L,38245159L,38242857L,38244841L,38245253L,38245039L,38243429L,38254321L,38254915L,38243487L,36945118L,38254949L,38255283L,38253895L,38255125L,36528954L,38255267L,37204866L,38255303L,38104893L,38255355L,38255029L,38255493L,38255223L,38245023L,38125625L,38191865L,38240589L,38252157L,38256203L,38255369L,38252975L,38256315L,38256461L,38256557L,38256477L,38255953L,38256329L,38255961L,38256617L,38256061L,38242599L,38256771L,38256585L,35456906L,38255813L,38256953L,38257007L,38256559L,38256385L,38257057L,38256209L,38257081L,38256649L,38256837L,38257265L,38257253L,37231876L,38254961L,38257317L,38257305L,38256293L,38255443L,38257375L,38256497L,38256457L,38257399L,38257431L,38210327L,38254825L,38257179L,38257483L,38257539L,38257567L,38256965L,38257593L,38257627L,38257373L,38257653L,38257497L,38257191L,38257295L,38257781L,38256991L,38236027L,35889224L,38257723L,38257229L,38256887L,37430749L,38257879L,38243587L,38257027L,38257441L,38257277L,38257975L,38257981L,38257991L,38258049L,38258101L,38257819L,38258115L,38257575L,38258033L,38258221L,38258235L,38258247L,38258241L,38257859L,38258273L,38258325L,38258349L,37335046L,38258445L,38258463L,38257911L,38252611L,38258149L,38257945L,38258603L,38258619L,38257977L,38258473L,38258703L,38382987L,38383077L,38382189L,38382793L,38382521L,38383151L,38382881L,38383311L,38383385L,38383127L,38383401L,37899957L,38383579L,38383703L,38383563L,38382359L,38383679L,38383695L,38382903L,38383603L,38363827L,38383815L,38384281L,38383171L,38384025L,38384019L,38384147L,38383969L,38302513L,38383233L,38383827L,38384321L,38384519L,38384557L,38384615L,38384805L,38384595L,38384433L,38384931L,5673929L));
for(Long loan: loanList){
iApiCommonService.queryData(loan,null);
}
}
@Test
......@@ -116,5 +122,11 @@ public class ApiCommonServiceTest {
iApiCommonService.updateBatchStatus(new Date(), CompensationStatus.already_status.get());
}
@Test
public void testUpdateMerchantContractNo(){
//HT100000201611250020530
Integer row = iApiCommonService.updateMerchantContractNo("HT100000201611250020530",32618252L);
logger.info("update row={}",row);
}
}
package cn.quantgroup.financial.service;
import cn.quantgroup.financial.BootStarter;
import cn.quantgroup.financial.constant.EncodingConfig;
import cn.quantgroup.financial.constant.HubeiCFCDataType;
import cn.quantgroup.financial.dao.IHuBeiCFCDao;
import cn.quantgroup.financial.model.huibeicfc.HuBeiHistory;
import cn.quantgroup.financial.scheduler.HuBeiReturnDiscScheduler;
import cn.quantgroup.financial.scheduler.HuBeiSendDiscScheduler;
import cn.quantgroup.financial.service.sys.IMailService;
import org.apache.commons.codec.binary.Base64;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.slf4j.Logger;
......@@ -13,6 +20,10 @@ import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;
import javax.activation.DataSource;
import java.util.ArrayList;
import java.util.List;
/**
* Created by WuKong on 2017/1/19.
*/
......@@ -29,35 +40,65 @@ public class HuBeiServiceTest {
@Autowired
IHuBeiService huBeiService;
@Autowired
HuBeiSendDiscScheduler huBeiSendDiscScheduler;
@Autowired
HuBeiReturnDiscScheduler huBeiReturnDiscScheduler;
@Autowired
IHuBeiCFCDao iHuBeiCFCDao;
@Autowired
private IMailService iMailService;
private Object lock = new Object();
/**
* 扣款明细
*/
@Test
public void testReturnDebitDisc(){
huBeiService.handleDiscData(HubeiCFCDataType.RETURN_BATCH_DEBIT,null);
huBeiService.handleDiscData(HubeiCFCDataType.RETURN_BATCH_DEBIT,null,188L,new Integer(1).byteValue());
}
/**
* 提前还款
*/
@Test
public void testReturnAdvanceRepayDisc(){
huBeiService.handleDiscData(HubeiCFCDataType.RETURN_ADVANCE_REPAYMENT,null);
huBeiService.handleDiscData(HubeiCFCDataType.RETURN_ADVANCE_REPAYMENT,"20170221_9009_T01.txt",10L,new Integer(1).byteValue());
}
/**
* 代偿
*/
public void testReturnCompensationDisc(){
huBeiService.handleDiscData(HubeiCFCDataType.RETURN_BATCH_COMPENSATION,null);
huBeiService.handleDiscData(HubeiCFCDataType.RETURN_BATCH_COMPENSATION,null,null,new Integer(1).byteValue());
}
@Test
public void testGetHistory(){
List<HuBeiHistory> huBeiHistoryList = iHuBeiCFCDao.getListByDocNameIdAndSeqNo(151L,new Integer(1).byteValue());
HuBeiHistory history = huBeiHistoryList.get(0);
System.out.println("ok");
}
@Test
public void testGetSendDisc(){
//20170119_9009_T01.txt
try {
huBeiService.handleDiscData(HubeiCFCDataType.SEND_DEBIT,null);
huBeiService.handleDiscData(HubeiCFCDataType.SEND_DEBIT,null,null,new Integer(1).byteValue(),"20170224");
} catch (Exception e) {
e.printStackTrace();
logger.error(e.getMessage(),e);
}
synchronized (lock) {
try {
lock.wait();
} catch (InterruptedException e) {
logger.error(e.getMessage(), e);
}
}
}
......@@ -65,9 +106,64 @@ public class HuBeiServiceTest {
public void testCheckSendDisc(){
//20170119_9009_T01.txt
try {
huBeiService.handleDiscData(HubeiCFCDataType.SEND_ADVANCE_REPAYMENT_CHECK,"20170120_9009_T01.txt");
huBeiService.handleDiscData(HubeiCFCDataType.SEND_ADVANCE_REPAYMENT_CHECK,"20170221_9009_T01.txt",10L,new Integer(1).byteValue());
} catch (Exception e) {
e.printStackTrace();
}
}
@Test
public void testScheduler(){
huBeiSendDiscScheduler.dayScheduler();
}
@Test
public void parse(){
String line = "SFQxMDAwMDAyMDE2MTIxNzAwMjcwNDh85YiY5pWP5oyvfDIwfDQxMDgyNjE5OTIwNzA2MDUxNnxO\n" +
"RnwyMDE3LTAzLTIwfDB8MjA0Ni44OHwwOXwyMDE2LTEyLTIyDUhUMTAwMDAwMjAxNjEyMTcwMDI3\n" +
"MTk3fOaItOeni+e6onwyMHwyMTAxMDYxOTc2MDcxMDQ2NDV8TkZ8MjAxNy0wMy0xOXwwfDIwNDYu\n" +
"ODh8MDl8MjAxNy0wMS0yMQ==";
String result = (new String(Base64.decodeBase64(line), EncodingConfig.defaultCharset));
System.out.println(result);
}
@Test
public void testReturnScheduler(){
huBeiReturnDiscScheduler.dayScheduler();
synchronized (lock) {
try {
lock.wait();
} catch (InterruptedException e) {
logger.error(e.getMessage(), e);
}
}
}
@Test
public void testSendMailNotice(){
huBeiService.sendErrorMailNotice("test");
synchronized (lock) {
try {
lock.wait();
} catch (InterruptedException e) {
logger.error(e.getMessage(), e);
}
}
}
@Test
public void testSendAttachmentMail(){
DataSource dataSource = iMailService.getDataSource("lkdjflajdlfkajd;fajl","aaa.txt");
ArrayList<DataSource> dataSourceList = new ArrayList<>();
dataSourceList.add(dataSource);
huBeiService.sendMailAttachment( HubeiCFCDataType.RETURN_ADVANCE_REPAYMENT,dataSourceList);
synchronized (lock) {
try {
lock.wait();
} catch (InterruptedException e) {
logger.error(e.getMessage(), e);
}
}
}
}
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