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
6 changed files with 23 additions and 30 deletions

View File

@ -9,7 +9,7 @@ public class TmTradeInfo {
/** /**
* 太米系统流水Id * 太米系统流水Id
*/ */
private Integer id; private String id;
/** /**
* 第三方内部流水号 * 第三方内部流水号

View File

@ -193,22 +193,14 @@ public class BoothServiceImpl implements BoothService {
try { try {
BoothQuery query = new BoothQuery(); BoothQuery query = new BoothQuery();
query.setUserId(userId); query.setUserId(userId);
query.setTime(LocalDateTime.now());
List<BoothVO> list = boothMapper.selectBoothList(query); List<BoothVO> list = boothMapper.selectBoothList(query);
if (list != null && !list.isEmpty()){ for (BoothVO vo : list) {
return CollectionUtils.firstElement(list); vo.setUserId(null);
}; boothMapper.updateBooth(vo);
}
BoothVO booth = boothMapper.selectBoothByBoothNo(boothNo); BoothVO booth = boothMapper.selectBoothByBoothNo(boothNo);
ServiceUtil.assertion(booth == null, "当前卡座不存在"); ServiceUtil.assertion(booth == null, "当前卡座不存在");
if (booth.getUserId() != null && booth.getExpiredTime() != null && booth.getExpiredTime().isAfter(LocalDateTime.now())) { booth.setUserId(userId);
// 卡座未过期被其他用户绑定
ServiceUtil.assertion(!booth.getUserId().equals(userId), "卡座已被绑定");
// 卡座未过期被当前用户绑定
ServiceUtil.assertion(booth.getUserId().equals(userId), "请勿重复绑定该设备");
} else {
booth.setExpiredTime(LocalDateTime.now().plusMinutes(30));
booth.setUserId(userId);
}
int i = boothMapper.updateBooth(booth); int i = boothMapper.updateBooth(booth);
ServiceUtil.assertion(i == 0, "操作失败"); ServiceUtil.assertion(i == 0, "操作失败");
return booth; return booth;
@ -286,14 +278,14 @@ public class BoothServiceImpl implements BoothService {
deviceQuery.setBoothNo(booth.getBoothNo()); deviceQuery.setBoothNo(booth.getBoothNo());
List<DeviceVO> deviceVOList = deviceMapper.selectDeviceList(deviceQuery); List<DeviceVO> deviceVOList = deviceMapper.selectDeviceList(deviceQuery);
ServiceUtil.assertion(deviceVOList.isEmpty(), "当前卡座下无设备");
// 设备相关校验 // 设备相关校验
if (deviceVOList != null && !deviceVOList.isEmpty()) { deviceVOList.forEach(deviceVO -> {
deviceVOList.forEach(deviceVO -> { ServiceUtil.assertion(deviceVO == null || deviceVO.getDeviceId() == null, "设备不存在");
ServiceUtil.assertion(deviceVO == null || deviceVO.getDeviceId() == null, "设备不存在"); ServiceUtil.assertion(StringUtils.isAllBlank(deviceVO.getMac(), deviceVO.getMac2()), "设备MAC号为空");
ServiceUtil.assertion(StringUtils.isAllBlank(deviceVO.getMac(), deviceVO.getMac2()), "设备MAC号为空"); ServiceUtil.assertion(deviceVO.getDuration() == null, "设备编号为%s的设备暂未设置开启时长", deviceVO.getDeviceNo());
ServiceUtil.assertion(deviceVO.getDuration() == null, "设备编号为%s的设备暂未设置开启时长", deviceVO.getDeviceNo()); });
});
}
// 新建IotVO 返回数据库操作与物联网操作结果 // 新建IotVO 返回数据库操作与物联网操作结果
DeviceIotVO iotVO = new DeviceIotVO(); DeviceIotVO iotVO = new DeviceIotVO();

View File

@ -8,6 +8,7 @@ import org.springframework.stereotype.Service;
@Service @Service
public class SuitConverterImpl implements SuitConverter { public class SuitConverterImpl implements SuitConverter {
@Override @Override
public Suit toPoByCreate(Suit data) { public Suit toPoByCreate(Suit data) {
if (data == null) { if (data == null) {
@ -15,7 +16,6 @@ public class SuitConverterImpl implements SuitConverter {
} }
Suit po = new Suit(); Suit po = new Suit();
// 设置基本信息 // 设置基本信息
po.setUserId(data.getUserId());
po.setStoreId(data.getStoreId()); po.setStoreId(data.getStoreId());
po.setOrderNum(data.getOrderNum()); po.setOrderNum(data.getOrderNum());
po.setLightingNums(data.getLightingNums()); po.setLightingNums(data.getLightingNums());

View File

@ -65,6 +65,8 @@ public class SuitServiceImpl implements SuitService
@Override @Override
public int insertSuit(Suit suit) public int insertSuit(Suit suit)
{ {
StoreVO store = storeService.selectStoreById(suit.getStoreId());
suit.setUserId(store.getUserId());
suit.setCreateTime(DateUtils.getNowDate()); suit.setCreateTime(DateUtils.getNowDate());
return suitMapper.insertSuit(suit); return suitMapper.insertSuit(suit);
} }
@ -78,9 +80,9 @@ public class SuitServiceImpl implements SuitService
@Override @Override
public int updateSuit(Suit suit) public int updateSuit(Suit suit)
{ {
StoreVO StoreVO = storeService.selectStoreById(suit.getStoreId()); StoreVO store = storeService.selectStoreById(suit.getStoreId());
ServiceUtil.assertion(StoreVO==null,"当前店铺不存在"); ServiceUtil.assertion(store==null,"当前店铺不存在");
suit.setUserId(StoreVO.getUserId()); suit.setUserId(store.getUserId());
return suitMapper.updateSuit(suit); return suitMapper.updateSuit(suit);
} }

View File

@ -32,12 +32,12 @@ public class AppBoothController extends BaseController {
private BoothService boothService; private BoothService boothService;
@ApiOperation("爆灯") @ApiOperation("爆灯")
@PutMapping("/{boothNo}/lighting") @PutMapping("/{boothId}/lighting")
public AjaxResult lighting(@PathVariable @ApiParam("设备id") String boothNo,boolean requiredIot) { public AjaxResult lighting(@PathVariable @ApiParam("设备id") Long boothId,boolean requiredIot) {
if (boothNo == null) { if (boothId == null) {
return error("卡座编号不能为空"); return error("卡座编号不能为空");
} }
BoothVO booth = boothService.selectBoothByBoothNo(boothNo); BoothVO booth = boothService.selectBoothByBoothId(boothId);
if (booth == null) { if (booth == null) {
return error("当前卡座信息不存在"); return error("当前卡座信息不存在");
} }

View File

@ -98,7 +98,6 @@ public class SuitController extends BaseController
if (!userValidator.canView(suit.getUserId())) { if (!userValidator.canView(suit.getUserId())) {
suit.setUserId(getUserId()); suit.setUserId(getUserId());
} }
suit.setUserId(getUserId());
suitConverter.toPoByCreate(suit); suitConverter.toPoByCreate(suit);
return toAjax(suitService.insertSuit(suit)); return toAjax(suitService.insertSuit(suit));
} }