Merge remote-tracking branch 'origin/main'

This commit is contained in:
方亮 2025-09-06 19:06:14 +08:00
commit 11bb477ba5
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.alibaba.fastjson.JSONObject;
import com.bonus.common.core.urk.CommonUtils; import com.bonus.common.core.urk.CommonUtils;
import com.bonus.common.core.urk.Constant; import com.bonus.common.core.urk.Constant;
import com.bonus.common.core.utils.StringUtils;
import com.bonus.urk.service.UserFaceHandleService; import com.bonus.urk.service.UserFaceHandleService;
import com.bonus.urk.vo.BmWorkerEinUserVo; import com.bonus.urk.vo.BmWorkerEinUserVo;
import com.bonus.urk.vo.DeviceVo; import com.bonus.urk.vo.DeviceVo;
@ -43,6 +44,7 @@ public class UserFaceHandle {
@Async @Async
public void addUserAttendance(DeviceVo deviceVo, HttpServletRequest req, HttpServletResponse resp) { public void addUserAttendance(DeviceVo deviceVo, HttpServletRequest req, HttpServletResponse resp) {
try{ try{
//判断设备是否绑定工程
// 解析request输入流 // 解析request输入流
String jsonStr = getRequestBody(req); String jsonStr = getRequestBody(req);
log.info("出入记录:{}", jsonStr); log.info("出入记录:{}", jsonStr);
@ -64,7 +66,8 @@ public class UserFaceHandle {
} }
//验证用户是否入场 //验证用户是否入场
BmWorkerEinUserVo vo=service.getOnUserInfo(userId); BmWorkerEinUserVo vo=service.getOnUserInfo(userId);
if(vo==null){ String proId=service.getDevPorId(devCode);
if(vo==null && StringUtils.isNotEmpty(proId)){
vo=new BmWorkerEinUserVo(); vo=new BmWorkerEinUserVo();
vo.setAttPhoto(bast64); vo.setAttPhoto(bast64);
vo.setAttTime(time); vo.setAttTime(time);
@ -72,18 +75,17 @@ public class UserFaceHandle {
vo.setDevName(deviceVo.getDeviceName()); vo.setDevName(deviceVo.getDeviceName());
vo.setUserId(userId); vo.setUserId(userId);
service.addWrcUser(vo); service.addWrcUser(vo);
resp.addHeader(Constant.DEVICE_HEADER_RESPONSE_CODE, Constant.OK);
resp.getWriter().write("");
}else { }else {
assert vo != null;
vo.setAttPhoto(bast64); vo.setAttPhoto(bast64);
vo.setAttTime(time); vo.setAttTime(time);
vo.setDevCode(devCode); vo.setDevCode(devCode);
vo.setDevName(deviceVo.getDeviceName()); vo.setDevName(deviceVo.getDeviceName());
service.addAttendInfo(vo); 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){ }catch (Exception e){
log.error(e.toString(),e); log.error(e.toString(),e);
} }

View File

@ -49,4 +49,11 @@ public interface UserFaceHandleMapper {
* @param vo * @param vo
*/ */
void addWrcUser(BmWorkerEinUserVo 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 from bm_att_record_no_ru
where worker_id=#{userId} and is_active=1 and att_day=#{attDay} where worker_id=#{userId} and is_active=1 and att_day=#{attDay}
</select> </select>
<select id="getDevPorId" resultType="java.lang.String">
select pro_id
from pm_att_device
where device_code=#{devCode}
</select>
<insert id="addWrcUser"> <insert id="addWrcUser">
insert into bm_att_record_no_ru( insert into bm_att_record_no_ru(