feat:一级人员门禁设备对接
parent
94dffef375
commit
1dc1f2e7da
|
|
@ -72,7 +72,7 @@ public class PersonApplyController {
|
||||||
}
|
}
|
||||||
@ApiOperation("相关方、临时-人员申请审批")
|
@ApiOperation("相关方、临时-人员申请审批")
|
||||||
@PostMapping("/xgfPersonAudit")
|
@PostMapping("/xgfPersonAudit")
|
||||||
public Response xgfPersonAudit(@Validated @RequestBody XgfPersonApplyAuditCmd cmd) {
|
public Response xgfPersonAudit(@Validated @RequestBody XgfPersonApplyAuditCmd cmd) throws Exception {
|
||||||
if (!(cmd.getAuditFlag().equals(2) || cmd.getAuditFlag().equals(3))) {
|
if (!(cmd.getAuditFlag().equals(2) || cmd.getAuditFlag().equals(3))) {
|
||||||
throw new BizException("审批状态必须是通过或不通过");
|
throw new BizException("审批状态必须是通过或不通过");
|
||||||
}
|
}
|
||||||
|
|
@ -128,7 +128,7 @@ public class PersonApplyController {
|
||||||
}
|
}
|
||||||
@ApiOperation("股份,分公司-人员授权")
|
@ApiOperation("股份,分公司-人员授权")
|
||||||
@PostMapping("/authorization")
|
@PostMapping("/authorization")
|
||||||
public Response authorization(@RequestBody PersonAuthCmd cmd) {
|
public Response authorization(@RequestBody PersonAuthCmd cmd) throws Exception {
|
||||||
personApplyService.authorization(cmd);
|
personApplyService.authorization(cmd);
|
||||||
return Response.buildSuccess();
|
return Response.buildSuccess();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -79,6 +79,7 @@ public class ClosedAreaPersonApplyAddExe {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
System.out.println(Base64.encodeToString("130323199504189999"));
|
System.out.println(Base64.encodeToString("130323199504189999"));
|
||||||
System.out.println(Base64.decodeToString("MTMwMzIzMTk5NTA0MTg5OTk5"));
|
System.out.println(Base64.decodeToString("MTMwMzIzMTk5NTA0MTg5OTk5"));
|
||||||
|
System.out.println(Base64.decodeToString("MTMwMzU0MTk5NzA0MDQyMDEw"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,7 @@ public class PersonApplyAddExe {
|
||||||
BeanUtils.copyProperties(personApply, personApplyE);
|
BeanUtils.copyProperties(personApply, personApplyE);
|
||||||
personApplyE.setXgfApplyPersonId(build.getId());
|
personApplyE.setXgfApplyPersonId(build.getId());
|
||||||
personApplyE.setMkmjPermission((cmd.getPersonBelongType() == 1 || cmd.getPersonBelongType() == 2) ? 1 : 2);
|
personApplyE.setMkmjPermission((cmd.getPersonBelongType() == 1 || cmd.getPersonBelongType() == 2) ? 1 : 2);
|
||||||
personApplyE.setUserCard(Base64.encodeToString(personApply.getUserCard()));
|
personApplyE.setUserCard(personApply.getUserCard());
|
||||||
personApplyES.add(personApplyE);
|
personApplyES.add(personApplyE);
|
||||||
});
|
});
|
||||||
personApplyGateway.saveBatch(personApplyES);
|
personApplyGateway.saveBatch(personApplyES);
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ public class PersonApplyUpdateExe {
|
||||||
}
|
}
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
|
||||||
public void xgfPersonAudit(XgfPersonApplyAuditCmd cmd) {
|
public void xgfPersonAudit(XgfPersonApplyAuditCmd cmd) throws Exception {
|
||||||
XgfApplyPersonE build = XgfApplyPersonE.builder()
|
XgfApplyPersonE build = XgfApplyPersonE.builder()
|
||||||
.auditFlag(cmd.getAuditFlag())
|
.auditFlag(cmd.getAuditFlag())
|
||||||
.auditTime(DateUtil.date2Str(new Date()))
|
.auditTime(DateUtil.date2Str(new Date()))
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,7 @@ public class PersonApplyServiceImpl implements PersonApplyServiceI {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void xgfPersonAudit(XgfPersonApplyAuditCmd cmd) {
|
public void xgfPersonAudit(XgfPersonApplyAuditCmd cmd) throws Exception {
|
||||||
personApplyUpdateExe.xgfPersonAudit(cmd);
|
personApplyUpdateExe.xgfPersonAudit(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ public interface PersonApplyServiceI {
|
||||||
|
|
||||||
PageResponse<PersonApplyCO> tmpPersonApplyH5List(XgfApplyPersonPageQry qry);
|
PageResponse<PersonApplyCO> tmpPersonApplyH5List(XgfApplyPersonPageQry qry);
|
||||||
|
|
||||||
void xgfPersonAudit(XgfPersonApplyAuditCmd cmd);
|
void xgfPersonAudit(XgfPersonApplyAuditCmd cmd) throws Exception;
|
||||||
|
|
||||||
PageResponse<PersonCountCO> personnelVehicleManagementList(PersonCountPageQry qry);
|
PageResponse<PersonCountCO> personnelVehicleManagementList(PersonCountPageQry qry);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -145,29 +145,45 @@ public class PersonApplyGatewayImpl implements PersonApplyGateway {
|
||||||
ArrayList<JSONObject> waitEditUser = new ArrayList<>();
|
ArrayList<JSONObject> waitEditUser = new ArrayList<>();
|
||||||
ArrayList<String> dockEdUserCards = new ArrayList<>();
|
ArrayList<String> dockEdUserCards = new ArrayList<>();
|
||||||
JSONArray mkmjUserInfoByUserCard = onePersonUtil.getMkmjUserInfoByUserCard(new ArrayList<>(userCardHashSet));
|
JSONArray mkmjUserInfoByUserCard = onePersonUtil.getMkmjUserInfoByUserCard(new ArrayList<>(userCardHashSet));
|
||||||
|
HashMap<String, JSONObject> mjDeviceHashMap = new HashMap<>();
|
||||||
for (int i = 0; i < mkmjUserInfoByUserCard.size(); i++) {
|
for (int i = 0; i < mkmjUserInfoByUserCard.size(); i++) {
|
||||||
JSONObject o = mkmjUserInfoByUserCard.getJSONObject(i);
|
JSONObject jsonObject = mkmjUserInfoByUserCard.getJSONObject(i);
|
||||||
String str = o.getStr("paperNumber");
|
mjDeviceHashMap.put(jsonObject.getStr("paperNumber"), jsonObject);
|
||||||
JSONObject entries = userHashMap.get(str);
|
|
||||||
if (userCardHashSet.add(str)) {
|
|
||||||
// 要新增的
|
|
||||||
waitSaveUser.add(entries);
|
|
||||||
} else {
|
|
||||||
// 已存在 看下今天是不是在 申请的时间里
|
|
||||||
long validStartTime = DateUtil.fomatDate(entries.getStr("validStartTime")+ "00:00:00","yyyy-MM-dd HH:mm:ss").getTime();
|
|
||||||
long validEndTime = DateUtil.fomatDate(entries.getStr("validEndTime")+ "23:59:59","yyyy-MM-dd HH:mm:ss").getTime();
|
|
||||||
long time = new Date().getTime();
|
|
||||||
if (time >= validStartTime && time <= validEndTime) {
|
|
||||||
// 今天在申请的时间里 需要修改
|
|
||||||
JSONObject entries1 = new JSONObject();
|
|
||||||
entries1.set("personId", o.getLong("id"));
|
|
||||||
entries1.set("validStartTime", DateUtil.date2Str(new Date(),"yyyy-MM-dd")+ "00:00:00");
|
|
||||||
entries1.set("validEndTime", DateUtil.date2Str(new Date(),"yyyy-MM-dd")+ "23:59:59");
|
|
||||||
waitEditUser.add(entries1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
dockEdUserCards.add(str);
|
|
||||||
}
|
}
|
||||||
|
// for (String s : userHashMap.keySet()) {
|
||||||
|
// JSONObject entries = userHashMap.get(s);
|
||||||
|
// if (mjDeviceHashMap.containsKey(s)) {
|
||||||
|
// JSONObject o = mjDeviceHashMap.get(s);
|
||||||
|
// // 已存在 看下今天是不是在 申请的时间里
|
||||||
|
// long validStartTime = DateUtil.fomatDate(entries.getStr("validStartTime")+ "00:00:00","yyyy-MM-dd HH:mm:ss").getTime();
|
||||||
|
// long validEndTime = DateUtil.fomatDate(entries.getStr("validEndTime")+ "23:59:59","yyyy-MM-dd HH:mm:ss").getTime();
|
||||||
|
// long time = new Date().getTime();
|
||||||
|
// if (time >= validStartTime && time <= validEndTime) {
|
||||||
|
// // 今天在申请的时间里 需要修改
|
||||||
|
// JSONObject entries1 = new JSONObject();
|
||||||
|
// entries1.set("personId", o.getLong("id"));
|
||||||
|
// entries1.set("validStartTime"
|
||||||
|
// , DateUtil.date2Str(new Date(),"yyyy-MM-dd")+ "00:00:00");
|
||||||
|
// entries1.set("validEndTime", DateUtil.date2Str(new Date(),"yyyy-MM-dd")+ "23:59:59");
|
||||||
|
// waitEditUser.add(entries1);
|
||||||
|
// }else {
|
||||||
|
// // 新增的
|
||||||
|
// waitSaveUser.add(entries);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// for (int i = 0; i < mkmjUserInfoByUserCard.size(); i++) {
|
||||||
|
// JSONObject o = mkmjUserInfoByUserCard.getJSONObject(i);
|
||||||
|
// String str = o.getStr("paperNumber");
|
||||||
|
// JSONObject entries = userHashMap.get(str);
|
||||||
|
// if (userCardHashSet.add(str)) {
|
||||||
|
// // 要新增的
|
||||||
|
// waitSaveUser.add(entries);
|
||||||
|
// } else {
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// dockEdUserCards.add(str);
|
||||||
|
// }
|
||||||
if (!waitSaveUser.isEmpty()) {
|
if (!waitSaveUser.isEmpty()) {
|
||||||
onePersonUtil.batchSaveUser(waitSaveUser);
|
onePersonUtil.batchSaveUser(waitSaveUser);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@ import com.jjb.saas.framework.job.Job;
|
||||||
import com.jjb.saas.framework.job.annotation.JobRegister;
|
import com.jjb.saas.framework.job.annotation.JobRegister;
|
||||||
import com.xxl.job.core.biz.model.ReturnT;
|
import com.xxl.job.core.biz.model.ReturnT;
|
||||||
import com.xxl.job.core.handler.annotation.XxlJob;
|
import com.xxl.job.core.handler.annotation.XxlJob;
|
||||||
import com.zcloud.primeport.persistence.repository.XgfApplyPersonRepository;
|
|
||||||
import com.zcloud.primeport.plan.mjDevice.OnePersonUtil;
|
import com.zcloud.primeport.plan.mjDevice.OnePersonUtil;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
|
@ -18,7 +17,7 @@ public class OneLevelUserXxlJon implements Job {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@JobRegister(cron = "0 14 0 * * ?", jobDesc = "口门定时任务,每日12点14进行当日可进门人员推送", triggerStatus = 1)
|
@JobRegister(cron = "0 14 0 * * ?", jobDesc = "口门定时任务,每日12点14进行当日可进门人员推送", triggerStatus = 1)
|
||||||
@XxlJob("com.zcloud.plan.VehicleExpiredExpirationXxlJob")
|
@XxlJob("com.zcloud.plan.OneLevelUserDockXxlJon")
|
||||||
public ReturnT<String> execute(String param) {
|
public ReturnT<String> execute(String param) {
|
||||||
// 相关方、临时访客 每日授权 门禁
|
// 相关方、临时访客 每日授权 门禁
|
||||||
onePersonUtil.execute();
|
onePersonUtil.execute();
|
||||||
|
|
|
||||||
|
|
@ -1,26 +1,14 @@
|
||||||
package com.zcloud.primeport.plan.mjDevice;
|
package com.zcloud.primeport.plan.mjDevice;
|
||||||
|
|
||||||
import cn.hutool.core.io.IoUtil;
|
|
||||||
import cn.hutool.http.HttpRequest;
|
|
||||||
import cn.hutool.http.HttpResponse;
|
|
||||||
import cn.hutool.json.JSONArray;
|
import cn.hutool.json.JSONArray;
|
||||||
import cn.hutool.json.JSONObject;
|
import cn.hutool.json.JSONObject;
|
||||||
import com.alibaba.fastjson.JSON;
|
|
||||||
import com.alibaba.fastjson.TypeReference;
|
|
||||||
import com.zcloud.gbscommon.dahuaDevice.DaHuaDeviceCommon;
|
import com.zcloud.gbscommon.dahuaDevice.DaHuaDeviceCommon;
|
||||||
import com.zcloud.gbscommon.dahuaDevice.DhuaConfig;
|
import com.zcloud.gbscommon.dahuaDevice.DhuaConfig;
|
||||||
import com.zcloud.gbscommon.utils.DateUtil;
|
import com.zcloud.gbscommon.utils.DateUtil;
|
||||||
import com.zcloud.primeport.persistence.dataobject.VehicleDockLogDO;
|
|
||||||
import com.zcloud.primeport.persistence.dataobject.XgfApplyPersonDO;
|
import com.zcloud.primeport.persistence.dataobject.XgfApplyPersonDO;
|
||||||
import com.zcloud.primeport.persistence.repository.VehicleApplyRepository;
|
|
||||||
import com.zcloud.primeport.persistence.repository.VehicleDockLogRepository;
|
|
||||||
import com.zcloud.primeport.persistence.repository.XgfApplyPersonRepository;
|
import com.zcloud.primeport.persistence.repository.XgfApplyPersonRepository;
|
||||||
import com.zcloud.primeport.plan.mjDevice.dto.OneLevelCarBlackDto;
|
|
||||||
import com.zcloud.primeport.plan.mjDevice.dto.OneLevelCarRemoveDto;
|
|
||||||
import com.zcloud.primeport.plan.mjDevice.dto.OneLevelCarSaveDto;
|
|
||||||
import jodd.util.Base64;
|
import jodd.util.Base64;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
|
@ -176,16 +164,24 @@ public class OnePersonUtil {
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
OnePersonUtil onePersonUtil = new OnePersonUtil();
|
OnePersonUtil onePersonUtil = new OnePersonUtil();
|
||||||
// JSONArray mkmjUserInfoByUserCard = onePersonUtil.getMkmjUserInfoByUserCard(Arrays.asList("360425198208131948"));
|
System.out.println(onePersonUtil.getDaHuaDeviceCommon().getToken());
|
||||||
// JSONArray mkmjUserInfoByUserCard2 = onePersonUtil.getMkmjUserInfoByUserCard(Arrays.asList("160425198208131948"));
|
JSONArray userListByUserCard = onePersonUtil.getDaHuaDeviceCommon().getUserListByUserCard(Arrays.asList("61010519900320002X", "130324199407282116")).getJSONObject("data").getJSONArray("pageData");
|
||||||
//// onePersonUtil.freezeByUserCard("360425198208131948", "1");
|
|
||||||
// System.out.println(mkmjUserInfoByUserCard);
|
|
||||||
// System.out.println(mkmjUserInfoByUserCard2);
|
|
||||||
//
|
|
||||||
// JSONArray batchGenerateId = onePersonUtil.getDaHuaDeviceCommon().getBatchGenerateId(10);
|
|
||||||
|
|
||||||
|
System.out.println();
|
||||||
|
String base64 = imageToBase64("C:\\Users\\Administrator\\Desktop\\myface.jpg");
|
||||||
|
String dataUrl = "data:image/jpeg;base64," + base64;
|
||||||
|
System.out.println(dataUrl);
|
||||||
}
|
}
|
||||||
|
public static String imageToBase64(String imagePath) throws IOException {
|
||||||
|
File file = new File(imagePath);
|
||||||
|
byte[] imageBytes = new byte[(int) file.length()];
|
||||||
|
|
||||||
|
try (FileInputStream fis = new FileInputStream(file)) {
|
||||||
|
fis.read(imageBytes);
|
||||||
|
}
|
||||||
|
|
||||||
|
return java.util.Base64.getEncoder().encodeToString(imageBytes);
|
||||||
|
}
|
||||||
public void execute() {
|
public void execute() {
|
||||||
if (!dockFlag.equals(1)) return;
|
if (!dockFlag.equals(1)) return;
|
||||||
List<XgfApplyPersonDO> dataList = xgfApplyPersonRepository.listTodayHasPort();
|
List<XgfApplyPersonDO> dataList = xgfApplyPersonRepository.listTodayHasPort();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue