Merge remote-tracking branch 'origin/master'
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
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
|
||||
*/
|
||||
|
@@ -75,16 +75,20 @@ public class AttendanceArrangementVo implements Serializable {
|
||||
@ExcelProperty(value = "状态:0-未生效,1-已生效")
|
||||
private Long status;
|
||||
|
||||
//考勤组
|
||||
private AttendanceGroup attendanceGroup;
|
||||
|
||||
//用户组
|
||||
private List<AttendanceUserGroup> userGroupList;
|
||||
|
||||
//固定排班
|
||||
private AttendanceWeekSet weekSet;
|
||||
|
||||
//班次
|
||||
private AttendanceShift shift;
|
||||
|
||||
private AttendanceScheduleCycle cycle;
|
||||
//排班制
|
||||
private AttendanceScheduleCycle scheduleCycle;
|
||||
|
||||
private AttendanceUserGroup userGroup;
|
||||
|
||||
}
|
||||
|
@@ -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);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 新增访客管理
|
||||
*
|
||||
|
@@ -20,8 +20,10 @@ import org.dromara.property.service.IAttendanceArrangementService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.DayOfWeek;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.time.temporal.WeekFields;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -78,90 +80,170 @@ public class AttendanceArrangementServiceImpl implements IAttendanceArrangementS
|
||||
@Override
|
||||
public TableDataInfo<AttendanceArrangementVo> queryPageList(AttendanceArrangementBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<AttendanceArrangement> lqw = buildQueryWrapper(bo);
|
||||
Page<AttendanceArrangementVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
|
||||
//查询当前日期在哪些排班中,当前日期大于等于排班开始日期,小于等于排班结束日期
|
||||
LambdaQueryWrapper<AttendanceArrangement> ge = lqw
|
||||
.le(AttendanceArrangement::getStartDate, bo.getCurrentDate())
|
||||
.ge(AttendanceArrangement::getEndDate, bo.getCurrentDate());
|
||||
|
||||
Page<AttendanceArrangementVo> result = baseMapper.selectVoPage(pageQuery.build(), ge);
|
||||
|
||||
Page<AttendanceArrangementVo> attendanceArrangementVoPage = result.setRecords(result.getRecords().stream().map(vo -> {
|
||||
//根据当前日期查询在开始时间和结束时间之间的排班信息
|
||||
//从前端查询出来的当前日期,判断是否在排班时间内
|
||||
if (bo.getCurrentDate().isAfter(vo.getStartDate()) && bo.getCurrentDate().isBefore(vo.getEndDate())) {
|
||||
//1.查询人员表信息
|
||||
//根据查询出来的result取出shceduleId
|
||||
Long scheduleId = vo.getId();
|
||||
//根据排班的id查询出排班的人员详细信息
|
||||
List<AttendanceUserGroup> userGroupList = userGroupMapper.selectList(Wrappers.<AttendanceUserGroup>lambdaQuery().in(AttendanceUserGroup::getScheduleId, scheduleId));
|
||||
vo.setUserGroupList(userGroupList);
|
||||
|
||||
//2.查询考勤组信息
|
||||
//根据查询出来的信息取出考勤组的id
|
||||
Long groupId = vo.getGroupId();
|
||||
//根据考勤组的id查询出考勤组的详细信息
|
||||
AttendanceGroup attendanceGroup = attendanceGroupMapper.selectById(groupId);
|
||||
//将考勤组的信息存到vo中
|
||||
vo.setAttendanceGroup(attendanceGroup);
|
||||
|
||||
//3.查询班制信息
|
||||
//判断当前考勤组的班制是固定班制还是排班制
|
||||
if (Objects.equals(attendanceGroup.getAttendanceType(), StatusConstant.FIXEDSCHEDULE)) {
|
||||
//3.1固定班制
|
||||
//根据考勤组id查询出班制信息的dayOfWeek
|
||||
List<AttendanceWeekSet> weekSetList = weekSetMapper.selectList(Wrappers.<AttendanceWeekSet>lambdaQuery().eq(AttendanceWeekSet::getGroupId, groupId));
|
||||
//将当前日期转换为周几
|
||||
int weekNumber = bo.getCurrentDate().getDayOfWeek().getValue();
|
||||
//匹配weekNumber和weekSetList中的dayOfWeek,匹配成功则将weekSet存到vo中
|
||||
AttendanceWeekSet attendanceWeekSet = weekSetList.stream().filter(weekSet -> weekSet.getDayOfWeek() == weekNumber).findFirst().orElse(null);
|
||||
//根据过滤出来的attendanceWeekSet的weekSetId查询出shiftId
|
||||
Long shiftId = attendanceWeekSet.getShiftId();
|
||||
//根据shiftId查询出班次的详细信息
|
||||
AttendanceShift attendanceShift = attendanceShiftMapper.selectById(shiftId);
|
||||
//将attendanceShift存到vo中
|
||||
vo.setShift(attendanceShift);
|
||||
|
||||
|
||||
Page<AttendanceArrangementVo> attendanceArrangementVoPage = result.setRecords(result.getRecords().stream().peek(vo -> {
|
||||
//1.根据当前日期查询在开始时间和结束时间之间的排班信息
|
||||
//查询指定日期查询在哪些排班中,并返回arrangementList
|
||||
List<AttendanceArrangement> arrangementList = baseMapper.selectList(
|
||||
Wrappers.<AttendanceArrangement>lambdaQuery()
|
||||
.ge(AttendanceArrangement::getStartDate, bo.getCurrentDate())
|
||||
.le(AttendanceArrangement::getEndDate, bo.getCurrentDate())
|
||||
);
|
||||
//根据排班查询出考勤组id
|
||||
List<Long> groupIds = arrangementList.stream().map(AttendanceArrangement::getGroupId).distinct().toList();
|
||||
}else if (Objects.equals(attendanceGroup.getAttendanceType(), StatusConstant.SHIFTSCHEDULE)) {
|
||||
//3.2排班制
|
||||
|
||||
// 2.循环将所有的考勤组id设置到考勤组中
|
||||
//循环groupIds,循环和AttendanceGroup中的id做对比,如果有相同的,则取出attendanceGroup中的所有数据
|
||||
groupIds.forEach(
|
||||
groupId -> {
|
||||
//从数据库查询出当前考勤组的所有数据
|
||||
AttendanceGroup group = attendanceGroupMapper.selectOne(Wrappers.<AttendanceGroup>lambdaQuery().eq(AttendanceGroup::getId, groupId));
|
||||
//将startDate作为第一天,endDate作为最后一天,循环判断当前日期是第几天,取出当前天数的班次信息。
|
||||
LocalDate startDate = vo.getStartDate();
|
||||
LocalDate endDate = vo.getEndDate();
|
||||
LocalDate currentDate = bo.getCurrentDate();
|
||||
// //统计当前考勤组有多少条数据
|
||||
// int count = Math.toIntExact(scheduleCycleMapper.selectCount(Wrappers.<AttendanceScheduleCycle>lambdaQuery().eq(AttendanceScheduleCycle::getGroupId, groupId)));
|
||||
|
||||
// 3.查询出当前考勤组的所有数据,从考勤组判断当前id是固定班制还是排班制
|
||||
if (group.getAttendanceType().equals(StatusConstant.FIXEDSCHEDULE)) {
|
||||
// 3.1固定班制:将当前的日期转为周几,然后与数据库中的班次周数作对比,取出当前日期的班次信息
|
||||
//将传来的日期参数转为周几
|
||||
// int week = DateUtil.dayOfWeek(bo.getCurrentDate());
|
||||
int week = 1;
|
||||
//取出当前日期的周数,与数据库中的班次周数作对比,取出当前日期的班次信息
|
||||
AttendanceWeekSet weekSet = weekSetMapper.selectOne(Wrappers.<AttendanceWeekSet>lambdaQuery().eq(AttendanceWeekSet::getGroupId, groupId).eq(AttendanceWeekSet::getDayOfWeek, week));
|
||||
//将weekSet存到结果中
|
||||
vo.setWeekSet(weekSet);
|
||||
//根据weekSet取出id,根据id查询出attendanceWeekSetShift表中的shiftId
|
||||
Long shiftId = weekSet.getId();
|
||||
//根据shiftId查询attendanceShift表中对应的id的数据
|
||||
AttendanceShift shift = attendanceShiftMapper.selectById(shiftId);
|
||||
//将shift存到结果中
|
||||
vo.setShift(shift);
|
||||
} else if (group.getAttendanceType().equals(StatusConstant.SHIFTSCHEDULE)) {
|
||||
// 3.2排班制:判断第一天是从几号开始,循环判断,判断当前是循环中的第几天,取出当前天数的班次信息。
|
||||
//取出排班中的开始时间和结束时间
|
||||
LocalDate startDate = bo.getStartDate();
|
||||
LocalDate endDate = bo.getEndDate();
|
||||
LocalDate currentDate = bo.getCurrentDate();
|
||||
//统计当前考勤组有多少条数据
|
||||
int count = Math.toIntExact(scheduleCycleMapper.selectCount(Wrappers.<AttendanceScheduleCycle>lambdaQuery().eq(AttendanceScheduleCycle::getGroupId, groupId)));
|
||||
|
||||
|
||||
//todo: 匹配天数
|
||||
|
||||
|
||||
//取出attendanceScheduleCycle表中的天数
|
||||
Integer cycleDays = scheduleCycleMapper.selectOne(Wrappers.<AttendanceScheduleCycle>lambdaQuery().eq(AttendanceScheduleCycle::getGroupId, groupId)).getDayNumber();
|
||||
//在startDate和endDate之间循环,判端当前日期是cycleDays中的第几天
|
||||
int cycleDay = 0;
|
||||
while (startDate.isBefore(currentDate) || endDate.isAfter(currentDate)) {
|
||||
cycleDay++;
|
||||
// startDate = DateUtil.offsetDay(startDate, 1);
|
||||
//判断当前日期是clcleDays中的第几天
|
||||
if (cycleDay > cycleDays) {
|
||||
cycleDay = 1;
|
||||
//取出attendanceScheduleCycle表中的天数
|
||||
List<Integer> cycleDaysList = scheduleCycleMapper.selectList(Wrappers.<AttendanceScheduleCycle>lambdaQuery().eq(AttendanceScheduleCycle::getGroupId, groupId)).stream().map(AttendanceScheduleCycle::getDayNumber).collect(Collectors.toList());
|
||||
// 在startDate和endDate之间循环,判端当前日期是cycleDays中的第几天
|
||||
int cycleDay = 1; // 初始化 cycleDay 为 1
|
||||
for (LocalDate date = startDate; date.isBefore(endDate) || date.isEqual(endDate); date = date.plusDays(1)) {
|
||||
if (date.isEqual(currentDate)) {
|
||||
// 判断当前日期是cycleDays中的第几天
|
||||
int dayNumber = date.getDayOfYear() - startDate.getDayOfYear() + 1;
|
||||
cycleDay = dayNumber % cycleDaysList.size();
|
||||
if (cycleDay == 0) {
|
||||
cycleDay = cycleDaysList.size();
|
||||
}
|
||||
// 根据cycleDay查询出当前日期的班次信息
|
||||
AttendanceScheduleCycle cycle = scheduleCycleMapper.selectOne(Wrappers.<AttendanceScheduleCycle>lambdaQuery()
|
||||
.eq(AttendanceScheduleCycle::getGroupId, groupId)
|
||||
.eq(AttendanceScheduleCycle::getDayNumber, cycleDay));
|
||||
//将cycle存到vo中
|
||||
vo.setScheduleCycle(cycle);
|
||||
//根据cycleId查询出shiftId
|
||||
Long cycleId = cycle.getId();
|
||||
AttendanceShift shift = attendanceShiftMapper.selectOne(Wrappers.<AttendanceShift>lambdaQuery().eq(AttendanceShift::getId, cycle.getShiftId()));
|
||||
//将shift存到vo中
|
||||
vo.setShift(shift);
|
||||
break; // 找到当前日期后跳出循环
|
||||
}
|
||||
//根据cycleDay查询出当前日期的班次信息
|
||||
AttendanceScheduleCycle cycle = scheduleCycleMapper.selectOne(Wrappers.<AttendanceScheduleCycle>lambdaQuery().eq(AttendanceScheduleCycle::getGroupId, groupId).eq(AttendanceScheduleCycle::getDayNumber, cycleDay));
|
||||
//将cycle存到结果中
|
||||
vo.setCycle(cycle);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//根据cycleDay查询出当前日期的班次信息
|
||||
AttendanceScheduleCycle cycle = scheduleCycleMapper.selectOne(Wrappers.<AttendanceScheduleCycle>lambdaQuery().eq(AttendanceScheduleCycle::getGroupId, groupId).eq(AttendanceScheduleCycle::getDayNumber, cycleDay));
|
||||
//将cycle存到vo中
|
||||
vo.setScheduleCycle(cycle);
|
||||
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
// AttendanceArrangementVo arrangementvo = baseMapper.selectVoByTime(bo.getCurrentDate());
|
||||
// //2.查询人员组的信息
|
||||
// //根据开始时间查询出所有的排班id
|
||||
// List<Long> scheduleIdList = baseMapper.selectList(Wrappers.<AttendanceArrangement>lambdaQuery().ge(AttendanceArrangement::getStartDate, bo.getCurrentDate())).stream().map(AttendanceArrangement::getId).collect(Collectors.toList());
|
||||
// //根据排班的id查询出排班的人员详细信息
|
||||
// List<AttendanceUserGroup> userGroupList = userGroupMapper.selectList(Wrappers.<AttendanceUserGroup>lambdaQuery().in(AttendanceUserGroup::getScheduleId, scheduleIdList));
|
||||
// //将排班人员信息添加到排班信息中
|
||||
// arrangementvo.setUserGroupList(userGroupList);
|
||||
} else {
|
||||
TableDataInfo.build();
|
||||
}
|
||||
|
||||
// //1.根据当前日期查询在开始时间和结束时间之间的排班信息
|
||||
// //查询指定日期查询在哪些排班中,并返回arrangementList
|
||||
// List<AttendanceArrangement> arrangementList = baseMapper.selectList(
|
||||
// Wrappers.<AttendanceArrangement>lambdaQuery()
|
||||
// .ge(AttendanceArrangement::getStartDate, bo.getCurrentDate())
|
||||
// .le(AttendanceArrangement::getEndDate, bo.getCurrentDate())
|
||||
// );
|
||||
// //根据排班查询出考勤组id
|
||||
// List<Long> groupIds = arrangementList.stream().map(AttendanceArrangement::getGroupId).distinct().toList();
|
||||
//
|
||||
// //3.根据排班的id查询出排班的考勤组id
|
||||
// List<Long> groupIds = baseMapper.selectList(Wrappers.<AttendanceArrangement>lambdaQuery().ge(AttendanceArrangement::getStartDate, bo.getCurrentDate())).stream().map(AttendanceArrangement::getGroupId).distinct().collect(Collectors.toList());
|
||||
// //判断考勤组是排班制还是固定班制
|
||||
// // 2.循环将所有的考勤组id设置到考勤组中
|
||||
// //循环groupIds,循环和AttendanceGroup中的id做对比,如果有相同的,则取出attendanceGroup中的所有数据
|
||||
// groupIds.forEach(
|
||||
// groupId -> {
|
||||
// //从数据库查询出当前考勤组的所有数据
|
||||
// AttendanceGroup group = attendanceGroupMapper.selectOne(Wrappers.<AttendanceGroup>lambdaQuery().eq(AttendanceGroup::getId, groupId));
|
||||
//
|
||||
// // 3.查询出当前考勤组的所有数据,从考勤组判断当前id是固定班制还是排班制
|
||||
// if (group.getAttendanceType().equals(StatusConstant.FIXEDSCHEDULE)) {
|
||||
// // 3.1固定班制:将当前的日期转为周几,然后与数据库中的班次周数作对比,取出当前日期的班次信息
|
||||
// //将传来的日期参数转为周几
|
||||
//// int week = DateUtil.dayOfWeek(bo.getCurrentDate());
|
||||
// int week = 1;
|
||||
// //取出当前日期的周数,与数据库中的班次周数作对比,取出当前日期的班次信息
|
||||
// AttendanceWeekSet weekSet = weekSetMapper.selectOne(Wrappers.<AttendanceWeekSet>lambdaQuery().eq(AttendanceWeekSet::getGroupId, groupId).eq(AttendanceWeekSet::getDayOfWeek, week));
|
||||
// //将weekSet存到结果中
|
||||
// vo.setWeekSet(weekSet);
|
||||
// //根据weekSet取出id,根据id查询出attendanceWeekSetShift表中的shiftId
|
||||
// Long shiftId = weekSet.getId();
|
||||
// //根据shiftId查询attendanceShift表中对应的id的数据
|
||||
// AttendanceShift shift = attendanceShiftMapper.selectById(shiftId);
|
||||
// //将shift存到结果中
|
||||
// vo.setShift(shift);
|
||||
// } else if (group.getAttendanceType().equals(StatusConstant.SHIFTSCHEDULE)) {
|
||||
// // 3.2排班制:判断第一天是从几号开始,循环判断,判断当前是循环中的第几天,取出当前天数的班次信息。
|
||||
// //取出排班中的开始时间和结束时间
|
||||
// LocalDate startDate = bo.getStartDate();
|
||||
// LocalDate endDate = bo.getEndDate();
|
||||
// LocalDate currentDate = bo.getCurrentDate();
|
||||
// //统计当前考勤组有多少条数据
|
||||
// int count = Math.toIntExact(scheduleCycleMapper.selectCount(Wrappers.<AttendanceScheduleCycle>lambdaQuery().eq(AttendanceScheduleCycle::getGroupId, groupId)));
|
||||
//
|
||||
//
|
||||
// //todo: 匹配天数
|
||||
//
|
||||
//
|
||||
// //取出attendanceScheduleCycle表中的天数
|
||||
// Integer cycleDays = scheduleCycleMapper.selectOne(Wrappers.<AttendanceScheduleCycle>lambdaQuery().eq(AttendanceScheduleCycle::getGroupId, groupId)).getDayNumber();
|
||||
// //在startDate和endDate之间循环,判端当前日期是cycleDays中的第几天
|
||||
// int cycleDay = 0;
|
||||
// while (startDate.isBefore(currentDate) || endDate.isAfter(currentDate)) {
|
||||
// cycleDay++;
|
||||
//// startDate = DateUtil.offsetDay(startDate, 1);
|
||||
// //判断当前日期是clcleDays中的第几天
|
||||
// if (cycleDay > cycleDays) {
|
||||
// cycleDay = 1;
|
||||
// }
|
||||
// }
|
||||
// //根据cycleDay查询出当前日期的班次信息
|
||||
// AttendanceScheduleCycle cycle = scheduleCycleMapper.selectOne(Wrappers.<AttendanceScheduleCycle>lambdaQuery().eq(AttendanceScheduleCycle::getGroupId, groupId).eq(AttendanceScheduleCycle::getDayNumber, cycleDay));
|
||||
// //将cycle存到结果中
|
||||
// vo.setCycle(cycle);
|
||||
//
|
||||
// }
|
||||
// }
|
||||
// );
|
||||
|
||||
return vo;
|
||||
}).collect(Collectors.toList()));
|
||||
|
||||
|
||||
@@ -202,7 +284,6 @@ public class AttendanceArrangementServiceImpl implements IAttendanceArrangementS
|
||||
// List<AttendanceUserGroup> userGroupList = userGroupMapper.selectList(Wrappers.<AttendanceUserGroup>lambdaQuery().in(AttendanceUserGroup::getScheduleId, scheduleIdList));
|
||||
|
||||
|
||||
|
||||
// 根据排班查询出考勤组id
|
||||
List<Long> groupIds = arrangementList.stream()
|
||||
.map(AttendanceArrangement::getGroupId)
|
||||
|
@@ -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>
|
||||
|
||||
|
@@ -36,7 +36,7 @@ public class SisAlarmEventAttachments extends TenantEntity {
|
||||
/**
|
||||
* 时间图片id
|
||||
*/
|
||||
private String ossId;
|
||||
private Long ossId;
|
||||
|
||||
/**
|
||||
* 1:图片,2:文件;3视频
|
||||
|
@@ -77,4 +77,7 @@ public class SisDeviceManage extends BaseEntity {
|
||||
* 设备组id
|
||||
*/
|
||||
private Long groupId;
|
||||
|
||||
private String tenantId;
|
||||
|
||||
}
|
||||
|
@@ -35,7 +35,7 @@ public class SisAlarmEventAttachmentsBo extends BaseEntity {
|
||||
/**
|
||||
* 时间图片id
|
||||
*/
|
||||
private String ossId;
|
||||
private Long ossId;
|
||||
|
||||
/**
|
||||
* 1:图片,2:文件;3视频
|
||||
|
@@ -40,7 +40,7 @@ public class SisAlarmEventAttachmentsVo implements Serializable {
|
||||
* 时间图片id
|
||||
*/
|
||||
@ExcelProperty(value = "时间图片id")
|
||||
private String ossId;
|
||||
private Long ossId;
|
||||
|
||||
/**
|
||||
* 1:图片,2:文件;3视频
|
||||
|
@@ -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);
|
||||
}
|
||||
|
@@ -2,6 +2,7 @@ package org.dromara.sis.service;
|
||||
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.sis.domain.SisAlarmEventAttachments;
|
||||
import org.dromara.sis.domain.bo.SisAlarmEventAttachmentsBo;
|
||||
import org.dromara.sis.domain.vo.SisAlarmEventAttachmentsVo;
|
||||
|
||||
@@ -65,4 +66,13 @@ public interface ISisAlarmEventAttachmentsService {
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
|
||||
/**
|
||||
* 批量写入事件附件表
|
||||
*
|
||||
* @param ls 附件数据
|
||||
* @return 返回写入数量
|
||||
*/
|
||||
Boolean batchInsert(List<SisAlarmEventAttachments> ls);
|
||||
|
||||
}
|
||||
|
@@ -76,6 +76,7 @@ public interface ISisDeviceManageService {
|
||||
*/
|
||||
SisDeviceManageVo queryVoByDeviceIp(String deviceIp);
|
||||
|
||||
SisDeviceManage queryByDeviceIp(String deviceId);
|
||||
/**
|
||||
* 查询设备数
|
||||
*
|
||||
|
@@ -27,6 +27,7 @@ public class AlarmRecordServiceImpl extends ServiceImpl<AlarmRecordMapper, Alarm
|
||||
@Autowired
|
||||
private AlarmTaskOperatorService taskOperatorService;
|
||||
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public int saveOrUpdateRecords(List<AlarmRecord> records, Map<Long, List<Map<String, Object>>> operatorMap) {
|
||||
@@ -58,6 +59,7 @@ public class AlarmRecordServiceImpl extends ServiceImpl<AlarmRecordMapper, Alarm
|
||||
} else {
|
||||
// 新记录
|
||||
newRecords.add(record);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,10 +70,8 @@ public class AlarmRecordServiceImpl extends ServiceImpl<AlarmRecordMapper, Alarm
|
||||
if (this.saveBatch(newRecords)) {
|
||||
result += newRecords.size();
|
||||
// 保存关联的操作记录
|
||||
saveRelatedOperators(newRecords, operatorMap);
|
||||
}
|
||||
}
|
||||
|
||||
// 批量更新修改过的记录
|
||||
if (!updateRecords.isEmpty()) {
|
||||
if (this.updateBatchById(updateRecords)) {
|
||||
@@ -125,38 +125,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;
|
||||
|
@@ -6,7 +6,6 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.sis.domain.SisAlarmEventAttachments;
|
||||
@@ -40,7 +39,7 @@ public class SisAlarmEventAttachmentsServiceImpl implements ISisAlarmEventAttach
|
||||
* @return 【请填写功能名称】
|
||||
*/
|
||||
@Override
|
||||
public SisAlarmEventAttachmentsVo queryById(Long id){
|
||||
public SisAlarmEventAttachmentsVo queryById(Long id) {
|
||||
return baseMapper.selectVoById(id);
|
||||
}
|
||||
|
||||
@@ -75,7 +74,7 @@ public class SisAlarmEventAttachmentsServiceImpl implements ISisAlarmEventAttach
|
||||
LambdaQueryWrapper<SisAlarmEventAttachments> lqw = Wrappers.lambdaQuery();
|
||||
lqw.orderByAsc(SisAlarmEventAttachments::getId);
|
||||
lqw.eq(bo.getEventId() != null, SisAlarmEventAttachments::getEventId, bo.getEventId());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getOssId()), SisAlarmEventAttachments::getOssId, bo.getOssId());
|
||||
lqw.eq(bo.getOssId() != null, SisAlarmEventAttachments::getOssId, bo.getOssId());
|
||||
lqw.eq(bo.getType() != null, SisAlarmEventAttachments::getType, bo.getType());
|
||||
return lqw;
|
||||
}
|
||||
@@ -113,7 +112,7 @@ public class SisAlarmEventAttachmentsServiceImpl implements ISisAlarmEventAttach
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(SisAlarmEventAttachments entity){
|
||||
private void validEntityBeforeSave(SisAlarmEventAttachments entity) {
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
@@ -126,9 +125,14 @@ public class SisAlarmEventAttachmentsServiceImpl implements ISisAlarmEventAttach
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
if (isValid) {
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteByIds(ids) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean batchInsert(List<SisAlarmEventAttachments> ls) {
|
||||
return baseMapper.insertBatch(ls);
|
||||
}
|
||||
}
|
||||
|
@@ -12,19 +12,20 @@ import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.resource.api.RemoteFileService;
|
||||
import org.dromara.resource.api.domain.RemoteFile;
|
||||
import org.dromara.sis.domain.SisAlarmEventAttachments;
|
||||
import org.dromara.sis.domain.SisAlarmEvents;
|
||||
import org.dromara.sis.domain.SisDeviceManage;
|
||||
import org.dromara.sis.domain.bo.SisAlarmEventsBo;
|
||||
import org.dromara.sis.domain.vo.SisAlarmEventsVo;
|
||||
import org.dromara.sis.domain.vo.SisDeviceManageVo;
|
||||
import org.dromara.sis.mapper.SisAlarmEventsMapper;
|
||||
import org.dromara.sis.service.ISisAlarmEventAttachmentsService;
|
||||
import org.dromara.sis.service.ISisAlarmEventsService;
|
||||
import org.dromara.sis.service.ISisDeviceManageService;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 告警Service业务层处理
|
||||
@@ -39,6 +40,7 @@ public class SisAlarmEventsServiceImpl implements ISisAlarmEventsService {
|
||||
|
||||
private final SisAlarmEventsMapper baseMapper;
|
||||
private final ISisDeviceManageService deviceManageService;
|
||||
private final ISisAlarmEventAttachmentsService alarmEventAttachmentsService;
|
||||
|
||||
@DubboReference
|
||||
private RemoteFileService remoteFileService;
|
||||
@@ -148,17 +150,49 @@ public class SisAlarmEventsServiceImpl implements ISisAlarmEventsService {
|
||||
|
||||
@Async
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void createAlarmRecord(String deviceIp, Integer level, Integer type, byte[] smallImg, byte[] bigImg) {
|
||||
// 校验设备信息
|
||||
SisDeviceManageVo sisDeviceManageVo = deviceManageService.queryVoByDeviceIp(deviceIp);
|
||||
if (sisDeviceManageVo == null) {
|
||||
SisDeviceManage sisDeviceManage = deviceManageService.queryByDeviceIp(deviceIp);
|
||||
if (sisDeviceManage == null) {
|
||||
log.error("设备信息不存在,放弃此条告警记录。");
|
||||
return;
|
||||
}
|
||||
// 生成时间信息
|
||||
SisAlarmEvents alarmEvents = new SisAlarmEvents();
|
||||
alarmEvents.setType(1L);
|
||||
alarmEvents.setLevel(Long.valueOf(level));
|
||||
alarmEvents.setDeviceIp(deviceIp);
|
||||
alarmEvents.setDeviceName(sisDeviceManage.getDeviceName());
|
||||
alarmEvents.setDeviceGroupId(sisDeviceManage.getId());
|
||||
alarmEvents.setReportTime(new Date());
|
||||
alarmEvents.setState(1);
|
||||
alarmEvents.setTenantId(sisDeviceManage.getTenantId());
|
||||
alarmEvents.setCreateDept(sisDeviceManage.getCreateDept());
|
||||
int insert = this.baseMapper.insert(alarmEvents);
|
||||
log.info("写入报警事件表完成,num={}", insert);
|
||||
// 写入附件表
|
||||
// 上传图片
|
||||
RemoteFile small = remoteFileService.uploadImg(smallImg);
|
||||
RemoteFile big = remoteFileService.uploadImg(bigImg);
|
||||
|
||||
List<SisAlarmEventAttachments> ls = new ArrayList<>();
|
||||
if (smallImg != null && smallImg.length > 0) {
|
||||
ls.add(createEventAttachments(smallImg, alarmEvents, sisDeviceManage));
|
||||
}
|
||||
if (bigImg != null && bigImg.length > 0) {
|
||||
ls.add(createEventAttachments(bigImg, alarmEvents, sisDeviceManage));
|
||||
}
|
||||
Boolean flag = alarmEventAttachmentsService.batchInsert(ls);
|
||||
log.info("写入告警事件附件表完成, reslut={}, size={}", flag, ls.size());
|
||||
|
||||
}
|
||||
|
||||
public SisAlarmEventAttachments createEventAttachments(byte[] img, SisAlarmEvents alarmEvents, SisDeviceManage sisDeviceManage) {
|
||||
RemoteFile result = remoteFileService.uploadImg(img);
|
||||
SisAlarmEventAttachments attachments = new SisAlarmEventAttachments();
|
||||
attachments.setEventId(alarmEvents.getId());
|
||||
attachments.setOssId(result.getOssId());
|
||||
attachments.setType(1L);
|
||||
attachments.setTenantId(sisDeviceManage.getTenantId());
|
||||
attachments.setCreateDept(sisDeviceManage.getCreateDept());
|
||||
return attachments;
|
||||
}
|
||||
}
|
||||
|
@@ -178,7 +178,14 @@ public class SisDeviceManageServiceImpl implements ISisDeviceManageService {
|
||||
public SisDeviceManageVo queryVoByDeviceIp(String deviceIp) {
|
||||
LambdaQueryWrapper<SisDeviceManage> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(SisDeviceManage::getDeviceIp, deviceIp);
|
||||
return baseMapper.selectVoById(lqw);
|
||||
return baseMapper.selectVoOne(lqw);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SisDeviceManage queryByDeviceIp(String deviceId) {
|
||||
LambdaQueryWrapper<SisDeviceManage> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(SisDeviceManage::getDeviceIp, deviceId);
|
||||
return baseMapper.selectOne(lqw);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -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