|
@@ -1,21 +1,28 @@
|
|
|
package cn.com.qmth.stmms.ms.admin.api;
|
|
|
|
|
|
+import cn.com.qmth.stmms.ms.commons.utils.ServletUtil;
|
|
|
import cn.com.qmth.stmms.ms.core.cache.ParamCache;
|
|
|
import cn.com.qmth.stmms.ms.core.domain.MarkSubject;
|
|
|
import cn.com.qmth.stmms.ms.core.domain.Paper;
|
|
|
import cn.com.qmth.stmms.ms.core.domain.ParamSetting;
|
|
|
+import cn.com.qmth.stmms.ms.core.domain.enums.ParamSettingTypeEnum;
|
|
|
import cn.com.qmth.stmms.ms.core.domain.enums.TrialEnum;
|
|
|
+import cn.com.qmth.stmms.ms.core.domain.paramsetting.CoarseLevelConfig;
|
|
|
+import cn.com.qmth.stmms.ms.core.domain.paramsetting.CollectConfig;
|
|
|
+import cn.com.qmth.stmms.ms.core.domain.paramsetting.LevelConfig;
|
|
|
+import cn.com.qmth.stmms.ms.core.domain.paramsetting.ScoreConfig;
|
|
|
import cn.com.qmth.stmms.ms.core.repository.MarkSubjectRepo;
|
|
|
import cn.com.qmth.stmms.ms.core.repository.MarkTaskRepo;
|
|
|
import cn.com.qmth.stmms.ms.core.repository.PaperRepo;
|
|
|
import cn.com.qmth.stmms.ms.core.repository.ParamSettingRepo;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import org.springframework.http.HttpStatus;
|
|
|
import org.springframework.http.ResponseEntity;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
import java.util.Objects;
|
|
|
|
|
|
/**
|
|
@@ -25,16 +32,16 @@ import java.util.Objects;
|
|
|
@RequestMapping("/api/param")
|
|
|
public class ParamApi {
|
|
|
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private ParamSettingRepo paramSettingRepo;
|
|
|
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private PaperRepo paperRepo;
|
|
|
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private MarkSubjectRepo markSubjectRepo;
|
|
|
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private MarkTaskRepo markTaskRepo;
|
|
|
|
|
|
/**
|
|
@@ -42,7 +49,7 @@ public class ParamApi {
|
|
|
*
|
|
|
* @param workId 工作Id
|
|
|
*/
|
|
|
- @RequestMapping(value = "/getParam", method = RequestMethod.GET)
|
|
|
+ @GetMapping("/getParam")
|
|
|
public ParamSetting getOne(@RequestParam Long workId) {
|
|
|
return paramSettingRepo.findByWorkId(workId);
|
|
|
}
|
|
@@ -50,144 +57,220 @@ public class ParamApi {
|
|
|
/**
|
|
|
* 更新采集参数
|
|
|
*
|
|
|
- * @param workId
|
|
|
- * @param packageScan
|
|
|
- * @param imageEncrypt
|
|
|
- * @param nameRule
|
|
|
- * @param paperStage
|
|
|
- * @return
|
|
|
+ * @param data data
|
|
|
*/
|
|
|
- @RequestMapping(value = "/collect", method = RequestMethod.POST)
|
|
|
- public ResponseEntity updateCollectParam(@RequestParam Long workId,
|
|
|
- @RequestParam Integer packageScan,
|
|
|
- @RequestParam Integer imageEncrypt,
|
|
|
- @RequestParam Integer nameRule,
|
|
|
- @RequestParam Integer paperStage) {
|
|
|
+ @PostMapping("/collect")
|
|
|
+ public ResponseEntity updateCollectParam(@RequestBody String data) {
|
|
|
+ JSONObject object = JSON.parseObject(data);
|
|
|
+ Integer packageScan = object.getInteger("packageScan");
|
|
|
+ Integer imageEncrypt = object.getInteger("imageEncrypt");
|
|
|
+ Integer nameRule = object.getInteger("nameRule");
|
|
|
+ Integer paperStage = object.getInteger("paperStage");
|
|
|
+
|
|
|
+ Long workId = ServletUtil.getWordId();
|
|
|
//保存采集参数
|
|
|
ParamSetting paramSetting = paramSettingRepo.findByWorkId(workId);
|
|
|
if (paramSetting == null) {
|
|
|
- paramSetting = ParamSetting.init();
|
|
|
+ paramSetting = ParamSetting.init(workId);
|
|
|
}
|
|
|
int countMarkTasks = markTaskRepo.countByWorkId(workId);
|
|
|
- if (countMarkTasks > 0
|
|
|
- && !Objects.equals(packageScan, paramSetting.getPackageScan())) {
|
|
|
- throw new RuntimeException("该评卷工作当前不是采集阶段,不能修改是否整包扫描参数");
|
|
|
+
|
|
|
+ CollectConfig oldCollectConfig = JSON.parseObject(paramSetting.getCollectConfig(), CollectConfig.class);
|
|
|
+ if (countMarkTasks > 0 && !Objects.equals(packageScan, oldCollectConfig.getPackageScan())) {
|
|
|
+ throw new RuntimeException("该评卷工作当前不是采集阶段,不能修改是【否整包扫描】参数");
|
|
|
}
|
|
|
//有采集数据,不能修改采集参数
|
|
|
List<Paper> papers = paperRepo.findByWorkId(workId);
|
|
|
- if (papers != null && papers.size() > 0) {
|
|
|
- if (!Objects.equals(imageEncrypt, paramSetting.getImageEncrypt())
|
|
|
- || !Objects.equals(nameRule, paramSetting.getNameRule())
|
|
|
- || !Objects.equals(paperStage, paramSetting.getPaperStage())) {
|
|
|
- throw new RuntimeException("该评卷工作已有采集数据,不能修改图片是否加密、图片命名规则、试卷档位参数");
|
|
|
+ if (papers != null && !papers.isEmpty()) {
|
|
|
+ if (!Objects.equals(imageEncrypt, oldCollectConfig.getImageEncrypt())) {
|
|
|
+ throw new RuntimeException("该评卷工作已有采集数据,不能修改【图片是否加密】参数");
|
|
|
+ }
|
|
|
+ if (!Objects.equals(nameRule, oldCollectConfig.getNameRule())) {
|
|
|
+ throw new RuntimeException("该评卷工作已有采集数据,不能修改【图片命名规则】参数");
|
|
|
+ }
|
|
|
+ if (!Objects.equals(paperStage, oldCollectConfig.getPaperStage())) {
|
|
|
+ throw new RuntimeException("该评卷工作已有采集数据,不能修改【试卷档位】参数");
|
|
|
}
|
|
|
}
|
|
|
-// if(paramSetting.getPaperStage() == 1 && !Objects.equals(paperStage, paramSetting.getPaperStage())){
|
|
|
-// throw new RuntimeException("试卷档位已经设置,不能修改");
|
|
|
-// }
|
|
|
-
|
|
|
- paramSetting.setPackageScan(packageScan);
|
|
|
- paramSetting.setImageEncrypt(imageEncrypt);
|
|
|
- paramSetting.setNameRule(nameRule);
|
|
|
- paramSetting.setPaperStage(paperStage);
|
|
|
+
|
|
|
+ oldCollectConfig.setPackageScan(packageScan);
|
|
|
+ oldCollectConfig.setImageEncrypt(imageEncrypt);
|
|
|
+ oldCollectConfig.setNameRule(nameRule);
|
|
|
+ oldCollectConfig.setPaperStage(paperStage);
|
|
|
+ paramSetting.setCollectConfig(JSON.toJSONString(oldCollectConfig));
|
|
|
paramSettingRepo.saveAndFlush(paramSetting);
|
|
|
- ParamCache.resetParam(paramSetting);
|
|
|
+ ParamCache.cacheParam(ParamSettingTypeEnum.COLLECT, workId, paramSetting.getCollectConfig());
|
|
|
|
|
|
return new ResponseEntity(HttpStatus.OK);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 更新分档规则参数
|
|
|
+ * 细分档规则参数
|
|
|
*
|
|
|
- * @param workId 工作ID
|
|
|
- * @param deviation 仲裁档位差
|
|
|
- * @param autoCallback 是否自动打回
|
|
|
- * @param majority 是否过半定档
|
|
|
- * @param clearData
|
|
|
- * @param cumulativeError 打回累计误差
|
|
|
- * @param levelShowAllPaper 分档阶段阅卷员是否显示所有试卷
|
|
|
- * @param propDenominator 档位百分比分母(1: "全部考生数", 2: "去掉缺考考生数")
|
|
|
- * @param autoCallbackShowDeviation 自动打回时显示偏差
|
|
|
- * @param showStandardPaperManage
|
|
|
- * @param takeBest 取优原则
|
|
|
+ * @param data data
|
|
|
*/
|
|
|
- @RequestMapping(value = "/level", method = RequestMethod.POST)
|
|
|
- public ResponseEntity updateLevelParam(@RequestParam Long workId,
|
|
|
- @RequestParam Integer deviation,
|
|
|
- @RequestParam Integer autoCallback,
|
|
|
- @RequestParam Integer majority,
|
|
|
- @RequestParam Integer clearData,
|
|
|
- @RequestParam Integer cumulativeError,
|
|
|
- @RequestParam Integer levelShowAllPaper,
|
|
|
- @RequestParam Integer propDenominator,
|
|
|
- @RequestParam Integer autoCallbackShowDeviation,
|
|
|
- @RequestParam Integer showStandardPaperManage,
|
|
|
- @RequestParam Integer takeBest) {
|
|
|
+ @PostMapping("/level")
|
|
|
+ public ResponseEntity updateLevelParam(@RequestBody String data) {
|
|
|
+ Long workId = ServletUtil.getWordId();
|
|
|
+ JSONObject object = JSON.parseObject(data);
|
|
|
+ Integer deviation = object.getInteger("deviation");
|
|
|
+ Integer autoCallback = object.getInteger("autoCallback");
|
|
|
+ Integer majority = object.getInteger("majority");
|
|
|
+ Integer takeBest = object.getInteger("takeBest");
|
|
|
+ Integer clearData = object.getInteger("clearData");
|
|
|
+ Integer levelShowAllPaper = object.getInteger("levelShowAllPaper");
|
|
|
+ Integer propDenominator = object.getInteger("propDenominator");
|
|
|
+ Integer showStandardPaperManage = object.getInteger("showStandardPaperManage");
|
|
|
+ Integer coarseLevel = object.getInteger("coarseLevel");
|
|
|
+ Integer removeHighAndLow = object.getInteger("removeHighAndLow");
|
|
|
+
|
|
|
List<MarkSubject> markSubjects = markSubjectRepo.findByWorkIdAndTestNot(workId, TrialEnum.DEFAULT.ordinal());
|
|
|
int countMarkTasks = markTaskRepo.countByWorkId(workId);
|
|
|
- boolean flag = false;
|
|
|
- if ((markSubjects == null || markSubjects.size() == 0) && countMarkTasks > 0) {
|
|
|
- flag = true;
|
|
|
- }
|
|
|
-
|
|
|
//保存分档参数
|
|
|
ParamSetting paramSetting = paramSettingRepo.findByWorkId(workId);
|
|
|
- if (flag && (!Objects.equals(deviation, paramSetting.getDeviation())
|
|
|
- || !Objects.equals(autoCallback, paramSetting.getAutoCallback())
|
|
|
- || !Objects.equals(majority, paramSetting.getMajority())
|
|
|
- || !Objects.equals(cumulativeError, paramSetting.getCumulativeError()))) {
|
|
|
- throw new RuntimeException("该评卷工作已有评卷数据,不能修改仲裁档位差、系统自动打回、是否过半定档参数");
|
|
|
- }
|
|
|
if (paramSetting == null) {
|
|
|
- paramSetting = ParamSetting.init();
|
|
|
+ paramSetting = ParamSetting.init(workId);
|
|
|
}
|
|
|
- paramSetting.setDeviation(deviation);
|
|
|
- paramSetting.setAutoCallback(autoCallback);
|
|
|
- paramSetting.setMajority(majority);
|
|
|
- paramSetting.setCumulativeError(cumulativeError);
|
|
|
- paramSetting.setLevelShowAllPaper(levelShowAllPaper);
|
|
|
- paramSetting.setPropDenominator(propDenominator);
|
|
|
- paramSetting.setClearData(clearData);
|
|
|
- paramSetting.setAutoCallbackShowDeviation(autoCallbackShowDeviation);
|
|
|
- paramSetting.setShowStandardPaperManage(showStandardPaperManage);
|
|
|
- paramSetting.setTakeBest(takeBest);
|
|
|
+
|
|
|
+ LevelConfig oldLevelConfig = JSON.parseObject(paramSetting.getLevelConfig(), LevelConfig.class);
|
|
|
+ if ((markSubjects == null || markSubjects.isEmpty()) && countMarkTasks > 0) {
|
|
|
+ if (!Objects.equals(deviation, oldLevelConfig.getDeviation())) {
|
|
|
+ throw new RuntimeException("该评卷工作已有评卷数据,不能修改【仲裁档位差】参数");
|
|
|
+ }
|
|
|
+ if (!Objects.equals(autoCallback, oldLevelConfig.getAutoCallback())) {
|
|
|
+ throw new RuntimeException("该评卷工作已有评卷数据,不能修【系统自动打回】参数");
|
|
|
+ }
|
|
|
+ if (!Objects.equals(majority, oldLevelConfig.getMajority())) {
|
|
|
+ throw new RuntimeException("该评卷工作已有评卷数据,不能修改【是否过半定档】参数");
|
|
|
+ }
|
|
|
+ if (!Objects.equals(coarseLevel, oldLevelConfig.getCoarseLevel())) {
|
|
|
+ throw new RuntimeException("该评卷工作已有评卷数据,不能修改【是否增加粗档位环节】参数");
|
|
|
+ }
|
|
|
+ if (!Objects.equals(removeHighAndLow, oldLevelConfig.getRemoveHighAndLow())) {
|
|
|
+ throw new RuntimeException("该评卷工作已有评卷数据,不能修改【是否开启去高去低再加权评卷】参数");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ oldLevelConfig.setDeviation(deviation);
|
|
|
+ oldLevelConfig.setAutoCallback(autoCallback);
|
|
|
+ oldLevelConfig.setMajority(majority);
|
|
|
+ oldLevelConfig.setTakeBest(takeBest);
|
|
|
+ oldLevelConfig.setLevelShowAllPaper(levelShowAllPaper);
|
|
|
+ oldLevelConfig.setPropDenominator(propDenominator);
|
|
|
+ oldLevelConfig.setShowStandardPaperManage(showStandardPaperManage);
|
|
|
+ oldLevelConfig.setClearData(clearData);
|
|
|
+ oldLevelConfig.setCoarseLevel(coarseLevel);
|
|
|
+ oldLevelConfig.setRemoveHighAndLow(removeHighAndLow);
|
|
|
+
|
|
|
+ paramSetting.setLevelConfig(JSON.toJSONString(oldLevelConfig));
|
|
|
paramSettingRepo.saveAndFlush(paramSetting);
|
|
|
- ParamCache.resetParam(paramSetting);
|
|
|
+ ParamCache.cacheParam(ParamSettingTypeEnum.LEVEL, workId, paramSetting.getLevelConfig());
|
|
|
|
|
|
return new ResponseEntity(HttpStatus.OK);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 打分改档参数
|
|
|
+ * 粗分档规则参数
|
|
|
*
|
|
|
- * @return
|
|
|
+ * @param data data
|
|
|
*/
|
|
|
- @RequestMapping(value = "/score", method = RequestMethod.POST)
|
|
|
- public ResponseEntity updateScoreParam(@RequestBody Map map) {
|
|
|
- Long workId = Long.valueOf(map.get("workId").toString());
|
|
|
- Integer roundUp = (Integer) map.get("roundUp");
|
|
|
- Integer changeStage = (Integer) map.get("changeStage");
|
|
|
- Integer scoreShowAllPaper = (Integer) map.get("scoreShowAllPaper");
|
|
|
+ @PostMapping("/coarse_level")
|
|
|
+ public ResponseEntity updateFirstLevelParam(@RequestBody String data) {
|
|
|
+ Long workId = ServletUtil.getWordId();
|
|
|
+ JSONObject object = JSON.parseObject(data);
|
|
|
+ Integer deviation = object.getInteger("deviation");
|
|
|
+ Integer autoCallback = object.getInteger("autoCallback");
|
|
|
+ Integer majority = object.getInteger("majority");
|
|
|
+ Integer takeBest = object.getInteger("takeBest");
|
|
|
+ Integer clearData = object.getInteger("clearData");
|
|
|
+ Integer levelShowAllPaper = object.getInteger("levelShowAllPaper");
|
|
|
+ Integer propDenominator = object.getInteger("propDenominator");
|
|
|
+ Integer showStandardPaperManage = object.getInteger("showStandardPaperManage");
|
|
|
+ Integer removeHighAndLow = object.getInteger("removeHighAndLow");
|
|
|
+
|
|
|
List<MarkSubject> markSubjects = markSubjectRepo.findByWorkIdAndTestNot(workId, TrialEnum.DEFAULT.ordinal());
|
|
|
+ // todo 需要改查询表 20220728
|
|
|
int countMarkTasks = markTaskRepo.countByWorkId(workId);
|
|
|
- boolean flag = false;
|
|
|
- if ((markSubjects == null || markSubjects.size() == 0) && countMarkTasks > 0) {
|
|
|
- flag = true;
|
|
|
+ //保存分档参数
|
|
|
+ ParamSetting paramSetting = paramSettingRepo.findByWorkId(workId);
|
|
|
+ if (paramSetting == null) {
|
|
|
+ paramSetting = ParamSetting.init(workId);
|
|
|
}
|
|
|
|
|
|
+ CoarseLevelConfig oldCoarseLevelConfig = JSON.parseObject(paramSetting.getCoarseLevelConfig(), CoarseLevelConfig.class);
|
|
|
+ if ((markSubjects == null || markSubjects.isEmpty()) && countMarkTasks > 0) {
|
|
|
+ if (!Objects.equals(deviation, oldCoarseLevelConfig.getDeviation())) {
|
|
|
+ throw new RuntimeException("该评卷工作已有评卷数据,不能修改【仲裁档位差】参数");
|
|
|
+ }
|
|
|
+ if (!Objects.equals(autoCallback, oldCoarseLevelConfig.getAutoCallback())) {
|
|
|
+ throw new RuntimeException("该评卷工作已有评卷数据,不能修【系统自动打回】参数");
|
|
|
+ }
|
|
|
+ if (!Objects.equals(majority, oldCoarseLevelConfig.getMajority())) {
|
|
|
+ throw new RuntimeException("该评卷工作已有评卷数据,不能修改【是否过半定档】参数");
|
|
|
+ }
|
|
|
+ if (!Objects.equals(removeHighAndLow, oldCoarseLevelConfig.getRemoveHighAndLow())) {
|
|
|
+ throw new RuntimeException("该评卷工作已有评卷数据,不能修改【是否开启去高去低再加权评卷】参数");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ oldCoarseLevelConfig.setDeviation(deviation);
|
|
|
+ oldCoarseLevelConfig.setAutoCallback(autoCallback);
|
|
|
+ oldCoarseLevelConfig.setMajority(majority);
|
|
|
+ oldCoarseLevelConfig.setTakeBest(takeBest);
|
|
|
+ oldCoarseLevelConfig.setLevelShowAllPaper(levelShowAllPaper);
|
|
|
+ oldCoarseLevelConfig.setPropDenominator(propDenominator);
|
|
|
+ oldCoarseLevelConfig.setShowStandardPaperManage(showStandardPaperManage);
|
|
|
+ oldCoarseLevelConfig.setClearData(clearData);
|
|
|
+ oldCoarseLevelConfig.setRemoveHighAndLow(removeHighAndLow);
|
|
|
+
|
|
|
+ paramSetting.setCoarseLevelConfig(JSON.toJSONString(oldCoarseLevelConfig));
|
|
|
+ paramSettingRepo.saveAndFlush(paramSetting);
|
|
|
+ ParamCache.cacheParam(ParamSettingTypeEnum.FIRST_LEVEL, workId, paramSetting.getCoarseLevelConfig());
|
|
|
+
|
|
|
+ return new ResponseEntity(HttpStatus.OK);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 打分改档参数
|
|
|
+ *
|
|
|
+ * @param data data
|
|
|
+ */
|
|
|
+ @PostMapping("/score")
|
|
|
+ public ResponseEntity updateScoreParam(@RequestBody String data) {
|
|
|
+ Long workId = ServletUtil.getWordId();
|
|
|
+ JSONObject object = JSON.parseObject(data);
|
|
|
+ Integer roundUp = object.getInteger("roundUp");
|
|
|
+ Integer changeStage = object.getInteger("changeStage");
|
|
|
+ Integer scoreShowAllPaper = object.getInteger("scoreShowAllPaper");
|
|
|
+ Integer removeHighAndLow = object.getInteger("removeHighAndLow");
|
|
|
+
|
|
|
//保存打分参数
|
|
|
ParamSetting paramSetting = paramSettingRepo.findByWorkId(workId);
|
|
|
- if (flag && (!Objects.equals(roundUp, paramSetting.getRoundUp()))) {
|
|
|
- throw new RuntimeException("该评卷工作已有评卷数据,不能修改分数处理方式参数");
|
|
|
- }
|
|
|
if (paramSetting == null) {
|
|
|
- paramSetting = ParamSetting.init();
|
|
|
+ paramSetting = ParamSetting.init(workId);
|
|
|
+ }
|
|
|
+
|
|
|
+ ScoreConfig oldScoreConfig = JSON.parseObject(paramSetting.getScoreConfig(), ScoreConfig.class);
|
|
|
+ List<MarkSubject> markSubjects = markSubjectRepo.findByWorkIdAndTestNot(workId, TrialEnum.DEFAULT.ordinal());
|
|
|
+ // todo 更新查询表 20220801
|
|
|
+ int countMarkTasks = markTaskRepo.countByWorkId(workId);
|
|
|
+ if ((markSubjects == null || markSubjects.isEmpty()) && countMarkTasks > 0) {
|
|
|
+ if (!Objects.equals(roundUp, oldScoreConfig.getRoundUp())) {
|
|
|
+ throw new RuntimeException("该评卷工作已有评卷数据,不能修改【分数处理方式】参数");
|
|
|
+ }
|
|
|
+ if (!Objects.equals(removeHighAndLow, oldScoreConfig.getRemoveHighAndLow())) {
|
|
|
+ throw new RuntimeException("该评卷工作已有评卷数据,不能修改【分数计算方式】参数");
|
|
|
+ }
|
|
|
}
|
|
|
- paramSetting.setRoundUp(roundUp);
|
|
|
- paramSetting.setChangeStage(changeStage);
|
|
|
- paramSetting.setScoreShowAllPaper(scoreShowAllPaper);
|
|
|
+
|
|
|
+ oldScoreConfig.setRoundUp(roundUp);
|
|
|
+ oldScoreConfig.setChangeStage(changeStage);
|
|
|
+ oldScoreConfig.setScoreShowAllPaper(scoreShowAllPaper);
|
|
|
+ oldScoreConfig.setRemoveHighAndLow(removeHighAndLow);
|
|
|
+
|
|
|
+ paramSetting.setScoreConfig(JSON.toJSONString(oldScoreConfig));
|
|
|
paramSettingRepo.saveAndFlush(paramSetting);
|
|
|
- ParamCache.resetParam(paramSetting);
|
|
|
+ ParamCache.cacheParam(ParamSettingTypeEnum.SCORE, workId, paramSetting.getScoreConfig());
|
|
|
|
|
|
return new ResponseEntity(HttpStatus.OK);
|
|
|
}
|