|
|
@@ -22,6 +22,7 @@ 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;
|
|
|
@@ -63,7 +64,7 @@ public class PortalSearchApiController extends CertifyApiController {
|
|
|
@RequestMapping(value = "/demandCancelInterest", method = RequestMethod.POST)
|
|
|
public Result demandCancelInterest(String id) {
|
|
|
Result res = new Result();
|
|
|
- if(!checkUserLogin(res)){
|
|
|
+ if (!checkUserLogin(res)) {
|
|
|
return res;
|
|
|
}
|
|
|
if (StringUtils.isBlank(id)) {
|
|
|
@@ -80,13 +81,19 @@ public class PortalSearchApiController extends CertifyApiController {
|
|
|
@RequestMapping(value = "/demandInterest", method = RequestMethod.POST)
|
|
|
public Result demandInterest(String id) {
|
|
|
Result res = new Result();
|
|
|
- if(!checkUserLogin(res)){
|
|
|
+ if (!checkUserLogin(res)) {
|
|
|
return res;
|
|
|
}
|
|
|
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(ErrorConstants.PARAM_ERROR, "当前科技科技需求已关注!"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
Demand d = demandService.selectByPrimaryKey(id);
|
|
|
if (null == d || d.getDeletedSign().equals(DeleteStatus.DELETED.getCode())
|
|
|
|| !d.getAuditStatus().equals(DemandAuditStatus.AUDITED.getCode())
|
|
|
@@ -105,7 +112,7 @@ public class PortalSearchApiController extends CertifyApiController {
|
|
|
@RequestMapping(value = "/achievementCancelInterest", method = RequestMethod.POST)
|
|
|
public Result achievementCancelInterest(String id) {
|
|
|
Result res = new Result();
|
|
|
- if(!checkUserLogin(res)){
|
|
|
+ if (!checkUserLogin(res)) {
|
|
|
return res;
|
|
|
}
|
|
|
if (StringUtils.isBlank(id)) {
|
|
|
@@ -122,15 +129,23 @@ public class PortalSearchApiController extends CertifyApiController {
|
|
|
@RequestMapping(value = "/achievementInterest", method = RequestMethod.POST)
|
|
|
public Result achievementInterest(String id) {
|
|
|
Result res = new Result();
|
|
|
-
|
|
|
- if(!checkUserLogin(res)){
|
|
|
+
|
|
|
+ if (!checkUserLogin(res)) {
|
|
|
return res;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
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(ErrorConstants.PARAM_ERROR, "当前科技成果已关注!"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
Achievement a = achievementService.selectByPrimaryKey(id);
|
|
|
if (null == a || a.getDeletedSign().equals(DeleteStatus.DELETED.getCode())
|
|
|
|| !a.getAuditStatus().equals(AchievementAuditStatus.AUDITED.getCode())
|
|
|
@@ -138,13 +153,6 @@ public class PortalSearchApiController extends CertifyApiController {
|
|
|
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;
|
|
|
}
|