|
@ -123,15 +123,25 @@ public class EventUserAttitudeServiceImpl extends BaseServiceImpl<EventUserAttit |
|
|
@Override |
|
|
@Override |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
public void statement(StatementFormDTO formDto) { |
|
|
public void statement(StatementFormDTO formDto) { |
|
|
IssueEntity issueEntity = null; |
|
|
String eventId; |
|
|
ItemEntity itemEntity = null; |
|
|
String noticeContent; |
|
|
|
|
|
String businessId; |
|
|
|
|
|
String userId; |
|
|
boolean isIssue = true; |
|
|
boolean isIssue = true; |
|
|
boolean isApprove = true; |
|
|
boolean isApprove = true; |
|
|
if (StringUtils.isNotEmpty(formDto.getIssueId())) { |
|
|
if (StringUtils.isNotEmpty(formDto.getIssueId())) { |
|
|
issueEntity = issueService.selectById(formDto.getIssueId()); |
|
|
IssueEntity issueEntity = issueService.selectById(formDto.getIssueId()); |
|
|
|
|
|
eventId = issueEntity.getEventId(); |
|
|
|
|
|
noticeContent = issueEntity.getIssueContent(); |
|
|
|
|
|
businessId = issueEntity.getId(); |
|
|
|
|
|
userId = issueEntity.getUserId(); |
|
|
} else { |
|
|
} else { |
|
|
isIssue = false; |
|
|
isIssue = false; |
|
|
itemEntity = itemService.selectById(formDto.getItemId()); |
|
|
ItemEntity itemEntity = itemService.selectById(formDto.getItemId()); |
|
|
|
|
|
eventId = itemEntity.getEventId(); |
|
|
|
|
|
noticeContent = itemEntity.getItemContent(); |
|
|
|
|
|
businessId = itemEntity.getId(); |
|
|
|
|
|
userId = itemEntity.getUserId(); |
|
|
} |
|
|
} |
|
|
if (NumConstant.ONE_STR.equals(formDto.getAttitude())) { |
|
|
if (NumConstant.ONE_STR.equals(formDto.getAttitude())) { |
|
|
isApprove = false; |
|
|
isApprove = false; |
|
@ -139,23 +149,23 @@ public class EventUserAttitudeServiceImpl extends BaseServiceImpl<EventUserAttit |
|
|
//根据用户id和事件id查询记录
|
|
|
//根据用户id和事件id查询记录
|
|
|
QueryWrapper<EventUserAttitudeEntity> wrapper = new QueryWrapper<>(); |
|
|
QueryWrapper<EventUserAttitudeEntity> wrapper = new QueryWrapper<>(); |
|
|
wrapper.eq(StringUtils.isNotBlank(formDto.getUserId()), "USER_ID", formDto.getUserId()); |
|
|
wrapper.eq(StringUtils.isNotBlank(formDto.getUserId()), "USER_ID", formDto.getUserId()); |
|
|
wrapper.eq(StringUtils.isNotBlank(issueEntity.getEventId()), "EVENT_ID", issueEntity.getEventId()); |
|
|
wrapper.eq(StringUtils.isNotBlank(eventId), "EVENT_ID", eventId); |
|
|
EventUserAttitudeEntity eventUserAttitudeEntity = baseDao.selectOne(wrapper); |
|
|
EventUserAttitudeEntity eventUserAttitudeEntity = baseDao.selectOne(wrapper); |
|
|
|
|
|
|
|
|
if ("0".equals(formDto.getAttitude()) || "1".equals(formDto.getAttitude())){ |
|
|
if ("0".equals(formDto.getAttitude()) || "1".equals(formDto.getAttitude())){ |
|
|
if (eventUserAttitudeEntity == null){ |
|
|
if (eventUserAttitudeEntity == null){ |
|
|
//没有点赞或者点踩,直接插入数据
|
|
|
//没有点赞或者点踩,直接插入数据
|
|
|
EventUserAttitudeDTO eventUserAttitudeDTO = new EventUserAttitudeDTO(); |
|
|
EventUserAttitudeDTO eventUserAttitudeDTO = new EventUserAttitudeDTO(); |
|
|
eventUserAttitudeDTO.setEventId(issueEntity.getEventId()); |
|
|
eventUserAttitudeDTO.setEventId(eventId); |
|
|
eventUserAttitudeDTO.setAttitudeFlag(formDto.getAttitude()); |
|
|
eventUserAttitudeDTO.setAttitudeFlag(formDto.getAttitude()); |
|
|
eventUserAttitudeDTO.setUserId(formDto.getUserId()); |
|
|
eventUserAttitudeDTO.setUserId(formDto.getUserId()); |
|
|
this.save(eventUserAttitudeDTO); |
|
|
this.save(eventUserAttitudeDTO); |
|
|
|
|
|
|
|
|
if ("0".equals(formDto.getAttitude())){ |
|
|
if ("0".equals(formDto.getAttitude())){ |
|
|
epdcEventsService.updateApproveNumAdd(issueEntity.getEventId()); |
|
|
epdcEventsService.updateApproveNumAdd(eventId); |
|
|
} |
|
|
} |
|
|
if ("1".equals(formDto.getAttitude())){ |
|
|
if ("1".equals(formDto.getAttitude())){ |
|
|
epdcEventsService.updateOpposeNumAdd(issueEntity.getEventId()); |
|
|
epdcEventsService.updateOpposeNumAdd(eventId); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
}else { |
|
|
}else { |
|
@ -165,12 +175,12 @@ public class EventUserAttitudeServiceImpl extends BaseServiceImpl<EventUserAttit |
|
|
|
|
|
|
|
|
if ("0".equals(formDto.getAttitude())){ |
|
|
if ("0".equals(formDto.getAttitude())){ |
|
|
//赞数加1 踩数减一
|
|
|
//赞数加1 踩数减一
|
|
|
epdcEventsService.updateApproveNumAdd(issueEntity.getEventId()); |
|
|
epdcEventsService.updateApproveNumAdd(eventId); |
|
|
epdcEventsService.updateOpposeNumSubtract(issueEntity.getEventId()); |
|
|
epdcEventsService.updateOpposeNumSubtract(eventId); |
|
|
}else { |
|
|
}else { |
|
|
//踩数加一 赞数减一
|
|
|
//踩数加一 赞数减一
|
|
|
epdcEventsService.updateOpposeNumAdd(issueEntity.getEventId()); |
|
|
epdcEventsService.updateOpposeNumAdd(eventId); |
|
|
epdcEventsService.updateApproveNumSubtract(issueEntity.getEventId()); |
|
|
epdcEventsService.updateApproveNumSubtract(eventId); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -179,11 +189,11 @@ public class EventUserAttitudeServiceImpl extends BaseServiceImpl<EventUserAttit |
|
|
this.deleteById(eventUserAttitudeEntity.getId()); |
|
|
this.deleteById(eventUserAttitudeEntity.getId()); |
|
|
if ("2".equals(formDto.getAttitude())){ |
|
|
if ("2".equals(formDto.getAttitude())){ |
|
|
//取消赞
|
|
|
//取消赞
|
|
|
epdcEventsService.updateApproveNumSubtract(issueEntity.getEventId()); |
|
|
epdcEventsService.updateApproveNumSubtract(eventId); |
|
|
} |
|
|
} |
|
|
if ("3".equals(formDto.getAttitude())){ |
|
|
if ("3".equals(formDto.getAttitude())){ |
|
|
//取消踩
|
|
|
//取消踩
|
|
|
epdcEventsService.updateOpposeNumSubtract(issueEntity.getEventId()); |
|
|
epdcEventsService.updateOpposeNumSubtract(eventId); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -192,9 +202,9 @@ public class EventUserAttitudeServiceImpl extends BaseServiceImpl<EventUserAttit |
|
|
informationFormDTO.setType(EventsNoticeConstant.NOTICE_TYPE_INTERACTIVE_NOTICE); |
|
|
informationFormDTO.setType(EventsNoticeConstant.NOTICE_TYPE_INTERACTIVE_NOTICE); |
|
|
if (isIssue) { |
|
|
if (isIssue) { |
|
|
// 议题
|
|
|
// 议题
|
|
|
informationFormDTO.setUserId(issueEntity.getUserId()); |
|
|
informationFormDTO.setUserId(userId); |
|
|
informationFormDTO.setContent(issueEntity.getIssueContent()); |
|
|
informationFormDTO.setContent(noticeContent); |
|
|
informationFormDTO.setBusinessId(issueEntity.getId()); |
|
|
informationFormDTO.setBusinessId(businessId); |
|
|
if (isApprove) { |
|
|
if (isApprove) { |
|
|
// 支持
|
|
|
// 支持
|
|
|
informationFormDTO.setTitle(EventsNoticeConstant.NOTICE_ISSUE_APPROVE); |
|
|
informationFormDTO.setTitle(EventsNoticeConstant.NOTICE_ISSUE_APPROVE); |
|
@ -208,9 +218,9 @@ public class EventUserAttitudeServiceImpl extends BaseServiceImpl<EventUserAttit |
|
|
} |
|
|
} |
|
|
} else { |
|
|
} else { |
|
|
// 项目
|
|
|
// 项目
|
|
|
informationFormDTO.setUserId(itemEntity.getUserId()); |
|
|
informationFormDTO.setUserId(userId); |
|
|
informationFormDTO.setContent(itemEntity.getItemContent()); |
|
|
informationFormDTO.setContent(noticeContent); |
|
|
informationFormDTO.setBusinessId(itemEntity.getId()); |
|
|
informationFormDTO.setBusinessId(businessId); |
|
|
if (isApprove) { |
|
|
if (isApprove) { |
|
|
// 支持
|
|
|
// 支持
|
|
|
informationFormDTO.setTitle(EventsNoticeConstant.NOTICE_ITEM_APPROVE); |
|
|
informationFormDTO.setTitle(EventsNoticeConstant.NOTICE_ITEM_APPROVE); |
|
|