完成消息待办和补充安全教育接口
This commit is contained in:
@ -92,7 +92,7 @@ public interface IBgtProjectRecruitApplyService extends IServicePlus<BgtProjectR
|
||||
/**
|
||||
* 获取当前用户的所有招工
|
||||
*/
|
||||
List<WgzAppUserAllRecruitmentTwo> userAllRecruitment();
|
||||
List<WgzAppUserAllRecruitmentTwo> userAllRecruitment(Long userId);
|
||||
|
||||
/**
|
||||
* 根据用户唯一标识去查询当前进场的工地信息
|
||||
|
@ -213,15 +213,13 @@ public class BgtProjectRecruitApplyServiceImpl extends ServicePlusImpl<BgtProjec
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<WgzAppUserAllRecruitmentTwo> userAllRecruitment() {
|
||||
//1、获取到所有项目
|
||||
Long appUserId = SecurityUtils.getAppUserId();
|
||||
List<WgzAppUserAllRecruitmentTwo> res = baseMapper.userAllRecruitment(appUserId);
|
||||
//2、获取到当前人员所在的工地
|
||||
public List<WgzAppUserAllRecruitmentTwo> userAllRecruitment(Long userId) {
|
||||
List<WgzAppUserAllRecruitmentTwo> res = baseMapper.userAllRecruitment(userId);
|
||||
//2、获取到指定人员所在的工地
|
||||
for (WgzAppUserAllRecruitmentTwo re : res) {
|
||||
LambdaQueryWrapper<BgtProjectRecruitApply> last = new LambdaQueryWrapper<BgtProjectRecruitApply>()
|
||||
.eq(BgtProjectRecruitApply::getRecruitId, re.getRecruitId())
|
||||
.eq(BgtProjectRecruitApply::getUserId, appUserId)
|
||||
.eq(BgtProjectRecruitApply::getUserId, userId)
|
||||
.orderByDesc(BgtProjectRecruitApply::getId)
|
||||
.last("limit 1");
|
||||
BgtProjectRecruitApply bgtProjectRecruitApply = baseMapper.selectOne(last);
|
||||
|
@ -90,4 +90,7 @@ public class WgzAppGetMessageListRes implements Serializable {
|
||||
|
||||
@ApiModelProperty("其它·请假·请假时间")
|
||||
private LocalDateTime qjLeaveTime;
|
||||
|
||||
@ApiModelProperty("其它·请假·请假时间")
|
||||
private String isOperation;
|
||||
}
|
||||
|
@ -32,6 +32,6 @@ public class WgzAppSubmitATestPaperRes implements Serializable {
|
||||
@ApiModelProperty("答对题数")
|
||||
private Integer number;
|
||||
|
||||
@ApiModelProperty("试卷")
|
||||
private String pdfStr;
|
||||
// @ApiModelProperty("试卷")
|
||||
// private String pdfStr;
|
||||
}
|
||||
|
@ -26,4 +26,8 @@ public interface WgzQuestionSaveMapper extends BaseMapperPlus<WgzQuestionSave> {
|
||||
"WHERE correct = 1 AND user_id = #{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);
|
||||
|
||||
}
|
||||
|
@ -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<WgzQuestionSave> {
|
||||
* 安全教育试卷提交保存
|
||||
*/
|
||||
WgzAppSubmitATestPaperRes userSubmitATestPaper(@Validated @RequestBody WgzAppSubmitATestPaperReq req);
|
||||
|
||||
/**
|
||||
* 查詢指定用戶的试卷是否及格
|
||||
*/
|
||||
WgzAppUserScoreQuery userScoreQuery(long userId);
|
||||
}
|
||||
|
@ -167,7 +167,7 @@ public class WgzLeaveServiceImpl extends ServicePlusImpl<WgzLeaveMapper, WgzLeav
|
||||
and(
|
||||
inner -> 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("当前时间段已存在请假!");
|
||||
|
@ -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<WgzMessageMapper, Wgz
|
||||
|
||||
@Override
|
||||
public WgzAppMessageTypeStatisticsRes userMessageTypeStatistics(Long id) {
|
||||
// Long appUserId = SecurityUtils.getAppUserId();
|
||||
// BgtProjectRecruitApply by = iBgtProjectRecruitApplyService.selectByUserIdProjectRecruitApplyId(appUserId);
|
||||
// BgtProjectRecruit appById = iBgtProjectRecruitService.getAppById(by.getRecruitId());
|
||||
//1、获取当前人,并获取到当前用户的所有项目
|
||||
Long appUserId = SecurityUtils.getAppUserId();
|
||||
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<>();
|
||||
//1、获取字典类型
|
||||
List<SysDictData> data = dictTypeService.selectDictDataByType("message_large_type");
|
||||
@ -167,16 +180,16 @@ public class WgzMessageServiceImpl extends ServicePlusImpl<WgzMessageMapper, Wgz
|
||||
eq(WgzMessage::getMessageLargeType, datum.getDictValue());
|
||||
mp.put(datum.getDictValue(),baseMapper.selectCount(wp));
|
||||
}
|
||||
// //2、单独获取待办中的消息
|
||||
// Integer daiBanCount = baseMapper.selectCount(
|
||||
// new LambdaQueryWrapper<WgzMessage>().
|
||||
// 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<WgzMessage>().
|
||||
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<WgzMessageMapper, Wgz
|
||||
queryDTOPage.setCurrent(req.getPageNum());
|
||||
queryDTOPage.setSize(req.getPageSize());
|
||||
//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);
|
||||
//2、循环小类型,然后去查询对应不同类的查询标题(主要针对0补卡、3请假)
|
||||
pe.getRecords().stream().forEach(res -> {
|
||||
@ -216,10 +229,11 @@ public class WgzMessageServiceImpl extends ServicePlusImpl<WgzMessageMapper, Wgz
|
||||
}
|
||||
//2、走正常的全部+大类型+具体的小类型
|
||||
else{
|
||||
//0、待办的查询
|
||||
//0、待办的查询(查出指定用戶所有的待办)
|
||||
String largeType = req.getLargeType();
|
||||
if (largeType!=null && largeType.equals("daiban")){
|
||||
throw new RuntimeException("待办的查询暂未开发");
|
||||
if (largeType!=null && largeType.equals("3")){
|
||||
Page<WgzAppGetMessageListRes> pe = baseMapper.pagingQueryTheMessageList(queryDTOPage, req);
|
||||
return PageUtils.buildDataInfo(pe);
|
||||
}
|
||||
return PageUtils.buildDataInfo(baseMapper.userGetMessageList(queryDTOPage,req));
|
||||
}
|
||||
|
@ -178,6 +178,7 @@ public class WgzPayCalculationServiceImpl extends ServicePlusImpl<WgzPayCalculat
|
||||
public Boolean userApplyForPayrollSettlementAdd(WgzApplyForPayrollSettlementAddReq req) {
|
||||
//1、获取当前人
|
||||
SysUser user = SecurityUtils.getLoginUser().getUser();
|
||||
WgzUser byUserId = wgzUserService.findByUserId(user.getUserId());
|
||||
BgtProjectRecruitApply recruitApply = iBgtProjectRecruitApplyService.selectByUserIdProjectRecruitApplyId(user.getUserId());
|
||||
BgtProjectRecruit recruit = iBgtProjectRecruitService.getAppById(recruitApply.getRecruitId());
|
||||
//2、查看当前申请结算的天数是否大于剩余天数
|
||||
@ -213,7 +214,7 @@ public class WgzPayCalculationServiceImpl extends ServicePlusImpl<WgzPayCalculat
|
||||
BeanUtils.copyProperties(req,wgzPayCalculation);
|
||||
wgzPayCalculation.
|
||||
setUserId(user.getUserId()).
|
||||
setUserName(user.getUserName()).
|
||||
setUserName(byUserId.getUsername()).
|
||||
setAuditorUserId(recruit.getUserId());
|
||||
boolean save = save(wgzPayCalculation);
|
||||
if (!save) {
|
||||
|
@ -97,7 +97,11 @@ public class WgzQuestionBankServiceImpl extends ServicePlusImpl<WgzQuestionBankM
|
||||
last("order by rand() limit " + num);
|
||||
List<WgzQuestionBank> wgzQuestionBanks = baseMapper.selectList(last);
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -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<WgzQuestionSaveM
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -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<WgzReissueacardM
|
||||
setAuditorUserId(recruit.getUserId());
|
||||
int insert = baseMapper.insert(wgzReissueacard);
|
||||
//6、发送消息
|
||||
// 定义日期时间格式,不包含 T
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
WgzUser byId = wgzUserService.findByUserId(appUserId);
|
||||
Map<String, String> 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).
|
||||
|
@ -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
|
||||
<if test="req.largeType == 0">
|
||||
,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
|
||||
<where>
|
||||
a.recipient_type = "1" 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.del_flag = "0"
|
||||
</where>
|
||||
|
Reference in New Issue
Block a user