This commit is contained in:
邱贞招 2025-01-25 09:21:32 +08:00
parent 724607e0e2
commit 5db571124d
38 changed files with 498 additions and 106 deletions

View File

@ -107,7 +107,7 @@ public class AppRoomController extends BaseController {
logger.info("开卫生间【toiletId={}】", toiletId);
ToiletVO toiletVO = toiletService.selectToiletByToiletId(toiletId);
toiletValidator.preOpenToilet(toiletVO);
return success(roomService.openGate(toiletVO));
return success(toiletService.openToilet(toiletVO));
}
/**

View File

@ -59,6 +59,7 @@ public class DeviceController extends BaseController
{
startPage();
List<DeviceVO> list = deviceService.selectSmDeviceList(smDevice);
deviceService.pullDeviceInfoList(list);
// deviceAssembler.assembleRealServiceRate(list);
// deviceAssembler.assemblePlacementStatus(list, smDevice.getPlacementStatus());
deviceAssembler.assembleEquipment(list);

View File

@ -9,6 +9,7 @@ import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.ss.order.domain.Order;
import com.ruoyi.ss.order.domain.OrderQuery;
import com.ruoyi.ss.order.domain.OrderVO;
import com.ruoyi.ss.order.service.IOrderAssembler;
import com.ruoyi.ss.order.service.IOrderService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
@ -28,7 +29,10 @@ import java.util.List;
public class OrderController extends BaseController
{
@Resource
private IOrderService rlOrderService;
private IOrderService orderService;
@Resource
private IOrderAssembler orderAssembler;
/**
* 查询订单列表
@ -38,7 +42,7 @@ public class OrderController extends BaseController
public TableDataInfo list(OrderQuery rlOrder)
{
startPage();
List<OrderVO> list = rlOrderService.selectRlOrderList(rlOrder);
List<OrderVO> list = orderService.selectRlOrderList(rlOrder);
return getDataTable(list);
}
@ -50,7 +54,7 @@ public class OrderController extends BaseController
@PostMapping("/export")
public void export(HttpServletResponse response, OrderQuery rlOrder)
{
List<OrderVO> list = rlOrderService.selectRlOrderList(rlOrder);
List<OrderVO> list = orderService.selectRlOrderList(rlOrder);
ExcelUtil<OrderVO> util = new ExcelUtil<OrderVO>(OrderVO.class);
util.exportExcel(response, list, "订单数据");
}
@ -62,7 +66,9 @@ public class OrderController extends BaseController
@GetMapping(value = "/{orderId}")
public AjaxResult getInfo(@PathVariable("orderId") Long orderId)
{
return success(rlOrderService.selectRlOrderByOrderId(orderId));
OrderVO orderVO = orderService.selectRlOrderByOrderId(orderId);
orderAssembler.assembleOrderInfo(orderVO);
return success(orderVO);
}
/**
@ -73,7 +79,7 @@ public class OrderController extends BaseController
@PostMapping
public AjaxResult add(@RequestBody OrderQuery rlOrder)
{
return toAjax(rlOrderService.insertRlOrder(rlOrder));
return toAjax(orderService.insertRlOrder(rlOrder));
}
/**
@ -84,7 +90,7 @@ public class OrderController extends BaseController
@PutMapping
public AjaxResult edit(@RequestBody Order rlOrder)
{
return toAjax(rlOrderService.updateRlOrder(rlOrder));
return toAjax(orderService.updateRlOrder(rlOrder));
}
/**
@ -95,6 +101,6 @@ public class OrderController extends BaseController
@DeleteMapping("/{orderIds}")
public AjaxResult remove(@PathVariable Long[] orderIds)
{
return toAjax(rlOrderService.deleteRlOrderByOrderIds(orderIds));
return toAjax(orderService.deleteRlOrderByOrderIds(orderIds));
}
}

View File

@ -3,6 +3,11 @@ package com.ruoyi.web.controller.system;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import cn.hutool.core.util.ObjectUtil;
import com.ruoyi.common.constant.ServiceConstants;
import com.ruoyi.common.utils.ServiceUtil;
import com.ruoyi.ss.equipment.domain.EquipmentVO;
import com.ruoyi.ss.equipment.service.IEquipmentService;
import com.ruoyi.ss.room.service.IRoomAssembler;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
@ -41,6 +46,9 @@ public class RoomController extends BaseController
@Autowired
private IRoomAssembler roomAssembler;
@Autowired
private IEquipmentService equipmentService;
/**
* 查询房间列表
@ -59,6 +67,23 @@ public class RoomController extends BaseController
return getDataTable(list);
}
/**
* 查询房间列表
*/
@PreAuthorize("@ss.hasPermi('system:room:list')")
@GetMapping("/list2")
public TableDataInfo list2(RoomQuery query)
{
startPage();
startOrderBy();
List<RoomVO> list = eRoomService.selectERoomList(query);
roomAssembler.assembleRuleInfo2(list);
//将设备信息填充到房间中
roomAssembler.assembleHallDevice(list);
return getDataTable(list);
}
/**
* 导出房间列表
*/
@ -117,4 +142,20 @@ public class RoomController extends BaseController
{
return toAjax(eRoomService.deleteERoomByRoomIds(roomIds));
}
/**
* 开房间门(管理员)
*/
@GetMapping(value = "/openRoomGate/{roomId}")
public AjaxResult openRoomGate(@PathVariable("roomId") Long roomId)
{
logger.info("开房间门【roomId={}】", roomId);
RoomVO eRoomVO = eRoomService.selectERoomByRoomId(roomId);
ServiceUtil.assertion(ObjectUtil.isNull(eRoomVO), "房间不存在");
EquipmentVO door = equipmentService.selectDoorByRoomId(eRoomVO.getRoomId(), ServiceConstants.FACILITY_TYPE_ROOM_DOOR);
ServiceUtil.assertion(ObjectUtil.isNull(door), "房间门设施不存在");
ServiceUtil.assertion(ObjectUtil.isNull(door.getDeviceId()), "房间门未绑定设备");
return success(eRoomService.openGate(door));
}
}

View File

