feat:临时访客一级口门申请

koumen
dearLin 2026-04-17 15:35:07 +08:00
parent a033bba12b
commit 6e331ede6f
12 changed files with 41 additions and 8 deletions

View File

@ -115,7 +115,6 @@ public class PersonApplyAddExe {
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>() {{
add(personApplyAddCmdExt);

View File

@ -2,6 +2,7 @@ package com.zcloud.primeport.command;
import com.alibaba.cola.exception.BizException;
import com.zcloud.gbscommon.utils.DateUtil;
import com.zcloud.gbscommon.utils.Tools;
import com.zcloud.primeport.domain.gateway.MkmjGateGateway;
import com.zcloud.primeport.domain.gateway.PersonApplyGateway;
import com.zcloud.primeport.domain.gateway.XgfApplyPersonGateway;
@ -61,7 +62,9 @@ public class PersonApplyUpdateExe {
personApplyGateway.update(personApplyE);
XgfApplyPersonE xgfApplyPersonE = new XgfApplyPersonE();
xgfApplyPersonE.setId(XgfApplyPersonId);
if (Tools.notEmpty(gate)) {
xgfApplyPersonE.setGateLevelAuthArea(gate);
}
xgfApplyPersonGateway.update(xgfApplyPersonE);
}

View File

@ -130,7 +130,8 @@ public class PersonApplyQueryExe {
public PersonApplyCO getInfoByUserId(Long userId) {
QueryWrapper<PersonApplyDO> objectQueryWrapper = new QueryWrapper<>();
objectQueryWrapper.eq("employee_person_user_id", userId);
return personApplyCoConvertor.converDOToCO(personApplyRepository.getOne(objectQueryWrapper));
return personApplyCoConvertor.converDOToCO(personApplyRepository.getInfoByUserId(userId));
}
}

View File

@ -2,6 +2,7 @@ package com.zcloud.primeport.service;
import com.alibaba.cola.dto.PageResponse;
import com.alibaba.cola.dto.SingleResponse;
import com.zcloud.gbscommon.utils.DateUtil;
import com.zcloud.primeport.api.PersonApplyServiceI;
import com.zcloud.primeport.command.PersonApplyAddExe;
import com.zcloud.primeport.command.PersonApplyRemoveExe;
@ -13,9 +14,12 @@ import com.zcloud.primeport.dto.clientobject.PersonApplyCO;
import com.zcloud.primeport.dto.clientobject.PersonCountCO;
import com.zcloud.primeport.dto.clientobject.XgfPersonApplyCO;
import com.zcloud.primeport.dto.clientobject.XgfPersonCountCO;
import com.zcloud.primeport.plan.mjDevice.OnePersonUtil;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.Date;
/**
* web-app
*
@ -29,6 +33,7 @@ public class PersonApplyServiceImpl implements PersonApplyServiceI {
private final PersonApplyUpdateExe personApplyUpdateExe;
private final PersonApplyRemoveExe personApplyRemoveExe;
private final PersonApplyQueryExe personApplyQueryExe;
private final OnePersonUtil onePersonUtil;
@Override
public PageResponse<XgfPersonApplyCO> listPage(PersonApplyPageQry qry) {
@ -89,20 +94,23 @@ public class PersonApplyServiceImpl implements PersonApplyServiceI {
}
@Override
public void authorization(PersonAuthCmd cmd) {
public void authorization(PersonAuthCmd cmd) throws Exception {
// 查一下这个人 有没有 授权,
PersonApplyCO co = personApplyQueryExe.getInfoByUserId(cmd.getUserId());
if (cmd.getMkmjPermission().equals(1)) {
// 开启门禁
if (co != null) {
personApplyUpdateExe.authorization(co.getId(), co.getXgfApplyPersonId(), cmd.getMkmjPermission(), cmd.getGateLevelAuthArea());
onePersonUtil.expirationDateRefreshedUserCard(co.getUserCard(), DateUtil.date2Str(new Date()), "2030-12-31 23:59:59");
} else {
personApplyAddExe.authorization(cmd);
onePersonUtil.dockLongTermUserByUserCardAndFaceImg(co.getUserCard(), co.getUserUid(), co.getEmployeePersonUserName(), co.getUserFaceUrl(), DateUtil.date2Str(new Date()), "2030-12-31 23:59:59");
}
} else {
// 关闭门禁
// 关闭门禁,这个人都没有授权过的话,什么都不管。
if (co != null) {
personApplyUpdateExe.authorization(co.getId(), co.getXgfApplyPersonId(), cmd.getMkmjPermission(), cmd.getGateLevelAuthArea());
onePersonUtil.freezeByUserCard(co.getUserCard(), cmd.getMkmjPermission());
}
}
}

View File

@ -37,7 +37,7 @@ public interface PersonApplyServiceI {
PageResponse<PersonCountCO> personnelVehicleManagementList(PersonCountPageQry qry);
void authorization(PersonAuthCmd cmd);
void authorization(PersonAuthCmd cmd) throws Exception;
XgfPersonApplyCO xgfPersonApplyInfoById(Long id);

View File

@ -93,6 +93,7 @@ public class PersonApplyCO extends ClientObject {
private String auditCorpName;
@ApiModelProperty(value = "审批时间",name = "auditTime")
private String auditTime;
private String userUid;
}

View File

@ -91,5 +91,7 @@ public class PersonApplyDO extends BaseDO {
private Long applyCorpId;
@TableField(exist = false)
private String applyCorpName;
@TableField(exist = false)
private String userUid;
}

View File

@ -33,5 +33,7 @@ public interface PersonApplyMapper extends BaseMapper<PersonApplyDO> {
IPage<PersonApplyDO> xgfPersonnelVehicleManagementList(Page<Map<String, Object>> page, Map<String, Object> params, String menuPerms);
PersonApplyDO xgfPersonPermissionsInfo(Long id);
PersonApplyDO getInfoByUserId(Long userId);
}

View File

@ -20,5 +20,6 @@ public interface PersonApplyRepository extends BaseRepository<PersonApplyDO> {
PersonApplyDO xgfPersonPermissionsInfo(Long id);
PersonApplyDO getInfoByUserId(Long userId);
}

View File

@ -73,6 +73,11 @@ public class PersonApplyRepositoryImpl extends BaseRepositoryImpl<PersonApplyMap
return personApplyMapper.xgfPersonPermissionsInfo(id);
}
@Override
public PersonApplyDO getInfoByUserId(Long userId) {
return personApplyMapper.getInfoByUserId(userId);
}
}

View File

@ -120,10 +120,10 @@ public class OnePersonUtil {
* 1 2
* (1: 2)
*/
public void freezeByUserCard(String userCard, String mkmjPermission) throws Exception {
public void freezeByUserCard(String userCard, Integer mkmjPermission) throws Exception {
DaHuaDeviceCommon daHuaDeviceCommon = getDaHuaDeviceCommon();
JSONObject userByUserCard = daHuaDeviceCommon.getUserByUserCard(userCard).getJSONObject("data");
daHuaDeviceCommon.updatePersonStatus(userByUserCard.getLong("id"), Integer.valueOf(mkmjPermission));
daHuaDeviceCommon.updatePersonStatus(userByUserCard.getLong("id"), mkmjPermission);
}

View File

@ -104,6 +104,17 @@
pa.id = #{id}
</select>
<select id="getInfoByUserId" resultType="com.zcloud.primeport.persistence.dataobject.PersonApplyDO">
SELECT
pa.*,
u.user_id user_uid
FROM
person_apply pa
LEFT JOIN USER u ON pa.employee_person_user_id = u.id
WHERE
pa.delete_enum = 'FALSE'
and pa.employee_person_user_id = ${userId}
</select>
</mapper>