feat: 设备故障码、设备校验记录、测控一体机开关、设备充值记录、充值订单,代码提交。

This commit is contained in:
tianyongbao
2025-10-19 22:54:34 +08:00
parent af1b0e5441
commit 7f40a94819
55 changed files with 4156 additions and 6 deletions

View File

@@ -92,6 +92,12 @@
<artifactId>ruoyi-fishery</artifactId>
<version>${revision}</version> <!-- 使用项目统一版本变量 -->
</dependency>
<!-- 鱼测云模块 -->
<dependency>
<groupId>org.dromara</groupId>
<artifactId>ruoyi-tdengine</artifactId>
<version>${revision}</version> <!-- 使用项目统一版本变量 -->
</dependency>
<!-- 工作流模块 -->
<dependency>
<groupId>org.dromara</groupId>

View File

@@ -51,17 +51,17 @@ spring:
# username: root
# password: root
driverClassName: org.postgresql.Driver
url: jdbc:postgresql://117.72.197.29:15432/ruoyi-plus?useUnicode=true&characterEncoding=utf8&useSSL=true&autoReconnect=true&reWriteBatchedInserts=true
url: jdbc:postgresql://154.8.147.51:15432/fishery_dev?useUnicode=true&characterEncoding=utf8&useSSL=true&autoReconnect=true&reWriteBatchedInserts=true
username: postgres
password: intc@123987
# # 从库数据源
# slave:
# lazy: true
# type: ${spring.datasource.type}
# driverClassName: com.mysql.cj.jdbc.Driver
# url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
# username:
# password:
# driverClassName: com.taosdata.jdbc.rs.RestfulDriver
# url: jdbc:TAOS-RS://117.72.197.29:6041/log?timezone=Shanghai&charset=UTF-8&locale=en_US.UTF-8
# username: root
# password: taosdata
# oracle:
# type: ${spring.datasource.type}
# driverClassName: oracle.jdbc.OracleDriver

View File

@@ -2,7 +2,7 @@ spring:
datasource:
type: com.zaxxer.hikari.HikariDataSource
driverClassName: org.postgresql.Driver
url: jdbc:postgresql://117.72.197.29:15432/ruoyi-plus?useUnicode=true&characterEncoding=utf8&useSSL=true&autoReconnect=true&reWriteBatchedInserts=true
url: jdbc:postgresql://154.8.147.51:15432/fishery_dev?useUnicode=true&characterEncoding=utf8&useSSL=true&autoReconnect=true&reWriteBatchedInserts=true
username: postgres
password: intc@123987
hikari:

View File

@@ -16,6 +16,7 @@
<module>ruoyi-system</module>
<module>ruoyi-workflow</module>
<module>ruoyi-fishery</module>
<module>ruoyi-tdengine</module>
</modules>
<artifactId>ruoyi-modules</artifactId>

View File

@@ -0,0 +1,105 @@
package org.dromara.fishery.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.fishery.domain.vo.DeviceCorrectRecordVo;
import org.dromara.fishery.domain.bo.DeviceCorrectRecordBo;
import org.dromara.fishery.service.IDeviceCorrectRecordService;
import org.dromara.common.mybatis.core.page.TableDataInfo;
/**
* 设备校准记录
*
* @author intc
* @date 2025-10-17
*/
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/fishery/deviceCorrectRecord")
public class DeviceCorrectRecordController extends BaseController {
private final IDeviceCorrectRecordService deviceCorrectRecordService;
/**
* 查询设备校准记录列表
*/
@SaCheckPermission("fishery:deviceCorrectRecord:list")
@GetMapping("/list")
public TableDataInfo<DeviceCorrectRecordVo> list(DeviceCorrectRecordBo bo, PageQuery pageQuery) {
return deviceCorrectRecordService.queryPageList(bo, pageQuery);
}
/**
* 导出设备校准记录列表
*/
@SaCheckPermission("fishery:deviceCorrectRecord:export")
@Log(title = "设备校准记录", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(DeviceCorrectRecordBo bo, HttpServletResponse response) {
List<DeviceCorrectRecordVo> list = deviceCorrectRecordService.queryList(bo);
ExcelUtil.exportExcel(list, "设备校准记录", DeviceCorrectRecordVo.class, response);
}
/**
* 获取设备校准记录详细信息
*
* @param id 主键
*/
@SaCheckPermission("fishery:deviceCorrectRecord:query")
@GetMapping("/{id}")
public R<DeviceCorrectRecordVo> getInfo(@NotNull(message = "主键不能为空")
@PathVariable Long id) {
return R.ok(deviceCorrectRecordService.queryById(id));
}
/**
* 新增设备校准记录
*/
@SaCheckPermission("fishery:deviceCorrectRecord:add")
@Log(title = "设备校准记录", businessType = BusinessType.INSERT)
@RepeatSubmit()
@PostMapping()
public R<Void> add(@Validated(AddGroup.class) @RequestBody DeviceCorrectRecordBo bo) {
return toAjax(deviceCorrectRecordService.insertByBo(bo));
}
/**
* 修改设备校准记录
*/
@SaCheckPermission("fishery:deviceCorrectRecord:edit")
@Log(title = "设备校准记录", businessType = BusinessType.UPDATE)
@RepeatSubmit()
@PutMapping()
public R<Void> edit(@Validated(EditGroup.class) @RequestBody DeviceCorrectRecordBo bo) {
return toAjax(deviceCorrectRecordService.updateByBo(bo));
}
/**
* 删除设备校准记录
*
* @param ids 主键串
*/
@SaCheckPermission("fishery:deviceCorrectRecord:remove")
@Log(title = "设备校准记录", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public R<Void> remove(@NotEmpty(message = "主键不能为空")
@PathVariable Long[] ids) {
return toAjax(deviceCorrectRecordService.deleteWithValidByIds(List.of(ids), true));
}
}

View File

@@ -0,0 +1,105 @@
package org.dromara.fishery.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.fishery.domain.vo.DeviceErrorCodeVo;
import org.dromara.fishery.domain.bo.DeviceErrorCodeBo;
import org.dromara.fishery.service.IDeviceErrorCodeService;
import org.dromara.common.mybatis.core.page.TableDataInfo;
/**
* 设备故障码
*
* @author intc
* @date 2025-10-17
*/
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/fishery/deviceErrorCode")
public class DeviceErrorCodeController extends BaseController {
private final IDeviceErrorCodeService deviceErrorCodeService;
/**
* 查询设备故障码列表
*/
@SaCheckPermission("fishery:deviceErrorCode:list")
@GetMapping("/list")
public TableDataInfo<DeviceErrorCodeVo> list(DeviceErrorCodeBo bo, PageQuery pageQuery) {
return deviceErrorCodeService.queryPageList(bo, pageQuery);
}
/**
* 导出设备故障码列表
*/
@SaCheckPermission("fishery:deviceErrorCode:export")
@Log(title = "设备故障码", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(DeviceErrorCodeBo bo, HttpServletResponse response) {
List<DeviceErrorCodeVo> list = deviceErrorCodeService.queryList(bo);
ExcelUtil.exportExcel(list, "设备故障码", DeviceErrorCodeVo.class, response);
}
/**
* 获取设备故障码详细信息
*
* @param id 主键
*/
@SaCheckPermission("fishery:deviceErrorCode:query")
@GetMapping("/{id}")
public R<DeviceErrorCodeVo> getInfo(@NotNull(message = "主键不能为空")
@PathVariable Long id) {
return R.ok(deviceErrorCodeService.queryById(id));
}
/**
* 新增设备故障码
*/
@SaCheckPermission("fishery:deviceErrorCode:add")
@Log(title = "设备故障码", businessType = BusinessType.INSERT)
@RepeatSubmit()
@PostMapping()
public R<Void> add(@Validated(AddGroup.class) @RequestBody DeviceErrorCodeBo bo) {
return toAjax(deviceErrorCodeService.insertByBo(bo));
}
/**
* 修改设备故障码
*/
@SaCheckPermission("fishery:deviceErrorCode:edit")
@Log(title = "设备故障码", businessType = BusinessType.UPDATE)
@RepeatSubmit()
@PutMapping()
public R<Void> edit(@Validated(EditGroup.class) @RequestBody DeviceErrorCodeBo bo) {
return toAjax(deviceErrorCodeService.updateByBo(bo));
}
/**
* 删除设备故障码
*
* @param ids 主键串
*/
@SaCheckPermission("fishery:deviceErrorCode:remove")
@Log(title = "设备故障码", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public R<Void> remove(@NotEmpty(message = "主键不能为空")
@PathVariable Long[] ids) {
return toAjax(deviceErrorCodeService.deleteWithValidByIds(List.of(ids), true));
}
}

View File

@@ -0,0 +1,105 @@
package org.dromara.fishery.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.fishery.domain.vo.DeviceSwitchVo;
import org.dromara.fishery.domain.bo.DeviceSwitchBo;
import org.dromara.fishery.service.IDeviceSwitchService;
import org.dromara.common.mybatis.core.page.TableDataInfo;
/**
* 测控一体机开关
*
* @author intc
* @date 2025-10-17
*/
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/fishery/deviceSwitch")
public class DeviceSwitchController extends BaseController {
private final IDeviceSwitchService deviceSwitchService;
/**
* 查询测控一体机开关列表
*/
@SaCheckPermission("fishery:deviceSwitch:list")
@GetMapping("/list")
public TableDataInfo<DeviceSwitchVo> list(DeviceSwitchBo bo, PageQuery pageQuery) {
return deviceSwitchService.queryPageList(bo, pageQuery);
}
/**
* 导出测控一体机开关列表
*/
@SaCheckPermission("fishery:deviceSwitch:export")
@Log(title = "测控一体机开关", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(DeviceSwitchBo bo, HttpServletResponse response) {
List<DeviceSwitchVo> list = deviceSwitchService.queryList(bo);
ExcelUtil.exportExcel(list, "测控一体机开关", DeviceSwitchVo.class, response);
}
/**
* 获取测控一体机开关详细信息
*
* @param id 主键
*/
@SaCheckPermission("fishery:deviceSwitch:query")
@GetMapping("/{id}")
public R<DeviceSwitchVo> getInfo(@NotNull(message = "主键不能为空")
@PathVariable Long id) {
return R.ok(deviceSwitchService.queryById(id));
}
/**
* 新增测控一体机开关
*/
@SaCheckPermission("fishery:deviceSwitch:add")
@Log(title = "测控一体机开关", businessType = BusinessType.INSERT)
@RepeatSubmit()
@PostMapping()
public R<Void> add(@Validated(AddGroup.class) @RequestBody DeviceSwitchBo bo) {
return toAjax(deviceSwitchService.insertByBo(bo));
}
/**
* 修改测控一体机开关
*/
@SaCheckPermission("fishery:deviceSwitch:edit")
@Log(title = "测控一体机开关", businessType = BusinessType.UPDATE)
@RepeatSubmit()
@PutMapping()
public R<Void> edit(@Validated(EditGroup.class) @RequestBody DeviceSwitchBo bo) {
return toAjax(deviceSwitchService.updateByBo(bo));
}
/**
* 删除测控一体机开关
*
* @param ids 主键串
*/
@SaCheckPermission("fishery:deviceSwitch:remove")
@Log(title = "测控一体机开关", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public R<Void> remove(@NotEmpty(message = "主键不能为空")
@PathVariable Long[] ids) {
return toAjax(deviceSwitchService.deleteWithValidByIds(List.of(ids), true));
}
}

View File

@@ -0,0 +1,105 @@
package org.dromara.fishery.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.fishery.domain.vo.PayDeviceVo;
import org.dromara.fishery.domain.bo.PayDeviceBo;
import org.dromara.fishery.service.IPayDeviceService;
import org.dromara.common.mybatis.core.page.TableDataInfo;
/**
* 设备充值记录
*
* @author intc
* @date 2025-10-16
*/
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/fishery/payDevice")
public class PayDeviceController extends BaseController {
private final IPayDeviceService payDeviceService;
/**
* 查询设备充值记录列表
*/
@SaCheckPermission("fishery:payDevice:list")
@GetMapping("/list")
public TableDataInfo<PayDeviceVo> list(PayDeviceBo bo, PageQuery pageQuery) {
return payDeviceService.queryPageList(bo, pageQuery);
}
/**
* 导出设备充值记录列表
*/
@SaCheckPermission("fishery:payDevice:export")
@Log(title = "设备充值记录", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(PayDeviceBo bo, HttpServletResponse response) {
List<PayDeviceVo> list = payDeviceService.queryList(bo);
ExcelUtil.exportExcel(list, "设备充值记录", PayDeviceVo.class, response);
}
/**
* 获取设备充值记录详细信息
*
* @param id 主键
*/
@SaCheckPermission("fishery:payDevice:query")
@GetMapping("/{id}")
public R<PayDeviceVo> getInfo(@NotNull(message = "主键不能为空")
@PathVariable Long id) {
return R.ok(payDeviceService.queryById(id));
}
/**
* 新增设备充值记录
*/
@SaCheckPermission("fishery:payDevice:add")
@Log(title = "设备充值记录", businessType = BusinessType.INSERT)
@RepeatSubmit()
@PostMapping()
public R<Void> add(@Validated(AddGroup.class) @RequestBody PayDeviceBo bo) {
return toAjax(payDeviceService.insertByBo(bo));
}
/**
* 修改设备充值记录
*/
@SaCheckPermission("fishery:payDevice:edit")
@Log(title = "设备充值记录", businessType = BusinessType.UPDATE)
@RepeatSubmit()
@PutMapping()
public R<Void> edit(@Validated(EditGroup.class) @RequestBody PayDeviceBo bo) {
return toAjax(payDeviceService.updateByBo(bo));
}
/**
* 删除设备充值记录
*
* @param ids 主键串
*/
@SaCheckPermission("fishery:payDevice:remove")
@Log(title = "设备充值记录", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public R<Void> remove(@NotEmpty(message = "主键不能为空")
@PathVariable Long[] ids) {
return toAjax(payDeviceService.deleteWithValidByIds(List.of(ids), true));
}
}

View File

@@ -0,0 +1,105 @@
package org.dromara.fishery.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.fishery.domain.vo.PayOrderVo;
import org.dromara.fishery.domain.bo.PayOrderBo;
import org.dromara.fishery.service.IPayOrderService;
import org.dromara.common.mybatis.core.page.TableDataInfo;
/**
* 充值订单
*
* @author intc
* @date 2025-10-17
*/
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/fishery/payOrder")
public class PayOrderController extends BaseController {
private final IPayOrderService payOrderService;
/**
* 查询充值订单列表
*/
@SaCheckPermission("fishery:payOrder:list")
@GetMapping("/list")
public TableDataInfo<PayOrderVo> list(PayOrderBo bo, PageQuery pageQuery) {
return payOrderService.queryPageList(bo, pageQuery);
}
/**
* 导出充值订单列表
*/
@SaCheckPermission("fishery:payOrder:export")
@Log(title = "充值订单", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(PayOrderBo bo, HttpServletResponse response) {
List<PayOrderVo> list = payOrderService.queryList(bo);
ExcelUtil.exportExcel(list, "充值订单", PayOrderVo.class, response);
}
/**
* 获取充值订单详细信息
*
* @param id 主键
*/
@SaCheckPermission("fishery:payOrder:query")
@GetMapping("/{id}")
public R<PayOrderVo> getInfo(@NotNull(message = "主键不能为空")
@PathVariable Long id) {
return R.ok(payOrderService.queryById(id));
}
/**
* 新增充值订单
*/
@SaCheckPermission("fishery:payOrder:add")
@Log(title = "充值订单", businessType = BusinessType.INSERT)
@RepeatSubmit()
@PostMapping()
public R<Void> add(@Validated(AddGroup.class) @RequestBody PayOrderBo bo) {
return toAjax(payOrderService.insertByBo(bo));
}
/**
* 修改充值订单
*/
@SaCheckPermission("fishery:payOrder:edit")
@Log(title = "充值订单", businessType = BusinessType.UPDATE)
@RepeatSubmit()
@PutMapping()
public R<Void> edit(@Validated(EditGroup.class) @RequestBody PayOrderBo bo) {
return toAjax(payOrderService.updateByBo(bo));
}
/**
* 删除充值订单
*
* @param ids 主键串
*/
@SaCheckPermission("fishery:payOrder:remove")
@Log(title = "充值订单", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public R<Void> remove(@NotEmpty(message = "主键不能为空")
@PathVariable Long[] ids) {
return toAjax(payOrderService.deleteWithValidByIds(List.of(ids), true));
}
}

View File

@@ -0,0 +1,105 @@
package org.dromara.fishery.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.fishery.domain.vo.UserRelationVo;
import org.dromara.fishery.domain.bo.UserRelationBo;
import org.dromara.fishery.service.IUserRelationService;
import org.dromara.common.mybatis.core.page.TableDataInfo;
/**
* 养殖用户子账号
*
* @author intc
* @date 2025-10-17
*/
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/fishery/userRelation")
public class UserRelationController extends BaseController {
private final IUserRelationService userRelationService;
/**
* 查询养殖用户子账号列表
*/
@SaCheckPermission("fishery:userRelation:list")
@GetMapping("/list")
public TableDataInfo<UserRelationVo> list(UserRelationBo bo, PageQuery pageQuery) {
return userRelationService.queryPageList(bo, pageQuery);
}
/**
* 导出养殖用户子账号列表
*/
@SaCheckPermission("fishery:userRelation:export")
@Log(title = "养殖用户子账号", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(UserRelationBo bo, HttpServletResponse response) {
List<UserRelationVo> list = userRelationService.queryList(bo);
ExcelUtil.exportExcel(list, "养殖用户子账号", UserRelationVo.class, response);
}
/**
* 获取养殖用户子账号详细信息
*
* @param id 主键
*/
@SaCheckPermission("fishery:userRelation:query")
@GetMapping("/{id}")
public R<UserRelationVo> getInfo(@NotNull(message = "主键不能为空")
@PathVariable Long id) {
return R.ok(userRelationService.queryById(id));
}
/**
* 新增养殖用户子账号
*/
@SaCheckPermission("fishery:userRelation:add")
@Log(title = "养殖用户子账号", businessType = BusinessType.INSERT)
@RepeatSubmit()
@PostMapping()
public R<Void> add(@Validated(AddGroup.class) @RequestBody UserRelationBo bo) {
return toAjax(userRelationService.insertByBo(bo));
}
/**
* 修改养殖用户子账号
*/
@SaCheckPermission("fishery:userRelation:edit")
@Log(title = "养殖用户子账号", businessType = BusinessType.UPDATE)
@RepeatSubmit()
@PutMapping()
public R<Void> edit(@Validated(EditGroup.class) @RequestBody UserRelationBo bo) {
return toAjax(userRelationService.updateByBo(bo));
}
/**
* 删除养殖用户子账号
*
* @param ids 主键串
*/
@SaCheckPermission("fishery:userRelation:remove")
@Log(title = "养殖用户子账号", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public R<Void> remove(@NotEmpty(message = "主键不能为空")
@PathVariable Long[] ids) {
return toAjax(userRelationService.deleteWithValidByIds(List.of(ids), true));
}
}

View File

@@ -0,0 +1,71 @@
package org.dromara.fishery.domain;
import org.dromara.common.tenant.core.TenantEntity;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serial;
/**
* 设备校准记录对象 aqu_device_correct_record
*
* @author intc
* @date 2025-10-17
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("aqu_device_correct_record")
public class DeviceCorrectRecord extends TenantEntity {
@Serial
private static final long serialVersionUID = 1L;
/**
* 主键id
*/
@TableId(value = "id")
private Long id;
/**
* 设备id
*/
private Long deviceId;
/**
* 用户id
*/
private Long userId;
/**
* 设备序列号
*/
private String serialNum;
/**
* 设备类型
*/
private Integer deviceType;
/**
* 溶解氧
*/
private Double valueDissolvedOxygen;
/**
* 水温
*/
private Double valueTemperature;
/**
* 饱和度
*/
private Double valueSaturability;
/**
* 备注
*/
private String remark;
}

View File

@@ -0,0 +1,51 @@
package org.dromara.fishery.domain;
import org.dromara.common.tenant.core.TenantEntity;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serial;
/**
* 设备故障码对象 aqu_device_error_code
*
* @author intc
* @date 2025-10-17
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("aqu_device_error_code")
public class DeviceErrorCode extends TenantEntity {
@Serial
private static final long serialVersionUID = 1L;
/**
* 主键id
*/
@TableId(value = "id")
private Long id;
/**
* 设备id
*/
private Long deviceId;
/**
* 开关序号
*/
private Integer switchIndex;
/**
* 故障码
*/
private Integer errorCode;
/**
* 备注
*/
private String remark;
}

View File

@@ -0,0 +1,98 @@
package org.dromara.fishery.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;
/**
* 测控一体机开关对象 aqu_device_switch
*
* @author intc
* @date 2025-10-17
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("aqu_device_switch")
public class DeviceSwitch extends TenantEntity {
@Serial
private static final long serialVersionUID = 1L;
/**
* 主键id
*/
@TableId(value = "id")
private Long id;
/**
* 设备id
*/
private Long deviceId;
/**
* 序号
*/
private Integer index;
/**
* 名称
*/
private String switchName;
/**
* 当前测定电流
*/
private Double detectElectricValue;
/**
* 当前测定电压
*/
private Double detectVoltageValue;
/**
* 接线方式
*/
private Integer connectVoltageType;
/**
* 塘口id
*/
private Long pondId;
/**
* 额定电流设置
*/
private Double rateElectricValue;
/**
* 当前开关状态
*/
private Integer isOpen;
/**
* 联动控制id
*/
private Long linkedCtrlId;
/**
* 电流告警开关
*/
private Integer electricWarnOpen;
/**
* 上次操作开关时间
*/
private Date lastTurnTime;
/**
* 备注
*/
private String remark;
}

View File

@@ -0,0 +1,83 @@
package org.dromara.fishery.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;
/**
* 设备充值记录对象 aqu_pay_device
*
* @author intc
* @date 2025-10-16
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("aqu_pay_device")
public class PayDevice extends TenantEntity {
@Serial
private static final long serialVersionUID = 1L;
/**
* 主键id
*/
@TableId(value = "id")
private Long id;
/**
* 用户Id
*/
private Long userId;
/**
* 设备编号
*/
private String serialNum;
/**
* 设备类型
*/
private Integer deviceType;
/**
* 续费时长(月)
*/
private Integer addMonth;
/**
* 最新到期时间
*/
private Date deadTime;
/**
* 续费金额(分)
*/
private Integer payAmount;
/**
* 订单id
*/
private Long orderId;
/**
* 续费方式
*/
private Integer payType;
/**
* 分润状态
*/
private Integer profitStatus;
/**
* 备注
*/
private String remark;
}

View File

@@ -0,0 +1,148 @@
package org.dromara.fishery.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;
/**
* 充值订单对象 aqu_pay_order
*
* @author intc
* @date 2025-10-17
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("aqu_pay_order")
public class PayOrder extends TenantEntity {
@Serial
private static final long serialVersionUID = 1L;
/**
* 主键id
*/
@TableId(value = "id")
private Long id;
/**
* 用户id
*/
private Long userId;
/**
* 充值总金额(分)
*/
private Integer totalAmount;
/**
* 有效期增加月数
*/
private Integer addMonth;
/**
* 附加数据
*/
private String attachment;
/**
* 付款银行类型
*/
private String bankType;
/**
* 币种
*/
private String currency;
/**
* 订单描述
*/
private String description;
/**
* 设备数量
*/
private Long deviceCount;
/**
* 支付的设备编号json格式
*/
private String isonDeviceSerialNum;
/**
* 支付回调通知URL
*/
private String notifyUrl;
/**
* 商户系统内部订单号
*/
private String outTradeNumber;
/**
* 用户支付币种
*/
private String payerCurrency;
/**
* 用户支付金额(分)
*/
private Integer payerTotal;
/**
* 微信预交易订单号
*/
private String prepayId;
/**
* 支付完成时间
*/
private Date successTime;
/**
* 交易状态
*/
private String tradeState;
/**
* 交易状态描述
*/
private String tradeStateDescription;
/**
* 交易类型
*/
private String tradeType;
/**
* 微信支付订单号
*/
private String transactionId;
/**
* 用户开放id
*/
private String wxOpenId;
/**
* 订单状态
*/
private Integer orderStatus;
/**
* 分润状态
*/
private Integer profitStatus;
/**
* 备注
*/
private String remark;
}

View File

@@ -0,0 +1,46 @@
package org.dromara.fishery.domain;
import org.dromara.common.tenant.core.TenantEntity;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serial;
/**
* 养殖用户子账号对象 aqu_user_relation
*
* @author intc
* @date 2025-10-17
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("aqu_user_relation")
public class UserRelation extends TenantEntity {
@Serial
private static final long serialVersionUID = 1L;
/**
* 主键id
*/
@TableId(value = "id")
private Long id;
/**
* 父级账号id
*/
private Long parentUserId;
/**
* 子账号id
*/
private Long childUserId;
/**
* 备注
*/
private String remark;
}

View File

@@ -0,0 +1,75 @@
package org.dromara.fishery.domain.bo;
import org.dromara.fishery.domain.DeviceCorrectRecord;
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.*;
/**
* 设备校准记录业务对象 aqu_device_correct_record
*
* @author intc
* @date 2025-10-17
*/
@Data
@EqualsAndHashCode(callSuper = true)
@AutoMapper(target = DeviceCorrectRecord.class, reverseConvertGenerate = false)
public class DeviceCorrectRecordBo extends BaseEntity {
/**
* 主键id
*/
@NotNull(message = "主键id不能为空", groups = { EditGroup.class })
private Long id;
/**
* 设备id
*/
private Long deviceId;
/**
* 用户id
*/
private Long userId;
/**
* 设备序列号
*/
@NotBlank(message = "设备序列号不能为空", groups = { AddGroup.class, EditGroup.class })
private String serialNum;
/**
* 设备类型
*/
@NotNull(message = "设备类型不能为空", groups = { AddGroup.class, EditGroup.class })
private Integer deviceType;
/**
* 溶解氧
*/
@NotNull(message = "溶解氧不能为空", groups = { AddGroup.class, EditGroup.class })
private Double valueDissolvedOxygen;
/**
* 水温
*/
@NotNull(message = "水温不能为空", groups = { AddGroup.class, EditGroup.class })
private Double valueTemperature;
/**
* 饱和度
*/
@NotNull(message = "饱和度不能为空", groups = { AddGroup.class, EditGroup.class })
private Double valueSaturability;
/**
* 备注
*/
private String remark;
}

View File

@@ -0,0 +1,53 @@
package org.dromara.fishery.domain.bo;
import org.dromara.fishery.domain.DeviceErrorCode;
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.*;
/**
* 设备故障码业务对象 aqu_device_error_code
*
* @author intc
* @date 2025-10-17
*/
@Data
@EqualsAndHashCode(callSuper = true)
@AutoMapper(target = DeviceErrorCode.class, reverseConvertGenerate = false)
public class DeviceErrorCodeBo extends BaseEntity {
/**
* 主键id
*/
@NotNull(message = "主键id不能为空", groups = { EditGroup.class })
private Long id;
/**
* 设备id
*/
@NotNull(message = "设备id不能为空", groups = { AddGroup.class, EditGroup.class })
private Long deviceId;
/**
* 开关序号
*/
@NotNull(message = "开关序号不能为空", groups = { AddGroup.class, EditGroup.class })
private Integer switchIndex;
/**
* 故障码
*/
@NotNull(message = "故障码不能为空", groups = { AddGroup.class, EditGroup.class })
private Integer errorCode;
/**
* 备注
*/
private String remark;
}

View File

@@ -0,0 +1,107 @@
package org.dromara.fishery.domain.bo;
import org.dromara.fishery.domain.DeviceSwitch;
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;
/**
* 测控一体机开关业务对象 aqu_device_switch
*
* @author intc
* @date 2025-10-17
*/
@Data
@EqualsAndHashCode(callSuper = true)
@AutoMapper(target = DeviceSwitch.class, reverseConvertGenerate = false)
public class DeviceSwitchBo extends BaseEntity {
/**
* 主键id
*/
@NotNull(message = "主键id不能为空", groups = { EditGroup.class })
private Long id;
/**
* 设备id
*/
@NotNull(message = "设备id不能为空", groups = { AddGroup.class, EditGroup.class })
private Long deviceId;
/**
* 序号
*/
@NotNull(message = "序号不能为空", groups = { AddGroup.class, EditGroup.class })
private Integer index;
/**
* 名称
*/
@NotBlank(message = "名称不能为空", groups = { AddGroup.class, EditGroup.class })
private String switchName;
/**
* 当前测定电流
*/
@NotNull(message = "当前测定电流不能为空", groups = { AddGroup.class, EditGroup.class })
private Double detectElectricValue;
/**
* 当前测定电压
*/
@NotNull(message = "当前测定电压不能为空", groups = { AddGroup.class, EditGroup.class })
private Double detectVoltageValue;
/**
* 接线方式
*/
@NotNull(message = "接线方式不能为空", groups = { AddGroup.class, EditGroup.class })
private Integer connectVoltageType;
/**
* 塘口id
*/
private Long pondId;
/**
* 额定电流设置
*/
@NotNull(message = "额定电流设置不能为空", groups = { AddGroup.class, EditGroup.class })
private Double rateElectricValue;
/**
* 当前开关状态
*/
@NotNull(message = "当前开关状态不能为空", groups = { AddGroup.class, EditGroup.class })
private Integer isOpen;
/**
* 联动控制id
*/
private Long linkedCtrlId;
/**
* 电流告警开关
*/
@NotNull(message = "电流告警开关不能为空", groups = { AddGroup.class, EditGroup.class })
private Integer electricWarnOpen;
/**
* 上次操作开关时间
*/
@NotNull(message = "上次操作开关时间不能为空", groups = { AddGroup.class, EditGroup.class })
private Date lastTurnTime;
/**
* 备注
*/
private String remark;
}

View File

@@ -0,0 +1,89 @@
package org.dromara.fishery.domain.bo;
import org.dromara.fishery.domain.PayDevice;
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;
/**
* 设备充值记录业务对象 aqu_pay_device
*
* @author intc
* @date 2025-10-16
*/
@Data
@EqualsAndHashCode(callSuper = true)
@AutoMapper(target = PayDevice.class, reverseConvertGenerate = false)
public class PayDeviceBo extends BaseEntity {
/**
* 主键id
*/
// @NotNull(message = "主键id不能为空", groups = { EditGroup.class })
private Long id;
/**
* 用户Id
*/
// @NotNull(message = "用户Id不能为空", groups = { AddGroup.class, EditGroup.class })
private Long userId;
/**
* 设备编号
*/
@NotBlank(message = "设备编号不能为空", groups = { AddGroup.class, EditGroup.class })
private String serialNum;
/**
* 设备类型
*/
@NotNull(message = "设备类型不能为空", groups = { AddGroup.class, EditGroup.class })
private Integer deviceType;
/**
* 续费时长(月)
*/
// @NotNull(message = "续费时长(月)不能为空", groups = { AddGroup.class, EditGroup.class })
private Integer addMonth;
/**
* 最新到期时间
*/
@NotNull(message = "最新到期时间不能为空", groups = { AddGroup.class, EditGroup.class })
private Date deadTime;
/**
* 续费金额(分)
*/
// @NotNull(message = "续费金额(分)不能为空", groups = { AddGroup.class, EditGroup.class })
private Integer payAmount;
/**
* 订单id
*/
private Long orderId;
/**
* 续费方式
*/
// @NotNull(message = "续费方式不能为空", groups = { AddGroup.class, EditGroup.class })
private Integer payType;
/**
* 分润状态
*/
private Integer profitStatus;
/**
* 备注
*/
private String remark;
}

View File

@@ -0,0 +1,156 @@
package org.dromara.fishery.domain.bo;
import org.dromara.fishery.domain.PayOrder;
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;
/**
* 充值订单业务对象 aqu_pay_order
*
* @author intc
* @date 2025-10-17
*/
@Data
@EqualsAndHashCode(callSuper = true)
@AutoMapper(target = PayOrder.class, reverseConvertGenerate = false)
public class PayOrderBo extends BaseEntity {
/**
* 主键id
*/
@NotNull(message = "主键id不能为空", groups = { EditGroup.class })
private Long id;
/**
* 用户id
*/
@NotNull(message = "用户id不能为空", groups = { AddGroup.class, EditGroup.class })
private Long userId;
/**
* 充值总金额(分)
*/
@NotNull(message = "充值总金额(分)不能为空", groups = { AddGroup.class, EditGroup.class })
private Integer totalAmount;
/**
* 有效期增加月数
*/
@NotNull(message = "有效期增加月数不能为空", groups = { AddGroup.class, EditGroup.class })
private Integer addMonth;
/**
* 附加数据
*/
private String attachment;
/**
* 付款银行类型
*/
private String bankType;
/**
* 币种
*/
private String currency;
/**
* 订单描述
*/
@NotBlank(message = "订单描述不能为空", groups = { AddGroup.class, EditGroup.class })
private String description;
/**
* 设备数量
*/
@NotNull(message = "设备数量不能为空", groups = { AddGroup.class, EditGroup.class })
private Long deviceCount;
/**
* 支付的设备编号json格式
*/
@NotBlank(message = "支付的设备编号json格式不能为空", groups = { AddGroup.class, EditGroup.class })
private String isonDeviceSerialNum;
/**
* 支付回调通知URL
*/
@NotBlank(message = "支付回调通知URL不能为空", groups = { AddGroup.class, EditGroup.class })
private String notifyUrl;
/**
* 商户系统内部订单号
*/
@NotBlank(message = "商户系统内部订单号不能为空", groups = { AddGroup.class, EditGroup.class })
private String outTradeNumber;
/**
* 用户支付币种
*/
private String payerCurrency;
/**
* 用户支付金额(分)
*/
private Integer payerTotal;
/**
* 微信预交易订单号
*/
@NotBlank(message = "微信预交易订单号不能为空", groups = { AddGroup.class, EditGroup.class })
private String prepayId;
/**
* 支付完成时间
*/
private Date successTime;
/**
* 交易状态
*/
private String tradeState;
/**
* 交易状态描述
*/
private String tradeStateDescription;
/**
* 交易类型
*/
private String tradeType;
/**
* 微信支付订单号
*/
private String transactionId;
/**
* 用户开放id
*/
private String wxOpenId;
/**
* 订单状态
*/
private Integer orderStatus;
/**
* 分润状态
*/
private Integer profitStatus;
/**
* 备注
*/
private String remark;
}

View File

@@ -0,0 +1,47 @@
package org.dromara.fishery.domain.bo;
import org.dromara.fishery.domain.UserRelation;
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.*;
/**
* 养殖用户子账号业务对象 aqu_user_relation
*
* @author intc
* @date 2025-10-17
*/
@Data
@EqualsAndHashCode(callSuper = true)
@AutoMapper(target = UserRelation.class, reverseConvertGenerate = false)
public class UserRelationBo extends BaseEntity {
/**
* 主键id
*/
@NotNull(message = "主键id不能为空", groups = { EditGroup.class })
private Long id;
/**
* 父级账号id
*/
@NotNull(message = "父级账号id不能为空", groups = { AddGroup.class, EditGroup.class })
private Long parentUserId;
/**
* 子账号id
*/
@NotNull(message = "子账号id不能为空", groups = { AddGroup.class, EditGroup.class })
private Long childUserId;
/**
* 备注
*/
private String remark;
}

View File

@@ -0,0 +1,116 @@
package org.dromara.fishery.domain.vo;
import java.io.Serial;
import java.io.Serializable;
import java.util.Date;
import org.dromara.common.excel.annotation.ExcelDictFormat;
import org.dromara.common.excel.convert.ExcelDictConvert;
import org.dromara.common.json.handler.DoubleSerializer;
import org.dromara.fishery.domain.DeviceCorrectRecord;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
import cn.idev.excel.annotation.ExcelProperty;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
/**
* 设备校准记录视图对象 aqu_device_correct_record
*
* @author intc
* @date 2025-10-17
*/
@Data
@ExcelIgnoreUnannotated
@AutoMapper(target = DeviceCorrectRecord.class)
public class DeviceCorrectRecordVo implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 主键id
*/
@ExcelProperty(value = "主键id")
private Long id;
/**
* 设备id
*/
@ExcelProperty(value = "设备id")
private Long deviceId;
/**
* 用户id
*/
@ExcelProperty(value = "用户id")
private Long userId;
/**
* 设备序列号
*/
@ExcelProperty(value = "设备序列号")
private String serialNum;
/**
* 设备类型
*/
@ExcelProperty(value = "设备类型", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "aqu_device_type")
private Integer deviceType;
/**
* 溶解氧
*/
@ExcelProperty(value = "溶解氧")
@JsonSerialize(using = DoubleSerializer.class)
private Double valueDissolvedOxygen;
/**
* 水温
*/
@ExcelProperty(value = "水温")
@JsonSerialize(using = DoubleSerializer.class)
private Double valueTemperature;
/**
* 饱和度
*/
@ExcelProperty(value = "饱和度")
@JsonSerialize(using = DoubleSerializer.class)
private Double valueSaturability;
/**
* 备注
*/
@ExcelProperty(value = "备注")
private String remark;
/**
* 用户名
*/
@ExcelProperty(value = "用户名")
private String userName;
/**
* 手机号
*/
@ExcelProperty(value = "手机号")
private String mobilePhone;
/**
* 设备名称
*/
@ExcelProperty(value = "设备名称")
private String deviceName;
private Date createTime;
private Date updateTime;
}

View File

@@ -0,0 +1,96 @@
package org.dromara.fishery.domain.vo;
import org.dromara.fishery.domain.DeviceErrorCode;
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;
/**
* 设备故障码视图对象 aqu_device_error_code
*
* @author intc
* @date 2025-10-17
*/
@Data
@ExcelIgnoreUnannotated
@AutoMapper(target = DeviceErrorCode.class)
public class DeviceErrorCodeVo 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 Integer switchIndex;
/**
* 开关名称
*/
@ExcelProperty(value = "开关名称")
private String switchName;
/**
* 故障码
*/
@ExcelProperty(value = "故障码")
private Integer errorCode;
/**
* 备注
*/
@ExcelProperty(value = "备注")
private String remark;
/**
* 设备名称
*/
@ExcelProperty(value = "设备名称")
private String deviceName;
/**
* 设备编号
*/
@ExcelProperty(value = "设备编号")
private String serialNum;
/**
* 用户名
*/
@ExcelProperty(value = "用户名")
private String userName;
/**
* 手机号
*/
@ExcelProperty(value = "手机号")
private String mobilePhone;
private Date createTime;
private Date updateTime;
}

View File

@@ -0,0 +1,143 @@
package org.dromara.fishery.domain.vo;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import org.dromara.common.json.handler.DoubleSerializer;
import org.dromara.fishery.domain.DeviceSwitch;
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;
/**
* 测控一体机开关视图对象 aqu_device_switch
*
* @author intc
* @date 2025-10-17
*/
@Data
@ExcelIgnoreUnannotated
@AutoMapper(target = DeviceSwitch.class)
public class DeviceSwitchVo 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 Integer index;
/**
* 名称
*/
@ExcelProperty(value = "名称")
private String switchName;
/**
* 当前测定电流
*/
@ExcelProperty(value = "当前测定电流")
@JsonSerialize(using = DoubleSerializer.class)
private Double detectElectricValue;
/**
* 当前测定电压
*/
@ExcelProperty(value = "当前测定电压")
@JsonSerialize(using = DoubleSerializer.class)
private Double detectVoltageValue;
/**
* 接线方式
*/
@ExcelProperty(value = "接线方式")
private Integer connectVoltageType;
/**
* 塘口id
*/
@ExcelProperty(value = "塘口id")
private Long pondId;
/**
* 额定电流设置
*/
@ExcelProperty(value = "额定电流设置")
private Double rateElectricValue;
/**
* 当前开关状态
*/
@ExcelProperty(value = "当前开关状态")
private Integer isOpen;
/**
* 电流告警开关
*/
@ExcelProperty(value = "电流告警开关")
private Integer electricWarnOpen;
/**
* 上次操作开关时间
*/
@ExcelProperty(value = "上次操作开关时间")
private Date lastTurnTime;
/**
* 联动控制id
*/
private Long linkedCtrlId;
/**
* 设备名称
*/
@ExcelProperty(value = "设备名称")
private String deviceName;
/**
* 设备编号
*/
@ExcelProperty(value = "设备编号")
private String serialNum;
/**
* 塘口名称
*/
@ExcelProperty(value = "塘口名称")
private String pondName;
/**
* 是否有联动控制0-否1-是)
*/
@ExcelProperty(value = "是否联动控制")
private Integer isLinkedCtrl;
private Date createTime;
private Date updateTime;
}

View File

@@ -0,0 +1,111 @@
package org.dromara.fishery.domain.vo;
import java.io.Serial;
import java.io.Serializable;
import java.util.Date;
import org.dromara.common.excel.annotation.ExcelDictFormat;
import org.dromara.common.excel.convert.ExcelDictConvert;
import org.dromara.fishery.domain.PayDevice;
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
import cn.idev.excel.annotation.ExcelProperty;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
/**
* 设备充值记录视图对象 aqu_pay_device
*
* @author intc
* @date 2025-10-16
*/
@Data
@ExcelIgnoreUnannotated
@AutoMapper(target = PayDevice.class)
public class PayDeviceVo implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 用户Id
*/
@ExcelProperty(value = "用户Id")
private Long userId;
/**
* 设备编号
*/
@ExcelProperty(value = "设备编号")
private String serialNum;
/**
* 设备类型
*/
@ExcelProperty(value = "设备类型", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "aqu_device_type")
private Integer deviceType;
/**
* 续费时长(月)
*/
@ExcelProperty(value = "续费时长", converter = ExcelDictConvert.class)
@ExcelDictFormat(readConverterExp = "月=")
private Integer addMonth;
/**
* 最新到期时间
*/
@ExcelProperty(value = "最新到期时间")
private Date deadTime;
/**
* 续费金额(分)
*/
@ExcelProperty(value = "续费金额", converter = ExcelDictConvert.class)
private Integer payAmount;
/**
* 续费金额(元)
*/
@ExcelProperty(value = "续费金额(元)")
private Double payAmountYuan;
/**
* 续费方式
*/
@ExcelProperty(value = "续费方式", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "pay_type")
private Integer payType;
/**
* 分润状态
*/
@ExcelProperty(value = "分润状态", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "profit_status")
private Integer profitStatus;
/**
* 用户名
*/
@ExcelProperty(value = "用户名")
private String userName;
/**
* 手机号
*/
@ExcelProperty(value = "手机号")
private String mobilePhone;
/**
* 订单id
*/
private Long orderId;
private Date createTime;
private Date updateTime;
}

View File

@@ -0,0 +1,119 @@
package org.dromara.fishery.domain.vo;
import java.io.Serial;
import java.io.Serializable;
import java.util.Date;
import org.dromara.common.excel.annotation.ExcelDictFormat;
import org.dromara.common.excel.convert.ExcelDictConvert;
import org.dromara.fishery.domain.PayOrder;
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
import cn.idev.excel.annotation.ExcelProperty;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
/**
* 充值订单视图对象 aqu_pay_order
*
* @author intc
* @date 2025-10-17
*/
@Data
@ExcelIgnoreUnannotated
@AutoMapper(target = PayOrder.class)
public class PayOrderVo implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 主键id
*/
// @ExcelProperty(value = "主键id")
private Long id;
/**
* 用户id
*/
// @ExcelProperty(value = "用户id")
private Long userId;
/**
* 充值总金额(分)
*/
// @ExcelProperty(value = "充值总金额", converter = ExcelDictConvert.class)
private Integer totalAmount;
/**
* 用户名
*/
@ExcelProperty(value = "用户名")
private String userName;
/**
* 手机号
*/
@ExcelProperty(value = "手机号")
private String mobilePhone;
/**
* 充值总金额(元)
*/
@ExcelProperty(value = "充值总金额(元)")
private Double totalAmountYuan;
/**
* 有效期增加月数
*/
@ExcelProperty(value = "有效期增加月数")
private Integer addMonth;
/**
* 设备数量
*/
@ExcelProperty(value = "设备数量")
private Long deviceCount;
/**
* 用户支付金额(分)
*/
// @ExcelProperty(value = "用户支付金额", converter = ExcelDictConvert.class)
private Integer payerTotal;
/**
* 用户支付金额(元)
*/
@ExcelProperty(value = "用户支付金额(元)")
private Double payerTotalYuan;
/**
* 支付完成时间
*/
@ExcelProperty(value = "支付完成时间")
private Date successTime;
/**
* 订单状态
*/
@ExcelProperty(value = "订单状态", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "order_status")
private Integer orderStatus;
/**
* 分润状态
*/
@ExcelProperty(value = "分润状态", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "profit_status")
private Integer profitStatus;
@ExcelProperty(value = "创建时间")
private Date createTime;
private Date updateTime;
}

View File

@@ -0,0 +1,56 @@
package org.dromara.fishery.domain.vo;
import org.dromara.fishery.domain.UserRelation;
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;
/**
* 养殖用户子账号视图对象 aqu_user_relation
*
* @author intc
* @date 2025-10-17
*/
@Data
@ExcelIgnoreUnannotated
@AutoMapper(target = UserRelation.class)
public class UserRelationVo implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 主键id
*/
@ExcelProperty(value = "主键id")
private Long id;
/**
* 父级账号id
*/
@ExcelProperty(value = "父级账号id")
private Long parentUserId;
/**
* 子账号id
*/
@ExcelProperty(value = "子账号id")
private Long childUserId;
/**
* 备注
*/
@ExcelProperty(value = "备注")
private String remark;
}

