Commit 56b5ecf8 authored by 杨钧's avatar 杨钧

增加xyqb接口调用

parent aeecc7e9
......@@ -4,7 +4,7 @@ import cn.quantgroup.customer.config.http.mvc.converter.DateConverter;
import cn.quantgroup.customer.config.http.mvc.converter.IEnumConverterFactory;
import cn.quantgroup.customer.config.http.mvc.converter.LocalDateConverter;
import cn.quantgroup.customer.config.http.mvc.converter.LocalDateTimeConverter;
import cn.quantgroup.customer.config.http.mvc.filter.UserTokenIntecepter;
import cn.quantgroup.customer.config.http.mvc.filter.UserTokenInterceptor;
import com.google.common.collect.Lists;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
......@@ -22,7 +22,7 @@ import java.util.List;
public class WebMvcConfigure extends WebMvcConfigurerAdapter {
@Autowired
private UserTokenIntecepter tokenIntecepter;
private UserTokenInterceptor tokenIntecepter;
@Override
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
......
......@@ -24,7 +24,7 @@ import java.util.Objects;
*/
@Slf4j
@Component
public class UserTokenIntecepter implements HandlerInterceptor{
public class UserTokenInterceptor implements HandlerInterceptor{
@Autowired
private IOpSystemService IOpSystemService;
......
package cn.quantgroup.customer.enums;
import java.util.Arrays;
import java.util.Optional;
/**
* 试算字段转换
*/
public enum OrderFieldEnum {
PRINCIPAL("principal","应还本金"),
INTEREST("interest","应还利息"),
SERVICE_FEE("serviceFee","应还担保费"),
PREMIUM("premium","应还保费"),
OVERDUE_INTEREST("overDueInterest","应还罚息"),
LIQUIDATE_DAMAGES("liquidatedDamages","结清违约金"),
OTHERFEE("otherFee","应还其他费用"),
TOTAL_AMOUNT("totalAmount","应还总额"),
OTHER("other","其他收费项目");
private String field;
private String title;
OrderFieldEnum(String field, String title) {
this.field = field;
this.title = title;
}
public String getField() {
return field;
}
public String getTitle() {
return title;
}
public static String getValue(String field){
Optional<OrderFieldEnum> optional = Arrays.asList(OrderFieldEnum.values()).stream().filter(orderFieldEnum -> field.equalsIgnoreCase(orderFieldEnum.getField())).findFirst();
if(optional.isPresent()){
return optional.get().getTitle();
}
return OrderFieldEnum.OTHER.getTitle();
}
}
......@@ -15,15 +15,15 @@ public class EarlySettleUpOrder {
private Long loanId;
private String phoneNo;
private BigDecimal loanAmount;
private String fundOrderNo;
private Long fundId;
private String fundOrder;
private Long fundCorpId;
private String fundName;
private String channelOrderNo;
private Long channelId;
private String channelName;
private Integer allTerm;
private Integer noPaidTerm;
private Boolean showEntryFlag;
private Boolean hideEntryFlag;
private Integer termSum;
private Integer noRepayTerm;
private Boolean showAllRepay;
private Boolean showTrial;
private Boolean showOplog;
}
......@@ -15,9 +15,11 @@ public class EarlySettleUpTrial {
private BigDecimal principal;
private BigDecimal interest;
private BigDecimal overdueInterest;
private BigDecimal otherFee;
private BigDecimal liquid;
private BigDecimal overDueInterest;
private BigDecimal premium;
private BigDecimal liquidatedDamages;
private BigDecimal serviceFee;
private BigDecimal otherFee;
private BigDecimal totalAmount;
}
......@@ -18,8 +18,4 @@ public class OperateEntryParam {
*/
private Integer opState;
private String userNo;
private String userName;
}
......@@ -3,6 +3,7 @@ package cn.quantgroup.customer.service;
import cn.quantgroup.customer.model.kaordermapping.ApplyRequestHistory;
import cn.quantgroup.customer.model.kaordermapping.ChannelConfigurationResult;
import cn.quantgroup.customer.model.kaordermapping.LoanOrderMapping;
import cn.quantgroup.customer.model.order.ApplyOrder;
import cn.quantgroup.customer.model.order.CallbackRecordList;
import cn.quantgroup.customer.rest.param.ordermapping.OrderQueryParam;
import cn.quantgroup.customer.rest.vo.JsonResult;
......
package cn.quantgroup.customer.service;
import cn.quantgroup.customer.model.order.FlowNode;
import cn.quantgroup.customer.model.order.LoanOrderDetail;
import cn.quantgroup.customer.model.order.OrderInfo;
import cn.quantgroup.customer.model.order.OrderInfoVo;
import cn.quantgroup.customer.entity.OpLog;
import cn.quantgroup.customer.model.order.*;
import cn.quantgroup.customer.rest.param.ordermapping.EarlySettleUpOrderQueryParam;
import cn.quantgroup.customer.rest.param.ordermapping.OperateEntryParam;
import cn.quantgroup.customer.rest.param.ordermapping.OrderQueryParam;
import cn.quantgroup.customer.rest.vo.JsonResult;
import java.util.List;
import java.util.Map;
/**
* @author Wang Xiangwei
......@@ -39,26 +38,26 @@ public interface IOrderService{
* @param orderQuery
* @return
*/
JsonResult queryEarlySettleUpOrders(EarlySettleUpOrderQueryParam orderQuery);
JsonResult<List<EarlySettleUpOrder>> queryEarlySettleUpOrders(EarlySettleUpOrderQueryParam orderQuery);
/**
* 显示or隐藏操作
* @param operateEntryParam
* @return
*/
JsonResult operateEntry(OperateEntryParam operateEntryParam);
JsonResult<Boolean> operateEntry(OperateEntryParam operateEntryParam);
/**
* 提前一次性结清金额试算
* @param loanId
* @return
*/
JsonResult earlySettleUpTrial(Long loanId);
JsonResult<List<Map<String,Object>>> earlySettleUpTrial(Long loanId);
/**
* 查询操作日志
* @param loanId
* @return
*/
JsonResult queryOperateLog(Long loanId);
JsonResult<List<OpLog>> queryOperateLog(Long loanId);
}
......@@ -4,6 +4,8 @@ import cn.quantgroup.customer.model.order.*;
import cn.quantgroup.customer.rest.param.card.ModifyReservePhone;
import cn.quantgroup.customer.rest.param.card.UnBindCardModel;
import cn.quantgroup.customer.rest.param.applyorder.ApplyOrderQuery;
import cn.quantgroup.customer.rest.param.ordermapping.EarlySettleUpOrderQueryParam;
import cn.quantgroup.customer.rest.param.ordermapping.OperateEntryParam;
import cn.quantgroup.customer.rest.param.ordermapping.OrderQueryParam;
import cn.quantgroup.customer.rest.param.repay.RepayOrderInfoQuery;
import cn.quantgroup.customer.rest.param.repay.RepayOrderQuery;
......@@ -63,4 +65,20 @@ public interface IXyqbService {
* @return
*/
JsonResult<OrderStatus> orderStatusQuery(OrderQueryParam orderQuery);
/**
* 查询xyqb一次性结清订单相关信息
* @param orderQuery
* @return
*/
JsonResult<List<EarlySettleUpOrder>> findLoanOrder4EarlySettleUp(EarlySettleUpOrderQueryParam orderQuery);
/**
* 处理新增或删除白名单操作
* @param operateEntryParam
* @return
*/
JsonResult<Boolean> operateEntry(OperateEntryParam operateEntryParam);
JsonResult<EarlySettleUpTrial> earlySettleUpTrial(Long loanId);
}
......@@ -5,6 +5,7 @@ import cn.quantgroup.customer.exception.BusinessException;
import cn.quantgroup.customer.model.kaordermapping.ApplyRequestHistory;
import cn.quantgroup.customer.model.kaordermapping.ChannelConfigurationResult;
import cn.quantgroup.customer.model.kaordermapping.LoanOrderMapping;
import cn.quantgroup.customer.model.order.ApplyOrder;
import cn.quantgroup.customer.model.order.CallbackRecordList;
import cn.quantgroup.customer.rest.param.ordermapping.OrderQueryParam;
import cn.quantgroup.customer.rest.vo.JsonResult;
......@@ -238,5 +239,4 @@ public class KaServiceImpl implements IKaService {
throw new BusinessException(ErrorCodeEnum.NET_ERROR);
}
}
}
......@@ -4,7 +4,9 @@ import cn.quantgroup.customer.aop.OperateLog;
import cn.quantgroup.customer.entity.OpLog;
import cn.quantgroup.customer.entity.OperateLogModel;
import cn.quantgroup.customer.enums.ErrorCodeEnum;
import cn.quantgroup.customer.enums.OrderFieldEnum;
import cn.quantgroup.customer.model.kaordermapping.ApplyRequestHistory;
import cn.quantgroup.customer.model.kaordermapping.ChannelConfigurationResult;
import cn.quantgroup.customer.model.kaordermapping.LoanOrderMapping;
import cn.quantgroup.customer.model.order.*;
import cn.quantgroup.customer.model.xyqbuser.UserBasicInfo;
......@@ -15,6 +17,7 @@ import cn.quantgroup.customer.rest.param.user.UserQueryParam;
import cn.quantgroup.customer.rest.vo.JsonResult;
import cn.quantgroup.customer.service.*;
import cn.quantgroup.customer.util.DateUtil;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -23,6 +26,7 @@ import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.security.Timestamp;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author Wang Xiangwei
......@@ -147,124 +151,219 @@ public class OrderServiceImpl implements IOrderService {
}
@Override
public JsonResult queryEarlySettleUpOrders(EarlySettleUpOrderQueryParam orderQuery) {
public JsonResult<List<EarlySettleUpOrder>> queryEarlySettleUpOrders(EarlySettleUpOrderQueryParam orderQuery) {
String logPre = "OrderServiceImpl.queryEarlySettleUpOrders";
//如果输入了渠道号,必须输入渠道订单号
if(!existAtLestOneParam(orderQuery)){
if (!existAtLestOneParam(orderQuery)) {
return JsonResult.buildErrorStateResult("至少输入一个请求参数", null);
}
// 渠道订单号和渠道号必须同时存在
if (!existChannelOrderNoAndChannelId(orderQuery))
{
if (!existChannelOrderNoAndChannelId(orderQuery)) {
return JsonResult.buildErrorStateResult("渠道号和渠道订单号必须同时存在", null);
}
// 获取用户userId
JsonResult<UserBasicInfo> userInfo = this.queryAndCheckUserInfo(orderQuery);
if (Objects.isNull(userInfo)||!userInfo.isSuccess()) {
return JsonResult.buildErrorStateResult("查询不到用户信息", null);
}
// 请求xyqb
UserBasicInfo userBasicInfo = userInfo.getData();
orderQuery.setUserId(userBasicInfo.getUserId());
JsonResult<List<EarlySettleUpOrder>> xyqbOrderResult = this.xyqbService.findLoanOrder4EarlySettleUp(orderQuery);
if (Objects.isNull(xyqbOrderResult)||!xyqbOrderResult.isSuccess()) {
return JsonResult.buildErrorStateResult("查询订单信息出错", null);
}
/**
* 查询渠道配置信息
*/
JsonResult<List<ChannelConfigurationResult>> channelConfigs = this.kaService.getAllChannelConfiguration();
if (Objects.isNull(channelConfigs)||!channelConfigs.isSuccess()) {
return JsonResult.buildErrorStateResult("查询渠道配置出错", null);
}
List<ChannelConfigurationResult> channelConfigLists = channelConfigs.getData();
Map<Long,List<ChannelConfigurationResult>> configurationResultMap = channelConfigLists.stream().collect(Collectors.groupingBy(ChannelConfigurationResult::getRegisteredFrom));
/**
* 处理数据转换
*/
List<EarlySettleUpOrder> settleUpOrders = xyqbOrderResult.getData();
settleUpOrders.forEach(e -> {
ChannelConfigurationResult configurationResult = null;
if(configurationResultMap.get(e.getChannelId()).size()!=1 ||
(configurationResultMap.get(e.getChannelId()).size()==1 && Objects.isNull(configurationResult = configurationResultMap.get(e.getChannelId()).get(0)))){
return;
}
// 处理返回数据
OrderQueryParam orderQueryParam = new OrderQueryParam();
orderQueryParam.setLoanId(e.getLoanId());
JsonResult<LoanOrderMapping> orderMappingJsonResult = this.kaService.findOrderMapping(orderQueryParam);
if(Objects.isNull(orderMappingJsonResult) || !orderMappingJsonResult.isSuccess()){
log.error("{} 查询渠道订单表数据为空 loanId={}",logPre,e.getLoanId());
return;
}
LoanOrderMapping loanOrderMapping = orderMappingJsonResult.getData();
e.setChannelName(configurationResult.getChannelName());
e.setChannelOrderNo(loanOrderMapping.getChannelOrderNo());
e.setChannelId(configurationResult.getRegisteredFrom());
e.setPhoneNo(userBasicInfo.getPhoneNo());
e.setShowOplog(dealWithShowOplog(e.getLoanId()));
});
return JsonResult.buildSuccessResult("处理成功", null);
return JsonResult.buildSuccessResult("处理成功", settleUpOrders);
}
// 查询用户信息
/**
* 处理是否显示 操作日志按钮
*
* @param loanId
* @return
*/
private Boolean dealWithShowOplog(Long loanId) {
List<OpLog> list = operateLogService.findLogsByLoanId(loanId);
return (Objects.nonNull(list) && list.size() > 0);
}
/**
* 查询用户信息
*/
private JsonResult<UserBasicInfo> queryAndCheckUserInfo(EarlySettleUpOrderQueryParam orderQuery) {
String logPre = "OrderServiceImpl.queryAndCheckUserInfo";
// 说明业务参数和用户参数都为空
boolean isExistOrderParam = existOrderParam(orderQuery);
boolean isExistUserParam = existUserParam(orderQuery);
if (!(isExistOrderParam || isExistUserParam)) {
log.error("{} 根据请求参数查询不到用户信息 orderQuery={}", logPre, orderQuery);
return JsonResult.buildErrorStateResult("查询不到用户信息", null);
}
JsonResult<UserBasicInfo> userInfoByOrder = null;
// 有订单信息存在,根据订单查询用户userId
if (!(Objects.isNull(orderQuery.getLoanId()) && Objects.isNull(orderQuery.getChannelId()) && StringUtils.isBlank(orderQuery.getChannelOrderNo()))) {
if (isExistOrderParam) {
OrderQueryParam orderQueryParam = new OrderQueryParam();
orderQueryParam.setLoanId(orderQuery.getLoanId());
orderQueryParam.setChannelId(orderQuery.getChannelId());
orderQueryParam.setChannelOrderNo(orderQuery.getChannelOrderNo());
userInfoByOrder = this.userService.findUserInfoByOrderParam(orderQueryParam);
if (!userInfoByOrder.isSuccess()) {
if (Objects.isNull(userInfoByOrder) || !userInfoByOrder.isSuccess()) {
log.error("{} 查询用户失败 result={}", logPre, userInfoByOrder);
return userInfoByOrder;
}
}
JsonResult<UserBasicInfo> userInfoByPhone = null;
if (Objects.nonNull(orderQuery.getPhoneNo())) {
if (isExistUserParam) {
//用户参数查询
UserQueryParam userQueryParam = new UserQueryParam();
userQueryParam.setPhoneNo(orderQuery.getPhoneNo());
userQueryParam.setUserId(orderQuery.getUserId());
userInfoByPhone = this.userService.findUserInfo(userQueryParam);
if (!userInfoByPhone.isSuccess()) {
if (Objects.isNull(userInfoByPhone) || !userInfoByPhone.isSuccess()) {
log.error("{} 查询用户失败 result={}", logPre, userInfoByPhone);
return userInfoByPhone;
}
}
//TODO 需要联合判断
if(Objects.isNull(userInfoByOrder) && Objects.isNull(userInfoByPhone) ){
if (isExistOrderParam && isExistUserParam) {
UserBasicInfo userBasicInfoByOrder = userInfoByOrder.getData();
UserBasicInfo userBasicInfoByUser = userInfoByOrder.getData();
if (userBasicInfoByOrder.getUserId().equals(userBasicInfoByUser.getUserId())) {
return userInfoByOrder;
} else {
return JsonResult.buildErrorStateResult("根据订单信息和用户信息查询的用户不一致", null);
}
} else if (isExistOrderParam) {
return userInfoByOrder;
} else {
return userInfoByPhone;
}
}
/**
* 判断是否存在用户基础字段
* @param orderQuery
* @return
*/
private boolean existUserParam(EarlySettleUpOrderQueryParam orderQuery) {
return !(StringUtils.isBlank(orderQuery.getPhoneNo()) && Objects.isNull(orderQuery.getUserId()));
}
return null;
/**
* 判断是否存在订单基础字段
* @param orderQuery
* @return
*/
private boolean existOrderParam(EarlySettleUpOrderQueryParam orderQuery) {
return !(Objects.isNull(orderQuery.getLoanId()) && Objects.isNull(orderQuery.getChannelId()) && StringUtils.isBlank(orderQuery.getChannelOrderNo()));
}
/**
* 渠道号和渠道订单号同时存在判断
* @param orderQuery
* @return
*/
private boolean existChannelOrderNoAndChannelId(EarlySettleUpOrderQueryParam orderQuery) {
if ( Objects.isNull(orderQuery.getChannelId()) && StringUtils.isNotBlank(orderQuery.getChannelOrderNo())
return !(Objects.isNull(orderQuery.getChannelId()) && StringUtils.isNotBlank(orderQuery.getChannelOrderNo())
|| Objects.nonNull(orderQuery.getChannelId()) && StringUtils.isBlank(orderQuery.getChannelOrderNo())
) {
return false;
}
return true;
);
}
private boolean existAtLestOneParam(EarlySettleUpOrderQueryParam orderQuery) {
if (Objects.isNull(orderQuery) ||
(StringUtils.isBlank(orderQuery.getChannelOrderNo())
&& Objects.isNull(orderQuery.getChannelId())
&& Objects.isNull(orderQuery.getLoanId())
&& Objects.isNull(orderQuery.getUserId())
&& StringUtils.isBlank(orderQuery.getFundOrderNo())
&& StringUtils.isBlank(orderQuery.getPhoneNo())
)
) {
return false;
}
return true;
return existOrderParam(orderQuery) && existUserParam(orderQuery);
}
@Override
public JsonResult operateEntry(OperateEntryParam operateEntryParam) {
return JsonResult.buildSuccessResult("处理成功", Boolean.TRUE);
public JsonResult<Boolean> operateEntry(OperateEntryParam operateEntryParam) {
return this.xyqbService.operateEntry(operateEntryParam);
}
@Override
public JsonResult earlySettleUpTrial(Long loanId) {
List<Map<String, Object>> datas = new ArrayList<>();
for (int i = 0; i < 3; i++) {
Map<String, Object> map = new HashMap<>();
if (i == 0) {
map.put("title", "本金");
map.put("value", "10000");
} else if (i == 1) {
map.put("title", "利息");
map.put("value", "100");
} else {
map.put("title", "违约金");
map.put("value", "500");
}
datas.add(map);
public JsonResult<List<Map<String,Object>>> earlySettleUpTrial(Long loanId) {
String logPre = "OrderServiceImpl.queryAndCheckUserInfo";
JsonResult<EarlySettleUpTrial> jsonResult = this.xyqbService.earlySettleUpTrial(loanId);
if (Objects.isNull(jsonResult) || !jsonResult.isSuccess()) {
log.error("{} 获取试算结果失败 loanId={}", logPre, loanId);
return JsonResult.buildErrorStateResult("获取试算结果失败", null);
}
List<Map<String, Object>> datas = dealWithFieldAndTitle(jsonResult.getData());
log.info("{} 试算对象 data={},试算后返回 datas:{}", logPre, jsonResult.getData(), datas);
return JsonResult.buildSuccessResult("处理成功", datas);
}
/**
* 根据返回参数值,获取对应title
*
* @param data
* @return
*/
private List<Map<String, Object>> dealWithFieldAndTitle(EarlySettleUpTrial data) {
JSONObject dataJson = JSONObject.parseObject(JSONObject.toJSONString(data));
Iterator<Map.Entry<String, Object>> iterator = dataJson.entrySet().iterator();
List<Map<String, Object>> dataList = new ArrayList<>();
while (iterator.hasNext()) {
Map.Entry<String, Object> me = iterator.next();
String key = me.getKey();
Object value = me.getValue();
Map<String, Object> fieldDataMap = new HashMap<>();
fieldDataMap.put("title", OrderFieldEnum.getValue(key));
fieldDataMap.put("value", value);
dataList.add(fieldDataMap);
}
return dataList;
}
@Override
public JsonResult queryOperateLog(Long loanId) {
public JsonResult<List<OpLog>> queryOperateLog(Long loanId) {
List<OpLog> list = operateLogService.findLogsByLoanId(loanId);
return JsonResult.buildSuccessResult("处理成功", list);
}
......
......@@ -5,6 +5,8 @@ import cn.quantgroup.customer.model.order.*;
import cn.quantgroup.customer.rest.param.applyorder.ApplyOrderQuery;
import cn.quantgroup.customer.rest.param.card.ModifyReservePhone;
import cn.quantgroup.customer.rest.param.card.UnBindCardModel;
import cn.quantgroup.customer.rest.param.ordermapping.EarlySettleUpOrderQueryParam;
import cn.quantgroup.customer.rest.param.ordermapping.OperateEntryParam;
import cn.quantgroup.customer.rest.param.ordermapping.OrderQueryParam;
import cn.quantgroup.customer.rest.param.repay.RepayOrderInfoQuery;
import cn.quantgroup.customer.rest.param.repay.RepayOrderQuery;
......@@ -354,4 +356,109 @@ public class XyqbServiceImpl implements IXyqbService {
}
}
}
@Override
public JsonResult<List<EarlySettleUpOrder>> findLoanOrder4EarlySettleUp(EarlySettleUpOrderQueryParam orderQuery) {
String logPre = "[XyqbServiceImpl.findLoanOrder4EarlySettleUp] 查询一次性结清订单相关信息";
String url = xyqbSysUrl + "/ex/operate/config/earlysettle/query";
Map<String, Object> queryParam = new HashMap<>(8);
if(Objects.isNull(orderQuery.getUserId()) &&
Objects.isNull(orderQuery.getLoanId()) &&
StringUtils.isBlank(orderQuery.getFundOrderNo())){
log.error("{} 请求参数都为空,不允许查询 orderQuery={}",logPre,orderQuery);
return JsonResult.buildErrorStateResult("查询参数都为空,不允许查询", null);
}
queryParam.put("loan_id", orderQuery.getLoanId());
queryParam.put("user_id",orderQuery.getUserId());
queryParam.put("fund_order_no",orderQuery.getFundOrderNo());
log.info("{} 请求参数 orderQuery={},queryParam={}", logPre, orderQuery, queryParam);
Map<String, String> header = new HashMap<>(2);
header.put("Accept", "application/json");
header.put("Content-Type", "application/x-www-form-urlencoded");
String result = httpService.post(url, header, queryParam);
log.info("{} 返回结果 result:{}", logPre, result);
if (StringUtils.isBlank(result)) {
log.error("{} 处理失败 queryParam={} result={}", logPre, queryParam, result);
return JsonResult.buildErrorStateResult("[查询失败,返回为空]", ErrorCodeEnum.RETURN_ERROR);
} else {
TypeReference<JsonResult<List<EarlySettleUpOrder>>> typeToken = new TypeReference<JsonResult<List<EarlySettleUpOrder>>>() {
};
JsonResult<List<EarlySettleUpOrder>> jsonResult = JSONTools.deserialize(result, typeToken);
if (Objects.isNull(jsonResult) || !jsonResult.isSuccess()) {
return JsonResult.buildErrorStateResult("[查询失败]", ErrorCodeEnum.RETURN_ERROR);
} else {
return jsonResult;
}
}
}
@Override
public JsonResult<Boolean> operateEntry(OperateEntryParam operateEntryParam){
String logPre = "[XyqbServiceImpl.operateEntry] 处理新增或删除白名单操作";
String url = xyqbSysUrl + "/ex/operate/config/earlysettle/opt_white_list";
Map<String, Object> queryParam = new HashMap<>(8);
if(Objects.isNull(operateEntryParam.getLoanId()) &&
Objects.isNull(operateEntryParam.getOpState())){
log.error("{} 请求参数都为空,不允许操作 orderQuery={}",logPre,operateEntryParam);
return JsonResult.buildErrorStateResult("查询参数都为空,不允许操作", null);
}
queryParam.put("loan_id", operateEntryParam.getLoanId());
if(operateEntryParam.getOpState()==1){
queryParam.put("opt","ADD");
}else{
queryParam.put("opt","DEL");
}
log.info("{} 请求参数 orderQuery={},queryParam={}", logPre, operateEntryParam, queryParam);
Map<String, String> header = new HashMap<>(2);
header.put("Accept", "application/json");
header.put("Content-Type", "application/x-www-form-urlencoded");
String result = httpService.post(url, header, queryParam);
log.info("{} 返回结果 result:{}", logPre, result);
if (StringUtils.isBlank(result)) {
log.error("{} 处理失败 queryParam={} result={}", logPre, queryParam, result);
return JsonResult.buildErrorStateResult("[处理失败]", Boolean.FALSE);
} else {
TypeReference<JsonResult> typeToken = new TypeReference<JsonResult>() {
};
JsonResult<JsonResult> jsonResult = JSONTools.deserialize(result, typeToken);
if (Objects.isNull(jsonResult) || !jsonResult.isSuccess()) {
return JsonResult.buildErrorStateResult("[处理失败]", Boolean.FALSE);
} else {
return JsonResult.buildSuccessResult("[操作成功]",Boolean.TRUE);
}
}
}
@Override
public JsonResult<EarlySettleUpTrial> earlySettleUpTrial(Long loanId) {
String logPre = "[XyqbServiceImpl.earlySettleUpTrial] 提前一次性结清金额试算";
String url = xyqbSysUrl + "/ex/operate/config/earlysettle/trial_order";
Map<String, Object> queryParam = new HashMap<>(8);
if(Objects.isNull(loanId)){
log.error("{} 请求参数为空,不允许操作 loanId={}",logPre,loanId);
return JsonResult.buildErrorStateResult("借据单号为空,不允许操作", null);
}
queryParam.put("loan_id", loanId);
log.info("{} 请求参数 loanId={},queryParam={}", logPre, loanId, queryParam);
Map<String, String> header = new HashMap<>(2);
header.put("Accept", "application/json");
header.put("Content-Type", "application/x-www-form-urlencoded");
String result = httpService.post(url, header, queryParam);
log.info("{} 返回结果 result:{}", logPre, result);
if (StringUtils.isBlank(result)) {
log.error("{} 处理失败 queryParam={} result={}", logPre, queryParam, result);
return JsonResult.buildErrorStateResult("[处理失败]", null);
} else {
TypeReference<JsonResult<EarlySettleUpTrial>> typeToken = new TypeReference<JsonResult<EarlySettleUpTrial>>() {
};
JsonResult<JsonResult<EarlySettleUpTrial>> jsonResult = JSONTools.deserialize(result, typeToken);
if (Objects.isNull(jsonResult) || !jsonResult.isSuccess()) {
return JsonResult.buildErrorStateResult("[处理失败]", null);
} else {
return JsonResult.buildSuccessResult("[操作成功]",jsonResult.getData());
}
}
}
}
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