gongfuzhu 1 жил өмнө
parent
commit
31b984381d

+ 153 - 0
SpringBatchServiceClient/src/main/java/com/zswl/cloud/springBatch/cline/model/request/CreateOrder2Request.java

@@ -0,0 +1,153 @@
+package com.zswl.cloud.springBatch.cline.model.request;
+
+import java.time.OffsetDateTime;
+
+/**
+ * TicketOrderChannelCreate2Dto,渠道下单
+ */
+public class CreateOrder2Request {
+    /**
+     * 有票票分配的appId
+     */
+    private String appId;
+    /**
+     * 影院地址
+     */
+    private String cinemaAddress;
+    /**
+     * 影院编码
+     */
+    private String cinemaCode;
+    /**
+     * 影院名称
+     */
+    private String cinemaName;
+    /**
+     * 城市名称
+     */
+    private String cityName;
+    /**
+     * 快速票
+     */
+    private Boolean fastTicket;
+    /**
+     * 影厅名称
+     */
+    private String hallName;
+    /**
+     * 是否情侣座(true/false)
+     */
+    private Boolean loveSeat;
+    /**
+     * 影片编码
+     */
+    private String movieCode;
+    /**
+     * 影片名称
+     */
+    private String movieName;
+    /**
+     * 影票类型(2D/ 3D)
+     */
+    private String movieVersion;
+    /**
+     * 第三方订单号
+     */
+    private String orderId;
+    private Long orderPayMode;
+    /**
+     * 原票价单价
+     */
+    private Double originPrice;
+    /**
+     * 影片海报图
+     */
+    private String postImageUrl;
+    /**
+     * 座位名称(多个用逗号分隔)
+     */
+    private String seatNames;
+    /**
+     * 开场时间
+     */
+    private OffsetDateTime sessionBeginTime;
+    /**
+     * 结束时间
+     */
+    private OffsetDateTime sessionEndTime;
+    /**
+     * 是否可调座
+     */
+    private boolean switchSeat;
+    /**
+     * 是否是测试订单(测试订单不会真实出票,请联系测试人员模拟出票、退款等)
+     */
+    private Boolean test;
+    /**
+     * 用户手机号
+     */
+    private String userMobile;
+
+    public String getAppId() { return appId; }
+    public void setAppId(String value) { this.appId = value; }
+
+    public String getCinemaAddress() { return cinemaAddress; }
+    public void setCinemaAddress(String value) { this.cinemaAddress = value; }
+
+    public String getCinemaCode() { return cinemaCode; }
+    public void setCinemaCode(String value) { this.cinemaCode = value; }
+
+    public String getCinemaName() { return cinemaName; }
+    public void setCinemaName(String value) { this.cinemaName = value; }
+
+    public String getCityName() { return cityName; }
+    public void setCityName(String value) { this.cityName = value; }
+
+    public Boolean getFastTicket() { return fastTicket; }
+    public void setFastTicket(Boolean value) { this.fastTicket = value; }
+
+    public String getHallName() { return hallName; }
+    public void setHallName(String value) { this.hallName = value; }
+
+    public Boolean getLoveSeat() { return loveSeat; }
+    public void setLoveSeat(Boolean value) { this.loveSeat = value; }
+
+    public String getMovieCode() { return movieCode; }
+    public void setMovieCode(String value) { this.movieCode = value; }
+
+    public String getMovieName() { return movieName; }
+    public void setMovieName(String value) { this.movieName = value; }
+
+    public String getMovieVersion() { return movieVersion; }
+    public void setMovieVersion(String value) { this.movieVersion = value; }
+
+    public String getOrderId() { return orderId; }
+    public void setOrderId(String value) { this.orderId = value; }
+
+    public Long getOrderPayMode() { return orderPayMode; }
+    public void setOrderPayMode(Long value) { this.orderPayMode = value; }
+
+    public Double getOriginPrice() { return originPrice; }
+    public void setOriginPrice(Double value) { this.originPrice = value; }
+
+    public String getPostImageUrl() { return postImageUrl; }
+    public void setPostImageUrl(String value) { this.postImageUrl = value; }
+
+    public String getSeatNames() { return seatNames; }
+    public void setSeatNames(String value) { this.seatNames = value; }
+
+    public OffsetDateTime getSessionBeginTime() { return sessionBeginTime; }
+    public void setSessionBeginTime(OffsetDateTime value) { this.sessionBeginTime = value; }
+
+    public OffsetDateTime getSessionEndTime() { return sessionEndTime; }
+    public void setSessionEndTime(OffsetDateTime value) { this.sessionEndTime = value; }
+
+    public boolean getSwitchSeat() { return switchSeat; }
+    public void setSwitchSeat(boolean value) { this.switchSeat = value; }
+
+    public Boolean getTest() { return test; }
+    public void setTest(Boolean value) { this.test = value; }
+
+    public String getUserMobile() { return userMobile; }
+    public void setUserMobile(String value) { this.userMobile = value; }
+}

