From b38510b1dbd0b5e7442ab0ac1d69602a7a362121 Mon Sep 17 00:00:00 2001 From: pan <1029559041@qq.com> Date: Fri, 29 May 2020 10:09:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=95=99=E8=A8=80bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/share/help/controller/ActivityController.java | 8 ++++---- src/main/java/com/share/help/form/ApplyActivityForm.java | 9 --------- .../java/com/share/help/form/UpdateActivityForm.java | 2 +- .../java/com/share/help/service/ActivityService.java | 4 ++-- .../java/com/share/help/service/LeaveWordService.java | 5 +++++ 5 files changed, 12 insertions(+), 16 deletions(-) delete mode 100644 src/main/java/com/share/help/form/ApplyActivityForm.java diff --git a/src/main/java/com/share/help/controller/ActivityController.java b/src/main/java/com/share/help/controller/ActivityController.java index c0f1bc7..4b03d4b 100644 --- a/src/main/java/com/share/help/controller/ActivityController.java +++ b/src/main/java/com/share/help/controller/ActivityController.java @@ -74,10 +74,10 @@ public class ActivityController { * @return 返回报名结果 */ @PostMapping(Constants.ACTIVITY_INTERFACE_APPLY) - public JSONResponse apply(ApplyActivityForm activityForm,@CookieValue(Constants.USER_COOKIE) String userId){ - if(StringUtils.isNotEmpty(userId)&&ObjectUtils.allNotNull(activityForm.getActivityId(),activityForm.getActivityStatus())){ - activityForm.setUserId(userId); - return activityService.apply(activityForm); + public JSONResponse apply(UpdateActivityForm updateActivityForm,@CookieValue(Constants.USER_COOKIE) String userId){ + if(StringUtils.isNotEmpty(userId)&&ObjectUtils.allNotNull(updateActivityForm.getActivityId(),updateActivityForm.getActivityStatus())){ + updateActivityForm.setUserId(userId); + return activityService.apply(updateActivityForm); }else{ return new JSONResponse<>(DefaultRes.fail,Result.FAIL); } diff --git a/src/main/java/com/share/help/form/ApplyActivityForm.java b/src/main/java/com/share/help/form/ApplyActivityForm.java deleted file mode 100644 index effb4f2..0000000 --- a/src/main/java/com/share/help/form/ApplyActivityForm.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.share.help.form; - -/** - * 报名活动表单 - */ -public class ApplyActivityForm extends UpdateActivityForm{ - -} - diff --git a/src/main/java/com/share/help/form/UpdateActivityForm.java b/src/main/java/com/share/help/form/UpdateActivityForm.java index 43d7386..2f19bd9 100644 --- a/src/main/java/com/share/help/form/UpdateActivityForm.java +++ b/src/main/java/com/share/help/form/UpdateActivityForm.java @@ -3,7 +3,7 @@ package com.share.help.form; /** * 改变活动状态 */ -public abstract class UpdateActivityForm { +public class UpdateActivityForm { //活动id private Long activityId; //用户id diff --git a/src/main/java/com/share/help/service/ActivityService.java b/src/main/java/com/share/help/service/ActivityService.java index 91e849b..d1d3aa6 100644 --- a/src/main/java/com/share/help/service/ActivityService.java +++ b/src/main/java/com/share/help/service/ActivityService.java @@ -113,7 +113,7 @@ public class ActivityService{ * @return 返回报名结果 */ @Transactional - public JSONResponse apply(ApplyActivityForm activityForm){ + public JSONResponse apply(UpdateActivityForm activityForm){ // 保存到活动历史记录 ActivityHistoryEntity activityEntity=new ActivityHistoryEntity(); activityEntity.setActivityId(activityForm.getActivityId()); @@ -127,7 +127,7 @@ public class ActivityService{ // 给求助用户发送留言 LeaveWordEntity leaveWordEntity=new LeaveWordEntity(); - leaveWordEntity.setType(LeaveWordType.apply.name()); + leaveWordEntity.setType(activityForm.getActivityStatus().toString()); leaveWordEntity.setSourceUserId(activityForm.getUserId()); ActivityEntity activity=activityMapper.findOne(activityForm.getActivityId()); if(activity==null){ diff --git a/src/main/java/com/share/help/service/LeaveWordService.java b/src/main/java/com/share/help/service/LeaveWordService.java index 8f66965..7f8412c 100644 --- a/src/main/java/com/share/help/service/LeaveWordService.java +++ b/src/main/java/com/share/help/service/LeaveWordService.java @@ -28,6 +28,11 @@ public class LeaveWordService { @Autowired private ActivityMapper activityMapper; + /** + * 查询留言 + * @param findLeaveWordForm 查询条件 + * @return 返回留言列表 + */ public JSONResponse>> query(FindLeaveWordForm findLeaveWordForm){ Page> listPage=leaveWordMapper.count(pageSize,findLeaveWordForm.getUserId()); List leaveWordRes=leaveWordMapper.select((findLeaveWordForm.getCurrentPage()-1)*pageSize,pageSize,findLeaveWordForm.getUserId());