diff --git a/blockchain-common/blockchain-common-base/src/main/java/com/blockchain/common/base/constant/BaseConstant.java b/blockchain-common/blockchain-common-base/src/main/java/com/blockchain/common/base/constant/BaseConstant.java index 313e2f6..ded7080 100644 --- a/blockchain-common/blockchain-common-base/src/main/java/com/blockchain/common/base/constant/BaseConstant.java +++ b/blockchain-common/blockchain-common-base/src/main/java/com/blockchain/common/base/constant/BaseConstant.java @@ -15,4 +15,6 @@ public class BaseConstant { public static final String USER_LOCALE_DEFAULT = USER_LOCALE_ZH_CN;//默认国际化标识为繁体中文 public static final int REQUEST_SUCCESS = 200;// 成功标识 + + } diff --git a/blockchain-common/blockchain-common-base/src/main/java/com/blockchain/common/base/constant/YyyfConstant.java b/blockchain-common/blockchain-common-base/src/main/java/com/blockchain/common/base/constant/YyyfConstant.java new file mode 100644 index 0000000..50ea71d --- /dev/null +++ b/blockchain-common/blockchain-common-base/src/main/java/com/blockchain/common/base/constant/YyyfConstant.java @@ -0,0 +1,34 @@ +package com.blockchain.common.base.constant; + +/** + * @author huan.xu + * @version 1.0 + * @className CaseConstant + * @description + * @date 2020-04-17 11:26 + */ +public class YyyfConstant { + public static final String EXAM_KEY="examKey"; + + public static final String ANSER_KEY="answerKey_"; + + public static final String NO_ENTRY_INTO_PRACTICE="您有未完成的考试,请先完成考试并提交"; + + public static final String INCOMPLETE_PRACTICE="您有未提交的练习,是否重新开始?"; + + + //Submitted + public static final String SUBMITTED="您的考试已提交,不允许再次进入"; + + public static final String EXAM_PAPER_KEY="examPaperKey"; + + /**参加考试的人员id key*/ + public static final String JOIN_EXAM_STU_IDS_KEY="joinExamStuIds"; + + public static final String CASE_KEY="case_"; + + public static final String YYYF_ZHIXINLIAN_CODE="128"; + + /**以渔有方与智信链用户绑定的cookies*/ + public static final String YYYF_ZHIXINLIAN_USER_KEY="yyyfZhixinlianUserKey"; +} \ No newline at end of file diff --git a/blockchain-common/blockchain-common-base/src/main/java/com/blockchain/common/base/dto/YyyfUserDto.java b/blockchain-common/blockchain-common-base/src/main/java/com/blockchain/common/base/dto/YyyfUserDto.java new file mode 100644 index 0000000..52a1685 --- /dev/null +++ b/blockchain-common/blockchain-common-base/src/main/java/com/blockchain/common/base/dto/YyyfUserDto.java @@ -0,0 +1,28 @@ +package com.blockchain.common.base.dto; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @author huan.xu + * @version 1.0 + * @className YyyfUserDto + * @description + * @date 2020-04-17 11:06 + */ +@Data +public class YyyfUserDto implements Serializable { + private static final long serialVersionUID = -6752296227958588252L; + /**传过来的用户id*/ + private String id; + /**用户名称*/ + private String name; + /**用户类型:0学生,1老师,2管理员*/ + private Integer type; + /**班级id*/ + private Integer classId; + /**学校id,为以后logo修改预留参数*/ + private Integer schoolId; + +} \ No newline at end of file diff --git a/blockchain-server/blockchain-server-yyyf/pom.xml b/blockchain-server/blockchain-server-yyyf/pom.xml new file mode 100644 index 0000000..b3f206c --- /dev/null +++ b/blockchain-server/blockchain-server-yyyf/pom.xml @@ -0,0 +1,68 @@ + + + + blockchain-server + com.blockchain + 1.0-SNAPSHOT + + 4.0.0 + + blockchain-server-yyyf + + + com.blockchain + blockchain-server-base + 1.0-SNAPSHOT + + + com.blockchain + blockchain-common-tx + 1.0-SNAPSHOT + + + com.blockchain + blockchain-common-base + 1.0-SNAPSHOT + + + + + com.sun.mail + javax.mail + 1.6.2 + + + + + com.aliyun + aliyun-java-sdk-core + 4.0.3 + + + + + com.gexin.platform + gexin-rp-sdk-http + 4.1.0.3 + + + + + + getui-nexus + http://mvn.gt.igexin.com/nexus/content/repositories/releases/ + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + \ No newline at end of file diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/YyyfApplication.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/YyyfApplication.java new file mode 100644 index 0000000..dea8c76 --- /dev/null +++ b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/YyyfApplication.java @@ -0,0 +1,20 @@ +package com.blockchain.server.yyyf; + +import com.blockchain.server.base.BaseConf; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.scheduling.annotation.EnableAsync; + +/** + * @author xusm + * @data 2019/2/21 14:06 + */ +@SpringBootApplication(scanBasePackageClasses = {BaseConf.class, YyyfApplication.class}) +@EnableConfigurationProperties +@EnableAsync +public class YyyfApplication { + public static void main(String[] args) { + SpringApplication.run(YyyfApplication.class,args); + } +} diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/LoginController.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/LoginController.java new file mode 100644 index 0000000..66f2545 --- /dev/null +++ b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/LoginController.java @@ -0,0 +1,236 @@ +package com.blockchain.server.yyyf.controller; + +import com.blockchain.common.base.constant.YyyfConstant; +import com.blockchain.common.base.dto.ResultDTO; +import com.blockchain.common.base.dto.TokenDTO; +import com.blockchain.common.base.dto.YyyfUserDto; +import com.blockchain.common.base.util.RSACoderUtils; +import com.blockchain.server.yyyf.controller.api.LoginApi; +import com.blockchain.server.yyyf.dto.*; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.HashOperations; +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.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import sun.misc.BASE64Decoder; + +import javax.validation.Valid; +import java.io.IOException; +import java.util.*; +import java.util.concurrent.TimeUnit; + +/** + * @author huangxl + * @data 2019/2/21 15:06 + * 用户注册, 登录控制器 + */ +@RestController +@Api(LoginApi.CONTROLLER_API) +@RequestMapping("/loginFromYyyf") +public class LoginController { + + private static final Logger LOG = LoggerFactory.getLogger(LoginController.class); + + + @Autowired + private RedisTemplate redisTemplate; + + @PostMapping("/login") + @ApiOperation(value = LoginApi.YyyfLogin.METHOD_NAME, + notes = LoginApi.YyyfLogin.METHOD_NOTE) + public ResultDTO loginyyyf(@ApiParam(LoginApi.YyyfLogin.METHOD_API_YYYFLOGINREQUESTVO) @Valid @RequestBody YyyfLoginRequestVo yyyfLoginRequestVo) { + + //存到redis中用于以渔有方用户与智信链用户进行绑定 + YyyfUserDto yyyfUserDto=new YyyfUserDto(); + //登录返回的Data + YyyfLoginDto yyyfLoginDto = new YyyfLoginDto(); + yyyfLoginDto.setStatus(0); + String userName =null; + + try { + userName = new String(new BASE64Decoder().decodeBuffer(yyyfLoginRequestVo.getUserName().replaceAll(" ", "+")), "UTF-8"); + //根据案例id,考核id封装相关信息。 + //1、从缓存中取案列相关 + //0 考试 1 练习 2 不计分 3 教师、管理员的案例管理 + int reqType = yyyfLoginRequestVo.getReqType().intValue(); + int userType = yyyfLoginRequestVo.getUserType().intValue(); + Integer classId =yyyfLoginRequestVo.getClassId(); + String userId = yyyfLoginRequestVo.getUserId(); + Integer schoolId = yyyfLoginRequestVo.getSchoolId(); + + yyyfUserDto.setClassId(classId); + yyyfUserDto.setId(userId); + yyyfUserDto.setName(userName); + yyyfUserDto.setSchoolId(schoolId); + yyyfUserDto.setType(userType); + + //以渔有方考核id + String examId = yyyfLoginRequestVo.getReqId(); + //试卷id(项目id) + String examPaperId = yyyfLoginRequestVo.getCaseId(); + //做考试和练习 + if (0 == reqType || 1 == reqType) { + HashOperations examDtoOpsForHash = redisTemplate.opsForHash(); + + //将参加考试的人员缓存 + HashOperations> studentOpsForHash = redisTemplate.opsForHash(); + //参加考试的人员id + List joinStuIds =null; + + //考试id和案列id缓存 + String caseKey = YyyfConstant.CASE_KEY + userId; + + //判断考试缓存中是否存在这张卷子 + if (0 == reqType) { + //如果他提交了,库里有信息了,不允许他再次进入了。 + if (/**this.assessUserService.getAssessUserByIssueIdAndUserIdForExam(examId, userId) != null*/1==1) { + yyyfLoginDto.setStatus(2); + yyyfLoginDto.setMsg(YyyfConstant.SUBMITTED); + return handleAfterLogin(yyyfLoginDto,yyyfUserDto); + } + + ExamDto examDto = examDtoOpsForHash.get(YyyfConstant.EXAM_KEY, examId); + if (examDto == null) { + examDto = new ExamDto(); + examDto.setExamId(yyyfLoginRequestVo.getReqId()); + examDto.setBeginTime(yyyfLoginRequestVo.getBeginTime()); + examDto.setEndTime(yyyfLoginRequestVo.getEndTime()); + examDto.setType(reqType); + examDto.setExamPaperId(examPaperId); + examDtoOpsForHash.put(YyyfConstant.EXAM_KEY, examId, examDto); + } + + joinStuIds=studentOpsForHash.get(YyyfConstant.JOIN_EXAM_STU_IDS_KEY, examId); + if (joinStuIds == null) { + joinStuIds = new ArrayList(); + } + //如果等于0 + if (joinStuIds.stream() + .filter(stuIds -> (stuIds.equals(userId))).count() == 0) { + joinStuIds.add(userId); + studentOpsForHash.put(YyyfConstant.JOIN_EXAM_STU_IDS_KEY, examId, joinStuIds); + } else { + yyyfLoginDto.setStatus(1); + yyyfLoginDto.setMsg(YyyfConstant.NO_ENTRY_INTO_PRACTICE); + return handleAfterLogin(yyyfLoginDto,yyyfUserDto); + } + }else { + + if (redisTemplate.hasKey(caseKey)) { + Map examMsgMap = (Map) redisTemplate.opsForValue().get(caseKey); + joinStuIds=studentOpsForHash.get(YyyfConstant.JOIN_EXAM_STU_IDS_KEY, examMsgMap.get("examId")); + } + //缓存是考试,要进入练习,则不让进入 + if (joinStuIds != null && joinStuIds.stream() + .filter(stuIds -> (stuIds.equals(userId))).count() != 0) { + yyyfLoginDto.setStatus(1); + yyyfLoginDto.setMsg(YyyfConstant.NO_ENTRY_INTO_PRACTICE); + return handleAfterLogin(yyyfLoginDto,yyyfUserDto); + } + + ValueOperations studentAnsweValueOperations = redisTemplate.opsForValue(); + String studentAnswerDtoKey = YyyfConstant.ANSER_KEY + userId + examPaperId; + StudentAnswerDto studentAnswerDto = (StudentAnswerDto) studentAnsweValueOperations.get(studentAnswerDtoKey); + if (studentAnswerDto != null) { + //答题结果、且未提交 + Map result = studentAnswerDto.getResult(); + if (result != null && result.size() > 0 && result.get("isSubmit")==null ) { + yyyfLoginDto.setStatus(3); + yyyfLoginDto.setMsg(YyyfConstant.INCOMPLETE_PRACTICE); + PractiseTipDto practiseTipDto = new PractiseTipDto(); + practiseTipDto.setExamId(examId); + practiseTipDto.setExamPaperId(examPaperId); + practiseTipDto.setYyyfUserId(userId); + yyyfLoginDto.setPractiseTipDto(practiseTipDto); + + Map map = new HashMap(); + map.put("examPaperId", examPaperId); + map.put("examId", examId); + + redisTemplate.opsForValue().set(caseKey, map); + redisTemplate.expire(studentAnswerDtoKey, 2, TimeUnit.HOURS); + redisTemplate.expire(caseKey, 2, TimeUnit.HOURS); + + return handleAfterLogin(yyyfLoginDto,yyyfUserDto); + } + } + } + //删除强制提醒的缓存 + redisTemplate.delete(YyyfConstant.ANSER_KEY + userId); + + ValueOperations studentAnsweValueOperations = redisTemplate.opsForValue(); + String studentAnswerDtoKey = YyyfConstant.ANSER_KEY + userId + examPaperId; + StudentAnswerDto studentAnswerDto = new StudentAnswerDto(); + studentAnswerDto.setUserId(userId); + studentAnswerDto.setUserType(userType); + studentAnswerDto.setBeginTime(new Date()); + studentAnswerDto.setExamId(examId); + studentAnswerDto.setType(reqType); + studentAnswerDto.setExamPaperId(examPaperId); + studentAnswerDto.setUserName(userName); + studentAnswerDto.setClassId(classId); + studentAnswerDto.setCourseId(yyyfLoginRequestVo.getCourserId()); + + studentAnsweValueOperations.set(studentAnswerDtoKey, studentAnswerDto); + + + Map map = new HashMap(); + map.put("examPaperId", examPaperId); + map.put("examId", examId); + + HashOperations examPaperOpsForHash = redisTemplate.opsForHash(); + ExamPaperDto examPaperDto = examPaperOpsForHash.get(YyyfConstant.EXAM_PAPER_KEY, examPaperId); + if (examPaperDto == null) { + // examPaperDto = this.projectManageService.getExamPaperDtoById(examPaperId); + examPaperOpsForHash.put(YyyfConstant.EXAM_PAPER_KEY, examPaperId, examPaperDto); + } + + redisTemplate.opsForValue().set(caseKey, map); + redisTemplate.expire(studentAnswerDtoKey, 2, TimeUnit.HOURS); + redisTemplate.expire(caseKey, 2, TimeUnit.HOURS); + } + } catch (IOException e) { + LOG.error(e.getMessage(),e); + } + return handleAfterLogin(yyyfLoginDto,yyyfUserDto); + } + + + /** + * 登录成功之后的处理 + */ + private ResultDTO handleAfterLogin(YyyfLoginDto yyyfLoginDto, YyyfUserDto yyyfUserDto) { + int status = yyyfLoginDto.getStatus(); + String token = generateToken(yyyfUserDto.getId(), System.currentTimeMillis(), YyyfConstant.YYYF_ZHIXINLIAN_USER_KEY); + yyyfLoginDto.setYyyfUserToken(token); + if(status==1){ + //到时看要不要设定时长 + redisTemplate.opsForValue().set(token,yyyfUserDto); + } + return ResultDTO.requstSuccess(yyyfLoginDto); + } + + /** + * 生成token返回前端 + * + * @param tel 手机号 + * @param timestamp 时间撮 + * @return token + */ + private String generateToken(String tel, long timestamp, String tokenType) { + TokenDTO tokenDTO = new TokenDTO(); + tokenDTO.setTel(tel); + tokenDTO.setTimestamp(timestamp); + tokenDTO.setTokenType(tokenType); + return RSACoderUtils.encryptToken(tokenDTO); + } + +} diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/api/LoginApi.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/api/LoginApi.java new file mode 100644 index 0000000..8dafcf5 --- /dev/null +++ b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/api/LoginApi.java @@ -0,0 +1,16 @@ +package com.blockchain.server.yyyf.controller.api; + +/** + * @author huangxl + * @create 2018-11-16 14:51 + */ +public class LoginApi { + public static final String CONTROLLER_API = "以渔有方登陆控制器"; + + public static class YyyfLogin { + public static final String METHOD_NAME = "以渔有方登录"; + public static final String METHOD_NOTE = "主要是获取案列,并将案列和用户对应上"; + public static final String METHOD_API_YYYFLOGINREQUESTVO = "以渔有方登录VO"; + } + +} diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/ExamDto.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/ExamDto.java new file mode 100644 index 0000000..d370ae0 --- /dev/null +++ b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/ExamDto.java @@ -0,0 +1,32 @@ +package com.blockchain.server.yyyf.dto; + +import lombok.Data; + +import java.util.Date; + +/** + * @author huan.xu + * @version 1.0 + * @className ExamDto + * @description 考试的dto + * @date 2019-08-19 10:50 + */ +@Data +public class ExamDto { + /**考试id,即reqId*/ + private String examId; + + /**开始时间*/ + private Date beginTime; + + /**结束时间*/ + private Date endTime; + + /**类型:0 考试 1 练习 2 不计分 */ + + private Integer type; + + /**试卷id(案列id)*/ + private String examPaperId; + +} \ No newline at end of file diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/ExamPaperDto.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/ExamPaperDto.java new file mode 100644 index 0000000..456a08f --- /dev/null +++ b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/ExamPaperDto.java @@ -0,0 +1,32 @@ +package com.blockchain.server.yyyf.dto; + +import lombok.Data; + +import java.util.List; + +@Data +public class ExamPaperDto { + /** + * id + */ + private String id; + /** + * 案例名称 + */ + private String name; + /** + * 案例数据 + */ + List caseDataList; + + /** + * 计分交易数据 + */ + List tradeList; + + /** + * 案例内容描述 + */ + private String content; + +} diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/PractiseTipDto.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/PractiseTipDto.java new file mode 100644 index 0000000..8265413 --- /dev/null +++ b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/PractiseTipDto.java @@ -0,0 +1,29 @@ +package com.blockchain.server.yyyf.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.Getter; +import lombok.Setter; + +/** + * @author huan.xu + * @version 1.0 + * @className PractiseTipDto + * @description + * @date 2019-12-18 15:50 + */ +@ApiModel("练习重新开始参数封装") +@Data +public class PractiseTipDto { + + @ApiModelProperty("考试id") + private String examId; + + @ApiModelProperty("案例id") + private String examPaperId; + + @ApiModelProperty("以渔有方用户id") + private String yyyfUserId; + +} \ No newline at end of file diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/StudentAnswerDto.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/StudentAnswerDto.java new file mode 100644 index 0000000..8f9aefd --- /dev/null +++ b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/StudentAnswerDto.java @@ -0,0 +1,47 @@ +package com.blockchain.server.yyyf.dto; + +import lombok.Data; + +import java.math.BigDecimal; +import java.util.Map; + +/** + * @author huan.xu + * @version 1.0 + * @className StudentAnswerDto + * @description 学生答题Dto + * @date 2019-08-20 9:04 + */ +@Data +public class StudentAnswerDto extends ExamDto { + /** + * 用户id + */ + private String userId; + /** + * 用户姓名 + */ + private String userName; + /** + * 答题结果 0答错,1答对 + */ + private Map result; + + /** + * 总分 + */ + private BigDecimal totalScore; + /** + * 班级id + */ + private Integer classId; + + /** + * 用户类型 + */ + private Integer userType; + /** + * 课程id + */ + private String courseId; +} \ No newline at end of file diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/YyyfLoginDto.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/YyyfLoginDto.java new file mode 100644 index 0000000..35e8d5e --- /dev/null +++ b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/YyyfLoginDto.java @@ -0,0 +1,27 @@ +package com.blockchain.server.yyyf.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.Getter; +import lombok.Setter; + +import java.io.Serializable; + +@ApiModel("以渔有方登录结果Dto") +@Data +public class YyyfLoginDto implements Serializable { + private static final long serialVersionUID = -4676837836442073982L; + + @ApiModelProperty("提示信息") + private String msg; + + @ApiModelProperty("状态:0,失败,1成功,2 考试提交后重复进入,3 练习未提交提醒") + private int status; + + @ApiModelProperty("练习重新开始参数封装") + private PractiseTipDto practiseTipDto; + @ApiModelProperty("以渔有方用户token") + private String yyyfUserToken; + +} diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/YyyfLoginRequestVo.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/YyyfLoginRequestVo.java new file mode 100644 index 0000000..9d4efab --- /dev/null +++ b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/YyyfLoginRequestVo.java @@ -0,0 +1,59 @@ +package com.blockchain.server.yyyf.dto; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.Date; + +@ApiModel(description = "以渔有方登录请求对象") +@Data +public class YyyfLoginRequestVo implements Serializable { + private static final long serialVersionUID = 6595694408632033196L; + @NotNull + @ApiModelProperty("登录用户的id") + private String userId; + @NotNull + @ApiModelProperty("登录用户的姓名") + private String userName; + @NotNull + @ApiModelProperty("用户类型:0学生,1老师,2管理员") + private Integer userType; + @ApiModelProperty("学校id,为后期的改logo预留") + private Integer schoolId; + @NotNull + @ApiModelProperty("检验码") + private String authorization; + + @ApiModelProperty("课程id") + private String courserId; + + @ApiModelProperty("请求类型:0 考试 1 练习 2 不计分 3 教师、管理员的案例管理") + private Integer reqType; + + @ApiModelProperty("考核id") + private String reqId; + + @ApiModelProperty("案例Id") + private String caseId; + + @ApiModelProperty("班级id") + private Integer classId; + + @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + @ApiModelProperty("开始时间") + private Date beginTime; + + + @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + @ApiModelProperty("结束时间") + private Date endTime; + + +} diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/feign/BtcFeign.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/feign/BtcFeign.java new file mode 100644 index 0000000..58f444d --- /dev/null +++ b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/feign/BtcFeign.java @@ -0,0 +1,16 @@ +package com.blockchain.server.yyyf.feign; + +import com.blockchain.common.base.dto.ResultDTO; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestParam; + +/** + * @author huangxl + * @create 2019-02-28 17:40 + */ +@FeignClient("dapp-btc-server") +public interface BtcFeign { + @GetMapping("/inner/wallet/createWallet") + ResultDTO createWallet(@RequestParam("userOpenId") String userOpenId); +} diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/feign/EosFeign.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/feign/EosFeign.java new file mode 100644 index 0000000..19d5104 --- /dev/null +++ b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/feign/EosFeign.java @@ -0,0 +1,16 @@ +package com.blockchain.server.yyyf.feign; + +import com.blockchain.common.base.dto.ResultDTO; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestParam; + +/** + * @author huangxl + * @create 2019-02-28 17:39 + */ +@FeignClient("dapp-eos-server") +public interface EosFeign { + @GetMapping("/inner/walletTx/initEosWallet") + ResultDTO initEosWallet(@RequestParam("userOpenId") String userOpenId); +} diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/feign/EthFeign.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/feign/EthFeign.java new file mode 100644 index 0000000..c6ff066 --- /dev/null +++ b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/feign/EthFeign.java @@ -0,0 +1,16 @@ +package com.blockchain.server.yyyf.feign; + +import com.blockchain.common.base.dto.ResultDTO; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestParam; + +/** + * @author huangxl + * @create 2019-02-28 17:39 + */ +@FeignClient("dapp-eth-server") +public interface EthFeign { + @GetMapping("/inner/wallet/initWallets") + ResultDTO initWallets(@RequestParam("userOpenId") String userOpenId); +} diff --git a/blockchain-server/blockchain-server-yyyf/src/main/resources/application.yml b/blockchain-server/blockchain-server-yyyf/src/main/resources/application.yml new file mode 100644 index 0000000..de0b943 --- /dev/null +++ b/blockchain-server/blockchain-server-yyyf/src/main/resources/application.yml @@ -0,0 +1,4 @@ +#日志配置路径 +logging: + config: classpath:logback/logback-${spring.cloud.config.profile}.xml + diff --git a/blockchain-server/blockchain-server-yyyf/src/main/resources/bootstrap.yml b/blockchain-server/blockchain-server-yyyf/src/main/resources/bootstrap.yml new file mode 100644 index 0000000..8cebef1 --- /dev/null +++ b/blockchain-server/blockchain-server-yyyf/src/main/resources/bootstrap.yml @@ -0,0 +1,23 @@ +server: + port: 8111 +#注册中心 +eureka: + client: + service-url: + defaultZone: http://${eureka-host}:8001/eureka/ + instance: + prefer-ip-address: true + instance-id: ${spring.cloud.client.ip-address}:${server.port} + hostname: ${spring.cloud.client.ip-address} +spring: + cloud: + #配置中心 + config: + discovery: + service-id: dapp-config-server + enabled: true + profile: dev + name: springconf,springcloudconf,redisconf,dbconf,txconf,xssconf,fileconf,smsconf,emailconf,ipconf,pushconf + application: + name: dapp-yyyf-server + diff --git a/blockchain-server/blockchain-server-yyyf/src/main/resources/logback/logback-dev.xml b/blockchain-server/blockchain-server-yyyf/src/main/resources/logback/logback-dev.xml new file mode 100644 index 0000000..9a0e324 --- /dev/null +++ b/blockchain-server/blockchain-server-yyyf/src/main/resources/logback/logback-dev.xml @@ -0,0 +1,54 @@ + + + + + + + + + ${log.pattern} + + + + + ${log.path}/sys-info.log + + INFO + ACCEPT + DENY + + + ${log.path}/sys-info.%d{yyyy-MM-dd}.log + 60 + + + ${log.pattern} + + + + + ERROR + ACCEPT + DENY + + ${log.path}/sys-error.log + + ${log.path}/sys-error.%d{yyyy-MM-dd}.log + 60 + + + ${log.pattern} + + + + + + + + + + + + + + \ No newline at end of file diff --git a/blockchain-server/blockchain-server-yyyf/src/main/resources/logback/logback-pro.xml b/blockchain-server/blockchain-server-yyyf/src/main/resources/logback/logback-pro.xml new file mode 100644 index 0000000..5b55059 --- /dev/null +++ b/blockchain-server/blockchain-server-yyyf/src/main/resources/logback/logback-pro.xml @@ -0,0 +1,54 @@ + + + + + + + + + ${log.pattern} + + + + + ${log.path}/sys-info.log + + INFO + ACCEPT + DENY + + + ${log.path}/sys-info.%d{yyyy-MM-dd}.log + 60 + + + ${log.pattern} + + + + + ERROR + ACCEPT + DENY + + ${log.path}/sys-error.log + + ${log.path}/sys-error.%d{yyyy-MM-dd}.log + 60 + + + ${log.pattern} + + + + + + + + + + + + + + \ No newline at end of file diff --git a/blockchain-server/pom.xml b/blockchain-server/pom.xml index f393496..b8e53a0 100644 --- a/blockchain-server/pom.xml +++ b/blockchain-server/pom.xml @@ -24,6 +24,7 @@ blockchain-server-sysconf blockchain-server-imJg blockchain-server-user + blockchain-server-yyyf