灌溉逻辑+修改充值记录接口添加了时间检索

This commit is contained in:
2024-12-31 16:52:55 +08:00
parent 48b18a9e8b
commit aba6f51ea7
17 changed files with 431 additions and 12 deletions

View File

@ -111,4 +111,15 @@ public class UserIrrigationRecord extends BaseEntity
@ApiModelProperty("关于灌溉记录的额外信息或备注")
private String remarks;
/** 开阀时用户累计用水量,以立方米为单位 */
@Excel(name = "开阀时用户累计用水量,以立方米为单位")
@ApiModelProperty("开阀时用户累计用水量,以立方米为单位")
private BigDecimal openCumFlow;
/** 本次用水量,以立方米为单位 */
@Excel(name = "关阀时用户累计用水量,以立方米为单位")
@ApiModelProperty("关阀时用户累计用水量,以立方米为单位")
private BigDecimal closeCumFlow;
}

View File

@ -0,0 +1,95 @@
package com.fastbee.rechargecard.domain.dto;
import cn.hutool.core.date.DateTime;
import com.fastbee.common.annotation.Excel;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
@Data
public class NgUserRechargeRecordsDto {
/** 主键ID */
private Long id;
/** 用户id与用户表连接 */
@Excel(name = "用户id与用户表连接")
@ApiModelProperty("用户id与用户表连接")
private Long userId;
/** 用户名 */
@Excel(name = "用户名")
@ApiModelProperty("用户名")
private String userName;
/** 充值卡号 */
@Excel(name = "充值卡号")
@ApiModelProperty("充值卡号")
private String cardNumber;
/** 区域号 */
@Excel(name = "区域号")
@ApiModelProperty("区域号")
private String areaCode;
/** 充值类型0=充值机1=微信2=支付宝 */
@Excel(name = "充值类型0=充值机1=微信2=支付宝")
@ApiModelProperty("充值类型0=充值机1=微信2=支付宝")
private Integer type;
/** 充值金额 */
@Excel(name = "充值金额")
@ApiModelProperty("充值金额")
private BigDecimal amount;
/** 卡内余额(充值后余额) */
@Excel(name = "卡内余额", readConverterExp = "充=值后余额")
@ApiModelProperty("卡内余额")
private BigDecimal balance;
/** 充值时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "充值时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty("充值时间")
private Date rechargeTime;
/** 充值编码 */
@Excel(name = "充值编码")
@ApiModelProperty("充值编码")
private String rechargeCode;
/** 充值状态,0=成功1=失败 */
@Excel(name = "充值状态,0=成功1=失败")
@ApiModelProperty("充值状态,0=成功1=失败")
private Integer status;
/** 充值机编码 */
@Excel(name = "充值机编码")
@ApiModelProperty("充值机编码")
private String serialNumber;
/** 设备编码 */
@Excel(name = "设备编码")
@ApiModelProperty("设备编码")
private String deviceNumber;
/** 项目编码 */
@Excel(name = "项目编码")
@ApiModelProperty("项目编码")
private Long projectId;
/** 机构id */
@Excel(name = "机构id")
@ApiModelProperty("机构id")
private Long deptId;
/**
* 检索时间段开始时间
*/
private Date startTime;
/**
* 检索时间段结束时间
*/
private Date endTime;
}

View File

@ -0,0 +1,112 @@
package com.fastbee.rechargecard.domain.dto;
import com.fastbee.common.annotation.Excel;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import java.math.BigDecimal;
import java.util.Date;
public class UserIrrigationRecordListDto {
/** 序号 */
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 HH:MM:SS")
@Excel(name = "开泵时间", width = 30, dateFormat = "yyyy-MM-dd")
@ApiModelProperty("开泵时间")
private Date startTime;
/** 关泵时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:MM:SS")
@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;
/** 开阀时用户累计用水量,以立方米为单位 */
@Excel(name = "开阀时用户累计用水量,以立方米为单位")
@ApiModelProperty("开阀时用户累计用水量,以立方米为单位")
private BigDecimal openCumFlow;
/** 本次用水量,以立方米为单位 */
@Excel(name = "关阀时用户累计用水量,以立方米为单位")
@ApiModelProperty("关阀时用户累计用水量,以立方米为单位")
private BigDecimal closeCumFlow;
/**
* 根据时间段查询的开始时间
*/
private Date searchStartTime;
private Date searchEndTime;
}

View File

