feat:临时访客一级口门申请
parent
a12523db72
commit
a033bba12b
|
|
@ -63,6 +63,9 @@
|
||||||
<inspection_tool class="AlibabaUnsupportedExceptionWithModifyAsList" enabled="true" level="WARNING" enabled_by_default="true" />
|
<inspection_tool class="AlibabaUnsupportedExceptionWithModifyAsList" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
<inspection_tool class="AlibabaUseQuietReferenceNotation" enabled="true" level="WARNING" enabled_by_default="true" />
|
<inspection_tool class="AlibabaUseQuietReferenceNotation" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
<inspection_tool class="AlibabaUseRightCaseForDateFormat" enabled="true" level="WARNING" enabled_by_default="true" />
|
<inspection_tool class="AlibabaUseRightCaseForDateFormat" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="AutoCloseableResource" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<option name="METHOD_MATCHER_CONFIG" value="java.util.Formatter,format,java.io.Writer,append,com.google.common.base.Preconditions,checkNotNull,org.hibernate.Session,close,java.io.PrintWriter,printf,java.io.PrintStream,printf,java.lang.foreign.Arena,ofAuto,java.lang.foreign.Arena,global,cn.hutool.http.HttpRequest,execute" />
|
||||||
|
</inspection_tool>
|
||||||
<inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
|
<inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
<inspection_tool class="MapOrSetKeyShouldOverrideHashCodeEquals" enabled="true" level="WARNING" enabled_by_default="true" />
|
<inspection_tool class="MapOrSetKeyShouldOverrideHashCodeEquals" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
<inspection_tool class="SpringJavaInjectionPointsAutowiringInspection" enabled="false" level="ERROR" enabled_by_default="false" />
|
<inspection_tool class="SpringJavaInjectionPointsAutowiringInspection" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ public class ClosedTmpApplyController {
|
||||||
stringObjectHashMap.put("value", cmd.getHgAuthAreaName());
|
stringObjectHashMap.put("value", cmd.getHgAuthAreaName());
|
||||||
hashMaps.add(stringObjectHashMap);
|
hashMaps.add(stringObjectHashMap);
|
||||||
HashMap<String, Object> stringObjectHashMap2 = new HashMap<>();
|
HashMap<String, Object> stringObjectHashMap2 = new HashMap<>();
|
||||||
stringObjectHashMap2.put("area", stringObjectHashMap);
|
stringObjectHashMap2.put("area", hashMaps);
|
||||||
xgf.setGateLevelAuthArea(JSON.toJSONString(stringObjectHashMap2));
|
xgf.setGateLevelAuthArea(JSON.toJSONString(stringObjectHashMap2));
|
||||||
xgf.setAuditCorpId(cmd.getAuditPersonCorpId());
|
xgf.setAuditCorpId(cmd.getAuditPersonCorpId());
|
||||||
xgf.setAuditCorpName(cmd.getAuditPersonCorpName());
|
xgf.setAuditCorpName(cmd.getAuditPersonCorpName());
|
||||||
|
|
|
||||||
|
|
@ -113,6 +113,10 @@ public class PersonApplyAddExe {
|
||||||
personApplyAddCmdExt.setUserFaceUrl(cmd.getUserFaceUrl());
|
personApplyAddCmdExt.setUserFaceUrl(cmd.getUserFaceUrl());
|
||||||
personApplyAddCmdExt.setUserCard(cmd.getUserCard());
|
personApplyAddCmdExt.setUserCard(cmd.getUserCard());
|
||||||
personApplyAddCmdExt.setUserPhone(cmd.getUserPhone());
|
personApplyAddCmdExt.setUserPhone(cmd.getUserPhone());
|
||||||
|
personApplyAddCmdExt.setVisitStartTime(DateUtil.date2Str(new Date()));
|
||||||
|
personApplyAddCmdExt.setVisitEndTime("2099-12-31 23:59:59");
|
||||||
|
personApplyAddCmdExt.setExpiredExpiration("2");
|
||||||
|
personApplyAddCmdExt.setUserPhone(cmd.getUserPhone());
|
||||||
xgfPersonApplyAddCmd.setPersonApplyList(new ArrayList<XgfPersonApplyAddCmd.PersonApplyAddCmdExt>() {{
|
xgfPersonApplyAddCmd.setPersonApplyList(new ArrayList<XgfPersonApplyAddCmd.PersonApplyAddCmdExt>() {{
|
||||||
add(personApplyAddCmdExt);
|
add(personApplyAddCmdExt);
|
||||||
}});
|
}});
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ package com.zcloud.primeport.command.query;
|
||||||
|
|
||||||
import com.alibaba.cola.dto.PageResponse;
|
import com.alibaba.cola.dto.PageResponse;
|
||||||
import com.alibaba.cola.dto.SingleResponse;
|
import com.alibaba.cola.dto.SingleResponse;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.jjb.saas.framework.auth.utils.AuthContext;
|
import com.jjb.saas.framework.auth.utils.AuthContext;
|
||||||
import com.zcloud.gbscommon.utils.PageQueryHelper;
|
import com.zcloud.gbscommon.utils.PageQueryHelper;
|
||||||
import com.zcloud.primeport.command.convertor.PersonApplyCoConvertor;
|
import com.zcloud.primeport.command.convertor.PersonApplyCoConvertor;
|
||||||
|
|
@ -125,5 +126,11 @@ public class PersonApplyQueryExe {
|
||||||
public SingleResponse<PersonApplyCO> xgfPersonPermissionsInfo(Long id) {
|
public SingleResponse<PersonApplyCO> xgfPersonPermissionsInfo(Long id) {
|
||||||
return SingleResponse.of(personApplyCoConvertor.converDOToCO(personApplyRepository.xgfPersonPermissionsInfo(id)));
|
return SingleResponse.of(personApplyCoConvertor.converDOToCO(personApplyRepository.xgfPersonPermissionsInfo(id)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public PersonApplyCO getInfoByUserId(Long userId) {
|
||||||
|
QueryWrapper<PersonApplyDO> objectQueryWrapper = new QueryWrapper<>();
|
||||||
|
objectQueryWrapper.eq("employee_person_user_id", userId);
|
||||||
|
return personApplyCoConvertor.converDOToCO(personApplyRepository.getOne(objectQueryWrapper));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ public class PersonApplyServiceImpl implements PersonApplyServiceI {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Long xgfPersonSave(XgfPersonApplyAddCmd cmd) {
|
public Long xgfPersonSave(XgfPersonApplyAddCmd cmd) {
|
||||||
return personApplyAddExe.xgfPersonSave(cmd);
|
return personApplyAddExe.xgfPersonSave(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -90,12 +90,20 @@ public class PersonApplyServiceImpl implements PersonApplyServiceI {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void authorization(PersonAuthCmd cmd) {
|
public void authorization(PersonAuthCmd cmd) {
|
||||||
if (cmd.getXgfApplyPersonId() != null) {
|
// 查一下这个人 有没有 授权,
|
||||||
// 修改
|
PersonApplyCO co = personApplyQueryExe.getInfoByUserId(cmd.getUserId());
|
||||||
personApplyUpdateExe.authorization(cmd.getApplyPersonId(), cmd.getXgfApplyPersonId(), cmd.getMkmjPermission(), cmd.getGateLevelAuthArea());
|
if (cmd.getMkmjPermission().equals(1)) {
|
||||||
|
// 开启门禁
|
||||||
|
if (co != null) {
|
||||||
|
personApplyUpdateExe.authorization(co.getId(), co.getXgfApplyPersonId(), cmd.getMkmjPermission(), cmd.getGateLevelAuthArea());
|
||||||
|
} else {
|
||||||
|
personApplyAddExe.authorization(cmd);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// 新增 就是股份,企业的。
|
// 关闭门禁
|
||||||
personApplyAddExe.authorization(cmd);
|
if (co != null) {
|
||||||
|
personApplyUpdateExe.authorization(co.getId(), co.getXgfApplyPersonId(), cmd.getMkmjPermission(), cmd.getGateLevelAuthArea());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -96,6 +96,12 @@ public class XgfPersonApplyAddCmd extends Command {
|
||||||
@ApiModelProperty(value = "身份证号码", name = "userCard")
|
@ApiModelProperty(value = "身份证号码", name = "userCard")
|
||||||
@NotEmpty(message = "身份证号码不能为空")
|
@NotEmpty(message = "身份证号码不能为空")
|
||||||
private String userCard;
|
private String userCard;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "访问起始时间", name = "visitStartTime")
|
||||||
|
private String visitStartTime;
|
||||||
|
@ApiModelProperty(value = "访问结束时间", name = "visitEndTime")
|
||||||
|
private String visitEndTime;
|
||||||
|
private String expiredExpiration;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,5 +19,6 @@ public interface PersonApplyRepository extends BaseRepository<PersonApplyDO> {
|
||||||
PageResponse<PersonApplyDO> xgfPersonnelVehicleManagementList(Map<String, Object> parmas);
|
PageResponse<PersonApplyDO> xgfPersonnelVehicleManagementList(Map<String, Object> parmas);
|
||||||
|
|
||||||
PersonApplyDO xgfPersonPermissionsInfo(Long id);
|
PersonApplyDO xgfPersonPermissionsInfo(Long id);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -72,5 +72,7 @@ public class PersonApplyRepositoryImpl extends BaseRepositoryImpl<PersonApplyMap
|
||||||
public PersonApplyDO xgfPersonPermissionsInfo(Long id) {
|
public PersonApplyDO xgfPersonPermissionsInfo(Long id) {
|
||||||
return personApplyMapper.xgfPersonPermissionsInfo(id);
|
return personApplyMapper.xgfPersonPermissionsInfo(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -284,8 +284,8 @@ public class OauthUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
System.out.println(RSAUtils.encrypt("3093164@qzs"
|
System.out.println(RSAUtils.encrypt("qinan@202604"
|
||||||
,"MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCzId+G65rq/ZSSKjOtd8VwIPdgDsz08RZK5fG/d2ZeIhg2P44kWvtZSSp7RPR/3sJdx9w0PzdQg14Sn6jn+eGfJIQsbs8af9QIqDVlv7M7eeoEabzRgU+4SBxo8dvokLMnNw3PUiZFjhchyLctlERoeTZ5rH6qdz/DtvEi9ypzVQIDAQAB"));
|
,"MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDM7pxra9uPw/0uFpEgnJXkWTYan9FTbWjNhDiOKogGageqGBjUnEcDpyCL9V8p6xl/gBTPHAJz4s29gWkqnvGiCFekKBCkEgfu4qgSQaMrDywK38C3ydHx/iCJ2u31HE2ULunO/LXQqVK4uUSGyX63Jy9Q/0rYwDUSsoov85FZMQIDAQAB"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,144 @@
|
||||||
|
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.JSONObject;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.TypeReference;
|
||||||
|
import com.zcloud.gbscommon.dahuaDevice.DaHuaDeviceCommon;
|
||||||
|
import com.zcloud.gbscommon.dahuaDevice.DhuaConfig;
|
||||||
|
import com.zcloud.primeport.persistence.dataobject.VehicleDockLogDO;
|
||||||
|
import com.zcloud.primeport.persistence.repository.VehicleDockLogRepository;
|
||||||
|
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 org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 一级人员门禁对接 前缀
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
public class OnePersonUtil {
|
||||||
|
@Value("${kmmj.dockflag}")
|
||||||
|
private Integer dockFlag;
|
||||||
|
@Value("${oneLevelPerson.prefix}")
|
||||||
|
private String prefix;
|
||||||
|
private static String prefix2 = "https://skqhdg.porthebei.com:9008/yjkmRy/";
|
||||||
|
private static String username = "shuangkong";
|
||||||
|
private static String password = "qinan@202604";
|
||||||
|
private static String clientId = "mkmj_management";
|
||||||
|
private static String clientSecret = "5ef82f7c-9926-46a3-8d07-136fd054849c";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 跟据身份证号码进行用户对接
|
||||||
|
*/
|
||||||
|
public void dockLongTermUserByUserCardAndFaceImg(String userCard, String userUid, String username, String userFaceImages, String visitStartTime, String visitEndTime) throws Exception {
|
||||||
|
DaHuaDeviceCommon daHuaDeviceCommon = getDaHuaDeviceCommon();
|
||||||
|
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", generateId);
|
||||||
|
userInfo.set("validStartTime", visitStartTime);
|
||||||
|
userInfo.set("validEndTime", visitEndTime);
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 跟据身份证号码进行用户门禁有效期刷新
|
||||||
|
*/
|
||||||
|
public void expirationDateRefreshedUserCard(String userCard, String visitStartTime, String visitEndTime) throws Exception {
|
||||||
|
JSONObject entries = new JSONObject();
|
||||||
|
entries.set("userCard", userCard);
|
||||||
|
entries.set("visitStartTime", visitStartTime);
|
||||||
|
entries.set("visitEndTime", visitEndTime);
|
||||||
|
expirationDateRefreshedUserCard(Arrays.asList(entries));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量跟据身份证号码进行用户门禁有效期刷新
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public void expirationDateRefreshedUserCard(List<JSONObject> userList) throws Exception {
|
||||||
|
DaHuaDeviceCommon daHuaDeviceCommon = getDaHuaDeviceCommon();
|
||||||
|
List<String> userCard = userList.stream().map(item -> item.getStr("userCard")).collect(Collectors.toList());
|
||||||
|
Map<String, JSONObject> userCardMap = userList.stream().collect(Collectors.toMap(item -> item.getStr("userCard"), item -> item, (existing, replacement) -> replacement));
|
||||||
|
JSONArray userListByUserCardList = daHuaDeviceCommon.getUserListByUserCard(userCard).getJSONObject("data").getJSONArray("pageData");
|
||||||
|
List<JSONObject> userDataList = new ArrayList<>();
|
||||||
|
for (int i = 0; i < userListByUserCardList.size(); i++) {
|
||||||
|
JSONObject item = userListByUserCardList.getJSONObject(i);
|
||||||
|
JSONObject entries = new JSONObject();
|
||||||
|
entries.set("id", item.get("id", Long.class));
|
||||||
|
JSONObject userCardJsonObj = userCardMap.get(item.getStr("paperNumber"));
|
||||||
|
entries.set("visitStartTime", userCardJsonObj.getStr("visitStartTime"));
|
||||||
|
entries.set("visitEndTime", userCardJsonObj.getStr("visitEndTime"));
|
||||||
|
userDataList.add(entries);
|
||||||
|
}
|
||||||
|
if (!userDataList.isEmpty()) {
|
||||||
|
expirationDateBatchRefreshedUserCardList(userDataList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 跟据身份证号码进行用户门禁有效期刷新
|
||||||
|
*/
|
||||||
|
private void expirationDateBatchRefreshedUserCardList(List<JSONObject> dataList) throws Exception {
|
||||||
|
DaHuaDeviceCommon daHuaDeviceCommon = getDaHuaDeviceCommon();
|
||||||
|
daHuaDeviceCommon.updatePersonValidity(dataList);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 跟据身份证号码进行用户门禁开启与关闭
|
||||||
|
* 1:解冻 2:冻结
|
||||||
|
* (1:有 2:无)
|
||||||
|
*/
|
||||||
|
public void freezeByUserCard(String userCard, String mkmjPermission) throws Exception {
|
||||||
|
DaHuaDeviceCommon daHuaDeviceCommon = getDaHuaDeviceCommon();
|
||||||
|
JSONObject userByUserCard = daHuaDeviceCommon.getUserByUserCard(userCard).getJSONObject("data");
|
||||||
|
daHuaDeviceCommon.updatePersonStatus(userByUserCard.getLong("id"), Integer.valueOf(mkmjPermission));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public DaHuaDeviceCommon getDaHuaDeviceCommon() {
|
||||||
|
DhuaConfig dhuaConfig = new DhuaConfig();
|
||||||
|
dhuaConfig.setPrefix(prefix2);
|
||||||
|
dhuaConfig.setClientId(clientId);
|
||||||
|
dhuaConfig.setClientSecret(clientSecret);
|
||||||
|
dhuaConfig.setUsername(username);
|
||||||
|
dhuaConfig.setPassword(password);
|
||||||
|
return new DaHuaDeviceCommon(dhuaConfig);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) throws Exception {
|
||||||
|
OnePersonUtil onePersonUtil = new OnePersonUtil();
|
||||||
|
onePersonUtil.freezeByUserCard("360425198208131948", "1");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
package com.zcloud.primeport.plan.mjDevice.dto;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
public enum PersonTypeEnum {
|
||||||
|
PERSON_TYPE1(0,"普通用户"),
|
||||||
|
PERSON_TYPE2(1, "黑名单用户"),
|
||||||
|
PERSON_TYPE3(2, "来宾用户"),
|
||||||
|
PERSON_TYPE4(3, "巡逻用户"),
|
||||||
|
PERSON_TYPE5(4, "VIP用户"),
|
||||||
|
PERSON_TYPE6(5, "其他用户"),
|
||||||
|
PERSON_TYPE7(6, "自定义用户1"),
|
||||||
|
PERSON_TYPE8(7, "自定义用户2");
|
||||||
|
private Integer code;
|
||||||
|
private String typeName;
|
||||||
|
|
||||||
|
PersonTypeEnum(Integer code, String typeName) {
|
||||||
|
this.code = code;
|
||||||
|
this.typeName = typeName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PersonTypeEnum setCode(Integer code) {
|
||||||
|
this.code = code;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PersonTypeEnum setTypeName(String typeName) {
|
||||||
|
this.typeName = typeName;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -117,7 +117,7 @@
|
||||||
u.id user_id,
|
u.id user_id,
|
||||||
u.phone user_phone,
|
u.phone user_phone,
|
||||||
u.name user_name,
|
u.name user_name,
|
||||||
u.user_id_card ,
|
u.user_id_card user_card,
|
||||||
d.id department_id,
|
d.id department_id,
|
||||||
d.`name` department_name,
|
d.`name` department_name,
|
||||||
p.post_name,
|
p.post_name,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue