优化
This commit is contained in:
@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.toolkit.SqlHelper;
|
||||
import com.google.errorprone.annotations.Var;
|
||||
import com.ruoyi.bgt.bo.BgtProjectRecruitApplyQueryBo;
|
||||
import com.ruoyi.bgt.domain.BgtMessage;
|
||||
import com.ruoyi.bgt.domain.BgtProjectRecruit;
|
||||
@ -41,6 +42,7 @@ import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import springfox.documentation.builders.ValidationResult;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.time.LocalDate;
|
||||
@ -193,7 +195,6 @@ public class BgtProjectRecruitApplyServiceImpl extends ServicePlusImpl<BgtProjec
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean consent(BgtProjectRecruitApplyConsentDTO dto) {
|
||||
|
||||
BgtProjectRecruitApply recruitApply = getById(dto.getId());
|
||||
List<BgtProjectRecruitApply> list = baseMapper.selectList(Wrappers.<BgtProjectRecruitApply>lambdaQuery()
|
||||
.eq(BgtProjectRecruitApply::getUserId, recruitApply.getUserId())
|
||||
@ -270,7 +271,7 @@ public class BgtProjectRecruitApplyServiceImpl extends ServicePlusImpl<BgtProjec
|
||||
Long appUserId = SecurityUtils.getAppUserId();
|
||||
//2、当前申请报名的工地信息
|
||||
BgtProjectRecruit appById = iBgtProjectRecruitService.getAppById(id);
|
||||
//3、检查当前用户是否已经有工地了、检查当前用户是否满足对应工种
|
||||
//3、检查当前用户是否实名认证
|
||||
Integer i = baseMapper.selectCount(
|
||||
new LambdaQueryWrapper<BgtProjectRecruitApply>().
|
||||
eq(BgtProjectRecruitApply::getUserId, appUserId).
|
||||
@ -283,22 +284,26 @@ public class BgtProjectRecruitApplyServiceImpl extends ServicePlusImpl<BgtProjec
|
||||
if (byId.getIdentityCard() == null || byId.getIdentityCard()=="") {
|
||||
throw new RuntimeException("当前用户还未实名认证!");
|
||||
}
|
||||
//3-2、是否已有工地
|
||||
if (i > 0) {
|
||||
throw new RuntimeException("已有工地!不可再次申请!");
|
||||
}
|
||||
//3-3、是否重复申请同一工地(先检查最后一次是否离场或取消,如果是就还能再次申请这个项目,否则无法申请)
|
||||
BgtProjectRecruitApply oneApply = baseMapper.selectOne(
|
||||
new LambdaQueryWrapper<BgtProjectRecruitApply>().
|
||||
eq(BgtProjectRecruitApply::getUserId, appUserId).
|
||||
eq(BgtProjectRecruitApply::getRecruitId, id).
|
||||
last("limit 1")
|
||||
);
|
||||
if (oneApply!=null && !(oneApply.getStatus().equals("6") || oneApply.getStatus().equals("7"))) {
|
||||
throw new RuntimeException("已申请过当前项目,如若再次申请请发起退场或者取消操作!");
|
||||
}
|
||||
//3-4、检查当前用户是否满足对应工种
|
||||
List<String> list = Arrays.asList(byId.getTypeOfWork().split(","));
|
||||
if (!list.contains(appById.getTypeOfWork())){
|
||||
throw new RuntimeException("工种不匹配!");
|
||||
}
|
||||
//4、判断当前用户是否已经申请过了,如果已经申请过了,就不能再次申请了
|
||||
Integer integer = baseMapper.selectCount(
|
||||
new LambdaQueryWrapper<BgtProjectRecruitApply>().
|
||||
eq(BgtProjectRecruitApply::getUserId, appUserId).
|
||||
eq(BgtProjectRecruitApply::getRecruitId, id)
|
||||
);
|
||||
if (integer > 0) {
|
||||
throw new RuntimeException("已申请过了!不可再次申请!");
|
||||
}
|
||||
|
||||
//3、插入数据
|
||||
BgtProjectRecruitApply bgtProjectRecruitApply = new BgtProjectRecruitApply();
|
||||
bgtProjectRecruitApply.setTaskId(appById.getTaskId());
|
||||
@ -478,15 +483,16 @@ public class BgtProjectRecruitApplyServiceImpl extends ServicePlusImpl<BgtProjec
|
||||
return insert;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public Boolean userCancelRegistration(Long recruitApplyId) {
|
||||
BgtProjectRecruitApply by = baseMapper.selectById(recruitApplyId);
|
||||
BgtProjectRecruitApply bgtProjectRecruitApply = new BgtProjectRecruitApply();
|
||||
bgtProjectRecruitApply.setId(recruitApplyId);
|
||||
// bgtProjectRecruitApply.setStatus("7");
|
||||
if (baseMapper.deleteById(bgtProjectRecruitApply) > 0) {
|
||||
bgtProjectRecruitApply.setStatus("7");
|
||||
if (baseMapper.updateById(bgtProjectRecruitApply) > 0) {
|
||||
Long appUserId = SecurityUtils.getAppUserId();
|
||||
BgtProjectRecruitApply by = baseMapper.selectById(recruitApplyId);
|
||||
BgtProjectRecruit appById = iBgtProjectRecruitService.getAppById(by.getRecruitId());
|
||||
Map<String, String> mp = new HashMap<>();
|
||||
mp.put("projectName", appById.getRecruitName());
|
||||
@ -497,8 +503,8 @@ public class BgtProjectRecruitApplyServiceImpl extends ServicePlusImpl<BgtProjec
|
||||
setRecipientId(appUserId).
|
||||
setHeadline(wgzMessage(mp, "103")).
|
||||
setSubheading(wgzMessage(mp, "104")).
|
||||
// setTableId(bgtProjectRecruitApply.getId()).
|
||||
// setTableName(SqlHelper.table(BgtProjectRecruitApply.class).getTableName()).
|
||||
setTableId(bgtProjectRecruitApply.getId()).
|
||||
setTableName(SqlHelper.table(BgtProjectRecruitApply.class).getTableName()).
|
||||
setMessageLargeType(LARGE_OTHER).
|
||||
setMessageSmallType(SMALL_SYSTEM);
|
||||
if (!iWgzMessageService.sendAMessage(wgzMessage)) {
|
||||
@ -534,10 +540,13 @@ public class BgtProjectRecruitApplyServiceImpl extends ServicePlusImpl<BgtProjec
|
||||
case "2":
|
||||
throw new RuntimeException("已失效!");
|
||||
}
|
||||
//3、更新报名状态、及更新消息的操作状态
|
||||
//3、更新报名状态、及更新消息的操作状态(用户同意更新进场时间、状态;用户拒绝更新状态)
|
||||
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("插入数据失败!");
|
||||
@ -588,7 +597,8 @@ public class BgtProjectRecruitApplyServiceImpl extends ServicePlusImpl<BgtProjec
|
||||
setSubheading(wgzMessage(mp, "108")).
|
||||
setTableId(apply.getId()).
|
||||
setTableName(SqlHelper.table(BgtProjectRecruitApply.class).getTableName()).
|
||||
setMessageLargeType(SMALL_SYSTEM);
|
||||
setMessageLargeType(LARGE_APPLY).
|
||||
setMessageSmallType(SMALL_SYSTEM);
|
||||
if (!iWgzMessageService.sendAMessage(wgzMessage)) {
|
||||
throw new RuntimeException("系统消息报名同意发送失败!");
|
||||
}
|
||||
|
@ -231,11 +231,11 @@ public class BgtProjectRecruitServiceImpl extends ServicePlusImpl<BgtProjectRecr
|
||||
pe.setCurrent(req.getPageNum());
|
||||
pe.setSize(req.getPageSize());
|
||||
TableDataInfo<WgzAppRegisteredProjectRes> wgzAppRegisteredProjectResTableDataInfo = PageUtils.buildDataInfo(baseMapper.userRegisteredProject(pe, userId));
|
||||
wgzAppRegisteredProjectResTableDataInfo.getRows().forEach(registeredProjectRes -> {
|
||||
//1、获取当前用户的取消、满员、失效、同意、拒绝状态
|
||||
//1、获取当前项目下的成员
|
||||
List<WgzAppCancelRegistrationProjectDetailsTwo> wgzUser = baseMapper.GetsTheMembersUnderTheCurrentProject(registeredProjectRes.getId());
|
||||
});
|
||||
// wgzAppRegisteredProjectResTableDataInfo.getRows().forEach(registeredProjectRes -> {
|
||||
// //1、获取当前用户的取消、满员、失效、同意、拒绝状态
|
||||
// //1、获取当前项目下的成员
|
||||
// List<WgzAppCancelRegistrationProjectDetailsTwo> wgzUser = baseMapper.GetsTheMembersUnderTheCurrentProject(registeredProjectRes.getId());
|
||||
// });
|
||||
return wgzAppRegisteredProjectResTableDataInfo;
|
||||
}
|
||||
|
||||
@ -264,7 +264,9 @@ public class BgtProjectRecruitServiceImpl extends ServicePlusImpl<BgtProjectRecr
|
||||
.in(WgzMessage::getTableId, req.getRecruitApplyId())
|
||||
.in(WgzMessage::getTableName, SqlHelper.table(BgtProjectRecruitApply.class).getTableName())
|
||||
);
|
||||
res.setIsOperation(one.getIsOperation());
|
||||
if (one !=null){
|
||||
res.setIsOperation(one.getIsOperation());
|
||||
}
|
||||
res.setFull(wgzAppProjectDetailsRes.getStatus());
|
||||
//5、获取当前申请人是否操作的对应状态
|
||||
BgtProjectRecruitApply byId = bgtProjectRecruitApplyService.getById(req.getRecruitApplyId());
|
||||
|
@ -212,7 +212,7 @@ public class FbsProjectTaskServiceImpl extends ServicePlusImpl<FbsProjectTaskMap
|
||||
Integer totalNum = attendanceService.dayTotalNum(id, date);
|
||||
appTaskDetailVO.setTotalNum(totalNum);
|
||||
//计算到岗率
|
||||
if(totalNum!=0){
|
||||
if(totalNum!=0 && bgtDayAttendanceCountVOS.size()>0){
|
||||
BgtDayAttendanceCountVO bgtDayAttendanceCountVO = bgtDayAttendanceCountVOS.get(bgtDayAttendanceCountVOS.size() - 1);
|
||||
int rate = new BigDecimal(bgtDayAttendanceCountVO.getReportToDutyNum()).divide(new BigDecimal(totalNum), 2, RoundingMode.HALF_UP)
|
||||
.multiply(new BigDecimal(100)).intValue();
|
||||
|
@ -12,6 +12,7 @@ import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@ -22,6 +23,9 @@ public class WgzAppDailyClockReq implements Serializable {
|
||||
@ApiModelProperty("日报状态(0正常 1补卡)")
|
||||
private String status;
|
||||
|
||||
@ApiModelProperty("status为1时,补卡日期")
|
||||
private LocalDateTime rqData;
|
||||
|
||||
@ApiModelProperty("今日完成工作")
|
||||
private String finishToday;
|
||||
|
||||
|
@ -188,6 +188,7 @@ public class WgzAttendanceServiceImpl extends ServicePlusImpl<WgzAttendanceMappe
|
||||
if (!flag) {
|
||||
throw new RuntimeException("打卡时间间隔不能少于3分钟");
|
||||
}
|
||||
wgzAttendance.setId(we.getId());
|
||||
wgzAttendance.setClockOutTime(now);
|
||||
LocalTime endWorkTime = appById.getEndWorkTime(); //下班
|
||||
String exceptionType = we.getExceptionType();
|
||||
@ -213,19 +214,17 @@ public class WgzAttendanceServiceImpl extends ServicePlusImpl<WgzAttendanceMappe
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断两个 LocalDateTime 之间的差值分钟数是否超过 3
|
||||
* 判断两个 LocalDateTime 之间的差值是否超过 3 分钟
|
||||
*
|
||||
* @param startTime 开始时间
|
||||
* @param endTime 结束时间
|
||||
* @return 如果差值分钟数超过 3 返回 true,否则返回 false
|
||||
* @return 如果差值超过 3 分钟返回 true,否则返回 false
|
||||
*/
|
||||
public static boolean isMinutesDifferenceGreaterThanThree(LocalDateTime startTime, LocalDateTime endTime) {
|
||||
// 计算两个时间之间的持续时间
|
||||
Duration duration = Duration.between(startTime, endTime);
|
||||
// 获取持续时间的分钟数
|
||||
long minutes = duration.toMinutes();
|
||||
// 判断分钟数是否超过 3
|
||||
return Math.abs(minutes) > 3;
|
||||
public boolean isMinutesDifferenceGreaterThanThree(LocalDateTime startTime, LocalDateTime endTime) {
|
||||
// 计算两个时间之间的持续时间(秒级精度)
|
||||
long seconds = Duration.between(startTime, endTime).getSeconds();
|
||||
// 超过 180 秒(3 分钟)则返回 true
|
||||
return Math.abs(seconds) > 180;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -178,9 +178,9 @@ public class WgzDailyClockServiceImpl extends ServicePlusImpl<WgzDailyClockMappe
|
||||
tempDate = tempDate.plusDays(1);
|
||||
}
|
||||
//2、查询当前人员指定日期的所有日报情况
|
||||
QueryWrapper<WgzDailyClock> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.apply("DATE_FORMAT(dily_time, '%Y-%m') = {0}", req.getYearMonth()); // 使用 apply 方法添加自定义 SQL 条件
|
||||
List<WgzDailyClock> wgzDailyClocks = baseMapper.selectList(queryWrapper);
|
||||
Long appUserId = SecurityUtils.getAppUserId();
|
||||
LambdaQueryWrapper<WgzDailyClock> apply = new LambdaQueryWrapper<WgzDailyClock>().eq(WgzDailyClock::getUserId, appUserId).apply("DATE_FORMAT(dily_time, '%Y-%m') = {0}", req.getYearMonth());
|
||||
List<WgzDailyClock> wgzDailyClocks = baseMapper.selectList(apply);
|
||||
//3、查看当前人、当前项目、当前月是否有请假
|
||||
Map<LocalDate, LocalDate> ll = iWgzLeaveService.selectByUserCancelLeave(req.getYearMonth());
|
||||
//4、将获取的年月与数据库中的日期进行比对,然后填充数据
|
||||
@ -195,7 +195,6 @@ public class WgzDailyClockServiceImpl extends ServicePlusImpl<WgzDailyClockMappe
|
||||
setId(wgzDailyClock.getId()).
|
||||
setDilyTime(wgzDailyClock.getDilyTime()).
|
||||
setPnchOsition(wgzDailyClock.getPnchOsition());
|
||||
|
||||
if (ll.get(date) !=null && ll.get(date).equals(clockDate)) {
|
||||
wgzAppAttachmentAcquisitionTwo.setStatus("2"); //全天请假
|
||||
}
|
||||
@ -226,13 +225,24 @@ public class WgzDailyClockServiceImpl extends ServicePlusImpl<WgzDailyClockMappe
|
||||
Long appUserId = SecurityUtils.getAppUserId();
|
||||
BgtProjectRecruitApply by = iBgtProjectRecruitApplyService.selectByUserIdProjectRecruitApplyId(appUserId);
|
||||
BgtProjectRecruit appById = iBgtProjectRecruitService.getAppById(by.getRecruitId());
|
||||
//2、为补卡时now的时间就为前端传递的日期
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
if (req.getStatus().equals("1")){
|
||||
now = req.getRqData();
|
||||
}
|
||||
// //3、判断当前时间的补卡是否存在,存在就不允许插入
|
||||
// LambdaQueryWrapper<WgzDailyClock> apply = new LambdaQueryWrapper<WgzDailyClock>()
|
||||
// .eq(WgzDailyClock::getUserId, appUserId)
|
||||
// .eq(WgzDailyClock::getRecruitId, appById.getId())
|
||||
// .eq(WgzDailyClock::getDilyTime, now);
|
||||
// List<WgzDailyClock> wgzDailyClocks = baseMapper.selectList(apply);
|
||||
//1、组装数据
|
||||
WgzDailyClock dc = new WgzDailyClock();
|
||||
BeanUtils.copyProperties(req,dc);
|
||||
dc.setStatus(req.getStatus());
|
||||
dc.setRecruitId(appUserId);
|
||||
dc.setUserId(appUserId);
|
||||
dc.setDilyTime(LocalDateTime.now());
|
||||
dc.setDilyTime(now);
|
||||
dc.setAuditorUserId(appById.getUserId());
|
||||
int insert = baseMapper.insert(dc);
|
||||
//2、插入成功,且状态为1,那么就需要发送消息给【补日报】的人和上级【招工】
|
||||
|
@ -237,7 +237,7 @@ public class WgzMessageServiceImpl extends ServicePlusImpl<WgzMessageMapper, Wgz
|
||||
if(count == num){
|
||||
return "1"; //已招满
|
||||
}
|
||||
if (recruitEndTime.isAfter(LocalDate.now())){
|
||||
if (!LocalDate.now().isBefore(recruitEndTime)){
|
||||
return "2"; //已失效
|
||||
}
|
||||
return "0";
|
||||
|
@ -91,6 +91,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
a.recruit_id = #{recruitId} AND a.del_flag = 0
|
||||
</select>
|
||||
|
||||
<!--b.id not in (SELECT recruit_id FROM bgt_project_recruit_apply WHERE user_id = #{req.userId})and-->
|
||||
<select id="userJobListing" resultType="com.ruoyi.wgz.bo.res.WgzAppJobListingRes">
|
||||
SELECT
|
||||
b.*,
|
||||
@ -105,7 +106,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
LEFT JOIN sys_dict_data as d ON (d.dict_type = 'type_of_work' and d.dict_value = b.type_of_work)
|
||||
WHERE
|
||||
DATE_FORMAT(NOW(), '%Y-%m-%d') BETWEEN b.recruit_begin_time AND b.recruit_end_time and
|
||||
b.id not in (SELECT recruit_id FROM bgt_project_recruit_apply WHERE user_id = #{req.userId})and
|
||||
b.del_flag = 0
|
||||
order by b.create_time desc
|
||||
</select>
|
||||
|
Reference in New Issue
Block a user