设备未绑定工程无法打卡

This commit is contained in:
haozq 2025-09-06 15:15:18 +08:00
parent 380fabe2bb
commit 82707878ec
4 changed files with 33 additions and 5 deletions

View File

@ -6,6 +6,7 @@ import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSONObject;
import com.bonus.common.core.urk.CommonUtils;
import com.bonus.common.core.urk.Constant;
import com.bonus.common.core.utils.StringUtils;
import com.bonus.urk.service.UserFaceHandleService;
import com.bonus.urk.vo.BmWorkerEinUserVo;
import com.bonus.urk.vo.DeviceVo;
@ -43,6 +44,7 @@ public class UserFaceHandle {
@Async
public void addUserAttendance(DeviceVo deviceVo, HttpServletRequest req, HttpServletResponse resp) {
try{
//判断设备是否绑定工程
// 解析request输入流
String jsonStr = getRequestBody(req);
log.info("出入记录:{}", jsonStr);
@ -64,7 +66,8 @@ public class UserFaceHandle {
}
//验证用户是否入场
BmWorkerEinUserVo vo=service.getOnUserInfo(userId);
if(vo==null){
String proId=service.getDevPorId(devCode);
if(vo==null && StringUtils.isNotEmpty(proId)){
vo=new BmWorkerEinUserVo();
vo.setAttPhoto(bast64);
vo.setAttTime(time);
@ -72,18 +75,17 @@ public class UserFaceHandle {
vo.setDevName(deviceVo.getDeviceName());
vo.setUserId(userId);
service.addWrcUser(vo);
resp.addHeader(Constant.DEVICE_HEADER_RESPONSE_CODE, Constant.OK);
resp.getWriter().write("");
}else {
assert vo != null;
vo.setAttPhoto(bast64);
vo.setAttTime(time);
vo.setDevCode(devCode);
vo.setDevName(deviceVo.getDeviceName());
service.addAttendInfo(vo);
//数据返回
resp.addHeader(Constant.DEVICE_HEADER_RESPONSE_CODE, Constant.OK);
resp.getWriter().write("");
}
resp.addHeader(Constant.DEVICE_HEADER_RESPONSE_CODE, Constant.OK);
resp.getWriter().write("");
}catch (Exception e){
log.error(e.toString(),e);
}

View File

@ -49,4 +49,11 @@ public interface UserFaceHandleMapper {
* @param vo
*/
void addWrcUser(BmWorkerEinUserVo vo);
/**
* 查询考情机绑定的工程
* @param devCode
* @return
*/
String getDevPorId(@Param("devCode") String devCode);
}

View File

@ -105,4 +105,18 @@ public class UserFaceHandleService {
}
}
/**
* 查询考情机绑定的工程
* @param devCode
* @return
*/
public String getDevPorId(String devCode) {
try{
return mapper.getDevPorId(devCode);
}catch (Exception e){
log.error(e.toString(),e);
}
return null;
}
}

View File

@ -42,6 +42,11 @@
from bm_att_record_no_ru
where worker_id=#{userId} and is_active=1 and att_day=#{attDay}
</select>
<select id="getDevPorId" resultType="java.lang.String">
select pro_id
from pm_att_device
where device_code=#{devCode}
</select>
<insert id="addWrcUser">
insert into bm_att_record_no_ru(