feat:接入海康二级口门进出记录
parent
74b7259593
commit
145235c9de
|
|
@ -35,6 +35,8 @@ import java.util.stream.Collectors;
|
||||||
public class TwoPersonUtil {
|
public class TwoPersonUtil {
|
||||||
@Resource
|
@Resource
|
||||||
private ClosedAreaPersonApplyRepository closedAreaPersonApplyRepository;
|
private ClosedAreaPersonApplyRepository closedAreaPersonApplyRepository;
|
||||||
|
@Resource
|
||||||
|
private OnePersonUtil onePersonUtil;
|
||||||
@DubboReference
|
@DubboReference
|
||||||
private ZcloudUserFacade zcloudUserFacade;
|
private ZcloudUserFacade zcloudUserFacade;
|
||||||
|
|
||||||
|
|
@ -79,12 +81,54 @@ public class TwoPersonUtil {
|
||||||
dockUserReal(userList);
|
dockUserReal(userList);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void dockOneLevelPerson(String userCard) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
|
TwoPersonUtil twoPersonUtil = new TwoPersonUtil();
|
||||||
|
// twoPersonUtil.dockOneLevelPerson("130324199407282111");
|
||||||
|
// twoPersonUtil.dockOneLevelPerson("130324199407282112");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void dockOneLevelPerson(String userCard, String userFaceImages, String userUid, String userName) throws Exception {
|
||||||
DaHuaDeviceCommon daHuaDeviceCommon = getDaHuaDeviceCommon();
|
DaHuaDeviceCommon daHuaDeviceCommon = getDaHuaDeviceCommon();
|
||||||
JSONObject userByUserCard = daHuaDeviceCommon.getUserByUserCard(userCard);
|
JSONObject userByUserCard = daHuaDeviceCommon.getUserByUserCard(userCard).getJSONObject("data");
|
||||||
|
if (userByUserCard.isEmpty()) {
|
||||||
|
// 没有这个用户,哪么直接加新人
|
||||||
|
Long generateId = daHuaDeviceCommon.getGenerateId();
|
||||||
|
JSONObject userInfo = new JSONObject();
|
||||||
|
JSONObject fileInfo = new JSONObject();
|
||||||
|
List<JSONObject> dataList = new ArrayList();
|
||||||
|
fileInfo.set("type", 3);
|
||||||
|
fileInfo.set("index", 1);
|
||||||
|
fileInfo.set("path", userFaceImages);
|
||||||
|
dataList.add(fileInfo);
|
||||||
|
userInfo.set("id", generateId);
|
||||||
|
userInfo.set("personBiosignatures", dataList);
|
||||||
|
userInfo.set("validStartTime", DateUtil.date2Str(new Date(), "yyyy-MM-dd") + "00:00:00");
|
||||||
|
userInfo.set("validEndTime", DateUtil.date2Str(new Date(), "yyyy-MM-dd") + "23:59:59");
|
||||||
|
userInfo.set("code", userUid);
|
||||||
|
userInfo.set("name", userName);
|
||||||
|
userInfo.set("paperType", 111);
|
||||||
|
userInfo.set("paperNumber", userCard);
|
||||||
|
userInfo.set("departmentId", 1L);
|
||||||
|
userInfo.set("personType", 0);
|
||||||
|
daHuaDeviceCommon.saveUser(userInfo);
|
||||||
|
} else {
|
||||||
|
// 一级门禁的长期人 一般都有权限,临时、相关方的不一定有。
|
||||||
|
userByUserCard.getStr("validStartTime");
|
||||||
|
userByUserCard.getStr("validEndTime");
|
||||||
|
// true=在范围内,false=不在范围内
|
||||||
|
boolean between = DateUtil.isBetween(DateUtil.date2Str(new Date()), userByUserCard.getStr("validStartTime"),
|
||||||
|
userByUserCard.getStr("validEndTime"), "yyyy-MM-dd HH:mm:ss");
|
||||||
|
if (!between) {
|
||||||
|
onePersonUtil.expirationDateRefreshedUserCard(userCard,DateUtil.date2Str(new Date(), "yyyy-MM-dd") + "00:00:00",DateUtil.date2Str(new Date(), "yyyy-MM-dd") + "23:59:59");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (userByUserCard.isEmpty()) System.out.println(userByUserCard);
|
||||||
|
if (userByUserCard.isEmpty()) System.out.println(userByUserCard);
|
||||||
// 如果这个人存在 哪么 看一下今天有没有时间
|
// 如果这个人存在 哪么 看一下今天有没有时间
|
||||||
// 这个人不存在 新增这个人
|
// 这个人不存在 新增这个人
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void dockUserReal(List<TwoLevelUser> userList) {
|
protected void dockUserReal(List<TwoLevelUser> userList) {
|
||||||
userList.forEach(item -> {
|
userList.forEach(item -> {
|
||||||
List<TwoLevelUser> u = new ArrayList<>();
|
List<TwoLevelUser> u = new ArrayList<>();
|
||||||
|
|
@ -198,12 +242,5 @@ public class TwoPersonUtil {
|
||||||
return new DaHuaDeviceCommon(new DhuaConfig(dockFlag, prefix, username, password, clientId, clientSecret));
|
return new DaHuaDeviceCommon(new DhuaConfig(dockFlag, prefix, username, password, clientId, clientSecret));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
|
||||||
JSONArray objects = new JSONArray();
|
|
||||||
JSONArray objects1 = new JSONArray("");
|
|
||||||
JSONArray objects3 = new JSONArray(null);
|
|
||||||
|
|
||||||
System.out.println(objects1);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue