Commit 26b1d9cd authored by suntao's avatar suntao

申请结清 结清状态

parent 3a503501
...@@ -46,4 +46,6 @@ public class ActiveApplyOrder { ...@@ -46,4 +46,6 @@ public class ActiveApplyOrder {
private String remark; private String remark;
private Integer settleFlag;
} }
...@@ -85,4 +85,15 @@ public class OrderRest { ...@@ -85,4 +85,15 @@ public class OrderRest {
log.info("[操作日志查询],请求参数:loanId={}", loanId); log.info("[操作日志查询],请求参数:loanId={}", loanId);
return orderService.queryOperateLog(loanId); return orderService.queryOperateLog(loanId);
} }
/**
* 申请结清证明
*
* @param loanId
* @return
*/
@GetMapping("/apply_settle/{loanId}")
public JsonResult applySettle(@PathVariable Long loanId) {
log.info("[申请结清证明],请求参数:loanId={}", loanId);
return orderService.applySettle(loanId);
}
} }
...@@ -7,9 +7,14 @@ import cn.quantgroup.customer.rest.param.applyorder.ApplyOrderQuery; ...@@ -7,9 +7,14 @@ import cn.quantgroup.customer.rest.param.applyorder.ApplyOrderQuery;
import cn.quantgroup.customer.rest.vo.JsonResult; import cn.quantgroup.customer.rest.vo.JsonResult;
import java.util.List; import java.util.List;
import java.util.Map;
public interface IIceService { public interface IIceService {
JsonResult<ApplyOrder> findApplyOrders(ApplyOrderQuery applyOrderQuery); JsonResult<ApplyOrder> findApplyOrders(ApplyOrderQuery applyOrderQuery);
JsonResult<LoanOrder> findLoanOrder(Long loanId); JsonResult<LoanOrder> findLoanOrder(Long loanId);
JsonResult<List<FlowNode>> findFlowChart(String orderNo); JsonResult<List<FlowNode>> findFlowChart(String orderNo);
JsonResult<Map<Long, Integer>> findSettleFlag(List<Long> loanIds);
JsonResult applySettle(Long loanId);
} }
...@@ -64,4 +64,6 @@ public interface IOrderService{ ...@@ -64,4 +64,6 @@ public interface IOrderService{
* @return * @return
*/ */
JsonResult<List<OpLog>> queryOperateLog(Long loanId); JsonResult<List<OpLog>> queryOperateLog(Long loanId);
JsonResult applySettle(Long loanId);
} }
...@@ -11,6 +11,7 @@ import cn.quantgroup.customer.util.JSONTools; ...@@ -11,6 +11,7 @@ import cn.quantgroup.customer.util.JSONTools;
import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.core.type.TypeReference;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
...@@ -135,4 +136,70 @@ public class IceServiceImpl implements IIceService { ...@@ -135,4 +136,70 @@ public class IceServiceImpl implements IIceService {
return jsonResult; return jsonResult;
} }
@Override
public JsonResult<Map<Long, Integer>> findSettleFlag(List<Long> loanIds) {
String logPre = "IceService.findSettleFlag";
log.info("{} 结清状态查询 loanIds={}", logPre, loanIds);
String url = iceUrl + "";
if (CollectionUtils.isEmpty(loanIds)) {
log.error("{} 订单号全为空 loanIds={}", logPre, loanIds);
return JsonResult.buildErrorStateResult("申请订单号为空", null);
}
Map<String, Object> param = Maps.newHashMap();
param.put("loanIds", StringUtils.join(loanIds, ","));
Map<String, String> header = Maps.newHashMap();
header.put("Content-Type", "application/x-www-form-urlencoded");
String result = null;
try {
result = httpService.post(url, header, param);
log.info("{} 结清状态查询 loanIds={},result:{}", logPre, loanIds, result);
} catch (Exception e) {
log.error("{} 通讯异常 url={},param={}", logPre, url, param, e);
return JsonResult.buildErrorStateResult("通讯异常", null);
}
if (StringUtils.isBlank(result)) {
log.error("{} 调用失败 url={}, header={},param={},result={}", logPre, url, header, param, result);
return JsonResult.buildErrorStateResult("结清状态查询失败", null);
}
TypeReference<JsonResult<Map<Long, Integer>>> typeToken = new TypeReference<JsonResult<Map<Long, Integer>>>() {
};
JsonResult<Map<Long, Integer>> jsonResult = JSONTools.deserialize(result, typeToken);
return jsonResult;
}
@Override
public JsonResult applySettle(Long loanId) {
String logPre = "IceService.applySettle";
log.info("{} 申请结清下载 loanIds={}", logPre, loanId);
String url = iceUrl + "";
if (loanId != null) {
log.error("{} 申请订单号为空 loanId={}", logPre, loanId);
return JsonResult.buildErrorStateResult("申请订单号为空", null);
}
Map<String, Object> param = Maps.newHashMap();
param.put("loanId", loanId);
Map<String, String> header = Maps.newHashMap();
header.put("Content-Type", "application/x-www-form-urlencoded");
String result = null;
try {
result = httpService.post(url, header, param);
log.info("{} 申请结清下载 loanId={},result:{}", logPre, loanId, result);
} catch (Exception e) {
log.error("{} 通讯异常 url={},param={}", logPre, url, param, e);
return JsonResult.buildErrorStateResult("通讯异常", null);
}
if (StringUtils.isBlank(result)) {
log.error("{} 调用失败 url={}, header={},param={},result={}", logPre, url, header, param, result);
return JsonResult.buildErrorStateResult("申请结清下载失败", null);
}
TypeReference<JsonResult<Boolean>> typeToken = new TypeReference<JsonResult<Boolean>>() {
};
JsonResult<Boolean> jsonResult = JSONTools.deserialize(result, typeToken);
return jsonResult;
}
} }
...@@ -468,6 +468,11 @@ public class OrderServiceImpl implements IOrderService { ...@@ -468,6 +468,11 @@ public class OrderServiceImpl implements IOrderService {
return JsonResult.buildSuccessResult("处理成功", list); return JsonResult.buildSuccessResult("处理成功", list);
} }
@Override
public JsonResult applySettle(Long loanId) {
return iceService.applySettle(loanId);
}
/** /**
* 处理查询不到orderMapping的情况,可能是进件失败,也可能不存在该笔订单 * 处理查询不到orderMapping的情况,可能是进件失败,也可能不存在该笔订单
* *
......
...@@ -541,6 +541,22 @@ public class UserServiceImpl implements IUserService { ...@@ -541,6 +541,22 @@ public class UserServiceImpl implements IUserService {
//JsonResult<ApplyOrder> applyOrders = xyqbService.findApplyOrders(applyOrderQuery); //JsonResult<ApplyOrder> applyOrders = xyqbService.findApplyOrders(applyOrderQuery);
//todo 替换中台接口 //todo 替换中台接口
JsonResult<ApplyOrder> applyOrders = iceService.findApplyOrders(applyOrderQuery); JsonResult<ApplyOrder> applyOrders = iceService.findApplyOrders(applyOrderQuery);
// 添加能否结清标记
if (applyOrders.isSuccess()) {
JsonResult<Map<Long, Integer>> settleFlagResult = null;
List<ActiveApplyOrder> activeOrders = applyOrders.getData().getActiveOrders();
if (CollectionUtils.isNotEmpty(activeOrders)) {
settleFlagResult = iceService.findSettleFlag(activeOrders.stream().filter(it-> it.getLoanId() != null).map(ActiveApplyOrder::getLoanId).collect(Collectors.toList()));
}
if (settleFlagResult != null && settleFlagResult.isSuccess()) {
for (ActiveApplyOrder activeOrder : activeOrders) {
Integer flag = settleFlagResult.getData().get(activeOrder.getLoanId());
if (activeOrder.getLoanId() != null && flag != null) {
activeOrder.setSettleFlag(flag);
}
}
}
}
return applyOrders; return applyOrders;
} }
......
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