Compare commits

..

2 Commits
master ... old

Author SHA1 Message Date
SjS
3a75fe93e1 卡座换绑功能 2025-05-20 15:22:47 +08:00
SjS
6b7eae8354 新增套餐bug修改,太米支付修正 2025-05-20 15:10:39 +08:00
36 changed files with 132 additions and 219 deletions

View File

@ -17,7 +17,6 @@ public enum LogBizType {
UNIT("5", "单位"),
SHIFT("6", "调班"),
SUIT("SUIT", "套餐"),
DEVICE("DEVICE", "设备"),
ARTICLE_CATEGORY("ARTICLE_CATEGORY", "文章分类"),
BOOTH("BOOTH", "卡座");

View File

@ -91,7 +91,7 @@ public class DataScopeUtil {
}
// 全部数据范围
if (DataScopeConstants.DATA_SCOPE_ALL.equals(dataScope)) {
sqlString = new StringBuilder(" OR 1=1 ");
sqlString = new StringBuilder();
conditions.add(dataScope);
break;
}

View File

@ -30,10 +30,10 @@ public class Booth extends BaseEntity
@NotNull(message = "分区ID不能为空",groups = ValidGroup.Create.class)
private Long partId;
@Excel(name = "卡座")
@ApiModelProperty("卡座")
@NotBlank(message = "卡座不能为空",groups = ValidGroup.Create.class)
private String boothName;
@Excel(name = "卡座编号")
@ApiModelProperty("卡座编号")
@NotBlank(message = "卡座编号不能为空",groups = ValidGroup.Create.class)
private String boothNo;
@Excel(name = "过期时间")
@ApiModelProperty("过期时间")

View File

@ -15,7 +15,4 @@ public class BoothQuery extends BoothVO {
@ApiModelProperty("当前时间")
private LocalDateTime time;
@ApiModelProperty("父分区ID")
private Long partParentId;
}

View File

@ -23,10 +23,6 @@ public class BoothVO extends Booth{
@ApiModelProperty("店铺名称")
private String storeName;
@Excel(name = "商户名称")
@ApiModelProperty("商户名称")
private String mchName;
@Excel(name = "店铺ID")
@ApiModelProperty("店铺ID")
private Long storeId;

View File

@ -12,14 +12,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="userId" column="user_id" />
<result property="expiredTime" column="expired_time" />
<result property="orderNum" column="order_num" />
<result property="boothName" column="booth_name" />
</resultMap>
<sql id="selectBoothVo">
select
bb.booth_id,
bb.part_id,
bb.booth_name,
bb.booth_no,
bb.picture,
bb.create_time,
bb.user_id,
@ -29,8 +28,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
bp.part_name as part_name,
bp_parent.part_name as parent_name,
bs.store_name as store_name,
bs.user_id as mch_id,
mch_su.user_name as mch_name
bs.user_id as mch_id
from <include refid="searchTables"/>
</sql>
@ -39,7 +37,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
left join bst_part bp on bp.part_id = bb.part_id
left join bst_part bp_parent on bp.parent_id = bp_parent.part_id
left join bst_store bs on bp.store_id = bs.store_id
left join sys_user mch_su on bs.user_id = mch_su.user_id
</sql>
<sql id="searchCondition">
@ -47,12 +44,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="query.userId != null "> and bb.user_id = #{query.userId}</if>
<if test="query.deleted != null "> and bb.deleted = #{query.deleted}</if>
<if test="query.boothId != null "> and bb.booth_id = #{query.boothId}</if>
<if test="query.storeId != null "> and bs.store_id = #{query.storeId}</if>
<if test="query.boothName != null and query.boothName != ''"> and bb.booth_name like concat('%', #{query.boothName}, '%')</if>
<if test="query.boothNo != null and query.boothNo != ''"> and bb.booth_no like concat('%', #{query.boothNo}, '%')</if>
<if test="query.picture != null and query.picture != ''"> and bb.picture = #{query.picture}</if>
<if test="query.partName != null and query.partName != ''"> and bp.part_name like concat('%', #{query.partName}, '%') </if>
<if test="query.partName != null and query.partName != ''"> and bp.part_name like concat('%', #{query.partName}, '%') </if>
<if test="query.time != null"> and bb.expired_time &gt;= #{query.time} </if>
<if test="query.partParentId != null"> or bp_parent.part_id = #{query.partParentId} </if>
<if test="query.storeName != null and query.storeName != ''"> and bs.store_name like concat('%', #{query.storeName}, '%') </if>
${@com.ruoyi.framework.util.DataScopeUtil@create(query.scope)
.userSetAlias("bs.user_id")
@ -77,8 +73,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<!-- selectIdByQuery -->
<select id="selectIdByQuery" resultType="Long">
select bb.booth_id from
<include refid="searchTables"/>
select bb.booth_id <include refid="searchTables"/>
<where>
<include refid="searchCondition"/>
</where>
@ -89,6 +84,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
from <include refid="searchTables"/>
<where>
<if test="query.boothId != null "> and bb.booth_id != #{query.boothId}</if>
<if test="query.boothNo != null "> and bb.booth_no = #{query.boothNo}</if>
</where>
</select>
@ -99,7 +95,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectBoothByBoothNo" resultType="com.ruoyi.bst.booth.domain.BoothVO">
<include refid="selectBoothVo"/>
where bb.booth_name = #{boothName}
where bb.booth_no = #{boothNo}
</select>
<insert id="insertBooth" parameterType="Booth" useGeneratedKeys="true" keyProperty="boothId">
@ -109,14 +105,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="picture != null">picture,</if>
<if test="createTime != null">create_time,</if>
<if test="orderNum != null">order_num,</if>
<if test="boothName != null">booth_name,</if>
<if test="boothNo != null">booth_no,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="partId != null">#{partId},</if>
<if test="picture != null">#{picture},</if>
<if test="createTime != null">#{createTime},</if>
<if test="orderNum != null">#{orderNum},</if>
<if test="boothName != null">#{boothName},</if>
<if test="boothNo != null">#{boothNo},</if>
</trim>
</insert>
@ -203,7 +199,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<sql id="updateColumns">
<if test="data.partId != null">part_id = #{data.partId},</if>
<if test="data.boothName != null">booth_name = #{data.boothName},</if>
<if test="data.boothNo != null">booth_no = #{data.boothNo},</if>
<if test="data.picture != null">picture = #{data.picture},</if>
<if test="data.createTime != null">create_time = #{data.createTime},</if>
<if test="data.userId != null">user_id = #{data.userId},</if>

View File

@ -86,7 +86,7 @@ public interface BoothService
public int deleteBoothByBoothId(Long boothId);
public BoothVO bindUser(Long userId, Long boothId);
public BoothVO bindUser(Long userId, String boothNo);
public DeviceIotVO lighting(BoothVO booth, Long userId,boolean requiredIot);
@ -96,7 +96,5 @@ public interface BoothService
int unbindUser(BoothVO booth);
int userChangeBind(Long usingBoothId ,Long changeBoothId,Long userId);
List<Long> selectChildrenIds(BoothQuery query);
int userChangeBind(String usingBoothNo ,String changeBoothNo,Long userId);
}

View File

@ -20,5 +20,9 @@ public interface BoothValidator {
*/
boolean canDeleteAll(List<Long> ids);
/**
* 校验
* @param boothId
*/
void validate(Long boothId,String boothNo);
}

View File

@ -17,7 +17,7 @@ public class BoothConverterImpl implements BoothConverter {
// 设置基本信息
po.setPartId(data.getPartId());
po.setPicture(data.getPicture());
po.setBoothName(data.getBoothName());
po.setBoothNo(data.getBoothNo());
po.setOrderNum(data.getOrderNum());
return po;
}
@ -32,7 +32,7 @@ public class BoothConverterImpl implements BoothConverter {
po.setBoothId(data.getBoothId());
po.setPartId(data.getPartId());
po.setPicture(data.getPicture());
po.setBoothName(data.getBoothName());
po.setBoothNo(data.getBoothNo());
po.setOrderNum(data.getOrderNum());
return po;
}

View File

@ -1,7 +1,6 @@
package com.ruoyi.bst.booth.service.impl;
import java.time.LocalDateTime;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
@ -101,12 +100,12 @@ public class BoothServiceImpl implements BoothService {
}
@Override
public BoothVO selectBoothByBoothNo(String boothName, boolean scope) {
if (boothName == null) {
public BoothVO selectBoothByBoothNo(String boothNo, boolean scope) {
if (boothNo == null) {
return null;
}
BoothQuery query = new BoothQuery();
query.setBoothName(boothName);
query.setBoothNo(boothNo);
query.setScope(scope);
query.addStorePermission(StoreStaffPermission.BOOTH_VIEW.getCode());
return this.selectOne(query);
@ -140,9 +139,15 @@ public class BoothServiceImpl implements BoothService {
@Override
public int insertBooth(Booth booth) {
booth.setCreateTime(DateUtils.getNowDate());
PartVO partVO = partService.selectPartById(booth.getPartId());
ServiceUtil.assertion(partVO == null, "id为%s的分区信息不存在", booth.getPartId());
return boothMapper.insertBooth(booth);
Integer result = transactionTemplate.execute(status -> {
int rows = boothMapper.insertBooth(booth);
if (rows > 0) {
// 后校验
boothValidator.validate(booth.getBoothId(), booth.getBoothNo());
}
return rows;
});
return result == null ? 0 : result;
}
/**
@ -153,9 +158,9 @@ public class BoothServiceImpl implements BoothService {
*/
@Override
public int updateBooth(Booth booth) {
ServiceUtil.assertion(booth.getPartId() == null, "分区ID不能为空");
PartVO partVO = partService.selectPartById(booth.getPartId());
ServiceUtil.assertion(partVO == null, "id为%s的分区信息不存在", booth.getPartId());
if (booth.getBoothNo() != null) {
boothValidator.validate(booth.getBoothId(), booth.getBoothNo());
}
return boothMapper.updateBooth(booth);
}
@ -182,29 +187,20 @@ public class BoothServiceImpl implements BoothService {
}
@Override
public BoothVO bindUser(Long userId, Long boothId) {
public BoothVO bindUser(Long userId, String boothNo) {
boolean lock = redisLock.lock(RedisLockKey.BOOTH_BIND_USER, userId);
ServiceUtil.assertion(!lock, "您当前操作过于频繁,请稍后重试");
try {
//查询当前用户当前绑定的卡座
BoothQuery query = new BoothQuery();
query.setUserId(userId);
query.setTime(LocalDateTime.now());
List<BoothVO> list = boothMapper.selectBoothList(query);
if (list != null && !list.isEmpty()) {
return CollectionUtils.firstElement(list);
for (BoothVO vo : list) {
vo.setUserId(null);
boothMapper.updateBooth(vo);
}
BoothVO booth = boothMapper.selectBoothByBoothId(boothId);
BoothVO booth = boothMapper.selectBoothByBoothNo(boothNo);
ServiceUtil.assertion(booth == null, "当前卡座不存在");
if (booth.getUserId() != null && booth.getExpiredTime() != null && booth.getExpiredTime().isAfter(LocalDateTime.now())) {
// 卡座未过期被其他用户绑定
ServiceUtil.assertion(!booth.getUserId().equals(userId), "卡座已被绑定");
// 卡座未过期被当前用户绑定
ServiceUtil.assertion(booth.getUserId().equals(userId), "请勿重复绑定该设备");
} else {
booth.setExpiredTime(LocalDateTime.now().plusMinutes(30));
booth.setUserId(userId);
}
booth.setUserId(userId);
int i = boothMapper.updateBooth(booth);
ServiceUtil.assertion(i == 0, "操作失败");
return booth;
@ -229,15 +225,15 @@ public class BoothServiceImpl implements BoothService {
}
@Override
public int userChangeBind(Long usingBoothId, Long changeBoothId, Long userId) {
public int userChangeBind(String usingBoothNo, String changeBoothNo, Long userId) {
BoothVO usingBooth = boothMapper.selectBoothByBoothId(usingBoothId);
ServiceUtil.assertion(usingBooth == null, "ID为%s的卡座信息不存在", usingBoothId);
ServiceUtil.assertion(usingBooth.getUserId() == null, "请先绑定ID为%s的卡座后再进行操作", usingBoothId);
ServiceUtil.assertion(!usingBooth.getUserId().equals(userId), "您无权限更改当前卡座信息", usingBoothId);
BoothVO changeBooth = boothMapper.selectBoothByBoothId(changeBoothId);
ServiceUtil.assertion(changeBooth == null, "ID为%s的卡座信息不存在", changeBoothId);
boolean lock = redisLock.lock(RedisLockKey.BOOTH_CHANGE_USER, changeBoothId);
BoothVO usingBooth = boothMapper.selectBoothByBoothNo(usingBoothNo);
ServiceUtil.assertion(usingBooth == null, "编号为%s的卡座信息不存在", usingBoothNo);
ServiceUtil.assertion(usingBooth.getUserId() == null, "请先绑定编号为%s的卡座后再进行操作", usingBoothNo);
ServiceUtil.assertion(!usingBooth.getUserId().equals(userId), "您无权限更改当前卡座信息", usingBoothNo);
BoothVO changeBooth = boothMapper.selectBoothByBoothNo(changeBoothNo);
ServiceUtil.assertion(changeBooth == null, "编号为%s的卡座信息不存在", changeBoothNo);
boolean lock = redisLock.lock(RedisLockKey.BOOTH_CHANGE_USER, changeBoothNo);
ServiceUtil.assertion(!lock, "您当前操作过于频繁,请稍后重试");
try {
Integer result = transactionTemplate.execute(status -> {
@ -258,21 +254,17 @@ public class BoothServiceImpl implements BoothService {
});
return result;
} finally {
redisLock.unlock(RedisLockKey.BOOTH_CHANGE_USER, changeBoothId);
redisLock.unlock(RedisLockKey.BOOTH_CHANGE_USER, changeBoothNo);
}
}
@Override
public List<Long> selectChildrenIds(BoothQuery query) {
return Collections.emptyList();
}
@Override
public DeviceIotVO lighting(BoothVO booth, Long userId, boolean requiredIot) {
// 操作校验
ServiceUtil.assertion(booth.getStoreId() == null, "当前卡座未绑定店铺");
ServiceUtil.assertion(booth.getExpiredTime().isBefore(LocalDateTime.now()), "请重新绑定卡座");
// 判断当前用户是否在该店铺下有余额
LightingNumVO vo = lightingNumMapper.selectLightingNumByUserId(userId, booth.getStoreId());
@ -283,9 +275,10 @@ public class BoothServiceImpl implements BoothService {
DeviceQuery deviceQuery = new DeviceQuery();
deviceQuery.setBoothId(booth.getBoothId());
deviceQuery.setDeleted(false);
deviceQuery.setBoothId(booth.getBoothId());
deviceQuery.setBoothNo(booth.getBoothNo());
List<DeviceVO> deviceVOList = deviceMapper.selectDeviceList(deviceQuery);
ServiceUtil.assertion(CollectionUtils.isEmpty(deviceVOList), "当前卡座下无可用设备");
ServiceUtil.assertion(deviceVOList.isEmpty(), "当前卡座下无设备");
// 设备相关校验
deviceVOList.forEach(deviceVO -> {
@ -294,7 +287,6 @@ public class BoothServiceImpl implements BoothService {
ServiceUtil.assertion(deviceVO.getDuration() == null, "设备编号为%s的设备暂未设置开启时长", deviceVO.getDeviceNo());
});
// 新建IotVO 返回数据库操作与物联网操作结果
DeviceIotVO iotVO = new DeviceIotVO();
@ -345,7 +337,7 @@ public class BoothServiceImpl implements BoothService {
ServiceUtil.assertion(res == null, "设备爆灯失败:未知错误");
return IotUtil.isSuccess(res);
} else {
ServiceUtil.assertion(true, "当前设备正在爆灯,请等待爆灯结束后再进行操作");
ServiceUtil.assertion(true, "爆灯频繁,请稍等后再进行爆灯");
}
return false;
}

View File

@ -37,6 +37,28 @@ public class BoothValidatorImpl implements BoothValidator {
return canOperate(ids);
}
@Override
public void validate(Long boothId,String boothNo) {
BoothVO booth = boothMapper.selectBoothByBoothId(boothId);
ServiceUtil.assertion(booth == null, "卡座不存在");
// 判断卡座编号是否重复
this.validateNo(boothId, boothNo);
}
private void validateNo(Long boothId, String boothNo) {
if (StringUtils.isBlank(boothNo)) {
return;
}
BoothQuery query = new BoothQuery();
query.setDeleted(false);
query.setBoothId(boothId);
query.setBoothNo(boothNo);
int count = boothMapper.selectCount(query);
ServiceUtil.assertion(count > 0,"卡座编号已存在");
}
// 是否可以操作卡座
private boolean canOperate(List<Long> boothIds) {
return hasPermission(boothIds);

View File

@ -21,11 +21,8 @@ public class DeviceQuery extends DeviceVO{
@ApiModelProperty("店铺id")
private Long storeId;
@ApiModelProperty("MAC列表")
private List<String> macList;
@ApiModelProperty("卡座名称")
private String boothName;
@ApiModelProperty("卡座编号")
private String boothNo;
@ApiModelProperty("是否查询未绑定的设备")
private Boolean isUnbound;

View File

@ -1,20 +0,0 @@
package com.ruoyi.bst.device.domain.dto;
import com.ruoyi.iot.domain.IotDeviceDetail;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
@Data
public class DeviceBltUploadDTO {
@ApiModelProperty("设备MAC")
@NotBlank(message = "设备MAC不能为空")
private String mac;
@ApiModelProperty("系统数据")
@NotNull(message = "系统数据不能为空")
private IotDeviceDetail sys;
}

View File

@ -8,5 +8,5 @@ public class DeviceMacSnVO {
// MAC
private String mac;
// SN
private String deviceNo;
private String sn;
}

View File

@ -7,7 +7,6 @@ import com.ruoyi.bst.device.domain.Device;
import com.ruoyi.bst.device.domain.DeviceCountVO;
import com.ruoyi.bst.device.domain.DeviceVO;
import com.ruoyi.bst.device.domain.DeviceQuery;
import com.ruoyi.bst.device.domain.vo.DeviceMacSnVO;
import com.ruoyi.common.domain.vo.LongIntegerVO;
import com.ruoyi.common.domain.vo.StringIntegerVO;
import org.apache.ibatis.annotations.Param;
@ -177,13 +176,4 @@ public interface DeviceMapper
* @return
*/
List<StringIntegerVO> selectOnlineStatusCount(@Param("query") DeviceQuery query);
/**
* 根据mac查询SN
*
* @param query
* @return
*/
List<DeviceMacSnVO> selectMacSnList(@Param("query") DeviceQuery query);
}

View File

@ -91,7 +91,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
su.user_name,
bs.store_name,
bs.store_id,
bb.booth_name as position
bb.booth_no as position
from <include refid="searchTables"/>
</sql>
@ -104,16 +104,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</sql>
<sql id="searchCondition">
<if test="query.deviceNo != null and query.deviceNo != ''"> and bd.device_no like concat('%', #{query.deviceNo}, '%')</if>
<if test="query.deviceNo != null and query.deviceNo != ''"> and bd.device_no = #{query.deviceNo}</if>
<if test="query.deviceId != null and query.deviceId != ''"> and bd.device_id = #{query.deviceId}</if>
<if test="query.storeId != null and query.storeId != ''"> and bd.store_id = #{query.storeId}</if>
<if test="query.boothId != null "> and bd.booth_id = #{query.boothId}</if>
<if test="query.boothName != null and query.boothName !=''"> and bb.booth_name = #{query.boothName}</if>
<if test="query.boothNo != null and query.boothNo !=''"> and bb.booth_no = #{query.boothNo}</if>
<if test="query.userId != null "> and bd.user_id = #{query.userId}</if>
<if test="query.modelId != null "> and bd.model_id = #{query.modelId}</if>
<if test="query.deviceName != null and query.deviceName != ''"> and bd.device_name like concat('%', #{query.deviceName}, '%')</if>
<if test="query.storeName != null and query.storeName != ''"> and bs.store_name like concat('%', #{query.storeName}, '%')</if>
<if test="query.mac != null and query.mac != ''"> and bd.mac like concat('%', #{query.mac}, '%')</if>
<if test="query.mac != null and query.mac != ''"> and bd.mac = #{query.mac}</if>
<if test="query.mac2 != null and query.mac2 != ''"> and bd.mac2 = #{query.mac2}</if>
<if test="query.totalElectriQuantity != null "> and bd.total_electri_quantity = #{query.totalElectriQuantity}</if>
<if test="query.onlineStatus != null and query.onlineStatus != ''"> and bd.online_status = #{query.onlineStatus}</if>
@ -143,12 +143,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="query.wxs != null "> and bd.wxs = #{query.wxs}</if>
<if test="query.isUnbound != null and query.isUnbound "> and bd.booth_id IS NULL</if>
<if test="query.lastRecoverTime != null "> and bd.last_recover_time = #{query.lastRecoverTime}</if>
<if test="query.macList != null and query.macList.size() > 0">
and bd.mac in
<foreach collection="query.macList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
${@com.ruoyi.framework.util.DataScopeUtil@create(query.scope)
.userSetAlias("bd.user_id")
.storeAlias("bd.store_id",query.storePermissions)
@ -268,17 +262,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
group by `key`
</select>
<!--selectMacSnList-->
<select id="selectMacSnList" resultType="com.ruoyi.bst.device.domain.vo.DeviceMacSnVO">
select
bd.mac,
bd.device_no
from bst_device bd
<where>
<include refid="searchCondition"/>
</where>
</select>
<insert id="insertDevice" parameterType="Device" useGeneratedKeys="true" keyProperty="deviceId">
<selectKey resultType="Long" order="AFTER" keyProperty="deviceId">
select LAST_INSERT_ID()
@ -897,7 +880,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<update id="unbindStore">
update bst_device
set store_id = null,booth_id = null
set store_id = null
where device_id = #{deviceId}
</update>
@ -918,7 +901,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<update id="unbindBooth">
update bst_device
set booth_id = null
set booth_id = null,store_id = null
where device_id = #{deviceId}
</update>

View File

@ -12,7 +12,6 @@ import com.ruoyi.bst.booth.domain.BoothVO;
import com.ruoyi.bst.device.domain.Device;
import com.ruoyi.bst.device.domain.DeviceVO;
import com.ruoyi.bst.device.domain.DeviceQuery;
import com.ruoyi.bst.device.domain.vo.DeviceMacSnVO;
import com.ruoyi.bst.store.domain.StoreVO;
import com.ruoyi.common.domain.vo.LongIntegerVO;
@ -137,9 +136,10 @@ public interface DeviceService
/**
* 根据设备ID解除绑定
* @param deviceId
* @param booth
* @return
*/
public void unbindBooth(Long deviceId);
public void unbindBooth(Long deviceId,BoothVO booth);
/**
@ -170,13 +170,4 @@ public interface DeviceService
* @param store
*/
void unbindStore(Long deviceId, StoreVO store);
/**
* 根据mac查询SN
*
* @param macList
* @return
*/
public List<DeviceMacSnVO> listSnByMac(List<String> macList);
}

View File

@ -22,7 +22,6 @@ import com.ruoyi.bst.device.domain.dto.DeviceWifiDTO;
import com.ruoyi.bst.device.domain.enums.DeviceOnlineStatus;
import com.ruoyi.bst.device.domain.enums.DevicePowerStatus;
import com.ruoyi.bst.device.domain.enums.DeviceStatus;
import com.ruoyi.bst.device.domain.vo.DeviceMacSnVO;
import com.ruoyi.bst.model.domain.ModelVO;
import com.ruoyi.bst.model.domain.enums.ModelTag;
import com.ruoyi.bst.model.service.ModelService;
@ -379,7 +378,7 @@ public class DeviceServiceImpl implements DeviceService
}
@Override
public void unbindBooth(Long deviceId) {
public void unbindBooth(Long deviceId, BoothVO booth) {
DeviceVO device = deviceMapper.selectDeviceByDeviceId(deviceId);
ServiceUtil.assertion(device == null, "设备未录入");
@ -449,14 +448,4 @@ public class DeviceServiceImpl implements DeviceService
int i = deviceMapper.unbindStore(device.getDeviceId());
ServiceUtil.assertion(i==0,"绑定失败");
}
@Override
public List<DeviceMacSnVO> listSnByMac(List<String> macList) {
if (CollectionUtils.isEmptyElement(macList)) {
return Collections.emptyList();
}
DeviceQuery query = new DeviceQuery();
query.setMacList(macList);
return deviceMapper.selectMacSnList(query);
}
}

View File

@ -19,12 +19,12 @@ public class LightingNumVO extends LightingNum{
@ApiModelProperty("用户昵称")
private String nickName;
@Excel(name = "户账号")
@ApiModelProperty("户账号")
@Excel(name = "户账号")
@ApiModelProperty("户账号")
private String mchName;
@Excel(name = "户昵称")
@ApiModelProperty("户昵称")
@Excel(name = "户昵称")
@ApiModelProperty("户昵称")
private String mchNickName;
}

View File

@ -38,8 +38,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="query.userId != null "> and bln.user_id = #{query.userId}</if>
<if test="query.storeId != null "> and bln.store_id = #{query.storeId}</if>
<if test="query.number != null "> and bln.number = #{query.number}</if>
<if test="query.userName != null "> and su.user_name like concat('%',#{query.userName},'%') </if>
<if test="query.nickName != null "> and su.nick_name like concat('%',#{query.nickName},'%') </if>
<if test="query.userName != null "> and bs.user_name like concat('%',#{query.userName},'%') </if>
<if test="query.storeName != null "> and bs.store_name like concat('%',#{query.storeName},'%')</if>
<if test="query.mchId != null "> and bs.user_id = #{query.mchId}</if>
${@com.ruoyi.framework.util.DataScopeUtil@create(query.scope)

View File

@ -18,9 +18,6 @@ public class OrderQuery extends OrderVO{
@ApiModelProperty("用户id列表")
private List<Long> userIds;
@ApiModelProperty("下单用户")
private String userName;
@ApiModelProperty("商户id")
private Long mchId;

View File

@ -59,7 +59,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</sql>
<sql id="searchCondition">
<if test="query.orderNo != null and query.orderNo != ''"> and bo.order_no like concat('%', #{query.orderNo}, '%')</if>
<if test="query.orderNo != null and query.orderNo != ''"> and bo.order_no = #{query.orderNo}</if>
<if test="query.id != null and query.id != ''"> and bo.id = #{query.id}</if>
<if test="query.storeId != null "> and bo.store_id = #{query.storeId}</if>
<if test="query.storeName != null and query.storeName != ''"> and bo.store_name like concat('%', #{query.storeName}, '%')</if>
@ -78,7 +78,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="query.endTime != null"> and date(bo.create_time) &lt;= #{query.endTime}</if>
<if test="query.createDate != null"> and date(bo.create_time) = #{query.createDate}</if>
<if test="query.mchId != null"> and bs.user_id = #{query.mchId}</if>
<if test="query.userName != null"> and su.user_name like concat('%', #{query.userName}, '%')</if>
<if test="query.statusList != null and query.statusList.size() > 0">
and bo.status in
<foreach collection="query.statusList" item="item" open="(" separator="," close=")">

View File

@ -12,7 +12,4 @@ public class PartQuery extends PartVO {
@ApiModelProperty("分区ID列表")
private List<Long> ids;
@ApiModelProperty("父分区ID列表")
private List<Long> parentIds;
}

View File

@ -74,5 +74,5 @@ public interface PartMapper
public List<Long> selectIdByQuery(@Param("query") PartQuery query);
List<PartVO> selectChildren(List<Long> ids);
List<PartVO> selectChildren(PartVO partVO);
}

View File

@ -44,12 +44,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="query.picture != null and query.picture != ''"> and picture = #{query.picture}</if>
<if test="query.storeName != null and query.storeName != ''"> and bs.store_name like concat('%', #{query.storeName}, '%') </if>
<if test="query.parentName != null and query.parentName != ''"> and bp_parent.part_name like concat('%', #{query.parentName}, '%') </if>
<if test="query.parentIds != null and query.parentIds.size() > 0">
and bp.parent_id in
<foreach collection="query.parentIds" item="ids" open="(" separator="," close=")">
#{ids}
</foreach>
</if>
${@com.ruoyi.framework.util.DataScopeUtil@create(query.scope)
.userSetAlias("bs.user_id")
.storeAlias("bp.store_id",query.storePermissions)

View File

@ -114,10 +114,6 @@ public class PartServiceImpl implements PartService
@Override
public int deletePartByPartIds(List<Long> partIds)
{
PartQuery query = new PartQuery();
query.setParentIds(partIds);
List<PartVO> list = partMapper.selectPartList(query);
ServiceUtil.assertion(!list.isEmpty(),"当前区域有子分区,不允许删除");
return partMapper.deletePartByPartIds(partIds);
}

View File

@ -37,7 +37,7 @@ public class PayConverterImpl implements PayConverter {
// 基础信息
pay.setStatus(PayStatus.WAIT_PAY.getStatus());
pay.setExpireTime(LocalDateTime.now().plusMinutes(10));
pay.setDescription("充值订单:"+order.getOrderNo());
pay.setRemark("充值订单:"+order.getOrderNo());
// 订单信息
pay.setBstType(PayBstType.ORDER.getType());

View File

@ -41,7 +41,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="query.storeId != null and query.storeId != ''"> and br.store_id = #{query.storeId}</if>
<if test="query.month != null">and month(br.create_time) = #{query.month}</if>
<if test="query.year != null">and year(br.create_time) = #{query.year}</if>
<if test="query.createDate != null">and date(br.create_time) = #{query.createDate}</if>
<if test="query.createDateRange != null and query.createDateRange.size() > 1">
and date(br.create_time) &gt;= #{query.createDateRange[0]}
and date(br.create_time) &lt;= #{query.createDateRange[1]}

View File

@ -31,7 +31,6 @@ public class Store extends BaseEntity
@Excel(name = "用户ID")
@ApiModelProperty("用户ID")
@NotNull(message = "所属用户不能为空",groups = {ValidGroup.Create.class})
private Long userId;
@Excel(name = "店铺名称")

View File

@ -14,7 +14,6 @@ public class StoreConverterImpl implements StoreConverter {
Store po = new Store();
// 设置基本信息
po.setStoreName(data.getStoreName());
po.setUserId(data.getUserId());
po.setUserName(data.getUserName());
po.setPhone(data.getPhone());
po.setStartTime(data.getStartTime());
@ -34,7 +33,6 @@ public class StoreConverterImpl implements StoreConverter {
Store po = new Store();
// 设置基本信息
po.setStoreId(data.getStoreId());
po.setUserId(data.getUserId());
po.setStoreName(data.getStoreName());
po.setUserName(data.getUserName());
po.setPhone(data.getPhone());

View File

@ -8,6 +8,7 @@ import org.springframework.stereotype.Service;
@Service
public class SuitConverterImpl implements SuitConverter {
@Override
public Suit toPoByCreate(Suit data) {
if (data == null) {

View File

@ -6,7 +6,6 @@ import com.github.pagehelper.PageHelper;
import com.ruoyi.bst.store.domain.StoreQuery;
import com.ruoyi.bst.store.domain.StoreVO;
import com.ruoyi.bst.store.service.StoreService;
import com.ruoyi.bst.storeStaff.domain.StoreStaff;
import com.ruoyi.bst.storeStaff.domain.enums.StoreStaffPermission;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ServiceUtil;
@ -66,8 +65,8 @@ public class SuitServiceImpl implements SuitService
@Override
public int insertSuit(Suit suit)
{
storeService.selectStoreById(suit.getStoreId());
suit.setUserId(suit.getUserId());
StoreVO store = storeService.selectStoreById(suit.getStoreId());
suit.setUserId(store.getUserId());
suit.setCreateTime(DateUtils.getNowDate());
return suitMapper.insertSuit(suit);
}
@ -81,9 +80,9 @@ public class SuitServiceImpl implements SuitService
@Override
public int updateSuit(Suit suit)
{
StoreVO StoreVO = storeService.selectStoreById(suit.getStoreId());
ServiceUtil.assertion(StoreVO==null,"当前店铺不存在");
suit.setUserId(StoreVO.getUserId());
StoreVO store = storeService.selectStoreById(suit.getStoreId());
ServiceUtil.assertion(store==null,"当前店铺不存在");
suit.setUserId(store.getUserId());
return suitMapper.updateSuit(suit);
}

View File

@ -41,25 +41,31 @@ public class AppBoothController extends BaseController {
if (booth == null) {
return error("当前卡座信息不存在");
}
if (booth.getUserId()==null) {
return error("您无权操作当前卡座设备");
}
if (!booth.getUserId().equals(getUserId())){
return error("您无权操作当前卡座设备");
}
return success(boothService.lighting(booth,getUserId(),requiredIot));
}
@ApiOperation("用户绑定卡座")
@PutMapping("/{boothId}/bindUser")
public AjaxResult bindBooth(@PathVariable Long boothId) {
if (boothId == null) {
@PutMapping("/{boothNo}/bindUser")
public AjaxResult bindBooth(@PathVariable String boothNo) {
if (boothNo == null) {
return error("卡座编号不能为空");
};
return AjaxResult.success(boothService.bindUser(getUserId(),boothId));
return AjaxResult.success(boothService.bindUser(getUserId(),boothNo));
}
@ApiOperation("用户解绑卡座")
@PutMapping("/{boothId}/unbind")
public AjaxResult unbindBooth(@PathVariable Long boothId) {
if (boothId == null) {
@PutMapping("/{boothNo}/unbind")
public AjaxResult unbindBooth(@PathVariable String boothNo) {
if (boothNo == null) {
return error("卡座编号不能为空");
};
BoothVO booth = boothService.selectBoothByBoothId(boothId);
BoothVO booth = boothService.selectBoothByBoothNo(boothNo);
ServiceUtil.assertion(booth==null,"当前卡座不存在");
ServiceUtil.assertion(!booth.getUserId().equals(getUserId()),"您无权操作当前卡座设备");
return AjaxResult.success(boothService.unbindUser(booth));
@ -67,11 +73,11 @@ public class AppBoothController extends BaseController {
@ApiOperation("用户换绑卡座")
@PutMapping("/userChangeBind")
public AjaxResult userChangeBind( Long usingBoothId ,Long changeBoothId) {
if (usingBoothId == null || changeBoothId == null) {
return error("卡座ID不能为空");
public AjaxResult userChangeBind( String usingBoothNo ,String changeBoothNo) {
if (usingBoothNo == null || changeBoothNo == null) {
return error("卡座编号不能为空");
};
return AjaxResult.success(boothService.userChangeBind(usingBoothId,changeBoothId,getUserId()));
return AjaxResult.success(boothService.userChangeBind(usingBoothNo,changeBoothNo,getUserId()));
}
@ApiOperation("查询用户绑定的卡座和设备信息")

View File

@ -61,7 +61,7 @@ public class BoothController extends BaseController {
*/
@PreAuthorize("@ss.hasPermi('bst:booth:list')")
@GetMapping("/list")
public TableDataInfo list(BoothQuery query,boolean needChildren) {
public TableDataInfo list(BoothQuery query) {
startPage();
startOrderBy();
query.setScope(true);
@ -114,6 +114,7 @@ public class BoothController extends BaseController {
if (!partValidator.canCheckForPart(booth.getPartId())) {
return AjaxResult.error("您无权选择ID为" + booth.getPartId() + "的分区");
}
// 卡座编号唯一性校验
return toAjax(boothService.insertBooth(booth));
}
@ -153,6 +154,7 @@ public class BoothController extends BaseController {
if (boothId == null) {
return AjaxResult.error("卡座ID不能为空");
}
if (!boothValidator.canEdit(boothId)) {
return AjaxResult.error("您无更改该卡座相关的权限");
}
@ -163,10 +165,12 @@ public class BoothController extends BaseController {
if (!storeValidator.canEdit(booth.getStoreId())) {
return AjaxResult.error("您无权限操作当前店铺信息");
}
// 设备权限校验
if (!deviceValidator.canOperate(device.getDeviceId())) {
return AjaxResult.error("您无权限操作当设备信息");
}
// 绑定设备
if (device.getDeviceId() != null) {
return AjaxResult.success("操作成功", deviceService.bindBoothById(device.getDeviceId(), booth));
@ -205,7 +209,7 @@ public class BoothController extends BaseController {
return AjaxResult.error("您无权限操作当设备信息");
}
deviceService.unbindBooth(device.getDeviceId());
deviceService.unbindBooth(device.getDeviceId(), booth);
return AjaxResult.success("操作成功");
}
}

View File

@ -90,7 +90,7 @@ public class ChangeRecordController extends BaseController
@PreAuthorize("@ss.hasPermi('bst:changeRecord:consumeRecord')")
@Log(title = "消费记录列表")
@Log(title = "爆灯次数变化")
@GetMapping("/consumeRecord")
public AjaxResult consumeRecord(ChangeRecordQuery query) {
if (query.getUserId() == null) {

View File

@ -196,14 +196,5 @@ public class DeviceController extends BaseController
return AjaxResult.success(deviceService.updateDeviceStore(device));
}
/**
* 查询MAC对应的SN
*/
@PreAuthorize("@ss.hasPermi('bst:device:list')")
@PostMapping("/listSnByMac")
public AjaxResult listSnByMac(@RequestBody List<String> macList) {
return success(deviceService.listSnByMac(macList));
}
}