修复留言bug

master
pan 5 years ago
parent e6de012598
commit b38510b1db
  1. 8
      src/main/java/com/share/help/controller/ActivityController.java
  2. 9
      src/main/java/com/share/help/form/ApplyActivityForm.java
  3. 2
      src/main/java/com/share/help/form/UpdateActivityForm.java
  4. 4
      src/main/java/com/share/help/service/ActivityService.java
  5. 5
      src/main/java/com/share/help/service/LeaveWordService.java

@ -74,10 +74,10 @@ public class ActivityController {
* @return 返回报名结果 * @return 返回报名结果
*/ */
@PostMapping(Constants.ACTIVITY_INTERFACE_APPLY) @PostMapping(Constants.ACTIVITY_INTERFACE_APPLY)
public JSONResponse<DefaultRes,Void> apply(ApplyActivityForm activityForm,@CookieValue(Constants.USER_COOKIE) String userId){ public JSONResponse<DefaultRes,Void> apply(UpdateActivityForm updateActivityForm,@CookieValue(Constants.USER_COOKIE) String userId){
if(StringUtils.isNotEmpty(userId)&&ObjectUtils.allNotNull(activityForm.getActivityId(),activityForm.getActivityStatus())){ if(StringUtils.isNotEmpty(userId)&&ObjectUtils.allNotNull(updateActivityForm.getActivityId(),updateActivityForm.getActivityStatus())){
activityForm.setUserId(userId); updateActivityForm.setUserId(userId);
return activityService.apply(activityForm); return activityService.apply(updateActivityForm);
}else{ }else{
return new JSONResponse<>(DefaultRes.fail,Result.FAIL); return new JSONResponse<>(DefaultRes.fail,Result.FAIL);
} }

@ -1,9 +0,0 @@
package com.share.help.form;
/**
* 报名活动表单
*/
public class ApplyActivityForm extends UpdateActivityForm{
}

@ -3,7 +3,7 @@ package com.share.help.form;
/** /**
* 改变活动状态 * 改变活动状态
*/ */
public abstract class UpdateActivityForm { public class UpdateActivityForm {
//活动id //活动id
private Long activityId; private Long activityId;
//用户id //用户id

@ -113,7 +113,7 @@ public class ActivityService{
* @return 返回报名结果 * @return 返回报名结果
*/ */
@Transactional @Transactional
public JSONResponse<DefaultRes,Void> apply(ApplyActivityForm activityForm){ public JSONResponse<DefaultRes,Void> apply(UpdateActivityForm activityForm){
// 保存到活动历史记录 // 保存到活动历史记录
ActivityHistoryEntity activityEntity=new ActivityHistoryEntity(); ActivityHistoryEntity activityEntity=new ActivityHistoryEntity();
activityEntity.setActivityId(activityForm.getActivityId()); activityEntity.setActivityId(activityForm.getActivityId());
@ -127,7 +127,7 @@ public class ActivityService{
// 给求助用户发送留言 // 给求助用户发送留言
LeaveWordEntity leaveWordEntity=new LeaveWordEntity(); LeaveWordEntity leaveWordEntity=new LeaveWordEntity();
leaveWordEntity.setType(LeaveWordType.apply.name()); leaveWordEntity.setType(activityForm.getActivityStatus().toString());
leaveWordEntity.setSourceUserId(activityForm.getUserId()); leaveWordEntity.setSourceUserId(activityForm.getUserId());
ActivityEntity activity=activityMapper.findOne(activityForm.getActivityId()); ActivityEntity activity=activityMapper.findOne(activityForm.getActivityId());
if(activity==null){ if(activity==null){

@ -28,6 +28,11 @@ public class LeaveWordService {
@Autowired @Autowired
private ActivityMapper activityMapper; private ActivityMapper activityMapper;
/**
* 查询留言
* @param findLeaveWordForm 查询条件
* @return 返回留言列表
*/
public JSONResponse<DefaultRes, Page<List<LeaveWordRes>>> query(FindLeaveWordForm findLeaveWordForm){ public JSONResponse<DefaultRes, Page<List<LeaveWordRes>>> query(FindLeaveWordForm findLeaveWordForm){
Page<List<LeaveWordRes>> listPage=leaveWordMapper.count(pageSize,findLeaveWordForm.getUserId()); Page<List<LeaveWordRes>> listPage=leaveWordMapper.count(pageSize,findLeaveWordForm.getUserId());
List<LeaveWordRes> leaveWordRes=leaveWordMapper.select((findLeaveWordForm.getCurrentPage()-1)*pageSize,pageSize,findLeaveWordForm.getUserId()); List<LeaveWordRes> leaveWordRes=leaveWordMapper.select((findLeaveWordForm.getCurrentPage()-1)*pageSize,pageSize,findLeaveWordForm.getUserId());

Loading…
Cancel
Save