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

This commit is contained in:
dy
2025-07-19 17:15:01 +08:00
73 changed files with 2666 additions and 537 deletions

View File

@@ -6,6 +6,7 @@ import lombok.RequiredArgsConstructor;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.constraints.*;
import cn.dev33.satoken.annotation.SaCheckPermission;
import org.dromara.property.domain.vo.CostHouseChargeDetailVo;
import org.springframework.web.bind.annotation.*;
import org.springframework.validation.annotation.Validated;
import org.dromara.common.idempotent.annotation.RepeatSubmit;
@@ -64,7 +65,7 @@ public class CostHouseChargeController extends BaseController {
*/
@SaCheckPermission("property:houseCharge:query")
@GetMapping("/{id}")
public R<CostHouseChargeVo> getInfo(@NotNull(message = "主键不能为空")
public R<CostHouseChargeDetailVo> getInfo(@NotNull(message = "主键不能为空")
@PathVariable("id") Long id) {
return R.ok(costHouseChargeService.queryById(id));
}

View File

@@ -40,7 +40,7 @@ public class CostPayFeeAuditController extends BaseController {
/**
* 查询费用-缴费审核列表
*/
@SaCheckPermission("system:payFeeAudit:list")
// @SaCheckPermission("system:payFeeAudit:list")
@GetMapping("/list")
public TableDataInfo<CostPayFeeAuditVo> list(CostPayFeeAuditBo bo, PageQuery pageQuery) {
return costPayFeeAuditService.queryPageList(bo, pageQuery);

View File

@@ -17,44 +17,44 @@ import org.dromara.common.core.validate.AddGroup;
import org.dromara.common.core.validate.EditGroup;
import org.dromara.common.log.enums.BusinessType;
import org.dromara.common.excel.utils.ExcelUtil;
import org.dromara.property.domain.vo.TbMeterVo;
import org.dromara.property.domain.bo.TbMeterBo;
import org.dromara.property.service.ITbMeterService;
import org.dromara.property.domain.vo.TbMeterInfoVo;
import org.dromara.property.domain.bo.TbMeterInfoBo;
import org.dromara.property.service.ITbMeterInfoService;
import org.dromara.common.mybatis.core.page.TableDataInfo;
/**
* 水电气
* 前端访问路由地址为:/property/meter
* 前端访问路由地址为:/property/meterInfo
*
* @author LionLi
* @since 2025-07-17
* @author lsm
* @date 2025-07-19
*/
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/meter")
public class TbMeterController extends BaseController {
@RequestMapping("/meterInfo")
public class TbMeterInfoController extends BaseController {
private final ITbMeterService tbMeterService;
private final ITbMeterInfoService tbMeterInfoService;
/**
* 查询水电气列表
*/
@SaCheckPermission("property:meter:list")
@SaCheckPermission("property:meterInfo:list")
@GetMapping("/list")
public TableDataInfo<TbMeterVo> list(TbMeterBo bo, PageQuery pageQuery) {
return tbMeterService.queryPageList(bo, pageQuery);
public TableDataInfo<TbMeterInfoVo> list(TbMeterInfoBo bo, PageQuery pageQuery) {
return tbMeterInfoService.queryPageList(bo, pageQuery);
}
/**
* 导出水电气列表
*/
@SaCheckPermission("property:meter:export")
@SaCheckPermission("property:meterInfo:export")
@Log(title = "水电气", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(TbMeterBo bo, HttpServletResponse response) {
List<TbMeterVo> list = tbMeterService.queryList(bo);
ExcelUtil.exportExcel(list, "水电气", TbMeterVo.class, response);
public void export(TbMeterInfoBo bo, HttpServletResponse response) {
List<TbMeterInfoVo> list = tbMeterInfoService.queryList(bo);
ExcelUtil.exportExcel(list, "水电气", TbMeterInfoVo.class, response);
}
/**
@@ -62,33 +62,33 @@ public class TbMeterController extends BaseController {
*
* @param id 主键
*/
@SaCheckPermission("property:meter:query")
@SaCheckPermission("property:meterInfo:query")
@GetMapping("/{id}")
public R<TbMeterVo> getInfo(@NotNull(message = "主键不能为空")
public R<TbMeterInfoVo> getInfo(@NotNull(message = "主键不能为空")
@PathVariable("id") Long id) {
return R.ok(tbMeterService.queryById(id));
return R.ok(tbMeterInfoService.queryById(id));
}
/**
* 新增水电气
*/
@SaCheckPermission("property:meter:add")
@SaCheckPermission("property:meterInfo:add")
@Log(title = "水电气", businessType = BusinessType.INSERT)
@RepeatSubmit()
@PostMapping()
public R<Void> add(@Validated(AddGroup.class) @RequestBody TbMeterBo bo) {
return toAjax(tbMeterService.insertByBo(bo));
public R<Void> add(@Validated(AddGroup.class) @RequestBody TbMeterInfoBo bo) {
return toAjax(tbMeterInfoService.insertByBo(bo));
}
/**
* 修改水电气
*/
@SaCheckPermission("property:meter:edit")
@SaCheckPermission("property:meterInfo:edit")
@Log(title = "水电气", businessType = BusinessType.UPDATE)
@RepeatSubmit()
@PutMapping()
public R<Void> edit(@Validated(EditGroup.class) @RequestBody TbMeterBo bo) {
return toAjax(tbMeterService.updateByBo(bo));
public R<Void> edit(@Validated(EditGroup.class) @RequestBody TbMeterInfoBo bo) {
return toAjax(tbMeterInfoService.updateByBo(bo));
}
/**
@@ -96,11 +96,11 @@ public class TbMeterController extends BaseController {
*
* @param ids 主键串
*/
@SaCheckPermission("property:meter:remove")
@SaCheckPermission("property:meterInfo:remove")
@Log(title = "水电气", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public R<Void> remove(@NotEmpty(message = "主键不能为空")
@PathVariable("ids") Long[] ids) {
return toAjax(tbMeterService.deleteWithValidByIds(List.of(ids), true));
return toAjax(tbMeterInfoService.deleteWithValidByIds(List.of(ids), true));
}
}

View File

@@ -0,0 +1,106 @@
package org.dromara.property.controller;
import java.util.List;
import lombok.RequiredArgsConstructor;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.constraints.*;
import cn.dev33.satoken.annotation.SaCheckPermission;
import org.springframework.web.bind.annotation.*;
import org.springframework.validation.annotation.Validated;
import org.dromara.common.idempotent.annotation.RepeatSubmit;
import org.dromara.common.log.annotation.Log;
import org.dromara.common.web.core.BaseController;
import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.core.domain.R;
import org.dromara.common.core.validate.AddGroup;
import org.dromara.common.core.validate.EditGroup;
import org.dromara.common.log.enums.BusinessType;
import org.dromara.common.excel.utils.ExcelUtil;
import org.dromara.property.domain.vo.TbMeterRecordVo;
import org.dromara.property.domain.bo.TbMeterRecordBo;
import org.dromara.property.service.ITbMeterRecordService;
import org.dromara.common.mybatis.core.page.TableDataInfo;
/**
* 抄记录
* 前端访问路由地址为:/property/meterRecord
*
* @author lsm
* @date 2025-07-19
*/
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/meterRecord")
public class TbMeterRecordController extends BaseController {
private final ITbMeterRecordService tbMeterRecordService;
/**
* 查询抄记录列表
*/
@SaCheckPermission("property:meterRecord:list")
@GetMapping("/list")
public TableDataInfo<TbMeterRecordVo> list(TbMeterRecordBo bo, PageQuery pageQuery) {
return tbMeterRecordService.queryPageList(bo, pageQuery);
}
/**
* 导出抄记录列表
*/
@SaCheckPermission("property:meterRecord:export")
@Log(title = "抄记录", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(TbMeterRecordBo bo, HttpServletResponse response) {
List<TbMeterRecordVo> list = tbMeterRecordService.queryList(bo);
ExcelUtil.exportExcel(list, "抄记录", TbMeterRecordVo.class, response);
}
/**
* 获取抄记录详细信息
*
* @param id 主键
*/
@SaCheckPermission("property:meterRecord:query")
@GetMapping("/{id}")
public R<TbMeterRecordVo> getInfo(@NotNull(message = "主键不能为空")
@PathVariable("id") Long id) {
return R.ok(tbMeterRecordService.queryById(id));
}
/**
* 新增抄记录
*/
@SaCheckPermission("property:meterRecord:add")
@Log(title = "抄记录", businessType = BusinessType.INSERT)
@RepeatSubmit()
@PostMapping()
public R<Void> add(@Validated(AddGroup.class) @RequestBody TbMeterRecordBo bo) {
return toAjax(tbMeterRecordService.insertByBo(bo));
}
/**
* 修改抄记录
*/
@SaCheckPermission("property:meterRecord:edit")
@Log(title = "抄记录", businessType = BusinessType.UPDATE)
@RepeatSubmit()
@PutMapping()
public R<Void> edit(@Validated(EditGroup.class) @RequestBody TbMeterRecordBo bo) {
return toAjax(tbMeterRecordService.updateByBo(bo));
}
/**
* 删除抄记录
*
* @param ids 主键串
*/
@SaCheckPermission("property:meterRecord:remove")
@Log(title = "抄记录", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public R<Void> remove(@NotEmpty(message = "主键不能为空")
@PathVariable("ids") Long[] ids) {
return toAjax(tbMeterRecordService.deleteWithValidByIds(List.of(ids), true));
}
}

View File

@@ -4,6 +4,8 @@ import org.dromara.common.tenant.core.TenantEntity;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.math.BigDecimal;
import java.util.Date;
import java.io.Serial;
@@ -48,6 +50,11 @@ public class CostCarCharge extends TenantEntity {
*/
private String location;
/**
* 应收金额
*/
private BigDecimal amountReceivable;
/**
* 状态
*/

View File

@@ -6,16 +6,17 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serial;
import java.math.BigDecimal;
/**
* 费用项设置对象 costItemSetting
* 费用项设置对象 costItems
*
* @author mocheng
* @date 2025-07-17
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("costItemSetting")
@TableName("cost_items")
public class CostItems extends TenantEntity {
@Serial
@@ -31,6 +32,10 @@ public class CostItems extends TenantEntity {
* 费用类型
*/
private String costType;
/**
* 费用编号
*/
private String chargeNo;
/**
* 收费项目
@@ -50,7 +55,7 @@ public class CostItems extends TenantEntity {
/**
* 缴费周期(月)
*/
private Long chargeCycle;
private Integer chargeCycle;
/**
* 是否手机缴费
@@ -80,17 +85,17 @@ public class CostItems extends TenantEntity {
/**
* 计费单价
*/
private Long unitPrice;
private BigDecimal unitPrice;
/**
* 附加费
*/
private Long surcharge;
private BigDecimal surcharge;
/**
* 搜索值
*单位
*/
private String searchValue;
private String unit;
}

View File

@@ -8,14 +8,14 @@ import lombok.EqualsAndHashCode;
import java.io.Serial;
/**
* 抄表类型对象 meterReadingType
* 抄表类型对象 CostMeterType
*
* @author mocheng
* @date 2025-07-17
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("meterReadingType")
@TableName("cost_meter_type")
public class CostMeterType extends TenantEntity {
@Serial
@@ -41,11 +41,4 @@ public class CostMeterType extends TenantEntity {
* 说明
*/
private String remark;
/**
* 搜索值
*/
private String searchValue;
}

View File

@@ -29,10 +29,18 @@ public class CostMeterWater extends TenantEntity {
@TableId(value = "id")
private Long id;
/**
* 业主id
*/
private Long userId;
/**
* 费用类型id
*/
private Long itemId;
/**
* 房间id
*/
private Long roomId;
/**
* 抄表类型id
@@ -70,10 +78,6 @@ public class CostMeterWater extends TenantEntity {
*/
private String remark;
/**
* 搜索值
*/
private String searchValue;
}

View File

@@ -4,6 +4,8 @@ import org.dromara.common.tenant.core.TenantEntity;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.math.BigDecimal;
import java.util.Date;
import java.io.Serial;
@@ -51,12 +53,12 @@ public class CostPayFeeAudit extends TenantEntity {
/**
* 实付金额
*/
private String receivedAmount;
private BigDecimal receivedAmount;
/**
* 应收金额
*/
private Long receivableAmount;
private BigDecimal receivableAmount;
/**
* 缴费时间
@@ -75,10 +77,4 @@ public class CostPayFeeAudit extends TenantEntity {
*/
private String remark;
/**
* 搜索值
*/
private String searchValue;
}

View File

@@ -77,10 +77,4 @@ public class MachineMaintainPlan extends TenantEntity {
*/
private String state;
/**
* 搜索值
*/
private String searchValue;
}

View File

@@ -1,6 +1,6 @@
package org.dromara.property.domain;
import org.dromara.common.mybatis.core.domain.BaseEntity;
import org.dromara.common.tenant.core.TenantEntity;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
@@ -8,15 +8,15 @@ import lombok.EqualsAndHashCode;
import java.io.Serial;
/**
* 水电气对象 tb_meter
* 水电气对象 tb_meter_info
*
* @author LionLi
* @since 2025-07-17
* @author lsm
* @since 2025-07-19
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("tb_meter")
public class TbMeter extends BaseEntity {
@TableName("tb_meter_info")
public class TbMeterInfo extends TenantEntity {
@Serial
private static final long serialVersionUID = 1L;
@@ -28,12 +28,12 @@ public class TbMeter extends BaseEntity {
private Long id;
/**
* 表名称
* 表名称
*/
private String meterName;
/**
* 设备编码
* 仪表编码
*/
private String meterCode;
@@ -48,39 +48,24 @@ public class TbMeter extends BaseEntity {
private Long meterType;
/**
* 表用途(1-分表2-总表3-公摊表)
* 计量单位(1-2-3-立方米)
*/
private Long meterPurpose;
private Long meterUnit;
/**
* 分摊类型1-不公摊2-按分表用量3-按租客面积4-按房源数量5-按固定比例
* 安装位置
*/
private Long shareType;
private String installLocation;
/**
* 付费类型(1-先付费2-后付费)
* 初始读数
*/
private Long payType;
private Long initReading;
/**
* 当前表显示读数
* 最大量程
*/
private Long display;
/**
* 最大表显读数(超过归0)
*/
private Long maxDisplay;
/**
* 计费倍率
*/
private Long billingRate;
/**
* 剩余量
*/
private Long surplus;
private Long maxRang;
/**
* 通信状态

View File

@@ -0,0 +1,73 @@
package org.dromara.property.domain;
import org.dromara.common.tenant.core.TenantEntity;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.io.Serial;
/**
* 抄记录对象 tb_meter_record
*
* @author lsm
* @date 2025-07-19
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("tb_meter_record")
public class TbMeterRecord extends TenantEntity {
@Serial
private static final long serialVersionUID = 1L;
/**
* 记录ID
*/
@TableId(value = "id")
private Long id;
/**
* 仪表编号
*/
private String meterId;
/**
* 抄表员ID
*/
private Long readerId;
/**
* 抄表时间
*/
private Date readingTime;
/**
* 当前读数
*/
private Long currentReading;
/**
* 上次读数
*/
private Long previousReading;
/**
* 用量
*/
private Long consumption;
/**
* 抄表方式(1手动 2自动 3用户上报)
*/
private Long readingMethod;
/**
* 抄表照片
*/
private Long imgOssid;
}

View File

@@ -60,6 +60,10 @@ public class TbRoom extends TenantEntity {
* 面积(平方米)
*/
private Float area;
/**
* 套内面积(平方米)
*/
private Float insideInArea;
/**
* 户型(如2室1厅1卫)

View File

@@ -8,6 +8,8 @@ import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import lombok.EqualsAndHashCode;
import jakarta.validation.constraints.*;
import java.math.BigDecimal;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
@@ -53,7 +55,7 @@ public class CostHouseChargeBo extends BaseEntity {
/**
* 应收金额
*/
private Long amountReceivable;
private BigDecimal amountReceivable;
/**
* 计费开始时间
@@ -75,10 +77,6 @@ public class CostHouseChargeBo extends BaseEntity {
*/
private String remark;
/**
* 搜索值
*/
private String searchValue;
}

View File

@@ -1,5 +1,6 @@
package org.dromara.property.domain.bo;
import cn.idev.excel.annotation.ExcelProperty;
import org.dromara.property.domain.CostItems;
import org.dromara.common.mybatis.core.domain.BaseEntity;
import org.dromara.common.core.validate.AddGroup;
@@ -9,6 +10,8 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import jakarta.validation.constraints.*;
import java.math.BigDecimal;
/**
* 费用项设置业务对象 costItemSetting
*
@@ -25,7 +28,10 @@ public class CostItemsBo extends BaseEntity {
*/
@NotNull(message = "主键不能为空", groups = { EditGroup.class })
private Long id;
/**
* 费用编号
*/
private String chargeNo;
/**
* 费用类型
*/
@@ -49,11 +55,16 @@ public class CostItemsBo extends BaseEntity {
*/
@NotBlank(message = "付费类型不能为空", groups = { AddGroup.class, EditGroup.class })
private String paymentType;
/**
*单位
*/
@ExcelProperty(value = "单位")
private String unit;
/**
* 缴费周期(月)
*/
private Long chargeCycle;
private Integer chargeCycle;
/**
* 是否手机缴费
@@ -63,11 +74,13 @@ public class CostItemsBo extends BaseEntity {
/**
* 进位方式
*/
@NotBlank(message = "进位方式不能为空", groups = { AddGroup.class, EditGroup.class })
private String roundingMode;
/**
* 保留小数
*/
@NotBlank(message = "保留小数不能为空", groups = { AddGroup.class, EditGroup.class })
private String currencyDecimals;
/**
@@ -78,17 +91,19 @@ public class CostItemsBo extends BaseEntity {
/**
* 计算公式
*/
@NotBlank(message = "计算公式不能", groups = { AddGroup.class, EditGroup.class })
private String formula;
/**
* 计费单价
*/
private Long unitPrice;
@NotBlank(message = "计费单价", groups = { AddGroup.class, EditGroup.class })
private BigDecimal unitPrice;
/**
* 附加费
*/
private Long surcharge;
private BigDecimal surcharge;
/**
* 搜索值

View File

@@ -29,12 +29,21 @@ public class CostMeterWaterBo extends BaseEntity {
@NotNull(message = "主键不能为空", groups = { EditGroup.class })
private Long id;
/**
* 业主id
*/
@NotNull(message = "业主id不能为空", groups = { EditGroup.class })
private Long userId;
/**
* 费用类型id
*/
@NotNull(message = "费用类型id不能为空", groups = { AddGroup.class, EditGroup.class })
private Long itemId;
/**
* 房间id
*/
private Long roomId;
/**
* 抄表类型id
*/

View File

@@ -10,6 +10,7 @@ import lombok.EqualsAndHashCode;
import jakarta.validation.constraints.*;
import org.dromara.property.domain.CostPayFeeAudit;
import java.math.BigDecimal;
import java.util.Date;
/**
@@ -56,13 +57,13 @@ public class CostPayFeeAuditBo extends BaseEntity {
/**
* 实付金额
*/
private String receivedAmount;
private BigDecimal receivedAmount;
/**
* 应收金额
*/
@NotNull(message = "应收金额不能为空", groups = { AddGroup.class, EditGroup.class })
private Long receivableAmount;
private BigDecimal receivableAmount;
/**
* 缴费时间

View File

@@ -11,6 +11,7 @@ import org.dromara.common.mybatis.core.domain.BaseEntity;
import org.dromara.property.domain.MachineMaintainPlan;
import java.util.Date;
import java.util.List;
/**
* 设备保养计划业务对象 machine_maintain_plan
@@ -85,5 +86,10 @@ public class MachineMaintainPlanBo extends BaseEntity {
*/
private String searchValue;
/**
* 选择员工
*/
private List<MachineMaintainPlanStaffBo> machineMaintainPlanStaffBoList;
}

View File

@@ -1,7 +1,8 @@
package org.dromara.property.domain.bo;
import org.dromara.property.domain.TbMeter;
import org.dromara.property.domain.TbMeterInfo;
import org.dromara.common.mybatis.core.domain.BaseEntity;
import org.dromara.common.core.validate.AddGroup;
import org.dromara.common.core.validate.EditGroup;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
@@ -9,15 +10,15 @@ import lombok.EqualsAndHashCode;
import jakarta.validation.constraints.*;
/**
* 水电气业务对象 tb_meter
* 水电气业务对象 tb_meter_info
*
* @author LionLi
* @since 2025-07-17
* @author lsm
* @since 2025-07-19
*/
@Data
@EqualsAndHashCode(callSuper = true)
@AutoMapper(target = TbMeter.class, reverseConvertGenerate = false)
public class TbMeterBo extends BaseEntity {
@AutoMapper(target = TbMeterInfo.class, reverseConvertGenerate = false)
public class TbMeterInfoBo extends BaseEntity {
/**
* 主键id
@@ -26,12 +27,12 @@ public class TbMeterBo extends BaseEntity {
private Long id;
/**
* 表名称
* 表名称
*/
private String meterName;
/**
* 设备编码
* 仪表编码
*/
private String meterCode;
@@ -43,42 +44,29 @@ public class TbMeterBo extends BaseEntity {
/**
* 设备类型(1-电表2-水表3-气表)
*/
@NotNull(message = "设备类型(1-电表2-水表3-气表)不能为空", groups = { AddGroup.class, EditGroup.class })
private Long meterType;
/**
* 表用途(1-分表2-总表3-公摊表)
* 计量单位(1-2-3-立方米)
*/
private Long meterPurpose;
@NotNull(message = "计量单位(1-度2-吨3-立方米)不能为空", groups = { AddGroup.class, EditGroup.class })
private Long meterUnit;
/**
* 分摊类型1-不公摊2-按分表用量3-按租客面积4-按房源数量5-按固定比例
* 安装位置
*/
private Long shareType;
private String installLocation;
/**
* 付费类型(1-先付费2-后付费)
* 初始读数
*/
private Long payType;
private Long initReading;
/**
* 当前表显示读数
* 最大量程
*/
private Long display;
/**
* 最大表显读数(超过归0)
*/
private Long maxDisplay;
/**
* 计费倍率
*/
private Long billingRate;
/**
* 剩余量
*/
private Long surplus;
private Long maxRang;
/**
* 通信状态

View File

@@ -0,0 +1,78 @@
package org.dromara.property.domain.bo;
import org.dromara.property.domain.TbMeterRecord;
import org.dromara.common.mybatis.core.domain.BaseEntity;
import org.dromara.common.core.validate.AddGroup;
import org.dromara.common.core.validate.EditGroup;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import lombok.EqualsAndHashCode;
import jakarta.validation.constraints.*;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
/**
* 抄记录业务对象 tb_meter_record
*
* @author lsm
* @date 2025-07-19
*/
@Data
@EqualsAndHashCode(callSuper = true)
@AutoMapper(target = TbMeterRecord.class, reverseConvertGenerate = false)
public class TbMeterRecordBo extends BaseEntity {
/**
* 记录ID
*/
@NotNull(message = "记录ID不能为空", groups = { EditGroup.class })
private Long id;
/**
* 仪表编号
*/
@NotBlank(message = "仪表编号不能为空", groups = { AddGroup.class, EditGroup.class })
private String meterId;
/**
* 抄表员ID
*/
@NotNull(message = "抄表员ID不能为空", groups = { AddGroup.class, EditGroup.class })
private Long readerId;
/**
* 抄表时间
*/
@NotNull(message = "抄表时间不能为空", groups = { AddGroup.class, EditGroup.class })
private Date readingTime;
/**
* 当前读数
*/
@NotNull(message = "当前读数不能为空", groups = { AddGroup.class, EditGroup.class })
private Long currentReading;
/**
* 上次读数
*/
@NotNull(message = "上次读数不能为空", groups = { AddGroup.class, EditGroup.class })
private Long previousReading;
/**
* 用量
*/
private Long consumption;
/**
* 抄表方式(1手动 2自动 3用户上报)
*/
@NotNull(message = "抄表方式(1手动 2自动 3用户上报)不能为空", groups = { AddGroup.class, EditGroup.class })
private Long readingMethod;
/**
* 抄表照片
*/
private Long imgOssid;
}

View File

@@ -47,7 +47,10 @@ public class TbRoomBo extends BaseEntity {
* 面积(平方米)
*/
private Float area;
/**
* 套内面积(平方米)
*/
private Float insideInArea;
/**
* 户型(如2室1厅1卫)
*/

View File

@@ -1,5 +1,6 @@
package org.dromara.property.domain.vo;
import java.math.BigDecimal;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.dromara.property.domain.CostCarCharge;
@@ -60,6 +61,10 @@ public class CostCarChargeVo implements Serializable {
@ExcelProperty(value = "车位")
private String location;
/**
* 应收金额
*/
private BigDecimal amountReceivable;
/**
* 状态
*/

View File

@@ -0,0 +1,98 @@
package org.dromara.property.domain.vo;
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.CostHouseCharge;
import org.dromara.property.domain.CostItems;
import java.io.Serial;
import java.io.Serializable;
import java.util.Date;
/**
* @Author:yuyongle
* @Date:2025/7/18 16:03
* @Description:
**/
@Data
@ExcelIgnoreUnannotated
@AutoMapper(target = CostHouseCharge.class)
public class CostHouseChargeDetailVo implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@ExcelProperty(value = "主键")
private Long id;
/**
* 房屋
*/
@ExcelProperty(value = "房屋")
private Long roomId;
/**
* 收费项目
*/
@ExcelProperty(value = "收费项目")
private Long costItemsId;
/**
* 支付方式
*/
@ExcelProperty(value = "支付方式")
private String payType;
/**
* 支付周期
*/
@ExcelProperty(value = "支付周期")
private String chargeCycle;
/**
* 应收金额
*/
@ExcelProperty(value = "应收金额")
private Long amountReceivable;
/**
* 计费开始时间
*/
@ExcelProperty(value = "计费开始时间")
private Date startTime;
/**
* 计费结束时间
*/
@ExcelProperty(value = "计费结束时间")
private Date endTime;
/**
* 状态
*/
@ExcelProperty(value = "状态")
private String state;
/**
* 说明
*/
@ExcelProperty(value = "说明")
private String remark;
/**
* 房间信息
*/
@ExcelProperty(value = "房间信息")
private TbRoomVo roomVo;
/**
* 收费项设置
*/
@ExcelProperty(value = "收费项设置")
private CostItemsVo costItemsVo;
}

View File

@@ -10,12 +10,13 @@ import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* 费用项设置视图对象 costItemSetting
* 费用项设置视图对象 costItems
*
* @author mocheng
* @date 2025-07-17
@@ -33,7 +34,10 @@ public class CostItemsVo implements Serializable {
*/
@ExcelProperty(value = "主键")
private Long id;
/**
* 费用编号
*/
private String chargeNo;
/**
* 费用类型
*/
@@ -64,7 +68,7 @@ public class CostItemsVo implements Serializable {
*/
@ExcelProperty(value = "缴费周期", converter = ExcelDictConvert.class)
@ExcelDictFormat(readConverterExp = "月=")
private Long chargeCycle;
private Integer chargeCycle;
/**
* 是否手机缴费
@@ -100,19 +104,24 @@ public class CostItemsVo implements Serializable {
* 计费单价
*/
@ExcelProperty(value = "计费单价")
private Long unitPrice;
private BigDecimal unitPrice;
/**
* 附加费
*/
@ExcelProperty(value = "附加费")
private Long surcharge;
private BigDecimal surcharge;
/**
* 搜索值
*/
@ExcelProperty(value = "搜索值")
private String searchValue;
/**
*单位
*/
@ExcelProperty(value = "单位")
private String unit;
}

View File

@@ -10,7 +10,7 @@ import org.dromara.property.domain.CostMeterType;
import java.io.Serial;
import java.io.Serializable;
import java.util.Date;
/**
@@ -51,6 +51,11 @@ public class CostMeterTypeVo implements Serializable {
*/
@ExcelProperty(value = "说明")
private String remark;
/**
* 创建时间
*/
@ExcelProperty(value = "创建时间")
private Date createTime;
/**
* 搜索值

View File

@@ -32,12 +32,20 @@ public class CostMeterWaterVo implements Serializable {
@ExcelProperty(value = "主键")
private Long id;
/**
* 业主id
*/
private Long userId;
/**
* 费用类型id
*/
@ExcelProperty(value = "费用类型id")
private Long itemId;
/**
* 房间id
*/
private Long roomId;
/**
* 抄表类型id
*/

View File

@@ -4,10 +4,13 @@ import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
import cn.idev.excel.annotation.ExcelProperty;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import org.dromara.common.excel.annotation.ExcelDictFormat;
import org.dromara.common.excel.convert.ExcelDictConvert;
import org.dromara.property.domain.CostPayFeeAudit;
import java.io.Serial;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
@@ -30,6 +33,7 @@ public class CostPayFeeAuditVo implements Serializable {
* 主键
*/
@ExcelProperty(value = "主键")
private Long id;
/**
@@ -37,13 +41,32 @@ public class CostPayFeeAuditVo implements Serializable {
*/
@ExcelProperty(value = "房屋收费id")
private Long houseChargeId;
/**
* 费用类型
*/
@ExcelProperty(value = "费用类型", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "pro_expense_type")
private String costType;
/**
* 房间号(如101,202)
*/
@ExcelProperty(value = "房间号(如101,202)")
private String roomNumber;
/**
* 费用项目id
*/
@ExcelProperty(value = "费用项目id")
private Long itemId;
/**
* 收费项目
*/
@ExcelProperty(value = "收费项目")
private String chargeItem;
/**
* 缴费周期(月)
*/
private Integer chargeCycle;
/**
* 缴费开始时间
*/
@@ -60,13 +83,13 @@ public class CostPayFeeAuditVo implements Serializable {
* 实付金额
*/
@ExcelProperty(value = "实付金额")
private String receivedAmount;
private BigDecimal receivedAmount;
/**
* 应收金额
*/
@ExcelProperty(value = "应收金额")
private Long receivableAmount;
private BigDecimal receivableAmount;
/**
* 缴费时间

View File

@@ -9,7 +9,7 @@ import org.dromara.property.domain.MachineMaintainPlan;
import java.io.Serial;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
@@ -98,5 +98,9 @@ public class MachineMaintainPlanVo implements Serializable {
@ExcelProperty(value = "搜索值")
private String searchValue;
/**
* 员工
*/
@ExcelProperty(value = "搜索值")
private List<MachineMaintainPlanStaffVo> machineMaintainPlanStaffVos;
}

View File

@@ -0,0 +1,107 @@
package org.dromara.property.domain.vo;
import org.dromara.common.excel.annotation.ExcelDictFormat;
import org.dromara.common.excel.convert.ExcelDictConvert;
import org.dromara.property.domain.TbMeterInfo;
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
import cn.idev.excel.annotation.ExcelProperty;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
/**
* 水电气视图对象 tb_meter_info
*
* @author lsm
* @since 2025-07-19
*/
@Data
@ExcelIgnoreUnannotated
@AutoMapper(target = TbMeterInfo.class)
public class TbMeterInfoVo implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 主键id
*/
@ExcelProperty(value = "主键id")
private Long id;
/**
* 仪表名称
*/
@ExcelProperty(value = "仪表名称")
private String meterName;
/**
* 仪表编码
*/
@ExcelProperty(value = "仪表编码")
private String meterCode;
/**
* 设备厂商
*/
@ExcelProperty(value = "设备厂商")
private String factoryNo;
/**
* 设备类型(1-电表2-水表3-气表)
*/
@ExcelProperty(value = "设备类型(1-电表2-水表3-气表)" ,converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "meter_type")
private Long meterType;
/**
* 计量单位(1-度2-吨3-立方米)
*/
@ExcelProperty(value = "计量单位(1-度2-吨3-立方米)", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "meter_unit")
private Long meterUnit;
/**
* 安装位置
*/
@ExcelProperty(value = "安装位置")
private String installLocation;
/**
* 初始读数
*/
@ExcelProperty(value = "初始读数")
private Long initReading;
/**
* 最大量程
*/
@ExcelProperty(value = "最大量程")
private Long maxRang;
/**
* 通信状态
*/
@ExcelProperty(value = "通信状态", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "sis_device_status")
private Long communicationState;
/**
* 运行状态
*/
@ExcelProperty(value = "运行状态", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "sis_device_status")
private Long runningState;
/**
* 备注
*/
@ExcelProperty(value = "备注")
private String remark;
}

View File

@@ -0,0 +1,88 @@
package org.dromara.property.domain.vo;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.dromara.property.domain.TbMeterRecord;
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
import cn.idev.excel.annotation.ExcelProperty;
import org.dromara.common.excel.annotation.ExcelDictFormat;
import org.dromara.common.excel.convert.ExcelDictConvert;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
import java.util.Date;
/**
* 抄记录视图对象 tb_meter_record
*
* @author lsm
* @date 2025-07-19
*/
@Data
@ExcelIgnoreUnannotated
@AutoMapper(target = TbMeterRecord.class)
public class TbMeterRecordVo implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 记录ID
*/
@ExcelProperty(value = "记录ID")
private Long id;
/**
* 仪表编号
*/
@ExcelProperty(value = "仪表编号")
private String meterId;
/**
* 抄表员ID
*/
@ExcelProperty(value = "抄表员ID")
private Long readerId;
/**
* 抄表时间
*/
@ExcelProperty(value = "抄表时间")
private Date readingTime;
/**
* 当前读数
*/
@ExcelProperty(value = "当前读数")
private Long currentReading;
/**
* 上次读数
*/
@ExcelProperty(value = "上次读数")
private Long previousReading;
/**
* 用量
*/
@ExcelProperty(value = "用量")
private Long consumption;
/**
* 抄表方式(1手动 2自动 3用户上报)
*/
@ExcelProperty(value = "抄表方式(1手动 2自动 3用户上报)")
private Long readingMethod;
/**
* 抄表照片
*/
@ExcelProperty(value = "抄表照片")
private Long imgOssid;
}

View File

@@ -1,122 +0,0 @@
package org.dromara.property.domain.vo;
import org.dromara.property.domain.TbMeter;
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
import cn.idev.excel.annotation.ExcelProperty;
import org.dromara.common.excel.annotation.ExcelDictFormat;
import org.dromara.common.excel.convert.ExcelDictConvert;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
/**
* 水电气视图对象 tb_meter
*
* @author LionLi
* @since 2025-07-17
*/
@Data
@ExcelIgnoreUnannotated
@AutoMapper(target = TbMeter.class)
public class TbMeterVo implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 主键id
*/
@ExcelProperty(value = "主键id")
private Long id;
/**
* 水表名称
*/
@ExcelProperty(value = "水表名称")
private String meterName;
/**
* 设备编码
*/
@ExcelProperty(value = "设备编码")
private String meterCode;
/**
* 设备厂商
*/
@ExcelProperty(value = "设备厂商")
private String factoryNo;
/**
* 设备类型(1-电表2-水表3-气表)
*/
@ExcelProperty(value = "设备类型(1-电表2-水表3-气表)")
private Long meterType;
/**
* 表用途(1-分表2-总表3-公摊表)
*/
@ExcelProperty(value = "表用途(1-分表2-总表3-公摊表)")
private Long meterPurpose;
/**
* 分摊类型1-不公摊2-按分表用量3-按租客面积4-按房源数量5-按固定比例)
*/
@ExcelProperty(value = "分摊类型", converter = ExcelDictConvert.class)
@ExcelDictFormat(readConverterExp = "1=-不公摊2-按分表用量3-按租客面积4-按房源数量5-按固定比例")
private Long shareType;
/**
* 付费类型(1-先付费2-后付费)
*/
@ExcelProperty(value = "付费类型(1-先付费2-后付费)")
private Long payType;
/**
* 当前表显示读数
*/
@ExcelProperty(value = "当前表显示读数")
private Long display;
/**
* 最大表显读数(超过归0)
*/
@ExcelProperty(value = "最大表显读数(超过归0)")
private Long maxDisplay;
/**
* 计费倍率
*/
@ExcelProperty(value = "计费倍率")
private Long billingRate;
/**
* 剩余量
*/
@ExcelProperty(value = "剩余量")
private Long surplus;
/**
* 通信状态
*/
@ExcelProperty(value = "通信状态")
private Long communicationState;
/**
* 运行状态
*/
@ExcelProperty(value = "运行状态")
private Long runningState;
/**
* 备注
*/
@ExcelProperty(value = "备注")
private String remark;
}

View File

@@ -76,8 +76,11 @@ public class TbRoomVo implements Serializable {
* 面积(平方米)
*/
@ExcelProperty(value = "面积(平方米)")
private Long area;
private Float area;
/**
* 套内面积(平方米)
*/
private Float insideInArea;
/**
* 户型(如2室1厅1卫)
*/

View File

@@ -1,6 +1,9 @@
package org.dromara.property.mapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
import org.dromara.property.domain.CostPayFeeAudit;
import org.dromara.property.domain.vo.CostPayFeeAuditVo;

View File

@@ -0,0 +1,15 @@
package org.dromara.property.mapper;
import org.dromara.property.domain.TbMeterInfo;
import org.dromara.property.domain.vo.TbMeterInfoVo;
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
/**
* 水电气Mapper接口
*
* @author lsm
* @date 2025-07-19
*/
public interface TbMeterInfoMapper extends BaseMapperPlus<TbMeterInfo, TbMeterInfoVo> {
}

View File

@@ -1,17 +0,0 @@
package org.dromara.property.mapper;
import org.apache.ibatis.annotations.Mapper;
import org.dromara.property.domain.TbMeter;
import org.dromara.property.domain.vo.TbMeterVo;
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
/**
* 水电气Mapper接口
*
* @author LionLi
* @since 2025-07-17
*/
@Mapper
public interface TbMeterMapper extends BaseMapperPlus<TbMeter, TbMeterVo> {
}

View File

@@ -0,0 +1,15 @@
package org.dromara.property.mapper;
import org.dromara.property.domain.TbMeterRecord;
import org.dromara.property.domain.vo.TbMeterRecordVo;
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
/**
* 抄记录Mapper接口
*
* @author lsm
* @date 2025-07-19
*/
public interface TbMeterRecordMapper extends BaseMapperPlus<TbMeterRecord, TbMeterRecordVo> {
}

View File

@@ -1,6 +1,7 @@
package org.dromara.property.service;
import org.dromara.property.domain.CostHouseCharge;
import org.dromara.property.domain.vo.CostHouseChargeDetailVo;
import org.dromara.property.domain.vo.CostHouseChargeVo;
import org.dromara.property.domain.bo.CostHouseChargeBo;
import org.dromara.common.mybatis.core.page.TableDataInfo;
@@ -23,7 +24,7 @@ public interface ICostHouseChargeService {
* @param id 主键
* @return 房屋收费
*/
CostHouseChargeVo queryById(Long id);
CostHouseChargeDetailVo queryById(Long id);
/**
* 分页查询房屋收费列表

View File

@@ -1,7 +1,8 @@
package org.dromara.property.service;
import org.dromara.property.domain.vo.TbMeterVo;
import org.dromara.property.domain.bo.TbMeterBo;
import org.dromara.property.domain.TbMeterInfo;
import org.dromara.property.domain.vo.TbMeterInfoVo;
import org.dromara.property.domain.bo.TbMeterInfoBo;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.common.mybatis.core.page.PageQuery;
@@ -11,10 +12,10 @@ import java.util.List;
/**
* 水电气Service接口
*
* @author LionLi
* @since 2025-07-17
* @author lsm
* @date 2025-07-19
*/
public interface ITbMeterService {
public interface ITbMeterInfoService {
/**
* 查询水电气
@@ -22,7 +23,7 @@ public interface ITbMeterService {
* @param id 主键
* @return 水电气
*/
TbMeterVo queryById(Long id);
TbMeterInfoVo queryById(Long id);
/**
* 分页查询水电气列表
@@ -31,7 +32,7 @@ public interface ITbMeterService {
* @param pageQuery 分页参数
* @return 水电气分页列表
*/
TableDataInfo<TbMeterVo> queryPageList(TbMeterBo bo, PageQuery pageQuery);
TableDataInfo<TbMeterInfoVo> queryPageList(TbMeterInfoBo bo, PageQuery pageQuery);
/**
* 查询符合条件的水电气列表
@@ -39,7 +40,7 @@ public interface ITbMeterService {
* @param bo 查询条件
* @return 水电气列表
*/
List<TbMeterVo> queryList(TbMeterBo bo);
List<TbMeterInfoVo> queryList(TbMeterInfoBo bo);
/**
* 新增水电气
@@ -47,7 +48,7 @@ public interface ITbMeterService {
* @param bo 水电气
* @return 是否新增成功
*/
Boolean insertByBo(TbMeterBo bo);
Boolean insertByBo(TbMeterInfoBo bo);
/**
* 修改水电气
@@ -55,7 +56,7 @@ public interface ITbMeterService {
* @param bo 水电气
* @return 是否修改成功
*/
Boolean updateByBo(TbMeterBo bo);
Boolean updateByBo(TbMeterInfoBo bo);
/**
* 校验并批量删除水电气信息

View File

@@ -0,0 +1,69 @@
package org.dromara.property.service;
import org.dromara.property.domain.TbMeterRecord;
import org.dromara.property.domain.vo.TbMeterRecordVo;
import org.dromara.property.domain.bo.TbMeterRecordBo;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.common.mybatis.core.page.PageQuery;
import java.util.Collection;
import java.util.List;
/**
* 抄记录Service接口
*
* @author lsm
* @date 2025-07-19
*/
public interface ITbMeterRecordService {
/**
* 查询抄记录
*
* @param id 主键
* @return 抄记录
*/
TbMeterRecordVo queryById(Long id);
/**
* 分页查询抄记录列表
*
* @param bo 查询条件
* @param pageQuery 分页参数
* @return 抄记录分页列表
*/
TableDataInfo<TbMeterRecordVo> queryPageList(TbMeterRecordBo bo, PageQuery pageQuery);
/**
* 查询符合条件的抄记录列表
*
* @param bo 查询条件
* @return 抄记录列表
*/
List<TbMeterRecordVo> queryList(TbMeterRecordBo bo);
/**
* 新增抄记录
*
* @param bo 抄记录
* @return 是否新增成功
*/
Boolean insertByBo(TbMeterRecordBo bo);
/**
* 修改抄记录
*
* @param bo 抄记录
* @return 是否修改成功
*/
Boolean updateByBo(TbMeterRecordBo bo);
/**
* 校验并批量删除抄记录信息
*
* @param ids 待删除的主键集合
* @param isValid 是否进行有效性校验
* @return 是否删除成功
*/
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
}

View File

@@ -9,6 +9,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.property.domain.vo.CostItemsVo;
import org.dromara.property.mapper.CostItemsMapper;
import org.springframework.stereotype.Service;
import org.dromara.property.domain.bo.CostCarChargeBo;
import org.dromara.property.domain.vo.CostCarChargeVo;
@@ -16,6 +18,7 @@ import org.dromara.property.domain.CostCarCharge;
import org.dromara.property.mapper.CostCarChargeMapper;
import org.dromara.property.service.ICostCarChargeService;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
import java.util.Collection;
@@ -32,6 +35,8 @@ import java.util.Collection;
public class CostCarChargeServiceImpl implements ICostCarChargeService {
private final CostCarChargeMapper baseMapper;
private final CostItemsMapper costItemsMapper;
/**
* 查询费用-车辆收费
@@ -95,6 +100,9 @@ public class CostCarChargeServiceImpl implements ICostCarChargeService {
@Override
public Boolean insertByBo(CostCarChargeBo bo) {
CostCarCharge add = MapstructUtils.convert(bo, CostCarCharge.class);
CostItemsVo costItemsVo = costItemsMapper.selectVoById(add.getCostItemsId());
BigDecimal unitPrice = costItemsVo.getUnitPrice();
add.setAmountReceivable(unitPrice);
validEntityBeforeSave(add);
boolean flag = baseMapper.insert(add) > 0;
if (flag) {

View File

@@ -1,5 +1,6 @@
package org.dromara.property.service.impl;
import cn.hutool.core.bean.BeanUtil;
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,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.vo.CostHouseChargeDetailVo;
import org.dromara.property.domain.vo.CostItemsVo;
import org.dromara.property.domain.vo.TbRoomVo;
import org.dromara.property.mapper.CostItemsMapper;
import org.dromara.property.mapper.TbRoomMapper;
import org.springframework.stereotype.Service;
import org.dromara.property.domain.bo.CostHouseChargeBo;
import org.dromara.property.domain.vo.CostHouseChargeVo;
@@ -16,6 +22,8 @@ import org.dromara.property.domain.CostHouseCharge;
import org.dromara.property.mapper.CostHouseChargeMapper;
import org.dromara.property.service.ICostHouseChargeService;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.List;
import java.util.Map;
import java.util.Collection;
@@ -32,6 +40,8 @@ import java.util.Collection;
public class CostHouseChargeServiceImpl implements ICostHouseChargeService {
private final CostHouseChargeMapper baseMapper;
private final CostItemsMapper costItemsMapper;
private final TbRoomMapper tbRoomMapper;
/**
* 查询房屋收费
@@ -40,8 +50,14 @@ public class CostHouseChargeServiceImpl implements ICostHouseChargeService {
* @return 房屋收费
*/
@Override
public CostHouseChargeVo queryById(Long id){
return baseMapper.selectVoById(id);
public CostHouseChargeDetailVo queryById(Long id){
CostHouseChargeVo costHouseChargeVo = baseMapper.selectVoById(id);
CostHouseChargeDetailVo costHouseChargeDetailVo = BeanUtil.copyProperties(costHouseChargeVo, CostHouseChargeDetailVo.class);
CostItemsVo costItemsVo = costItemsMapper.selectVoById(costHouseChargeDetailVo.getCostItemsId());
costHouseChargeDetailVo.setCostItemsVo( costItemsVo );
TbRoomVo tbRoomVo = tbRoomMapper.selectVoById(costHouseChargeDetailVo.getRoomId());
costHouseChargeDetailVo.setRoomVo(tbRoomVo);
return costHouseChargeDetailVo;
}
/**
@@ -95,6 +111,24 @@ public class CostHouseChargeServiceImpl implements ICostHouseChargeService {
@Override
public Boolean insertByBo(CostHouseChargeBo bo) {
CostHouseCharge add = MapstructUtils.convert(bo, CostHouseCharge.class);
//查询房间面积
TbRoomVo tbRoomVo = tbRoomMapper.selectVoById(bo.getRoomId());
BigDecimal area = new BigDecimal(tbRoomVo.getArea());
CostItemsVo costItemsVo = costItemsMapper.selectVoById(add.getCostItemsId());
BigDecimal unitPrice = costItemsVo.getUnitPrice();
//向上取整
if(costItemsVo.getRoundingMode().equals("1")){
add.setAmountReceivable(area.multiply(unitPrice).add(costItemsVo.getSurcharge()).setScale(Integer.valueOf(costItemsVo.getCurrencyDecimals()), BigDecimal.ROUND_UP).longValue());
}
//向下取整
if(costItemsVo.getRoundingMode().equals("2")){
add.setAmountReceivable( area.multiply(unitPrice).add(costItemsVo.getSurcharge()).setScale(Integer.valueOf(costItemsVo.getCurrencyDecimals()), BigDecimal.ROUND_DOWN).longValue());
}
//四舍五入
if(costItemsVo.getRoundingMode().equals("0")){
add.setAmountReceivable(area.multiply(unitPrice).add(costItemsVo.getSurcharge()).setScale( Integer.valueOf(costItemsVo.getCurrencyDecimals()), RoundingMode.HALF_UP).longValue());
}
//area
validEntityBeforeSave(add);
boolean flag = baseMapper.insert(add) > 0;
if (flag) {

View File

@@ -1,5 +1,6 @@
package org.dromara.property.service.impl;
import cn.hutool.core.util.RandomUtil;
import org.dromara.common.core.utils.MapstructUtils;
import org.dromara.common.core.utils.StringUtils;
import org.dromara.common.mybatis.core.page.TableDataInfo;
@@ -99,6 +100,7 @@ public class CostItemsServiceImpl implements ICostItemsService {
@Override
public Boolean insertByBo(CostItemsBo bo) {
CostItems add = MapstructUtils.convert(bo, CostItems.class);
add.setChargeNo( RandomUtil.randomNumbers(11));
validEntityBeforeSave(add);
boolean flag = baseMapper.insert(add) > 0;
if (flag) {

View File

@@ -1,5 +1,7 @@
package org.dromara.property.service.impl;
import cn.hutool.core.util.ObjectUtil;
import org.checkerframework.checker.units.qual.C;
import org.dromara.common.core.utils.MapstructUtils;
import org.dromara.common.core.utils.StringUtils;
import org.dromara.common.mybatis.core.page.TableDataInfo;
@@ -11,14 +13,18 @@ import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.dromara.property.domain.CostPayFeeAudit;
import org.dromara.property.domain.bo.CostPayFeeAuditBo;
import org.dromara.property.domain.vo.CostPayFeeAuditVo;
import org.dromara.property.domain.vo.*;
import org.dromara.property.mapper.CostItemsMapper;
import org.dromara.property.mapper.CostPayFeeAuditMapper;
import org.dromara.property.mapper.TbRoomMapper;
import org.dromara.property.service.ICostPayFeeAuditService;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Collection;
import java.util.stream.Collectors;
/**
* 费用-缴费审核Service业务层处理
@@ -32,6 +38,8 @@ import java.util.Collection;
public class CostPayFeeAuditServiceImpl implements ICostPayFeeAuditService {
private final CostPayFeeAuditMapper baseMapper;
private final CostItemsMapper costItemsMapper;
private final TbRoomMapper roomMapper;
/**
* 查询费用-缴费审核
@@ -55,7 +63,30 @@ public class CostPayFeeAuditServiceImpl implements ICostPayFeeAuditService {
public TableDataInfo<CostPayFeeAuditVo> queryPageList(CostPayFeeAuditBo bo, PageQuery pageQuery) {
LambdaQueryWrapper<CostPayFeeAudit> lqw = buildQueryWrapper(bo);
Page<CostPayFeeAuditVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
return TableDataInfo.build(result);
List<Long> itemIdList = result.getRecords().stream()
.map(vo -> vo.getItemId())
.distinct()
.collect(Collectors.toList());
List<Long> roomIdList = result.getRecords().stream()
.map(vo -> vo.getHouseChargeId())
.distinct()
.collect(Collectors.toList());
List<CostItemsVo> costItemsVoList = costItemsMapper.selectVoByIds(itemIdList);
List<TbRoomVo> roomVoList = roomMapper.selectVoByIds(roomIdList);
List<CostPayFeeAuditVo> costPayFeeAuditVoList = new ArrayList<>();
result.getRecords().stream().forEach(s -> {
CostItemsVo costItemsVo = costItemsVoList.stream()
.filter(vo -> vo.getId() != null && vo.getId().equals(s.getItemId())).findFirst().orElse(null);
s.setChargeItem(ObjectUtil.isNotEmpty(costItemsVo)?costItemsVo.getChargeItem():null);
s.setCostType(ObjectUtil.isNotEmpty(costItemsVo)?costItemsVo.getCostType():null);
s.setChargeCycle(ObjectUtil.isNotEmpty(costItemsVo)?costItemsVo.getChargeCycle():null);
TbRoomVo tbRoomVo = roomVoList.stream()
.filter(vo -> vo.getId() != null && vo.getId().equals(s.getHouseChargeId())).findFirst().orElse(null);
s.setRoomNumber(ObjectUtil.isNotEmpty(tbRoomVo)?tbRoomVo.getRoomNumber():null);
costPayFeeAuditVoList.add(s);
});
return TableDataInfo.build(new Page<CostPayFeeAuditVo>().setRecords(costPayFeeAuditVoList));
}
/**
@@ -78,7 +109,6 @@ public class CostPayFeeAuditServiceImpl implements ICostPayFeeAuditService {
lqw.eq(bo.getItemId() != null, CostPayFeeAudit::getItemId, bo.getItemId());
lqw.eq(bo.getStartTime() != null, CostPayFeeAudit::getStartTime, bo.getStartTime());
lqw.eq(bo.getEndTime() != null, CostPayFeeAudit::getEndTime, bo.getEndTime());
lqw.eq(StringUtils.isNotBlank(bo.getReceivedAmount()), CostPayFeeAudit::getReceivedAmount, bo.getReceivedAmount());
lqw.eq(bo.getReceivableAmount() != null, CostPayFeeAudit::getReceivableAmount, bo.getReceivableAmount());
lqw.eq(bo.getPayTime() != null, CostPayFeeAudit::getPayTime, bo.getPayTime());
lqw.eq(StringUtils.isNotBlank(bo.getState()), CostPayFeeAudit::getState, bo.getState());

View File

@@ -153,6 +153,7 @@ public class MachineLocationServiceImpl implements IMachineLocationService {
@Override
public Boolean insertByBo(MachineLocationBo bo) {
MachineLocation add = MapstructUtils.convert(bo, MachineLocation.class);
add.setLocationCode(RandomUtil.randomNumbers(11));
validEntityBeforeSave(add);
boolean flag = baseMapper.insert(add) > 0;
if (flag) {
@@ -179,7 +180,7 @@ public class MachineLocationServiceImpl implements IMachineLocationService {
*/
private void validEntityBeforeSave(MachineLocation entity) {
//TODO 做一些数据校验,如唯一约束
entity.setLocationCode(RandomUtil.randomNumbers(11));
}
/**

View File

@@ -1,5 +1,7 @@
package org.dromara.property.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import org.dromara.common.core.utils.MapstructUtils;
import org.dromara.common.core.utils.StringUtils;
import org.dromara.common.mybatis.core.page.TableDataInfo;
@@ -9,10 +11,16 @@ 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.InspectionPlanStaff;
import org.dromara.property.domain.MachineMaintainPlan;
import org.dromara.property.domain.MachineMaintainPlanStaff;
import org.dromara.property.domain.bo.InspectionPlanStaffBo;
import org.dromara.property.domain.bo.MachineMaintainPlanBo;
import org.dromara.property.domain.bo.MachineMaintainPlanStaffBo;
import org.dromara.property.domain.vo.MachineMaintainPlanStaffVo;
import org.dromara.property.domain.vo.MachineMaintainPlanVo;
import org.dromara.property.mapper.MachineMaintainPlanMapper;
import org.dromara.property.mapper.MachineMaintainPlanStaffMapper;
import org.dromara.property.service.IMachineMaintainPlanService;
import org.springframework.stereotype.Service;
@@ -32,6 +40,7 @@ import java.util.Collection;
public class MachineMaintainPlanServiceImpl implements IMachineMaintainPlanService {
private final MachineMaintainPlanMapper baseMapper;
private final MachineMaintainPlanStaffMapper machineMaintainPlanStaffMapper;
/**
* 查询设备保养计划
@@ -41,7 +50,12 @@ public class MachineMaintainPlanServiceImpl implements IMachineMaintainPlanServi
*/
@Override
public MachineMaintainPlanVo queryById(Long id){
return baseMapper.selectVoById(id);
MachineMaintainPlanVo machineMaintainPlanVo = baseMapper.selectVoById(id);
LambdaQueryWrapper<MachineMaintainPlanStaff> planQueryWrapper = new LambdaQueryWrapper<>();
planQueryWrapper.eq(MachineMaintainPlanStaff::getMaintainPlanId,id);
List<MachineMaintainPlanStaffVo> machineMaintainPlanStaffVos = machineMaintainPlanStaffMapper.selectVoList(planQueryWrapper);
machineMaintainPlanVo.setMachineMaintainPlanStaffVos(machineMaintainPlanStaffVos );
return machineMaintainPlanVo;
}
/**
@@ -97,10 +111,18 @@ public class MachineMaintainPlanServiceImpl implements IMachineMaintainPlanServi
@Override
public Boolean insertByBo(MachineMaintainPlanBo bo) {
MachineMaintainPlan add = MapstructUtils.convert(bo, MachineMaintainPlan.class);
add.setState("0");
validEntityBeforeSave(add);
boolean flag = baseMapper.insert(add) > 0;
if (flag) {
bo.setId(add.getId());
List<MachineMaintainPlanStaffBo> machineMaintainPlanStaffBoList = bo.getMachineMaintainPlanStaffBoList();
if (CollectionUtil.isNotEmpty(machineMaintainPlanStaffBoList)) {
for (MachineMaintainPlanStaffBo staffBo : machineMaintainPlanStaffBoList) {
staffBo.setMaintainPlanId(add.getId());
}
machineMaintainPlanStaffMapper.insertBatch(BeanUtil.copyToList(machineMaintainPlanStaffBoList, MachineMaintainPlanStaff.class));
}
}
return flag;
}
@@ -123,7 +145,7 @@ public class MachineMaintainPlanServiceImpl implements IMachineMaintainPlanServi
*/
private void validEntityBeforeSave(MachineMaintainPlan entity){
//TODO 做一些数据校验,如唯一约束
entity.setState("0");
}
/**

View File

@@ -109,6 +109,9 @@ public class PlantsOrderChargeServiceImpl implements IPlantsOrderChargeService {
@Override
public Boolean insertByBo(PlantsOrderChargeBo bo) {
PlantsOrderCharge add = MapstructUtils.convert(bo, PlantsOrderCharge.class);
if(add.getRent()!=null&&add.getDeposit()!=null&&add.getPenalty()!=null){
add.setTotalAmount(add.getRent().add(add.getDeposit()).add(add.getPenalty()));
}
validEntityBeforeSave(add);
boolean flag = baseMapper.insert(add) > 0;
if (flag) {
@@ -134,9 +137,7 @@ public class PlantsOrderChargeServiceImpl implements IPlantsOrderChargeService {
* 保存前的数据校验
*/
private void validEntityBeforeSave(PlantsOrderCharge entity){
if(entity.getRent()!=null&&entity.getDeposit()!=null&&entity.getPenalty()!=null){
entity.setTotalAmount(entity.getRent().add(entity.getDeposit()).add(entity.getPenalty()));
}
}
/**

View File

@@ -137,7 +137,7 @@ public class ServiceWorkOrdersServiceImpl implements IServiceWorkOrdersService {
@Transactional(rollbackFor = Exception.class)
public Boolean insertByBo(ServiceWorkOrdersBo bo) {
ServiceWorkOrders add = MapstructUtils.convert(bo, ServiceWorkOrders.class);
add.setOrderNo("GD" + IdUtil.getSnowflakeNextIdStr());
validEntityBeforeSave(add);
boolean flag = baseMapper.insert(add) > 0;
if (flag) {
@@ -165,7 +165,7 @@ public class ServiceWorkOrdersServiceImpl implements IServiceWorkOrdersService {
*/
private void validEntityBeforeSave(ServiceWorkOrders entity) {
//TODO 做一些数据校验,如唯一约束
entity.setOrderNo("GD" + IdUtil.getSnowflakeNextIdStr());
}
/**

View File

@@ -10,11 +10,11 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.dromara.property.domain.bo.TbMeterBo;
import org.dromara.property.domain.vo.TbMeterVo;
import org.dromara.property.domain.TbMeter;
import org.dromara.property.mapper.TbMeterMapper;
import org.dromara.property.service.ITbMeterService;
import org.dromara.property.domain.bo.TbMeterInfoBo;
import org.dromara.property.domain.vo.TbMeterInfoVo;
import org.dromara.property.domain.TbMeterInfo;
import org.dromara.property.mapper.TbMeterInfoMapper;
import org.dromara.property.service.ITbMeterInfoService;
import java.util.List;
import java.util.Map;
@@ -23,15 +23,15 @@ import java.util.Collection;
/**
* 水电气Service业务层处理
*
* @author LionLi
* @since 2025-07-17
* @author lsm
* @since 2025-07-19
*/
@Slf4j
@RequiredArgsConstructor
@Service
public class TbMeterServiceImpl implements ITbMeterService {
public class TbMeterInfoServiceImpl implements ITbMeterInfoService {
private final TbMeterMapper baseMapper;
private final TbMeterInfoMapper baseMapper;
/**
* 查询水电气
@@ -40,7 +40,7 @@ public class TbMeterServiceImpl implements ITbMeterService {
* @return 水电气
*/
@Override
public TbMeterVo queryById(Long id){
public TbMeterInfoVo queryById(Long id){
return baseMapper.selectVoById(id);
}
@@ -52,9 +52,9 @@ public class TbMeterServiceImpl implements ITbMeterService {
* @return 水电气分页列表
*/
@Override
public TableDataInfo<TbMeterVo> queryPageList(TbMeterBo bo, PageQuery pageQuery) {
LambdaQueryWrapper<TbMeter> lqw = buildQueryWrapper(bo);
Page<TbMeterVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
public TableDataInfo<TbMeterInfoVo> queryPageList(TbMeterInfoBo bo, PageQuery pageQuery) {
LambdaQueryWrapper<TbMeterInfo> lqw = buildQueryWrapper(bo);
Page<TbMeterInfoVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
return TableDataInfo.build(result);
}
@@ -65,28 +65,25 @@ public class TbMeterServiceImpl implements ITbMeterService {
* @return 水电气列表
*/
@Override
public List<TbMeterVo> queryList(TbMeterBo bo) {
LambdaQueryWrapper<TbMeter> lqw = buildQueryWrapper(bo);
public List<TbMeterInfoVo> queryList(TbMeterInfoBo bo) {
LambdaQueryWrapper<TbMeterInfo> lqw = buildQueryWrapper(bo);
return baseMapper.selectVoList(lqw);
}
private LambdaQueryWrapper<TbMeter> buildQueryWrapper(TbMeterBo bo) {
private LambdaQueryWrapper<TbMeterInfo> buildQueryWrapper(TbMeterInfoBo bo) {
Map<String, Object> params = bo.getParams();
LambdaQueryWrapper<TbMeter> lqw = Wrappers.lambdaQuery();
lqw.orderByAsc(TbMeter::getId);
lqw.like(StringUtils.isNotBlank(bo.getMeterName()), TbMeter::getMeterName, bo.getMeterName());
lqw.eq(StringUtils.isNotBlank(bo.getMeterCode()), TbMeter::getMeterCode, bo.getMeterCode());
lqw.eq(StringUtils.isNotBlank(bo.getFactoryNo()), TbMeter::getFactoryNo, bo.getFactoryNo());
lqw.eq(bo.getMeterType() != null, TbMeter::getMeterType, bo.getMeterType());
lqw.eq(bo.getMeterPurpose() != null, TbMeter::getMeterPurpose, bo.getMeterPurpose());
lqw.eq(bo.getShareType() != null, TbMeter::getShareType, bo.getShareType());
lqw.eq(bo.getPayType() != null, TbMeter::getPayType, bo.getPayType());
lqw.eq(bo.getDisplay() != null, TbMeter::getDisplay, bo.getDisplay());
lqw.eq(bo.getMaxDisplay() != null, TbMeter::getMaxDisplay, bo.getMaxDisplay());
lqw.eq(bo.getBillingRate() != null, TbMeter::getBillingRate, bo.getBillingRate());
lqw.eq(bo.getSurplus() != null, TbMeter::getSurplus, bo.getSurplus());
lqw.eq(bo.getCommunicationState() != null, TbMeter::getCommunicationState, bo.getCommunicationState());
lqw.eq(bo.getRunningState() != null, TbMeter::getRunningState, bo.getRunningState());
LambdaQueryWrapper<TbMeterInfo> lqw = Wrappers.lambdaQuery();
lqw.orderByAsc(TbMeterInfo::getId);
lqw.like(StringUtils.isNotBlank(bo.getMeterName()), TbMeterInfo::getMeterName, bo.getMeterName());
lqw.eq(StringUtils.isNotBlank(bo.getMeterCode()), TbMeterInfo::getMeterCode, bo.getMeterCode());
lqw.eq(StringUtils.isNotBlank(bo.getFactoryNo()), TbMeterInfo::getFactoryNo, bo.getFactoryNo());
lqw.eq(bo.getMeterType() != null, TbMeterInfo::getMeterType, bo.getMeterType());
lqw.eq(bo.getMeterUnit() != null, TbMeterInfo::getMeterUnit, bo.getMeterUnit());
lqw.eq(StringUtils.isNotBlank(bo.getInstallLocation()), TbMeterInfo::getInstallLocation, bo.getInstallLocation());
lqw.eq(bo.getInitReading() != null, TbMeterInfo::getInitReading, bo.getInitReading());
lqw.eq(bo.getMaxRang() != null, TbMeterInfo::getMaxRang, bo.getMaxRang());
lqw.eq(bo.getCommunicationState() != null, TbMeterInfo::getCommunicationState, bo.getCommunicationState());
lqw.eq(bo.getRunningState() != null, TbMeterInfo::getRunningState, bo.getRunningState());
return lqw;
}
@@ -97,8 +94,8 @@ public class TbMeterServiceImpl implements ITbMeterService {
* @return 是否新增成功
*/
@Override
public Boolean insertByBo(TbMeterBo bo) {
TbMeter add = MapstructUtils.convert(bo, TbMeter.class);
public Boolean insertByBo(TbMeterInfoBo bo) {
TbMeterInfo add = MapstructUtils.convert(bo, TbMeterInfo.class);
validEntityBeforeSave(add);
boolean flag = baseMapper.insert(add) > 0;
if (flag) {
@@ -114,8 +111,8 @@ public class TbMeterServiceImpl implements ITbMeterService {
* @return 是否修改成功
*/
@Override
public Boolean updateByBo(TbMeterBo bo) {
TbMeter update = MapstructUtils.convert(bo, TbMeter.class);
public Boolean updateByBo(TbMeterInfoBo bo) {
TbMeterInfo update = MapstructUtils.convert(bo, TbMeterInfo.class);
validEntityBeforeSave(update);
return baseMapper.updateById(update) > 0;
}
@@ -123,7 +120,7 @@ public class TbMeterServiceImpl implements ITbMeterService {
/**
* 保存前的数据校验
*/
private void validEntityBeforeSave(TbMeter entity){
private void validEntityBeforeSave(TbMeterInfo entity){
//TODO 做一些数据校验,如唯一约束
}

View File

@@ -0,0 +1,139 @@
package org.dromara.property.service.impl;
import org.dromara.common.core.utils.MapstructUtils;
import org.dromara.common.core.utils.StringUtils;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.common.mybatis.core.page.PageQuery;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
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.springframework.stereotype.Service;
import org.dromara.property.domain.bo.TbMeterRecordBo;
import org.dromara.property.domain.vo.TbMeterRecordVo;
import org.dromara.property.domain.TbMeterRecord;
import org.dromara.property.mapper.TbMeterRecordMapper;
import org.dromara.property.service.ITbMeterRecordService;
import java.util.List;
import java.util.Map;
import java.util.Collection;
/**
* 抄记录Service业务层处理
*
* @author lsm
* @date 2025-07-19
*/
@Slf4j
@RequiredArgsConstructor
@Service
public class TbMeterRecordServiceImpl implements ITbMeterRecordService {
private final TbMeterRecordMapper baseMapper;
/**
* 查询抄记录
*
* @param id 主键
* @return 抄记录
*/
@Override
public TbMeterRecordVo queryById(Long id){
return baseMapper.selectVoById(id);
}
/**
* 分页查询抄记录列表
*
* @param bo 查询条件
* @param pageQuery 分页参数
* @return 抄记录分页列表
*/
@Override
public TableDataInfo<TbMeterRecordVo> queryPageList(TbMeterRecordBo bo, PageQuery pageQuery) {
LambdaQueryWrapper<TbMeterRecord> lqw = buildQueryWrapper(bo);
Page<TbMeterRecordVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
return TableDataInfo.build(result);
}
/**
* 查询符合条件的抄记录列表
*
* @param bo 查询条件
* @return 抄记录列表
*/
@Override
public List<TbMeterRecordVo> queryList(TbMeterRecordBo bo) {
LambdaQueryWrapper<TbMeterRecord> lqw = buildQueryWrapper(bo);
return baseMapper.selectVoList(lqw);
}
private LambdaQueryWrapper<TbMeterRecord> buildQueryWrapper(TbMeterRecordBo bo) {
Map<String, Object> params = bo.getParams();
LambdaQueryWrapper<TbMeterRecord> lqw = Wrappers.lambdaQuery();
lqw.orderByAsc(TbMeterRecord::getId);
lqw.eq(StringUtils.isNotBlank(bo.getMeterId()), TbMeterRecord::getMeterId, bo.getMeterId());
lqw.eq(bo.getReaderId() != null, TbMeterRecord::getReaderId, bo.getReaderId());
lqw.eq(bo.getReadingTime() != null, TbMeterRecord::getReadingTime, bo.getReadingTime());
lqw.eq(bo.getCurrentReading() != null, TbMeterRecord::getCurrentReading, bo.getCurrentReading());
lqw.eq(bo.getPreviousReading() != null, TbMeterRecord::getPreviousReading, bo.getPreviousReading());
lqw.eq(bo.getConsumption() != null, TbMeterRecord::getConsumption, bo.getConsumption());
lqw.eq(bo.getReadingMethod() != null, TbMeterRecord::getReadingMethod, bo.getReadingMethod());
lqw.eq(bo.getImgOssid() != null, TbMeterRecord::getImgOssid, bo.getImgOssid());
return lqw;
}
/**
* 新增抄记录
*
* @param bo 抄记录
* @return 是否新增成功
*/
@Override
public Boolean insertByBo(TbMeterRecordBo bo) {
TbMeterRecord add = MapstructUtils.convert(bo, TbMeterRecord.class);
validEntityBeforeSave(add);
boolean flag = baseMapper.insert(add) > 0;
if (flag) {
bo.setId(add.getId());
}
return flag;
}
/**
* 修改抄记录
*
* @param bo 抄记录
* @return 是否修改成功
*/
@Override
public Boolean updateByBo(TbMeterRecordBo bo) {
TbMeterRecord update = MapstructUtils.convert(bo, TbMeterRecord.class);
validEntityBeforeSave(update);
return baseMapper.updateById(update) > 0;
}
/**
* 保存前的数据校验
*/
private void validEntityBeforeSave(TbMeterRecord entity){
//TODO 做一些数据校验,如唯一约束
}
/**
* 校验并批量删除抄记录信息
*
* @param ids 待删除的主键集合
* @param isValid 是否进行有效性校验
* @return 是否删除成功
*/
@Override
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
if(isValid){
//TODO 做一些业务上的校验,判断是否需要校验
}
return baseMapper.deleteByIds(ids) > 0;
}
}

View File

@@ -0,0 +1,118 @@
package org.dromara.sis.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.RequiredArgsConstructor;
import org.dromara.common.core.domain.R;
import org.dromara.common.core.domain.TreeNode;
import org.dromara.common.core.validate.AddGroup;
import org.dromara.common.core.validate.EditGroup;
import org.dromara.common.excel.utils.ExcelUtil;
import org.dromara.common.idempotent.annotation.RepeatSubmit;
import org.dromara.common.log.annotation.Log;
import org.dromara.common.log.enums.BusinessType;
import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.common.web.core.BaseController;
import org.dromara.sis.domain.bo.SisDeviceChannelBo;
import org.dromara.sis.domain.vo.SisDeviceChannelVo;
import org.dromara.sis.service.ISisDeviceChannelService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 设备通道管理
* 前端访问路由地址为:/sis/deviceChannel
*
* @author lxj
* @date 2025-07-19
*/
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/deviceChannel")
public class SisDeviceChannelController extends BaseController {
private final ISisDeviceChannelService sisDeviceChannelService;
/**
* 查询设备通道管理列表
*/
@SaCheckPermission("sis:deviceChannel:list")
@GetMapping("/list")
public TableDataInfo<SisDeviceChannelVo> list(SisDeviceChannelBo bo, PageQuery pageQuery) {
return sisDeviceChannelService.queryPageList(bo, pageQuery);
}
/**
* 查询设备通道树
*
* @return 返回设备通道树
*/
@GetMapping("/treeList")
public R<List<TreeNode<Long>>> tree() {
return R.ok(sisDeviceChannelService.queryTree());
}
/**
* 导出设备通道管理列表
*/
@SaCheckPermission("sis:deviceChannel:export")
@Log(title = "设备通道管理", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(SisDeviceChannelBo bo, HttpServletResponse response) {
List<SisDeviceChannelVo> list = sisDeviceChannelService.queryList(bo);
ExcelUtil.exportExcel(list, "设备通道管理", SisDeviceChannelVo.class, response);
}
/**
* 获取设备通道管理详细信息
*
* @param id 主键
*/
@SaCheckPermission("sis:deviceChannel:query")
@GetMapping("/{id}")
public R<SisDeviceChannelVo> getInfo(@NotNull(message = "主键不能为空")
@PathVariable("id") Long id) {
return R.ok(sisDeviceChannelService.queryById(id));
}
/**
* 新增设备通道管理
*/
@SaCheckPermission("sis:deviceChannel:add")
@Log(title = "设备通道管理", businessType = BusinessType.INSERT)
@RepeatSubmit()
@PostMapping()
public R<Void> add(@Validated(AddGroup.class) @RequestBody SisDeviceChannelBo bo) {
return toAjax(sisDeviceChannelService.insertByBo(bo));
}
/**
* 修改设备通道管理
*/
@SaCheckPermission("sis:deviceChannel:edit")
@Log(title = "设备通道管理", businessType = BusinessType.UPDATE)
@RepeatSubmit()
@PutMapping()
public R<Void> edit(@Validated(EditGroup.class) @RequestBody SisDeviceChannelBo bo) {
return toAjax(sisDeviceChannelService.updateByBo(bo));
}
/**
* 删除设备通道管理
*
* @param ids 主键串
*/
@SaCheckPermission("sis:deviceChannel:remove")
@Log(title = "设备通道管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public R<Void> remove(@NotEmpty(message = "主键不能为空")
@PathVariable("ids") Long[] ids) {
return toAjax(sisDeviceChannelService.deleteWithValidByIds(List.of(ids), true));
}
}

View File

@@ -0,0 +1,106 @@
package org.dromara.sis.controller;
import java.util.List;
import lombok.RequiredArgsConstructor;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.constraints.*;
import cn.dev33.satoken.annotation.SaCheckPermission;
import org.springframework.web.bind.annotation.*;
import org.springframework.validation.annotation.Validated;
import org.dromara.common.idempotent.annotation.RepeatSubmit;
import org.dromara.common.log.annotation.Log;
import org.dromara.common.web.core.BaseController;
import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.core.domain.R;
import org.dromara.common.core.validate.AddGroup;
import org.dromara.common.core.validate.EditGroup;
import org.dromara.common.log.enums.BusinessType;
import org.dromara.common.excel.utils.ExcelUtil;
import org.dromara.sis.domain.vo.SisDeviceGroupVo;
import org.dromara.sis.domain.bo.SisDeviceGroupBo;
import org.dromara.sis.service.ISisDeviceGroupService;
import org.dromara.common.mybatis.core.page.TableDataInfo;
/**
* 设备组管理
* 前端访问路由地址为:/sis/deviceGroup
*
* @author lxj
* @date 2025-07-19
*/
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/deviceGroup")
public class SisDeviceGroupController extends BaseController {
private final ISisDeviceGroupService sisDeviceGroupService;
/**
* 查询设备组管理列表
*/
@SaCheckPermission("sis:deviceGroup:list")
@GetMapping("/list")
public TableDataInfo<SisDeviceGroupVo> list(SisDeviceGroupBo bo, PageQuery pageQuery) {
return sisDeviceGroupService.queryPageList(bo, pageQuery);
}
/**
* 导出设备组管理列表
*/
@SaCheckPermission("sis:deviceGroup:export")
@Log(title = "设备组管理", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(SisDeviceGroupBo bo, HttpServletResponse response) {
List<SisDeviceGroupVo> list = sisDeviceGroupService.queryList(bo);
ExcelUtil.exportExcel(list, "设备组管理", SisDeviceGroupVo.class, response);
}
/**
* 获取设备组管理详细信息
*
* @param id 主键
*/
@SaCheckPermission("sis:deviceGroup:query")
@GetMapping("/{id}")
public R<SisDeviceGroupVo> getInfo(@NotNull(message = "主键不能为空")
@PathVariable("id") Long id) {
return R.ok(sisDeviceGroupService.queryById(id));
}
/**
* 新增设备组管理
*/
@SaCheckPermission("sis:deviceGroup:add")
@Log(title = "设备组管理", businessType = BusinessType.INSERT)
@RepeatSubmit()
@PostMapping()
public R<Void> add(@Validated(AddGroup.class) @RequestBody SisDeviceGroupBo bo) {
return toAjax(sisDeviceGroupService.insertByBo(bo));
}
/**
* 修改设备组管理
*/
@SaCheckPermission("sis:deviceGroup:edit")
@Log(title = "设备组管理", businessType = BusinessType.UPDATE)
@RepeatSubmit()
@PutMapping()
public R<Void> edit(@Validated(EditGroup.class) @RequestBody SisDeviceGroupBo bo) {
return toAjax(sisDeviceGroupService.updateByBo(bo));
}
/**
* 删除设备组管理
*
* @param ids 主键串
*/
@SaCheckPermission("sis:deviceGroup:remove")
@Log(title = "设备组管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public R<Void> remove(@NotEmpty(message = "主键不能为空")
@PathVariable("ids") Long[] ids) {
return toAjax(sisDeviceGroupService.deleteWithValidByIds(List.of(ids), true));
}
}

View File

@@ -0,0 +1,76 @@
package org.dromara.sis.domain;
import org.dromara.common.tenant.core.TenantEntity;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serial;
/**
* 设备通道管理对象 sis_device_channel
*
* @author lxj
* @date 2025-07-19
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("sis_device_channel")
public class SisDeviceChannel extends TenantEntity {
@Serial
private static final long serialVersionUID = 1L;
/**
* 主键id
*/
@TableId(value = "id")
private Long id;
/**
* 设备id
*/
private Long deviceId;
/**
* 设备名称
*/
private String channelName;
/**
* 通道分组组id
*/
private Long groupId;
/**
* 设备ip
*/
private String deviceIp;
/**
* 设备端口
*/
private Long devicePort;
/**
* 设备账号
*/
private String deviceAccount;
/**
* 设备密码
*/
private String devicePwd;
/**
* 设备
*/
private String deviceMac;
/**
* 设备通道编号
*/
private String channelNo;
}

View File

@@ -0,0 +1,46 @@
package org.dromara.sis.domain;
import org.dromara.common.tenant.core.TenantEntity;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serial;
/**
* 设备组管理对象 sis_device_group
*
* @author lxj
* @date 2025-07-19
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("sis_device_group")
public class SisDeviceGroup extends TenantEntity {
@Serial
private static final long serialVersionUID = 1L;
/**
* 主键id
*/
@TableId(value = "id")
private Long id;
/**
* 分组名称
*/
private String name;
/**
* 父编码id(-1 表示根节点)
*/
private Long parentId;
/**
* 备注
*/
private String remark;
}

View File

@@ -53,21 +53,6 @@ public class SisDeviceManage extends BaseEntity {
*/
private Integer deviceStatus;
/**
* 父级设备id
*/
private Long parentId;
/**
* 录像机ip
*/
private String vcrIp;
/**
* 录像机端口
*/
private Integer vcrPort;
/**
* 设备账号
*/
@@ -79,19 +64,17 @@ public class SisDeviceManage extends BaseEntity {
private String devicePwd;
/**
* 录像机账号
* 设备类型
*/
private String vcrAccount;
private Integer deviceType;
/**
* 录像机密码
* 设备厂商编号
*/
private String vcrPwd;
private String factoryNo;
/**
* 设备在录像机的通道编码
* 设备组id
*/
private String channelNo;
private Long groupId;
}

View File

@@ -0,0 +1,81 @@
package org.dromara.sis.domain.bo;
import org.dromara.sis.domain.SisDeviceChannel;
import org.dromara.common.mybatis.core.domain.BaseEntity;
import org.dromara.common.core.validate.AddGroup;
import org.dromara.common.core.validate.EditGroup;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import lombok.EqualsAndHashCode;
import jakarta.validation.constraints.*;
/**
* 设备通道管理业务对象 sis_device_channel
*
* @author lxj
* @date 2025-07-19
*/
@Data
@EqualsAndHashCode(callSuper = true)
@AutoMapper(target = SisDeviceChannel.class, reverseConvertGenerate = false)
public class SisDeviceChannelBo extends BaseEntity {
/**
* 主键id
*/
@NotNull(message = "主键id不能为空", groups = { EditGroup.class })
private Long id;
/**
* 设备id
*/
@NotNull(message = "设备id不能为空", groups = { AddGroup.class, EditGroup.class })
private Long deviceId;
/**
* 设备名称
*/
private String channelName;
/**
* 通道分组组id
*/
@NotNull(message = "通道分组组id不能为空", groups = { AddGroup.class, EditGroup.class })
private Long groupId;
/**
* 设备ip
*/
@NotBlank(message = "设备ip不能为空", groups = { AddGroup.class, EditGroup.class })
private String deviceIp;
/**
* 设备端口
*/
@NotNull(message = "设备端口不能为空", groups = { AddGroup.class, EditGroup.class })
private Long devicePort;
/**
* 设备账号
*/
@NotBlank(message = "设备账号不能为空", groups = { AddGroup.class, EditGroup.class })
private String deviceAccount;
/**
* 设备密码
*/
@NotBlank(message = "设备密码不能为空", groups = { AddGroup.class, EditGroup.class })
private String devicePwd;
/**
* 设备
*/
private String deviceMac;
/**
* 设备通道编号
*/
private String channelNo;
}

View File

@@ -0,0 +1,47 @@
package org.dromara.sis.domain.bo;
import org.dromara.sis.domain.SisDeviceGroup;
import org.dromara.common.mybatis.core.domain.BaseEntity;
import org.dromara.common.core.validate.AddGroup;
import org.dromara.common.core.validate.EditGroup;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import lombok.EqualsAndHashCode;
import jakarta.validation.constraints.*;
/**
* 设备组管理业务对象 sis_device_group
*
* @author lxj
* @date 2025-07-19
*/
@Data
@EqualsAndHashCode(callSuper = true)
@AutoMapper(target = SisDeviceGroup.class, reverseConvertGenerate = false)
public class SisDeviceGroupBo extends BaseEntity {
/**
* 主键id
*/
@NotNull(message = "主键id不能为空", groups = { EditGroup.class })
private Long id;
/**
* 分组名称
*/
@NotBlank(message = "分组名称不能为空", groups = { AddGroup.class, EditGroup.class })
private String name;
/**
* 父编码id(-1 表示根节点)
*/
@NotNull(message = "父编码id(-1 表示根节点)不能为空", groups = { AddGroup.class, EditGroup.class })
private Long parentId;
/**
* 备注
*/
private String remark;
}

View File

@@ -50,22 +50,6 @@ public class SisDeviceManageBo extends BaseEntity {
*/
private String deviceMac;
/**
* 父级设备id
*/
// @NotNull(message = "父级设备id不能为空", groups = {AddGroup.class, EditGroup.class})
private Long parentId;
/**
* 录像机ip
*/
private String vcrIp;
/**
* 录像机端口
*/
private Long vcrPort;
/**
* 设备账号
*/
@@ -79,19 +63,19 @@ public class SisDeviceManageBo extends BaseEntity {
private String devicePwd;
/**
* 录像机账号
* 设备类型
*/
private String vcrAccount;
private Integer deviceType;
/**
* 录像机密码
* 设备厂商编号
*/
private String vcrPwd;
private String factoryNo;
/**
* 设备在录像机的通道编码
* 设备组id
*/
private String channelNo;
private Long groupId;
}

View File

@@ -0,0 +1,92 @@
package org.dromara.sis.domain.vo;
import org.dromara.sis.domain.SisDeviceChannel;
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
import cn.idev.excel.annotation.ExcelProperty;
import org.dromara.common.excel.annotation.ExcelDictFormat;
import org.dromara.common.excel.convert.ExcelDictConvert;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
import java.util.Date;
/**
* 设备通道管理视图对象 sis_device_channel
*
* @author lxj
* @date 2025-07-19
*/
@Data
@ExcelIgnoreUnannotated
@AutoMapper(target = SisDeviceChannel.class)
public class SisDeviceChannelVo implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 主键id
*/
@ExcelProperty(value = "主键id")
private Long id;
/**
* 设备id
*/
@ExcelProperty(value = "设备id")
private Long deviceId;
/**
* 设备名称
*/
@ExcelProperty(value = "设备名称")
private String channelName;
/**
* 通道分组组id
*/
@ExcelProperty(value = "通道分组组id")
private Long groupId;
/**
* 设备ip
*/
@ExcelProperty(value = "设备ip")
private String deviceIp;
/**
* 设备端口
*/
@ExcelProperty(value = "设备端口")
private Long devicePort;
/**
* 设备账号
*/
@ExcelProperty(value = "设备账号")
private String deviceAccount;
/**
* 设备密码
*/
@ExcelProperty(value = "设备密码")
private String devicePwd;
/**
* 设备
*/
@ExcelProperty(value = "设备")
private String deviceMac;
/**
* 设备通道编号
*/
@ExcelProperty(value = "设备通道编号")
private String channelNo;
}

View File

@@ -0,0 +1,56 @@
package org.dromara.sis.domain.vo;
import org.dromara.sis.domain.SisDeviceGroup;
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
import cn.idev.excel.annotation.ExcelProperty;
import org.dromara.common.excel.annotation.ExcelDictFormat;
import org.dromara.common.excel.convert.ExcelDictConvert;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
import java.util.Date;
/**
* 设备组管理视图对象 sis_device_group
*
* @author lxj
* @date 2025-07-19
*/
@Data
@ExcelIgnoreUnannotated
@AutoMapper(target = SisDeviceGroup.class)
public class SisDeviceGroupVo implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 主键id
*/
@ExcelProperty(value = "主键id")
private Long id;
/**
* 分组名称
*/
@ExcelProperty(value = "分组名称")
private String name;
/**
* 父编码id(-1 表示根节点)
*/
@ExcelProperty(value = "父编码id(-1 表示根节点)")
private Long parentId;
/**
* 备注
*/
@ExcelProperty(value = "备注")
private String remark;
}

View File

@@ -1,21 +1,20 @@
package org.dromara.sis.domain.vo;
import org.dromara.sis.domain.SisDeviceManage;
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
import cn.idev.excel.annotation.ExcelProperty;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import org.dromara.sis.domain.SisDeviceManage;
import java.io.Serial;
import java.io.Serializable;
/**
* 设备管理视图对象 sis_device_manage
*
* @author mocheng
* @since 2025-06-26
* @since 2025-06-26
*/
@Data
@ExcelIgnoreUnannotated
@@ -55,24 +54,6 @@ public class SisDeviceManageVo implements Serializable {
@ExcelProperty(value = "设备")
private String deviceMac;
/**
* 父级设备id
*/
@ExcelProperty(value = "父级设备id")
private Long parentId;
/**
* 录像机ip
*/
@ExcelProperty(value = "录像机ip")
private String vcrIp;
/**
* 录像机端口
*/
@ExcelProperty(value = "录像机端口")
private Integer vcrPort;
/**
* 设备账号
*/
@@ -84,20 +65,18 @@ public class SisDeviceManageVo implements Serializable {
private String devicePwd;
/**
* 录像机账号
* 设备类型
*/
private String vcrAccount;
private Integer deviceType;
/**
* 录像机密码
* 设备厂商编号
*/
private String vcrPwd;
private String factoryNo;
/**
* 设备在录像机的通道编码
* 设备组id
*/
private String channelNo;
private String bindDeviceId;
private Long groupId;
}

View File

@@ -0,0 +1,15 @@
package org.dromara.sis.mapper;
import org.dromara.sis.domain.SisDeviceChannel;
import org.dromara.sis.domain.vo.SisDeviceChannelVo;
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
/**
* 设备通道管理Mapper接口
*
* @author lxj
* @date 2025-07-19
*/
public interface SisDeviceChannelMapper extends BaseMapperPlus<SisDeviceChannel, SisDeviceChannelVo> {
}

View File

@@ -0,0 +1,15 @@
package org.dromara.sis.mapper;
import org.dromara.sis.domain.SisDeviceGroup;
import org.dromara.sis.domain.vo.SisDeviceGroupVo;
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
/**
* 设备组管理Mapper接口
*
* @author lxj
* @date 2025-07-19
*/
public interface SisDeviceGroupMapper extends BaseMapperPlus<SisDeviceGroup, SisDeviceGroupVo> {
}

View File

@@ -40,9 +40,9 @@ public class HikDeviceApplicationRunner implements ApplicationRunner {
// 现在查询全部,后面要更具需要查询指定厂商的设备
HikDeviceApplicationRunner runner = SpringUtils.getAopProxy(this);
// 梯控登录
runner.hikElevatorInfoLogin();
// runner.hikElevatorInfoLogin();
// 网络摄像头登录
hikNetCameraLogin();
runner.hikNetCameraLogin();
}
@Async
@@ -62,37 +62,21 @@ public class HikDeviceApplicationRunner implements ApplicationRunner {
}
});
}
// String ip = "192.168.24.188";
// short port = 8000;
// String account = "admin";
// String pwd = "qweasd123";
// HikApiService.getInstance().login(ip, port, account, pwd);
// List<Integer> arrs = Arrays.asList(2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2);
// for (int i = 0; i < arrs.size(); i++) {
// HikApiService.getInstance().controlGateway(ip, (i + 1), arrs.get(i));
// }
}
@Async
public void hikNetCameraLogin() {
List<SisDeviceManageVo> deviceList = deviceManageService.queryList(new SisDeviceManageBo());
if (CollUtil.isEmpty(deviceList)) {
log.info("没有查询到摄像设备信息,不执行登录");
return;
}
deviceList.forEach(item -> {
int handler = HikApiService.getInstance().login(item.getDeviceIp(), item.getDevicePort().shortValue(), item.getDeviceAccount(), item.getDevicePwd());
log.info("设备[{}]执行登录完成result={}", item.getDeviceIp(), handler);
if (handler != -1) {
HikApiService.getInstance().setAlarmChan(handler);
}
});
// String ip = "192.168.24.19";
// short port = 8000;
// String account = "admin";
// String pwd = "xzf13579";
// int handler = HikApiService.getInstance().login(ip, port, account, pwd);
}
}

View File

@@ -17,10 +17,17 @@ import org.dromara.sis.sdk.huawei.HuaWeiBoxApi;
import org.dromara.sis.service.*;
import org.springframework.stereotype.Component;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.text.SimpleDateFormat;
import java.util.Collection;
import java.util.Date;
import java.util.List;
import static org.dromara.sis.sdk.hik.HCNetSDK.*;
@Slf4j
@Component
@RequiredArgsConstructor
@@ -32,111 +39,341 @@ public class HikAlarmCallBack implements HCNetSDK.FMSGCallBack_V31 {
private final ISisDeviceBindRefService deviceBindRefService;
private final ISisAccessControlService accessControlService;
private final ISisElevatorFloorRefService elevatorFloorRefService;
private final E8PlatformApi e8PlatformApi;
@DubboReference
private RemoteFloorService remoteFloorService;
private static final int COMM_UPLOAD_FACESNAP_RESULT = 0x1112;
@Override
public boolean invoke(int lCommand, HCNetSDK.NET_DVR_ALARMER pAlarmer, Pointer pAlarmInfo, int dwBufLen, Pointer pUser) {
if (lCommand == COMM_UPLOAD_FACESNAP_RESULT) {// 读取抓拍人脸数据
long s = System.currentTimeMillis();
log.info("hik 抓拍信息上报完成,lCommand={}", lCommand);
HCNetSDK.NET_VCA_FACESNAP_RESULT result = new HCNetSDK.NET_VCA_FACESNAP_RESULT();
result.write();
Pointer pItsPlateInfo = result.getPointer();
pItsPlateInfo.write(0, pAlarmInfo.getByteArray(0, result.size()), 0, result.size());
result.read();
// 读取人脸小图
ByteBuffer buffers = result.pBuffer1.getByteBuffer(0, result.dwFacePicLen);
byte[] smallImg = new byte[result.dwFacePicLen];
buffers.rewind();
buffers.get(smallImg);
switch (lCommand) {
//实时特征抓拍上传
case COMM_UPLOAD_FACESNAP_RESULT: {
log.info("hik 抓拍信息上报完成,lCommand={}", lCommand);
HCNetSDK.NET_VCA_FACESNAP_RESULT strFaceSnapInfo = new HCNetSDK.NET_VCA_FACESNAP_RESULT();
strFaceSnapInfo.write();
Pointer pFaceSnapInfo = strFaceSnapInfo.getPointer();
pFaceSnapInfo.write(0, pAlarmInfo.getByteArray(0, strFaceSnapInfo.size()), 0, strFaceSnapInfo.size());
strFaceSnapInfo.read();
handleFaceSnap(strFaceSnapInfo, pAlarmer);
break;
}
// 异常行为检测
case COMM_ALARM_RULE: {
// 读数据
HCNetSDK.NET_VCA_RULE_ALARM strVcaAlarm = new HCNetSDK.NET_VCA_RULE_ALARM();
strVcaAlarm.write();
Pointer pVCAInfo = strVcaAlarm.getPointer();
pVCAInfo.write(0, pAlarmInfo.getByteArray(0, strVcaAlarm.size()), 0, strVcaAlarm.size());
strVcaAlarm.read();
// 读取人脸大图
switch (strVcaAlarm.struRuleInfo.wEventTypeEx) {
case 1: //穿越警戒面 (越界侦测)
System.out.println("越界侦测报警发生");
strVcaAlarm.struRuleInfo.uEventParam.setType(HCNetSDK.NET_VCA_TRAVERSE_PLANE.class);
System.out.println("检测目标:" + strVcaAlarm.struRuleInfo.uEventParam.struTraversePlane.byDetectionTarget); //检测目标0表示所有目标表示不锁定检测目标所有目标都将进行检测其他取值按位表示不同的检测目标0x01-人0x02-车
//图片保存
if ((strVcaAlarm.dwPicDataLen > 0) && (strVcaAlarm.byPicTransType == 0)) {
SimpleDateFormat sf = new SimpleDateFormat("yyyyMMddHHmmss");
String newName = sf.format(new Date());
FileOutputStream fout;
try {
String filename = "./pic/" + newName + "VCA_TRAVERSE_PLANE" + ".jpg";
fout = new FileOutputStream(filename);
//将字节写入文件
long offset = 0;
ByteBuffer buffers = strVcaAlarm.pImage.getByteBuffer(offset, strVcaAlarm.dwPicDataLen);
byte[] bytes = new byte[strVcaAlarm.dwPicDataLen];
buffers.rewind();
buffers.get(bytes);
fout.write(bytes);
fout.close();
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
break;
case 2: //目标进入区域
System.out.println("目标进入区域报警发生");
strVcaAlarm.struRuleInfo.uEventParam.setType(HCNetSDK.NET_VCA_AREA.class);
System.out.println("检测目标:" + strVcaAlarm.struRuleInfo.uEventParam.struArea.byDetectionTarget);
//图片保存
if ((strVcaAlarm.dwPicDataLen > 0) && (strVcaAlarm.byPicTransType == 0)) {
SimpleDateFormat sf = new SimpleDateFormat("yyyyMMddHHmmss");
String newName = sf.format(new Date());
FileOutputStream fout;
try {
String filename = "./pic/" + newName + "_TargetEnter" + ".jpg";
fout = new FileOutputStream(filename);
//将字节写入文件
long offset = 0;
ByteBuffer buffers = strVcaAlarm.pImage.getByteBuffer(offset, strVcaAlarm.dwPicDataLen);
byte[] bytes = new byte[strVcaAlarm.dwPicDataLen];
buffers.rewind();
buffers.get(bytes);
fout.write(bytes);
fout.close();
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
break;
case 3: //目标离开区域
System.out.println("目标离开区域报警触发");
strVcaAlarm.struRuleInfo.uEventParam.setType(HCNetSDK.NET_VCA_AREA.class);
System.out.println("检测目标:" + strVcaAlarm.struRuleInfo.uEventParam.struArea.byDetectionTarget);
//图片保存
if ((strVcaAlarm.dwPicDataLen > 0) && (strVcaAlarm.byPicTransType == 0)) {
SimpleDateFormat sf = new SimpleDateFormat("yyyyMMddHHmmss");
String newName = sf.format(new Date());
FileOutputStream fout;
try {
String filename = "./pic/" + newName + "_TargetLeave" + ".jpg";
fout = new FileOutputStream(filename);
//将字节写入文件
long offset = 0;
ByteBuffer buffers = strVcaAlarm.pImage.getByteBuffer(offset, strVcaAlarm.dwPicDataLen);
byte[] bytes = new byte[strVcaAlarm.dwPicDataLen];
buffers.rewind();
buffers.get(bytes);
fout.write(bytes);
fout.close();
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
break;
case 4: //周界入侵
System.out.println("周界入侵报警发生");
strVcaAlarm.struRuleInfo.uEventParam.setType(HCNetSDK.NET_VCA_INTRUSION.class);
System.out.println("检测目标:" + strVcaAlarm.struRuleInfo.uEventParam.struIntrusion.byDetectionTarget);
//图片保存
if ((strVcaAlarm.dwPicDataLen > 0) && (strVcaAlarm.byPicTransType == 0)) {
SimpleDateFormat sf = new SimpleDateFormat("yyyyMMddHHmmss");
String newName = sf.format(new Date());
FileOutputStream fout;
try {
String filename = "./pic/" + newName + "VCA_INTRUSION" + ".jpg";
fout = new FileOutputStream(filename);
//将字节写入文件
long offset = 0;
ByteBuffer buffers = strVcaAlarm.pImage.getByteBuffer(offset, strVcaAlarm.dwPicDataLen);
byte[] bytes = new byte[strVcaAlarm.dwPicDataLen];
buffers.rewind();
buffers.get(bytes);
fout.write(bytes);
fout.close();
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
break;
case 5: //徘徊
System.out.println("徘徊事件触发");
break;
case 8: //快速移动(奔跑)
System.out.println("快速移动(奔跑)事件触发");
break;
case 15:
System.out.println("事件触发");
strVcaAlarm.struRuleInfo.uEventParam.setType(HCNetSDK.NET_VCA_LEAVE_POSITION.class);
System.out.println(strVcaAlarm.struRuleInfo.uEventParam.struLeavePos.byOnPosition);
//图片保存
if ((strVcaAlarm.dwPicDataLen > 0) && (strVcaAlarm.byPicTransType == 0)) {
SimpleDateFormat sf = new SimpleDateFormat("yyyyMMddHHmmss");
String newName = sf.format(new Date());
FileOutputStream fout;
try {
String filename = "./pic/" + newName + "VCA_LEAVE_POSITION_" + ".jpg";
fout = new FileOutputStream(filename);
//将字节写入文件
long offset = 0;
ByteBuffer buffers = strVcaAlarm.pImage.getByteBuffer(offset, strVcaAlarm.dwPicDataLen);
byte[] bytes = new byte[strVcaAlarm.dwPicDataLen];
buffers.rewind();
buffers.get(bytes);
fout.write(bytes);
fout.close();
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
case 20: //倒地检测
System.out.println("倒地事件触发");
break;
case 44: //玩手机
System.out.println("玩手机报警发生");
//图片保存
if ((strVcaAlarm.dwPicDataLen > 0) && (strVcaAlarm.byPicTransType == 0)) {
SimpleDateFormat sf = new SimpleDateFormat("yyyyMMddHHmmss");
String newName = sf.format(new Date());
FileOutputStream fout;
try {
String filename = "./pic/" + newName + "PLAY_CELLPHONE_" + ".jpg";
fout = new FileOutputStream(filename);
//将字节写入文件
long offset = 0;
ByteBuffer buffers = strVcaAlarm.pImage.getByteBuffer(offset, strVcaAlarm.dwPicDataLen);
byte[] bytes = new byte[strVcaAlarm.dwPicDataLen];
buffers.rewind();
buffers.get(bytes);
fout.write(bytes);
fout.close();
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
break;
case 45: //持续检测
System.out.println("持续检测事件触发");
default:
System.out.println("行为事件类型:" + strVcaAlarm.struRuleInfo.wEventTypeEx);
break;
}
break;
}
// 人脸比对结果上报
case COMM_SNAP_MATCH_ALARM: {
HCNetSDK.NET_VCA_FACESNAP_MATCH_ALARM strFaceSnapMatch = new HCNetSDK.NET_VCA_FACESNAP_MATCH_ALARM();
strFaceSnapMatch.write();
Pointer pFaceSnapMatch = strFaceSnapMatch.getPointer();
pFaceSnapMatch.write(0, pAlarmInfo.getByteArray(0, strFaceSnapMatch.size()), 0, strFaceSnapMatch.size());
strFaceSnapMatch.read();
//比对结果0-保留1-比对成功2-比对失败
String sFaceSnapMatchInfo = "比对结果:" + strFaceSnapMatch.byContrastStatus + ",相似度:" + strFaceSnapMatch.fSimilarity;
}
default: {
}
}
return true;
}
/**
* 处理人脸抓拍上报
*
* @param result 人脸数据
* @param pAlarmer 设备数据
* @return 返回是否处理成功
*/
private boolean handleFaceSnap(HCNetSDK.NET_VCA_FACESNAP_RESULT result, HCNetSDK.NET_DVR_ALARMER pAlarmer) {
long s = System.currentTimeMillis();
// 读取人脸小图
ByteBuffer buffers = result.pBuffer1.getByteBuffer(0, result.dwFacePicLen);
byte[] smallImg = new byte[result.dwFacePicLen];
buffers.rewind();
buffers.get(smallImg);
// 读取人脸大图
/*ByteBuffer buffers1 = result.pBuffer2.getByteBuffer(0, result.dwBackgroundPicLen);
byte[] bigImg = new byte[result.dwBackgroundPicLen];
buffers1.rewind();
buffers1.get(bigImg);*/
//设备ip
String sAlarmInfo = new String(pAlarmer.sDeviceIP).trim();
// 设备绑定关系
List<SisDeviceBindRefVo> bindRefList = deviceBindRefService.queryByDeviceIp(sAlarmInfo);
if (CollUtil.isEmpty(bindRefList)) {
log.info("当前报警设备未绑定门禁/梯控,不做处理!");
return true;
}
//设备ip
String sAlarmInfo = new String(pAlarmer.sDeviceIP).trim();
// 设备绑定关系
List<SisDeviceBindRefVo> bindRefList = deviceBindRefService.queryByDeviceIp(sAlarmInfo);
if (CollUtil.isEmpty(bindRefList)) {
log.info("当前报警设备未绑定门禁/梯控,不做处理!");
return true;
}
// todo 进行人脸比对
String smallImgBase64Str = Base64Encoder.encode(smallImg);
long s1 = System.currentTimeMillis();
Long person = huaWeiBoxApi.findPerson(smallImgBase64Str);
log.info("人脸比对执行完成,耗时:{}", System.currentTimeMillis() - s1);
if (person == null) {
log.info("未命中人脸数据,暂不处理。");
return true;
}
log.info("人脸比对完成,personId={}", person);
// todo 进行人脸比对
String smallImgBase64Str = Base64Encoder.encode(smallImg);
long s1 = System.currentTimeMillis();
Long person = huaWeiBoxApi.findPerson(smallImgBase64Str);
log.info("人脸比对执行完成,耗时:{}", System.currentTimeMillis() - s1);
if (person == null) {
log.info("未命中人脸数据,暂不处理。");
return true;
}
log.info("人脸比对完成,personId={}", person);
// 授权记录
List<SisAuthRecordVo> authVoList = authRecordService.checkAuth(person);
// 获取门禁id
Collection<Long> acIds = authVoList.stream().filter(vo -> vo.getDeviceType() == 1).map(SisAuthRecordVo::getDeviceId).toList();
if (CollUtil.isNotEmpty(acIds)) {
acIds.forEach(id -> {
Long deviceId = bindRefList.stream().filter(vo -> vo.getBindId().equals(id)).findFirst().map(SisDeviceBindRefVo::getDeviceId).orElse(null);
SisAccessControlVo ac = accessControlService.queryById(deviceId);
if (ac != null) {
log.info("调用门禁服务远程开门doorName:{}", ac.getAccessName());
RemoteOpenDoorReq req = new RemoteOpenDoorReq();
req.setType(0);
RemoteOpenDoorReq.ControlData data = new RemoteOpenDoorReq.ControlData();
data.setDeviceId(Long.parseLong(ac.getOutCode()));
data.setDoorId(Long.parseLong(ac.getOutCode()));
req.setControlList(List.of(data));
Boolean flag = e8PlatformApi.remoteOpenDoor(req);
log.info("远程开门结果,result={}", flag);
}
});
}
// 授权记录
List<SisAuthRecordVo> authVoList = authRecordService.checkAuth(person);
// 获取门禁id
Collection<Long> acIds = authVoList.stream().filter(vo -> vo.getDeviceType() == 1).map(SisAuthRecordVo::getDeviceId).toList();
if (CollUtil.isNotEmpty(acIds)) {
acIds.forEach(id -> {
Long deviceId = bindRefList.stream().filter(vo -> vo.getBindId().equals(id)).findFirst().map(SisDeviceBindRefVo::getDeviceId).orElse(null);
SisAccessControlVo ac = accessControlService.queryById(deviceId);
if (ac != null) {
log.info("调用门禁服务远程开门doorName:{}", ac.getAccessName());
RemoteOpenDoorReq req = new RemoteOpenDoorReq();
req.setType(0);
RemoteOpenDoorReq.ControlData data = new RemoteOpenDoorReq.ControlData();
data.setDeviceId(Long.parseLong(ac.getOutCode()));
data.setDoorId(Long.parseLong(ac.getOutCode()));
req.setControlList(List.of(data));
Boolean flag = e8PlatformApi.remoteOpenDoor(req);
log.info("远程开门结果,result={}", flag);
}
});
}
// 获取电梯ids
Collection<Long> eleIds = authVoList.stream().filter(vo -> vo.getDeviceType() == 2).map(SisAuthRecordVo::getDeviceId).toList();
if (CollUtil.isNotEmpty(eleIds)) {
eleIds.forEach(id -> {
Long deviceId = bindRefList.stream().filter(vo -> vo.getBindId().equals(id)).findFirst().map(SisDeviceBindRefVo::getDeviceId).orElse(null);
SisElevatorInfoVo ele = elevatorInfoService.queryById(deviceId);
if (ele != null) {
log.info("下发电梯权限");
// 根据单元ID获取楼层信息
List<RemoteFloorVo> floorInfo = remoteFloorService.queryByUnitId(ele.getUnitId());
// 获取电梯⇄楼层关联信息
List<SisElevatorFloorRefVo> floorRefList = elevatorFloorRefService.queryByElevatorId(deviceId);
// 获取楼层数组
List<Long> layerArray = floorInfo.stream().map(RemoteFloorVo::getFloorNumber).sorted().toList();
// 获取电梯ids
Collection<Long> eleIds = authVoList.stream().filter(vo -> vo.getDeviceType() == 2).map(SisAuthRecordVo::getDeviceId).toList();
if (CollUtil.isNotEmpty(eleIds)) {
eleIds.forEach(id -> {
Long deviceId = bindRefList.stream().filter(vo -> vo.getBindId().equals(id)).findFirst().map(SisDeviceBindRefVo::getDeviceId).orElse(null);
SisElevatorInfoVo ele = elevatorInfoService.queryById(deviceId);
if (ele != null) {
log.info("下发电梯权限");
// 根据单元ID获取楼层信息
List<RemoteFloorVo> floorInfo = remoteFloorService.queryByUnitId(ele.getUnitId());
// 获取电梯⇄楼层关联信息
List<SisElevatorFloorRefVo> floorRefList = elevatorFloorRefService.queryByElevatorId(deviceId);
// 获取楼层数组
List<Long> layerArray = floorInfo.stream().map(RemoteFloorVo::getFloorNumber).sorted().toList();
layerArray.forEach(layer -> {
SisElevatorFloorRefVo floorRef = floorRefList.stream()
.filter(vo -> vo.getFloorNum().intValue() == layer) // 直接使用 layer
.findFirst()
.orElse(null);
if (floorRef == null) {
HikApiService.getInstance().controlGateway(ele.getControlIp(), layer.intValue(), 3);
} else {
HikApiService.getInstance().controlGateway(ele.getControlIp(), layer.intValue(), 2);
}
});
}
});
}
log.info("权限下发执行完成,耗时:{}", System.currentTimeMillis() - s);
layerArray.forEach(layer -> {
SisElevatorFloorRefVo floorRef = floorRefList.stream()
.filter(vo -> vo.getFloorNum().intValue() == layer) // 直接使用 layer
.findFirst()
.orElse(null);
if (floorRef == null) {
HikApiService.getInstance().controlGateway(ele.getControlIp(), layer.intValue(), 3);
} else {
HikApiService.getInstance().controlGateway(ele.getControlIp(), layer.intValue(), 2);
}
});
}
});
}
log.info("权限下发执行完成,耗时:{}", System.currentTimeMillis() - s);
// todo 做延时队列,关闭梯控授权
// try {
@@ -148,9 +385,6 @@ public class HikAlarmCallBack implements HCNetSDK.FMSGCallBack_V31 {
// } catch (InterruptedException e) {
// throw new RuntimeException(e);
// }
} else {
log.info("未知报警类型,lCommand={}", lCommand);
}
return true;
return false;
}
}

View File

@@ -1,9 +1,11 @@
package org.dromara.sis.sdk.hik.service;
import com.sun.jna.Memory;
import com.sun.jna.Native;
import com.sun.jna.Pointer;
import lombok.extern.slf4j.Slf4j;
import org.dromara.sis.sdk.hik.HCNetSDK;
import org.dromara.sis.sdk.hik.SDK_Structure;
import org.springframework.util.Assert;
import static org.dromara.sis.sdk.hik.common.osSelect.isWindows;
@@ -98,7 +100,7 @@ public class SdkBaseServer {
return b;
}
public static boolean setAlarmChan(int lUserID){
public static boolean setAlarmChan(int lUserID) {
//报警布防参数设置
HCNetSDK.NET_DVR_SETUPALARM_PARAM_V50 m_strAlarmInfoV50 = new HCNetSDK.NET_DVR_SETUPALARM_PARAM_V50();
m_strAlarmInfoV50.dwSize = m_strAlarmInfoV50.size();

View File

@@ -0,0 +1,78 @@
package org.dromara.sis.service;
import org.dromara.common.core.domain.TreeNode;
import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.sis.domain.bo.SisDeviceChannelBo;
import org.dromara.sis.domain.vo.SisDeviceChannelVo;
import java.util.Collection;
import java.util.List;
/**
* 设备通道管理Service接口
*
* @author lxj
* @date 2025-07-19
*/
public interface ISisDeviceChannelService {
/**
* 查询设备通道管理
*
* @param id 主键
* @return 设备通道管理
*/
SisDeviceChannelVo queryById(Long id);
/**
* 分页查询设备通道管理列表
*
* @param bo 查询条件
* @param pageQuery 分页参数
* @return 设备通道管理分页列表
*/
TableDataInfo<SisDeviceChannelVo> queryPageList(SisDeviceChannelBo bo, PageQuery pageQuery);
/**
* 查询符合条件的设备通道管理列表
*
* @param bo 查询条件
* @return 设备通道管理列表
*/
List<SisDeviceChannelVo> queryList(SisDeviceChannelBo bo);
/**
* 新增设备通道管理
*
* @param bo 设备通道管理
* @return 是否新增成功
*/
Boolean insertByBo(SisDeviceChannelBo bo);
/**
* 修改设备通道管理
*
* @param bo 设备通道管理
* @return 是否修改成功
*/
Boolean updateByBo(SisDeviceChannelBo bo);
/**
* 校验并批量删除设备通道管理信息
*
* @param ids 待删除的主键集合
* @param isValid 是否进行有效性校验
* @return 是否删除成功
*/
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
/**
* 查询设备通道树
*
* @return 返回通道树结构
*/
List<TreeNode<Long>> queryTree();
}

View File

@@ -0,0 +1,72 @@
package org.dromara.sis.service;
import org.dromara.sis.domain.SisDeviceGroup;
import org.dromara.sis.domain.vo.SisDeviceGroupVo;
import org.dromara.sis.domain.bo.SisDeviceGroupBo;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.common.mybatis.core.page.PageQuery;
import java.util.Collection;
import java.util.List;
/**
* 设备组管理Service接口
*
* @author lxj
* @date 2025-07-19
*/
public interface ISisDeviceGroupService {
/**
* 查询设备组管理
*
* @param id 主键
* @return 设备组管理
*/
SisDeviceGroupVo queryById(Long id);
/**
* 分页查询设备组管理列表
*
* @param bo 查询条件
* @param pageQuery 分页参数
* @return 设备组管理分页列表
*/
TableDataInfo<SisDeviceGroupVo> queryPageList(SisDeviceGroupBo bo, PageQuery pageQuery);
/**
* 查询符合条件的设备组管理列表
*
* @param bo 查询条件
* @return 设备组管理列表
*/
List<SisDeviceGroupVo> queryList(SisDeviceGroupBo bo);
/**
* 新增设备组管理
*
* @param bo 设备组管理
* @return 是否新增成功
*/
Boolean insertByBo(SisDeviceGroupBo bo);
/**
* 修改设备组管理
*
* @param bo 设备组管理
* @return 是否修改成功
*/
Boolean updateByBo(SisDeviceGroupBo bo);
/**
* 校验并批量删除设备组管理信息
*
* @param ids 待删除的主键集合
* @param isValid 是否进行有效性校验
* @return 是否删除成功
*/
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
List<SisDeviceGroupVo> querAll();
}

View File

@@ -0,0 +1,186 @@
package org.dromara.sis.service.impl;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.dromara.common.core.domain.TreeNode;
import org.dromara.common.core.utils.MapstructUtils;
import org.dromara.common.core.utils.StringUtils;
import org.dromara.common.core.utils.TreeUtils;
import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.sis.domain.SisDeviceChannel;
import org.dromara.sis.domain.bo.SisDeviceChannelBo;
import org.dromara.sis.domain.vo.SisDeviceChannelVo;
import org.dromara.sis.domain.vo.SisDeviceGroupVo;
import org.dromara.sis.mapper.SisDeviceChannelMapper;
import org.dromara.sis.service.ISisDeviceChannelService;
import org.dromara.sis.service.ISisDeviceGroupService;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
/**
* 设备通道管理Service业务层处理
*
* @author lxj
* @date 2025-07-19
*/
@Slf4j
@RequiredArgsConstructor
@Service
public class SisDeviceChannelServiceImpl implements ISisDeviceChannelService {
private final SisDeviceChannelMapper baseMapper;
private final ISisDeviceGroupService deviceGroupService;
/**
* 查询设备通道管理
*
* @param id 主键
* @return 设备通道管理
*/
@Override
public SisDeviceChannelVo queryById(Long id) {
return baseMapper.selectVoById(id);
}
/**
* 分页查询设备通道管理列表
*
* @param bo 查询条件
* @param pageQuery 分页参数
* @return 设备通道管理分页列表
*/
@Override
public TableDataInfo<SisDeviceChannelVo> queryPageList(SisDeviceChannelBo bo, PageQuery pageQuery) {
LambdaQueryWrapper<SisDeviceChannel> lqw = buildQueryWrapper(bo);
Page<SisDeviceChannelVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
return TableDataInfo.build(result);
}
/**
* 查询符合条件的设备通道管理列表
*
* @param bo 查询条件
* @return 设备通道管理列表
*/
@Override
public List<SisDeviceChannelVo> queryList(SisDeviceChannelBo bo) {
LambdaQueryWrapper<SisDeviceChannel> lqw = buildQueryWrapper(bo);
return baseMapper.selectVoList(lqw);
}
private LambdaQueryWrapper<SisDeviceChannel> buildQueryWrapper(SisDeviceChannelBo bo) {
Map<String, Object> params = bo.getParams();
LambdaQueryWrapper<SisDeviceChannel> lqw = Wrappers.lambdaQuery();
lqw.orderByAsc(SisDeviceChannel::getId);
lqw.eq(bo.getDeviceId() != null, SisDeviceChannel::getDeviceId, bo.getDeviceId());
lqw.like(StringUtils.isNotBlank(bo.getChannelName()), SisDeviceChannel::getChannelName, bo.getChannelName());
lqw.eq(bo.getGroupId() != null, SisDeviceChannel::getGroupId, bo.getGroupId());
lqw.eq(StringUtils.isNotBlank(bo.getDeviceIp()), SisDeviceChannel::getDeviceIp, bo.getDeviceIp());
lqw.eq(bo.getDevicePort() != null, SisDeviceChannel::getDevicePort, bo.getDevicePort());
lqw.eq(StringUtils.isNotBlank(bo.getDeviceAccount()), SisDeviceChannel::getDeviceAccount, bo.getDeviceAccount());
lqw.eq(StringUtils.isNotBlank(bo.getDevicePwd()), SisDeviceChannel::getDevicePwd, bo.getDevicePwd());
lqw.eq(StringUtils.isNotBlank(bo.getDeviceMac()), SisDeviceChannel::getDeviceMac, bo.getDeviceMac());
lqw.eq(StringUtils.isNotBlank(bo.getChannelNo()), SisDeviceChannel::getChannelNo, bo.getChannelNo());
return lqw;
}
/**
* 新增设备通道管理
*
* @param bo 设备通道管理
* @return 是否新增成功
*/
@Override
public Boolean insertByBo(SisDeviceChannelBo bo) {
SisDeviceChannel add = MapstructUtils.convert(bo, SisDeviceChannel.class);
validEntityBeforeSave(add);
boolean flag = baseMapper.insert(add) > 0;
if (flag) {
bo.setId(add.getId());
}
return flag;
}
/**
* 修改设备通道管理
*
* @param bo 设备通道管理
* @return 是否修改成功
*/
@Override
public Boolean updateByBo(SisDeviceChannelBo bo) {
SisDeviceChannel update = MapstructUtils.convert(bo, SisDeviceChannel.class);
validEntityBeforeSave(update);
return baseMapper.updateById(update) > 0;
}
/**
* 保存前的数据校验
*/
private void validEntityBeforeSave(SisDeviceChannel entity) {
//TODO 做一些数据校验,如唯一约束
}
/**
* 校验并批量删除设备通道管理信息
*
* @param ids 待删除的主键集合
* @param isValid 是否进行有效性校验
* @return 是否删除成功
*/
@Override
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
if (isValid) {
//TODO 做一些业务上的校验,判断是否需要校验
}
return baseMapper.deleteByIds(ids) > 0;
}
@Override
public List<TreeNode<Long>> queryTree() {
// 查询设备的分组信息
List<SisDeviceGroupVo> ls = deviceGroupService.querAll();
if (CollUtil.isEmpty(ls)) {
return List.of();
}
// 查询通道信息
List<SisDeviceChannelVo> sisDeviceChannelVos = baseMapper.selectVoList(null);
if (CollUtil.isEmpty(sisDeviceChannelVos)) {
return List.of();
}
// 组装树结构
List<TreeNode<Long>> treeNodes = new ArrayList<>(ls.size() + sisDeviceChannelVos.size());
ls.forEach(item -> {
TreeNode<Long> treeNode = new TreeNode<>();
treeNode.setLevel(1);
treeNode.setCode(item.getId());
treeNode.setKey(item.getId());
treeNode.setParentCode(item.getParentId());
treeNode.setLabel(item.getName());
treeNode.setTitle(item.getName());
treeNode.setData(item);
treeNodes.add(treeNode);
});
sisDeviceChannelVos.forEach(item -> {
TreeNode<Long> treeNode = new TreeNode<>();
treeNode.setLevel(2);
treeNode.setCode(item.getId());
treeNode.setKey(item.getId());
treeNode.setParentCode(item.getGroupId());
treeNode.setLabel(item.getChannelName());
treeNode.setTitle(item.getChannelName());
treeNode.setData(item);
treeNodes.add(treeNode);
});
return TreeUtils.build(treeNodes, -1L);
}
}

View File

@@ -0,0 +1,138 @@
package org.dromara.sis.service.impl;
import org.dromara.common.core.utils.MapstructUtils;
import org.dromara.common.core.utils.StringUtils;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.common.mybatis.core.page.PageQuery;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
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.springframework.stereotype.Service;
import org.dromara.sis.domain.bo.SisDeviceGroupBo;
import org.dromara.sis.domain.vo.SisDeviceGroupVo;
import org.dromara.sis.domain.SisDeviceGroup;
import org.dromara.sis.mapper.SisDeviceGroupMapper;
import org.dromara.sis.service.ISisDeviceGroupService;
import java.util.List;
import java.util.Map;
import java.util.Collection;
/**
* 设备组管理Service业务层处理
*
* @author lxj
* @date 2025-07-19
*/
@Slf4j
@RequiredArgsConstructor
@Service
public class SisDeviceGroupServiceImpl implements ISisDeviceGroupService {
private final SisDeviceGroupMapper baseMapper;
/**
* 查询设备组管理
*
* @param id 主键
* @return 设备组管理
*/
@Override
public SisDeviceGroupVo queryById(Long id){
return baseMapper.selectVoById(id);
}
/**
* 分页查询设备组管理列表
*
* @param bo 查询条件
* @param pageQuery 分页参数
* @return 设备组管理分页列表
*/
@Override
public TableDataInfo<SisDeviceGroupVo> queryPageList(SisDeviceGroupBo bo, PageQuery pageQuery) {
LambdaQueryWrapper<SisDeviceGroup> lqw = buildQueryWrapper(bo);
Page<SisDeviceGroupVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
return TableDataInfo.build(result);
}
/**
* 查询符合条件的设备组管理列表
*
* @param bo 查询条件
* @return 设备组管理列表
*/
@Override
public List<SisDeviceGroupVo> queryList(SisDeviceGroupBo bo) {
LambdaQueryWrapper<SisDeviceGroup> lqw = buildQueryWrapper(bo);
return baseMapper.selectVoList(lqw);
}
private LambdaQueryWrapper<SisDeviceGroup> buildQueryWrapper(SisDeviceGroupBo bo) {
Map<String, Object> params = bo.getParams();
LambdaQueryWrapper<SisDeviceGroup> lqw = Wrappers.lambdaQuery();
lqw.orderByAsc(SisDeviceGroup::getId);
lqw.like(StringUtils.isNotBlank(bo.getName()), SisDeviceGroup::getName, bo.getName());
lqw.eq(bo.getParentId() != null, SisDeviceGroup::getParentId, bo.getParentId());
return lqw;
}
/**
* 新增设备组管理
*
* @param bo 设备组管理
* @return 是否新增成功
*/
@Override
public Boolean insertByBo(SisDeviceGroupBo bo) {
SisDeviceGroup add = MapstructUtils.convert(bo, SisDeviceGroup.class);
validEntityBeforeSave(add);
boolean flag = baseMapper.insert(add) > 0;
if (flag) {
bo.setId(add.getId());
}
return flag;
}
/**
* 修改设备组管理
*
* @param bo 设备组管理
* @return 是否修改成功
*/
@Override
public Boolean updateByBo(SisDeviceGroupBo bo) {
SisDeviceGroup update = MapstructUtils.convert(bo, SisDeviceGroup.class);
validEntityBeforeSave(update);
return baseMapper.updateById(update) > 0;
}
/**
* 保存前的数据校验
*/
private void validEntityBeforeSave(SisDeviceGroup entity){
//TODO 做一些数据校验,如唯一约束
}
/**
* 校验并批量删除设备组管理信息
*
* @param ids 待删除的主键集合
* @param isValid 是否进行有效性校验
* @return 是否删除成功
*/
@Override
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
if(isValid){
//TODO 做一些业务上的校验,判断是否需要校验
}
return baseMapper.deleteByIds(ids) > 0;
}
@Override
public List<SisDeviceGroupVo> querAll() {
return baseMapper.selectVoList(null);
}
}

View File

@@ -79,9 +79,8 @@ public class SisDeviceManageServiceImpl implements ISisDeviceManageService {
lqw.eq(StringUtils.isNotBlank(bo.getDeviceIp()), SisDeviceManage::getDeviceIp, bo.getDeviceIp());
lqw.eq(bo.getDevicePort() != null, SisDeviceManage::getDevicePort, bo.getDevicePort());
lqw.eq(StringUtils.isNotBlank(bo.getDeviceMac()), SisDeviceManage::getDeviceMac, bo.getDeviceMac());
lqw.eq(bo.getParentId() != null, SisDeviceManage::getParentId, bo.getParentId());
lqw.eq(StringUtils.isNotBlank(bo.getVcrIp()), SisDeviceManage::getVcrIp, bo.getVcrIp());
lqw.eq(bo.getVcrPort() != null, SisDeviceManage::getVcrPort, bo.getVcrPort());
lqw.eq(bo.getDeviceType() != null, SisDeviceManage::getDeviceType, bo.getDeviceType());
lqw.eq(StringUtils.isNotBlank(bo.getFactoryNo()), SisDeviceManage::getFactoryNo, bo.getFactoryNo());
return lqw;
}

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.dromara.sis.mapper.SisDeviceChannelMapper">
</mapper>

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.dromara.sis.mapper.SisDeviceGroupMapper">
</mapper>