Commit 1b053e08 authored by sunyuhua's avatar sunyuhua

成绩提交,审核的代码

parent 4447d762
...@@ -28,7 +28,7 @@ public class CmptScoreRuleScoreInfo { ...@@ -28,7 +28,7 @@ public class CmptScoreRuleScoreInfo {
private Integer subsectionMileage; private Integer subsectionMileage;
//成绩审核的状态,0为未审核,1为审核通过,2为审核未通过 //成绩审核的状态,0为未审核,1为审核通过,2为审核未通过
private Integer checkStatus; private Integer checkStatus;
private Integer cmptPace; private float cmptPace;
//用户提交的成绩依据材料路径 //用户提交的成绩依据材料路径
private List<String> scoreFieldValueList; private List<String> scoreFieldValueList;
@JsonIgnore @JsonIgnore
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
<mapper namespace="com.dlbridge.jadp.plugins.cmpt.dao.mapper.CmptScoreRuleScoreInfoMapper"> <mapper namespace="com.dlbridge.jadp.plugins.cmpt.dao.mapper.CmptScoreRuleScoreInfoMapper">
<insert id="saveScoreRuleScoreInfo" useGeneratedKeys="true" keyProperty="id" keyColumn="id"> <insert id="saveScoreRuleScoreInfo" useGeneratedKeys="true" keyProperty="id" keyColumn="id">
INSERT INTO gk_cmpt_score_rule_scoreinfo(cmptId,rule_id,mark_no,subsectionTime,subsectionscore,subsectionMileage,cmptPace,isDelete,insertTime,updateTime) INSERT INTO gk_cmpt_score_rule_scoreinfo(cmptId,rule_id,mark_no,subsectionTime,subsectionscore,subsectionMileage,cmptPace,checkStatus,isDelete,insertTime,updateTime)
VALUES(#{cmptScoreRuleScoreInfo.cmptId},#{cmptScoreRuleScoreInfo.ruleId},#{cmptScoreRuleScoreInfo.markNo},#{cmptScoreRuleScoreInfo.subsectionTime},#{cmptScoreRuleScoreInfo.subsectionscore},#{cmptScoreRuleScoreInfo.subsectionMileage},#{cmptScoreRuleScoreInfo.cmptPace},0,now(),now()) VALUES(#{cmptScoreRuleScoreInfo.cmptId},#{cmptScoreRuleScoreInfo.ruleId},#{cmptScoreRuleScoreInfo.markNo},#{cmptScoreRuleScoreInfo.subsectionTime},#{cmptScoreRuleScoreInfo.subsectionscore},#{cmptScoreRuleScoreInfo.subsectionMileage},#{cmptScoreRuleScoreInfo.cmptPace},#{cmptScoreRuleScoreInfo.checkStatus},0,now(),now())
</insert> </insert>
<select id="getScoreRuleScoreInfoByMarkNo" resultType="com.dlbridge.jadp.plugins.cmpt.bean.CmptScoreRuleScoreInfo"> <select id="getScoreRuleScoreInfoByMarkNo" resultType="com.dlbridge.jadp.plugins.cmpt.bean.CmptScoreRuleScoreInfo">
select id,cmptId,rule_id as ruleId,mark_no as markNo,subsectionTime,subsectionscore,subsectionMileage,cmptPace from gk_cmpt_score_rule_scoreinfo where cmptId=#{cmptId} and mark_no=#{markNo} and checkStatus=1 and isDelete=0 select id,cmptId,rule_id as ruleId,mark_no as markNo,subsectionTime,subsectionscore,subsectionMileage,cmptPace from gk_cmpt_score_rule_scoreinfo where cmptId=#{cmptId} and mark_no=#{markNo} and checkStatus=1 and isDelete=0
......
...@@ -40,7 +40,6 @@ public class CmptScoreRuleScoreInfoService { ...@@ -40,7 +40,6 @@ public class CmptScoreRuleScoreInfoService {
* @param cmptScoreRuleScoreInfo * @param cmptScoreRuleScoreInfo
*/ */
public void saveScoreRuleScoreInfo(CmptScoreRuleScoreInfo cmptScoreRuleScoreInfo){ public void saveScoreRuleScoreInfo(CmptScoreRuleScoreInfo cmptScoreRuleScoreInfo){
System.out.print("===="+cmptScoreRuleScoreInfo.getCmptPace());
cmptScoreRuleScoreInfoMapper.saveScoreRuleScoreInfo(cmptScoreRuleScoreInfo); cmptScoreRuleScoreInfoMapper.saveScoreRuleScoreInfo(cmptScoreRuleScoreInfo);
} }
......
...@@ -6,7 +6,6 @@ import com.alibaba.fastjson.JSONObject; ...@@ -6,7 +6,6 @@ import com.alibaba.fastjson.JSONObject;
import com.dlbridge.jadp.plugins.cmpt.bean.*; import com.dlbridge.jadp.plugins.cmpt.bean.*;
import com.dlbridge.jadp.plugins.cmpt.dao.model.Cmpt; import com.dlbridge.jadp.plugins.cmpt.dao.model.Cmpt;
import lombok.extern.log4j.Log4j2; import lombok.extern.log4j.Log4j2;
import org.apache.commons.codec.net.URLCodec;
import org.apache.commons.lang3.math.NumberUtils; import org.apache.commons.lang3.math.NumberUtils;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
...@@ -538,6 +537,7 @@ public class RemoteService { ...@@ -538,6 +537,7 @@ public class RemoteService {
*/ */
public boolean mergePersonEnrollByMarkNo(HashMap<String,Object> cmptEnrollInfo) throws UnsupportedEncodingException { public boolean mergePersonEnrollByMarkNo(HashMap<String,Object> cmptEnrollInfo) throws UnsupportedEncodingException {
String cmptEnrolljson= JSON.toJSONString(cmptEnrollInfo); String cmptEnrolljson= JSON.toJSONString(cmptEnrollInfo);
log.info("调用计时系统,将提交成绩保存起来="+timerURL + "updateUserEnroll.do?personEnroll="+URLEncoder.encode(cmptEnrolljson, StandardCharsets.UTF_8.toString()));
ResponseEntity<String> forEntity = restTemplate.getForEntity(timerURL + "updateUserEnroll.do?personEnroll="+URLEncoder.encode(cmptEnrolljson, StandardCharsets.UTF_8.toString()), String.class); ResponseEntity<String> forEntity = restTemplate.getForEntity(timerURL + "updateUserEnroll.do?personEnroll="+URLEncoder.encode(cmptEnrolljson, StandardCharsets.UTF_8.toString()), String.class);
if (forEntity.getStatusCode() == HttpStatus.OK) { if (forEntity.getStatusCode() == HttpStatus.OK) {
String resultString = forEntity.getBody(); String resultString = forEntity.getBody();
......
...@@ -35,6 +35,7 @@ import javax.servlet.http.HttpServletRequest; ...@@ -35,6 +35,7 @@ import javax.servlet.http.HttpServletRequest;
import java.io.*; import java.io.*;
import java.net.HttpURLConnection; import java.net.HttpURLConnection;
import java.net.URL; import java.net.URL;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
...@@ -848,23 +849,26 @@ public class MicroApiController { ...@@ -848,23 +849,26 @@ public class MicroApiController {
} }
//根据里程计算配速,里程来自用户自己填写的里程或者来自项目的里程 //根据里程计算配速,里程来自用户自己填写的里程或者来自项目的里程
int duration=score.getScore().getDuration(); int duration=score.getScore().getDuration();
int cmptPace=0; float cmptPace=0;
int mileage=0; int mileage=0;
FuncSetting settingByCmptId = funcSettingService.getSettingByCmptId(score.getCmptId()); FuncSetting settingByCmptId = funcSettingService.getSettingByCmptId(score.getCmptId());
int isHasMileage=settingByCmptId.getMileage(); int isHasMileage=settingByCmptId.getMileage();
//是否开启了里程的填写
if(isHasMileage==1){ if(isHasMileage==1){
mileage=score.getScore().getMileage(); mileage=score.getScore().getMileage();
if(mileage ==0){ if(mileage ==0){
return Result.fail().setMsg("请输入里程"); return Result.fail().setMsg("请输入里程");
} }
cmptPace=duration/mileage; DecimalFormat df = new DecimalFormat("0.##");
cmptPace=Float.valueOf(df.format((float)duration/mileage));
}else{ }else{
int distance=(int)remoteService.getTimeSegInfoByRoadId(score.getCmptId(),score.getRoadId()).get("distance"); int distance=(int)remoteService.getTimeSegInfoByRoadId(score.getCmptId(),score.getRoadId()).get("distance");
if(distance ==0){ if(distance ==0){
return Result.fail().setMsg("赛事项目需要设置里程"); return Result.fail().setMsg("赛事项目需要设置里程");
} }
mileage=distance; mileage=distance;
cmptPace=duration/mileage; DecimalFormat df = new DecimalFormat("0.##");
cmptPace=Float.valueOf(df.format((float)duration/mileage));
} }
//前端上传json中取出里程,耗时,提交时间,赛事地,规则id,markNo //前端上传json中取出里程,耗时,提交时间,赛事地,规则id,markNo
CmptScoreRuleScoreInfo cmptScoreRuleScoreInfo = new CmptScoreRuleScoreInfo().setCmptId(score.getCmptId()) CmptScoreRuleScoreInfo cmptScoreRuleScoreInfo = new CmptScoreRuleScoreInfo().setCmptId(score.getCmptId())
...@@ -874,7 +878,7 @@ public class MicroApiController { ...@@ -874,7 +878,7 @@ public class MicroApiController {
//如果自动审核开启的话,进行单条成绩的审核处理 //如果自动审核开启的话,进行单条成绩的审核处理
if(settingByCmptId.getSwitchScoreReview()==1){ if(settingByCmptId.getSwitchScoreReview()==1){
//配速小于2"27不能通过审核 //配速小于2"27不能通过审核
if(cmptPace<=147){ if(cmptPace<=(float)147/1000){
cmptScoreRuleScoreInfo.setCheckStatus(2); cmptScoreRuleScoreInfo.setCheckStatus(2);
}else{ }else{
cmptScoreRuleScoreInfo.setCheckStatus(1); cmptScoreRuleScoreInfo.setCheckStatus(1);
...@@ -955,7 +959,7 @@ public class MicroApiController { ...@@ -955,7 +959,7 @@ public class MicroApiController {
int visibility=cmptSetting.getCmptSettingsVisibilityByCmptIdAndType(Integer.valueOf(cmptId),12); int visibility=cmptSetting.getCmptSettingsVisibilityByCmptIdAndType(Integer.valueOf(cmptId),12);
if(visibility==1){ if(visibility==1){
HashMap<String,Object> scoreMap=cmptScoreRuleScoreInfoService.getUserScoreByMarkNo(Integer.valueOf(cmptId),keyword); HashMap<String,Object> scoreMap=cmptScoreRuleScoreInfoService.getUserScoreByMarkNo(Integer.valueOf(cmptId),keyword);
if((int)scoreMap.get("userTotalScore")>0){ if((long)scoreMap.get("userTotalScore")>0){
return Result.success().setMsg("请下载证书"); return Result.success().setMsg("请下载证书");
}else{ }else{
return Result.fail().setMsg("您尚未完赛,无法查看完赛证书"); return Result.fail().setMsg("您尚未完赛,无法查看完赛证书");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment