Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
xunj
/
festival-activites
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit bedce491
authored
Feb 05, 2021
by
xunj
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
正是上线发布版本
1 parent
faadb547
Show whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
195 additions
and
66 deletions
activity-admin/src/main/java/com/polysoft/activity/constant/MsgCodeEnum.java
activity-admin/src/main/java/com/polysoft/activity/controller/CattleController.java
activity-admin/src/main/java/com/polysoft/activity/mapper/ActivityMapper.java
activity-admin/src/main/java/com/polysoft/activity/model/vo/RedPackInfoVO.java
activity-admin/src/main/java/com/polysoft/activity/service/impl/ActItemServiceImpl.java
activity-admin/src/main/java/com/polysoft/activity/service/impl/CattleBrandServiceImpl.java
activity-admin/src/main/java/com/polysoft/activity/service/impl/UserInfoServiceImpl.java
activity-admin/src/main/java/com/polysoft/activity/service/impl/WishServiceImpl.java
activity-admin/src/main/java/com/polysoft/activity/task/CattleBrandCarveUpTask.java
activity-admin/src/main/java/com/polysoft/activity/task/InitRedPackageTask1.java
activity-admin/src/main/java/com/polysoft/activity/task/InitRedPackageTask2.java
activity-admin/src/main/java/com/polysoft/activity/task/InitRedPackageTask3.java
activity-admin/src/main/java/com/polysoft/activity/task/UserSignTask.java
activity-admin/src/main/java/com/polysoft/activity/task/WishLuckDrawTask.java
activity-admin/src/main/resources/mapper/ActivityMapper.xml
activity-admin/src/main/resources/mapper/CattleBrandMapper.xml
activity-admin/src/main/resources/mapper/WishMapper.xml
activity-admin/src/main/java/com/polysoft/activity/config/exception/BusinessException.java → activity-common/src/main/java/com/polysoft/activity/common/exception/BusinessException.java
activity-common/src/main/java/com/polysoft/activity/utils/RedPacketUtil.java
activity-admin/src/main/java/com/polysoft/activity/constant/MsgCodeEnum.java
View file @
bedce49
...
@@ -4,7 +4,9 @@ public enum MsgCodeEnum {
...
@@ -4,7 +4,9 @@ public enum MsgCodeEnum {
BALANCE_NO
(
"1001"
,
"余额不足"
),
BALANCE_NO
(
"1001"
,
"余额不足"
),
OPEN_CATTLE1
(
"2001"
,
"该用户不存在"
),
OPEN_CATTLE1
(
"2001"
,
"该用户不存在"
),
OPEN_CATTLE2
(
"2002"
,
"福牛红包已被领取"
),
OPEN_CATTLE2
(
"2002"
,
"福牛红包已被领取"
),
OPEN_CATTLE3
(
"2003"
,
"开奖时间2020-02-17 20:21:00,请少侠耐心等待"
);
OPEN_CATTLE3
(
"2003"
,
"开奖时间2020-02-17 20:21:00,请少侠耐心等待"
),
//
RED_PACK_RECHAGE_NO
(
"3001"
,
"红包雨未结算完成"
);
private
String
code
;
private
String
code
;
private
String
msg
;
private
String
msg
;
...
...
activity-admin/src/main/java/com/polysoft/activity/controller/CattleController.java
View file @
bedce49
...
@@ -35,14 +35,12 @@ public class CattleController {
...
@@ -35,14 +35,12 @@ public class CattleController {
}
}
return
cattleBrandService
.
queryCattleBrandByUserId2
(
userId
);
return
cattleBrandService
.
queryCattleBrandByUserId2
(
userId
);
}
}
//1,牛牌合成
@PostMapping
(
"/saveComposeCattleBrand"
)
@PostMapping
(
"/saveComposeCattleBrand"
)
@ResponseBody
@ResponseBody
public
ApiResult
saveComposeCattleBrand
(
@RequestBody
@Validated
ComposeCattleBrandParam
param
)
{
public
ApiResult
saveComposeCattleBrand
(
@RequestBody
@Validated
ComposeCattleBrandParam
param
)
{
return
cattleBrandService
.
saveComposeCattleBrand
(
param
);
return
cattleBrandService
.
saveComposeCattleBrand
(
param
);
}
}
//2,打卡合成牛牌
@PostMapping
(
"/saveOpenCattleBrand"
)
@PostMapping
(
"/saveOpenCattleBrand"
)
@ResponseBody
@ResponseBody
public
ApiResult
saveOpenCattleBrand
(
@RequestBody
@Validated
ComposeCattleBrandParam
param
)
{
public
ApiResult
saveOpenCattleBrand
(
@RequestBody
@Validated
ComposeCattleBrandParam
param
)
{
...
...
activity-admin/src/main/java/com/polysoft/activity/mapper/ActivityMapper.java
View file @
bedce49
...
@@ -42,6 +42,7 @@ public interface ActivityMapper extends BaseMapper<ActItemDto> {
...
@@ -42,6 +42,7 @@ public interface ActivityMapper extends BaseMapper<ActItemDto> {
List
<
SmashBasinVO
>
getcollectCardMoney
();
List
<
SmashBasinVO
>
getcollectCardMoney
();
List
<
SmashBasinVO
>
getGrapRedPackMoney
();
List
<
SmashBasinVO
>
getGrapRedPackMoney
();
GrapRedPackResultVO
getGrapRedPackResult
(
GrapRedPackResultDto
dto
);
GrapRedPackResultVO
getGrapRedPackResult
(
GrapRedPackResultDto
dto
);
int
getRedPackRecharge
(
GrapRedPackResultDto
dto
);
List
<
GrapRedPackResultVO
>
getGrapRedRainRank
(
GrapRedPackResultDto
dto
);
List
<
GrapRedPackResultVO
>
getGrapRedRainRank
(
GrapRedPackResultDto
dto
);
RedAmountConfVO
getRedAmountConf
(
@Param
(
"redSource"
)
String
redSource
,
@Param
(
"batchNum"
)
Long
batchNum
);
RedAmountConfVO
getRedAmountConf
(
@Param
(
"redSource"
)
String
redSource
,
@Param
(
"batchNum"
)
Long
batchNum
);
List
<
Long
>
getRedIdToCattle
(
@Param
(
"redAmount"
)
BigDecimal
redAmount
);
List
<
Long
>
getRedIdToCattle
(
@Param
(
"redAmount"
)
BigDecimal
redAmount
);
...
...
activity-admin/src/main/java/com/polysoft/activity/model/vo/RedPackInfoVO.java
View file @
bedce49
...
@@ -10,6 +10,7 @@ import java.math.BigDecimal;
...
@@ -10,6 +10,7 @@ import java.math.BigDecimal;
*/
*/
@Data
@Data
public
class
RedPackInfoVO
{
public
class
RedPackInfoVO
{
private
Long
redId
;
private
BigDecimal
redamount
;
private
BigDecimal
redamount
;
private
String
sourceType
;
private
String
sourceType
;
private
String
createTime
;
private
String
createTime
;
...
...
activity-admin/src/main/java/com/polysoft/activity/service/impl/ActItemServiceImpl.java
View file @
bedce49
...
@@ -3,10 +3,9 @@ package com.polysoft.activity.service.impl;
...
@@ -3,10 +3,9 @@ package com.polysoft.activity.service.impl;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.date.DateUtil
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageHelper
;
import
com.polysoft.activity.common.utils.BeanTransferUtils
;
import
com.polysoft.activity.common.utils.BeanTransferUtils
;
import
com.polysoft.activity.common.utils.PageQuery
;
import
com.polysoft.activity.common.utils.PageResult
;
import
com.polysoft.activity.common.utils.PageResult
;
import
com.polysoft.activity.config.exception.BusinessException
;
import
com.polysoft.activity.constant.CommonTypeEnum
;
import
com.polysoft.activity.constant.CommonTypeEnum
;
import
com.polysoft.activity.constant.MsgCodeEnum
;
import
com.polysoft.activity.mapper.ActivityMapper
;
import
com.polysoft.activity.mapper.ActivityMapper
;
import
com.polysoft.activity.mapper.UserInfoMapper
;
import
com.polysoft.activity.mapper.UserInfoMapper
;
import
com.polysoft.activity.model.dto.AddRedRainDto
;
import
com.polysoft.activity.model.dto.AddRedRainDto
;
...
@@ -56,12 +55,12 @@ public class ActItemServiceImpl implements ActItemService{
...
@@ -56,12 +55,12 @@ public class ActItemServiceImpl implements ActItemService{
item
.
setActivityStatus
(
CommonTypeEnum
.
ACTIVITY_STATUS1
.
getCode
());
item
.
setActivityStatus
(
CommonTypeEnum
.
ACTIVITY_STATUS1
.
getCode
());
item
.
setSurplusSecond
(
endTime
-
cuttentTime
);
item
.
setSurplusSecond
(
endTime
-
cuttentTime
);
}
}
if
(
cuttentTime
<
startTime
&&
(
startTime
-
cuttentTime
)
<
30
){
/*
if(cuttentTime < startTime && (startTime - cuttentTime) <30){
//即将开始
//即将开始
activityMapper.updateActStatus(item.getId(), CommonTypeEnum.ACTIVITY_STATUS2.getCode());
activityMapper.updateActStatus(item.getId(), CommonTypeEnum.ACTIVITY_STATUS2.getCode());
item.setActivityStatus(CommonTypeEnum.ACTIVITY_STATUS2.getCode());
item.setActivityStatus(CommonTypeEnum.ACTIVITY_STATUS2.getCode());
item.setSurplusSecond(endTime-endTime);
item.setSurplusSecond(endTime-endTime);
}
}
*/
if
(
cuttentTime
>
endTime
)
{
if
(
cuttentTime
>
endTime
)
{
//已结束
//已结束
activityMapper
.
updateActStatus
(
item
.
getId
(),
CommonTypeEnum
.
ACTIVITY_STATUS3
.
getCode
());
activityMapper
.
updateActStatus
(
item
.
getId
(),
CommonTypeEnum
.
ACTIVITY_STATUS3
.
getCode
());
...
@@ -128,6 +127,16 @@ public class ActItemServiceImpl implements ActItemService{
...
@@ -128,6 +127,16 @@ public class ActItemServiceImpl implements ActItemService{
@Override
@Override
public
ApiResult
getGrapRedPackResult
(
QueeryGrapRedPackResultParam
param
)
{
public
ApiResult
getGrapRedPackResult
(
QueeryGrapRedPackResultParam
param
)
{
//查询红包雨是否结算完成
GrapRedPackResultDto
dto1
=
new
GrapRedPackResultDto
();
dto1
.
setIsEnble
(
CommonTypeEnum
.
RED_ISENBLE_NO
.
getCode
());
dto1
.
setBatchNum
(
param
.
getBatchNum
());
int
count
=
activityMapper
.
getRedPackRecharge
(
dto1
);
if
(
count
>
0
){
return
ApiResult
.
ok
(
MsgCodeEnum
.
RED_PACK_RECHAGE_NO
.
getCode
(),
MsgCodeEnum
.
RED_PACK_RECHAGE_NO
.
getMsg
());
}
GrapRedPackResultDto
dto
=
new
GrapRedPackResultDto
();
GrapRedPackResultDto
dto
=
new
GrapRedPackResultDto
();
dto
.
setUserId
(
param
.
getUserId
());
dto
.
setUserId
(
param
.
getUserId
());
dto
.
setBatchNum
(
param
.
getBatchNum
());
dto
.
setBatchNum
(
param
.
getBatchNum
());
...
@@ -146,7 +155,7 @@ public class ActItemServiceImpl implements ActItemService{
...
@@ -146,7 +155,7 @@ public class ActItemServiceImpl implements ActItemService{
return
ApiResult
.
ok
(
activityMapper
.
getGrapRedRainRank
(
dto
));
return
ApiResult
.
ok
(
activityMapper
.
getGrapRedRainRank
(
dto
));
}
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Runtime
Exception
.
class
)
@Override
@Override
public
ApiResult
testOne
()
{
public
ApiResult
testOne
()
{
AddRedRainDto
rainDto
=
new
AddRedRainDto
();
AddRedRainDto
rainDto
=
new
AddRedRainDto
();
...
...
activity-admin/src/main/java/com/polysoft/activity/service/impl/CattleBrandServiceImpl.java
View file @
bedce49
...
@@ -2,6 +2,7 @@ package com.polysoft.activity.service.impl;
...
@@ -2,6 +2,7 @@ package com.polysoft.activity.service.impl;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.date.DateUtil
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.polysoft.activity.common.exception.BusinessException
;
import
com.polysoft.activity.constant.CommonTypeEnum
;
import
com.polysoft.activity.constant.CommonTypeEnum
;
import
com.polysoft.activity.constant.MsgCodeEnum
;
import
com.polysoft.activity.constant.MsgCodeEnum
;
import
com.polysoft.activity.mapper.ActivityMapper
;
import
com.polysoft.activity.mapper.ActivityMapper
;
...
@@ -23,7 +24,10 @@ import com.polysoft.activity.model.vo.UserInfoVO;
...
@@ -23,7 +24,10 @@ import com.polysoft.activity.model.vo.UserInfoVO;
import
com.polysoft.activity.service.CattleBrandService
;
import
com.polysoft.activity.service.CattleBrandService
;
import
com.polysoft.activity.utils.ApiResult
;
import
com.polysoft.activity.utils.ApiResult
;
import
com.polysoft.activity.utils.SnowFlakeUtil
;
import
com.polysoft.activity.utils.SnowFlakeUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.interceptor.TransactionAspectSupport
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
...
@@ -36,6 +40,7 @@ import java.util.Map;
...
@@ -36,6 +40,7 @@ import java.util.Map;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
@Service
@Service
@Slf4j
public
class
CattleBrandServiceImpl
implements
CattleBrandService
{
public
class
CattleBrandServiceImpl
implements
CattleBrandService
{
@Resource
@Resource
...
@@ -85,6 +90,7 @@ public class CattleBrandServiceImpl implements CattleBrandService {
...
@@ -85,6 +90,7 @@ public class CattleBrandServiceImpl implements CattleBrandService {
return
ApiResult
.
ok
(
map
);
return
ApiResult
.
ok
(
map
);
}
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
@Override
public
ApiResult
saveComposeCattleBrand
(
ComposeCattleBrandParam
param
)
{
public
ApiResult
saveComposeCattleBrand
(
ComposeCattleBrandParam
param
)
{
JSONObject
object
=
new
JSONObject
();
JSONObject
object
=
new
JSONObject
();
...
@@ -97,8 +103,16 @@ public class CattleBrandServiceImpl implements CattleBrandService {
...
@@ -97,8 +103,16 @@ public class CattleBrandServiceImpl implements CattleBrandService {
try
{
try
{
List
<
UserCattleVO
>
list
=
cattleBrandMapper
.
getComposeCattleBrand
(
param
.
getUserId
());
List
<
UserCattleVO
>
list
=
cattleBrandMapper
.
getComposeCattleBrand
(
param
.
getUserId
());
if
(
list
!=
null
&&
list
.
size
()
==
5
){
if
(
list
!=
null
&&
list
.
size
()
==
5
){
cattleBrandMapper
.
updateComposeCattleStatus
(
param
.
getUserId
(),
"1"
,
DateUtil
.
format
(
new
Date
(),
"yyyy-MM-dd HH:mm:ss"
));
int
k1
=
cattleBrandMapper
.
updateComposeCattleStatus
(
param
.
getUserId
(),
"1"
,
DateUtil
.
format
(
new
Date
(),
"yyyy-MM-dd HH:mm:ss"
));
cattleBrandMapper
.
deleteUserCalltle
(
list
);
if
(
k1
<
1
){
log
.
error
(
"更新合成牛牌状态是失败"
);
throw
new
BusinessException
(
"更新合成牛牌状态是异常"
);
}
int
k2
=
cattleBrandMapper
.
deleteUserCalltle
(
list
);
if
(
k2
<
1
){
log
.
error
(
"合成牛牌过程,消费牛牌异常"
);
throw
new
BusinessException
(
"合成牛牌过程,消费牛牌异常"
);
}
//插入到t_red_rain
//插入到t_red_rain
AddRedRainDto
rainDto
=
new
AddRedRainDto
();
AddRedRainDto
rainDto
=
new
AddRedRainDto
();
rainDto
.
setRedId
(
SnowFlakeUtil
.
nextId
());
rainDto
.
setRedId
(
SnowFlakeUtil
.
nextId
());
...
@@ -109,19 +123,24 @@ public class CattleBrandServiceImpl implements CattleBrandService {
...
@@ -109,19 +123,24 @@ public class CattleBrandServiceImpl implements CattleBrandService {
rainDto
.
setIsEnble
(
CommonTypeEnum
.
RED_ISENBLE_NO
.
getCode
());
rainDto
.
setIsEnble
(
CommonTypeEnum
.
RED_ISENBLE_NO
.
getCode
());
rainDto
.
setSourceType
(
CommonTypeEnum
.
REDPACK_SOURCE_TYPE4
.
getCode
());
rainDto
.
setSourceType
(
CommonTypeEnum
.
REDPACK_SOURCE_TYPE4
.
getCode
());
rainDto
.
setCreateTime
(
new
Date
());
rainDto
.
setCreateTime
(
new
Date
());
activityMapper
.
saveRedRainForOne
(
rainDto
);
int
k3
=
activityMapper
.
saveRedRainForOne
(
rainDto
);
if
(
k3
<
1
){
log
.
error
(
"牛牌合成t_red_rain表失败"
);
throw
new
BusinessException
(
"牛牌合成t_red_rain表失败"
);
}
object
.
put
(
"isCompose"
,
true
);
object
.
put
(
"isCompose"
,
true
);
return
ApiResult
.
ok
(
"200"
,
"恭喜合成牛牌"
,
object
);
return
ApiResult
.
ok
(
"200"
,
"恭喜合成牛牌"
,
object
);
}
else
{
}
else
{
object
.
put
(
"isCompose"
,
false
);
object
.
put
(
"isCompose"
,
false
);
return
ApiResult
.
ok
(
"200"
,
"请继续收集牛牌"
,
object
);
return
ApiResult
.
ok
(
"200"
,
"请继续收集牛牌"
,
object
);
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Runtime
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
return
ApiResult
.
error
(
);
throw
new
BusinessException
(
"牛牌合成异常"
);
}
}
}
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
@Override
public
ApiResult
saveOpenCattleBrand
(
ComposeCattleBrandParam
param
)
{
public
ApiResult
saveOpenCattleBrand
(
ComposeCattleBrandParam
param
)
{
//判断是否已经打开过牛牌
//判断是否已经打开过牛牌
...
@@ -135,7 +154,7 @@ public class CattleBrandServiceImpl implements CattleBrandService {
...
@@ -135,7 +154,7 @@ public class CattleBrandServiceImpl implements CattleBrandService {
return
ApiResult
.
ok
(
MsgCodeEnum
.
OPEN_CATTLE2
.
getCode
(),
MsgCodeEnum
.
OPEN_CATTLE2
.
getMsg
());
return
ApiResult
.
ok
(
MsgCodeEnum
.
OPEN_CATTLE2
.
getCode
(),
MsgCodeEnum
.
OPEN_CATTLE2
.
getMsg
());
}
}
Long
currentTime
=
System
.
currentTimeMillis
()/
1000
;
Long
currentTime
=
System
.
currentTimeMillis
()/
1000
;
Long
guiDingTime
=
DateUtil
.
parse
(
"2021-02-17 22:21:
1
0"
,
"yyyy-MM-dd HH:mm:ss"
).
getTime
()/
1000
;
Long
guiDingTime
=
DateUtil
.
parse
(
"2021-02-17 22:21:
0
0"
,
"yyyy-MM-dd HH:mm:ss"
).
getTime
()/
1000
;
if
(
currentTime
<
guiDingTime
){
if
(
currentTime
<
guiDingTime
){
return
ApiResult
.
ok
(
MsgCodeEnum
.
OPEN_CATTLE2
.
getCode
(),
MsgCodeEnum
.
OPEN_CATTLE3
.
getMsg
());
return
ApiResult
.
ok
(
MsgCodeEnum
.
OPEN_CATTLE2
.
getCode
(),
MsgCodeEnum
.
OPEN_CATTLE3
.
getMsg
());
}
}
...
@@ -143,7 +162,11 @@ public class CattleBrandServiceImpl implements CattleBrandService {
...
@@ -143,7 +162,11 @@ public class CattleBrandServiceImpl implements CattleBrandService {
UpdateUserStatesDto
dto
=
new
UpdateUserStatesDto
();
UpdateUserStatesDto
dto
=
new
UpdateUserStatesDto
();
dto
.
setUserId
(
param
.
getUserId
());
dto
.
setUserId
(
param
.
getUserId
());
dto
.
setCattleOpenStatus
(
"1"
);
dto
.
setCattleOpenStatus
(
"1"
);
userInfoMapper
.
updateUserStates
(
dto
);
int
k1
=
userInfoMapper
.
updateUserStates
(
dto
);
if
(
k1
<
1
){
log
.
info
(
"ID@@"
+
param
.
getUserId
()+
"@@更新牛一牛状态异常"
);
throw
new
BusinessException
(
"更新牛一牛状态异常"
);
}
//更新聚宝盆余额
//更新聚宝盆余额
List
<
UserInfoDto
>
userInfoDtoList
=
new
ArrayList
<>();
List
<
UserInfoDto
>
userInfoDtoList
=
new
ArrayList
<>();
OpenCattleVO
openCattleVO
=
userInfoMapper
.
getCattleAmount
(
param
.
getUserId
());
OpenCattleVO
openCattleVO
=
userInfoMapper
.
getCattleAmount
(
param
.
getUserId
());
...
@@ -151,15 +174,23 @@ public class CattleBrandServiceImpl implements CattleBrandService {
...
@@ -151,15 +174,23 @@ public class CattleBrandServiceImpl implements CattleBrandService {
userInfoDto
.
setUserId
(
param
.
getUserId
());
userInfoDto
.
setUserId
(
param
.
getUserId
());
userInfoDto
.
setRedBalance
(
openCattleVO
.
getRedAmount
());
userInfoDto
.
setRedBalance
(
openCattleVO
.
getRedAmount
());
userInfoDtoList
.
add
(
userInfoDto
);
userInfoDtoList
.
add
(
userInfoDto
);
userInfoMapper
.
updateRedBalace
(
userInfoDtoList
);
int
k2
=
userInfoMapper
.
updateRedBalace
(
userInfoDtoList
);
activityMapper
.
updateRedRainIsEnble
(
openCattleVO
.
getRedId
());
if
(
k2
<
1
){
log
.
info
(
"ID@@"
+
param
.
getUserId
()+
"@@更新聚宝盆余额异常"
);
throw
new
BusinessException
(
"更新牛一牛状态异常"
);
}
int
k3
=
activityMapper
.
updateRedRainIsEnble
(
openCattleVO
.
getRedId
());
if
(
k3
<
1
){
log
.
info
(
"ID@@"
+
param
.
getUserId
()+
"@@打开牛牌更新t_red_rain表异常"
);
throw
new
BusinessException
(
"打开牛牌更新t_red_rain表异常"
);
}
//查询排名
//查询排名
List
<
RankVO
>
rankVOList
=
cattleBrandMapper
.
getRedSourceType4Rank
();
List
<
RankVO
>
rankVOList
=
cattleBrandMapper
.
getRedSourceType4Rank
();
int
total
=
rankVOList
.
size
();
int
total
=
rankVOList
.
size
();
Map
<
Long
,
Integer
>
map
=
rankVOList
.
stream
().
collect
(
Collectors
.
toMap
(
RankVO:
:
getUserId
,
RankVO:
:
getRanking
));
Map
<
Long
,
Integer
>
map
=
rankVOList
.
stream
().
collect
(
Collectors
.
toMap
(
RankVO:
:
getUserId
,
RankVO:
:
getRanking
));
int
rank
=
map
.
get
(
param
.
getUserId
());
int
rank
=
map
.
get
(
param
.
getUserId
());
DecimalFormat
df
=
new
DecimalFormat
(
"######0%"
);
DecimalFormat
df
=
new
DecimalFormat
(
"######0%"
);
String
percent
=
df
.
format
(
Double
.
valueOf
(
total
-
rank
)/
total
);
String
percent
=
df
.
format
(
Double
.
valueOf
(
total
-
rank
)/
total
);
openCattleVO
.
setTotalPerson
(
total
);
openCattleVO
.
setTotalPerson
(
total
);
openCattleVO
.
setPercent
(
percent
);
openCattleVO
.
setPercent
(
percent
);
...
...
activity-admin/src/main/java/com/polysoft/activity/service/impl/UserInfoServiceImpl.java
View file @
bedce49
...
@@ -2,6 +2,7 @@ package com.polysoft.activity.service.impl;
...
@@ -2,6 +2,7 @@ package com.polysoft.activity.service.impl;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.date.DateUtil
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.polysoft.activity.common.exception.BusinessException
;
import
com.polysoft.activity.common.log.LoggerHelper
;
import
com.polysoft.activity.common.log.LoggerHelper
;
import
com.polysoft.activity.constant.CommonTypeEnum
;
import
com.polysoft.activity.constant.CommonTypeEnum
;
import
com.polysoft.activity.constant.MsgCodeEnum
;
import
com.polysoft.activity.constant.MsgCodeEnum
;
...
@@ -27,6 +28,7 @@ import com.polysoft.activity.utils.SnowFlakeUtil;
...
@@ -27,6 +28,7 @@ import com.polysoft.activity.utils.SnowFlakeUtil;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.web.client.RestClientException
;
import
org.springframework.web.client.RestClientException
;
import
org.springframework.web.client.RestTemplate
;
import
org.springframework.web.client.RestTemplate
;
...
@@ -121,6 +123,7 @@ public class UserInfoServiceImpl implements UserInfoService {
...
@@ -121,6 +123,7 @@ public class UserInfoServiceImpl implements UserInfoService {
}
}
}
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
@Override
public
ApiResult
saveShareCattle
(
ShareLinkParam
param
)
{
public
ApiResult
saveShareCattle
(
ShareLinkParam
param
)
{
try
{
try
{
...
@@ -138,9 +141,15 @@ public class UserInfoServiceImpl implements UserInfoService {
...
@@ -138,9 +141,15 @@ public class UserInfoServiceImpl implements UserInfoService {
dto
.
setUserId
(
param
.
getUserId
());
dto
.
setUserId
(
param
.
getUserId
());
dto
.
setCattleBrandId
(
cattleVO
.
getCattleBrandId
());
dto
.
setCattleBrandId
(
cattleVO
.
getCattleBrandId
());
list
.
add
(
dto
);
list
.
add
(
dto
);
mapper
.
saveCattleBrand
(
list
);
int
k1
=
mapper
.
saveCattleBrand
(
list
);
if
(
k1
<
1
){
throw
new
BusinessException
(
"ID@@"
+
param
.
getUserId
()+
"@@分享获取牛牌异常"
);
}
//删除用户牛牌关系表数据
//删除用户牛牌关系表数据
cattleBrandMapper
.
deleteUsetCattleById
(
param
.
getCattleId
());
int
k2
=
cattleBrandMapper
.
deleteUsetCattleById
(
param
.
getCattleId
());
if
(
k2
<
1
){
throw
new
BusinessException
(
"ID@@"
+
param
.
getUserId
()+
"@@分享获取牛牌异常"
);
}
object
.
put
(
"cardType"
,
param
.
getCardType
());
object
.
put
(
"cardType"
,
param
.
getCardType
());
object
.
put
(
"isReceived"
,
true
);
object
.
put
(
"isReceived"
,
true
);
return
ApiResult
.
ok
(
"200"
,
"领取牛牌成功"
,
object
);
return
ApiResult
.
ok
(
"200"
,
"领取牛牌成功"
,
object
);
...
@@ -150,6 +159,7 @@ public class UserInfoServiceImpl implements UserInfoService {
...
@@ -150,6 +159,7 @@ public class UserInfoServiceImpl implements UserInfoService {
}
}
}
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
@Override
public
ApiResult
saveUserSign
(
UserInfoParam
param
)
{
public
ApiResult
saveUserSign
(
UserInfoParam
param
)
{
try
{
try
{
...
@@ -162,6 +172,9 @@ public class UserInfoServiceImpl implements UserInfoService {
...
@@ -162,6 +172,9 @@ public class UserInfoServiceImpl implements UserInfoService {
UserSignDto
userSignDto
=
new
UserSignDto
();
UserSignDto
userSignDto
=
new
UserSignDto
();
CattleBrandVO
cattleBrandVO
=
null
;
CattleBrandVO
cattleBrandVO
=
null
;
CattleBrandConfVO
confVO
=
cattleBrandMapper
.
queryCattleBrandConf
(
today
);
CattleBrandConfVO
confVO
=
cattleBrandMapper
.
queryCattleBrandConf
(
today
);
if
(
confVO
==
null
){
return
ApiResult
.
error
(
"牛牌概率未配置"
);
}
if
(
param
.
getSignId
()
!=
null
){
if
(
param
.
getSignId
()
!=
null
){
//扣除金额
//扣除金额
BigDecimal
kouchu
=
BigDecimal
.
valueOf
(
20.00
);
BigDecimal
kouchu
=
BigDecimal
.
valueOf
(
20.00
);
...
@@ -175,7 +188,10 @@ public class UserInfoServiceImpl implements UserInfoService {
...
@@ -175,7 +188,10 @@ public class UserInfoServiceImpl implements UserInfoService {
userSignDto
.
setId
(
param
.
getSignId
());
userSignDto
.
setId
(
param
.
getSignId
());
userSignDto
.
setCreateTime
(
date
);
userSignDto
.
setCreateTime
(
date
);
userSignDto
.
setSignStatus
(
CommonTypeEnum
.
USER_SIGN_STATUS1
.
getCode
());
userSignDto
.
setSignStatus
(
CommonTypeEnum
.
USER_SIGN_STATUS1
.
getCode
());
mapper
.
updateUserSign
(
userSignDto
);
int
k1
=
mapper
.
updateUserSign
(
userSignDto
);
if
(
k1
<
1
){
throw
new
BusinessException
(
"ID@@"
+
param
.
getUserId
()+
"@@更新签到状态异常"
);
}
AddRedRainDto
rainDto
=
new
AddRedRainDto
();
AddRedRainDto
rainDto
=
new
AddRedRainDto
();
rainDto
.
setRedId
(
SnowFlakeUtil
.
nextId
());
rainDto
.
setRedId
(
SnowFlakeUtil
.
nextId
());
rainDto
.
setUserId
(
param
.
getUserId
());
rainDto
.
setUserId
(
param
.
getUserId
());
...
@@ -184,38 +200,52 @@ public class UserInfoServiceImpl implements UserInfoService {
...
@@ -184,38 +200,52 @@ public class UserInfoServiceImpl implements UserInfoService {
rainDto
.
setCreateTime
(
date
);
rainDto
.
setCreateTime
(
date
);
rainDto
.
setIsEnble
(
CommonTypeEnum
.
RED_ISENBLE_YES
.
getCode
());
rainDto
.
setIsEnble
(
CommonTypeEnum
.
RED_ISENBLE_YES
.
getCode
());
rainDto
.
setSourceType
(
CommonTypeEnum
.
REDPACK_SOURCE_TYPE3
.
getCode
());
rainDto
.
setSourceType
(
CommonTypeEnum
.
REDPACK_SOURCE_TYPE3
.
getCode
());
activityMapper
.
saveRedRainForOne
(
rainDto
);
int
k2
=
activityMapper
.
saveRedRainForOne
(
rainDto
);
if
(
k2
<
1
){
throw
new
BusinessException
(
"ID@@"
+
param
.
getUserId
()+
"@@补签扣钱新增t_red_rain表异常"
);
}
List
<
UserInfoDto
>
list
=
new
ArrayList
<>();
List
<
UserInfoDto
>
list
=
new
ArrayList
<>();
UserInfoDto
infoDto
=
new
UserInfoDto
();
UserInfoDto
infoDto
=
new
UserInfoDto
();
infoDto
.
setUserId
(
param
.
getUserId
());
infoDto
.
setUserId
(
param
.
getUserId
());
infoDto
.
setRedBalance
(
rainDto
.
getRedAmount
());
infoDto
.
setRedBalance
(
rainDto
.
getRedAmount
());
list
.
add
(
infoDto
);
list
.
add
(
infoDto
);
mapper
.
updateRedBalace
(
list
);
int
k3
=
mapper
.
updateRedBalace
(
list
);
}
else
{
if
(
k3
<
1
){
throw
new
BusinessException
(
"ID@@"
+
param
.
getUserId
()+
"@@补签更新余额异常"
);
}
}
else
{
userSignDto
.
setId
(
SnowFlakeUtil
.
nextId
());
userSignDto
.
setId
(
SnowFlakeUtil
.
nextId
());
userSignDto
.
setUserId
(
param
.
getUserId
());
userSignDto
.
setUserId
(
param
.
getUserId
());
userSignDto
.
setSignStatus
(
"1"
);
userSignDto
.
setSignStatus
(
"1"
);
userSignDto
.
setSignDate
(
date
);
userSignDto
.
setSignDate
(
date
);
userSignDto
.
setCreateTime
(
date
);
userSignDto
.
setCreateTime
(
date
);
mapper
.
saveUserSign
(
userSignDto
);
int
k4
=
mapper
.
saveUserSign
(
userSignDto
);
if
(
k4
<
1
)
{
throw
new
BusinessException
(
"ID@@"
+
param
.
getUserId
()
+
"@@签到异常"
);
}
}
MathRandom
random
=
new
MathRandom
(
confVO
.
getRate1
(),
confVO
.
getRate2
(),
confVO
.
getRate3
(),
confVO
.
getRate4
(),
confVO
.
getRate5
());
MathRandom
random
=
new
MathRandom
(
confVO
.
getRate1
(),
confVO
.
getRate2
(),
confVO
.
getRate3
(),
confVO
.
getRate4
(),
confVO
.
getRate5
());
List
<
SaveUserCattleDto
>
list
=
new
ArrayList
<>();
List
<
SaveUserCattleDto
>
list
=
new
ArrayList
<>();
SaveUserCattleDto
dto
=
new
SaveUserCattleDto
();
SaveUserCattleDto
dto
=
new
SaveUserCattleDto
();
dto
.
setId
(
SnowFlakeUtil
.
nextId
());
dto
.
setId
(
SnowFlakeUtil
.
nextId
());
dto
.
setUserId
(
param
.
getUserId
());
dto
.
setUserId
(
param
.
getUserId
());
String
barandType
=
random
.
PercentageRandom
()+
""
;
String
barandType
=
random
.
PercentageRandom
()
+
""
;
cattleBrandVO
=
cattleBrandMapper
.
queryCattleBrandList
(
barandType
).
get
(
0
);
cattleBrandVO
=
cattleBrandMapper
.
queryCattleBrandList
(
barandType
).
get
(
0
);
dto
.
setCattleBrandId
(
cattleBrandVO
.
getCattleId
());
dto
.
setCattleBrandId
(
cattleBrandVO
.
getCattleId
());
list
.
add
(
dto
);
list
.
add
(
dto
);
mapper
.
saveCattleBrand
(
list
);
int
k5
=
mapper
.
saveCattleBrand
(
list
);
if
(
k5
<
1
)
{
throw
new
BusinessException
(
"ID@@"
+
param
.
getUserId
()
+
"@@签到发送牛牌异常"
);
}
return
ApiResult
.
ok
(
cattleBrandVO
);
return
ApiResult
.
ok
(
cattleBrandVO
);
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
return
ApiResult
.
error
(
e
.
getMessage
());
return
ApiResult
.
error
(
e
.
getMessage
());
}
}
return
ApiResult
.
ok
();
}
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
@Override
public
ApiResult
getFirsetLgoinRed
(
Long
userId
)
{
public
ApiResult
getFirsetLgoinRed
(
Long
userId
)
{
//判断是否首次登录
//判断是否首次登录
...
@@ -237,21 +267,27 @@ public class UserInfoServiceImpl implements UserInfoService {
...
@@ -237,21 +267,27 @@ public class UserInfoServiceImpl implements UserInfoService {
dto
.
setSourceType
(
CommonTypeEnum
.
REDPACK_SOURCE_TYPE2
.
getCode
());
dto
.
setSourceType
(
CommonTypeEnum
.
REDPACK_SOURCE_TYPE2
.
getCode
());
dto
.
setBatchNum
(
99
);
dto
.
setBatchNum
(
99
);
dto
.
setCreateTime
(
new
Date
());
dto
.
setCreateTime
(
new
Date
());
activityMapper
.
saveRedRainForOne
(
dto
);
int
k1
=
activityMapper
.
saveRedRainForOne
(
dto
);
if
(
k1
<
1
){
throw
new
BusinessException
(
"首次登录新增t_red_rain表异常"
);
}
//更新聚宝盆余额
//更新聚宝盆余额
List
<
UserInfoDto
>
userInfoDtoList
=
new
ArrayList
<>();
List
<
UserInfoDto
>
userInfoDtoList
=
new
ArrayList
<>();
UserInfoDto
userInfoDto
=
new
UserInfoDto
();
UserInfoDto
userInfoDto
=
new
UserInfoDto
();
userInfoDto
.
setUserId
(
userId
);
userInfoDto
.
setUserId
(
userId
);
userInfoDto
.
setRedBalance
(
redVO
.
getAmount
());
userInfoDto
.
setRedBalance
(
redVO
.
getAmount
());
userInfoDtoList
.
add
(
userInfoDto
);
userInfoDtoList
.
add
(
userInfoDto
);
mapper
.
updateRedBalace
(
userInfoDtoList
);
int
k2
=
mapper
.
updateRedBalace
(
userInfoDtoList
);
if
(
k2
<
1
){
throw
new
BusinessException
(
"ID@@"
+
userId
+
"@@首次登录更新余额异常"
);
}
//更新首次登录状态
//更新首次登录状态
mapper
.
updateFirstLoginStatus
(
userId
);
mapper
.
updateFirstLoginStatus
(
userId
);
return
ApiResult
.
ok
(
redVO
.
getAmount
());
return
ApiResult
.
ok
(
redVO
.
getAmount
());
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
return
ApiResult
.
error
(
);
throw
new
BusinessException
(
"ID@@"
+
userId
+
"@@首次登录更新余额异常"
);
}
}
return
ApiResult
.
ok
();
return
ApiResult
.
ok
();
}
}
...
...
activity-admin/src/main/java/com/polysoft/activity/service/impl/WishServiceImpl.java
View file @
bedce49
...
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.conditions.segments.MergeSegments;
...
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.conditions.segments.MergeSegments;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageHelper
;
import
com.polysoft.activity.common.exception.BusinessException
;
import
com.polysoft.activity.common.utils.BeanTransferUtils
;
import
com.polysoft.activity.common.utils.BeanTransferUtils
;
import
com.polysoft.activity.common.utils.PageResult
;
import
com.polysoft.activity.common.utils.PageResult
;
import
com.polysoft.activity.mapper.CattleBrandMapper
;
import
com.polysoft.activity.mapper.CattleBrandMapper
;
...
@@ -29,6 +30,7 @@ import com.polysoft.activity.utils.MathRandom;
...
@@ -29,6 +30,7 @@ import com.polysoft.activity.utils.MathRandom;
import
com.polysoft.activity.utils.SnowFlakeUtil
;
import
com.polysoft.activity.utils.SnowFlakeUtil
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
...
@@ -54,6 +56,7 @@ public class WishServiceImpl implements WishService {
...
@@ -54,6 +56,7 @@ public class WishServiceImpl implements WishService {
@Value
(
"${fileUpload.callWishPicUrl}"
)
@Value
(
"${fileUpload.callWishPicUrl}"
)
private
String
callWishPicUrl
;
private
String
callWishPicUrl
;
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
@Override
public
ApiResult
addWish
(
AddWishParam
param
)
{
public
ApiResult
addWish
(
AddWishParam
param
)
{
try
{
try
{
...
@@ -86,16 +89,22 @@ public class WishServiceImpl implements WishService {
...
@@ -86,16 +89,22 @@ public class WishServiceImpl implements WishService {
saveUserCattleDto
.
setUserId
(
param
.
getUserId
());
saveUserCattleDto
.
setUserId
(
param
.
getUserId
());
String
barandType
=
random
.
PercentageRandom
()+
""
;
String
barandType
=
random
.
PercentageRandom
()+
""
;
cattleBrandVO
=
cattleBrandMapper
.
queryCattleBrandList
(
barandType
).
get
(
0
);
cattleBrandVO
=
cattleBrandMapper
.
queryCattleBrandList
(
barandType
).
get
(
0
);
if
(
cattleBrandVO
==
null
)
{
throw
new
BusinessException
(
"ID@@"
+
param
.
getUserId
()+
"@@发送心愿发放牛牌异常"
);
}
saveUserCattleDto
.
setCattleBrandId
(
cattleBrandVO
.
getCattleId
());
saveUserCattleDto
.
setCattleBrandId
(
cattleBrandVO
.
getCattleId
());
list
.
add
(
saveUserCattleDto
);
list
.
add
(
saveUserCattleDto
);
userInfoMapper
.
saveCattleBrand
(
list
);
int
k2
=
userInfoMapper
.
saveCattleBrand
(
list
);
if
(
k2
<
1
){
throw
new
BusinessException
(
"ID@@"
+
param
.
getUserId
()+
"@@发送心愿发放牛牌异常"
);
}
return
ApiResult
.
ok
(
cattleBrandVO
);
return
ApiResult
.
ok
(
cattleBrandVO
);
}
else
{
}
else
{
return
ApiResult
.
ok
();
return
ApiResult
.
ok
();
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
return
ApiResult
.
error
(
e
.
getMessage
()
);
throw
new
BusinessException
(
"ID@@"
+
param
.
getUserId
()+
"@@发送心愿发放牛牌异常"
);
}
}
}
}
...
...
activity-admin/src/main/java/com/polysoft/activity/task/CattleBrandCarveUpTask.java
View file @
bedce49
...
@@ -35,8 +35,8 @@ public class CattleBrandCarveUpTask {
...
@@ -35,8 +35,8 @@ public class CattleBrandCarveUpTask {
private
ActivityMapper
activityMapper
;
private
ActivityMapper
activityMapper
;
// @Scheduled( cron = "0 20 20 * * ? ")
// @Scheduled( cron = "0 20 20 * * ? ")
// @Scheduled(initialDelay =
60
000, fixedRate = 1*15*60*1000)
// @Scheduled(initialDelay =
5
000, fixedRate = 1*15*60*1000)
@Scheduled
(
cron
=
"0
5 20 17 2 ? "
)
// 2021年2月17号 20时5
分0秒 执行
@Scheduled
(
cron
=
"0
1 20 17 2 ? "
)
// 2021年2月17号 20时
分0秒 执行
public
void
execute
()
{
public
void
execute
()
{
try
{
try
{
sendWechat
();
sendWechat
();
...
@@ -48,10 +48,9 @@ public class CattleBrandCarveUpTask {
...
@@ -48,10 +48,9 @@ public class CattleBrandCarveUpTask {
log
.
info
(
"牛牌瓜分红包任务开始"
);
log
.
info
(
"牛牌瓜分红包任务开始"
);
//查询已经合成牛牌的红包
//查询已经合成牛牌的红包
List
<
Long
>
list
=
activityMapper
.
getRedIdToCattle
(
null
);
List
<
Long
>
list
=
activityMapper
.
getRedIdToCattle
(
null
);
List
<
Long
>
lastList
=
activityMapper
.
getRedIdToCattle
(
BigDecimal
.
valueOf
(
0.00
));
//第一批 牛牌瓜分
//第一批 牛牌瓜分
//生成数量
//生成数量
int
count_1
=
(
int
)
(
list
.
size
()*
0.05
);
int
count_1
=
(
int
)
(
list
.
size
()*
0.05
)
+
1
;
//生成范围
//生成范围
int
random_1
=
list
.
size
();
int
random_1
=
list
.
size
();
HashSet
<
Integer
>
set_1
=
getLuckUser
(
count_1
,
random_1
);
HashSet
<
Integer
>
set_1
=
getLuckUser
(
count_1
,
random_1
);
...
@@ -76,7 +75,7 @@ public class CattleBrandCarveUpTask {
...
@@ -76,7 +75,7 @@ public class CattleBrandCarveUpTask {
//未充值的牛牌红包
//未充值的牛牌红包
List
<
Long
>
redCattlePacke_2
=
activityMapper
.
getRedIdToCattle
(
BigDecimal
.
valueOf
(
0.00
));
List
<
Long
>
redCattlePacke_2
=
activityMapper
.
getRedIdToCattle
(
BigDecimal
.
valueOf
(
0.00
));
//生成数量
//生成数量
int
count_2
=
(
int
)
(
list
.
size
()*
0.15
);
int
count_2
=
(
int
)
(
list
.
size
()*
0.15
)
+
1
;
//生成范围
//生成范围
int
random_2
=
redCattlePacke_2
.
size
();
int
random_2
=
redCattlePacke_2
.
size
();
HashSet
<
Integer
>
set_2
=
getLuckUser
(
count_2
,
random_2
);
HashSet
<
Integer
>
set_2
=
getLuckUser
(
count_2
,
random_2
);
...
@@ -99,7 +98,7 @@ public class CattleBrandCarveUpTask {
...
@@ -99,7 +98,7 @@ public class CattleBrandCarveUpTask {
//未充值的牛牌红包
//未充值的牛牌红包
List
<
Long
>
redCattlePacke_3
=
activityMapper
.
getRedIdToCattle
(
BigDecimal
.
valueOf
(
0.00
));
List
<
Long
>
redCattlePacke_3
=
activityMapper
.
getRedIdToCattle
(
BigDecimal
.
valueOf
(
0.00
));
//生成数量
//生成数量
int
count_3
=
(
int
)
(
list
.
size
()*
0.40
);
int
count_3
=
(
int
)
(
list
.
size
()*
0.40
)
+
1
;
//生成范围
//生成范围
int
random_3
=
redCattlePacke_3
.
size
();
int
random_3
=
redCattlePacke_3
.
size
();
HashSet
<
Integer
>
set_3
=
getLuckUser
(
count_3
,
random_3
);
HashSet
<
Integer
>
set_3
=
getLuckUser
(
count_3
,
random_3
);
...
...
activity-admin/src/main/java/com/polysoft/activity/task/InitRedPackageTask1.java
View file @
bedce49
...
@@ -3,12 +3,15 @@ package com.polysoft.activity.task;
...
@@ -3,12 +3,15 @@ package com.polysoft.activity.task;
import
com.polysoft.activity.common.utils.BeanTransferUtils
;
import
com.polysoft.activity.common.utils.BeanTransferUtils
;
import
com.polysoft.activity.constant.CommonTypeEnum
;
import
com.polysoft.activity.constant.CommonTypeEnum
;
import
com.polysoft.activity.mapper.ActivityMapper
;
import
com.polysoft.activity.mapper.ActivityMapper
;
import
com.polysoft.activity.mapper.CattleBrandMapper
;
import
com.polysoft.activity.mapper.UserInfoMapper
;
import
com.polysoft.activity.mapper.UserInfoMapper
;
import
com.polysoft.activity.model.dto.*
;
import
com.polysoft.activity.model.dto.*
;
import
com.polysoft.activity.model.vo.CattleBrandConfVO
;
import
com.polysoft.activity.model.vo.CattleBrandVO
;
import
com.polysoft.activity.model.vo.CattleBrandVO
;
import
com.polysoft.activity.model.vo.RedAmountTotalVO
;
import
com.polysoft.activity.model.vo.RedAmountTotalVO
;
import
com.polysoft.activity.model.vo.RedRainVO
;
import
com.polysoft.activity.model.vo.RedRainVO
;
import
com.polysoft.activity.service.CattleBrandService
;
import
com.polysoft.activity.service.CattleBrandService
;
import
com.polysoft.activity.utils.MathRandom
;
import
com.polysoft.activity.utils.RedPacketUtil
;
import
com.polysoft.activity.utils.RedPacketUtil
;
import
com.polysoft.activity.utils.SnowFlakeUtil
;
import
com.polysoft.activity.utils.SnowFlakeUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
...
@@ -39,13 +42,22 @@ public class InitRedPackageTask1 {
...
@@ -39,13 +42,22 @@ public class InitRedPackageTask1 {
private
CattleBrandService
cattleBrandService
;
private
CattleBrandService
cattleBrandService
;
@Resource
@Resource
private
UserInfoMapper
userInfoMapper
;
private
UserInfoMapper
userInfoMapper
;
@Resource
private
CattleBrandMapper
cattleBrandMapper
;
// @Scheduled(initialDelay = 10000, fixedRate = 1*15*60*1000)
// @Scheduled(initialDelay = 10000, fixedRate = 1*15*60*1000)
// @Scheduled( cron = "
30 50 14
* * ? ")
// @Scheduled( cron = "
40 10 17
* * ? ")
@Scheduled
(
cron
=
"
32 0 20 11 2 ? "
)
// 2月11日 20点0分32
秒执行
@Scheduled
(
cron
=
"
40 0 20 11 2 ? "
)
// 2月11日 20点0分40
秒执行
public
void
execute
()
{
public
void
execute
()
{
System
.
out
.
println
(
"时间正确"
);
System
.
out
.
println
(
"时间正确"
);
try
{
Thread
.
sleep
(
5000
);
sendWechat
();
sendWechat
();
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
throw
new
RuntimeException
(
"第一场红包雨线程睡眠异常"
);
}
}
}
private
void
sendWechat
(){
private
void
sendWechat
(){
log
.
info
(
"第一批红包雨任务开始"
);
log
.
info
(
"第一批红包雨任务开始"
);
...
@@ -61,7 +73,7 @@ public class InitRedPackageTask1 {
...
@@ -61,7 +73,7 @@ public class InitRedPackageTask1 {
//前10%红包
//前10%红包
int
redNum
=
(
int
)(
list
.
size
()*
0.1
);
int
redNum
=
(
int
)(
list
.
size
()*
0.1
);
RedPacketUtil
redpack
=
new
RedPacketUtil
();
RedPacketUtil
redpack
=
new
RedPacketUtil
();
List
<
Double
>
redAmount
=
redpack
.
getMoney
(
totalMoney
*
0.25
,
redNum
,
0.01
,
1
00
,
2.1
);
List
<
Double
>
redAmount
=
redpack
.
getMoney
(
totalMoney
*
0.25
,
redNum
,
0.01
,
2
00
,
2.1
);
HashSet
<
Integer
>
set
=
getLuckUser
(
redNum
,
list
.
size
());
HashSet
<
Integer
>
set
=
getLuckUser
(
redNum
,
list
.
size
());
int
i
=
0
;
int
i
=
0
;
for
(
Integer
s
:
set
)
{
for
(
Integer
s
:
set
)
{
...
@@ -91,7 +103,7 @@ public class InitRedPackageTask1 {
...
@@ -91,7 +103,7 @@ public class InitRedPackageTask1 {
//前20%红包
//前20%红包
int
redNum
=
(
int
)(
list
.
size
()*
0.2
);
int
redNum
=
(
int
)(
list
.
size
()*
0.2
);
RedPacketUtil
redpack
=
new
RedPacketUtil
();
RedPacketUtil
redpack
=
new
RedPacketUtil
();
List
<
Double
>
redAmount
=
redpack
.
getMoney
(
totalMoney
*
0.25
,
redNum
,
0.01
,
1
00
,
2.1
);
List
<
Double
>
redAmount
=
redpack
.
getMoney
(
totalMoney
*
0.25
,
redNum
,
0.01
,
2
00
,
2.1
);
HashSet
<
Integer
>
set
=
getLuckUser
(
redNum
,
list2
.
size
());
HashSet
<
Integer
>
set
=
getLuckUser
(
redNum
,
list2
.
size
());
int
i
=
0
;
int
i
=
0
;
for
(
Integer
s
:
set
)
{
for
(
Integer
s
:
set
)
{
...
@@ -119,7 +131,7 @@ public class InitRedPackageTask1 {
...
@@ -119,7 +131,7 @@ public class InitRedPackageTask1 {
//前65%红包
//前65%红包
int
redNum
=
(
int
)(
list
.
size
()*
0.65
);
int
redNum
=
(
int
)(
list
.
size
()*
0.65
);
RedPacketUtil
redpack
=
new
RedPacketUtil
();
RedPacketUtil
redpack
=
new
RedPacketUtil
();
List
<
Double
>
redAmount
=
redpack
.
getMoney
(
totalMoney
*
0.5
,
redNum
,
0.01
,
1
00
,
2.1
);
List
<
Double
>
redAmount
=
redpack
.
getMoney
(
totalMoney
*
0.5
,
redNum
,
0.01
,
2
00
,
2.1
);
HashSet
<
Integer
>
set
=
getLuckUser
(
redNum
,
list2
.
size
());
HashSet
<
Integer
>
set
=
getLuckUser
(
redNum
,
list2
.
size
());
int
i
=
0
;
int
i
=
0
;
for
(
Integer
s
:
set
)
{
for
(
Integer
s
:
set
)
{
...
...
activity-admin/src/main/java/com/polysoft/activity/task/InitRedPackageTask2.java
View file @
bedce49
...
@@ -45,10 +45,16 @@ public class InitRedPackageTask2 {
...
@@ -45,10 +45,16 @@ public class InitRedPackageTask2 {
private
UserInfoMapper
userInfoMapper
;
private
UserInfoMapper
userInfoMapper
;
// @Scheduled(initialDelay = 10000, fixedRate = 1*15*60*1000)
// @Scheduled(initialDelay = 10000, fixedRate = 1*15*60*1000)
// @Scheduled( cron = "
20 17 21
* * ? ")
// @Scheduled( cron = "
40 15 17
* * ? ")
@Scheduled
(
cron
=
"
32 0 22 11 2 ? "
)
// 2月11日 22点0分32
秒执行
@Scheduled
(
cron
=
"
40 0 22 11 2 ? "
)
// 2月11日 22点0分40
秒执行
public
void
execute
()
{
public
void
execute
()
{
try
{
Thread
.
sleep
(
5000
);
sendWechat
();
sendWechat
();
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
throw
new
RuntimeException
(
"第二场红包雨线程睡眠异常"
);
}
}
}
private
void
sendWechat
(){
private
void
sendWechat
(){
...
@@ -65,7 +71,7 @@ public class InitRedPackageTask2 {
...
@@ -65,7 +71,7 @@ public class InitRedPackageTask2 {
//前10%红包
//前10%红包
int
redNum
=
(
int
)(
list
.
size
()*
0.1
);
int
redNum
=
(
int
)(
list
.
size
()*
0.1
);
RedPacketUtil
redpack
=
new
RedPacketUtil
();
RedPacketUtil
redpack
=
new
RedPacketUtil
();
List
<
Double
>
redAmount
=
redpack
.
getMoney
(
totalMoney
*
0.25
,
redNum
,
0.01
,
1
00
,
2.1
);
List
<
Double
>
redAmount
=
redpack
.
getMoney
(
totalMoney
*
0.25
,
redNum
,
0.01
,
2
00
,
2.1
);
HashSet
<
Integer
>
set
=
getLuckUser
(
redNum
,
list
.
size
());
HashSet
<
Integer
>
set
=
getLuckUser
(
redNum
,
list
.
size
());
int
i
=
0
;
int
i
=
0
;
for
(
Integer
s
:
set
)
{
for
(
Integer
s
:
set
)
{
...
@@ -95,7 +101,7 @@ public class InitRedPackageTask2 {
...
@@ -95,7 +101,7 @@ public class InitRedPackageTask2 {
//前20%红包
//前20%红包
int
redNum
=
(
int
)(
list
.
size
()*
0.2
);
int
redNum
=
(
int
)(
list
.
size
()*
0.2
);
RedPacketUtil
redpack
=
new
RedPacketUtil
();
RedPacketUtil
redpack
=
new
RedPacketUtil
();
List
<
Double
>
redAmount
=
redpack
.
getMoney
(
totalMoney
*
0.25
,
redNum
,
0.01
,
1
00
,
2.1
);
List
<
Double
>
redAmount
=
redpack
.
getMoney
(
totalMoney
*
0.25
,
redNum
,
0.01
,
2
00
,
2.1
);
HashSet
<
Integer
>
set
=
getLuckUser
(
redNum
,
list2
.
size
());
HashSet
<
Integer
>
set
=
getLuckUser
(
redNum
,
list2
.
size
());
int
i
=
0
;
int
i
=
0
;
for
(
Integer
s
:
set
)
{
for
(
Integer
s
:
set
)
{
...
@@ -123,7 +129,7 @@ public class InitRedPackageTask2 {
...
@@ -123,7 +129,7 @@ public class InitRedPackageTask2 {
//前65%红包
//前65%红包
int
redNum
=
(
int
)(
list
.
size
()*
0.65
);
int
redNum
=
(
int
)(
list
.
size
()*
0.65
);
RedPacketUtil
redpack
=
new
RedPacketUtil
();
RedPacketUtil
redpack
=
new
RedPacketUtil
();
List
<
Double
>
redAmount
=
redpack
.
getMoney
(
totalMoney
*
0.5
,
redNum
,
0.01
,
1
00
,
2.1
);
List
<
Double
>
redAmount
=
redpack
.
getMoney
(
totalMoney
*
0.5
,
redNum
,
0.01
,
2
00
,
2.1
);
HashSet
<
Integer
>
set
=
getLuckUser
(
redNum
,
list2
.
size
());
HashSet
<
Integer
>
set
=
getLuckUser
(
redNum
,
list2
.
size
());
int
i
=
0
;
int
i
=
0
;
for
(
Integer
s
:
set
)
{
for
(
Integer
s
:
set
)
{
...
...
activity-admin/src/main/java/com/polysoft/activity/task/InitRedPackageTask3.java
View file @
bedce49
...
@@ -19,6 +19,7 @@ import lombok.extern.slf4j.Slf4j;
...
@@ -19,6 +19,7 @@ import lombok.extern.slf4j.Slf4j;
import
org.springframework.scheduling.annotation.EnableScheduling
;
import
org.springframework.scheduling.annotation.EnableScheduling
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.CollectionUtils
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
...
@@ -45,10 +46,16 @@ public class InitRedPackageTask3 {
...
@@ -45,10 +46,16 @@ public class InitRedPackageTask3 {
private
UserInfoMapper
userInfoMapper
;
private
UserInfoMapper
userInfoMapper
;
// @Scheduled(initialDelay = 10000, fixedRate = 1*15*60*1000)
// @Scheduled(initialDelay = 10000, fixedRate = 1*15*60*1000)
// @Scheduled( cron = "
20 17 21
* * ? ")
// @Scheduled( cron = "
40 20 17
* * ? ")
@Scheduled
(
cron
=
"
32 0 0 12 2 ? "
)
// 2月12日 0时0点0分32
秒执行
@Scheduled
(
cron
=
"
40 0 0 12 2 ? "
)
// 2月12日 0时0点0分40
秒执行
public
void
execute
()
{
public
void
execute
()
{
try
{
Thread
.
sleep
(
5000
);
sendWechat
();
sendWechat
();
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
throw
new
RuntimeException
(
"第三场红包雨线程睡眠异常"
);
}
}
}
private
void
sendWechat
(){
private
void
sendWechat
(){
...
@@ -62,10 +69,11 @@ public class InitRedPackageTask3 {
...
@@ -62,10 +69,11 @@ public class InitRedPackageTask3 {
dto1
.
setIsEnble
(
CommonTypeEnum
.
RED_ISENBLE_NO
.
getCode
());
dto1
.
setIsEnble
(
CommonTypeEnum
.
RED_ISENBLE_NO
.
getCode
());
dto1
.
setBatchNum
(
batchNum
);
dto1
.
setBatchNum
(
batchNum
);
List
<
RedRainVO
>
list
=
activityMapper
.
queryRedRainList
(
dto1
);
List
<
RedRainVO
>
list
=
activityMapper
.
queryRedRainList
(
dto1
);
// !CollectionUtils.isEmpty(blackLists)
//前10%红包
//前10%红包
int
redNum
=
(
int
)(
list
.
size
()*
0.1
);
int
redNum
=
(
int
)(
list
.
size
()*
0.1
);
RedPacketUtil
redpack
=
new
RedPacketUtil
();
RedPacketUtil
redpack
=
new
RedPacketUtil
();
List
<
Double
>
redAmount
=
redpack
.
getMoney
(
totalMoney
*
0.25
,
redNum
,
0.01
,
1
00
,
2.1
);
List
<
Double
>
redAmount
=
redpack
.
getMoney
(
totalMoney
*
0.25
,
redNum
,
0.01
,
2
00
,
2.1
);
HashSet
<
Integer
>
set
=
getLuckUser
(
redNum
,
list
.
size
());
HashSet
<
Integer
>
set
=
getLuckUser
(
redNum
,
list
.
size
());
int
i
=
0
;
int
i
=
0
;
for
(
Integer
s
:
set
)
{
for
(
Integer
s
:
set
)
{
...
@@ -95,7 +103,7 @@ public class InitRedPackageTask3 {
...
@@ -95,7 +103,7 @@ public class InitRedPackageTask3 {
//前20%红包
//前20%红包
int
redNum
=
(
int
)(
list
.
size
()*
0.2
);
int
redNum
=
(
int
)(
list
.
size
()*
0.2
);
RedPacketUtil
redpack
=
new
RedPacketUtil
();
RedPacketUtil
redpack
=
new
RedPacketUtil
();
List
<
Double
>
redAmount
=
redpack
.
getMoney
(
totalMoney
*
0.25
,
redNum
,
0.01
,
1
00
,
2.1
);
List
<
Double
>
redAmount
=
redpack
.
getMoney
(
totalMoney
*
0.25
,
redNum
,
0.01
,
2
00
,
2.1
);
HashSet
<
Integer
>
set
=
getLuckUser
(
redNum
,
list2
.
size
());
HashSet
<
Integer
>
set
=
getLuckUser
(
redNum
,
list2
.
size
());
int
i
=
0
;
int
i
=
0
;
for
(
Integer
s
:
set
)
{
for
(
Integer
s
:
set
)
{
...
@@ -123,7 +131,7 @@ public class InitRedPackageTask3 {
...
@@ -123,7 +131,7 @@ public class InitRedPackageTask3 {
//前65%红包
//前65%红包
int
redNum
=
(
int
)(
list
.
size
()*
0.65
);
int
redNum
=
(
int
)(
list
.
size
()*
0.65
);
RedPacketUtil
redpack
=
new
RedPacketUtil
();
RedPacketUtil
redpack
=
new
RedPacketUtil
();
List
<
Double
>
redAmount
=
redpack
.
getMoney
(
totalMoney
*
0.5
,
redNum
,
0.01
,
1
00
,
2.1
);
List
<
Double
>
redAmount
=
redpack
.
getMoney
(
totalMoney
*
0.5
,
redNum
,
0.01
,
2
00
,
2.1
);
HashSet
<
Integer
>
set
=
getLuckUser
(
redNum
,
list2
.
size
());
HashSet
<
Integer
>
set
=
getLuckUser
(
redNum
,
list2
.
size
());
int
i
=
0
;
int
i
=
0
;
for
(
Integer
s
:
set
)
{
for
(
Integer
s
:
set
)
{
...
...
activity-admin/src/main/java/com/polysoft/activity/task/UserSignTask.java
View file @
bedce49
...
@@ -29,9 +29,8 @@ public class UserSignTask {
...
@@ -29,9 +29,8 @@ public class UserSignTask {
/**
/**
* 补签任务
* 补签任务
*/
*/
// @Scheduled( cron = "0 21 20 * * ? ")
// @Scheduled( cron = "0 35 17 * * ? ")
// @Scheduled(initialDelay = 10000, fixedRate = 1*15*60*1000)
@Scheduled
(
cron
=
"0 5 0 12,13,14,15,16,17 2 ? "
)
//2月12,13,14,15,16,17 0时5分0秒执行
@Scheduled
(
cron
=
"0 5 0 4,13,14,15,16,17 2 ? "
)
//2月12,13,14,15,16,17 0时5分0秒执行
public
void
execute
()
{
public
void
execute
()
{
try
{
try
{
sendWechat
();
sendWechat
();
...
...
activity-admin/src/main/java/com/polysoft/activity/task/WishLuckDrawTask.java
View file @
bedce49
...
@@ -31,7 +31,8 @@ public class WishLuckDrawTask {
...
@@ -31,7 +31,8 @@ public class WishLuckDrawTask {
@Resource
@Resource
private
WishRealPrizeMapper
wishRealPrizeMapper
;
private
WishRealPrizeMapper
wishRealPrizeMapper
;
// @Scheduled( cron = "0 21 20 * * ? ")
// @Scheduled( cron = "0 40 17 * * ? ")
// @Scheduled(initialDelay = 5000, fixedRate = 1*15*60*1000)
@Scheduled
(
cron
=
"0 20 20 11,12,13,14,15,16,17 2 ? "
)
//2月11,12,13,14,15,16,17, 20时20分0秒执行
@Scheduled
(
cron
=
"0 20 20 11,12,13,14,15,16,17 2 ? "
)
//2月11,12,13,14,15,16,17, 20时20分0秒执行
public
void
execute
()
{
public
void
execute
()
{
try
{
try
{
...
@@ -65,7 +66,7 @@ public class WishLuckDrawTask {
...
@@ -65,7 +66,7 @@ public class WishLuckDrawTask {
WishRealPrizeDto
dto
=
new
WishRealPrizeDto
();
WishRealPrizeDto
dto
=
new
WishRealPrizeDto
();
dto
.
setId
(
SnowFlakeUtil
.
nextId
());
dto
.
setId
(
SnowFlakeUtil
.
nextId
());
dto
.
setUserId
(
item
.
getUserId
());
dto
.
setUserId
(
item
.
getUserId
());
dto
.
setWishId
(
dto
.
getWishId
());
dto
.
setWishId
(
item
.
getWishId
());
dto
.
setPrizeId
(
realPrizeVO
.
getPrizeId
());
dto
.
setPrizeId
(
realPrizeVO
.
getPrizeId
());
dto
.
setCreateTime
(
date
);
dto
.
setCreateTime
(
date
);
dtos
.
add
(
dto
);
dtos
.
add
(
dto
);
...
...
activity-admin/src/main/resources/mapper/ActivityMapper.xml
View file @
bedce49
...
@@ -172,6 +172,7 @@
...
@@ -172,6 +172,7 @@
</select>
</select>
<select
id=
"queryRedPackInfo"
resultType=
"com.polysoft.activity.model.vo.RedPackInfoVO"
>
<select
id=
"queryRedPackInfo"
resultType=
"com.polysoft.activity.model.vo.RedPackInfoVO"
>
SELECT
SELECT
t.red_id ,
t.red_amount,
t.red_amount,
t.source_type,
t.source_type,
t.create_time
t.create_time
...
@@ -180,7 +181,7 @@
...
@@ -180,7 +181,7 @@
WHERE
WHERE
t.user_id = #{userId} and red_type = '1' and t.is_enble='1'
t.user_id = #{userId} and red_type = '1' and t.is_enble='1'
ORDER BY
ORDER BY
t.
create_time
DESC
t.
red_id
DESC
</select>
</select>
<select
id=
"getKukcyMoney"
resultType=
"com.polysoft.activity.model.vo.SmashBasinVO"
>
<select
id=
"getKukcyMoney"
resultType=
"com.polysoft.activity.model.vo.SmashBasinVO"
>
SELECT
SELECT
...
@@ -263,4 +264,13 @@
...
@@ -263,4 +264,13 @@
and red_amount = #{redAmount}
and red_amount = #{redAmount}
</if>
</if>
</select>
</select>
<select
id=
"getRedPackRecharge"
resultType=
"java.lang.Integer"
>
SELECT
count(*)
FROM
t_red_rain t
WHERE
t.batch_num = #{batchNum}
AND t.is_enble = #{isEnble}
</select>
</mapper>
</mapper>
activity-admin/src/main/resources/mapper/CattleBrandMapper.xml
View file @
bedce49
...
@@ -98,8 +98,8 @@
...
@@ -98,8 +98,8 @@
<select
id=
"getTaskStatus"
resultType=
"com.polysoft.activity.model.vo.TaskStatusVO"
>
<select
id=
"getTaskStatus"
resultType=
"com.polysoft.activity.model.vo.TaskStatusVO"
>
SELECT
SELECT
t.user_id AS userId,
t.user_id AS userId,
(select count(*) from t_wish tw where tw.user_id = t.user_id and tw.push_date=#{today}) AS everyDay
Sign
,
(select count(*) from t_wish tw where tw.user_id = t.user_id and tw.push_date=#{today}) AS everyDay
Wish
,
(select count(*) from t_user_sign tus where tus.user_id = t.user_id and tus.sign_status='1' and tus.sign_date=#{today}) AS everyDay
Wish
,
(select count(*) from t_user_sign tus where tus.user_id = t.user_id and tus.sign_status='1' and tus.sign_date=#{today}) AS everyDay
Sign
,
(select count(*) from t_share ts where ts.user_id = t.user_id and ts.share_date=#{today}) AS everyDayShare
(select count(*) from t_share ts where ts.user_id = t.user_id and ts.share_date=#{today}) AS everyDayShare
FROM
FROM
t_user t
t_user t
...
...
activity-admin/src/main/resources/mapper/WishMapper.xml
View file @
bedce49
...
@@ -30,8 +30,9 @@
...
@@ -30,8 +30,9 @@
FROM
FROM
t_wish t
t_wish t
WHERE
WHERE
t.push_date = DATE_FORMAT(NOW(),'%Y-%m-%d')
t.push_date = '2021-02-04'
AND t.user_id NOT IN ( SELECT t2.user_id FROM t_wish_real_prize t2 )
/* t.push_date = DATE_FORMAT(NOW(),'%Y-%m-%d')
*/ AND t.user_id NOT IN ( SELECT t2.user_id FROM t_wish_real_prize t2 )
GROUP by t.user_id
GROUP by t.user_id
order by t.user_id asc
order by t.user_id asc
</select>
</select>
...
...
activity-
admin/src/main/java/com/polysoft/activity/config
/exception/BusinessException.java
→
activity-
common/src/main/java/com/polysoft/activity/common
/exception/BusinessException.java
View file @
bedce49
package
com
.
polysoft
.
activity
.
co
nfig
.
exception
;
package
com
.
polysoft
.
activity
.
co
mmon
.
exception
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
...
@@ -6,7 +6,7 @@ import javax.servlet.http.HttpServletResponse;
...
@@ -6,7 +6,7 @@ import javax.servlet.http.HttpServletResponse;
* @author by zhangbr
* @author by zhangbr
* @date 2020/4/20.
* @date 2020/4/20.
*/
*/
public
class
BusinessException
extends
Exception
{
public
class
BusinessException
extends
Runtime
Exception
{
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
...
...
activity-common/src/main/java/com/polysoft/activity/utils/RedPacketUtil.java
View file @
bedce49
...
@@ -78,4 +78,10 @@ public class RedPacketUtil {
...
@@ -78,4 +78,10 @@ public class RedPacketUtil {
return
splitRedPackets
(
money
,
count
,
MINMONEY
,
MAXMONEY
,
TIMES
);
return
splitRedPackets
(
money
,
count
,
MINMONEY
,
MAXMONEY
,
TIMES
);
}
}
public
static
void
main
(
String
[]
args
)
{
RedPacketUtil
redpack
=
new
RedPacketUtil
();
List
<
Double
>
redAmount
=
redpack
.
getMoney
(
4000
,
227
,
5
,
100
,
2.1
);
redAmount
.
forEach
(
a
->
System
.
out
.
println
(
a
));
}
}
}
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment