|
|
@@ -2,6 +2,7 @@ package com.goafanti.admin.controller;
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.validation.Valid;
|
|
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
@@ -13,6 +14,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
import com.goafanti.common.bo.Result;
|
|
|
import com.goafanti.common.constant.ErrorConstants;
|
|
|
import com.goafanti.common.controller.CertifyApiController;
|
|
|
+import com.goafanti.common.enums.AttachmentType;
|
|
|
import com.goafanti.common.enums.DemandDataCategory;
|
|
|
import com.goafanti.common.enums.DemandFields;
|
|
|
import com.goafanti.common.enums.DemandReleaseStatus;
|
|
|
@@ -26,6 +28,51 @@ import com.goafanti.demand.service.DemandService;
|
|
|
public class AdminDemandApiController extends CertifyApiController {
|
|
|
@Resource
|
|
|
private DemandService demandService;
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 需求资料--图片上传
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/uploadPicture", method = RequestMethod.POST)
|
|
|
+ public Result uploadPicture(HttpServletRequest req, String sign, String uid) {
|
|
|
+ Result res = new Result();
|
|
|
+ if (StringUtils.isBlank(uid)){
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户ID", "用户ID"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+ AttachmentType attachmentType = AttachmentType.getField(sign);
|
|
|
+
|
|
|
+ if (attachmentType == AttachmentType.DEMAND_PICTURE) {
|
|
|
+ res.setData(handleFiles(res, "/demand/", false, req, sign, uid));
|
|
|
+ } else {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
|
|
|
+ }
|
|
|
+
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 需求资料--文本文件上传
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/uploadTextFile", method = RequestMethod.POST)
|
|
|
+ public Result uploadTextFile(HttpServletRequest req, String sign, String uid){
|
|
|
+ Result res = new Result();
|
|
|
+
|
|
|
+ if (StringUtils.isBlank(uid)){
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户ID", "用户ID"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+ AttachmentType attachmentType = AttachmentType.getField(sign);
|
|
|
+
|
|
|
+ if (attachmentType == AttachmentType.DEMAND_TEXT_FILE) {
|
|
|
+ res.setData(handleFiles(res, "/demand/", false, req, sign, uid));
|
|
|
+ } else {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
|
|
|
+ }
|
|
|
+ return res;
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 个人用户--需求列表
|