|
|
@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
package com.sztzjy.forex.trading_trading.controller;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.sztzjy.forex.trading_trading.annotation.AnonymousAccess;
|
|
|
|
|
|
|
|
import com.sztzjy.forex.trading_trading.config.Constant;
|
|
|
|
|
|
|
|
import com.sztzjy.forex.trading_trading.config.security.JwtUser;
|
|
|
|
|
|
|
|
import com.sztzjy.forex.trading_trading.config.security.TokenProvider;
|
|
|
|
|
|
|
|
import com.sztzjy.forex.trading_trading.entity.Member;
|
|
|
|
|
|
|
|
import com.sztzjy.forex.trading_trading.service.MemberService;
|
|
|
|
|
|
|
|
import io.jsonwebtoken.Jwt;
|
|
|
|
|
|
|
|
import io.swagger.annotations.Api;
|
|
|
|
|
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
|
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@RestController
|
|
|
|
|
|
|
|
@Api(tags = "对外开放接口")
|
|
|
|
|
|
|
|
@RequestMapping("/account")
|
|
|
|
|
|
|
|
public class AccountController {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
private MemberService memberService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation("根据用户Code查询该用户是否存在个人赛用户数据,存在则返回,不存在则新增后返回,用于智云3.0创建用户后调用该接口创建用户个人赛")
|
|
|
|
|
|
|
|
@PostMapping("/checkOrCreateForexSimulationUser")
|
|
|
|
|
|
|
|
@AnonymousAccess
|
|
|
|
|
|
|
|
public Member checkOrCreateForexSimulationUser(@RequestParam String name,
|
|
|
|
|
|
|
|
@RequestParam String className,
|
|
|
|
|
|
|
|
@RequestParam Integer classId,
|
|
|
|
|
|
|
|
@RequestParam String majorName,
|
|
|
|
|
|
|
|
@RequestParam String studentNumber,
|
|
|
|
|
|
|
|
Double initialCapital) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Member member;
|
|
|
|
|
|
|
|
member = memberService.findByTrainingIdAndStudentNumber(Constant.PRACTICE_TRAINING_ID, studentNumber);
|
|
|
|
|
|
|
|
if (member == null) {
|
|
|
|
|
|
|
|
JwtUser jwtUser = new JwtUser();
|
|
|
|
|
|
|
|
jwtUser.setName(name);
|
|
|
|
|
|
|
|
jwtUser.setClassName(className);
|
|
|
|
|
|
|
|
jwtUser.setClassId(classId);
|
|
|
|
|
|
|
|
jwtUser.setMajorName(majorName);
|
|
|
|
|
|
|
|
jwtUser.setUsername(studentNumber);
|
|
|
|
|
|
|
|
member = memberService.buildPracticeMemberByJwtUser(jwtUser, initialCapital);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return member;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|