|
|
@ -21,9 +21,7 @@ import org.jeecg.modules.clockinteam.service.IClockinTeamService; |
|
|
|
import org.jeecg.modules.clockinteamlog.entity.ClockinTeamLog; |
|
|
|
import org.jeecg.modules.clockinteamlog.service.IClockinTeamLogService; |
|
|
|
import org.jeecg.modules.hanHaiMember.entity.HanHaiMember; |
|
|
|
import org.jeecg.modules.xcx.clockin.req.ClockInLogReq; |
|
|
|
import org.jeecg.modules.xcx.clockin.req.ClockInReq; |
|
|
|
import org.jeecg.modules.xcx.clockin.req.ClockInTotalReq; |
|
|
|
import org.jeecg.modules.xcx.clockin.req.*; |
|
|
|
import org.jeecg.modules.xcx.clockin.resp.ClockInTotalResp; |
|
|
|
import org.jeecg.modules.xcx.clockin.service.IClockinService; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
@ -73,9 +71,9 @@ public class ClockinServiceImpl implements IClockinService { |
|
|
|
if(clockInProject == null){ |
|
|
|
throw new JeecgBootException("当前团队未配置项目,无需打卡"); |
|
|
|
} |
|
|
|
Integer distance = clockInProjectService.getDistance(clockInReq.getLon(), clockInProject.getLat(), clockInProject.getId()); |
|
|
|
Integer distance = clockInProjectService.getDistance(clockInReq.getLon(), clockInReq.getLat(), clockInProject.getId()); |
|
|
|
if(distance > clockInProject.getDistance()){ |
|
|
|
log.info("用户经度:"+clockInReq.getLon()+"纬度:"+clockInProject.getLat()); |
|
|
|
log.info("用户经度:"+clockInReq.getLon()+"纬度:"+clockInReq.getLat()); |
|
|
|
log.info("距离:"+distance); |
|
|
|
throw new JeecgBootException("不在有效打卡距离内"); |
|
|
|
} |
|
|
@ -84,10 +82,7 @@ public class ClockinServiceImpl implements IClockinService { |
|
|
|
throw new JeecgBootException("当前未到打卡时间"); |
|
|
|
} |
|
|
|
|
|
|
|
VerifyFaceResponse verifyFaceResponse = TencentUtils.VerifyFace(hanHaiMember.getId(), clockInReq.getImage(),Long.parseLong(clockInConfService.getConf("qualityControl"))); |
|
|
|
if(!verifyFaceResponse.getIsMatch()){ |
|
|
|
throw new JeecgBootException("人脸识别错误"); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
ClockinLog clockinLog1 = clockinLogService.lambdaQuery() |
|
|
|
.eq(ClockinLog::getDelFlag, 0) |
|
|
@ -210,4 +205,51 @@ public class ClockinServiceImpl implements IClockinService { |
|
|
|
map.put("abnormal",abnormal); |
|
|
|
return Result.OK(map); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Result<?> verifyFace(VerifyFaceReq verifyFaceReq) { |
|
|
|
HanHaiMember hanHaiMember = shiroRealm.checkUserTokenIsEffectHanHaiAccount(verifyFaceReq.getToken()); |
|
|
|
|
|
|
|
VerifyFaceResponse verifyFaceResponse = TencentUtils.VerifyFace(hanHaiMember.getId(), verifyFaceReq.getImage(),Long.parseLong(clockInConfService.getConf("qualityControl"))); |
|
|
|
if(!verifyFaceResponse.getIsMatch()){ |
|
|
|
throw new JeecgBootException("人脸识别错误"); |
|
|
|
} |
|
|
|
|
|
|
|
return Result.OK(); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Result<?> clockInTime(ClockInTimeReq clockInTimeReq) { |
|
|
|
HanHaiMember hanHaiMember = shiroRealm.checkUserTokenIsEffectHanHaiAccount(clockInTimeReq.getToken()); |
|
|
|
|
|
|
|
ClockinTeamLog clockinTeamLog = clockinTeamLogService.lambdaQuery() |
|
|
|
.eq(ClockinTeamLog::getDelFlag, 0) |
|
|
|
.eq(ClockinTeamLog::getUserId, hanHaiMember.getId()) |
|
|
|
.one(); |
|
|
|
if(clockinTeamLog == null){ |
|
|
|
throw new JeecgBootException("未绑定团队,请先绑定团队"); |
|
|
|
} |
|
|
|
ClockInProject clockInProject = clockInProjectService.lambdaQuery() |
|
|
|
.eq(ClockInProject::getDelFlag, 0) |
|
|
|
.eq(ClockInProject::getTeamId, clockinTeamLog.getTeamId()) |
|
|
|
.one(); |
|
|
|
if(clockInProject == null){ |
|
|
|
throw new JeecgBootException("当前团队未配置项目"); |
|
|
|
} |
|
|
|
|
|
|
|
ClockInProjectItem validClockInTime = clockInProjectItemService.getValidClockInTime(DateUtils2.getNowDateTimeStrings(), clockInProject.getId()); |
|
|
|
if(validClockInTime == null){ |
|
|
|
throw new JeecgBootException("当前未到打卡时间"); |
|
|
|
} |
|
|
|
|
|
|
|
Integer distance = clockInProjectService.getDistance(clockInTimeReq.getLon(), clockInTimeReq.getLat(), clockInProject.getId()); |
|
|
|
log.info("用户经度:"+clockInTimeReq.getLon()+"纬度:"+clockInTimeReq.getLat()); |
|
|
|
log.info("距离:"+distance); |
|
|
|
if(distance > clockInProject.getDistance()){ |
|
|
|
|
|
|
|
throw new JeecgBootException("不在有效打卡距离内"); |
|
|
|
} |
|
|
|
|
|
|
|
return Result.OK(); |
|
|
|
} |
|
|
|
} |