View File

@@ -0,0 +1,15 @@
package org.dromara.fishery.mapper;
import org.dromara.fishery.domain.DeviceCorrectRecord;
import org.dromara.fishery.domain.vo.DeviceCorrectRecordVo;
import org.dromara.common.mybatis.core.mapper.BaseMapperPlusJoin;
/**
* 设备校准记录Mapper接口
*
* @author intc
* @date 2025-10-17
*/
public interface DeviceCorrectRecordMapper extends BaseMapperPlusJoin<DeviceCorrectRecord, DeviceCorrectRecordVo> {
}

View File

@@ -0,0 +1,15 @@
package org.dromara.fishery.mapper;
import org.dromara.fishery.domain.DeviceErrorCode;
import org.dromara.fishery.domain.vo.DeviceErrorCodeVo;
import org.dromara.common.mybatis.core.mapper.BaseMapperPlusJoin;
/**
* 设备故障码Mapper接口
*
* @author intc
* @date 2025-10-17
*/
public interface DeviceErrorCodeMapper extends BaseMapperPlusJoin<DeviceErrorCode, DeviceErrorCodeVo> {
}

View File

@@ -0,0 +1,15 @@
package org.dromara.fishery.mapper;
import org.dromara.fishery.domain.DeviceSwitch;
import org.dromara.fishery.domain.vo.DeviceSwitchVo;
import org.dromara.common.mybatis.core.mapper.BaseMapperPlusJoin;
/**
* 测控一体机开关Mapper接口
*
* @author intc
* @date 2025-10-17
*/
public interface DeviceSwitchMapper extends BaseMapperPlusJoin<DeviceSwitch, DeviceSwitchVo> {
}

