以渔有方服务上传

pull/1/head
huan.xu 5 years ago
parent f2921b89d4
commit 64b507fb70
  1. 2
      blockchain-common/blockchain-common-base/src/main/java/com/blockchain/common/base/constant/BaseConstant.java
  2. 34
      blockchain-common/blockchain-common-base/src/main/java/com/blockchain/common/base/constant/YyyfConstant.java
  3. 28
      blockchain-common/blockchain-common-base/src/main/java/com/blockchain/common/base/dto/YyyfUserDto.java
  4. 68
      blockchain-server/blockchain-server-yyyf/pom.xml
  5. 20
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/YyyfApplication.java
  6. 236
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/LoginController.java
  7. 16
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/api/LoginApi.java
  8. 32
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/ExamDto.java
  9. 32
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/ExamPaperDto.java
  10. 29
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/PractiseTipDto.java
  11. 47
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/StudentAnswerDto.java
  12. 27
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/YyyfLoginDto.java
  13. 59
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/YyyfLoginRequestVo.java
  14. 16
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/feign/BtcFeign.java
  15. 16
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/feign/EosFeign.java
  16. 16
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/feign/EthFeign.java
  17. 4
      blockchain-server/blockchain-server-yyyf/src/main/resources/application.yml
  18. 23
      blockchain-server/blockchain-server-yyyf/src/main/resources/bootstrap.yml
  19. 54
      blockchain-server/blockchain-server-yyyf/src/main/resources/logback/logback-dev.xml
  20. 54
      blockchain-server/blockchain-server-yyyf/src/main/resources/logback/logback-pro.xml
  21. 1
      blockchain-server/pom.xml

@ -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;// 成功标识
}

@ -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";
}

@ -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;
}

@ -0,0 +1,68 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>blockchain-server</artifactId>
<groupId>com.blockchain</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>blockchain-server-yyyf</artifactId>
<dependencies>
<dependency>
<groupId>com.blockchain</groupId>
<artifactId>blockchain-server-base</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.blockchain</groupId>
<artifactId>blockchain-common-tx</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.blockchain</groupId>
<artifactId>blockchain-common-base</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<!-- java mail -->
<dependency>
<groupId>com.sun.mail</groupId>
<artifactId>javax.mail</artifactId>
<version>1.6.2</version>
</dependency>
<!-- 阿里云依赖 -->
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>aliyun-java-sdk-core</artifactId>
<version>4.0.3</version>
</dependency>
<!-- 个推API依赖 -->
<dependency>
<groupId>com.gexin.platform</groupId>
<artifactId>gexin-rp-sdk-http</artifactId>
<version>4.1.0.3</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>getui-nexus</id>
<url>http://mvn.gt.igexin.com/nexus/content/repositories/releases/</url>
</repository>
</repositories>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

@ -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);
}
}

@ -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<YyyfLoginDto> 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<String, String, ExamDto> examDtoOpsForHash = redisTemplate.opsForHash();
//将参加考试的人员缓存
HashOperations<String, String, List<String>> studentOpsForHash = redisTemplate.opsForHash();
//参加考试的人员id
List<String> 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<String>();
}
//如果等于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<String, String> examMsgMap = (Map<String, String>) 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<String, Object> studentAnsweValueOperations = redisTemplate.opsForValue();
String studentAnswerDtoKey = YyyfConstant.ANSER_KEY + userId + examPaperId;
StudentAnswerDto studentAnswerDto = (StudentAnswerDto) studentAnsweValueOperations.get(studentAnswerDtoKey);
if (studentAnswerDto != null) {
//答题结果、且未提交
Map<String, Integer> 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<String, String> map = new HashMap<String, String>();
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<String, Object> 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<String, String> map = new HashMap<String, String>();
map.put("examPaperId", examPaperId);
map.put("examId", examId);
HashOperations<String, String, ExamPaperDto> 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);
}
}

@ -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";
}
}

@ -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;
}

@ -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;
}

@ -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;
}

@ -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<String, Integer> result;
/**
* 总分
*/
private BigDecimal totalScore;
/**
* 班级id
*/
private Integer classId;
/**
* 用户类型
*/
private Integer userType;
/**
* 课程id
*/
private String courseId;
}

@ -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;
}

@ -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;
}

@ -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);
}

@ -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);
}

@ -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);
}

@ -0,0 +1,4 @@
#日志配置路径
logging:
config: classpath:logback/logback-${spring.cloud.config.profile}.xml

@ -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

@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<!-- 输入文件的根目录 -->
<property name="log.path" value="/log/${custom-project-name}/${project.artifactId}" />
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
</appender>
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/sys-info.log</file>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>INFO</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${log.path}/sys-info.%d{yyyy-MM-dd}.log</fileNamePattern>
<maxHistory>60</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
</appender>
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>ERROR</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
<file>${log.path}/sys-error.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${log.path}/sys-error.%d{yyyy-MM-dd}.log</fileNamePattern>
<maxHistory>60</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
</appender>
<!-- 包名debug -->
<logger name="com.blockchain" level="debug"/>
<root level="debug">
<appender-ref ref="console" />
</root>
<root level="info">
<appender-ref ref="file_info" />
<appender-ref ref="file_error" />
</root>
</configuration>

@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<!-- 输入文件的根目录 -->
<property name="log.path" value="/log/${custom-project-name}/${project.artifactId}" />
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
</appender>
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/sys-info.log</file>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>INFO</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${log.path}/sys-info.%d{yyyy-MM-dd}.log</fileNamePattern>
<maxHistory>60</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
</appender>
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>ERROR</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
<file>${log.path}/sys-error.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${log.path}/sys-error.%d{yyyy-MM-dd}.log</fileNamePattern>
<maxHistory>60</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
</appender>
<!-- 包名debug -->
<logger name="com.blockchain" level="info"/>
<root level="info">
<appender-ref ref="console" />
</root>
<root level="info">
<appender-ref ref="file_info" />
<appender-ref ref="file_error" />
</root>
</configuration>

@ -24,6 +24,7 @@
<module>blockchain-server-sysconf</module>
<module>blockchain-server-imJg</module>
<module>blockchain-server-user</module>
<module>blockchain-server-yyyf</module>
</modules>
<dependencies>

Loading…
Cancel
Save