|
|
@@ -1,14 +1,8 @@
|
|
|
package com.jpsoft.employment.modules.base.api;
|
|
|
|
|
|
import com.github.pagehelper.Page;
|
|
|
-import com.jpsoft.employment.modules.base.entity.MessageBoard;
|
|
|
-import com.jpsoft.employment.modules.base.entity.RegUser;
|
|
|
-import com.jpsoft.employment.modules.base.entity.VolunteerSignRecord;
|
|
|
-import com.jpsoft.employment.modules.base.entity.VolunteerTasks;
|
|
|
-import com.jpsoft.employment.modules.base.service.MessageBoardService;
|
|
|
-import com.jpsoft.employment.modules.base.service.RegUserService;
|
|
|
-import com.jpsoft.employment.modules.base.service.VolunteerSignRecordService;
|
|
|
-import com.jpsoft.employment.modules.base.service.VolunteerTasksService;
|
|
|
+import com.jpsoft.employment.modules.base.entity.*;
|
|
|
+import com.jpsoft.employment.modules.base.service.*;
|
|
|
import com.jpsoft.employment.modules.common.dto.MessageResult;
|
|
|
import com.jpsoft.employment.modules.common.dto.Sort;
|
|
|
import com.jpsoft.employment.modules.common.utils.PojoUtils;
|
|
|
@@ -18,6 +12,7 @@ import org.apache.commons.lang3.StringUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
@@ -38,6 +33,10 @@ public class VolunteerApi {
|
|
|
private VolunteerSignRecordService volunteerSignRecordService;
|
|
|
@Autowired
|
|
|
private RegUserService regUserService;
|
|
|
+ @Autowired
|
|
|
+ private NewsInfoService newsInfoService;
|
|
|
+ @Autowired
|
|
|
+ private NewsRegUserService newsRegUserService;
|
|
|
|
|
|
@ApiOperation(value="列表")
|
|
|
@RequestMapping(value = "list",method = RequestMethod.POST)
|
|
|
@@ -97,6 +96,7 @@ public class VolunteerApi {
|
|
|
|
|
|
@ApiOperation(value="保存")
|
|
|
@RequestMapping(value = "save",method = RequestMethod.POST)
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
public MessageResult save(String tasksId, String name, String phone, String remark, HttpServletRequest request) {
|
|
|
MessageResult msgResult = new MessageResult<>();
|
|
|
String subject = (String)request.getAttribute("subject");
|
|
|
@@ -113,6 +113,26 @@ public class VolunteerApi {
|
|
|
volunteerSignRecord.setCreateBy(subject);
|
|
|
volunteerSignRecord.setCreateTime(new Date());
|
|
|
volunteerSignRecordService.insert(volunteerSignRecord);
|
|
|
+
|
|
|
+ NewsInfo newsInfo = new NewsInfo();
|
|
|
+ newsInfo.setId(UUID.randomUUID().toString());
|
|
|
+ newsInfo.setTitle(String.format("{0}申请了志愿者项目",regUserService.get(subject).getRealName()));
|
|
|
+ newsInfo.setType("0");
|
|
|
+ newsInfo.setIsTop(false);
|
|
|
+ newsInfo.setContent(String.format("{0}申请了志愿者项目“{1}”",regUserService.get(subject).getRealName(),volunteerTasksService.get(tasksId).getIntroduce()));
|
|
|
+ newsInfo.setDelFlag(false);
|
|
|
+ newsInfo.setCreateBy(subject);
|
|
|
+ newsInfo.setCreateTime(new Date());
|
|
|
+ newsInfoService.insert(newsInfo);
|
|
|
+
|
|
|
+ NewsRegUser newsRegUser = new NewsRegUser();
|
|
|
+ newsRegUser.setId(UUID.randomUUID().toString());
|
|
|
+ newsRegUser.setRegUserId(subject);
|
|
|
+ newsRegUser.setNewsId(newsInfo.getId());
|
|
|
+ newsRegUser.setDelFlag(false);
|
|
|
+ newsRegUser.setCreateBy(subject);
|
|
|
+ newsRegUser.setCreateTime(new Date());
|
|
|
+ newsRegUserService.insert(newsRegUser);
|
|
|
}
|
|
|
else {
|
|
|
volunteerSignRecord.setName(name);
|