View File

@@ -1,5 +1,6 @@
package org.dromara.fishery.mapper;
import org.dromara.common.mybatis.core.mapper.BaseMapperPlusJoin;
import org.dromara.fishery.domain.Fish;
import org.dromara.fishery.domain.vo.FishVo;
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;

View File

@@ -0,0 +1,16 @@
package org.dromara.fishery.mapper;
import org.dromara.common.mybatis.core.mapper.BaseMapperPlusJoin;
import org.dromara.fishery.domain.PayDevice;
import org.dromara.fishery.domain.vo.PayDeviceVo;
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
/**
* 设备充值记录Mapper接口
*
* @author intc
* @date 2025-10-16
*/
public interface PayDeviceMapper extends BaseMapperPlusJoin<PayDevice, PayDeviceVo> {
}

View File

@@ -0,0 +1,16 @@
package org.dromara.fishery.mapper;
import org.dromara.common.mybatis.core.mapper.BaseMapperPlusJoin;
import org.dromara.fishery.domain.PayOrder;
import org.dromara.fishery.domain.vo.PayOrderVo;
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
/**
* 充值订单Mapper接口
*
* @author intc
* @date 2025-10-17
*/
public interface PayOrderMapper extends BaseMapperPlusJoin<PayOrder, PayOrderVo> {
}

View File