@ -4,6 +4,7 @@ import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fastbee.rechargecard.domain.NgUserRechargeRecords;
import com.fastbee.rechargecard.domain.dto.NgUserRechargeRecordsDto;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
@ -16,6 +17,8 @@ import org.apache.ibatis.annotations.Select;
@Mapper
public interface NgUserRechargeRecordsMapper extends BaseMapper<NgUserRechargeRecords>
{
public List<NgUserRechargeRecords> selectNgUserRechargeRecordsListByTime(NgUserRechargeRecordsDto ngUserRechargeRecordsDto);
/**
* 根据订单号查询充值记录
* @param rechargeCode

View File

@ -3,6 +3,7 @@ package com.fastbee.rechargecard.mapper;
import java.util.List;
import com.fastbee.rechargecard.domain.UserIrrigationRecord;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
/**
* 灌溉记录Mapper接口
@ -13,6 +14,14 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface UserIrrigationRecordMapper
{
/**
* 根据卡号和设备编码获取最新的灌溉中的灌溉记录
* @param cardNumber
* @param deviceNumber
* @return
*/
@Select("select * from user_irrigation_record where card_number=#{cardNumber} AND device_number=#{deviceNumber} AND status=1 order by create_time desc ")
public List<UserIrrigationRecord> selectUserIrrigationRecordListBycardNumberAndDeviceNumber(String cardNumber,String deviceNumber);
/**
* 查询单用户灌溉记录列表
*

View File

@ -2,6 +2,7 @@ package com.fastbee.rechargecard.service;
import java.util.List;
import com.fastbee.rechargecard.domain.NgUserRechargeRecords;
import com.fastbee.rechargecard.domain.dto.NgUserRechargeRecordsDto;
import com.fastbee.rechargecard.domain.dto.RechargecardUser;
import com.fastbee.rechargecard.domain.dto.WeChatRecharge;
import com.fastbee.rechargecard.mapper.NgUserRechargeRecordsMapper;
@ -14,6 +15,14 @@ import com.fastbee.rechargecard.mapper.NgUserRechargeRecordsMapper;
*/
public interface INgUserRechargeRecordsService
{
/**
* 查询用户充值记录列表
*
* @param ngUserRechargeRecords 用户充值记录
* @return 用户充值记录集合
*/
public List<NgUserRechargeRecords> selectNgUserRechargeRecordsListByTime(NgUserRechargeRecordsDto ngUserRechargeRecords);
/**
* 根据订单编号查找充值记录
* @param rechargeCode

View File

@ -14,6 +14,15 @@ import com.fastbee.rechargecard.domain.dto.UserIrrigationRecordDto;
*/
public interface IUserIrrigationRecordService
{
/**
* 查询灌溉记录列表
*
* @param userIrrigationRecord 灌溉记录
* @return 灌溉记录集合
*//*
public List<UserIrrigationRecord> selectUserIrrigationRecordListByTime(UserIrrigationRecord userIrrigationRecord);*/
/**
* 查询用户灌溉展示记录列表
*

View File

@ -1,6 +1,7 @@
package com.fastbee.rechargecard.service;
import com.fastbee.rechargecard.domain.UserRechargeCards;
import com.fastbee.rechargecard.domain.dto.WeChatPlatformCertificate;
import com.fastbee.rechargecard.domain.dto.WeChatRecharge;
import java.io.IOException;
@ -25,7 +26,7 @@ public interface IUserWechatPayService {
/**
* 获取平台证书
*/
public Map<String,Object> getPlatformCertificat(String mchId,String privateKey,String serial_no,String apiV3Key);
public Map<String,Object> getPlatformCertificat(WeChatPlatformCertificate weChatPlatformCertificate);
}

View File

@ -5,6 +5,7 @@ import java.util.List;
import com.fastbee.common.exception.ServiceException;
import com.fastbee.common.utils.DateUtils;
import com.fastbee.rechargecard.domain.UserRechargeCards;
import com.fastbee.rechargecard.domain.dto.NgUserRechargeRecordsDto;
import com.fastbee.rechargecard.domain.dto.RechargecardUser;
import com.fastbee.rechargecard.domain.dto.WeChatRecharge;
import com.fastbee.rechargecard.mapper.UserRechargeCardsMapper;
@ -28,6 +29,11 @@ public class NgUserRechargeRecordsServiceImpl implements INgUserRechargeRecordsS
@Autowired
private UserRechargeCardsMapper userRechargeCardsMapper;
@Override
public List<NgUserRechargeRecords> selectNgUserRechargeRecordsListByTime(NgUserRechargeRecordsDto ngUserRechargeRecords) {
return ngUserRechargeRecordsMapper.selectNgUserRechargeRecordsListByTime(ngUserRechargeRecords);
}
@Override
public NgUserRechargeRecords SelectRechargeRecodeByRechargeCode(String rechargeCode) {
return ngUserRechargeRecordsMapper.SelectRechargeRecodeByRechargeCode(rechargeCode);

View File

@ -33,6 +33,7 @@ public class UserIrrigationRecordServiceImpl implements IUserIrrigationRecordSer
private NgIrrigationControllersMapper ngIrrigationControllersMapper;
@Override
public List<UserIrrigationRecordDto> selectUserIrrigationRecordShowListByCardNumber(UserIrrigationRecord userIrrigationRecord) {
List<UserIrrigationRecordDto> result=new ArrayList<>();

View File

@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.fastbee.common.utils.pay.AesUtil;
import com.fastbee.common.utils.pay.wxPayConfig;
import com.fastbee.rechargecard.domain.NgMerchants;
import com.fastbee.rechargecard.domain.dto.WeChatPlatformCertificate;
import com.fastbee.rechargecard.domain.dto.WeChatRecharge;
import com.fastbee.rechargecard.mapper.NgMerchantsMapper;
import com.fastbee.rechargecard.service.IUserWechatPayService;
@ -207,13 +208,13 @@ public class UserWechatPayServiceImpl implements IUserWechatPayService {
* @return
*/
@Override
public Map<String,Object> getPlatformCertificat(String mchId,String privateKey,String serial_no,String apiV3Key)
public Map<String,Object> getPlatformCertificat(WeChatPlatformCertificate weChatPlatformCertificate)
{
String url="https://api.mch.weixin.qq.com/v3/certificates";
try (CloseableHttpClient httpClient = HttpClients.createDefault()) {
HttpGet httpGet = new HttpGet(url);
//生成签名
Map<String,String> signResult=getSign(null,"GET","/v3/certificates",privateKey);
Map<String,String> signResult=getSign(null,"GET","/v3/certificates",weChatPlatformCertificate.getPrivateKey());
Set<String> keySet2 = signResult.keySet();
// 遍历键集合
for (String key : keySet2) {
@ -222,7 +223,7 @@ public class UserWechatPayServiceImpl implements IUserWechatPayService {
String sign=signResult.get("sign").toString();
String nonce_str=signResult.get("nonce_str").toString();
String timeStamp=signResult.get("timeStamp").toString();
String Authorization="WECHATPAY2-SHA256-RSA2048 mchid=\""+mchId+"\",nonce_str=\""+nonce_str+"\",signature=\""+sign+"\",timestamp=\""+timeStamp+"\",serial_no=\""+serial_no+"\"";
String Authorization="WECHATPAY2-SHA256-RSA2048 mchid=\""+weChatPlatformCertificate.getMchId()+"\",nonce_str=\""+nonce_str+"\",signature=\""+sign+"\",timestamp=\""+timeStamp+"\",serial_no=\""+weChatPlatformCertificate.getSerial_no()+"\"";
System.err.println(Authorization);
httpGet.setHeader("Accept", "application/json");
httpGet.setHeader("Authorization",Authorization);
@ -257,7 +258,7 @@ public class UserWechatPayServiceImpl implements IUserWechatPayService {
//使用apiv3key解密
String decryptData="";
try{
decryptData= new AesUtil(apiV3Key.getBytes(StandardCharsets.UTF_8)).decryptToString
decryptData= new AesUtil(weChatPlatformCertificate.getApiV3Key().getBytes(StandardCharsets.UTF_8)).decryptToString
(associated_data.getBytes(StandardCharsets.UTF_8),
nonce.getBytes(StandardCharsets.UTF_8),
ciphertext);
@ -267,7 +268,7 @@ public class UserWechatPayServiceImpl implements IUserWechatPayService {
System.out.println("解密失败");
}
Map<String,Object> result=new HashMap<>();
result.put("platformCertificate",responseMap.toString());
result.put("platformCertificate",decryptData.toString());
result.put("serial",serial);
Set<String> keys=result.keySet();
for(String key : keys)

View File

@ -32,6 +32,30 @@
from ng_user_recharge_records
</sql>
<select id="selectNgUserRechargeRecordsListByTime" parameterType="NgUserRechargeRecordsDto" resultMap="NgUserRechargeRecordsResult">
<include refid="selectNgUserRechargeRecordsVo"/>
<where>
<if test="startTime !=null and endTime!=null">and recharge_time between #{startTime} and #{endTime}</if>
<if test="userId != null "> and user_id = #{userId}</if>
<if test="userName != null and userName != ''"> and user_name like concat('%', #{userName}, '%')</if>
<if test="cardNumber != null and cardNumber != ''"> and card_number = #{cardNumber}</if>
<if test="areaCode != null and areaCode != ''"> and area_code = #{areaCode}</if>
<if test="type != null "> and type = #{type}</if>
<if test="amount != null "> and amount = #{amount}</if>
<if test="balance != null "> and balance = #{balance}</if>
<if test="rechargeTime != null "> and recharge_time = #{rechargeTime}</if>
<if test="rechargeCode != null and rechargeCode != ''"> and recharge_code = #{rechargeCode}</if>
<if test="status != null "> and status = #{status}</if>
<if test="serialNumber != null and serialNumber != ''"> and serial_number = #{serialNumber}</if>
<if test="deviceNumber != null and deviceNumber != ''"> and device_number = #{deviceNumber}</if>
<if test="projectId != null "> and project_id = #{projectId}</if>
<if test="deptId != null "> and dept_id = #{deptId}</if>
</where>
<!-- 添加排序 -->
order by recharge_time desc
</select>
<select id="selectNgUserRechargeRecordsList" parameterType="NgUserRechargeRecords" resultMap="NgUserRechargeRecordsResult">
<include refid="selectNgUserRechargeRecordsVo"/>
<where>

View File

@ -26,15 +26,18 @@
<result property="updateTime" column="update_time" />
<result property="createBy" column="create_by" />
<result property="updateBy" column="update_by" />
<result property="openCumFlow" column="open_cum_flow" />
<result property="closeCumFlow" column="close_cum_flow" />
</resultMap>
<sql id="selectUserIrrigationRecordVo">
select id, user_id, device_number, project_id, dept_id, card_number, area_code, cur_flow, cur_ele, balance, start_time, end_time, duration, unit, last_time, status, remarks, create_time, update_time, create_by, update_by from user_irrigation_record
select id, user_id, device_number, project_id, dept_id, card_number, area_code, cur_flow, cur_ele, balance, start_time, end_time, duration, unit, last_time, status, remarks, create_time, update_time, create_by, update_by,open_cum_flow,close_cum_flow from user_irrigation_record
</sql>
<select id="selectUserIrrigationRecordList" parameterType="UserIrrigationRecord" resultMap="UserIrrigationRecordResult">
<include refid="selectUserIrrigationRecordVo"/>
<where>
<if test="id != null "> and id = #{id}</if>
<if test="userId != null "> and user_id = #{userId}</if>
<if test="deviceNumber != null and deviceNumber != ''"> and device_number = #{deviceNumber}</if>
<if test="projectId != null "> and project_id = #{projectId}</if>
@ -51,6 +54,8 @@
<if test="lastTime != null "> and last_time = #{lastTime}</if>
<if test="status != null "> and status = #{status}</if>
<if test="remarks != null and remarks != ''"> and remarks = #{remarks}</if>
<if test="openCumFlow != null "> and open_cum_flow = #{openCumFlow}</if>
<if test="closeCumFlow != null "> and close_cum_flow = #{closeCumFlow}</if>
</where>
</select>
@ -108,6 +113,8 @@
<if test="updateTime != null">update_time,</if>
<if test="createBy != null">create_by,</if>
<if test="updateBy != null">update_by,</if>
<if test="openCumFlow != null">open_cum_flow,</if>
<if test="closeCumFlow != null">close_cum_flow,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="userId != null">#{userId},</if>
@ -130,6 +137,8 @@
<if test="updateTime != null">#{updateTime},</if>
<if test="createBy != null">#{createBy},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="openCumFlow != null">#{openCumFlow},</if>
<if test="closeCumFlow != null">#{closeCumFlow},</if>
</trim>
</insert>
@ -156,6 +165,8 @@
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="openCumFlow != null">open_cum_flow = #{openCumFlow},</if>
<if test="closeCumFlow != null">close_cum_flow = #{closeCumFlow},</if>
</trim>
where id = #{id}
</update>