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

@ -726,7 +726,7 @@
public AjaxResult<WgzAppUserAllRecruitmentRes> userAllRecruitment() {
Long appUserId = SecurityUtils.getAppUserId();
WgzAppUserAllRecruitmentRes res = new WgzAppUserAllRecruitmentRes();
res.setList(iBgtProjectRecruitApplyService.userAllRecruitment(appUserId));
res.setList(iBgtProjectRecruitApplyService.userAllRecruitment(appUserId,"1"));
return AjaxResult.success(res);
}

View File

@ -45,6 +45,11 @@ public interface BgtProjectRecruitApplyMapper extends BaseMapperPlus<BgtProjectR
// 我的任务详情-务工者人员列表分页
Page<BgtProjectRecruitApplyVO> taskUserList(@Param("page")Page<BgtProjectTaskUserDTO> queryDTOPage, @Param("dto") BgtProjectTaskUserDTO dto);
//获取指定用户的所有招工
List<WgzAppUserAllRecruitmentTwo> userAllRecruitment(@Param("userId") Long userId);
/**
* 获取指定用户的所有招工
* @param userId 用户id
* @param type 类型1获取招工查询入职、进场、离职 2获取需待办的查询同意、入职、进场、离职
* @return
*/
List<WgzAppUserAllRecruitmentTwo> userAllRecruitment(@Param("userId") Long userId,@Param("type") String type);
}

View File

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

View File

@ -213,8 +213,8 @@ public class BgtProjectRecruitApplyServiceImpl extends ServicePlusImpl<BgtProjec
}
@Override
public List<WgzAppUserAllRecruitmentTwo> userAllRecruitment(Long userId) {
List<WgzAppUserAllRecruitmentTwo> res = baseMapper.userAllRecruitment(userId);
public List<WgzAppUserAllRecruitmentTwo> userAllRecruitment(Long userId,String type) {
List<WgzAppUserAllRecruitmentTwo> res = baseMapper.userAllRecruitment(userId,type);
//2、获取到指定人员所在的工地
for (WgzAppUserAllRecruitmentTwo re : res) {
LambdaQueryWrapper<BgtProjectRecruitApply> last = new LambdaQueryWrapper<BgtProjectRecruitApply>()
@ -646,16 +646,16 @@ public class BgtProjectRecruitApplyServiceImpl extends ServicePlusImpl<BgtProjec
String status = judMp.get("status").toString();
switch (status) {
case "1":
//异步修改状态为已招满
iAsyncService.updateRecruitStatus(recruit);
// //异步修改状态为已招满
// iAsyncService.updateRecruitStatus(recruit);
throw new RuntimeException("已招满!");
case "2":
throw new RuntimeException("已失效!");
}
// int count = ((Number) judMp.get("count")).intValue();
// if (count > 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<BgtProjec
BgtProjectRecruitApply apply = new BgtProjectRecruitApply();
apply.setId(req.getRecruitApplyId());
apply.setStatus(req.getStatus());
// if (req.getStatus().equals("3")){
// apply.setStatus("5");
// }
int up = baseMapper.updateById(apply);
if (up == 0) {
throw new RuntimeException("修改招工申请信息失败!");

View File

@ -178,12 +178,12 @@ public class BgtProjectRecruitServiceImpl extends ServicePlusImpl<BgtProjectRecr
}
TableDataInfo<BgtProjectRecruitApplyVO> page = bgtProjectRecruitApplyService.recruitApplyList(userDTO);
int count = bgtProjectRecruitApplyService.count(Wrappers.<BgtProjectRecruitApply>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.<BgtProjectRecruitApply>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);

View File

@ -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);

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){

View File

@ -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")
<if test="type!=null and type!='1'">
and a.status in ("3","5","6")
</if>
<if test="type!=null and type!='2'">
and a.status in ("1","3","5","6")
</if>
and a.del_flag = "0"
GROUP BY a.recruit_id
</select>

View File

@ -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

View File

@ -125,10 +125,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<where>
a.recipient_type = "1" AND
a.recipient_id = #{req.recipientId} AND
<if test="req.largeType !=null and req.largeType!='2'">
<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'">
<if test="req.largeType !=null and req.largeType==3">
a.is_operation = '1' AND
</if>
<if test="req.rq!=null">