@@ -0,0 +1,15 @@
package org.dromara.fishery.mapper;
import org.dromara.fishery.domain.UserRelation;
import org.dromara.fishery.domain.vo.UserRelationVo;
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
/**
* 养殖用户子账号Mapper接口
*
* @author intc
* @date 2025-10-17
*/
public interface UserRelationMapper extends BaseMapperPlus<UserRelation, UserRelationVo> {
}

View File

@@ -0,0 +1,68 @@
package org.dromara.fishery.service;
import org.dromara.fishery.domain.vo.DeviceCorrectRecordVo;
import org.dromara.fishery.domain.bo.DeviceCorrectRecordBo;
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 intc
* @date 2025-10-17
*/
public interface IDeviceCorrectRecordService {
/**
* 查询设备校准记录
*
* @param id 主键
* @return 设备校准记录
*/
DeviceCorrectRecordVo queryById(Long id);
/**
* 分页查询设备校准记录列表
*
* @param bo 查询条件
* @param pageQuery 分页参数
* @return 设备校准记录分页列表
*/
TableDataInfo<DeviceCorrectRecordVo> queryPageList(DeviceCorrectRecordBo bo, PageQuery pageQuery);
/**
* 查询符合条件的设备校准记录列表
*
* @param bo 查询条件
* @return 设备校准记录列表
*/
List<DeviceCorrectRecordVo> queryList(DeviceCorrectRecordBo bo);
/**
* 新增设备校准记录
*
* @param bo 设备校准记录
* @return 是否新增成功
*/
Boolean insertByBo(DeviceCorrectRecordBo bo);
/**
* 修改设备校准记录
*
* @param bo 设备校准记录
* @return 是否修改成功
*/
Boolean updateByBo(DeviceCorrectRecordBo bo);
/**
* 校验并批量删除设备校准记录信息
*
* @param ids 待删除的主键集合
* @param isValid 是否进行有效性校验
* @return 是否删除成功
*/
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
}

View File

@@ -0,0 +1,68 @@
package org.dromara.fishery.service;
import org.dromara.fishery.domain.vo.DeviceErrorCodeVo;
import org.dromara.fishery.domain.bo.DeviceErrorCodeBo;
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 intc
* @date 2025-10-17
*/
public interface IDeviceErrorCodeService {
/**
* 查询设备故障码
*
* @param id 主键
* @return 设备故障码
*/
DeviceErrorCodeVo queryById(Long id);
/**
* 分页查询设备故障码列表
*
* @param bo 查询条件
* @param pageQuery 分页参数
* @return 设备故障码分页列表
*/
TableDataInfo<DeviceErrorCodeVo> queryPageList(DeviceErrorCodeBo bo, PageQuery pageQuery);
/**
* 查询符合条件的设备故障码列表
*
* @param bo 查询条件
* @return 设备故障码列表
*/
List<DeviceErrorCodeVo> queryList(DeviceErrorCodeBo bo);
/**
* 新增设备故障码
*
* @param bo 设备故障码
* @return 是否新增成功
*/
Boolean insertByBo(DeviceErrorCodeBo bo);
/**
* 修改设备故障码
*
* @param bo 设备故障码
* @return 是否修改成功
*/
Boolean updateByBo(DeviceErrorCodeBo bo);
/**
* 校验并批量删除设备故障码信息
*
* @param ids 待删除的主键集合
* @param isValid 是否进行有效性校验
* @return 是否删除成功
*/
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
}

View File

@@ -0,0 +1,68 @@
package org.dromara.fishery.service;
import org.dromara.fishery.domain.vo.DeviceSwitchVo;
import org.dromara.fishery.domain.bo.DeviceSwitchBo;
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 intc
* @date 2025-10-17
*/
public interface IDeviceSwitchService {
/**
* 查询测控一体机开关
*
* @param id 主键
* @return 测控一体机开关
*/
DeviceSwitchVo queryById(Long id);
/**
* 分页查询测控一体机开关列表
*
* @param bo 查询条件
* @param pageQuery 分页参数
* @return 测控一体机开关分页列表
*/
TableDataInfo<DeviceSwitchVo> queryPageList(DeviceSwitchBo bo, PageQuery pageQuery);
/**
* 查询符合条件的测控一体机开关列表
*
* @param bo 查询条件
* @return 测控一体机开关列表
*/
List<DeviceSwitchVo> queryList(DeviceSwitchBo bo);
/**
* 新增测控一体机开关
*
* @param bo 测控一体机开关
* @return 是否新增成功
*/
Boolean insertByBo(DeviceSwitchBo bo);
/**
* 修改测控一体机开关
*
* @param bo 测控一体机开关
* @return 是否修改成功
*/
Boolean updateByBo(DeviceSwitchBo bo);
/**
* 校验并批量删除测控一体机开关信息
*
* @param ids 待删除的主键集合
* @param isValid 是否进行有效性校验
* @return 是否删除成功
*/
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
}

View File

@@ -0,0 +1,68 @@
package org.dromara.fishery.service;
import org.dromara.fishery.domain.vo.PayDeviceVo;
import org.dromara.fishery.domain.bo.PayDeviceBo;
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 intc
* @date 2025-10-16
*/
public interface IPayDeviceService {
/**
* 查询设备充值记录
*
* @param id 主键
* @return 设备充值记录
*/
PayDeviceVo queryById(Long id);
/**
* 分页查询设备充值记录列表
*
* @param bo 查询条件
* @param pageQuery 分页参数
* @return 设备充值记录分页列表
*/
TableDataInfo<PayDeviceVo> queryPageList(PayDeviceBo bo, PageQuery pageQuery);
/**
* 查询符合条件的设备充值记录列表
*
* @param bo 查询条件
* @return 设备充值记录列表
*/
List<PayDeviceVo> queryList(PayDeviceBo bo);
/**
* 新增设备充值记录
*
* @param bo 设备充值记录
* @return 是否新增成功
*/
Boolean insertByBo(PayDeviceBo bo);
/**
* 修改设备充值记录
*
* @param bo 设备充值记录
* @return 是否修改成功
*/
Boolean updateByBo(PayDeviceBo bo);
/**
* 校验并批量删除设备充值记录信息
*
* @param ids 待删除的主键集合
* @param isValid 是否进行有效性校验
* @return 是否删除成功
*/
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
}

View File

@@ -0,0 +1,68 @@
package org.dromara.fishery.service;
import org.dromara.fishery.domain.vo.PayOrderVo;
import org.dromara.fishery.domain.bo.PayOrderBo;
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 intc
* @date 2025-10-17
*/
public interface IPayOrderService {
/**
* 查询充值订单
*
* @param id 主键
* @return 充值订单
*/
PayOrderVo queryById(Long id);
/**
* 分页查询充值订单列表
*
* @param bo 查询条件
* @param pageQuery 分页参数
* @return 充值订单分页列表
*/
TableDataInfo<PayOrderVo> queryPageList(PayOrderBo bo, PageQuery pageQuery);
/**
* 查询符合条件的充值订单列表
*
* @param bo 查询条件
* @return 充值订单列表
*/
List<PayOrderVo> queryList(PayOrderBo bo);
/**
* 新增充值订单
*
* @param bo 充值订单
* @return 是否新增成功
*/
Boolean insertByBo(PayOrderBo bo);
/**
* 修改充值订单
*
* @param bo 充值订单
* @return 是否修改成功
*/
Boolean updateByBo(PayOrderBo bo);
/**
* 校验并批量删除充值订单信息
*
* @param ids 待删除的主键集合
* @param isValid 是否进行有效性校验
* @return 是否删除成功
*/
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
}

View File

@@ -0,0 +1,68 @@
package org.dromara.fishery.service;
import org.dromara.fishery.domain.vo.UserRelationVo;
import org.dromara.fishery.domain.bo.UserRelationBo;
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 intc
* @date 2025-10-17
*/
public interface IUserRelationService {
/**
* 查询养殖用户子账号
*
* @param id 主键
* @return 养殖用户子账号
*/
UserRelationVo queryById(Long id);
/**
* 分页查询养殖用户子账号列表
*
* @param bo 查询条件
* @param pageQuery 分页参数
* @return 养殖用户子账号分页列表
*/
TableDataInfo<UserRelationVo> queryPageList(UserRelationBo bo, PageQuery pageQuery);
/**
* 查询符合条件的养殖用户子账号列表
*
* @param bo 查询条件
* @return 养殖用户子账号列表
*/
List<UserRelationVo> queryList(UserRelationBo bo);
/**
* 新增养殖用户子账号
*
* @param bo 养殖用户子账号
* @return 是否新增成功
*/
Boolean insertByBo(UserRelationBo bo);
/**
* 修改养殖用户子账号
*
* @param bo 养殖用户子账号
* @return 是否修改成功
*/
Boolean updateByBo(UserRelationBo bo);
/**
* 校验并批量删除养殖用户子账号信息
*
* @param ids 待删除的主键集合
* @param isValid 是否进行有效性校验
* @return 是否删除成功
*/
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
}

View File

