灌溉记录的逻辑实现
This commit is contained in:
@@ -0,0 +1,114 @@
|
||||
package com.fastbee.rechargecard.domain;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.fastbee.common.annotation.Excel;
|
||||
import com.fastbee.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 灌溉记录对象 user_irrigation_record
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2024-12-18
|
||||
*/
|
||||
@ApiModel(value = "UserIrrigationRecord",description = "灌溉记录 user_irrigation_record")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class UserIrrigationRecord extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 序号 */
|
||||
private Long id;
|
||||
|
||||
/** 用户id,关联用户 */
|
||||
@Excel(name = "用户id,关联用户")
|
||||
@ApiModelProperty("用户id,关联用户")
|
||||
private Long userId;
|
||||
|
||||
/** 设备编码 */
|
||||
@Excel(name = "设备编码")
|
||||
@ApiModelProperty("设备编码")
|
||||
private String deviceNumber;
|
||||
|
||||
/** 所属项目id */
|
||||
@Excel(name = "所属项目id")
|
||||
@ApiModelProperty("所属项目id")
|
||||
private Long projectId;
|
||||
|
||||
/** 所属机构 */
|
||||
@Excel(name = "所属机构")
|
||||
@ApiModelProperty("所属机构")
|
||||
private Long deptId;
|
||||
|
||||
/** 购水卡号 */
|
||||
@Excel(name = "购水卡号")
|
||||
@ApiModelProperty("购水卡号")
|
||||
private String cardNumber;
|
||||
|
||||
/** 区域号 */
|
||||
@Excel(name = "区域号")
|
||||
@ApiModelProperty("区域号")
|
||||
private String areaCode;
|
||||
|
||||
/** 本次用水量,以立方米为单位 */
|
||||
@Excel(name = "本次用水量,以立方米为单位")
|
||||
@ApiModelProperty("本次用水量,以立方米为单位")
|
||||
private BigDecimal curFlow;
|
||||
|
||||
/** 本次用电量 */
|
||||
@Excel(name = "本次用电量")
|
||||
@ApiModelProperty("本次用电量")
|
||||
private BigDecimal curEle;
|
||||
|
||||
/** 卡内余额 */
|
||||
@Excel(name = "卡内余额")
|
||||
@ApiModelProperty("卡内余额")
|
||||
private BigDecimal balance;
|
||||
|
||||
/** 开泵时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "开泵时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
@ApiModelProperty("开泵时间")
|
||||
private Date startTime;
|
||||
|
||||
/** 关泵时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "关泵时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
@ApiModelProperty("关泵时间")
|
||||
private Date endTime;
|
||||
|
||||
/** 灌溉持续时间 */
|
||||
@Excel(name = "灌溉持续时间")
|
||||
@ApiModelProperty("灌溉持续时间")
|
||||
private BigDecimal duration;
|
||||
|
||||
/** 灌溉时间单位,0=小时、1=天、2=周、3=月、4=季度、5=年 */
|
||||
@Excel(name = "灌溉时间单位,0=小时、1=天、2=周、3=月、4=季度、5=年")
|
||||
@ApiModelProperty("灌溉时间单位,0=小时、1=天、2=周、3=月、4=季度、5=年")
|
||||
private Integer unit;
|
||||
|
||||
/** 灌溉上报时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "灌溉上报时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
@ApiModelProperty("灌溉上报时间")
|
||||
private Date lastTime;
|
||||
|
||||
/** 灌溉状态,1=开始灌溉,2=结束灌溉 */
|
||||
@Excel(name = "灌溉状态,1=开始灌溉,2=结束灌溉")
|
||||
@ApiModelProperty("灌溉状态,1=开始灌溉,2=结束灌溉")
|
||||
private Integer status;
|
||||
|
||||
/** 关于灌溉记录的额外信息或备注 */
|
||||
@Excel(name = "关于灌溉记录的额外信息或备注")
|
||||
@ApiModelProperty("关于灌溉记录的额外信息或备注")
|
||||
private String remarks;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.fastbee.rechargecard.domain.dto;
|
||||
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import com.fastbee.rechargecard.domain.UserIrrigationRecord;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
public class UserIrrigationRecordDto
|
||||
{
|
||||
public String userName;
|
||||
public String deviceName;
|
||||
public String cardNumber;
|
||||
public BigDecimal flow;
|
||||
public Date startTime;
|
||||
public Date endTime;
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package com.fastbee.rechargecard.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.fastbee.rechargecard.domain.UserIrrigationRecord;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 灌溉记录Mapper接口
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2024-12-18
|
||||
*/
|
||||
@Mapper
|
||||
public interface UserIrrigationRecordMapper
|
||||
{
|
||||
/**
|
||||
* 查询用户灌溉记录列表
|
||||
*
|
||||
* @param cardNumber
|
||||
* @return 灌溉记录集合
|
||||
*/
|
||||
public List<UserIrrigationRecord> selectUserIrrigationRecordListBycardNumber(String cardNumber);
|
||||
|
||||
/**
|
||||
* 查询灌溉记录
|
||||
*
|
||||
* @param id 灌溉记录主键
|
||||
* @return 灌溉记录
|
||||
*/
|
||||
public UserIrrigationRecord selectUserIrrigationRecordById(Long id);
|
||||
|
||||
/**
|
||||
* 查询灌溉记录列表
|
||||
*
|
||||
* @param userIrrigationRecord 灌溉记录
|
||||
* @return 灌溉记录集合
|
||||
*/
|
||||
public List<UserIrrigationRecord> selectUserIrrigationRecordList(UserIrrigationRecord userIrrigationRecord);
|
||||
|
||||
/**
|
||||
* 新增灌溉记录
|
||||
*
|
||||
* @param userIrrigationRecord 灌溉记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertUserIrrigationRecord(UserIrrigationRecord userIrrigationRecord);
|
||||
|
||||
/**
|
||||
* 修改灌溉记录
|
||||
*
|
||||
* @param userIrrigationRecord 灌溉记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateUserIrrigationRecord(UserIrrigationRecord userIrrigationRecord);
|
||||
|
||||
/**
|
||||
* 删除灌溉记录
|
||||
*
|
||||
* @param id 灌溉记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteUserIrrigationRecordById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除灌溉记录
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteUserIrrigationRecordByIds(Long[] ids);
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package com.fastbee.rechargecard.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.fastbee.rechargecard.domain.UserIrrigationRecord;
|
||||
import com.fastbee.rechargecard.domain.dto.UserIrrigationRecordDto;
|
||||
|
||||
/**
|
||||
* 灌溉记录Service接口
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2024-12-18
|
||||
*/
|
||||
public interface IUserIrrigationRecordService
|
||||
{
|
||||
/**
|
||||
* 查询用户灌溉展示记录列表
|
||||
*
|
||||
* @param cardNumber 卡号
|
||||
* @return 灌溉记录
|
||||
*/
|
||||
public List<UserIrrigationRecordDto> selectUserIrrigationRecordListShowBycardNumber(String cardNumber);
|
||||
|
||||
/**
|
||||
* 查询用户灌溉记录列表
|
||||
*
|
||||
* @param cardNumber 卡号
|
||||
* @return 灌溉记录
|
||||
*/
|
||||
public List<UserIrrigationRecord> selectUserIrrigationRecordListBycardNumber(String cardNumber);
|
||||
|
||||
/**
|
||||
* 查询灌溉记录
|
||||
*
|
||||
* @param id 灌溉记录主键
|
||||
* @return 灌溉记录
|
||||
*/
|
||||
public UserIrrigationRecord selectUserIrrigationRecordById(Long id);
|
||||
|
||||
/**
|
||||
* 查询灌溉记录列表
|
||||
*
|
||||
* @param userIrrigationRecord 灌溉记录
|
||||
* @return 灌溉记录集合
|
||||
*/
|
||||
public List<UserIrrigationRecord> selectUserIrrigationRecordList(UserIrrigationRecord userIrrigationRecord);
|
||||
|
||||
/**
|
||||
* 新增灌溉记录
|
||||
*
|
||||
* @param userIrrigationRecord 灌溉记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertUserIrrigationRecord(UserIrrigationRecord userIrrigationRecord);
|
||||
|
||||
/**
|
||||
* 修改灌溉记录
|
||||
*
|
||||
* @param userIrrigationRecord 灌溉记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateUserIrrigationRecord(UserIrrigationRecord userIrrigationRecord);
|
||||
|
||||
/**
|
||||
* 批量删除灌溉记录
|
||||
*
|
||||
* @param ids 需要删除的灌溉记录主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteUserIrrigationRecordByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除灌溉记录信息
|
||||
*
|
||||
* @param id 灌溉记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteUserIrrigationRecordById(Long id);
|
||||
}
|
||||
@@ -0,0 +1,140 @@
|
||||
package com.fastbee.rechargecard.service.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import com.fastbee.common.utils.DateUtils;
|
||||
import com.fastbee.iot.mapper.DeviceMapper;
|
||||
import com.fastbee.rechargecard.domain.dto.UserIrrigationRecordDto;
|
||||
import com.fastbee.system.mapper.SysUserMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.fastbee.rechargecard.mapper.UserIrrigationRecordMapper;
|
||||
import com.fastbee.rechargecard.domain.UserIrrigationRecord;
|
||||
import com.fastbee.rechargecard.service.IUserIrrigationRecordService;
|
||||
|
||||
/**
|
||||
* 灌溉记录Service业务层处理
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2024-12-18
|
||||
*/
|
||||
@Service
|
||||
public class UserIrrigationRecordServiceImpl implements IUserIrrigationRecordService
|
||||
{
|
||||
@Autowired
|
||||
private UserIrrigationRecordMapper userIrrigationRecordMapper;
|
||||
@Autowired
|
||||
private SysUserMapper sysUserMapper;
|
||||
@Autowired
|
||||
private DeviceMapper deviceMapper;
|
||||
|
||||
/**
|
||||
* 获取用户灌溉记录列表
|
||||
* @param cardNumber 卡号
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<UserIrrigationRecord> selectUserIrrigationRecordListBycardNumber(String cardNumber)
|
||||
{
|
||||
return userIrrigationRecordMapper.selectUserIrrigationRecordListBycardNumber(cardNumber);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户灌溉记录展示数据列表
|
||||
* @param cardNumber 卡号
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<UserIrrigationRecordDto> selectUserIrrigationRecordListShowBycardNumber(String cardNumber)
|
||||
{
|
||||
List<UserIrrigationRecordDto> result=new ArrayList<>();
|
||||
List<UserIrrigationRecord> list=userIrrigationRecordMapper.selectUserIrrigationRecordListBycardNumber(cardNumber);
|
||||
for(int i=0;i<list.size();i++)
|
||||
{
|
||||
UserIrrigationRecordDto temp=new UserIrrigationRecordDto();
|
||||
temp.userName= sysUserMapper.selectUserById(list.get(i).getUserId()).getUserName();
|
||||
temp.deviceName=deviceMapper.selectDeviceBySerialNumber(list.get(i).getDeviceNumber()).getDeviceName();
|
||||
temp.cardNumber=list.get(i).getCardNumber();
|
||||
temp.flow=list.get(i).getCurFlow();
|
||||
temp.startTime=list.get(i).getStartTime();
|
||||
temp.endTime=list.get(i).getEndTime();
|
||||
result.add(temp);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询灌溉记录
|
||||
*
|
||||
* @param id 灌溉记录主键
|
||||
* @return 灌溉记录
|
||||
*/
|
||||
@Override
|
||||
public UserIrrigationRecord selectUserIrrigationRecordById(Long id)
|
||||
{
|
||||
return userIrrigationRecordMapper.selectUserIrrigationRecordById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询灌溉记录列表
|
||||
*
|
||||
* @param userIrrigationRecord 灌溉记录
|
||||
* @return 灌溉记录
|
||||
*/
|
||||
@Override
|
||||
public List<UserIrrigationRecord> selectUserIrrigationRecordList(UserIrrigationRecord userIrrigationRecord)
|
||||
{
|
||||
return userIrrigationRecordMapper.selectUserIrrigationRecordList(userIrrigationRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增灌溉记录
|
||||
*
|
||||
* @param userIrrigationRecord 灌溉记录
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertUserIrrigationRecord(UserIrrigationRecord userIrrigationRecord)
|
||||
{
|
||||
userIrrigationRecord.setCreateTime(DateUtils.getNowDate());
|
||||
return userIrrigationRecordMapper.insertUserIrrigationRecord(userIrrigationRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改灌溉记录
|
||||
*
|
||||
* @param userIrrigationRecord 灌溉记录
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateUserIrrigationRecord(UserIrrigationRecord userIrrigationRecord)
|
||||
{
|
||||
userIrrigationRecord.setUpdateTime(DateUtils.getNowDate());
|
||||
return userIrrigationRecordMapper.updateUserIrrigationRecord(userIrrigationRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除灌溉记录
|
||||
*
|
||||
* @param ids 需要删除的灌溉记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteUserIrrigationRecordByIds(Long[] ids)
|
||||
{
|
||||
return userIrrigationRecordMapper.deleteUserIrrigationRecordByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除灌溉记录信息
|
||||
*
|
||||
* @param id 灌溉记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteUserIrrigationRecordById(Long id)
|
||||
{
|
||||
return userIrrigationRecordMapper.deleteUserIrrigationRecordById(id);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user