mirror of
https://gitee.com/freshday/radar.git
synced 2025-12-26 07:16:26 +08:00
增加vip权限字段,限制构建模型,节省资源。
feihu wang
This commit is contained in:
parent
7133c135c2
commit
d72238161b
8
pom.xml
8
pom.xml
@ -265,7 +265,12 @@
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>nexus-aliyun</id>
|
||||
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<build>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
@ -323,5 +328,4 @@
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
|
||||
@ -4,6 +4,7 @@ package com.pgmmers.radar.controller;
|
||||
import com.pgmmers.radar.dal.bean.ModelQuery;
|
||||
import com.pgmmers.radar.enums.StatusType;
|
||||
import com.pgmmers.radar.intercpt.ContextHolder;
|
||||
import com.pgmmers.radar.service.admin.UserService;
|
||||
import com.pgmmers.radar.service.common.CommonResult;
|
||||
import com.pgmmers.radar.service.model.ModelService;
|
||||
import com.pgmmers.radar.vo.admin.UserVO;
|
||||
@ -29,6 +30,9 @@ public class ModelApiController {
|
||||
@Autowired
|
||||
private ContextHolder contextHolder;
|
||||
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
|
||||
@GetMapping("/{id}")
|
||||
public CommonResult get(@PathVariable Long id) {
|
||||
CommonResult result = new CommonResult();
|
||||
@ -96,6 +100,13 @@ public class ModelApiController {
|
||||
@PostMapping("/build/{id}")
|
||||
public CommonResult build(@PathVariable Long id) {
|
||||
CommonResult result = new CommonResult();
|
||||
String userName = contextHolder.getContext().getUsername();
|
||||
UserVO userVO = userService.getByUserName(userName);
|
||||
if (userVO.getVipLevel() <= 0) {
|
||||
result.setSuccess(false);
|
||||
result.setMsg("服务器资源有限,请联系作者开通VIP权限!");
|
||||
return result;
|
||||
}
|
||||
try {
|
||||
result = modelService.build(id);
|
||||
} catch (Exception e) {
|
||||
|
||||
@ -93,7 +93,7 @@ public class SysLoginApiController {
|
||||
* @author xushuai
|
||||
*/
|
||||
@PostMapping("/merchant/regist")
|
||||
public CommonResult regist(String loginName, String passwd, String verifyPasswd, String captcha, HttpServletRequest request) {
|
||||
public CommonResult regist(String loginName, String passwd, String verifyPasswd, String captcha,String giteeAccount, HttpServletRequest request) {
|
||||
CommonResult result = new CommonResult();
|
||||
|
||||
String checkResult = checkParam(loginName, passwd, verifyPasswd, captcha, request);
|
||||
@ -115,6 +115,8 @@ public class SysLoginApiController {
|
||||
userVO.setUserName(loginName);
|
||||
userVO.setPasswd(encrypt);
|
||||
userVO.setStatus("1");
|
||||
userVO.setVipLevel(0);
|
||||
userVO.setGiteeAccount(giteeAccount);
|
||||
userVO.setCode(loginName);
|
||||
userVO.setCreateTime(new Date());
|
||||
userVO.setUpdateTime(new Date());
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
<!doctype html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width,initial-scale=1"> <title>风控引擎管理平台</title> <link rel="shortcut icon" href="/images/anquan.png"> <!--[if lt IE 10]>
|
||||
<script src="https://as.alipayobjects.com/g/component/??console-polyfill/0.2.2/index.js,es5-shim/4.5.7/es5-shim.min.js,es5-shim/4.5.7/es5-sham.min.js,html5shiv/3.7.2/html5shiv.min.js,media-match/2.0.2/media.match.min.js"></script>
|
||||
<![endif]--> <link href="./index.f4b2bdd4-1.css" rel="stylesheet"><link href="./index.f4b2bdd4-2.css" rel="stylesheet"><link href="./index.f4b2bdd4-3.css" rel="stylesheet"></head> <body> <div id="react-content"></div> <script type="text/javascript" src="./main.f4b2bdd4.js"></script></body> </html>
|
||||
<![endif]--> <link href="./index.ab367878-1.css" rel="stylesheet"><link href="./index.ab367878-2.css" rel="stylesheet"><link href="./index.ab367878-3.css" rel="stylesheet"></head> <body> <div id="react-content"></div> <script type="text/javascript" src="./main.ab367878.js"></script></body> </html>
|
||||
File diff suppressed because one or more lines are too long
@ -16,6 +16,14 @@ public class UserVO implements Serializable{
|
||||
|
||||
private String status;
|
||||
|
||||
private Integer vipLevel;
|
||||
|
||||
private String mobile;
|
||||
|
||||
private String email;
|
||||
|
||||
private String giteeAccount;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
private Date updateTime;
|
||||
@ -75,4 +83,36 @@ public class UserVO implements Serializable{
|
||||
public void setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
public Integer getVipLevel() {
|
||||
return vipLevel;
|
||||
}
|
||||
|
||||
public void setVipLevel(Integer vipLevel) {
|
||||
this.vipLevel = vipLevel;
|
||||
}
|
||||
|
||||
public String getMobile() {
|
||||
return mobile;
|
||||
}
|
||||
|
||||
public void setMobile(String mobile) {
|
||||
this.mobile = mobile;
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
public String getGiteeAccount() {
|
||||
return giteeAccount;
|
||||
}
|
||||
|
||||
public void setGiteeAccount(String giteeAccount) {
|
||||
this.giteeAccount = giteeAccount;
|
||||
}
|
||||
}
|
||||
|
||||
@ -22,6 +22,18 @@ public class UserPO {
|
||||
@Column(name = "STATUS")
|
||||
private String status;
|
||||
|
||||
@Column(name = "VIP_LEVEL")
|
||||
private Integer vipLevel;
|
||||
|
||||
@Column(name = "MOBILE")
|
||||
private String mobile;
|
||||
|
||||
@Column(name = "EMAIL")
|
||||
private String email;
|
||||
|
||||
@Column(name = "GITEE_ACCOUNT")
|
||||
private String giteeAccount;
|
||||
|
||||
@Column(name = "CREATE_TIME")
|
||||
private Date createTime;
|
||||
|
||||
@ -98,6 +110,62 @@ public class UserPO {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return VIP_LEVEL
|
||||
*/
|
||||
public Integer getVipLevel() {
|
||||
return vipLevel;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param vipLevel
|
||||
*/
|
||||
public void setVipLevel(Integer vipLevel) {
|
||||
this.vipLevel = vipLevel;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return MOBILE
|
||||
*/
|
||||
public String getMobile() {
|
||||
return mobile;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mobile
|
||||
*/
|
||||
public void setMobile(String mobile) {
|
||||
this.mobile = mobile;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return EMAIL
|
||||
*/
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param email
|
||||
*/
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return GITEE_ACCOUNT
|
||||
*/
|
||||
public String getGiteeAccount() {
|
||||
return giteeAccount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param giteeAccount
|
||||
*/
|
||||
public void setGiteeAccount(String giteeAccount) {
|
||||
this.giteeAccount = giteeAccount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return CREATE_TIME
|
||||
*/
|
||||
|
||||
@ -10,6 +10,10 @@
|
||||
<result column="PASSWD" jdbcType="VARCHAR" property="passwd" />
|
||||
<result column="CODE" jdbcType="VARCHAR" property="code" />
|
||||
<result column="STATUS" jdbcType="VARCHAR" property="status" />
|
||||
<result column="VIP_LEVEL" jdbcType="INTEGER" property="vipLevel" />
|
||||
<result column="MOBILE" jdbcType="VARCHAR" property="mobile" />
|
||||
<result column="EMAIL" jdbcType="VARCHAR" property="email" />
|
||||
<result column="GITEE_ACCOUNT" jdbcType="VARCHAR" property="giteeAccount" />
|
||||
<result column="CREATE_TIME" jdbcType="TIMESTAMP" property="createTime" />
|
||||
<result column="UPDATE_TIME" jdbcType="TIMESTAMP" property="updateTime" />
|
||||
</resultMap>
|
||||
|
||||
@ -42,6 +42,18 @@ public class UserServiceImpl implements UserService {
|
||||
return Optional.ofNullable(users);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserVO getByUserName(String userName) {
|
||||
UserQuery query = new UserQuery();
|
||||
query.setUserName(userName);
|
||||
PageResult<UserPO> result = userDal.query(query);
|
||||
UserVO userVO = null;
|
||||
if (result.getRowCount() > 0) {
|
||||
userVO = userMapping.sourceToTarget(result.getList().get(0));
|
||||
}
|
||||
return userVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer insert(UserVO userVO) {
|
||||
UserPO userPO = userMapping.targetToSource(userVO);
|
||||
|
||||
@ -115,6 +115,7 @@ public class ModelServiceImpl implements ModelService, SubscribeHandle {
|
||||
ModelQuery query = new ModelQuery();
|
||||
query.setMerchantCode(model.getCode());
|
||||
query.setLabel(model.getLabel());
|
||||
query.setPageSize(100);
|
||||
PageResult<ModelVO> page = modelDal.query(query);
|
||||
if (page != null && page.getRowCount() > 0 && (model.getId() == null)) {
|
||||
for (ModelVO tmp : page.getList()) {
|
||||
@ -124,7 +125,6 @@ public class ModelServiceImpl implements ModelService, SubscribeHandle {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if (model.getId() == null) {
|
||||
model.setStatus(StatusType.INIT.getKey());
|
||||
|
||||
@ -14,5 +14,7 @@ public interface UserService {
|
||||
|
||||
Optional<List<UserVO>> list(String userName, String passwd);
|
||||
|
||||
UserVO getByUserName(String userName);
|
||||
|
||||
Integer insert(UserVO userVO);
|
||||
}
|
||||
|
||||
4
sql/radar-1.0.4.sql
Normal file
4
sql/radar-1.0.4.sql
Normal file
@ -0,0 +1,4 @@
|
||||
ALTER TABLE `users` ADD COLUMN `VIP_LEVEL` int(0) NULL DEFAULT 0 AFTER `STATUS`;
|
||||
ALTER TABLE `users` ADD COLUMN `MOBILE` varchar(20) NULL AFTER `VIP_LEVEL`;
|
||||
ALTER TABLE `users` ADD COLUMN `EMAIL` varchar(32) NULL AFTER `MOBILE`;
|
||||
ALTER TABLE `users` ADD COLUMN `GITEE_ACCOUNT` varchar(32) NULL AFTER `EMAIL`;
|
||||
Loading…
x
Reference in New Issue
Block a user