访客&&大屏
This commit is contained in:
@@ -23,6 +23,11 @@
|
||||
<artifactId>ruoyi-common-core</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-dubbo</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
@@ -14,4 +14,5 @@ public interface RemoteConfigService {
|
||||
*/
|
||||
boolean selectRegisterEnabled(String tenantId);
|
||||
|
||||
String selectQrTimeOut();
|
||||
}
|
||||
|
@@ -196,4 +196,6 @@ public interface RemoteUserService {
|
||||
*/
|
||||
Map<Long, String> selectPostNamesByIds(List<Long> postIds);
|
||||
|
||||
Map<String ,Integer> seelectOrgcount();
|
||||
|
||||
}
|
||||
|
@@ -0,0 +1,11 @@
|
||||
package org.dromara.sis.api;
|
||||
|
||||
import org.dromara.sis.api.domain.RemotePrecautionaryVo;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface RemotePrecautionary {
|
||||
List<RemotePrecautionaryVo> getList();
|
||||
Map count();
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
package org.dromara.sis.api;
|
||||
|
||||
import org.dromara.sis.api.domain.RemoteAlarmRecord;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface RemoteSos {
|
||||
List<RemoteAlarmRecord> getSoslist();
|
||||
|
||||
Map sosCount();
|
||||
}
|
@@ -0,0 +1,201 @@
|
||||
package org.dromara.sis.api.domain;
|
||||
|
||||
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 报警记录实体类,对应数据库表 alarm_record
|
||||
* 存储系统中的报警事件信息,包括设备信息、时间信息、处理状态等
|
||||
*/
|
||||
@Data
|
||||
public class RemoteAlarmRecord implements Serializable {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 报警记录唯一标识,对应 API 返回的 Id 字段
|
||||
* 采用 INPUT 策略,使用 API 返回的实际 ID 值
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 任务编码,用于标识特定的报警任务
|
||||
*/
|
||||
private String taskCode;
|
||||
|
||||
/**
|
||||
* 设备ID,关联具体的报警设备
|
||||
*/
|
||||
private Integer deviceId;
|
||||
|
||||
/**
|
||||
* 设备名称,如 "7楼办公室"
|
||||
*/
|
||||
private String deviceName;
|
||||
|
||||
/**
|
||||
* 设备许可证ID,用于唯一标识设备
|
||||
*/
|
||||
private String deviceLicenseId;
|
||||
|
||||
/**
|
||||
* 设备SIP号码,用于通信
|
||||
*/
|
||||
private String deviceSipNum;
|
||||
|
||||
/**
|
||||
* 设备所在经度
|
||||
*/
|
||||
private Double deviceLng;
|
||||
|
||||
/**
|
||||
* 设备所在纬度
|
||||
*/
|
||||
private Double deviceLat;
|
||||
|
||||
/**
|
||||
* 会议ID,关联报警处理过程中的会议
|
||||
*/
|
||||
private Long conferenceId;
|
||||
|
||||
/**
|
||||
* 会议SIP编码
|
||||
*/
|
||||
private String confSipCode;
|
||||
|
||||
/**
|
||||
* 报警状态,如 "finished"(已完成)、"noAnswer"(未接听)等
|
||||
*/
|
||||
private String state;
|
||||
|
||||
/**
|
||||
* 报警开始时间(Java Date 类型)
|
||||
*/
|
||||
private Date startTime;
|
||||
|
||||
/**
|
||||
* 报警开始时间的 Unix 时间戳(毫秒)
|
||||
*/
|
||||
private Long startTimeUnix;
|
||||
|
||||
/**
|
||||
* 报警结束时间(Java Date 类型)
|
||||
*/
|
||||
private Date finishTime;
|
||||
|
||||
/**
|
||||
* 报警结束时间的 Unix 时间戳(毫秒)
|
||||
*/
|
||||
private Long finishTimeUnix;
|
||||
|
||||
/**
|
||||
* 响铃开始时间(Java Date 类型)
|
||||
*/
|
||||
private Date ringingTime;
|
||||
|
||||
/**
|
||||
* 响铃开始时间的 Unix 时间戳(毫秒)
|
||||
*/
|
||||
private Long ringingTimeUnix;
|
||||
|
||||
/**
|
||||
* 过期时间(Java Date 类型)
|
||||
*/
|
||||
private Date expireTime;
|
||||
|
||||
/**
|
||||
* 过期时间的 Unix 时间戳(毫秒)
|
||||
*/
|
||||
private Long expireTimeUnix;
|
||||
|
||||
/**
|
||||
* 呼叫过期时间(Java Date 类型)
|
||||
*/
|
||||
private Date callExpireTime;
|
||||
|
||||
/**
|
||||
* 呼叫过期时间的 Unix 时间戳(毫秒)
|
||||
*/
|
||||
private Long callExpireTimeUnix;
|
||||
|
||||
/**
|
||||
* 呼叫开始时间(Java Date 类型)
|
||||
*/
|
||||
private Date callTime;
|
||||
|
||||
/**
|
||||
* 呼叫开始时间的 Unix 时间戳(毫秒)
|
||||
*/
|
||||
private Long callTimeUnix;
|
||||
|
||||
/**
|
||||
* 设备是否带有摄像头(0-不带,1-带)
|
||||
*/
|
||||
private Integer deviceWithCamera;
|
||||
|
||||
/**
|
||||
* 公司编码,标识所属公司
|
||||
*/
|
||||
private String companyCode;
|
||||
|
||||
/**
|
||||
* 报警类型,如 "button"(按钮报警)
|
||||
*/
|
||||
private String alarmType;
|
||||
|
||||
/**
|
||||
* 业务类型,如 "normal"(正常业务)
|
||||
*/
|
||||
private String businessType;
|
||||
|
||||
/**
|
||||
* 分组ID,用于对设备进行分组管理
|
||||
*/
|
||||
private Integer groupId;
|
||||
|
||||
/**
|
||||
* 报告通知级别
|
||||
*/
|
||||
private Integer reportNotifyLevel;
|
||||
|
||||
/**
|
||||
* 是否挂起(0-未挂起,1-挂起)
|
||||
*/
|
||||
private Integer isHold;
|
||||
|
||||
/**
|
||||
* 显示的报警类型(可能为空)
|
||||
*/
|
||||
private String displayAlarmType;
|
||||
|
||||
/**
|
||||
* 接收类型(可能为空)
|
||||
*/
|
||||
private String acceptType;
|
||||
|
||||
/**
|
||||
* 分组名称(可能为空)
|
||||
*/
|
||||
private String groupName;
|
||||
|
||||
/**
|
||||
* 设备联系人(可能为空)
|
||||
*/
|
||||
private String deviceLinkman;
|
||||
|
||||
/**
|
||||
* 设备联系电话(可能为空)
|
||||
*/
|
||||
private String devicePhoneNum;
|
||||
|
||||
/**
|
||||
* 记录创建时间,由数据库自动填充
|
||||
* 使用 MyBatis-Plus 的自动填充功能,插入时自动设置为当前时间
|
||||
*/
|
||||
private Date createTime;
|
||||
}
|
@@ -0,0 +1,63 @@
|
||||
package org.dromara.sis.api.domain;
|
||||
|
||||
import lombok.Data;
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
/**
|
||||
* 预警视图对象 precautionary
|
||||
*
|
||||
* @author mocheng
|
||||
* @date 2025-08-01
|
||||
*/
|
||||
@Data
|
||||
public class RemotePrecautionaryVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 预警类型
|
||||
*/
|
||||
|
||||
private Long type;
|
||||
|
||||
/**
|
||||
* 时间
|
||||
*/
|
||||
|
||||
private Date time;
|
||||
|
||||
/**
|
||||
* 位置
|
||||
*/
|
||||
|
||||
private String address;
|
||||
|
||||
/**
|
||||
* 预警内容
|
||||
*/
|
||||
|
||||
private String msg;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
|
||||
private Long status;
|
||||
|
||||
/**
|
||||
* 详情id
|
||||
*/
|
||||
|
||||
private Long taskId;
|
||||
|
||||
|
||||
}
|
@@ -1,11 +1,21 @@
|
||||
package org.dromara.property.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.nacos.api.config.ConfigService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
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.redis.utils.RedisUtils;
|
||||
import org.dromara.property.domain.bo.QrCodeInfo;
|
||||
import org.dromara.resource.api.RemoteMessageService;
|
||||
import org.dromara.system.api.RemoteConfigService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||
@@ -36,6 +46,13 @@ import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
public class TbVisitorManagementController extends BaseController {
|
||||
|
||||
private final ITbVisitorManagementService tbVisitorManagementService;
|
||||
@DubboReference
|
||||
private final RemoteConfigService remoteConfigService;
|
||||
|
||||
@DubboReference(stub = "true")
|
||||
private final RemoteMessageService remoteMessageService;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 查询访客管理列表
|
||||
@@ -46,6 +63,42 @@ public class TbVisitorManagementController extends BaseController {
|
||||
return tbVisitorManagementService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取二维码uuid
|
||||
* @param qrCodeInfo
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/getcode")
|
||||
public R<String> getcode(QrCodeInfo qrCodeInfo) {
|
||||
Long string = (Long) StpUtil.getLoginId();
|
||||
qrCodeInfo.setUserid(string);
|
||||
String s = remoteConfigService.selectQrTimeOut();
|
||||
int i = Integer.parseInt(s);
|
||||
UUID value = UUID.randomUUID();
|
||||
RedisUtils.setCacheObject("Qrcode"+value, qrCodeInfo);
|
||||
RedisUtils.expire("Qrcode", i);
|
||||
return R.ok(value.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* 推送二维码被扫信息
|
||||
* @param qrcode
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/useqr")
|
||||
public R<String> useqr(String qrcode) {
|
||||
QrCodeInfo qrCodeInfo = RedisUtils.getCacheObject("Qrcode" + qrcode);
|
||||
if (qrCodeInfo==null) {
|
||||
return R.fail("二维码已过期");
|
||||
}
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("type","qrcode");
|
||||
jsonObject.put("date",qrcode);
|
||||
remoteMessageService.publishMessage(List.of(qrCodeInfo.getUserid()),jsonObject.toString());
|
||||
return R.ok("二维码可用");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出访客管理列表
|
||||
*/
|
||||
@@ -75,8 +128,12 @@ public class TbVisitorManagementController extends BaseController {
|
||||
@SaCheckPermission("property:visitorManagement:add")
|
||||
@Log(title = "访客管理", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
@PostMapping("/add")
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody TbVisitorManagementBo bo) {
|
||||
QrCodeInfo info = RedisUtils.getCacheObject("Qrcode" + bo.getQrCodeId());
|
||||
if (info==null){
|
||||
return R.fail("请确认Qr码有效");
|
||||
}
|
||||
return toAjax(tbVisitorManagementService.insertByBo(bo));
|
||||
}
|
||||
|
||||
|
@@ -0,0 +1,66 @@
|
||||
package org.dromara.property.controller.cockpit;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.property.domain.vo.TbVisitorManagementVo;
|
||||
import org.dromara.property.service.ITbVisitorManagementService;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 大屏预约接口
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/cockpit")
|
||||
public class BookingController {
|
||||
@Resource
|
||||
private ITbVisitorManagementService tbVisitorManagementService;
|
||||
|
||||
@RequestMapping("visitor")
|
||||
public R<Map> visitor() {
|
||||
// 创建查询条件包装器
|
||||
QueryWrapper<TbVisitorManagementVo> queryWrapper = new QueryWrapper<>();
|
||||
|
||||
// 添加时间条件,查询近七天的数据
|
||||
LocalDateTime sevenDaysAgo = LocalDateTime.now().minusDays(7);
|
||||
queryWrapper.ge("create_time", sevenDaysAgo); // 假设创建时间字段为create_time
|
||||
|
||||
// 执行查询
|
||||
List<TbVisitorManagementVo> tbVisitorManagementVos = tbVisitorManagementService.queryListByWapper(queryWrapper);
|
||||
|
||||
// 按天分组统计
|
||||
Map<String, Long> typeCountMap = tbVisitorManagementVos.stream()
|
||||
.collect(Collectors.groupingBy(
|
||||
vo -> {
|
||||
// 如果 getVisitingBeginTime() 返回 Date 类型
|
||||
return vo.getVisitingBeginTime().toInstant()
|
||||
.atZone(ZoneId.systemDefault())
|
||||
.toLocalDate()
|
||||
.toString();
|
||||
},
|
||||
Collectors.counting()
|
||||
));
|
||||
ArrayList<String> keys = new ArrayList<>();
|
||||
ArrayList<String> values = new ArrayList<>();
|
||||
for (String s : typeCountMap.keySet()) {
|
||||
keys.add(s);
|
||||
}
|
||||
for (Long value : typeCountMap.values()) {
|
||||
values.add(value.toString());
|
||||
}
|
||||
HashMap<String, List> stringListHashMap = new HashMap<>();
|
||||
stringListHashMap.put("keys",keys);
|
||||
stringListHashMap.put("values",values);
|
||||
return R.ok(stringListHashMap);
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,13 @@
|
||||
package org.dromara.property.controller.cockpit;
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 大屏设备接口
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/cockpit")
|
||||
public class DriverController {
|
||||
|
||||
}
|
@@ -0,0 +1,15 @@
|
||||
package org.dromara.property.controller.cockpit;
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 大屏能耗接口
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/cockpit")
|
||||
public class EnergyConsumptionController {
|
||||
|
||||
|
||||
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
package org.dromara.property.controller.cockpit;
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 大屏事件接口
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/cockpit")
|
||||
public class EventController {
|
||||
}
|
@@ -0,0 +1,49 @@
|
||||
package org.dromara.property.controller.cockpit;
|
||||
|
||||
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.property.domain.bo.CostPayFeeAuditBo;
|
||||
import org.dromara.property.domain.vo.CostPayFeeAuditVo;
|
||||
import org.dromara.property.service.ICostPayFeeAuditService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/**
|
||||
* 大屏费用接口
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/cockpit")
|
||||
public class ExpensesController {
|
||||
@Autowired
|
||||
private ICostPayFeeAuditService costPayFeeAuditService;
|
||||
|
||||
@RequestMapping("/expenses")
|
||||
public R<HashMap<String, BigDecimal>> expenses(){
|
||||
List<CostPayFeeAuditVo> costPayFeeAuditVos = costPayFeeAuditService.queryList(new CostPayFeeAuditBo());
|
||||
// 按 chargeItem 分组统计数量
|
||||
List<String> collect = costPayFeeAuditVos.stream()
|
||||
.filter(vo -> vo.getChargeItem() != null)
|
||||
.map(a -> a.getChargeItem())
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
HashMap<String, BigDecimal> stringBigDecimalHashMap = new HashMap<>();
|
||||
for (String s : collect) {
|
||||
BigDecimal bigDecimal = costPayFeeAuditVos.stream()
|
||||
.filter(a -> a.getReceivedAmount() == null)
|
||||
.filter(a -> a.getChargeItem() .equals(s))
|
||||
.map(CostPayFeeAuditVo::getReceivedAmount)
|
||||
.reduce(BigDecimal::add)
|
||||
.get();
|
||||
stringBigDecimalHashMap.put(s, bigDecimal);
|
||||
}
|
||||
|
||||
return R.ok(stringBigDecimalHashMap);
|
||||
}
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
package org.dromara.property.controller.cockpit;
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 大屏流量接口
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/cockpit")
|
||||
public class FlowController {
|
||||
}
|
@@ -0,0 +1,25 @@
|
||||
package org.dromara.property.controller.cockpit;
|
||||
|
||||
import org.apache.dubbo.config.annotation.DubboReference;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.system.api.RemoteUserService;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 大屏物业人员接口
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/cockpit")
|
||||
public class PropertyPersonController {
|
||||
@DubboReference
|
||||
private RemoteUserService remoteUserService;
|
||||
|
||||
@RequestMapping("propertyperson")
|
||||
public R<Map<String, Integer>> propertyPerson() {
|
||||
return R.ok(remoteUserService.seelectOrgcount());
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,30 @@
|
||||
package org.dromara.property.controller.cockpit;
|
||||
|
||||
import org.apache.dubbo.config.annotation.DubboReference;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.sis.api.RemoteSos;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 大屏报警接口
|
||||
*/
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/cockpit")
|
||||
public class SosController {
|
||||
@DubboReference
|
||||
private RemoteSos remoteSos;
|
||||
|
||||
@RequestMapping("sos")
|
||||
public R<Map<String, Integer>> sos(){
|
||||
return R.ok(remoteSos.sosCount());
|
||||
}
|
||||
@RequestMapping("soslist")
|
||||
public R<List> sosList(){
|
||||
return R.ok(remoteSos.getSoslist());
|
||||
}
|
||||
}
|
@@ -0,0 +1,62 @@
|
||||
package org.dromara.property.controller.cockpit;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.property.domain.bo.ServiceWorkOrdersBo;
|
||||
import org.dromara.property.domain.vo.ServiceWorkOrderAnalysisVo;
|
||||
import org.dromara.property.domain.vo.ServiceWorkOrdersVo;
|
||||
import org.dromara.property.service.IServiceWorkOrdersService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 大屏工单接口
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/cockpit")
|
||||
public class WorkOrderController {
|
||||
@Resource
|
||||
private IServiceWorkOrdersService serviceWorkOrdersService;
|
||||
|
||||
/**
|
||||
* 获取服务工单统计信息
|
||||
*
|
||||
* @return 返回服务工单分析数据的封装结果
|
||||
*/
|
||||
@GetMapping("/workcount")
|
||||
public R<HashMap> counts() {
|
||||
// 调用服务层获取工单统计信息并返回成功结果
|
||||
List<ServiceWorkOrdersVo> serviceWorkOrdersVos = serviceWorkOrdersService.queryList(new ServiceWorkOrdersBo());
|
||||
// 按type分组统计
|
||||
Map<String, Long> typeCountMap = serviceWorkOrdersVos.stream()
|
||||
.collect(Collectors.groupingBy(
|
||||
vo -> String.valueOf(vo.getTypeName()),
|
||||
Collectors.counting()
|
||||
));
|
||||
ArrayList<String> keys = new ArrayList<>();
|
||||
ArrayList<String> values = new ArrayList<>();
|
||||
for (String s : typeCountMap.keySet()) {
|
||||
keys.add(s);
|
||||
}
|
||||
for (Long value : typeCountMap.values()) {
|
||||
values.add(value.toString());
|
||||
}
|
||||
HashMap<String, List> stringListHashMap = new HashMap<>();
|
||||
stringListHashMap.put("keys",keys);
|
||||
stringListHashMap.put("values",values);
|
||||
return R.ok(stringListHashMap);
|
||||
}
|
||||
|
||||
|
||||
}
|
@@ -0,0 +1,10 @@
|
||||
package org.dromara.property.domain.bo;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class QrCodeInfo {
|
||||
private String deviceCode; // 对应“设备码”
|
||||
private String generateTime; // 对应“生成时间”
|
||||
private String qrCodeId; // 对应“二维码ID”
|
||||
private Long userid;
|
||||
}
|
@@ -22,6 +22,12 @@ import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
@AutoMapper(target = TbVisitorManagement.class, reverseConvertGenerate = false)
|
||||
public class TbVisitorManagementBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* qr码id
|
||||
*/
|
||||
@NotNull(message = "qr码id不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Long qrCodeId;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
|
@@ -1,5 +1,6 @@
|
||||
package org.dromara.property.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.property.domain.bo.ServiceWorkOrdersBo;
|
||||
|
@@ -1,5 +1,7 @@
|
||||
package org.dromara.property.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import org.dromara.property.domain.TbVisitorManagement;
|
||||
import org.dromara.property.domain.vo.TbVisitorManagementVo;
|
||||
import org.dromara.property.domain.bo.TbVisitorManagementBo;
|
||||
@@ -42,6 +44,10 @@ public interface ITbVisitorManagementService {
|
||||
*/
|
||||
List<TbVisitorManagementVo> queryList(TbVisitorManagementBo bo);
|
||||
|
||||
List<TbVisitorManagementVo> queryListByWapper(QueryWrapper wapper);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 新增访客管理
|
||||
*
|
||||
|
@@ -140,7 +140,23 @@ public class ServiceWorkOrdersServiceImpl implements IServiceWorkOrdersService {
|
||||
@Override
|
||||
public List<ServiceWorkOrdersVo> queryList(ServiceWorkOrdersBo bo) {
|
||||
LambdaQueryWrapper<ServiceWorkOrders> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
List<ServiceWorkOrdersVo> result = baseMapper.selectVoList(lqw);
|
||||
if (ObjectUtil.isEmpty(result)) {
|
||||
return result;
|
||||
}
|
||||
List<Long> typeList = result.stream().map(vo -> vo.getType()).distinct().collect(Collectors.toList());
|
||||
List<ServiceWorkOrdersTypeVo> serviceWorkOrdersTypeVoList = typesMapper.selectVoByIds(typeList);
|
||||
if (ObjectUtil.isEmpty(serviceWorkOrdersTypeVoList)) {
|
||||
return result;
|
||||
}
|
||||
List<ServiceWorkOrdersVo> serviceWorkOrdersVoList = new ArrayList<>();
|
||||
result.stream().forEach(s -> {
|
||||
ServiceWorkOrdersTypeVo serviceWorkOrdersTypeVo = serviceWorkOrdersTypeVoList.stream().filter(vo -> vo.getId() != null && vo.getId().equals(s.getType())).findFirst().orElse(null);
|
||||
|
||||
s.setTypeName(ObjectUtil.isNotNull(serviceWorkOrdersTypeVo) ? serviceWorkOrdersTypeVo.getOrderTypeName() : null);
|
||||
serviceWorkOrdersVoList.add(s);
|
||||
});
|
||||
return serviceWorkOrdersVoList;
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<ServiceWorkOrders> buildQueryWrapper(ServiceWorkOrdersBo bo) {
|
||||
|
@@ -1,5 +1,6 @@
|
||||
package org.dromara.property.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
@@ -9,6 +10,8 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.common.redis.utils.RedisUtils;
|
||||
import org.dromara.property.domain.bo.QrCodeInfo;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.dromara.property.domain.bo.TbVisitorManagementBo;
|
||||
import org.dromara.property.domain.vo.TbVisitorManagementVo;
|
||||
@@ -58,16 +61,15 @@ public class TbVisitorManagementServiceImpl implements ITbVisitorManagementServi
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询符合条件的访客管理列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 访客管理列表
|
||||
*/
|
||||
@Override
|
||||
public List<TbVisitorManagementVo> queryList(TbVisitorManagementBo bo) {
|
||||
LambdaQueryWrapper<TbVisitorManagement> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
LambdaQueryWrapper<TbVisitorManagement> tbVisitorManagementLambdaQueryWrapper = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(tbVisitorManagementLambdaQueryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TbVisitorManagementVo> queryListByWapper(QueryWrapper wapper) {
|
||||
return baseMapper.selectVoList(wapper);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<TbVisitorManagement> buildQueryWrapper(TbVisitorManagementBo bo) {
|
||||
@@ -98,8 +100,10 @@ public class TbVisitorManagementServiceImpl implements ITbVisitorManagementServi
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(TbVisitorManagementBo bo) {
|
||||
QrCodeInfo info = RedisUtils.getCacheObject("Qrcode" + bo.getQrCodeId());
|
||||
TbVisitorManagement add = MapstructUtils.convert(bo, TbVisitorManagement.class);
|
||||
validEntityBeforeSave(add);
|
||||
add.setCreateById(info.getUserid());
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setId(add.getId());
|
||||
|
@@ -123,17 +123,23 @@
|
||||
<artifactId>examples</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.hik</groupId>
|
||||
<artifactId>jna</artifactId>
|
||||
<version>4.5.2_1</version>
|
||||
</dependency>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.hik</groupId>-->
|
||||
<!-- <artifactId>jna</artifactId>-->
|
||||
<!-- <version>4.5.2_1</version>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
<dependency>
|
||||
<groupId>com.ghgande</groupId>
|
||||
<artifactId>j2mod</artifactId>
|
||||
<version>3.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.java.dev.jna</groupId>
|
||||
<artifactId>jna</artifactId>
|
||||
<version>5.17.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
@@ -0,0 +1,35 @@
|
||||
package org.dromara.sis.dubbo;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.dubbo.config.annotation.DubboService;
|
||||
import org.dromara.sis.api.RemotePrecautionary;
|
||||
import org.dromara.sis.api.domain.RemotePrecautionaryVo;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@Slf4j
|
||||
@DubboService
|
||||
@RequiredArgsConstructor
|
||||
public class RemotePrecautionaryImpl implements RemotePrecautionary {
|
||||
private final PrecautionaryMapper precautionaryMapper;
|
||||
|
||||
@Override
|
||||
public List<RemotePrecautionaryVo> getList() {
|
||||
Page<Precautionary> Page = new Page<>(1, 10);
|
||||
QueryWrapper<Precautionary> wrapper = new QueryWrapper<>();
|
||||
wrapper.orderByAsc("time");
|
||||
return precautionaryMapper.selectVoPage(Page, wrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map count() {
|
||||
List<Precautionary> precautionaries = precautionaryMapper.selectList();
|
||||
Stream<Long> longStream = precautionaries.stream().map(Precautionary::getType);
|
||||
return Map.of();
|
||||
}
|
||||
}
|
@@ -0,0 +1,49 @@
|
||||
package org.dromara.sis.dubbo;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.dubbo.config.annotation.DubboService;
|
||||
import org.dromara.sis.api.RemoteSos;
|
||||
import org.dromara.sis.api.domain.RemoteAlarmRecord;
|
||||
import org.dromara.sis.domain.AlarmRecord;
|
||||
import org.dromara.sis.service.AlarmRecordService;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@DubboService
|
||||
@RequiredArgsConstructor
|
||||
public class RemoteSosImpl implements RemoteSos {
|
||||
private final AlarmRecordService alarmRecordService;
|
||||
|
||||
@Override
|
||||
public List<RemoteAlarmRecord> getSoslist() {
|
||||
QueryWrapper<AlarmRecord> startTime = new QueryWrapper<AlarmRecord>();
|
||||
Page<AlarmRecord> page = alarmRecordService.page(new Page<>(1, 10));
|
||||
List<AlarmRecord> records = page.getRecords();
|
||||
List<RemoteAlarmRecord> remoteAlarmRecordList = new ArrayList<>();
|
||||
records.forEach(alarmRecord -> {
|
||||
RemoteAlarmRecord remoteAlarmRecord = new RemoteAlarmRecord();
|
||||
BeanUtils.copyProperties(alarmRecord, remoteAlarmRecord);
|
||||
remoteAlarmRecordList.add(remoteAlarmRecord);
|
||||
});
|
||||
return remoteAlarmRecordList;
|
||||
};
|
||||
|
||||
@Override
|
||||
public Map sosCount() {
|
||||
List<AlarmRecord> list = alarmRecordService.list();
|
||||
//进行中
|
||||
long inprogress = list.stream().filter(alarmRecord -> alarmRecord.getState().equals("inprogress")).count();
|
||||
//已结束
|
||||
long finished = list.stream().filter(alarmRecord -> alarmRecord.getState().equals("finished")).count();
|
||||
//未接通
|
||||
long noAnswer = list.stream().filter(alarmRecord -> alarmRecord.getState().equals("noAnswer")).count();
|
||||
return Map.of("进行中", inprogress, "已结束", finished, "未接通", noAnswer,"总计", list.size());
|
||||
}
|
||||
}
|
@@ -29,5 +29,5 @@ public interface AlarmRecordService extends IService<AlarmRecord> {
|
||||
* @param operatorMap 操作记录映射,键为报警记录ID,值为对应操作记录列表
|
||||
* @return 成功保存的记录数
|
||||
*/
|
||||
int saveNewRecords(List<AlarmRecord> records, Map<Long, List<Map<String, Object>>> operatorMap);
|
||||
// int saveNewRecords(List<AlarmRecord> records, Map<Long, List<Map<String, Object>>> operatorMap);
|
||||
}
|
||||
|
@@ -26,6 +26,8 @@ public class AlarmRecordServiceImpl extends ServiceImpl<AlarmRecordMapper, Alarm
|
||||
|
||||
@Autowired
|
||||
private AlarmTaskOperatorService taskOperatorService;
|
||||
@Autowired
|
||||
private PrecautionaryMapper precautionaryMapper;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
@@ -46,10 +48,20 @@ public class AlarmRecordServiceImpl extends ServiceImpl<AlarmRecordMapper, Alarm
|
||||
|
||||
List<AlarmRecord> newRecords = new ArrayList<>();
|
||||
List<AlarmRecord> updateRecords = new ArrayList<>();
|
||||
List<Precautionary> newList=new ArrayList<>();
|
||||
|
||||
|
||||
// 分类处理记录
|
||||
for (AlarmRecord record : records) {
|
||||
if (existingRecordMap.containsKey(record.getId())) {
|
||||
Precautionary precautionary = new Precautionary();
|
||||
precautionary.setType(1L);
|
||||
precautionary.setTime(record.getCallTime());
|
||||
precautionary.setAddress(record.getDeviceName());
|
||||
precautionary.setMsg("SOS终端接警");
|
||||
precautionary.setStatus(0L);
|
||||
precautionary.setTaskId(record.getId());
|
||||
newList.add(precautionary);
|
||||
// 如果记录已存在,检查是否需要更新
|
||||
AlarmRecord existing = existingRecordMap.get(record.getId());
|
||||
if (hasRecordChanges(existing, record)) {
|
||||
@@ -58,6 +70,7 @@ public class AlarmRecordServiceImpl extends ServiceImpl<AlarmRecordMapper, Alarm
|
||||
} else {
|
||||
// 新记录
|
||||
newRecords.add(record);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,9 +81,12 @@ public class AlarmRecordServiceImpl extends ServiceImpl<AlarmRecordMapper, Alarm
|
||||
if (this.saveBatch(newRecords)) {
|
||||
result += newRecords.size();
|
||||
// 保存关联的操作记录
|
||||
saveRelatedOperators(newRecords, operatorMap);
|
||||
}
|
||||
}
|
||||
// 批量插入主表记录
|
||||
if (!newList.isEmpty()) {
|
||||
precautionaryMapper.insertOrUpdateBatch(newList);
|
||||
}
|
||||
|
||||
// 批量更新修改过的记录
|
||||
if (!updateRecords.isEmpty()) {
|
||||
@@ -125,38 +141,38 @@ public class AlarmRecordServiceImpl extends ServiceImpl<AlarmRecordMapper, Alarm
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int saveNewRecords(List<AlarmRecord> records, Map<Long, List<Map<String, Object>>> operatorMap) {
|
||||
if (records == null || records.isEmpty()) return 0;
|
||||
|
||||
// 提取待插入记录的ID列表
|
||||
List<Long> ids = records.stream().map(AlarmRecord::getId).collect(Collectors.toList());
|
||||
|
||||
// 查询数据库中已存在的记录
|
||||
LambdaQueryWrapper<AlarmRecord> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.in(AlarmRecord::getId, ids);
|
||||
List<AlarmRecord> existingRecords = this.list(queryWrapper);
|
||||
List<Long> existingIds = existingRecords.stream().map(AlarmRecord::getId).collect(Collectors.toList());
|
||||
|
||||
// 过滤出新增记录
|
||||
List<AlarmRecord> newRecords = records.stream()
|
||||
.filter(record -> !existingIds.contains(record.getId()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 批量插入新记录
|
||||
int savedCount = 0;
|
||||
if (!newRecords.isEmpty()) {
|
||||
if (this.saveBatch(newRecords)) {
|
||||
savedCount = newRecords.size();
|
||||
|
||||
// 保存关联的操作记录
|
||||
saveRelatedOperators(newRecords, operatorMap);
|
||||
}
|
||||
}
|
||||
return savedCount;
|
||||
}
|
||||
//
|
||||
// @Override
|
||||
// @Transactional(rollbackFor = Exception.class)
|
||||
// public int saveNewRecords(List<AlarmRecord> records, Map<Long, List<Map<String, Object>>> operatorMap) {
|
||||
// if (records == null || records.isEmpty()) return 0;
|
||||
//
|
||||
// // 提取待插入记录的ID列表
|
||||
// List<Long> ids = records.stream().map(AlarmRecord::getId).collect(Collectors.toList());
|
||||
//
|
||||
// // 查询数据库中已存在的记录
|
||||
// LambdaQueryWrapper<AlarmRecord> queryWrapper = new LambdaQueryWrapper<>();
|
||||
// queryWrapper.in(AlarmRecord::getId, ids);
|
||||
// List<AlarmRecord> existingRecords = this.list(queryWrapper);
|
||||
// List<Long> existingIds = existingRecords.stream().map(AlarmRecord::getId).collect(Collectors.toList());
|
||||
//
|
||||
// // 过滤出新增记录
|
||||
// List<AlarmRecord> newRecords = records.stream()
|
||||
// .filter(record -> !existingIds.contains(record.getId()))
|
||||
// .collect(Collectors.toList());
|
||||
//
|
||||
// // 批量插入新记录
|
||||
// int savedCount = 0;
|
||||
// if (!newRecords.isEmpty()) {
|
||||
// if (this.saveBatch(newRecords)) {
|
||||
// savedCount = newRecords.size();
|
||||
//
|
||||
// // 保存关联的操作记录
|
||||
// saveRelatedOperators(newRecords, operatorMap);
|
||||
// }
|
||||
// }
|
||||
// return savedCount;
|
||||
// }
|
||||
|
||||
private void saveRelatedOperators(List<AlarmRecord> newRecords, Map<Long, List<Map<String, Object>>> operatorMap) {
|
||||
if (operatorMap == null || operatorMap.isEmpty()) return;
|
||||
|
@@ -26,4 +26,13 @@ public class RemoteConfigServiceImpl implements RemoteConfigService {
|
||||
return configService.selectRegisterEnabled(tenantId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取访客机二维码有效期
|
||||
*/
|
||||
@Override
|
||||
public String selectQrTimeOut() {
|
||||
return configService.selectConfigByKey("sys.fkqr.timeout");
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -25,6 +25,7 @@ import org.dromara.system.api.model.PostDTO;
|
||||
import org.dromara.system.api.model.RoleDTO;
|
||||
import org.dromara.system.api.model.XcxLoginUser;
|
||||
import org.dromara.system.domain.*;
|
||||
import org.dromara.system.domain.bo.SysDeptBo;
|
||||
import org.dromara.system.domain.bo.SysUserBo;
|
||||
import org.dromara.system.domain.vo.SysDeptVo;
|
||||
import org.dromara.system.domain.vo.SysPostVo;
|
||||
@@ -478,4 +479,16 @@ public class RemoteUserServiceImpl implements RemoteUserService {
|
||||
.collect(Collectors.toMap(SysPost::getPostId, SysPost::getPostName));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Integer> seelectOrgcount() {
|
||||
List<SysDeptVo> sysDeptVos = deptService.selectDeptList(new SysDeptBo());
|
||||
HashMap<String , Integer> hashMap = new HashMap<>();
|
||||
for (SysDeptVo sysDeptVo : sysDeptVos) {
|
||||
Long l = userMapper.selectCount(new LambdaQueryWrapper<SysUser>().eq(SysUser::getDeptId, sysDeptVo.getDeptId()));
|
||||
hashMap.put(sysDeptVo.getDeptName(), l.intValue());
|
||||
}
|
||||
return hashMap;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user