Commit 9ebc7050 authored by suntao's avatar suntao

操作记录 审批操作 加到数据库

parent 1f29759d
...@@ -9,7 +9,6 @@ import cn.quantgroup.cashloanflowboss.spi.clf.entity.ClfOrderMapping; ...@@ -9,7 +9,6 @@ import cn.quantgroup.cashloanflowboss.spi.clf.entity.ClfOrderMapping;
import cn.quantgroup.cashloanflowboss.spi.clf.service.CLFCenterService; import cn.quantgroup.cashloanflowboss.spi.clf.service.CLFCenterService;
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.data.domain.Page;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.persistence.criteria.Predicate; import javax.persistence.criteria.Predicate;
...@@ -86,4 +85,11 @@ public class OptHistoryLogService { ...@@ -86,4 +85,11 @@ public class OptHistoryLogService {
}); });
return page; return page;
} }
public void save(OptHistoryLog optHistoryLog) {
optHistoryLogRepository.save(optHistoryLog);
}
} }
package cn.quantgroup.cashloanflowboss.api.order.controller; package cn.quantgroup.cashloanflowboss.api.order.controller;
import java.util.Date;
import cn.quantgroup.cashloanflowboss.api.optlog.entity.OptHistoryLog;
import cn.quantgroup.cashloanflowboss.api.optlog.service.OptHistoryLogService;
import cn.quantgroup.cashloanflowboss.api.order.model.ApproveVo; import cn.quantgroup.cashloanflowboss.api.order.model.ApproveVo;
import cn.quantgroup.cashloanflowboss.api.order.model.LendingFormModel; import cn.quantgroup.cashloanflowboss.api.order.model.LendingFormModel;
import cn.quantgroup.cashloanflowboss.api.order.service.OrderService; import cn.quantgroup.cashloanflowboss.api.order.service.OrderService;
...@@ -30,6 +33,7 @@ public class OrderController { ...@@ -30,6 +33,7 @@ public class OrderController {
@Autowired @Autowired
private OrderService orderService; private OrderService orderService;
@Value("${debug.model}") @Value("${debug.model}")
private Boolean debugModel; private Boolean debugModel;
...@@ -65,10 +69,10 @@ public class OrderController { ...@@ -65,10 +69,10 @@ public class OrderController {
@PostMapping("/approve") @PostMapping("/approve")
public Result approveOpt(@RequestBody @Valid ApproveVo approveVo) { public Result approveOpt(@RequestBody @Valid ApproveVo approveVo) {
if (debugModel) { if (debugModel) {
Tuple<Boolean, Boolean> booleanBooleanTuple = orderService.approveOpt(approveVo); Tuple<Boolean, Boolean> approveOptBooleanAndFundSettingBooleanTuple = orderService.approveOpt(approveVo);
Boolean approveResult = booleanBooleanTuple.getKey(); Boolean approveResult = approveOptBooleanAndFundSettingBooleanTuple.getKey();
if (approveResult) { if (approveResult) {
return Result.buildSuccess(approveResult, booleanBooleanTuple.getValue() ? "审批操作成功" : "请检查资产计划配置,审批操作成功"); return Result.buildSuccess(approveResult, approveOptBooleanAndFundSettingBooleanTuple.getValue() ? "审批操作成功" : "请检查资产计划配置,审批操作成功");
} else { } else {
return Result.buildSuccess(false,"审批操作失败"); return Result.buildSuccess(false,"审批操作失败");
} }
......
package cn.quantgroup.cashloanflowboss.api.order.service; package cn.quantgroup.cashloanflowboss.api.order.service;
import cn.quantgroup.cashloanflowboss.api.optlog.entity.OptHistoryLog;
import cn.quantgroup.cashloanflowboss.api.optlog.service.OptHistoryLogService;
import cn.quantgroup.cashloanflowboss.api.user.model.UserDetailInfo;
import cn.quantgroup.cashloanflowboss.api.user.service.UserService;
import cn.quantgroup.cashloanflowboss.spi.clf.entity.CallbackFailRecord; import cn.quantgroup.cashloanflowboss.spi.clf.entity.CallbackFailRecord;
import cn.quantgroup.cashloanflowboss.spi.clf.model.LoanProgress; import cn.quantgroup.cashloanflowboss.spi.clf.model.LoanProgress;
import cn.quantgroup.cashloanflowboss.spi.clf.model.CallbackRouter; import cn.quantgroup.cashloanflowboss.spi.clf.model.CallbackRouter;
...@@ -65,6 +69,10 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -65,6 +69,10 @@ import org.springframework.transaction.annotation.Transactional;
@Service @Service
public class OrderService { public class OrderService {
@Autowired
private OptHistoryLogService optHistoryLogService;
@Autowired @Autowired
private ChannelConfRepository channelConfRepository; private ChannelConfRepository channelConfRepository;
@Autowired @Autowired
...@@ -240,14 +248,35 @@ public class OrderService { ...@@ -240,14 +248,35 @@ public class OrderService {
} catch (Exception e) { } catch (Exception e) {
log.error("审批,资方校验异常,channelOrderNumber={},fundId={}, e={}", orderMapping.getChannelOrderNo(), fundId, ExceptionUtils.getStackTrace(e)); log.error("审批,资方校验异常,channelOrderNumber={},fundId={}, e={}", orderMapping.getChannelOrderNo(), fundId, ExceptionUtils.getStackTrace(e));
} }
// 操作记录
OptHistoryLog optHistoryLog = new OptHistoryLog();
optHistoryLog.setChannelOrderNumber(approveVo.getChannelOrderNumber());
optHistoryLog.setCreditNumber(orderMapping.getApplyNo());
optHistoryLog.setLoanId(orderMapping.getLoanId());
optHistoryLog.setChannelId(orderMapping.getRegisteredFrom());
optHistoryLog.setOptName("审批操作");
optHistoryLog.setCreateTime(new Date());
Boolean optResult;
if ("success".equals(approveStringResult)) { if ("success".equals(approveStringResult)) {
optHistoryLog.setOptLogDetail(corpPolicyValidate ? "" : "资产计划未配置,请联系管理员配置");
optHistoryLog.setOptResult(true);
optResult = true;
log.info("审批申请成功,channelOrderNumber={}", orderMapping.getChannelOrderNo()); log.info("审批申请成功,channelOrderNumber={}", orderMapping.getChannelOrderNo());
return new Tuple<>(true, corpPolicyValidate);
} else { } else {
optHistoryLog.setOptResult(false);
optHistoryLog.setOptLogDetail("审批失败");
log.info("审批申请失败,channelOrderNumber={},requestParam={}", orderMapping.getChannelOrderNo(), JSONTools.serialize(data)); log.info("审批申请失败,channelOrderNumber={},requestParam={}", orderMapping.getChannelOrderNo(), JSONTools.serialize(data));
return new Tuple<>(false, corpPolicyValidate); optResult = false;
} }
optHistoryLogService.save(optHistoryLog);
return new Tuple<>(optResult, corpPolicyValidate);
} }
/** /**
......
...@@ -30,7 +30,7 @@ public class UserDetailInfo { ...@@ -30,7 +30,7 @@ public class UserDetailInfo {
} }
@Data @Data
static class UserInfo { public static class UserInfo {
private Long userId; private Long userId;
private String userName; private String userName;
} }
......
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