+ 184 - 0
SpringBatchServiceClient/src/main/java/com/zswl/cloud/springBatch/cline/model/request/CreateOrdereRquest.java

@@ -0,0 +1,184 @@
+package com.zswl.cloud.springBatch.cline.model.request;
+
+import java.time.OffsetDateTime;
+
+/**
+ * TicketOrderChannelCreateDto,渠道下单
+ */
+public class CreateOrdereRquest {
+    /**
+     * 应用AppId
+     */
+    private String appId;
+    /**
+     * 观众列表ID,用,分隔
+     */
+    private String audience;
+    /**
+     * 购买模式:0优惠购票 1原价票
+     */
+    private Long buyModel;
+    /**
+     * 影院地址
+     */
+    private String cinemaAddress;
+    /**
+     * 影院编码
+     */
+    private String cinemaCode;
+    /**
+     * 影院ID
+     */
+    private String cinemaId;
+    /**
+     * 影院经度
+     */
+    private Double cinemaLat;
+    /**
+     * 影院纬度
+     */
+    private Double cinemaLng;
+    /**
+     * 影院名称
+     */
+    private String cinemaName;
+    /**
+     * 城市ID
+     */
+    private String cityId;
+    /**
+     * 城市名称
+     */
+    private String cityName;
+    /**
+     * 自定义参数
+     */
+    private String entPara;
+    /**
+     * 影厅名称
+     */
+    private String hallName;
+    /**
+     * 电影编码
+     */
+    private String movieCode;
+    /**
+     * 电影ID
+     */
+    private String movieId;
+    /**
+     * 电影名称
+     */
+    private String movieName;
+    /**
+     * 影票类型(英语 3D)
+     */
+    private String movieVersion;
+    /**
+     * 座位id,多个座位用逗号分隔
+     */
+    private String originalSeatIds;
+    /**
+     * 电影海报地址
+     */
+    private String postImageUrl;
+    /**
+     * 座位名称(多个用逗号分隔)
+     */
+    private String seatNames;
+    /**
+     * 开场时间
+     */
+    private OffsetDateTime sessionBeginTime;
+    /**
+     * 结束时间
+     */
+    private OffsetDateTime sessionEndTime;
+    /**
+     * 场次ID
+     */
+    private String sessionId;
+    /**
+     * 票源id
+     */
+    private String sourceId;
+    /**
+     * 用户手机号
+     */
+    private String userMobile;
+
+    public String getAppId() { return appId; }
+    public void setAppId(String value) { this.appId = value; }
+
+    public String getAudience() { return audience; }
+    public void setAudience(String value) { this.audience = value; }
+
+    public Long getBuyModel() { return buyModel; }
+    public void setBuyModel(Long value) { this.buyModel = value; }
+
+    public String getCinemaAddress() { return cinemaAddress; }
+    public void setCinemaAddress(String value) { this.cinemaAddress = value; }
+
+    public String getCinemaCode() { return cinemaCode; }
+    public void setCinemaCode(String value) { this.cinemaCode = value; }
+
+    public String getCinemaId() { return cinemaId; }
+    public void setCinemaId(String value) { this.cinemaId = value; }
+
+    public Double getCinemaLat() { return cinemaLat; }
+    public void setCinemaLat(Double value) { this.cinemaLat = value; }
+
+    public Double getCinemaLng() { return cinemaLng; }
+    public void setCinemaLng(Double value) { this.cinemaLng = value; }
+
+    public String getCinemaName() { return cinemaName; }
+    public void setCinemaName(String value) { this.cinemaName = value; }
+
+    public String getCityId() { return cityId; }
+    public void setCityId(String value) { this.cityId = value; }
+
+    public String getCityName() { return cityName; }
+    public void setCityName(String value) { this.cityName = value; }
+
+    public String getEntPara() { return entPara; }
+    public void setEntPara(String value) { this.entPara = value; }
+
+    public String getHallName() { return hallName; }
+    public void setHallName(String value) { this.hallName = value; }
+
+    public String getMovieCode() { return movieCode; }
+    public void setMovieCode(String value) { this.movieCode = value; }
+
+    public String getMovieId() { return movieId; }
+    public void setMovieId(String value) { this.movieId = value; }
+
+    public String getMovieName() { return movieName; }
+    public void setMovieName(String value) { this.movieName = value; }
+
+    public String getMovieVersion() { return movieVersion; }
+    public void setMovieVersion(String value) { this.movieVersion = value; }
+
+    public String getOriginalSeatIds() { return originalSeatIds; }
+    public void setOriginalSeatIds(String value) { this.originalSeatIds = value; }
+
+    public String getPostImageUrl() { return postImageUrl; }
+    public void setPostImageUrl(String value) { this.postImageUrl = value; }
+
+    public String getSeatNames() { return seatNames; }
+    public void setSeatNames(String value) { this.seatNames = value; }
+
+    public OffsetDateTime getSessionBeginTime() { return sessionBeginTime; }
+    public void setSessionBeginTime(OffsetDateTime value) { this.sessionBeginTime = value; }
+
+    public OffsetDateTime getSessionEndTime() { return sessionEndTime; }
+    public void setSessionEndTime(OffsetDateTime value) { this.sessionEndTime = value; }
+
+    public String getSessionId() { return sessionId; }
+    public void setSessionId(String value) { this.sessionId = value; }
+
+    public String getSourceId() { return sourceId; }
+    public void setSourceId(String value) { this.sourceId = value; }
+
+    public String getUserMobile() { return userMobile; }
+    public void setUserMobile(String value) { this.userMobile = value; }
+}

