Commit 3f18c965 authored by suntao's avatar suntao

订单审批

parent 82c312a9
package cn.quantgroup.cashloanflowboss.api.order.model;
import lombok.Data;
/**
* function:
* date: 2019/8/8
*
* @author: suntao
*/
@Data
public class ClothoApproveModel {
private Integer code = 0;
private String msg = "success";
private Long bizChannel;
private String uuid;
private String bizNo;
private Integer bizType;
private Boolean auditResult;
private String amount;
private Long deadLine;
private String extData;
/**
* [{"min":10000,"max":10000,"terms":[{"term":6,"fundInfo":[{"fundId":480,"rate":"0","rateType":1,"priority":"1","feeType":"1"}]}]}]
*/
private String financeProducts;
}
...@@ -3,19 +3,19 @@ package cn.quantgroup.cashloanflowboss.api.order.service; ...@@ -3,19 +3,19 @@ package cn.quantgroup.cashloanflowboss.api.order.service;
import cn.quantgroup.cashloanflowboss.api.channel.entity.boss.ChannelConf; import cn.quantgroup.cashloanflowboss.api.channel.entity.boss.ChannelConf;
import cn.quantgroup.cashloanflowboss.api.channel.repository.boss.ChannelConfRepository; import cn.quantgroup.cashloanflowboss.api.channel.repository.boss.ChannelConfRepository;
import cn.quantgroup.cashloanflowboss.api.order.model.ApproveVo; import cn.quantgroup.cashloanflowboss.api.order.model.ApproveVo;
import cn.quantgroup.cashloanflowboss.api.order.model.ClothoApproveModel;
import cn.quantgroup.cashloanflowboss.api.order.model.OrderVo; import cn.quantgroup.cashloanflowboss.api.order.model.OrderVo;
import cn.quantgroup.cashloanflowboss.api.order.util.OrderUtil; import cn.quantgroup.cashloanflowboss.api.order.util.OrderUtil;
import cn.quantgroup.cashloanflowboss.api.user.model.UserSessionInfo;
import cn.quantgroup.cashloanflowboss.api.user.service.UserSessionService;
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.user.service.UserSysService; import cn.quantgroup.cashloanflowboss.spi.clotho.service.ClothoCenter;
import cn.quantgroup.cashloanflowboss.spi.user.service.XyqbUserService; import cn.quantgroup.cashloanflowboss.spi.user.service.XyqbUserService;
import cn.quantgroup.cashloanflowboss.spi.util.HttpService; import cn.quantgroup.cashloanflowboss.utils.JSONTools;
import cn.quantgroup.user.retbean.XUser; import cn.quantgroup.user.retbean.XUser;
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;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -34,6 +34,9 @@ import java.util.*; ...@@ -34,6 +34,9 @@ import java.util.*;
@Service @Service
public class OrderService { public class OrderService {
@Autowired
private UserSessionService userSessionService;
@Autowired @Autowired
private ChannelConfRepository channelConfRepository; private ChannelConfRepository channelConfRepository;
@Autowired @Autowired
...@@ -41,10 +44,8 @@ public class OrderService { ...@@ -41,10 +44,8 @@ public class OrderService {
@Autowired @Autowired
private XyqbUserService xyqbUserService; private XyqbUserService xyqbUserService;
@Autowired @Autowired
private HttpService httpService; private ClothoCenter clothoCenter;
//@Value("${fund.pay.api-host}")
private String clothoHttp;
public Page<OrderVo> getOrders(Long channelId, String channelOrderNo, Integer pageNumber, Integer pageSize) { public Page<OrderVo> getOrders(Long channelId, String channelOrderNo, Integer pageNumber, Integer pageSize) {
...@@ -76,10 +77,12 @@ public class OrderService { ...@@ -76,10 +77,12 @@ public class OrderService {
orderVo.setChannelOrderNumber(it.getChannelOrderNo()); orderVo.setChannelOrderNumber(it.getChannelOrderNo());
orderVo.setCreatedAt(it.getCreatedAt().getTime()); orderVo.setCreatedAt(it.getCreatedAt().getTime());
OrderVo.OptButton button = new OrderVo.OptButton();
button.setAction(OrderVo.OptButtonAction.audit.name());
button.setName(OrderVo.OptButtonAction.audit.getDesc());
orderVo.setStatus(OrderVo.OptButtonAction.audit.getDesc());
orderVo.setStatus(""); orderVo.setOpt(JSONTools.serialize(button));
orderVo.setOpt("");
orderVo.setMessage(""); orderVo.setMessage("");
return orderVo; return orderVo;
}); });
...@@ -93,6 +96,11 @@ public class OrderService { ...@@ -93,6 +96,11 @@ public class OrderService {
return false; return false;
} }
UserSessionInfo userSessionInfo = userSessionService.findUserSessionInfo();
if (!userSessionInfo.getChannelId().equals(orderMapping.getRegisteredFrom())) {
}
XUser xUser = xyqbUserService.findXUserById(orderMapping.getQgUserId()); XUser xUser = xyqbUserService.findXUserById(orderMapping.getQgUserId());
if (xUser == null) { if (xUser == null) {
log.info("approveOpt,审批失败,未找到用户 channelOrderNumber={}", approveVo.getChannelOrderNumber()); log.info("approveOpt,审批失败,未找到用户 channelOrderNumber={}", approveVo.getChannelOrderNumber());
...@@ -121,23 +129,24 @@ public class OrderService { ...@@ -121,23 +129,24 @@ public class OrderService {
String fundFormat = String.format(OrderUtil.financeProductsFormat, approveVo.getAmount(), approveVo.getAmount(), String fundFormat = String.format(OrderUtil.financeProductsFormat, approveVo.getAmount(), approveVo.getAmount(),
approveVo.getPeriod(), fundId); approveVo.getPeriod(), fundId);
ClothoApproveModel clothoApproveModel = new ClothoApproveModel();
Map<String, Object> data = new HashMap<>(16);
clothoApproveModel.setCode(0); data.put("code", 0);
clothoApproveModel.setMsg("success"); data.put("msg", "success");
clothoApproveModel.setBizChannel(orderMapping.getRegisteredFrom()); data.put("bizChannel", orderMapping.getRegisteredFrom());
clothoApproveModel.setUuid(xUser.getUuid()); data.put("uuid", xUser.getUuid());
clothoApproveModel.setBizNo(orderMapping.getChannelOrderNo()); data.put("bizNo", orderMapping.getChannelOrderNo());
clothoApproveModel.setBizType(channelConf.getBizType()); data.put("bizType", channelConf.getBizType());
clothoApproveModel.setAuditResult(approveVo.getIsPass()); data.put("auditResult", approveVo.getIsPass());
clothoApproveModel.setAmount(approveVo.getAmount()); data.put("amount", approveVo.getAmount());
clothoApproveModel.setDeadLine(calendar.getTime().getTime()); data.put("deadLine", calendar.getTime().getTime());
clothoApproveModel.setExtData(""); data.put("financeProducts", fundFormat);
clothoApproveModel.setFinanceProducts(fundFormat);
String approveResult = clothoCenter.approve(data);
//httpService.post(clothoHttp.concat("/external/quota/auth_amount_audit/notify"), ); if ("success".equals(approveResult)) {
return true;
return true; } else {
return false;
}
} }
} }
package cn.quantgroup.cashloanflowboss.spi.clotho.service;
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;
import java.util.Map;
/**
* function:
* date: 2019/8/9
*
* @author: suntao
*/
@Component
@FeignClient(name = "ClothoServiceCenter", url = "${fund.pay.api-host}", fallback = ClothoCenter.Fallback.class)
public interface ClothoCenter {
@PostMapping(value = "/external/quota/auth_amount_audit/notify", consumes = "application/x-www-form-urlencoded")
String approve(@RequestParam Map approveData);
@Component
class Fallback implements ClothoCenter {
@Override
public String approve(Map approveData) {
return "error";
}
}
}
package cn.quantgroup.cashloanflowboss.spi.xyqb.service;
/**
* function:
* date: 2019/8/9
*
* @author: suntao
*/
public class XyqbCenter {
}
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