@ -36,7 +36,7 @@ import com.ruoyi.common.core.page.TableDataInfo;
public class StoreController extends BaseController
{
@Autowired
private IStoreService eStoreService;
private IStoreService storeService;
@Autowired
private IStoreAssembler storeAssembler;
@ -50,7 +50,7 @@ public class StoreController extends BaseController
{
startPage();
startOrderBy();
List<StoreVO> list = eStoreService.selectEStoreList(query);
List<StoreVO> list = storeService.selectEStoreList(query);
return getDataTable(list);
}
@ -62,7 +62,7 @@ public class StoreController extends BaseController
@PostMapping("/export")
public void export(HttpServletResponse response, StoreQuery query)
{
List<StoreVO> list = eStoreService.selectEStoreList(query);
List<StoreVO> list = storeService.selectEStoreList(query);
ExcelUtil<StoreVO> util = new ExcelUtil<StoreVO>(StoreVO.class);
util.exportExcel(response, list, "店铺数据");
}
@ -74,7 +74,7 @@ public class StoreController extends BaseController
@GetMapping(value = "/{storeId}")
public AjaxResult getInfo(@PathVariable("storeId") Long storeId)
{
StoreVO vo = eStoreService.selectEStoreByStoreId(storeId);
StoreVO vo = storeService.selectEStoreByStoreId(storeId);
// 拼接今日收入本月收入总设备数总营收房间总数正在使用中的房间数设施总数正在使用中的设施数 统计数据
storeAssembler.assembleStatisticalData(vo);
return success(vo);
@ -88,7 +88,7 @@ public class StoreController extends BaseController
@PostMapping
public AjaxResult add(@RequestBody Store eStore)
{
return toAjax(eStoreService.insertEStore(eStore));
return toAjax(storeService.insertEStore(eStore));
}
/**
@ -99,7 +99,7 @@ public class StoreController extends BaseController
@PutMapping
public AjaxResult edit(@RequestBody Store eStore)
{
return toAjax(eStoreService.updateEStore(eStore));
return toAjax(storeService.updateEStore(eStore));
}
/**
@ -110,6 +110,16 @@ public class StoreController extends BaseController
@DeleteMapping("/{storeIds}")
public AjaxResult remove(@PathVariable Long[] storeIds)
{
return toAjax(eStoreService.deleteEStoreByStoreIds(storeIds));
return toAjax(storeService.deleteEStoreByStoreIds(storeIds));
}
/**
* 开大门管理员
*/
@GetMapping(value = "/openGate/{storeId}")
public AjaxResult openGate(@PathVariable("storeId") Long storeId)
{
logger.info("开大门【storeId={}】", storeId);
return success(storeService.openGate(storeId));
}
}

View File

@ -109,4 +109,15 @@ public class ToiletController extends BaseController
{
return toAjax(toiletService.deleteToiletByToiletIds(toiletIds));
}
/**
* 开卫生间(管理员)
*/
@GetMapping(value = "/open/{toiletId}")
public AjaxResult openToilet(@PathVariable("toiletId") Long toiletId)
{
logger.info("开卫生间【toiletId={}】", toiletId);
ToiletVO toiletVO = toiletService.selectToiletByToiletId(toiletId);
return success(toiletService.openToilet(toiletVO));
}
}

View File

@ -147,7 +147,7 @@ qiniu:
# 七牛云命名空间
bucket: autosprout
# 过期时间(秒)
expireSeconds: 600
expireSeconds: 60000
# 七牛云GET请求域名
domain: https://lxnapi.ccttiot.com

View File

@ -395,6 +395,16 @@ public interface DeviceService
*/
int setTime(DeviceVO device, long seconds, int tryCount);
/**
* 设置通电时长
*/
int setTime(DeviceVO device, long seconds);
/**
* 设置断电时长
*/
int setTtme(DeviceVO device, long seconds);
/**
* 投放设备
*/
@ -424,4 +434,9 @@ public interface DeviceService
* 根据mac查询设备SN
*/
String selectSnByMac(String mac);
/**
* 通用控制设备方法
*/
boolean controlDevice(Long deviceId, Integer unlockTime, String unlockMode, boolean open);
}

View File