+ 63 - 0
SpringBatchServiceClient/src/main/java/com/zswl/cloud/springBatch/cline/model/request/OrderListRequest.java

@@ -0,0 +1,63 @@
+package com.zswl.cloud.springBatch.cline.model.request;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.time.OffsetDateTime;
+import java.util.List;
+
+/**
+ * MovieOrderQuery
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class OrderListRequest {
+    /**
+     * appid
+     */
+    private String appId;
+    /**
+     * appid
+     */
+    private List<String> appIds;
+    /**
+     * 影院
+     */
+    private String cinemaName;
+    /**
+     * 城市
+     */
+    private String cityName;
+    /**
+     * 截至时间
+     */
+    private OffsetDateTime endTime;
+    /**
+     * 渠道订单id
+     */
+    private String entOrderId;
+    private Boolean exportExcel;
+    /**
+     * 电影名称
+     */
+    private String movieName;
+    /**
+     * 订单号
+     */
+    private String orderCustomId;
+    private Long orderState;
+    private Long pageIndex;
+    private Long pageSize;
+    /**
+     * 查询类型:1 创建时间,2 支付时间,(需要同时传时间段)
+     */
+    private Long queryType;
+    /**
+     * 起始时间
+     */
+    private OffsetDateTime startTime;
+
+
+}

+ 6 - 0
SpringBatchServiceServer/pom.xml

@@ -81,6 +81,12 @@
             <version>${project.version}</version>
         </dependency>
 
+        <dependency>
+            <groupId>com.github.microservice.components</groupId>
+            <artifactId>RedisData</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
     </dependencies>
 
     <build>

+ 281 - 0
SpringBatchServiceServer/src/main/java/com/zswl/cloud/springBtach/server/core/api/ypp/YppApi.java

