Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gxpt_ht
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
pseer
gxpt_ht
Commits
0cf41771
Commit
0cf41771
authored
Jul 23, 2024
by
吕明尚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
活动增加根据选择日期输出活动列表
parent
913f484c
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
77 additions
and
6 deletions
+77
-6
ActivityController.java
.../java/share/web/controller/system/ActivityController.java
+4
-2
ActivityDto.java
...tem/src/main/java/share/system/domain/vo/ActivityDto.java
+11
-0
ActivityVo.java
...stem/src/main/java/share/system/domain/vo/ActivityVo.java
+8
-0
ActivityService.java
...m/src/main/java/share/system/service/ActivityService.java
+4
-0
ActivityServiceImpl.java
...n/java/share/system/service/impl/ActivityServiceImpl.java
+49
-0
ActivityMapper.xml
...ystem/src/main/resources/mapper/system/ActivityMapper.xml
+1
-4
No files found.
share-front/src/main/java/share/web/controller/system/ActivityController.java
View file @
0cf41771
...
...
@@ -9,6 +9,8 @@ import share.common.core.controller.BaseController;
import
share.common.core.domain.AjaxResult
;
import
share.common.core.page.TableDataInfo
;
import
share.system.domain.Activity
;
import
share.system.domain.vo.ActivityDto
;
import
share.system.domain.vo.ActivityVo
;
import
share.system.service.ActivityService
;
import
java.util.List
;
...
...
@@ -36,8 +38,8 @@ public class ActivityController extends BaseController {
}
@GetMapping
(
"/query"
)
public
AjaxResult
query
(
Activity
activity
)
{
List
<
Activity
>
list
=
activityService
.
selectActivityList
(
activity
);
public
AjaxResult
query
(
Activity
Dto
dto
)
{
List
<
Activity
Vo
>
list
=
activityService
.
queryList
(
dto
);
return
success
(
list
);
}
...
...
share-system/src/main/java/share/system/domain/vo/ActivityDto.java
0 → 100644
View file @
0cf41771
package
share
.
system
.
domain
.
vo
;
import
lombok.Data
;
import
share.system.domain.Activity
;
import
java.util.Date
;
@Data
public
class
ActivityDto
extends
Activity
{
private
Date
day
;
}
share-system/src/main/java/share/system/domain/vo/ActivityVo.java
0 → 100644
View file @
0cf41771
package
share
.
system
.
domain
.
vo
;
import
lombok.Data
;
import
share.system.domain.Activity
;
@Data
public
class
ActivityVo
extends
Activity
{
}
share-system/src/main/java/share/system/service/ActivityService.java
View file @
0cf41771
...
...
@@ -2,6 +2,8 @@ package share.system.service;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
share.system.domain.Activity
;
import
share.system.domain.vo.ActivityDto
;
import
share.system.domain.vo.ActivityVo
;
import
java.util.List
;
...
...
@@ -59,4 +61,6 @@ public interface ActivityService extends IService<Activity> {
* @return 结果
*/
public
int
deleteActivityById
(
Long
id
);
List
<
ActivityVo
>
queryList
(
ActivityDto
dto
);
}
share-system/src/main/java/share/system/service/impl/ActivityServiceImpl.java
View file @
0cf41771
package
share
.
system
.
service
.
impl
;
import
cn.hutool.core.util.ObjectUtil
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.cronutils.model.Cron
;
import
com.cronutils.model.CronType
;
import
com.cronutils.model.definition.CronDefinitionBuilder
;
import
com.cronutils.model.time.ExecutionTime
;
import
com.cronutils.parser.CronParser
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
share.common.utils.DateUtils
;
import
share.common.utils.StringUtils
;
import
share.common.utils.bean.BeanUtils
;
import
share.system.domain.Activity
;
import
share.system.domain.ConsumerMember
;
import
share.system.domain.SConsumer
;
import
share.system.domain.SStore
;
import
share.system.domain.vo.ActivityDto
;
import
share.system.domain.vo.ActivityVo
;
import
share.system.mapper.ActivityMapper
;
import
share.system.service.ActivityService
;
import
share.system.service.ConsumerMemberService
;
import
share.system.service.ISStoreService
;
import
share.system.service.SConsumerService
;
import
java.time.ZoneId
;
import
java.time.ZonedDateTime
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.stream.Collectors
;
...
...
@@ -26,6 +43,10 @@ public class ActivityServiceImpl extends ServiceImpl<ActivityMapper, Activity> i
private
ActivityMapper
activityMapper
;
@Autowired
private
ISStoreService
storeService
;
@Autowired
private
SConsumerService
sConsumerService
;
@Autowired
private
ConsumerMemberService
consumerMemberService
;
/**
* 查询活动
...
...
@@ -97,4 +118,32 @@ public class ActivityServiceImpl extends ServiceImpl<ActivityMapper, Activity> i
public
int
deleteActivityById
(
Long
id
)
{
return
activityMapper
.
deleteActivityById
(
id
);
}
@Override
public
List
<
ActivityVo
>
queryList
(
ActivityDto
dto
)
{
SConsumer
user
=
sConsumerService
.
getInfo
();
ConsumerMember
consumerMember
=
consumerMemberService
.
getOne
(
new
LambdaQueryWrapper
<
ConsumerMember
>()
.
eq
(
ConsumerMember:
:
getConsumerId
,
user
.
getId
())
);
if
(
ObjectUtil
.
isEmpty
(
consumerMember
))
{
return
new
ArrayList
<>();
}
Activity
activity
=
new
Activity
();
BeanUtils
.
copyProperties
(
dto
,
activity
);
List
<
Activity
>
activities
=
selectActivityList
(
activity
);
CronParser
cronParser
=
new
CronParser
(
CronDefinitionBuilder
.
instanceDefinitionFor
(
CronType
.
QUARTZ
));
List
<
ActivityVo
>
voList
=
new
ArrayList
<>();
activities
.
stream
().
forEach
(
item
->
{
Cron
cron
=
cronParser
.
parse
(
item
.
getCronExpression
());
ExecutionTime
executionTime
=
ExecutionTime
.
forCron
(
cron
);
boolean
match
=
executionTime
.
isMatch
(
ZonedDateTime
.
ofInstant
(
dto
.
getDay
().
toInstant
(),
ZoneId
.
systemDefault
()));
if
(
match
&&
consumerMember
.
getMemberType
().
equals
(
item
.
getMemberType
()))
{
ActivityVo
activityVo
=
new
ActivityVo
();
BeanUtils
.
copyProperties
(
item
,
activityVo
);
voList
.
add
(
activityVo
);
}
});
return
voList
;
}
}
share-system/src/main/resources/mapper/system/ActivityMapper.xml
View file @
0cf41771
...
...
@@ -45,7 +45,7 @@
<select
id=
"selectActivityList"
parameterType=
"Activity"
resultMap=
"ActivityResult"
>
<include
refid=
"selectActivityVo"
/>
<where>
where is_open = 1 and is_delete = 0
<if
test=
"activityName != null and activityName != ''"
>
and activity_name like concat('%', #{activityName},
'%')
</if>
...
...
@@ -58,9 +58,6 @@
<if
test=
"labelId != null "
>
and label_id = #{labelId}
</if>
<if
test=
"packId != null "
>
and pack_id = #{packId}
</if>
<if
test=
"cronExpression != null and cronExpression != ''"
>
and cron_expression = #{cronExpression}
</if>
<if
test=
"isOpen != null "
>
and is_open = #{isOpen}
</if>
<if
test=
"isDelete != null "
>
and is_delete = #{isDelete}
</if>
</where>
</select>
<select
id=
"selectActivityById"
parameterType=
"Long"
resultMap=
"ActivityResult"
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment