feat:订单创建
This commit is contained in:
@@ -57,20 +57,13 @@ public class VenueController {
|
||||
if (StringUtils.isBlank(token)) {
|
||||
return Result.error("暂无可订购的用户");
|
||||
}
|
||||
for (String placeName : map.keySet()) {
|
||||
map.keySet().parallelStream().forEach(placeName -> {
|
||||
List<VenueInfoDO> venueInfoDOList = map.get(placeName);
|
||||
Boolean order = jntyzxHttpService.createOrder(venueInfoDOList, token);
|
||||
if (order) {
|
||||
dingTalkScriptVenueService.sendScriptMsg("场地:" + placeName + "下单成功,请付款!时间:" + LocalDateTime.now());
|
||||
}
|
||||
}
|
||||
// map.keySet().forEach(placeName -> {
|
||||
// List<VenueInfoDO> venueInfoDOList = map.get(placeName);
|
||||
// Boolean order = jntyzxHttpService.createOrder(venueInfoDOList, token);
|
||||
// if (order) {
|
||||
// dingTalkScriptVenueService.sendScriptMsg("场地:" + placeName + "下单成功,请付款!时间:" + LocalDateTime.now());
|
||||
// }
|
||||
// });
|
||||
});
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.xiang.xservice.application.script.jntyzx.entity.pojo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @Author: xiang
|
||||
* @Date: 2025-12-16 10:57
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@TableName("jntyzx_order_create_info")
|
||||
public class OrderInfoDO {
|
||||
private Long id;
|
||||
/**
|
||||
* 订单id
|
||||
*/
|
||||
private String orderId;
|
||||
|
||||
/**
|
||||
* 参数
|
||||
*/
|
||||
private String params;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 订单创建人
|
||||
*/
|
||||
private String username;
|
||||
|
||||
/**
|
||||
* 场地号
|
||||
*/
|
||||
private String placeName;
|
||||
|
||||
/**
|
||||
* 所属日期
|
||||
*/
|
||||
private LocalDate date;
|
||||
|
||||
/**
|
||||
* 订单状态 (0:待付款,1:已付款)
|
||||
*/
|
||||
private Integer orderStatus;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.xiang.xservice.application.script.jntyzx.manage;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.xiang.xservice.application.script.jntyzx.entity.pojo.OrderInfoDO;
|
||||
|
||||
/**
|
||||
* @Author: xiang
|
||||
* @Date: 2025-12-16 10:59
|
||||
*/
|
||||
public interface IOrderCreateInfoManage extends IService<OrderInfoDO> {
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.xiang.xservice.application.script.jntyzx.manage;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.xiang.xservice.application.script.jntyzx.entity.pojo.OrderInfoDO;
|
||||
import com.xiang.xservice.application.script.jntyzx.mapper.JntyzxOrderCreateInfoMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @Author: xiang
|
||||
* @Date: 2025-12-16 10:59
|
||||
*/
|
||||
@Service
|
||||
public class OrderCreateInfoManageImpl extends ServiceImpl<JntyzxOrderCreateInfoMapper, OrderInfoDO> implements IOrderCreateInfoManage {
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.xiang.xservice.application.script.jntyzx.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.xiang.xservice.application.script.jntyzx.entity.pojo.OrderInfoDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* @Author: xiang
|
||||
* @Date: 2025-12-16 10:58
|
||||
*/
|
||||
@Mapper
|
||||
@Repository
|
||||
public interface JntyzxOrderCreateInfoMapper extends BaseMapper<OrderInfoDO> {
|
||||
}
|
||||
@@ -9,6 +9,7 @@ import com.xiang.xmc.service.cache.service.IRedisService;
|
||||
import com.xiang.xmc.service.http.helper.HttpHelper;
|
||||
import com.xiang.xservice.application.script.jntyzx.constants.RedisKeyConstant;
|
||||
import com.xiang.xservice.application.script.jntyzx.constants.UrlConstant;
|
||||
import com.xiang.xservice.application.script.jntyzx.entity.pojo.OrderInfoDO;
|
||||
import com.xiang.xservice.application.script.jntyzx.entity.pojo.VenueInfoDO;
|
||||
import com.xiang.xservice.application.script.jntyzx.entity.req.SubscribeRequest;
|
||||
import com.xiang.xservice.application.script.jntyzx.entity.req.SubscribeVo;
|
||||
@@ -16,6 +17,7 @@ import com.xiang.xservice.application.script.jntyzx.entity.resp.JntyzxResponse;
|
||||
import com.xiang.xservice.application.script.jntyzx.entity.resp.OrderCreateResp;
|
||||
import com.xiang.xservice.application.script.jntyzx.entity.resp.query.SitePositionList;
|
||||
import com.xiang.xservice.application.script.jntyzx.entity.resp.query.VenueList;
|
||||
import com.xiang.xservice.application.script.jntyzx.manage.IOrderCreateInfoManage;
|
||||
import com.xiang.xservice.basic.utils.Base64;
|
||||
import com.xiang.xservice.basic.utils.JsonUtils;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -27,6 +29,7 @@ import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
@@ -41,6 +44,7 @@ import java.util.Objects;
|
||||
public class JntyzxHttpServiceImpl implements IJntyzxHttpService {
|
||||
|
||||
private final IRedisService redisService;
|
||||
private final IOrderCreateInfoManage orderCreateInfoManage;
|
||||
|
||||
@Override
|
||||
public List<SitePositionList> queryAvailable(String isWeekend, String token) {
|
||||
@@ -161,6 +165,15 @@ public class JntyzxHttpServiceImpl implements IJntyzxHttpService {
|
||||
if (Objects.nonNull(createResp)) {
|
||||
String orderId = createResp.getId();
|
||||
redisService.set(RedisKeyConstant.JNTYZX_ORDER_CREATE_KEY + orderId, String.valueOf(System.currentTimeMillis()));
|
||||
OrderInfoDO orderInfoDO = new OrderInfoDO();
|
||||
orderInfoDO.setOrderId(orderId);
|
||||
orderInfoDO.setParams(JsonUtils.toJsonString(subscribeRequest));
|
||||
orderInfoDO.setCreateTime(LocalDateTime.now());
|
||||
orderInfoDO.setUsername(token);
|
||||
orderInfoDO.setPlaceName(vos.get(0).getPlaceName());
|
||||
orderInfoDO.setDate(LocalDate.now());
|
||||
orderInfoDO.setOrderStatus(0);
|
||||
orderCreateInfoManage.save(orderInfoDO);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user