灌溉控制器逻辑实现

This commit is contained in:
ALEI_ALEI
2024-12-19 18:19:55 +08:00
parent 45535a73bf
commit 4ca8da41df
16 changed files with 583 additions and 31 deletions

View File

@@ -0,0 +1,67 @@
package com.fastbee.rechargecard.domain;
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;
/**
* 灌溉控制器信息对象 ng_irrigation_controllers
*
* @author kerwincui
* @date 2024-12-19
*/
@ApiModel(value = "NgIrrigationControllers",description = "灌溉控制器信息 ng_irrigation_controllers")
@Data
@EqualsAndHashCode(callSuper = true)
public class NgIrrigationControllers extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键ID */
private Long id;
/** 控制器编码 */
@Excel(name = "控制器编码")
@ApiModelProperty("控制器编码")
private String serialNumber;
/** 控制器名称 */
@Excel(name = "控制器名称")
@ApiModelProperty("控制器名称")
private String controllerName;
/** 控制器型号 */
@Excel(name = "控制器型号")
@ApiModelProperty("控制器型号")
private String controllerModel;
/** 安装日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "安装日期", width = 30, dateFormat = "yyyy-MM-dd")
@ApiModelProperty("安装日期")
private Date installationDate;
/** 控制器状态,0=开启1=关闭2=维护中 */
@Excel(name = "控制器状态,0=开启1=关闭2=维护中")
@ApiModelProperty("控制器状态,0=开启1=关闭2=维护中")
private Integer status;
/** 上次维护日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "上次维护日期", width = 30, dateFormat = "yyyy-MM-dd")
@ApiModelProperty("上次维护日期")
private Date lastMaintenance;
/** 区域码 */
@Excel(name = "区域码")
@ApiModelProperty("区域码")
private String areaCode;
}

View File

@@ -68,9 +68,9 @@ public class NgRechargeMachines extends BaseEntity
@ApiModelProperty("联系电话")
private String contactPhone;
/** 备注 */
@Excel(name = "备注")
@ApiModelProperty("备注")
private String remark;
/** 充值机名称 */
@Excel(name = "充值机名称")
@ApiModelProperty("充值机名称")
private String deviceName;
}

View File

@@ -79,14 +79,9 @@ public class NgUserRechargeRecords extends BaseEntity
@ApiModelProperty("充值状态,0=成功1=失败")
private Integer status;
/** 充值机id */
@Excel(name = "充值机id")
@ApiModelProperty("充值机id")
private Long deviceId;
/** 备注 */
@Excel(name = "备注")
@ApiModelProperty("备注")
private String remark;
/** 充值机编码 */
@Excel(name = "充值机编码")
@ApiModelProperty("充值机编码")
private String serialNumber;
}

View File

@@ -99,19 +99,19 @@ public class UserConsumptionDetails extends BaseEntity
private BigDecimal billingPeriodDuration;
/** 账单生成的日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd HH:MM:SS")
@Excel(name = "账单生成的日期", width = 30, dateFormat = "yyyy-MM-dd")
@ApiModelProperty("账单生成的日期")
private Date billingDate;
/** 开泵时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd HH:MM:SS")
@Excel(name = "开泵时间", width = 30, dateFormat = "yyyy-MM-dd")
@ApiModelProperty("开泵时间")
private Date startTime;
/** 关泵时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd HH:MM:SS")
@Excel(name = "关泵时间", width = 30, dateFormat = "yyyy-MM-dd")
@ApiModelProperty("关泵时间")
private Date endTime;
@@ -127,7 +127,7 @@ public class UserConsumptionDetails extends BaseEntity
private Integer paymentMethod;
/** 账单支付的时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd HH:MM:SS")
@Excel(name = " 账单支付的时间", width = 30, dateFormat = "yyyy-MM-dd")
@ApiModelProperty(" 账单支付的时间")
private Date paymentTime;

View File

@@ -74,13 +74,13 @@ public class UserIrrigationRecord extends BaseEntity
private BigDecimal balance;
/** 开泵时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd HH:MM:SS")
@Excel(name = "开泵时间", width = 30, dateFormat = "yyyy-MM-dd")
@ApiModelProperty("开泵时间")
private Date startTime;
/** 关泵时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd HH:MM:SS")
@Excel(name = "关泵时间", width = 30, dateFormat = "yyyy-MM-dd")
@ApiModelProperty("关泵时间")
private Date endTime;

View File

@@ -2,6 +2,7 @@ package com.fastbee.rechargecard.domain.dto;
import cn.hutool.core.date.DateTime;
import com.fastbee.rechargecard.domain.UserIrrigationRecord;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.math.BigDecimal;
import java.util.Date;
@@ -13,6 +14,8 @@ public class UserIrrigationRecordDto
public String deviceName;
public String cardNumber;
public BigDecimal flow;
@JsonFormat(pattern = "yyyy-MM-dd HH:MM:SS")
public Date startTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:MM:SS")
public Date endTime;
}

View File

@@ -0,0 +1,63 @@
package com.fastbee.rechargecard.mapper;
import java.util.List;
import com.fastbee.rechargecard.domain.NgIrrigationControllers;
import org.apache.ibatis.annotations.Mapper;
/**
* 灌溉控制器信息Mapper接口
*
* @author kerwincui
* @date 2024-12-19
*/
@Mapper
public interface NgIrrigationControllersMapper
{
/**
* 查询灌溉控制器信息
*
* @param id 灌溉控制器信息主键
* @return 灌溉控制器信息
*/
public NgIrrigationControllers selectNgIrrigationControllersById(Long id);
/**
* 查询灌溉控制器信息列表
*
* @param ngIrrigationControllers 灌溉控制器信息
* @return 灌溉控制器信息集合
*/
public List<NgIrrigationControllers> selectNgIrrigationControllersList(NgIrrigationControllers ngIrrigationControllers);
/**
* 新增灌溉控制器信息
*
* @param ngIrrigationControllers 灌溉控制器信息
* @return 结果
*/
public int insertNgIrrigationControllers(NgIrrigationControllers ngIrrigationControllers);
/**
* 修改灌溉控制器信息
*
* @param ngIrrigationControllers 灌溉控制器信息
* @return 结果
*/
public int updateNgIrrigationControllers(NgIrrigationControllers ngIrrigationControllers);
/**
* 删除灌溉控制器信息
*
* @param id 灌溉控制器信息主键
* @return 结果
*/
public int deleteNgIrrigationControllersById(Long id);
/**
* 批量删除灌溉控制器信息
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteNgIrrigationControllersByIds(Long[] ids);
}

View File

@@ -0,0 +1,61 @@
package com.fastbee.rechargecard.service;
import java.util.List;
import com.fastbee.rechargecard.domain.NgIrrigationControllers;
/**
* 灌溉控制器信息Service接口
*
* @author kerwincui
* @date 2024-12-19
*/
public interface INgIrrigationControllersService
{
/**
* 查询灌溉控制器信息
*
* @param id 灌溉控制器信息主键
* @return 灌溉控制器信息
*/
public NgIrrigationControllers selectNgIrrigationControllersById(Long id);
/**
* 查询灌溉控制器信息列表
*
* @param ngIrrigationControllers 灌溉控制器信息
* @return 灌溉控制器信息集合
*/
public List<NgIrrigationControllers> selectNgIrrigationControllersList(NgIrrigationControllers ngIrrigationControllers);
/**
* 新增灌溉控制器信息
*
* @param ngIrrigationControllers 灌溉控制器信息
* @return 结果
*/
public int insertNgIrrigationControllers(NgIrrigationControllers ngIrrigationControllers);
/**
* 修改灌溉控制器信息
*
* @param ngIrrigationControllers 灌溉控制器信息
* @return 结果
*/
public int updateNgIrrigationControllers(NgIrrigationControllers ngIrrigationControllers);
/**
* 批量删除灌溉控制器信息
*
* @param ids 需要删除的灌溉控制器信息主键集合
* @return 结果
*/
public int deleteNgIrrigationControllersByIds(Long[] ids);
/**
* 删除灌溉控制器信息信息
*
* @param id 灌溉控制器信息主键
* @return 结果
*/
public int deleteNgIrrigationControllersById(Long id);
}

View File

@@ -20,6 +20,14 @@ public interface IUserIrrigationRecordService
*/
//public List<UserIrrigationRecordDto> selectUserIrrigationRecordListShowBycardNumber(String cardNumber);
/**
* 查询展示灌溉记录列表
*
* @param userIrrigationRecord 灌溉记录
* @return 灌溉记录集合
*/
public List<UserIrrigationRecordDto> selectUserIrrigationRecordShowList(UserIrrigationRecord userIrrigationRecord);
/**
* 查询用户灌溉记录列表
*

View File

@@ -0,0 +1,96 @@
package com.fastbee.rechargecard.service.impl;
import java.util.List;
import com.fastbee.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.fastbee.rechargecard.mapper.NgIrrigationControllersMapper;
import com.fastbee.rechargecard.domain.NgIrrigationControllers;
import com.fastbee.rechargecard.service.INgIrrigationControllersService;
/**
* 灌溉控制器信息Service业务层处理
*
* @author kerwincui
* @date 2024-12-19
*/
@Service
public class NgIrrigationControllersServiceImpl implements INgIrrigationControllersService
{
@Autowired
private NgIrrigationControllersMapper ngIrrigationControllersMapper;
/**
* 查询灌溉控制器信息
*
* @param id 灌溉控制器信息主键
* @return 灌溉控制器信息
*/
@Override
public NgIrrigationControllers selectNgIrrigationControllersById(Long id)
{
return ngIrrigationControllersMapper.selectNgIrrigationControllersById(id);
}
/**
* 查询灌溉控制器信息列表
*
* @param ngIrrigationControllers 灌溉控制器信息
* @return 灌溉控制器信息
*/
@Override
public List<NgIrrigationControllers> selectNgIrrigationControllersList(NgIrrigationControllers ngIrrigationControllers)
{
return ngIrrigationControllersMapper.selectNgIrrigationControllersList(ngIrrigationControllers);
}
/**
* 新增灌溉控制器信息
*
* @param ngIrrigationControllers 灌溉控制器信息
* @return 结果
*/
@Override
public int insertNgIrrigationControllers(NgIrrigationControllers ngIrrigationControllers)
{
ngIrrigationControllers.setCreateTime(DateUtils.getNowDate());
return ngIrrigationControllersMapper.insertNgIrrigationControllers(ngIrrigationControllers);
}
/**
* 修改灌溉控制器信息
*
* @param ngIrrigationControllers 灌溉控制器信息
* @return 结果
*/
@Override
public int updateNgIrrigationControllers(NgIrrigationControllers ngIrrigationControllers)
{
ngIrrigationControllers.setUpdateTime(DateUtils.getNowDate());
return ngIrrigationControllersMapper.updateNgIrrigationControllers(ngIrrigationControllers);
}
/**
* 批量删除灌溉控制器信息
*
* @param ids 需要删除的灌溉控制器信息主键
* @return 结果
*/
@Override
public int deleteNgIrrigationControllersByIds(Long[] ids)
{
return ngIrrigationControllersMapper.deleteNgIrrigationControllersByIds(ids);
}
/**
* 删除灌溉控制器信息信息
*
* @param id 灌溉控制器信息主键
* @return 结果
*/
@Override
public int deleteNgIrrigationControllersById(Long id)
{
return ngIrrigationControllersMapper.deleteNgIrrigationControllersById(id);
}
}

View File

@@ -1,5 +1,6 @@
package com.fastbee.rechargecard.service.impl;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import com.fastbee.common.utils.DateUtils;
@@ -28,6 +29,26 @@ public class UserIrrigationRecordServiceImpl implements IUserIrrigationRecordSer
@Autowired
private DeviceMapper deviceMapper;
@Override
public List<UserIrrigationRecordDto> selectUserIrrigationRecordShowList(UserIrrigationRecord userIrrigationRecord) {
List<UserIrrigationRecordDto> result=new ArrayList<>();
List<UserIrrigationRecord> list=userIrrigationRecordMapper.selectUserIrrigationRecordList(userIrrigationRecord);
for(int i=0;i<list.size();i++)
{
UserIrrigationRecordDto temp=new UserIrrigationRecordDto();
temp.id=list.get(i).getId();
temp.userName= sysUserMapper.selectUserById(list.get(i).getUserId()).getUserName()==null ? "" :sysUserMapper.selectUserById(list.get(i).getUserId()).getUserName();
temp.deviceName=deviceMapper.selectDeviceBySerialNumber(list.get(i).getDeviceNumber()).getDeviceName() == null ? "":deviceMapper.selectDeviceBySerialNumber(list.get(i).getDeviceNumber()).getDeviceName();
temp.cardNumber=list.get(i).getCardNumber() == null ? "" : list.get(i).getCardNumber();
temp.flow=list.get(i).getCurFlow()==null ? BigDecimal.valueOf(0) :list.get(i).getCurFlow();
temp.startTime=list.get(i).getStartTime()==null ? null : list.get(i).getStartTime();
temp.endTime=list.get(i).getEndTime()==null ? null :list.get(0).getEndTime();
result.add(temp);
}
return result;
}
/**
* 获取用户灌溉记录列表
* @param cardNumber 卡号