|
|
@@ -1,6 +1,8 @@
|
|
|
package com.goafanti.admin.controller;
|
|
|
|
|
|
|
|
|
+import java.util.Arrays;
|
|
|
+
|
|
|
import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.validation.Valid;
|
|
|
@@ -9,6 +11,7 @@ import org.springframework.beans.BeanUtils;
|
|
|
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.RestController;
|
|
|
|
|
|
import com.goafanti.common.bo.Result;
|
|
|
@@ -29,6 +32,8 @@ public class AdminDemandApiController extends CertifyApiController {
|
|
|
@Resource
|
|
|
private DemandService demandService;
|
|
|
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 个人需求详情
|
|
|
*/
|
|
|
@@ -46,49 +51,7 @@ public class AdminDemandApiController extends CertifyApiController {
|
|
|
}
|
|
|
|
|
|
|
|
|
- /**
|
|
|
- * 需求资料--图片上传
|
|
|
- */
|
|
|
- @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;
|
|
|
- }
|
|
|
|
|
|
/**
|
|
|
* 个人用户--需求列表
|
|
|
@@ -188,6 +151,64 @@ public class AdminDemandApiController extends CertifyApiController {
|
|
|
return res;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 需求资料--图片上传
|
|
|
+ */
|
|
|
+ @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;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除需求(个人&团体)
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/delete", method = RequestMethod.POST)
|
|
|
+ public Result delete(@RequestParam(name = "ids[]", required = false) String[] ids){
|
|
|
+ Result res = new Result();
|
|
|
+ if (ids == null || ids.length < 1) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", ""));
|
|
|
+ } else {
|
|
|
+ res.setData(demandService.deleteByPrimaryKey(Arrays.asList(ids)));
|
|
|
+ }
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
private Result disposeDemand(Result res, InputDemand demand){
|
|
|
if (StringUtils.isBlank(demand.getName())) {
|
|
|
res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到需求名称", "需求名称"));
|