| | |
| | | package com.xiaopeng.operation.controller; |
| | | |
| | | import com.xiaopeng.api.model.operation.XpTradingStrategy; |
| | | import com.xiaopeng.common.core.domain.R; |
| | | import com.xiaopeng.common.core.web.controller.BaseController; |
| | | import com.xiaopeng.common.log.annotation.AdminOperationLog; |
| | | import com.xiaopeng.common.log.enums.AdminBusinessType; |
| | | import com.xiaopeng.common.log.enums.AdminOperationType; |
| | | import com.xiaopeng.operation.dto.XpTradingStrategyEditDTO; |
| | | import com.xiaopeng.operation.service.IXpTradingStrategyService; |
| | | import com.xiaopeng.operation.vo.XpTradingStrategyDetailVO; |
| | | import com.xiaopeng.api.vo.operation.XpTradingStrategyDetailVO; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.validation.Valid; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | @RestController |
| | | @Api(tags = "交易策略管理") |
| | | @RequiredArgsConstructor |
| | | @RequiredArgsConstructor(onConstructor_ = @Lazy) |
| | | public class XpTradingStrategyController extends BaseController { |
| | | |
| | | private final IXpTradingStrategyService tradingStrategyService; |
| | |
| | | return R.ok(detail); |
| | | } |
| | | |
| | | @ApiOperation(value = "获取交易策略配置", tags = {"inner-交易策略配置"}) |
| | | @GetMapping("/logan/inner/xpOperationStrategy/getOne") |
| | | public R<XpTradingStrategyDetailVO> getOne() { |
| | | XpTradingStrategyDetailVO detail = tradingStrategyService.queryDetail(); |
| | | return R.ok(detail); |
| | | } |
| | | |
| | | /** |
| | | * 修改交易策略 |
| | | * |
| | |
| | | */ |
| | | @ApiOperation(value = "修改交易策略", tags = {"管理后台-交易管理-交易策略配置"}) |
| | | @PostMapping("/api/v1/tradingStrategy/edit") |
| | | @AdminOperationLog( |
| | | businessType = AdminBusinessType.TRADING_STRATEGY_MANAGEMENT, |
| | | operationType = AdminOperationType.EDIT, |
| | | content = "修改交易策略", |
| | | appendRequestData = true |
| | | ) |
| | | public R<?> edit(@Validated @RequestBody XpTradingStrategyEditDTO dto) { |
| | | tradingStrategyService.editStrategy(dto); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据开通城市获取交易策略 |
| | | * @param cityCode |
| | | * @return |
| | | */ |
| | | @GetMapping("/logan/inner/xpOperationStrategy/getTradingStrategyByCityCode/{cityCode}") |
| | | public R<XpTradingStrategy> getTradingStrategyByCityCode(@PathVariable String cityCode){ |
| | | XpTradingStrategy detail = tradingStrategyService.getTradingStrategyByCityCode(cityCode); |
| | | return R.ok(detail); |
| | | } |
| | | } |