1
This commit is contained in:
@@ -1,21 +1,10 @@
|
||||
package org.dromara.property.controller.xcx;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import org.dromara.common.excel.utils.ExcelUtil;
|
||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||
import org.dromara.common.log.annotation.Log;
|
||||
import org.dromara.common.log.enums.BusinessType;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.property.domain.bo.ServiceWorkOrdersTypeBo;
|
||||
import org.dromara.property.domain.vo.ServiceWorkOrdersTypeVo;
|
||||
import org.dromara.property.service.IServiceWorkOrdersTypeService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
@@ -1,39 +1,21 @@
|
||||
package org.dromara.property.controller.xcx;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.dubbo.config.annotation.DubboReference;
|
||||
import org.dromara.common.core.constant.GlobalConstants;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import org.dromara.common.excel.utils.ExcelUtil;
|
||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||
import org.dromara.common.log.annotation.Log;
|
||||
import org.dromara.common.log.enums.BusinessType;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.redis.utils.RedisUtils;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.common.websocket.dto.WebSocketMessageDto;
|
||||
import org.dromara.common.websocket.holder.WebSocketSessionHolder;
|
||||
import org.dromara.common.websocket.utils.WebSocketUtils;
|
||||
import org.dromara.property.domain.bo.QrCodeInfo;
|
||||
import org.dromara.property.domain.bo.TbVisitorManagementBo;
|
||||
import org.dromara.property.domain.vo.TbVisitorManagementVo;
|
||||
import org.dromara.property.service.ITbVisitorManagementService;
|
||||
import org.dromara.system.api.RemoteConfigService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 访客管理
|
||||
@@ -104,10 +86,11 @@ public class XTbVisitorManagementController extends BaseController {
|
||||
*/
|
||||
@GetMapping("/qrCode/{id}")
|
||||
@SaCheckPermission("xcx:visitorManagement:getQrCode")
|
||||
public R<String> getQrCode(@NotNull(message = "主键不能为空")
|
||||
public R<Object> getQrCode(@NotNull(message = "主键不能为空")
|
||||
@PathVariable("id") Long id) {
|
||||
int code = Integer.parseInt(tbVisitorManagementService.getQrCodeByIdForXcx(id).get("code").toString());
|
||||
return code == 200 ? R.ok(tbVisitorManagementService.getQrCodeByIdForXcx(id).get("data").toString()) : R.fail(tbVisitorManagementService.getQrCodeByIdForXcx(id).get("data").toString());
|
||||
Map<String, Object> res = tbVisitorManagementService.getQrCodeByIdForXcx(id);
|
||||
int code = Integer.parseInt(res.get("code").toString());
|
||||
return code == 200 ? R.ok(res.get("data")) : R.fail(res.get("data"));
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -176,8 +176,13 @@ public class ResidentPersonServiceImpl implements IResidentPersonService {
|
||||
ResidentPerson update = MapstructUtils.convert(bo, ResidentPerson.class);
|
||||
assert update != null;
|
||||
|
||||
// 人脸照片存在时,才同步修改授权
|
||||
if (update.getAuthGroupId() != null && update.getAuthEndDate() != null && update.getImg() != null) {
|
||||
// 定义触发条件
|
||||
boolean shouldUpdateAuth = (update.getAuthGroupId() != null &&
|
||||
update.getAuthEndDate() != null &&
|
||||
update.getImg() != null) ||
|
||||
update.getState() != 1;
|
||||
|
||||
if (shouldUpdateAuth) {
|
||||
ResidentPersonVo vo = queryById(update.getId());
|
||||
Long e8Id = vo.getEEightId();
|
||||
|
||||
@@ -267,7 +272,7 @@ public class ResidentPersonServiceImpl implements IResidentPersonService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询已上传图片,未授权人员
|
||||
* 查询已上传图片,未授权人员(账号启用,且审核通过)
|
||||
*
|
||||
* @return List<ResidentPersonVo>
|
||||
*/
|
||||
@@ -276,6 +281,8 @@ public class ResidentPersonServiceImpl implements IResidentPersonService {
|
||||
LambdaQueryWrapper<ResidentPerson> lqw = Wrappers.lambdaQuery();
|
||||
lqw.isNotNull(ResidentPerson::getImg)
|
||||
.ne(ResidentPerson::getImg, "")
|
||||
.eq(ResidentPerson::getState, 1)
|
||||
.eq(ResidentPerson::getIsAudit, 1)
|
||||
.isNull(ResidentPerson::getEEightId);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
@@ -6,6 +6,7 @@ import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.dubbo.config.annotation.DubboReference;
|
||||
import org.apache.dubbo.config.annotation.DubboService;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.resource.api.RemoteFileService;
|
||||
import org.dromara.sis.api.RemoteVisitorService;
|
||||
import org.dromara.sis.api.domain.RemoteVisitor;
|
||||
@@ -15,7 +16,6 @@ import org.dromara.sis.sdk.e8.domain.visitors.req.VisitorAddReq;
|
||||
import org.dromara.sis.sdk.e8.domain.visitors.res.VisitorAddRes;
|
||||
import org.dromara.sis.sdk.e8.utils.ImageUtil;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -44,14 +44,16 @@ public class RemoteVisitorServiceImpl implements RemoteVisitorService {
|
||||
@Override
|
||||
public Map<String, Object> syncE8PlatVisitor(RemoteVisitor visitor) {
|
||||
try {
|
||||
String imgUrl = null;
|
||||
if (StringUtils.isNotBlank(visitor.getVisitorFaceImg())) {
|
||||
byte[] imgByte = fileService.downloadToByteArray(Long.parseLong(visitor.getVisitorFaceImg()));
|
||||
Assert.notNull(imgByte, "下载访客照片失败");
|
||||
|
||||
byte[] zipByte = imageUtil.compressImageToRequirements(imgByte);
|
||||
|
||||
String imgUrl = e8PlatformApi.uploadFace(zipByte);
|
||||
imgUrl = e8PlatformApi.uploadFace(zipByte);
|
||||
Assert.notNull(imgUrl, "e8平台上传访客照片失败");
|
||||
|
||||
}
|
||||
VisitorAddReq req = new VisitorAddReq();
|
||||
req.setVisitorName(visitor.getVisitorName());
|
||||
req.setMobilePhone(visitor.getMobilePhone());
|
||||
@@ -68,7 +70,7 @@ public class RemoteVisitorServiceImpl implements RemoteVisitorService {
|
||||
: Map.of("code", 500, "data", res.getMessage());
|
||||
} catch (Exception e) {
|
||||
log.info(e.getMessage());
|
||||
return Map.of("code", 500, "data", "e8平台新增访客登记出错");
|
||||
return Map.of("code", 500, "data", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,7 +92,7 @@ public class RemoteVisitorServiceImpl implements RemoteVisitorService {
|
||||
|
||||
} catch (Exception e) {
|
||||
log.info(e.getMessage());
|
||||
return Map.of("code", 500, "data", "e8平台获取访客二维码出错");
|
||||
return Map.of("code", 500, "data", e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -48,7 +48,6 @@ public class SyncGrantAuthTask {
|
||||
// 需要先设置模拟上下文
|
||||
SaTokenContextMockUtil.setMockContext(() -> {
|
||||
// 模拟登录
|
||||
StpUtil.login(1);
|
||||
unAuthPersonRef.set(remoteResidentPersonService.queryUnAuthPerson());
|
||||
List<RemoteResidentPersonVo> unAuthPerson = unAuthPersonRef.get();
|
||||
|
||||
@@ -89,38 +88,39 @@ public class SyncGrantAuthTask {
|
||||
continue;
|
||||
}
|
||||
|
||||
// // 计算图片MD5
|
||||
// String nowMd5 = calculateMD5(imgByte);
|
||||
// // 通过MD5查询相同图片
|
||||
// Long remoteId = remoteSisAuthService.queryHuaweiBoxIdByImgMd5(nowMd5);
|
||||
//
|
||||
// Long huaweiId;
|
||||
// if (remoteId == null) {
|
||||
// // 当前本地人像信息不存在相同照片,直接上传华为盒子
|
||||
// huaweiId = syncHuaweiBox(person, imgByte);
|
||||
// } else {
|
||||
// huaweiId = remoteId;
|
||||
// }
|
||||
//
|
||||
// if (huaweiId == null) {
|
||||
// log.info("华为盒子人像上传失败:{}-----{}", person.getName(), person.getId());
|
||||
// remoteSisAuthService.deletePersonAuth(List.of(person.getId()), new ArrayList<>());
|
||||
// continue;
|
||||
// }
|
||||
//
|
||||
// Boolean update = false;
|
||||
// try {
|
||||
// update = remoteSisAuthService.updateImgByPersonId(person.getId(), huaweiId, nowMd5);
|
||||
// } catch (Exception e) {
|
||||
// remoteSisAuthService.deletePersonAuth(List.of(person.getId()), new ArrayList<>());
|
||||
// continue;
|
||||
// }
|
||||
//
|
||||
// if (!update) {
|
||||
// log.info("更新人像信息失败:{}-----{}", person.getName(), person.getId());
|
||||
// remoteSisAuthService.deletePersonAuth(List.of(person.getId()), new ArrayList<>());
|
||||
// continue;
|
||||
// }
|
||||
// 计算图片MD5
|
||||
String nowMd5 = calculateMD5(imgByte);
|
||||
// 通过MD5查询相同图片
|
||||
Long remoteId = remoteSisAuthService.queryHuaweiBoxIdByImgMd5(nowMd5);
|
||||
|
||||
Long huaweiId;
|
||||
if (remoteId == null) {
|
||||
// 当前本地人像信息不存在相同照片,直接上传华为盒子
|
||||
huaweiId = syncHuaweiBox(person, imgByte);
|
||||
} else {
|
||||
huaweiId = remoteId;
|
||||
}
|
||||
|
||||
if (huaweiId == null) {
|
||||
log.info("华为盒子人像上传失败:{}-----{}", person.getName(), person.getId());
|
||||
remoteSisAuthService.deletePersonAuth(List.of(person.getId()), new ArrayList<>());
|
||||
continue;
|
||||
}
|
||||
|
||||
Boolean update;
|
||||
try {
|
||||
update = remoteSisAuthService.updateImgByPersonId(person.getId(), huaweiId, nowMd5);
|
||||
} catch (Exception e) {
|
||||
log.info("更新人像信息出错:{}-----{}", person.getName(), person.getId());
|
||||
remoteSisAuthService.deletePersonAuth(List.of(person.getId()), new ArrayList<>());
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!update) {
|
||||
log.info("更新人像信息失败:{}-----{}", person.getName(), person.getId());
|
||||
remoteSisAuthService.deletePersonAuth(List.of(person.getId()), new ArrayList<>());
|
||||
continue;
|
||||
}
|
||||
|
||||
// 黑名单不授权到E8
|
||||
if (!Objects.equals(person.getRosterType(), RosterTypeEnum.BLACK_LIST.getCode())) {
|
||||
|
Reference in New Issue
Block a user