|
|
@@ -1,192 +1,354 @@
|
|
|
-package com.goafanti.portal.controller;
|
|
|
-
|
|
|
-import javax.annotation.Resource;
|
|
|
-
|
|
|
-import org.apache.commons.lang3.StringUtils;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
-
|
|
|
-import com.goafanti.achievement.service.AchievementInterestService;
|
|
|
-import com.goafanti.achievement.service.AchievementService;
|
|
|
-import com.goafanti.common.bo.Result;
|
|
|
-import com.goafanti.common.constant.ErrorConstants;
|
|
|
-import com.goafanti.common.controller.CertifyApiController;
|
|
|
-import com.goafanti.common.enums.AchievementAuditStatus;
|
|
|
-import com.goafanti.common.enums.AchievementReleaseStatus;
|
|
|
-import com.goafanti.common.enums.DeleteStatus;
|
|
|
-import com.goafanti.common.enums.DemandAuditStatus;
|
|
|
-import com.goafanti.common.enums.DemandReleaseStatus;
|
|
|
-import com.goafanti.common.model.Achievement;
|
|
|
-import com.goafanti.common.model.AchievementInterest;
|
|
|
-import com.goafanti.common.model.Demand;
|
|
|
-import com.goafanti.common.model.DemandInterest;
|
|
|
-import com.goafanti.core.shiro.token.TokenManager;
|
|
|
-import com.goafanti.demand.service.DemandInterestService;
|
|
|
-import com.goafanti.demand.service.DemandService;
|
|
|
-
|
|
|
-@RestController
|
|
|
-@RequestMapping(value = "/api/user/portal")
|
|
|
-public class PortalInterestApiController extends CertifyApiController{
|
|
|
- @Resource
|
|
|
- private AchievementService achievementService;
|
|
|
- @Resource
|
|
|
- private DemandService demandService;
|
|
|
- @Resource
|
|
|
- private AchievementInterestService achievementInterestService;
|
|
|
- @Resource
|
|
|
- private DemandInterestService demandInterestService;
|
|
|
-
|
|
|
- /**
|
|
|
- * 科技需求"感兴趣列表"
|
|
|
- */
|
|
|
- @RequestMapping(value = "/demandInterestList", method = RequestMethod.GET)
|
|
|
- public Result demandInterestList(String pageNo, String pageSize){
|
|
|
- Result res = new Result();
|
|
|
- Integer pNo = 1;
|
|
|
- Integer pSize = 10;
|
|
|
- if (StringUtils.isNumeric(pageSize)) {
|
|
|
- pSize = Integer.parseInt(pageSize);
|
|
|
- }
|
|
|
- if (StringUtils.isNumeric(pageNo)) {
|
|
|
- pNo = Integer.parseInt(pageNo);
|
|
|
- }
|
|
|
- res.setData(demandInterestService.listDemandInterest(pNo, pSize));
|
|
|
- return res;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 科技成果"感兴趣列表"
|
|
|
- */
|
|
|
- @RequestMapping(value = "/achievementInterestList", method = RequestMethod.GET)
|
|
|
- private Result achievementInterestList(String pageNo, String pageSize) {
|
|
|
- Result res = new Result();
|
|
|
- Integer pNo = 1;
|
|
|
- Integer pSize = 10;
|
|
|
- if (StringUtils.isNumeric(pageSize)) {
|
|
|
- pSize = Integer.parseInt(pageSize);
|
|
|
- }
|
|
|
- if (StringUtils.isNumeric(pageNo)) {
|
|
|
- pNo = Integer.parseInt(pageNo);
|
|
|
- }
|
|
|
- res.setData(achievementInterestService.listAchievementInterest(pNo, pSize));
|
|
|
- return res;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 科技需求取消关注
|
|
|
- *
|
|
|
- */
|
|
|
- @RequestMapping(value = "/demandCancelInterest", method = RequestMethod.POST)
|
|
|
- public Result demandCancelInterest(String id) {
|
|
|
- Result res = new Result();
|
|
|
- if (StringUtils.isBlank(id)) {
|
|
|
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到需求ID", "需求ID"));
|
|
|
- return res;
|
|
|
- }
|
|
|
- res.setData(demandInterestService.saveCancelDemandInterest(id));
|
|
|
- return res;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 科技需求关注
|
|
|
- */
|
|
|
- @RequestMapping(value = "/demandInterest", method = RequestMethod.POST)
|
|
|
- public Result demandInterest(String id) {
|
|
|
- Result res = new Result();
|
|
|
- if (StringUtils.isBlank(id)) {
|
|
|
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到需求ID", "需求ID"));
|
|
|
- return res;
|
|
|
- }
|
|
|
-
|
|
|
- DemandInterest di = demandInterestService.selectDemandInterestByUidAndDemandId(TokenManager.getUserId(), id);
|
|
|
- if (null != di) {
|
|
|
- res.getError().add(buildError("", "当前科技需求已关注!"));
|
|
|
- return res;
|
|
|
- }
|
|
|
- Demand d = demandService.selectByPrimaryKey(id);
|
|
|
- if (null == d || d.getDeletedSign().equals(DeleteStatus.DELETED.getCode())
|
|
|
- || !d.getAuditStatus().equals(DemandAuditStatus.AUDITED.getCode())
|
|
|
- || !d.getReleaseStatus().equals(DemandReleaseStatus.RELEASED.getCode())) {
|
|
|
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "需求ID"));
|
|
|
- return res;
|
|
|
- }
|
|
|
- res.setData(demandInterestService.saveAchievementInterest(id));
|
|
|
- return res;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 科技成果取消关注
|
|
|
- *
|
|
|
- */
|
|
|
- @RequestMapping(value = "/achievementCancelInterest", method = RequestMethod.POST)
|
|
|
- public Result achievementCancelInterest(String id) {
|
|
|
- Result res = new Result();
|
|
|
- if (StringUtils.isBlank(id)) {
|
|
|
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到成果ID", "成果ID"));
|
|
|
- return res;
|
|
|
- }
|
|
|
- res.setData(achievementInterestService.saveCancelAchievementInterest(id));
|
|
|
- return res;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 科技成果关注
|
|
|
- */
|
|
|
- @RequestMapping(value = "/achievementInterest", method = RequestMethod.POST)
|
|
|
- public Result achievementInterest(String id) {
|
|
|
- Result res = new Result();
|
|
|
-
|
|
|
- if (StringUtils.isBlank(id)) {
|
|
|
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到成果ID", "科技成果ID"));
|
|
|
- return res;
|
|
|
- }
|
|
|
-
|
|
|
- AchievementInterest ai = achievementInterestService
|
|
|
- .selectAchievementInterestByUidAndAchievementId(TokenManager.getUserId(), id);
|
|
|
- if (null != ai) {
|
|
|
- res.getError().add(buildError("", "当前科技成果已关注!"));
|
|
|
- return res;
|
|
|
- }
|
|
|
-
|
|
|
- Achievement a = achievementService.selectByPrimaryKey(id);
|
|
|
- if (null == a || a.getDeletedSign().equals(DeleteStatus.DELETED.getCode())
|
|
|
- || !a.getAuditStatus().equals(AchievementAuditStatus.AUDITED.getCode())
|
|
|
- || !a.getReleaseStatus().equals(AchievementReleaseStatus.RELEASED.getCode())) {
|
|
|
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "成果ID"));
|
|
|
- return res;
|
|
|
- }
|
|
|
- res.setData(achievementInterestService.saveAchievementInterest(id));
|
|
|
- return res;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- /**
|
|
|
- * 科技成果详情
|
|
|
- */
|
|
|
- @RequestMapping(value = "/achievementDetail", method = RequestMethod.GET)
|
|
|
- public Result achievementDetail(String id) {
|
|
|
- Result res = new Result();
|
|
|
- if (StringUtils.isBlank(id)) {
|
|
|
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到成果ID", "成果ID"));
|
|
|
- return res;
|
|
|
- }
|
|
|
- res.setData(achievementService.selectAchievementDetail(TokenManager.getUserId(), id));
|
|
|
- return res;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 科技需求详情
|
|
|
- */
|
|
|
- @RequestMapping(value = "/demandDetail", method = RequestMethod.GET)
|
|
|
- public Result demandDetail(String id) {
|
|
|
- Result res = new Result();
|
|
|
- if (StringUtils.isBlank(id)) {
|
|
|
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到需求ID", "需求ID"));
|
|
|
- return res;
|
|
|
- }
|
|
|
- res.setData(demandService.selectDemandDetail(TokenManager.getUserId(), id));
|
|
|
- return res;
|
|
|
- }
|
|
|
-
|
|
|
-}
|
|
|
+package com.goafanti.portal.controller;
|
|
|
+
|
|
|
+import java.util.Date;
|
|
|
+import java.util.UUID;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
+
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+import com.goafanti.achievement.service.AchievementInterestService;
|
|
|
+import com.goafanti.achievement.service.AchievementService;
|
|
|
+import com.goafanti.business.service.JtBusinessService;
|
|
|
+import com.goafanti.common.bo.Result;
|
|
|
+import com.goafanti.common.constant.ErrorConstants;
|
|
|
+import com.goafanti.common.controller.CertifyApiController;
|
|
|
+import com.goafanti.common.dao.ProjectInterestMapper;
|
|
|
+import com.goafanti.common.enums.AchievementAuditStatus;
|
|
|
+import com.goafanti.common.enums.AchievementReleaseStatus;
|
|
|
+import com.goafanti.common.enums.DeleteStatus;
|
|
|
+import com.goafanti.common.enums.DemandAuditStatus;
|
|
|
+import com.goafanti.common.enums.DemandReleaseStatus;
|
|
|
+import com.goafanti.common.model.Achievement;
|
|
|
+import com.goafanti.common.model.AchievementInterest;
|
|
|
+import com.goafanti.common.model.Demand;
|
|
|
+import com.goafanti.common.model.DemandInterest;
|
|
|
+import com.goafanti.common.model.JtBusinessProject;
|
|
|
+import com.goafanti.common.model.ProjectInterest;
|
|
|
+import com.goafanti.common.model.UserInterest;
|
|
|
+import com.goafanti.core.mybatis.page.Pagination;
|
|
|
+import com.goafanti.core.shiro.token.TokenManager;
|
|
|
+import com.goafanti.demand.service.DemandInterestService;
|
|
|
+import com.goafanti.demand.service.DemandService;
|
|
|
+import com.goafanti.user.bo.UserIdentityBo;
|
|
|
+import com.goafanti.user.service.UserIdentityService;
|
|
|
+import com.goafanti.user.service.UserInterestService;
|
|
|
+import com.goafanti.user.service.UserService;
|
|
|
+
|
|
|
+@RestController
|
|
|
+@RequestMapping(value = "/api/user/portal")
|
|
|
+public class PortalInterestApiController extends CertifyApiController{
|
|
|
+ @Resource
|
|
|
+ private AchievementService achievementService;
|
|
|
+ @Resource
|
|
|
+ private DemandService demandService;
|
|
|
+ @Resource
|
|
|
+ private AchievementInterestService achievementInterestService;
|
|
|
+ @Resource
|
|
|
+ private DemandInterestService demandInterestService;
|
|
|
+ @Resource
|
|
|
+ private JtBusinessService jtBusinessService;
|
|
|
+ @Resource
|
|
|
+ private ProjectInterestMapper projectInterestMapper;
|
|
|
+ @Resource
|
|
|
+ private UserInterestService userInterestService;
|
|
|
+ @Resource UserIdentityService userIdentityService ;
|
|
|
+ /**
|
|
|
+ * 科技需求"感兴趣列表"
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/demandInterestList", method = RequestMethod.GET)
|
|
|
+ public Result demandInterestList(String pageNo, String pageSize){
|
|
|
+ Result res = new Result();
|
|
|
+ Integer pNo = 1;
|
|
|
+ Integer pSize = 10;
|
|
|
+ if (StringUtils.isNumeric(pageSize)) {
|
|
|
+ pSize = Integer.parseInt(pageSize);
|
|
|
+ }
|
|
|
+ if (StringUtils.isNumeric(pageNo)) {
|
|
|
+ pNo = Integer.parseInt(pageNo);
|
|
|
+ }
|
|
|
+ res.setData(demandInterestService.listDemandInterest(pNo, pSize));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 科技成果"感兴趣列表"
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/achievementInterestList", method = RequestMethod.GET)
|
|
|
+ private Result achievementInterestList(String pageNo, String pageSize) {
|
|
|
+ Result res = new Result();
|
|
|
+ Integer pNo = 1;
|
|
|
+ Integer pSize = 10;
|
|
|
+ if (StringUtils.isNumeric(pageSize)) {
|
|
|
+ pSize = Integer.parseInt(pageSize);
|
|
|
+ }
|
|
|
+ if (StringUtils.isNumeric(pageNo)) {
|
|
|
+ pNo = Integer.parseInt(pageNo);
|
|
|
+ }
|
|
|
+ res.setData(achievementInterestService.listAchievementInterest(pNo, pSize));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 科技需求取消关注
|
|
|
+ *
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/demandCancelInterest", method = RequestMethod.POST)
|
|
|
+ public Result demandCancelInterest(String id) {
|
|
|
+ Result res = new Result();
|
|
|
+ if (StringUtils.isBlank(id)) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到需求ID", "需求ID"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ res.setData(demandInterestService.saveCancelDemandInterest(id));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 科技需求关注
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/demandInterest", method = RequestMethod.POST)
|
|
|
+ public Result demandInterest(String id) {
|
|
|
+ Result res = new Result();
|
|
|
+ if (StringUtils.isBlank(id)) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到需求ID", "需求ID"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+ DemandInterest di = demandInterestService.selectDemandInterestByUidAndDemandId(TokenManager.getUserId(), id);
|
|
|
+ if (null != di) {
|
|
|
+ res.getError().add(buildError("", "当前科技需求已关注!"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ Demand d = demandService.selectByPrimaryKey(id);
|
|
|
+ if (null == d || d.getDeletedSign().equals(DeleteStatus.DELETED.getCode())
|
|
|
+ || !d.getAuditStatus().equals(DemandAuditStatus.AUDITED.getCode())
|
|
|
+ || !d.getReleaseStatus().equals(DemandReleaseStatus.RELEASED.getCode())) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "需求ID"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ res.setData(demandInterestService.saveAchievementInterest(id));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 科技成果取消关注
|
|
|
+ *
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/achievementCancelInterest", method = RequestMethod.POST)
|
|
|
+ public Result achievementCancelInterest(String id) {
|
|
|
+ Result res = new Result();
|
|
|
+ if (StringUtils.isBlank(id)) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到成果ID", "成果ID"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ res.setData(achievementInterestService.saveCancelAchievementInterest(id));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 科技成果关注
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/achievementInterest", method = RequestMethod.POST)
|
|
|
+ public Result achievementInterest(String id) {
|
|
|
+ Result res = new Result();
|
|
|
+
|
|
|
+ if (StringUtils.isBlank(id)) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到成果ID", "科技成果ID"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+ AchievementInterest ai = achievementInterestService
|
|
|
+ .selectAchievementInterestByUidAndAchievementId(TokenManager.getUserId(), id);
|
|
|
+ if (null != ai) {
|
|
|
+ res.getError().add(buildError("", "当前科技成果已关注!"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+ Achievement a = achievementService.selectByPrimaryKey(id);
|
|
|
+ if (null == a || a.getDeletedSign().equals(DeleteStatus.DELETED.getCode())
|
|
|
+ || !a.getAuditStatus().equals(AchievementAuditStatus.AUDITED.getCode())
|
|
|
+ || !a.getReleaseStatus().equals(AchievementReleaseStatus.RELEASED.getCode())) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "成果ID"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ res.setData(achievementInterestService.saveAchievementInterest(id));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 科技成果详情
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/achievementDetail", method = RequestMethod.GET)
|
|
|
+ public Result achievementDetail(String id) {
|
|
|
+ Result res = new Result();
|
|
|
+ if (StringUtils.isBlank(id)) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到成果ID", "成果ID"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ res.setData(achievementService.selectAchievementDetail(TokenManager.getUserId(), id));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 科技需求详情
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/demandDetail", method = RequestMethod.GET)
|
|
|
+ public Result demandDetail(String id) {
|
|
|
+ Result res = new Result();
|
|
|
+ if (StringUtils.isBlank(id)) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到需求ID", "需求ID"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ res.setData(demandService.selectDemandDetail(TokenManager.getUserId(), id));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+ /*
|
|
|
+ * 服务项目取消关注
|
|
|
+ * */
|
|
|
+ @RequestMapping(value="/projectCancelInterest",method=RequestMethod.POST)
|
|
|
+ public Result projectCancelInterest(String id) {
|
|
|
+ Result result=new Result();
|
|
|
+ if(StringUtils.isBlank(id)) {
|
|
|
+ result.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到需求ID", "需求ID"));
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ if(StringUtils.isBlank(TokenManager.getUserId())) {
|
|
|
+ result.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "当前用户未登陆"));
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ result.setData(projectInterestMapper.deleteInterest(TokenManager.getUserId(), id));
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ /*
|
|
|
+ * 服务项目关注
|
|
|
+ * */
|
|
|
+ @RequestMapping(value="/projectInterest",method=RequestMethod.POST)
|
|
|
+ public Result projectInterest(String id) {
|
|
|
+ Result result=new Result();
|
|
|
+ if(StringUtils.isBlank(id)) {
|
|
|
+ result.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到需求ID", "需求ID"));
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ if(StringUtils.isBlank(TokenManager.getUserId())) {
|
|
|
+ result.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "当前用户未登陆"));
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ ProjectInterest projectInterest=new ProjectInterest();
|
|
|
+ projectInterest.setCreateTime(new Date());
|
|
|
+ projectInterest.setId(UUID.randomUUID().toString());
|
|
|
+ projectInterest.setProjectId(id);
|
|
|
+ projectInterest.setUid(TokenManager.getUserId());
|
|
|
+ result.setData(projectInterestMapper.insert(projectInterest));
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ /*
|
|
|
+ * 服务-关注列表
|
|
|
+ * */
|
|
|
+ @RequestMapping(value="/listProjectIInterestedIn",method=RequestMethod.GET)
|
|
|
+ public Result listProjectIInterestedIn(Integer pageNo,Integer pageSize) {
|
|
|
+ Result result=new Result();
|
|
|
+ if(StringUtils.isBlank(TokenManager.getUserId())) {
|
|
|
+ result.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "当前用户未登陆"));
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ result.setData(jtBusinessService.listProjectIInterestedIn(pageNo,pageSize));
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ /*
|
|
|
+ * 成果关注列表
|
|
|
+ * */
|
|
|
+ @RequestMapping(value="/listAchievementIInterestedIn",method=RequestMethod.GET)
|
|
|
+ public Result listAchievementIInterestedIn(Integer pageNo,Integer pageSize) {
|
|
|
+ Result result=new Result();
|
|
|
+ if(StringUtils.isBlank(TokenManager.getUserId())) {
|
|
|
+ result.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "当前用户未登陆"));
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ result.setData(achievementService.listInterestedAchievement(pageNo, pageSize));
|
|
|
+ return result;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /*
|
|
|
+ * 需求关注列表
|
|
|
+ * */
|
|
|
+ @RequestMapping(value="/listDemandIInterestedIn",method=RequestMethod.GET)
|
|
|
+ public Result listDemandIInterestedIn(Integer pageNo,Integer pageSize) {
|
|
|
+ Result result=new Result();
|
|
|
+ if(StringUtils.isBlank(TokenManager.getUserId())) {
|
|
|
+ result.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "当前用户未登陆"));
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ result.setData(demandService.listInterestedAchievement(pageNo, pageSize));
|
|
|
+ return result;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /*
|
|
|
+ * 关注专家
|
|
|
+ * */
|
|
|
+ @RequestMapping(value="/expertInterest",method=RequestMethod.POST)
|
|
|
+ public Result expertInterest(String id) {
|
|
|
+ Result result=new Result();
|
|
|
+ if(StringUtils.isBlank(id)) {
|
|
|
+ result.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "专家ID"));
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ if(StringUtils.isBlank(TokenManager.getUserId())) {
|
|
|
+ result.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "当前用户未登陆"));
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+// UserInterest userInterest=new UserInterest();
|
|
|
+// userInterest.setCreateTime(new Date());
|
|
|
+// userInterest.setId(UUID.randomUUID().toString());
|
|
|
+// userInterest.setFromUid(TokenManager.getUserId());
|
|
|
+// userInterest.setToUid(id);
|
|
|
+ userInterestService.insert(id);
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ /*
|
|
|
+ * 取消关注专家
|
|
|
+ * */
|
|
|
+ @RequestMapping(value="/expertCancelInterest",method=RequestMethod.POST)
|
|
|
+ public Result expertCancelInterest(String id) {
|
|
|
+ Result result=new Result();
|
|
|
+ if(StringUtils.isBlank(id)) {
|
|
|
+ result.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "专家ID"));
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ if(StringUtils.isBlank(TokenManager.getUserId())) {
|
|
|
+ result.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "当前用户未登陆"));
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ UserInterest userInterest=userInterestService.findByFromUidAndToUid(TokenManager.getUserId(), id);
|
|
|
+ if(userInterest!=null && userInterest.getId()!=null)
|
|
|
+ userInterestService.deleteByPrimaryKey(userInterest.getId());
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ /*
|
|
|
+ * 专家-关注列表
|
|
|
+ * */
|
|
|
+ @RequestMapping(value="/listInterestedInExpert",method=RequestMethod.GET)
|
|
|
+ public Result listExpertIInterestedIn(Integer pageNo,Integer pageSize) {
|
|
|
+ Result result=new Result();
|
|
|
+ if(StringUtils.isBlank(TokenManager.getUserId())) {
|
|
|
+ result.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "当前用户未登陆"));
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ result.setData(userIdentityService.listInterestedDemand(pageNo,pageSize));
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+}
|