This commit is contained in:
2025-03-21 17:08:03 +08:00
parent da2b45f344
commit e7657de323
13 changed files with 97 additions and 42 deletions

View File

@ -28,7 +28,7 @@ public class WgzAppCancelRegistrationProjectDetailsTwo implements Serializable {
private String username;
@ApiModelProperty("务工者头像")
private String avatar_name;
private String avatarName;
@ApiModelProperty("务工者评分")
private Double score;

View File

@ -20,8 +20,8 @@ import java.util.Map;
public interface WgzQuestionSaveMapper extends BaseMapperPlus<WgzQuestionSave> {
@Select("SELECT SUM(score) AS sumScore, " +
"(SELECT pass FROM bus_question_save WHERE user_id = #{userId} AND del_flag = '0' ORDER BY id ASC LIMIT 1) AS pass, " +
"(SELECT sign FROM bus_question_save WHERE user_id = #{userId} AND del_flag = '0' ORDER BY id ASC LIMIT 1) AS sign " +
"(SELECT pass FROM wgz_question_save WHERE user_id = #{userId} AND del_flag = '0' ORDER BY id ASC LIMIT 1) AS pass, " +
"(SELECT sign FROM wgz_question_save WHERE user_id = #{userId} AND del_flag = '0' ORDER BY id ASC LIMIT 1) AS sign " +
"FROM wgz_question_save " +
"WHERE correct = 1 AND user_id = #{userId}")
Map<String, Object> getSumScoreAndPassAndSign(@Param("userId") Long userId);

View File

@ -154,7 +154,7 @@ public class WgzMessageServiceImpl extends ServicePlusImpl<WgzMessageMapper, Wgz
//1、获取当前人并获取到当前用户的所有项目
Long appUserId = SecurityUtils.getAppUserId();
List<Long> zgIds = new ArrayList<>();
List<WgzAppUserAllRecruitmentTwo> wgzAppUserAllRecruitmentTwos = iBgtProjectRecruitApplyService.userAllRecruitment(appUserId);
List<WgzAppUserAllRecruitmentTwo> wgzAppUserAllRecruitmentTwos = iBgtProjectRecruitApplyService.userAllRecruitment(appUserId,"2");
for (WgzAppUserAllRecruitmentTwo zg : wgzAppUserAllRecruitmentTwos) {
zgIds.add(zg.getRecruitId());
}
@ -237,6 +237,7 @@ public class WgzMessageServiceImpl extends ServicePlusImpl<WgzMessageMapper, Wgz
//0、待办的查询(查出指定用戶所有的待办)
String largeType = req.getLargeType();
if (largeType!=null && largeType.equals("3")){
System.out.println("?????????? "+req.getLargeType());
Page<WgzAppGetMessageListRes> pe = baseMapper.pagingQueryTheMessageList(queryDTOPage, req);
return PageUtils.buildDataInfo(pe);
}

View File

@ -7,6 +7,7 @@ import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.wgz.bo.req.WgzAppSubmitATestPaperReq;
import com.ruoyi.wgz.bo.res.WgzAppSubmitATestPaperRes;
import com.ruoyi.wgz.bo.res.WgzAppUserScoreQuery;
import com.ruoyi.wgz.bo.rests.WgzAppSubmitATestPaperTwo;
import com.ruoyi.wgz.domain.WgzQuestionBank;
import com.ruoyi.wgz.domain.WgzQuestionsConfiguration;
import com.ruoyi.wgz.service.IWgzQuestionBankService;
@ -125,10 +126,11 @@ public class WgzQuestionSaveServiceImpl extends ServicePlusImpl<WgzQuestionSaveM
WgzQuestionsConfiguration configuration = iWgzQuestionsConfigurationService.appQueryLimitOne();
//3、计算这次用户提交的试卷信息所得到的分数
List<WgzQuestionSave> bqs = new ArrayList<>();
AtomicReference<Double> fenshu = new AtomicReference<>(0.0);
AtomicInteger number = new AtomicInteger(0);
AtomicInteger index = new AtomicInteger(0);
req.getList().forEach(data -> {
Double fenshu = 0.0;
Integer number = 0;
Integer index = 0;
List<WgzAppSubmitATestPaperTwo> list = req.getList();
for (WgzAppSubmitATestPaperTwo data : list) {
String correct = "";
String pass = "";
// 获取题库的正确答案,然后和用户的答案作对比
@ -141,8 +143,8 @@ public class WgzQuestionSaveServiceImpl extends ServicePlusImpl<WgzQuestionSaveM
}
if (bqb.getCorrectAnswer().toLowerCase().contains(data.getAnswer().toLowerCase())) {
correct = "1";
fenshu.updateAndGet(v -> v + data.getScore());
number.incrementAndGet();
fenshu = fenshu+data.getScore();
number = number+1;
} else {
correct = "2";
}
@ -156,27 +158,72 @@ public class WgzQuestionSaveServiceImpl extends ServicePlusImpl<WgzQuestionSaveM
bqsTwo.setCorrect(correct);
bqsTwo.setScore(data.getScore());
//这几条数据只在每张试卷的第一条数据中存储(重复的没必要每条都存储)
if (index.get() == 0) {
if (index == 0) {
bqsTwo.setTakeTime(req.getTakeTime());
bqsTwo.setTimeOut(configuration.getAnswerTime());
bqsTwo.setPass(pass);
}
bqs.add(bqsTwo);
index.incrementAndGet();
});
index = index+1;
}
// AtomicReference<Double> fenshu = new AtomicReference<>(0.0);
// AtomicInteger number = new AtomicInteger(0);
// AtomicInteger index = new AtomicInteger(0);
// req.getList().forEach(data -> {
// String correct = "";
// String pass = "";
// // 获取题库的正确答案,然后和用户的答案作对比
// WgzQuestionBank bqb = iWgzQuestionBankService.selectById(data.getBankId());
// if (bqb == null) {
// throw new RuntimeException("您的试卷被外星人卷走了!");
// } else {
// if (StringUtils.isEmpty(data.getAnswer())) {
// throw new RuntimeException("您还有题未答完!");
// }
// if (bqb.getCorrectAnswer().toLowerCase().contains(data.getAnswer().toLowerCase())) {
// correct = "1";
// fenshu.updateAndGet(v -> v + data.getScore());
// number.incrementAndGet();
// } else {
// correct = "2";
// }
// }
// // 记录这次的及格线和总分
// pass = configuration.getPassingScore().toString() + "," + configuration.getFullMark().toString();
// WgzQuestionSave bqsTwo = new WgzQuestionSave();
// bqsTwo.setUserId(req.getUserId());
// bqsTwo.setBankId(data.getBankId());
// bqsTwo.setAnswer(data.getAnswer());
// bqsTwo.setCorrect(correct);
// bqsTwo.setScore(data.getScore());
// //这几条数据只在每张试卷的第一条数据中存储(重复的没必要每条都存储)
// if (index.get() == 0) {
// bqsTwo.setTakeTime(req.getTakeTime());
// bqsTwo.setTimeOut(configuration.getAnswerTime());
// bqsTwo.setPass(pass);
// }
// bqs.add(bqsTwo);
// index.incrementAndGet();
// });
Double fullMark = configuration.getFullMark();
scoreTwo = 100.00 / fullMark * fenshu.get();
scoreTwo = 100.00 / fullMark * fenshu;
WgzAppSubmitATestPaperRes res = new WgzAppSubmitATestPaperRes();
res.setAnswerTime(configuration.getAnswerTime());
res.setTakeTime(req.getTakeTime());
res.setFullMark(fullMark);
res.setPassingScore(configuration.getPassingScore());
res.setScore(fenshu.get());
res.setNumber(number.get());
res.setScore(fenshu);
res.setNumber(number);
//4、两次卷子的分数对比,第一次的分数比第二次大那么第二次只返回结果;第二次的分数比第一次大那么删除第一次的数据再重新插入
if (scoreOne > scoreTwo) {
return res;
} else {
if (scoreOne == 0){
// 插入新数据
super.saveBatch(bqs);
return res;
}
// 先查询当前用户是否有答题,有就把之前的删除(真删)
int deleteResult = baseMapper.delete(new LambdaQueryWrapper<WgzQuestionSave>().eq(WgzQuestionSave::getUserId, req.getUserId()));
if (deleteResult >0){