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 117c68c8
authored
Jan 30, 2021
by
xunj
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
优化
1 parent
b0ac7c0d
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
242 additions
and
58 deletions
activity-admin/src/main/java/com/polysoft/activity/controller/UserController.java
activity-admin/src/main/java/com/polysoft/activity/controller/WishController.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/param/IdQueryParam.java
activity-admin/src/main/java/com/polysoft/activity/model/param/UserSignParam.java
activity-admin/src/main/java/com/polysoft/activity/model/vo/UserInfoVO.java
activity-admin/src/main/java/com/polysoft/activity/model/vo/UserSignVO.java
activity-admin/src/main/java/com/polysoft/activity/model/vo/WishVO.java
activity-admin/src/main/java/com/polysoft/activity/service/UserInfoService.java
activity-admin/src/main/java/com/polysoft/activity/service/WishService.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/UserSignTask.java
activity-admin/src/main/java/com/polysoft/activity/task/WishLuckDrawTask.java
activity-admin/src/main/resources/mapper/CattleBrandMapper.xml
activity-admin/src/main/resources/mapper/UserInfoMapper.xml
activity-admin/src/main/resources/mapper/WishMapper.xml
activity-common/src/main/java/com/polysoft/activity/common/utils/PageQuery.java
activity-common/src/main/java/com/polysoft/activity/utils/FileUtils.java
activity-admin/src/main/java/com/polysoft/activity/controller/UserController.java
View file @
117c68c
package
com
.
polysoft
.
activity
.
controller
;
package
com
.
polysoft
.
activity
.
controller
;
import
com.polysoft.activity.model.param.IdQueryParam
;
import
com.polysoft.activity.model.param.ShareLinkParam
;
import
com.polysoft.activity.model.param.ShareLinkParam
;
import
com.polysoft.activity.model.param.UserInfoParam
;
import
com.polysoft.activity.model.param.UserInfoParam
;
import
com.polysoft.activity.service.UserInfoService
;
import
com.polysoft.activity.service.UserInfoService
;
...
@@ -41,4 +42,9 @@ public class UserController {
...
@@ -41,4 +42,9 @@ public class UserController {
public
ApiResult
saveUserSign
(
@RequestBody
UserInfoParam
param
)
{
public
ApiResult
saveUserSign
(
@RequestBody
UserInfoParam
param
)
{
return
userInfoService
.
saveUserSign
(
param
);
return
userInfoService
.
saveUserSign
(
param
);
}
}
@PostMapping
(
"/queryUserSign"
)
@ResponseBody
public
ApiResult
queryUserSign
(
@RequestBody
IdQueryParam
param
)
{
return
userInfoService
.
queryUserSignByUserId
(
param
.
getId
(),
null
);
}
}
}
activity-admin/src/main/java/com/polysoft/activity/controller/WishController.java
View file @
117c68c
...
@@ -18,6 +18,7 @@ import org.springframework.web.bind.annotation.RestController;
...
@@ -18,6 +18,7 @@ import org.springframework.web.bind.annotation.RestController;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
java.util.List
;
@RestController
@RestController
@RequestMapping
(
"/wish"
)
@RequestMapping
(
"/wish"
)
...
@@ -32,10 +33,16 @@ public class WishController {
...
@@ -32,10 +33,16 @@ public class WishController {
public
ApiResult
addWish
(
@Validated
AddWishParam
param
)
{
public
ApiResult
addWish
(
@Validated
AddWishParam
param
)
{
return
wishService
.
addWish
(
param
);
return
wishService
.
addWish
(
param
);
}
}
@
Ge
tMapping
(
"/queryWishList"
)
@
Pos
tMapping
(
"/queryWishList"
)
@ResponseBody
@ResponseBody
public
ApiResult
queryWishList
(
@RequestBody
QueryWishParam
param
)
{
public
ApiResult
queryWishList
(
@RequestBody
QueryWishParam
param
)
{
return
wishService
.
queryWishList
(
param
);
return
wishService
.
queryWishList
(
param
);
}
}
@GetMapping
(
"/queryPrizeUser"
)
@ResponseBody
public
ApiResult
queryPrizeUser
()
{
return
wishService
.
getPrizeUserName
();
}
}
}
activity-admin/src/main/java/com/polysoft/activity/mapper/UserInfoMapper.java
View file @
117c68c
...
@@ -8,6 +8,7 @@ import com.polysoft.activity.model.dto.WechatTokenDto;
...
@@ -8,6 +8,7 @@ import com.polysoft.activity.model.dto.WechatTokenDto;
import
com.polysoft.activity.model.param.UserInfoParam
;
import
com.polysoft.activity.model.param.UserInfoParam
;
import
com.polysoft.activity.model.vo.FirstLoginRedVO
;
import
com.polysoft.activity.model.vo.FirstLoginRedVO
;
import
com.polysoft.activity.model.vo.UserInfoVO
;
import
com.polysoft.activity.model.vo.UserInfoVO
;
import
com.polysoft.activity.model.vo.UserSignVO
;
import
com.polysoft.activity.model.vo.WechatToken
;
import
com.polysoft.activity.model.vo.WechatToken
;
import
org.mapstruct.Mapper
;
import
org.mapstruct.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Param
;
...
@@ -28,4 +29,5 @@ public interface UserInfoMapper {
...
@@ -28,4 +29,5 @@ public interface UserInfoMapper {
int
getFirstoginYesOrNo
(
@Param
(
"userId"
)
Long
userId
);
int
getFirstoginYesOrNo
(
@Param
(
"userId"
)
Long
userId
);
int
updateFirstLoginStatus
(
@Param
(
"userId"
)
Long
userId
);
int
updateFirstLoginStatus
(
@Param
(
"userId"
)
Long
userId
);
UserInfoVO
getUserByComposeStatus
(
UserInfoForComposeStatusDto
dto
);
UserInfoVO
getUserByComposeStatus
(
UserInfoForComposeStatusDto
dto
);
List
<
UserSignVO
>
queryUserSignByUserId
(
@Param
(
"userId"
)
Long
userId
,
@Param
(
"signDate"
)
String
signDate
);
}
}
activity-admin/src/main/java/com/polysoft/activity/mapper/WishMapper.java
View file @
117c68c
...
@@ -17,5 +17,6 @@ public interface WishMapper extends BaseMapper<AddWishDto> {
...
@@ -17,5 +17,6 @@ public interface WishMapper extends BaseMapper<AddWishDto> {
List
<
QueryLuckDrawWishVO
>
queryLuckDrawWish
();
List
<
QueryLuckDrawWishVO
>
queryLuckDrawWish
();
QueryRealPrizeVO
querRealPrize
();
QueryRealPrizeVO
querRealPrize
();
int
getWishFirstPushOnDay
(
@Param
(
"userId"
)
Long
userId
,
@Param
(
"pushDate"
)
String
pushDate
);
int
getWishFirstPushOnDay
(
@Param
(
"userId"
)
Long
userId
,
@Param
(
"pushDate"
)
String
pushDate
);
List
<
String
>
getPrizeUserName
();
}
}
activity-admin/src/main/java/com/polysoft/activity/model/param/IdQueryParam.java
0 → 100644
View file @
117c68c
package
com
.
polysoft
.
activity
.
model
.
param
;
import
lombok.Data
;
/**
* @author lvyp
* @date 2021/1/30
*/
@Data
public
class
IdQueryParam
{
private
Long
id
;
}
activity-admin/src/main/java/com/polysoft/activity/model/param/UserSignParam.java
0 → 100644
View file @
117c68c
package
com
.
polysoft
.
activity
.
model
.
param
;
import
lombok.Data
;
/**
* @author lvyp
* @date 2021/1/30
*/
@Data
public
class
UserSignParam
{
private
Long
userId
;
private
Long
signId
;
}
activity-admin/src/main/java/com/polysoft/activity/model/vo/UserInfoVO.java
View file @
117c68c
...
@@ -28,4 +28,5 @@ public class UserInfoVO implements Serializable {
...
@@ -28,4 +28,5 @@ public class UserInfoVO implements Serializable {
@ApiModelProperty
(
"牛牌合成时间"
)
@ApiModelProperty
(
"牛牌合成时间"
)
private
String
composeCattleTime
;
private
String
composeCattleTime
;
private
String
sysCurretTime
;
private
String
sysCurretTime
;
private
String
hammerStatus
;
}
}
activity-admin/src/main/java/com/polysoft/activity/model/vo/UserSignVO.java
0 → 100644
View file @
117c68c
package
com
.
polysoft
.
activity
.
model
.
vo
;
import
lombok.Data
;
/**
* @author lvyp
* @date 2021/1/30
*/
@Data
public
class
UserSignVO
{
private
Long
id
;
private
Long
userId
;
private
String
signDate
;
private
String
signStatus
;
}
activity-admin/src/main/java/com/polysoft/activity/model/vo/WishVO.java
View file @
117c68c
...
@@ -6,6 +6,7 @@ import io.swagger.annotations.ApiModelProperty;
...
@@ -6,6 +6,7 @@ import io.swagger.annotations.ApiModelProperty;
import
lombok.Data
;
import
lombok.Data
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
/**
/**
* @author lvyp
* @author lvyp
...
@@ -30,5 +31,6 @@ public class WishVO {
...
@@ -30,5 +31,6 @@ public class WishVO {
private
String
pushDate
;
private
String
pushDate
;
@ApiModelProperty
(
"0 未删除 1 已删除"
)
@ApiModelProperty
(
"0 未删除 1 已删除"
)
private
String
deleteFalg
;
private
String
deleteFalg
;
private
List
<
String
>
picList
;
private
String
picUrl
;
private
String
picUrl
;
}
}
activity-admin/src/main/java/com/polysoft/activity/service/UserInfoService.java
View file @
117c68c
...
@@ -5,9 +5,12 @@ import com.polysoft.activity.model.param.ShareLinkParam;
...
@@ -5,9 +5,12 @@ import com.polysoft.activity.model.param.ShareLinkParam;
import
com.polysoft.activity.model.param.UserInfoParam
;
import
com.polysoft.activity.model.param.UserInfoParam
;
import
com.polysoft.activity.utils.ApiResult
;
import
com.polysoft.activity.utils.ApiResult
;
import
java.util.List
;
public
interface
UserInfoService
{
public
interface
UserInfoService
{
ApiResult
queryAuthUser
(
UserInfoParam
param
);
ApiResult
queryAuthUser
(
UserInfoParam
param
);
ApiResult
getShareLink
(
ShareLinkParam
param
);
ApiResult
getShareLink
(
ShareLinkParam
param
);
ApiResult
saveUserSign
(
UserInfoParam
param
);
ApiResult
saveUserSign
(
UserInfoParam
param
);
ApiResult
getFirsetLgoinRed
(
Long
userId
);
ApiResult
getFirsetLgoinRed
(
Long
userId
);
ApiResult
queryUserSignByUserId
(
Long
userId
,
String
signDate
);
}
}
activity-admin/src/main/java/com/polysoft/activity/service/WishService.java
View file @
117c68c
...
@@ -16,4 +16,5 @@ public interface WishService {
...
@@ -16,4 +16,5 @@ public interface WishService {
ApiResult
queryWishList
(
QueryWishParam
pageNum
);
ApiResult
queryWishList
(
QueryWishParam
pageNum
);
List
<
QueryLuckDrawWishVO
>
queryLuckDrawWish
();
List
<
QueryLuckDrawWishVO
>
queryLuckDrawWish
();
QueryRealPrizeVO
querRealPrize
();
QueryRealPrizeVO
querRealPrize
();
ApiResult
getPrizeUserName
();
}
}
activity-admin/src/main/java/com/polysoft/activity/service/impl/UserInfoServiceImpl.java
View file @
117c68c
...
@@ -102,30 +102,43 @@ public class UserInfoServiceImpl implements UserInfoService {
...
@@ -102,30 +102,43 @@ public class UserInfoServiceImpl implements UserInfoService {
@Override
@Override
public
ApiResult
saveUserSign
(
UserInfoParam
param
)
{
public
ApiResult
saveUserSign
(
UserInfoParam
param
)
{
try
{
String
today
=
DateUtil
.
format
(
new
Date
(),
"yyyy-MM-dd"
);
List
<
UserSignVO
>
list2
=
mapper
.
queryUserSignByUserId
(
param
.
getUserId
(),
today
);
if
(
list2
!=
null
&&
list2
.
size
()
>
0
){
return
ApiResult
.
ok
();
}
UserSignDto
userSignDto
=
new
UserSignDto
();
UserSignDto
userSignDto
=
new
UserSignDto
();
CattleBrandConfVO
confVO
=
cattleBrandMapper
.
queryCattleBrandConf
(
DateUtil
.
format
(
new
Date
(),
"yyyy-MM-dd"
))
;
CattleBrandVO
cattleBrandVO
=
null
;
// CattleBrandConfVO confVO = cattleBrandMapper.queryCattleBrandConf("2021-02-11"
);
CattleBrandConfVO
confVO
=
cattleBrandMapper
.
queryCattleBrandConf
(
today
);
if
(
param
.
getSignId
()
!=
null
){
if
(
param
.
getSignId
()
!=
null
){
userSignDto
.
setId
(
param
.
getSignId
());
userSignDto
.
setId
(
param
.
getSignId
());
userSignDto
.
setCreateTime
(
new
Date
());
userSignDto
.
setCreateTime
(
new
Date
());
userSignDto
.
setSignStatus
(
"2
"
);
userSignDto
.
setSignStatus
(
"1
"
);
mapper
.
updateUserSign
(
userSignDto
);
mapper
.
updateUserSign
(
userSignDto
);
}
else
{
}
else
{
MathRandom
a
=
new
MathRandom
(
confVO
.
getRate1
(),
confVO
.
getRate2
(),
confVO
.
getRate3
(),
confVO
.
getRate4
(),
confVO
.
getRate5
());
userSignDto
.
setId
(
SnowFlakeUtil
.
nextId
());
userSignDto
.
setId
(
SnowFlakeUtil
.
nextId
());
userSignDto
.
setUserId
(
param
.
getUserId
());
userSignDto
.
setUserId
(
param
.
getUserId
());
userSignDto
.
setSignStatus
(
"1"
);
userSignDto
.
setSignStatus
(
"1"
);
userSignDto
.
setSignDate
(
new
Date
());
userSignDto
.
setSignDate
(
new
Date
());
userSignDto
.
setCreateTime
(
new
Date
());
userSignDto
.
setCreateTime
(
new
Date
());
mapper
.
saveUserSign
(
userSignDto
);
mapper
.
saveUserSign
(
userSignDto
);
}
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
());
dto
.
setCattleBrandId
(
cattleBrandMapper
.
queryCattleBrandList
((
a
.
PercentageRandom
()+
""
)).
get
(
0
).
getCattleId
());
String
barandType
=
random
.
PercentageRandom
()+
""
;
cattleBrandVO
=
cattleBrandMapper
.
queryCattleBrandList
(
barandType
).
get
(
0
);
dto
.
setCattleBrandId
(
cattleBrandVO
.
getCattleId
());
list
.
add
(
dto
);
mapper
.
saveCattleBrand
(
list
);
mapper
.
saveCattleBrand
(
list
);
return
ApiResult
.
ok
(
cattleBrandVO
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
ApiResult
.
error
(
e
.
getMessage
());
}
}
return
ApiResult
.
ok
();
}
}
@Override
@Override
...
@@ -167,4 +180,10 @@ public class UserInfoServiceImpl implements UserInfoService {
...
@@ -167,4 +180,10 @@ public class UserInfoServiceImpl implements UserInfoService {
}
}
return
ApiResult
.
ok
();
return
ApiResult
.
ok
();
}
}
@Override
public
ApiResult
queryUserSignByUserId
(
Long
userId
,
String
signDate
)
{
return
ApiResult
.
ok
(
mapper
.
queryUserSignByUserId
(
userId
,
null
));
}
}
}
activity-admin/src/main/java/com/polysoft/activity/service/impl/WishServiceImpl.java
View file @
117c68c
...
@@ -78,12 +78,13 @@ public class WishServiceImpl implements WishService {
...
@@ -78,12 +78,13 @@ public class WishServiceImpl implements WishService {
//发放牛牌
//发放牛牌
if
(
i
>
0
&&
firstPushNum
==
0
){
if
(
i
>
0
&&
firstPushNum
==
0
){
CattleBrandConfVO
confVO
=
cattleBrandMapper
.
queryCattleBrandConf
(
DateUtil
.
format
(
new
Date
(),
"yyyy-MM-dd"
));
CattleBrandConfVO
confVO
=
cattleBrandMapper
.
queryCattleBrandConf
(
DateUtil
.
format
(
new
Date
(),
"yyyy-MM-dd"
));
MathRandom
a
=
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
saveUserCattleDto
=
new
SaveUserCattleDto
();
SaveUserCattleDto
saveUserCattleDto
=
new
SaveUserCattleDto
();
saveUserCattleDto
.
setId
(
SnowFlakeUtil
.
nextId
());
saveUserCattleDto
.
setId
(
SnowFlakeUtil
.
nextId
());
saveUserCattleDto
.
setUserId
(
param
.
getUserId
());
saveUserCattleDto
.
setUserId
(
param
.
getUserId
());
cattleBrandVO
=
cattleBrandMapper
.
queryCattleBrandList
((
a
.
PercentageRandom
()+
""
)).
get
(
0
);
String
barandType
=
random
.
PercentageRandom
()+
""
;
cattleBrandVO
=
cattleBrandMapper
.
queryCattleBrandList
(
barandType
).
get
(
0
);
saveUserCattleDto
.
setCattleBrandId
(
cattleBrandVO
.
getCattleId
());
saveUserCattleDto
.
setCattleBrandId
(
cattleBrandVO
.
getCattleId
());
list
.
add
(
saveUserCattleDto
);
list
.
add
(
saveUserCattleDto
);
userInfoMapper
.
saveCattleBrand
(
list
);
userInfoMapper
.
saveCattleBrand
(
list
);
...
@@ -99,7 +100,9 @@ public class WishServiceImpl implements WishService {
...
@@ -99,7 +100,9 @@ public class WishServiceImpl implements WishService {
@Override
@Override
public
ApiResult
queryWishList
(
QueryWishParam
param
)
{
public
ApiResult
queryWishList
(
QueryWishParam
param
)
{
if
(
param
.
getIsPage
()){
PageHelper
.
startPage
(
param
.
getPageNum
(),
param
.
getPageSize
());
PageHelper
.
startPage
(
param
.
getPageNum
(),
param
.
getPageSize
());
}
PageResult
<
WishVO
>
result
=
BeanTransferUtils
.
toPagedResult
(
mapper
.
queryWishList
(
param
),
WishVO
.
class
);
PageResult
<
WishVO
>
result
=
BeanTransferUtils
.
toPagedResult
(
mapper
.
queryWishList
(
param
),
WishVO
.
class
);
return
ApiResult
.
ok
(
result
);
return
ApiResult
.
ok
(
result
);
}
}
...
@@ -113,4 +116,9 @@ public class WishServiceImpl implements WishService {
...
@@ -113,4 +116,9 @@ public class WishServiceImpl implements WishService {
public
QueryRealPrizeVO
querRealPrize
()
{
public
QueryRealPrizeVO
querRealPrize
()
{
return
mapper
.
querRealPrize
();
return
mapper
.
querRealPrize
();
}
}
@Override
public
ApiResult
getPrizeUserName
()
{
return
ApiResult
.
ok
(
mapper
.
getPrizeUserName
());
}
}
}
activity-admin/src/main/java/com/polysoft/activity/task/UserSignTask.java
0 → 100644
View file @
117c68c
package
com
.
polysoft
.
activity
.
task
;
import
com.polysoft.activity.common.log.LoggerHelper
;
import
com.polysoft.activity.mapper.WishRealPrizeMapper
;
import
com.polysoft.activity.model.dto.WishRealPrizeDto
;
import
com.polysoft.activity.model.vo.QueryLuckDrawWishVO
;
import
com.polysoft.activity.model.vo.QueryRealPrizeVO
;
import
com.polysoft.activity.service.WishService
;
import
com.polysoft.activity.utils.SnowFlakeUtil
;
import
org.springframework.scheduling.annotation.EnableScheduling
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Component
;
import
javax.annotation.Resource
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.Random
;
/**
* @author lvyp
* @date 2021/1/21
*/
@Component
@EnableScheduling
public
class
UserSignTask
{
@Resource
private
WishService
wishService
;
@Resource
private
WishRealPrizeMapper
wishRealPrizeMapper
;
@Scheduled
(
cron
=
"0 21 20 * * ? "
)
// @Scheduled( cron = "0 55 10 * * ? ")
public
void
execute
()
{
try
{
sendWechat
();
}
catch
(
Exception
e
)
{
LoggerHelper
.
err
(
this
.
getClass
(),
"EpidemicForSendWechatp休眠异常:{}"
,
e
);
}
}
private
void
sendWechat
(){
//查询疫情回访数据基础表
LoggerHelper
.
info
(
this
.
getClass
(),
"任务开始"
);
List
<
QueryLuckDrawWishVO
>
wishForToday
=
wishService
.
queryLuckDrawWish
();
QueryRealPrizeVO
realPrizeVO
=
wishService
.
querRealPrize
();
List
<
WishRealPrizeDto
>
dtos
=
new
ArrayList
<>();
Date
date
=
new
Date
();
if
(
wishForToday
!=
null
&&
wishForToday
.
size
()
>
0
&&
realPrizeVO
!=
null
)
{
if
(
wishForToday
.
size
()
<
10
)
{
wishForToday
.
forEach
(
item
->
{
WishRealPrizeDto
dto
=
new
WishRealPrizeDto
();
dto
.
setId
(
SnowFlakeUtil
.
nextId
());
dto
.
setUserId
(
item
.
getUserId
());
dto
.
setWishId
(
item
.
getWishId
());
dto
.
setPrizeId
(
realPrizeVO
.
getPrizeId
());
dto
.
setCreateTime
(
date
);
dtos
.
add
(
dto
);
});
}
else
{
HashSet
<
Integer
>
has
=
getLuckUser
(
10
,
wishForToday
.
size
());
for
(
Integer
n
:
has
)
{
QueryLuckDrawWishVO
item
=
wishForToday
.
get
(
n
);
WishRealPrizeDto
dto
=
new
WishRealPrizeDto
();
dto
.
setId
(
SnowFlakeUtil
.
nextId
());
dto
.
setUserId
(
item
.
getUserId
());
dto
.
setWishId
(
dto
.
getWishId
());
dto
.
setPrizeId
(
realPrizeVO
.
getPrizeId
());
dto
.
setCreateTime
(
date
);
dtos
.
add
(
dto
);
}
}
wishRealPrizeMapper
.
saveWishRealPrizeForList
(
dtos
);
}
else
{
LoggerHelper
.
info
(
this
.
getClass
(),
"无抽奖"
);
}
}
private
HashSet
<
Integer
>
getLuckUser
(
int
count
,
int
random
){
HashSet
<
Integer
>
has
=
new
HashSet
<
Integer
>();
Integer
i
=
0
;
for
(
int
j
=
1
;
j
!=
0
;
j
++)
{
i
=
new
Random
().
nextInt
(
random
);
has
.
add
(
i
);
if
(
count
==
has
.
size
())
{
break
;
}
}
return
has
;
}
}
activity-admin/src/main/java/com/polysoft/activity/task/WishLuckDrawTask.java
View file @
117c68c
...
@@ -67,9 +67,8 @@ public class WishLuckDrawTask {
...
@@ -67,9 +67,8 @@ public class WishLuckDrawTask {
});
});
}
else
{
}
else
{
HashSet
<
Integer
>
has
=
getLuckUser
(
10
,
wishForToday
.
size
());
HashSet
<
Integer
>
has
=
getLuckUser
(
10
,
wishForToday
.
size
());
List
<
QueryLuckDrawWishVO
>
luckWish
=
wishService
.
queryLuckDrawWish
();
for
(
Integer
n
:
has
)
{
for
(
Integer
n
:
has
)
{
QueryLuckDrawWishVO
item
=
luckWish
.
get
(
n
);
QueryLuckDrawWishVO
item
=
wishForToday
.
get
(
n
);
WishRealPrizeDto
dto
=
new
WishRealPrizeDto
();
WishRealPrizeDto
dto
=
new
WishRealPrizeDto
();
dto
.
setId
(
SnowFlakeUtil
.
nextId
());
dto
.
setId
(
SnowFlakeUtil
.
nextId
());
dto
.
setUserId
(
item
.
getUserId
());
dto
.
setUserId
(
item
.
getUserId
());
...
...
activity-admin/src/main/resources/mapper/CattleBrandMapper.xml
View file @
117c68c
...
@@ -12,10 +12,11 @@
...
@@ -12,10 +12,11 @@
cattle_id,
cattle_id,
brand_type,
brand_type,
brand_name
brand_name
from t_cattle_brand where
from t_cattle_brand
where
1=1
1=1
<if
test=
"brandType != null and brandType != '' "
>
<if
test=
"brandType != null and brandType != '' "
>
and brand_
name
#{brandType}
and brand_
type =
#{brandType}
</if>
</if>
</select>
</select>
<select
id=
"queryCattleBrandByUserId"
resultType=
"com.polysoft.activity.model.vo.CattleBrandFroUserVO"
>
<select
id=
"queryCattleBrandByUserId"
resultType=
"com.polysoft.activity.model.vo.CattleBrandFroUserVO"
>
...
@@ -55,7 +56,7 @@
...
@@ -55,7 +56,7 @@
SELECT
SELECT
t2.brand_type,
t2.brand_type,
t2.brand_name ,
t2.brand_name ,
t1.
cattle_brand_i
d,
t1.
id as cattleBrandI
d,
t1.user_id
t1.user_id
FROM
FROM
t_user_cattle t1 LEFT join t_cattle_brand t2 ON ( t2.cattle_id = t1.cattle_brand_id )
t_user_cattle t1 LEFT join t_cattle_brand t2 ON ( t2.cattle_id = t1.cattle_brand_id )
...
...
activity-admin/src/main/resources/mapper/UserInfoMapper.xml
View file @
117c68c
...
@@ -11,7 +11,8 @@
...
@@ -11,7 +11,8 @@
dept_name,
dept_name,
is_first,
is_first,
compose_cattle_status,
compose_cattle_status,
compose_cattle_time
compose_cattle_time,
hammer_status
from
from
t_user where
t_user where
1=1
1=1
...
@@ -91,7 +92,7 @@
...
@@ -91,7 +92,7 @@
UPDATE t_user_sign
UPDATE t_user_sign
SET
SET
sign_status =#{signStatus},
sign_status =#{signStatus},
create_time =#{
#{
createTime}
create_time =#{createTime}
where id = #{id}
where id = #{id}
</insert>
</insert>
<select
id=
"getUserByComposeStatus"
parameterType=
"com.polysoft.activity.model.dto.UserInfoForComposeStatusDto"
<select
id=
"getUserByComposeStatus"
parameterType=
"com.polysoft.activity.model.dto.UserInfoForComposeStatusDto"
...
@@ -101,6 +102,21 @@
...
@@ -101,6 +102,21 @@
from t_user
from t_user
where
where
user_id=#{userId}
user_id=#{userId}
</select>
</select>
<select
id=
"queryUserSignByUserId"
resultType=
"com.polysoft.activity.model.vo.UserSignVO"
>
select
t.id,
t.sign_date,
t.sign_status,
t.user_id
from
t_user_sign t
where
user_id = #{userId}
<if
test=
"signDate != null and signDate != '' "
>
and sign_date = #{signDate}
</if>
order by t.sign_date asc
</select>
</mapper>
</mapper>
activity-admin/src/main/resources/mapper/WishMapper.xml
View file @
117c68c
...
@@ -13,23 +13,15 @@
...
@@ -13,23 +13,15 @@
t1.prize_falg,
t1.prize_falg,
t1.create_time,
t1.create_time,
t1.push_date,
t1.push_date,
t2.
pic_url
( SELECT GROUP_CONCAT(t.pic_url) FROM t_wish_pic t WHERE t.wish_id = t1.wish_id ) as
pic_url
FROM
FROM
t_wish t1
t_wish t1
left join t_wish_pic t2 on(t1.wish_id = t2.wish_id)
left join t_wish_pic t2 on(t1.wish_id = t2.wish_id)
<where>
order by create_time desc
1=1
<if
test=
"isPage == false"
>
<if
test=
"pushDate !=null and pushDate != '' "
>
limit 20
and push_date = #{pushDate}
</if>
</if>
<if
test=
"wishId != null "
>
and wish_id = #{wishId}
</if>
<if
test=
"userId != null "
>
and user_id = #{userId}
</if>
</where>
</select>
</select>
<select
id=
"queryLuckDrawWish"
resultType=
"com.polysoft.activity.model.vo.QueryLuckDrawWishVO"
>
<select
id=
"queryLuckDrawWish"
resultType=
"com.polysoft.activity.model.vo.QueryLuckDrawWishVO"
>
SELECT
SELECT
...
@@ -64,4 +56,13 @@
...
@@ -64,4 +56,13 @@
user_id = #{userId}
user_id = #{userId}
and push_date =#{pushDate}
and push_date =#{pushDate}
</select>
</select>
<select
id=
"getPrizeUserName"
resultType=
"java.lang.String"
>
SELECT
t2.user_name
FROM
t_wish_real_prize t
LEFT JOIN t_user t2 ON ( t2.user_id = t.user_id )
WHERE
DATE_FORMAT( t.create_time, '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
</select>
</mapper>
</mapper>
activity-common/src/main/java/com/polysoft/activity/common/utils/PageQuery.java
View file @
117c68c
package
com
.
polysoft
.
activity
.
common
.
utils
;
package
com
.
polysoft
.
activity
.
common
.
utils
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
/**
/**
* @author by zhangbr
* @author by zhangbr
* @date 2020/6/24.
* @date 2020/6/24.
*/
*/
@Data
public
class
PageQuery
{
public
class
PageQuery
{
@ApiModelProperty
(
"当前页码"
)
@ApiModelProperty
(
"当前页码"
)
private
Integer
pageNum
=
1
;
private
Integer
pageNum
=
1
;
@ApiModelProperty
(
"每页显示条数,默认
3
0"
)
@ApiModelProperty
(
"每页显示条数,默认
2
0"
)
private
Integer
pageSize
=
3
0
;
private
Integer
pageSize
=
2
0
;
@ApiModelProperty
(
value
=
"是否分页,默认:true"
)
@ApiModelProperty
(
value
=
"是否分页,默认:true"
)
private
Boolean
isPage
=
true
;
private
Boolean
isPage
=
true
;
public
Integer
getPageNum
()
{
return
pageNum
;
}
public
void
setPageNum
(
Integer
pageNum
)
{
this
.
pageNum
=
pageNum
;
}
public
Integer
getPageSize
()
{
return
pageSize
;
}
public
void
setPageSize
(
Integer
pageSize
)
{
this
.
pageSize
=
pageSize
;
}
public
Boolean
getPage
()
{
return
isPage
;
}
public
void
setPage
(
Boolean
page
)
{
isPage
=
page
;
}
}
}
activity-common/src/main/java/com/polysoft/activity/utils/FileUtils.java
View file @
117c68c
...
@@ -31,17 +31,23 @@ public class FileUtils {
...
@@ -31,17 +31,23 @@ public class FileUtils {
File
dest
=
null
;
File
dest
=
null
;
try
{
try
{
// String path=uploadpath+File.separator+date+File.separator+uuid+fileName;
// String path=uploadpath+File.separator+date+File.separator+uuid+fileName;
String
path
=
uploadpath
+
"/"
+
date
+
"/"
+
uuid
+
fileName
;
String
fileType
=
fileName
.
substring
(
fileName
.
indexOf
(
"."
),
fileName
.
length
());
String
path
=
uploadpath
+
"/"
+
date
+
"/"
+
uuid
+
fileType
;
dest
=
new
File
(
path
);
dest
=
new
File
(
path
);
if
(!
dest
.
getParentFile
().
exists
())
{
if
(!
dest
.
getParentFile
().
exists
())
{
dest
.
getParentFile
().
mkdirs
();
dest
.
getParentFile
().
mkdirs
();
}
}
file
.
transferTo
(
dest
);
file
.
transferTo
(
dest
);
log
.
info
(
"上传成功"
);
log
.
info
(
"上传成功"
);
return
ApiResult
.
ok
(
"/"
+
date
+
"/"
+
uuid
+
file
Nam
e
);
return
ApiResult
.
ok
(
"/"
+
date
+
"/"
+
uuid
+
file
Typ
e
);
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
e
.
printStackTrace
();
e
.
printStackTrace
();
return
ApiResult
.
error
();
return
ApiResult
.
error
();
}
}
}
}
public
static
void
main
(
String
[]
args
)
{
String
ss
=
"0ab520bfbbcd4ca8b3c66c7b4dbd8e3eF5A3F540-D6A3-404F-807C-A55D5D2FBE1E.jpeg"
;
System
.
out
.
println
(
ss
.
substring
(
ss
.
indexOf
(
"."
),
ss
.
length
()));
}
}
}
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