弹弓的木垒的考勤转发
This commit is contained in:
parent
3b6c83f6b0
commit
5b739a8bfe
@ -66,4 +66,10 @@ public class UploadAttendanceByDevDto {
|
|||||||
@ApiModelProperty("经度")
|
@ApiModelProperty("经度")
|
||||||
private String pos_lng;
|
private String pos_lng;
|
||||||
|
|
||||||
|
private String idCard;
|
||||||
|
/**
|
||||||
|
* 是否被转发
|
||||||
|
*/
|
||||||
|
private Boolean isTranspond;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,6 +5,8 @@ import cn.hutool.core.collection.CollUtil;
|
|||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.exceptions.ExceptionUtil;
|
import cn.hutool.core.exceptions.ExceptionUtil;
|
||||||
import cn.hutool.core.io.FileUtil;
|
import cn.hutool.core.io.FileUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import cn.hutool.http.HttpRequest;
|
||||||
import cn.xuyanwu.spring.file.storage.FileInfo;
|
import cn.xuyanwu.spring.file.storage.FileInfo;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
@ -56,6 +58,7 @@ import java.math.BigDecimal;
|
|||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static com.arcsoft.face.toolkit.ImageFactory.getRGBData;
|
import static com.arcsoft.face.toolkit.ImageFactory.getRGBData;
|
||||||
@ -315,7 +318,7 @@ public class WorkerAttendanceServiceImpl extends ServiceImpl<WorkerAttendanceMap
|
|||||||
int hour = Integer.valueOf(time.substring(11, 13));
|
int hour = Integer.valueOf(time.substring(11, 13));
|
||||||
if (dev != null && dev.getIsEnter() != null && dev.getIsEnter() == 1 && dev.getIsOut() != null && dev.getIsOut() == 1) {
|
if (dev != null && dev.getIsEnter() != null && dev.getIsEnter() == 1 && dev.getIsOut() != null && dev.getIsOut() == 1) {
|
||||||
String entTime = "," + dev.getEnterTime() + ",";
|
String entTime = "," + dev.getEnterTime() + ",";
|
||||||
if (entTime.indexOf(Cts.COMMA + hour +Cts.COMMA) > -1) {
|
if (entTime.indexOf(Cts.COMMA + hour + Cts.COMMA) > -1) {
|
||||||
type = 1;
|
type = 1;
|
||||||
} else {
|
} else {
|
||||||
type = 2;
|
type = 2;
|
||||||
@ -1177,15 +1180,35 @@ status 状态码 String 1表示成功;其余表示失败
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String uploadAttendanceByDev(UploadAttendanceByDevDto dto) {
|
public String uploadAttendanceByDev(UploadAttendanceByDevDto dto) {
|
||||||
WorkerInfo workerInfo = workerInfoMapper.selectById(dto.getWorkerId());
|
|
||||||
if (workerInfo == null) {
|
|
||||||
throw new OpenAlertException("workerId不存在");
|
|
||||||
}
|
|
||||||
UfaceDev dev = ufaceDevMapper.selectOne(new LambdaQueryWrapper<UfaceDev>()
|
UfaceDev dev = ufaceDevMapper.selectOne(new LambdaQueryWrapper<UfaceDev>()
|
||||||
.eq(UfaceDev::getDevSn, dto.getDeviceId()));
|
.eq(UfaceDev::getDevSn, dto.getDeviceId()));
|
||||||
if (dev == null) {
|
if (dev == null) {
|
||||||
throw new OpenAlertException("deviceId不存在");
|
throw new OpenAlertException("deviceId不存在");
|
||||||
}
|
}
|
||||||
|
WorkerInfo workerInfo;
|
||||||
|
if (StrUtil.isNotBlank(dto.getIdCard())) {
|
||||||
|
workerInfo = workerInfoMapper.selectOne(new LambdaQueryWrapper<WorkerInfo>().eq(WorkerInfo::getIdCard, dto.getIdCard()).eq(WorkerInfo::getProjectSn, dev.getProjectSn()));
|
||||||
|
} else {
|
||||||
|
workerInfo = workerInfoMapper.selectById(dto.getWorkerId());
|
||||||
|
}
|
||||||
|
if (workerInfo == null) {
|
||||||
|
throw new OpenAlertException("workerId不存在");
|
||||||
|
}
|
||||||
|
dto.setIdCard(workerInfo.getIdCard());
|
||||||
|
if (!Objects.equals(dto.getIsTranspond(), true)) {
|
||||||
|
dto.setWorkerId(null);
|
||||||
|
dto.setIsTranspond(true);
|
||||||
|
if (Objects.equals(dev.getProjectSn(), "F20D19C31C5140C585185BAB10E8D9A2")) {
|
||||||
|
CompletableFuture.runAsync(() -> {
|
||||||
|
//木垒转发
|
||||||
|
String result2 = HttpRequest.post("http://222.80.185.228:6090/photo")
|
||||||
|
.body(JSON.toJSONString(dto))
|
||||||
|
.timeout(2000)//超时,毫秒
|
||||||
|
.execute().body();
|
||||||
|
log.info("木垒转发考勤结果:{}", result2);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
HashMap<String, Object> map = new HashMap<>(16);
|
HashMap<String, Object> map = new HashMap<>(16);
|
||||||
FileInfo fileInfo = null;
|
FileInfo fileInfo = null;
|
||||||
if (StringUtils.isNotBlank(dto.getBase64())) {
|
if (StringUtils.isNotBlank(dto.getBase64())) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user