完成消息待办和补充安全教育接口

This commit is contained in:
2025-03-21 14:02:44 +08:00
parent fb1cdf731c
commit ab7e0a15ab
14 changed files with 126 additions and 35 deletions

View File

@ -198,6 +198,17 @@
return AjaxResult.success(iWgzQuestionSaveService.userSubmitATestPaper(req)); return AjaxResult.success(iWgzQuestionSaveService.userSubmitATestPaper(req));
} }
/**
* 【我的】【岗前培训】分数查询
*/
@ApiOperation("【我的】【岗前培训】分数查询")
//@PreAuthorize("@ss.hasPermi('wgzApp:user:userScoreQuery')")
@PostMapping("/WgzUserScoreQuery")
public AjaxResult<WgzAppUserScoreQuery> userScoreQuery() {
Long appUserId = SecurityUtils.getAppUserId();
return AjaxResult.success(iWgzQuestionSaveService.userScoreQuery(appUserId));
}
/** /**
* 【我的】【请假】 历史请假列表 * 【我的】【请假】 历史请假列表
*/ */
@ -713,8 +724,9 @@
//@PreAuthorize("@ss.hasPermi('wgzApp:user:userAllRecruitment')") //@PreAuthorize("@ss.hasPermi('wgzApp:user:userAllRecruitment')")
@GetMapping("/WgzAppUserAllRecruitment") @GetMapping("/WgzAppUserAllRecruitment")
public AjaxResult<WgzAppUserAllRecruitmentRes> userAllRecruitment() { public AjaxResult<WgzAppUserAllRecruitmentRes> userAllRecruitment() {
Long appUserId = SecurityUtils.getAppUserId();
WgzAppUserAllRecruitmentRes res = new WgzAppUserAllRecruitmentRes(); WgzAppUserAllRecruitmentRes res = new WgzAppUserAllRecruitmentRes();
res.setList(iBgtProjectRecruitApplyService.userAllRecruitment()); res.setList(iBgtProjectRecruitApplyService.userAllRecruitment(appUserId));
return AjaxResult.success(res); return AjaxResult.success(res);
} }

View File

