Compare commits
5 Commits
6e84a1c646
...
master
Author | SHA1 | Date | |
---|---|---|---|
3ebc58f5e3 | |||
07b9e8b722 | |||
b20828a800 | |||
9c0b0bad03 | |||
a16c333759 |
@@ -125,6 +125,11 @@
|
||||
<artifactId>ruoyi-common-websocket</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.rocketmq</groupId>
|
||||
<artifactId>rocketmq-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
@@ -13,6 +13,7 @@ import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.property.domain.bo.ServiceWorkOrdersBo;
|
||||
import org.dromara.property.domain.bo.mobile.MServiceWorkOrdersBo;
|
||||
import org.dromara.property.domain.vo.ServiceWorkOrdersVo;
|
||||
import org.dromara.property.domain.vo.mobile.MServiceWorkOrdersVo;
|
||||
import org.dromara.property.service.IServiceWorkOrdersService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -35,7 +36,6 @@ public class MServiceWorkOrdersController extends BaseController {
|
||||
* 小程序新增【工单处理】
|
||||
*/
|
||||
@Log(title = "【小程序新增工单处理】", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody MServiceWorkOrdersBo bo) {
|
||||
return toAjax(serviceWorkOrdersService.insertMServiceWorkOrdersBo(bo));
|
||||
@@ -44,7 +44,7 @@ public class MServiceWorkOrdersController extends BaseController {
|
||||
* 小程序查询【工单处理】
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<ServiceWorkOrdersVo> list(ServiceWorkOrdersBo bo, PageQuery pageQuery) {
|
||||
public TableDataInfo<MServiceWorkOrdersVo> list(ServiceWorkOrdersBo bo, PageQuery pageQuery) {
|
||||
return serviceWorkOrdersService.queryMobilePageList(bo, pageQuery);
|
||||
}
|
||||
/**
|
||||
|
@@ -107,10 +107,6 @@ public class ServiceWorkOrdersBo extends BaseEntity {
|
||||
* 图片
|
||||
*/
|
||||
private String imgUrl;
|
||||
/**
|
||||
* 工单图片
|
||||
*/
|
||||
private String orderImgUrl;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
|
@@ -105,6 +105,10 @@ public class MServiceWorkOrdersBo extends BaseEntity {
|
||||
* 工单图片
|
||||
*/
|
||||
private String orderImgUrl;
|
||||
/**
|
||||
* 问题描述
|
||||
*/
|
||||
private String issueDesc;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
|
@@ -47,7 +47,7 @@ public class TbLightInfoBo extends BaseEntity {
|
||||
/**
|
||||
* 楼层ID
|
||||
*/
|
||||
@NotNull(message = "层ID不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
@NotNull(message = "楼层ID不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private Long floorId;
|
||||
|
||||
/**
|
||||
|
@@ -9,6 +9,8 @@ import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import jakarta.validation.constraints.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 水电气业务对象 tb_meter_info
|
||||
*
|
||||
@@ -23,7 +25,7 @@ public class TbMeterInfoBo extends BaseEntity {
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@NotNull(message = "主键id不能为空", groups = { EditGroup.class })
|
||||
@NotNull(message = "主键id不能为空", groups = {EditGroup.class})
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
@@ -44,15 +46,42 @@ public class TbMeterInfoBo extends BaseEntity {
|
||||
/**
|
||||
* 设备类型(1-电表,2-水表,3-气表)
|
||||
*/
|
||||
@NotNull(message = "设备类型(1-电表,2-水表,3-气表)不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
@NotNull(message = "设备类型(1-电表,2-水表,3-气表)不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private Long meterType;
|
||||
|
||||
/**
|
||||
* 计量单位(1-度,2-吨,3-立方米)
|
||||
*/
|
||||
@NotNull(message = "计量单位(1-度,2-吨,3-立方米)不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
@NotNull(message = "计量单位(1-度,2-吨,3-立方米)不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private Long meterUnit;
|
||||
|
||||
/**
|
||||
* 采集器IP
|
||||
*/
|
||||
@NotNull(message = "采集器IP不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private String hostIp;
|
||||
|
||||
/**
|
||||
* 楼层ID
|
||||
*/
|
||||
@NotNull(message = "楼层ID不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private Long floorId;
|
||||
|
||||
/**
|
||||
* 园区编码
|
||||
*/
|
||||
private Long communityId;
|
||||
|
||||
/**
|
||||
* 建筑名称
|
||||
*/
|
||||
private Long buildingId;
|
||||
|
||||
/**
|
||||
* 单元编码
|
||||
*/
|
||||
private Long unitId;
|
||||
|
||||
/**
|
||||
* 安装位置
|
||||
*/
|
||||
@@ -61,12 +90,12 @@ public class TbMeterInfoBo extends BaseEntity {
|
||||
/**
|
||||
* 初始读数
|
||||
*/
|
||||
private Long initReading;
|
||||
private BigDecimal initReading;
|
||||
|
||||
/**
|
||||
* 最大量程
|
||||
*/
|
||||
private Long maxRang;
|
||||
private BigDecimal maxRang;
|
||||
|
||||
/**
|
||||
* 通信状态
|
||||
|
@@ -6,6 +6,7 @@ import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 水电气对象 tb_meter_info
|
||||
@@ -60,12 +61,12 @@ public class TbMeterInfo extends TenantEntity {
|
||||
/**
|
||||
* 初始读数
|
||||
*/
|
||||
private Long initReading;
|
||||
private BigDecimal initReading;
|
||||
|
||||
/**
|
||||
* 最大量程
|
||||
*/
|
||||
private Long maxRang;
|
||||
private BigDecimal maxRang;
|
||||
|
||||
/**
|
||||
* 通信状态
|
||||
@@ -82,5 +83,30 @@ public class TbMeterInfo extends TenantEntity {
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 园区编码
|
||||
*/
|
||||
private Long communityId;
|
||||
|
||||
/**
|
||||
* 建筑名称
|
||||
*/
|
||||
private Long buildingId;
|
||||
|
||||
/**
|
||||
* 单元编码
|
||||
*/
|
||||
private Long unitId;
|
||||
|
||||
/**
|
||||
* 所属楼层ID
|
||||
*/
|
||||
private Long floorId;
|
||||
|
||||
/**
|
||||
* 采集器IP
|
||||
*/
|
||||
private String hostIp;
|
||||
|
||||
|
||||
}
|
||||
|
@@ -0,0 +1,30 @@
|
||||
package org.dromara.property.domain.enums;
|
||||
|
||||
/**
|
||||
* 收费类型枚举
|
||||
*/
|
||||
public enum ChargeTypeEnum {
|
||||
/**
|
||||
* 房屋收费
|
||||
*/
|
||||
HOUS_CHARGES("房屋收费", "1"),
|
||||
/**
|
||||
* 车辆收费
|
||||
*/
|
||||
CARD_CHARGES("车辆收费", "2");
|
||||
private final String name;
|
||||
private final String value;
|
||||
|
||||
ChargeTypeEnum(String name, String value) {
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return this.value;
|
||||
}
|
||||
}
|
@@ -53,8 +53,12 @@ public class CostPayFeeAuditVo implements Serializable {
|
||||
/**
|
||||
* 房间号(如101,202)
|
||||
*/
|
||||
@ExcelProperty(value = "房间号(如101,202)")
|
||||
@ExcelProperty(value = "房间号")
|
||||
private String roomNumber;
|
||||
/**
|
||||
* 车牌号
|
||||
*/
|
||||
private String carNumber;
|
||||
|
||||
/**
|
||||
* 费用项目id
|
||||
|
@@ -146,6 +146,7 @@ public class ServiceWorkOrdersVo implements Serializable {
|
||||
* 图片
|
||||
*/
|
||||
private String imgUrl;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
|
@@ -0,0 +1,61 @@
|
||||
package org.dromara.property.domain.vo.mobile;
|
||||
|
||||
|
||||
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import org.dromara.property.domain.ServiceWorkOrdersRecord;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author yuyongle
|
||||
* @version 1.0
|
||||
* @description: TODO
|
||||
* @date 2025/8/26 13:53
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
@AutoMapper(target = ServiceWorkOrdersRecord.class)
|
||||
public class MServiceWorkOrdersRecordVo implements Serializable {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@ExcelProperty(value = "id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 工单id
|
||||
*/
|
||||
@ExcelProperty(value = "工单id")
|
||||
private String orderId;
|
||||
|
||||
/**
|
||||
* 状态(0创建工单,1已派单2已抢单3处理中,4已完成)
|
||||
*/
|
||||
@ExcelProperty(value = "状态(0创建工单,1已派单2已抢单3处理中,4已完成)")
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 处理人
|
||||
*/
|
||||
@ExcelProperty(value = "处理人")
|
||||
private Long handler;
|
||||
/**
|
||||
* 处理人
|
||||
*/
|
||||
@ExcelProperty(value = "处理人")
|
||||
private String handlerName;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@ExcelProperty(value = "创建时间")
|
||||
private Date createTime;
|
||||
}
|
@@ -0,0 +1,166 @@
|
||||
package org.dromara.property.domain.vo.mobile;
|
||||
|
||||
|
||||
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import org.dromara.property.domain.ServiceWorkOrders;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author yuyongle
|
||||
* @version 1.0
|
||||
* @description: TODO
|
||||
* @date 2025/8/26 13:52
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
@AutoMapper(target = ServiceWorkOrders.class)
|
||||
public class MServiceWorkOrdersVo implements Serializable {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@ExcelProperty(value = "id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 工单编号
|
||||
*/
|
||||
@ExcelProperty(value = "工单编号")
|
||||
private String orderNo;
|
||||
/**
|
||||
* 权重
|
||||
*/
|
||||
@ExcelProperty(value = "权重")
|
||||
private String processingWeight;
|
||||
|
||||
/**
|
||||
* 工单名称
|
||||
*/
|
||||
@ExcelProperty(value = "工单名称")
|
||||
private String orderName;
|
||||
|
||||
/**
|
||||
* 工单类型
|
||||
*/
|
||||
@ExcelProperty(value = "工单类型")
|
||||
private Long type;
|
||||
/**
|
||||
* 上报类型
|
||||
*/
|
||||
private String reportingType;
|
||||
/**
|
||||
* 工单类型名称
|
||||
*/
|
||||
@ExcelProperty(value = "工单类型名称")
|
||||
private String typeName;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
@ExcelProperty(value = "状态(0创建工单,1已派单2已抢单3处理中,4已完成,5已评价)")
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 派单时间
|
||||
*/
|
||||
@ExcelProperty(value = "派单时间")
|
||||
private Date dispatchTime;
|
||||
/**
|
||||
* 运作模式(0派单+抢单,1派单,2自动派单)
|
||||
*/
|
||||
private String operationMode;
|
||||
/**
|
||||
* 发起人
|
||||
*/
|
||||
private String initiatorPeople;
|
||||
|
||||
/**
|
||||
* 处理人姓名
|
||||
*/
|
||||
private long handler;
|
||||
/**
|
||||
* 抄送人
|
||||
*/
|
||||
private long ccPeople;
|
||||
/**
|
||||
* 发起人手机号
|
||||
*/
|
||||
@ExcelProperty(value = "发起人手机号")
|
||||
private String initiatorPhone;
|
||||
/**
|
||||
* 处理人姓名文本
|
||||
*/
|
||||
@ExcelProperty(value = "处理人姓名文本")
|
||||
private String handlerText;
|
||||
|
||||
/**
|
||||
* 处理人姓名文本
|
||||
*/
|
||||
@ExcelProperty(value = "处理人电话")
|
||||
private String handlerPhone;
|
||||
|
||||
/**
|
||||
* 地址
|
||||
*/
|
||||
@ExcelProperty(value = "地址")
|
||||
private String location;
|
||||
|
||||
/**
|
||||
* 计划完成时间
|
||||
*/
|
||||
@ExcelProperty(value = "计划完成时间")
|
||||
private Date planCompleTime;
|
||||
|
||||
/**
|
||||
* 完成时间
|
||||
*/
|
||||
@ExcelProperty(value = "完成时间")
|
||||
private Date compleTime;
|
||||
|
||||
/**
|
||||
* 评价
|
||||
*/
|
||||
@ExcelProperty(value = "评价")
|
||||
private Integer serviceEvalua;
|
||||
|
||||
/**
|
||||
* 是否超时
|
||||
*/
|
||||
@ExcelProperty(value = "是否超时")
|
||||
private String isTimeOut;
|
||||
|
||||
/**
|
||||
* 评价文本
|
||||
*/
|
||||
private String serviceEvaluaText;
|
||||
/**
|
||||
* 工单图片
|
||||
*/
|
||||
private String orderImgUrl;
|
||||
/**
|
||||
* 图片
|
||||
*/
|
||||
private String imgUrl;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
/**
|
||||
* 工单记录
|
||||
*/
|
||||
List<MServiceWorkOrdersRecordVo> recordVoList;
|
||||
}
|
@@ -10,7 +10,7 @@ import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
|
||||
/**
|
||||
@@ -54,7 +54,7 @@ public class TbMeterInfoVo implements Serializable {
|
||||
/**
|
||||
* 设备类型(1-电表,2-水表,3-气表)
|
||||
*/
|
||||
@ExcelProperty(value = "设备类型(1-电表,2-水表,3-气表)" ,converter = ExcelDictConvert.class)
|
||||
@ExcelProperty(value = "设备类型(1-电表,2-水表,3-气表)", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(dictType = "meter_type")
|
||||
private Long meterType;
|
||||
|
||||
@@ -75,13 +75,13 @@ public class TbMeterInfoVo implements Serializable {
|
||||
* 初始读数
|
||||
*/
|
||||
@ExcelProperty(value = "初始读数")
|
||||
private Long initReading;
|
||||
private BigDecimal initReading;
|
||||
|
||||
/**
|
||||
* 最大量程
|
||||
*/
|
||||
@ExcelProperty(value = "最大量程")
|
||||
private Long maxRang;
|
||||
private BigDecimal maxRang;
|
||||
|
||||
/**
|
||||
* 通信状态
|
||||
@@ -97,6 +97,42 @@ public class TbMeterInfoVo implements Serializable {
|
||||
@ExcelDictFormat(dictType = "sis_device_status")
|
||||
private Long runningState;
|
||||
|
||||
/**
|
||||
* 园区编码
|
||||
*/
|
||||
@ExcelProperty(value = "园区编码")
|
||||
private Long communityId;
|
||||
|
||||
/**
|
||||
* 建筑名称
|
||||
*/
|
||||
@ExcelProperty(value = "建筑名称")
|
||||
private Long buildingId;
|
||||
|
||||
/**
|
||||
* 单元编码
|
||||
*/
|
||||
@ExcelProperty(value = "单元编码")
|
||||
private Long unitId;
|
||||
|
||||
/**
|
||||
* 楼层ID
|
||||
*/
|
||||
@ExcelProperty(value = "楼层ID")
|
||||
private Long floorId;
|
||||
|
||||
/**
|
||||
* 楼层
|
||||
*/
|
||||
@ExcelProperty(value = "楼层")
|
||||
private String floorName;
|
||||
|
||||
/**
|
||||
* 采集器IP
|
||||
*/
|
||||
@ExcelProperty(value = "采集器IP")
|
||||
private String hostIp;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
|
@@ -1,5 +1,6 @@
|
||||
package org.dromara.property.mapper.smartDevicesMapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.dromara.property.domain.entity.smartDevices.TbMeterInfo;
|
||||
import org.dromara.property.domain.vo.smartDevicesVo.TbMeterInfoVo;
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
@@ -8,8 +9,9 @@ import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
* 水电气Mapper接口
|
||||
*
|
||||
* @author lsm
|
||||
* @date 2025-07-19
|
||||
* @since 2025-07-19
|
||||
*/
|
||||
@Mapper
|
||||
public interface TbMeterInfoMapper extends BaseMapperPlus<TbMeterInfo, TbMeterInfoVo> {
|
||||
|
||||
}
|
||||
|
@@ -0,0 +1,18 @@
|
||||
package org.dromara.property.rocketmq;
|
||||
|
||||
/**
|
||||
* @author lsm
|
||||
* @apiNote RocketMqConstants
|
||||
* @since 2025/8/25
|
||||
*/
|
||||
public interface RocketMqConstants {
|
||||
// mq topic
|
||||
String TOPIC = "SmartParks";
|
||||
|
||||
// mq GROUP
|
||||
String GROUP = "Meter-Group";
|
||||
|
||||
/*-----------------------------------消息tag------------------------------------*/
|
||||
String METER_RECORD = "METER_RECORD_TAG";
|
||||
|
||||
}
|
@@ -0,0 +1,40 @@
|
||||
package org.dromara.property.rocketmq.consumer;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.rocketmq.common.message.MessageExt;
|
||||
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
|
||||
import org.apache.rocketmq.spring.core.RocketMQListener;
|
||||
import org.dromara.property.rocketmq.RocketMqConstants;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* @author lsm
|
||||
* @apiNote MeterRecordConsumer
|
||||
* @since 2025/8/25
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
@RocketMQMessageListener(
|
||||
topic = RocketMqConstants.TOPIC,
|
||||
consumerGroup = RocketMqConstants.GROUP,
|
||||
selectorExpression = RocketMqConstants.METER_RECORD
|
||||
)
|
||||
public class MeterRecordConsumer implements RocketMQListener<MessageExt> {
|
||||
|
||||
@Override
|
||||
public void onMessage(MessageExt ext) {
|
||||
log.info("消费仪表上报数据,数据长度={}", ext.getBody().length);
|
||||
try {
|
||||
String message = new String(ext.getBody());
|
||||
log.info("物业仪表上报数据,数据={}", message);
|
||||
} catch (Exception e) {
|
||||
log.error("消费仪表上报数据处理失败,", e);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@@ -8,6 +8,7 @@ import org.dromara.property.domain.bo.mobile.MServiceWorkOrdersBo;
|
||||
import org.dromara.property.domain.vo.ServiceWorkOrderAnalysisVo;
|
||||
import org.dromara.property.domain.vo.ServiceWorkOrdersInfoVo;
|
||||
import org.dromara.property.domain.vo.ServiceWorkOrdersVo;
|
||||
import org.dromara.property.domain.vo.mobile.MServiceWorkOrdersVo;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
@@ -101,5 +102,5 @@ public interface IServiceWorkOrdersService {
|
||||
* @param pageQuery 分页参数
|
||||
* @return 【工单处理】分页列表
|
||||
*/
|
||||
TableDataInfo<ServiceWorkOrdersVo> queryMobilePageList(ServiceWorkOrdersBo bo, PageQuery pageQuery);
|
||||
TableDataInfo<MServiceWorkOrdersVo> queryMobilePageList(ServiceWorkOrdersBo bo, PageQuery pageQuery);
|
||||
}
|
||||
|
@@ -18,6 +18,7 @@ import org.dromara.property.domain.CostHouseCharge;
|
||||
import org.dromara.property.domain.CostPayFeeAudit;
|
||||
import org.dromara.property.domain.bo.CostPayFeeAuditBo;
|
||||
import org.dromara.property.domain.enums.ChargeStatusEnum;
|
||||
import org.dromara.property.domain.enums.ChargeTypeEnum;
|
||||
import org.dromara.property.domain.vo.*;
|
||||
import org.dromara.property.mapper.*;
|
||||
import org.dromara.property.service.ICostPayFeeAuditService;
|
||||
@@ -59,7 +60,18 @@ public class CostPayFeeAuditServiceImpl implements ICostPayFeeAuditService {
|
||||
CostItemsVo costItemsVo = costItemsMapper.selectVoById(costPayFeeAuditVo.getItemId());
|
||||
costPayFeeAuditVo.setChargeItem(ObjectUtil.isNotEmpty(costItemsVo) ? costItemsVo.getChargeItem() : null);
|
||||
costPayFeeAuditVo.setChargeCycle(ObjectUtil.isNotEmpty(costItemsVo) ? costItemsVo.getChargeCycle() : null);
|
||||
//TbRoomVo roomVo = roomMapper.selectVoById(costPayFeeAuditVo.getChargeId());
|
||||
if (costPayFeeAuditVo.getChargeType().equals(ChargeTypeEnum.HOUS_CHARGES.getValue())) {
|
||||
CostHouseCharge costHouseCharge = coinHouseChargeMapper.selectById(costPayFeeAuditVo.getChargeId());
|
||||
if (ObjectUtil.isNotEmpty(costHouseCharge)) {
|
||||
String queryRoomName = roomMapper.queryRoomName(costHouseCharge.getRoomId());
|
||||
costPayFeeAuditVo.setRoomNumber(ObjectUtil.isNotEmpty(queryRoomName) ? queryRoomName : null);
|
||||
}
|
||||
}
|
||||
if (costPayFeeAuditVo.getChargeType().equals(ChargeTypeEnum.CARD_CHARGES.getValue())) {
|
||||
CostCarCharge costCarCharge = costCarChargeMapper.selectById(costPayFeeAuditVo.getChargeId());
|
||||
costPayFeeAuditVo.setCarNumber(ObjectUtil.isNotEmpty(costCarCharge) ? costCarCharge.getCarNumber() : null);
|
||||
}
|
||||
// TbRoomVo roomVo = roomMapper.selectVoById(costPayFeeAuditVo.getChargeId());
|
||||
//costPayFeeAuditVo.setRoomNumber(ObjectUtil.isNotEmpty(roomVo)? roomVo.getRoomNumber() :null );
|
||||
return costPayFeeAuditVo;
|
||||
}
|
||||
@@ -175,13 +187,13 @@ public class CostPayFeeAuditServiceImpl implements ICostPayFeeAuditService {
|
||||
private void validEntityBeforeUpdate(CostPayFeeAudit entity) {
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
if (entity.getState().equals("1")) {
|
||||
if (entity.getChargeType().equals("1")) {
|
||||
if (entity.getChargeType().equals(ChargeTypeEnum.HOUS_CHARGES.getValue())) {
|
||||
CostHouseCharge costHouseCharge = coinHouseChargeMapper.selectById(entity.getChargeId());
|
||||
Assert.isTrue(ObjectUtil.isNotEmpty(costHouseCharge), "该房屋收费项不存在!");
|
||||
costHouseCharge.setChargeStatus(ChargeStatusEnum.THE_PAYMENT_WAS_APPROVED.getValue());
|
||||
coinHouseChargeMapper.updateById(costHouseCharge);
|
||||
}
|
||||
if (entity.getChargeType().equals("2")) {
|
||||
if (entity.getChargeType().equals(ChargeTypeEnum.CARD_CHARGES.getValue())) {
|
||||
|
||||
CostCarCharge costCarCharge = costCarChargeMapper.selectById(entity.getChargeId());
|
||||
Assert.isTrue(ObjectUtil.isNotEmpty(costCarCharge), "该车辆收费项为空");
|
||||
@@ -190,13 +202,13 @@ public class CostPayFeeAuditServiceImpl implements ICostPayFeeAuditService {
|
||||
}
|
||||
}
|
||||
if (entity.getState().equals("2")) {
|
||||
if (entity.getChargeType().equals("1")) {
|
||||
if (entity.getChargeType().equals(ChargeTypeEnum.HOUS_CHARGES.getValue())) {
|
||||
CostHouseCharge costHouseCharge = coinHouseChargeMapper.selectById(entity.getChargeId());
|
||||
Assert.isTrue(ObjectUtil.isNotEmpty(costHouseCharge), "该房屋收费项为空");
|
||||
costHouseCharge.setChargeStatus(ChargeStatusEnum.THE_PAYMENT_REVIEW_FAILED.getValue());
|
||||
coinHouseChargeMapper.updateById(costHouseCharge);
|
||||
}
|
||||
if (entity.getChargeType().equals("2")) {
|
||||
if (entity.getChargeType().equals(ChargeTypeEnum.CARD_CHARGES.getValue())) {
|
||||
CostCarCharge costCarCharge = costCarChargeMapper.selectById(entity.getChargeId());
|
||||
Assert.isTrue(ObjectUtil.isNotEmpty(costCarCharge), "该车辆收费项为空");
|
||||
costCarCharge.setChargeStatus(ChargeStatusEnum.THE_PAYMENT_REVIEW_FAILED.getValue());
|
||||
|
@@ -85,11 +85,13 @@ public class MeetBookingServiceImpl implements IMeetBookingService {
|
||||
public TableDataInfo<MeetBookingVo> queryPageList(MeetBookingBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<MeetBooking> lqw = buildQueryWrapper(bo);
|
||||
Page<MeetBookingVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
List<MeetBookingVo> meetBookingVoList = new ArrayList<>();
|
||||
if(CollUtil.isNotEmpty(result.getRecords())){
|
||||
List<ResidentUnitVo> residentUnitVolist = residentUnitMapper.selectVoList();
|
||||
List<Long> userId = result.getRecords().stream().map(vo -> vo.getPerson()).distinct().map(Long::parseLong).collect(Collectors.toList());
|
||||
List<ResidentPersonVo> remoteUserVos = residentPersonMapper.selectVoByIds(userId);
|
||||
// List<RemoteUserVo> remoteUserVos = remoteUserService.selectListByIds(userId);
|
||||
List<MeetBookingVo> meetBookingVoList = new ArrayList<>();
|
||||
|
||||
result.getRecords().stream().forEach(s -> {
|
||||
if (CollUtil.isNotEmpty(residentUnitVolist)) {
|
||||
ResidentUnitVo residentUnitVo = residentUnitVolist.stream()
|
||||
@@ -104,6 +106,7 @@ public class MeetBookingServiceImpl implements IMeetBookingService {
|
||||
}
|
||||
meetBookingVoList.add(s);
|
||||
});
|
||||
}
|
||||
return TableDataInfo.build(new Page<MeetBookingVo>().setRecords(meetBookingVoList).setTotal(result.getTotal()));
|
||||
}
|
||||
|
||||
|
@@ -1,8 +1,10 @@
|
||||
package org.dromara.property.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import org.apache.dubbo.config.annotation.DubboReference;
|
||||
import org.dromara.common.core.exception.ServiceException;
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
@@ -12,11 +14,11 @@ 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.property.domain.MeetAttach;
|
||||
import org.dromara.property.domain.MeetBooking;
|
||||
import org.dromara.property.domain.vo.MeetAttachVo;
|
||||
import org.dromara.property.domain.vo.ResidentPersonVo;
|
||||
import org.dromara.property.mapper.MeetBookingMapper;
|
||||
import org.dromara.property.mapper.ResidentPersonMapper;
|
||||
import org.dromara.property.mapper.TbRoomMapper;
|
||||
import org.dromara.property.mapper.*;
|
||||
import org.dromara.system.api.RemoteUserService;
|
||||
import org.dromara.system.api.domain.vo.RemoteUserVo;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -24,7 +26,6 @@ import org.springframework.stereotype.Service;
|
||||
import org.dromara.property.domain.bo.MeetBo;
|
||||
import org.dromara.property.domain.vo.MeetVo;
|
||||
import org.dromara.property.domain.Meet;
|
||||
import org.dromara.property.mapper.MeetMapper;
|
||||
import org.dromara.property.service.IMeetService;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@@ -48,6 +49,7 @@ import java.util.stream.Collectors;
|
||||
public class MeetServiceImpl implements IMeetService {
|
||||
|
||||
private final MeetMapper baseMapper;
|
||||
private final MeetAttachMapper meetAttachMapper;
|
||||
private final ResidentPersonMapper residentPersonMapper;
|
||||
private final TbRoomMapper roomMapper;
|
||||
private final MeetBookingMapper meetbookMapper;
|
||||
@@ -63,7 +65,7 @@ public class MeetServiceImpl implements IMeetService {
|
||||
@Override
|
||||
public MeetVo queryById(Long id) {
|
||||
MeetVo meetVo = baseMapper.selectVoById(id);
|
||||
// ResidentPersonVo residentPersonVo = residentPersonMapper.selectVoById(meetVo.getPrincipals());
|
||||
// ResidentPersonVo residentPersonVo = residentPersonMapper.selectVoById(meetVo.getPrincipals());
|
||||
// if(ObjectUtil.isNotEmpty(residentPersonVo)){
|
||||
// meetVo.setPrincipalsName(residentPersonVo.getUserName());
|
||||
// meetVo.setPhoneNo(residentPersonVo.getPhone());
|
||||
@@ -216,6 +218,10 @@ public class MeetServiceImpl implements IMeetService {
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if (isValid) {
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
boolean exists = meetAttachMapper.exists(new LambdaQueryWrapper<MeetAttach>().in(MeetAttach::getMeetId, ids));
|
||||
Assert.isTrue(!exists, "会议室具有增值服务,不允许单独删除");
|
||||
boolean meetbookExists = meetbookMapper.exists(new LambdaQueryWrapper<MeetBooking>().in(MeetBooking::getMeetId, ids));
|
||||
Assert.isTrue(!meetbookExists, "会议室具有预约记录,不允许单独删除");
|
||||
}
|
||||
return baseMapper.deleteByIds(ids) > 0;
|
||||
}
|
||||
|
@@ -26,6 +26,8 @@ import org.dromara.property.domain.enums.OrderReportingTypeEnum;
|
||||
import org.dromara.property.domain.enums.OrderTypeOperationEnum;
|
||||
import org.dromara.property.domain.enums.WorkOrderStatusEnum;
|
||||
import org.dromara.property.domain.vo.*;
|
||||
import org.dromara.property.domain.vo.mobile.MServiceWorkOrdersRecordVo;
|
||||
import org.dromara.property.domain.vo.mobile.MServiceWorkOrdersVo;
|
||||
import org.dromara.property.mapper.ResidentPersonMapper;
|
||||
import org.dromara.property.mapper.ServiceWorkOrdersMapper;
|
||||
import org.dromara.property.mapper.ServiceWorkOrdersRecordMapper;
|
||||
@@ -119,23 +121,20 @@ public class ServiceWorkOrdersServiceImpl implements IServiceWorkOrdersService {
|
||||
public TableDataInfo<ServiceWorkOrdersVo> queryPageList(ServiceWorkOrdersBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<ServiceWorkOrders> lqw = buildQueryWrapper(bo);
|
||||
Page<ServiceWorkOrdersVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
if (ObjectUtil.isEmpty(result.getRecords())) {
|
||||
return TableDataInfo.build(result);
|
||||
if (ObjectUtil.isNotEmpty(result.getRecords())) {
|
||||
List<Long> typeList = result.getRecords().stream().map(vo -> vo.getType()).distinct().collect(Collectors.toList());
|
||||
List<ServiceWorkOrdersTypeVo> serviceWorkOrdersTypeVoList = typesMapper.selectVoByIds(typeList);
|
||||
if (ObjectUtil.isNotEmpty(serviceWorkOrdersTypeVoList)) {
|
||||
List<ServiceWorkOrdersVo> serviceWorkOrdersVoList = new ArrayList<>();
|
||||
result.getRecords().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);
|
||||
s.setOperationMode(ObjectUtil.isNotNull(serviceWorkOrdersTypeVo) ? serviceWorkOrdersTypeVo.getOperationMode() : null);
|
||||
serviceWorkOrdersVoList.add(s);
|
||||
});
|
||||
}
|
||||
}
|
||||
List<Long> typeList = result.getRecords().stream().map(vo -> vo.getType()).distinct().collect(Collectors.toList());
|
||||
List<ServiceWorkOrdersTypeVo> serviceWorkOrdersTypeVoList = typesMapper.selectVoByIds(typeList);
|
||||
if (ObjectUtil.isEmpty(serviceWorkOrdersTypeVoList)) {
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
List<ServiceWorkOrdersVo> serviceWorkOrdersVoList = new ArrayList<>();
|
||||
result.getRecords().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);
|
||||
s.setOperationMode(ObjectUtil.isNotNull(serviceWorkOrdersTypeVo) ? serviceWorkOrdersTypeVo.getOperationMode() : null);
|
||||
serviceWorkOrdersVoList.add(s);
|
||||
});
|
||||
return TableDataInfo.build(new Page<ServiceWorkOrdersVo>().setRecords(serviceWorkOrdersVoList).setTotal(result.getTotal()));
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -246,14 +245,14 @@ public class ServiceWorkOrdersServiceImpl implements IServiceWorkOrdersService {
|
||||
.ge(AttendanceUserGroup::getEndDate, today)
|
||||
.orderByAsc(AttendanceUserGroup::getCreateTime)
|
||||
);
|
||||
Assert.isTrue(CollUtil.isNotEmpty(attendanceUserGroups),"暂无排班人员");
|
||||
Assert.isTrue(CollUtil.isNotEmpty(attendanceUserGroups), "暂无排班人员");
|
||||
// 缓存当天排班数据(假设当天不会变)
|
||||
RedisUtils.setCacheList(DateUtil.today(), attendanceUserGroups);
|
||||
RedisUtils.setCacheList(DateUtil.today(), attendanceUserGroups);
|
||||
}
|
||||
|
||||
// 2. 获取并更新轮询索引(原子性很重要)
|
||||
int currentIndex;
|
||||
Integer lastScheduleId = RedisUtils.getCacheObject(DateUtil.today()+"LastScheduleId");
|
||||
Integer lastScheduleId = RedisUtils.getCacheObject(DateUtil.today() + "LastScheduleId");
|
||||
if (lastScheduleId == null || lastScheduleId < 0 || lastScheduleId >= attendanceUserGroups.size()) {
|
||||
currentIndex = 0; // 越界或未设置,重置为0
|
||||
} else {
|
||||
@@ -262,7 +261,7 @@ public class ServiceWorkOrdersServiceImpl implements IServiceWorkOrdersService {
|
||||
currentIndex = 0; // 循环轮询
|
||||
}
|
||||
}
|
||||
RedisUtils.setCacheObject(DateUtil.today()+"LastScheduleId", currentIndex);
|
||||
RedisUtils.setCacheObject(DateUtil.today() + "LastScheduleId", currentIndex);
|
||||
|
||||
// 3. 分配处理人
|
||||
AttendanceUserGroup assignedGroup = attendanceUserGroups.get(currentIndex);
|
||||
@@ -631,30 +630,66 @@ public class ServiceWorkOrdersServiceImpl implements IServiceWorkOrdersService {
|
||||
* @return 【工单处理】分页列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<ServiceWorkOrdersVo> queryMobilePageList(ServiceWorkOrdersBo bo, PageQuery pageQuery) {
|
||||
|
||||
//当前登录用户
|
||||
public TableDataInfo<MServiceWorkOrdersVo> queryMobilePageList(ServiceWorkOrdersBo bo, PageQuery pageQuery) {
|
||||
// 当前登录用户
|
||||
LoginUser loginUser = LoginHelper.getLoginUser();
|
||||
if (!LoginHelper.isSuperAdmin(loginUser.getUserId())) {
|
||||
bo.setHandler(loginUser.getUserId());
|
||||
}
|
||||
LambdaQueryWrapper<ServiceWorkOrders> lqw = buildQueryWrapper(bo);
|
||||
Page<ServiceWorkOrdersVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
if (ObjectUtil.isEmpty(result.getRecords())) {
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
List<Long> typeList = result.getRecords().stream().map(vo -> vo.getType()).distinct().collect(Collectors.toList());
|
||||
List<ServiceWorkOrdersTypeVo> serviceWorkOrdersTypeVoList = typesMapper.selectVoByIds(typeList);
|
||||
if (ObjectUtil.isEmpty(serviceWorkOrdersTypeVoList)) {
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
List<ServiceWorkOrdersVo> serviceWorkOrdersVoList = new ArrayList<>();
|
||||
result.getRecords().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 TableDataInfo.build(new Page<ServiceWorkOrdersVo>().setRecords(serviceWorkOrdersVoList).setTotal(result.getTotal()));
|
||||
// 转换 VO 类型
|
||||
List<MServiceWorkOrdersVo> mServiceWorkOrdersVos = new ArrayList<>();
|
||||
if (CollUtil.isNotEmpty(result.getRecords())) {
|
||||
List<Long> typeList = result.getRecords().stream()
|
||||
.map(ServiceWorkOrdersVo::getType)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
|
||||
List<ServiceWorkOrdersTypeVo> typeVoList = typesMapper.selectVoByIds(typeList);
|
||||
Map<Long, String> typeMap = typeVoList.stream()
|
||||
.collect(Collectors.toMap(ServiceWorkOrdersTypeVo::getId, ServiceWorkOrdersTypeVo::getOrderTypeName, (a, b) -> a));
|
||||
//收集处理人转化成list
|
||||
List<Long> handlerIdList = result.getRecords().stream().map(ServiceWorkOrdersVo::getHandler)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
List<RemoteUserVo> remoteUserVos = remoteUserService.selectListByIds(handlerIdList);
|
||||
// 转换并设置 typeName
|
||||
mServiceWorkOrdersVos = result.getRecords().stream().map(vo -> {
|
||||
MServiceWorkOrdersVo mVo = BeanUtil.copyProperties(vo, MServiceWorkOrdersVo.class);
|
||||
dataProcessing(mVo, typeMap, remoteUserVos);
|
||||
return mVo;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
// 构建分页结果
|
||||
Page<MServiceWorkOrdersVo> pageResult = new Page<>();
|
||||
pageResult.setRecords(mServiceWorkOrdersVos);
|
||||
pageResult.setTotal(result.getTotal());
|
||||
pageResult.setCurrent(result.getCurrent());
|
||||
pageResult.setSize(result.getSize());
|
||||
return TableDataInfo.build(pageResult);
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理数据
|
||||
*
|
||||
* @param mServiceWorkOrdersVo
|
||||
*/
|
||||
private void dataProcessing(MServiceWorkOrdersVo mServiceWorkOrdersVo, Map<Long, String> typeMap, List<RemoteUserVo> remoteUserVos) {
|
||||
mServiceWorkOrdersVo.setTypeName(typeMap.getOrDefault(mServiceWorkOrdersVo.getType(), null));
|
||||
//通过处理人id查询处理人信息
|
||||
RemoteUserVo remoteUserVo = remoteUserVos.stream().filter(user -> user.getUserId().equals(mServiceWorkOrdersVo.getHandler())).findFirst().orElse(null);
|
||||
mServiceWorkOrdersVo.setHandlerPhone(remoteUserVo != null ? remoteUserVo.getPhonenumber() : null);
|
||||
mServiceWorkOrdersVo.setHandlerText(remoteUserVo != null ? remoteUserVo.getNickName() : null);
|
||||
//查询工单处理记录
|
||||
List<ServiceWorkOrdersRecordVo> serviceWorkOrdersRecordVoList = workOrdersRecordMapper.selectVoList(new LambdaQueryWrapper<ServiceWorkOrdersRecord>().eq(ServiceWorkOrdersRecord::getOrderId, mServiceWorkOrdersVo.getId()));
|
||||
if (CollUtil.isNotEmpty(serviceWorkOrdersRecordVoList)) {
|
||||
List<MServiceWorkOrdersRecordVo> mServiceWorkOrdersRecordVos = BeanUtil.copyToList(serviceWorkOrdersRecordVoList, MServiceWorkOrdersRecordVo.class);
|
||||
mServiceWorkOrdersRecordVos.stream().forEach(workOrdersRecordVo -> {
|
||||
workOrdersRecordVo.setHandlerName(Objects.nonNull(remoteUserVo) ? remoteUserVo.getNickName() : null);
|
||||
});
|
||||
mServiceWorkOrdersVo.setRecordVoList(mServiceWorkOrdersRecordVos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -10,6 +10,7 @@ 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.property.domain.bo.TbFloorBo;
|
||||
import org.dromara.property.domain.vo.TbFloorVo;
|
||||
import org.dromara.property.service.ITbFloorService;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -23,6 +24,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 灯控开关信息Service业务层处理
|
||||
@@ -60,7 +62,19 @@ public class TbLightInfoServiceImpl implements ITbLightInfoService {
|
||||
public TableDataInfo<TbLightInfoVo> queryPageList(TbLightInfoBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<TbLightInfo> lqw = buildQueryWrapper(bo);
|
||||
Page<TbLightInfoVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
result.getRecords().forEach(r -> r.setFloorName(floorService.queryById(r.getFloorId()).getFloorName()));
|
||||
|
||||
// 创建楼层ID到楼层名称的映射,避免重复查询
|
||||
List<TbFloorVo> floorVo = floorService.queryList(new TbFloorBo());
|
||||
Map<Long, String> floorMap = floorVo.stream()
|
||||
.collect(Collectors.toMap(TbFloorVo::getId, TbFloorVo::getFloorName, (key1, key2) -> key1));
|
||||
|
||||
// 为每个灯控信息设置楼层名称
|
||||
result.getRecords().forEach(record -> {
|
||||
String floorName = floorMap.get(record.getFloorId());
|
||||
if (floorName != null) {
|
||||
record.setFloorName(floorName);
|
||||
}
|
||||
});
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
@@ -151,7 +165,7 @@ public class TbLightInfoServiceImpl implements ITbLightInfoService {
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean switchSingleLight(TbLightInfoBo bo){
|
||||
public Boolean switchSingleLight(TbLightInfoBo bo) {
|
||||
TbLightInfo update = MapstructUtils.convert(bo, TbLightInfo.class);
|
||||
boolean flag = baseMapper.updateById(update) > 0;
|
||||
Assert.isTrue(flag, "修改灯开关失败");
|
||||
|
@@ -1,5 +1,6 @@
|
||||
package org.dromara.property.service.impl.smartDevicesImpl;
|
||||
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
@@ -9,16 +10,21 @@ 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.property.domain.bo.TbFloorBo;
|
||||
import org.dromara.property.domain.vo.TbFloorVo;
|
||||
import org.dromara.property.service.ITbFloorService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.dromara.property.domain.bo.smartDevicesBo.TbMeterInfoBo;
|
||||
import org.dromara.property.domain.vo.smartDevicesVo.TbMeterInfoVo;
|
||||
import org.dromara.property.domain.entity.smartDevices.TbMeterInfo;
|
||||
import org.dromara.property.mapper.smartDevicesMapper.TbMeterInfoMapper;
|
||||
import org.dromara.property.service.smartDevicesService.ITbMeterInfoService;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 水电气Service业务层处理
|
||||
@@ -27,11 +33,12 @@ import java.util.Collection;
|
||||
* @since 2025-07-19
|
||||
*/
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class TbMeterInfoServiceImpl implements ITbMeterInfoService {
|
||||
|
||||
private final TbMeterInfoMapper baseMapper;
|
||||
private final ITbFloorService floorService;
|
||||
|
||||
/**
|
||||
* 查询水电气
|
||||
@@ -40,7 +47,7 @@ public class TbMeterInfoServiceImpl implements ITbMeterInfoService {
|
||||
* @return 水电气
|
||||
*/
|
||||
@Override
|
||||
public TbMeterInfoVo queryById(Long id){
|
||||
public TbMeterInfoVo queryById(Long id) {
|
||||
return baseMapper.selectVoById(id);
|
||||
}
|
||||
|
||||
@@ -55,6 +62,19 @@ public class TbMeterInfoServiceImpl implements ITbMeterInfoService {
|
||||
public TableDataInfo<TbMeterInfoVo> queryPageList(TbMeterInfoBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<TbMeterInfo> lqw = buildQueryWrapper(bo);
|
||||
Page<TbMeterInfoVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
// 创建楼层ID到楼层名称的映射,避免重复查询
|
||||
List<TbFloorVo> floorList = floorService.queryList(new TbFloorBo());
|
||||
Map<Long, String> floorMap = floorList.stream()
|
||||
.collect(Collectors.toMap(TbFloorVo::getId, TbFloorVo::getFloorName, (key1, key2) -> key1));
|
||||
|
||||
// 为每个灯控信息设置楼层名称
|
||||
result.getRecords().forEach(record -> {
|
||||
String floorName = floorMap.get(record.getFloorId());
|
||||
if (floorName != null) {
|
||||
record.setFloorName(floorName);
|
||||
}
|
||||
});
|
||||
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
@@ -94,13 +114,15 @@ public class TbMeterInfoServiceImpl implements ITbMeterInfoService {
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean insertByBo(TbMeterInfoBo bo) {
|
||||
TbMeterInfo add = MapstructUtils.convert(bo, TbMeterInfo.class);
|
||||
validEntityBeforeSave(add);
|
||||
assert add != null;
|
||||
TbFloorVo floor = floorService.queryById(add.getFloorId());
|
||||
add.setBuildingId(floor.getBuildingId());
|
||||
add.setCommunityId(floor.getCommunityId());
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setId(add.getId());
|
||||
}
|
||||
Assert.isTrue(flag, "新增水电气信息失败");
|
||||
return flag;
|
||||
}
|
||||
|
||||
@@ -120,7 +142,7 @@ public class TbMeterInfoServiceImpl implements ITbMeterInfoService {
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(TbMeterInfo entity){
|
||||
private void validEntityBeforeSave(TbMeterInfo entity) {
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
@@ -133,7 +155,7 @@ public class TbMeterInfoServiceImpl implements ITbMeterInfoService {
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
if (isValid) {
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteByIds(ids) > 0;
|
||||
|
@@ -0,0 +1,75 @@
|
||||
package org.dromara.sis.config;
|
||||
|
||||
import org.apache.rocketmq.client.producer.DefaultMQProducer;
|
||||
import org.apache.rocketmq.spring.core.RocketMQTemplate;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* @author lsm
|
||||
* @apiNote RocketMQClusterConfig
|
||||
* @since 2025/8/26
|
||||
*/
|
||||
@Configuration
|
||||
public class RocketMQClusterConfig {
|
||||
|
||||
// 从配置文件中读取 cluster 的配置
|
||||
@Value("${rocketmq.cluster1.name-server}")
|
||||
private String nameServer1;
|
||||
|
||||
@Value("${rocketmq.cluster1.producer.group}")
|
||||
private String producerGroup1;
|
||||
|
||||
// 为第一个集群创建生产者实例
|
||||
@Bean({"clusterProducerOne"})
|
||||
public DefaultMQProducer clusterProducerOne() throws Exception {
|
||||
DefaultMQProducer producer = new DefaultMQProducer(producerGroup1);
|
||||
producer.setNamesrvAddr(nameServer1);
|
||||
// 设置发送超时时间
|
||||
producer.setSendMsgTimeout(5000);
|
||||
// 设置重试次数
|
||||
producer.setRetryTimesWhenSendFailed(2);
|
||||
producer.setRetryTimesWhenSendAsyncFailed(2);
|
||||
return producer;
|
||||
}
|
||||
|
||||
// 使用上面的生产者实例创建 RocketMQTemplate
|
||||
@Bean("rocketMQTemplateClusterOne")
|
||||
public RocketMQTemplate rocketMQTemplateClusterOne(@Qualifier("clusterProducerOne") DefaultMQProducer producer) {
|
||||
RocketMQTemplate template = new RocketMQTemplate();
|
||||
template.setProducer(producer);
|
||||
return template;
|
||||
}
|
||||
|
||||
|
||||
// 从配置文件中读取 cluster 的配置
|
||||
@Value("${rocketmq.cluster2.name-server}")
|
||||
private String nameServer2;
|
||||
|
||||
@Value("${rocketmq.cluster2.producer.group}")
|
||||
private String producerGroup2;
|
||||
|
||||
// 为第二个集群创建生产者实例
|
||||
@Bean({"clusterProducerTwo"})
|
||||
public DefaultMQProducer clusterProducerTwo() throws Exception {
|
||||
DefaultMQProducer producer = new DefaultMQProducer(producerGroup2);
|
||||
producer.setNamesrvAddr(nameServer2);
|
||||
// 设置发送超时时间
|
||||
producer.setSendMsgTimeout(5000);
|
||||
// 设置重试次数
|
||||
producer.setRetryTimesWhenSendFailed(2);
|
||||
producer.setRetryTimesWhenSendAsyncFailed(2);
|
||||
return producer;
|
||||
}
|
||||
|
||||
// 使用上面的生产者实例创建 RocketMQTemplate
|
||||
@Bean("rocketMQTemplateClusterTwo")
|
||||
public RocketMQTemplate rocketMQTemplateClusterTwo(@Qualifier("clusterProducerTwo") DefaultMQProducer producer) {
|
||||
RocketMQTemplate template = new RocketMQTemplate();
|
||||
template.setProducer(producer);
|
||||
return template;
|
||||
}
|
||||
|
||||
}
|
@@ -10,7 +10,7 @@ public interface RocketMqConstants {
|
||||
String TOPIC = "SmartParks";
|
||||
|
||||
// mq GROUP
|
||||
String GROUP = "SmartParksEqp";
|
||||
String GROUP = "SmartParks";
|
||||
|
||||
/*-----------------------------------消息tag------------------------------------*/
|
||||
String HIKADD = "ADD_HIK_DEVICE_TAG";
|
||||
@@ -19,4 +19,6 @@ public interface RocketMqConstants {
|
||||
// 人脸比对
|
||||
String FACECOMPARE = "FACE_COMPARE_REPORT";
|
||||
|
||||
String METER_RECORD = "METER_RECORD_TAG";
|
||||
|
||||
}
|
||||
|
@@ -9,6 +9,7 @@ import org.apache.rocketmq.spring.core.RocketMQListener;
|
||||
import org.dromara.sis.rocketmq.RocketMqConstants;
|
||||
import org.dromara.sis.rocketmq.domain.FaceCapture;
|
||||
import org.dromara.sis.service.IZeroSensationPassageService;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
@@ -23,7 +24,8 @@ import org.springframework.stereotype.Component;
|
||||
@RocketMQMessageListener(
|
||||
topic = RocketMqConstants.TOPIC,
|
||||
consumerGroup = RocketMqConstants.GROUP,
|
||||
selectorExpression = RocketMqConstants.FACECAPTURE
|
||||
selectorExpression = RocketMqConstants.FACECAPTURE,
|
||||
nameServer = "${rocketmq.cluster2.name-server}"
|
||||
)
|
||||
public class FaceCaptureConsumer implements RocketMQListener<MessageExt> {
|
||||
|
||||
@@ -34,7 +36,7 @@ public class FaceCaptureConsumer implements RocketMQListener<MessageExt> {
|
||||
log.info("消费人脸抓拍数据,数据长度={}", ext.getBody().length);
|
||||
try {
|
||||
FaceCapture capture = JSONObject.parseObject(ext.getBody(), FaceCapture.class);
|
||||
zeroSensationPassageService.pass(capture.getDeviceIp(), capture.getSmallImg(), capture.getBigImg());
|
||||
// zeroSensationPassageService.pass(capture.getDeviceIp(), capture.getSmallImg(), capture.getBigImg());
|
||||
} catch (Exception e) {
|
||||
log.error("消费人脸抓拍数据处理失败,", e);
|
||||
}
|
||||
|
@@ -22,7 +22,8 @@ import org.springframework.stereotype.Component;
|
||||
@RocketMQMessageListener(
|
||||
topic = RocketMqConstants.TOPIC,
|
||||
consumerGroup = RocketMqConstants.GROUP,
|
||||
selectorExpression = RocketMqConstants.FACECOMPARE
|
||||
selectorExpression = RocketMqConstants.FACECOMPARE,
|
||||
nameServer = "${rocketmq.cluster2.name-server}"
|
||||
)
|
||||
public class FaceCompareConsumer implements RocketMQListener<MessageExt> {
|
||||
|
||||
@@ -32,7 +33,7 @@ public class FaceCompareConsumer implements RocketMQListener<MessageExt> {
|
||||
log.info("消费人脸比对数据,数据长度={}", ext.getBody().length);
|
||||
try {
|
||||
FaceCompare compare = JSONObject.parseObject(ext.getBody(), FaceCompare.class);
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("消费比对抓拍数据处理失败,", e);
|
||||
}
|
||||
|
@@ -0,0 +1,38 @@
|
||||
package org.dromara.sis.rocketmq.consumer;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.rocketmq.common.message.MessageExt;
|
||||
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
|
||||
import org.apache.rocketmq.spring.core.RocketMQListener;
|
||||
import org.dromara.sis.rocketmq.RocketMqConstants;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @author lsm
|
||||
* @apiNote MeterRecordConsumer
|
||||
* @since 2025/8/25
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
@RocketMQMessageListener(
|
||||
consumerGroup = "Meter_Group",
|
||||
topic = RocketMqConstants.TOPIC,
|
||||
selectorExpression = RocketMqConstants.METER_RECORD,
|
||||
nameServer = "${rocketmq.cluster2.name-server}"
|
||||
)
|
||||
public class MeterRecordConsumer implements RocketMQListener<MessageExt> {
|
||||
|
||||
@Override
|
||||
public void onMessage(MessageExt ext) {
|
||||
log.info("消费仪表上报数据,数据长度={}", ext.getBody().length);
|
||||
try {
|
||||
String message = new String(ext.getBody());
|
||||
log.info("消费仪表上报数据,数据={}", message);
|
||||
} catch (Exception e) {
|
||||
log.error("消费仪表上报数据处理失败,", e);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@@ -0,0 +1,69 @@
|
||||
package org.dromara.sis.rocketmq.producer;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.rocketmq.common.message.Message;
|
||||
import org.apache.rocketmq.spring.core.RocketMQTemplate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @author lsm
|
||||
* @apiNote ProducerService
|
||||
* @since 2025/8/26
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class ProducerService {
|
||||
|
||||
@Autowired
|
||||
@Qualifier("rocketMQTemplateClusterOne")
|
||||
private RocketMQTemplate rocketMQTemplateClusterOne;
|
||||
|
||||
@Autowired
|
||||
// @Qualifier("rocketMQTemplateClusterTwo")
|
||||
private RocketMQTemplate rocketMQTemplateClusterTwo;
|
||||
|
||||
/**
|
||||
* 向mq写入消息
|
||||
*
|
||||
* @param topic 消息topic
|
||||
* @param tag 消息tag
|
||||
* @param msg 消息
|
||||
*/
|
||||
public void defaultSend(String topic, String tag, String msg) {
|
||||
try {
|
||||
String destination = topic + ":" + tag;
|
||||
log.info("准备向默认RocketMQ发送消息,目的地:{}", destination);
|
||||
|
||||
// 使用 RocketMQTemplate 的同步发送方法
|
||||
rocketMQTemplateClusterOne.syncSend(destination, msg);
|
||||
|
||||
log.info("发送RocketMQ消息成功");
|
||||
} catch (Exception e) {
|
||||
log.error("发送RocketMQ消息失败", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 向mq写入消息
|
||||
*
|
||||
* @param topic 消息topic
|
||||
* @param tag 消息tag
|
||||
* @param msg 消息
|
||||
*/
|
||||
public void clusterSend(String topic, String tag, String msg) {
|
||||
try {
|
||||
String destination = topic + ":" + tag;
|
||||
log.info("准备向集群2 RocketMQ发送消息,目的地:{}", destination);
|
||||
|
||||
// 使用 RocketMQTemplate 的同步发送方法
|
||||
rocketMQTemplateClusterTwo.syncSend(destination, msg);
|
||||
|
||||
log.info("发送ClusterRocketMQ消息成功");
|
||||
} catch (Exception e) {
|
||||
log.error("发送RocketMQ消息失败", e);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user