|
|
@@ -15,6 +15,7 @@ import org.springframework.http.HttpMethod;
|
|
|
import org.springframework.validation.BindingResult;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
+import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
@@ -25,10 +26,13 @@ import com.goafanti.banners.service.BannersService;
|
|
|
import com.goafanti.common.bo.Result;
|
|
|
import com.goafanti.common.constant.AFTConstants;
|
|
|
import com.goafanti.common.constant.ErrorConstants;
|
|
|
+import com.goafanti.common.constant.PageConstants;
|
|
|
import com.goafanti.common.controller.BaseApiController;
|
|
|
import com.goafanti.common.dao.JpushEasemobAccountMapper;
|
|
|
+import com.goafanti.common.enums.AchievementAuditStatus;
|
|
|
import com.goafanti.common.enums.AchievementFields;
|
|
|
import com.goafanti.common.enums.AttachmentType;
|
|
|
+import com.goafanti.common.enums.DemandAuditStatus;
|
|
|
import com.goafanti.common.enums.DemandFields;
|
|
|
import com.goafanti.common.model.Achievement;
|
|
|
import com.goafanti.common.model.Demand;
|
|
|
@@ -42,6 +46,7 @@ import com.goafanti.common.utils.DateUtils;
|
|
|
import com.goafanti.common.utils.PasswordUtil;
|
|
|
import com.goafanti.common.utils.TimeUtils;
|
|
|
import com.goafanti.common.utils.VerifyCodeUtils;
|
|
|
+import com.goafanti.core.mybatis.page.Pagination;
|
|
|
import com.goafanti.core.shiro.token.TokenManager;
|
|
|
import com.goafanti.demand.bo.InputDemand;
|
|
|
import com.goafanti.demand.service.DemandService;
|
|
|
@@ -52,6 +57,7 @@ import com.goafanti.message.bo.MessageListBo;
|
|
|
import com.goafanti.message.service.MessageService;
|
|
|
import com.goafanti.news.service.NewsService;
|
|
|
import com.goafanti.order.service.JtOrderService;
|
|
|
+import com.goafanti.portal.bo.AchievementObject;
|
|
|
import com.goafanti.user.service.UserCareerService;
|
|
|
import com.goafanti.user.service.UserIdentityService;
|
|
|
import com.goafanti.user.service.UserInterestService;
|
|
|
@@ -277,24 +283,7 @@ public class AppUserController extends BaseApiController {
|
|
|
}
|
|
|
|
|
|
|
|
|
- /**
|
|
|
- * 我的成果
|
|
|
- */
|
|
|
- @RequestMapping(value = "/achievementList", method = RequestMethod.GET)
|
|
|
- private Result achievementList(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(achievementService.listAppMyAchievement(pNo, pSize));
|
|
|
- return res;
|
|
|
- }
|
|
|
|
|
|
/**
|
|
|
* 我的需求
|
|
|
@@ -615,4 +604,182 @@ public class AppUserController extends BaseApiController {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
+ /*
|
|
|
+ * APP我的成果列表
|
|
|
+ **/
|
|
|
+ @RequestMapping(value="/appAchievementList",method = RequestMethod.GET)
|
|
|
+ public Result msyJtAchievementList(Integer auditStatus, String name,Integer dataCategory, String startDate,
|
|
|
+ String endDate, Integer pageNo, Integer pageSize) {
|
|
|
+ Result result=new Result();
|
|
|
+ if(null==pageNo||pageNo<0)pageNo=1;
|
|
|
+ if(null==pageSize||pageSize<0)pageSize=10;
|
|
|
+ Pagination<AchievementObject> p=achievementService.listMyAchievement(auditStatus, name, dataCategory,
|
|
|
+ startDate, endDate, pageNo, pageSize);
|
|
|
+ result.data(p);
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 修改成果
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/updateAchievement", method = RequestMethod.POST)
|
|
|
+ public Result updateAchievement(@Valid InputAchievement ia, BindingResult bindingResult,
|
|
|
+ @RequestParam(name = "keywords[]", required = false) String[] keywords,
|
|
|
+ @RequestParam(name = "publishPages[]", required = false) String[] publishPages) {
|
|
|
+ Result res = new Result();
|
|
|
+ if (bindingResult.hasErrors()) {
|
|
|
+ res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
|
|
|
+ AchievementFields.getFieldDesc(bindingResult.getFieldError().getField())));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isBlank(ia.getId())) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到需求ID", "需求ID"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!AchievementAuditStatus.CREATE.getCode().equals(ia.getAuditStatus())
|
|
|
+ && !AchievementAuditStatus.SUBMIT.getCode().equals(ia.getAuditStatus())
|
|
|
+ && !AchievementAuditStatus.UNAUDITED.getCode().equals(ia.getAuditStatus())) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "当前状态无法提交审核!"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ List<String> webPages = new ArrayList<String>();
|
|
|
+ List<String> appPages = new ArrayList<String>();
|
|
|
+ PageConstants.putAchievement(publishPages, webPages, appPages);
|
|
|
+ res = disposeInputAchievement(res, ia, keywords,publishPages);
|
|
|
+ if (!res.getError().isEmpty()) {
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ if(webPages.size()==0 && appPages.size() == 0){
|
|
|
+
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "页面参数错误","页面参数"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ if(TokenManager.getUserId() ==null) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.NON_LOGIN, "", ""));return res;
|
|
|
+ }
|
|
|
+ Achievement a = new Achievement();
|
|
|
+ BeanUtils.copyProperties(ia, a);
|
|
|
+ a.setOwnerId(TokenManager.getUserId());
|
|
|
+ res.setData(achievementService.updateAchievement(a, keywords, null,webPages,appPages));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ private Result disposeInputAchievement(Result res, InputAchievement ia, String[] keywords,String[] publishPages) {
|
|
|
+ if (StringUtils.isBlank(ia.getName())) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到成果名称", "成果名称"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (null == ia.getCategory()) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到数据类别", "数据类别"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isBlank(ia.getKeyword())) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到关键词", "关键词"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (null == keywords || keywords.length < 1) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到关键词", "关键词"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ for (int i = 0; i < keywords.length; i++) {
|
|
|
+ if (AFTConstants.KEYWORDLENTH < keywords[i].length()) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "关键词长度"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 修改需求
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/updateDemand", method = RequestMethod.POST)
|
|
|
+ public Result updateDemand(@Valid InputDemand demand, BindingResult bindingResult,
|
|
|
+ @RequestParam(name = "keywords[]", required = false) String[] keywords,
|
|
|
+ @RequestParam(name = "publishPages[]", required = false) String[] publishPages,
|
|
|
+ String validityPeriodFormattedDate) {
|
|
|
+ Result res = new Result();
|
|
|
+ if (bindingResult.hasErrors()) {
|
|
|
+ res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
|
|
|
+ DemandFields.getFieldDesc(bindingResult.getFieldError().getField())));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ if (StringUtils.isBlank(demand.getId())) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到需求ID", "需求ID"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ if (!DemandAuditStatus.CREATE.getCode().equals(demand.getAuditStatus())
|
|
|
+ && !DemandAuditStatus.UNAUDITED.getCode().equals(demand.getAuditStatus())
|
|
|
+ && !DemandAuditStatus.REVOKE.getCode().equals(demand.getAuditStatus())) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "当前状态无法提交审核!"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ //demand.setAuditStatus(DemandAuditStatus.INAUDIT.getCode()); 两步操作,先保存后提交
|
|
|
+ res = disposeDemand(res, demand, keywords, publishPages);
|
|
|
+ if (!res.getError().isEmpty()) {
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ List<String> webPages = new ArrayList<String>();
|
|
|
+ List<String> appPages = new ArrayList<String>();
|
|
|
+ PageConstants.putDemand(publishPages, webPages, appPages);
|
|
|
+ if(webPages.size()==0 && appPages.size() == 0){
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "页面参数错误"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ Demand d = new Demand();
|
|
|
+ BeanUtils.copyProperties(demand, d);
|
|
|
+ d.setEmployerId(TokenManager.getUserId());
|
|
|
+ res.setData(demandService.updateUserDemand(d, validityPeriodFormattedDate, keywords, webPages,appPages));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ private Result disposeDemand(Result res, InputDemand demand, String[] keywords,String[] publishPages) {
|
|
|
+ if (StringUtils.isBlank(demand.getName())) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到需求名称", "需求名称"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+ /*if (!DemandDataCategory.USERDEMAND.getCode().equals(demand.getDataCategory())
|
|
|
+ && !DemandDataCategory.ORGDEMAND.getCode().equals(demand.getDataCategory())) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "数据类型"));
|
|
|
+ return res;
|
|
|
+ }*/
|
|
|
+
|
|
|
+ if (StringUtils.isBlank(demand.getKeyword())) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到关键词", "关键词"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (null == keywords || keywords.length < 1) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到关键词", "关键词"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (null == demand.getIndustryCategoryA()) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到行业类别", "行业类别"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (null == demand.getDemandType()) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到需求类型", "需求类型"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isBlank(demand.getProblemDes())) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到问题说明", "问题说明"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+ for (int i = 0; i < keywords.length; i++) {
|
|
|
+ if (AFTConstants.KEYWORDLENTH < keywords[i].length()) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "关键词长度"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return res;
|
|
|
+ }
|
|
|
}
|