@ -92,7 +92,7 @@ public interface IBgtProjectRecruitApplyService extends IServicePlus<BgtProjectR
/** /**
* 获取当前用户的所有招工 * 获取当前用户的所有招工
*/ */
List<WgzAppUserAllRecruitmentTwo> userAllRecruitment(); List<WgzAppUserAllRecruitmentTwo> userAllRecruitment(Long userId);
/** /**
* 根据用户唯一标识去查询当前进场的工地信息 * 根据用户唯一标识去查询当前进场的工地信息

View File

@ -213,15 +213,13 @@ public class BgtProjectRecruitApplyServiceImpl extends ServicePlusImpl<BgtProjec
} }
@Override @Override
public List<WgzAppUserAllRecruitmentTwo> userAllRecruitment() { public List<WgzAppUserAllRecruitmentTwo> userAllRecruitment(Long userId) {
//1、获取到所有项目 List<WgzAppUserAllRecruitmentTwo> res = baseMapper.userAllRecruitment(userId);
Long appUserId = SecurityUtils.getAppUserId(); //2、获取到指定人员所在的工地
List<WgzAppUserAllRecruitmentTwo> res = baseMapper.userAllRecruitment(appUserId);
//2、获取到当前人员所在的工地
for (WgzAppUserAllRecruitmentTwo re : res) { for (WgzAppUserAllRecruitmentTwo re : res) {
LambdaQueryWrapper<BgtProjectRecruitApply> last = new LambdaQueryWrapper<BgtProjectRecruitApply>() LambdaQueryWrapper<BgtProjectRecruitApply> last = new LambdaQueryWrapper<BgtProjectRecruitApply>()
.eq(BgtProjectRecruitApply::getRecruitId, re.getRecruitId()) .eq(BgtProjectRecruitApply::getRecruitId, re.getRecruitId())
.eq(BgtProjectRecruitApply::getUserId, appUserId) .eq(BgtProjectRecruitApply::getUserId, userId)
.orderByDesc(BgtProjectRecruitApply::getId) .orderByDesc(BgtProjectRecruitApply::getId)
.last("limit 1"); .last("limit 1");
BgtProjectRecruitApply bgtProjectRecruitApply = baseMapper.selectOne(last); BgtProjectRecruitApply bgtProjectRecruitApply = baseMapper.selectOne(last);

View File

@ -90,4 +90,7 @@ public class WgzAppGetMessageListRes implements Serializable {
@ApiModelProperty("其它·请假·请假时间") @ApiModelProperty("其它·请假·请假时间")
private LocalDateTime qjLeaveTime; private LocalDateTime qjLeaveTime;
@ApiModelProperty("其它·请假·请假时间")
private String isOperation;
} }

View File

@ -32,6 +32,6 @@ public class WgzAppSubmitATestPaperRes implements Serializable {
@ApiModelProperty("答对题数") @ApiModelProperty("答对题数")
private Integer number; private Integer number;
@ApiModelProperty("试卷") // @ApiModelProperty("试卷")
private String pdfStr; // private String pdfStr;
} }

View File

@ -26,4 +26,8 @@ public interface WgzQuestionSaveMapper extends BaseMapperPlus<WgzQuestionSave> {
"WHERE correct = 1 AND user_id = #{userId}") "WHERE correct = 1 AND user_id = #{userId}")
Map<String, Object> getSumScoreAndPassAndSign(@Param("userId") Long userId); Map<String, Object> 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);
} }

View File

@ -2,6 +2,7 @@ package com.ruoyi.wgz.service;
import com.ruoyi.wgz.bo.req.WgzAppSubmitATestPaperReq; import com.ruoyi.wgz.bo.req.WgzAppSubmitATestPaperReq;
import com.ruoyi.wgz.bo.res.WgzAppSubmitATestPaperRes; import com.ruoyi.wgz.bo.res.WgzAppSubmitATestPaperRes;
import com.ruoyi.wgz.bo.res.WgzAppUserScoreQuery;
import com.ruoyi.wgz.domain.WgzQuestionSave; import com.ruoyi.wgz.domain.WgzQuestionSave;
import com.ruoyi.wgz.bo.WgzQuestionSaveQueryBo; import com.ruoyi.wgz.bo.WgzQuestionSaveQueryBo;
import com.ruoyi.common.core.mybatisplus.core.IServicePlus; import com.ruoyi.common.core.mybatisplus.core.IServicePlus;
@ -68,4 +69,9 @@ public interface IWgzQuestionSaveService extends IServicePlus<WgzQuestionSave> {
* 安全教育试卷提交保存 * 安全教育试卷提交保存
*/ */
WgzAppSubmitATestPaperRes userSubmitATestPaper(@Validated @RequestBody WgzAppSubmitATestPaperReq req); WgzAppSubmitATestPaperRes userSubmitATestPaper(@Validated @RequestBody WgzAppSubmitATestPaperReq req);
/**
* 查詢指定用戶的试卷是否及格
*/
WgzAppUserScoreQuery userScoreQuery(long userId);
} }

View File

