From e7657de323541318a1e320bf0e9d8c71706d1526 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BD=97=E6=88=90?= <2847920761@qq.com> Date: Fri, 21 Mar 2025 17:08:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wgz/controller/WgzAppController.java | 2 +- .../mapper/BgtProjectRecruitApplyMapper.java | 9 ++- .../IBgtProjectRecruitApplyService.java | 2 +- .../BgtProjectRecruitApplyServiceImpl.java | 19 +++-- .../impl/BgtProjectRecruitServiceImpl.java | 12 ++-- .../common/service/impl/AsyncServiceImpl.java | 2 +- ...ppCancelRegistrationProjectDetailsTwo.java | 2 +- .../wgz/mapper/WgzQuestionSaveMapper.java | 4 +- .../service/impl/WgzMessageServiceImpl.java | 3 +- .../impl/WgzQuestionSaveServiceImpl.java | 71 +++++++++++++++---- .../bgt/BgtProjectRecruitApplyMapper.xml | 7 +- .../mapper/bgt/BgtProjectRecruitMapper.xml | 2 +- .../resources/mapper/wgz/WgzMessageMapper.xml | 4 +- 13 files changed, 97 insertions(+), 42 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wgz/controller/WgzAppController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wgz/controller/WgzAppController.java index 753b786..b490a5e 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wgz/controller/WgzAppController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wgz/controller/WgzAppController.java @@ -726,7 +726,7 @@ public AjaxResult userAllRecruitment() { Long appUserId = SecurityUtils.getAppUserId(); WgzAppUserAllRecruitmentRes res = new WgzAppUserAllRecruitmentRes(); - res.setList(iBgtProjectRecruitApplyService.userAllRecruitment(appUserId)); + res.setList(iBgtProjectRecruitApplyService.userAllRecruitment(appUserId,"1")); return AjaxResult.success(res); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/bgt/mapper/BgtProjectRecruitApplyMapper.java b/ruoyi-system/src/main/java/com/ruoyi/bgt/mapper/BgtProjectRecruitApplyMapper.java index ad7b934..8f04e93 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/bgt/mapper/BgtProjectRecruitApplyMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/bgt/mapper/BgtProjectRecruitApplyMapper.java @@ -45,6 +45,11 @@ public interface BgtProjectRecruitApplyMapper extends BaseMapperPlus taskUserList(@Param("page")Page queryDTOPage, @Param("dto") BgtProjectTaskUserDTO dto); - //获取指定用户的所有招工 - List userAllRecruitment(@Param("userId") Long userId); + /** + * 获取指定用户的所有招工 + * @param userId 用户id + * @param type 类型:1获取招工(查询入职、进场、离职) 2获取需待办的(查询同意、入职、进场、离职) + * @return + */ + List userAllRecruitment(@Param("userId") Long userId,@Param("type") String type); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/bgt/service/IBgtProjectRecruitApplyService.java b/ruoyi-system/src/main/java/com/ruoyi/bgt/service/IBgtProjectRecruitApplyService.java index caaac5b..993e770 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/bgt/service/IBgtProjectRecruitApplyService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/bgt/service/IBgtProjectRecruitApplyService.java @@ -91,7 +91,7 @@ public interface IBgtProjectRecruitApplyService extends IServicePlus userAllRecruitment(Long userId); + List userAllRecruitment(Long userId,String type); /** * 根据用户唯一标识去查询当前进场的工地信息 diff --git a/ruoyi-system/src/main/java/com/ruoyi/bgt/service/impl/BgtProjectRecruitApplyServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/bgt/service/impl/BgtProjectRecruitApplyServiceImpl.java index ebea762..524a61f 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/bgt/service/impl/BgtProjectRecruitApplyServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/bgt/service/impl/BgtProjectRecruitApplyServiceImpl.java @@ -213,8 +213,8 @@ public class BgtProjectRecruitApplyServiceImpl extends ServicePlusImpl userAllRecruitment(Long userId) { - List res = baseMapper.userAllRecruitment(userId); + public List userAllRecruitment(Long userId,String type) { + List res = baseMapper.userAllRecruitment(userId,type); //2、获取到指定人员所在的工地 for (WgzAppUserAllRecruitmentTwo re : res) { LambdaQueryWrapper last = new LambdaQueryWrapper() @@ -646,16 +646,16 @@ public class BgtProjectRecruitApplyServiceImpl extends ServicePlusImpl 0){ -// throw new RuntimeException("您已在其他工地!"); -// } + int count = ((Number) judMp.get("count")).intValue() + 1; + if (count == recruit.getRecruitStaffNum()){ + iAsyncService.updateRecruitStatus(recruit); + } //数据库行级锁(是否进入其他工地) Integer i = iWgzService.QueryWhetherTheCurrentUserHasAnOngoingProject(byUserId.getUserId()); if (i>0) { @@ -665,9 +665,6 @@ public class BgtProjectRecruitApplyServiceImpl extends ServicePlusImpl page = bgtProjectRecruitApplyService.recruitApplyList(userDTO); - int count = bgtProjectRecruitApplyService.count(Wrappers.lambdaQuery() - .eq(BgtProjectRecruitApply::getRecruitId, vo.getId()) - .in(BgtProjectRecruitApply::getStatus, RecruitApplyStatus.getFull())); - if(count == vo.getRecruitStaffNum()){ - vo.setStatus(RecruitStatus.FULL.getCode()); - } +// int count = bgtProjectRecruitApplyService.count(Wrappers.lambdaQuery() +// .eq(BgtProjectRecruitApply::getRecruitId, vo.getId()) +// .in(BgtProjectRecruitApply::getStatus, RecruitApplyStatus.getFull())); +// if(count == vo.getRecruitStaffNum()){ +// vo.setStatus(RecruitStatus.FULL.getCode()); +// } vo.setApplyList(page.getRows()); } return PageUtils.buildDataInfo(queryVOPage); diff --git a/ruoyi-system/src/main/java/com/ruoyi/common/service/impl/AsyncServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/common/service/impl/AsyncServiceImpl.java index d9999eb..516041f 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/common/service/impl/AsyncServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/common/service/impl/AsyncServiceImpl.java @@ -14,7 +14,7 @@ public class AsyncServiceImpl implements IAsyncService { private IBgtProjectRecruitService iBgtProjectRecruitService; @Override - @Async +// @Async public void updateRecruitStatus(BgtProjectRecruit recruit) { recruit.setStatus("2"); iBgtProjectRecruitService.updateById(recruit); diff --git a/ruoyi-system/src/main/java/com/ruoyi/wgz/bo/rests/WgzAppCancelRegistrationProjectDetailsTwo.java b/ruoyi-system/src/main/java/com/ruoyi/wgz/bo/rests/WgzAppCancelRegistrationProjectDetailsTwo.java index 6f96b42..33bac2f 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wgz/bo/rests/WgzAppCancelRegistrationProjectDetailsTwo.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wgz/bo/rests/WgzAppCancelRegistrationProjectDetailsTwo.java @@ -28,7 +28,7 @@ public class WgzAppCancelRegistrationProjectDetailsTwo implements Serializable { private String username; @ApiModelProperty("务工者头像") - private String avatar_name; + private String avatarName; @ApiModelProperty("务工者评分") private Double score; diff --git a/ruoyi-system/src/main/java/com/ruoyi/wgz/mapper/WgzQuestionSaveMapper.java b/ruoyi-system/src/main/java/com/ruoyi/wgz/mapper/WgzQuestionSaveMapper.java index a6764de..1a9a2ca 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wgz/mapper/WgzQuestionSaveMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wgz/mapper/WgzQuestionSaveMapper.java @@ -20,8 +20,8 @@ import java.util.Map; public interface WgzQuestionSaveMapper extends BaseMapperPlus { @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 getSumScoreAndPassAndSign(@Param("userId") Long userId); diff --git a/ruoyi-system/src/main/java/com/ruoyi/wgz/service/impl/WgzMessageServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wgz/service/impl/WgzMessageServiceImpl.java index a67737f..d431721 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wgz/service/impl/WgzMessageServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wgz/service/impl/WgzMessageServiceImpl.java @@ -154,7 +154,7 @@ public class WgzMessageServiceImpl extends ServicePlusImpl zgIds = new ArrayList<>(); - List wgzAppUserAllRecruitmentTwos = iBgtProjectRecruitApplyService.userAllRecruitment(appUserId); + List wgzAppUserAllRecruitmentTwos = iBgtProjectRecruitApplyService.userAllRecruitment(appUserId,"2"); for (WgzAppUserAllRecruitmentTwo zg : wgzAppUserAllRecruitmentTwos) { zgIds.add(zg.getRecruitId()); } @@ -237,6 +237,7 @@ public class WgzMessageServiceImpl extends ServicePlusImpl pe = baseMapper.pagingQueryTheMessageList(queryDTOPage, req); return PageUtils.buildDataInfo(pe); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wgz/service/impl/WgzQuestionSaveServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wgz/service/impl/WgzQuestionSaveServiceImpl.java index eb572d7..a0bcaf7 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wgz/service/impl/WgzQuestionSaveServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wgz/service/impl/WgzQuestionSaveServiceImpl.java @@ -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 bqs = new ArrayList<>(); - AtomicReference 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 list = req.getList(); + for (WgzAppSubmitATestPaperTwo data : list) { String correct = ""; String pass = ""; // 获取题库的正确答案,然后和用户的答案作对比 @@ -141,8 +143,8 @@ public class WgzQuestionSaveServiceImpl extends ServicePlusImpl v + data.getScore()); - number.incrementAndGet(); + fenshu = fenshu+data.getScore(); + number = number+1; } else { correct = "2"; } @@ -156,27 +158,72 @@ public class WgzQuestionSaveServiceImpl extends ServicePlusImpl 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().eq(WgzQuestionSave::getUserId, req.getUserId())); if (deleteResult >0){ diff --git a/ruoyi-system/src/main/resources/mapper/bgt/BgtProjectRecruitApplyMapper.xml b/ruoyi-system/src/main/resources/mapper/bgt/BgtProjectRecruitApplyMapper.xml index 8174783..244d0e1 100644 --- a/ruoyi-system/src/main/resources/mapper/bgt/BgtProjectRecruitApplyMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/bgt/BgtProjectRecruitApplyMapper.xml @@ -262,7 +262,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" LEFT JOIN bgt_project_recruit as b on(b.id = a.recruit_id) WHERE a.user_id = #{userId} - and (a.status = "3" or a.status = "5" or a.status = "6") + + and a.status in ("3","5","6") + + + and a.status in ("1","3","5","6") + and a.del_flag = "0" GROUP BY a.recruit_id diff --git a/ruoyi-system/src/main/resources/mapper/bgt/BgtProjectRecruitMapper.xml b/ruoyi-system/src/main/resources/mapper/bgt/BgtProjectRecruitMapper.xml index d02fc50..d0a33c2 100644 --- a/ruoyi-system/src/main/resources/mapper/bgt/BgtProjectRecruitMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/bgt/BgtProjectRecruitMapper.xml @@ -85,7 +85,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" a.user_id, a.status, b.username, - b.avatar_name, + b.avatar_name as avatarName, b.score FROM bgt_project_recruit_apply as a diff --git a/ruoyi-system/src/main/resources/mapper/wgz/WgzMessageMapper.xml b/ruoyi-system/src/main/resources/mapper/wgz/WgzMessageMapper.xml index cd77875..93db7b9 100644 --- a/ruoyi-system/src/main/resources/mapper/wgz/WgzMessageMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/wgz/WgzMessageMapper.xml @@ -125,10 +125,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" a.recipient_type = "1" AND a.recipient_id = #{req.recipientId} AND - + a.message_large_type = '2' AND - + a.is_operation = '1' AND