人员导入去掉某些必填
This commit is contained in:
parent
a57a1d58c9
commit
4e3c9f759b
@ -346,6 +346,88 @@ public class HikvisionCall {
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "服务挂了主动获取查询过车记录", notes = "服务挂了主动获取查询过车记录", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "projectSn", value = "项目sn", paramType = "body", required = false, dataType = "String"),
|
||||
@ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "body", required = true, dataType = "String"),
|
||||
@ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "body", required = true, dataType = "String"),
|
||||
})
|
||||
@PostMapping(value = "/getCrossRecords")
|
||||
public Result getCrossRecords(@ApiIgnore @RequestBody HashMap<String, Object> paramMap) {
|
||||
String startTime = MapUtils.getString(paramMap, "startTime");
|
||||
String endTime = MapUtils.getString(paramMap, "endTime");
|
||||
DateUtils.checkLegalDate19(startTime);
|
||||
DateUtils.checkLegalDate19(endTime);
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("startTime", DateUtils.getISO8601Str(DateUtil.parse(startTime)));
|
||||
param.put("endTime", DateUtils.getISO8601Str(DateUtil.parse(endTime)));
|
||||
String projectSn = MapUtils.getString(paramMap, "projectSn");
|
||||
LambdaQueryWrapper<Project> queryWrapper = new LambdaQueryWrapper<Project>()
|
||||
.eq(Project::getSyncHikvision, 1);
|
||||
if (StringUtils.isNotBlank(projectSn)) {
|
||||
queryWrapper.eq(Project::getProjectSn, projectSn);
|
||||
}
|
||||
List<Project> projects = projectMapper.selectList(queryWrapper);
|
||||
for (Project project : projects) {
|
||||
List<UfaceDev> ufaceDevs = ufaceDevMapper.selectList(new LambdaQueryWrapper<UfaceDev>()
|
||||
.eq(UfaceDev::getProjectSn, project.getProjectSn()));
|
||||
for (UfaceDev ufaceDev : ufaceDevs) {
|
||||
param.put("doorIndexCode", ufaceDev.getDevSn());
|
||||
param.put("pageNo", 1);
|
||||
Integer total = 0;
|
||||
do {
|
||||
String rs = getDoorEventsForHttp(project, param);
|
||||
JSONObject joData = HikvisionUtil.getJSONObjectData(rs);
|
||||
if (joData != null) {
|
||||
total = joData.getInteger("total");
|
||||
if (!Objects.equals(total, 0)) {
|
||||
JSONArray listJa = joData.getJSONArray("list");
|
||||
for (int i = 0; i < listJa.size(); i++) {
|
||||
JSONObject listJo = listJa.getJSONObject(i);
|
||||
String eventTime = listJo.getString("eventTime");
|
||||
String personId = listJo.getString("personId");
|
||||
String personName = listJo.getString("personName");
|
||||
String doorIndexCode = listJo.getString("doorIndexCode");
|
||||
String picUri = listJo.getString("picUri");
|
||||
String svrIndexCode = listJo.getString("svrIndexCode");
|
||||
WorkerInfo workerInfo = workerInfoMapper.selectById(personId);
|
||||
if (workerInfo == null) {
|
||||
log.error("未找到该人员信息,personName:{}", personName);
|
||||
continue;
|
||||
}
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
String time = DateUtil.formatDateTime(DateUtil.parse(eventTime));
|
||||
map.put("passTime", time);
|
||||
map.put("idCard", workerInfo.getIdCard());
|
||||
map.put("attendanceNumber", workerInfo.getAttendanceNumber());
|
||||
int passType = workerAttendanceServiceImpl.getPassType(ufaceDev, time);
|
||||
map.put("direction", passType);
|
||||
map.put("passType", 2);
|
||||
map.put("projectCode", workerInfo.getProjectSn());
|
||||
map.put("devCode", doorIndexCode);
|
||||
|
||||
try {
|
||||
HikvisionEventsPictureRq rq = new HikvisionEventsPictureRq();
|
||||
rq.setPicUri(picUri);
|
||||
rq.setSvrIndexCode(svrIndexCode);
|
||||
map.put("faceUrl", saveToLocal(getHikvisionEventsPicture(rq, project.getArtemisConfigHost(), project.getArtemisConfigAppKey(), project.getArtemisConfigAppSecret())));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
workerAttendanceService.saveExternalPassRecord(map);
|
||||
}
|
||||
param.put("pageNo", param.getIntValue("pageNo") + 1);
|
||||
}
|
||||
}
|
||||
} while (total > 0);
|
||||
}
|
||||
workerAttendancePresenceService.addNowAllWorkerAttendancePresence(projectSn);
|
||||
}
|
||||
log.info("服务挂了主动获取门禁点事件的人员通行记录执行完成,startTime:{},endTime:{}", startTime, endTime);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试查询组织
|
||||
*
|
||||
|
||||
@ -2,6 +2,7 @@ package com.zhgd.xmgl.modules.worker.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
@ -1503,22 +1504,27 @@ public class WorkerInfoServiceImpl extends ServiceImpl<WorkerInfoMapper, WorkerI
|
||||
} else {
|
||||
workerInfo.setPersonType(1);
|
||||
}
|
||||
workerInfo.setNation(importInfo.get("*民族"));
|
||||
workerInfo.setPhoneNumber(importInfo.get("*联系电话"));
|
||||
workerInfo.setEmergentPerson(importInfo.get("*紧急联系人"));
|
||||
workerInfo.setEmergentPhone(importInfo.get("*紧急联系人电话"));
|
||||
workerInfo.setIssuingAuthorityForIdcard(importInfo.get("*签发机构"));
|
||||
workerInfo.setNativePlace(importInfo.get("*籍贯"));
|
||||
if ("".equals(importInfo.get("*身份证有效日期")) || "".equals(importInfo.get("*身份证有效日期"))) {
|
||||
workerInfo.setLongTerm(1);
|
||||
workerInfo.setNation(importInfo.get("民族"));
|
||||
workerInfo.setPhoneNumber(importInfo.get("联系电话"));
|
||||
workerInfo.setEmergentPerson(importInfo.get("紧急联系人"));
|
||||
workerInfo.setEmergentPhone(importInfo.get("紧急联系人电话"));
|
||||
workerInfo.setIssuingAuthorityForIdcard(importInfo.get("签发机构"));
|
||||
workerInfo.setNativePlace(importInfo.get("籍贯"));
|
||||
try {
|
||||
String idCardValidDate = importInfo.get("身份证有效日期");
|
||||
if (!"".equals(idCardValidDate)) {
|
||||
DateTime parse = DateUtil.parse(idCardValidDate);
|
||||
if (idCardValidDate.length() > 10) {
|
||||
workerInfo.setIdCardEndDate(idCardValidDate.substring(0, 10));
|
||||
} else {
|
||||
if (importInfo.get("*身份证有效日期").length() > 10) {
|
||||
workerInfo.setIdCardEndDate(importInfo.get("*身份证有效日期").substring(0, 10));
|
||||
} else {
|
||||
workerInfo.setIdCardEndDate(importInfo.get("*身份证有效日期"));
|
||||
workerInfo.setIdCardEndDate(idCardValidDate);
|
||||
}
|
||||
workerInfo.setLongTerm(0);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
workerInfo.setLongTerm(1);
|
||||
}
|
||||
if (workerInfo.getPersonType() == 2) {
|
||||
String department = importInfo.get("*部门/班组");
|
||||
if (!"".equals(department) && !"#N/A".equals(department)) {
|
||||
@ -1637,27 +1643,6 @@ public class WorkerInfoServiceImpl extends ServiceImpl<WorkerInfoMapper, WorkerI
|
||||
if (StringUtils.isBlank(personTypeStr)) {
|
||||
throw new OpenAlertException("有人员类型未填写");
|
||||
}
|
||||
if (StringUtils.isBlank(importInfo.get("*民族"))) {
|
||||
throw new OpenAlertException("有民族未填写");
|
||||
}
|
||||
if (StringUtils.isBlank(importInfo.get("*签发机构"))) {
|
||||
throw new OpenAlertException("有签发机构未填写");
|
||||
}
|
||||
if (StringUtils.isBlank(importInfo.get("*籍贯"))) {
|
||||
throw new OpenAlertException("有籍贯未填写");
|
||||
}
|
||||
if (StringUtils.isBlank(importInfo.get("*身份证有效日期"))) {
|
||||
throw new OpenAlertException("有身份证有效日期未填写");
|
||||
}
|
||||
if (StringUtils.isBlank(importInfo.get("*联系电话"))) {
|
||||
throw new OpenAlertException("有联系电话未填写");
|
||||
}
|
||||
if (StringUtils.isBlank(importInfo.get("*紧急联系人"))) {
|
||||
throw new OpenAlertException("有紧急联系人未填写");
|
||||
}
|
||||
if (StringUtils.isBlank(importInfo.get("*紧急联系人电话"))) {
|
||||
throw new OpenAlertException("有紧急联系人电话未填写");
|
||||
}
|
||||
if (StringUtils.isBlank(importInfo.get("*部门/班组"))) {
|
||||
throw new OpenAlertException("有部门/班组未填写");
|
||||
}
|
||||
|
||||
@ -184,34 +184,6 @@ public class IdCardUtils {
|
||||
return map;
|
||||
}
|
||||
|
||||
/* public static void main(String[] args) {
|
||||
String projectid = "0c9c4261fa80f43b2fdbc0103360d790";
|
||||
String domainname = "yunhaiyun";
|
||||
String username = "hqocr";
|
||||
String password = "hq123456";
|
||||
String endpoint = "cn-north-4";
|
||||
String imageurl = "http://119.29.110.58:9000/itbgp/file/3b097a48-7e46-407c-9e32-fc725204c485.jpg";
|
||||
String JSONSTR = getTokenStr(domainname, username, password, endpoint);
|
||||
String token = HttpRequest.post("https://iam." + endpoint + ".myhuaweicloud.com/v3/auth/tokens").body(JSONUtil.toJsonStr(JSONSTR)).execute().header("x-subject-token");
|
||||
log.info(token);
|
||||
String url = "https://ocr." + endpoint + ".myhuaweicloud.com/v2/" + projectid + "/ocr/id-card";
|
||||
Map<String, Object> param = new HashMap<>();
|
||||
param.put("url", imageurl);
|
||||
param.put("side", "front");
|
||||
String result = HttpRequest.post(url).header("x-auth-token", token).body(JSONUtil.toJsonStr(param)).execute().body();
|
||||
log.info(result);
|
||||
}*/
|
||||
/*public static void main(String[] args) {
|
||||
String username="hqocr";
|
||||
String domain="yunhaiyun";
|
||||
String password="hq123456";
|
||||
String projectid="0c9c4261fa80f43b2fdbc0103360d790";
|
||||
String imageurl="http://119.29.110.58:9000/itbgp/file/3b097a48-7e46-407c-9e32-fc725204c485.jpg";
|
||||
String JSONSTR=getTokenStr(domain,username,password,"cn-north-4");
|
||||
|
||||
String token = HttpRequest.postJson("https://iam.cn-north-4.myhuaweicloud.com/v3/auth/tokens").body(JSONUtil.toJsonStr(JSONSTR)).execute().header("x-subject-token");
|
||||
log.info(token);
|
||||
}*/
|
||||
public static void main(String[] args) {
|
||||
System.out.println(getBirthdayAgeSex(""));
|
||||
}
|
||||
|
||||
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user