|
|
|
@ -6,6 +6,7 @@ import cn.hutool.core.lang.Snowflake; |
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
import com.ccsens.common.bean.po.ProMember; |
|
|
|
import com.ccsens.common.persist.dao.ProMemberDao; |
|
|
|
import com.ccsens.common.service.IPowerService; |
|
|
|
import com.ccsens.common.util.CommonCodeError; |
|
|
|
import com.ccsens.defaultwbs.bean.dto.ClockingInDto; |
|
|
|
import com.ccsens.defaultwbs.bean.po.ProClockingIn; |
|
|
|
@ -13,6 +14,7 @@ import com.ccsens.defaultwbs.bean.po.ProClockingIn; |
|
|
|
import com.ccsens.defaultwbs.bean.vo.ClockingInVo; |
|
|
|
import com.ccsens.defaultwbs.persist.dao.ProClockingInDao; |
|
|
|
|
|
|
|
import com.ccsens.defaultwbs.util.DefaultCodeError; |
|
|
|
import com.ccsens.util.PoiUtil; |
|
|
|
import com.ccsens.util.PropUtil; |
|
|
|
import com.ccsens.util.exception.BaseException; |
|
|
|
@ -44,6 +46,8 @@ public class ClockingInService implements IClockingInService { |
|
|
|
private ProClockingInDao clockingInDao; |
|
|
|
@Resource |
|
|
|
private Snowflake snowflake; |
|
|
|
@Resource |
|
|
|
private IPowerService powerService; |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<ClockingInVo.ClockingInInfo> queryClockingIn(ClockingInDto.QueryClockingIn params, Long userId) { |
|
|
|
@ -190,7 +194,6 @@ public class ClockingInService implements IClockingInService { |
|
|
|
ProClockingIn proClockingIn = clockingInDao.queryHaveData(params.getMemberId(),System.currentTimeMillis()); |
|
|
|
if(ObjectUtil.isNotNull(proClockingIn)){ |
|
|
|
//如果有记录则查找记录并修改
|
|
|
|
// ProClockingIn proClockingIn = clockingInDao.selectByPrimaryKey(params.getId());
|
|
|
|
if(params.getClockType() == 0 && proClockingIn.getMorningStatus() == 0){ |
|
|
|
proClockingIn.setMorning(System.currentTimeMillis()); |
|
|
|
proClockingIn.setMorningStatus((byte) 1); |
|
|
|
@ -269,6 +272,86 @@ public class ClockingInService implements IClockingInService { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void auditRecord1(ClockingInDto.Audit params, Long userId) { |
|
|
|
ProClockingIn proClockingIn; |
|
|
|
//查询当前用户所属的memberId
|
|
|
|
Long userOfMemberId = memberDao.findUserOfMemberId(params.getProjectId(), userId); |
|
|
|
//判断打卡记录id是否为空
|
|
|
|
if(ObjectUtil.isNotNull(params.getId())){ |
|
|
|
//不为空 查询打卡记录
|
|
|
|
ProClockingIn record = clockingInDao.selectByPrimaryKey(params.getId()); |
|
|
|
log.info("查找打卡记录:{}",record); |
|
|
|
//如果是空返回错误信息
|
|
|
|
if(ObjectUtil.isNull(record)){ |
|
|
|
throw new BaseException(DefaultCodeError.NOT_CLOCKING_IN); |
|
|
|
} |
|
|
|
//判断当前用户是否是检查人
|
|
|
|
if (!record.getCheckerId().equals(userOfMemberId)) { |
|
|
|
throw new BaseException(CommonCodeError.NO_POWER); |
|
|
|
} |
|
|
|
//需要操作的记录
|
|
|
|
proClockingIn = new ProClockingIn(); |
|
|
|
proClockingIn.setId(params.getId()); |
|
|
|
}else { |
|
|
|
//当前用户是否是项目经理
|
|
|
|
Integer power = powerService.queryUserPower(params.getProjectId(), userId); |
|
|
|
//根据memberId查询上一条打卡记录的检查人
|
|
|
|
ClockingInVo.LastChecker lastChecker = clockingInDao.queryLastChecker(params.getMemberId()); |
|
|
|
if(power < 1){ |
|
|
|
//不是项目经理,且不是上一条信息的检查人,提示错误信息
|
|
|
|
if(ObjectUtil.isNull(lastChecker)){ |
|
|
|
throw new BaseException(CommonCodeError.NO_POWER); |
|
|
|
} |
|
|
|
if(!lastChecker.getLastCheckerId().equals(userOfMemberId)){ |
|
|
|
throw new BaseException(CommonCodeError.NO_POWER); |
|
|
|
} |
|
|
|
} |
|
|
|
//新建一个打卡记录
|
|
|
|
proClockingIn = new ProClockingIn(); |
|
|
|
proClockingIn.setId(snowflake.nextId()); |
|
|
|
proClockingIn.setCheckerId(userOfMemberId); |
|
|
|
proClockingIn.setMemberId(params.getMemberId()); |
|
|
|
clockingInDao.insertSelective(proClockingIn); |
|
|
|
} |
|
|
|
|
|
|
|
//修改
|
|
|
|
if (0 == params.getType()) { |
|
|
|
if (ObjectUtil.isNotNull(params.getMorning())) { |
|
|
|
proClockingIn.setMorning(params.getMorning()); |
|
|
|
proClockingIn.setMorningStatus((byte)1); |
|
|
|
} |
|
|
|
if (ObjectUtil.isNotNull(params.getNight())) { |
|
|
|
proClockingIn.setNight(params.getNight()); |
|
|
|
proClockingIn.setNightStatus((byte)1); |
|
|
|
} |
|
|
|
log.info("修改打卡记录:{}",proClockingIn); |
|
|
|
} |
|
|
|
//驳回
|
|
|
|
if (1 == params.getType()) { |
|
|
|
if (ObjectUtil.isNotNull(params.getMorning())) { |
|
|
|
proClockingIn.setMorningStatus((byte)2); |
|
|
|
} |
|
|
|
if (ObjectUtil.isNotNull(params.getNight())) { |
|
|
|
proClockingIn.setNightStatus((byte)2); |
|
|
|
} |
|
|
|
log.info("驳回打卡记录:{}",proClockingIn); |
|
|
|
} |
|
|
|
//审核通过
|
|
|
|
if (2 == params.getType()) { |
|
|
|
if (ObjectUtil.isNotNull(params.getMorning())) { |
|
|
|
proClockingIn.setMorningStatus((byte)3); |
|
|
|
} |
|
|
|
if (ObjectUtil.isNotNull(params.getNight())) { |
|
|
|
proClockingIn.setNightStatus((byte)3); |
|
|
|
} |
|
|
|
log.info("审核通过打卡记录:{}",proClockingIn); |
|
|
|
} |
|
|
|
clockingInDao.updateByPrimaryKeySelective(proClockingIn); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public ClockingInVo.ExcelUrl exportRecord(ClockingInDto.QueryClockingIn params, Long userId) throws IOException { |
|
|
|
log.info("开始调用查询考勤方法"); |
|
|
|
|