Compare commits
3 Commits
d942b31c8b
...
4904be16da
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4904be16da | ||
|
|
c4915b17c8 | ||
|
|
7fce8c91f2 |
@@ -0,0 +1,10 @@
|
|||||||
|
package com.xiang.xservice.application.script.jntyzx.constants;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2025-12-16 10:43
|
||||||
|
*/
|
||||||
|
public class RedisKeyConstant {
|
||||||
|
|
||||||
|
public static final String JNTYZX_ORDER_CREATE_KEY = "jntyzx:order:create:orderId:";
|
||||||
|
}
|
||||||
@@ -22,6 +22,11 @@ public class UrlConstant {
|
|||||||
*/
|
*/
|
||||||
public final static String ADD_SUBSCRIBE = GNTYZX_BASE_URL + "/GYM-JN/multi/Subscribe/addSubscribe";
|
public final static String ADD_SUBSCRIBE = GNTYZX_BASE_URL + "/GYM-JN/multi/Subscribe/addSubscribe";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单信息
|
||||||
|
*/
|
||||||
|
public final static String ORDER_INFO = GNTYZX_BASE_URL + "/GYM-JN/multi/busiOrder/queryOrderInfo";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 心跳监测接口
|
* 心跳监测接口
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -2,15 +2,22 @@ package com.xiang.xservice.application.script.jntyzx.controller;
|
|||||||
|
|
||||||
import com.xiang.xservice.application.script.jntyzx.entity.pojo.VenueInfoDO;
|
import com.xiang.xservice.application.script.jntyzx.entity.pojo.VenueInfoDO;
|
||||||
import com.xiang.xservice.application.script.jntyzx.entity.resp.query.SitePositionList;
|
import com.xiang.xservice.application.script.jntyzx.entity.resp.query.SitePositionList;
|
||||||
import com.xiang.xservice.application.script.jntyzx.service.IVenueService;
|
import com.xiang.xservice.application.script.jntyzx.service.DingTalkScriptVenueService;
|
||||||
import com.xiang.xservice.application.script.jntyzx.service.IJntyzxHttpService;
|
import com.xiang.xservice.application.script.jntyzx.service.IJntyzxHttpService;
|
||||||
|
import com.xiang.xservice.application.script.jntyzx.service.IUserTokenInfoService;
|
||||||
|
import com.xiang.xservice.application.script.jntyzx.service.IVenueService;
|
||||||
|
import com.xiang.xservice.application.script.jntyzx.utils.VenueInfoUtils;
|
||||||
import com.xiang.xservice.basic.common.resp.Result;
|
import com.xiang.xservice.basic.common.resp.Result;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author: xiang
|
* @Author: xiang
|
||||||
@@ -22,6 +29,8 @@ public class VenueController {
|
|||||||
|
|
||||||
private final IVenueService venueService;
|
private final IVenueService venueService;
|
||||||
private final IJntyzxHttpService jntyzxHttpService;
|
private final IJntyzxHttpService jntyzxHttpService;
|
||||||
|
private final IUserTokenInfoService userTokenInfoService;
|
||||||
|
private final DingTalkScriptVenueService dingTalkScriptVenueService;
|
||||||
|
|
||||||
private final static String STATIC_TOKEN = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE3NjU3ODQ1NjMsInVzZXJuYW1lIjoid3hfb3Blbl9pZF9vMjFNWDR5N3doWENHanZVVEdQNkNUejJIYkQ4In0.QBzNQNvJZQPZZnzmbU8K5Liz0piHwercrDIq3kirUJk";
|
private final static String STATIC_TOKEN = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE3NjU3ODQ1NjMsInVzZXJuYW1lIjoid3hfb3Blbl9pZF9vMjFNWDR5N3doWENHanZVVEdQNkNUejJIYkQ4In0.QBzNQNvJZQPZZnzmbU8K5Liz0piHwercrDIq3kirUJk";
|
||||||
|
|
||||||
@@ -37,13 +46,24 @@ public class VenueController {
|
|||||||
return Result.success(sitePositionLists);
|
return Result.success(sitePositionLists);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("addSubscribe")
|
@PostMapping("/addSubscribe")
|
||||||
public Result<Void> addSubscribe() {
|
public Result<Void> addSubscribe() {
|
||||||
List<VenueInfoDO> venueInfoDOS = venueService.queryCanBuyVenue();
|
List<VenueInfoDO> venueInfoDOS = venueService.queryCanBuyVenue();
|
||||||
if (CollectionUtils.isEmpty(venueInfoDOS)) {
|
if (CollectionUtils.isEmpty(venueInfoDOS)) {
|
||||||
return Result.error("暂无可订购的数据");
|
return Result.error("暂无可订购的数据");
|
||||||
}
|
}
|
||||||
jntyzxHttpService.createOrder(venueInfoDOS);
|
Map<String, List<VenueInfoDO>> map = venueInfoDOS.stream().filter(VenueInfoUtils::get1221VenueInfo4Mor).collect(Collectors.groupingBy(VenueInfoDO::getPlaceName));
|
||||||
|
String token = userTokenInfoService.getToken("Xiang");
|
||||||
|
if (StringUtils.isBlank(token)) {
|
||||||
|
return Result.error("暂无可订购的用户");
|
||||||
|
}
|
||||||
|
map.keySet().parallelStream().forEach(placeName -> {
|
||||||
|
List<VenueInfoDO> venueInfoDOList = map.get(placeName);
|
||||||
|
Boolean order = jntyzxHttpService.createOrder(venueInfoDOList, token);
|
||||||
|
if (order) {
|
||||||
|
dingTalkScriptVenueService.sendScriptMsg("场地:" + placeName + "下单成功,请付款!时间:" + LocalDateTime.now());
|
||||||
|
}
|
||||||
|
});
|
||||||
return Result.success();
|
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,18 @@
|
|||||||
|
package com.xiang.xservice.application.script.jntyzx.entity.resp;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2025-12-16 10:36
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class OrderCreateResp {
|
||||||
|
|
||||||
|
private String id;
|
||||||
|
private String countDownNum;
|
||||||
|
}
|
||||||
@@ -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> {
|
||||||
|
}
|
||||||
@@ -1,13 +1,24 @@
|
|||||||
package com.xiang.xservice.application.script.jntyzx.schedule;
|
package com.xiang.xservice.application.script.jntyzx.schedule;
|
||||||
|
|
||||||
import com.xiang.xservice.application.script.jntyzx.entity.pojo.VenueInfoDO;
|
import com.xiang.xservice.application.script.jntyzx.entity.pojo.VenueInfoDO;
|
||||||
|
import com.xiang.xservice.application.script.jntyzx.service.DingTalkScriptVenueService;
|
||||||
|
import com.xiang.xservice.application.script.jntyzx.service.IJntyzxHttpService;
|
||||||
|
import com.xiang.xservice.application.script.jntyzx.service.IUserTokenInfoService;
|
||||||
import com.xiang.xservice.application.script.jntyzx.service.IVenueService;
|
import com.xiang.xservice.application.script.jntyzx.service.IVenueService;
|
||||||
|
import com.xiang.xservice.application.script.jntyzx.utils.VenueInfoUtils;
|
||||||
|
import com.xiang.xservice.common.entity.SysConfigDO;
|
||||||
|
import com.xiang.xservice.common.service.ISysConfigService;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.scheduling.annotation.Scheduled;
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author: xiang
|
* @Author: xiang
|
||||||
@@ -18,16 +29,76 @@ import java.util.List;
|
|||||||
public class VenuePeekSchedule {
|
public class VenuePeekSchedule {
|
||||||
|
|
||||||
private final IVenueService venueService;
|
private final IVenueService venueService;
|
||||||
|
private final IJntyzxHttpService jntyzxHttpService;
|
||||||
|
private final ISysConfigService sysConfigService;
|
||||||
|
private final IUserTokenInfoService userTokenInfoService;
|
||||||
|
private final DingTalkScriptVenueService dingTalkScriptVenueService;
|
||||||
|
|
||||||
@Scheduled(cron = "5 1 9-20 * * ?")
|
@Scheduled(cron = "5 1 9-20 * * ?")
|
||||||
public void peek() {
|
public void peek8210() {
|
||||||
List<VenueInfoDO> venueInfoDOS = venueService.queryCanBuyVenue();
|
SysConfigDO config = sysConfigService.getByName("jntyzx.venue.peek.switch");
|
||||||
if (CollectionUtils.isEmpty(venueInfoDOS)) {
|
boolean peekSwitch;
|
||||||
return;
|
if (Objects.isNull(config)) {
|
||||||
|
peekSwitch = false;
|
||||||
|
} else {
|
||||||
|
if (StringUtils.equals(config.getValue(), "true")) {
|
||||||
|
peekSwitch = true;
|
||||||
|
} else {
|
||||||
|
peekSwitch = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
if (peekSwitch) {
|
||||||
|
List<VenueInfoDO> venueInfoDOS = venueService.queryCanBuyVenue();
|
||||||
|
if (CollectionUtils.isEmpty(venueInfoDOS)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Map<String, List<VenueInfoDO>> map = venueInfoDOS.stream().filter(VenueInfoUtils::get8210VenueInfo).collect(Collectors.groupingBy(VenueInfoDO::getPlaceName));
|
||||||
|
String token = userTokenInfoService.getToken("Xiang");
|
||||||
|
if (StringUtils.isBlank(token)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
map.keySet().parallelStream().forEach(placeName -> {
|
||||||
|
List<VenueInfoDO> venueInfoDOList = map.get(placeName);
|
||||||
|
Boolean order = jntyzxHttpService.createOrder(venueInfoDOList, token);
|
||||||
|
if (order) {
|
||||||
|
dingTalkScriptVenueService.sendScriptMsg("场地:" + placeName + "下单成功,请付款!时间:" + LocalDateTime.now());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
venueInfoDOS.parallelStream().forEach(item -> {
|
@Scheduled(cron = "5 1 9-20 * * ?")
|
||||||
// 请求接口创建订单不支付
|
public void peek628() {
|
||||||
});
|
SysConfigDO config = sysConfigService.getByName("jntyzx.venue.peek.switch");
|
||||||
|
boolean peekSwitch;
|
||||||
|
if (Objects.isNull(config)) {
|
||||||
|
peekSwitch = false;
|
||||||
|
} else {
|
||||||
|
if (StringUtils.equals(config.getValue(), "true")) {
|
||||||
|
peekSwitch = true;
|
||||||
|
} else {
|
||||||
|
peekSwitch = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (peekSwitch) {
|
||||||
|
List<VenueInfoDO> venueInfoDOS = venueService.queryCanBuyVenue();
|
||||||
|
if (CollectionUtils.isEmpty(venueInfoDOS)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Map<String, List<VenueInfoDO>> map = venueInfoDOS.stream()
|
||||||
|
.filter(VenueInfoUtils::get628VenueInfo)
|
||||||
|
.collect(Collectors.groupingBy(VenueInfoDO::getPlaceName));
|
||||||
|
String token = userTokenInfoService.getToken("Xiang");
|
||||||
|
if (StringUtils.isBlank(token)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
map.keySet().parallelStream().forEach(placeName -> {
|
||||||
|
List<VenueInfoDO> venueInfoDOList = map.get(placeName);
|
||||||
|
Boolean order = jntyzxHttpService.createOrder(venueInfoDOList, token);
|
||||||
|
if (order) {
|
||||||
|
dingTalkScriptVenueService.sendScriptMsg("场地:" + placeName + "下单成功,请付款!时间:" + LocalDateTime.now());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,9 +5,12 @@ import com.xiang.xservice.application.script.jntyzx.entity.pojo.VenueInfoDO;
|
|||||||
import com.xiang.xservice.application.script.jntyzx.entity.resp.query.SitePositionList;
|
import com.xiang.xservice.application.script.jntyzx.entity.resp.query.SitePositionList;
|
||||||
import com.xiang.xservice.application.script.jntyzx.service.DingTalkScriptVenueService;
|
import com.xiang.xservice.application.script.jntyzx.service.DingTalkScriptVenueService;
|
||||||
import com.xiang.xservice.application.script.jntyzx.service.IVenueService;
|
import com.xiang.xservice.application.script.jntyzx.service.IVenueService;
|
||||||
|
import com.xiang.xservice.common.entity.SysConfigDO;
|
||||||
|
import com.xiang.xservice.common.service.ISysConfigService;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
|
import org.apache.commons.collections4.MapUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.scheduling.annotation.Scheduled;
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@@ -15,6 +18,7 @@ import org.springframework.stereotype.Component;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author: xiang
|
* @Author: xiang
|
||||||
@@ -27,6 +31,7 @@ public class VenueQuerySchedule {
|
|||||||
|
|
||||||
private final IVenueService venueService;
|
private final IVenueService venueService;
|
||||||
private final DingTalkScriptVenueService dingTalkScriptVenueService;
|
private final DingTalkScriptVenueService dingTalkScriptVenueService;
|
||||||
|
private final ISysConfigService sysConfigService;
|
||||||
|
|
||||||
@Scheduled(cron = "0 30 8 * * ?")
|
@Scheduled(cron = "0 30 8 * * ?")
|
||||||
public void venueQueryTask() {
|
public void venueQueryTask() {
|
||||||
@@ -85,6 +90,18 @@ public class VenueQuerySchedule {
|
|||||||
if (CollectionUtils.isEmpty(venueInfoDOS)) {
|
if (CollectionUtils.isEmpty(venueInfoDOS)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
SysConfigDO config = sysConfigService.getByName("jntyzx.order.create.xiaoguan.switch");
|
||||||
|
boolean orderSwitch;
|
||||||
|
if (Objects.nonNull(config)) {
|
||||||
|
String value = config.getValue();
|
||||||
|
if (StringUtils.equals(value, "true")) {
|
||||||
|
orderSwitch = true;
|
||||||
|
} else {
|
||||||
|
orderSwitch = false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
orderSwitch = false;
|
||||||
|
}
|
||||||
// 6-8场地
|
// 6-8场地
|
||||||
Map<String, List<VenueInfoDO>> map1 = Maps.newLinkedHashMap();
|
Map<String, List<VenueInfoDO>> map1 = Maps.newLinkedHashMap();
|
||||||
// 8-10场地
|
// 8-10场地
|
||||||
@@ -92,6 +109,12 @@ public class VenueQuerySchedule {
|
|||||||
venueInfoDOS.stream()
|
venueInfoDOS.stream()
|
||||||
.filter(item -> StringUtils.equals(item.getSjName(), "18:00-19:00") || StringUtils.equals(item.getSjName(), "19:00-20:00")
|
.filter(item -> StringUtils.equals(item.getSjName(), "18:00-19:00") || StringUtils.equals(item.getSjName(), "19:00-20:00")
|
||||||
|| StringUtils.equals(item.getSjName(), "20:00-21:00") || StringUtils.equals(item.getSjName(), "21:00-22:00"))
|
|| StringUtils.equals(item.getSjName(), "20:00-21:00") || StringUtils.equals(item.getSjName(), "21:00-22:00"))
|
||||||
|
.filter(item -> {
|
||||||
|
if (!orderSwitch) {
|
||||||
|
return !item.getPlaceName().contains("小馆");
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
})
|
||||||
.forEach(item -> {
|
.forEach(item -> {
|
||||||
if (StringUtils.equals(item.getSjName(), "18:00-19:00")) {
|
if (StringUtils.equals(item.getSjName(), "18:00-19:00")) {
|
||||||
putIntoMap(item, map1);
|
putIntoMap(item, map1);
|
||||||
@@ -106,12 +129,16 @@ public class VenueQuerySchedule {
|
|||||||
putIntoMap(item, map2);
|
putIntoMap(item, map2);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
StringBuffer sb1 = new StringBuffer("查询江体小程序场地信息【18:00-20:00】\n");
|
if (MapUtils.isNotEmpty(map1)) {
|
||||||
buildMsg(map1, sb1);
|
StringBuffer sb1 = new StringBuffer("查询江体小程序场地信息【18:00-20:00】\n");
|
||||||
StringBuffer sb2 = new StringBuffer("查询江体小程序场地信息【20:00-22:00】\n");
|
buildMsg(map1, sb1);
|
||||||
buildMsg(map2, sb2);
|
dingTalkScriptVenueService.sendScriptMsg(sb1.toString());
|
||||||
dingTalkScriptVenueService.sendScriptMsg(sb1.toString());
|
}
|
||||||
dingTalkScriptVenueService.sendScriptMsg(sb2.toString());
|
if (MapUtils.isNotEmpty(map1)) {
|
||||||
|
StringBuffer sb2 = new StringBuffer("查询江体小程序场地信息【20:00-22:00】\n");
|
||||||
|
buildMsg(map2, sb2);
|
||||||
|
dingTalkScriptVenueService.sendScriptMsg(sb2.toString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void buildMsg(Map<String, List<VenueInfoDO>> map1, StringBuffer sb1) {
|
private static void buildMsg(Map<String, List<VenueInfoDO>> map1, StringBuffer sb1) {
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ public interface IJntyzxHttpService {
|
|||||||
* 订单创建
|
* 订单创建
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Boolean createOrder(List<VenueInfoDO> venueInfos);
|
Boolean createOrder(List<VenueInfoDO> venueInfos, String token);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 心跳监测
|
* 心跳监测
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ package com.xiang.xservice.application.script.jntyzx.service;
|
|||||||
*/
|
*/
|
||||||
public interface IUserTokenInfoService {
|
public interface IUserTokenInfoService {
|
||||||
|
|
||||||
|
String getToken(String name);
|
||||||
boolean flushSingleToken(String name);
|
boolean flushSingleToken(String name);
|
||||||
boolean flushToken();
|
boolean flushToken();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,17 +2,24 @@ package com.xiang.xservice.application.script.jntyzx.service;
|
|||||||
|
|
||||||
import com.alibaba.fastjson2.JSON;
|
import com.alibaba.fastjson2.JSON;
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
|
import com.alibaba.fastjson2.TypeReference;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
|
import com.xiang.xmc.service.cache.service.IRedisService;
|
||||||
import com.xiang.xmc.service.http.helper.HttpHelper;
|
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.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.pojo.VenueInfoDO;
|
||||||
import com.xiang.xservice.application.script.jntyzx.entity.req.SubscribeRequest;
|
import com.xiang.xservice.application.script.jntyzx.entity.req.SubscribeRequest;
|
||||||
import com.xiang.xservice.application.script.jntyzx.entity.req.SubscribeVo;
|
import com.xiang.xservice.application.script.jntyzx.entity.req.SubscribeVo;
|
||||||
import com.xiang.xservice.application.script.jntyzx.entity.resp.JntyzxResponse;
|
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.SitePositionList;
|
||||||
import com.xiang.xservice.application.script.jntyzx.entity.resp.query.VenueList;
|
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.Base64;
|
||||||
|
import com.xiang.xservice.basic.utils.JsonUtils;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
@@ -21,6 +28,8 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
@@ -34,6 +43,9 @@ import java.util.Objects;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public class JntyzxHttpServiceImpl implements IJntyzxHttpService {
|
public class JntyzxHttpServiceImpl implements IJntyzxHttpService {
|
||||||
|
|
||||||
|
private final IRedisService redisService;
|
||||||
|
private final IOrderCreateInfoManage orderCreateInfoManage;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<SitePositionList> queryAvailable(String isWeekend, String token) {
|
public List<SitePositionList> queryAvailable(String isWeekend, String token) {
|
||||||
String url = UrlConstant.QUERY_TODAY_SUBSCRIBE_URL;
|
String url = UrlConstant.QUERY_TODAY_SUBSCRIBE_URL;
|
||||||
@@ -96,7 +108,7 @@ public class JntyzxHttpServiceImpl implements IJntyzxHttpService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean createOrder(List<VenueInfoDO> venueInfos) {
|
public Boolean createOrder(List<VenueInfoDO> venueInfos, String token) {
|
||||||
|
|
||||||
List<SubscribeVo> vos = Lists.newArrayList();
|
List<SubscribeVo> vos = Lists.newArrayList();
|
||||||
for (VenueInfoDO venueInfo : venueInfos) {
|
for (VenueInfoDO venueInfo : venueInfos) {
|
||||||
@@ -110,7 +122,7 @@ public class JntyzxHttpServiceImpl implements IJntyzxHttpService {
|
|||||||
subscribeVo.setType("0");
|
subscribeVo.setType("0");
|
||||||
subscribeVo.setClassName(venueInfo.getClassName());
|
subscribeVo.setClassName(venueInfo.getClassName());
|
||||||
subscribeVo.setClassCode(venueInfo.getClassCode());
|
subscribeVo.setClassCode(venueInfo.getClassCode());
|
||||||
subscribeVo.setMoney(venueInfo.getMoney());
|
subscribeVo.setMoney(venueInfo.getMoney().setScale(0));
|
||||||
subscribeVo.setContacts("0");
|
subscribeVo.setContacts("0");
|
||||||
subscribeVo.setContactNumber(null);
|
subscribeVo.setContactNumber(null);
|
||||||
subscribeVo.setMemberNumber(null);
|
subscribeVo.setMemberNumber(null);
|
||||||
@@ -132,15 +144,41 @@ public class JntyzxHttpServiceImpl implements IJntyzxHttpService {
|
|||||||
subscribeRequest.setSubscribeVos(vos);
|
subscribeRequest.setSubscribeVos(vos);
|
||||||
subscribeRequest.setBookTime(venueInfos.get(0).getAppointments());
|
subscribeRequest.setBookTime(venueInfos.get(0).getAppointments());
|
||||||
subscribeRequest.setPaymentMethod(1);
|
subscribeRequest.setPaymentMethod(1);
|
||||||
subscribeRequest.setSvCiphertext(Base64.encode(JSON.toJSONString(vos).getBytes(StandardCharsets.UTF_8)));
|
subscribeRequest.setSvCiphertext(sonAddSalt(JsonUtils.toJsonString(vos)));
|
||||||
subscribeRequest.setJsonObject(jsonObject);
|
subscribeRequest.setJsonObject(jsonObject);
|
||||||
|
|
||||||
Map<String, String> params = Maps.newHashMap();
|
Map<String, String> params = Maps.newHashMap();
|
||||||
params.put("X-Access-Token", "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE3NjU3ODQ1NjMsInVzZXJuYW1lIjoid3hfb3Blbl9pZF9vMjFNWDR5N3doWENHanZVVEdQNkNUejJIYkQ4In0.QBzNQNvJZQPZZnzmbU8K5Liz0piHwercrDIq3kirUJk");
|
params.put("X-Access-Token", token);
|
||||||
String resp = HttpHelper.doPost(UrlConstant.ADD_SUBSCRIBE, params, JSONObject.toJSONString(subscribeRequest));
|
String resp = HttpHelper.doPost(UrlConstant.ADD_SUBSCRIBE, params, JsonUtils.toJsonString(subscribeRequest));
|
||||||
return null;
|
if (StringUtils.isBlank(resp)) {
|
||||||
|
log.info("请求结果为空");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
JntyzxResponse<OrderCreateResp> response = JSON.parseObject(resp, new TypeReference<JntyzxResponse<OrderCreateResp>>() {
|
||||||
|
});
|
||||||
|
if (Objects.isNull(response)) {
|
||||||
|
log.info("请求结果为空");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (response.getSuccess()) {
|
||||||
|
OrderCreateResp createResp = response.getResult();
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JntyzxResponse healthDeclaration(String token, String openId) {
|
public JntyzxResponse healthDeclaration(String token, String openId) {
|
||||||
Map<String, String> headers = Maps.newHashMap();
|
Map<String, String> headers = Maps.newHashMap();
|
||||||
@@ -175,4 +213,30 @@ public class JntyzxHttpServiceImpl implements IJntyzxHttpService {
|
|||||||
jsonObject.put("default05", null);
|
jsonObject.put("default05", null);
|
||||||
return jsonObject;
|
return jsonObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static int[] getMonthAndDay() {
|
||||||
|
LocalDate currentDate = LocalDate.now();
|
||||||
|
int month = currentDate.getMonthValue();
|
||||||
|
int day = currentDate.getDayOfMonth();
|
||||||
|
return new int[]{month, day};
|
||||||
|
}
|
||||||
|
|
||||||
|
private String sonAddSalt(String json) {
|
||||||
|
String svCiphertext = "";
|
||||||
|
String suiji = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
||||||
|
String token1 = String.valueOf(suiji.charAt((int) (Math.random() * (double) suiji.length())));
|
||||||
|
String token2 = String.valueOf(suiji.charAt((int) (Math.random() * (double) suiji.length())));
|
||||||
|
svCiphertext = Base64.encode(json.getBytes(StandardCharsets.UTF_8));
|
||||||
|
int[] monthAndDay = getMonthAndDay();
|
||||||
|
int month = monthAndDay[0];
|
||||||
|
int day = monthAndDay[1];
|
||||||
|
if (month == 1) {
|
||||||
|
svCiphertext = (svCiphertext = token1 + svCiphertext).substring(0, day - 1) + token2 + svCiphertext.substring(day - 1);
|
||||||
|
} else if (day == 1) {
|
||||||
|
svCiphertext = token2 + svCiphertext.substring(0, month - 1) + token1 + svCiphertext.substring(month - 1);
|
||||||
|
} else {
|
||||||
|
svCiphertext = (svCiphertext = svCiphertext.substring(0, month - 1) + token1 + svCiphertext.substring(month - 1)).substring(0, day - 1) + token2 + svCiphertext.substring(day - 1);
|
||||||
|
}
|
||||||
|
return svCiphertext;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,15 @@ public class UserTokenInfoServiceImpl implements IUserTokenInfoService {
|
|||||||
private final DingTalkScriptVenueService dingTalkScriptVenueService;
|
private final DingTalkScriptVenueService dingTalkScriptVenueService;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getToken(String name) {
|
||||||
|
UserTokenInfoDO userTokenInfoDO = userTokenInfoManage.getByName(name);
|
||||||
|
if (Objects.isNull(userTokenInfoDO)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return userTokenInfoDO.getToken();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean flushSingleToken(String name) {
|
public boolean flushSingleToken(String name) {
|
||||||
UserTokenInfoDO userTokenInfoDO = userTokenInfoManage.getByName(name);
|
UserTokenInfoDO userTokenInfoDO = userTokenInfoManage.getByName(name);
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ public class VenueServiceImpl implements IVenueService {
|
|||||||
if (CollectionUtils.isEmpty(sitePositionLists)) {
|
if (CollectionUtils.isEmpty(sitePositionLists)) {
|
||||||
return Lists.newArrayList();
|
return Lists.newArrayList();
|
||||||
}
|
}
|
||||||
updateDatabase(sitePositionLists);
|
updateDatabase(sitePositionLists, true);
|
||||||
return sitePositionLists;
|
return sitePositionLists;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,7 +46,7 @@ public class VenueServiceImpl implements IVenueService {
|
|||||||
if (CollectionUtils.isEmpty(sitePositionLists)) {
|
if (CollectionUtils.isEmpty(sitePositionLists)) {
|
||||||
return Lists.newArrayList();
|
return Lists.newArrayList();
|
||||||
}
|
}
|
||||||
updateDatabase(sitePositionLists);
|
updateDatabase(sitePositionLists, false);
|
||||||
return sitePositionLists;
|
return sitePositionLists;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -55,8 +55,14 @@ public class VenueServiceImpl implements IVenueService {
|
|||||||
return venueInfoManage.queryByType(LocalDate.now(), 0);
|
return venueInfoManage.queryByType(LocalDate.now(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateDatabase(List<SitePositionList> list) {
|
private void updateDatabase(List<SitePositionList> list, boolean isToday) {
|
||||||
List<VenueInfoDO> venueInfoDOS = venueInfoManage.queryByDate(LocalDate.now());
|
List<VenueInfoDO> venueInfoDOS = Lists.newArrayList();
|
||||||
|
if (isToday) {
|
||||||
|
venueInfoDOS.addAll(venueInfoManage.queryByDate(LocalDate.now()));
|
||||||
|
} else {
|
||||||
|
venueInfoDOS.addAll(venueInfoManage.queryByDate(LocalDate.now().plusDays(1)));
|
||||||
|
}
|
||||||
|
|
||||||
Map<Long, VenueInfoDO> map = Maps.newHashMap();
|
Map<Long, VenueInfoDO> map = Maps.newHashMap();
|
||||||
if (CollectionUtils.isNotEmpty(venueInfoDOS)) {
|
if (CollectionUtils.isNotEmpty(venueInfoDOS)) {
|
||||||
map.putAll(venueInfoDOS.stream().filter(Objects::nonNull).collect(Collectors.toMap(VenueInfoDO::getPlaceMainId, Function.identity(), (a, b) -> a)));
|
map.putAll(venueInfoDOS.stream().filter(Objects::nonNull).collect(Collectors.toMap(VenueInfoDO::getPlaceMainId, Function.identity(), (a, b) -> a)));
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package com.xiang.xservice.application.script.jntyzx.utils;
|
||||||
|
|
||||||
|
import com.xiang.xservice.application.script.jntyzx.entity.pojo.VenueInfoDO;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2025-12-16 09:55
|
||||||
|
*/
|
||||||
|
public class VenueInfoUtils {
|
||||||
|
|
||||||
|
public static boolean get123VenueInfo4Mor(VenueInfoDO venueInfoDO) {
|
||||||
|
return StringUtils.equals(venueInfoDO.getSjName(), "13:00-14:00") || StringUtils.equals(venueInfoDO.getSjName(), "14:00-15:00");
|
||||||
|
}
|
||||||
|
public static boolean get1221VenueInfo4Mor(VenueInfoDO venueInfoDO) {
|
||||||
|
return StringUtils.equals(venueInfoDO.getSjName(), "12:00-13:00") || StringUtils.equals(venueInfoDO.getSjName(), "13:00-14:00");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean get628VenueInfo(VenueInfoDO venueInfoDO) {
|
||||||
|
return StringUtils.equals(venueInfoDO.getSjName(), "18:00-19:00") || StringUtils.equals(venueInfoDO.getSjName(), "19:00-20:00");
|
||||||
|
}
|
||||||
|
public static boolean get8210VenueInfo(VenueInfoDO venueInfoDO) {
|
||||||
|
return StringUtils.equals(venueInfoDO.getSjName(), "20:00-21:00") || StringUtils.equals(venueInfoDO.getSjName(), "21:00-22:00");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package com.xiang.xservice.common.service;
|
||||||
|
|
||||||
|
import com.xiang.xservice.common.entity.SysConfigDO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2025-12-16 11:19
|
||||||
|
*/
|
||||||
|
public interface ISysConfigService {
|
||||||
|
|
||||||
|
SysConfigDO getByName(String name);
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package com.xiang.xservice.common.service;
|
||||||
|
|
||||||
|
import com.xiang.xservice.common.entity.SysConfigDO;
|
||||||
|
import com.xiang.xservice.common.mapper.SysConfigMapper;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2025-12-16 11:20
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class SysConfigServiceImpl implements ISysConfigService {
|
||||||
|
private final SysConfigMapper sysConfigMapper;
|
||||||
|
@Override
|
||||||
|
public SysConfigDO getByName(String name) {
|
||||||
|
return sysConfigMapper.getByName(name);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user