微信支付回调
This commit is contained in:
parent
060019c830
commit
d51db24133
|
@ -22,6 +22,12 @@
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<artifactId>smart-switch-system</artifactId>
|
<artifactId>smart-switch-system</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
package com.ruoyi.ss.dashboard;
|
package com.ruoyi.ss.dashboard;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonView;
|
||||||
|
import com.ruoyi.common.core.domain.JsonViewProfile;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
@ -14,40 +17,68 @@ import java.util.Date;
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class BillCountVo {
|
public class BillCountVo {
|
||||||
|
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
|
@JsonView(JsonViewProfile.AppMch.class)
|
||||||
@ApiModelProperty("年")
|
@ApiModelProperty("年")
|
||||||
private Integer createYear; // 年
|
private Integer createYear; // 年
|
||||||
|
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
|
@JsonView(JsonViewProfile.AppMch.class)
|
||||||
@ApiModelProperty("月")
|
@ApiModelProperty("月")
|
||||||
private Integer createMonth; // 月
|
private Integer createMonth; // 月
|
||||||
|
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
|
@JsonView(JsonViewProfile.AppMch.class)
|
||||||
@ApiModelProperty("日")
|
@ApiModelProperty("日")
|
||||||
private Integer createDay; // 日
|
private Integer createDay; // 日
|
||||||
|
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
|
@JsonView(JsonViewProfile.AppMch.class)
|
||||||
@ApiModelProperty("日期")
|
@ApiModelProperty("日期")
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
private Date createDate; // 日期
|
private Date createDate; // 日期
|
||||||
|
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
|
@JsonView(JsonViewProfile.AppMch.class)
|
||||||
@ApiModelProperty("年月")
|
@ApiModelProperty("年月")
|
||||||
private String createYearMonth; // 年月
|
private String createYearMonth; // 年月
|
||||||
|
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
|
@JsonView(JsonViewProfile.AppMch.class)
|
||||||
@ApiModelProperty("时间(小时)")
|
@ApiModelProperty("时间(小时)")
|
||||||
private Integer createHour; // 时间(小时)
|
private Integer createHour; // 时间(小时)
|
||||||
|
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
@ApiModelProperty("店铺id")
|
@ApiModelProperty("店铺id")
|
||||||
private Long storeId;
|
private Long storeId;
|
||||||
|
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
|
@ApiModelProperty("设备id")
|
||||||
|
private Long deviceId;
|
||||||
|
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
|
@JsonView(JsonViewProfile.AppMch.class)
|
||||||
@ApiModelProperty("充值金额(收入)")
|
@ApiModelProperty("充值金额(收入)")
|
||||||
private BigDecimal recharge; // 充值金额
|
private BigDecimal recharge; // 充值金额
|
||||||
|
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
@ApiModelProperty("提现金额")
|
@ApiModelProperty("提现金额")
|
||||||
private BigDecimal withdraw; // 提现金额
|
private BigDecimal withdraw; // 提现金额
|
||||||
|
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
@ApiModelProperty("服务费")
|
@ApiModelProperty("服务费")
|
||||||
private BigDecimal serviceCharge;
|
private BigDecimal serviceCharge;
|
||||||
|
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
@ApiModelProperty("渠道成本")
|
@ApiModelProperty("渠道成本")
|
||||||
private BigDecimal channelCost;
|
private BigDecimal channelCost;
|
||||||
|
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
@ApiModelProperty("利润")
|
@ApiModelProperty("利润")
|
||||||
private BigDecimal profit;
|
private BigDecimal profit;
|
||||||
|
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
|
@ApiModelProperty("数量")
|
||||||
|
private Integer count;
|
||||||
}
|
}
|
||||||
|
|
|
@ -121,32 +121,15 @@ public class SmDevice extends BaseEntity
|
||||||
)
|
)
|
||||||
private String outageWay;
|
private String outageWay;
|
||||||
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
|
||||||
@Excel(name = "下次房租到期提醒日期")
|
|
||||||
@ApiModelProperty("下次房租到期提醒日期")
|
|
||||||
private Date expireDate;
|
|
||||||
|
|
||||||
@Excel(name = "wifi名称")
|
@Excel(name = "wifi名称")
|
||||||
@ApiModelProperty("wifi名称")
|
@ApiModelProperty("wifi名称")
|
||||||
private String wifi;
|
private String wifi;
|
||||||
|
|
||||||
@Excel(name = "是否开启房租到期提醒")
|
|
||||||
@ApiModelProperty("是否开启房租到期提醒")
|
|
||||||
private Boolean enableExpireNotice;
|
|
||||||
|
|
||||||
@Excel(name = "房租到期提醒方式")
|
|
||||||
@ApiModelProperty("房租到期提醒方式")
|
|
||||||
private String noticeWay;
|
|
||||||
|
|
||||||
@ApiModelProperty("上次拉取设备信息的时间")
|
@ApiModelProperty("上次拉取设备信息的时间")
|
||||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
private Date lastPullTime;
|
private Date lastPullTime;
|
||||||
|
|
||||||
@ApiModelProperty("房租到期提醒日(每月)")
|
@ApiModelProperty("总电量初始读数")
|
||||||
@Range(min = 1, max = 31, message = "房租到期提醒日应该在1到31日(含)之间")
|
|
||||||
private Integer expireDay;
|
|
||||||
|
|
||||||
@ApiModelProperty("电量初始读数")
|
|
||||||
private BigDecimal initReading;
|
private BigDecimal initReading;
|
||||||
|
|
||||||
@ApiModelProperty("开关状态,0断电,1通电")
|
@ApiModelProperty("开关状态,0断电,1通电")
|
||||||
|
|
|
@ -13,6 +13,7 @@ import lombok.Data;
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalTime;
|
import java.time.LocalTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -60,4 +61,10 @@ public class SmDeviceVo extends SmDevice {
|
||||||
|
|
||||||
@ApiModelProperty("所属商户ID")
|
@ApiModelProperty("所属商户ID")
|
||||||
private Long userId;
|
private Long userId;
|
||||||
|
|
||||||
|
@ApiModelProperty("订单总数量")
|
||||||
|
private Integer orderCount;
|
||||||
|
|
||||||
|
@ApiModelProperty("订单总金额")
|
||||||
|
private BigDecimal orderAmount;
|
||||||
}
|
}
|
||||||
|
|
|
@ -132,4 +132,10 @@ public interface SmDeviceMapper
|
||||||
*/
|
*/
|
||||||
int bindSn(@Param("deviceId") Long deviceId, @Param("sn") String sn);
|
int bindSn(@Param("deviceId") Long deviceId, @Param("sn") String sn);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据SN查询简单数据
|
||||||
|
* @param deviceNo
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
SmDeviceVo selectSimpleSmDeviceBySn(String deviceNo);
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="userId != null"> and su.user_id = #{userId}</if>
|
<if test="userId != null"> and su.user_id = #{userId}</if>
|
||||||
<if test="storeId != null"> and sd.store_id = #{storeId}</if>
|
<if test="storeId != null"> and sd.store_id = #{storeId}</if>
|
||||||
<if test="deviceId != null"> and sd.device_id = #{deviceId}</if>
|
<if test="deviceId != null"> and sd.device_id = #{deviceId}</if>
|
||||||
<if test="expireDay != null">and sd.expire_day = #{expireDay}</if>
|
|
||||||
<if test="deviceIds != null and deviceIds.size() > 0">
|
<if test="deviceIds != null and deviceIds.size() > 0">
|
||||||
and sd.device_id in
|
and sd.device_id in
|
||||||
<foreach collection="deviceIds" open="(" close=")" separator="," item="item">
|
<foreach collection="deviceIds" open="(" close=")" separator="," item="item">
|
||||||
|
@ -158,6 +157,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectSimpleSmDeviceBySn" resultMap="SmDeviceResult">
|
||||||
|
select sd.*
|
||||||
|
from sm_device sd
|
||||||
|
where sd.device_no = #{deviceNo} and sd.deleted = false
|
||||||
|
</select>
|
||||||
|
|
||||||
<insert id="insertSmDevice" parameterType="SmDevice" useGeneratedKeys="true" keyProperty="deviceId">
|
<insert id="insertSmDevice" parameterType="SmDevice" useGeneratedKeys="true" keyProperty="deviceId">
|
||||||
<selectKey resultType="Long" order="AFTER" keyProperty="deviceId">
|
<selectKey resultType="Long" order="AFTER" keyProperty="deviceId">
|
||||||
select LAST_INSERT_ID()
|
select LAST_INSERT_ID()
|
||||||
|
@ -183,11 +188,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="remark != null">remark,</if>
|
<if test="remark != null">remark,</if>
|
||||||
<if test="outageWay != null">outage_way,</if>
|
<if test="outageWay != null">outage_way,</if>
|
||||||
<if test="wifi != null">wifi,</if>
|
<if test="wifi != null">wifi,</if>
|
||||||
<if test="enableExpireNotice != null">enable_expire_notice,</if>
|
|
||||||
<if test="noticeWay != null">notice_way,</if>
|
|
||||||
<if test="deleted != null">deleted,</if>
|
<if test="deleted != null">deleted,</if>
|
||||||
<if test="lastPullTime != null">last_pull_time,</if>
|
<if test="lastPullTime != null">last_pull_time,</if>
|
||||||
<if test="expireDay != null">expire_day,</if>
|
|
||||||
<if test="initReading != null">init_reading,</if>
|
<if test="initReading != null">init_reading,</if>
|
||||||
<if test="powerStatus != null">power_status,</if>
|
<if test="powerStatus != null">power_status,</if>
|
||||||
<if test="deviceNo != null">device_no,</if>
|
<if test="deviceNo != null">device_no,</if>
|
||||||
|
@ -212,11 +214,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="remark != null">#{remark},</if>
|
<if test="remark != null">#{remark},</if>
|
||||||
<if test="outageWay != null">#{outageWay},</if>
|
<if test="outageWay != null">#{outageWay},</if>
|
||||||
<if test="wifi != null">#{wifi},</if>
|
<if test="wifi != null">#{wifi},</if>
|
||||||
<if test="enableExpireNotice != null">#{enableExpireNotice},</if>
|
|
||||||
<if test="noticeWay != null">#{noticeWay},</if>
|
|
||||||
<if test="deleted != null">#{deleted},</if>
|
<if test="deleted != null">#{deleted},</if>
|
||||||
<if test="lastPullTime != null">#{lastPullTime},</if>
|
<if test="lastPullTime != null">#{lastPullTime},</if>
|
||||||
<if test="expireDay != null">#{expireDay},</if>
|
|
||||||
<if test="initReading != null">#{initReading},</if>
|
<if test="initReading != null">#{initReading},</if>
|
||||||
<if test="powerStatus != null">#{powerStatus},</if>
|
<if test="powerStatus != null">#{powerStatus},</if>
|
||||||
<if test="deviceNo != null">#{deviceNo},</if>
|
<if test="deviceNo != null">#{deviceNo},</if>
|
||||||
|
@ -260,13 +259,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||||
<if test="remark != null">remark = #{remark},</if>
|
<if test="remark != null">remark = #{remark},</if>
|
||||||
<if test="outageWay != null">outage_way = #{outageWay},</if>
|
<if test="outageWay != null">outage_way = #{outageWay},</if>
|
||||||
<if test="expireDate != null">expire_date = #{expireDate},</if>
|
|
||||||
<if test="wifi != null">wifi = #{wifi},</if>
|
<if test="wifi != null">wifi = #{wifi},</if>
|
||||||
<if test="enableExpireNotice != null">enable_expire_notice = #{enableExpireNotice},</if>
|
|
||||||
<if test="noticeWay != null">notice_way = #{noticeWay},</if>
|
|
||||||
<if test="deleted != null">deleted = #{deleted},</if>
|
<if test="deleted != null">deleted = #{deleted},</if>
|
||||||
<if test="lastPullTime != null">last_pull_time = #{lastPullTime},</if>
|
<if test="lastPullTime != null">last_pull_time = #{lastPullTime},</if>
|
||||||
<if test="expireDay != null">expire_day = #{expireDay},</if>
|
|
||||||
<if test="initReading != null">init_reading = #{initReading},</if>
|
<if test="initReading != null">init_reading = #{initReading},</if>
|
||||||
<if test="powerStatus != null">power_status = #{powerStatus},</if>
|
<if test="powerStatus != null">power_status = #{powerStatus},</if>
|
||||||
<if test="expireTime != null">expire_time = #{expireTime},</if>
|
<if test="expireTime != null">expire_time = #{expireTime},</if>
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package com.ruoyi.ss.device.service;
|
package com.ruoyi.ss.device.service;
|
||||||
|
|
||||||
|
|
||||||
import com.ruoyi.ss.device.domain.SmDevice;
|
|
||||||
import com.ruoyi.ss.device.domain.vo.SmDeviceVo;
|
import com.ruoyi.ss.device.domain.vo.SmDeviceVo;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -15,19 +14,21 @@ public interface DeviceAssembler {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 拼接租户信息
|
* 拼接租户信息
|
||||||
* @param list
|
|
||||||
*/
|
*/
|
||||||
void assembleTenant(List<SmDeviceVo> list);
|
void assembleTenant(List<SmDeviceVo> list);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 拼接套餐列表
|
* 拼接套餐列表
|
||||||
* @param list
|
|
||||||
*/
|
*/
|
||||||
void assembleSuitList(List<SmDeviceVo> list);
|
void assembleSuitList(List<SmDeviceVo> list);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 拼接店铺营业时间
|
* 拼接店铺营业时间
|
||||||
* @param list
|
|
||||||
*/
|
*/
|
||||||
void assembleBusinessTime(List<SmDeviceVo> list);
|
void assembleBusinessTime(List<SmDeviceVo> list);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拼接订单统计信息:订单数量、订单金额
|
||||||
|
*/
|
||||||
|
void assembleOrderCountInfo(List<SmDeviceVo> list);
|
||||||
}
|
}
|
||||||
|
|
|
@ -136,7 +136,7 @@ public interface ISmDeviceService
|
||||||
* @param mac
|
* @param mac
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
boolean isBind(String mac);
|
boolean isBindByMac(String mac);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ids查询列表
|
* ids查询列表
|
||||||
|
@ -180,4 +180,11 @@ public interface ISmDeviceService
|
||||||
* @param sn SN
|
* @param sn SN
|
||||||
*/
|
*/
|
||||||
int bindSn(Long deviceId, String sn);
|
int bindSn(Long deviceId, String sn);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据SN码查询设备是否已经绑定
|
||||||
|
* @param deviceNo
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
boolean isBindBySn(String deviceNo);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
package com.ruoyi.ss.device.service;
|
package com.ruoyi.ss.device.service.impl;
|
||||||
|
|
||||||
import com.ruoyi.common.utils.CollectionUtils;
|
import com.ruoyi.common.utils.CollectionUtils;
|
||||||
import com.ruoyi.common.utils.ServiceUtil;
|
import com.ruoyi.ss.dashboard.BillCountVo;
|
||||||
import com.ruoyi.ss.device.domain.SmDevice;
|
|
||||||
import com.ruoyi.ss.device.domain.vo.SmDeviceVo;
|
import com.ruoyi.ss.device.domain.vo.SmDeviceVo;
|
||||||
|
import com.ruoyi.ss.device.service.DeviceAssembler;
|
||||||
import com.ruoyi.ss.store.domain.StoreQuery;
|
import com.ruoyi.ss.store.domain.StoreQuery;
|
||||||
import com.ruoyi.ss.store.domain.StoreVo;
|
import com.ruoyi.ss.store.domain.StoreVo;
|
||||||
import com.ruoyi.ss.store.service.IStoreService;
|
import com.ruoyi.ss.store.service.IStoreService;
|
||||||
|
@ -12,9 +12,15 @@ import com.ruoyi.ss.deviceTenant.service.ISmDeviceTenantService;
|
||||||
import com.ruoyi.ss.suit.domain.SuitQuery;
|
import com.ruoyi.ss.suit.domain.SuitQuery;
|
||||||
import com.ruoyi.ss.suit.domain.SuitVo;
|
import com.ruoyi.ss.suit.domain.SuitVo;
|
||||||
import com.ruoyi.ss.suit.service.ISuitService;
|
import com.ruoyi.ss.suit.service.ISuitService;
|
||||||
|
import com.ruoyi.ss.transactionBill.domain.TransactionBillQuery;
|
||||||
|
import com.ruoyi.ss.transactionBill.domain.enums.TransactionBillGroupBy;
|
||||||
|
import com.ruoyi.ss.transactionBill.domain.enums.TransactionBillStatus;
|
||||||
|
import com.ruoyi.ss.transactionBill.domain.enums.TransactionBillType;
|
||||||
|
import com.ruoyi.ss.transactionBill.service.TransactionBillService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
@ -30,15 +36,15 @@ public class DeviceAssemblerImpl implements DeviceAssembler {
|
||||||
@Autowired
|
@Autowired
|
||||||
private ISmDeviceTenantService deviceTenantService;
|
private ISmDeviceTenantService deviceTenantService;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private IStoreService smDeviceGroupService;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ISuitService suitService;
|
private ISuitService suitService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IStoreService storeService;
|
private IStoreService storeService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TransactionBillService transactionBillService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void assembleTenant(List<SmDeviceVo> list) {
|
public void assembleTenant(List<SmDeviceVo> list) {
|
||||||
if (CollectionUtils.isEmpty(list)) {
|
if (CollectionUtils.isEmpty(list)) {
|
||||||
|
@ -97,4 +103,29 @@ public class DeviceAssemblerImpl implements DeviceAssembler {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拼接订单统计信息:订单数量、订单金额
|
||||||
|
*
|
||||||
|
* @param list
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void assembleOrderCountInfo(List<SmDeviceVo> list) {
|
||||||
|
if (CollectionUtils.isEmptyElement(list)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
TransactionBillQuery query = new TransactionBillQuery();
|
||||||
|
query.setGroupBy(TransactionBillGroupBy.device_id.name());
|
||||||
|
query.setDeviceIds(list.stream().map(SmDeviceVo::getDeviceId).collect(Collectors.toList()));
|
||||||
|
query.setType(TransactionBillType.RECHARGE.getType());
|
||||||
|
query.setStatus(TransactionBillStatus.SUCCESS.getStatus());
|
||||||
|
Map<Long, BillCountVo> map = transactionBillService.selectCountMap(query, BillCountVo::getDeviceId);
|
||||||
|
|
||||||
|
for (SmDeviceVo device : list) {
|
||||||
|
BillCountVo count = map.get(device.getDeviceId());
|
||||||
|
device.setOrderCount(count == null ? 0 : count.getCount());
|
||||||
|
device.setOrderAmount(count == null ? BigDecimal.ZERO : count.getRecharge());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package com.ruoyi.ss.device.service;
|
package com.ruoyi.ss.device.service.impl;
|
||||||
|
|
||||||
import com.ruoyi.common.core.domain.model.LoginUser;
|
import com.ruoyi.common.core.domain.model.LoginUser;
|
||||||
import com.ruoyi.common.enums.LoginType;
|
import com.ruoyi.common.enums.LoginType;
|
||||||
|
@ -12,16 +12,13 @@ import com.ruoyi.ss.device.domain.enums.DeviceOnlineStatus;
|
||||||
import com.ruoyi.ss.device.domain.enums.DevicePowerStatus;
|
import com.ruoyi.ss.device.domain.enums.DevicePowerStatus;
|
||||||
import com.ruoyi.ss.device.domain.enums.DeviceStatus;
|
import com.ruoyi.ss.device.domain.enums.DeviceStatus;
|
||||||
import com.ruoyi.ss.device.mapper.SmDeviceMapper;
|
import com.ruoyi.ss.device.mapper.SmDeviceMapper;
|
||||||
|
import com.ruoyi.ss.device.service.DeviceAssembler;
|
||||||
|
import com.ruoyi.ss.device.service.ISmDeviceService;
|
||||||
import com.ruoyi.ss.deviceBindRecord.service.ISmDeviceBindRecordService;
|
import com.ruoyi.ss.deviceBindRecord.service.ISmDeviceBindRecordService;
|
||||||
import com.ruoyi.ss.deviceTenant.domain.SmDeviceTenant;
|
|
||||||
import com.ruoyi.ss.deviceTenant.mapper.SmDeviceTenantMapper;
|
|
||||||
import com.ruoyi.ss.deviceTenant.service.ISmDeviceTenantService;
|
|
||||||
import com.ruoyi.ss.resetRecord.domain.SmResetRecord;
|
import com.ruoyi.ss.resetRecord.domain.SmResetRecord;
|
||||||
import com.ruoyi.ss.resetRecord.service.ISmResetRecordService;
|
import com.ruoyi.ss.resetRecord.service.ISmResetRecordService;
|
||||||
import com.ruoyi.ss.store.domain.StoreVo;
|
import com.ruoyi.ss.store.domain.StoreVo;
|
||||||
import com.ruoyi.ss.store.service.IStoreService;
|
import com.ruoyi.ss.store.service.IStoreService;
|
||||||
import com.ruoyi.ss.user.domain.SmUserVo;
|
|
||||||
import com.ruoyi.ss.user.mapper.SmUserMapper;
|
|
||||||
import com.ruoyi.iot.domain.IotDeviceInfo;
|
import com.ruoyi.iot.domain.IotDeviceInfo;
|
||||||
import com.ruoyi.iot.service.IotService;
|
import com.ruoyi.iot.service.IotService;
|
||||||
import lombok.SneakyThrows;
|
import lombok.SneakyThrows;
|
||||||
|
@ -55,15 +52,6 @@ public class SmDeviceServiceImpl implements ISmDeviceService
|
||||||
@Autowired
|
@Autowired
|
||||||
private SmDeviceMapper smDeviceMapper;
|
private SmDeviceMapper smDeviceMapper;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private SmUserMapper smUserMapper;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private ISmDeviceTenantService smDeviceTenantService;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private SmDeviceTenantMapper smDeviceTenantMapper;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IotService iotService;
|
private IotService iotService;
|
||||||
|
|
||||||
|
@ -375,15 +363,9 @@ public class SmDeviceServiceImpl implements ISmDeviceService
|
||||||
ServiceUtil.assertion(!StringUtils.hasText(device.getMac()), "设备Mac号为空");
|
ServiceUtil.assertion(!StringUtils.hasText(device.getMac()), "设备Mac号为空");
|
||||||
|
|
||||||
deviceAssembler.assembleTenant(Collections.singletonList(device));
|
deviceAssembler.assembleTenant(Collections.singletonList(device));
|
||||||
ServiceUtil.assertion(!UserUtil.hasFrontUser(device.getTenantIds())
|
ServiceUtil.assertion(!UserUtil.hasFrontUser(device.getUserId()), "您不是该设备的商户,无法进行该操作" );
|
||||||
&& !UserUtil.hasFrontUser(device.getUserId()), "您不是该设备的租户或商户,无法进行该操作" );
|
|
||||||
|
|
||||||
if (DevicePowerStatus.ON.equals(status)) {
|
if (DevicePowerStatus.ON.equals(status)) {
|
||||||
// 通电,检查电量余额是否足够
|
|
||||||
IotDeviceInfo deviceInfo = iotService.getDeviceInfo(device.getMac());
|
|
||||||
ServiceUtil.assertion(deviceInfo.getM() == null
|
|
||||||
|| BigDecimal.ZERO.compareTo(deviceInfo.getM()) >= 0, "电量余额不足,请充值后重试");
|
|
||||||
|
|
||||||
iotService.open(device.getMac());
|
iotService.open(device.getMac());
|
||||||
} else if (DevicePowerStatus.OFF.equals(status)) {
|
} else if (DevicePowerStatus.OFF.equals(status)) {
|
||||||
iotService.close(device.getMac());
|
iotService.close(device.getMac());
|
||||||
|
@ -539,7 +521,7 @@ public class SmDeviceServiceImpl implements ISmDeviceService
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean isBind(String mac) {
|
public boolean isBindByMac(String mac) {
|
||||||
if (StringUtils.isBlank(mac)) {
|
if (StringUtils.isBlank(mac)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -547,6 +529,21 @@ public class SmDeviceServiceImpl implements ISmDeviceService
|
||||||
return device != null && device.getStoreId() != null;
|
return device != null && device.getStoreId() != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据SN码查询设备是否已经绑定
|
||||||
|
*
|
||||||
|
* @param deviceNo
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean isBindBySn(String deviceNo) {
|
||||||
|
if (StringUtils.isBlank(deviceNo)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
SmDeviceVo device = smDeviceMapper.selectSimpleSmDeviceBySn(deviceNo);
|
||||||
|
return device != null && device.getStoreId() != null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ids查询列表
|
* ids查询列表
|
||||||
*
|
*
|
|
@ -42,7 +42,8 @@ public class TransactionBill extends BaseEntity
|
||||||
private Long userId;
|
private Long userId;
|
||||||
|
|
||||||
/** 类型 */
|
/** 类型 */
|
||||||
@ApiModelProperty("类型:1充值")
|
@ApiModelProperty("类型:1充值,2提现")
|
||||||
|
@JsonView(JsonViewProfile.AppMch.class)
|
||||||
private String type;
|
private String type;
|
||||||
|
|
||||||
/** 设备 */
|
/** 设备 */
|
||||||
|
@ -59,6 +60,7 @@ public class TransactionBill extends BaseEntity
|
||||||
/** 商户(到账用户) */
|
/** 商户(到账用户) */
|
||||||
@Excel(name = "商户(到账用户)")
|
@Excel(name = "商户(到账用户)")
|
||||||
@ApiModelProperty("商户(到账用户)id")
|
@ApiModelProperty("商户(到账用户)id")
|
||||||
|
@JsonView(JsonViewProfile.AppMch.class)
|
||||||
private Long mchId;
|
private Long mchId;
|
||||||
|
|
||||||
/** 交易金额 */
|
/** 交易金额 */
|
||||||
|
@ -73,6 +75,7 @@ public class TransactionBill extends BaseEntity
|
||||||
/** 实际到账金额 */
|
/** 实际到账金额 */
|
||||||
@Excel(name = "商户实际到账金额")
|
@Excel(name = "商户实际到账金额")
|
||||||
@ApiModelProperty("商户实际到账金额")
|
@ApiModelProperty("商户实际到账金额")
|
||||||
|
@JsonView(JsonViewProfile.AppMch.class)
|
||||||
private BigDecimal arrivalAmount;
|
private BigDecimal arrivalAmount;
|
||||||
|
|
||||||
/** 手续费 */
|
/** 手续费 */
|
||||||
|
@ -89,6 +92,7 @@ public class TransactionBill extends BaseEntity
|
||||||
private Long channelId;
|
private Long channelId;
|
||||||
|
|
||||||
@ApiModelProperty("到账后余额")
|
@ApiModelProperty("到账后余额")
|
||||||
|
@JsonView(JsonViewProfile.AppMch.class)
|
||||||
private BigDecimal afterBalance;
|
private BigDecimal afterBalance;
|
||||||
|
|
||||||
@ApiModelProperty("支付成功的时间")
|
@ApiModelProperty("支付成功的时间")
|
||||||
|
@ -99,6 +103,7 @@ public class TransactionBill extends BaseEntity
|
||||||
private Date expireTime;
|
private Date expireTime;
|
||||||
|
|
||||||
@ApiModelProperty("交易账号(银行卡号、微信openId)")
|
@ApiModelProperty("交易账号(银行卡号、微信openId)")
|
||||||
|
@JsonView(JsonViewProfile.AppMch.class)
|
||||||
private String accountNo;
|
private String accountNo;
|
||||||
|
|
||||||
@ApiModelProperty("已支付/提现金额")
|
@ApiModelProperty("已支付/提现金额")
|
||||||
|
|
|
@ -31,7 +31,7 @@ public class TransactionBillQuery extends TransactionBill {
|
||||||
private String userName;
|
private String userName;
|
||||||
|
|
||||||
@ApiModelProperty("商户名称")
|
@ApiModelProperty("商户名称")
|
||||||
private String landlordName;
|
private String mchName;
|
||||||
|
|
||||||
@ApiModelProperty("设备名称")
|
@ApiModelProperty("设备名称")
|
||||||
private String deviceName;
|
private String deviceName;
|
||||||
|
@ -70,4 +70,7 @@ public class TransactionBillQuery extends TransactionBill {
|
||||||
|
|
||||||
@ApiModelProperty("店铺ID列表")
|
@ApiModelProperty("店铺ID列表")
|
||||||
private List<Long> storeIds;
|
private List<Long> storeIds;
|
||||||
|
|
||||||
|
@ApiModelProperty("设备ID列表")
|
||||||
|
private List<Long> deviceIds;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@ public class TransactionBillVo extends TransactionBill {
|
||||||
private String userName;
|
private String userName;
|
||||||
|
|
||||||
@ApiModelProperty("商户(到账用户)名称")
|
@ApiModelProperty("商户(到账用户)名称")
|
||||||
|
@JsonView(JsonViewProfile.AppMch.class)
|
||||||
private String mchName;
|
private String mchName;
|
||||||
|
|
||||||
@ApiModelProperty("支付渠道名称")
|
@ApiModelProperty("支付渠道名称")
|
||||||
|
|
|
@ -17,5 +17,6 @@ public enum TransactionBillGroupBy {
|
||||||
create_date,
|
create_date,
|
||||||
create_hour,
|
create_hour,
|
||||||
create_year_month,
|
create_year_month,
|
||||||
|
device_id,
|
||||||
store_id
|
store_id
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="type != null "> and stb.type = #{type} </if>
|
<if test="type != null "> and stb.type = #{type} </if>
|
||||||
<if test="mchId != null "> and stb.mch_id = #{mchId}</if>
|
<if test="mchId != null "> and stb.mch_id = #{mchId}</if>
|
||||||
<if test="userName != null "> and su.user_name like concat('%', #{userName}, '%')</if>
|
<if test="userName != null "> and su.user_name like concat('%', #{userName}, '%')</if>
|
||||||
<if test="landlordName != null "> and su1.user_name like concat('%', #{landlordName}, '%')</if>
|
<if test="mchName != null "> and su1.user_name like concat('%', #{mchName}, '%')</if>
|
||||||
<if test="deviceName != null "> and stb.device_name like concat('%', #{deviceName}, '%')</if>
|
<if test="deviceName != null "> and stb.device_name like concat('%', #{deviceName}, '%')</if>
|
||||||
<if test="createTime != null"> and stb.create_time = #{createTime}</if>
|
<if test="createTime != null"> and stb.create_time = #{createTime}</if>
|
||||||
<if test="createDate != null"> and date(stb.create_time) = date(#{createDate})</if>
|
<if test="createDate != null"> and date(stb.create_time) = date(#{createDate})</if>
|
||||||
|
@ -87,6 +87,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
#{item}
|
#{item}
|
||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
|
<if test="deviceIds != null and deviceIds.size() > 0">
|
||||||
|
and stb.device_id in
|
||||||
|
<foreach item="item" collection="deviceIds" open="(" separator="," close=")">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectSmTransactionBillList" parameterType="TransactionBillQuery" resultMap="SmTransactionBillResult">
|
<select id="selectSmTransactionBillList" parameterType="TransactionBillQuery" resultMap="SmTransactionBillResult">
|
||||||
|
@ -110,6 +116,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<result property="createDay" column="create_day"/>
|
<result property="createDay" column="create_day"/>
|
||||||
<result property="createYearMonth" column="create_year_month"/>
|
<result property="createYearMonth" column="create_year_month"/>
|
||||||
<result property="storeId" column="store_id"/>
|
<result property="storeId" column="store_id"/>
|
||||||
|
<result property="deviceId" column="device_id"/>
|
||||||
|
<result property="count" column="count" typeHandler="com.ruoyi.system.mapper.typehandler.NonNullIntegerTyperHandler"/>
|
||||||
<result property="serviceCharge" column="service_charge" typeHandler="com.ruoyi.system.mapper.typehandler.NonNullDecimalTypeHandler"/>
|
<result property="serviceCharge" column="service_charge" typeHandler="com.ruoyi.system.mapper.typehandler.NonNullDecimalTypeHandler"/>
|
||||||
<result property="channelCost" column="channel_cost" typeHandler="com.ruoyi.system.mapper.typehandler.NonNullDecimalTypeHandler"/>
|
<result property="channelCost" column="channel_cost" typeHandler="com.ruoyi.system.mapper.typehandler.NonNullDecimalTypeHandler"/>
|
||||||
<result property="profit" column="profit" typeHandler="com.ruoyi.system.mapper.typehandler.NonNullDecimalTypeHandler"/>
|
<result property="profit" column="profit" typeHandler="com.ruoyi.system.mapper.typehandler.NonNullDecimalTypeHandler"/>
|
||||||
|
@ -138,11 +146,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="groupBy == 'store_id'">
|
<if test="groupBy == 'store_id'">
|
||||||
stb.store_id as store_id,
|
stb.store_id as store_id,
|
||||||
</if>
|
</if>
|
||||||
|
<if test="groupBy == 'device_id'">
|
||||||
|
stb.device_id as device_id,
|
||||||
|
</if>
|
||||||
SUM(IF( stb.type = '1' and stb.status = '2', stb.arrival_amount, 0 )) AS recharge,
|
SUM(IF( stb.type = '1' and stb.status = '2', stb.arrival_amount, 0 )) AS recharge,
|
||||||
SUM(IF( stb.type = '2' and stb.status = '14', stb.arrival_amount, 0 )) AS withdraw,
|
SUM(IF( stb.type = '2' and stb.status = '14', stb.arrival_amount, 0 )) AS withdraw,
|
||||||
SUM(stb.service_charge) AS service_charge,
|
SUM(stb.service_charge) AS service_charge,
|
||||||
SUM(stb.channel_cost) AS channel_cost,
|
SUM(stb.channel_cost) AS channel_cost,
|
||||||
SUM(stb.service_charge - stb.channel_cost) AS profit
|
SUM(stb.service_charge - stb.channel_cost) AS profit,
|
||||||
|
count(stb.bill_id) AS `count`
|
||||||
FROM
|
FROM
|
||||||
sm_transaction_bill stb
|
sm_transaction_bill stb
|
||||||
<where>
|
<where>
|
||||||
|
|
|
@ -588,14 +588,6 @@ public class TransactionBillServiceImpl implements TransactionBillService {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 计算充值电量
|
|
||||||
// private BigDecimal computeElectricity(TransactionBill bill) {
|
|
||||||
// if (bill == null) {
|
|
||||||
// return BigDecimal.ZERO;
|
|
||||||
// }
|
|
||||||
// return bill.getDeviceAmount().divide(bill.getUnitPrice(), 1, RoundingMode.HALF_UP);
|
|
||||||
// }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 记录下操作后的余额
|
* 记录下操作后的余额
|
||||||
* @param billId 订单id
|
* @param billId 订单id
|
||||||
|
|
|
@ -126,9 +126,9 @@ public class WxPayService implements IWxPayService {
|
||||||
transactionBillService.paying(bill.getBillId());
|
transactionBillService.paying(bill.getBillId());
|
||||||
|
|
||||||
// 每隔20秒查询支付结果,直到过期,首次10秒查询
|
// 每隔20秒查询支付结果,直到过期,首次10秒查询
|
||||||
scheduledExecutorService.schedule(() -> {
|
// scheduledExecutorService.schedule(() -> {
|
||||||
transactionBillService.refreshPayResultBeforeExpire(bill.getBillNo(), 20, TimeUnit.SECONDS);
|
// transactionBillService.refreshPayResultBeforeExpire(bill.getBillNo(), 20, TimeUnit.SECONDS);
|
||||||
}, 10, TimeUnit.SECONDS);
|
// }, 10, TimeUnit.SECONDS);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
this.closeOrder(bill.getBillNo());
|
this.closeOrder(bill.getBillNo());
|
||||||
|
@ -181,35 +181,21 @@ public class WxPayService implements IWxPayService {
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public void payNotify(HttpServletRequest request) {
|
public void payNotify(HttpServletRequest request) {
|
||||||
|
// 获取原始报文body
|
||||||
String body = HttpUtils.getBody(request);
|
String body = HttpUtils.getBody(request);
|
||||||
// 解析通知数据
|
// 解析通知数据
|
||||||
Notification notification = JSON.parseObject(body, Notification.class);
|
Notification notification = JSON.parseObject(body, Notification.class);
|
||||||
|
// 支付成功通知
|
||||||
|
if (NotifyEventType.TRANSACTION_SUCCESS.getValue().equals(notification.getEventType())) {
|
||||||
|
// 验签、解密并转换成 Transaction
|
||||||
|
Transaction transaction = checkAndParse(request, body, Transaction.class);
|
||||||
|
|
||||||
try {
|
if (Transaction.TradeStateEnum.SUCCESS.equals(transaction.getTradeState())) {
|
||||||
// 判断是否重复通知,重复通知则忽略
|
// 充值成功,修改订单状态
|
||||||
if(!redisLock.lock(RedisLockKey.PAY_NOTIFY, notification.getId())) {
|
transactionBillService.rechargeSuccess(transaction.getOutTradeNo(), DateUtils.getNowDate());
|
||||||
return;
|
// 保存通知数据
|
||||||
|
// saveNotifyData(transaction.getOutTradeNo(), notification, transaction);
|
||||||
}
|
}
|
||||||
if (isRepeatNotify(notification.getId())) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 支付成功通知
|
|
||||||
if (NotifyEventType.TRANSACTION_SUCCESS.getValue().equals(notification.getEventType())) {
|
|
||||||
// 验签、解密并转换成 Transaction
|
|
||||||
Transaction transaction = checkAndParse(request, body, Transaction.class);
|
|
||||||
|
|
||||||
if (Transaction.TradeStateEnum.SUCCESS.equals(transaction.getTradeState())) {
|
|
||||||
// 充值成功,修改订单状态
|
|
||||||
transactionBillService.rechargeSuccess(transaction.getOutTradeNo(), DateUtils.getNowDate());
|
|
||||||
// 保存通知数据
|
|
||||||
saveNotifyData(transaction.getOutTradeNo(), notification, transaction);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} finally {
|
|
||||||
redisLock.unlock(RedisLockKey.PAY_NOTIFY, notification.getId());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ import com.ruoyi.common.core.domain.JsonViewProfile;
|
||||||
import com.ruoyi.common.core.domain.ValidGroup;
|
import com.ruoyi.common.core.domain.ValidGroup;
|
||||||
import com.ruoyi.common.core.page.TableDataInfo;
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
import com.ruoyi.common.utils.ServiceUtil;
|
import com.ruoyi.common.utils.ServiceUtil;
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
import com.ruoyi.ss.device.domain.DeviceView;
|
import com.ruoyi.ss.device.domain.DeviceView;
|
||||||
import com.ruoyi.ss.device.domain.SmDevice;
|
import com.ruoyi.ss.device.domain.SmDevice;
|
||||||
import com.ruoyi.ss.device.domain.SmDeviceQuery;
|
import com.ruoyi.ss.device.domain.SmDeviceQuery;
|
||||||
|
@ -65,10 +66,6 @@ public class AppDeviceController extends BaseController {
|
||||||
device.setDeviceId(smDevice.getDeviceId());
|
device.setDeviceId(smDevice.getDeviceId());
|
||||||
device.setStoreId(smDevice.getStoreId());
|
device.setStoreId(smDevice.getStoreId());
|
||||||
device.setRemark(smDevice.getRemark());
|
device.setRemark(smDevice.getRemark());
|
||||||
device.setNoticeWay(smDevice.getNoticeWay());
|
|
||||||
device.setEnableExpireNotice(smDevice.getEnableExpireNotice());
|
|
||||||
device.setExpireDate(smDevice.getExpireDate());
|
|
||||||
device.setExpireDay(smDevice.getExpireDay());
|
|
||||||
return toAjax(smDeviceService.updateSmDevice(device));
|
return toAjax(smDeviceService.updateSmDevice(device));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,12 +92,18 @@ public class AppDeviceController extends BaseController {
|
||||||
/**
|
/**
|
||||||
* 获取设备详细信息
|
* 获取设备详细信息
|
||||||
*/
|
*/
|
||||||
|
@MchRequired
|
||||||
@ApiOperation("获取设备详细信息")
|
@ApiOperation("获取设备详细信息")
|
||||||
@GetMapping(value = "/{deviceId}")
|
@GetMapping(value = "/{deviceId}")
|
||||||
public AjaxResult getInfo(@PathVariable("deviceId") Long deviceId) {
|
public AjaxResult getInfo(@PathVariable("deviceId") Long deviceId) {
|
||||||
return success(smDeviceService.selectSmDeviceByDeviceId(deviceId));
|
ServiceUtil.assertion(!deviceValidator.isBelong(deviceId, getUserId()), "这不是您的设备");
|
||||||
|
SmDeviceVo device = smDeviceService.selectSmDeviceByDeviceId(deviceId);
|
||||||
|
List<SmDeviceVo> list = Collections.singletonList(device);
|
||||||
|
deviceAssembler.assembleOrderCountInfo(list); // 订单统计信息
|
||||||
|
return success(device);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@MchRequired
|
||||||
@ApiOperation("设备通断电")
|
@ApiOperation("设备通断电")
|
||||||
@PutMapping("/{deviceId}/changePower")
|
@PutMapping("/{deviceId}/changePower")
|
||||||
public AjaxResult close(@PathVariable @ApiParam("设备id") Long deviceId, String status) {
|
public AjaxResult close(@PathVariable @ApiParam("设备id") Long deviceId, String status) {
|
||||||
|
@ -130,6 +133,7 @@ public class AppDeviceController extends BaseController {
|
||||||
return success(smDeviceService.reset(deviceId));
|
return success(smDeviceService.reset(deviceId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@MchRequired
|
||||||
@ApiOperation("获取设备用电量分析")
|
@ApiOperation("获取设备用电量分析")
|
||||||
@GetMapping("/electric/count")
|
@GetMapping("/electric/count")
|
||||||
public AjaxResult count(@Validated({ValidGroup.Query.class}) SmMeterReadingRecordQuery dto)
|
public AjaxResult count(@Validated({ValidGroup.Query.class}) SmMeterReadingRecordQuery dto)
|
||||||
|
@ -139,26 +143,36 @@ public class AppDeviceController extends BaseController {
|
||||||
|
|
||||||
@MchRequired
|
@MchRequired
|
||||||
@ApiOperation("设备充值时长")
|
@ApiOperation("设备充值时长")
|
||||||
@PostMapping("/addTime/{deviceId}")
|
@PutMapping("/addTime/{deviceId}")
|
||||||
public AjaxResult addTime(@PathVariable @ApiParam("设备id") Long deviceId, @ApiParam("电量(度)") BigDecimal amount)
|
public AjaxResult addTime(@PathVariable @ApiParam("设备id") Long deviceId, @ApiParam("电量(度)") BigDecimal amount)
|
||||||
{
|
{
|
||||||
|
ServiceUtil.assertion(!deviceValidator.isBelong(deviceId, getUserId()), "这不是您的设备");
|
||||||
SmDeviceVo device = smDeviceService.selectSmDeviceByDeviceId(deviceId);
|
SmDeviceVo device = smDeviceService.selectSmDeviceByDeviceId(deviceId);
|
||||||
ServiceUtil.assertion(device == null || !getUserId().equals(device.getUserId()), "设备不存在或您无权充值");
|
ServiceUtil.assertion(device == null || !getUserId().equals(device.getUserId()), "设备不存在或您无权充值");
|
||||||
smDeviceService.addTime(deviceId, amount);
|
smDeviceService.addTime(deviceId, amount);
|
||||||
return success(true);
|
return success(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@MchRequired
|
||||||
@ApiOperation("刷新设备信息")
|
@ApiOperation("刷新设备信息")
|
||||||
@GetMapping("/{deviceId}/refreshIot")
|
@GetMapping("/{deviceId}/refreshIot")
|
||||||
public AjaxResult syncIot(@PathVariable @ApiParam("设备id") Long deviceId) {
|
public AjaxResult syncIot(@PathVariable @ApiParam("设备id") Long deviceId) {
|
||||||
|
ServiceUtil.assertion(!deviceValidator.isBelong(deviceId, getUserId()), "这不是您的设备");
|
||||||
smDeviceService.pullDeviceInfo(Collections.singletonList(deviceId));
|
smDeviceService.pullDeviceInfo(Collections.singletonList(deviceId));
|
||||||
return success();
|
return success();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("判断设备是否已经被绑定")
|
@ApiOperation("判断设备是否已经被绑定")
|
||||||
@GetMapping("/{mac}/isBind")
|
@GetMapping("/isBind")
|
||||||
public AjaxResult syncIot(@PathVariable @ApiParam("设备mac") String mac) {
|
public AjaxResult syncIot(@RequestParam(required = false) @ApiParam("设备mac") String mac,
|
||||||
return success(smDeviceService.isBind(mac));
|
@RequestParam(required = false) @ApiParam("设备sn") String deviceNo) {
|
||||||
|
if (StringUtils.hasText(mac)) {
|
||||||
|
return success(smDeviceService.isBindByMac(mac));
|
||||||
|
} else if (StringUtils.hasText(deviceNo)) {
|
||||||
|
return success(smDeviceService.isBindBySn(deviceNo));
|
||||||
|
} else {
|
||||||
|
return error("至少传入一个MAC号或SN码");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("获取设备,包含套餐列表")
|
@ApiOperation("获取设备,包含套餐列表")
|
||||||
|
@ -167,4 +181,10 @@ public class AppDeviceController extends BaseController {
|
||||||
public AjaxResult getDeviceWithSuitList(@PathVariable String deviceNo) {
|
public AjaxResult getDeviceWithSuitList(@PathVariable String deviceNo) {
|
||||||
return success(smDeviceService.getDeviceWithSuitList(deviceNo));
|
return success(smDeviceService.getDeviceWithSuitList(deviceNo));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation("通过SN码获取设备信息")
|
||||||
|
@GetMapping("/{deviceNo}/bySn")
|
||||||
|
public AjaxResult getByDeviceNo(@PathVariable @ApiParam("设备编号(SN)") String deviceNo) {
|
||||||
|
return success(smDeviceService.selectByDeviceNo(deviceNo));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.ruoyi.web.controller.app;
|
package com.ruoyi.web.controller.app;
|
||||||
|
|
||||||
|
import com.ruoyi.common.annotation.Anonymous;
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
import com.ruoyi.ss.transactionBill.service.TransactionBillService;
|
import com.ruoyi.ss.transactionBill.service.TransactionBillService;
|
||||||
import com.ruoyi.ss.wxPay.service.IWxPayService;
|
import com.ruoyi.ss.wxPay.service.IWxPayService;
|
||||||
|
@ -38,6 +39,7 @@ public class AppPayController {
|
||||||
// 微信支付结果通知
|
// 微信支付结果通知
|
||||||
@ApiOperation("微信支付通知")
|
@ApiOperation("微信支付通知")
|
||||||
@PostMapping("/notify/wx")
|
@PostMapping("/notify/wx")
|
||||||
|
@Anonymous
|
||||||
public ResponseEntity<Boolean> wxPayNotify(HttpServletRequest request) {
|
public ResponseEntity<Boolean> wxPayNotify(HttpServletRequest request) {
|
||||||
try {
|
try {
|
||||||
wxPayService.payNotify(request);
|
wxPayService.payNotify(request);
|
||||||
|
|
|
@ -30,6 +30,7 @@ import org.springframework.util.CollectionUtils;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -88,13 +89,16 @@ public class AppTransactionBillController extends BaseController
|
||||||
/**
|
/**
|
||||||
* 查询收支列表
|
* 查询收支列表
|
||||||
*/
|
*/
|
||||||
|
@MchRequired
|
||||||
@ApiOperation("查询本人收支列表")
|
@ApiOperation("查询本人收支列表")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
|
@JsonView(JsonViewProfile.AppMch.class)
|
||||||
public TableDataInfo list(TransactionBillQuery smTransactionBill)
|
public TableDataInfo list(TransactionBillQuery smTransactionBill)
|
||||||
{
|
{
|
||||||
startPage();
|
startPage();
|
||||||
smTransactionBill.setUserId(getUserId());
|
smTransactionBill.setUserId(getUserId());
|
||||||
List<TransactionBillVo> list = smTransactionBillService.selectSmTransactionBillList(smTransactionBill);
|
List<TransactionBillVo> list = smTransactionBillService.selectSmTransactionBillList(smTransactionBill);
|
||||||
|
transactionAssembler.assembleChannelName(list);
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,6 +114,7 @@ public class AppTransactionBillController extends BaseController
|
||||||
|
|
||||||
@MchRequired
|
@MchRequired
|
||||||
@ApiOperation("获取商户统计信息")
|
@ApiOperation("获取商户统计信息")
|
||||||
|
@JsonView(JsonViewProfile.AppMch.class)
|
||||||
@GetMapping("/landlordCount")
|
@GetMapping("/landlordCount")
|
||||||
public AjaxResult landlordCount(@Validated({ValidGroup.Query.class}) TransactionBillQuery dto) {
|
public AjaxResult landlordCount(@Validated({ValidGroup.Query.class}) TransactionBillQuery dto) {
|
||||||
Date now = new Date();
|
Date now = new Date();
|
||||||
|
|
|
@ -20,7 +20,7 @@ wx:
|
||||||
# apiV3密钥
|
# apiV3密钥
|
||||||
apiV3Key: 49819e0f0abdb2df3246f7b27f264d75
|
apiV3Key: 49819e0f0abdb2df3246f7b27f264d75
|
||||||
# 通知回调地址
|
# 通知回调地址
|
||||||
notifyUrl: http://124.221.246.124:2288/app/pay/notify/wx # 内网穿透
|
notifyUrl: http://124.221.246.124:2288/dev-api/app/pay/notify/wx # 内网穿透
|
||||||
# 密钥所在位置
|
# 密钥所在位置
|
||||||
privateKeyPath: D:/project/证书/wxpay/apiclient_key.pem
|
privateKeyPath: D:/project/证书/wxpay/apiclient_key.pem
|
||||||
# 证书序列号
|
# 证书序列号
|
||||||
|
|
Loading…
Reference in New Issue
Block a user