@ -1,9 +1,6 @@
package com.ruoyi.ss.device.service.impl;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.core.redis.RedisLock;
import com.ruoyi.common.core.redis.enums.RedisLockKey;
import com.ruoyi.common.exception.ServiceException;
@ -11,12 +8,10 @@ import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ServiceUtil;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.collection.CollectionUtils;
import com.ruoyi.ss.clean.domain.CleanVO;
import com.ruoyi.ss.device.domain.Device;
import com.ruoyi.ss.device.domain.DeviceBO;
import com.ruoyi.ss.device.domain.DeviceCountVO;
import com.ruoyi.ss.device.domain.DeviceQuery;
import com.ruoyi.ss.commandLog.domain.CommandLog;
import com.ruoyi.ss.device.domain.dto.DeviceBatchUpdateModelDTO;
import com.ruoyi.ss.device.domain.dto.DeviceRegisterDTO;
import com.ruoyi.ss.device.domain.dto.DeviceWifiDTO;
@ -41,7 +36,6 @@ import com.ruoyi.ss.model.domain.ModelVO;
import com.ruoyi.ss.model.domain.enums.ModelTag;
import com.ruoyi.ss.model.service.IModelService;
import com.ruoyi.ss.order.service.IOrderValidator;
import com.ruoyi.ss.room.domain.Room;
import com.ruoyi.ss.room.domain.RoomVO;
import com.ruoyi.ss.room.service.IRoomService;
import com.ruoyi.ss.store.domain.Store;
@ -416,21 +410,10 @@ public class DeviceServiceImpl implements DeviceService
*/
@Override
public boolean switchEquipment(Long equipmentId, boolean open,boolean isIgnore) {
EquipmentVO equipmentVO = equipmentService.selectEquipmentByEquipmentId(equipmentId);
ServiceUtil.assertion(equipmentVO == null, "设施不存在");
if(equipmentVO.getDeviceId() !=null){
if(equipmentVO.getUnlockMode().equals(LOCK_MODE_POWER_OFF)){
open = !open;
}
DeviceVO vo = selectById(equipmentVO.getDeviceId());
ServiceUtil.assertion(vo == null, "设备不存在");
if (open) {
return iotService.open(vo,isIgnore);
} else {
return iotService.close(vo,isIgnore);
}
}
return true;
EquipmentVO vo = equipmentService.selectEquipmentByEquipmentId(equipmentId);
ServiceUtil.assertion(vo == null, "设施不存在");
ServiceUtil.assertion(vo.getDeviceId() == null, "未绑定设备");
return controlDevice(vo.getDeviceId(),vo.getUnlockTime(),vo.getUnlockMode(),open);
}
@Override
@ -816,6 +799,20 @@ public class DeviceServiceImpl implements DeviceService
return this.setTime(device, LocalDateTime.now().plusSeconds(seconds), true, tryCount);
}
@Override
public int setTime(DeviceVO device, long seconds) {
CommandResponse res1 = iotService.setTime(device, seconds);
ServiceUtil.assertion(!res1.isSuccess(), "设备设置时长失败:" + res1.getMsg());
return 1;
}
@Override
public int setTtme(DeviceVO device, long seconds) {
CommandResponse res1 = iotService.setTtme(device, seconds);
ServiceUtil.assertion(!res1.isSuccess(), "设备设置时长失败:" + res1.getMsg());
return 1;
}
/**
* 投放
*/
@ -932,7 +929,7 @@ public class DeviceServiceImpl implements DeviceService
}else {// 其他的都是设施表
i = equipmentService.offlineDeviceByDeviceId(deviceId);
}
ServiceUtil.assertion(i == 0, "设备解绑失败,请刷新后重试");
// ServiceUtil.assertion(i == 0, "设备解绑失败,请刷新后重试");
// 清除投放状态
int i1 = deviceMapper.cleanPlacementStatus(deviceId);
@ -1221,7 +1218,6 @@ public class DeviceServiceImpl implements DeviceService
device.setVoltage(deviceInfo.getV());
device.setElectricity(deviceInfo.getA());
device.setVersion(deviceInfo.getVersion());
// device.setVxs(deviceInfo.getVxs());
// 判断是否支持WIFI支持则更新
if (ModelTag.hasTag(device.getModelTags(), ModelTag.WIFI)) {
@ -1607,9 +1603,7 @@ public class DeviceServiceImpl implements DeviceService
ServiceUtil.assertion(updateCount != 1, "当前设备信息已变更,请刷新后重试");
// 删除设备与设施的关系投放状态
if(DEVICE_PLACEMENT_STATUS_PLACED.equals(device.getPlacementStatus())){
offlineDevice(deviceId, device.getPlacementType());
}
offlineDevice(deviceId, device.getPlacementType());
// 新增解绑记录
deviceBindRecordService.record(device.getUserId(), deviceId, BindRecordType.UNBIND, BindRecordUserType.MCH);
@ -1645,4 +1639,59 @@ public class DeviceServiceImpl implements DeviceService
CommandResponse res = iotService.setVxs(device, vxs, reason);
return res != null && res.isSuccess() ? 1 : 0;
}
/**
* 通用设备开关控制方法
* @param deviceId 设备ID
* @param unlockTime 开锁时间0表示立马开启/关闭
* @param unlockMode 开锁模式1-通电开锁2-断电开锁
* @return 操作是否成功
*/
@Override
public boolean controlDevice(Long deviceId, Integer unlockTime, String unlockMode, boolean open) {
// 参数校验
validateParams(deviceId, unlockTime, unlockMode);
// 获取设备信息
DeviceVO deviceVO = selectById(deviceId);
ServiceUtil.assertion(deviceVO == null, "设备不存在");
return unlockTime == 0 ?
handleDirectControl(deviceId, unlockMode, open) :
handleTimedControl(deviceVO, unlockTime, unlockMode);
}
/**
* 参数校验
*/
private void validateParams(Long deviceId, Integer unlockTime, String unlockMode) {
ServiceUtil.assertion(deviceId == null, "设备ID不能为空");
ServiceUtil.assertion(unlockTime == null, "开锁时间不能为空");
ServiceUtil.assertion((!LOCK_MODE_POWER_ON.equals(unlockMode) && !LOCK_MODE_POWER_OFF.equals(unlockMode)),"无效的开锁模式");
}
/**
* 处理直接控制
*/
private boolean handleDirectControl(Long deviceId, String unlockMode, boolean open) {
if(!LOCK_MODE_POWER_ON.equals(unlockMode)){
open = !open;
}
return switchDevice(deviceId, open);
}
/**
* 处理定时控制
*/
private boolean handleTimedControl(DeviceVO deviceVO, Integer unlockTime, String unlockMode) {
int result;
if (LOCK_MODE_POWER_ON.equals(unlockMode)) {
result = setTime(deviceVO, unlockTime.longValue());
ServiceUtil.assertion(result == 0, "通电开锁失败");
} else {
result = setTtme(deviceVO, unlockTime.longValue());
ServiceUtil.assertion(result == 0, "断电开锁失败");
}
return true;
}
}

View File

@ -49,6 +49,15 @@ public interface EquipmentMapper
*/
public int updateEquipment(@Param("data") Equipment equipment);
/**
* 根据房间id修改设施
*
* @param equipment 设施
* @return 结果
*/
public int updateEquipmentByRoomId(@Param("data") Equipment equipment);
/**
* 删除设施
*

View File

@ -221,6 +221,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where equipment_id = #{data.equipmentId}
</update>
<update id="updateEquipmentByRoomId" parameterType="Equipment">
update ss_equipment
<trim prefix="SET" suffixOverrides=",">
<include refid="updateColumns"/>
</trim>
where room_id = #{data.roomId}
</update>
<!-- <update id="offlineDevice" >-->
<!-- update ss_equipment-->
<!-- set device_id = null-->

View File

@ -56,6 +56,14 @@ public interface IEquipmentService
*/
public int updateEquipment(Equipment equipment);
/**
* 根据房间id修改设施
*
* @param equipment 设施
* @return 结果
*/
public int updateEquipmentByRoomId(Equipment equipment);
/**
* 批量删除设施
*

View File

@ -116,6 +116,18 @@ public class EquipmentServiceImpl implements IEquipmentService
return equipmentMapper.updateEquipment(equipment);
}
/**
* 根据房间id修改设施
*
* @param equipment 设施
* @return 结果
*/
@Override
public int updateEquipmentByRoomId(Equipment equipment)
{
return equipmentMapper.updateEquipmentByRoomId(equipment);
}
/**
* 批量删除设施
*

View File

@ -57,7 +57,12 @@ public class FeeRuleServiceImpl implements IFeeRuleService
if(query.getRoomId() != null){
RoomVO roomVO = roomService.selectERoomByRoomId(query.getRoomId());
ServiceUtil.assertion(roomVO == null, "房间不存在");
return selectEFeeRuleListByRuleIds(roomVO.getRuleIds());
List<Long> ruleIds = roomVO.getRuleIds();
if(ruleIds.isEmpty()){
query.setRuleIds(Collections.singletonList(0L));
}else{
query.setRuleIds(ruleIds);
}
}
return eFeeRuleMapper.selectEFeeRuleList(query);
}

View File

@ -79,6 +79,12 @@ public class Order extends BaseEntity {
@Excel(name = "大门sn码")
private String gateSn;
/**
* 大门Id
*/
@Excel(name = "大门Id")
private Long gateId;
/**
* 房间门mac
*/

