Skip to content
切换导航面板
项目
群组
代码片段
帮助
zhangtai
/
zzhnc
当前项目
正在载入...
登录
切换导航面板
转到一个项目
项目
版本库
问题
0
合并请求
0
流水线
维基
设置
活动
图像
图表
创建新的问题
作业
提交
问题看板
文件
提交
分支
标签
贡献者
图像
比较
图表
Commit 7b7ee99d
由
沈姿.前端(已离职)
编写于
Jan 03, 2018
浏览文件
选项
浏览文件
标签
下载
差异文件
Merge branch 'master' of
http://120.76.158.63:18080/zhangtai/zzhnc
2 个父辈
405f2542
980ac755
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
103 行增加
和
106 行删除
src/com/w1hd/zzhnc/model/Lotterylog.java
src/com/w1hd/zzhnc/service/ActivityService.java
src/com/w1hd/zzhnc/service/AutoreplyService.java
src/com/w1hd/zzhnc/service/PrizeService.java
src/com/w1hd/zzhnc/model/Lotterylog.java
查看文件 @
7b7ee99
...
...
@@ -6,7 +6,7 @@ import java.util.Date;
import
javax.persistence.Id
;
public
class
Lotterylog
implements
Serializable
{
public
class
Lotterylog
implements
Serializable
{
/**
*
*/
...
...
@@ -18,13 +18,13 @@ public class Lotterylog implements Serializable{
private
BigDecimal
mny
;
private
Integer
status
;
private
Integer
turn
;
private
Integer
prizeId
;
private
Date
createdtime
;
public
Integer
getId
()
{
return
id
;
}
public
String
getPrizeName
()
{
return
prizeName
;
}
...
...
@@ -33,7 +33,6 @@ public class Lotterylog implements Serializable{
this
.
prizeName
=
prizeName
;
}
public
void
setId
(
Integer
id
)
{
this
.
id
=
id
;
}
...
...
@@ -53,6 +52,7 @@ public class Lotterylog implements Serializable{
public
void
setMny
(
BigDecimal
mny
)
{
this
.
mny
=
mny
;
}
public
Integer
getStatus
()
{
return
status
;
}
...
...
@@ -77,5 +77,11 @@ public class Lotterylog implements Serializable{
this
.
createdtime
=
createdtime
;
}
public
Integer
getPrizeId
()
{
return
prizeId
;
}
public
void
setPrizeId
(
Integer
prizeId
)
{
this
.
prizeId
=
prizeId
;
}
}
\ No newline at end of file
src/com/w1hd/zzhnc/service/ActivityService.java
查看文件 @
7b7ee99
...
...
@@ -132,6 +132,7 @@ public class ActivityService {
public
void
updateActivityPrize
(
Integer
type
,
Prize
prize
)
{
Activity
setting
=
getActivitySetting
();
prize
.
setId
(
type
);
switch
(
type
)
{
case
1
:
setting
.
setP1
(
prize
);
...
...
src/com/w1hd/zzhnc/service/AutoreplyService.java
查看文件 @
7b7ee99
...
...
@@ -76,16 +76,12 @@ public class AutoreplyService {
AutoreplyDao
autoreplyDao
;
static
List
<
RegexKeywordFilter
>
filterList
=
Lists
.
newArrayList
();
static
RegexKeywordFilter
projectNameFilter
=
new
RegexKeywordFilter
();
static
Map
<
String
,
Integer
>
projectNameMap
=
Maps
.
newHashMap
();
static
boolean
inited
=
false
;
public
void
init
(
boolean
hard
)
{
if
(
hard
)
{
inited
=
false
;
filterList
=
Lists
.
newArrayList
();
projectNameFilter
=
new
RegexKeywordFilter
();
projectNameMap
=
Maps
.
newHashMap
();
}
init
();
}
...
...
@@ -105,33 +101,15 @@ public class AutoreplyService {
filter
.
compile
();
filterList
.
add
(
filter
);
});
projectNameMap
.
put
(
"全部"
,
0
);
projectNameFilter
.
add
(
"全部"
);
projectNameFilter
.
compile
();
inited
=
true
;
}
@Autowired
RedisTemplate
<
String
,
String
>
redisTemplate
;
public
void
conentProjectName
(
String
content
,
String
fromUserName
)
{
boolean
b
=
projectNameFilter
.
hasKeywords
(
content
);
if
(
b
)
{
Set
<
String
>
set
=
projectNameMap
.
keySet
();
set
.
stream
().
forEach
(
s
->
{
int
count
=
projectNameFilter
.
count
(
content
,
s
);
if
(
count
>
0
)
{
log
.
info
(
"包含{},修改projectId为{}"
,
s
,
projectNameMap
.
get
(
s
));
redisTemplate
.
opsForValue
().
set
(
"dvmini171027_dvmini_cache_project_"
+
fromUserName
,
projectNameMap
.
get
(
s
)
+
""
);
}
});
}
}
public
Autoreply
autoreply
(
String
string
,
Integer
projectId
)
{
public
Autoreply
autoreply
(
String
string
)
{
List
<
Set
>
sets
=
Lists
.
newArrayList
();
...
...
@@ -164,7 +142,7 @@ public class AutoreplyService {
return
null
;
List
<
String
>
list
=
Lists
.
newArrayList
();
list
.
addAll
(
sets
.
get
(
0
));
List
<
Autoreply
>
autoreplys
=
autoreplyDao
.
findByKeys
(
list
,
projectId
);
List
<
Autoreply
>
autoreplys
=
autoreplyDao
.
findByKeys
(
list
,
null
);
if
(
autoreplys
.
isEmpty
())
return
null
;
...
...
@@ -218,14 +196,6 @@ public class AutoreplyService {
return
pageresult
;
}
/*
* (非 Javadoc) Description:
*
* @see
* com.w1hd.zzhnc.service.AutoreplyService#addAutoReply(java.lang.String,
* boolean, java.lang.String)
*/
public
String
addAutoReply
(
String
keywords
,
boolean
isRedirectStaff
,
String
content
,
Integer
projectId
,
String
projectName
,
Integer
sort
)
{
if
(
Strings
.
isNullOrEmpty
(
keywords
))
...
...
@@ -321,15 +291,10 @@ public class AutoreplyService {
}
public
HashMap
<
Object
,
Object
>
autoreply
(
String
content
,
Integer
projectId
,
String
fromUserName
)
{
conentProjectName
(
content
,
fromUserName
);
String
projectIdStr
=
redisTemplate
.
opsForValue
().
get
(
"dvmini171027_dvmini_cache_project_"
+
fromUserName
);
Autoreply
autoreply
=
null
;
if
(!
Strings
.
isNullOrEmpty
(
projectIdStr
))
{
projectId
=
Integer
.
parseInt
(
projectIdStr
);
autoreply
=
autoreply
(
content
,
projectId
);
}
if
(
autoreply
==
null
)
{
autoreply
=
autoreply
(
content
,
0
);
autoreply
=
autoreply
(
content
);
}
HashMap
<
Object
,
Object
>
result
=
Maps
.
newHashMap
();
...
...
src/com/w1hd/zzhnc/service/PrizeService.java
查看文件 @
7b7ee99
...
...
@@ -121,7 +121,7 @@ public class PrizeService {
p
.
setNum
(
p
.
getNum
()
-
1
);
setting
.
setP8
(
p
);
break
;
default
:
break
;
}
...
...
@@ -131,9 +131,10 @@ public class PrizeService {
lotterylog
.
setFansid
(
fansId
);
lotterylog
.
setMny
(
mny
);
lotterylog
.
setPrizeName
(
p
.
getName
());
if
(
"谢谢"
.
equals
(
p
.
getName
()))
{
lotterylog
.
setPrizeId
(
pType
);
if
(
"谢谢"
.
equals
(
p
.
getName
()))
{
lotterylog
.
setStatus
(
3
);
}
else
{
}
else
{
lotterylog
.
setStatus
(
1
);
}
lotterylog
.
setTurn
(
setting
.
getTurn
());
...
...
@@ -174,70 +175,94 @@ public class PrizeService {
Activity
activity
=
activityService
.
getActivitySetting
();
int
nextInt
=
RandomUtils
.
nextInt
(
0
,
100
);
System
.
out
.
println
(
"幸运数字 ---》》》"
+
nextInt
);
Prize
p8
=
activity
.
getP8
();
Prize
p7
=
activity
.
getP7
();
Prize
p6
=
activity
.
getP6
();
Prize
p5
=
activity
.
getP5
();
Prize
p4
=
activity
.
getP4
();
Prize
p3
=
activity
.
getP3
();
Prize
p2
=
activity
.
getP2
();
Prize
p1
=
activity
.
getP1
();
nextInt
=
51
;
int
sumNum
=
0
;
int
sumPro
=
0
;
Prize
tmp
=
null
;
List
<
Prize
>
prizeList
=
activityService
.
getPrizeList
();
for
(
Prize
p
:
prizeList
)
{
if
(
p
!=
null
)
{
sumNum
+=
p
.
getNum
();
sumPro
+=
p
.
getProbability
();
if
(
p
.
getName
().
contains
(
"谢谢"
))
{
tmp
=
p
;
}
}
}
int
mny
=
0
;
Integer
logId
=
0
;
if
(
p1
!=
null
&&
nextInt
<
p1
.
getProbability
()
&&
p1
.
getNum
()
>
1
)
{
if
(
p1
.
getIsMoney
())
{
mny
=
RandomUtils
.
nextInt
(
p1
.
getMixMoney
(),
p1
.
getMaxMoney
());
}
logId
=
insert
(
fansId
,
1
,
new
BigDecimal
(
mny
*
0.01
).
setScale
(
2
,
RoundingMode
.
HALF_UP
));
}
else
if
(
p2
!=
null
&&
nextInt
<
(
p2
.
getProbability
()
+
p1
.
getProbability
())
&&
p2
.
getNum
()
>
1
)
{
if
(
p2
.
getIsMoney
())
{
mny
=
RandomUtils
.
nextInt
(
p2
.
getMixMoney
(),
p2
.
getMaxMoney
());
}
logId
=
insert
(
fansId
,
2
,
new
BigDecimal
(
mny
*
0.01
).
setScale
(
2
,
RoundingMode
.
HALF_UP
));
}
else
if
(
p3
!=
null
&&
nextInt
<
(
p3
.
getProbability
()
+
p2
.
getProbability
()
+
p1
.
getProbability
())
&&
p3
.
getNum
()
>
1
)
{
if
(
p3
.
getIsMoney
())
{
mny
=
RandomUtils
.
nextInt
(
p3
.
getMixMoney
(),
p3
.
getMaxMoney
());
}
logId
=
insert
(
fansId
,
3
,
new
BigDecimal
(
mny
*
0.01
).
setScale
(
2
,
RoundingMode
.
HALF_UP
));
}
else
if
(
p4
!=
null
&&
nextInt
<
(
p4
.
getProbability
()
+
p3
.
getProbability
()
+
p2
.
getProbability
()
+
p1
.
getProbability
())
&&
p4
.
getNum
()
>
1
)
{
if
(
p4
.
getIsMoney
())
{
mny
=
RandomUtils
.
nextInt
(
p4
.
getMixMoney
(),
p4
.
getMaxMoney
());
}
logId
=
insert
(
fansId
,
4
,
new
BigDecimal
(
mny
*
0.01
).
setScale
(
2
,
RoundingMode
.
HALF_UP
));
}
else
if
(
p5
!=
null
&&
nextInt
<
(
p5
.
getProbability
()
+
p4
.
getProbability
()
+
p3
.
getProbability
()
+
p2
.
getProbability
()
+
p1
.
getProbability
())
&&
p5
.
getNum
()
>
1
)
{
if
(
p5
.
getIsMoney
())
{
mny
=
RandomUtils
.
nextInt
(
p5
.
getMixMoney
(),
p5
.
getMaxMoney
());
if
(
nextInt
>
sumPro
)
{
if
(
tmp
!=
null
)
{
if
(
tmp
.
getIsMoney
())
{
mny
=
RandomUtils
.
nextInt
(
tmp
.
getMixMoney
(),
tmp
.
getMaxMoney
());
}
logId
=
insert
(
fansId
,
tmp
.
getId
(),
new
BigDecimal
(
mny
*
0.01
).
setScale
(
2
,
RoundingMode
.
HALF_UP
));
}
logId
=
insert
(
fansId
,
5
,
new
BigDecimal
(
mny
*
0.01
).
setScale
(
2
,
RoundingMode
.
HALF_UP
));
}
else
if
(
p6
!=
null
&&
nextInt
<
(
p6
.
getProbability
()
+
p5
.
getProbability
()
+
p4
.
getProbability
()
+
p3
.
getProbability
()
+
p2
.
getProbability
()
+
p1
.
getProbability
())
&&
p6
.
getNum
()
>
1
)
{
if
(
p6
.
getIsMoney
())
{
mny
=
RandomUtils
.
nextInt
(
p6
.
getMixMoney
(),
p6
.
getMaxMoney
());
}
logId
=
insert
(
fansId
,
6
,
new
BigDecimal
(
mny
*
0.01
).
setScale
(
2
,
RoundingMode
.
HALF_UP
));
}
else
if
(
p7
!=
null
&&
nextInt
<
(
p7
.
getProbability
()
+
p6
.
getProbability
()
+
p5
.
getProbability
()
+
p4
.
getProbability
()
+
p3
.
getProbability
()
+
p2
.
getProbability
()
+
p1
.
getProbability
())
&&
p7
.
getNum
()
>
1
)
{
if
(
p7
.
getIsMoney
())
{
mny
=
RandomUtils
.
nextInt
(
p7
.
getMixMoney
(),
p7
.
getMaxMoney
());
}
logId
=
insert
(
fansId
,
7
,
new
BigDecimal
(
mny
*
0.01
).
setScale
(
2
,
RoundingMode
.
HALF_UP
));
}
else
if
(
p8
!=
null
&&
nextInt
<
(
p8
.
getProbability
()
+
p7
.
getProbability
()
+
p6
.
getProbability
()
+
p5
.
getProbability
()
+
p4
.
getProbability
()
+
p3
.
getProbability
()
+
p2
.
getProbability
()
+
p1
.
getProbability
())
&&
p8
.
getNum
()
>
1
)
{
if
(
p8
.
getIsMoney
())
{
mny
=
RandomUtils
.
nextInt
(
p7
.
getMixMoney
(),
p7
.
getMaxMoney
());
}
logId
=
insert
(
fansId
,
8
,
new
BigDecimal
(
mny
*
0.01
).
setScale
(
2
,
RoundingMode
.
HALF_UP
));
}
else
{
return
-
0
;
Prize
p8
=
activity
.
getP8
();
Prize
p7
=
activity
.
getP7
();
Prize
p6
=
activity
.
getP6
();
Prize
p5
=
activity
.
getP5
();
Prize
p4
=
activity
.
getP4
();
Prize
p3
=
activity
.
getP3
();
Prize
p2
=
activity
.
getP2
();
Prize
p1
=
activity
.
getP1
();
if
(
p1
!=
null
&&
nextInt
<
p1
.
getProbability
()
&&
p1
.
getNum
()
>
1
)
{
if
(
p1
.
getIsMoney
())
{
mny
=
RandomUtils
.
nextInt
(
p1
.
getMixMoney
(),
p1
.
getMaxMoney
());
}
logId
=
insert
(
fansId
,
1
,
new
BigDecimal
(
mny
*
0.01
).
setScale
(
2
,
RoundingMode
.
HALF_UP
));
}
else
if
(
p2
!=
null
&&
nextInt
<
(
p2
.
getProbability
()
+
p1
.
getProbability
())
&&
p2
.
getNum
()
>
1
)
{
if
(
p2
.
getIsMoney
())
{
mny
=
RandomUtils
.
nextInt
(
p2
.
getMixMoney
(),
p2
.
getMaxMoney
());
}
logId
=
insert
(
fansId
,
2
,
new
BigDecimal
(
mny
*
0.01
).
setScale
(
2
,
RoundingMode
.
HALF_UP
));
}
else
if
(
p3
!=
null
&&
nextInt
<
(
p3
.
getProbability
()
+
p2
.
getProbability
()
+
p1
.
getProbability
())
&&
p3
.
getNum
()
>
1
)
{
if
(
p3
.
getIsMoney
())
{
mny
=
RandomUtils
.
nextInt
(
p3
.
getMixMoney
(),
p3
.
getMaxMoney
());
}
logId
=
insert
(
fansId
,
3
,
new
BigDecimal
(
mny
*
0.01
).
setScale
(
2
,
RoundingMode
.
HALF_UP
));
}
else
if
(
p4
!=
null
&&
nextInt
<
(
p4
.
getProbability
()
+
p3
.
getProbability
()
+
p2
.
getProbability
()
+
p1
.
getProbability
())
&&
p4
.
getNum
()
>
1
)
{
if
(
p4
.
getIsMoney
())
{
mny
=
RandomUtils
.
nextInt
(
p4
.
getMixMoney
(),
p4
.
getMaxMoney
());
}
logId
=
insert
(
fansId
,
4
,
new
BigDecimal
(
mny
*
0.01
).
setScale
(
2
,
RoundingMode
.
HALF_UP
));
}
else
if
(
p5
!=
null
&&
nextInt
<
(
p5
.
getProbability
()
+
p4
.
getProbability
()
+
p3
.
getProbability
()
+
p2
.
getProbability
()
+
p1
.
getProbability
())
&&
p5
.
getNum
()
>
1
)
{
if
(
p5
.
getIsMoney
())
{
mny
=
RandomUtils
.
nextInt
(
p5
.
getMixMoney
(),
p5
.
getMaxMoney
());
}
logId
=
insert
(
fansId
,
5
,
new
BigDecimal
(
mny
*
0.01
).
setScale
(
2
,
RoundingMode
.
HALF_UP
));
}
else
if
(
p6
!=
null
&&
nextInt
<
(
p6
.
getProbability
()
+
p5
.
getProbability
()
+
p4
.
getProbability
()
+
p3
.
getProbability
()
+
p2
.
getProbability
()
+
p1
.
getProbability
())
&&
p6
.
getNum
()
>
1
)
{
if
(
p6
.
getIsMoney
())
{
mny
=
RandomUtils
.
nextInt
(
p6
.
getMixMoney
(),
p6
.
getMaxMoney
());
}
logId
=
insert
(
fansId
,
6
,
new
BigDecimal
(
mny
*
0.01
).
setScale
(
2
,
RoundingMode
.
HALF_UP
));
}
else
if
(
p7
!=
null
&&
nextInt
<
(
p7
.
getProbability
()
+
p6
.
getProbability
()
+
p5
.
getProbability
()
+
p4
.
getProbability
()
+
p3
.
getProbability
()
+
p2
.
getProbability
()
+
p1
.
getProbability
())
&&
p7
.
getNum
()
>
1
)
{
if
(
p7
.
getIsMoney
())
{
mny
=
RandomUtils
.
nextInt
(
p7
.
getMixMoney
(),
p7
.
getMaxMoney
());
}
logId
=
insert
(
fansId
,
7
,
new
BigDecimal
(
mny
*
0.01
).
setScale
(
2
,
RoundingMode
.
HALF_UP
));
}
else
if
(
p8
!=
null
&&
nextInt
<
(
p8
.
getProbability
()
+
p7
.
getProbability
()
+
p6
.
getProbability
()
+
p5
.
getProbability
()
+
p4
.
getProbability
()
+
p3
.
getProbability
()
+
p2
.
getProbability
()
+
p1
.
getProbability
())
&&
p8
.
getNum
()
>
1
)
{
if
(
p8
.
getIsMoney
())
{
mny
=
RandomUtils
.
nextInt
(
p7
.
getMixMoney
(),
p7
.
getMaxMoney
());
}
logId
=
insert
(
fansId
,
8
,
new
BigDecimal
(
mny
*
0.01
).
setScale
(
2
,
RoundingMode
.
HALF_UP
));
}
else
{
if
(
sumNum
>
0
)
{
return
randomKill
(
fansId
);
}
}
}
redisTemplate
.
opsForValue
().
set
(
PRIZE_KILL_FANSID
+
fansId
,
logId
);
return
logId
;
}
...
...
编写
预览
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
请先完成此消息的编辑!
取消
请
注册
或
登录
后发表评论