灌溉逻辑+修改充值记录接口添加了时间检索
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
package com.fastbee.mq.redischannel.consumer;
|
||||
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.baomidou.mybatisplus.extension.conditions.update.LambdaUpdateChainWrapper;
|
||||
@ -12,14 +13,20 @@ import com.fastbee.mq.service.impl.DeviceOtherMsgHandler;
|
||||
import com.fastbee.mqttclient.PubMqttClient;
|
||||
import com.fastbee.rechargecard.domain.NgUserRechargeRecords;
|
||||
import com.fastbee.rechargecard.domain.NgWaterPumpUsageRecords;
|
||||
import com.fastbee.rechargecard.domain.UserIrrigationRecord;
|
||||
import com.fastbee.rechargecard.mapper.NgUserRechargeRecordsMapper;
|
||||
import com.fastbee.rechargecard.mapper.NgWaterPumpUsageRecordsMapper;
|
||||
import com.fastbee.rechargecard.mapper.UserIrrigationRecordMapper;
|
||||
import com.fastbee.rechargecard.mapper.UserRechargeCardsMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.h2.engine.User;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
@ -50,6 +57,12 @@ public class DeviceOtherMsgConsumer {
|
||||
@Autowired
|
||||
private NgUserRechargeRecordsMapper ngUserRechargeRecordsMapper;
|
||||
|
||||
@Autowired
|
||||
private UserIrrigationRecordMapper userIrrigationRecordMapper;
|
||||
|
||||
@Autowired
|
||||
private UserRechargeCardsMapper userRechargeCardsMapper;
|
||||
|
||||
@Autowired
|
||||
private StringRedisTemplate stringRedisTemplate;
|
||||
|
||||
@ -70,7 +83,8 @@ public class DeviceOtherMsgConsumer {
|
||||
//从主题中解析出设备序列号
|
||||
String serialNumber= split[2];//设备序列号
|
||||
|
||||
// System.err.println("主题:"+topic+"--产品id:"+productId+"--设备序列号:"+serialNumber);
|
||||
System.err.println("主题:"+topic+"--产品id:"+productId+"--设备序列号:"+serialNumber);
|
||||
System.err.println(topic.endsWith("/info/up"));
|
||||
//设备上报数据消息---------------------------------------------------------------------------------
|
||||
if(topic.endsWith("/info/up")){
|
||||
deviceDataReportHandler(new String(data));
|
||||
@ -112,6 +126,74 @@ public class DeviceOtherMsgConsumer {
|
||||
if(i<1){
|
||||
System.err.println("--------------------------保存使用记录失败!---------------------------");
|
||||
}
|
||||
JSONObject dataJson=jsonObject.getJSONObject("data");
|
||||
System.err.println(jsonObject);
|
||||
System.err.println(dataJson);
|
||||
if(JSONUtil.parseObj(data1).get("action").equals("startPump"))
|
||||
{
|
||||
System.err.println("开阀");
|
||||
//开阀-添加灌溉记录
|
||||
UserIrrigationRecord userIrrigationRecord=new UserIrrigationRecord();
|
||||
userIrrigationRecord.setDeviceNumber(serialNumber);//设备编码
|
||||
System.err.println("serialNumber"+serialNumber);
|
||||
|
||||
String cardNumber= String.valueOf(dataJson.getInt("cardId"));//解析cardId
|
||||
userIrrigationRecord.setCardNumber(cardNumber);//卡号
|
||||
System.err.println("cardNumber"+cardNumber);
|
||||
|
||||
/*Long userId=null;
|
||||
System.err.println("userId");
|
||||
if(userRechargeCardsMapper.selectUserRechargeCardsByCardNumber(cardNumber)==null)
|
||||
{
|
||||
throw new Exception("订单信息不存在");
|
||||
}
|
||||
userId=userRechargeCardsMapper.selectUserRechargeCardsByCardNumber(cardNumber).getUserId();
|
||||
userIrrigationRecord.setUserId(userId);
|
||||
System.err.println("userId"+userId);*/
|
||||
|
||||
|
||||
DateTime currentTime=DateTime.now();//获取当前时间作为开阀时间
|
||||
userIrrigationRecord.setStartTime(currentTime);//开阀时间
|
||||
System.err.println("currentTime"+currentTime);
|
||||
|
||||
BigDecimal openCumFlow=dataJson.getBigDecimal("userSumFlow");//用户开阀时总使用水量
|
||||
userIrrigationRecord.setOpenCumFlow(openCumFlow);//用户开阀时使用水量
|
||||
System.err.println("openCumFlow"+openCumFlow);
|
||||
|
||||
String areaCode=dataJson.getStr("areaCode");
|
||||
userIrrigationRecord.setAreaCode(areaCode);//区域号
|
||||
System.err.println("areaCode"+areaCode);
|
||||
|
||||
userIrrigationRecord.setStatus(1);//状态改为灌溉中
|
||||
|
||||
userIrrigationRecordMapper.insertUserIrrigationRecord(userIrrigationRecord);//开阀时添加一条灌溉记录
|
||||
}else{
|
||||
System.err.println("关阀");
|
||||
//关阀-修改灌溉记录,修改结束时间、灌溉用水量(做差 关阀-开阀用户总累计流量。)查卡号最新一条记录
|
||||
String cardNumber=dataJson.getStr("cardId");//解析cardId
|
||||
//根据设备编码和卡号获取当前状态为灌溉中的灌溉记录
|
||||
UserIrrigationRecord userIrrigationRecord=userIrrigationRecordMapper.selectUserIrrigationRecordListBycardNumberAndDeviceNumber(cardNumber,serialNumber).get(0);
|
||||
|
||||
if(userIrrigationRecord==null)
|
||||
{
|
||||
System.err.println("此灌溉记录不存在");
|
||||
}
|
||||
DateTime currentTime=DateTime.now();//获取当前时间作为关阀时间
|
||||
userIrrigationRecord.setEndTime(currentTime);//关阀时间
|
||||
|
||||
BigDecimal closeCumFlow=dataJson.getBigDecimal("userSumFlow");//用户关阀时总用水量
|
||||
userIrrigationRecord.setCloseCumFlow(closeCumFlow);
|
||||
|
||||
BigDecimal currentFlow=closeCumFlow.subtract(userIrrigationRecord.getOpenCumFlow());//计算结果为当前用水量
|
||||
userIrrigationRecord.setCurFlow(currentFlow);
|
||||
|
||||
BigDecimal userBalance=dataJson.getBigDecimal("userBalance");//用户余额
|
||||
userIrrigationRecord.setBalance(userBalance);
|
||||
|
||||
userIrrigationRecord.setStatus(2);//灌溉状态更改为结束灌溉
|
||||
|
||||
userIrrigationRecordMapper.updateUserIrrigationRecord(userIrrigationRecord);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -285,5 +367,44 @@ public class DeviceOtherMsgConsumer {
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.err.println((LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))));
|
||||
DeviceReportBo bo=new DeviceReportBo();
|
||||
bo.setTopicName("hzlink/147/1200028/info/up");
|
||||
System.err.println("111");
|
||||
|
||||
String jsonStr = "{"
|
||||
+ " \"data\": {"
|
||||
+ " \"valveState\": 0,"
|
||||
+ " \"userBalance\": 9995102,"
|
||||
+ " \"sumFlow\": 640000,"
|
||||
+ " \"userSumEle\": 0,"
|
||||
+ " \"cardSn\": 1841852732,"
|
||||
+ " \"cardType\": 12,"
|
||||
+ " \"sumEle\": 0,"
|
||||
+ " \"doorStatus\": 100,"
|
||||
+ " \"meterIns\": 6100,"
|
||||
+ " \"meterStatus\": 1,"
|
||||
+ " \"userSumFlow\": 640000,"
|
||||
+ " \"cardId\": 402,"
|
||||
+ " \"action\": \"stopPump\","
|
||||
+ " \"meterSum\": 6400,"
|
||||
+ " \"pumpState\": 0,"
|
||||
+ " \"mcuSn\": 2147483647,"
|
||||
+ " \"areaCode\": 6460,"
|
||||
+ " \"workState\": 0"
|
||||
+ " },"
|
||||
+ " \"type\": \"waterEleData\","
|
||||
+ " \"pakSn\": 9"
|
||||
+ "}";
|
||||
|
||||
|
||||
// 将 JSON 字符串转换为 byte[] 数组
|
||||
byte[] jsonBytes = jsonStr.getBytes(StandardCharsets.UTF_8);
|
||||
bo.setData(jsonBytes);
|
||||
|
||||
DeviceOtherMsgConsumer deviceOtherMsgConsumer=new DeviceOtherMsgConsumer();
|
||||
deviceOtherMsgConsumer.consume(bo);
|
||||
System.err.println("end");
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ import com.fastbee.common.core.domain.AjaxResult;
|
||||
import com.fastbee.common.utils.pay.AesUtil;
|
||||
import com.fastbee.common.utils.pay.RSAUtil;
|
||||
import com.fastbee.rechargecard.domain.NgMerchants;
|
||||
import com.fastbee.rechargecard.domain.dto.WeChatPlatformCertificate;
|
||||
import com.fastbee.rechargecard.domain.dto.WeChatRecharge;
|
||||
import com.fastbee.rechargecard.domain.dto.WeChatRechargeBacktracking;
|
||||
import com.fastbee.rechargecard.mapper.NgIrrigationControllersMapper;
|
||||
@ -83,9 +84,9 @@ public class WeChatPayController extends BaseController {
|
||||
*/
|
||||
@ApiOperation("获取平台证书")
|
||||
@GetMapping("/getPlatformCertificate")
|
||||
public AjaxResult getPlatformCertificate(@RequestBody String mchId,@RequestBody String privateKey,@RequestBody String serial_no,@RequestBody String apiV3Key)
|
||||
public AjaxResult getPlatformCertificate(@RequestBody WeChatPlatformCertificate weChatPlatformCertificate)
|
||||
{
|
||||
return success(userWechatPayService.getPlatformCertificat(mchId,privateKey,serial_no,apiV3Key));
|
||||
return success(userWechatPayService.getPlatformCertificat(weChatPlatformCertificate));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -4,6 +4,8 @@ import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import com.fastbee.rechargecard.domain.dto.NgUserRechargeRecordsDto;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
@ -45,16 +47,18 @@ public class NgUserRechargeRecordsController extends BaseController
|
||||
// @PreAuthorize("@ss.hasPermi('rechargecard:records:list')")
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("查询用户充值记录列表")
|
||||
public TableDataInfo list(NgUserRechargeRecords ngUserRechargeRecords)
|
||||
public TableDataInfo list(NgUserRechargeRecordsDto ngUserRechargeRecords)
|
||||
{
|
||||
startPage();
|
||||
List<NgUserRechargeRecords> list = ngUserRechargeRecordsService.selectNgUserRechargeRecordsList(ngUserRechargeRecords);
|
||||
List<NgUserRechargeRecords> list = ngUserRechargeRecordsService.selectNgUserRechargeRecordsListByTime(ngUserRechargeRecords);
|
||||
//按照充值时间由近到远排序
|
||||
// list.sort(Comparator.comparing(NgUserRechargeRecords::getRechargeTime).reversed());
|
||||
// System.err.println("充值list = " + list);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 导出用户充值记录列表
|
||||
*/
|
||||
|
@ -29,6 +29,7 @@
|
||||
<select id="selectNgCardSwipeRecordsList" parameterType="NgCardSwipeRecords" resultMap="NgCardSwipeRecordsResult">
|
||||
<include refid="selectNgCardSwipeRecordsVo"/>
|
||||
<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="cardSwipeType != null "> and card_swipe_type = #{cardSwipeType}</if>
|
||||
|
@ -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;
|
||||
|
||||
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
@ -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;
|
||||
}
|
@ -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
|
||||
|
@ -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);
|
||||
/**
|
||||
* 查询单用户灌溉记录列表
|
||||
*
|
||||
|
@ -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
|
||||
|
@ -14,6 +14,15 @@ import com.fastbee.rechargecard.domain.dto.UserIrrigationRecordDto;
|
||||
*/
|
||||
public interface IUserIrrigationRecordService
|
||||
{
|
||||
/**
|
||||
* 查询灌溉记录列表
|
||||
*
|
||||
* @param userIrrigationRecord 灌溉记录
|
||||
* @return 灌溉记录集合
|
||||
*//*
|
||||
public List<UserIrrigationRecord> selectUserIrrigationRecordListByTime(UserIrrigationRecord userIrrigationRecord);*/
|
||||
|
||||
|
||||
/**
|
||||
* 查询用户灌溉展示记录列表
|
||||
*
|
||||
|
@ -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);
|
||||
|
||||
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -33,6 +33,7 @@ public class UserIrrigationRecordServiceImpl implements IUserIrrigationRecordSer
|
||||
private NgIrrigationControllersMapper ngIrrigationControllersMapper;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public List<UserIrrigationRecordDto> selectUserIrrigationRecordShowListByCardNumber(UserIrrigationRecord userIrrigationRecord) {
|
||||
List<UserIrrigationRecordDto> result=new ArrayList<>();
|
||||
|
@ -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)
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
Reference in New Issue
Block a user