Merge branch 'master' of http://47.109.37.87:3000/by2025/SmartParks
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:
@@ -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());
|
||||
|
Reference in New Issue
Block a user