|
@@ -9,10 +9,19 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
|
|
|
|
+import com.goafanti.achievement.service.AchievementInterestService;
|
|
|
import com.goafanti.achievement.service.AchievementService;
|
|
import com.goafanti.achievement.service.AchievementService;
|
|
|
import com.goafanti.common.bo.Result;
|
|
import com.goafanti.common.bo.Result;
|
|
|
import com.goafanti.common.constant.ErrorConstants;
|
|
import com.goafanti.common.constant.ErrorConstants;
|
|
|
import com.goafanti.common.controller.BaseApiController;
|
|
import com.goafanti.common.controller.BaseApiController;
|
|
|
|
|
+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.Demand;
|
|
|
|
|
+import com.goafanti.demand.service.DemandInterestService;
|
|
|
import com.goafanti.demand.service.DemandService;
|
|
import com.goafanti.demand.service.DemandService;
|
|
|
|
|
|
|
|
@RestController
|
|
@RestController
|
|
@@ -22,6 +31,82 @@ public class PortalSearchApiController extends BaseApiController {
|
|
|
private AchievementService achievementService;
|
|
private AchievementService achievementService;
|
|
|
@Resource
|
|
@Resource
|
|
|
private DemandService demandService;
|
|
private DemandService demandService;
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ private AchievementInterestService achievementInterestService;
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ private DemandInterestService demandInterestService;
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ /**科技需求取消关注
|
|
|
|
|
+ *
|
|
|
|
|
+ */
|
|
|
|
|
+ @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;
|
|
|
|
|
+ }
|
|
|
|
|
+ Demand d = demandService.selectByPrimaryKey(id);
|
|
|
|
|
+ if (null == d || d.getDeletedSign().equals(DeleteStatus.DELETED.getCode())
|
|
|
|
|
+ || !d.getAuditStatus().equals(DemandAuditStatus.AUDITED.getCode())
|
|
|
|
|
+ || !d.getReleaseStatus().equals(DemandReleaseStatus.UNRELEASE.getCode())) {
|
|
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "需求ID"));
|
|
|
|
|
+ return res;
|
|
|
|
|
+ }
|
|
|
|
|
+ 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;
|
|
|
|
|
+ }
|
|
|
|
|
+ Achievement a = achievementService.selectByPrimaryKey(id);
|
|
|
|
|
+ if (null == a || a.getDeletedSign().equals(DeleteStatus.DELETED.getCode())
|
|
|
|
|
+ || !a.getAuditStatus().equals(AchievementAuditStatus.AUDITED.getCode())
|
|
|
|
|
+ || !a.getReleaseStatus().equals(AchievementReleaseStatus.UNRELEASE.getCode())) {
|
|
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "成果ID"));
|
|
|
|
|
+ return res;
|
|
|
|
|
+ }
|
|
|
|
|
+ achievementInterestService.saveAchievementInterest(id);
|
|
|
|
|
+ return res;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 科技成果搜索
|
|
* 科技成果搜索
|