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 59f8c1d4
authored
Jan 28, 2021
by
lvyp
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
红包雨-红包发放
1 parent
17ac7f96
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
159 additions
and
38 deletions
activity-admin/src/main/java/com/polysoft/activity/mapper/ActivityMapper.java
activity-admin/src/main/java/com/polysoft/activity/mapper/CattleBrandMapper.java
activity-admin/src/main/java/com/polysoft/activity/mapper/UserInfoMapper.java
activity-admin/src/main/java/com/polysoft/activity/mapper/WishMapper.java
activity-admin/src/main/java/com/polysoft/activity/model/dto/ActItemDto.java
activity-admin/src/main/java/com/polysoft/activity/model/dto/AddRedRainDto.java
activity-admin/src/main/java/com/polysoft/activity/model/dto/CattleBrandDto.java
activity-admin/src/main/java/com/polysoft/activity/model/param/AddRedRainParam.java
activity-admin/src/main/java/com/polysoft/activity/model/vo/CattleBrandVO.java
activity-admin/src/main/java/com/polysoft/activity/model/vo/QueryRealPrizeVO.java
activity-admin/src/main/java/com/polysoft/activity/model/vo/RedRainVO.java
activity-admin/src/main/java/com/polysoft/activity/service/CattleBrandService.java
activity-admin/src/main/java/com/polysoft/activity/service/impl/CattleBrandServiceImpl.java
activity-admin/src/main/java/com/polysoft/activity/task/InitRedPackageTask.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/mapper/ActivityMapper.java
View file @
59f8c1d
...
@@ -23,4 +23,5 @@ public interface ActivityMapper extends BaseMapper<ActItemDto> {
...
@@ -23,4 +23,5 @@ public interface ActivityMapper extends BaseMapper<ActItemDto> {
int
saveRedRain
(
@Param
(
"list"
)
List
<
AddRedRainDto
>
list
);
int
saveRedRain
(
@Param
(
"list"
)
List
<
AddRedRainDto
>
list
);
List
<
RedRainVO
>
queryRedRainList
(
QueryRedRainDto
dto
);
List
<
RedRainVO
>
queryRedRainList
(
QueryRedRainDto
dto
);
int
updateRedPackage
(
List
<
AddRedRainDto
>
dto
);
int
updateRedPackage
(
List
<
AddRedRainDto
>
dto
);
int
updateRedPackageForCattle
(
List
<
AddRedRainDto
>
dto
);
}
}
activity-admin/src/main/java/com/polysoft/activity/mapper/CattleBrandMapper.java
0 → 100644
View file @
59f8c1d
package
com
.
polysoft
.
activity
.
mapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.polysoft.activity.model.dto.CattleBrandDto
;
import
com.polysoft.activity.model.vo.CattleBrandVO
;
import
org.mapstruct.Mapper
;
import
java.util.List
;
@Mapper
public
interface
CattleBrandMapper
extends
BaseMapper
<
CattleBrandDto
>
{
List
<
CattleBrandVO
>
queryCattleBrandList
();
}
activity-admin/src/main/java/com/polysoft/activity/mapper/UserInfoMapper.java
View file @
59f8c1d
...
@@ -3,7 +3,7 @@ package com.polysoft.activity.mapper;
...
@@ -3,7 +3,7 @@ package com.polysoft.activity.mapper;
import
com.polysoft.activity.model.dto.WechatTokenDto
;
import
com.polysoft.activity.model.dto.WechatTokenDto
;
import
com.polysoft.activity.model.vo.UserInfoVO
;
import
com.polysoft.activity.model.vo.UserInfoVO
;
import
com.polysoft.activity.model.vo.WechatToken
;
import
com.polysoft.activity.model.vo.WechatToken
;
import
org.
apache.ibatis.annotations
.Mapper
;
import
org.
mapstruct
.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
import
java.util.List
;
...
...
activity-admin/src/main/java/com/polysoft/activity/mapper/WishMapper.java
View file @
59f8c1d
...
@@ -6,7 +6,7 @@ import com.polysoft.activity.model.param.QueryWishParam;
...
@@ -6,7 +6,7 @@ import com.polysoft.activity.model.param.QueryWishParam;
import
com.polysoft.activity.model.vo.QueryLuckDrawWishVO
;
import
com.polysoft.activity.model.vo.QueryLuckDrawWishVO
;
import
com.polysoft.activity.model.vo.QueryRealPrizeVO
;
import
com.polysoft.activity.model.vo.QueryRealPrizeVO
;
import
com.polysoft.activity.model.vo.WishVO
;
import
com.polysoft.activity.model.vo.WishVO
;
import
org.
apache.ibatis.annotations
.Mapper
;
import
org.
mapstruct
.Mapper
;
import
java.util.List
;
import
java.util.List
;
...
...
activity-admin/src/main/java/com/polysoft/activity/model/dto/ActItemDto.java
View file @
59f8c1d
...
@@ -10,9 +10,14 @@ import lombok.Data;
...
@@ -10,9 +10,14 @@ import lombok.Data;
@Data
@Data
@TableName
(
value
=
"act_item"
)
@TableName
(
value
=
"act_item"
)
public
class
ActItemDto
{
public
class
ActItemDto
{
//主键
private
Long
id
;
private
Long
id
;
//活动名称
private
String
activityName
;
private
String
activityName
;
//活动开始时间
private
String
startTime
;
private
String
startTime
;
//活动结束时间
private
String
emdTime
;
private
String
emdTime
;
//活动状态 0 未开始 1 正在进行 2 即将开始 3 已结束
private
int
activityStatus
;
private
int
activityStatus
;
}
}
activity-admin/src/main/java/com/polysoft/activity/model/dto/AddRedRainDto.java
View file @
59f8c1d
...
@@ -3,6 +3,7 @@ package com.polysoft.activity.model.dto;
...
@@ -3,6 +3,7 @@ package com.polysoft.activity.model.dto;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.date.DateUtil
;
import
lombok.Data
;
import
lombok.Data
;
import
java.math.BigDecimal
;
import
java.util.Date
;
import
java.util.Date
;
/**
/**
...
@@ -15,7 +16,7 @@ public class AddRedRainDto {
...
@@ -15,7 +16,7 @@ public class AddRedRainDto {
//用户主键
//用户主键
private
Long
userId
;
private
Long
userId
;
//红包金额
//红包金额
private
String
redAmount
;
private
BigDecimal
redAmount
;
//红包类型 0 普通红包 1 牛牌
//红包类型 0 普通红包 1 牛牌
private
int
redType
;
private
int
redType
;
//牛牌主键
//牛牌主键
...
...
activity-admin/src/main/java/com/polysoft/activity/model/dto/CattleBrandDto.java
0 → 100644
View file @
59f8c1d
package
com
.
polysoft
.
activity
.
model
.
dto
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
lombok.Data
;
@Data
@TableName
(
"t_cattle_brand"
)
public
class
CattleBrandDto
{
private
Long
cattleId
;
private
int
brandType
;
private
String
brandName
;
}
activity-admin/src/main/java/com/polysoft/activity/model/param/AddRedRainParam.java
View file @
59f8c1d
package
com
.
polysoft
.
activity
.
model
.
param
;
package
com
.
polysoft
.
activity
.
model
.
param
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.Data
;
/**
/**
...
@@ -9,7 +10,10 @@ import lombok.Data;
...
@@ -9,7 +10,10 @@ import lombok.Data;
*/
*/
@Data
@Data
public
class
AddRedRainParam
{
public
class
AddRedRainParam
{
@ApiModelProperty
(
"用户主键"
)
private
Long
userId
;
private
Long
userId
;
@ApiModelProperty
(
"用户主键"
)
private
int
redNum
;
private
int
redNum
;
@ApiModelProperty
(
"用户主键"
)
private
int
batchNum
;
private
int
batchNum
;
}
}
activity-admin/src/main/java/com/polysoft/activity/model/vo/CattleBrandVO.java
0 → 100644
View file @
59f8c1d
package
com
.
polysoft
.
activity
.
model
.
vo
;
import
lombok.Data
;
@Data
public
class
CattleBrandVO
{
private
Long
cattleId
;
private
int
brandType
;
private
String
brandName
;
}
activity-admin/src/main/java/com/polysoft/activity/model/vo/QueryRealPrizeVO.java
View file @
59f8c1d
...
@@ -2,6 +2,8 @@ package com.polysoft.activity.model.vo;
...
@@ -2,6 +2,8 @@ package com.polysoft.activity.model.vo;
import
lombok.Data
;
import
lombok.Data
;
import
java.math.BigDecimal
;
/**
/**
* @author lvyp
* @author lvyp
* @date 2021/1/27
* @date 2021/1/27
...
@@ -12,5 +14,5 @@ public class QueryRealPrizeVO {
...
@@ -12,5 +14,5 @@ public class QueryRealPrizeVO {
private
String
prizeName
;
private
String
prizeName
;
private
String
luckDrawDate
;
private
String
luckDrawDate
;
private
String
prizeNum
;
private
String
prizeNum
;
private
String
prizePrice
;
private
BigDecimal
prizePrice
;
}
}
activity-admin/src/main/java/com/polysoft/activity/model/vo/RedRainVO.java
View file @
59f8c1d
...
@@ -3,6 +3,7 @@ package com.polysoft.activity.model.vo;
...
@@ -3,6 +3,7 @@ package com.polysoft.activity.model.vo;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.date.DateUtil
;
import
lombok.Data
;
import
lombok.Data
;
import
java.math.BigDecimal
;
import
java.util.Date
;
import
java.util.Date
;
/**
/**
...
@@ -15,7 +16,7 @@ public class RedRainVO {
...
@@ -15,7 +16,7 @@ public class RedRainVO {
//用户主键
//用户主键
private
Long
userId
;
private
Long
userId
;
//红包金额
//红包金额
private
String
redAmount
;
private
BigDecimal
redAmount
;
//红包类型 0 普通红包 1 牛牌
//红包类型 0 普通红包 1 牛牌
private
int
redType
;
private
int
redType
;
//牛牌主键
//牛牌主键
...
...
activity-admin/src/main/java/com/polysoft/activity/service/CattleBrandService.java
0 → 100644
View file @
59f8c1d
package
com
.
polysoft
.
activity
.
service
;
import
com.polysoft.activity.model.vo.CattleBrandVO
;
import
com.polysoft.activity.utils.ApiResult
;
import
java.util.List
;
public
interface
CattleBrandService
{
ApiResult
queryCattleBrandList
();
}
activity-admin/src/main/java/com/polysoft/activity/service/impl/CattleBrandServiceImpl.java
0 → 100644
View file @
59f8c1d
package
com
.
polysoft
.
activity
.
service
.
impl
;
import
com.polysoft.activity.mapper.CattleBrandMapper
;
import
com.polysoft.activity.service.CattleBrandService
;
import
com.polysoft.activity.utils.ApiResult
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
@Service
public
class
CattleBrandServiceImpl
implements
CattleBrandService
{
@Resource
private
CattleBrandMapper
cattleBrandMapper
;
@Override
public
ApiResult
queryCattleBrandList
()
{
return
ApiResult
.
ok
(
cattleBrandMapper
.
queryCattleBrandList
());
}
}
activity-admin/src/main/java/com/polysoft/activity/task/InitRedPackageTask.java
View file @
59f8c1d
...
@@ -6,13 +6,16 @@ import com.polysoft.activity.common.utils.BeanTransferUtils;
...
@@ -6,13 +6,16 @@ import com.polysoft.activity.common.utils.BeanTransferUtils;
import
com.polysoft.activity.mapper.ActivityMapper
;
import
com.polysoft.activity.mapper.ActivityMapper
;
import
com.polysoft.activity.model.dto.AddRedRainDto
;
import
com.polysoft.activity.model.dto.AddRedRainDto
;
import
com.polysoft.activity.model.dto.QueryRedRainDto
;
import
com.polysoft.activity.model.dto.QueryRedRainDto
;
import
com.polysoft.activity.model.vo.CattleBrandVO
;
import
com.polysoft.activity.model.vo.RedRainVO
;
import
com.polysoft.activity.model.vo.RedRainVO
;
import
com.polysoft.activity.service.CattleBrandService
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
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
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
java.math.BigDecimal
;
import
java.text.DecimalFormat
;
import
java.text.DecimalFormat
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.Date
;
...
@@ -31,9 +34,11 @@ public class InitRedPackageTask {
...
@@ -31,9 +34,11 @@ public class InitRedPackageTask {
@Resource
@Resource
private
ActivityMapper
activityMapper
;
private
ActivityMapper
activityMapper
;
@Resource
private
CattleBrandService
cattleBrandService
;
// @Scheduled(initialDelay = 10000, fixedRate = 1*15*60*1000)
// @Scheduled(initialDelay = 10000, fixedRate = 1*15*60*1000)
@Scheduled
(
cron
=
"
20 59 17
* * ? "
)
@Scheduled
(
cron
=
"
50 06 22
* * ? "
)
public
void
execute
()
{
public
void
execute
()
{
sendWechat
();
sendWechat
();
}
}
...
@@ -57,6 +62,7 @@ public class InitRedPackageTask {
...
@@ -57,6 +62,7 @@ public class InitRedPackageTask {
// if(currentTime > batch3 ){
// if(currentTime > batch3 ){
// batchNum = 3;
// batchNum = 3;
// }
// }
LoggerHelper
.
debug
(
this
.
getClass
(),
"任务开始"
);
//查询出没有初始化的红包
//查询出没有初始化的红包
int
batchNum
=
1
;
int
batchNum
=
1
;
double
totalMoney
=
5000.00
;
double
totalMoney
=
5000.00
;
...
@@ -73,7 +79,7 @@ public class InitRedPackageTask {
...
@@ -73,7 +79,7 @@ public class InitRedPackageTask {
int
i
=
0
;
int
i
=
0
;
for
(
Integer
s
:
set
)
{
for
(
Integer
s
:
set
)
{
AddRedRainDto
addRedRainDto
=
BeanTransferUtils
.
transfer
(
list
.
get
(
s
),
AddRedRainDto
.
class
);
AddRedRainDto
addRedRainDto
=
BeanTransferUtils
.
transfer
(
list
.
get
(
s
),
AddRedRainDto
.
class
);
addRedRainDto
.
setRedAmount
(
redAmount
[
i
]+
""
);
addRedRainDto
.
setRedAmount
(
BigDecimal
.
valueOf
(
redAmount
[
i
])
);
addRedRainDto
.
setRedType
(
1
);
addRedRainDto
.
setRedType
(
1
);
addRedRainDto
.
setIsEnble
(
1
);
addRedRainDto
.
setIsEnble
(
1
);
batchList
.
add
(
addRedRainDto
);
batchList
.
add
(
addRedRainDto
);
...
@@ -85,12 +91,11 @@ public class InitRedPackageTask {
...
@@ -85,12 +91,11 @@ public class InitRedPackageTask {
if
(
2
==
2
){
if
(
2
==
2
){
//获取红包总数
//获取红包总数
QueryRedRainDto
dto
=
new
QueryRedRainDto
();
QueryRedRainDto
dto
=
new
QueryRedRainDto
();
List
<
AddRedRainDto
>
batchList
=
new
ArrayList
<>();
dto
.
setBatchNum
(
batchNum
);
dto
.
setBatchNum
(
batchNum
);
List
<
RedRainVO
>
list
=
activityMapper
.
queryRedRainList
(
dto
);
List
<
RedRainVO
>
list
=
activityMapper
.
queryRedRainList
(
dto
);
List
<
AddRedRainDto
>
batchList2
=
new
ArrayList
<>();
//获取未结算的红包数
//获取未结算的红包数
QueryRedRainDto
dto2
=
new
QueryRedRainDto
();
QueryRedRainDto
dto2
=
new
QueryRedRainDto
();
List
<
AddRedRainDto
>
batchList2
=
new
ArrayList
<>();
dto2
.
setIsEnble
(
0
);
dto2
.
setIsEnble
(
0
);
dto2
.
setBatchNum
(
batchNum
);
dto2
.
setBatchNum
(
batchNum
);
List
<
RedRainVO
>
list2
=
activityMapper
.
queryRedRainList
(
dto
);
List
<
RedRainVO
>
list2
=
activityMapper
.
queryRedRainList
(
dto
);
...
@@ -101,8 +106,8 @@ public class InitRedPackageTask {
...
@@ -101,8 +106,8 @@ public class InitRedPackageTask {
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
)
{
AddRedRainDto
addRedRainDto
=
BeanTransferUtils
.
transfer
(
list
.
get
(
s
),
AddRedRainDto
.
class
);
AddRedRainDto
addRedRainDto
=
BeanTransferUtils
.
transfer
(
list
2
.
get
(
s
),
AddRedRainDto
.
class
);
addRedRainDto
.
setRedAmount
(
redAmount
[
i
]+
""
);
addRedRainDto
.
setRedAmount
(
BigDecimal
.
valueOf
(
redAmount
[
i
])
);
addRedRainDto
.
setRedType
(
1
);
addRedRainDto
.
setRedType
(
1
);
addRedRainDto
.
setIsEnble
(
1
);
addRedRainDto
.
setIsEnble
(
1
);
batchList2
.
add
(
addRedRainDto
);
batchList2
.
add
(
addRedRainDto
);
...
@@ -113,24 +118,22 @@ public class InitRedPackageTask {
...
@@ -113,24 +118,22 @@ public class InitRedPackageTask {
if
(
3
==
3
){
if
(
3
==
3
){
//获取红包总数
//获取红包总数
QueryRedRainDto
dto
=
new
QueryRedRainDto
();
QueryRedRainDto
dto
=
new
QueryRedRainDto
();
List
<
AddRedRainDto
>
batchList
=
new
ArrayList
<>();
dto
.
setBatchNum
(
batchNum
);
dto
.
setBatchNum
(
batchNum
);
List
<
RedRainVO
>
list
=
activityMapper
.
queryRedRainList
(
dto
);
List
<
RedRainVO
>
list
=
activityMapper
.
queryRedRainList
(
dto
);
List
<
AddRedRainDto
>
batchList2
=
new
ArrayList
<>();
//获取未结算的红包数
//获取未结算的红包数
QueryRedRainDto
dto2
=
new
QueryRedRainDto
();
QueryRedRainDto
dto2
=
new
QueryRedRainDto
();
List
<
AddRedRainDto
>
batchList2
=
new
ArrayList
<>();
dto2
.
setIsEnble
(
0
);
dto2
.
setIsEnble
(
0
);
dto2
.
setBatchNum
(
batchNum
);
dto2
.
setBatchNum
(
batchNum
);
List
<
RedRainVO
>
list2
=
activityMapper
.
queryRedRainList
(
dto
);
List
<
RedRainVO
>
list2
=
activityMapper
.
queryRedRainList
(
dto
);
//前65%红包
//前65%红包
int
redNum
=
(
int
)(
list
.
size
()*
0.65
);
int
redNum
=
(
int
)(
list
.
size
()*
0.65
);
double
[]
redAmount
=
getMoney
(
5000.00
*
0.
4
,
redNum
);
double
[]
redAmount
=
getMoney
(
5000.00
*
0.
5
,
redNum
);
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
)
{
AddRedRainDto
addRedRainDto
=
BeanTransferUtils
.
transfer
(
list
.
get
(
s
),
AddRedRainDto
.
class
);
AddRedRainDto
addRedRainDto
=
BeanTransferUtils
.
transfer
(
list
2
.
get
(
s
),
AddRedRainDto
.
class
);
addRedRainDto
.
setRedAmount
(
redAmount
[
i
]+
""
);
addRedRainDto
.
setRedAmount
(
BigDecimal
.
valueOf
(
redAmount
[
i
])
);
addRedRainDto
.
setRedType
(
1
);
addRedRainDto
.
setRedType
(
1
);
addRedRainDto
.
setIsEnble
(
1
);
addRedRainDto
.
setIsEnble
(
1
);
batchList2
.
add
(
addRedRainDto
);
batchList2
.
add
(
addRedRainDto
);
...
@@ -141,32 +144,31 @@ public class InitRedPackageTask {
...
@@ -141,32 +144,31 @@ public class InitRedPackageTask {
if
(
4
==
4
){
if
(
4
==
4
){
//获取红包总数
//获取红包总数
QueryRedRainDto
dto
=
new
QueryRedRainDto
();
QueryRedRainDto
dto
=
new
QueryRedRainDto
();
List
<
AddRedRainDto
>
batchList
=
new
ArrayList
<>();
dto
.
setBatchNum
(
batchNum
);
dto
.
setBatchNum
(
batchNum
);
List
<
RedRainVO
>
list
=
activityMapper
.
queryRedRainList
(
dto
);
List
<
RedRainVO
>
list
=
activityMapper
.
queryRedRainList
(
dto
);
List
<
AddRedRainDto
>
batchList2
=
new
ArrayList
<>();
//获取未结算的红包数
//获取未结算的红包数
QueryRedRainDto
dto2
=
new
QueryRedRainDto
();
QueryRedRainDto
dto2
=
new
QueryRedRainDto
();
List
<
AddRedRainDto
>
batchList2
=
new
ArrayList
<>();
dto2
.
setIsEnble
(
0
);
dto2
.
setIsEnble
(
0
);
dto2
.
setBatchNum
(
batchNum
);
dto2
.
setBatchNum
(
batchNum
);
List
<
RedRainVO
>
list2
=
activityMapper
.
queryRedRainList
(
dto
);
List
<
RedRainVO
>
list2
=
activityMapper
.
queryRedRainList
(
dto
);
//前5%红包牛牌
//前5%红包
int
redNum
=
list2
.
size
();
int
redNum
=
list2
.
size
();
double
[]
redAmount
=
getMoney
(
5000.00
*
0.10
,
redNum
);
HashSet
<
Integer
>
set
=
getLuckUser
(
redNum
,
list2
.
size
());
HashSet
<
Integer
>
set
=
getLuckUser
(
redNum
,
list2
.
size
());
List
<
CattleBrandVO
>
cattleList
=
(
List
<
CattleBrandVO
>)
cattleBrandService
.
queryCattleBrandList
().
get
(
"data"
);
int
i
=
0
;
int
i
=
0
;
for
(
Integer
s
:
set
)
{
for
(
Integer
s
:
set
)
{
AddRedRainDto
addRedRainDto
=
BeanTransferUtils
.
transfer
(
list
.
get
(
s
),
AddRedRainDto
.
class
);
AddRedRainDto
addRedRainDto
=
BeanTransferUtils
.
transfer
(
list2
.
get
(
s
),
AddRedRainDto
.
class
);
addRedRainDto
.
setRedAmount
(
redAmount
[
i
]+
""
);
int
k
=
new
Random
().
nextInt
(
4
);
addRedRainDto
.
setRedType
(
1
);
addRedRainDto
.
setCattleBrandId
(
cattleList
.
get
(
k
).
getCattleId
());
addRedRainDto
.
setRedType
(
2
);
addRedRainDto
.
setIsEnble
(
1
);
addRedRainDto
.
setIsEnble
(
1
);
batchList2
.
add
(
addRedRainDto
);
batchList2
.
add
(
addRedRainDto
);
i
++;
i
++;
}
}
activityMapper
.
updateRedPackage
(
batchList2
);
activityMapper
.
updateRedPackage
ForCattle
(
batchList2
);
}
}
LoggerHelper
.
debug
(
this
.
getClass
(),
"任务结束"
);
}
}
private
HashSet
<
Integer
>
getLuckUser
(
int
count
,
int
random
){
private
HashSet
<
Integer
>
getLuckUser
(
int
count
,
int
random
){
HashSet
<
Integer
>
has
=
new
HashSet
<
Integer
>();
HashSet
<
Integer
>
has
=
new
HashSet
<
Integer
>();
...
...
activity-admin/src/main/resources/mapper/ActivityMapper.xml
View file @
59f8c1d
...
@@ -47,7 +47,31 @@
...
@@ -47,7 +47,31 @@
</foreach>
</foreach>
</where>
</where>
</update>
</update>
<update
id=
"updateRedPackageForCattle"
parameterType=
"java.util.List"
>
update t_red_rain
<trim
prefix=
"set"
suffixOverrides=
","
>
<trim
prefix=
" cattle_brand_id = case"
suffix=
"end,"
>
<foreach
collection=
"list"
item=
"item"
index=
"index"
>
when red_id=#{item.redId} then #{item.cattleBrandId}
</foreach>
</trim>
<trim
prefix=
" red_type = case"
suffix=
"end,"
>
<foreach
collection=
"list"
item=
"item"
index=
"index"
>
when red_id=#{item.redId} then #{item.redType}
</foreach>
</trim>
<trim
prefix=
" is_enble = case"
suffix=
"end,"
>
<foreach
collection=
"list"
item=
"item"
index=
"index"
>
when red_id=#{item.redId} then #{item.isEnble}
</foreach>
</trim>
</trim>
<where>
<foreach
collection=
"list"
separator=
"or"
item=
"item"
index=
"index"
>
red_id=#{item.redId}
</foreach>
</where>
</update>
<select
id=
"queryActivityInfo"
resultType=
"com.polysoft.activity.model.vo.ActItemVO"
>
<select
id=
"queryActivityInfo"
resultType=
"com.polysoft.activity.model.vo.ActItemVO"
>
SELECT
SELECT
id,
id,
...
@@ -68,17 +92,18 @@
...
@@ -68,17 +92,18 @@
red_type,
red_type,
is_enble
is_enble
from t_red_rain where
from t_red_rain where
<if
test=
"isEnble !=null and isEnble !='' "
>
1=1
is_enble = #{isEnble}
<if
test=
"isEnble !=null "
>
and is_enble = #{isEnble}
</if>
</if>
<if
test=
"userId !=null
and userId !=''
"
>
<if
test=
"userId !=null "
>
user_id = #{userId}
and
user_id = #{userId}
</if>
</if>
<if
test=
"redType !=null
and redType !=''
"
>
<if
test=
"redType !=null "
>
red_type = #{redType}
and
red_type = #{redType}
</if>
</if>
<if
test=
"batchNum !=null
and batchNum !=''
"
>
<if
test=
"batchNum !=null "
>
batch_num = #{batchNum}
and
batch_num = #{batchNum}
</if>
</if>
order by red_id asc
order by red_id asc
</select>
</select>
...
...
activity-admin/src/main/resources/mapper/CattleBrandMapper.xml
0 → 100644
View file @
59f8c1d
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.polysoft.activity.mapper.CattleBrandMapper"
>
<select
id=
"queryCattleBrandList"
resultType=
"com.polysoft.activity.model.vo.CattleBrandVO"
>
select
cattle_id,
brand_type,
brand_name
from t_cattle_brand
</select>
</mapper>
activity-admin/src/main/resources/mapper/WishMapper.xml
View file @
59f8c1d
...
@@ -23,10 +23,10 @@
...
@@ -23,10 +23,10 @@
<if
test=
"pushDate !=null and pushDate != '' "
>
<if
test=
"pushDate !=null and pushDate != '' "
>
and push_date = #{pushDate}
and push_date = #{pushDate}
</if>
</if>
<if
test=
"wishId != null
and wishId != ''
"
>
<if
test=
"wishId != null "
>
and wish_id = #{wishId}
and wish_id = #{wishId}
</if>
</if>
<if
test=
"userId != null
and userId != ''
"
>
<if
test=
"userId != null "
>
and user_id = #{userId}
and user_id = #{userId}
</if>
</if>
</where>
</where>
...
...
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