View File

@ -2,6 +2,7 @@ package com.ruoyi.ss.order.domain;
import com.ruoyi.ss.feeRule.domain.FeeRuleVO;
import com.ruoyi.ss.orderOper.domain.OrderOper;
import com.ruoyi.ss.payBill.domain.PayBillVO;
import com.ruoyi.ss.refund.domain.Refund;
import com.ruoyi.ss.refund.domain.RefundVO;
import lombok.Data;
@ -36,4 +37,10 @@ public class OrderVO extends Order {
/** 退款列表 */
private List<Refund> refunds;
/** 支付单号 */
private String payNo;
/** 支付单对象 */
private PayBillVO payBillVO;
}

View File

@ -7,7 +7,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="OrderVO" id="RlOrderResult" autoMapping="true"/>
<sql id="selectRlOrderVo">
select order_id, order_no, user_id, user_name, real_name, phone, rule_id, gate_mac, gate_mac2, gate_sn, room_mac, room_mac2, room_sn, pay_time, pay_type, paid, pay_id, type,
select order_id, order_no, user_id, user_name, real_name, phone, rule_id, gate_mac, gate_mac2, gate_sn, gate_id, room_mac, room_mac2, room_sn, pay_time, pay_type, paid, pay_id, type,
total_fee, pay_fee, deposit, deposit_refund, refund, refund_time, is_refund, platform_service_fee, mark, duration, status, create_time, change_reason, pay_channel,
channel_name, channel_cost, store_name, lng,lat, store_id, merchant_id, original_order_no, price, `explain`, auto_cancel_time, is_send_msg, room_id,equipment_id,
equipment_type,equipment_name, room_name, room_type, mode, hours, reserve_start_time, reserve_end_time, wifi, wifi_password, manager_phone, deposit_refund_desc,
@ -26,6 +26,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
o.gate_mac,
o.gate_mac2,
o.gate_sn,
o.gate_id,
o.room_mac,
o.room_mac2,
o.room_sn,
@ -55,6 +56,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
o.lat,
o.store_id,
o.merchant_id,
m.user_name AS merchantName,
o.original_order_no,
o.price,
o.`explain`,
@ -306,13 +308,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
SELECT
o.order_no,
o.deposit_refund,
o.pay_fee
o.pay_fee,
p.pay_no
FROM
ss_order o
left join ss_pay_bill p on p.pay_id = o.pay_id
WHERE
o.is_refund = '0'
AND o.mode = '1'
AND o.refund_time IS NOT NULL
AND P.status = '3'
</select>
<select id="getCount" parameterType="OrderQuery" resultType="java.lang.Integer">
@ -340,6 +345,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="ruleId != null">rule_id,</if>
<if test="gateMac != null">gate_mac,</if>
<if test="gateSn != null">gate_sn,</if>
<if test="gateId != null">gate_id,</if>
<if test="roomMac != null">room_mac,</if>
<if test="roomSn != null">room_sn,</if>
<if test="payTime != null">pay_time,</if>
@ -397,6 +403,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="ruleId != null">#{ruleId},</if>
<if test="gateMac != null">#{gateMac},</if>
<if test="gateSn != null">#{gateSn},</if>
<if test="gateId != null">#{gateId},</if>
<if test="roomMac != null">#{roomMac},</if>
<if test="roomSn != null">#{roomSn},</if>
<if test="payTime != null">#{payTime},</if>
@ -458,6 +465,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="ruleId != null">rule_id = #{ruleId},</if>
<if test="gateMac != null">gate_mac = #{gateMac},</if>
<if test="gateSn != null">gate_sn = #{gateSn},</if>
<if test="gateId != null">gate_id = #{gateId},</if>
<if test="roomMac != null">room_mac = #{roomMac},</if>
<if test="roomSn != null">room_sn = #{roomSn},</if>
<if test="payTime != null">pay_time = #{payTime},</if>
@ -522,6 +530,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="ruleId != null">rule_id = #{ruleId},</if>
<if test="gateMac != null">gate_mac = #{gateMac},</if>
<if test="gateSn != null">gate_sn = #{gateSn},</if>
<if test="gateId != null">gate_id = #{gateId},</if>
<if test="roomMac != null">room_mac = #{roomMac},</if>
<if test="roomSn != null">room_sn = #{roomSn},</if>
<if test="payTime != null">pay_time = #{payTime},</if>

View File

@ -0,0 +1,13 @@
package com.ruoyi.ss.order.service;
import com.ruoyi.ss.order.domain.OrderVO;
public interface IOrderAssembler {
/**
* 拼接后台需要的订单信息
* @param order 房间对象
*/
void assembleOrderInfo(OrderVO order);
}

View File

@ -4,7 +4,6 @@ import com.ruoyi.ss.order.domain.OrderBO;
import com.ruoyi.ss.order.domain.dto.OrderDTO;
import com.ruoyi.ss.order.domain.dto.ProductDTO;
import com.ruoyi.ss.order.domain.dto.ReOrderDTO;
import com.ruoyi.ss.order.domain.dto.TopUpOrderDTO;
public interface IOrderConverter {

View File

@ -0,0 +1,37 @@
package com.ruoyi.ss.order.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.ruoyi.ss.order.domain.OrderVO;
import com.ruoyi.ss.order.service.IOrderAssembler;
import com.ruoyi.ss.payBill.domain.PayBillVO;
import com.ruoyi.ss.payBill.service.PayBillService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* 订单组装器
*
* @author qzz
* @date 2024-09-19
*/
@Service
public class OrderAssemblerImpl implements IOrderAssembler {
@Autowired
private PayBillService paymentService;
/**
* 拼接后台需要的订单信息
* @param order 房间对象
*/
@Override
public void assembleOrderInfo(OrderVO order) {
// 支付单信息
PayBillVO payBillVO = paymentService.selectPayBillByPayId(order.getPayId());
if(!ObjectUtil.isNull(payBillVO)){
order.setPayNo(payBillVO.getPayNo());
order.setPayBillVO(payBillVO);
}
}
}

View File

@ -1,10 +1,8 @@
package com.ruoyi.ss.order.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.core.domain.entity.User;
import com.ruoyi.common.core.redis.RedisLock;
import com.ruoyi.common.core.redis.enums.RedisLockKey;
@ -22,7 +20,6 @@ import com.ruoyi.ss.dividendDetail.domain.DividendDetailQuery;
import com.ruoyi.ss.dividendDetail.service.IDividendDetailService;
import com.ruoyi.ss.feeRule.domain.FeeRuleVO;
import com.ruoyi.ss.feeRule.service.IFeeRuleService;
import com.ruoyi.ss.msgLog.service.IMsgLogService;
import com.ruoyi.ss.order.domain.Order;
import com.ruoyi.ss.order.domain.OrderBO;
import com.ruoyi.ss.order.domain.OrderQuery;
@ -37,6 +34,9 @@ import com.ruoyi.ss.order.service.IOrderConverter;
import com.ruoyi.ss.order.service.IOrderService;
import com.ruoyi.ss.order.service.IOrderValidator;
import com.ruoyi.ss.orderOper.service.IOrderOperService;
import com.ruoyi.ss.pay.service.IWxPayService;
import com.ruoyi.ss.payBill.domain.PayBillVO;
import com.ruoyi.ss.payBill.service.PayBillService;
import com.ruoyi.ss.product.service.IProductService;
import com.ruoyi.ss.refund.domain.Refund;
import com.ruoyi.ss.refund.service.IRefundService;
@ -49,7 +49,6 @@ import com.ruoyi.ss.user.service.IUserService;
import com.ruoyi.system.domain.vo.InCome;
import com.ruoyi.system.domain.vo.IndexAdminVo;
import com.ruoyi.system.service.ISysConfigService;
import com.ruoyi.ss.pay.service.IWxPayService;
import com.wechat.pay.java.service.payments.jsapi.model.PrepayWithRequestPaymentResponse;
import org.jetbrains.annotations.NotNull;
import org.slf4j.Logger;
@ -64,13 +63,14 @@ import javax.annotation.Resource;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.DayOfWeek;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;
import java.time.temporal.TemporalAdjusters;
import java.util.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Objects;
import static com.ruoyi.common.constant.ServiceConstants.*;
import static com.ruoyi.common.utils.SecurityUtils.getUserId;
@ -135,6 +135,9 @@ public class OrderServiceImpl implements IOrderService
@Autowired
private IProductService productService;
@Autowired
private PayBillService paymentService;
@Value("${aliyun.accessKeyId}")
private String accessKeyId;
@ -585,6 +588,7 @@ public class OrderServiceImpl implements IOrderService
order.setGateMac(orderBO.getGate().getMac());
order.setGateMac2(orderBO.getGate().getMac2());
order.setGateSn(orderBO.getGate().getSn());
order.setGateId(orderBO.getGate().getDeviceId());
//房间
if(orderBO.getRoom() == null){
@ -753,6 +757,7 @@ public class OrderServiceImpl implements IOrderService
OrderVO order = orderMapper.selectRlOrderByOrderNo(orderNo);
ServiceUtil.assertion(order == null,"订单不存在");
PayBillVO payBillVO = paymentService.selectPayBillByPayId(order.getPayId());
// todo 刷新支付结果
Boolean execute = transactionTemplate.execute(e -> {
logger.info("=================【订单取消】==================");
@ -784,7 +789,7 @@ public class OrderServiceImpl implements IOrderService
}
if(refundAmount.compareTo(BigDecimal.ZERO) > 0){
String refNo = IdUtils.getOrderNo("ref");
wxPayService.refund(order,"订单取消,扣除违约金:"+penaltyAmount+",退还剩余金额:"+refundAmount, refundAmount,refNo);
wxPayService.refund(order,"订单取消,扣除违约金:"+penaltyAmount+",退还剩余金额:"+refundAmount, refundAmount,refNo,payBillVO.getPayNo());
}
}
/* 更新订单状态 */

View File

@ -51,8 +51,9 @@ public interface IWxPayService {
* @param reason 退款原因
* @param amount 退款金额
* @param outRefundNo 退款订单号
* @param payNo 支付单号
*/
void refund(OrderVO etOrder, String reason, BigDecimal amount, String outRefundNo);
void refund(OrderVO etOrder, String reason, BigDecimal amount, String outRefundNo, String payNo);
// /**
// * 发起商家转账

View File

@ -336,9 +336,10 @@ public class WxPayService implements IWxPayService {
* @param reason 退款原因
* @param amount 退款金额
* @param outRefundNo 退款订单号
* @param payNo 支付单号
*/
@Override
public void refund(OrderVO etOrder, String reason, BigDecimal amount, String outRefundNo) {
public void refund(OrderVO etOrder, String reason, BigDecimal amount, String outRefundNo, String payNo) {
if(!etOrder.getPaid().equals(ServiceConstants.ORDER_PAY_STATUS_PAID)) throw new ServiceException("订单状态异常");
ChannelVO channelVO = channelService.selectChannelByChannelId(etOrder.getPayChannel());
if (channelVO == null) {
@ -349,7 +350,7 @@ public class WxPayService implements IWxPayService {
log.info("----------{}-------------","微信官方退款");
CreateRequest request = new CreateRequest();
// todo 用支付表
// request.setOutTradeNo(etOrder.getOutTradeNo());
request.setOutTradeNo(payNo);
request.setOutRefundNo(outRefundNo);
request.setReason(reason);
request.setAmount(getAmountReq(etOrder.getPayFee(),amount));
@ -361,7 +362,7 @@ public class WxPayService implements IWxPayService {
}else if(PayChannel.TM_WX.equalsCode(channelVO.getCode())){
log.info("----------{}-------------","太米微信退款");
RefundAble refundAble = new RefundAble();
// refundAble.setOutTradeNo(etOrder.getOutTradeNo());
refundAble.setOutTradeNo(payNo);
refundAble.setOutRefundNo(outRefundNo);
refundAble.setReason(reason);
refundAble.setAmount(amount.multiply(new BigDecimal(100)).longValue());
@ -392,11 +393,16 @@ public class WxPayService implements IWxPayService {
}
private RefundService getRefundService(ChannelVO channelVO){
String privateKeyPath = channelVO.getPrivateKeyPath();
log.info("是否是测试环境------{}", isTest);
if(isTest){
privateKeyPath = path;
}
// 初始化商户配置
Config config = new RSAAutoCertificateConfig.Builder()
.merchantId(channelVO.getMerchantId())
// 使用 com.wechat.pay.java.core.util 中的函数从本地文件中加载商户私钥商户私钥会用来生成请求的签名
.privateKeyFromPath(channelVO.getPrivateKeyPath())
.privateKeyFromPath(privateKeyPath)
.merchantSerialNumber(channelVO.getMerchantSerialNumber())
.apiV3Key(channelVO.getApiV3Key())
.build();

View File

@ -20,8 +20,7 @@ public enum PayBillStatus {
PAY_SUCCESS("3", "支付成功"),
CANCEL("4", "已取消"),
REFUNDING("5", "退款中"),
REFUNDED("6", "已退款")
;
REFUNDED("6", "已退款");
private final String status;
private final String msg;

View File

@ -13,6 +13,7 @@ import com.ruoyi.ss.order.service.IOrderService;
import com.ruoyi.ss.orderOper.service.IOrderOperService;
import com.ruoyi.ss.payBill.domain.PayBill;
import com.ruoyi.ss.payBill.domain.PayBillQuery;
import com.ruoyi.ss.payBill.domain.PayBillVO;
import com.ruoyi.ss.payBill.domain.enums.PayBillStatus;
import com.ruoyi.ss.payBill.service.PayBillService;
import com.ruoyi.ss.refund.domain.Refund;
@ -153,6 +154,7 @@ public class RefundServiceImpl implements IRefundService
{
OrderVO orderVO = bo.getOrder();
RefundDTO dto = bo.getDto();
PayBillVO payBill = bo.getPayBill();
Boolean execute = transactionTemplate.execute(e -> {
/** 2. 创建退款对象*/
String refNo = saveRefund(dto, orderVO);
@ -180,7 +182,7 @@ public class RefundServiceImpl implements IRefundService
/** 6. 发起退款 */
try {
wxPayService.refund(orderVO, "商家退款金额", dto.getAmount(), refNo);
wxPayService.refund(orderVO, "商家退款金额", dto.getAmount(), refNo,payBill.getPayNo());
}catch (com.wechat.pay.java.core.exception.ServiceException ex){
logger.error("退款失败:{}",ex.getErrorMessage());
throw new ServiceException("退款失败:"+ex.getErrorMessage());
@ -193,18 +195,18 @@ public class RefundServiceImpl implements IRefundService
private String saveRefund(RefundDTO dto, OrderVO orderVO) {
Refund refund = new Refund();
String orderNo = IdUtils.getOrderNo(ServiceConstants.ORDER_TYPE_REFUND_PREFIX);
String refundNo = IdUtils.getOrderNo(ServiceConstants.ORDER_TYPE_REFUND_PREFIX);
refund.setCreateTime(DateUtils.getNowDate());
refund.setAmount(dto.getAmount());
refund.setReason(dto.getReason());
refund.setUserId(getUserId());
refund.setPayId(dto.getPayId());
refund.setUserName(SecurityUtils.getUsername());
refund.setRefundNo(orderNo);
refund.setRefundNo(refundNo);
refund.setMerchantId(orderVO.getMerchantId());
int i = refundMapper.insertEtRefund(refund);
ServiceUtil.assertion(i == 0,"保存退款对象失败");
return orderNo;
return refundNo;
}
/**

View File

@ -52,7 +52,7 @@ public class RefundValidatormpl implements IRefundValidator
ServiceUtil.assertion(ORDER_PAY_STATUS_NON_PAYMENT.equals(orderVO.getPaid()), "订单未支付,不能发起退款");
ServiceUtil.assertion(dto.getAmount().compareTo(BigDecimal.ZERO) <= 0, "退款金额不能为0");
ServiceUtil.assertion(dto.getAmount().compareTo(orderVO.getPayFee()) > 0, "退款金额不能超过订单金额");
ServiceUtil.assertion(!PayBillStatus.PAY_SUCCESS.getStatus().equals(payBillVO.getStatus()), "当前状态不允许退款");
ServiceUtil.assertion(!PayBillStatus.PAY_SUCCESS.getStatus().equals(payBillVO.getStatus()), "支付单状态非:"+PayBillStatus.PAY_SUCCESS.getMsg()+",不允许退款");
RefundBO bo = new RefundBO();
bo.setOrder(orderVO);

View File

@ -93,12 +93,6 @@ public interface IRoomService
*/
boolean openGate(EquipmentVO equipmentVO);
/**
* 开卫生间门
* @param toiletVO 卫生间对象
* @return String
*/
boolean openGate(ToiletVO toiletVO);
/**
* 根据店铺查房间

View File

@ -375,10 +375,8 @@ public class RoomAssemblerImpl implements IRoomAssembler {
if(deviceId == null){
return;
}
DeviceVO deviceVO = deviceService.selectById(deviceId);
ServiceUtil.assertion(deviceVO == null, "设备不存在");
roomVO.setDeviceId(deviceId);
roomVO.setSn(deviceVO.getSn());
roomVO.setSn(equipmentVOS.get(0).getSn());
}
}

View File

@ -199,11 +199,26 @@ public class RoomServiceImpl implements IRoomService
@Override
public int updateERoom(Room eRoom)
{
if(eRoom.getStoreId() != null && StrUtil.isNotBlank(eRoom.getType())){
int i = storeService.updateStoreTypeTags(eRoom.getStoreId(), eRoom.getType());
ServiceUtil.assertion(i == 0, "店铺类型标签更新失败");
}
return roomMapper.updateERoom(eRoom);
Boolean execute = transactionTemplate.execute(e -> {
if(eRoom.getStoreId() != null && StrUtil.isNotBlank(eRoom.getType())){
int i = storeService.updateStoreTypeTags(eRoom.getStoreId(), eRoom.getType());
ServiceUtil.assertion(i == 0, "店铺类型标签更新失败");
}
int i = roomMapper.updateERoom(eRoom);
ServiceUtil.assertion(i == 0, "修改房间失败");
if(StrUtil.isNotBlank(eRoom.getRoomName())){// 同时更新设施中的房间名
Equipment equipment = new Equipment();
equipment.setRoomName(eRoom.getRoomName());
equipment.setRoomId(eRoom.getRoomId());
int i1 = equipmentService.updateEquipmentByRoomId(equipment);
ServiceUtil.assertion(i1 == 0, "修改房间设施失败");
}
return Boolean.TRUE;
});
if(Boolean.FALSE.equals(execute))throw new ServiceException("【修改房间】失败");
return 1;
}
/**
@ -240,16 +255,7 @@ public class RoomServiceImpl implements IRoomService
*/
@Override
public boolean openGate(EquipmentVO equipmentVO) {
return deviceService.switchDevice(equipmentVO.getDeviceId(), true);
}
/**
* 开卫生间门
* @param toiletVO 卫生间对象
*/
@Override
public boolean openGate(ToiletVO toiletVO) {
return deviceService.switchDevice(toiletVO.getDeviceId(), true);
return deviceService.controlDevice(equipmentVO.getDeviceId(),equipmentVO.getUnlockTime(),equipmentVO.getUnlockMode(),true);
}
/**

View File

@ -58,7 +58,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<sql id="searchCondition">
<if test="query.name != null and query.name != ''"> and s.name like concat('%', #{query.name}, '%')</if>
<if test="query.contactName != null and query.contactName != ''"> and s.contact_name like concat('%', #{query.contactName}, '%')</if>
<if test="query.type != null and query.type != ''"> and s.type = #{query.type}</if>
<if test="query.type != null and query.type != ''"> and FIND_IN_SET( #{query.type}, s.type_tags )</if>
<if test="query.contactMobile != null and query.contactMobile != ''"> and s.contact_mobile = #{query.contactMobile}</if>
<if test="query.idcard != null and query.idcard != ''"> and s.idcard = #{query.idcard}</if>
<if test="query.storeId != null and query.storeId != ''"> and s.store_id = #{query.storeId}</if>

View File

@ -170,6 +170,9 @@ public class StoreServiceImpl implements IStoreService
@Override
public int insertEStore(Store eStore)
{
if(!Objects.isNull(eStore.getTypeTags())){
eStore.setType(eStore.getTypeTags().get(0));
}
eStore.setCreateTime(DateUtils.getNowDate());
Long merchantId = eStore.getMerchantId();
if(merchantId == null){
@ -279,7 +282,7 @@ public class StoreServiceImpl implements IStoreService
@Override
public boolean openGate(Long storeId) {
StoreVO storeVO = storeMapper.selectEStoreByStoreId(storeId);
return smDeviceService.switchDevice(storeVO.getGateId(), true);
return smDeviceService.controlDevice(storeVO.getGateId(),storeVO.getUnlockTime(),storeVO.getUnlockMode(), true);
}
/**
@ -298,7 +301,9 @@ public class StoreServiceImpl implements IStoreService
public ServerPhone getServicePhone(Long storeId) {
StoreVO eStoreVO = storeMapper.selectEStoreByStoreId(storeId);
ServerPhone serverPhone = new ServerPhone();
serverPhone.setStorePhone(eStoreVO.getServerPhone());
if(!Objects.isNull(eStoreVO)){
serverPhone.setStorePhone(eStoreVO.getServerPhone());
}
String platformPhone = configService.selectConfigByKey("ss.platform.phone");
serverPhone.setPlatformPhone(platformPhone);
return serverPhone;

View File

@ -13,4 +13,6 @@ public class ToiletVO extends Toilet{
@ApiModelProperty("二维码文本")
private String qrText;
private String sn;
}

View File

@ -75,4 +75,11 @@ public interface IToiletService
* @return String
*/
int selectCount(ToiletQuery toilet);
/**
* 开卫生间门
* @param toiletVO 卫生间对象
* @return String
*/
boolean openToilet(ToiletVO toiletVO);
}

View File

@ -3,6 +3,7 @@ package com.ruoyi.ss.toilet.service.impl;
import java.util.List;
import com.ruoyi.common.utils.ServiceUtil;
import com.ruoyi.ss.device.domain.vo.DeviceVO;
import com.ruoyi.ss.device.service.DeviceService;
import com.ruoyi.ss.store.domain.StoreVO;
import com.ruoyi.ss.store.service.IStoreService;
@ -14,6 +15,8 @@ import com.ruoyi.ss.toilet.service.IToiletService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import static com.ruoyi.common.constant.ServiceConstants.LOCK_MODE_POWER_OFF;
import static com.ruoyi.common.constant.ServiceConstants.LOCK_MODE_POWER_ON;
import static com.ruoyi.common.utils.SecurityUtils.getUserId;
/**
@ -133,4 +136,15 @@ public class ToiletServiceImpl implements IToiletService
public int selectCount(ToiletQuery toilet) {
return toiletMapper.selectCount(toilet);
}
/**
* 开卫生间门
* @param toiletVO 卫生间对象
*/
@Override
public boolean openToilet(ToiletVO toiletVO) {
ServiceUtil.assertion(toiletVO == null, "卫生间不存在");
return deviceService.controlDevice(toiletVO.getDeviceId(), toiletVO.getUnlockTime(), toiletVO.getUnlockMode(), true);
}
}

View File

@ -39,10 +39,36 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</sql>
<select id="selectUserList" parameterType="UserQuery" resultMap="EUserResult">
select u.user_id, u.nick_name, u.user_name, u.real_name,u.email, u.avatar, u.phonenumber,u.user_type,u.service_fee_proportion,
u.clean_duration, u.clean_notice,u.ago_cancel,u.penalty,u.pay_channel,u.merchant_id,u.store_id,u.device_admin,
u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,u.is_authentication, u.balance,
u.wxopenid from ss_user u
select u.user_id,
u.nick_name,
u.user_name,
u.real_name,
u.email,
u.avatar,
u.phonenumber,
u.user_type,
u.service_fee_proportion,
u.clean_duration,
u.clean_notice,
u.ago_cancel,
u.penalty,
u.pay_channel,
u.merchant_id,
u.store_id,
s.name as storeName,
u.device_admin,
u.sex,
u.status,
u.del_flag,
u.login_ip,
u.login_date,
u.create_by,
u.create_time,
u.remark,
u.is_authentication,
u.balance,
u.wxopenid from ss_user u
left join ss_store s on u.store_id = s.store_id
where u.del_flag = '0' and u.user_name != 'admin'
<if test="userId != null and userId != 0">
AND u.user_id = #{userId}
@ -79,7 +105,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if>
${params.dataScope}
GROUP BY u.user_name
order by u.login_date desc
order by u.create_time desc
</select>
<select id="selectAppUserList" parameterType="User" resultMap="EUserResult">
@ -125,9 +151,43 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="selectUserById" parameterType="Long" resultMap="EUserResult">
select u.user_id, u.user_name, u.real_name, u.id_card, u.nick_name, u.email, u.avatar,u.service_fee_proportion,pay_channel,merchant_id,u.clean_duration, u.clean_notice,u.ago_cancel,u.penalty,
u.phonenumber, u.password, u.sex, u.status,u.user_type,r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status, u.balance,u.device_admin,u.app_menus,u.before_time,
u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,u.wxopenid,u.is_authentication,u.pay_channel,u.dividend_proportion
select u.user_id,
u.user_name,
u.real_name,
u.id_card,
u.nick_name,
u.email,
u.avatar,
u.service_fee_proportion,pay_channel,merchant_id,
u.clean_duration,
u.clean_notice,
u.ago_cancel,
u.penalty,
u.phonenumber,
u.password,
u.store_id,
u.sex,
u.status,
u.user_type,
r.role_id,
r.role_name,
r.role_key,
r.role_sort,
r.data_scope,
r.status,
u.balance,
u.device_admin,
u.app_menus,
u.before_time,
u.del_flag,
u.login_ip,
u.login_date,
u.create_by,
u.create_time,
u.remark,u.wxopenid,
u.is_authentication,
u.pay_channel,
u.dividend_proportion
from ss_user u
left join sys_user_role ur on u.user_id = ur.user_id
left join sys_role r on r.role_id = ur.role_id

View File

@ -64,7 +64,7 @@ public interface IotService {
boolean close(IotDevice device,boolean isIgnore);
/**
* 设置剩余时长
* 设置通电时长
*
* @param deviceName 设备名称
* @param seconds 时长
@ -73,10 +73,24 @@ public interface IotService {
CommandResponse setTime(String deviceName, long seconds, String productId);
/**
* 设置剩余时长
* 设置断电时长
*
* @param deviceName 设备名称
* @param seconds 时长
* @param productId
*/
CommandResponse setTtme(String deviceName, long seconds, String productId);
/**
* 设置通电时长
*/
CommandResponse setTime(IotDevice device, long seconds);
/**
* 设置断电时长
*/
CommandResponse setTtme(IotDevice device, long seconds);
/**
* 获取设备信息并转化为IotDeviceInfo
*

View File

@ -404,7 +404,7 @@ public class IotServiceImpl implements IotService {
}
/**
* 设置剩余时长
* 设置通电时长
*
* @param deviceName 设备名称
* @param seconds 时长
@ -414,11 +414,27 @@ public class IotServiceImpl implements IotService {
@Override
public CommandResponse setTime(String deviceName, long seconds, String productId) {
if (seconds < 0) {
throw new ServiceException("设置剩余时长参数错误读数不允许小于0");
throw new ServiceException("设置通电时长参数错误读数不允许小于0");
}
return sendCommand(deviceName, IotConstants.COMMAND_RECHARGE + seconds + IotConstants.COMMAND_SEPARATOR, 5, productId);
}
/**
* 设置断电时长
*
* @param deviceName 设备名称
* @param seconds 时长
* @param productId
* @return 是否成功
*/
@Override
public CommandResponse setTtme(String deviceName, long seconds, String productId) {
if (seconds < 0) {
throw new ServiceException("设置断电时长参数错误读数不允许小于0");
}
return sendCommand(deviceName, IotConstants.COMMAND_REVERSE_RECHARGE + seconds + IotConstants.COMMAND_SEPARATOR, 5, productId);
}
@Override
public CommandResponse setTime(IotDevice device, long seconds) {
if (device == null || StringUtils.isBlank(device.getProductId())) {
@ -436,6 +452,23 @@ public class IotServiceImpl implements IotService {
return res;
}
@Override
public CommandResponse setTtme(IotDevice device, long seconds) {
if (device == null || StringUtils.isBlank(device.getProductId())) {
throw new ServiceException("设置时长错误:参数不允许为空");
}
CommandResponse res = null;
if (StringUtils.hasText(device.iotMac1())) {
res = this.setTtme(device.iotMac1(), seconds, device.getProductId());
}
if ((res == null || !res.isSuccess()) && StringUtils.hasText(device.iotMac2())) {
res = this.setTtme(device.iotMac2(), seconds, device.getProductId());
}
return res;
}
@Override
public CommandResponse addEle(String deviceName, BigDecimal ele, String productId) {

View File

@ -108,7 +108,7 @@ public class SsTask {
String refNo = IdUtils.getOrderNo("ref");
BigDecimal depositRefund = orderVO.getDepositRefund();
wxPayService.refund(orderVO,"订单结束,已使用金额:"+orderVO.getPayFee()+",退还剩余金额:"+depositRefund, depositRefund,refNo);
wxPayService.refund(orderVO,"订单结束,已使用金额:"+orderVO.getPayFee()+",退还剩余金额:"+depositRefund, depositRefund,refNo,orderVO.getPayNo());
}
log.info("-------------------【定时任务】押金自动退还处理---结束----------------");
}