@ -167,7 +167,7 @@ public class WgzLeaveServiceImpl extends ServicePlusImpl<WgzLeaveMapper, WgzLeav
and( and(
inner -> inner.in(WgzLeave::getStartTime, rqList).or().in(WgzLeave::getEndTime, rqList) inner -> inner.in(WgzLeave::getStartTime, rqList).or().in(WgzLeave::getEndTime, rqList)
). ).
ne(WgzLeave::getAuditorType, "4") notIn(WgzLeave::getAuditorType,"3","4")
); );
if (num > 0) { if (num > 0) {
throw new RuntimeException("当前时间段已存在请假!"); throw new RuntimeException("当前时间段已存在请假!");

View File

@ -24,6 +24,7 @@ import com.ruoyi.wgz.bo.res.WgzAppGetMessageListRes;
import com.ruoyi.wgz.bo.res.WgzAppMessageTypeStatisticsRes; import com.ruoyi.wgz.bo.res.WgzAppMessageTypeStatisticsRes;
import com.ruoyi.wgz.bo.res.WgzAppRegistrationInformationRes; import com.ruoyi.wgz.bo.res.WgzAppRegistrationInformationRes;
import com.ruoyi.wgz.bo.rests.WgzAppMessageTypeStatisticsTwo; import com.ruoyi.wgz.bo.rests.WgzAppMessageTypeStatisticsTwo;
import com.ruoyi.wgz.bo.rests.WgzAppUserAllRecruitmentTwo;
import com.ruoyi.wgz.domain.*; import com.ruoyi.wgz.domain.*;
import com.ruoyi.wgz.service.IWgzLeaveService; import com.ruoyi.wgz.service.IWgzLeaveService;
import com.ruoyi.wgz.service.IWgzReissueacardService; import com.ruoyi.wgz.service.IWgzReissueacardService;
@ -150,11 +151,23 @@ public class WgzMessageServiceImpl extends ServicePlusImpl<WgzMessageMapper, Wgz
@Override @Override
public WgzAppMessageTypeStatisticsRes userMessageTypeStatistics(Long id) { public WgzAppMessageTypeStatisticsRes userMessageTypeStatistics(Long id) {
// Long appUserId = SecurityUtils.getAppUserId(); //1、获取当前人并获取到当前用户的所有项目
// BgtProjectRecruitApply by = iBgtProjectRecruitApplyService.selectByUserIdProjectRecruitApplyId(appUserId); Long appUserId = SecurityUtils.getAppUserId();
// BgtProjectRecruit appById = iBgtProjectRecruitService.getAppById(by.getRecruitId()); List<Long> zgIds = new ArrayList<>();
List<WgzAppUserAllRecruitmentTwo> wgzAppUserAllRecruitmentTwos = iBgtProjectRecruitApplyService.userAllRecruitment(appUserId);
for (WgzAppUserAllRecruitmentTwo zg : wgzAppUserAllRecruitmentTwos) {
zgIds.add(zg.getRecruitId());
}
List<Long> zgUserIds = new ArrayList<>();
List<BgtProjectRecruit> appByIdList = iBgtProjectRecruitService.list(
new LambdaQueryWrapper<BgtProjectRecruit>().
in(BgtProjectRecruit::getId, zgIds)
);
for (BgtProjectRecruit appById : appByIdList) {
zgUserIds.add(appById.getUserId());
}
WgzAppMessageTypeStatisticsRes res = new WgzAppMessageTypeStatisticsRes(); WgzAppMessageTypeStatisticsRes res = new WgzAppMessageTypeStatisticsRes();
Map<String, Integer> mp = new HashMap<>(); Map<String, Integer> mp = new HashMap<>();
//1、获取字典类型 //1、获取字典类型
List<SysDictData> data = dictTypeService.selectDictDataByType("message_large_type"); List<SysDictData> data = dictTypeService.selectDictDataByType("message_large_type");
@ -167,16 +180,16 @@ public class WgzMessageServiceImpl extends ServicePlusImpl<WgzMessageMapper, Wgz
eq(WgzMessage::getMessageLargeType, datum.getDictValue()); eq(WgzMessage::getMessageLargeType, datum.getDictValue());
mp.put(datum.getDictValue(),baseMapper.selectCount(wp)); mp.put(datum.getDictValue(),baseMapper.selectCount(wp));
} }
// //2、单独获取待办中的消息 //2、单独获取待办中的消息
// Integer daiBanCount = baseMapper.selectCount( Integer daiBanCount = baseMapper.selectCount(
// new LambdaQueryWrapper<WgzMessage>(). new LambdaQueryWrapper<WgzMessage>().
// eq(WgzMessage::getSenderType, USERTYPE_BGT). eq(WgzMessage::getSenderType, USERTYPE_BGT).
// eq(WgzMessage::getSenderId, appById.getUserId()). in(WgzMessage::getSenderId, zgUserIds).
// eq(WgzMessage::getRecipientType, USERTYPE_WGZ). eq(WgzMessage::getRecipientType, USERTYPE_WGZ).
// eq(WgzMessage::getRecipientId, appUserId). eq(WgzMessage::getRecipientId, appUserId).
// eq(WgzMessage::getIsOperation, "1") eq(WgzMessage::getIsOperation, "1")
// ); );
// mp.put("daiban",daiBanCount); mp.put("3",daiBanCount);
return res.setMp(mp); return res.setMp(mp);
} }
@ -189,7 +202,7 @@ public class WgzMessageServiceImpl extends ServicePlusImpl<WgzMessageMapper, Wgz
queryDTOPage.setCurrent(req.getPageNum()); queryDTOPage.setCurrent(req.getPageNum());
queryDTOPage.setSize(req.getPageSize()); queryDTOPage.setSize(req.getPageSize());
//1、分页查询出所有的小类型然后循环查询小类型对应标题数据 //1、分页查询出所有的小类型然后循环查询小类型对应标题数据
if(req.getLargeType() !=null && req.getLargeType().equals("3") && req.getSmallType()==null){ if(req.getLargeType() !=null && req.getLargeType().equals("2") && req.getSmallType()==null){
Page<WgzAppGetMessageListRes> pe = baseMapper.pagingQueryTheMessageList(queryDTOPage, req); Page<WgzAppGetMessageListRes> pe = baseMapper.pagingQueryTheMessageList(queryDTOPage, req);
//2、循环小类型,然后去查询对应不同类的查询标题主要针对0补卡、3请假 //2、循环小类型,然后去查询对应不同类的查询标题主要针对0补卡、3请假
pe.getRecords().stream().forEach(res -> { pe.getRecords().stream().forEach(res -> {
@ -216,10 +229,11 @@ public class WgzMessageServiceImpl extends ServicePlusImpl<WgzMessageMapper, Wgz
} }
//2、走正常的全部+大类型+具体的小类型 //2、走正常的全部+大类型+具体的小类型
else{ else{
//0、待办的查询 //0、待办的查询(查出指定用戶所有的待办)
String largeType = req.getLargeType(); String largeType = req.getLargeType();
if (largeType!=null && largeType.equals("daiban")){ if (largeType!=null && largeType.equals("3")){
throw new RuntimeException("待办的查询暂未开发"); Page<WgzAppGetMessageListRes> pe = baseMapper.pagingQueryTheMessageList(queryDTOPage, req);
return PageUtils.buildDataInfo(pe);
} }
return PageUtils.buildDataInfo(baseMapper.userGetMessageList(queryDTOPage,req)); return PageUtils.buildDataInfo(baseMapper.userGetMessageList(queryDTOPage,req));
} }

View File

@ -178,6 +178,7 @@ public class WgzPayCalculationServiceImpl extends ServicePlusImpl<WgzPayCalculat
public Boolean userApplyForPayrollSettlementAdd(WgzApplyForPayrollSettlementAddReq req) { public Boolean userApplyForPayrollSettlementAdd(WgzApplyForPayrollSettlementAddReq req) {
//1、获取当前人 //1、获取当前人
SysUser user = SecurityUtils.getLoginUser().getUser(); SysUser user = SecurityUtils.getLoginUser().getUser();
WgzUser byUserId = wgzUserService.findByUserId(user.getUserId());
BgtProjectRecruitApply recruitApply = iBgtProjectRecruitApplyService.selectByUserIdProjectRecruitApplyId(user.getUserId()); BgtProjectRecruitApply recruitApply = iBgtProjectRecruitApplyService.selectByUserIdProjectRecruitApplyId(user.getUserId());
BgtProjectRecruit recruit = iBgtProjectRecruitService.getAppById(recruitApply.getRecruitId()); BgtProjectRecruit recruit = iBgtProjectRecruitService.getAppById(recruitApply.getRecruitId());
//2、查看当前申请结算的天数是否大于剩余天数 //2、查看当前申请结算的天数是否大于剩余天数
@ -213,7 +214,7 @@ public class WgzPayCalculationServiceImpl extends ServicePlusImpl<WgzPayCalculat
BeanUtils.copyProperties(req,wgzPayCalculation); BeanUtils.copyProperties(req,wgzPayCalculation);
wgzPayCalculation. wgzPayCalculation.
setUserId(user.getUserId()). setUserId(user.getUserId()).
setUserName(user.getUserName()). setUserName(byUserId.getUsername()).
setAuditorUserId(recruit.getUserId()); setAuditorUserId(recruit.getUserId());
boolean save = save(wgzPayCalculation); boolean save = save(wgzPayCalculation);
if (!save) { if (!save) {

View File

@ -97,7 +97,11 @@ public class WgzQuestionBankServiceImpl extends ServicePlusImpl<WgzQuestionBankM
last("order by rand() limit " + num); last("order by rand() limit " + num);
List<WgzQuestionBank> wgzQuestionBanks = baseMapper.selectList(last); List<WgzQuestionBank> wgzQuestionBanks = baseMapper.selectList(last);
List<WgzAppGetTestPaperThree> wgzAppGetTestPaperThrees = new ArrayList<>(); List<WgzAppGetTestPaperThree> wgzAppGetTestPaperThrees = new ArrayList<>();
BeanUtils.copyProperties(wgzQuestionBanks, wgzAppGetTestPaperThrees); for (WgzQuestionBank wai : wgzQuestionBanks) {
WgzAppGetTestPaperThree nei = new WgzAppGetTestPaperThree();
BeanUtils.copyProperties(wai, nei);
wgzAppGetTestPaperThrees.add(nei);
}
return wgzAppGetTestPaperThrees; return wgzAppGetTestPaperThrees;
} }

View File

@ -6,6 +6,7 @@ import com.ruoyi.common.utils.PageUtils;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.wgz.bo.req.WgzAppSubmitATestPaperReq; import com.ruoyi.wgz.bo.req.WgzAppSubmitATestPaperReq;
import com.ruoyi.wgz.bo.res.WgzAppSubmitATestPaperRes; 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.WgzQuestionBank;
import com.ruoyi.wgz.domain.WgzQuestionsConfiguration; import com.ruoyi.wgz.domain.WgzQuestionsConfiguration;
import com.ruoyi.wgz.service.IWgzQuestionBankService; 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.transaction.annotation.Transactional;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import java.text.DecimalFormat;
import java.util.*; import java.util.*;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.atomic.AtomicReference;
@ -184,4 +186,41 @@ public class WgzQuestionSaveServiceImpl extends ServicePlusImpl<WgzQuestionSaveM
} }
return res; return res;
} }
@Override
public WgzAppUserScoreQuery userScoreQuery(long userId) {
WgzAppUserScoreQuery res = new WgzAppUserScoreQuery();
//1、查询及格分和满分,为空表示暂无记录
LambdaQueryWrapper<WgzQuestionSave> wra = new LambdaQueryWrapper<WgzQuestionSave>()
.eq(WgzQuestionSave::getUserId, userId);
List<WgzQuestionSave> 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;
}
} }