@@ -0,0 +1,281 @@
+package com.zswl.cloud.springBtach.server.core.api.ypp;
+
+import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.http.HttpRequest;
+import cn.hutool.http.HttpResponse;
+import cn.hutool.http.HttpUtil;
+import cn.hutool.json.JSONObject;
+import cn.hutool.json.JSONUtil;
+import com.zswl.cloud.springBatch.cline.model.request.CreateOrder2Request;
+import com.zswl.cloud.springBatch.cline.model.request.CreateOrdereRquest;
+import com.zswl.cloud.springBatch.cline.model.request.OrderListRequest;
+import com.zswl.cloud.springBtach.server.core.helper.RedisHelper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+import org.springframework.util.Assert;
+
+import java.util.HashMap;
+
+//接口地址 https://apifox.com/apidoc/shared-48c64918-c4ce-49f4-b846-d23855299d7a/doc-2590155
+@Component
+public class YppApi {
+
+    @Autowired
+    RedisHelper redisHelper;
+
+
+    @Value("${ypp.entId}")
+    private String entId;
+
+    @Value("${ypp.appSecret}")
+    private String appSecret;
+
+    private final String tokenName = "ypp-token";
+    private final String tokenValue = "Bearer ";
+
+
+    /**
+     * 订单简要信息(字段较简洁,用于发起订单支付)
+     *
+     * @param orderId
+     * @return
+     */
+    public JSONObject order_detail(String orderId) {
+        JSONObject entries = httpGet("https://channel.youpiaopiao.cn/api/movie/order_detail?id=" + orderId);
+        return entries;
+
+    }
+
+    /**
+     * 支付订单(支付成功后调用)
+     *
+     * @param orderId
+     * @param mobile
+     * @return
+     */
+    public JSONObject pay_order(String orderId, String mobile) {
+        JSONObject entries = httpGet("https://channel.youpiaopiao.cn/api/movie/pay_order?id=" + orderId + "&test=&mobile=" + mobile);
+        return entries;
+
+    }
+
+    /**
+     * 订单列表
+     *
+     * @param orderListRequest
+     * @return
+     */
+    public JSONObject order_list(OrderListRequest orderListRequest) {
+        JSONObject entries = httpPost("https://channel.youpiaopiao.cn/api/movie/list", orderListRequest);
+        return entries;
+
+    }
+
+    /**
+     * 订单详情
+     *
+     * @param orderId
+     * @return
+     */
+    public JSONObject get_order(String orderId) {
+        JSONObject entries = httpGet("https://channel.youpiaopiao.cn/api/movie/get_order?id=" + orderId);
+        return entries;
+
+    }
+
+    /**
+     * 创建订单 价格跟随有票票
+     *
+     * @param createOrdereRquest
+     * @return
+     */
+    public JSONObject create_order(CreateOrdereRquest createOrdereRquest) {
+        JSONObject entries = httpPost("https://channel.youpiaopiao.cn/api/movie/create_order", createOrdereRquest);
+        return entries;
+
+    }
+
+    /**
+     * 创建订单自定义价格
+     *
+     * @param createOrder2Request
+     * @return
+     */
+    public JSONObject create_order2(CreateOrder2Request createOrder2Request) {
+        JSONObject entries = httpPost("https://channel.youpiaopiao.cn/api/movie/create_order2", createOrder2Request);
+        return entries;
+
+    }
+
+    /**
+     * 热映电影(pageIndex从0开始)
+     *
+     * @param
+     * @return
+     */
+    public JSONObject movies(String cityId, String pageIndex, String pageSize) {
+        JSONObject entries = httpGet("https://channel.youpiaopiao.cn/api/movie/movies?cityId=" + cityId + "&pageIndex=" + pageIndex + "&pageSize" + pageSize);
+        return entries;
+
+    }
+
+    /**
+     * 即将上映电影
+     *
+     * @param cityId
+     * @return
+     */
+    public JSONObject coming_movies(String cityId) {
+        JSONObject entries = httpGet("https://channel.youpiaopiao.cn/api/movie/coming_movies?cityId=" + cityId);
+        return entries;
+
+    }
+
+    /**
+     * 获取电影详情
+     *
+     * @param movieId
+     * @return
+     */
+    public JSONObject movie_detail(String movieId) {
+        JSONObject entries = httpGet("https://channel.youpiaopiao.cn/api/movie/movie_detail?movieId=" + movieId);
+        return entries;
+
+    }
+
+    /**
+     * 获取电影的影院列表
+     *
+     * @param movieId
+     * @return
+     */
+    public JSONObject movie_cinemas(String cityId, String movieId) {
+        JSONObject entries = httpGet("https://channel.youpiaopiao.cn/api/movie/movie_cinemas?cityId=" + cityId + "&movieId=" + movieId);
+        return entries;
+
+    }
+
+    /**
+     * 获取影院列表
+     *
+     * @param cityId
+     * @param districtId
+     * @param brandId
+     * @param lat
+     * @param lng
+     * @return
+     */
+
+    public JSONObject cinemas(String cityId, String districtId, String brandId, String lat, String lng) {
+        JSONObject entries = httpGet("https://channel.youpiaopiao.cn/api/movie/cinemas?cityId=" + cityId + "&districtId=" + districtId + "&brandId=" + brandId + "&lat=" + lat + brandId + "&lng=" + lng);
+        return entries;
+
+    }
+
+    /**
+     * 获取影院过滤列表
+     *
+     * @param cityId
+     * @return
+     */
+    public JSONObject cinema_filter(String cityId) {
+        JSONObject entries = httpGet("https://channel.youpiaopiao.cn/api/movie/cinema_filter?cityId=" + cityId);
+        return entries;
+
+    }
+
+    /**
+     * 获取城市列表
+     *
+     * @return
+     */
+    public JSONObject get_citys() {
+        JSONObject entries = httpGet("https://channel.youpiaopiao.cn/api/movie/get_citys");
+        return entries;
+
+    }
+
+
+    /**
+     * 获取影院某个电影的排片列表
+     *
+     * @param movieId
+     * @param cinemaId
+     * @param currentMovieId
+     * @return
+     */
+    public JSONObject cinema_shows(String movieId, String cinemaId, String currentMovieId) {
+        JSONObject entries = httpGet("https://channel.youpiaopiao.cn/api/movie/cinema_shows?cinemaId=cinemaId" + cinemaId + "&movieId=" + movieId + "&currentMovieId=" + currentMovieId);
+        return entries;
+    }
+
+    /**
+     * 获取电影场次(座位)详情
+     *
+     * @param sessionId
+     * @param cinemaId
+     * @param movieId
+     * @param sid
+     * @return
+     */
+    public JSONObject session(String sessionId, String cinemaId, String movieId, String sid) {
+        JSONObject entries = httpGet("https://channel.youpiaopiao.cn/api/movie/session?sessionId=" + sessionId + "&cinemaId=" + cinemaId + "&movieId=" + movieId + "&sid=" + sid);
+        return entries;
+    }
+
+    /**
+     * 获取广告列表
+     *
+     * @return
+     */
+    public JSONObject ad_configs() {
+        JSONObject entries = httpGet("https://channel.youpiaopiao.cn/api/movie/ad_configs");
+        return entries;
+    }
+
+    private JSONObject httpGet(String url) {
+        String token = getoken();
+        HttpRequest get = HttpUtil.createGet(url);
+        HttpResponse execute = get.header("Authorization", token).execute();
+        String body = execute.body();
+        JSONObject entries = JSONUtil.parseObj(body);
+        Integer code = (Integer) entries.get("code");
+        Assert.isTrue(execute.isOk(), "飘飘响应错误");
+        Assert.isTrue(code.equals(0), String.valueOf(entries.get("message")));
+        return JSONUtil.parseObj(body);
+
+    }
+
+    private JSONObject httpPost(String url, Object body) {
+
+        HttpRequest post = HttpUtil.createPost(url);
+        if (!url.contains("api/oauth/token")) {
+            String token = getoken();
+            post.header("Authorization", token);
+        }
+        HttpResponse execute = post.body(JSONUtil.toJsonStr(body)).execute();
+        String response = execute.body();
+        JSONObject entries = JSONUtil.parseObj(response);
+        Integer code = (Integer) entries.get("code");
+        Assert.isTrue(execute.isOk(), "票票响应错误");
+        Assert.isTrue(code.equals(0), String.valueOf(entries.get("message")));
+        return entries;
+    }
+
+    private String getoken() {
+        Object value = redisHelper.getValue(tokenName);
+        if (!ObjectUtil.isEmpty(value)) {
+            return String.valueOf(value);
+        }
+        HashMap<String, String> para = new HashMap<>();
+        para.put("entId", entId);
+        para.put("appSecret", appSecret);
+        JSONObject http = httpPost("https://channel.youpiaopiao.cn/api/oauth/token", para);
+        String access_token = (String) http.getByPath("data.access_token");
+        String token = tokenValue + access_token;
+        redisHelper.cacheValue(tokenName, token, 82800);
+        return token;
+    }
+
+}

