H5访客
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled

This commit is contained in:
mocheng 2025-08-08 18:43:48 +08:00
parent 48984a494d
commit d5e46d88df
7 changed files with 9562 additions and 949 deletions

View File

@ -25,6 +25,11 @@ public class RemoteUserVo implements Serializable {
*/
private Long userId;
/**
* 租户ID
*/
private String tenantId;
/**
* 部门ID
*/

View File

@ -1,5 +1,6 @@
package org.dromara.property.controller;
import java.time.Duration;
import java.util.List;
import java.util.UUID;
@ -11,6 +12,7 @@ import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.constraints.*;
import cn.dev33.satoken.annotation.SaCheckPermission;
import org.apache.dubbo.config.annotation.DubboReference;
import org.dromara.common.core.constant.GlobalConstants;
import org.dromara.common.redis.utils.RedisUtils;
import org.dromara.property.domain.bo.QrCodeInfo;
import org.dromara.resource.api.RemoteMessageService;
@ -77,8 +79,7 @@ public class TbVisitorManagementController extends BaseController {
String s = remoteConfigService.selectQrTimeOut();
int i = Integer.parseInt(s);
UUID value = UUID.randomUUID();
RedisUtils.setCacheObject("Qrcode"+value, qrCodeInfo);
RedisUtils.expire("Qrcode", i);
RedisUtils.setCacheObject(GlobalConstants.CAPTCHA_CODE_KEY+"Qrcode"+value, qrCodeInfo, Duration.ofSeconds(i));
return R.ok(value.toString());
}
@ -87,9 +88,9 @@ public class TbVisitorManagementController extends BaseController {
* @param qrcode
* @return
*/
@PostMapping("/useqr")
@GetMapping("/useqr")
public R<String> useqr(String qrcode) {
QrCodeInfo qrCodeInfo = RedisUtils.getCacheObject("Qrcode" + qrcode);
QrCodeInfo qrCodeInfo = RedisUtils.getCacheObject(GlobalConstants.CAPTCHA_CODE_KEY +"Qrcode" + qrcode);
if (qrCodeInfo==null) {
return R.fail("二维码已过期");
}
@ -127,12 +128,12 @@ public class TbVisitorManagementController extends BaseController {
/**
* 小程序新增访客管理
*/
@SaCheckPermission("property:visitorManagement:add")
// @SaCheckPermission("property:visitorManagement:add")
@Log(title = "访客管理", businessType = BusinessType.INSERT)
@RepeatSubmit()
@PostMapping("/add")
public R<Void> add(@Validated(AddGroup.class) @RequestBody TbVisitorManagementBo bo) {
QrCodeInfo info = RedisUtils.getCacheObject("Qrcode" + bo.getQrCodeId());
QrCodeInfo info = RedisUtils.getCacheObject(GlobalConstants.CAPTCHA_CODE_KEY +"Qrcode" + bo.getQrCodeId());
if (info==null){
return R.fail("请确认Qr码有效");
}

View File

@ -26,7 +26,7 @@ public class TbVisitorManagementBo extends BaseEntity {
* qr码id
*/
// @NotNull(message = "qr码id不能为空", groups = { AddGroup.class, EditGroup.class })
private Long qrCodeId;
private String qrCodeId;
/**
* id

View File

@ -1,6 +1,7 @@
package org.dromara.property.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.dromara.common.core.constant.GlobalConstants;
import org.dromara.common.core.utils.MapstructUtils;
import org.dromara.common.core.utils.StringUtils;
import org.dromara.common.mybatis.core.page.TableDataInfo;
@ -12,6 +13,8 @@ import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.dromara.common.redis.utils.RedisUtils;
import org.dromara.property.domain.bo.QrCodeInfo;
import org.dromara.system.api.RemoteUserService;
import org.dromara.system.api.domain.vo.RemoteUserVo;
import org.springframework.stereotype.Service;
import org.dromara.property.domain.bo.TbVisitorManagementBo;
import org.dromara.property.domain.vo.TbVisitorManagementVo;
@ -35,6 +38,7 @@ import java.util.Collection;
public class TbVisitorManagementServiceImpl implements ITbVisitorManagementService {
private final TbVisitorManagementMapper baseMapper;
private final RemoteUserService remoteUserService;
/**
* 查询访客管理
@ -100,10 +104,16 @@ public class TbVisitorManagementServiceImpl implements ITbVisitorManagementServi
*/
@Override
public Boolean insertByBo(TbVisitorManagementBo bo) {
QrCodeInfo info = RedisUtils.getCacheObject("Qrcode" + bo.getQrCodeId());
QrCodeInfo info = RedisUtils.getCacheObject(GlobalConstants.CAPTCHA_CODE_KEY +"Qrcode" + bo.getQrCodeId());
TbVisitorManagement add = MapstructUtils.convert(bo, TbVisitorManagement.class);
validEntityBeforeSave(add);
add.setCreateById(info.getUserid());
RemoteUserVo userInfoById = remoteUserService.getUserInfoById(info.getUserid());
add.setTenantId(userInfoById.getTenantId());
add.setCreateBy(userInfoById.getUserId());
add.setUpdateById(userInfoById.getUserId());
add.setUpdateBy(userInfoById.getUserId());
add.setCreateDept(userInfoById.getDeptId());
boolean flag = baseMapper.insert(add) > 0;
if (flag) {
bo.setId(add.getId());

View File

@ -88,7 +88,7 @@ public class SysOssController extends BaseController {
*
* @param file 文件
*/
@SaCheckPermission("system:oss:upload")
// @SaCheckPermission("system:oss:upload")
@Log(title = "OSS对象存储", businessType = BusinessType.INSERT)
@PostMapping(value = "/qrupload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public R<SysOssUploadVo> codeUpload(@RequestPart("file") MultipartFile file,String code) {

View File

@ -40,9 +40,9 @@ spring.sql.init.platform=mysql
db.num=1
### Connect URL of DB:
db.url.0=jdbc:mysql://47.109.37.87:23306/ry-config?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true
db.url.0=jdbc:mysql://127.0.0.1:3306/ry-config?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true
db.user.0=root
db.password.0=admin@123456
db.password.0=By@2025!
### the maximum retry times for push
nacos.config.push.maxRetryTime=50

File diff suppressed because one or more lines are too long