View File

@ -40,6 +40,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*; import java.util.*;
import static com.ruoyi.common.constants.BgtMessageConstant.*; import static com.ruoyi.common.constants.BgtMessageConstant.*;
@ -180,11 +181,13 @@ public class WgzReissueacardServiceImpl extends ServicePlusImpl<WgzReissueacardM
setAuditorUserId(recruit.getUserId()); setAuditorUserId(recruit.getUserId());
int insert = baseMapper.insert(wgzReissueacard); int insert = baseMapper.insert(wgzReissueacard);
//6、发送消息 //6、发送消息
// 定义日期时间格式,不包含 T
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
WgzUser byId = wgzUserService.findByUserId(appUserId); WgzUser byId = wgzUserService.findByUserId(appUserId);
Map<String, String> mp = new HashMap<>(); Map<String, String> mp = new HashMap<>();
mp.put("projectName", recruit.getRecruitName()); mp.put("projectName", recruit.getRecruitName());
mp.put("userName", byId.getUsername()); mp.put("userName", byId.getUsername());
mp.put("data", String.valueOf(req.getNowTime())); mp.put("data", req.getNowTime().format(formatter));
if (insert > 0) { if (insert > 0) {
WgzMessage wgzMessage = new WgzMessage(). WgzMessage wgzMessage = new WgzMessage().
setSenderType(USERTYPE_SYSTEM). setSenderType(USERTYPE_SYSTEM).

View File

@ -36,7 +36,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
a.read_status as readStatus, a.read_status as readStatus,
a.create_time as createTime, a.create_time as createTime,
a.message_large_type as messageLargeType, a.message_large_type as messageLargeType,
a.message_small_type as messageSmallType a.message_small_type as messageSmallType,
a.is_operation as isOperation
<if test="req.largeType == 0"> <if test="req.largeType == 0">
,c.recruit_name as recruitName ,c.recruit_name as recruitName
,c.id as recruitId ,c.id as recruitId
@ -114,13 +115,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
a.read_status as readStatus, a.read_status as readStatus,
a.create_time as createTime, a.create_time as createTime,
a.message_large_type as messageLargeType, a.message_large_type as messageLargeType,
a.message_small_type as messageSmallType a.message_small_type as messageSmallType,
a.is_operation as isOperation
FROM FROM
wgz_message as a wgz_message as a
<where> <where>
a.recipient_type = "1" AND a.recipient_type = "1" AND
a.recipient_id = #{req.recipientId} AND a.recipient_id = #{req.recipientId} AND
a.message_large_type = '3' AND <if test="req.largeType !=null and req.largeType!='2'">
a.message_large_type = '2' AND
</if>
<if test="req.largeType !=null and req.largeType!='3'">
a.is_operation = '1' AND
</if>
a.message_small_type is null AND a.message_small_type is null AND
a.del_flag = "0" a.del_flag = "0"
</where> </where>