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 c7b35b3..f0661d7 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 @@ -198,6 +198,17 @@ return AjaxResult.success(iWgzQuestionSaveService.userSubmitATestPaper(req)); } + /** + * 【我的】【岗前培训】分数查询 + */ + @ApiOperation("【我的】【岗前培训】分数查询") + //@PreAuthorize("@ss.hasPermi('wgzApp:user:userScoreQuery')") + @PostMapping("/WgzUserScoreQuery") + public AjaxResult userScoreQuery() { + Long appUserId = SecurityUtils.getAppUserId(); + return AjaxResult.success(iWgzQuestionSaveService.userScoreQuery(appUserId)); + } + /** * 【我的】【请假】 历史请假列表 */ @@ -713,8 +724,9 @@ //@PreAuthorize("@ss.hasPermi('wgzApp:user:userAllRecruitment')") @GetMapping("/WgzAppUserAllRecruitment") public AjaxResult userAllRecruitment() { + Long appUserId = SecurityUtils.getAppUserId(); WgzAppUserAllRecruitmentRes res = new WgzAppUserAllRecruitmentRes(); - res.setList(iBgtProjectRecruitApplyService.userAllRecruitment()); + res.setList(iBgtProjectRecruitApplyService.userAllRecruitment(appUserId)); return AjaxResult.success(res); } 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 79c6001..fa95b71 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 @@ -92,7 +92,7 @@ public interface IBgtProjectRecruitApplyService extends IServicePlus userAllRecruitment(); + List userAllRecruitment(Long userId); /** * 根据用户唯一标识去查询当前进场的工地信息 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 9d3105d..f4d82a8 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,15 +213,13 @@ public class BgtProjectRecruitApplyServiceImpl extends ServicePlusImpl userAllRecruitment() { - //1、获取到所有项目 - Long appUserId = SecurityUtils.getAppUserId(); - List res = baseMapper.userAllRecruitment(appUserId); - //2、获取到当前人员所在的工地 + public List userAllRecruitment(Long userId) { + List res = baseMapper.userAllRecruitment(userId); + //2、获取到指定人员所在的工地 for (WgzAppUserAllRecruitmentTwo re : res) { LambdaQueryWrapper last = new LambdaQueryWrapper() .eq(BgtProjectRecruitApply::getRecruitId, re.getRecruitId()) - .eq(BgtProjectRecruitApply::getUserId, appUserId) + .eq(BgtProjectRecruitApply::getUserId, userId) .orderByDesc(BgtProjectRecruitApply::getId) .last("limit 1"); BgtProjectRecruitApply bgtProjectRecruitApply = baseMapper.selectOne(last); diff --git a/ruoyi-system/src/main/java/com/ruoyi/wgz/bo/res/WgzAppGetMessageListRes.java b/ruoyi-system/src/main/java/com/ruoyi/wgz/bo/res/WgzAppGetMessageListRes.java index d1b4f1d..e1f7fe3 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wgz/bo/res/WgzAppGetMessageListRes.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wgz/bo/res/WgzAppGetMessageListRes.java @@ -90,4 +90,7 @@ public class WgzAppGetMessageListRes implements Serializable { @ApiModelProperty("其它·请假·请假时间") private LocalDateTime qjLeaveTime; + + @ApiModelProperty("其它·请假·请假时间") + private String isOperation; } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wgz/bo/res/WgzAppSubmitATestPaperRes.java b/ruoyi-system/src/main/java/com/ruoyi/wgz/bo/res/WgzAppSubmitATestPaperRes.java index d75860d..eb196e5 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wgz/bo/res/WgzAppSubmitATestPaperRes.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wgz/bo/res/WgzAppSubmitATestPaperRes.java @@ -32,6 +32,6 @@ public class WgzAppSubmitATestPaperRes implements Serializable { @ApiModelProperty("答对题数") private Integer number; - @ApiModelProperty("试卷") - private String pdfStr; +// @ApiModelProperty("试卷") +// private String pdfStr; } 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 005518e..a6764de 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 @@ -26,4 +26,8 @@ public interface WgzQuestionSaveMapper extends BaseMapperPlus { "WHERE correct = 1 AND user_id = #{userId}") Map getSumScoreAndPassAndSign(@Param("userId") Long userId); + //查询指定用户所有答对的题目分数 + @Select("SELECT SUM(score) AS sumScore FROM wgz_question_save WHERE user_id = #{userId} AND correct = 1") + float getSumScore(@Param("userId") Long userId); + } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wgz/service/IWgzQuestionSaveService.java b/ruoyi-system/src/main/java/com/ruoyi/wgz/service/IWgzQuestionSaveService.java index 8de9671..11d9375 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wgz/service/IWgzQuestionSaveService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wgz/service/IWgzQuestionSaveService.java @@ -2,6 +2,7 @@ package com.ruoyi.wgz.service; 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.domain.WgzQuestionSave; import com.ruoyi.wgz.bo.WgzQuestionSaveQueryBo; import com.ruoyi.common.core.mybatisplus.core.IServicePlus; @@ -68,4 +69,9 @@ public interface IWgzQuestionSaveService extends IServicePlus { * 安全教育试卷提交保存 */ WgzAppSubmitATestPaperRes userSubmitATestPaper(@Validated @RequestBody WgzAppSubmitATestPaperReq req); + + /** + * 查詢指定用戶的试卷是否及格 + */ + WgzAppUserScoreQuery userScoreQuery(long userId); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wgz/service/impl/WgzLeaveServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wgz/service/impl/WgzLeaveServiceImpl.java index 3c6cd64..227d91a 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wgz/service/impl/WgzLeaveServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wgz/service/impl/WgzLeaveServiceImpl.java @@ -167,7 +167,7 @@ public class WgzLeaveServiceImpl extends ServicePlusImpl inner.in(WgzLeave::getStartTime, rqList).or().in(WgzLeave::getEndTime, rqList) ). - ne(WgzLeave::getAuditorType, "4") + notIn(WgzLeave::getAuditorType,"3","4") ); if (num > 0) { throw new RuntimeException("当前时间段已存在请假!"); 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 c644af3..b358059 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 @@ -24,6 +24,7 @@ import com.ruoyi.wgz.bo.res.WgzAppGetMessageListRes; import com.ruoyi.wgz.bo.res.WgzAppMessageTypeStatisticsRes; import com.ruoyi.wgz.bo.res.WgzAppRegistrationInformationRes; import com.ruoyi.wgz.bo.rests.WgzAppMessageTypeStatisticsTwo; +import com.ruoyi.wgz.bo.rests.WgzAppUserAllRecruitmentTwo; import com.ruoyi.wgz.domain.*; import com.ruoyi.wgz.service.IWgzLeaveService; import com.ruoyi.wgz.service.IWgzReissueacardService; @@ -150,11 +151,23 @@ public class WgzMessageServiceImpl extends ServicePlusImpl zgIds = new ArrayList<>(); + List wgzAppUserAllRecruitmentTwos = iBgtProjectRecruitApplyService.userAllRecruitment(appUserId); + for (WgzAppUserAllRecruitmentTwo zg : wgzAppUserAllRecruitmentTwos) { + zgIds.add(zg.getRecruitId()); + } + List zgUserIds = new ArrayList<>(); + List appByIdList = iBgtProjectRecruitService.list( + new LambdaQueryWrapper(). + in(BgtProjectRecruit::getId, zgIds) + ); + for (BgtProjectRecruit appById : appByIdList) { + zgUserIds.add(appById.getUserId()); + } - WgzAppMessageTypeStatisticsRes res = new WgzAppMessageTypeStatisticsRes(); + WgzAppMessageTypeStatisticsRes res = new WgzAppMessageTypeStatisticsRes(); Map mp = new HashMap<>(); //1、获取字典类型 List data = dictTypeService.selectDictDataByType("message_large_type"); @@ -167,16 +180,16 @@ public class WgzMessageServiceImpl extends ServicePlusImpl(). -// eq(WgzMessage::getSenderType, USERTYPE_BGT). -// eq(WgzMessage::getSenderId, appById.getUserId()). -// eq(WgzMessage::getRecipientType, USERTYPE_WGZ). -// eq(WgzMessage::getRecipientId, appUserId). -// eq(WgzMessage::getIsOperation, "1") -// ); -// mp.put("daiban",daiBanCount); + //2、单独获取待办中的消息 + Integer daiBanCount = baseMapper.selectCount( + new LambdaQueryWrapper(). + eq(WgzMessage::getSenderType, USERTYPE_BGT). + in(WgzMessage::getSenderId, zgUserIds). + eq(WgzMessage::getRecipientType, USERTYPE_WGZ). + eq(WgzMessage::getRecipientId, appUserId). + eq(WgzMessage::getIsOperation, "1") + ); + mp.put("3",daiBanCount); return res.setMp(mp); } @@ -189,7 +202,7 @@ public class WgzMessageServiceImpl extends ServicePlusImpl pe = baseMapper.pagingQueryTheMessageList(queryDTOPage, req); //2、循环小类型,然后去查询对应不同类的查询标题(主要针对0补卡、3请假) pe.getRecords().stream().forEach(res -> { @@ -216,10 +229,11 @@ public class WgzMessageServiceImpl extends ServicePlusImpl pe = baseMapper.pagingQueryTheMessageList(queryDTOPage, req); + return PageUtils.buildDataInfo(pe); } return PageUtils.buildDataInfo(baseMapper.userGetMessageList(queryDTOPage,req)); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wgz/service/impl/WgzPayCalculationServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wgz/service/impl/WgzPayCalculationServiceImpl.java index c8d059f..b048282 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wgz/service/impl/WgzPayCalculationServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wgz/service/impl/WgzPayCalculationServiceImpl.java @@ -178,6 +178,7 @@ public class WgzPayCalculationServiceImpl extends ServicePlusImpl wgzQuestionBanks = baseMapper.selectList(last); List wgzAppGetTestPaperThrees = new ArrayList<>(); - BeanUtils.copyProperties(wgzQuestionBanks, wgzAppGetTestPaperThrees); + for (WgzQuestionBank wai : wgzQuestionBanks) { + WgzAppGetTestPaperThree nei = new WgzAppGetTestPaperThree(); + BeanUtils.copyProperties(wai, nei); + wgzAppGetTestPaperThrees.add(nei); + } return wgzAppGetTestPaperThrees; } 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 5807a92..eb572d7 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 @@ -6,6 +6,7 @@ import com.ruoyi.common.utils.PageUtils; 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.domain.WgzQuestionBank; import com.ruoyi.wgz.domain.WgzQuestionsConfiguration; import com.ruoyi.wgz.service.IWgzQuestionBankService; @@ -22,6 +23,7 @@ import com.ruoyi.wgz.service.IWgzQuestionSaveService; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.StringUtils; +import java.text.DecimalFormat; import java.util.*; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicReference; @@ -184,4 +186,41 @@ public class WgzQuestionSaveServiceImpl extends ServicePlusImpl wra = new LambdaQueryWrapper() + .eq(WgzQuestionSave::getUserId, userId); + List savaList = baseMapper.selectList(wra); + if (savaList.isEmpty()) { + res.setIsPass("3"); + return res; + } + //2、查询用户答对的分数 + float sumScore = baseMapper.getSumScore(userId); + //3、计算上次分数是否及格 + String pass = savaList.get(0).getPass(); + if (pass != null && !pass.isEmpty()) { + String[] split = pass.split(","); + float fullMark = Float.parseFloat(split[1]); + float passingGrade = Float.parseFloat(split[0]); + // 100分 / 满分 * 答对的分数 = 当前分数 + double score = 100.00 / fullMark * sumScore; + // 使用 DecimalFormat 保证分数最多1位小数 + DecimalFormat df = new DecimalFormat("#.#"); + score = Double.parseDouble(df.format(score)); + // 当前分数 >= 及格线 = 及格 否则 不及格 + if (score >= passingGrade) { + res.setIsPass("1"); + } else { + res.setIsPass("2"); + } + res.setFullMark(fullMark); + res.setPassingScore(passingGrade); + } + res.setCurrentMinute(sumScore); + return res; + } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wgz/service/impl/WgzReissueacardServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wgz/service/impl/WgzReissueacardServiceImpl.java index 9cb9dc2..f7aef7b 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wgz/service/impl/WgzReissueacardServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wgz/service/impl/WgzReissueacardServiceImpl.java @@ -40,6 +40,7 @@ import org.springframework.transaction.annotation.Transactional; import java.time.LocalDate; import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; import java.util.*; import static com.ruoyi.common.constants.BgtMessageConstant.*; @@ -180,11 +181,13 @@ public class WgzReissueacardServiceImpl extends ServicePlusImpl mp = new HashMap<>(); mp.put("projectName", recruit.getRecruitName()); mp.put("userName", byId.getUsername()); - mp.put("data", String.valueOf(req.getNowTime())); + mp.put("data", req.getNowTime().format(formatter)); if (insert > 0) { WgzMessage wgzMessage = new WgzMessage(). setSenderType(USERTYPE_SYSTEM). diff --git a/ruoyi-system/src/main/resources/mapper/wgz/WgzMessageMapper.xml b/ruoyi-system/src/main/resources/mapper/wgz/WgzMessageMapper.xml index df0c61f..34d7ae2 100644 --- a/ruoyi-system/src/main/resources/mapper/wgz/WgzMessageMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/wgz/WgzMessageMapper.xml @@ -36,7 +36,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" a.read_status as readStatus, a.create_time as createTime, a.message_large_type as messageLargeType, - a.message_small_type as messageSmallType + a.message_small_type as messageSmallType, + a.is_operation as isOperation ,c.recruit_name as recruitName ,c.id as recruitId @@ -114,13 +115,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" a.read_status as readStatus, a.create_time as createTime, a.message_large_type as messageLargeType, - a.message_small_type as messageSmallType + a.message_small_type as messageSmallType, + a.is_operation as isOperation FROM wgz_message as a a.recipient_type = "1" AND a.recipient_id = #{req.recipientId} AND - a.message_large_type = '3' AND + + a.message_large_type = '2' AND + + + a.is_operation = '1' AND + a.message_small_type is null AND a.del_flag = "0"