|
|
@@ -20,30 +20,29 @@ 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.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.portal.bo.AchievementInterestListBo;
|
|
|
|
|
|
@RestController
|
|
|
@RequestMapping(value = "/portal/search")
|
|
|
public class PortalSearchApiController extends BaseApiController {
|
|
|
@Resource
|
|
|
- private AchievementService achievementService;
|
|
|
+ private AchievementService achievementService;
|
|
|
@Resource
|
|
|
- private DemandService demandService;
|
|
|
+ private DemandService demandService;
|
|
|
@Resource
|
|
|
- private AchievementInterestService achievementInterestService;
|
|
|
+ private AchievementInterestService achievementInterestService;
|
|
|
@Resource
|
|
|
- private DemandInterestService demandInterestService;
|
|
|
-
|
|
|
+ private DemandInterestService demandInterestService;
|
|
|
+
|
|
|
/**
|
|
|
* 科技成果"感兴趣列表"
|
|
|
*/
|
|
|
@RequestMapping(value = "/achievementInterestList", method = RequestMethod.GET)
|
|
|
- private Result achievementInterestList(String pageNo, String pageSize){
|
|
|
+ private Result achievementInterestList(String pageNo, String pageSize) {
|
|
|
Result res = new Result();
|
|
|
Integer pNo = 1;
|
|
|
Integer pSize = 10;
|
|
|
@@ -53,16 +52,16 @@ public class PortalSearchApiController extends BaseApiController {
|
|
|
if (StringUtils.isNumeric(pageNo)) {
|
|
|
pNo = Integer.parseInt(pageNo);
|
|
|
}
|
|
|
- Pagination<AchievementInterestListBo> aa = achievementInterestService.listAchievementInterest(pNo, pSize);
|
|
|
+ res.setData(achievementInterestService.listAchievementInterest(pNo, pSize));
|
|
|
return res;
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
- /**科技需求取消关注
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 科技需求取消关注
|
|
|
*
|
|
|
*/
|
|
|
@RequestMapping(value = "/demandCancelInterest", method = RequestMethod.POST)
|
|
|
- public Result demandCancelInterest(String id){
|
|
|
+ public Result demandCancelInterest(String id) {
|
|
|
Result res = new Result();
|
|
|
if (StringUtils.isBlank(id)) {
|
|
|
res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到需求ID", "需求ID"));
|
|
|
@@ -92,13 +91,13 @@ public class PortalSearchApiController extends BaseApiController {
|
|
|
demandInterestService.saveAchievementInterest(id);
|
|
|
return res;
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
- /**科技成果取消关注
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 科技成果取消关注
|
|
|
*
|
|
|
*/
|
|
|
@RequestMapping(value = "/achievementCancelInterest", method = RequestMethod.POST)
|
|
|
- public Result achievementCancelInterest(String id){
|
|
|
+ public Result achievementCancelInterest(String id) {
|
|
|
Result res = new Result();
|
|
|
if (StringUtils.isBlank(id)) {
|
|
|
res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到成果ID", "成果ID"));
|
|
|
@@ -115,16 +114,23 @@ public class PortalSearchApiController extends BaseApiController {
|
|
|
public Result achievementInterest(String id) {
|
|
|
Result res = new Result();
|
|
|
if (StringUtils.isBlank(id)) {
|
|
|
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到成果ID", "成果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())) {
|
|
|
+ || !a.getReleaseStatus().equals(AchievementReleaseStatus.RELEASED.getCode())) {
|
|
|
res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "成果ID"));
|
|
|
return res;
|
|
|
}
|
|
|
+
|
|
|
+ AchievementInterest ai = achievementInterestService
|
|
|
+ .selectAchievementInterestByUidAndAchievementId(TokenManager.getUserId(), id);
|
|
|
+ if (null != ai){
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "当前科技成果已关注!"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
achievementInterestService.saveAchievementInterest(id);
|
|
|
return res;
|
|
|
}
|