This commit is contained in:
2025-03-13 17:03:37 +08:00
parent 3a2b2064d5
commit ee0411263f
10 changed files with 184 additions and 74 deletions

View File

@ -237,9 +237,9 @@
}
/**
* 【日报】日报打卡
* 【日报】日报打卡|补卡
*/
@ApiOperation("【日报】日报打卡")
@ApiOperation("【日报】日报打卡|补卡")
//@PreAuthorize("@ss.hasPermi('wgzApp:user:userDailyClock')")
@RepeatSubmit
@PostMapping("/WgzUserDailyClock")

View File

@ -23,6 +23,9 @@ public class WgzAppDailyClockReq implements Serializable {
@ApiModelProperty("日报状态0正常 1补卡")
private String status;
@ApiModelProperty("补卡理由status为1传递")
private String reason;
@ApiModelProperty("status为1时补卡日期")
private LocalDateTime rqData;

View File

@ -88,4 +88,13 @@ public class WgzAppCheckDailyNewspaperRes implements Serializable {
@ApiModelProperty("头像地址")
private String avatarName;
@ApiModelProperty("日报状态0正常 1补卡")
private String status;
@ApiModelProperty("补卡理由")
private String reason;
@ApiModelProperty("招工主题")
private String recruitName;
}

View File

@ -37,7 +37,10 @@ public class WgzAppUserDailyRecordRes implements Serializable {
@ApiModelProperty("今日完成工作")
private String finishToday;
@ApiModelProperty("审核状态0未读 1审核 2已审核")
@ApiModelProperty("审核状态0未读 1审核 2已审核")
private String auditorType;
@ApiModelProperty("日报状态0正常 1补卡")
private String status;
}

View File

@ -117,6 +117,11 @@ public class WgzAttendance implements Serializable {
@ApiModelProperty("类型0正常 1迟到 2早退 3上班缺卡 4下班缺卡 5补卡 6请假")
private String exceptionType;
/** 结算标识 */
@Excel(name = "结算标识" )
@ApiModelProperty("结算标识")
private Integer settlement;
/** 删除标志0代表存在 2代表删除 */
@Excel(name = "删除标志" , readConverterExp = "0=代表存在,2=代表删除")
@ApiModelProperty("删除标志0代表存在 2代表删除")

View File

@ -111,6 +111,11 @@ public class WgzDailyClock implements Serializable {
@ApiModelProperty("日报状态0正常 1补卡")
private String status;
/** 补卡理由 */
@Excel(name = "补卡理由")
@ApiModelProperty("补卡理由")
private String reason;
/** 删除标志0代表存在 2代表删除 */
@Excel(name = "删除标志" , readConverterExp = "0=代表存在,2=代表删除")
@ApiModelProperty("删除标志0代表存在 2代表删除")

View File

@ -185,10 +185,13 @@ public class WgzAttendanceServiceImpl extends ServicePlusImpl<WgzAttendanceMappe
LocalDateTime now = LocalDateTime.now(); //当前完整年月日时分秒
LocalTime localTime = now.toLocalTime(); //获取时分秒
if (we != null) {
//获取上次打卡时间与这次打卡时间的间隔是否超过3分钟
boolean flag = isMinutesDifferenceGreaterThanThree(we.getClockInTime(), now);
if (!flag) {
throw new RuntimeException("打卡时间间隔不能少于3分钟");
//如果是上班缺卡的话,那么就可以直接打下班卡
if (!(we.getMissedIn() ==1)) {
//获取上次打卡时间与这次打卡时间的间隔是否超过3分钟
boolean flag = isMinutesDifferenceGreaterThanThree(we.getClockInTime(), now);
if (!flag) {
throw new RuntimeException("打卡时间间隔不能少于3分钟");
}
}
wgzAttendance.setId(we.getId());
wgzAttendance.setClockOutTime(now);
@ -243,7 +246,16 @@ public class WgzAttendanceServiceImpl extends ServicePlusImpl<WgzAttendanceMappe
} else {
res.setClockingCondition(1); //下班
if (wgzAttendance.getLeaveMarkId() == null && wgzAttendance.getClockInTime() != null && wgzAttendance.getClockOutTime() != null) {
res.setClockingCondition(3); //已完成
res.setClockingCondition(3); //已完成 ()
}else if(wgzAttendance.getLeaveMarkId() == null){
//打了上班,下班缺卡 = 完成
if (wgzAttendance.getClockInTime() != null && wgzAttendance.getMissedOut() == 1) {
res.setClockingCondition(3); //已完成
}
//上班缺卡,打了下班 = 完成
if (wgzAttendance.getMissedIn() == 1 && wgzAttendance.getClockOutTime() != null) {
res.setClockingCondition(3); //已完成
}
}
if (wgzAttendance.getLeaveMarkId() != null && wgzAttendance.getLeaveMarkId() != 0) {
res.setClockingCondition(2); //请假
@ -311,14 +323,16 @@ public class WgzAttendanceServiceImpl extends ServicePlusImpl<WgzAttendanceMappe
LocalDate clockDate = wa.getDate();
if (clockDate.equals(date)) {
//上班
if (wa.getClockInTime() != null) {
if (wa.getClockInTime() != null || wa.getMissedIn()== 1) {
two.setNum(1);
two.setSb(sbOrXb(wa, 1));
}
//下班
if (wa.getClockOutTime() != null) {
if (wa.getClockOutTime() != null || wa.getMissedOut()== 1) {
two.setNum(2);
two.setManHour(calculateWorkingHours(wa.getClockInTime(), wa.getClockOutTime()));
if (wa.getClockOutTime() != null && wa.getClockOutTime() != null ) {
two.setManHour(calculateWorkingHours(wa.getClockInTime(), wa.getClockOutTime()));
}
two.setXb(sbOrXb(wa, 2));
}
}
@ -381,7 +395,8 @@ public class WgzAttendanceServiceImpl extends ServicePlusImpl<WgzAttendanceMappe
public Integer attendanceDetail(Long userId, Long recruitId, Integer num) {
LambdaQueryWrapper<WgzAttendance> apply = new LambdaQueryWrapper<WgzAttendance>().
eq(WgzAttendance::getUserId, userId).
eq(WgzAttendance::getRecruitId, recruitId).and(wrapper -> wrapper
eq(WgzAttendance::getSettlement, 0). //为0就表示当天工资还未结算
eq(WgzAttendance::getRecruitId, recruitId).and(wrapper -> wrapper
.isNotNull(WgzAttendance::getClockInTime)
.or()
.isNotNull(WgzAttendance::getClockOutTime)
@ -393,6 +408,22 @@ public class WgzAttendanceServiceImpl extends ServicePlusImpl<WgzAttendanceMappe
return baseMapper.selectCount(apply);
}
// @Override
// public Integer attendanceDetail(Long userId, Long recruitId, Integer num) {
// LambdaQueryWrapper<WgzAttendance> apply = new LambdaQueryWrapper<WgzAttendance>().
// eq(WgzAttendance::getUserId, userId).
// eq(WgzAttendance::getRecruitId, recruitId).and(wrapper -> wrapper
// .isNotNull(WgzAttendance::getClockInTime)
// .or()
// .isNotNull(WgzAttendance::getClockOutTime)
// );
// apply.orderByAsc(WgzAttendance::getDate);
// if (num != null && num > 0) { //表示查询指定天数的打卡记录,否则查询所有
// apply.last("LIMIT " + num);
// }
// return baseMapper.selectCount(apply);
// }
@Override
public List<BgtAttendanceCountVO> countByTaskId(Long taskId, LocalDate beginDate, LocalDate endDate) {
@ -566,6 +597,10 @@ public class WgzAttendanceServiceImpl extends ServicePlusImpl<WgzAttendanceMappe
if (wa.getExceptionType().contains("5")) {
sbb.setClockingCondition(5);
}
//缺卡
if (wa.getMissedIn()==1) {
sbb.setClockingCondition(3);
}
// 获取上班补卡信息
setReissueacardInfo(sbb, wa, 0);
}
@ -579,6 +614,10 @@ public class WgzAttendanceServiceImpl extends ServicePlusImpl<WgzAttendanceMappe
if (wa.getExceptionType().contains("6")) {
sbb.setClockingCondition(6);
}
//缺卡
if (wa.getMissedOut()==1) {
sbb.setClockingCondition(4);
}
// 获取下班补卡信息
setReissueacardInfo(sbb, wa, 1);
}

View File

@ -274,7 +274,7 @@ public class WgzDailyClockServiceImpl extends ServicePlusImpl<WgzDailyClockMappe
setTableId(dc.getId()).
setTableName(SqlHelper.table(WgzDailyClock.class).getTableName()).
setMessageLargeType(BGT_LARGE_OTHER).
setMessageSmallType(BGT_SMALL_MAKE_UP);
setMessageSmallType(BGT_SMALL_REPORT_MAKE_UP);
if (!iBgtMessageService.sendAMessage(bgtMessage)){
throw new RuntimeException("发送日报补卡消息失败!");
}
@ -302,6 +302,9 @@ public class WgzDailyClockServiceImpl extends ServicePlusImpl<WgzDailyClockMappe
//2、获取日报的审核人信息
BgtUser by = userService.selectUserByUserId(byId.getAuditorUserId());
res.setAvatarName(by.getAvatarName()).setUsername(by.getUsername());
//3、获取招工主题
BgtProjectRecruit byId1 = recruitService.getById(byId.getRecruitId());
res.setRecruitName(byId1.getRecruitName());
return res;
}

View File

@ -40,10 +40,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import static com.ruoyi.common.constants.BgtMessageConstant.*;
import static com.ruoyi.common.constants.WgzAndBgtMessageConstant.*;
@ -172,76 +169,122 @@ public class WgzPayCalculationServiceImpl extends ServicePlusImpl<WgzPayCalculat
SysUser user = SecurityUtils.getLoginUser().getUser();
BgtProjectRecruitApply recruitApply = iBgtProjectRecruitApplyService.selectByUserIdProjectRecruitApplyId(user.getUserId());
BgtProjectRecruit recruit = iBgtProjectRecruitService.getAppById(recruitApply.getId());
//2、结算数据之前,需要先获取以往结算的数据(如果没有就说明第一次结算),然后得到剩余结算天数,再从剩余天数重新进行数据结算
Integer num = 0;
LocalDate byNumGetDate = null;
WgzPayCalculation wgzts = baseMapper.selectOne(Wrappers.<WgzPayCalculation>lambdaQuery().
eq(WgzPayCalculation::getUserId, user.getUserId()).
eq(WgzPayCalculation::getRecruitId, recruitApply.getId()).
orderByDesc(WgzPayCalculation::getCreateTime).
last("LIMIT 1")
//2、查看当前申请结算的天数是否大于剩余天数
LambdaQueryWrapper<WgzAttendance> attWra = new LambdaQueryWrapper<WgzAttendance>().
eq(WgzAttendance::getUserId, user.getUserId()).
eq(WgzAttendance::getSettlement, 0). //为0就表示当天工资还未结算
eq(WgzAttendance::getRecruitId, recruitApply.getRecruitId()).and(wrapper -> wrapper
.isNotNull(WgzAttendance::getClockInTime)
.or()
.isNotNull(WgzAttendance::getClockOutTime)
);
List<WgzAttendance> attList = iWgzAttendanceService.list(
attWra.orderByAsc(WgzAttendance::getDate)
.last("LIMIT " + req.getNum())
);
if (wgzts != null) {//得到最后一次的结算截止时间和剩余未结算天数
byNumGetDate = wgzts.getCutOffTime();
num = iWgzAttendanceService.findByDateGetDateList(user.getUserId(), recruitApply.getRecruitId(), byNumGetDate).size();
if (attList.size() < req.getNum()) { //判断剩余天数是否满足当前结算天数
throw new RuntimeException("您剩余可结算天数为:"+attList.size()+"天,您当前想要结算的天数为:"+req.getNum()+"天,剩余天数不足!");
}
//3、把需要结算的数据标记为已结算
List<WgzAttendance> objects = new ArrayList<>();
for (WgzAttendance data : attList) {
objects.add(new WgzAttendance()
.setId(data.getId())
.setSettlement(1)
);
}
//4、将结算的数据
}else{//得到即将结算截止的日期和剩余未结算天数
byNumGetDate = iWgzAttendanceService.findByNumGetDate(user.getUserId(), recruitApply.getRecruitId(), req.getNum());
num = iWgzAttendanceService.attendanceDetail(user.getUserId(), recruitApply.getRecruitId(), null);
}
if (num < req.getNum()) { //判断剩余天数是否满足当前结算天数
throw new RuntimeException("您剩余可结算天数为:"+num+"天,您当前想要结算的天数为:"+req.getNum()+"天,剩余天数不足!");
}
//4、组装数据
WgzPayCalculation wgzPayCalculation = new WgzPayCalculation();
BeanUtils.copyProperties(req,wgzPayCalculation);
wgzPayCalculation.
setUserId(user.getUserId()).
setUserName(user.getUserName()).
setAuditorUserId(recruit.getUserId()).
setCutOffTime(byNumGetDate);
setAuditorUserId(recruit.getUserId());
//5、获取附件信息并插入
iWgzPayCalculationFilesService.saveBatch(req.getPayCalculation());
//6、插入工资结算信息
boolean save = save(wgzPayCalculation);
if (save) {
WgzUser byId = wgzUserService.findByUserId(user.getUserId());
Map<String, String> mp = new HashMap<>();
mp.put("projectName", recruit.getRecruitName());
mp.put("userName", byId.getUsername());
mp.put("num", String.valueOf(wgzPayCalculation.getNum()));
mp.put("money", String.valueOf(new BigDecimal(wgzPayCalculation.getNum()).multiply(wgzPayCalculation.getRecruitAmount())));
WgzMessage wgzMessage = new WgzMessage().
setSenderType(USERTYPE_SYSTEM).
setRecipientType(USERTYPE_WGZ).
setRecipientId(user.getUserId()).
setHeadline(WgzAndBgtMessageConstant.wgzMessage(mp,"111")).
setSubheading(WgzAndBgtMessageConstant.wgzMessage(mp,"112")).
setTableId(wgzPayCalculation.getId()).
setTableName(SqlHelper.table(WgzPayCalculation.class).getTableName()).
setMessageLargeType(LARGE_SALARY);
if (!iWgzMessageService.sendAMessage(wgzMessage)){
throw new RuntimeException("系统工资结算消息发送失败!");
}
BgtMessage bgtMessage = new BgtMessage().
setSenderType(USERTYPE_WGZ).
setSenderId(user.getUserId()).
setRecipientType(USERTYPE_BGT).
setRecipientId(recruit.getUserId()).
setHeadline(WgzAndBgtMessageConstant.wgzMessage(mp,"209")).
setSubheading(WgzAndBgtMessageConstant.wgzMessage(mp,"210")).
setTableId(wgzPayCalculation.getId()).
setTableName(SqlHelper.table(WgzPayCalculation.class).getTableName()).
setMessageLargeType(BGT_LARGE_OTHER).
setMessageSmallType(BGT_SMALL_PAY);
if (!iBgtMessageService.sendAMessage(bgtMessage)){
throw new RuntimeException("发送补卡消息失败!");
}
return true;
}
return save(wgzPayCalculation);
}
// @Override
// @Transactional
// public Boolean userApplyForPayrollSettlementAdd(WgzApplyForPayrollSettlementAddReq req) {
// //1、获取当前人
// SysUser user = SecurityUtils.getLoginUser().getUser();
// BgtProjectRecruitApply recruitApply = iBgtProjectRecruitApplyService.selectByUserIdProjectRecruitApplyId(user.getUserId());
// BgtProjectRecruit recruit = iBgtProjectRecruitService.getAppById(recruitApply.getId());
// //2、结算数据之前需要先获取以往结算的数据(如果没有就说明第一次结算),然后得到剩余结算天数,再从剩余天数重新进行数据结算
// Integer num = 0;
// LocalDate byNumGetDate = null;
// WgzPayCalculation wgzts = baseMapper.selectOne(Wrappers.<WgzPayCalculation>lambdaQuery().
// eq(WgzPayCalculation::getUserId, user.getUserId()).
// eq(WgzPayCalculation::getRecruitId, recruitApply.getId()).
// orderByDesc(WgzPayCalculation::getCreateTime).
// last("LIMIT 1")
// );
// if (wgzts != null) {//得到最后一次的结算截止时间和剩余未结算天数
// byNumGetDate = wgzts.getCutOffTime();
// num = iWgzAttendanceService.findByDateGetDateList(user.getUserId(), recruitApply.getRecruitId(), byNumGetDate).size();
// }else{//得到即将结算截止的日期和剩余未结算天数
// byNumGetDate = iWgzAttendanceService.findByNumGetDate(user.getUserId(), recruitApply.getRecruitId(), req.getNum());
// num = iWgzAttendanceService.attendanceDetail(user.getUserId(), recruitApply.getRecruitId(), null);
// }
// if (num < req.getNum()) { //判断剩余天数是否满足当前结算天数
// throw new RuntimeException("您剩余可结算天数为:"+num+"天,您当前想要结算的天数为:"+req.getNum()+"天,剩余天数不足!");
// }
// //4、组装数据
// WgzPayCalculation wgzPayCalculation = new WgzPayCalculation();
// BeanUtils.copyProperties(req,wgzPayCalculation);
// wgzPayCalculation.
// setUserId(user.getUserId()).
// setUserName(user.getUserName()).
// setAuditorUserId(recruit.getUserId()).
// setCutOffTime(byNumGetDate);
// //5、获取附件信息并插入
// iWgzPayCalculationFilesService.saveBatch(req.getPayCalculation());
// //6、插入工资结算信息
// boolean save = save(wgzPayCalculation);
// if (save) {
// WgzUser byId = wgzUserService.findByUserId(user.getUserId());
// Map<String, String> mp = new HashMap<>();
// mp.put("projectName", recruit.getRecruitName());
// mp.put("userName", byId.getUsername());
// mp.put("num", String.valueOf(wgzPayCalculation.getNum()));
// mp.put("money", String.valueOf(new BigDecimal(wgzPayCalculation.getNum()).multiply(wgzPayCalculation.getRecruitAmount())));
// WgzMessage wgzMessage = new WgzMessage().
// setSenderType(USERTYPE_SYSTEM).
// setRecipientType(USERTYPE_WGZ).
// setRecipientId(user.getUserId()).
// setHeadline(WgzAndBgtMessageConstant.wgzMessage(mp,"111")).
// setSubheading(WgzAndBgtMessageConstant.wgzMessage(mp,"112")).
// setTableId(wgzPayCalculation.getId()).
// setTableName(SqlHelper.table(WgzPayCalculation.class).getTableName()).
// setMessageLargeType(LARGE_SALARY);
// if (!iWgzMessageService.sendAMessage(wgzMessage)){
// throw new RuntimeException("系统工资结算消息发送失败!");
// }
// BgtMessage bgtMessage = new BgtMessage().
// setSenderType(USERTYPE_WGZ).
// setSenderId(user.getUserId()).
// setRecipientType(USERTYPE_BGT).
// setRecipientId(recruit.getUserId()).
// setHeadline(WgzAndBgtMessageConstant.wgzMessage(mp,"209")).
// setSubheading(WgzAndBgtMessageConstant.wgzMessage(mp,"210")).
// setTableId(wgzPayCalculation.getId()).
// setTableName(SqlHelper.table(WgzPayCalculation.class).getTableName()).
// setMessageLargeType(BGT_LARGE_OTHER).
// setMessageSmallType(BGT_SMALL_PAY);
// if (!iBgtMessageService.sendAMessage(bgtMessage)){
// throw new RuntimeException("发送补卡消息失败!");
// }
// return true;
// }
// return save(wgzPayCalculation);
// }
@Override
public TableDataInfo<WgzAppApplyForPayrollSettlementListRes> userApplyForPayrollSettlementList(WgzAppApplyForPayrollSettlementListReq req) {
Page<WgzAppApplyForPayrollSettlementListReq> pe = new Page<>();

View File

@ -206,7 +206,7 @@ public class WgzReissueacardServiceImpl extends ServicePlusImpl<WgzReissueacardM
setSubheading(WgzAndBgtMessageConstant.wgzMessage(mp, "208")).
setTableId(wgzReissueacard.getId()).
setTableName(SqlHelper.table(BgtProjectRecruitApply.class).getTableName()).
setMessageLargeType(BGT_TYPE_SIGN_UP).
setMessageLargeType(BGT_LARGE_OTHER).
setMessageSmallType(BGT_SMALL_MAKE_UP);
if (!iBgtMessageService.sendAMessage(bgtMessage)) {
throw new RuntimeException("发送补卡消息失败!");