Commit 3a471b8f authored by 王俊权's avatar 王俊权

贷前关单

parent ef7b8145
package cn.quantgroup.cashloanflowboss.api.order.controller; package cn.quantgroup.cashloanflowboss.api.order.controller;
import cn.quantgroup.cashloanflowboss.api.order.model.ApproveVo; import cn.quantgroup.cashloanflowboss.api.order.model.ApproveVo;
import cn.quantgroup.cashloanflowboss.api.order.model.OrderVo;
import cn.quantgroup.cashloanflowboss.api.order.service.OrderService; import cn.quantgroup.cashloanflowboss.api.order.service.OrderService;
import cn.quantgroup.cashloanflowboss.core.annotation.ChannelIdInit; import cn.quantgroup.cashloanflowboss.core.annotation.ChannelIdInit;
import cn.quantgroup.cashloanflowboss.core.annotation.CheckChannelRole; import cn.quantgroup.cashloanflowboss.core.annotation.CheckChannelRole;
...@@ -37,4 +38,8 @@ public class OrderController { ...@@ -37,4 +38,8 @@ public class OrderController {
return Result.buildSuccess(orderService.approveOpt(approveVo)); return Result.buildSuccess(orderService.approveOpt(approveVo));
} }
@PostMapping(value = "/cancel/loan",consumes = "application/json")
public Result cancel(@RequestBody @Valid OrderVo orderVo) {
return Result.buildSuccess(orderService.cancel(orderVo));
}
} }
...@@ -9,9 +9,13 @@ import cn.quantgroup.cashloanflowboss.core.Application; ...@@ -9,9 +9,13 @@ import cn.quantgroup.cashloanflowboss.core.Application;
import cn.quantgroup.cashloanflowboss.spi.clf.entity.ClfOrderMapping; import cn.quantgroup.cashloanflowboss.spi.clf.entity.ClfOrderMapping;
import cn.quantgroup.cashloanflowboss.spi.clf.repository.ClfOrderMappingRepository; import cn.quantgroup.cashloanflowboss.spi.clf.repository.ClfOrderMappingRepository;
import cn.quantgroup.cashloanflowboss.spi.clotho.service.ClothoCenter; import cn.quantgroup.cashloanflowboss.spi.clotho.service.ClothoCenter;
import cn.quantgroup.cashloanflowboss.spi.jolyne.JolyneCenter;
import cn.quantgroup.cashloanflowboss.spi.user.service.XyqbUserService; import cn.quantgroup.cashloanflowboss.spi.user.service.XyqbUserService;
import cn.quantgroup.cashloanflowboss.utils.JSONTools; import cn.quantgroup.cashloanflowboss.utils.JSONTools;
import cn.quantgroup.user.retbean.XUser; import cn.quantgroup.user.retbean.XUser;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import java.util.concurrent.ConcurrentMap;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
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;
...@@ -41,6 +45,8 @@ public class OrderService { ...@@ -41,6 +45,8 @@ public class OrderService {
private XyqbUserService xyqbUserService; private XyqbUserService xyqbUserService;
@Autowired @Autowired
private ClothoCenter clothoCenter; private ClothoCenter clothoCenter;
@Autowired
private JolyneCenter jolyneCenter;
...@@ -150,4 +156,30 @@ public class OrderService { ...@@ -150,4 +156,30 @@ public class OrderService {
return false; return false;
} }
} }
public boolean cancel(OrderVo orderVo){
ClfOrderMapping orderMapping = clfOrderMappingRepository.findByChannelOrderNoLastOne(orderVo.getChannelOrderNumber());
if (orderMapping == null) {
log.info("cancel,关单失败,无订单 channelOrderNumber={}", orderVo.getChannelOrderNumber());
return false;
}
XUser xUser = xyqbUserService.findXUserById(orderMapping.getQgUserId());
if (xUser == null) {
log.info("cancel,关单失败,未找到用户 channelOrderNumber={}", orderVo.getChannelOrderNumber());
return false;
}
Long userId = xUser.getId();
ConcurrentMap<Object, Object> data = Maps.newConcurrentMap();
ArrayList<Object> cancel_list = Lists.newArrayList();
cancel_list.add("update xyqb.quota_credit set is_active=0 where user_id="+userId);
cancel_list.add("update xyqb.quota_account set is_active=0 where user_id="+userId);
cancel_list.add("update xyqb.loan_application_history set progress=16 where user_id="+userId);
cancel_list.add("update xyqb.loan_application_history set is_active=0 where user_id="+userId);
cancel_list.add("delete from apply_quota_record where user_id="+userId);
cancel_list.add("delete from user_operation_history where user_id="+userId);
data.put("sql",cancel_list);
String cancel_result = jolyneCenter.cancel(JSONTools.serialize(data));
return "success".equals(cancel_result);
}
} }
package cn.quantgroup.cashloanflowboss.spi.jolyne;
import cn.quantgroup.cashloanflowboss.spi.clotho.service.ClothoCenter;
import java.util.Map;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
@Component
@FeignClient(name = "JolyneServiceCenter", url = "http://192.168.4.156:9001/executeSQL/{{NAMESPACE}}", fallback = JolyneCenter.Fallback.class)
public interface JolyneCenter {
@PostMapping(value = "/xyqb", consumes = "application/json")
String cancel(@RequestParam("json") String cancelData);
@Component
class Fallback implements JolyneCenter {
@Override
public String cancel(String cancelData) {
return null;
}
}
}
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