答题处理

pull/1/head
huan.xu 5 years ago
parent dd64ea523f
commit 5e4be58b1a
  1. 55
      blockchain-server/blockchain-server-user/src/main/java/com/blockchain/server/user/controller/LoginController.java
  2. 2
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/LoginController.java
  3. 63
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/StudentAnswerController.java
  4. 2
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/api/StudentAnswerApi.java
  5. 16
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/AssessUserTargetDto.java
  6. 46
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/entity/AssessUserProject.java
  7. 65
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/entity/AssessUserTarget.java
  8. 95
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/enums/UserEnums.java
  9. 52
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/exceprion/UserException.java
  10. 3
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/mapper/AssessUserMapper.java
  11. 15
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/mapper/AssessUserProjectMapper.java
  12. 16
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/mapper/AssessUserTargetMapper.java
  13. 4
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/AssessUserProjectService.java
  14. 1
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/AssessUserService.java
  15. 13
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/AssessUserTargetService.java
  16. 15
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/impl/AssessUserProjectServiceImpl.java
  17. 4
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/impl/AssessUserServiceImpl.java
  18. 23
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/impl/AssessUserTargetServiceImpl.java
  19. 56
      blockchain-server/blockchain-server-yyyf/src/main/resources/mapper/AssessUserTargetMapper.xml

@ -273,34 +273,12 @@ public class LoginController {
*/ */
private ResultDTO handleAfterLogin(UserMain userMain, String tokenType, HttpServletRequest request) { private ResultDTO handleAfterLogin(UserMain userMain, String tokenType, HttpServletRequest request) {
String userId=userMain.getId();
Integer yyyfUserId = null;
String yyyfTtoken = request.getHeader(BaseConstant.YYYF_TOKEN_HEADER);
//如果有token,拿到用户信息,与以渔有方进行绑定
if (redisTemplate.hasKey(yyyfTtoken)) {
YyyfUserDto yyyfUserDto = (YyyfUserDto) redisTemplate.opsForValue().get(yyyfTtoken);
yyyfUserId = yyyfUserDto.getId();
String userId =userMain.getId();
YyyfUser yyyfUser = this.yyyfUserService.selectByYyyfUserIdAndTel(yyyfUserId, userMain.getMobilePhone());
if (yyyfUser == null) {
this.yyyfUserService.saveUser(yyyfUserId, userId, yyyfUserDto.getName());
this.redisTemplate.delete(yyyfTtoken);
}else{
if(!yyyfUser.getUserId().equals(userMain.getId())){
throw new UserException(UserEnums.USER_NOT_FORBID_OTHER_USER);
}
}
}else{
throw new UserException(UserEnums.USER_NOT_BIND_YYYF);
}
long timestamp = System.currentTimeMillis(); long timestamp = System.currentTimeMillis();
setUserToRedis(userMain.getId(), userMain.getMobilePhone(), timestamp, tokenType, yyyfUserId); setUserToRedis(userMain.getId(), userMain.getMobilePhone(), timestamp, tokenType, dealBindYyyfAccount(userId,userMain.getMobilePhone(),request));
String token = generateToken(userMain.getMobilePhone(), timestamp, tokenType); String token = generateToken(userMain.getMobilePhone(), timestamp, tokenType);
UserBaseDTO userBaseDTO = userMainService.selectUserInfoById(userMain.getId()); UserBaseDTO userBaseDTO = userMainService.selectUserInfoById(userMain.getId());
userBaseDTO.setToken(token); userBaseDTO.setToken(token);
return ResultDTO.requstSuccess(userBaseDTO); return ResultDTO.requstSuccess(userBaseDTO);
} }
@ -338,4 +316,33 @@ public class LoginController {
return ResultDTO.requstSuccess(); return ResultDTO.requstSuccess();
} }
/**
* @description 处理yyyf账号绑定
* @param [userId, tel, request]
* @return java.lang.String
**/
private Integer dealBindYyyfAccount(String userId, String tel, HttpServletRequest request){
Integer yyyfUserId = null;
String yyyfTtoken = request.getHeader(BaseConstant.YYYF_TOKEN_HEADER);
//如果有token,拿到用户信息,与以渔有方进行绑定
if (redisTemplate.hasKey(yyyfTtoken)) {
YyyfUserDto yyyfUserDto = (YyyfUserDto) redisTemplate.opsForValue().get(yyyfTtoken);
yyyfUserId = yyyfUserDto.getId();
YyyfUser yyyfUser = this.yyyfUserService.selectByYyyfUserIdAndTel(yyyfUserId, tel);
if (yyyfUser == null) {
this.yyyfUserService.saveUser(yyyfUserId, userId, yyyfUserDto.getName());
this.redisTemplate.delete(yyyfTtoken);
}else{
if(!yyyfUser.getUserId().equals(userId)){
throw new UserException(UserEnums.USER_NOT_FORBID_OTHER_USER);
}
}
}else{
throw new UserException(UserEnums.USER_NOT_BIND_YYYF);
}
return yyyfUserId;
}
} }

