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

湖北消金 - 因为时间范围的

parent eaf659de
......@@ -83,6 +83,16 @@ public class HubeiCFCField {
}
};
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_BATCH_COMPENSATION.get(),HubeiCFCDataType.RETURN_BATCH_COMPENSATION);
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";
/**
......
......@@ -7,6 +7,7 @@ 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;
......@@ -45,7 +46,10 @@ public interface IHuBeiService {
* 异常邮件通知
* @param messageString
*/
@Async
void sendMailNotice(String messageString);
@Async
void sendMailNotice(List<HuBeiHistory> huBeiHistoryList,String noticeMessage);
/**
* 每日附件发送
......
......@@ -372,6 +372,7 @@ public class HuBeiServiceImpl implements IHuBeiService {
*/
Map<Long,List<RepayXyqbDetail>> listRepayDetailMap = getRepayXyqbMap(loanHistoryIdList);
List<HuBeiHistory> returnHuBeiHistoryList = new ArrayList<>();
List<HuBeiHistory> errorHuBeiHistoryList = new ArrayList<>();
//先查所有提前还款
Date[] dates = HubeiCFCUtil.getDateScope();
returnHuBeiHistoryList.addAll(advanceRepayment(loanHistoryIdList,dates[0],dates[1]));
......@@ -379,6 +380,7 @@ public class HuBeiServiceImpl implements IHuBeiService {
int index = 0;
for(; index< sendHuBeiHistoryList.size(); index++){
HuBeiHistory history = sendHuBeiHistoryList.get(index);
Long loanId = contractNoMapLoanId.get(history.getContactNo());
......@@ -398,8 +400,8 @@ public class HuBeiServiceImpl implements IHuBeiService {
Collections.sort(repayXyqbDetailList,new RepayXyqbCompartor());
if(!CollectionUtils.isEmpty(repayXyqbDetailList)){
RepayXyqbDetail repayXyqbDetail = repayXyqbDetailList.get(0);
//等于送盘文件当前期
if(repayXyqbDetail.getCurrTermNo().compareTo(history.getCurrTermNo())==0){
//应还日或者逾期 湖北不能接收再提前还款
if(repayXyqbDetailList.size()==0&&repayXyqbDetail.getCurrTermNo().compareTo(history.getCurrTermNo())==0){
RepaymentPlanDetail repaymentPlanDetail = noYetContractMapRepayPlan.get(history.getContactNo());
if(repaymentPlanDetail!=null){
//湖北罚息
......@@ -408,13 +410,12 @@ public class HuBeiServiceImpl implements IHuBeiService {
BigDecimal reallyRepayAmount = repaymentPlanDetail.getPrincipal().add(repaymentPlanDetail.getInterest()).add(hubeiOverdueInterest);
returnHuBeiHistoryList.add(deitHuiBeiHistory(history, sendHuBeiDocName.getCreateTime(),reallyRepayAmount,HubeiCFCField.tradeCodeSuccess));
}
//去除第一个
repayXyqbDetailList = repayXyqbDetailList.subList(1,repayXyqbDetailList.size());
}
//剩下的提前还款
List<HuBeiHistory> advanceHistoryList = advanceHuiBeiHistory(repayXyqbDetailList);
if(!CollectionUtils.isEmpty(advanceHistoryList)){
returnHuBeiHistoryList.addAll(advanceHistoryList);
}else {
//这部分
List<HuBeiHistory> advanceHistoryList = advanceHuiBeiHistory(repayXyqbDetailList);
if(!CollectionUtils.isEmpty(advanceHistoryList)){
errorHuBeiHistoryList.addAll(advanceHistoryList);
}
}
continue;
}
......@@ -435,6 +436,13 @@ public class HuBeiServiceImpl implements IHuBeiService {
returnHuBeiHistoryList.add(deitHuiBeiHistory(history, sendHuBeiDocName.getCreateTime(),BigDecimal.ZERO,HubeiCFCField.tradeCodeNoTrade));
}
//给相关人员发送异常的邮件
if(!CollectionUtils.isEmpty(errorHuBeiHistoryList)){
sendMailNotice(errorHuBeiHistoryList,"异常的数据:");
}
return returnHuBeiHistoryList;
}
......@@ -633,6 +641,26 @@ public class HuBeiServiceImpl implements IHuBeiService {
}
}
@Async
@Override
public void sendMailNotice(List<HuBeiHistory> huBeiHistoryList,String noticeMessage){
try {
if(CollectionUtils.isEmpty(huBeiHistoryList)){
return;
}
StringBuilder errorStringBuilder = new StringBuilder(noticeMessage+"\r");
for(HuBeiHistory huBeiHistory:huBeiHistoryList){
errorStringBuilder.append(huBeiHandlerDispatcher.builder(HubeiCFCField.HubeiTypeMap.get(huBeiHistory.getDataType()),huBeiHistory)).append("\r");
}
String message = errorStringBuilder.toString();
if(!StringUtils.isEmpty(message)){
sendMailNotice(message);
}
} catch (Exception e) {
logger.error(e.getMessage(),e);
}
}
private String[] getMailListByType(Byte type){
List<MailInfo> mailInfoList = huBeiCFCDao.getListByType(type);
if(CollectionUtils.isEmpty(mailInfoList)){
......
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