+ 26 - 0
SpringBatchServiceServer/src/main/java/com/zswl/cloud/springBtach/server/core/config/RedisConfig.java

@@ -0,0 +1,26 @@
+package com.zswl.cloud.springBtach.server.core.config;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.data.redis.connection.RedisConnectionFactory;
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.data.redis.serializer.StringRedisSerializer;
+
+@Configuration
+public class RedisConfig {
+    /**
+     * 自定义Key为String类型Value为Object类型的Redis操作模板
+     */
+    @Bean(name = "redisTemplate")
+    public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory redisConnectionFactory){
+        RedisTemplate<String, Object> redisTemplate = new RedisTemplate<>();
+        redisTemplate.setConnectionFactory(redisConnectionFactory);
+
+        // key采用String的序列化方式
+        redisTemplate.setKeySerializer(new StringRedisSerializer());
+        // hash的key也采用String的序列化方式
+        redisTemplate.setHashKeySerializer(new StringRedisSerializer());
+ 
+        return redisTemplate;
+    }
+}

+ 110 - 0
SpringBatchServiceServer/src/main/java/com/zswl/cloud/springBtach/server/core/helper/RedisHelper.java

@@ -0,0 +1,110 @@
+package com.zswl.cloud.springBtach.server.core.helper;
+
+import lombok.extern.log4j.Log4j2;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.data.redis.core.ValueOperations;
+import org.springframework.stereotype.Component;
+
+import java.util.Set;
+import java.util.concurrent.TimeUnit;
+
+@Component
+@Log4j2
+public class RedisHelper {
+
+    @Autowired
+    RedisTemplate<String, Object> redisTemplate;
+
+
+
+    public boolean cacheValue(String key, Object value, long time) {
+        try {
+            ValueOperations<String, Object> valueOperations = redisTemplate.opsForValue();
+            valueOperations.set(key, value);
+            if (time > 0) {
+                // 如果有设置超时时间的话
+                redisTemplate.expire(key, time, TimeUnit.SECONDS);
+            }
+            return true;
+        } catch (Throwable e) {
+            log.error("缓存[" + key + "]失败, value[" + value + "] " + e.getMessage());
+        }
+        return false;
+    }
+
+    /**
+     * 缓存value,没有设置超时时间
+     *
+     * @param key
+     * @param value
+     * @return
+     */
+    public boolean cacheValue(String key, Object value) {
+        return cacheValue(key, value, -1);
+    }
+
+    /**
+     * 判断缓存是否存在
+     *
+     * @param key
+     * @return
+     */
+    public boolean containsKey(String key) {
+        try {
+            return redisTemplate.hasKey(key);
+        } catch (Throwable e) {
+            log.error("判断缓存是否存在时失败key[" + key + "]", "err[" + e.getMessage() + "]");
+        }
+        return false;
+    }
+
+    /**
+     * 根据key,获取缓存
+     *
+     * @param key
+     * @return
+     */
+    public Object getValue(String key) {
+        try {
+            ValueOperations<String, Object> valueOperations = redisTemplate.opsForValue();
+            return valueOperations.get(key);
+        } catch (Throwable e) {
+            log.error("获取缓存时失败key[" + key + "]", "err[" + e.getMessage() + "]");
+        }
+        return null;
+    }
+
+    /**
+     * 移除缓存
+     *
+     * @param key
+     * @return
+     */
+    public boolean removeValue(String key) {
+        try {
+            redisTemplate.delete(key);
+            return true;
+        } catch (Throwable e) {
+            log.error("移除缓存时失败key[" + key + "]", "err[" + e.getMessage() + "]");
+        }
+        return false;
+    }
+
+    /**
+     * 根据前缀移除所有以传入前缀开头的key-value
+     *
+     * @param pattern
+     * @return
+     */
+    public boolean removeKeys(String pattern) {
+        try {
+            Set<String> keySet = redisTemplate.keys(pattern + "*");
+            redisTemplate.delete(keySet);
+            return true;
+        } catch (Throwable e) {
+            log.error("移除key[" + pattern + "]前缀的缓存时失败", "err[" + e.getMessage() + "]");
+        }
+        return false;
+    }
+}

+ 9 - 0
SpringBatchServiceServer/src/main/resources/application-dev.yml

@@ -18,6 +18,11 @@ spring:
       #      mode: always
       mode: never
 
+  redis:
+    host: 192.168.110.241
+    port: 6379
+    database: 5
+
 swagger:
   packageName: "com.zswl.cloud.springBatch.server.core.controller"
   title: "中数未来"
@@ -25,6 +30,10 @@ swagger:
   version: "1.0"
   enable: true
 
+ypp:
+  entId: 101206
+  appSecret: VqJfaVYc87wDKk8Gad4yAx9v8TFNhrt0
+
 
 #logging:
 #  level: