Commit 15901576 authored by suntao's avatar suntao

Application.isDebug()

parent 7c08e63c
...@@ -33,10 +33,6 @@ public class Principal { ...@@ -33,10 +33,6 @@ public class Principal {
*/ */
private Set<Role> roles; private Set<Role> roles;
/**
* 是否测试模式 true 是;false 不是测试(生产环境)
*/
private Boolean debugModel;
/** /**
* 是否是超级管理员 * 是否是超级管理员
* *
......
...@@ -30,9 +30,6 @@ public class LogService { ...@@ -30,9 +30,6 @@ public class LogService {
@Autowired @Autowired
private HttpServletRequest request; private HttpServletRequest request;
@Value("${debug.model}")
private Boolean debugModel;
/** /**
* 登入 * 登入
* *
...@@ -62,7 +59,6 @@ public class LogService { ...@@ -62,7 +59,6 @@ public class LogService {
principal.setChannelId(user.getChannelId()); principal.setChannelId(user.getChannelId());
principal.setRank(user.getRank()); principal.setRank(user.getRank());
principal.setRoles(user.getRoles()); principal.setRoles(user.getRoles());
principal.setDebugModel(debugModel);
session.setAttribute(ApplicationDictionary.PRINCIPAL, JSONTools.serialize(principal)); session.setAttribute(ApplicationDictionary.PRINCIPAL, JSONTools.serialize(principal));
......
...@@ -3,6 +3,7 @@ import cn.quantgroup.cashloanflowboss.api.order.model.ApproveVo; ...@@ -3,6 +3,7 @@ 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;
import cn.quantgroup.cashloanflowboss.component.security.annotiation.Security; import cn.quantgroup.cashloanflowboss.component.security.annotiation.Security;
import cn.quantgroup.cashloanflowboss.core.Application;
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;
import cn.quantgroup.cashloanflowboss.core.annotation.CheckChannelRoleByChannelOrderNumber; import cn.quantgroup.cashloanflowboss.core.annotation.CheckChannelRoleByChannelOrderNumber;
...@@ -30,9 +31,6 @@ public class OrderController { ...@@ -30,9 +31,6 @@ public class OrderController {
private OrderService orderService; private OrderService orderService;
@Value("${debug.model}")
private Boolean debugModel;
/** /**
* 订单查询列表接口 * 订单查询列表接口
* *
...@@ -64,7 +62,8 @@ public class OrderController { ...@@ -64,7 +62,8 @@ public class OrderController {
@ChannelIdInit @ChannelIdInit
@PostMapping("/approve") @PostMapping("/approve")
public Result approveOpt(@RequestBody @Valid ApproveVo approveVo) { public Result approveOpt(@RequestBody @Valid ApproveVo approveVo) {
if (debugModel) {
if (Application.isDebug()) {
Tuple<Boolean, Boolean> approveOptBooleanAndFundSettingBooleanTuple = orderService.approveOpt(approveVo); Tuple<Boolean, Boolean> approveOptBooleanAndFundSettingBooleanTuple = orderService.approveOpt(approveVo);
Boolean approveResult = approveOptBooleanAndFundSettingBooleanTuple.getKey(); Boolean approveResult = approveOptBooleanAndFundSettingBooleanTuple.getKey();
if (approveResult) { if (approveResult) {
...@@ -85,7 +84,7 @@ public class OrderController { ...@@ -85,7 +84,7 @@ public class OrderController {
@Security(authorityId = "Order.lending") @Security(authorityId = "Order.lending")
@PostMapping("/lending") @PostMapping("/lending")
public Result<Boolean> lending(@RequestBody @Valid LendingFormModel lendingFormModel) { public Result<Boolean> lending(@RequestBody @Valid LendingFormModel lendingFormModel) {
if (debugModel) { if (Application.isDebug()) {
boolean lendingResult = this.orderService.lending(lendingFormModel); boolean lendingResult = this.orderService.lending(lendingFormModel);
return Result.buildSuccess(lendingResult, lendingResult ? "放款操作成功" : "放款操作失败"); return Result.buildSuccess(lendingResult, lendingResult ? "放款操作成功" : "放款操作失败");
} else { } else {
...@@ -101,7 +100,7 @@ public class OrderController { ...@@ -101,7 +100,7 @@ public class OrderController {
@Security(authorityId = "Order.secondAudit") @Security(authorityId = "Order.secondAudit")
@GetMapping("/secondAudit") @GetMapping("/secondAudit")
public Result<Boolean> secondAudit(String channelOrderNumber) { public Result<Boolean> secondAudit(String channelOrderNumber) {
if (debugModel) { if (Application.isDebug()) {
boolean secondAudit = this.orderService.secondAudit(channelOrderNumber); boolean secondAudit = this.orderService.secondAudit(channelOrderNumber);
return Result.buildSuccess(secondAudit, secondAudit ? "操作成功" : "操作失败"); return Result.buildSuccess(secondAudit, secondAudit ? "操作成功" : "操作失败");
} else { } else {
...@@ -117,7 +116,7 @@ public class OrderController { ...@@ -117,7 +116,7 @@ public class OrderController {
@Security(authorityId = "Order.cancelPreLoan") @Security(authorityId = "Order.cancelPreLoan")
@PostMapping("/cancel/loan") @PostMapping("/cancel/loan")
public Result<Boolean> cancelPreLoan(@RequestBody @Valid String channelOrderNumber) { public Result<Boolean> cancelPreLoan(@RequestBody @Valid String channelOrderNumber) {
if (debugModel) { if (Application.isDebug()) {
return Result.buildSuccess(this.orderService.cancelPreLoan(channelOrderNumber)); return Result.buildSuccess(this.orderService.cancelPreLoan(channelOrderNumber));
} else { } else {
return Result.buildSuccess(false,"无此操作"); return Result.buildSuccess(false,"无此操作");
...@@ -132,7 +131,7 @@ public class OrderController { ...@@ -132,7 +131,7 @@ public class OrderController {
@Security(authorityId = "Order.cancelAfterLoan") @Security(authorityId = "Order.cancelAfterLoan")
@PostMapping("/cancel/after/loan") @PostMapping("/cancel/after/loan")
public Result<Boolean> cancelAfterLoan(@RequestParam @Valid String channelOrderNumber) { public Result<Boolean> cancelAfterLoan(@RequestParam @Valid String channelOrderNumber) {
if (debugModel) { if (Application.isDebug()) {
return Result.buildSuccess(this.orderService.cancelAfterLoan(channelOrderNumber)); return Result.buildSuccess(this.orderService.cancelAfterLoan(channelOrderNumber));
} else { } else {
return Result.buildSuccess(false,"无此操作"); return Result.buildSuccess(false,"无此操作");
......
...@@ -96,10 +96,6 @@ public class OrderService { ...@@ -96,10 +96,6 @@ public class OrderService {
private ClfOrderMappingRepository clfOrderMappingRepository; private ClfOrderMappingRepository clfOrderMappingRepository;
@Value("${debug.model}")
private Boolean debugModel;
public Page<OrderVo> orderList(Long channelId, String channelOrderNo, String applyNo, Long loanId, Integer pageNumber, Integer pageSize) { public Page<OrderVo> orderList(Long channelId, String channelOrderNo, String applyNo, Long loanId, Integer pageNumber, Integer pageSize) {
...@@ -151,7 +147,7 @@ public class OrderService { ...@@ -151,7 +147,7 @@ public class OrderService {
Tuple<String, List<OrderVo.OptButton>> currentStatusAndButtons = this.getCurrentStatusAndButtons(currentStatus, it); Tuple<String, List<OrderVo.OptButton>> currentStatusAndButtons = this.getCurrentStatusAndButtons(currentStatus, it);
orderVo.setStatus(currentStatusAndButtons.getKey()); orderVo.setStatus(currentStatusAndButtons.getKey());
if (debugModel) { if (Application.isDebug()) {
// 只有测试环境才需要订单操作 // 只有测试环境才需要订单操作
orderVo.setOpt(currentStatusAndButtons.getValue()); orderVo.setOpt(currentStatusAndButtons.getValue());
} }
......
...@@ -75,6 +75,15 @@ public class Application implements ApplicationContextAware, ServletContextAware ...@@ -75,6 +75,15 @@ public class Application implements ApplicationContextAware, ServletContextAware
return Application.getValue("${server.port}"); return Application.getValue("${server.port}");
} }
/**
* 是否是测试环境
*
* @return
*/
public static Boolean isDebug() {
return "true".equals(Application.getValue("${debug.model}"));
}
/** /**
* 获取配置属性值 * 获取配置属性值
* *
......
...@@ -24,10 +24,6 @@ public class ClothoCenterService { ...@@ -24,10 +24,6 @@ public class ClothoCenterService {
@Autowired @Autowired
private ClothoCenter clothoCenter; private ClothoCenter clothoCenter;
@Value("${debug.model}")
public Boolean debugModel;
public Boolean orderAuditNotify(String uuid, Long loanId, boolean auditResult, int bizType) { public Boolean orderAuditNotify(String uuid, Long loanId, boolean auditResult, int bizType) {
Map notify = new HashMap(); Map notify = new HashMap();
...@@ -58,7 +54,7 @@ public class ClothoCenterService { ...@@ -58,7 +54,7 @@ public class ClothoCenterService {
*/ */
public boolean lending(Integer fundId, BigDecimal amountLimit, Integer pepoleLimit) { public boolean lending(Integer fundId, BigDecimal amountLimit, Integer pepoleLimit) {
if (debugModel) { if (Application.isDebug()) {
String data = this.clothoCenter.lending(new HashMap(4) {{ String data = this.clothoCenter.lending(new HashMap(4) {{
put("fundingCorpId", fundId); put("fundingCorpId", fundId);
put("amountLimit", amountLimit); put("amountLimit", amountLimit);
...@@ -79,7 +75,7 @@ public class ClothoCenterService { ...@@ -79,7 +75,7 @@ public class ClothoCenterService {
* @return * @return
*/ */
public String approve(Map<String, Object> approveData) { public String approve(Map<String, Object> approveData) {
if (debugModel) { if (Application.isDebug()) {
return clothoCenter.approve(approveData); return clothoCenter.approve(approveData);
} else { } else {
return "error"; return "error";
...@@ -87,7 +83,7 @@ public class ClothoCenterService { ...@@ -87,7 +83,7 @@ public class ClothoCenterService {
} }
public String cancelPreLoan(Map<Object, Object> data) { public String cancelPreLoan(Map<Object, Object> data) {
if (debugModel) { if (Application.isDebug()) {
return clothoCenter.cancelPreLoan(data); return clothoCenter.cancelPreLoan(data);
} else { } else {
return "error"; return "error";
...@@ -95,7 +91,7 @@ public class ClothoCenterService { ...@@ -95,7 +91,7 @@ public class ClothoCenterService {
} }
public String cancelAfterLoan(Map<Object, Object> data) { public String cancelAfterLoan(Map<Object, Object> data) {
if (debugModel) { if (Application.isDebug()) {
return clothoCenter.cancelAfterLoan(data); return clothoCenter.cancelAfterLoan(data);
} else { } else {
return "error"; return "error";
......
package cn.quantgroup.cashloanflowboss.spi.jolyne; package cn.quantgroup.cashloanflowboss.spi.jolyne;
import cn.quantgroup.cashloanflowboss.utils.JSONTools; import cn.quantgroup.cashloanflowboss.utils.JSONTools;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import java.util.List; import java.util.List;
......
...@@ -2,6 +2,7 @@ package cn.quantgroup.cashloanflowboss.spi.xyqb.service; ...@@ -2,6 +2,7 @@ package cn.quantgroup.cashloanflowboss.spi.xyqb.service;
import cn.quantgroup.cashloanflowboss.api.order.model.XyqbCurrentOrderStatusServiceResultModel; import cn.quantgroup.cashloanflowboss.api.order.model.XyqbCurrentOrderStatusServiceResultModel;
import cn.quantgroup.cashloanflowboss.api.order.model.XyqbHistoryOrderStatusServiceResultModel; import cn.quantgroup.cashloanflowboss.api.order.model.XyqbHistoryOrderStatusServiceResultModel;
import cn.quantgroup.cashloanflowboss.core.Application;
import cn.quantgroup.cashloanflowboss.core.base.ServiceResult; import cn.quantgroup.cashloanflowboss.core.base.ServiceResult;
import cn.quantgroup.cashloanflowboss.spi.xyqb.client.XYQBCenter; import cn.quantgroup.cashloanflowboss.spi.xyqb.client.XYQBCenter;
import cn.quantgroup.cashloanflowboss.spi.xyqb.entity.*; import cn.quantgroup.cashloanflowboss.spi.xyqb.entity.*;
...@@ -40,9 +41,6 @@ public class XYQBCenterService { ...@@ -40,9 +41,6 @@ public class XYQBCenterService {
private LoanApplicationHistoryRepository loanApplicationHistoryRepository; private LoanApplicationHistoryRepository loanApplicationHistoryRepository;
@Value("${debug.model}")
public Boolean debugModel;
@Autowired @Autowired
private XYQBCenter xyqbCenter; private XYQBCenter xyqbCenter;
...@@ -188,7 +186,7 @@ public class XYQBCenterService { ...@@ -188,7 +186,7 @@ public class XYQBCenterService {
* @return * @return
*/ */
public boolean payResultNotify(Long loanId, Boolean expectPayResult) { public boolean payResultNotify(Long loanId, Boolean expectPayResult) {
if (debugModel) { if (Application.isDebug()) {
Map paramMap = Maps.newHashMap(); Map paramMap = Maps.newHashMap();
paramMap.put("orderNo", loanId); paramMap.put("orderNo", loanId);
paramMap.put("payOrderNo", loanId); paramMap.put("payOrderNo", loanId);
......
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