Merge pull request 'feat/robot_dev' (#5) from feat/robot_dev into master
Reviewed-on: XiangZ/xservice-script#5
This commit is contained in:
69
pom.xml
69
pom.xml
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>com.xiang</groupId>
|
||||
<artifactId>xservice-basic</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<version>1.1</version>
|
||||
</parent>
|
||||
|
||||
<groupId>com.xiang</groupId>
|
||||
@@ -30,68 +30,29 @@
|
||||
<dependency>
|
||||
<groupId>com.xiang</groupId>
|
||||
<artifactId>xservice-common</artifactId>
|
||||
<version>1.0-snapshot</version>
|
||||
<version>1.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.xiang</groupId>
|
||||
<artifactId>xservice-third-part</artifactId>
|
||||
<version>1.0-snapshot</version>
|
||||
</dependency>
|
||||
<!--<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter</artifactId>
|
||||
<version>${spring.boot.version}</version>
|
||||
<artifactId>xservice-message-starter</artifactId>
|
||||
<version>2.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
<version>${spring.boot.version}</version>
|
||||
<groupId>com.xiang</groupId>
|
||||
<artifactId>xservice-schedule-starter</artifactId>
|
||||
<version>1.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.32</version>
|
||||
<groupId>com.xiang</groupId>
|
||||
<artifactId>xservice-cache-starter</artifactId>
|
||||
<version>1.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.xiang</groupId>
|
||||
<artifactId>xservice-http-starter</artifactId>
|
||||
<version>1.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.alibaba.fastjson2</groupId>
|
||||
<artifactId>fastjson2</artifactId>
|
||||
<version>2.0.51</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
<version>4.5.13</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>8.0.33</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.mybatis.spring.boot</groupId>
|
||||
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||
<version>2.3.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
<version>32.0.1-android</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-collections4</artifactId>
|
||||
<version>4.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
<version>3.15.0</version>
|
||||
</dependency>-->
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
||||
@@ -11,12 +11,12 @@
|
||||
</parent>
|
||||
|
||||
<groupId>com.xiang</groupId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<version>1.0</version>
|
||||
<packaging>jar</packaging>
|
||||
<artifactId>script</artifactId>
|
||||
|
||||
<properties>
|
||||
<java.version>1.8</java.version>
|
||||
<java.version>17</java.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package com.xiang;
|
||||
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.context.properties.ConfigurationPropertiesScan;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
|
||||
/**
|
||||
@@ -10,6 +12,14 @@ import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
*/
|
||||
@SpringBootApplication
|
||||
@EnableScheduling
|
||||
@MapperScan(basePackages = {
|
||||
"com.xiang.xservice.fwd.mapper",
|
||||
"com.xiang.xservice.glados.repository",
|
||||
"com.xiang.xservice.xb.repository"
|
||||
})
|
||||
@ConfigurationPropertiesScan(basePackages = {
|
||||
"com.xiang.xservice.config"
|
||||
})
|
||||
public class ServiceScriptApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(ServiceScriptApplication.class, args);
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package com.xiang.xservice;
|
||||
|
||||
import com.xiang.xservice.basic.common.resp.Result;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
@@ -12,8 +14,11 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/demo")
|
||||
@RequiredArgsConstructor
|
||||
public class IndexController {
|
||||
|
||||
private final RedisTemplate<String, String> redisTemplate;
|
||||
|
||||
@Value("${spring.profiles.active}")
|
||||
private String env;
|
||||
|
||||
@@ -28,4 +33,11 @@ public class IndexController {
|
||||
String msg = "已激活环境:" + env + ",web端口启用:" + port + "使用datasource:" + url;
|
||||
return Result.success(msg);
|
||||
}
|
||||
|
||||
@GetMapping("/redisTest")
|
||||
private Result<Void> redisTest() {
|
||||
redisTemplate.opsForValue().set("2222", "231");
|
||||
|
||||
return Result.success("redis获取到key为test的值为:" + redisTemplate.opsForValue().get("2222"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.xiang.xservice.config;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: xiang
|
||||
* @Date: 2025-08-07 10:46
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@ConfigurationProperties(prefix = "dingtalk.robot.script")
|
||||
public class DingTalkRobotScriptConfig {
|
||||
|
||||
private String token;
|
||||
private String secret;
|
||||
private List<String> users;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.xiang.xservice.config;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: xiang
|
||||
* @Date: 2025-08-07 10:46
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@ConfigurationProperties(prefix = "dingtalk.robot.xb")
|
||||
public class DingTalkRobotXbConfig {
|
||||
|
||||
private String token;
|
||||
private String secret;
|
||||
private List<String> users;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.xiang.xservice.domain.service;
|
||||
|
||||
import com.xiang.xservice.basic.xservice.dingTalk.service.DingTalkService;
|
||||
import com.xiang.xservice.config.DingTalkRobotScriptConfig;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @Author: xiang
|
||||
* @Date: 2025-08-07 10:30
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class DingTalkScriptDomainService {
|
||||
|
||||
private final DingTalkService dingTalkService;
|
||||
private final DingTalkRobotScriptConfig dingTalkRobotScriptConfig;
|
||||
|
||||
/**
|
||||
* 发送脚本消息
|
||||
* @param msg 消息
|
||||
*/
|
||||
public void sendScriptMsg(String msg) {
|
||||
try {
|
||||
dingTalkService.sendRobotMessage(dingTalkRobotScriptConfig.getSecret(), dingTalkRobotScriptConfig.getToken(),
|
||||
dingTalkRobotScriptConfig.getUsers(), msg);
|
||||
} catch (Exception e) {
|
||||
log.error("信息发送异常, 信息:{}", msg, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,11 +8,9 @@ import com.aliyun.alidns20150109.models.DescribeSubDomainRecordsResponse;
|
||||
import com.aliyun.alidns20150109.models.DescribeSubDomainRecordsResponseBody;
|
||||
import com.aliyun.alidns20150109.models.UpdateDomainRecordRequest;
|
||||
import com.aliyun.teaopenapi.models.Config;
|
||||
import com.xiang.xservice.basic.xservice.dingTalk.service.DingTalkService;
|
||||
import com.xiang.xservice.domain.config.AliyunDnsPropertyConfig;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
@@ -38,10 +36,7 @@ public class IDomainServiceImpl implements IDomainService {
|
||||
private final AliyunDnsPropertyConfig aliyunDnsPropertyConfig;
|
||||
private static final String TYPE = "A";
|
||||
|
||||
private final DingTalkService dingTalkService;
|
||||
@Value("${DingTalk.chatId}")
|
||||
private String chatId;
|
||||
|
||||
private final DingTalkScriptDomainService dingTalkService;
|
||||
@Override
|
||||
public void dynamicDomainAnalysis(String publicIp) throws Exception {
|
||||
Client client = createClient();
|
||||
@@ -58,14 +53,14 @@ public class IDomainServiceImpl implements IDomainService {
|
||||
if (records.isEmpty()) {
|
||||
log.info("未找到记录,添加记录..., ip:{}", publicIp);
|
||||
addDnsRecord(client, publicIp, rr);
|
||||
dingTalkService.sendChatMessage(chatId, "动态解析公网ip成功,域名:" + rr + "." + DOMAIN_NAME + ", 新ip:" + publicIp);
|
||||
dingTalkService.sendScriptMsg("动态解析公网ip成功,域名:" + rr + "." + DOMAIN_NAME + ", 新ip:" + publicIp);
|
||||
} else {
|
||||
String recordId = records.get(0).getRecordId();
|
||||
String currentValue = records.get(0).getValue();
|
||||
if (!publicIp.equals(currentValue)) {
|
||||
log.info("IP变更,更新记录...,ip:{}", publicIp);
|
||||
updateDnsRecord(client, recordId, publicIp, rr);
|
||||
dingTalkService.sendChatMessage(chatId, "动态解析公网ip成功,域名:" + rr + "." + DOMAIN_NAME + ", 新ip:" + publicIp);
|
||||
dingTalkService.sendScriptMsg("动态解析公网ip成功,域名:" + rr + "." + DOMAIN_NAME + ", 新ip:" + publicIp);
|
||||
} else {
|
||||
log.info("ip未变更,无需修改,ip:{}", publicIp);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
package com.xiang.xservice.fwd.constants;
|
||||
|
||||
public class CodeConstants {
|
||||
public static final Integer SUCCESS = 10000;
|
||||
public static final Integer LIMIT = 47009;
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.xiang.xservice.fwd.constants;
|
||||
|
||||
public class UrlConstants {
|
||||
|
||||
public static final String token = "Bearer eyJhbGciOiJIUzUxMiJ9.eyJjdCI6MTc1MjYzODAwNTUxNywic3ViIjoiTDIxMTQzMjU2NDEiLCJhdWQiOiJMSVZFTEFCIiwiaXNzIjoiVElDS0VUIiwibWlkIjoxNzU4ODA4NTcxMzgzNjcxNTUzLCJ0eXBlIjoiYXBwbGV0IiwiaWF0IjoxNzUyNjM4MDA1LCJkaWQiOiI2RTRDMDQ5RS00RkFBLTQ0NDMtQjI3NC1DNjRBMjZEMUFGNTkiLCJrZXkiOiJMSVZFTEFCIn0.iw1u3LyCYlxYCI1gMwTeuJlPdv-rQKCVlO2ySF_UrJ-lrEH6fm5lGo4wGalLn1qGkyqZaxuTx1K6X7Oy7sHgBA";
|
||||
|
||||
/**
|
||||
* 芬玩岛的基础URL
|
||||
*/
|
||||
public final static String BASE_URL = "https://api.livelab.com.cn";
|
||||
|
||||
/**
|
||||
* 全部演出列表URL
|
||||
*/
|
||||
public final static String PROJECTS_URL = BASE_URL + "/appShow/app/homepage/projects";
|
||||
|
||||
/**
|
||||
* 查询演出详情URL
|
||||
*/
|
||||
public final static String PROJECTS_INFO_URL = BASE_URL + "/performance/app/project/get_project_info";
|
||||
|
||||
/**
|
||||
* 查询演出具体票务信息
|
||||
*/
|
||||
public final static String PERFORMS_URL = BASE_URL + "/performance/app/project/get_performs";
|
||||
/**
|
||||
* 创建订单URL
|
||||
*/
|
||||
public final static String PROJECT_ORDER_CREATE_URL = BASE_URL + "/order/app/center/v3/create";
|
||||
|
||||
/**
|
||||
* 获取演出座位信息
|
||||
*/
|
||||
public final static String PROJECT_SEAT_STATUS_URL = BASE_URL + "/performance/app/project/seatPlanStatus";
|
||||
|
||||
/**
|
||||
* 查询观影人列表
|
||||
*/
|
||||
public final static String PROJECT_AUDIENCE_MEMBER_INFO = BASE_URL + "/member/member/bearer/app/list";
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.xiang.xservice.fwd.entity.param;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class FwdOrderTaskParam {
|
||||
private Long projectId;
|
||||
private Long taskId;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.xiang.xservice.fwd.entity.pojo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class FAudienceConfig {
|
||||
private Long id;
|
||||
private Integer status;
|
||||
private Long frequentId;
|
||||
private String frequentName;
|
||||
private String frequentNo;
|
||||
private String frequentPhone;
|
||||
private Integer delFlag;
|
||||
private Long userId;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.xiang.xservice.fwd.entity.pojo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class FPerformConfig {
|
||||
private Long id;
|
||||
private Long projectId;
|
||||
private LocalDateTime time;
|
||||
private Integer delFlag;
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.xiang.xservice.fwd.entity.pojo;
|
||||
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class FPerformProjectInfo {
|
||||
private Long id;
|
||||
|
||||
private String projectName;
|
||||
|
||||
private String nameDisplay;
|
||||
|
||||
private Integer status;
|
||||
|
||||
private String projectSource;
|
||||
|
||||
private Integer isHasSeat;
|
||||
|
||||
private Integer isChoiceSeat;
|
||||
|
||||
private Long bizId;
|
||||
|
||||
private Long projectId;
|
||||
|
||||
private String tagName;
|
||||
|
||||
private String tagRemark;
|
||||
|
||||
private String projectCity;
|
||||
|
||||
private String shortCity;
|
||||
|
||||
private String venueName;
|
||||
|
||||
private BigDecimal lowestPrice;
|
||||
|
||||
private BigDecimal highestPrice;
|
||||
|
||||
private BigDecimal projectPrice;
|
||||
|
||||
private LocalDate projectStartDate;
|
||||
|
||||
private LocalDate projectEndDate;
|
||||
|
||||
private String subClassifyName;
|
||||
|
||||
private LocalDateTime preSaleTime;
|
||||
}
|
||||
@@ -0,0 +1,143 @@
|
||||
package com.xiang.xservice.fwd.entity.pojo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @Author: xiang
|
||||
* @Date: 2025-07-25 10:36
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class FPerformSeatInfo implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 座位计划id
|
||||
*/
|
||||
private Long seatPlanId;
|
||||
|
||||
/**
|
||||
* 座位计划名称
|
||||
*/
|
||||
private String seatPlanName;
|
||||
|
||||
/**
|
||||
* 演出id
|
||||
*/
|
||||
private Long performId;
|
||||
|
||||
/**
|
||||
* 演出名称
|
||||
*/
|
||||
private String performName;
|
||||
|
||||
/**
|
||||
* 停止销售
|
||||
*/
|
||||
private Integer stopSale;
|
||||
|
||||
/**
|
||||
* shelf_status
|
||||
*/
|
||||
private Integer shelfStatus;
|
||||
|
||||
/**
|
||||
* 价格
|
||||
*/
|
||||
private BigDecimal price;
|
||||
|
||||
/**
|
||||
* 折扣价
|
||||
*/
|
||||
private BigDecimal discountPrice;
|
||||
|
||||
/**
|
||||
* sub_status
|
||||
*/
|
||||
private Integer subStatus;
|
||||
|
||||
/**
|
||||
* quantity
|
||||
*/
|
||||
private Integer quantity;
|
||||
|
||||
/**
|
||||
* status
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* max_sell_stock
|
||||
*/
|
||||
private Integer maxSellStock;
|
||||
|
||||
/**
|
||||
* sold_stock
|
||||
*/
|
||||
private Integer soldStock;
|
||||
|
||||
/**
|
||||
* left_stock
|
||||
*/
|
||||
private Integer leftStock;
|
||||
|
||||
/**
|
||||
* able_sale_quantity
|
||||
*/
|
||||
private Integer ableSaleQuantity;
|
||||
|
||||
/**
|
||||
* ash_show
|
||||
*/
|
||||
private Integer ashShow;
|
||||
|
||||
/**
|
||||
* ash_show_desc
|
||||
*/
|
||||
private String ashShowDesc;
|
||||
|
||||
/**
|
||||
* selectable
|
||||
*/
|
||||
private Integer selectable;
|
||||
|
||||
/**
|
||||
* display
|
||||
*/
|
||||
private Integer display;
|
||||
|
||||
/**
|
||||
* available_ticket_quantity
|
||||
*/
|
||||
private Integer availableTicketQuantity;
|
||||
|
||||
/**
|
||||
* available_all_ticket_quantity
|
||||
*/
|
||||
private Integer availableAllTicketQuantity;
|
||||
|
||||
/**
|
||||
* sale_time
|
||||
*/
|
||||
private LocalDateTime saleTime;
|
||||
|
||||
/**
|
||||
* 演出id(总)
|
||||
*/
|
||||
private Long projectId;
|
||||
|
||||
/**
|
||||
* 是否售罄
|
||||
* 0:否 1:是
|
||||
*/
|
||||
private Integer soldOut;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.xiang.xservice.fwd.entity.pojo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class FUserConfig {
|
||||
private Long id;
|
||||
private String name;
|
||||
private String token;
|
||||
private Integer status;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.xiang.xservice.fwd.entity.req;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.checkerframework.checker.units.qual.N;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public class PrivilegeCode {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.xiang.xservice.fwd.entity.req;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class ProjectOrderCreateReq {
|
||||
private Integer deliveryType;
|
||||
private String contactName;
|
||||
private String contactPhone;
|
||||
private BigDecimal payment;
|
||||
private BigDecimal totalPrice;
|
||||
private Long performId;
|
||||
private String projectId;
|
||||
private List<PrivilegeCode> privilegeCodeList;
|
||||
private Integer audienceCount;
|
||||
private List<Long> frequentIds;
|
||||
private List<Long> seatPlanIds;
|
||||
private String blackBox;
|
||||
private String combineTicketVos;
|
||||
private String ordinaryTicketVos;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.xiang.xservice.fwd.entity.resp;
|
||||
|
||||
public class BaseResult<T> {
|
||||
/**
|
||||
* 响应码 10000成功
|
||||
*/
|
||||
private Long code;
|
||||
|
||||
/**
|
||||
* 消息
|
||||
*/
|
||||
private String msg;
|
||||
|
||||
/**
|
||||
* 数据
|
||||
*/
|
||||
private T data;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.xiang.xservice.fwd.entity.resp.http.audience;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class AudienceMemberInfo {
|
||||
private Long frequentContactsId;
|
||||
private String name;
|
||||
private String idTypeCode;
|
||||
private String idType;
|
||||
private String idTypeDesc;
|
||||
private String idCard;
|
||||
private String phone;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.xiang.xservice.fwd.entity.resp.http.perform;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class DeductionRuleDTO {
|
||||
private BigDecimal commonRatio;
|
||||
private BigDecimal commonMinUnit;
|
||||
private BigDecimal commonThreshold;
|
||||
private List<String> specialRefundBeanRuleDtoList;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.xiang.xservice.fwd.entity.resp.http.perform;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class Delivery {
|
||||
private Integer deliveryType;
|
||||
private String beforeDays;
|
||||
private String address;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.xiang.xservice.fwd.entity.resp.http.perform;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class Notice {
|
||||
private String searchValue;
|
||||
private String createBy;
|
||||
private LocalDateTime createTime;
|
||||
private String updateBy;
|
||||
private LocalDateTime updateTime;
|
||||
private String remark;
|
||||
private List<Object> params;
|
||||
private Long id;
|
||||
private Long projectId;
|
||||
private String name;
|
||||
private Integer choose;
|
||||
private String content;
|
||||
private String tag;
|
||||
private Integer type;
|
||||
private Integer enhanced;
|
||||
private String description;
|
||||
private Integer sort;
|
||||
private String delFlag;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.xiang.xservice.fwd.entity.resp.http.perform;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class Perform {
|
||||
private Long projectId;
|
||||
private Integer purchaseLimitationOnce;
|
||||
private String limitationPrompt;
|
||||
private Integer showDate;
|
||||
private List<String> dates;
|
||||
private List<PerformInfo> performInfos;
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.xiang.xservice.fwd.entity.resp.http.perform;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class PerformDetail {
|
||||
private Long id;
|
||||
private String name;
|
||||
private Integer status;
|
||||
private String beginTime;
|
||||
private String endTime;
|
||||
private String beginDate;
|
||||
private String endDate;
|
||||
private String validityPeriod;
|
||||
private Integer includeSpecial;
|
||||
private String specialDate;
|
||||
private Integer isOneOrderOneCard;
|
||||
private Integer isOneTicketOneCard;
|
||||
private String cardType;
|
||||
private Integer performType;
|
||||
private List<Delivery> delivery;
|
||||
private String isChoiceSeat;
|
||||
private Integer ashShow;
|
||||
private String ashShowDesc;
|
||||
private Integer selectable;
|
||||
private List<String> tags;
|
||||
private List<String> tagsCustom;
|
||||
private String subStatus;
|
||||
private List<SeatPlan> seatPlans;
|
||||
private String expressFeeStr;
|
||||
private String saleTime;
|
||||
private Integer allowAppointment;
|
||||
private Integer enableNoTicketLabel;
|
||||
private String standbyChannel;
|
||||
private Integer sort;
|
||||
private String openLabel;
|
||||
private String label;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.xiang.xservice.fwd.entity.resp.http.perform;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class PerformInfo {
|
||||
private String dateStr;
|
||||
private List<PerformDetail> performInfo;
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package com.xiang.xservice.fwd.entity.resp.http.perform;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class ProjectInfoResp {
|
||||
private Long projectId;
|
||||
private String projectName;
|
||||
private String nameDisplay;
|
||||
private Integer status;
|
||||
private String projectSource;
|
||||
private Integer isHasSeat;
|
||||
private Integer isChoiceSeat;
|
||||
private String poster;
|
||||
private BigDecimal highPrice;
|
||||
private BigDecimal lowPrice;
|
||||
private String projectPrice;
|
||||
private String projectStartDate;
|
||||
private String projectEndDate;
|
||||
private String timeDisplay;
|
||||
private String projectCity;
|
||||
private String subClassifyName;
|
||||
private List<ProjectService> projectServices;
|
||||
private Integer showFlag;
|
||||
private String preSaleTime;
|
||||
private String saleStartTime;
|
||||
private Long lastTime;
|
||||
private Integer buttonStatus;
|
||||
private String deliveryType;
|
||||
private String details;
|
||||
private VenueInfo venueInfo;
|
||||
private List<Notice> ticketNotices;
|
||||
private List<Notice> watchNotices;
|
||||
private List<StandByNotice> standByNotices;
|
||||
private String bkImg;
|
||||
private Integer dialogFlag;
|
||||
private String dialogTitle;
|
||||
private String dialogContent;
|
||||
private Integer isPrivilegeCode;
|
||||
private Integer canBuyQuantity;
|
||||
private String dialogButtonContent;
|
||||
private List<String> projectNoticeList;
|
||||
private String dialogChangeTime;
|
||||
private Integer dialogAlwayShow;
|
||||
private Integer serviceSettingSwitch;
|
||||
private String calendarRemindersTitle;
|
||||
private String calendarRemindersContent;
|
||||
private String dyProductId;
|
||||
private Boolean showCalendar;
|
||||
private Integer dyShelfStatus;
|
||||
private String venueUnderlayUrl;
|
||||
private String changeDialogContent;
|
||||
private String licenseInfo;
|
||||
private Integer isPreview;
|
||||
private Boolean existGrabTicketActivity;
|
||||
private Boolean existMoreTicketActivity;
|
||||
private DeductionRuleDTO deductionRuleDto;
|
||||
private RefundBeanRuleDTO refundBeanRuleDto;
|
||||
private Boolean likesShowFlag;
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.xiang.xservice.fwd.entity.resp.http.perform;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 全部演出列表
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class ProjectList {
|
||||
private Long id;
|
||||
|
||||
private String name;
|
||||
|
||||
private Long bizId;
|
||||
|
||||
private Long projectId;
|
||||
|
||||
private String tagName;
|
||||
|
||||
private String tagRemark;
|
||||
|
||||
private String city;
|
||||
|
||||
private String shortCity;
|
||||
|
||||
private String venueName;
|
||||
|
||||
private BigDecimal lowestPrice;
|
||||
|
||||
private String projectPrice;
|
||||
|
||||
private String dateRange;
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.xiang.xservice.fwd.entity.resp.http.perform;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class ProjectOrderCreateResp {
|
||||
private String orderNo;
|
||||
private String totalPrice;
|
||||
private Integer cancelTimestamp;
|
||||
private List<Ticket> tickets;
|
||||
private Integer deliveryType;
|
||||
private String expressFee;
|
||||
private BigDecimal price;
|
||||
private String projectName;
|
||||
private String poster;
|
||||
private String projectCity;
|
||||
private String performStartTime;
|
||||
private String performEndTime;
|
||||
private Integer performType;
|
||||
private String venueName;
|
||||
private String repeatBeardIds;
|
||||
private Long projectId;
|
||||
private Long performId;
|
||||
private Long orderId;
|
||||
private DeductionRuleDTO deductionRuleDto;
|
||||
private RefundBeanRuleDTO refundBeanRuleDto;
|
||||
private Integer refundBeanNum;
|
||||
private Integer deductBeanNum;
|
||||
private Integer sourceType;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.xiang.xservice.fwd.entity.resp.http.perform;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class ProjectService {
|
||||
private String title;
|
||||
private Integer type;
|
||||
private List<String> description;
|
||||
private List<RefundRule> refundRuleList;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.xiang.xservice.fwd.entity.resp.http.perform;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ProjectsResp {
|
||||
private Integer total;
|
||||
|
||||
private List<ProjectList> list;
|
||||
|
||||
private Integer pageNum;
|
||||
|
||||
private Integer pageSize;
|
||||
|
||||
private Integer startRow;
|
||||
|
||||
private Integer endRow;
|
||||
|
||||
private Integer pages;
|
||||
|
||||
private Integer prePage;
|
||||
|
||||
private Integer nextPage;
|
||||
|
||||
private Boolean isFirstPage;
|
||||
|
||||
private Boolean isLastPage;
|
||||
|
||||
private Boolean hasPreviousPage;
|
||||
|
||||
private Boolean hasNextPage;
|
||||
|
||||
private Integer navigatePages;
|
||||
|
||||
private Integer navigatepageNums;
|
||||
|
||||
private Integer navigateFirstPage;
|
||||
|
||||
private Integer navigateLastPage;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.xiang.xservice.fwd.entity.resp.http.perform;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class RefundBeanRuleDTO {
|
||||
private BigDecimal commonRatio;
|
||||
private List<String> specialRefundBeanRuleDtoList;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.xiang.xservice.fwd.entity.resp.http.perform;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class RefundRule {
|
||||
private String performId;
|
||||
private String performName;
|
||||
private String performStartTime;
|
||||
private List<RefundRuleInfo> refundRules;
|
||||
private String refundRuleUndeterminedStr;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.xiang.xservice.fwd.entity.resp.http.perform;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class RefundRuleInfo {
|
||||
private String entrances;
|
||||
private String sourceTypes;
|
||||
private String startTime;
|
||||
private String endTime;
|
||||
private String procedureFeeRatio;
|
||||
private String expressFeeFlag;
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.xiang.xservice.fwd.entity.resp.http.perform;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class SeatPlan {
|
||||
private Long seatPlanId;
|
||||
private String seatPlanName;
|
||||
private Long performId;
|
||||
private String performName;
|
||||
private Integer stopSale;
|
||||
private Integer type;
|
||||
private Integer ableSell;
|
||||
private Integer shelfStatus;
|
||||
private BigDecimal price;
|
||||
private BigDecimal discountPrice;
|
||||
private Integer subStatus;
|
||||
private Integer quantity;
|
||||
private Integer status;
|
||||
private Integer maxSellStock;
|
||||
private Integer soldStock;
|
||||
private Integer leftStock;
|
||||
private Integer ableSaleQuantity;
|
||||
private Integer ashShow;
|
||||
private String ashShowDesc;
|
||||
private Integer selectable;
|
||||
private Integer display;
|
||||
private List<String> tags;
|
||||
private List<String> tagsCustom;
|
||||
private Integer availableTicketQuantity;
|
||||
private Integer availableAllTicketQuantity;
|
||||
private BigDecimal standbyServiceFeeRate;
|
||||
private String saleTime;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.xiang.xservice.fwd.entity.resp.http.perform;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @Author: xiang
|
||||
* @Date: 2025-07-25 16:10
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class SeatPlanStatus {
|
||||
private Long seatPlanId;
|
||||
private Long performId;
|
||||
private Boolean soldOutFlag;
|
||||
private Integer enableNoTicketLabel;
|
||||
private Integer standbyStatus;
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package com.xiang.xservice.fwd.entity.resp.http.perform;
|
||||
|
||||
public class StandByNotice {
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.xiang.xservice.fwd.entity.resp.http.perform;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @Author: xiang
|
||||
* @Date: 2025-07-25 10:13
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class Tags {
|
||||
private int type;
|
||||
|
||||
private String tag;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.xiang.xservice.fwd.entity.resp.http.perform;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class Ticket {
|
||||
private Integer seatPlanType;
|
||||
private String seatPlanName;
|
||||
private Integer seatPlanQuantity;
|
||||
private BigDecimal seatPlanPrice;
|
||||
private Long seatPlanId;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.xiang.xservice.fwd.entity.resp.http.perform;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class TicketNotice {
|
||||
private String searchValue;
|
||||
private String createBy;
|
||||
private LocalDateTime createTime;
|
||||
private String updateBy;
|
||||
private LocalDateTime updateTime;
|
||||
private String remark;
|
||||
private List<Object> params;
|
||||
private Long id;
|
||||
private Long projectId;
|
||||
private String name;
|
||||
private Integer choose;
|
||||
private String content;
|
||||
private String tag;
|
||||
private Integer type;
|
||||
private Integer enhanced;
|
||||
private String description;
|
||||
private Integer sort;
|
||||
private String delFlag;
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.xiang.xservice.fwd.entity.resp.http.perform;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
|
||||
public class VenueInfo {
|
||||
private String searchValue;
|
||||
private String createBy;
|
||||
private LocalDateTime createTime;
|
||||
private String updateBy;
|
||||
private LocalDateTime updateTime;
|
||||
private String remark;
|
||||
private List<Object> params;
|
||||
private Integer id;
|
||||
private String name;
|
||||
private String province;
|
||||
private String city;
|
||||
private String area;
|
||||
private String address;
|
||||
private String planeImage;
|
||||
private String panoramicImage;
|
||||
private String contactsName;
|
||||
private String contactsPhone;
|
||||
private Integer enable;
|
||||
private String code;
|
||||
private Integer delFlag;
|
||||
private BigDecimal lng;
|
||||
private BigDecimal lat;
|
||||
private Integer externalId;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.xiang.xservice.fwd.mapper;
|
||||
|
||||
import com.xiang.xservice.fwd.entity.pojo.FAudienceConfig;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
@Repository
|
||||
public interface FwdAudienceConfigMapper {
|
||||
|
||||
List<FAudienceConfig> getAudienceByUserId(Long userId);
|
||||
|
||||
int batchSave(List<FAudienceConfig> list);
|
||||
int delByUserId(Long userId);
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.xiang.xservice.fwd.mapper;
|
||||
|
||||
import com.xiang.xservice.fwd.entity.pojo.FPerformConfig;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
@Mapper
|
||||
public interface FwdPerformConfigMapper {
|
||||
|
||||
List<FPerformConfig> getAvailablePerform();
|
||||
|
||||
int delPerforms();
|
||||
|
||||
int insertPerforms(List<FPerformConfig> list);
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.xiang.xservice.fwd.mapper;
|
||||
|
||||
import com.xiang.xservice.fwd.entity.pojo.FPerformProjectInfo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: xiang
|
||||
* @Date: 2025-07-24 17:22
|
||||
*/
|
||||
@Repository
|
||||
@Mapper
|
||||
public interface FwdPerformProjectInfoMapper {
|
||||
FPerformProjectInfo getProjectByProjectId(Long projectId);
|
||||
|
||||
int insert(FPerformProjectInfo fPerformProjectInfo);
|
||||
|
||||
int update(FPerformProjectInfo fPerformProjectInfo);
|
||||
|
||||
List<FPerformProjectInfo> getPreSaleTodayData(@Param("startTime") LocalDateTime startTime, @Param("endTime") LocalDateTime endTime);
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.xiang.xservice.fwd.mapper;
|
||||
|
||||
import com.xiang.xservice.fwd.entity.pojo.FPerformSeatInfo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: xiang
|
||||
* @Date: 2025-07-25 10:53
|
||||
*/
|
||||
@Repository
|
||||
@Mapper
|
||||
public interface FwdPerformSeatInfoMapper {
|
||||
int batchSave(List<FPerformSeatInfo> fPerformSeatInfos);
|
||||
|
||||
int update(FPerformSeatInfo fPerformSeatInfo);
|
||||
|
||||
List<FPerformSeatInfo> getPerformSeatInfoBySeatIds(@Param("list") List<Long> seatIds);
|
||||
|
||||
FPerformSeatInfo getPerformSeatInfoBySeatIdAndPerformIdAndProjectId(
|
||||
@Param("seatId") Long seatId, @Param("performId") Long performId, @Param("projectId") Long projectId);
|
||||
|
||||
List<FPerformSeatInfo> getPerformSeatByProjectId(Long projectId);
|
||||
|
||||
FPerformSeatInfo getBySeatPlanId(@Param("id") Long seatPlanId);
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.xiang.xservice.fwd.mapper;
|
||||
|
||||
import com.xiang.xservice.fwd.entity.pojo.FUserConfig;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
@Mapper
|
||||
public interface FwdUserConfigMapper {
|
||||
|
||||
/**
|
||||
* 查询可用配置用户
|
||||
* @return
|
||||
*/
|
||||
List<FUserConfig> getAvailableUser();
|
||||
|
||||
/**
|
||||
* 根据用户名查询用户
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
FUserConfig getUserByName(String name);
|
||||
|
||||
/**
|
||||
* 更新用户token
|
||||
* @param name
|
||||
* @param token
|
||||
* @return
|
||||
*/
|
||||
int updateTokenByName(@Param("name") String name, @Param("token") String token);
|
||||
|
||||
/**
|
||||
* 新增用户token
|
||||
* @param userConfig
|
||||
* @return
|
||||
*/
|
||||
int insert(FUserConfig userConfig);
|
||||
}
|
||||
@@ -0,0 +1,243 @@
|
||||
package com.xiang.xservice.fwd.schedule;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.xiang.xservice.basic.utils.DateUtils;
|
||||
import com.xiang.xservice.basic.utils.PrimaryKeyUtils;
|
||||
import com.xiang.xservice.fwd.entity.param.FwdOrderTaskParam;
|
||||
import com.xiang.xservice.fwd.entity.pojo.FPerformConfig;
|
||||
import com.xiang.xservice.fwd.entity.pojo.FPerformProjectInfo;
|
||||
import com.xiang.xservice.fwd.entity.pojo.FPerformSeatInfo;
|
||||
import com.xiang.xservice.fwd.entity.resp.http.perform.Perform;
|
||||
import com.xiang.xservice.fwd.entity.resp.http.perform.PerformDetail;
|
||||
import com.xiang.xservice.fwd.entity.resp.http.perform.PerformInfo;
|
||||
import com.xiang.xservice.fwd.entity.resp.http.perform.SeatPlan;
|
||||
import com.xiang.xservice.fwd.entity.resp.http.perform.SeatPlanStatus;
|
||||
import com.xiang.xservice.fwd.mapper.FwdAudienceConfigMapper;
|
||||
import com.xiang.xservice.fwd.mapper.FwdPerformConfigMapper;
|
||||
import com.xiang.xservice.fwd.mapper.FwdPerformProjectInfoMapper;
|
||||
import com.xiang.xservice.fwd.mapper.FwdUserConfigMapper;
|
||||
import com.xiang.xservice.fwd.service.DingTalkScriptFWDService;
|
||||
import com.xiang.xservice.fwd.service.IPerformService;
|
||||
import com.xiang.xservice.fwd.service.IPerformServiceHttp;
|
||||
import com.xiang.xservice.schedule.core.DynamicTaskScheduler;
|
||||
import com.xiang.xservice.schedule.entity.ScheduledTaskEntity;
|
||||
import com.xiang.xservice.schedule.entity.TaskConfig;
|
||||
import com.xiang.xservice.schedule.enums.TaskGroupEnum;
|
||||
import com.xiang.xservice.schedule.enums.TaskStatusEnum;
|
||||
import com.xiang.xservice.schedule.service.IDynamicTaskSchedulerService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.collections4.MapUtils;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Author: xiang
|
||||
* @Date: 2025-07-25 14:13
|
||||
*/
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/system/job/fwd")
|
||||
public class FwdImportantMsgJob {
|
||||
|
||||
private final FwdPerformProjectInfoMapper performProjectInfoMapper;
|
||||
private final FwdPerformConfigMapper performConfigMapper;
|
||||
private final DynamicTaskScheduler dynamicTaskScheduler;
|
||||
private final DingTalkScriptFWDService dingTalkScriptFWDService;
|
||||
private final FwdUserConfigMapper fwdUserConfigMapper;
|
||||
private final FwdAudienceConfigMapper fwdAudienceConfigMapper;
|
||||
private final IPerformService iPerformService;
|
||||
private final IDynamicTaskSchedulerService dynamicTaskSchedulerService;
|
||||
private final IPerformServiceHttp iPerformServiceHttp;
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
log.info("xs-fwd任务调度系统初始化!");
|
||||
ScheduledTaskEntity scheduledTaskEntity = new ScheduledTaskEntity();
|
||||
scheduledTaskEntity.setTaskGroup(TaskGroupEnum.SERVICE_FWD_SCHEDULE.getCode());
|
||||
scheduledTaskEntity.setStatus(TaskStatusEnum.UN_START.getCode());
|
||||
List<ScheduledTaskEntity> taskList = dynamicTaskSchedulerService.getTaskList(scheduledTaskEntity);
|
||||
for (ScheduledTaskEntity taskEntity : taskList) {
|
||||
HashMap params = com.alibaba.fastjson2.JSON.parseObject(taskEntity.getParameters(), HashMap.class);
|
||||
FwdOrderTaskParam param = MapUtils.isEmpty(params) ? new FwdOrderTaskParam(null, taskEntity.getId()) : new FwdOrderTaskParam((Long) params.get("projectId"), taskEntity.getId());
|
||||
LocalDateTime runTime = taskEntity.getRunTime().isBefore(LocalDateTime.now()) ? LocalDateTime.now().plusMinutes(1) : taskEntity.getRunTime();
|
||||
dynamicTaskScheduler.schedule(
|
||||
new TaskConfig(taskEntity.getId(), taskEntity.getTaskName(), taskEntity.getTaskGroup(), runTime, params),
|
||||
new TicketGrabTask(fwdUserConfigMapper, fwdAudienceConfigMapper, iPerformService, param, dynamicTaskSchedulerService)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@Scheduled(cron = "0 0 8 1/1 * ?")
|
||||
@PostMapping("/preSaleReminderJob")
|
||||
public void preSaleReminderJob() throws Exception {
|
||||
log.info("【芬玩岛】演唱会预售定时任务开始!time:{}", System.currentTimeMillis());
|
||||
|
||||
// 删除配置表里面今日配置的项目信息
|
||||
performConfigMapper.delPerforms();
|
||||
|
||||
// 查询所有即将今天预售的演唱会信息
|
||||
LocalDate now = LocalDate.now();
|
||||
List<FPerformProjectInfo> saleTodayData = performProjectInfoMapper.getPreSaleTodayData(now.atTime(0, 0, 0), now.atTime(23, 59, 59));
|
||||
if (CollectionUtils.isEmpty(saleTodayData)) {
|
||||
log.info("【芬玩岛】 今天:{}暂无预售的演唱会门票信息.", now);
|
||||
return;
|
||||
}
|
||||
log.info("【芬玩岛】 即将:{}预售的演唱会门票信息:{}", now, JSONObject.toJSONString(saleTodayData));
|
||||
List<FPerformConfig> addList = saleTodayData.stream().map(data -> {
|
||||
FPerformConfig performConfig = new FPerformConfig();
|
||||
performConfig.setTime(data.getPreSaleTime());
|
||||
performConfig.setProjectId(data.getProjectId());
|
||||
performConfig.setDelFlag(0);
|
||||
return performConfig;
|
||||
}).collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(addList)) {
|
||||
performConfigMapper.insertPerforms(addList);
|
||||
}
|
||||
|
||||
StringBuilder msg = new StringBuilder("今日" + now + "演唱会门票预售信息:\n");
|
||||
for (FPerformProjectInfo data : saleTodayData) {
|
||||
msg.append("演唱会名称:").append(data.getProjectName()).append("预售时间:").append(DateUtils.getDateTimeFromDateTime(data.getPreSaleTime())).append("\n");
|
||||
long taskId = PrimaryKeyUtils.snowflakeId();
|
||||
Map<String, Object> params = Maps.newHashMap();
|
||||
params.put("projectId", data.getProjectId());
|
||||
LocalDateTime runTime = data.getPreSaleTime().isBefore(LocalDateTime.now()) ? LocalDateTime.now().plusMinutes(1) : data.getPreSaleTime();
|
||||
dynamicTaskScheduler.schedule(
|
||||
new TaskConfig(taskId, "芬玩岛演唱会抢票-【" + data.getProjectName() + "】", TaskGroupEnum.SERVICE_FWD_SCHEDULE.getCode(),
|
||||
runTime, params),
|
||||
new TicketGrabTask(fwdUserConfigMapper, fwdAudienceConfigMapper, iPerformService,
|
||||
new FwdOrderTaskParam(data.getProjectId(), taskId), dynamicTaskSchedulerService));
|
||||
savaTask(data, taskId, params);
|
||||
}
|
||||
msg.append("请注意进行数据库配置的更改!");
|
||||
dingTalkScriptFWDService.sendScriptMsg(msg.toString());
|
||||
log.info("【芬玩岛】演唱会预售定时任务结束!time:{}", System.currentTimeMillis());
|
||||
}
|
||||
|
||||
@Scheduled(cron = "0 10 8 1/1 * ?")
|
||||
@PostMapping("/presaleSeatReminderJob")
|
||||
public void presaleSeatReminderJob() {
|
||||
|
||||
ScheduledTaskEntity entity = new ScheduledTaskEntity();
|
||||
entity.setStatus(TaskStatusEnum.UN_START.getCode());
|
||||
List<ScheduledTaskEntity> taskList = dynamicTaskSchedulerService.getTaskList(entity);
|
||||
if (CollectionUtils.isEmpty(taskList)) {
|
||||
log.info("今天暂无预售的演出,time:{}", LocalDateTime.now());
|
||||
return;
|
||||
}
|
||||
log.info("今天:{}的预售的项目信息:{}", LocalDateTime.now(), JSON.toJSONString(taskList));
|
||||
LocalDateTime todayStartTime = LocalDate.now().atTime(0, 0, 0);
|
||||
LocalDateTime todayEndTime = LocalDate.now().atTime(23, 59, 59);
|
||||
|
||||
StringBuffer msg = new StringBuffer();
|
||||
|
||||
taskList.forEach(taskEntity -> {
|
||||
String parameters = taskEntity.getParameters();
|
||||
JSONObject jsonObject = JSON.parseObject(parameters);
|
||||
Long projectId = null;
|
||||
try {
|
||||
projectId = (Long) jsonObject.get("projectId");
|
||||
} catch (Exception e) {
|
||||
log.error("异常错误信息:{}", JSON.toJSONString(taskEntity), e);
|
||||
}
|
||||
if (Objects.nonNull(projectId)) {
|
||||
Perform performsByProjectIdFromHttp = iPerformServiceHttp.getPerformsByProjectIdFromHttp(projectId);
|
||||
if (Objects.nonNull(performsByProjectIdFromHttp)) {
|
||||
for (PerformInfo performInfo : performsByProjectIdFromHttp.getPerformInfos()) {
|
||||
for (PerformDetail performDetail : performInfo.getPerformInfo()) {
|
||||
LocalDateTime saleTime = DateUtils.getDateTimeFromStr(performDetail.getSaleTime());
|
||||
if (saleTime.isAfter(todayStartTime) && saleTime.isBefore(todayEndTime)) {
|
||||
List<SeatPlan> seatPlans = performDetail.getSeatPlans();
|
||||
Map<Long, SeatPlan> seatPlanMap = seatPlans.stream().collect(Collectors.toMap(SeatPlan::getSeatPlanId, Function.identity(), (a, b) -> a));
|
||||
List<Long> seatPlanIds = seatPlans.stream().map(SeatPlan::getSeatPlanId).collect(Collectors.toList());
|
||||
List<SeatPlanStatus> seatPlanStatusFromHttp = iPerformServiceHttp.getSeatPlanStatusFromHttp(seatPlanIds);
|
||||
for (SeatPlanStatus seatPlanStatus : seatPlanStatusFromHttp) {
|
||||
if (!seatPlanStatus.getSoldOutFlag()) {
|
||||
FPerformSeatInfo seatInfoBySeatId = iPerformService.getSeatInfoBySeatId(seatPlanStatus.getSeatPlanId());
|
||||
if (Objects.nonNull(seatInfoBySeatId)) {
|
||||
seatInfoBySeatId.setSoldOut(0);
|
||||
iPerformService.updateSeatInfo(seatInfoBySeatId);
|
||||
msg.append("演出任务名称").append(taskEntity.getTaskName()).append("的场次信息")
|
||||
.append(performDetail.getName()).append("的座位信息")
|
||||
.append(seatInfoBySeatId.getSeatPlanName()).append("信息已更新\n");
|
||||
} else {
|
||||
if (seatPlanMap.containsKey(seatPlanStatus.getSeatPlanId())) {
|
||||
SeatPlan seatPlan = seatPlanMap.get(seatPlanStatus.getSeatPlanId());
|
||||
FPerformSeatInfo fPerformSeatInfo = new FPerformSeatInfo();
|
||||
fPerformSeatInfo.setSeatPlanId(seatInfoBySeatId.getSeatPlanId());
|
||||
fPerformSeatInfo.setSeatPlanName(seatPlan.getSeatPlanName());
|
||||
fPerformSeatInfo.setPerformId(seatInfoBySeatId.getPerformId());
|
||||
fPerformSeatInfo.setPerformName(seatInfoBySeatId.getPerformName());
|
||||
fPerformSeatInfo.setStopSale(seatInfoBySeatId.getStopSale());
|
||||
fPerformSeatInfo.setShelfStatus(seatInfoBySeatId.getShelfStatus());
|
||||
fPerformSeatInfo.setPrice(seatInfoBySeatId.getPrice());
|
||||
fPerformSeatInfo.setDiscountPrice(seatInfoBySeatId.getDiscountPrice());
|
||||
fPerformSeatInfo.setSubStatus(seatInfoBySeatId.getSubStatus());
|
||||
fPerformSeatInfo.setQuantity(seatInfoBySeatId.getQuantity());
|
||||
fPerformSeatInfo.setStatus(seatInfoBySeatId.getStatus());
|
||||
fPerformSeatInfo.setMaxSellStock(seatInfoBySeatId.getMaxSellStock());
|
||||
fPerformSeatInfo.setSoldStock(seatInfoBySeatId.getSoldStock());
|
||||
fPerformSeatInfo.setLeftStock(seatInfoBySeatId.getLeftStock());
|
||||
fPerformSeatInfo.setAbleSaleQuantity(seatInfoBySeatId.getAbleSaleQuantity());
|
||||
fPerformSeatInfo.setAshShow(seatInfoBySeatId.getAshShow());
|
||||
fPerformSeatInfo.setAshShowDesc(seatInfoBySeatId.getAshShowDesc());
|
||||
fPerformSeatInfo.setSelectable(seatInfoBySeatId.getSelectable());
|
||||
fPerformSeatInfo.setDisplay(seatInfoBySeatId.getDisplay());
|
||||
fPerformSeatInfo.setAvailableTicketQuantity(seatInfoBySeatId.getAvailableTicketQuantity());
|
||||
fPerformSeatInfo.setAvailableAllTicketQuantity(seatInfoBySeatId.getAvailableAllTicketQuantity());
|
||||
fPerformSeatInfo.setSaleTime(seatInfoBySeatId.getSaleTime());
|
||||
fPerformSeatInfo.setProjectId(seatInfoBySeatId.getProjectId());
|
||||
fPerformSeatInfo.setSoldOut(seatInfoBySeatId.getSoldOut());
|
||||
iPerformService.addSeatInfo(fPerformSeatInfo);
|
||||
msg.append("演出任务名称").append(taskEntity.getTaskName()).append("的场次信息")
|
||||
.append(performDetail.getName()).append("的座位信息")
|
||||
.append(seatPlan.getSeatPlanName()).append("信息已更新\n");
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
log.info("演出:{},座位:{},已售罄", performDetail.getName(), seatPlanStatus.getSeatPlanId());
|
||||
msg.append("演出任务名称").append(taskEntity.getTaskName()).append("的场次信息")
|
||||
.append(performDetail.getName()).append("的座位信息").append("已售罄\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
dingTalkScriptFWDService.sendScriptMsg(msg.toString());
|
||||
}
|
||||
|
||||
private void savaTask(FPerformProjectInfo data, long taskId, Map<String, Object> params) {
|
||||
ScheduledTaskEntity entity = new ScheduledTaskEntity();
|
||||
entity.setId(taskId);
|
||||
entity.setTaskName("芬玩岛演唱会抢票-【" + data.getProjectName() + "】");
|
||||
entity.setTaskGroup(TaskGroupEnum.SERVICE_FWD_SCHEDULE.getCode());
|
||||
entity.setRunTime(data.getPreSaleTime());
|
||||
entity.setStatus(TaskStatusEnum.UN_START.getCode());
|
||||
entity.setParameters(JSON.toJSONString(params));
|
||||
entity.setCreatedTime(LocalDateTime.now());
|
||||
entity.setUpdatedTime(LocalDateTime.now());
|
||||
dynamicTaskSchedulerService.saveTask(entity);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,292 @@
|
||||
package com.xiang.xservice.fwd.schedule;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.xiang.xservice.basic.common.req.BaseRequest;
|
||||
import com.xiang.xservice.basic.config.MyThreadFactory;
|
||||
import com.xiang.xservice.basic.utils.DateUtils;
|
||||
import com.xiang.xservice.fwd.entity.pojo.FAudienceConfig;
|
||||
import com.xiang.xservice.fwd.entity.pojo.FPerformProjectInfo;
|
||||
import com.xiang.xservice.fwd.entity.pojo.FPerformSeatInfo;
|
||||
import com.xiang.xservice.fwd.entity.pojo.FUserConfig;
|
||||
import com.xiang.xservice.fwd.entity.resp.http.audience.AudienceMemberInfo;
|
||||
import com.xiang.xservice.fwd.entity.resp.http.perform.Perform;
|
||||
import com.xiang.xservice.fwd.entity.resp.http.perform.PerformDetail;
|
||||
import com.xiang.xservice.fwd.entity.resp.http.perform.PerformInfo;
|
||||
import com.xiang.xservice.fwd.entity.resp.http.perform.ProjectInfoResp;
|
||||
import com.xiang.xservice.fwd.entity.resp.http.perform.ProjectList;
|
||||
import com.xiang.xservice.fwd.entity.resp.http.perform.ProjectsResp;
|
||||
import com.xiang.xservice.fwd.entity.resp.http.perform.SeatPlan;
|
||||
import com.xiang.xservice.fwd.entity.resp.http.perform.SeatPlanStatus;
|
||||
import com.xiang.xservice.fwd.mapper.FwdAudienceConfigMapper;
|
||||
import com.xiang.xservice.fwd.mapper.FwdPerformConfigMapper;
|
||||
import com.xiang.xservice.fwd.mapper.FwdPerformProjectInfoMapper;
|
||||
import com.xiang.xservice.fwd.mapper.FwdPerformSeatInfoMapper;
|
||||
import com.xiang.xservice.fwd.mapper.FwdUserConfigMapper;
|
||||
import com.xiang.xservice.fwd.service.IPerformServiceHttp;
|
||||
import com.xiang.xservice.http.helper.HttpRequestHelper;
|
||||
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 org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 芬玩岛拉取数据定时任务
|
||||
*
|
||||
* @Author: xiang
|
||||
* @Date: 2025-07-24 17:19
|
||||
*/
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
@RestController
|
||||
public class PullDataFromFWDJob {
|
||||
|
||||
private final IPerformServiceHttp performServiceHttp;
|
||||
private final FwdPerformProjectInfoMapper performProjectInfoMapper;
|
||||
private final FwdPerformConfigMapper performConfigMapper;
|
||||
private final FwdPerformSeatInfoMapper performSeatInfoMapper;
|
||||
private final FwdUserConfigMapper userConfigMapper;
|
||||
private final FwdAudienceConfigMapper audienceConfigMapper;
|
||||
private final HttpRequestHelper httpRequestHelper;
|
||||
|
||||
private final ExecutorService es =
|
||||
new ThreadPoolExecutor(
|
||||
5,
|
||||
10,
|
||||
1000,
|
||||
TimeUnit.MILLISECONDS,
|
||||
new LinkedBlockingQueue<>(),
|
||||
new MyThreadFactory("fwd-pull-data-http", Boolean.TRUE),
|
||||
new ThreadPoolExecutor.AbortPolicy());
|
||||
|
||||
private void saveProjectInfo(ProjectList project, ProjectInfoResp projectInfoFromHttp) {
|
||||
FPerformProjectInfo fPerformProjectInfo = new FPerformProjectInfo();
|
||||
fPerformProjectInfo.setNameDisplay(projectInfoFromHttp.getNameDisplay());
|
||||
fPerformProjectInfo.setStatus(projectInfoFromHttp.getStatus());
|
||||
fPerformProjectInfo.setProjectSource(projectInfoFromHttp.getProjectSource());
|
||||
fPerformProjectInfo.setIsHasSeat(projectInfoFromHttp.getIsHasSeat());
|
||||
fPerformProjectInfo.setIsChoiceSeat(projectInfoFromHttp.getIsChoiceSeat());
|
||||
fPerformProjectInfo.setHighestPrice(projectInfoFromHttp.getHighPrice());
|
||||
if (StringUtils.isNotBlank(projectInfoFromHttp.getProjectStartDate())) {
|
||||
fPerformProjectInfo.setProjectStartDate(DateUtils.getDateFromStr(projectInfoFromHttp.getProjectStartDate(), "yyyy/MM/dd"));
|
||||
}
|
||||
if (StringUtils.isNotBlank(projectInfoFromHttp.getProjectEndDate())) {
|
||||
fPerformProjectInfo.setProjectEndDate(DateUtils.getDateFromStr(projectInfoFromHttp.getProjectEndDate(), "yyyy/MM/dd"));
|
||||
}
|
||||
fPerformProjectInfo.setSubClassifyName(projectInfoFromHttp.getSubClassifyName());
|
||||
|
||||
fPerformProjectInfo.setProjectName(project.getName());
|
||||
fPerformProjectInfo.setBizId(project.getBizId());
|
||||
fPerformProjectInfo.setProjectId(project.getProjectId());
|
||||
fPerformProjectInfo.setTagName(project.getTagName());
|
||||
fPerformProjectInfo.setTagRemark(project.getTagRemark());
|
||||
fPerformProjectInfo.setProjectCity(project.getCity());
|
||||
fPerformProjectInfo.setShortCity(project.getShortCity());
|
||||
fPerformProjectInfo.setVenueName(project.getVenueName());
|
||||
fPerformProjectInfo.setLowestPrice(project.getLowestPrice());
|
||||
if (StringUtils.isNotBlank(projectInfoFromHttp.getPreSaleTime())) {
|
||||
fPerformProjectInfo.setPreSaleTime(DateUtils.getDateTimeFromStr(projectInfoFromHttp.getPreSaleTime(), "yyyy/MM/dd HH:mm:ss"));
|
||||
}
|
||||
performProjectInfoMapper.insert(fPerformProjectInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 每月拉取观影人数据更新
|
||||
*/
|
||||
@Scheduled(cron = "0 0 0 1 1/1 ? ")
|
||||
public void pullAudienceMemberInfo() {
|
||||
List<FUserConfig> availableUser = userConfigMapper.getAvailableUser();
|
||||
if (CollectionUtils.isEmpty(availableUser)) {
|
||||
return;
|
||||
}
|
||||
availableUser.forEach(user -> {
|
||||
List<AudienceMemberInfo> audienceMemberInfo = performServiceHttp.getAudienceMemberInfo(user.getToken());
|
||||
if (CollectionUtils.isNotEmpty(audienceMemberInfo)) {
|
||||
List<FAudienceConfig> list = audienceMemberInfo.stream().map(audience -> {
|
||||
FAudienceConfig info = new FAudienceConfig();
|
||||
info.setDelFlag(0);
|
||||
info.setFrequentId(audience.getFrequentContactsId());
|
||||
info.setFrequentNo(audience.getIdCard());
|
||||
info.setFrequentName(audience.getName());
|
||||
info.setStatus(1);
|
||||
info.setFrequentPhone(audience.getPhone());
|
||||
info.setUserId(user.getId());
|
||||
return info;
|
||||
}).collect(Collectors.toList());
|
||||
audienceConfigMapper.delByUserId(user.getId());
|
||||
audienceConfigMapper.batchSave(list);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@PostMapping("/pullPerformDataJob")
|
||||
@Scheduled(cron = "0 0 1 1/1 * ?")
|
||||
public void pullPerformDataJob() {
|
||||
int pageNum = 0;
|
||||
while (true) {
|
||||
pageNum++;
|
||||
BaseRequest baseRequest = new BaseRequest();
|
||||
baseRequest.setCurrent(pageNum);
|
||||
baseRequest.setPageSize(50);
|
||||
// 查询所有的演出
|
||||
ProjectsResp projectsResp = httpRequestHelper.fetchWithRetry(() -> performServiceHttp.getShowProjectsFromHttp(baseRequest), "fetch-projects");
|
||||
if (Objects.isNull(projectsResp)) {
|
||||
break;
|
||||
}
|
||||
List<ProjectList> projectLists = projectsResp.getList();
|
||||
if (CollectionUtils.isEmpty(projectLists)) {
|
||||
break;
|
||||
}
|
||||
for (ProjectList projectList : projectLists) {
|
||||
// 查询演出的详情
|
||||
ProjectInfoResp projectInfoFromHttp = httpRequestHelper.fetchWithRetry(() -> performServiceHttp.getProjectInfoFromHttp(projectList.getProjectId()), "fetch-project-info");
|
||||
if (Objects.isNull(projectInfoFromHttp)) {
|
||||
continue;
|
||||
}
|
||||
// 查询演出信息
|
||||
Perform performsByProjectIdFromHttp = httpRequestHelper.fetchWithRetry(() -> performServiceHttp.getPerformsByProjectIdFromHttp(projectList.getProjectId()), "fetch-perform-by-project-id");
|
||||
if (Objects.isNull(performsByProjectIdFromHttp)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// 查询数据库
|
||||
FPerformProjectInfo projectInfo = performProjectInfoMapper.getProjectByProjectId(performsByProjectIdFromHttp.getProjectId());
|
||||
if (Objects.isNull(projectInfo)) {
|
||||
// 不存在则新增
|
||||
saveProjectInfo(projectList, projectInfoFromHttp);
|
||||
} else {
|
||||
// 存在则更新
|
||||
buildUpdateProjectInfo(projectList, projectInfo, projectInfoFromHttp);
|
||||
performProjectInfoMapper.update(projectInfo);
|
||||
}
|
||||
|
||||
// 查询演出信息
|
||||
List<PerformInfo> performInfos = performsByProjectIdFromHttp.getPerformInfos();
|
||||
if (CollectionUtils.isEmpty(performInfos)) {
|
||||
continue;
|
||||
}
|
||||
// 查询演出座位档次信息
|
||||
List<FPerformSeatInfo> insertList = Lists.newCopyOnWriteArrayList();
|
||||
List<FPerformSeatInfo> updateList = Lists.newCopyOnWriteArrayList();
|
||||
for (PerformInfo performInfo : performInfos) {
|
||||
List<PerformDetail> performs = performInfo.getPerformInfo();
|
||||
if (CollectionUtils.isEmpty(performs)) {
|
||||
continue;
|
||||
}
|
||||
for (PerformDetail perform : performs) {
|
||||
if (CollectionUtils.isEmpty(perform.getSeatPlans())) {
|
||||
continue;
|
||||
}
|
||||
List<Long> seatPlanIds = perform.getSeatPlans().stream().map(SeatPlan::getSeatPlanId).collect(Collectors.toList());
|
||||
List<SeatPlanStatus> seatPlanStatusList = httpRequestHelper.fetchWithRetry(() -> performServiceHttp.getSeatPlanStatusFromHttp(seatPlanIds), "fetch-seat-plan-status");
|
||||
if (CollectionUtils.isEmpty(seatPlanStatusList)) {
|
||||
continue;
|
||||
}
|
||||
Map<Long, SeatPlanStatus> map = seatPlanStatusList.stream().collect(Collectors.toMap(SeatPlanStatus::getSeatPlanId, Function.identity(), (a, b) -> a));
|
||||
Map<Long, FPerformSeatInfo> existSeatMap = performSeatInfoMapper.getPerformSeatInfoBySeatIds(seatPlanIds)
|
||||
.stream()
|
||||
.collect(Collectors.toMap(FPerformSeatInfo::getSeatPlanId, Function.identity(), (a, b) -> a));
|
||||
for (SeatPlan seatPlan : perform.getSeatPlans()) {
|
||||
if (map.containsKey(seatPlan.getSeatPlanId())) {
|
||||
SeatPlanStatus value = map.get(seatPlan.getSeatPlanId());
|
||||
if (existSeatMap.containsKey(seatPlan.getSeatPlanId())) {
|
||||
// 更新
|
||||
FPerformSeatInfo performSeatInfo = existSeatMap.get(seatPlan.getSeatPlanId());
|
||||
performSeatInfo.setSoldStock(value.getSoldOutFlag() ? 1 : 0);
|
||||
updateList.add(performSeatInfo);
|
||||
} else {
|
||||
// 新增
|
||||
saveSeatInfo(projectList, seatPlan.getSeatPlanId(), value, seatPlan, insertList);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(insertList)) {
|
||||
performSeatInfoMapper.batchSave(insertList);
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(updateList)) {
|
||||
for (FPerformSeatInfo seatInfo : updateList) {
|
||||
performSeatInfoMapper.update(seatInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void saveSeatInfo(ProjectList projectList, Long seatPlanId, SeatPlanStatus seatPlanStatus, SeatPlan seatPlan, List<FPerformSeatInfo> insertList) {
|
||||
FPerformSeatInfo fPerformSeatInfo = new FPerformSeatInfo();
|
||||
fPerformSeatInfo.setSeatPlanId(seatPlanId);
|
||||
fPerformSeatInfo.setSeatPlanName(seatPlan.getSeatPlanName());
|
||||
fPerformSeatInfo.setPerformId(seatPlan.getPerformId());
|
||||
fPerformSeatInfo.setPerformName(seatPlan.getPerformName());
|
||||
fPerformSeatInfo.setStopSale(seatPlan.getStopSale());
|
||||
fPerformSeatInfo.setShelfStatus(seatPlan.getShelfStatus());
|
||||
fPerformSeatInfo.setPrice(seatPlan.getPrice());
|
||||
fPerformSeatInfo.setDiscountPrice(seatPlan.getDiscountPrice());
|
||||
fPerformSeatInfo.setSubStatus(seatPlan.getSubStatus());
|
||||
fPerformSeatInfo.setQuantity(seatPlan.getQuantity());
|
||||
fPerformSeatInfo.setStatus(seatPlan.getStatus());
|
||||
fPerformSeatInfo.setMaxSellStock(seatPlan.getMaxSellStock());
|
||||
fPerformSeatInfo.setSoldStock(seatPlan.getSoldStock());
|
||||
fPerformSeatInfo.setLeftStock(seatPlan.getLeftStock());
|
||||
fPerformSeatInfo.setAbleSaleQuantity(seatPlan.getAbleSaleQuantity());
|
||||
fPerformSeatInfo.setAshShow(seatPlan.getAshShow());
|
||||
fPerformSeatInfo.setAshShowDesc(seatPlan.getAshShowDesc());
|
||||
fPerformSeatInfo.setSelectable(seatPlan.getSelectable());
|
||||
fPerformSeatInfo.setDisplay(seatPlan.getDisplay());
|
||||
fPerformSeatInfo.setAvailableTicketQuantity(seatPlan.getAvailableTicketQuantity());
|
||||
fPerformSeatInfo.setAvailableAllTicketQuantity(seatPlan.getAvailableAllTicketQuantity());
|
||||
if (StringUtils.isNotBlank(seatPlan.getSaleTime())) {
|
||||
fPerformSeatInfo.setSaleTime(DateUtils.getDateTimeFromStr(seatPlan.getSaleTime()));
|
||||
}
|
||||
fPerformSeatInfo.setProjectId(projectList.getProjectId());
|
||||
if (!seatPlanStatus.getSoldOutFlag() && seatPlanStatus.getStandbyStatus().equals(10)) {
|
||||
fPerformSeatInfo.setSoldOut(0);
|
||||
} else {
|
||||
fPerformSeatInfo.setSoldOut(1);
|
||||
}
|
||||
insertList.add(fPerformSeatInfo);
|
||||
}
|
||||
|
||||
private static void buildUpdateProjectInfo(ProjectList projectList, FPerformProjectInfo projectInfo, ProjectInfoResp projectInfoFromHttp) {
|
||||
projectInfo.setNameDisplay(projectInfoFromHttp.getNameDisplay());
|
||||
projectInfo.setStatus(projectInfoFromHttp.getStatus());
|
||||
projectInfo.setProjectSource(projectInfoFromHttp.getProjectSource());
|
||||
projectInfo.setIsHasSeat(projectInfoFromHttp.getIsHasSeat());
|
||||
projectInfo.setIsChoiceSeat(projectInfoFromHttp.getIsChoiceSeat());
|
||||
projectInfo.setHighestPrice(projectInfoFromHttp.getHighPrice());
|
||||
if (StringUtils.isNotBlank(projectInfoFromHttp.getProjectStartDate())) {
|
||||
projectInfo.setProjectStartDate(DateUtils.getDateFromStr(projectInfoFromHttp.getProjectStartDate(), "yyyy/MM/dd"));
|
||||
}
|
||||
if (StringUtils.isNotBlank(projectInfoFromHttp.getProjectEndDate())) {
|
||||
projectInfo.setProjectEndDate(DateUtils.getDateFromStr(projectInfoFromHttp.getProjectEndDate(), "yyyy/MM/dd"));
|
||||
}
|
||||
projectInfo.setSubClassifyName(projectInfoFromHttp.getSubClassifyName());
|
||||
projectInfo.setProjectName(projectList.getName());
|
||||
projectInfo.setBizId(projectList.getBizId());
|
||||
projectInfo.setTagName(projectList.getTagName());
|
||||
projectInfo.setTagRemark(projectList.getTagRemark());
|
||||
projectInfo.setProjectCity(projectList.getCity());
|
||||
projectInfo.setShortCity(projectList.getShortCity());
|
||||
projectInfo.setVenueName(projectList.getVenueName());
|
||||
projectInfo.setLowestPrice(projectList.getLowestPrice());
|
||||
if (StringUtils.isNotBlank(projectInfoFromHttp.getPreSaleTime())) {
|
||||
projectInfo.setPreSaleTime(DateUtils.getDateTimeFromStr(projectInfoFromHttp.getPreSaleTime(), "yyyy/MM/dd HH:mm:ss"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.xiang.xservice.fwd.schedule;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.xiang.xservice.fwd.entity.param.FwdOrderTaskParam;
|
||||
import com.xiang.xservice.fwd.entity.pojo.FAudienceConfig;
|
||||
import com.xiang.xservice.fwd.entity.pojo.FUserConfig;
|
||||
import com.xiang.xservice.fwd.mapper.FwdAudienceConfigMapper;
|
||||
import com.xiang.xservice.fwd.mapper.FwdUserConfigMapper;
|
||||
import com.xiang.xservice.fwd.service.IPerformService;
|
||||
import com.xiang.xservice.schedule.service.IDynamicTaskSchedulerService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
public class TicketGrabTask implements Runnable {
|
||||
|
||||
private final FwdUserConfigMapper userConfigMapper;
|
||||
private final FwdAudienceConfigMapper audienceConfigMapper;
|
||||
private final IPerformService performService;
|
||||
private final FwdOrderTaskParam param;
|
||||
private final IDynamicTaskSchedulerService dynamicTaskSchedulerService;
|
||||
|
||||
public TicketGrabTask(FwdUserConfigMapper userConfigMapper, FwdAudienceConfigMapper audienceConfigMapper,
|
||||
IPerformService performService, FwdOrderTaskParam param,
|
||||
IDynamicTaskSchedulerService dynamicTaskSchedulerService) {
|
||||
this.userConfigMapper = userConfigMapper;
|
||||
this.audienceConfigMapper = audienceConfigMapper;
|
||||
this.performService = performService;
|
||||
this.param = param;
|
||||
this.dynamicTaskSchedulerService = dynamicTaskSchedulerService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
log.info("【TicketGrabTask】 run start. 获取到参数:{}", JSON.toJSONString(param));
|
||||
dynamicTaskSchedulerService.updateProcess(param.getTaskId());
|
||||
List<FUserConfig> availableUser = userConfigMapper.getAvailableUser();
|
||||
if (CollectionUtils.isEmpty(availableUser)) {
|
||||
return;
|
||||
}
|
||||
for (FUserConfig userConfig : availableUser) {
|
||||
List<FAudienceConfig> audiences = audienceConfigMapper.getAudienceByUserId(userConfig.getId());
|
||||
try {
|
||||
performService.createProjectOrder(param.getProjectId(), audiences.stream().map(FAudienceConfig::getFrequentId).collect(Collectors.toList()));
|
||||
dynamicTaskSchedulerService.finishTask(param.getTaskId());
|
||||
} catch (Exception e) {
|
||||
log.error("创建订单失败", e);
|
||||
dynamicTaskSchedulerService.errTask(param.getTaskId());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("任务调度运行失败", e);
|
||||
dynamicTaskSchedulerService.errTask(param.getTaskId());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
package com.xiang.xservice.fwd.server;
|
||||
|
||||
import com.xiang.xservice.basic.common.resp.Result;
|
||||
import com.xiang.xservice.basic.utils.DateUtils;
|
||||
import com.xiang.xservice.fwd.entity.pojo.FPerformConfig;
|
||||
import com.xiang.xservice.fwd.entity.pojo.FPerformProjectInfo;
|
||||
import com.xiang.xservice.fwd.entity.pojo.FPerformSeatInfo;
|
||||
import com.xiang.xservice.fwd.entity.resp.http.perform.*;
|
||||
import com.xiang.xservice.fwd.service.IPerformService;
|
||||
import com.xiang.xservice.fwd.service.IPerformServiceHttp;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/system/fwd")
|
||||
@RequiredArgsConstructor
|
||||
public class FwdDataController {
|
||||
|
||||
private final IPerformService performService;
|
||||
private final IPerformServiceHttp performServiceHttp;
|
||||
|
||||
@PostMapping("/refreshData")
|
||||
public Result<Void> refreshData() {
|
||||
List<FPerformConfig> availablePerforms = performService.getAvailablePerform();
|
||||
for (FPerformConfig availablePerform : availablePerforms) {
|
||||
ProjectInfoResp info = performServiceHttp.getProjectInfoFromHttp(availablePerform.getProjectId());
|
||||
Perform performsByProjectIdFromHttp = performServiceHttp.getPerformsByProjectIdFromHttp(availablePerform.getProjectId());
|
||||
FPerformProjectInfo performByProjectId = performService.getPerformByProjectId(availablePerform.getProjectId());
|
||||
performByProjectId.setStatus(info.getStatus());
|
||||
performByProjectId.setPreSaleTime(DateUtils.getDateTimeFromStr(info.getPreSaleTime()));
|
||||
performService.updateProjectInfo(performByProjectId);
|
||||
List<PerformInfo> performInfos = performsByProjectIdFromHttp.getPerformInfos();
|
||||
if (CollectionUtils.isEmpty(performInfos)) {
|
||||
continue;
|
||||
}
|
||||
for (PerformInfo performInfo : performInfos) {
|
||||
List<PerformDetail> performInfo1 = performInfo.getPerformInfo();
|
||||
if (CollectionUtils.isEmpty(performInfo1)) {
|
||||
continue;
|
||||
}
|
||||
for (PerformDetail performDetail : performInfo1) {
|
||||
List<SeatPlan> seatPlans = performDetail.getSeatPlans();
|
||||
if (CollectionUtils.isEmpty(seatPlans)) {
|
||||
continue;
|
||||
}
|
||||
List<Long> seatIds = seatPlans.stream().map(SeatPlan::getSeatPlanId).collect(Collectors.toList());
|
||||
List<SeatPlanStatus> seatPlanStatusFromHttp = performServiceHttp.getSeatPlanStatusFromHttp(seatIds);
|
||||
if (CollectionUtils.isEmpty(seatPlanStatusFromHttp)) {
|
||||
continue;
|
||||
}
|
||||
Map<Long, SeatPlanStatus> map = seatPlanStatusFromHttp.stream().collect(Collectors.toMap(SeatPlanStatus::getSeatPlanId, Function.identity(), (a, b) -> a));
|
||||
for (SeatPlan seatPlan : seatPlans) {
|
||||
FPerformSeatInfo seatInfoBySeatId = performService.getSeatInfoBySeatId(seatPlan.getSeatPlanId());
|
||||
if (Objects.isNull(seatInfoBySeatId)) {
|
||||
FPerformSeatInfo fPerformSeatInfo = new FPerformSeatInfo();
|
||||
fPerformSeatInfo.setSeatPlanId(seatPlan.getSeatPlanId());
|
||||
fPerformSeatInfo.setSeatPlanName(seatPlan.getSeatPlanName());
|
||||
fPerformSeatInfo.setPerformId(seatPlan.getPerformId());
|
||||
fPerformSeatInfo.setPerformName(seatPlan.getPerformName());
|
||||
fPerformSeatInfo.setStopSale(seatPlan.getStopSale());
|
||||
fPerformSeatInfo.setShelfStatus(seatPlan.getShelfStatus());
|
||||
fPerformSeatInfo.setPrice(seatPlan.getPrice());
|
||||
fPerformSeatInfo.setDiscountPrice(seatPlan.getDiscountPrice());
|
||||
fPerformSeatInfo.setSubStatus(seatPlan.getSubStatus());
|
||||
fPerformSeatInfo.setQuantity(seatPlan.getQuantity());
|
||||
fPerformSeatInfo.setStatus(seatPlan.getStatus());
|
||||
fPerformSeatInfo.setMaxSellStock(seatPlan.getMaxSellStock());
|
||||
fPerformSeatInfo.setSoldStock(seatPlan.getSoldStock());
|
||||
fPerformSeatInfo.setLeftStock(seatPlan.getLeftStock());
|
||||
fPerformSeatInfo.setAbleSaleQuantity(seatPlan.getAbleSaleQuantity());
|
||||
fPerformSeatInfo.setAshShow(seatPlan.getAshShow());
|
||||
fPerformSeatInfo.setAshShowDesc(seatPlan.getAshShowDesc());
|
||||
fPerformSeatInfo.setSelectable(seatPlan.getSelectable());
|
||||
fPerformSeatInfo.setDisplay(seatPlan.getDisplay());
|
||||
fPerformSeatInfo.setAvailableTicketQuantity(seatPlan.getAvailableTicketQuantity());
|
||||
fPerformSeatInfo.setAvailableAllTicketQuantity(seatPlan.getAvailableAllTicketQuantity());
|
||||
fPerformSeatInfo.setSaleTime(DateUtils.getDateTimeFromStr(seatPlan.getSaleTime(), "yyyy/MM/dd HH:mm:ss"));
|
||||
fPerformSeatInfo.setProjectId(availablePerform.getProjectId());
|
||||
fPerformSeatInfo.setSoldOut(seatPlan.getSoldStock());
|
||||
performService.addSeatInfo(fPerformSeatInfo);
|
||||
} else {
|
||||
SeatPlanStatus seatPlanStatus = map.get(seatPlan.getSeatPlanId());
|
||||
if (Objects.isNull(seatPlanStatus)) {
|
||||
continue;
|
||||
}
|
||||
seatInfoBySeatId.setSoldStock(seatPlanStatus.getSoldOutFlag() ? 1 : 0);
|
||||
performService.updateSeatInfo(seatInfoBySeatId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return Result.success("success");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.xiang.xservice.fwd.server;
|
||||
|
||||
import com.xiang.xservice.basic.common.req.BaseRequest;
|
||||
import com.xiang.xservice.basic.common.resp.Result;
|
||||
import com.xiang.xservice.fwd.entity.resp.http.perform.Perform;
|
||||
import com.xiang.xservice.fwd.entity.resp.http.perform.ProjectsResp;
|
||||
import com.xiang.xservice.fwd.entity.resp.http.perform.SeatPlanStatus;
|
||||
import com.xiang.xservice.fwd.service.IPerformService;
|
||||
import com.xiang.xservice.fwd.service.IPerformServiceHttp;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: xiang
|
||||
* @Date: 2025-07-24 16:55
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/system/fwd/outer")
|
||||
public class FwdOuterController {
|
||||
|
||||
private final IPerformServiceHttp performServiceHttp;
|
||||
private final IPerformService performService;
|
||||
private static final List<Long> FREQUENT_IDS = List.of(50438548L, 35320661L, 50436621L, 50442739L);
|
||||
|
||||
|
||||
@GetMapping("/getShowProjects")
|
||||
public Result<ProjectsResp> getShowProjects() {
|
||||
ProjectsResp showProjectsFromHttp = performServiceHttp.getShowProjectsFromHttp(new BaseRequest());
|
||||
return Result.success("查询成功!", showProjectsFromHttp);
|
||||
}
|
||||
|
||||
@GetMapping("/getProjectInfo/{id}")
|
||||
public Result<Perform> getProjectInfo(@PathVariable("id") Long id) {
|
||||
Perform performsByProjectIdFromHttp = performServiceHttp.getPerformsByProjectIdFromHttp(id);
|
||||
return Result.success("查询成功!", performsByProjectIdFromHttp);
|
||||
}
|
||||
|
||||
@GetMapping("/getPerformsByProjectIdFromHttp/{id}")
|
||||
public Result<Perform> getPerformsByProjectIdFromHttp(@PathVariable("id") Long id) {
|
||||
Perform performsByProjectIdFromHttp = performServiceHttp.getPerformsByProjectIdFromHttp(id);
|
||||
return Result.success("查询成功!", performsByProjectIdFromHttp);
|
||||
}
|
||||
|
||||
@PostMapping("/createOrder")
|
||||
public Result<Void> createOrder(Long projectId) throws Exception {
|
||||
if (performService.createProjectOrder(projectId, FREQUENT_IDS)) {
|
||||
return Result.success("下单成功!");
|
||||
}
|
||||
return Result.error("下单失败!");
|
||||
}
|
||||
|
||||
@GetMapping("/getSeatPlanStatus")
|
||||
public Result<SeatPlanStatus> getSeatPlanStatu (@RequestParam List<Long> ids) {
|
||||
List<SeatPlanStatus> seatPlanStatusFromHttp = performServiceHttp.getSeatPlanStatusFromHttp(ids);
|
||||
return Result.success("查询成功!", seatPlanStatusFromHttp);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.xiang.xservice.fwd.server;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.xiang.xservice.basic.common.resp.Result;
|
||||
import com.xiang.xservice.fwd.service.DingTalkScriptFWDService;
|
||||
import com.xiang.xservice.fwd.service.IPerformService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author: xiang
|
||||
* @Date: 2025-08-06 10:41
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/open/fwd/user")
|
||||
@RequiredArgsConstructor
|
||||
public class FwdUserController {
|
||||
|
||||
private final IPerformService performService;
|
||||
private final DingTalkScriptFWDService dingTalkService;
|
||||
|
||||
@GetMapping("/token")
|
||||
public Result<Void> updateUserTokenFromHttpProxy(@RequestParam Map<String, String> params) {
|
||||
String name = params.get("name");
|
||||
String token = params.get("token");
|
||||
log.info("接收到的参数有===>{}, name:{}, token:{}", JSON.toJSONString(params), name, token);
|
||||
Boolean b = performService.updateTokenByName(name, token);
|
||||
if (b) {
|
||||
String msg = "用户:" + name + "的token更新成功!";
|
||||
try {
|
||||
dingTalkService.sendScriptMsg(msg);
|
||||
} catch (Exception e) {
|
||||
log.error("消息发送失败", e);
|
||||
return Result.error("消息发送失败");
|
||||
}
|
||||
}
|
||||
return Result.success();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.xiang.xservice.fwd.service;
|
||||
|
||||
import com.xiang.xservice.basic.xservice.dingTalk.service.DingTalkService;
|
||||
import com.xiang.xservice.config.DingTalkRobotScriptConfig;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @Author: xiang
|
||||
* @Date: 2025-08-07 10:30
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class DingTalkScriptFWDService {
|
||||
|
||||
private final DingTalkService dingTalkService;
|
||||
private final DingTalkRobotScriptConfig dingTalkRobotConfig;
|
||||
|
||||
/**
|
||||
* 发送脚本消息
|
||||
* @param msg 消息
|
||||
*/
|
||||
public void sendScriptMsg(String msg) {
|
||||
try {
|
||||
dingTalkService.sendRobotMessage(dingTalkRobotConfig.getSecret(), dingTalkRobotConfig.getToken(), dingTalkRobotConfig.getUsers(), msg);
|
||||
} catch (Exception e) {
|
||||
log.error("信息发送异常, 信息:{}", msg, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.xiang.xservice.fwd.service;
|
||||
|
||||
import com.xiang.xservice.fwd.entity.pojo.FPerformConfig;
|
||||
import com.xiang.xservice.fwd.entity.pojo.FPerformProjectInfo;
|
||||
import com.xiang.xservice.fwd.entity.pojo.FPerformSeatInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: xiang
|
||||
* @Date: 2025-07-25 15:15
|
||||
*/
|
||||
public interface IPerformService {
|
||||
|
||||
FPerformProjectInfo getPerformByProjectId(Long projectId);
|
||||
|
||||
List<FPerformSeatInfo> getPerformSeatInfoByProjectId(Long projectId);
|
||||
|
||||
Boolean createProjectOrder(Long projectId, List<Long> frequentIds) throws Exception;
|
||||
|
||||
List<FPerformConfig> getAvailablePerform();
|
||||
|
||||
Boolean updateProjectInfo(FPerformProjectInfo projectInfo);
|
||||
|
||||
FPerformSeatInfo getSeatInfoBySeatId(Long seatId);
|
||||
|
||||
Boolean updateSeatInfo(FPerformSeatInfo seatInfoBySeatId);
|
||||
|
||||
Boolean addSeatInfo(FPerformSeatInfo fPerformSeatInfo);
|
||||
|
||||
Boolean updateTokenByName(String name, String token);
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.xiang.xservice.fwd.service;
|
||||
|
||||
import com.xiang.xservice.basic.common.req.BaseRequest;
|
||||
import com.xiang.xservice.fwd.entity.req.ProjectOrderCreateReq;
|
||||
import com.xiang.xservice.fwd.entity.resp.http.audience.AudienceMemberInfo;
|
||||
import com.xiang.xservice.fwd.entity.resp.http.perform.Perform;
|
||||
import com.xiang.xservice.fwd.entity.resp.http.perform.ProjectInfoResp;
|
||||
import com.xiang.xservice.fwd.entity.resp.http.perform.ProjectOrderCreateResp;
|
||||
import com.xiang.xservice.fwd.entity.resp.http.perform.ProjectsResp;
|
||||
import com.xiang.xservice.fwd.entity.resp.http.perform.SeatPlanStatus;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface IPerformServiceHttp {
|
||||
|
||||
/**
|
||||
* http请求查询全部演出列表
|
||||
* @return ProjectsResp
|
||||
*/
|
||||
ProjectsResp getShowProjectsFromHttp(BaseRequest request);
|
||||
|
||||
/**
|
||||
* http请求根据projectId查询演出详情
|
||||
* @param projectId projectId
|
||||
* @return ProjectInfoResp
|
||||
*/
|
||||
ProjectInfoResp getProjectInfoFromHttp(Long projectId);
|
||||
|
||||
/**
|
||||
* http请求创建演出订单
|
||||
* @param req 创建请求参数
|
||||
* @return ProjectOrderCreateResp
|
||||
*/
|
||||
ProjectOrderCreateResp createProjectOrder(ProjectOrderCreateReq req, String token);
|
||||
|
||||
/**
|
||||
* http请求查询演出票务信息
|
||||
* @param projectId
|
||||
* @return
|
||||
*/
|
||||
Perform getPerformsByProjectIdFromHttp(Long projectId);
|
||||
|
||||
/**
|
||||
* http请求获取座位状态信息
|
||||
* @param seatPlanIds
|
||||
* @return
|
||||
*/
|
||||
List<SeatPlanStatus> getSeatPlanStatusFromHttp(List<Long> seatPlanIds);
|
||||
|
||||
/**
|
||||
* http请求查询观影人信息
|
||||
* @param token
|
||||
* @return
|
||||
*/
|
||||
List<AudienceMemberInfo> getAudienceMemberInfo(String token);
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,189 @@
|
||||
package com.xiang.xservice.fwd.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.xiang.xservice.basic.common.req.BaseRequest;
|
||||
import com.xiang.xservice.basic.utils.HttpUtils;
|
||||
import com.xiang.xservice.basic.utils.JsonUtils;
|
||||
import com.xiang.xservice.fwd.constants.CodeConstants;
|
||||
import com.xiang.xservice.fwd.constants.UrlConstants;
|
||||
import com.xiang.xservice.fwd.entity.req.ProjectOrderCreateReq;
|
||||
import com.xiang.xservice.fwd.entity.resp.http.audience.AudienceMemberInfo;
|
||||
import com.xiang.xservice.fwd.entity.resp.http.perform.Perform;
|
||||
import com.xiang.xservice.fwd.entity.resp.http.perform.ProjectInfoResp;
|
||||
import com.xiang.xservice.fwd.entity.resp.http.perform.ProjectOrderCreateResp;
|
||||
import com.xiang.xservice.fwd.entity.resp.http.perform.ProjectsResp;
|
||||
import com.xiang.xservice.fwd.entity.resp.http.perform.SeatPlanStatus;
|
||||
import com.xiang.xservice.fwd.service.IPerformServiceHttp;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
public class PerformServiceHttpServiceImpl implements IPerformServiceHttp {
|
||||
|
||||
@Override
|
||||
public ProjectsResp getShowProjectsFromHttp(BaseRequest request) {
|
||||
Map<String, String> params = Maps.newHashMap();
|
||||
params.put("projectModuleId", "7");
|
||||
if (Objects.isNull(request.getCurrent())) {
|
||||
params.put("pageNum", String.valueOf(1));
|
||||
} else {
|
||||
params.put("pageNum", String.valueOf(request.getCurrent()));
|
||||
}
|
||||
if (Objects.isNull(request.getPageSize())) {
|
||||
params.put("pageSize", String.valueOf(10));
|
||||
} else {
|
||||
params.put("pageSize", String.valueOf(request.getPageSize()));
|
||||
}
|
||||
String respStr = HttpUtils.doGet(UrlConstants.PROJECTS_URL, buildFWDHeaders(null), params);
|
||||
if (StringUtils.isBlank(respStr)) {
|
||||
return null;
|
||||
}
|
||||
log.info("【Http请求】 http请求查询演出列表结果:{}", respStr);
|
||||
JSONObject resp = JSON.parseObject(respStr);
|
||||
Integer code = (Integer) resp.get("code");
|
||||
if (Objects.nonNull(code) && Objects.equals(code, CodeConstants.SUCCESS)) {
|
||||
ProjectsResp projectsResp = JSON.parseObject(resp.get("data").toString(), ProjectsResp.class);
|
||||
if (Objects.isNull(projectsResp)) {
|
||||
return null;
|
||||
}
|
||||
return projectsResp;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProjectInfoResp getProjectInfoFromHttp(Long projectId) {
|
||||
Map<String, String> params = Maps.newHashMap();
|
||||
params.put("project_id", String.valueOf(projectId));
|
||||
String respStr = HttpUtils.doGet(UrlConstants.PROJECTS_INFO_URL, buildFWDHeaders(UrlConstants.token), params);
|
||||
if (StringUtils.isBlank(respStr)) {
|
||||
return null;
|
||||
}
|
||||
log.info("【Http请求】 根据projectId:{},http请求查询演出信息结果:{}", projectId, respStr);
|
||||
JSONObject resp = JSON.parseObject(respStr);
|
||||
Integer code = (Integer) resp.get("code");
|
||||
if (Objects.nonNull(code) && Objects.equals(code, CodeConstants.SUCCESS)) {
|
||||
ProjectInfoResp projectInfoResp = JSON.parseObject(resp.get("data").toString(), ProjectInfoResp.class);
|
||||
if (Objects.isNull(projectInfoResp)) {
|
||||
return null;
|
||||
}
|
||||
return projectInfoResp;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProjectOrderCreateResp createProjectOrder(ProjectOrderCreateReq req, String token) {
|
||||
String respStr = HttpUtils.doPost(UrlConstants.PROJECT_ORDER_CREATE_URL, buildFWDHeaders(token), JsonUtils.toJsonString(req));
|
||||
if (StringUtils.isBlank(respStr)) {
|
||||
return null;
|
||||
}
|
||||
log.info("【Http请求】 http请求创建订单结果:{}", respStr);
|
||||
JSONObject resp = JSON.parseObject(respStr);
|
||||
Integer code = (Integer) resp.get("code");
|
||||
if (Objects.nonNull(code) && Objects.equals(code, CodeConstants.SUCCESS)) {
|
||||
ProjectOrderCreateResp projectOrderCreateResp = JSON.parseObject(resp.get("data").toString(), ProjectOrderCreateResp.class);
|
||||
if (Objects.isNull(projectOrderCreateResp)) {
|
||||
return null;
|
||||
}
|
||||
return projectOrderCreateResp;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Perform getPerformsByProjectIdFromHttp(Long projectId) {
|
||||
Map<String, String> params = Maps.newHashMap();
|
||||
params.put("project_id", String.valueOf(projectId));
|
||||
String respStr = HttpUtils.doGet(UrlConstants.PERFORMS_URL, buildFWDHeaders(UrlConstants.token), params);
|
||||
if (StringUtils.isBlank(respStr)) {
|
||||
return null;
|
||||
}
|
||||
log.info("【Http请求】 根据projectId:{}http请求查询演出票务信息结果:{}", projectId, respStr);
|
||||
JSONObject resp = JSON.parseObject(respStr);
|
||||
Integer code = (Integer) resp.get("code");
|
||||
if (Objects.nonNull(code) && Objects.equals(code, CodeConstants.SUCCESS)) {
|
||||
Perform projectInfoResp = JSON.parseObject(resp.get("data").toString(), Perform.class);
|
||||
if (Objects.isNull(projectInfoResp)) {
|
||||
return null;
|
||||
}
|
||||
return projectInfoResp;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SeatPlanStatus> getSeatPlanStatusFromHttp(List<Long> seatPlanIds) {
|
||||
StringBuilder seatIds = new StringBuilder();
|
||||
for (Long seatPlanId : seatPlanIds) {
|
||||
seatIds.append(seatPlanId).append(",");
|
||||
}
|
||||
Map<String, String> params = Maps.newHashMap();
|
||||
params.put("seatPlanIds", seatIds.substring(0, seatIds.length() - 2));
|
||||
params.put("type", "3");
|
||||
String respStr = HttpUtils.doGet(UrlConstants.PROJECT_SEAT_STATUS_URL, buildFWDHeaders(UrlConstants.token), params);
|
||||
if (StringUtils.isBlank(respStr)) {
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
log.info("【Http请求】 根据seatPlanIds:{}http请求查询演出座位信息结果:{}", seatPlanIds, respStr);
|
||||
JSONObject resp = JSON.parseObject(respStr);
|
||||
Integer code = (Integer) resp.get("code");
|
||||
if (Objects.nonNull(code) && Objects.equals(code, CodeConstants.SUCCESS)) {
|
||||
List<SeatPlanStatus> data = JSON.parseArray(resp.get("data").toString(), SeatPlanStatus.class);
|
||||
if (CollectionUtils.isEmpty(data)) {
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AudienceMemberInfo> getAudienceMemberInfo(String token) {
|
||||
Map<String, String> params = Maps.newHashMap();
|
||||
String respStr = HttpUtils.doGet(UrlConstants.PROJECT_AUDIENCE_MEMBER_INFO, buildFWDHeaders(token), params);
|
||||
if (StringUtils.isBlank(respStr)) {
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
log.info("【Http请求】 根据token:{}http请求查询观影人信息结果:{}", token, respStr);
|
||||
JSONObject resp = JSON.parseObject(respStr);
|
||||
Integer code = (Integer) resp.get("code");
|
||||
if (Objects.nonNull(code) && Objects.equals(code, CodeConstants.SUCCESS)) {
|
||||
List<AudienceMemberInfo> data = JSON.parseArray(resp.get("data").toString(), AudienceMemberInfo.class);
|
||||
if (CollectionUtils.isEmpty(data)) {
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
|
||||
private Map<String, String> buildFWDHeaders(String token) {
|
||||
Map<String, String> headers = Maps.newHashMap();
|
||||
headers.put("Host", "api.livelab.com.cn");
|
||||
headers.put("Connection", "keep-alive");
|
||||
headers.put("platform-type", "%E7%BA%B7%E7%8E%A9%E5%B2%9B%E5%BE%AE%E4%BF%A1%E5%B0%8F%E7%A8%8B%E5%BA%8F");
|
||||
headers.put("content-type", "application/json");
|
||||
headers.put("x-fwd-anonymousId", "ocXac5C25MY5O3UM_EfL0oTgm7Jw");
|
||||
headers.put("platform-version", "3.12.0");
|
||||
if (StringUtils.isNotBlank(token)) {
|
||||
headers.put("Authorization", token);
|
||||
}
|
||||
headers.put("Accept-Encoding", "gzip,compress,br,deflate");
|
||||
headers.put("User-Agent", "Mozilla/5.0 (iPhone; CPU iPhone OS 18_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/8.0.61(0x18003d30) NetType/4G Language/zh_CN");
|
||||
headers.put("Referer", "https://servicewechat.com/wx5a8f481d967649eb/114/page-frame.html");
|
||||
return headers;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,156 @@
|
||||
package com.xiang.xservice.fwd.service.impl;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.xiang.xservice.basic.config.MyThreadFactory;
|
||||
import com.xiang.xservice.fwd.entity.pojo.FPerformConfig;
|
||||
import com.xiang.xservice.fwd.entity.pojo.FPerformProjectInfo;
|
||||
import com.xiang.xservice.fwd.entity.pojo.FPerformSeatInfo;
|
||||
import com.xiang.xservice.fwd.entity.pojo.FUserConfig;
|
||||
import com.xiang.xservice.fwd.entity.req.ProjectOrderCreateReq;
|
||||
import com.xiang.xservice.fwd.entity.resp.http.perform.ProjectOrderCreateResp;
|
||||
import com.xiang.xservice.fwd.mapper.FwdPerformConfigMapper;
|
||||
import com.xiang.xservice.fwd.mapper.FwdPerformProjectInfoMapper;
|
||||
import com.xiang.xservice.fwd.mapper.FwdPerformSeatInfoMapper;
|
||||
import com.xiang.xservice.fwd.mapper.FwdUserConfigMapper;
|
||||
import com.xiang.xservice.fwd.service.DingTalkScriptFWDService;
|
||||
import com.xiang.xservice.fwd.service.IPerformService;
|
||||
import com.xiang.xservice.fwd.service.IPerformServiceHttp;
|
||||
import com.xiang.xservice.http.helper.HttpRequestHelper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* @Author: xiang
|
||||
* @Date: 2025-07-25 15:16
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class PerformServiceImpl implements IPerformService {
|
||||
|
||||
private final FwdPerformSeatInfoMapper fwdPerformSeatInfoMapper;
|
||||
private final FwdPerformProjectInfoMapper fwdPerformProjectInfoMapper;
|
||||
private final FwdPerformConfigMapper fwdPerformConfigMapper;
|
||||
private final IPerformServiceHttp performServiceHttp;
|
||||
private final DingTalkScriptFWDService dingTalkService;
|
||||
private final FwdUserConfigMapper fwdUserConfigMapper;
|
||||
private final HttpRequestHelper httpRequestHelper;
|
||||
private final ExecutorService es =
|
||||
new ThreadPoolExecutor(
|
||||
10,
|
||||
20,
|
||||
1000,
|
||||
TimeUnit.MILLISECONDS,
|
||||
new LinkedBlockingQueue<>(),
|
||||
new MyThreadFactory("ticket-", Boolean.TRUE),
|
||||
new ThreadPoolExecutor.AbortPolicy());
|
||||
|
||||
@Override
|
||||
public FPerformProjectInfo getPerformByProjectId(Long projectId) {
|
||||
return fwdPerformProjectInfoMapper.getProjectByProjectId(projectId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FPerformSeatInfo> getPerformSeatInfoByProjectId(Long projectId) {
|
||||
return fwdPerformSeatInfoMapper.getPerformSeatByProjectId(projectId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean createProjectOrder(Long projectId, List<Long> frequentIds) throws Exception {
|
||||
List<FUserConfig> availableUser = fwdUserConfigMapper.getAvailableUser();
|
||||
if (CollectionUtils.isEmpty(availableUser)) {
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
FPerformProjectInfo performByProjectId = getPerformByProjectId(projectId);
|
||||
if (Objects.isNull(performByProjectId)) {
|
||||
log.info("该projectId:{}暂无演出信息", projectId);
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
List<FPerformSeatInfo> seatInfoByProjectId = getPerformSeatInfoByProjectId(projectId);
|
||||
if (CollectionUtils.isEmpty(seatInfoByProjectId)) {
|
||||
log.info("该projectId:{}暂无座位信息", projectId);
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
for (FPerformSeatInfo fPerformSeatInfo : seatInfoByProjectId) {
|
||||
if (1 == fPerformSeatInfo.getSoldOut()) {
|
||||
continue;
|
||||
}
|
||||
ProjectOrderCreateReq projectOrderCreateReq = new ProjectOrderCreateReq();
|
||||
projectOrderCreateReq.setDeliveryType(1);
|
||||
projectOrderCreateReq.setContactName("朱吉祥");
|
||||
projectOrderCreateReq.setContactPhone("15858717571");
|
||||
projectOrderCreateReq.setPayment(fPerformSeatInfo.getPrice().multiply(BigDecimal.valueOf(frequentIds.size())).setScale(2));
|
||||
projectOrderCreateReq.setTotalPrice(fPerformSeatInfo.getPrice().multiply(BigDecimal.valueOf(frequentIds.size())).setScale(2, BigDecimal.ROUND_HALF_UP));
|
||||
projectOrderCreateReq.setPerformId(fPerformSeatInfo.getPerformId());
|
||||
projectOrderCreateReq.setProjectId(projectId.toString());
|
||||
projectOrderCreateReq.setPrivilegeCodeList(new ArrayList<>());
|
||||
projectOrderCreateReq.setAudienceCount(frequentIds.size());
|
||||
projectOrderCreateReq.setFrequentIds(frequentIds);
|
||||
projectOrderCreateReq.setSeatPlanIds(Collections.singletonList(fPerformSeatInfo.getSeatPlanId()));
|
||||
projectOrderCreateReq.setBlackBox("0");
|
||||
projectOrderCreateReq.setCombineTicketVos(null);
|
||||
projectOrderCreateReq.setOrdinaryTicketVos(null);
|
||||
for (int i = 1; i <= 10; i++) {
|
||||
ProjectOrderCreateResp projectOrder = httpRequestHelper.fetchWithRetry(() -> performServiceHttp.createProjectOrder(projectOrderCreateReq, availableUser.get(0).getToken()), "create-project-order");
|
||||
if (Objects.nonNull(projectOrder)) {
|
||||
log.info("下单成功,订单信息:{}", JSONObject.toJSONString(projectOrder));
|
||||
String msg = "【芬玩岛】下单成功✅✅✅,演出名称:" + performByProjectId.getProjectName() + ",请在2分钟内完成付款!";
|
||||
dingTalkService.sendScriptMsg(msg);
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FPerformConfig> getAvailablePerform() {
|
||||
return fwdPerformConfigMapper.getAvailablePerform();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean updateProjectInfo(FPerformProjectInfo projectInfo) {
|
||||
return fwdPerformProjectInfoMapper.update(projectInfo) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FPerformSeatInfo getSeatInfoBySeatId(Long seatId) {
|
||||
return fwdPerformSeatInfoMapper.getBySeatPlanId(seatId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean updateSeatInfo(FPerformSeatInfo seatInfoBySeatId) {
|
||||
return fwdPerformSeatInfoMapper.update(seatInfoBySeatId) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean addSeatInfo(FPerformSeatInfo fPerformSeatInfo) {
|
||||
return fwdPerformSeatInfoMapper.batchSave(Collections.singletonList(fPerformSeatInfo)) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean updateTokenByName(String name, String token) {
|
||||
FUserConfig userByName = fwdUserConfigMapper.getUserByName(name);
|
||||
if (Objects.isNull(userByName)) {
|
||||
FUserConfig fUserConfig = new FUserConfig();
|
||||
fUserConfig.setName(name);
|
||||
fUserConfig.setToken(token);
|
||||
fUserConfig.setStatus(1);
|
||||
return fwdUserConfigMapper.insert(fUserConfig) > 0;
|
||||
} else {
|
||||
return fwdUserConfigMapper.updateTokenByName(name, token) > 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,6 @@ public class GladosCheckInJob {
|
||||
private final GLaDOSService glaDOSService;
|
||||
|
||||
@Scheduled(cron = "0 0 8,16 1/1 * ?")
|
||||
// @Scheduled(cron = "0 0/1 * * * ?")
|
||||
public void checkInJon() {
|
||||
log.info("[job] Glados Check In Job start, time:{}", LocalDateTime.now());
|
||||
glaDOSService.checkIn();
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.xiang.xservice.glados.service;
|
||||
|
||||
import com.xiang.xservice.basic.xservice.dingTalk.service.DingTalkService;
|
||||
import com.xiang.xservice.config.DingTalkRobotScriptConfig;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @Author: xiang
|
||||
* @Date: 2025-08-07 10:30
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class DingTalkScriptGladosService {
|
||||
|
||||
private final DingTalkService dingTalkService;
|
||||
private final DingTalkRobotScriptConfig dingTalkRobotScriptConfig;
|
||||
|
||||
/**
|
||||
* 发送脚本消息
|
||||
* @param msg 消息
|
||||
*/
|
||||
public void sendScriptMsg(String msg) {
|
||||
try {
|
||||
dingTalkService.sendRobotMessage(dingTalkRobotScriptConfig.getSecret(), dingTalkRobotScriptConfig.getToken(),
|
||||
dingTalkRobotScriptConfig.getUsers(), msg);
|
||||
} catch (Exception e) {
|
||||
log.error("信息发送异常, 信息:{}", msg, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,16 +3,14 @@ package com.xiang.xservice.glados.service;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.xiang.xservice.basic.utils.HttpUtils;
|
||||
import com.xiang.xservice.basic.xservice.dingTalk.service.DingTalkService;
|
||||
import com.xiang.xservice.glados.common.GladosConstants;
|
||||
import com.xiang.xservice.glados.common.URLConstants;
|
||||
import com.xiang.xservice.glados.entity.GladosRunLog;
|
||||
import com.xiang.xservice.xb.entity.pojo.User;
|
||||
import com.xiang.xservice.glados.entity.resp.GLaDOSResponse;
|
||||
import com.xiang.xservice.glados.repository.GladosMapper;
|
||||
import com.xiang.xservice.xb.entity.pojo.User;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
@@ -33,13 +31,7 @@ public class GLaDOSServiceImpl implements GLaDOSService{
|
||||
|
||||
private final GladosMapper gladosMapper;
|
||||
|
||||
private final DingTalkService dingTalkService;
|
||||
|
||||
@Value("${DingTalk.userList}")
|
||||
private String userList;
|
||||
|
||||
@Value("${DingTalk.chatId}")
|
||||
private String chatId;
|
||||
private final DingTalkScriptGladosService dingTalkService;
|
||||
|
||||
/**
|
||||
* 签到
|
||||
@@ -84,7 +76,7 @@ public class GLaDOSServiceImpl implements GLaDOSService{
|
||||
log.info("签到成功, 签到积分:{}, 签到消息:{}", gLaDOSResponse.getPoints(), gLaDOSResponse.getMessage());
|
||||
sb.append(user.getEmail()).append("签到成功,获得积分:").append(gLaDOSResponse.getPoints()).append("\n");
|
||||
try {
|
||||
dingTalkService.sendChatMessage(chatId, "[时间:" + LocalDateTime.now() + "] 用户: " +
|
||||
dingTalkService.sendScriptMsg("[时间:" + LocalDateTime.now() + "] 用户: " +
|
||||
user.getEmail() + "签到成功,获得积分:" + gLaDOSResponse.getPoints());
|
||||
} catch (Exception e) {
|
||||
log.error("发送钉钉消息失败", e);
|
||||
@@ -98,7 +90,7 @@ public class GLaDOSServiceImpl implements GLaDOSService{
|
||||
log.warn("签到失败,用户:{}, cookie过期:{}", user.getEmail(), gLaDOSResponse.getMessage());
|
||||
String message = "[时间:" + LocalDateTime.now() + "] 用户: " + user.getEmail() + ",签到消息: " + gLaDOSResponse.getMessage();
|
||||
try {
|
||||
dingTalkService.sendChatMessage(chatId, message);
|
||||
dingTalkService.sendScriptMsg(message);
|
||||
} catch (Exception e) {
|
||||
log.error("发送钉钉消息失败", e);
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ public class JntyzxServiceImpl implements JntyzxService{
|
||||
|
||||
private final DingTalkService dingTalkService;
|
||||
|
||||
@Value("${DingTalk.chatId}")
|
||||
@Value("${dingtalk.chatId}")
|
||||
private String chatId;
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
package com.xiang.xservice.xb.schedule.jntyzx;
|
||||
|
||||
import com.xiang.xservice.jntyzx.service.JntyzxService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @Author: xiang
|
||||
* @Date: 2025-05-14 15:34
|
||||
*/
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class QueryVenueJob {
|
||||
private final JntyzxService jntyzxService;
|
||||
|
||||
// @Scheduled(cron = "0 0 14 1/1 * ?")
|
||||
public void query() throws Exception{
|
||||
log.info("[查询场地] 查询当天场地定时任务启动!");
|
||||
jntyzxService.queryAvailable();
|
||||
log.info("[查询场地] 查询当天场地定时任务结束!");
|
||||
}
|
||||
}
|
||||
@@ -2,16 +2,15 @@ package com.xiang.xservice.xb.schedule.xb;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.xiang.xservice.basic.xservice.dingTalk.service.DingTalkService;
|
||||
import com.xiang.xservice.xb.entity.pojo.xb.XbFundCount;
|
||||
import com.xiang.xservice.xb.entity.pojo.xb.XbFundList;
|
||||
import com.xiang.xservice.xb.entity.response.xbyj.fund.FundList;
|
||||
import com.xiang.xservice.xb.service.DingTalkRobotService;
|
||||
import com.xiang.xservice.xb.service.FundService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -37,9 +36,7 @@ import java.util.stream.Collectors;
|
||||
public class FundCountJob {
|
||||
|
||||
private final FundService fundService;
|
||||
private final DingTalkService dingTalkService;
|
||||
@Value("${DingTalk.chatId}")
|
||||
private String chatId;
|
||||
private final DingTalkRobotService dingTalkService;
|
||||
@Scheduled(cron = "0 0 22 * * ?")
|
||||
public void countFundJob() {
|
||||
// 周六周日过滤
|
||||
@@ -61,7 +58,7 @@ public class FundCountJob {
|
||||
xbFundCount.setLId(xbFundList.getId());
|
||||
xbFundCount.setCode(xbFundList.getCode());
|
||||
xbFundCount.setName(xbFundList.getName());
|
||||
xbFundCount.setChange(fund.get(0).getChange());
|
||||
xbFundCount.setChange(fund.get(0).getChange().multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP));
|
||||
xbFundCount.setUpdateTime(LocalDateTime.now());
|
||||
counts.add(xbFundCount);
|
||||
}
|
||||
@@ -96,7 +93,7 @@ public class FundCountJob {
|
||||
sb.append("【").append(fundCounts.get(0).getName()).append("】本周平均涨跌幅为:").append(avg).append("\n");
|
||||
});
|
||||
if (StringUtils.isNotBlank(sb)) {
|
||||
dingTalkService.sendChatMessage(chatId, sb.toString());
|
||||
dingTalkService.sendXbMsg(sb.toString());
|
||||
}
|
||||
log.info("==========================[基金统计] 基金本周涨跌幅消息发送定时任务结束!==========================");
|
||||
}
|
||||
|
||||
@@ -25,7 +25,6 @@ import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
@@ -59,113 +58,13 @@ public class FundInfoQueryJob {
|
||||
new ThreadPoolExecutor.AbortPolicy());
|
||||
@Value("${xiaobei.codeArr}")
|
||||
private String codeArr;
|
||||
@Value("${DingTalk.chatId}")
|
||||
@Value("${dingtalk.chatId}")
|
||||
private String chatId;
|
||||
|
||||
/**
|
||||
* 基金增长定时任务查询
|
||||
* 半个小时一次 9点开始到3.30结束
|
||||
*/
|
||||
@Scheduled(cron = "0 1,31 9,10,11,13,14 * * ? ")
|
||||
public void queryFundJob() throws Exception {
|
||||
// 周六周日过滤
|
||||
if (Objects.equals(LocalDateTime.now().getDayOfWeek(), DayOfWeek.SATURDAY) ||
|
||||
Objects.equals(LocalDateTime.now().getDayOfWeek(), DayOfWeek.SUNDAY)) {
|
||||
return;
|
||||
}
|
||||
log.info("==========================[基金查询] 基金查询定时任务启动!==========================");
|
||||
List<FundMessage> result = queryFund(1);
|
||||
if (CollectionUtils.isEmpty(result)) {
|
||||
return;
|
||||
}
|
||||
log.info("查询的基金涨跌幅数据:{}", JSONObject.toJSONString(result));
|
||||
result = result.stream().sorted(Comparator.comparing(FundMessage::getChange)).collect(Collectors.toList());
|
||||
StringBuilder sb = new StringBuilder("今天的A股行情:");
|
||||
for (FundMessage fundMessage : result) {
|
||||
sb.append("基金名称:")
|
||||
.append(fundMessage.getName())
|
||||
.append("于")
|
||||
.append(fundMessage.getUpdate())
|
||||
.append("更新涨跌幅:")
|
||||
.append(fundMessage.getChange()
|
||||
.multiply(new BigDecimal("100"))
|
||||
.setScale(2, RoundingMode.HALF_UP).toString())
|
||||
.append("%\n");
|
||||
}
|
||||
dingTalkService.sendChatMessage(chatId, sb.toString());
|
||||
log.info("==========================[基金查询] 基金查询定时任务结束!==========================");
|
||||
}
|
||||
/**
|
||||
* 基金增长定时任务查询
|
||||
* 半个小时一次 9点开始到3.30结束
|
||||
*/
|
||||
@Scheduled(cron = "0 0 9 * * ? ")
|
||||
public void queryFundJob3() throws Exception {
|
||||
// 周六周日过滤
|
||||
if (Objects.equals(LocalDateTime.now().getDayOfWeek(), DayOfWeek.SATURDAY) ||
|
||||
Objects.equals(LocalDateTime.now().getDayOfWeek(), DayOfWeek.SUNDAY)) {
|
||||
return;
|
||||
}
|
||||
log.info("==========================[基金查询] 基金查询定时任务启动!==========================");
|
||||
List<FundMessage> result = queryFund(3);
|
||||
if (CollectionUtils.isEmpty(result)) {
|
||||
return;
|
||||
}
|
||||
log.info("查询的美股基金涨跌幅数据:{}", JSONObject.toJSONString(result));
|
||||
result = result.stream().sorted(Comparator.comparing(FundMessage::getChange)).collect(Collectors.toList());
|
||||
StringBuilder sb = new StringBuilder("今天的美股行情:\n");
|
||||
for (FundMessage fundMessage : result) {
|
||||
sb.append("基金名称:")
|
||||
.append(fundMessage.getName())
|
||||
.append("于")
|
||||
.append(fundMessage.getUpdate())
|
||||
.append("更新涨跌幅:")
|
||||
.append(fundMessage.getChange()
|
||||
.multiply(new BigDecimal("100"))
|
||||
.setScale(2, RoundingMode.HALF_UP).toString())
|
||||
.append("%\n");
|
||||
}
|
||||
dingTalkService.sendChatMessage(chatId, sb.toString());
|
||||
log.info("==========================[基金查询] 基金查询定时任务结束!==========================");
|
||||
}
|
||||
/**
|
||||
* 基金增长定时任务查询
|
||||
* 半个小时一次 9点开始到3.30结束
|
||||
*/
|
||||
@Scheduled(cron = "0 1,31 9,10,11,13,14,15 * * ? ")
|
||||
public void queryFundJob2() throws Exception {
|
||||
// 周六周日过滤
|
||||
if (Objects.equals(LocalDateTime.now().getDayOfWeek(), DayOfWeek.SATURDAY) ||
|
||||
Objects.equals(LocalDateTime.now().getDayOfWeek(), DayOfWeek.SUNDAY)) {
|
||||
return;
|
||||
}
|
||||
log.info("==========================[基金查询] 基金查询定时任务启动!==========================");
|
||||
List<FundMessage> result = queryFund(2);
|
||||
if (CollectionUtils.isEmpty(result)) {
|
||||
return;
|
||||
}
|
||||
log.info("查询的港股基金涨跌幅数据:{}", JSONObject.toJSONString(result));
|
||||
result = result.stream().sorted(Comparator.comparing(FundMessage::getChange)).collect(Collectors.toList());
|
||||
StringBuilder sb = new StringBuilder("今天的美股行情:\n");
|
||||
for (FundMessage fundMessage : result) {
|
||||
sb.append("基金名称:")
|
||||
.append(fundMessage.getName())
|
||||
.append("于")
|
||||
.append(fundMessage.getUpdate())
|
||||
.append("更新涨跌幅:")
|
||||
.append(fundMessage.getChange()
|
||||
.multiply(new BigDecimal("100"))
|
||||
.setScale(2, RoundingMode.HALF_UP).toString())
|
||||
.append("%\n");
|
||||
}
|
||||
dingTalkService.sendChatMessage(chatId, sb.toString());
|
||||
log.info("==========================[基金查询] 基金查询定时任务结束!==========================");
|
||||
}
|
||||
|
||||
/**
|
||||
* 基金涨跌幅5分钟超过2%重点通知
|
||||
*/
|
||||
@Scheduled(cron = "0 0/5 * * * ? ")
|
||||
@Scheduled(cron = "0 0/5 9,10,11,13,14,15 * * ? ")
|
||||
public void queryFundEmergencyJob() throws Exception {
|
||||
// 周六周日过滤
|
||||
if (Objects.equals(LocalDateTime.now().getDayOfWeek(), DayOfWeek.SATURDAY) ||
|
||||
|
||||
@@ -0,0 +1,144 @@
|
||||
package com.xiang.xservice.xb.schedule.xb;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.xiang.xservice.xb.entity.pojo.xb.XbFundList;
|
||||
import com.xiang.xservice.xb.entity.response.xbyj.fund.FundList;
|
||||
import com.xiang.xservice.xb.service.DingTalkRobotService;
|
||||
import com.xiang.xservice.xb.service.FundService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.time.DayOfWeek;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Author: xiang
|
||||
* @Date: 2025-07-31 18:10
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
public class FundMsgReportJob {
|
||||
|
||||
private final FundService fundService;
|
||||
private final DingTalkRobotService dingTalkService;
|
||||
private static final Integer TYPE_A = 1;
|
||||
private static final Integer TYPE_M = 3;
|
||||
private static final Integer TYPE_G = 2;
|
||||
|
||||
@Scheduled(cron = "0 1,31 9,10,11,13,14 * * ?")
|
||||
@PostMapping("/asdasda")
|
||||
public void fundReport4A() {
|
||||
log.info("===========A股基金变化通知!===========");
|
||||
// 周六周日过滤
|
||||
if (Objects.equals(LocalDateTime.now().getDayOfWeek(), DayOfWeek.SATURDAY) ||
|
||||
Objects.equals(LocalDateTime.now().getDayOfWeek(), DayOfWeek.SUNDAY)) {
|
||||
log.info("当前时间为:{}", LocalDateTime.now());
|
||||
return;
|
||||
}
|
||||
List<XbFundList> fundLists = fundService.queryFundList(TYPE_A);
|
||||
if (CollectionUtils.isEmpty(fundLists)) {
|
||||
log.info("查询配置的A股信息为空");
|
||||
return;
|
||||
}
|
||||
Map<String, XbFundList> fundMap = fundLists.stream().collect(Collectors.toMap(XbFundList::getCode, Function.identity(), (a, b) -> a));
|
||||
String date = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
||||
List<FundList> funds = fundService.queryTodayList(date, "2", Boolean.TRUE, new ArrayList<>(fundMap.keySet()));
|
||||
if (CollectionUtils.isEmpty(funds)) {
|
||||
log.info("http请求查询基金信息为空");
|
||||
return;
|
||||
}
|
||||
log.info("http查询基金信息:{}", JSON.toJSONString(funds));
|
||||
StringBuilder msg = new StringBuilder(date).append("===》A股基金变化通知:\n");
|
||||
buildMsg(funds, fundMap, msg);
|
||||
dingTalkService.sendXbMsg(msg.toString());
|
||||
}
|
||||
|
||||
@Scheduled(cron = "0 1,31 9,10,11,13,14,15 * * ?")
|
||||
public void fundReport4G() {
|
||||
log.info("===========港股基金变化通知!===========");
|
||||
// 周六周日过滤
|
||||
if (Objects.equals(LocalDateTime.now().getDayOfWeek(), DayOfWeek.SATURDAY) ||
|
||||
Objects.equals(LocalDateTime.now().getDayOfWeek(), DayOfWeek.SUNDAY)) {
|
||||
log.info("当前时间为:{}", LocalDateTime.now());
|
||||
return;
|
||||
}
|
||||
List<XbFundList> fundLists = fundService.queryFundList(TYPE_G);
|
||||
if (CollectionUtils.isEmpty(fundLists)) {
|
||||
log.info("查询配置的港股信息为空");
|
||||
return;
|
||||
}
|
||||
Map<String, XbFundList> fundMap = fundLists.stream().collect(Collectors.toMap(XbFundList::getCode, Function.identity(), (a, b) -> a));
|
||||
String date = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
||||
List<FundList> funds = fundService.queryTodayList(date, "2", Boolean.TRUE, new ArrayList<>(fundMap.keySet()));
|
||||
if (CollectionUtils.isEmpty(funds)) {
|
||||
log.info("http请求查询基金信息为空");
|
||||
return;
|
||||
}
|
||||
log.info("http查询港股基金信息:{}", JSON.toJSONString(funds));
|
||||
StringBuilder msg = new StringBuilder(date).append("===》港股基金变化通知:\n");
|
||||
buildMsg(funds, fundMap, msg);
|
||||
dingTalkService.sendXbMsg(msg.toString());
|
||||
}
|
||||
|
||||
@Scheduled(cron = "0 0 9 * * ?")
|
||||
public void fundReport4M() {
|
||||
log.info("===========美股基金变化通知!===========");
|
||||
// 周六周日过滤
|
||||
if (Objects.equals(LocalDateTime.now().getDayOfWeek(), DayOfWeek.SATURDAY) ||
|
||||
Objects.equals(LocalDateTime.now().getDayOfWeek(), DayOfWeek.SUNDAY)) {
|
||||
log.info("当前时间为:{}", LocalDateTime.now());
|
||||
return;
|
||||
}
|
||||
List<XbFundList> fundLists = fundService.queryFundList(TYPE_M);
|
||||
if (CollectionUtils.isEmpty(fundLists)) {
|
||||
log.info("查询配置的美股信息为空");
|
||||
return;
|
||||
}
|
||||
Map<String, XbFundList> fundMap = fundLists.stream().collect(Collectors.toMap(XbFundList::getCode, Function.identity(), (a, b) -> a));
|
||||
String date = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
||||
List<FundList> funds = fundService.queryTodayList(date, "2", Boolean.TRUE, new ArrayList<>(fundMap.keySet()));
|
||||
if (CollectionUtils.isEmpty(funds)) {
|
||||
log.info("http请求查询基金信息为空");
|
||||
return;
|
||||
}
|
||||
log.info("http查询美股基金信息:{}", JSON.toJSONString(funds));
|
||||
StringBuilder msg = new StringBuilder(date).append("===》美股基金变化通知:\n");
|
||||
buildMsg(funds, fundMap, msg);
|
||||
dingTalkService.sendXbMsg(msg.toString());
|
||||
}
|
||||
|
||||
private static void buildMsg(List<FundList> funds, Map<String, XbFundList> fundMap, StringBuilder msg) {
|
||||
funds = funds.stream().sorted(Comparator.comparing(FundList::getChange).reversed())
|
||||
.collect(Collectors.toList());
|
||||
for (FundList fund : funds) {
|
||||
if (fundMap.containsKey(fund.getCode())) {
|
||||
XbFundList fundList = fundMap.get(fund.getCode());
|
||||
msg.append("基金名称:")
|
||||
.append(fundList.getName())
|
||||
.append("涨跌幅:")
|
||||
.append(fund.getChange()
|
||||
.multiply(new BigDecimal("100"))
|
||||
.setScale(2, RoundingMode.HALF_UP))
|
||||
.append("\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.xiang.xservice.xb.service;
|
||||
|
||||
import com.xiang.xservice.basic.xservice.dingTalk.service.DingTalkService;
|
||||
import com.xiang.xservice.config.DingTalkRobotXbConfig;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @Author: xiang
|
||||
* @Date: 2025-08-07 11:02
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class DingTalkRobotService {
|
||||
private final DingTalkService dingTalkService;
|
||||
private final DingTalkRobotXbConfig dingTalkRobotConfig;
|
||||
|
||||
/**
|
||||
* 发送脚本消息
|
||||
* @param msg 消息
|
||||
*/
|
||||
public void sendXbMsg(String msg) {
|
||||
try {
|
||||
dingTalkService.sendRobotMessage(dingTalkRobotConfig.getSecret(), dingTalkRobotConfig.getToken(), dingTalkRobotConfig.getUsers(), msg);
|
||||
} catch (Exception e) {
|
||||
log.error("信息发送异常, 信息:{}", msg, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -65,7 +65,7 @@ public class FundServiceImpl implements FundService{
|
||||
if (StringUtils.isNotBlank(resp)) {
|
||||
QueryFundListResponse response = JSONObject.parseObject(resp, QueryFundListResponse.class);
|
||||
if (Objects.nonNull(response)) {
|
||||
if (Objects.equals(SUCCESS_0, response.getCode())) {
|
||||
if (Objects.equals(SUCCESS_200, response.getCode())) {
|
||||
return response.getData();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
spring:
|
||||
datasource:
|
||||
url: jdbc:mysql://120.27.153.87:3306/xservice-script-test?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&allowMultiQueries=true
|
||||
url: jdbc:mysql://rm-bp1j371yx9d9894ewbo.mysql.rds.aliyuncs.com:3306/xservice-script-test?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&allowMultiQueries=true
|
||||
username: root
|
||||
password: 123456
|
||||
password: xb#UWqnhH24&XpX
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
redis:
|
||||
host: r-bp1dqqbzlfw04fldp3pd.redis.rds.aliyuncs.com
|
||||
@@ -16,7 +16,25 @@ spring:
|
||||
max-idle: 8
|
||||
min-idle: 0
|
||||
max-wait: 1000
|
||||
|
||||
aliyun:
|
||||
dns:
|
||||
RR:
|
||||
- local
|
||||
|
||||
dingtalk:
|
||||
# 钉钉消息用户,用逗号隔开
|
||||
userList: "450841600726084717"
|
||||
# 钉钉消息群ID,需要调用/chat/create api创建群返回
|
||||
chatId: "chatd16d8daeea33b36b73588c676d508096"
|
||||
robot:
|
||||
script:
|
||||
token: 797be7f32062e31dec1d567f8b490a5649a5366083618e236c7a1263df1f4af3
|
||||
secret: SEC9aca642c0c29c9da261462869c464d34623247583d98fc82343a0a4464abbe91
|
||||
users:
|
||||
- 450841600726084717
|
||||
xb:
|
||||
token: ad21ead99f0fdc63aa00d6732b7b0888c17590f7612c68297edfcb71844d1437
|
||||
secret: SECc09d8aad6635f1a4cbadb7c0ab365523c46299f138438cd885e445e0f5f4d730
|
||||
users:
|
||||
- 450841600726084717
|
||||
@@ -22,3 +22,20 @@ aliyun:
|
||||
RR:
|
||||
- client
|
||||
- file
|
||||
|
||||
DingTalk:
|
||||
# 钉钉消息用户,用逗号隔开
|
||||
userList: "450841600726084717"
|
||||
# 钉钉消息群ID,需要调用/chat/create api创建群返回
|
||||
chatId: "chatd16d8daeea33b36b73588c676d508096"
|
||||
robot:
|
||||
script:
|
||||
token: 4709b708d961846e0aee523c5abc3b67e8fa424ee292501d85efd4e504f15a8b
|
||||
secret: SEC768ed578c0fb31a9aec84b1c1db4f195f5aca203985bbb9d549e23e41c8874d1
|
||||
userIds:
|
||||
- 450841600726084717
|
||||
xb:
|
||||
token: 340a9d39a5b0b6a52ba2262f9c27179cf50e3c8cfe6883ca082649d306038f41
|
||||
secret: ad21ead99f0fdc63aa00d6732b7b0888c17590f7612c68297edfcb71844d1437
|
||||
userIds:
|
||||
- 450841600726084717
|
||||
@@ -1,8 +1,8 @@
|
||||
spring:
|
||||
datasource:
|
||||
url: jdbc:mysql://172.28.159.213:3306/xservice-script?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&allowMultiQueries=true
|
||||
url: jdbc:mysql://rm-bp1j371yx9d9894ewbo.mysql.rds.aliyuncs.com:3306/xservice-script-test?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&allowMultiQueries=true
|
||||
username: root
|
||||
password: 123456
|
||||
password: xb#UWqnhH24&XpX
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
redis:
|
||||
host: r-bp1dqqbzlfw04fldp3pd.redis.rds.aliyuncs.com
|
||||
@@ -21,3 +21,20 @@ aliyun:
|
||||
dns:
|
||||
RR:
|
||||
- test
|
||||
|
||||
DingTalk:
|
||||
# 钉钉消息用户,用逗号隔开
|
||||
userList: "450841600726084717"
|
||||
# 钉钉消息群ID,需要调用/chat/create api创建群返回
|
||||
chatId: "chatd16d8daeea33b36b73588c676d508096"
|
||||
robot:
|
||||
script:
|
||||
token: 797be7f32062e31dec1d567f8b490a5649a5366083618e236c7a1263df1f4af3
|
||||
secret: SEC9aca642c0c29c9da261462869c464d34623247583d98fc82343a0a4464abbe91
|
||||
userIds:
|
||||
- 450841600726084717
|
||||
xb:
|
||||
token: ad21ead99f0fdc63aa00d6732b7b0888c17590f7612c68297edfcb71844d1437
|
||||
secret: SECc09d8aad6635f1a4cbadb7c0ab365523c46299f138438cd885e445e0f5f4d730
|
||||
userIds:
|
||||
- 450841600726084717
|
||||
@@ -1,15 +1,10 @@
|
||||
mybatis:
|
||||
mapper-locations:
|
||||
- classpath*:mapper/*/*.xml
|
||||
- classpath*:mapper/*.xml
|
||||
configuration:
|
||||
map-underscore-to-camel-case: true
|
||||
|
||||
DingTalk:
|
||||
# 钉钉消息用户,用逗号隔开
|
||||
userList: "450841600726084717"
|
||||
# 钉钉消息群ID,需要调用/chat/create api创建群返回
|
||||
chatId: "chatd16d8daeea33b36b73588c676d508096"
|
||||
|
||||
xiaobei:
|
||||
unionId: o896o5y8bJZYMh2gdKhDdmUKc0Wk
|
||||
codeArr: "010364, 022150, 013224, 008960, 013841, 015528, 012414, 020412, 014662, 016814, 014422, 015596, 007844,
|
||||
@@ -22,3 +17,7 @@ server:
|
||||
spring:
|
||||
profiles:
|
||||
active: local
|
||||
|
||||
http:
|
||||
maxAttempts: 10
|
||||
sleepMs: 200
|
||||
@@ -0,0 +1,56 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.xiang.xservice.fwd.mapper.FwdAudienceConfigMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.xiang.xservice.fwd.entity.pojo.FAudienceConfig">
|
||||
<result column="id" property="id"/>
|
||||
<result column="frequent_id" property="frequentId"/>
|
||||
<result column="frequent_name" property="frequentName"/>
|
||||
<result column="status" property="status"/>
|
||||
<result column="frequent_no" property="frequentNo"/>
|
||||
<result column="frequent_phone" property="frequentPhone"/>
|
||||
<result column="del_flag" property="delFlag"/>
|
||||
<result column="user_id" property="userId"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id, frequent_id, frequent_name, status,frequent_no,frequent_phone,del_flag,user_id
|
||||
</sql>
|
||||
|
||||
<delete id="delByUserId">
|
||||
delete
|
||||
from fwd_audience_config
|
||||
where user_id = #{user_id}
|
||||
</delete>
|
||||
|
||||
<insert id="batechSave">
|
||||
INSERT INTO fwd_audience_config (
|
||||
status,
|
||||
frequent_id,
|
||||
frequent_name,
|
||||
frequent_no,
|
||||
frequent_phone,
|
||||
del_flag,
|
||||
user_id
|
||||
)
|
||||
VALUES
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(
|
||||
#{item.status},
|
||||
#{item.frequentId},
|
||||
#{item.frequentName},
|
||||
#{item.frequentNo},
|
||||
#{item.frequentPhone},
|
||||
#{item.delFlag},
|
||||
#{item.userId}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<select id="getAudienceByUserId" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
from fwd_audience_config where user_id = #{userId} and status = 1
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.xiang.xservice.fwd.mapper.FwdPerformConfigMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.xiang.xservice.fwd.entity.pojo.FPerformConfig" >
|
||||
<result column="id" property="id"/>
|
||||
<result column="project_id" property="projectId"/>
|
||||
<result column="time" property="time"/>
|
||||
<result column="del_flag" property="delFlag"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id, project_id, time, del_flag
|
||||
</sql>
|
||||
|
||||
<update id="delPerforms">
|
||||
update fwd_perform_config set del_flag = 1 where 1=1
|
||||
</update>
|
||||
|
||||
<insert id="insertPerforms">
|
||||
insert into fwd_perform_config(project_id, time, del_flag)
|
||||
values
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{item.projectId}, #{item.time}, #{item.delFlag})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<select id="getAvailablePerform" resultMap="BaseResultMap">
|
||||
select <include refid="Base_Column_List"/>
|
||||
from fwd_perform_config where del_flag = 0
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,210 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.xiang.xservice.fwd.mapper.FwdPerformProjectInfoMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.xiang.xservice.fwd.entity.pojo.FPerformProjectInfo" >
|
||||
<result column="id" property="id"/>
|
||||
<result column="project_name" property="projectName" />
|
||||
<result column="status" property="status" />
|
||||
<result column="project_source" property="projectSource" />
|
||||
<result column="is_has_seat" property="isHasSeat" />
|
||||
<result column="is_choice_seat" property="isChoiceSeat" />
|
||||
<result column="biz_id" property="bizId" />
|
||||
<result column="project_id" property="projectId" />
|
||||
<result column="tag_name" property="tagName" />
|
||||
<result column="tag_remark" property="tagRemark" />
|
||||
<result column="project_city" property="projectCity" />
|
||||
<result column="short_city" property="shortCity" />
|
||||
<result column="venue_name" property="venueName" />
|
||||
<result column="lowest_price" property="lowestPrice" />
|
||||
<result column="highest_price" property="highestPrice" />
|
||||
<result column="project_price" property="projectPrice" />
|
||||
<result column="project_start_date" property="projectStartDate" />
|
||||
<result column="project_end_date" property="projectEndDate" />
|
||||
<result column="sub_classify_name" property="subClassifyName" />
|
||||
<result column="pre_sale_time" property="preSaleTime"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id, project_name,
|
||||
status,
|
||||
project_source,
|
||||
is_has_seat,
|
||||
is_choice_seat,
|
||||
biz_id,
|
||||
project_id,
|
||||
tag_name,
|
||||
tag_remark,
|
||||
project_city,
|
||||
short_city,
|
||||
venue_name,
|
||||
lowest_price,
|
||||
highest_price,
|
||||
project_price,
|
||||
project_start_date,
|
||||
project_end_date,
|
||||
sub_classify_name,
|
||||
pre_sale_time
|
||||
</sql>
|
||||
|
||||
<insert id="insert" useGeneratedKeys="true" keyColumn="id" keyProperty="id" parameterType="com.xiang.xservice.fwd.entity.pojo.FPerformProjectInfo">
|
||||
INSERT INTO fwd_perform_project_info
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="null != projectName and '' != projectName">
|
||||
project_name,
|
||||
</if>
|
||||
<if test="null != status ">
|
||||
status,
|
||||
</if>
|
||||
<if test="null != projectSource and '' != projectSource">
|
||||
project_source,
|
||||
</if>
|
||||
<if test="null != isHasSeat ">
|
||||
is_has_seat,
|
||||
</if>
|
||||
<if test="null != isChoiceSeat ">
|
||||
is_choice_seat,
|
||||
</if>
|
||||
<if test="null != bizId ">
|
||||
biz_id,
|
||||
</if>
|
||||
<if test="null != projectId ">
|
||||
project_id,
|
||||
</if>
|
||||
<if test="null != tagName and '' != tagName">
|
||||
tag_name,
|
||||
</if>
|
||||
<if test="null != tagRemark and '' != tagRemark">
|
||||
tag_remark,
|
||||
</if>
|
||||
<if test="null != projectCity and '' != projectCity">
|
||||
project_city,
|
||||
</if>
|
||||
<if test="null != shortCity and '' != shortCity">
|
||||
short_city,
|
||||
</if>
|
||||
<if test="null != venueName and '' != venueName">
|
||||
venue_name,
|
||||
</if>
|
||||
<if test="null != lowestPrice ">
|
||||
lowest_price,
|
||||
</if>
|
||||
<if test="null != highestPrice ">
|
||||
highest_price,
|
||||
</if>
|
||||
<if test="null != projectPrice ">
|
||||
project_price,
|
||||
</if>
|
||||
<if test="null != projectStartDate ">
|
||||
project_start_date,
|
||||
</if>
|
||||
<if test="null != projectEndDate ">
|
||||
project_end_date,
|
||||
</if>
|
||||
<if test="null != subClassifyName and '' != subClassifyName">
|
||||
sub_classify_name,
|
||||
</if>
|
||||
<if test="null != preSaleTime">
|
||||
pre_sale_time
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="null != projectName and '' != projectName">
|
||||
#{projectName},
|
||||
</if>
|
||||
<if test="null != status ">
|
||||
#{status},
|
||||
</if>
|
||||
<if test="null != projectSource and '' != projectSource">
|
||||
#{projectSource},
|
||||
</if>
|
||||
<if test="null != isHasSeat ">
|
||||
#{isHasSeat},
|
||||
</if>
|
||||
<if test="null != isChoiceSeat ">
|
||||
#{isChoiceSeat},
|
||||
</if>
|
||||
<if test="null != bizId ">
|
||||
#{bizId},
|
||||
</if>
|
||||
<if test="null != projectId ">
|
||||
#{projectId},
|
||||
</if>
|
||||
<if test="null != tagName and '' != tagName">
|
||||
#{tagName},
|
||||
</if>
|
||||
<if test="null != tagRemark and '' != tagRemark">
|
||||
#{tagRemark},
|
||||
</if>
|
||||
<if test="null != projectCity and '' != projectCity">
|
||||
#{projectCity},
|
||||
</if>
|
||||
<if test="null != shortCity and '' != shortCity">
|
||||
#{shortCity},
|
||||
</if>
|
||||
<if test="null != venueName and '' != venueName">
|
||||
#{venueName},
|
||||
</if>
|
||||
<if test="null != lowestPrice ">
|
||||
#{lowestPrice},
|
||||
</if>
|
||||
<if test="null != highestPrice ">
|
||||
#{highestPrice},
|
||||
</if>
|
||||
<if test="null != projectPrice ">
|
||||
#{projectPrice},
|
||||
</if>
|
||||
<if test="null != projectStartDate ">
|
||||
#{projectStartDate},
|
||||
</if>
|
||||
<if test="null != projectEndDate ">
|
||||
#{projectEndDate},
|
||||
</if>
|
||||
<if test="null != subClassifyName and '' != subClassifyName">
|
||||
#{subClassifyName},
|
||||
</if>
|
||||
<if test="null != preSaleTime">
|
||||
#{preSaleTime}
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="update" parameterType="com.xiang.xservice.fwd.entity.pojo.FPerformProjectInfo">
|
||||
UPDATE fwd_perform_project_info
|
||||
<set>
|
||||
<if test="null != projectName and '' != projectName">project_name = #{projectName},</if>
|
||||
<if test="null != status ">status = #{status},</if>
|
||||
<if test="null != projectSource and '' != projectSource">project_source = #{projectSource},</if>
|
||||
<if test="null != isHasSeat ">is_has_seat = #{isHasSeat},</if>
|
||||
<if test="null != isChoiceSeat ">is_choice_seat = #{isChoiceSeat},</if>
|
||||
<if test="null != bizId ">biz_id = #{bizId},</if>
|
||||
<if test="null != projectId ">project_id = #{projectId},</if>
|
||||
<if test="null != tagName and '' != tagName">tag_name = #{tagName},</if>
|
||||
<if test="null != tagRemark and '' != tagRemark">tag_remark = #{tagRemark},</if>
|
||||
<if test="null != projectCity and '' != projectCity">project_city = #{projectCity},</if>
|
||||
<if test="null != shortCity and '' != shortCity">short_city = #{shortCity},</if>
|
||||
<if test="null != venueName and '' != venueName">venue_name = #{venueName},</if>
|
||||
<if test="null != lowestPrice ">lowest_price = #{lowestPrice},</if>
|
||||
<if test="null != highestPrice ">highest_price = #{highestPrice},</if>
|
||||
<if test="null != projectPrice ">project_price = #{projectPrice},</if>
|
||||
<if test="null != projectStartDate ">project_start_date = #{projectStartDate},</if>
|
||||
<if test="null != projectEndDate ">project_end_date = #{projectEndDate},</if>
|
||||
<if test="null != subClassifyName and '' != subClassifyName">sub_classify_name = #{subClassifyName},</if>
|
||||
<if test="null != preSaleTime">pre_sale_time = #{preSaleTime}</if>
|
||||
</set>
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
<select id="getProjectByProjectId" resultMap="BaseResultMap">
|
||||
select <include refid="Base_Column_List"/>
|
||||
from fwd_perform_project_info
|
||||
where project_id = #{projectId}
|
||||
</select>
|
||||
<select id="getPreSaleTodayData" resultMap="BaseResultMap">
|
||||
select <include refid="Base_Column_List"/>
|
||||
from fwd_perform_project_info
|
||||
where pre_sale_time between #{startTime} and #{endTime} and status = 21
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,292 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.xiang.xservice.fwd.mapper.FwdPerformSeatInfoMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.xiang.xservice.fwd.entity.pojo.FPerformSeatInfo" >
|
||||
<result column="id" property="id"/>
|
||||
<result column="seat_plan_id" property="seatPlanId" />
|
||||
<result column="seat_plan_name" property="seatPlanName" />
|
||||
<result column="perform_id" property="performId" />
|
||||
<result column="perform_name" property="performName" />
|
||||
<result column="stop_sale" property="stopSale" />
|
||||
<result column="shelf_status" property="shelfStatus" />
|
||||
<result column="price" property="price" />
|
||||
<result column="discount_price" property="discountPrice" />
|
||||
<result column="sub_status" property="subStatus" />
|
||||
<result column="quantity" property="quantity" />
|
||||
<result column="status" property="status" />
|
||||
<result column="max_sell_stock" property="maxSellStock" />
|
||||
<result column="sold_stock" property="soldStock" />
|
||||
<result column="left_stock" property="leftStock" />
|
||||
<result column="able_sale_quantity" property="ableSaleQuantity" />
|
||||
<result column="ash_show" property="ashShow" />
|
||||
<result column="ash_show_desc" property="ashShowDesc" />
|
||||
<result column="selectable" property="selectable" />
|
||||
<result column="display" property="display" />
|
||||
<result column="available_ticket_quantity" property="availableTicketQuantity" />
|
||||
<result column="available_all_ticket_quantity" property="availableAllTicketQuantity" />
|
||||
<result column="sale_time" property="saleTime" />
|
||||
<result column="project_id" property="projectId" />
|
||||
<result column="sold_out" property="soldOut"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id, seat_plan_id,
|
||||
seat_plan_name,
|
||||
perform_id,
|
||||
perform_name,
|
||||
stop_sale,
|
||||
shelf_status,
|
||||
price,
|
||||
discount_price,
|
||||
sub_status,
|
||||
quantity,
|
||||
status,
|
||||
max_sell_stock,
|
||||
sold_stock,
|
||||
left_stock,
|
||||
able_sale_quantity,
|
||||
ash_show,
|
||||
ash_show_desc,
|
||||
selectable,
|
||||
display,
|
||||
available_ticket_quantity,
|
||||
available_all_ticket_quantity,
|
||||
sale_time,
|
||||
project_id,
|
||||
sold_out
|
||||
</sql>
|
||||
|
||||
<insert id="insert" useGeneratedKeys="true" keyColumn="id" keyProperty="id" parameterType="com.xiang.xservice.fwd.entity.pojo.FPerformSeatInfo">
|
||||
INSERT INTO fwd_perform_seat_info
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="null != seatPlanId ">
|
||||
seat_plan_id,
|
||||
</if>
|
||||
<if test="null != seatPlanName ">
|
||||
seat_plan_name,
|
||||
</if>
|
||||
<if test="null != performId ">
|
||||
perform_id,
|
||||
</if>
|
||||
<if test="null != performName and '' != performName">
|
||||
perform_name,
|
||||
</if>
|
||||
<if test="null != stopSale ">
|
||||
stop_sale,
|
||||
</if>
|
||||
<if test="null != shelfStatus ">
|
||||
shelf_status,
|
||||
</if>
|
||||
<if test="null != price ">
|
||||
price,
|
||||
</if>
|
||||
<if test="null != discountPrice ">
|
||||
discount_price,
|
||||
</if>
|
||||
<if test="null != subStatus ">
|
||||
sub_status,
|
||||
</if>
|
||||
<if test="null != quantity ">
|
||||
quantity,
|
||||
</if>
|
||||
<if test="null != status ">
|
||||
status,
|
||||
</if>
|
||||
<if test="null != maxSellStock ">
|
||||
max_sell_stock,
|
||||
</if>
|
||||
<if test="null != soldStock ">
|
||||
sold_stock,
|
||||
</if>
|
||||
<if test="null != leftStock ">
|
||||
left_stock,
|
||||
</if>
|
||||
<if test="null != ableSaleQuantity ">
|
||||
able_sale_quantity,
|
||||
</if>
|
||||
<if test="null != ashShow ">
|
||||
ash_show,
|
||||
</if>
|
||||
<if test="null != ashShowDesc ">
|
||||
ash_show_desc,
|
||||
</if>
|
||||
<if test="null != selectable ">
|
||||
selectable,
|
||||
</if>
|
||||
<if test="null != display ">
|
||||
display,
|
||||
</if>
|
||||
<if test="null != availableTicketQuantity ">
|
||||
available_ticket_quantity,
|
||||
</if>
|
||||
<if test="null != availableAllTicketQuantity ">
|
||||
available_all_ticket_quantity,
|
||||
</if>
|
||||
<if test="null != saleTime ">
|
||||
sale_time,
|
||||
</if>
|
||||
<if test="null != projectId ">
|
||||
project_id,
|
||||
</if>
|
||||
<if test="null != soldOut ">
|
||||
sold_out
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="null != seatPlanId ">
|
||||
#{seatPlanId},
|
||||
</if>
|
||||
<if test="null != seatPlanName ">
|
||||
#{seatPlanName},
|
||||
</if>
|
||||
<if test="null != performId ">
|
||||
#{performId},
|
||||
</if>
|
||||
<if test="null != performName and '' != performName">
|
||||
#{performName},
|
||||
</if>
|
||||
<if test="null != stopSale ">
|
||||
#{stopSale},
|
||||
</if>
|
||||
<if test="null != shelfStatus ">
|
||||
#{shelfStatus},
|
||||
</if>
|
||||
<if test="null != price ">
|
||||
#{price},
|
||||
</if>
|
||||
<if test="null != discountPrice ">
|
||||
#{discountPrice},
|
||||
</if>
|
||||
<if test="null != subStatus ">
|
||||
#{subStatus},
|
||||
</if>
|
||||
<if test="null != quantity ">
|
||||
#{quantity},
|
||||
</if>
|
||||
<if test="null != status ">
|
||||
#{status},
|
||||
</if>
|
||||
<if test="null != maxSellStock ">
|
||||
#{maxSellStock},
|
||||
</if>
|
||||
<if test="null != soldStock ">
|
||||
#{soldStock},
|
||||
</if>
|
||||
<if test="null != leftStock ">
|
||||
#{leftStock},
|
||||
</if>
|
||||
<if test="null != ableSaleQuantity ">
|
||||
#{ableSaleQuantity},
|
||||
</if>
|
||||
<if test="null != ashShow ">
|
||||
#{ashShow},
|
||||
</if>
|
||||
<if test="null != ashShowDesc ">
|
||||
#{ashShowDesc},
|
||||
</if>
|
||||
<if test="null != selectable ">
|
||||
#{selectable},
|
||||
</if>
|
||||
<if test="null != display ">
|
||||
#{display},
|
||||
</if>
|
||||
<if test="null != availableTicketQuantity ">
|
||||
#{availableTicketQuantity},
|
||||
</if>
|
||||
<if test="null != availableAllTicketQuantity ">
|
||||
#{availableAllTicketQuantity},
|
||||
</if>
|
||||
<if test="null != saleTime ">
|
||||
#{saleTime},
|
||||
</if>
|
||||
<if test="null != projectId ">
|
||||
#{projectId},
|
||||
</if>
|
||||
<if test="null != soldOut ">
|
||||
#{soldOut},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<insert id="batchSave">
|
||||
INSERT INTO fwd_perform_seat_info
|
||||
(
|
||||
seat_plan_id, seat_plan_name, perform_id, perform_name, stop_sale,
|
||||
shelf_status, price, discount_price, sub_status, quantity,
|
||||
status, max_sell_stock, sold_stock, left_stock, able_sale_quantity,
|
||||
ash_show, ash_show_desc, selectable, display,
|
||||
available_ticket_quantity, available_all_ticket_quantity,
|
||||
sale_time, project_id, sold_out
|
||||
)
|
||||
VALUES
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(
|
||||
#{item.seatPlanId}, #{item.seatPlanName}, #{item.performId}, #{item.performName}, #{item.stopSale},
|
||||
#{item.shelfStatus}, #{item.price}, #{item.discountPrice}, #{item.subStatus}, #{item.quantity},
|
||||
#{item.status}, #{item.maxSellStock}, #{item.soldStock}, #{item.leftStock}, #{item.ableSaleQuantity},
|
||||
#{item.ashShow}, #{item.ashShowDesc}, #{item.selectable}, #{item.display},
|
||||
#{item.availableTicketQuantity}, #{item.availableAllTicketQuantity},
|
||||
#{item.saleTime}, #{item.projectId}, #{item.soldOut}
|
||||
)
|
||||
</foreach>
|
||||
|
||||
</insert>
|
||||
|
||||
|
||||
<update id="update" parameterType="com.xiang.xservice.fwd.entity.pojo.FPerformSeatInfo">
|
||||
UPDATE fwd_perform_seat_info
|
||||
<set>
|
||||
<if test="null != seatPlanId ">seat_plan_id = #{seatPlanId},</if>
|
||||
<if test="null != seatPlanName ">seat_plan_name = #{seatPlanName},</if>
|
||||
<if test="null != performId ">perform_id = #{performId},</if>
|
||||
<if test="null != performName and '' != performName">perform_name = #{performName},</if>
|
||||
<if test="null != stopSale ">stop_sale = #{stopSale},</if>
|
||||
<if test="null != shelfStatus ">shelf_status = #{shelfStatus},</if>
|
||||
<if test="null != price ">price = #{price},</if>
|
||||
<if test="null != discountPrice ">discount_price = #{discountPrice},</if>
|
||||
<if test="null != subStatus ">sub_status = #{subStatus},</if>
|
||||
<if test="null != quantity ">quantity = #{quantity},</if>
|
||||
<if test="null != status ">status = #{status},</if>
|
||||
<if test="null != maxSellStock ">max_sell_stock = #{maxSellStock},</if>
|
||||
<if test="null != soldStock ">sold_stock = #{soldStock},</if>
|
||||
<if test="null != leftStock ">left_stock = #{leftStock},</if>
|
||||
<if test="null != ableSaleQuantity ">able_sale_quantity = #{ableSaleQuantity},</if>
|
||||
<if test="null != ashShow ">ash_show = #{ashShow},</if>
|
||||
<if test="null != ashShowDesc ">ash_show_desc = #{ashShowDesc},</if>
|
||||
<if test="null != selectable ">selectable = #{selectable},</if>
|
||||
<if test="null != display ">display = #{display},</if>
|
||||
<if test="null != availableTicketQuantity ">available_ticket_quantity = #{availableTicketQuantity},</if>
|
||||
<if test="null != availableAllTicketQuantity ">available_all_ticket_quantity = #{availableAllTicketQuantity},</if>
|
||||
<if test="null != saleTime ">sale_time = #{saleTime},</if>
|
||||
<if test="null != projectId ">project_id = #{projectId},</if>
|
||||
<if test="null != soldOut">sold_out = #{soldOut}</if>
|
||||
</set>
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
<select id="getPerformSeatInfoBySeatIds" resultMap="BaseResultMap">
|
||||
select <include refid="Base_Column_List"/>
|
||||
from fwd_perform_seat_info
|
||||
where seat_plan_id in
|
||||
<foreach collection="list" item="item" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
<select id="getPerformSeatInfoBySeatIdAndPerformIdAndProjectId"
|
||||
resultMap="BaseResultMap">
|
||||
select <include refid="Base_Column_List"/>
|
||||
from fwd_perform_seat_info
|
||||
where seat_plan_id = #{seatId} and perform_id = #{performId} and project_id = #{projectId}
|
||||
</select>
|
||||
<select id="getPerformSeatByProjectId" resultMap="BaseResultMap">
|
||||
select <include refid="Base_Column_List"/>
|
||||
from fwd_perform_seat_info
|
||||
where project_id = #{projectId} and sold_out = 0
|
||||
</select>
|
||||
<select id="getBySeatPlanId" resultMap="BaseResultMap">
|
||||
select <include refid="Base_Column_List"/>
|
||||
from fwd_perform_seat_info
|
||||
where seat_plan_id = #{id}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
34
script/src/main/resources/mapper/fwd/FwdUserConfigMapper.xml
Normal file
34
script/src/main/resources/mapper/fwd/FwdUserConfigMapper.xml
Normal file
@@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.xiang.xservice.fwd.mapper.FwdUserConfigMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.xiang.xservice.fwd.entity.pojo.FUserConfig" >
|
||||
<result column="id" property="id"/>
|
||||
<result column="name" property="name"/>
|
||||
<result column="token" property="token"/>
|
||||
<result column="status" property="status"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id, name, token, status
|
||||
</sql>
|
||||
<insert id="insert" keyProperty="id" useGeneratedKeys="true" parameterType="com.xiang.xservice.fwd.entity.pojo.FUserConfig" keyColumn="id">
|
||||
insert into fwd_user_config (name, token, status) values (#{name}, #{token}, #{status});
|
||||
</insert>
|
||||
<update id="updateTokenByName">
|
||||
update fwd_user_config set token = #{token} where name = #{name}
|
||||
</update>
|
||||
|
||||
|
||||
<select id="getAvailableUser" resultMap="BaseResultMap">
|
||||
select <include refid="Base_Column_List"/>
|
||||
from fwd_user_config where status = 1
|
||||
</select>
|
||||
|
||||
<select id="getUserByName" resultMap="BaseResultMap">
|
||||
select <include refid="Base_Column_List"/>
|
||||
from fwd_user_config where status = 1 and name = #{name}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user