|
|
@@ -1,7 +1,8 @@
|
|
|
package platform.modules.api.web;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
+import org.apache.commons.io.IOUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
-import org.apache.ibatis.annotations.Param;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
@@ -9,6 +10,7 @@ import platform.common.Constant;
|
|
|
import platform.common.annotation.OperationLog;
|
|
|
import platform.common.base.controller.BaseController;
|
|
|
import platform.common.util.ShiroUtils;
|
|
|
+import platform.common.util.WxAppUtil;
|
|
|
import platform.modules.build.entity.Company;
|
|
|
import platform.modules.build.service.CompanyService;
|
|
|
import platform.modules.government.dto.ParamRegistration;
|
|
|
@@ -19,9 +21,11 @@ import platform.modules.government.service.AttachmentService;
|
|
|
import platform.modules.government.service.UserService;
|
|
|
import platform.modules.sys.entity.ActivityDetail;
|
|
|
import platform.modules.sys.entity.ActivityFavourite;
|
|
|
-import platform.modules.sys.entity.ActivityFeedback;
|
|
|
import platform.modules.sys.entity.ActivityRegistration;
|
|
|
-import platform.modules.sys.service.*;
|
|
|
+import platform.modules.sys.service.ActivityFavouriteService;
|
|
|
+import platform.modules.sys.service.ActivityRegistrationService;
|
|
|
+import platform.modules.sys.service.ActivityService;
|
|
|
+import platform.modules.sys.service.WaitToDoService;
|
|
|
import platform.modules.sys.web.ResponseMessage;
|
|
|
|
|
|
import java.util.*;
|
|
|
@@ -43,9 +47,6 @@ public class ActivityOpenController extends BaseController {
|
|
|
@Autowired
|
|
|
private ActivityRegistrationService activityRegistrationService;
|
|
|
|
|
|
- @Autowired
|
|
|
- private ActivityFeedbackService activityFeedbackService;
|
|
|
-
|
|
|
@Autowired
|
|
|
private AttachmentService attachmentService;
|
|
|
|
|
|
@@ -105,26 +106,10 @@ public class ActivityOpenController extends BaseController {
|
|
|
@GetMapping(value = "/is_regist")
|
|
|
public ResponseMessage getActivityDetail(@RequestParam("activity_id") String id, @RequestParam("phone") String phone) {
|
|
|
|
|
|
- List<ActivityRegistration> activityRegistrationList = activityRegistrationService.getCurrRegUsers(id, phone, null);
|
|
|
- if (!CollectionUtils.isEmpty(activityRegistrationList)) {
|
|
|
- for (ActivityRegistration activityRegistration : activityRegistrationList) {
|
|
|
- if (!Objects.equals("3", activityRegistration.getReview_state())) {
|
|
|
- return ResponseMessage.success("查询成功!", true);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- return ResponseMessage.success("查询成功!", false);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 获取已报名的用户
|
|
|
- *
|
|
|
- * @return
|
|
|
- */
|
|
|
- @GetMapping(value = "/getRegUsers")
|
|
|
- public ResponseMessage getRegUsers(String activity_id, String user_id) {
|
|
|
- log.info("获取已报名的用户!");
|
|
|
- return ResponseMessage.success("查询成功!", activityRegistrationService.getCurrRegUsers(activity_id, null, user_id));
|
|
|
+ List<ActivityRegistration> activityRegistrationList = activityRegistrationService.getCurrRegUsers(id, phone);
|
|
|
+ if (CollectionUtils.isEmpty(activityRegistrationList))
|
|
|
+ return ResponseMessage.success("查询成功!", false);
|
|
|
+ return ResponseMessage.success("查询成功!", true);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -152,30 +137,24 @@ public class ActivityOpenController extends BaseController {
|
|
|
//已报名人数
|
|
|
registrationNumber = activityRegistrationService.getActivityRegistrationNumber(id);
|
|
|
if (registrationNumber >= Integer.parseInt(quota)) {
|
|
|
- return ResponseMessage.error("名额不足,仅剩" + (Integer.parseInt(quota) - registrationNumber) + "个名额,请修改人数!");
|
|
|
+ return ResponseMessage.success("名额不足,仅剩" + (Integer.parseInt(quota) - registrationNumber) + "个名额,请修改人数!", false);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
List<ActivityRegistration> registrationList = paramRegistration.getRegistrationList();
|
|
|
if (!org.apache.commons.collections.CollectionUtils.isEmpty(registrationList)) {
|
|
|
- List<ActivityRegistration> registrations = activityRegistrationService.findByActivityIdAndUserIdAndPhones(id + "", registrationList.get(0).getUser_id() + "", registrationList);
|
|
|
- if (!org.apache.commons.collections.CollectionUtils.isEmpty(registrations)) {
|
|
|
- String phone = "";
|
|
|
- for (ActivityRegistration registration : registrations) {
|
|
|
- phone += registration.getPhone() + " ";
|
|
|
- }
|
|
|
- return ResponseMessage.error("手机号码为:" + phone + "的用户已报名");
|
|
|
- }
|
|
|
for (ActivityRegistration registration : registrationList) {
|
|
|
-// if (registration.getId() == null) {
|
|
|
- activityRegistrationService.saveActivityRegistration(registration);
|
|
|
-// }
|
|
|
+ if (registration.getId() == null) {
|
|
|
+ activityRegistrationService.saveActivityRegistration(registration);
|
|
|
+ }
|
|
|
}
|
|
|
List<User> pusers = userService.findUsersByPermission("G_ACTIVITY_MANAGE");
|
|
|
waitToDoService.completeAllTODO(activityDetail.getId(), Constant.DictionaryType.ACTIVITY_APPLICATION);
|
|
|
for (User puser : pusers) {
|
|
|
waitToDoService.newTODO(activityDetail.getActivity_title() + "审核", "/government/activity/review/" + activityDetail.getId(), Constant.WaitToDo_OperType.AUDIT, activityDetail.getId(),
|
|
|
Constant.DictionaryType.ACTIVITY_APPLICATION, null, puser.getId().toString(), Constant.WaitToDo_IsSerial.IS_SERIAL, false);
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
if (!Objects.equals(quota, null) && !Objects.equals(quota, "")) {
|
|
|
@@ -194,7 +173,7 @@ public class ActivityOpenController extends BaseController {
|
|
|
@DeleteMapping(value = "/cancel_regist")
|
|
|
public ResponseMessage cancelRegist(@RequestParam("activity_id") String id, @RequestParam("phone") String phone) {
|
|
|
|
|
|
- List<ActivityRegistration> activityRegistrationList = activityRegistrationService.getCurrRegUsers(id, phone, null);
|
|
|
+ List<ActivityRegistration> activityRegistrationList = activityRegistrationService.getCurrRegUsers(id, phone);
|
|
|
if (!CollectionUtils.isEmpty(activityRegistrationList)) {
|
|
|
List<String> ids = new ArrayList<>();
|
|
|
for (ActivityRegistration activityRegistration : activityRegistrationList) {
|
|
|
@@ -205,16 +184,6 @@ public class ActivityOpenController extends BaseController {
|
|
|
return ResponseMessage.success("操作成功!");
|
|
|
}
|
|
|
|
|
|
- @OperationLog(value = "删除报名")
|
|
|
- @DeleteMapping(value = "/delete_regist")
|
|
|
- public ResponseMessage deleteRegist(@RequestParam("regist_id") String registId) {
|
|
|
- ActivityRegistration activityRegistration = new ActivityRegistration();
|
|
|
- activityRegistration.setId(Integer.parseInt(registId));
|
|
|
- activityRegistration.setDel_flag(true);
|
|
|
- activityRegistrationService.updateSelective(activityRegistration);
|
|
|
- return ResponseMessage.success("操作成功!");
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* @Author: huZhiHao
|
|
|
* @Description: 获取已报名
|
|
|
@@ -225,7 +194,7 @@ public class ActivityOpenController extends BaseController {
|
|
|
@GetMapping(value = "/regist_user/list")
|
|
|
public ResponseMessage getCurrRegUsers(@RequestParam("activity_id") String id, @RequestParam("phone") String phone) {
|
|
|
|
|
|
- List<ActivityRegistration> activityRegistrationList = activityRegistrationService.getCurrRegUsers(id, phone, null);
|
|
|
+ List<ActivityRegistration> activityRegistrationList = activityRegistrationService.getCurrRegUsers(id, phone);
|
|
|
return ResponseMessage.success("查询成功!", activityRegistrationList);
|
|
|
}
|
|
|
|
|
|
@@ -236,13 +205,14 @@ public class ActivityOpenController extends BaseController {
|
|
|
* @Params: [id]
|
|
|
* @Return: platform.modules.sys.web.ResponseMessage
|
|
|
**/
|
|
|
- @GetMapping(value = "/is_favourite")
|
|
|
- public ResponseMessage isFavourite(@RequestParam("activity_id") String activityId, @RequestParam("user_id") String userId) throws Exception {
|
|
|
-
|
|
|
- log.info("查询是否收藏!activity_id = {}", activityId);
|
|
|
- ActivityFavourite activityFavourite = activityFavouriteService.selectByActivityIdAndUserId(activityId, userId);
|
|
|
- if (Objects.equals(activityFavourite, null)) return ResponseMessage.success("查询成功!", false);
|
|
|
- return ResponseMessage.success("查询成功!", true);
|
|
|
+ @GetMapping(value = "/is_favourite/{activity_id}")
|
|
|
+ public ResponseMessage isFavourite(@PathVariable("activity_id") int id) throws Exception {
|
|
|
+
|
|
|
+ log.info("查询是否收藏!activity_id = {}", id);
|
|
|
+ if (!ShiroUtils.isLogin()) return ResponseMessage.success("请先登录!", 2);
|
|
|
+ ActivityFavourite activityFavourite = activityFavouriteService.selectByActivityIdAndUserId(id + "", ShiroUtils.getUserId() + "");
|
|
|
+ if (Objects.equals(activityFavourite, null)) return ResponseMessage.success("查询成功!", 1);
|
|
|
+ return ResponseMessage.success("查询成功!", 0);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -256,6 +226,8 @@ public class ActivityOpenController extends BaseController {
|
|
|
@PostMapping(value = "/add_favourite")
|
|
|
public ResponseMessage addFavourite(@RequestBody ActivityFavourite activityFavourite) throws Exception {
|
|
|
|
|
|
+ if (!ShiroUtils.isLogin()) return ResponseMessage.success("请先登录!", 2);
|
|
|
+
|
|
|
int count = activityFavouriteService.saveActivityFavourite(activityFavourite);
|
|
|
if (count > 0) return ResponseMessage.success("收藏成功!");
|
|
|
return ResponseMessage.success("收藏失败!");
|
|
|
@@ -269,10 +241,10 @@ public class ActivityOpenController extends BaseController {
|
|
|
* @Return: platform.modules.sys.web.ResponseMessage
|
|
|
**/
|
|
|
@OperationLog(value = "取消收藏活动")
|
|
|
- @DeleteMapping(value = "/remove_favourite")
|
|
|
- public ResponseMessage removeFavourite(@RequestParam("activity_id") String activity_id, @RequestParam("user_id") String userId) throws Exception {
|
|
|
+ @DeleteMapping(value = "/remove_favourite/{activity_id}")
|
|
|
+ public ResponseMessage removeFavourite(@PathVariable("id") int id) throws Exception {
|
|
|
|
|
|
- boolean b = activityFavouriteService.deleteByActivityIdAndUserId(activity_id, userId);
|
|
|
+ boolean b = activityFavouriteService.deleteByActivityIdAndUserId(id + "", ShiroUtils.getUserId() + "");
|
|
|
if (b) return ResponseMessage.success("取消收藏成功!");
|
|
|
return ResponseMessage.success("取消收藏失败!");
|
|
|
}
|
|
|
@@ -310,17 +282,9 @@ public class ActivityOpenController extends BaseController {
|
|
|
@PutMapping(value = "/sign")
|
|
|
public ResponseMessage getByPhone(@RequestBody ActivityRegistration activityRegistration) {
|
|
|
|
|
|
- activityRegistration.setReview_state("1");
|
|
|
- ActivityRegistration activityRegistration1 = activityRegistrationService.findOne(activityRegistration);
|
|
|
- if (activityRegistration1 != null) {
|
|
|
- ActivityRegistration activityRegistration_n = new ActivityRegistration();
|
|
|
- activityRegistration_n.setId(activityRegistration1.getId());
|
|
|
- activityRegistration_n.setSign_state("0");
|
|
|
- activityRegistration_n.setSign_time(new Date());
|
|
|
- activityRegistrationService.updateSelective(activityRegistration_n);
|
|
|
- return ResponseMessage.success("签到成功!");
|
|
|
- }
|
|
|
- return ResponseMessage.error("签到失败!");
|
|
|
+ activityRegistration.setSign_state("0");
|
|
|
+ activityRegistrationService.updateState(activityRegistration);
|
|
|
+ return ResponseMessage.success("签到成功!");
|
|
|
}
|
|
|
|
|
|
//根据手机号获取用户信息和企业信息
|
|
|
@@ -331,44 +295,15 @@ public class ActivityOpenController extends BaseController {
|
|
|
Map<String, String> map = new HashMap<>();
|
|
|
User user = userService.findByMobile(phone);
|
|
|
if (user != null) {
|
|
|
- map.put("user_id", user.getId() + "");
|
|
|
+ Company company = companyService.findById(user.getCompany_id());
|
|
|
map.put("user_name", user.getUser_name());
|
|
|
map.put("phone", user.getPhone());
|
|
|
map.put("email", user.getEmail());
|
|
|
|
|
|
- if (user.getCompany_id() != null) {
|
|
|
- Company company = companyService.findById(user.getCompany_id());
|
|
|
- map.put("company_name", company.getCompany_name());
|
|
|
- map.put("industry_name", company.getIndustry_name());
|
|
|
- }
|
|
|
+ map.put("company_name", company.getCompany_name());
|
|
|
+ map.put("industry_name", company.getIndustry_name());
|
|
|
}
|
|
|
- return ResponseMessage.success("查询成功!", map);
|
|
|
- }
|
|
|
-
|
|
|
- @OperationLog(value = "根据活动id获取最新的公开反馈评论信息")
|
|
|
- @GetMapping(value = "/feedback/list")
|
|
|
- public ResponseMessage feedbackList(@RequestParam("activity_id") String activityId, @RequestParam("min_score") String minScore, @RequestParam("max_score") String maxScore) {
|
|
|
- List<ActivityFeedback> list = activityFeedbackService.feedbackList(activityId, "1", "1", minScore, maxScore);
|
|
|
- return ResponseMessage.success("操作成功!", list);
|
|
|
- }
|
|
|
-
|
|
|
- @OperationLog(value = "根据活动id和用户id获取反馈评论信息")
|
|
|
- @GetMapping(value = "/feedback")
|
|
|
- public ResponseMessage feedbackGet(@RequestParam("activity_id") String activityId, @RequestParam("user_id") String userId) {
|
|
|
- return ResponseMessage.success("操作成功!", activityFeedbackService.feedbackGet(activityId, userId));
|
|
|
- }
|
|
|
-
|
|
|
- @OperationLog(value = "新增反馈")
|
|
|
- @PostMapping(value = "/feedback")
|
|
|
- public ResponseMessage feedbackSave(@RequestBody ActivityFeedback activityFeedback) {
|
|
|
- activityFeedback.setIs_view(false);
|
|
|
- activityFeedback.setIs_top(false);
|
|
|
- return ResponseMessage.success("操作成功!", activityFeedbackService.feedbackSave(activityFeedback));
|
|
|
- }
|
|
|
|
|
|
- @OperationLog(value = "获取各分数段人数")
|
|
|
- @GetMapping(value = "/feedback/score_count")
|
|
|
- public ResponseMessage feedbackScoreCount(@RequestParam("activity_id") String activityId) {
|
|
|
- return ResponseMessage.success("操作成功!", activityFeedbackService.getScoreCount(activityId, "1", "1", null, null));
|
|
|
+ return ResponseMessage.success("查询成功!", map);
|
|
|
}
|
|
|
}
|