feat:场地查询
This commit is contained in:
@@ -16,4 +16,9 @@ public class UrlConstant {
|
||||
*/
|
||||
public final static String QUERY_SUBSCRIBE_URL = GNTYZX_BASE_URL + "/GYM-JN/multi/Subscribe/getSubscribeByToday";
|
||||
|
||||
/**
|
||||
* 订阅场地
|
||||
*/
|
||||
public final static String ADD_SUBSCRIBE = GNTYZX_BASE_URL + "/GYM-JN/multi/Subscribe/addSubscribe";
|
||||
|
||||
}
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
package com.xiang.xservice.application.script.jntyzx.controller;
|
||||
|
||||
import com.xiang.xservice.application.script.jntyzx.entity.resp.query.SitePositionList;
|
||||
import com.xiang.xservice.application.script.jntyzx.entity.pojo.VenueInfoDO;
|
||||
import com.xiang.xservice.application.script.jntyzx.service.IVenueService;
|
||||
import com.xiang.xservice.application.script.jntyzx.service.IVenueServiceHttp;
|
||||
import com.xiang.xservice.basic.common.resp.Result;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@@ -17,14 +19,25 @@ import java.util.List;
|
||||
@RequiredArgsConstructor
|
||||
public class VenueController {
|
||||
|
||||
private final IVenueService venueService;
|
||||
private final IVenueServiceHttp venueServiceHttp;
|
||||
|
||||
private final static String STATIC_TOKEN = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE3NjU3ODQ1NjMsInVzZXJuYW1lIjoid3hfb3Blbl9pZF9vMjFNWDR5N3doWENHanZVVEdQNkNUejJIYkQ4In0.QBzNQNvJZQPZZnzmbU8K5Liz0piHwercrDIq3kirUJk";
|
||||
|
||||
@PostMapping("/queryVenue")
|
||||
public Result<SitePositionList> queryVenue() {
|
||||
List<SitePositionList> venueListDTOS = venueServiceHttp.queryAvailable("1", STATIC_TOKEN);
|
||||
return Result.success(venueListDTOS);
|
||||
public Result<Void> queryVenue() {
|
||||
venueService.queryVenueService();
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@PostMapping("addSubscribe")
|
||||
public Result<Void> addSubscribe() {
|
||||
List<VenueInfoDO> venueInfoDOS = venueService.queryCanBuyVenue();
|
||||
if (CollectionUtils.isEmpty(venueInfoDOS)) {
|
||||
return Result.error("暂无可订购的数据");
|
||||
}
|
||||
venueServiceHttp.createOrder(venueInfoDOS);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@@ -62,4 +63,10 @@ public class VenueInfoDO {
|
||||
* 状态
|
||||
*/
|
||||
private Integer type;
|
||||
|
||||
private BigDecimal money;
|
||||
private String className;
|
||||
private String classCode;
|
||||
private String appointments;
|
||||
private String cTypeCode;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.xiang.xservice.application.script.jntyzx.entity.req;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: xiang
|
||||
* @Date: 2025-12-15 16:34
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class SubscribeRequest {
|
||||
private JSONObject jsonObject;
|
||||
private List<SubscribeVo> subscribeVos;
|
||||
private String bookTime;
|
||||
private Integer paymentMethod;
|
||||
private String svCiphertext;
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.xiang.xservice.application.script.jntyzx.entity.req;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @Author: xiang
|
||||
* @Date: 2025-12-15 16:35
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class SubscribeVo {
|
||||
private int id;
|
||||
|
||||
private String ballCourtId;
|
||||
|
||||
private String sjName;
|
||||
|
||||
private String scheduleId;
|
||||
|
||||
private String placeName;
|
||||
|
||||
private int placeId;
|
||||
|
||||
private String type;
|
||||
|
||||
private String className;
|
||||
|
||||
private String classCode;
|
||||
|
||||
private BigDecimal money;
|
||||
|
||||
private String contacts;
|
||||
|
||||
private String contactNumber;
|
||||
|
||||
private String memberNumber;
|
||||
|
||||
private String appointments;
|
||||
|
||||
private String operator;
|
||||
|
||||
private String endTime;
|
||||
|
||||
private String beginTime;
|
||||
|
||||
private int specOneTimes;
|
||||
|
||||
private String ctypeCode;
|
||||
|
||||
private int isWhole;
|
||||
|
||||
private String orderId;
|
||||
|
||||
private int votesnum;
|
||||
}
|
||||
@@ -1,11 +1,21 @@
|
||||
package com.xiang.xservice.application.script.jntyzx.schedule;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
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.service.DingTalkScriptVenueService;
|
||||
import com.xiang.xservice.application.script.jntyzx.service.IVenueService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author: xiang
|
||||
* @Date: 2025-12-15 15:02
|
||||
@@ -14,12 +24,41 @@ import org.springframework.stereotype.Component;
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class VenueQuerySchedule {
|
||||
|
||||
private final IVenueService venueService;
|
||||
private final DingTalkScriptVenueService dingTalkScriptVenueService;
|
||||
|
||||
@Scheduled(cron = "0 30 8 * * ?")
|
||||
public void venueQueryTask() {
|
||||
log.info("每日8:30拉取江体小程序数据定时任务");
|
||||
venueService.queryVenueService();
|
||||
List<SitePositionList> sitePositionLists = venueService.queryVenueService();
|
||||
// 6-8场地
|
||||
Map<String, List<SitePositionList>> map1 = Maps.newLinkedHashMap();
|
||||
// 8-10场地
|
||||
Map<String, List<SitePositionList>> map2 = Maps.newLinkedHashMap();
|
||||
sitePositionLists.stream()
|
||||
.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"))
|
||||
.forEach(item -> {
|
||||
if (StringUtils.equals(item.getSjName(), "18:00-19:00")) {
|
||||
putIntoMap(item, map1);
|
||||
}
|
||||
if (StringUtils.equals(item.getSjName(), "19:00-20:00")) {
|
||||
putIntoMap(item, map1);
|
||||
}
|
||||
if (StringUtils.equals(item.getSjName(), "20:00-21:00")) {
|
||||
putIntoMap(item, map2);
|
||||
}
|
||||
if (StringUtils.equals(item.getSjName(), "21:00-22:00")) {
|
||||
putIntoMap(item, map2);
|
||||
}
|
||||
});
|
||||
StringBuffer sb1 = new StringBuffer("查询江体小程序场地信息【18:00-20:00】\n");
|
||||
buildMsg2(map1, sb1);
|
||||
StringBuffer sb2 = new StringBuffer("查询江体小程序场地信息【20:00-22:00】\n");
|
||||
buildMsg2(map2, sb2);
|
||||
dingTalkScriptVenueService.sendScriptMsg(sb1.toString());
|
||||
dingTalkScriptVenueService.sendScriptMsg(sb2.toString());
|
||||
}
|
||||
|
||||
@Scheduled(cron = "0 0/10 9-15 * * ?")
|
||||
@@ -39,4 +78,73 @@ public class VenueQuerySchedule {
|
||||
log.info("每日紧急时刻时刻拉取江体小程序数据定时任务");
|
||||
venueService.queryVenueService();
|
||||
}
|
||||
|
||||
@Scheduled(cron = "0 0/1 9-20 * * ?")
|
||||
public void venueCanBuyMsg() {
|
||||
List<VenueInfoDO> venueInfoDOS = venueService.queryCanBuyVenue();
|
||||
if (CollectionUtils.isEmpty(venueInfoDOS)) {
|
||||
return;
|
||||
}
|
||||
// 6-8场地
|
||||
Map<String, List<VenueInfoDO>> map1 = Maps.newLinkedHashMap();
|
||||
// 8-10场地
|
||||
Map<String, List<VenueInfoDO>> map2 = Maps.newLinkedHashMap();
|
||||
venueInfoDOS.stream()
|
||||
.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"))
|
||||
.forEach(item -> {
|
||||
if (StringUtils.equals(item.getSjName(), "18:00-19:00")) {
|
||||
putIntoMap(item, map1);
|
||||
}
|
||||
if (StringUtils.equals(item.getSjName(), "19:00-20:00")) {
|
||||
putIntoMap(item, map1);
|
||||
}
|
||||
if (StringUtils.equals(item.getSjName(), "20:00-21:00")) {
|
||||
putIntoMap(item, map2);
|
||||
}
|
||||
if (StringUtils.equals(item.getSjName(), "21:00-22:00")) {
|
||||
putIntoMap(item, map2);
|
||||
}
|
||||
});
|
||||
StringBuffer sb1 = new StringBuffer("查询江体小程序场地信息【18:00-20:00】\n");
|
||||
buildMsg(map1, sb1);
|
||||
StringBuffer sb2 = new StringBuffer("查询江体小程序场地信息【20:00-22:00】\n");
|
||||
buildMsg(map2, sb2);
|
||||
dingTalkScriptVenueService.sendScriptMsg(sb1.toString());
|
||||
dingTalkScriptVenueService.sendScriptMsg(sb2.toString());
|
||||
}
|
||||
|
||||
private static void buildMsg(Map<String, List<VenueInfoDO>> map1, StringBuffer sb1) {
|
||||
map1.forEach((k, v) -> {
|
||||
VenueInfoDO sitePositionList1 = v.get(0);
|
||||
VenueInfoDO sitePositionList2 = v.get(1);
|
||||
String contacts = sitePositionList1.getContacts();
|
||||
if (!StringUtils.equals(sitePositionList1.getContacts(), sitePositionList2.getContacts())) {
|
||||
contacts = sitePositionList1.getContacts() + "," + sitePositionList2.getContacts();
|
||||
}
|
||||
sb1.append(k).append("场地,订购人:").append(contacts).append("\n");
|
||||
});
|
||||
}
|
||||
private static void buildMsg2(Map<String, List<SitePositionList>> map1, StringBuffer sb1) {
|
||||
map1.forEach((k, v) -> {
|
||||
SitePositionList sitePositionList1 = v.get(0);
|
||||
SitePositionList sitePositionList2 = v.get(1);
|
||||
String contacts = sitePositionList1.getContacts();
|
||||
if (!StringUtils.equals(sitePositionList1.getContacts(), sitePositionList2.getContacts())) {
|
||||
contacts = sitePositionList1.getContacts() + "," + sitePositionList2.getContacts();
|
||||
}
|
||||
sb1.append(k).append("场地,订购人:").append(contacts).append("\n");
|
||||
});
|
||||
}
|
||||
|
||||
private static void putIntoMap(VenueInfoDO item, Map<String, List<VenueInfoDO>> map1) {
|
||||
map1.computeIfAbsent(item.getPlaceName(),
|
||||
k -> new ArrayList<>()
|
||||
).add(item);
|
||||
}
|
||||
private static void putIntoMap(SitePositionList item, Map<String, List<SitePositionList>> map1) {
|
||||
map1.computeIfAbsent(item.getPlaceName(),
|
||||
k -> new ArrayList<>()
|
||||
).add(item);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.xiang.xservice.application.script.jntyzx.service;
|
||||
|
||||
import com.xiang.xservice.application.script.jntyzx.entity.pojo.VenueInfoDO;
|
||||
import com.xiang.xservice.application.script.jntyzx.entity.resp.query.SitePositionList;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -10,7 +11,7 @@ import java.util.List;
|
||||
*/
|
||||
public interface IVenueService {
|
||||
|
||||
void queryVenueService();
|
||||
List<SitePositionList> queryVenueService();
|
||||
|
||||
List<VenueInfoDO> queryCanBuyVenue();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.xiang.xservice.application.script.jntyzx.service;
|
||||
|
||||
import com.xiang.xservice.application.script.jntyzx.entity.pojo.VenueInfoDO;
|
||||
import com.xiang.xservice.application.script.jntyzx.entity.resp.query.SitePositionList;
|
||||
|
||||
import java.util.List;
|
||||
@@ -15,5 +16,9 @@ public interface IVenueServiceHttp {
|
||||
*/
|
||||
List<SitePositionList> queryAvailable(String isWeekend, String token);
|
||||
|
||||
// Boolean createOrder();
|
||||
/**
|
||||
* 订单创建
|
||||
* @return
|
||||
*/
|
||||
Boolean createOrder(List<VenueInfoDO> venueInfos);
|
||||
}
|
||||
|
||||
@@ -6,17 +6,19 @@ import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.xiang.xmc.service.http.helper.HttpHelper;
|
||||
import com.xiang.xservice.application.script.jntyzx.constants.UrlConstant;
|
||||
import com.xiang.xservice.application.script.jntyzx.entity.dto.VenueListDTO;
|
||||
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;
|
||||
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.basic.utils.DateUtils;
|
||||
import com.xiang.xservice.basic.utils.Base64;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
@@ -80,20 +82,70 @@ public class VenueServiceHttpImpl implements IVenueServiceHttp {
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean createOrder(List<VenueInfoDO> venueInfos) {
|
||||
|
||||
private Boolean filterTime(SitePositionList sitePositionList) {
|
||||
if (StringUtils.equals("18:00-19:00", sitePositionList.getSjName())) {
|
||||
return Boolean.TRUE;
|
||||
List<SubscribeVo> vos = Lists.newArrayList();
|
||||
for (VenueInfoDO venueInfo : venueInfos) {
|
||||
SubscribeVo subscribeVo = new SubscribeVo();
|
||||
subscribeVo.setId(0);
|
||||
subscribeVo.setBallCourtId("03");
|
||||
subscribeVo.setSjName(venueInfo.getSjName());
|
||||
subscribeVo.setScheduleId(String.valueOf(venueInfo.getScheduleId()));
|
||||
subscribeVo.setPlaceName(venueInfo.getPlaceName());
|
||||
subscribeVo.setPlaceId(venueInfo.getPlaceId());
|
||||
subscribeVo.setType("0");
|
||||
subscribeVo.setClassName(venueInfo.getClassName());
|
||||
subscribeVo.setClassCode(venueInfo.getClassCode());
|
||||
subscribeVo.setMoney(venueInfo.getMoney());
|
||||
subscribeVo.setContacts("0");
|
||||
subscribeVo.setContactNumber(null);
|
||||
subscribeVo.setMemberNumber(null);
|
||||
subscribeVo.setAppointments(venueInfo.getAppointments());
|
||||
subscribeVo.setOperator(null);
|
||||
subscribeVo.setEndTime(null);
|
||||
subscribeVo.setBeginTime(null);
|
||||
subscribeVo.setSpecOneTimes(3);
|
||||
subscribeVo.setCtypeCode(venueInfo.getCTypeCode());
|
||||
subscribeVo.setIsWhole(0);
|
||||
subscribeVo.setOrderId(null);
|
||||
subscribeVo.setVotesnum(1);
|
||||
vos.add(subscribeVo);
|
||||
}
|
||||
if (StringUtils.equals("19:00-20:00", sitePositionList.getSjName())) {
|
||||
return Boolean.TRUE;
|
||||
|
||||
JSONObject jsonObject = buildParamJsonObj();
|
||||
SubscribeRequest subscribeRequest = new SubscribeRequest();
|
||||
|
||||
subscribeRequest.setSubscribeVos(vos);
|
||||
subscribeRequest.setBookTime(venueInfos.get(0).getAppointments());
|
||||
subscribeRequest.setPaymentMethod(1);
|
||||
subscribeRequest.setSvCiphertext(Base64.encode(JSON.toJSONString(vos).getBytes(StandardCharsets.UTF_8)));
|
||||
subscribeRequest.setJsonObject(jsonObject);
|
||||
|
||||
Map<String, String> params = Maps.newHashMap();
|
||||
params.put("X-Access-Token", "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE3NjU3ODQ1NjMsInVzZXJuYW1lIjoid3hfb3Blbl9pZF9vMjFNWDR5N3doWENHanZVVEdQNkNUejJIYkQ4In0.QBzNQNvJZQPZZnzmbU8K5Liz0piHwercrDIq3kirUJk");
|
||||
String resp = HttpHelper.doPost(UrlConstant.ADD_SUBSCRIBE, params, JSONObject.toJSONString(subscribeRequest));
|
||||
return null;
|
||||
}
|
||||
if (StringUtils.equals("20:00-21:00", sitePositionList.getSjName())) {
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
if (StringUtils.equals("21:00-22:00", sitePositionList.getSjName())) {
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
return Boolean.FALSE;
|
||||
|
||||
private static JSONObject buildParamJsonObj() {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("id", "1702581215097257986");
|
||||
jsonObject.put("createBy", null);
|
||||
jsonObject.put("createTime", "2023-09-15 15:12:48");
|
||||
jsonObject.put("updateBy", null);
|
||||
jsonObject.put("updateTime", null);
|
||||
jsonObject.put("sysOrgCode", null);
|
||||
jsonObject.put("openId", "o21MX4y7whXCGjvUTGP6CTz2HbD8");
|
||||
jsonObject.put("nickName", "1");
|
||||
jsonObject.put("unionId", null);
|
||||
jsonObject.put("avatarUrl", "https://thirdwx.qlogo.cn/mmopen/vi_32/POgEwh4mIHO4nibH0KlMECNjjGxQUq24ZEaGT4poC6icRiccVGKSyXwibcPq4BWmiaIGuG1icwxaQX6grC9VemZoJ8rg/132");
|
||||
jsonObject.put("remarks", null);
|
||||
jsonObject.put("default01", null);
|
||||
jsonObject.put("default02", null);
|
||||
jsonObject.put("default03", null);
|
||||
jsonObject.put("default04", null);
|
||||
jsonObject.put("default05", null);
|
||||
return jsonObject;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,6 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
@@ -29,43 +28,16 @@ public class VenueServiceImpl implements IVenueService {
|
||||
|
||||
private final static String STATIC_TOKEN = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE3NjU3ODQ1NjMsInVzZXJuYW1lIjoid3hfb3Blbl9pZF9vMjFNWDR5N3doWENHanZVVEdQNkNUejJIYkQ4In0.QBzNQNvJZQPZZnzmbU8K5Liz0piHwercrDIq3kirUJk";
|
||||
private final IVenueServiceHttp venueServiceHttp;
|
||||
private final DingTalkScriptVenueService dingTalkScriptVenueService;
|
||||
private final IVenueInfoManage venueInfoManage;
|
||||
|
||||
@Override
|
||||
public void queryVenueService() {
|
||||
public List<SitePositionList> queryVenueService() {
|
||||
List<SitePositionList> sitePositionLists = venueServiceHttp.queryAvailable("1", STATIC_TOKEN);
|
||||
if (CollectionUtils.isEmpty(sitePositionLists)) {
|
||||
return;
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
// 6-8场地
|
||||
Map<String, List<SitePositionList>> map1 = Maps.newLinkedHashMap();
|
||||
// 8-10场地
|
||||
Map<String, List<SitePositionList>> map2 = Maps.newLinkedHashMap();
|
||||
sitePositionLists.stream()
|
||||
.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"))
|
||||
.forEach(item -> {
|
||||
if (StringUtils.equals(item.getSjName(), "18:00-19:00")) {
|
||||
putIntoMap(item, map1);
|
||||
}
|
||||
if (StringUtils.equals(item.getSjName(), "19:00-20:00")) {
|
||||
putIntoMap(item, map1);
|
||||
}
|
||||
if (StringUtils.equals(item.getSjName(), "20:00-21:00")) {
|
||||
putIntoMap(item, map2);
|
||||
}
|
||||
if (StringUtils.equals(item.getSjName(), "21:00-22:00")) {
|
||||
putIntoMap(item, map2);
|
||||
}
|
||||
});
|
||||
StringBuffer sb1 = new StringBuffer("查询江体小程序场地信息【18:00-20:00】\n");
|
||||
buildMsg(map1, sb1);
|
||||
StringBuffer sb2 = new StringBuffer("查询江体小程序场地信息【20:00-22:00】\n");
|
||||
buildMsg(map2, sb2);
|
||||
updateDatabase(sitePositionLists);
|
||||
dingTalkScriptVenueService.sendScriptMsg(sb1.toString());
|
||||
dingTalkScriptVenueService.sendScriptMsg(sb2.toString());
|
||||
return sitePositionLists;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -83,8 +55,11 @@ public class VenueServiceImpl implements IVenueService {
|
||||
for (SitePositionList sitePositionList : list) {
|
||||
if (map.containsKey(sitePositionList.getId())) {
|
||||
VenueInfoDO venueInfoDO = map.get(sitePositionList.getId());
|
||||
if (!StringUtils.equals(venueInfoDO.getContacts(), sitePositionList.getContacts())) {
|
||||
if (!StringUtils.equals(venueInfoDO.getContacts(), sitePositionList.getContacts())
|
||||
|| !Objects.equals(venueInfoDO.getType(), sitePositionList.getType())) {
|
||||
venueInfoDO.setContacts(sitePositionList.getContacts());
|
||||
venueInfoDO.setType(sitePositionList.getType());
|
||||
venueInfoDO.setPlaceMainId(sitePositionList.getId());
|
||||
venueInfoManage.updateById(venueInfoDO);
|
||||
}
|
||||
} else {
|
||||
@@ -97,6 +72,12 @@ public class VenueServiceImpl implements IVenueService {
|
||||
venueInfoDO.setSjName(sitePositionList.getSjName());
|
||||
venueInfoDO.setCreateTime(LocalDateTime.now());
|
||||
venueInfoDO.setContacts(sitePositionList.getContacts());
|
||||
venueInfoDO.setType(sitePositionList.getType());
|
||||
venueInfoDO.setMoney(sitePositionList.getMoney());
|
||||
venueInfoDO.setClassName(sitePositionList.getClassName());
|
||||
venueInfoDO.setClassCode(sitePositionList.getClassCode());
|
||||
venueInfoDO.setAppointments(sitePositionList.getAppointments());
|
||||
venueInfoDO.setCTypeCode(sitePositionList.getCtypeCode());
|
||||
insertList.add(venueInfoDO);
|
||||
}
|
||||
}
|
||||
@@ -104,22 +85,4 @@ public class VenueServiceImpl implements IVenueService {
|
||||
venueInfoManage.saveBatch(insertList);
|
||||
}
|
||||
}
|
||||
|
||||
private static void buildMsg(Map<String, List<SitePositionList>> map1, StringBuffer sb1) {
|
||||
map1.forEach((k, v) -> {
|
||||
SitePositionList sitePositionList1 = v.get(0);
|
||||
SitePositionList sitePositionList2 = v.get(1);
|
||||
String contacts = sitePositionList1.getContacts();
|
||||
if (!StringUtils.equals(sitePositionList1.getContacts(), sitePositionList2.getContacts())) {
|
||||
contacts = sitePositionList1.getContacts() + "," + sitePositionList2.getContacts();
|
||||
}
|
||||
sb1.append(k).append("场地,订购人:").append(contacts).append("\n");
|
||||
});
|
||||
}
|
||||
|
||||
private static void putIntoMap(SitePositionList item, Map<String, List<SitePositionList>> map1) {
|
||||
map1.computeIfAbsent(item.getPlaceName(),
|
||||
k -> new ArrayList<>()
|
||||
).add(item);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user