...
|
...
|
@@ -4,6 +4,7 @@ import com.wordnik.swagger.annotations.ApiImplicitParam; |
|
|
import com.wordnik.swagger.annotations.ApiImplicitParams;
|
|
|
import com.wordnik.swagger.annotations.ApiOperation;
|
|
|
import com.xkl.authorization.annotation.Authorization;
|
|
|
import com.xkl.authorization.annotation.CurrentAdmin;
|
|
|
import com.xkl.authorization.annotation.CurrentUser;
|
|
|
import com.xkl.authorization.manager.ITokenManager;
|
|
|
import com.xkl.authorization.model.TokenModel;
|
...
|
...
|
@@ -48,14 +49,16 @@ public class UploadSoftwareAccountController { |
|
|
|
|
|
AMPMachine ampMachine = ampMachineRepository.findBySecretKey(ampkey.trim());
|
|
|
if (ampMachine == null ||// 未找到密钥所对应的机器
|
|
|
!ampMachine.getAMPSerial().equals(ampserial)) {
|
|
|
!ampMachine.getAMPSerial().equals(ampserial) ||//amp序号不符合
|
|
|
ampMachine.getStatus() != 1) {//用户无效
|
|
|
return new ResponseEntity<>(ResultModel.error(ResultStatus.AMP_KEY_ERROR), HttpStatus.NOT_FOUND);
|
|
|
|
|
|
}
|
|
|
|
|
|
Admin admin = adminRepository.findByAccount(account);
|
|
|
if (admin == null || //未注册
|
|
|
!admin.getPwd().equals(password)) { //密码错误
|
|
|
!admin.getPwd().equals(password) ||//密码错误
|
|
|
admin.getStatus() != 1) {//用户无效
|
|
|
//提示用户名或密码错误
|
|
|
return new ResponseEntity<>(ResultModel.error(ResultStatus.USERNAME_OR_PASSWORD_ERROR), HttpStatus.NOT_FOUND);
|
|
|
}
|
...
|
...
|
@@ -67,13 +70,26 @@ public class UploadSoftwareAccountController { |
|
|
|
|
|
@RequestMapping(method = RequestMethod.DELETE)
|
|
|
@Authorization
|
|
|
@ApiOperation(value = "退出登录")
|
|
|
@ApiOperation(value = "报告上传软件退出登录")
|
|
|
@ApiImplicitParams({
|
|
|
@ApiImplicitParam(name = "authorization", value = "请输入登录返回信息:userId_tokens", required = true, dataType = "string", paramType = "header"),
|
|
|
})
|
|
|
public ResponseEntity<ResultModel> logout(@CurrentUser Admin admin) {
|
|
|
public ResponseEntity<ResultModel> logout(@CurrentAdmin Admin admin) {
|
|
|
tokenManager.deleteToken(admin.getId());
|
|
|
return new ResponseEntity<>(ResultModel.ok(), HttpStatus.OK);
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "/modpwd", method = RequestMethod.PUT)
|
|
|
@Authorization
|
|
|
@ApiOperation(value = "报告上传软件修改用户密码")
|
|
|
@ApiImplicitParams({
|
|
|
@ApiImplicitParam(name = "authorization", value = "请以如下格式输入登录返回信息:adminId_tokens", required = true, dataType = "string", paramType = "header"),
|
|
|
})
|
|
|
public ResponseEntity<ResultModel> modpwd(@CurrentAdmin Admin admin, @RequestParam String newpwd) {
|
|
|
|
|
|
admin = adminRepository.findById(admin.getId());
|
|
|
admin.setPwd(newpwd);
|
|
|
adminRepository.save(admin);
|
|
|
return new ResponseEntity<>(ResultModel.ok(), HttpStatus.OK);
|
|
|
}
|
|
|
} |
...
|
...
|
|