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
index 52a1685..996f62f 100644
--- 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
@@ -15,7 +15,7 @@ import java.io.Serializable;
public class YyyfUserDto implements Serializable {
private static final long serialVersionUID = -6752296227958588252L;
/**传过来的用户id*/
- private String id;
+ private Integer id;
/**用户名称*/
private String name;
/**用户类型:0学生,1老师,2管理员*/
diff --git a/blockchain-server/blockchain-server-user/src/main/resources/bootstrap.yml b/blockchain-server/blockchain-server-user/src/main/resources/bootstrap.yml
index d983557..ef11b67 100644
--- a/blockchain-server/blockchain-server-user/src/main/resources/bootstrap.yml
+++ b/blockchain-server/blockchain-server-user/src/main/resources/bootstrap.yml
@@ -13,6 +13,7 @@ spring:
cloud:
#配置中心
config:
+ uri: http://10.10.17.84:8002
discovery:
service-id: dapp-config-server
enabled: true
diff --git a/blockchain-server/blockchain-server-yyyf/pom.xml b/blockchain-server/blockchain-server-yyyf/pom.xml
index b3f206c..0753e77 100644
--- a/blockchain-server/blockchain-server-yyyf/pom.xml
+++ b/blockchain-server/blockchain-server-yyyf/pom.xml
@@ -47,6 +47,28 @@
gexin-rp-sdk-http
4.1.0.3
+
+
+ org.springframework.cloud
+ spring-cloud-commons
+
+
+
+ org.apache.poi
+ poi
+ 3.10-FINAL
+
+
+ org.apache.poi
+ poi-ooxml
+ 3.10-FINAL
+
+
+ org.apache.poi
+ poi-ooxml-schemas
+ 3.10-FINAL
+
+
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
index 66f2545..e4c963f 100644
--- 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
@@ -7,6 +7,7 @@ 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 com.blockchain.server.yyyf.service.AssessUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@@ -17,7 +18,6 @@ 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;
@@ -39,6 +39,8 @@ public class LoginController {
private static final Logger LOG = LoggerFactory.getLogger(LoginController.class);
+ @Autowired
+ private AssessUserService assessUserService;
@Autowired
private RedisTemplate redisTemplate;
@@ -46,7 +48,7 @@ public class LoginController {
@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) {
+ public ResultDTO loginyyyf(@ApiParam(LoginApi.YyyfLogin.METHOD_API_YYYFLOGINREQUESTVO) @Valid YyyfLoginRequestVo yyyfLoginRequestVo) {
//存到redis中用于以渔有方用户与智信链用户进行绑定
YyyfUserDto yyyfUserDto=new YyyfUserDto();
@@ -63,7 +65,7 @@ public class LoginController {
int reqType = yyyfLoginRequestVo.getReqType().intValue();
int userType = yyyfLoginRequestVo.getUserType().intValue();
Integer classId =yyyfLoginRequestVo.getClassId();
- String userId = yyyfLoginRequestVo.getUserId();
+ Integer userId = yyyfLoginRequestVo.getUserId();
Integer schoolId = yyyfLoginRequestVo.getSchoolId();
yyyfUserDto.setClassId(classId);
@@ -81,9 +83,9 @@ public class LoginController {
HashOperations examDtoOpsForHash = redisTemplate.opsForHash();
//将参加考试的人员缓存
- HashOperations> studentOpsForHash = redisTemplate.opsForHash();
+ HashOperations> studentOpsForHash = redisTemplate.opsForHash();
//参加考试的人员id
- List joinStuIds =null;
+ List joinStuIds =null;
//考试id和案列id缓存
String caseKey = YyyfConstant.CASE_KEY + userId;
@@ -91,7 +93,7 @@ public class LoginController {
//判断考试缓存中是否存在这张卷子
if (0 == reqType) {
//如果他提交了,库里有信息了,不允许他再次进入了。
- if (/**this.assessUserService.getAssessUserByIssueIdAndUserIdForExam(examId, userId) != null*/1==1) {
+ if (this.assessUserService.selectScore(examId, userId) != null) {
yyyfLoginDto.setStatus(2);
yyyfLoginDto.setMsg(YyyfConstant.SUBMITTED);
return handleAfterLogin(yyyfLoginDto,yyyfUserDto);
@@ -110,7 +112,7 @@ public class LoginController {
joinStuIds=studentOpsForHash.get(YyyfConstant.JOIN_EXAM_STU_IDS_KEY, examId);
if (joinStuIds == null) {
- joinStuIds = new ArrayList();
+ joinStuIds = new ArrayList();
}
//如果等于0
if (joinStuIds.stream()
@@ -209,7 +211,7 @@ public class LoginController {
*/
private ResultDTO handleAfterLogin(YyyfLoginDto yyyfLoginDto, YyyfUserDto yyyfUserDto) {
int status = yyyfLoginDto.getStatus();
- String token = generateToken(yyyfUserDto.getId(), System.currentTimeMillis(), YyyfConstant.YYYF_ZHIXINLIAN_USER_KEY);
+ String token = generateToken(String.valueOf(yyyfUserDto.getId()), System.currentTimeMillis(), YyyfConstant.YYYF_ZHIXINLIAN_USER_KEY);
yyyfLoginDto.setYyyfUserToken(token);
if(status==1){
//到时看要不要设定时长
diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/TeachingGradeController.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/TeachingGradeController.java
new file mode 100644
index 0000000..6a14574
--- /dev/null
+++ b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/TeachingGradeController.java
@@ -0,0 +1,619 @@
+package com.blockchain.server.yyyf.controller;
+
+import com.alibaba.fastjson.JSONObject;
+import com.blockchain.server.yyyf.dto.PractiseProDto;
+import com.blockchain.server.yyyf.dto.PractiseTaskDto;
+import com.blockchain.server.yyyf.entity.AssessUser;
+import com.blockchain.server.yyyf.service.AssessUserService;
+import com.blockchain.server.yyyf.service.AssessUserTaskService;
+import com.blockchain.server.yyyf.utils.MSExcelUtil;
+import com.blockchain.server.yyyf.utils.ResponseUtils;
+
+import org.apache.poi.hssf.usermodel.*;
+import org.apache.poi.hssf.util.HSSFColor;
+import org.apache.poi.ss.util.CellRangeAddress;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+import sun.misc.BASE64Decoder;
+
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.math.BigDecimal;
+import java.net.URLEncoder;
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+/**
+ * @author huan.xu
+ * @version 1.0
+ * @className TeachingGradeController
+ * @description 练习、考核成绩Controller
+ * @date 2019-11-05 16:23
+ */
+@Controller
+@RequestMapping("/teachingGrade")
+public class TeachingGradeController {
+ protected Logger logger = LoggerFactory.getLogger(TeachingGradeController.class);
+
+ private static final String SYS_CODE = "102";
+
+ @Autowired
+ private AssessUserService assessUserService;
+ @Autowired
+ private AssessUserTaskService assessUserTaskService;
+ // @Autowired
+ // private ScoreSynchroService scoreSynchroService;
+
+
+ /**
+ * http://10.10.17.93:8080/BankTrain/teachingGrade/getGradeData?issueId=7e027a96764b4749b2a2d65cdc4a5c92&totalNum=10&caseId=38
+ *
+ * @param [request, response]
+ * @return void
+ * @description 教师端获取错误率 (issueId:考核id【即reqId】;totalNum:班级总人数;caseId:项目id)
+ * @author huan.xu
+ * @date 2019-11-08 18:03:39
+ **/
+ @RequestMapping(value = "/getGradeData"/*,produces = {"application/text;charset=UTF-8"}*/)
+ @ResponseBody
+ @SuppressWarnings("all")
+ public void getGradeData(HttpServletRequest request, HttpServletResponse response) {
+
+ String issueId = request.getParameter("issueId");
+ String totalNumStr = request.getParameter("totalNum");
+ String projectId = request.getParameter("caseId");//项目id
+ Integer totalNum = Integer.valueOf(totalNumStr);
+
+ JSONObject json = new JSONObject();
+ try {/*
+ //根据考核id 查询所有的有成绩的学生考核概览信息
+ List assessUserList = this.assessUserService.selectAssessUserListByIssueId(issueId);
+ Map wrongStatistics = null;//错误信息
+ //无人考试 时封装错误率
+ if (assessUserList == null || (assessUserList != null && assessUserList.size() == 0)) {
+
+ //String projectName = JedisUtil.getMapValue(JedisUtil.bulidKey(Const.TIFPRO_KEY), projectId, TifPro.class).getProjectName();
+ //获取所有交易关联信息
+ List tiftrnDtoList = JedisUtil.getMapValueForList(JedisUtil.bulidKey(Const.TIFTRN_KEY), projectId, TiftrnDto.class);
+
+ wrongStatistics = new HashMap<>();
+
+ Map maxErrorRateInfo = new HashMap<>();//最大错误率信息记录
+ Map minErrorRateInfo = new HashMap<>();//最小错误率信息记录
+ List taskNames = new ArrayList<>();
+ List errorRates = new ArrayList<>();
+ for (TiftrnDto tifDtotrn : tiftrnDtoList) {
+ List testPoints = tifDtotrn.getTestPoints();
+ if (testPoints != null && testPoints.size() != 0) {
+ for (TestPointDto testPointDto : testPoints) {
+ taskNames.add(testPointDto.getPointName());
+ errorRates.add(Double.valueOf(100));
+ if (maxErrorRateInfo.size() == 0) {
+ maxErrorRateInfo.put("headCount", totalNum);
+ maxErrorRateInfo.put("taskName", testPointDto.getPointName());
+ maxErrorRateInfo.put("errorRate", Double.valueOf(100));
+ maxErrorRateInfo.put("projectName", tifDtotrn.getTrxName());
+ maxErrorRateInfo.put("errorCount", totalNum);
+ continue;
+ }
+ if (minErrorRateInfo.size() == 0) {
+ minErrorRateInfo.put("headCount", totalNum);
+ minErrorRateInfo.put("taskName", testPointDto.getPointName());
+ minErrorRateInfo.put("errorRate", Double.valueOf(100));
+ minErrorRateInfo.put("projectName", tifDtotrn.getTrxName());
+ minErrorRateInfo.put("errorCount", totalNum);
+ continue;
+ }
+ }
+
+ } else {
+ taskNames.add(tifDtotrn.getTrxName());
+ errorRates.add(Double.valueOf(100));
+ if (maxErrorRateInfo.size() == 0) {
+ maxErrorRateInfo.put("headCount", totalNum);
+ maxErrorRateInfo.put("taskName", tifDtotrn.getTrxName());
+ maxErrorRateInfo.put("errorRate", Double.valueOf(100));
+ maxErrorRateInfo.put("projectName", tifDtotrn.getTrxName());
+ maxErrorRateInfo.put("errorCount", totalNum);
+ continue;
+ }
+ if (minErrorRateInfo.size() == 0) {
+ minErrorRateInfo.put("headCount", totalNum);
+ minErrorRateInfo.put("taskName", tifDtotrn.getTrxName());
+ minErrorRateInfo.put("errorRate", Double.valueOf(100));
+ minErrorRateInfo.put("projectName", tifDtotrn.getTrxName());
+ minErrorRateInfo.put("errorCount", totalNum);
+ continue;
+ }
+ }
+ }
+ wrongStatistics.put("maxErrorRateInfo", maxErrorRateInfo);
+ wrongStatistics.put("minErrorRateInfo", minErrorRateInfo);
+ wrongStatistics.put("taskNames", taskNames);
+ wrongStatistics.put("errorRates", errorRates);
+
+ } else {
+ wrongStatistics = getWrongStatistics(issueId, totalNum - assessUserList.size());
+ }
+
+
+ json.put("result", true);
+ json.put("wrongStatistics", wrongStatistics);*/
+ } catch (Exception e) {
+ json.put("result", false);
+ json.put("msg", "获取成绩报表数据失败");
+ logger.error("获取成绩报表数据失败: " + e.getMessage(), e);
+ }
+
+ ResponseUtils.renderJson(response, json.toString());
+ }
+
+ /**
+ * @param [issueId, notExamNum]
+ * @return java.util.Map
+ * @description 封装错误率
+ * @author huan.xu
+ * @date 2019-11-08 18:27:22
+ **/
+ public Map getWrongStatistics(String issueId, Integer notExamNum) {
+ Map wrongStatistics = new HashMap();
+ //根据考核发布id,获取考核点信息
+ List