Commit 15901576 authored by suntao's avatar suntao

Application.isDebug()

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