@ -5,7 +5,6 @@ import com.blockchain.common.base.dto.ResultDTO;
import com.blockchain.common.base.dto.TokenDTO; import com.blockchain.common.base.dto.TokenDTO;
import com.blockchain.common.base.dto.YyyfUserDto; import com.blockchain.common.base.dto.YyyfUserDto;
import com.blockchain.common.base.util.RSACoderUtils; import com.blockchain.common.base.util.RSACoderUtils;
import com.blockchain.server.train.dto.ExamPaperDto;
import com.blockchain.server.yyyf.controller.api.LoginApi; import com.blockchain.server.yyyf.controller.api.LoginApi;
import com.blockchain.server.yyyf.dto.*; import com.blockchain.server.yyyf.dto.*;
import com.blockchain.server.yyyf.service.AssessUserService; import com.blockchain.server.yyyf.service.AssessUserService;
@ -52,6 +51,7 @@ public class LoginController {
public ResultDTO<YyyfLoginDto> loginyyyf(@ApiParam(LoginApi.YyyfLogin.METHOD_API_YYYFLOGINREQUESTVO) @Valid YyyfLoginRequestVo yyyfLoginRequestVo) { public ResultDTO<YyyfLoginDto> loginyyyf(@ApiParam(LoginApi.YyyfLogin.METHOD_API_YYYFLOGINREQUESTVO) @Valid YyyfLoginRequestVo yyyfLoginRequestVo) {
//存到redis中用于以渔有方用户与智信链用户进行绑定 //存到redis中用于以渔有方用户与智信链用户进行绑定
YyyfUserDto yyyfUserDto = new YyyfUserDto(); YyyfUserDto yyyfUserDto = new YyyfUserDto();
//登录返回的Data //登录返回的Data
YyyfLoginDto yyyfLoginDto = new YyyfLoginDto(); YyyfLoginDto yyyfLoginDto = new YyyfLoginDto();

@ -2,10 +2,13 @@ package com.blockchain.server.yyyf.controller;
import com.blockchain.common.base.constant.YyyfConstant; import com.blockchain.common.base.constant.YyyfConstant;
import com.blockchain.common.base.dto.ResultDTO; import com.blockchain.common.base.dto.ResultDTO;
import com.blockchain.server.train.dto.ExamPaperDto;
import com.blockchain.server.yyyf.controller.api.StudentAnswerApi; import com.blockchain.server.yyyf.controller.api.StudentAnswerApi;
import com.blockchain.server.yyyf.dto.StudentAnswerDto; import com.blockchain.server.yyyf.dto.AssessUserTargetDto;
import com.blockchain.server.yyyf.entity.AssessUserTarget;
import com.blockchain.server.yyyf.enums.UserEnums;
import com.blockchain.server.yyyf.exceprion.UserException;
import com.blockchain.server.yyyf.service.AssessUserService; import com.blockchain.server.yyyf.service.AssessUserService;
import com.blockchain.server.yyyf.service.AssessUserTargetService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
@ -13,78 +16,62 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
/** /**
* @author huangxl * @author huangxl
* @data 2019/2/21 15:06 * @data 2019/2/21 15:06
* 用户注册, 登录控制器 * 学生成绩控制器
*/ */
@RestController @RestController
@Api(StudentAnswerApi.CONTROLLER_API) @Api(StudentAnswerApi.CONTROLLER_API)
@RequestMapping("/loginFromYyyf") @RequestMapping("/studentAnswer")
public class StudentAnswerController { public class StudentAnswerController {
private static final Logger LOG = LoggerFactory.getLogger(StudentAnswerController.class); private static final Logger LOG = LoggerFactory.getLogger(StudentAnswerController.class);
@Autowired @Autowired
private AssessUserService assessUserService; private AssessUserService assessUserService;
@Autowired
private AssessUserTargetService assessUserTargetService;
@Autowired @Autowired
private RedisTemplate redisTemplate; private RedisTemplate redisTemplate;
@PostMapping("/studentAnswer") @PostMapping("/saveAnswer")
@ApiOperation(value = StudentAnswerApi.StudentAnswer.METHOD_NAME, @ApiOperation(value = StudentAnswerApi.SaveAnswer.METHOD_NAME,
notes = StudentAnswerApi.StudentAnswer.METHOD_NOTE) notes = StudentAnswerApi.SaveAnswer.METHOD_NOTE)
public ResultDTO studentAnswer(@ApiParam(StudentAnswerApi.StudentAnswer.METHOD_YYYF_USER_ID) @RequestParam(name = "yyyfUserId")String yyyfUserId, public ResultDTO saveAnswer(@ApiParam(StudentAnswerApi.SaveAnswer.METHOD_YYYF_USER_ID) @RequestParam(name = "yyyfUserId")Integer yyyfUserId,
@ApiParam(StudentAnswerApi.StudentAnswer.METHOD_STUDENT_TASK_RATE) @RequestParam(name = "taskRate")String taskRate, @ApiParam(StudentAnswerApi.SaveAnswer.METHOD_STUDENT_TASK_RATE) @RequestParam(name = "taskRate")String taskRate,
@ApiParam(StudentAnswerApi.StudentAnswer.METHOD_STARGE_ID) @RequestParam(name = "targeId")String targeId) { @ApiParam(StudentAnswerApi.SaveAnswer.METHOD_STARGE_ID) @RequestParam(name = "targeId")String targeId) {
String caseKey = YyyfConstant.CASE_KEY + yyyfUserId; String caseKey = YyyfConstant.CASE_KEY + yyyfUserId;
String studentAnswerDtoKey = null; String studentAnswerDtoKey = null;
/* if (redisTemplate.hasKey(caseKey)) { if (redisTemplate.hasKey(caseKey)) {
Map<String,String> map = (Map<String,String>) redisTemplate.opsForValue().get(caseKey); Map<String,String> map = (Map<String,String>) redisTemplate.opsForValue().get(caseKey);
String caseId=map.get("examPaperId"); String caseId=map.get("examPaperId");
String examId=map.get("examId");
studentAnswerDtoKey = YyyfConstant.ANSER_KEY +yyyfUserId + caseId;
ValueOperations<String, Object> studentAnsweValueOperations = redisTemplate.opsForValue(); AssessUserTargetDto assessUserTargetDto= assessUserTargetService.selectAssessUserTargetDtoByUserIdAndIssueIdAndCaseId(yyyfUserId,examId,caseId);
StudentAnswerDto studentAnswerDto = (StudentAnswerDto) studentAnsweValueOperations.get(studentAnswerDtoKey);
if (studentAnswerDto == null || (studentAnswerDto != null && studentAnswerDto.getTotalScore() != null)) { if(assessUserTargetDto==null){
return;
}
ExamPaperDto examPaperDto = (ExamPaperDto) redisTemplate.opsForHash().get(YyyfConstant.EXAM_PAPER_KEY, studentAnswerDto.getExamPaperId());
//交易id
String trxId = studentAnswer.value();
Map<String, Double> result = studentAnswerDto.getResult();
if (result == null) {
result = new HashMap<>();
}
AtomicBoolean flag = new AtomicBoolean(false);
examPaperDto.getTradeList().stream().forEach(bd -> {
if (bd.getId().equals(trxId)) {
flag.set(true);
}
});
if (flag.get()) {
result.put(trxId, 1);
studentAnswerDto.setResult(result);
studentAnsweValueOperations.set(studentAnswerDtoKey, studentAnswerDto);
} }
redisTemplate.expire(caseKey, 2, TimeUnit.HOURS); redisTemplate.expire(caseKey, 2, TimeUnit.HOURS);
redisTemplate.expire(studentAnswerDtoKey, 2, TimeUnit.HOURS); redisTemplate.expire(studentAnswerDtoKey, 2, TimeUnit.HOURS);
}*/
}else{
throw new UserException(UserEnums.USER_NOT_BIND_YYYF);
}
return new ResultDTO(); return new ResultDTO();
} }

@ -7,7 +7,7 @@ package com.blockchain.server.yyyf.controller.api;
public class StudentAnswerApi { public class StudentAnswerApi {
public static final String CONTROLLER_API = "案例答题控制器"; public static final String CONTROLLER_API = "案例答题控制器";
public static class StudentAnswer { public static class SaveAnswer {
public static final String METHOD_NAME = "学生答题"; public static final String METHOD_NAME = "学生答题";
public static final String METHOD_NOTE = "学生答题统一调用"; public static final String METHOD_NOTE = "学生答题统一调用";
public static final String METHOD_YYYF_USER_ID = "以渔有方用户id"; public static final String METHOD_YYYF_USER_ID = "以渔有方用户id";

@ -0,0 +1,16 @@
package com.blockchain.server.yyyf.dto;
import com.blockchain.server.yyyf.entity.AssessUserTarget;
import lombok.Data;
/**
* @author huan.xu
* @version 1.0
* @className AssessUserTargetDto
* @description
* @date 2020-05-13 16:52
*/
@Data
public class AssessUserTargetDto extends AssessUserTarget {
private String assessUserId;
}

@ -1,46 +0,0 @@
package com.blockchain.server.yyyf.entity;
import lombok.Data;
import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;
import java.math.BigDecimal;
@Table(name = "yyyf_server_assess_user_project")
@Data
public class AssessUserProject implements Serializable {
private static final long serialVersionUID = 1L;
/**
* uuid
*/
@Id
@Column(name = "id")
private String id;
/**
* 用户考核主表id
*/
@Column(name = "assess_user_id")
private String assessUserId;
/**
* 子系统项目id
*/
@Column(name = "project_id")
private String projectId;
/**
* 子系统项目名称
*/
@Column(name = "project_name")
private String projectName;
/**
* 项目得分
*/
@Column(name = "project_score")
private BigDecimal projectScore;
@Column(name = "project_case_desc")
private BigDecimal projectCaseDesc;
}

@ -0,0 +1,65 @@
package com.blockchain.server.yyyf.entity;
import lombok.Data;
import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;
@Table(name = "yyyf_server_assess_user_target")
@Data
public class AssessUserTarget implements Serializable {
private static final long serialVersionUID = 1L;
/**
* uuid
*/
@Id
@Column(name = "id")
private String id;
/**
* 用户考核主表id
*/
@Column(name = "assess_user_id")
private String assessUserId;
/**
* 指标id
*/
@Column(name = "targe_id")
private String targeId;
/**
* 指标名称
*/
@Column(name = "target_name")
private String targetName;
/**
* 任务目标运算符1大于2等于3小于
*/
@Column(name = "task_operate")
private Integer taskOperate;
/**
* 任务目标比率
*/
@Column(name = "task_rate")
private Double taskRate;
/**
* 任务分数
*/
@Column(name = "task_score")
private Double taskScore;
/**
* 指标代码
*/
@Column(name = "code")
private String code;
/**
* 排序
*/
@Column(name = "sort")
private Integer sort;
}

@ -0,0 +1,95 @@
package com.blockchain.server.yyyf.enums;
/**
* @author huangxl
* @data 2019/2/21 20:53
*/
public enum UserEnums {
USER_NOT_FORBID_OTHER_USER(1098, "禁止登录他人账号", "The user does not allow login other user's accout", "禁止登錄他人賬號"),
USER_NOT_BIND_YYYF(1099, "该用户未绑定以渔有方或者以渔有方登录已失效", "The user does not bind yyyf", "該用戶未綁定以漁有方或者以漁有方登錄已失效"),
USER_EXISTS(1100, "该用户已存在", "The user already exists", "該用戶已存在"),
USER_NOT_EXISTS(1101, "不存在该用户", "The user does not exist", "不存在該用戶"),
LOGIN_PASSWORD_ERROR(1102, "用户名密码错误", "Wrong username and password", "用戶名密碼錯誤"),
LOGIN_FORBIDDEN(1103, "你被列入黑名单,禁止登录", "You are blacklisted from logging in", "你被列入黑名單,禁止登錄"),
SMS_VERIFY_FAIL(1104, "手机号验证码错误", "Wrong verification code for mobile phone number", "手機號驗證碼錯誤"),
SMS_CODE_NOT_EXIST(1105, "请先获取验证码信息", "Please get the captcha information first", "請先獲取驗證碼資訊"),
PHONE_FORMAT_ERROR(1106, "手机号格式不正确", "The phone number format is not correct", "手機號格式不正確"),
FORMAT_ERROR(1106, "手机号或邮箱格式不正确", "The phone number or email format is not correct", "手機號或郵箱格式不正確"),
VERIFY_CODE_TYPE_ERROR(1107, "没有此类型短信", "There is no text message of this type", "沒有此類型短信"),
VERIFY_CODE_OVER_COUNT(1108, "今日获取验证码到达上限", "The upper limit of the captcha is reached today", "今日獲取驗證碼到達上限"),
USER_PHONE_EXISTS(1109, "该手机号或邮箱已存在", "The phone number or email address already exists", "該手機號或郵箱已存在"),
USER_PASSWORD_ERROR_FORMAT(1110, "密码只能是6-16位数字、字母和特殊字符的组合", "Passwords can only be 6-16 digit combinations of Numbers, letters, and special characters", "密碼只能是6-16位數字、字母和特殊字元的組合"),
INVALID_INVITATION_CODE(1111, "无效的邀请码信息", "Invalid invitation code information", "無效的邀請碼資訊"),
INVALID_NICK_NAME(1112, "昵称不能包含特殊字符", "Nicknames cannot contain special characters", "昵稱不能包含特殊字元"),
PHONE_NOT_CHANGE(1113, "手机号码与当前用户一致", "The phone number is the same as the current user", "手機號碼與當前用戶一致"),
GOOGLE_SECRET_KEY_FAIL(1114, "获取谷歌安全码失败", "Failed to get Google security code", "獲取穀歌安全碼失敗"),
GOOGLE_SECRET_KEY_EXIST(1115, "你已绑定谷歌验证器,请勿重复绑定", "You have bound the Google validator. Do not repeat the binding", "你已綁定穀歌驗證器,請勿重複綁定"),
GOOGLE_AUTH_FAIL(1116, "谷歌验证器验证失败", "Google verifier validation failed", "穀歌驗證器驗證失敗"),
FILE_UPLOAD_ERROR(1117, "文件上传失败", "File upload failed", "文檔上傳失敗"),
FILE_UPLOAD_LIMIT(1118, "文件上传失败,上传文件次数过多!", "File upload failed, too many times!", "文檔上傳失敗,上傳檔次數過多!"),
FILE_UPLOAD_FORMAT_ERROR(1119, "文件地址错误", "File address error", "文檔地址錯誤"),
FILE_UPLOAD_DEFICIENCY(1120, "请先上传文件", "Please upload the file first", "請先上傳文檔"),
AUTH_WAIT(1121, "认证审核中,请勿重复申请!", "Please do not repeat the application during the certification audit!", "認證審核中,請勿重複申請!"),
AUTH_YES(1122, "你已完成认证!", "You have completed the certification!", "你已完成認證!"),
AUTH_BASIC_BEFORE(1123, "请先完成初级认证!", "Please complete the primary certification first!", "請先完成初級認證!"),
EMAIL_FORMAT_ERROR(1124, "无效的邮箱格式!", "Invalid mailbox format!", "無效的郵箱格式!"),
EMAIL_VERIFY_FAIL(1125, "邮箱验证失败!", "Mailbox authentication failed!", "郵箱驗證失敗!"),
EMAIL_BIND_REPEAT(1126, "绑定失败,你已绑定邮箱", "Failed to bind. You have bound your mailbox", "綁定失敗,你已綁定郵箱"),
PASSWORD_EXIST(1127, "设置失败,你已经设置过密码了", "Setup failed. You have already set the password", "設置失敗,你已經設置過密碼了"),
EMAIL_EXIST(1128, "绑定失败,该邮箱已被绑定!", "The mailbox has been bound!", "綁定失敗,該郵箱已被綁定!"),
PASSWORD_NOT_MATCH(1129, "密码不匹配", "Password mismatch", "密碼不匹配"),
TRANSACTION_FORBIDDEN(1130, "你被列入黑名单,禁止交易!", "You're blacklisted! No trading!", "你被列入黑名單,禁止交易!"),
CANNOT_FOUND_INTERNATIONAL(1131, "找不到该国家信息", "Country information not available", "找不到該國家信息"),
VERIFY_CODE_DID_NOT_FIND(1034, "验证码已过期或没有获取", "The captcha is expired or not available", "驗證碼已過期或沒有獲取"),
VERIFY_CODE_DID_NOT_MATCH(1035, "您输入的验证码不匹配", "The verification code you entered does not match", "您輸入的驗證碼不匹配"),
WITHDRAW_FORBIDDEN(1136, "你被列入黑名单,禁止提现!", "You are blacklisted and no withdrawal is allowed!", "你被列入黑名單,禁止提現!"),
TRANSACTION_NOT_PASS_HIGH_AUTH(1137, "操作失败,您未通过高级认证!", "Operation failed. You did not pass advanced certification!", "操作失敗,您未通過高級認證!"),
TRANSACTION_NOT_PASS_LOW_AUTH(1137, "操作失败,您未通过初级认证!", "Operation failed. You did not pass primary certification!", "操作失敗,您未通過初級認證!"),
SEND_CODE_ERROR(1138, "验证码发送失败!", "Verification code failed to send!", "驗證碼發送失敗!"),
;
private int code;
private String hkmsg;
private String enMsg;
private String cnmsg;
UserEnums(int code, String cnmsg, String enMsg, String hkmsg) {
this.code = code;
this.cnmsg = cnmsg;
this.enMsg = enMsg;
this.hkmsg = hkmsg;
}
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public String getHkmsg() {
return hkmsg;
}
public void setHkmsg(String hkmsg) {
this.hkmsg = hkmsg;
}
public String getEnMsg() {
return enMsg;
}
public void setEnMsg(String enMsg) {
this.enMsg = enMsg;
}
public String getCnmsg() {
return cnmsg;
}
public void setCnmsg(String cnmsg) {
this.cnmsg = cnmsg;
}
}

@ -0,0 +1,52 @@
package com.blockchain.server.yyyf.exceprion;
import com.blockchain.common.base.constant.BaseConstant;
import com.blockchain.common.base.exception.BaseException;
import com.blockchain.common.base.util.HttpRequestUtil;
import com.blockchain.server.yyyf.enums.UserEnums;
import lombok.Data;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
/**
* @author huangxl
* @data 2019/2/21 20:51
*/
@Data
public class UserException extends BaseException {
protected int code;
protected String msg;
public UserException(int code, String msg) {
this.code = code;
this.msg = msg;
}
public UserException(UserEnums rs) {
ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
//可能是定时器调用,避免获取request空指针
if (servletRequestAttributes == null) {
this.code = rs.getCode();
this.msg = rs.getCnmsg();
} else {
HttpServletRequest request = servletRequestAttributes.getRequest();
String userLocale = HttpRequestUtil.getUserLocale(request);
String msg = "";
switch (userLocale) {
case BaseConstant.USER_LOCALE_EN_US:
msg = rs.getEnMsg();
break;
case BaseConstant.USER_LOCALE_ZH_HK:
msg = rs.getHkmsg();
break;
default:
msg = rs.getCnmsg();
break;
}
this.code = rs.getCode();
this.msg = msg;
}
}
}

@ -5,13 +5,14 @@ import com.blockchain.server.yyyf.dto.PractiseProDto;
import com.blockchain.server.yyyf.entity.AssessUser; import com.blockchain.server.yyyf.entity.AssessUser;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import tk.mybatis.mapper.common.Mapper;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@Repository @Repository
public interface AssessUserMapper { public interface AssessUserMapper extends Mapper<AssessUserMapper> {
void insert(AssessUser assessUser); void insert(AssessUser assessUser);

@ -1,15 +0,0 @@
package com.blockchain.server.yyyf.mapper;
import com.blockchain.server.yyyf.entity.AssessUserProject;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface AssessUserProjectMapper {
void insert(AssessUserProject assessUserProject);
void batchInsert(List<AssessUserProject> assessUserProjectList);
}

@ -0,0 +1,16 @@
package com.blockchain.server.yyyf.mapper;
import com.blockchain.server.yyyf.dto.AssessUserTargetDto;
import com.blockchain.server.yyyf.entity.AssessUserTarget;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import tk.mybatis.mapper.common.Mapper;
import java.util.List;
@Repository
public interface AssessUserTargetMapper extends Mapper<AssessUserTarget> {
AssessUserTargetDto selectAssessUserTargetDtoByUserIdAndIssueIdAndCaseId(@Param("userId") Integer userId, @Param("issueId") String issueId,@Param("caseId") String caseId);
}

@ -1,4 +0,0 @@
package com.blockchain.server.yyyf.service;
public interface AssessUserProjectService{
}

@ -71,4 +71,5 @@ public interface AssessUserService {
* @return void * @return void
**/ **/
void delAssessUserByIssueId(String examId); void delAssessUserByIssueId(String examId);
} }

@ -0,0 +1,13 @@
package com.blockchain.server.yyyf.service;
import com.blockchain.server.yyyf.dto.AssessUserTargetDto;
import com.blockchain.server.yyyf.entity.AssessUserTarget;
public interface AssessUserTargetService{
/**
* @description 获取指标情况
* @param [yyyfUserId, examId, caseId]
* @return com.blockchain.server.yyyf.dto.AssessUserTargetDto
**/
AssessUserTargetDto selectAssessUserTargetDtoByUserIdAndIssueIdAndCaseId(Integer yyyfUserId, String examId, String caseId);
}

@ -1,15 +0,0 @@
package com.blockchain.server.yyyf.service.impl;
import com.blockchain.server.yyyf.service.AssessUserProjectService;
import org.springframework.stereotype.Service;
/**
* @author huan.xu
* @version 1.0
* @className AssessUserProjectServiceImpl
* @description
* @date 2019-10-31 17:40
*/
@Service
public class AssessUserProjectServiceImpl implements AssessUserProjectService {
}

@ -3,7 +3,7 @@ package com.blockchain.server.yyyf.service.impl;
import com.blockchain.server.yyyf.dto.PractiseProDto; import com.blockchain.server.yyyf.dto.PractiseProDto;
import com.blockchain.server.yyyf.entity.AssessUser; import com.blockchain.server.yyyf.entity.AssessUser;
import com.blockchain.server.yyyf.mapper.AssessUserMapper; import com.blockchain.server.yyyf.mapper.AssessUserMapper;
import com.blockchain.server.yyyf.mapper.AssessUserProjectMapper; import com.blockchain.server.yyyf.mapper.AssessUserTargetMapper;
import com.blockchain.server.yyyf.mapper.AssessUserTaskMapper; import com.blockchain.server.yyyf.mapper.AssessUserTaskMapper;
import com.blockchain.server.yyyf.service.AssessUserService; import com.blockchain.server.yyyf.service.AssessUserService;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -29,7 +29,7 @@ public class AssessUserServiceImpl implements AssessUserService {
@Autowired @Autowired
private AssessUserMapper assessUserMapper; private AssessUserMapper assessUserMapper;
@Autowired @Autowired
private AssessUserProjectMapper assessUserProjectMapper; private AssessUserTargetMapper assessUserTargetMapper;
@Autowired @Autowired
private AssessUserTaskMapper assessUserTaskMapper; private AssessUserTaskMapper assessUserTaskMapper;

@ -0,0 +1,23 @@
package com.blockchain.server.yyyf.service.impl;
import com.blockchain.server.yyyf.dto.AssessUserTargetDto;
import com.blockchain.server.yyyf.entity.AssessUserTarget;
import com.blockchain.server.yyyf.mapper.AssessUserTargetMapper;
import com.blockchain.server.yyyf.service.AssessUserTargetService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* @version 1.0
* @className AssessUserProjectServiceImpl
* @description
*/
@Service
public class AssessUserTargetServiceImpl implements AssessUserTargetService {
@Autowired
private AssessUserTargetMapper assessUserTargetMapper;
@Override
public AssessUserTargetDto selectAssessUserTargetDtoByUserIdAndIssueIdAndCaseId(Integer yyyfUserId, String examId, String caseId) {
return this.assessUserTargetMapper.selectAssessUserTargetDtoByUserIdAndIssueIdAndCaseId(yyyfUserId,examId,caseId);
}
}

@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.blockchain.server.yyyf.mapper.AssessUserProjectMapper"> <mapper namespace="com.blockchain.server.yyyf.mapper.AssessUserTargetMapper">
<resultMap id="YfServerAssessUserProjectResultMap" type="com.blockchain.server.yyyf.entity.AssessUserProject"> <resultMap id="YfServerAssessUserProjectResultMap" type="com.blockchain.server.yyyf.entity.AssessUserTarget">
<id column="id" jdbcType="VARCHAR" property="id"/> <id column="id" jdbcType="VARCHAR" property="id"/>
<result column="assess_user_id" jdbcType="VARCHAR" property="assessUserId"/> <result column="assess_user_id" jdbcType="VARCHAR" property="assessUserId"/>
<result column="project_name" jdbcType="VARCHAR" property="projectName"/> <!--<result column="project_name" jdbcType="VARCHAR" property="projectName"/>
<result column="project_id" jdbcType="VARCHAR" property="projectId"/> <result column="project_id" jdbcType="VARCHAR" property="projectId"/>
<result column="project_score" jdbcType="NUMERIC" property="projectScore"/> <result column="project_score" jdbcType="NUMERIC" property="projectScore"/>
<result column="project_case_desc" jdbcType="VARCHAR" property="projectCaseDesc"/> <result column="project_case_desc" jdbcType="VARCHAR" property="projectCaseDesc"/>-->
</resultMap> </resultMap>
<sql id="YfServerAssessUserProject_Where_Clause"> <sql id="YfServerAssessUserProject_Where_Clause">
@ -47,36 +47,26 @@
t.duration_unit, t.duration_unit,
t.project_case_desc, t.project_case_desc,
</sql> </sql>
<select id="selectAssessUserTargetDtoByUserIdAndIssueIdAndCaseId"
resultType="com.blockchain.server.yyyf.dto.AssessUserTargetDto">
<insert id="insert" parameterType="com.blockchain.server.yyyf.entity.AssessUserProject"> SELECT
insert into yyyf_server_assess_user_project (id, assess_user_id, project_name, project_id, project_score, duration, duration_unit, project_case_desc) u.id AS assessUserId,
values( t.id AS id,
#{id}, t.targe_id AS targeId,
#{assessUserId}, t.target_name AS targetName,
#{projectName}, t.task_operate AS taskOperate,
#{projectId}, t.task_rate AS taskRate,
#{projectScore}, t.task_score AS taskScore,
#{duration}, t. CODE AS CODE,
#{durationUnit}, t.sort AS sort
#{projectCaseDesc} FROM
) yyyf_server_assess_user u
</insert> LEFT JOIN yyyf_server_assess_user_target t ON (
u.end_time IS NULL
AND u.case_id = #{caseId} and u.id=t.assess_user_id and u.user_id=#{userId}
AND u.issue_id = #{issueId} )
</select>
<insert id="batchInsert" parameterType="java.util.List">
insert into yyyf_server_assess_user_project ( id, assess_user_id, project_name, project_id, project_score, project_case_desc)
values
<foreach collection ="list" item="item" index= "index" separator =",">
(
#{item.id},
#{item.assessUserId},
#{item.projectName},
#{item.projectId},
#{item.projectScore},
#{item.projectCaseDesc}
)
</foreach >
</insert>
</mapper> </mapper>
Loading…
Cancel
Save