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;
import cn.quantgroup.cashloanflowboss.api.channel.entity.boss.ChannelConf;
import cn.quantgroup.cashloanflowboss.api.channel.repository.boss.ChannelConfRepository;
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.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.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.util.HttpService;
import cn.quantgroup.cashloanflowboss.utils.JSONTools;
import cn.quantgroup.user.retbean.XUser;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
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.PageRequest;
import org.springframework.stereotype.Service;
......@@ -34,6 +34,9 @@ import java.util.*;
@Service
public class OrderService {
@Autowired
private UserSessionService userSessionService;
@Autowired
private ChannelConfRepository channelConfRepository;
@Autowired
......@@ -41,10 +44,8 @@ public class OrderService {
@Autowired
private XyqbUserService xyqbUserService;
@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) {
......@@ -76,10 +77,12 @@ public class OrderService {
orderVo.setChannelOrderNumber(it.getChannelOrderNo());
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.setOpt("");
orderVo.setStatus(OrderVo.OptButtonAction.audit.getDesc());
orderVo.setOpt(JSONTools.serialize(button));
orderVo.setMessage("");
return orderVo;
});
......@@ -93,6 +96,11 @@ public class OrderService {
return false;
}
UserSessionInfo userSessionInfo = userSessionService.findUserSessionInfo();
if (!userSessionInfo.getChannelId().equals(orderMapping.getRegisteredFrom())) {
}
XUser xUser = xyqbUserService.findXUserById(orderMapping.getQgUserId());
if (xUser == null) {
log.info("approveOpt,审批失败,未找到用户 channelOrderNumber={}", approveVo.getChannelOrderNumber());
......@@ -121,23 +129,24 @@ public class OrderService {
String fundFormat = String.format(OrderUtil.financeProductsFormat, approveVo.getAmount(), approveVo.getAmount(),
approveVo.getPeriod(), fundId);
ClothoApproveModel clothoApproveModel = new ClothoApproveModel();
clothoApproveModel.setCode(0);
clothoApproveModel.setMsg("success");
clothoApproveModel.setBizChannel(orderMapping.getRegisteredFrom());
clothoApproveModel.setUuid(xUser.getUuid());
clothoApproveModel.setBizNo(orderMapping.getChannelOrderNo());
clothoApproveModel.setBizType(channelConf.getBizType());
clothoApproveModel.setAuditResult(approveVo.getIsPass());
clothoApproveModel.setAmount(approveVo.getAmount());
clothoApproveModel.setDeadLine(calendar.getTime().getTime());
clothoApproveModel.setExtData("");
clothoApproveModel.setFinanceProducts(fundFormat);
//httpService.post(clothoHttp.concat("/external/quota/auth_amount_audit/notify"), );
return true;
Map<String, Object> data = new HashMap<>(16);
data.put("code", 0);
data.put("msg", "success");
data.put("bizChannel", orderMapping.getRegisteredFrom());
data.put("uuid", xUser.getUuid());
data.put("bizNo", orderMapping.getChannelOrderNo());
data.put("bizType", channelConf.getBizType());
data.put("auditResult", approveVo.getIsPass());
data.put("amount", approveVo.getAmount());
data.put("deadLine", calendar.getTime().getTime());
data.put("financeProducts", fundFormat);
String approveResult = clothoCenter.approve(data);
if ("success".equals(approveResult)) {
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