提交 250b3ab7 authored 作者: 窦馨雨's avatar 窦馨雨

合并分支 'qa' 到 'master'

增加下班时下班时间判断逻辑 查看合并请求 !84
package com.wangxiaolu.promotion.controller.activity.temporary;
import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
import com.alibaba.nacos.client.utils.StringUtils;
import com.wangxiaolu.promotion.enums.activity.TemActApproveStatus;
import com.wangxiaolu.promotion.exception.DataException;
......@@ -10,10 +12,7 @@ import com.wangxiaolu.promotion.pojo.activity.temporary.vo.TemporaryActivityData
import com.wangxiaolu.promotion.pojo.activity.temporary.vo.TemporaryActivityMarketCellVo;
import com.wangxiaolu.promotion.result.basedata.R;
import com.wangxiaolu.promotion.result.basedata.RCode;
import com.wangxiaolu.promotion.service.activity.temporary.TemporaryActivityClockCoreService;
import com.wangxiaolu.promotion.service.activity.temporary.TemporaryActivityClockQueryService;
import com.wangxiaolu.promotion.service.activity.temporary.TemporaryActivityCoreService;
import com.wangxiaolu.promotion.service.activity.temporary.TemporaryActivityQueryService;
import com.wangxiaolu.promotion.service.activity.temporary.*;
import com.wangxiaolu.promotion.service.wechat.WeChatUserQueryService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
......@@ -23,6 +22,7 @@ import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
import java.math.BigDecimal;
import java.util.Date;
import java.util.Objects;
/**
......@@ -139,7 +139,7 @@ public class TemporaryActivityCoreController {
@PutMapping("/reported/approve/submit/{id}")
public R activityReportedSubmit(@PathVariable("id") Long id) {
TemporaryActivityReportedDto activityReportedDto = temporaryActivityQueryService.findTemporaryActivityById(id);
TemporaryClockDto clockInfo = tempActivityClockQueryService.findCLockInfoByReportedId(activityReportedDto.getId(),activityReportedDto.getTemporaryId());
if (CollectionUtils.isEmpty(activityReportedDto.getTgscPhotoInfos()) ){
throw new DataException(RCode.NOT_TGSH_PHOTO_ERROR);
}else if (CollectionUtils.isEmpty(activityReportedDto.getTghdPhotoInfos()) ){
......@@ -169,8 +169,32 @@ public class TemporaryActivityCoreController {
}else if (activityReportedDto.getGiftBoxSales() == null ){
throw new DataException(RCode.NOT_GIFT_SALES_ERROR);
}
Date clockInTime = clockInfo.getClockInTime();
Date noonClockInTime = clockInfo.getNoonClockInTime();
Date noonClockOutTime = clockInfo.getNoonClockOutTime();
Date clockOutTime = new Date();
long totalMinutes = 0;
boolean isNoonCardMissing = Objects.isNull(clockInTime) || Objects.isNull(noonClockInTime);
if (isNoonCardMissing) {
// 午休缺卡:直接计算上班→下班的总时长
totalMinutes = DateUtil.between(clockInTime, clockOutTime, DateUnit.MINUTE);
} else {
// 午休不缺卡:两段时长相加(上午段 + 下午段)
// 上班→午休下班
long morningMinutes = DateUtil.between(clockInTime, noonClockOutTime, DateUnit.MINUTE);
long afternoonMinutes= DateUtil.between(noonClockInTime, clockOutTime, DateUnit.MINUTE);
totalMinutes = morningMinutes + afternoonMinutes;
}
tempActivityCoreService.activityReportedSubmit(id);
// 分钟转小时(保留1位小数,避免多位小数)
double hours = Math.round((totalMinutes / 60.0) * 10) / 10.0;
if (hours < 8.0){
throw new DataException(RCode.NOT_ENOUGH_WORK_TIME_ERROR);
}
tempActivityCoreService.activityReportedSubmit(id);
return R.success();
}
......
......@@ -44,4 +44,5 @@ public interface TemporaryActivityClockDao {
TemporaryClockDto findClockInfo(TemporaryClockWrapper wr);
TemporaryClockDto findCLockInfoByReportedId(Long reportedId, Long temporaryId);
}
......@@ -107,7 +107,14 @@ public class TemporaryActivityClockDaoImpl implements TemporaryActivityClockDao
return clockDto;
}
@Override
public TemporaryClockDto findCLockInfoByReportedId(Long reportedId, Long temporaryId) {
LambdaQueryWrapper<TemporaryActivityClockDO> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(TemporaryActivityClockDO::getReportedId,reportedId);
queryWrapper.eq(TemporaryActivityClockDO::getTemporaryId,temporaryId);
TemporaryActivityClockDO temporaryActivityClockDO = temporaryActivityClockMapper.selectOne(queryWrapper);
return transitionDto(temporaryActivityClockDO);
}
private LambdaQueryWrapper<TemporaryActivityClockDO> buildWrapper(TemporaryClockWrapper tcw) {
LambdaQueryWrapper<TemporaryActivityClockDO> qw = new LambdaQueryWrapper<>();
......
......@@ -20,4 +20,6 @@ public interface TemporaryActivityClockQueryService {
TemporaryClockDto findClockInfo(TemporaryClockWrapper wr);
TemporaryClockDto findCLockInfoByReportedId(Long id, Long temporaryId);
}
......@@ -94,6 +94,18 @@ public class TemporaryActivityClockQueryServiceImpl implements TemporaryActivity
return temporaryClockDto;
}
/**
* 获取打卡信息
*
* @param reportedId
* @param temporaryId
* @return
*/
@Override
public TemporaryClockDto findCLockInfoByReportedId(Long reportedId, Long temporaryId) {
return temporaryActivityClockDao.findCLockInfoByReportedId(reportedId, temporaryId);
}
/**
* 查询打卡图片
*/
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论