@@ -0,0 +1,181 @@
package org.dromara.fishery.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.github.yulichang.wrapper.MPJLambdaWrapper;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.dromara.fishery.domain.bo.DeviceCorrectRecordBo;
import org.dromara.fishery.domain.vo.DeviceCorrectRecordVo;
import org.dromara.fishery.domain.DeviceCorrectRecord;
import org.dromara.fishery.domain.AquUser;
import org.dromara.fishery.domain.Device;
import org.dromara.fishery.mapper.DeviceCorrectRecordMapper;
import org.dromara.fishery.service.IDeviceCorrectRecordService;
import java.util.List;
import java.util.Map;
import java.util.Collection;
/**
* 设备校准记录Service业务层处理
*
* @author intc
* @date 2025-10-17
*/
@Slf4j
@RequiredArgsConstructor
@Service
public class DeviceCorrectRecordServiceImpl implements IDeviceCorrectRecordService {
private final DeviceCorrectRecordMapper baseMapper;
/**
* 查询设备校准记录
*
* @param id 主键
* @return 设备校准记录
*/
@Override
public DeviceCorrectRecordVo queryById(Long id){
return baseMapper.selectVoById(id);
}
/**
* 分页查询设备校准记录列表
*
* @param bo 查询条件
* @param pageQuery 分页参数
* @return 设备校准记录分页列表
*/
@Override
public TableDataInfo<DeviceCorrectRecordVo> queryPageList(DeviceCorrectRecordBo bo, PageQuery pageQuery) {
MPJLambdaWrapper<DeviceCorrectRecord> wrapper = buildQueryWrapper(bo);
Page<DeviceCorrectRecordVo> result = baseMapper.selectJoinPage(pageQuery.build(), DeviceCorrectRecordVo.class, wrapper);
return TableDataInfo.build(result);
}
/**
* 查询符合条件的设备校准记录列表
*
* @param bo 查询条件
* @return 设备校准记录列表
*/
@Override
public List<DeviceCorrectRecordVo> queryList(DeviceCorrectRecordBo bo) {
MPJLambdaWrapper<DeviceCorrectRecord> wrapper = buildQueryWrapper(bo);
return baseMapper.selectJoinList(DeviceCorrectRecordVo.class, wrapper);
}
private MPJLambdaWrapper<DeviceCorrectRecord> buildQueryWrapper(DeviceCorrectRecordBo bo) {
Map<String, Object> params = bo.getParams();
MPJLambdaWrapper<DeviceCorrectRecord> wrapper = new MPJLambdaWrapper<>();
// 选择主表所有字段
wrapper.selectAll(DeviceCorrectRecord.class);
// 选择用户表字段
wrapper.selectAs(AquUser::getUserName, DeviceCorrectRecordVo::getUserName)
.selectAs(AquUser::getMobilePhone, DeviceCorrectRecordVo::getMobilePhone);
// 选择设备表字段
wrapper.selectAs(Device::getDeviceName, DeviceCorrectRecordVo::getDeviceName);
// 左连接用户表
wrapper.leftJoin(AquUser.class, AquUser::getId, DeviceCorrectRecord::getUserId);
// 左连接设备表
wrapper.leftJoin(Device.class, Device::getId, DeviceCorrectRecord::getDeviceId);
// 查询条件
wrapper.eq(bo.getDeviceId() != null, DeviceCorrectRecord::getDeviceId, bo.getDeviceId())
.eq(bo.getUserId() != null, DeviceCorrectRecord::getUserId, bo.getUserId())
.eq(StringUtils.isNotBlank(bo.getSerialNum()), DeviceCorrectRecord::getSerialNum, bo.getSerialNum())
.eq(bo.getDeviceType() != null, DeviceCorrectRecord::getDeviceType, bo.getDeviceType())
.eq(bo.getValueDissolvedOxygen() != null, DeviceCorrectRecord::getValueDissolvedOxygen, bo.getValueDissolvedOxygen())
.eq(bo.getValueTemperature() != null, DeviceCorrectRecord::getValueTemperature, bo.getValueTemperature())
.eq(bo.getValueSaturability() != null, DeviceCorrectRecord::getValueSaturability, bo.getValueSaturability());
// 处理额外的查询参数
if (params != null && !params.isEmpty()) {
handleExtraParams(wrapper, params);
}
// 默认按id升序排列
wrapper.orderByDesc(DeviceCorrectRecord::getCreateTime);
return wrapper;
}
/**
* 处理额外的查询参数
*
* @param wrapper 查询包装器
* @param params 额外参数
*/
private void handleExtraParams(MPJLambdaWrapper<DeviceCorrectRecord> wrapper, Map<String, Object> params) {
// 处理用户搜索关键词 - 直接在SQL中进行JOIN查询
String userKeyword = (String) params.get("userKeyword");
if (StringUtils.isNotBlank(userKeyword)) {
wrapper.and(w -> w.like(AquUser::getUserName, userKeyword)
.or()
.like(AquUser::getMobilePhone, userKeyword));
}
}
/**
* 新增设备校准记录
*
* @param bo 设备校准记录
* @return 是否新增成功
*/
@Override
public Boolean insertByBo(DeviceCorrectRecordBo bo) {
DeviceCorrectRecord add = MapstructUtils.convert(bo, DeviceCorrectRecord.class);
validEntityBeforeSave(add);
boolean flag = baseMapper.insert(add) > 0;
if (flag) {
bo.setId(add.getId());
}
return flag;
}
/**
* 修改设备校准记录
*
* @param bo 设备校准记录
* @return 是否修改成功
*/
@Override
public Boolean updateByBo(DeviceCorrectRecordBo bo) {
DeviceCorrectRecord update = MapstructUtils.convert(bo, DeviceCorrectRecord.class);
validEntityBeforeSave(update);
return baseMapper.updateById(update) > 0;
}
/**
* 保存前的数据校验
*/
private void validEntityBeforeSave(DeviceCorrectRecord 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,215 @@
package org.dromara.fishery.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.github.yulichang.wrapper.MPJLambdaWrapper;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.dromara.fishery.domain.bo.DeviceErrorCodeBo;
import org.dromara.fishery.domain.vo.DeviceErrorCodeVo;
import org.dromara.fishery.domain.DeviceErrorCode;
import org.dromara.fishery.domain.Device;
import org.dromara.fishery.domain.AquUser;
import org.dromara.fishery.domain.DeviceSwitch;
import org.dromara.fishery.mapper.DeviceErrorCodeMapper;
import org.dromara.fishery.service.IDeviceErrorCodeService;
import java.util.List;
import java.util.Map;
import java.util.Collection;
/**
* 设备故障码Service业务层处理
*
* @author intc
* @date 2025-10-17
*/
@Slf4j
@RequiredArgsConstructor
@Service
public class DeviceErrorCodeServiceImpl implements IDeviceErrorCodeService {
private final DeviceErrorCodeMapper baseMapper;
/**
* 查询设备故障码
*
* @param id 主键
* @return 设备故障码
*/
@Override
public DeviceErrorCodeVo queryById(Long id){
return baseMapper.selectVoById(id);
}
/**
* 分页查询设备故障码列表
*
* @param bo 查询条件
* @param pageQuery 分页参数
* @return 设备故障码分页列表
*/
@Override
public TableDataInfo<DeviceErrorCodeVo> queryPageList(DeviceErrorCodeBo bo, PageQuery pageQuery) {
MPJLambdaWrapper<DeviceErrorCode> wrapper = buildQueryWrapper(bo);
Page<DeviceErrorCodeVo> result = baseMapper.selectJoinPage(pageQuery.build(), DeviceErrorCodeVo.class, wrapper);
// 处理 switchIndex 为 0 的记录
processSwitchName(result.getRecords());
return TableDataInfo.build(result);
}
/**
* 查询符合条件的设备故障码列表
*
* @param bo 查询条件
* @return 设备故障码列表
*/
@Override
public List<DeviceErrorCodeVo> queryList(DeviceErrorCodeBo bo) {
MPJLambdaWrapper<DeviceErrorCode> wrapper = buildQueryWrapper(bo);
List<DeviceErrorCodeVo> list = baseMapper.selectJoinList(DeviceErrorCodeVo.class, wrapper);
// 处理 switchIndex 为 0 的记录
processSwitchName(list);
return list;
}
private MPJLambdaWrapper<DeviceErrorCode> buildQueryWrapper(DeviceErrorCodeBo bo) {
Map<String, Object> params = bo.getParams();
MPJLambdaWrapper<DeviceErrorCode> wrapper = new MPJLambdaWrapper<>();
// 选择主表所有字段
wrapper.selectAll(DeviceErrorCode.class);
// 选择设备表字段
wrapper.selectAs(Device::getDeviceName, DeviceErrorCodeVo::getDeviceName)
.selectAs(Device::getSerialNum, DeviceErrorCodeVo::getSerialNum);
// 选择用户表字段
wrapper.selectAs(AquUser::getUserName, DeviceErrorCodeVo::getUserName)
.selectAs(AquUser::getMobilePhone, DeviceErrorCodeVo::getMobilePhone);
// 选择开关表字段(条件查询:switchIndex 不为 0 时才关联)
wrapper.selectAs(DeviceSwitch::getSwitchName, DeviceErrorCodeVo::getSwitchName);
// 左连接设备表
wrapper.leftJoin(Device.class, Device::getId, DeviceErrorCode::getDeviceId);
// 左连接用户表 (通过设备表的userId)
wrapper.leftJoin(AquUser.class, AquUser::getId, Device::getUserId);
// 条件左连接开关表:只在 switchIndex 为 1-4 时关联
wrapper.leftJoin(DeviceSwitch.class, on -> on
.eq(DeviceSwitch::getDeviceId, DeviceErrorCode::getDeviceId)
.eq(DeviceSwitch::getIndex, DeviceErrorCode::getSwitchIndex)
.in(DeviceErrorCode::getSwitchIndex, 1, 2, 3, 4));
// 查询条件
wrapper.eq(bo.getDeviceId() != null, DeviceErrorCode::getDeviceId, bo.getDeviceId())
.eq(bo.getSwitchIndex() != null, DeviceErrorCode::getSwitchIndex, bo.getSwitchIndex())
.like(bo.getErrorCode() != null, DeviceErrorCode::getErrorCode, bo.getErrorCode());
// 处理额外的查询参数
if (params != null && !params.isEmpty()) {
handleExtraParams(wrapper, params);
}
// 默认按id升序排列
wrapper.orderByDesc(DeviceErrorCode::getCreateTime);
return wrapper;
}
/**
* 处理额外的查询参数
*
* @param wrapper 查询包装器
* @param params 额外参数
*/
private void handleExtraParams(MPJLambdaWrapper<DeviceErrorCode> wrapper, Map<String, Object> params) {
// 处理用户搜索关键词 - 直接在SQL中进行JOIN查询
String userKeyword = (String) params.get("userKeyword");
if (StringUtils.isNotBlank(userKeyword)) {
wrapper.and(w -> w.like(AquUser::getUserName, userKeyword)
.or()
.like(AquUser::getMobilePhone, userKeyword));
}
// 处理设备编号搜索关键词 - 直接在SQL中进行JOIN查询
String deviceKeyword = (String) params.get("deviceKeyword");
if (StringUtils.isNotBlank(deviceKeyword)) {
wrapper.and(w -> w.like(Device::getSerialNum, deviceKeyword));
}
}
/**
* 处理 switchIndex 为 0 的记录,将 switchName 设置为 "--"
*
* @param list 设备故障码列表
*/
private void processSwitchName(List<DeviceErrorCodeVo> list) {
if (list == null || list.isEmpty()) {
return;
}
for (DeviceErrorCodeVo vo : list) {
if (vo.getSwitchIndex() != null && vo.getSwitchIndex() == 0) {
vo.setSwitchName("--");
}
}
}
/**
* 新增设备故障码
*
* @param bo 设备故障码
* @return 是否新增成功
*/
@Override
public Boolean insertByBo(DeviceErrorCodeBo bo) {
DeviceErrorCode add = MapstructUtils.convert(bo, DeviceErrorCode.class);
validEntityBeforeSave(add);
boolean flag = baseMapper.insert(add) > 0;
if (flag) {
bo.setId(add.getId());
}
return flag;
}
/**
* 修改设备故障码
*
* @param bo 设备故障码
* @return 是否修改成功
*/
@Override
public Boolean updateByBo(DeviceErrorCodeBo bo) {
DeviceErrorCode update = MapstructUtils.convert(bo, DeviceErrorCode.class);
validEntityBeforeSave(update);
return baseMapper.updateById(update) > 0;
}
/**
* 保存前的数据校验
*/
private void validEntityBeforeSave(DeviceErrorCode 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,223 @@
package org.dromara.fishery.service.impl;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
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.fishery.domain.bo.DeviceSwitchBo;
import org.dromara.fishery.domain.vo.DeviceSwitchVo;
import org.dromara.fishery.domain.DeviceSwitch;
import org.dromara.fishery.domain.Device;
import org.dromara.fishery.domain.Pond;
import org.dromara.fishery.mapper.DeviceSwitchMapper;
import org.dromara.fishery.service.IDeviceSwitchService;
import java.util.List;
import java.util.Map;
import java.util.Collection;
/**
* 测控一体机开关Service业务层处理
*
* @author intc
* @date 2025-10-17
*/
@Slf4j
@RequiredArgsConstructor
@Service
public class DeviceSwitchServiceImpl implements IDeviceSwitchService {
private final DeviceSwitchMapper baseMapper;
/**
* 查询测控一体机开关
*
* @param id 主键
* @return 测控一体机开关
*/
@Override
public DeviceSwitchVo queryById(Long id){
return baseMapper.selectVoById(id);
}
/**
* 分页查询测控一体机开关列表
*
* @param bo 查询条件
* @param pageQuery 分页参数
* @return 测控一体机开关分页列表
*/
@Override
public TableDataInfo<DeviceSwitchVo> queryPageList(DeviceSwitchBo bo, PageQuery pageQuery) {
MPJLambdaWrapper<DeviceSwitch> wrapper = buildJoinQueryWrapper(bo);
Page<DeviceSwitchVo> result = baseMapper.selectJoinPage(pageQuery.build(), DeviceSwitchVo.class, wrapper);
// 填充isLinkedCtrl字段
fillIsLinkedCtrl(result.getRecords());
return TableDataInfo.build(result);
}
/**
* 查询符合条件的测控一体机开关列表
*
* @param bo 查询条件
* @return 测控一体机开关列表
*/
@Override
public List<DeviceSwitchVo> queryList(DeviceSwitchBo bo) {
MPJLambdaWrapper<DeviceSwitch> wrapper = buildJoinQueryWrapper(bo);
List<DeviceSwitchVo> list = baseMapper.selectJoinList(DeviceSwitchVo.class, wrapper);
// 填充isLinkedCtrl字段
fillIsLinkedCtrl(list);
return list;
}
private LambdaQueryWrapper<DeviceSwitch> buildQueryWrapper(DeviceSwitchBo bo) {
Map<String, Object> params = bo.getParams();
LambdaQueryWrapper<DeviceSwitch> lqw = Wrappers.lambdaQuery();
lqw.orderByAsc(DeviceSwitch::getId);
lqw.eq(bo.getDeviceId() != null, DeviceSwitch::getDeviceId, bo.getDeviceId());
lqw.eq(bo.getIndex() != null, DeviceSwitch::getIndex, bo.getIndex());
lqw.like(StringUtils.isNotBlank(bo.getSwitchName()), DeviceSwitch::getSwitchName, bo.getSwitchName());
lqw.eq(bo.getConnectVoltageType() != null, DeviceSwitch::getConnectVoltageType, bo.getConnectVoltageType());
lqw.eq(bo.getPondId() != null, DeviceSwitch::getPondId, bo.getPondId());
lqw.eq(bo.getIsOpen() != null, DeviceSwitch::getIsOpen, bo.getIsOpen());
lqw.eq(bo.getLinkedCtrlId() != null, DeviceSwitch::getLinkedCtrlId, bo.getLinkedCtrlId());
lqw.eq(bo.getLastTurnTime() != null, DeviceSwitch::getLastTurnTime, bo.getLastTurnTime());
return lqw;
}
/**
* 构建关联查询条件
*
* @param bo 查询条件
* @return 关联查询Wrapper
*/
private MPJLambdaWrapper<DeviceSwitch> buildJoinQueryWrapper(DeviceSwitchBo bo) {
Map<String, Object> params = bo.getParams();
MPJLambdaWrapper<DeviceSwitch> wrapper = new MPJLambdaWrapper<DeviceSwitch>()
.selectAll(DeviceSwitch.class)
.selectAs(Device::getDeviceName, DeviceSwitchVo::getDeviceName)
.selectAs(Device::getSerialNum, DeviceSwitchVo::getSerialNum)
.selectAs(Pond::getPondName, DeviceSwitchVo::getPondName)
.leftJoin(Device.class, Device::getId, DeviceSwitch::getDeviceId)
.leftJoin(Pond.class, Pond::getId, DeviceSwitch::getPondId)
.eq(bo.getDeviceId() != null, DeviceSwitch::getDeviceId, bo.getDeviceId())
.eq(bo.getIndex() != null, DeviceSwitch::getIndex, bo.getIndex())
.like(StringUtils.isNotBlank(bo.getSwitchName()), DeviceSwitch::getSwitchName, bo.getSwitchName())
.eq(bo.getConnectVoltageType() != null, DeviceSwitch::getConnectVoltageType, bo.getConnectVoltageType())
.eq(bo.getPondId() != null, DeviceSwitch::getPondId, bo.getPondId())
.eq(bo.getIsOpen() != null, DeviceSwitch::getIsOpen, bo.getIsOpen())
.eq(bo.getLinkedCtrlId() != null, DeviceSwitch::getLinkedCtrlId, bo.getLinkedCtrlId())
.eq(bo.getLastTurnTime() != null, DeviceSwitch::getLastTurnTime, bo.getLastTurnTime())
.orderByAsc(DeviceSwitch::getId);
// 处理额外的查询参数
if (params != null && !params.isEmpty()) {
handleExtraParams(wrapper, params);
}
return wrapper;
}
/**
* 填充isLinkedCtrl字段
* 如果linkedCtrlId不为空isLinkedCtrl设置为1否则设置为0
*
* @param list 测控一体机开关列表
*/
private void fillIsLinkedCtrl(List<DeviceSwitchVo> list) {
if (list == null || list.isEmpty()) {
return;
}
for (DeviceSwitchVo vo : list) {
vo.setIsLinkedCtrl(vo.getLinkedCtrlId() != null ? 1 : 0);
}
}
/**
* 处理额外的查询参数
*
* @param wrapper 查询包装器
* @param params 额外参数
*/
private void handleExtraParams(MPJLambdaWrapper<DeviceSwitch> wrapper, Map<String, Object> params) {
// 处理设备名称或设备编号模糊查询
String deviceKeyword = (String) params.get("deviceKeyword");
if (StringUtils.isNotBlank(deviceKeyword)) {
wrapper.and(w -> w.like(Device::getDeviceName, deviceKeyword)
.or()
.like(Device::getSerialNum, deviceKeyword));
}
// 处理设备名称模糊查询
String deviceName = (String) params.get("deviceName");
if (StringUtils.isNotBlank(deviceName)) {
wrapper.like(Device::getDeviceName, deviceName);
}
// 处理设备编号模糊查询
String serialNum = (String) params.get("serialNum");
if (StringUtils.isNotBlank(serialNum)) {
wrapper.like(Device::getSerialNum, serialNum);
}
}
/**
* 新增测控一体机开关
*
* @param bo 测控一体机开关
* @return 是否新增成功
*/
@Override
public Boolean insertByBo(DeviceSwitchBo bo) {
DeviceSwitch add = MapstructUtils.convert(bo, DeviceSwitch.class);
validEntityBeforeSave(add);
boolean flag = baseMapper.insert(add) > 0;
if (flag) {
bo.setId(add.getId());
}
return flag;
}
/**
* 修改测控一体机开关
*
* @param bo 测控一体机开关
* @return 是否修改成功
*/
@Override
public Boolean updateByBo(DeviceSwitchBo bo) {
DeviceSwitch update = MapstructUtils.convert(bo, DeviceSwitch.class);
validEntityBeforeSave(update);
return baseMapper.updateById(update) > 0;
}
/**
* 保存前的数据校验
*/
private void validEntityBeforeSave(DeviceSwitch 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,245 @@
package org.dromara.fishery.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
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 lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.dromara.fishery.domain.bo.PayDeviceBo;
import org.dromara.fishery.domain.vo.PayDeviceVo;
import org.dromara.fishery.domain.PayDevice;
import org.dromara.fishery.domain.Device;
import org.dromara.fishery.domain.AquUser;
import org.dromara.fishery.mapper.PayDeviceMapper;
import org.dromara.fishery.mapper.DeviceMapper;
import org.dromara.fishery.service.IPayDeviceService;
import java.time.LocalDate;
import java.time.ZoneId;
import java.time.temporal.ChronoUnit;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Collection;
/**
* 设备充值记录Service业务层处理
*
* @author intc
* @date 2025-10-16
*/
@Slf4j
@RequiredArgsConstructor
@Service
public class PayDeviceServiceImpl implements IPayDeviceService {
private final PayDeviceMapper baseMapper;
private final DeviceMapper deviceMapper;
/**
* 查询设备充值记录
*
* @param id 主键
* @return 设备充值记录
*/
@Override
public PayDeviceVo queryById(Long id){
MPJLambdaWrapper<PayDevice> wrapper = new MPJLambdaWrapper<>();
wrapper.selectAll(PayDevice.class)
.selectAs(AquUser::getUserName, PayDeviceVo::getUserName)
.selectAs(AquUser::getMobilePhone, PayDeviceVo::getMobilePhone)
.leftJoin(AquUser.class, AquUser::getId, PayDevice::getUserId)
.eq(PayDevice::getId, id);
PayDeviceVo vo = baseMapper.selectJoinOne(PayDeviceVo.class, wrapper);
if (vo != null) {
convertPayAmountToYuan(vo);
}
return vo;
}
/**
* 分页查询设备充值记录列表
*
* @param bo 查询条件
* @param pageQuery 分页参数
* @return 设备充值记录分页列表
*/
@Override
public TableDataInfo<PayDeviceVo> queryPageList(PayDeviceBo bo, PageQuery pageQuery) {
MPJLambdaWrapper<PayDevice> wrapper = buildJoinQueryWrapper(bo);
Page<PayDeviceVo> result = baseMapper.selectJoinPage(pageQuery.build(), PayDeviceVo.class, wrapper);
// 转换金额从分到元
result.getRecords().forEach(this::convertPayAmountToYuan);
return TableDataInfo.build(result);
}
/**
* 查询符合条件的设备充值记录列表
*
* @param bo 查询条件
* @return 设备充值记录列表
*/
@Override
public List<PayDeviceVo> queryList(PayDeviceBo bo) {
MPJLambdaWrapper<PayDevice> wrapper = buildJoinQueryWrapper(bo);
List<PayDeviceVo> list = baseMapper.selectJoinList(PayDeviceVo.class, wrapper);
// 转换金额从分到元
list.forEach(this::convertPayAmountToYuan);
return list;
}
private MPJLambdaWrapper<PayDevice> buildJoinQueryWrapper(PayDeviceBo bo) {
Map<String, Object> params = bo.getParams();
MPJLambdaWrapper<PayDevice> wrapper = new MPJLambdaWrapper<>();
// Select all fields from main table
wrapper.selectAll(PayDevice.class);
// Select joined fields from AquUser table
wrapper.selectAs(AquUser::getUserName, PayDeviceVo::getUserName)
.selectAs(AquUser::getMobilePhone, PayDeviceVo::getMobilePhone);
// Left join with AquUser table
wrapper.leftJoin(AquUser.class, AquUser::getId, PayDevice::getUserId);
// Build query conditions
wrapper.orderByDesc(PayDevice::getCreateTime);
wrapper.eq(bo.getUserId() != null, PayDevice::getUserId, bo.getUserId());
wrapper.like(StringUtils.isNotBlank(bo.getSerialNum()), PayDevice::getSerialNum, bo.getSerialNum());
wrapper.eq(bo.getDeviceType() != null, PayDevice::getDeviceType, bo.getDeviceType());
wrapper.eq(bo.getOrderId() != null, PayDevice::getOrderId, bo.getOrderId());
wrapper.eq(bo.getPayType() != null, PayDevice::getPayType, bo.getPayType());
wrapper.eq(bo.getProfitStatus() != null, PayDevice::getProfitStatus, bo.getProfitStatus());
// 处理扩展查询参数:用户关键词搜索(用户名或手机号模糊查询)
if (params != null && !params.isEmpty()) {
String userKeyword = (String) params.get("userKeyword");
if (StringUtils.isNotBlank(userKeyword)) {
wrapper.and(w -> w.like(AquUser::getUserName, userKeyword)
.or()
.like(AquUser::getMobilePhone, userKeyword));
}
}
return wrapper;
}
/**
* 将续费金额从分转换为元
*
* @param vo 设备充值记录VO
*/
private void convertPayAmountToYuan(PayDeviceVo vo) {
if (vo != null && vo.getPayAmount() != null) {
// 分转元除以100保畚2位小数
double yuan = vo.getPayAmount() / 100.0;
vo.setPayAmountYuan(Math.round(yuan * 100.0) / 100.0);
}
}
/**
* 新增设备充值记录
*
* @param bo 设备充值记录
* @return 是否新增成功
*/
@Override
public Boolean insertByBo(PayDeviceBo bo) {
PayDevice add = MapstructUtils.convert(bo, PayDevice.class);
// 1. 根据设备编号查询设备信息
LambdaQueryWrapper<Device> deviceQuery = new LambdaQueryWrapper<>();
deviceQuery.eq(Device::getSerialNum, bo.getSerialNum());
Device device = deviceMapper.selectOne(deviceQuery);
if (device == null) {
log.error("设备不存在,设备编号: {}", bo.getSerialNum());
throw new RuntimeException("设备不存在");
}
// 2. 计算续费时长(月)- 使用设备原到期时间与新到期时间比较
Integer addMonth = calculateAddMonth(device.getDeadTime(), bo.getDeadTime());
add.setAddMonth(addMonth);
// 3. 保存充值记录
validEntityBeforeSave(add);
boolean flag = baseMapper.insert(add) > 0;
if (flag) {
bo.setId(add.getId());
// 4. 直接更新设备的到期时间为前端传来的新到期时间
device.setDeadTime(bo.getDeadTime());
deviceMapper.updateById(device);
}
return flag;
}
/**
* 计算续费时长(月)
*
* @param oldDeadTime 原到期时间
* @param newDeadTime 新到期时间
* @return 续费月数
*/
private Integer calculateAddMonth(Date oldDeadTime, Date newDeadTime) {
if (newDeadTime == null) {
log.warn("新到期时间为空,无法计算续费时长");
return 0;
}
// 如果设备原来没有到期时间,使用当前时间作为基准
Date baseTime = (oldDeadTime != null) ? oldDeadTime : new Date();
// 转换为LocalDate进行月份计算
LocalDate baseDate = baseTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
LocalDate newDate = newDeadTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
// 计算月份差
long months = ChronoUnit.MONTHS.between(baseDate, newDate);
log.debug("计算续费时长 - 基准时间: {}, 新到期时间: {}, 续费月数: {}", baseDate, newDate, months);
return Math.max(0, (int) months);
}
/**
* 修改设备充值记录
*
* @param bo 设备充值记录
* @return 是否修改成功
*/
@Override
public Boolean updateByBo(PayDeviceBo bo) {
PayDevice update = MapstructUtils.convert(bo, PayDevice.class);
validEntityBeforeSave(update);
return baseMapper.updateById(update) > 0;
}
/**
* 保存前的数据校验
*/
private void validEntityBeforeSave(PayDevice 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,199 @@
package org.dromara.fishery.service.impl;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
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 lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.dromara.fishery.domain.bo.PayOrderBo;
import org.dromara.fishery.domain.vo.PayOrderVo;
import org.dromara.fishery.domain.PayOrder;
import org.dromara.fishery.domain.AquUser;
import org.dromara.fishery.mapper.PayOrderMapper;
import org.dromara.fishery.service.IPayOrderService;
import java.util.List;
import java.util.Map;
import java.util.Collection;
/**
* 充值订单Service业务层处理
*
* @author intc
* @date 2025-10-17
*/
@Slf4j
@RequiredArgsConstructor
@Service
public class PayOrderServiceImpl implements IPayOrderService {
private final PayOrderMapper baseMapper;
/**
* 查询充值订单
*
* @param id 主键
* @return 充值订单
*/
@Override
public PayOrderVo queryById(Long id){
MPJLambdaWrapper<PayOrder> wrapper = new MPJLambdaWrapper<>();
wrapper.selectAll(PayOrder.class)
.selectAs(AquUser::getUserName, PayOrderVo::getUserName)
.selectAs(AquUser::getMobilePhone, PayOrderVo::getMobilePhone)
.leftJoin(AquUser.class, AquUser::getId, PayOrder::getUserId)
.eq(PayOrder::getId, id);
PayOrderVo vo = baseMapper.selectJoinOne(PayOrderVo.class, wrapper);
if (vo != null) {
convertAmountToYuan(vo);
}
return vo;
}
/**
* 分页查询充值订单列表
*
* @param bo 查询条件
* @param pageQuery 分页参数
* @return 充值订单分页列表
*/
@Override
public TableDataInfo<PayOrderVo> queryPageList(PayOrderBo bo, PageQuery pageQuery) {
MPJLambdaWrapper<PayOrder> wrapper = buildJoinQueryWrapper(bo);
Page<PayOrderVo> result = baseMapper.selectJoinPage(pageQuery.build(), PayOrderVo.class, wrapper);
// 转换金额从分到元
result.getRecords().forEach(this::convertAmountToYuan);
return TableDataInfo.build(result);
}
/**
* 查询符合条件的充值订单列表
*
* @param bo 查询条件
* @return 充值订单列表
*/
@Override
public List<PayOrderVo> queryList(PayOrderBo bo) {
MPJLambdaWrapper<PayOrder> wrapper = buildJoinQueryWrapper(bo);
List<PayOrderVo> list = baseMapper.selectJoinList(PayOrderVo.class, wrapper);
// 转换金额从分到元
list.forEach(this::convertAmountToYuan);
return list;
}
private MPJLambdaWrapper<PayOrder> buildJoinQueryWrapper(PayOrderBo bo) {
Map<String, Object> params = bo.getParams();
MPJLambdaWrapper<PayOrder> wrapper = new MPJLambdaWrapper<>();
// Select all fields from main table
wrapper.selectAll(PayOrder.class);
// Select joined fields from AquUser table
wrapper.selectAs(AquUser::getUserName, PayOrderVo::getUserName)
.selectAs(AquUser::getMobilePhone, PayOrderVo::getMobilePhone);
// Left join with AquUser table
wrapper.leftJoin(AquUser.class, AquUser::getId, PayOrder::getUserId);
// Build query conditions
wrapper.orderByDesc(PayOrder::getCreateTime);
wrapper.eq(bo.getUserId() != null, PayOrder::getUserId, bo.getUserId());
wrapper.eq(StringUtils.isNotBlank(bo.getBankType()), PayOrder::getBankType, bo.getBankType());
wrapper.eq(bo.getSuccessTime() != null, PayOrder::getSuccessTime, bo.getSuccessTime());
wrapper.eq(StringUtils.isNotBlank(bo.getTradeState()), PayOrder::getTradeState, bo.getTradeState());
wrapper.eq(StringUtils.isNotBlank(bo.getTradeType()), PayOrder::getTradeType, bo.getTradeType());
wrapper.eq(StringUtils.isNotBlank(bo.getTransactionId()), PayOrder::getTransactionId, bo.getTransactionId());
wrapper.eq(bo.getOrderStatus() != null, PayOrder::getOrderStatus, bo.getOrderStatus());
wrapper.eq(bo.getProfitStatus() != null, PayOrder::getProfitStatus, bo.getProfitStatus());
// 处理扩展查询参数:用户关键词搜索(用户名或手机号模糊查询)
if (params != null && !params.isEmpty()) {
String userKeyword = (String) params.get("userKeyword");
if (StringUtils.isNotBlank(userKeyword)) {
wrapper.and(w -> w.like(AquUser::getUserName, userKeyword)
.or()
.like(AquUser::getMobilePhone, userKeyword));
}
}
return wrapper;
}
/**
* 将金额从分转换为元
*
* @param vo 充值订单VO
*/
private void convertAmountToYuan(PayOrderVo vo) {
if (vo == null) {
return;
}
// 转换充值总金额
if (vo.getTotalAmount() != null) {
double yuan = vo.getTotalAmount() / 100.0;
vo.setTotalAmountYuan(Math.round(yuan * 100.0) / 100.0);
}
// 转换用户支付金额
if (vo.getPayerTotal() != null) {
double yuan = vo.getPayerTotal() / 100.0;
vo.setPayerTotalYuan(Math.round(yuan * 100.0) / 100.0);
}
}
/**
* 新增充值订单
*
* @param bo 充值订单
* @return 是否新增成功
*/
@Override
public Boolean insertByBo(PayOrderBo bo) {
PayOrder add = MapstructUtils.convert(bo, PayOrder.class);
validEntityBeforeSave(add);
boolean flag = baseMapper.insert(add) > 0;
if (flag) {
bo.setId(add.getId());
}
return flag;
}
/**
* 修改充值订单
*
* @param bo 充值订单
* @return 是否修改成功
*/
@Override
public Boolean updateByBo(PayOrderBo bo) {
PayOrder update = MapstructUtils.convert(bo, PayOrder.class);
validEntityBeforeSave(update);
return baseMapper.updateById(update) > 0;
}
/**
* 保存前的数据校验
*/
private void validEntityBeforeSave(PayOrder 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,133 @@
package org.dromara.fishery.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.fishery.domain.bo.UserRelationBo;
import org.dromara.fishery.domain.vo.UserRelationVo;
import org.dromara.fishery.domain.UserRelation;
import org.dromara.fishery.mapper.UserRelationMapper;
import org.dromara.fishery.service.IUserRelationService;
import java.util.List;
import java.util.Map;
import java.util.Collection;
/**
* 养殖用户子账号Service业务层处理
*
* @author intc
* @date 2025-10-17
*/
@Slf4j
@RequiredArgsConstructor
@Service
public class UserRelationServiceImpl implements IUserRelationService {
private final UserRelationMapper baseMapper;
/**
* 查询养殖用户子账号
*
* @param id 主键
* @return 养殖用户子账号
*/
@Override
public UserRelationVo queryById(Long id){
return baseMapper.selectVoById(id);
}
/**
* 分页查询养殖用户子账号列表
*
* @param bo 查询条件
* @param pageQuery 分页参数
* @return 养殖用户子账号分页列表
*/
@Override
public TableDataInfo<UserRelationVo> queryPageList(UserRelationBo bo, PageQuery pageQuery) {
LambdaQueryWrapper<UserRelation> lqw = buildQueryWrapper(bo);
Page<UserRelationVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
return TableDataInfo.build(result);
}
/**
* 查询符合条件的养殖用户子账号列表
*
* @param bo 查询条件
* @return 养殖用户子账号列表
*/
@Override
public List<UserRelationVo> queryList(UserRelationBo bo) {
LambdaQueryWrapper<UserRelation> lqw = buildQueryWrapper(bo);
return baseMapper.selectVoList(lqw);
}
private LambdaQueryWrapper<UserRelation> buildQueryWrapper(UserRelationBo bo) {
Map<String, Object> params = bo.getParams();
LambdaQueryWrapper<UserRelation> lqw = Wrappers.lambdaQuery();
lqw.orderByAsc(UserRelation::getId);
lqw.eq(bo.getParentUserId() != null, UserRelation::getParentUserId, bo.getParentUserId());
lqw.eq(bo.getChildUserId() != null, UserRelation::getChildUserId, bo.getChildUserId());
return lqw;
}
/**
* 新增养殖用户子账号
*
* @param bo 养殖用户子账号
* @return 是否新增成功
*/
@Override
public Boolean insertByBo(UserRelationBo bo) {
UserRelation add = MapstructUtils.convert(bo, UserRelation.class);
validEntityBeforeSave(add);
boolean flag = baseMapper.insert(add) > 0;
if (flag) {
bo.setId(add.getId());
}
return flag;
}
/**
* 修改养殖用户子账号
*
* @param bo 养殖用户子账号
* @return 是否修改成功
*/
@Override
public Boolean updateByBo(UserRelationBo bo) {
UserRelation update = MapstructUtils.convert(bo, UserRelation.class);
validEntityBeforeSave(update);
return baseMapper.updateById(update) > 0;
}
/**
* 保存前的数据校验
*/
private void validEntityBeforeSave(UserRelation 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,6 @@
<?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.fishery.mapper.DeviceCorrectRecordMapper">
</mapper>

View File

@@ -0,0 +1,6 @@
<?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.fishery.mapper.DeviceErrorCodeMapper">
</mapper>

View File

@@ -0,0 +1,6 @@
<?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.fishery.mapper.DeviceSwitchMapper">
</mapper>

View File

@@ -0,0 +1,6 @@
<?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.fishery.mapper.PayDeviceMapper">
</mapper>

View File

@@ -0,0 +1,6 @@
<?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.fishery.mapper.PayOrderMapper">
</mapper>

View File

@@ -0,0 +1,6 @@
<?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.fishery.mapper.UserRelationMapper">
</mapper>

View File

@@ -0,0 +1,112 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>org.dromara</groupId>
<artifactId>ruoyi-modules</artifactId>
<version>${revision}</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>ruoyi-tdengine</artifactId>
<description>
TD数据模块
</description>
<dependencies>
<!-- 通用工具-->
<dependency>
<groupId>org.dromara</groupId>
<artifactId>ruoyi-common-core</artifactId>
</dependency>
<dependency>
<groupId>org.dromara</groupId>
<artifactId>ruoyi-common-doc</artifactId>
</dependency>
<dependency>
<groupId>org.dromara</groupId>
<artifactId>ruoyi-common-sms</artifactId>
</dependency>
<dependency>
<groupId>org.dromara</groupId>
<artifactId>ruoyi-common-mail</artifactId>
</dependency>
<dependency>
<groupId>org.dromara</groupId>
<artifactId>ruoyi-common-redis</artifactId>
</dependency>
<dependency>
<groupId>org.dromara</groupId>
<artifactId>ruoyi-common-idempotent</artifactId>
</dependency>
<dependency>
<groupId>org.dromara</groupId>
<artifactId>ruoyi-common-mybatis</artifactId>
</dependency>
<dependency>
<groupId>org.dromara</groupId>
<artifactId>ruoyi-common-log</artifactId>
</dependency>
<dependency>
<groupId>org.dromara</groupId>
<artifactId>ruoyi-common-excel</artifactId>
</dependency>
<dependency>
<groupId>org.dromara</groupId>
<artifactId>ruoyi-common-security</artifactId>
</dependency>
<dependency>
<groupId>org.dromara</groupId>
<artifactId>ruoyi-common-web</artifactId>
</dependency>
<dependency>
<groupId>org.dromara</groupId>
<artifactId>ruoyi-common-ratelimiter</artifactId>
</dependency>
<dependency>
<groupId>org.dromara</groupId>
<artifactId>ruoyi-common-translation</artifactId>
</dependency>
<dependency>
<groupId>org.dromara</groupId>
<artifactId>ruoyi-common-sensitive</artifactId>
</dependency>
<dependency>
<groupId>org.dromara</groupId>
<artifactId>ruoyi-common-encrypt</artifactId>
</dependency>
<dependency>
<groupId>org.dromara</groupId>
<artifactId>ruoyi-common-tenant</artifactId>
</dependency>
<dependency>
<groupId>org.dromara</groupId>
<artifactId>ruoyi-common-websocket</artifactId>
</dependency>
<dependency>
<groupId>com.taosdata.jdbc</groupId>
<artifactId>taos-jdbcdriver</artifactId>
<version>2.0.40</version>
</dependency>
</dependencies>
</project>

View File

@@ -0,0 +1,3 @@
java包使用 `.` 分割 resource 目录使用 `/` 分割
<br>
此文件目的 防止文件夹粘连找不到 `xml` 文件