Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
promotion-common
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
promotion
promotion-common
Commits
0fe5fc7a
提交
0fe5fc7a
authored
2月 06, 2025
作者:
李秋林
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
根据url中地址将文件保存到本地工具;新增返回报错信息;
上级
8f7792ad
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
50 行增加
和
2 行删除
+50
-2
FileUtils.java
...java/com/wangxiaolu/promotion/common/excel/FileUtils.java
+29
-0
RedisKeys.java
...java/com/wangxiaolu/promotion/common/redis/RedisKeys.java
+9
-0
RedisCache.java
...wangxiaolu/promotion/common/redis/service/RedisCache.java
+3
-2
DataException.java
...ava/com/wangxiaolu/promotion/exception/DataException.java
+5
-0
RCode.java
.../java/com/wangxiaolu/promotion/result/basedata/RCode.java
+4
-0
没有找到文件。
src/main/java/com/wangxiaolu/promotion/common/excel/FileUtils.java
0 → 100644
浏览文件 @
0fe5fc7a
package
com
.
wangxiaolu
.
promotion
.
common
.
excel
;
import
java.io.FileOutputStream
;
import
java.io.InputStream
;
import
java.net.URL
;
import
java.net.URLConnection
;
/**
* @author : liqiulin
* @date : 2025-01-21 14
* @describe :
*/
public
class
FileUtils
{
public
static
void
downloadExcel
(
String
urlS
,
String
filePath
)
throws
Exception
{
// 保存文件
URL
url
=
new
URL
(
urlS
);
URLConnection
urlConnection
=
url
.
openConnection
();
InputStream
inputStream
=
urlConnection
.
getInputStream
();
FileOutputStream
fileOutputStream
=
new
FileOutputStream
(
filePath
);
// 调大小
byte
[]
buffer
=
new
byte
[
102400
];
int
bytesRead
;
while
((
bytesRead
=
inputStream
.
read
(
buffer
))
!=
-
1
)
{
fileOutputStream
.
write
(
buffer
,
0
,
bytesRead
);
}
fileOutputStream
.
close
();
inputStream
.
close
();
}
}
src/main/java/com/wangxiaolu/promotion/common/redis/RedisKeys.java
浏览文件 @
0fe5fc7a
...
@@ -58,4 +58,13 @@ public interface RedisKeys {
...
@@ -58,4 +58,13 @@ public interface RedisKeys {
String
key
;
String
key
;
}
}
@AllArgsConstructor
@Getter
enum
Manage
{
ACTIVITY_PLAN_UP
(
"prom:manage:activity_plan_up:"
),
;
String
key
;
}
}
}
src/main/java/com/wangxiaolu/promotion/common/redis/service/RedisCache.java
浏览文件 @
0fe5fc7a
...
@@ -3,9 +3,7 @@ package com.wangxiaolu.promotion.common.redis.service;
...
@@ -3,9 +3,7 @@ package com.wangxiaolu.promotion.common.redis.service;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.redis.core.HashOperations
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.data.redis.core.SetOperations
;
import
org.springframework.data.redis.core.ValueOperations
;
import
org.springframework.data.redis.core.ValueOperations
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
...
@@ -127,6 +125,9 @@ public class RedisCache {
...
@@ -127,6 +125,9 @@ public class RedisCache {
redisTemplate
.
delete
(
keys
);
redisTemplate
.
delete
(
keys
);
}
}
public
boolean
hasKey
(
String
key
)
{
return
redisTemplate
.
hasKey
(
key
);
}
private
String
valToJson
(
Object
o
)
{
private
String
valToJson
(
Object
o
)
{
...
...
src/main/java/com/wangxiaolu/promotion/exception/DataException.java
浏览文件 @
0fe5fc7a
...
@@ -35,5 +35,10 @@ public class DataException extends RuntimeException {
...
@@ -35,5 +35,10 @@ public class DataException extends RuntimeException {
this
.
msg
=
RCode
.
API_ERROR
.
getMsg
();
this
.
msg
=
RCode
.
API_ERROR
.
getMsg
();
}
}
public
DataException
(
StatusCode
statusCode
,
Object
...
args
)
{
this
.
code
=
statusCode
.
getCode
();
this
.
msg
=
String
.
format
(
statusCode
.
getMsg
(),
args
);
}
}
}
src/main/java/com/wangxiaolu/promotion/result/basedata/RCode.java
浏览文件 @
0fe5fc7a
...
@@ -18,6 +18,7 @@ public enum RCode implements StatusCode {
...
@@ -18,6 +18,7 @@ public enum RCode implements StatusCode {
PARAM_ERROR
(
1002
,
"参数错误"
),
PARAM_ERROR
(
1002
,
"参数错误"
),
RESPONSE_PACK_ERROR
(
1003
,
"包装R失败"
),
RESPONSE_PACK_ERROR
(
1003
,
"包装R失败"
),
SELECT_PARAMS_ERROR
(
1004
,
"查询条件错误"
),
SELECT_PARAMS_ERROR
(
1004
,
"查询条件错误"
),
REDIS_PUSH_DATA_NOT_EXIT
(
1005
,
"数据已过期或不存在,请重复上传;"
),
/**
/**
* 业务统一编码(不分模块)
* 业务统一编码(不分模块)
...
@@ -95,6 +96,9 @@ public enum RCode implements StatusCode {
...
@@ -95,6 +96,9 @@ public enum RCode implements StatusCode {
*/
*/
ACTIVITY_PLAN_MONTH_HAS
(
5000
,
"本月活动计划已上传,请删除后再次上传"
),
ACTIVITY_PLAN_MONTH_HAS
(
5000
,
"本月活动计划已上传,请删除后再次上传"
),
ACTIVITY_PLAN_FILENAME_LONG
(
5001
,
"文件名过长,请少于20个字"
),
ACTIVITY_PLAN_FILENAME_LONG
(
5001
,
"文件名过长,请少于20个字"
),
ACTIVITY_PLAN_CELL_NOT_NULL
(
5002
,
"第%s行有空值,请改正后再次提交;"
),
ACTIVITY_PLAN_TEM_ERROR
(
5003
,
"当前流程模板错误;"
),
ACTIVITY_PLAN_REPETITION_ERROR
(
5004
,
"本次上传的活动或系统已存在的活动,有日期重复的计划;"
),
/**
/**
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论