|
|
@@ -1,6 +1,8 @@
|
|
|
package com.goafanti.portal.controller;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
import javax.validation.Valid;
|
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
@@ -13,8 +15,10 @@ 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.DeleteStatus;
|
|
|
import com.goafanti.common.enums.DemandAuditStatus;
|
|
|
+import com.goafanti.common.enums.DemandOrderFields;
|
|
|
import com.goafanti.common.enums.DemandReleaseStatus;
|
|
|
import com.goafanti.common.model.Demand;
|
|
|
import com.goafanti.common.model.DemandOrder;
|
|
|
@@ -31,6 +35,45 @@ public class PortalOrderApiController extends CertifyApiController {
|
|
|
private DemandOrderService demandOrderService;
|
|
|
@Resource
|
|
|
private DemandService demandService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 附件上传
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/upload", method = RequestMethod.POST)
|
|
|
+ public Result uploadTextFile(HttpServletRequest req, String sign) {
|
|
|
+ Result res = new Result();
|
|
|
+
|
|
|
+ AttachmentType attachmentType = AttachmentType.getField(sign);
|
|
|
+
|
|
|
+ if (attachmentType == AttachmentType.DEMAND_ORDER_FILE) {
|
|
|
+ res.setData(handleFiles(res, "/demandOrder/", false, req, sign, TokenManager.getUserId()));
|
|
|
+ } else {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
|
|
|
+ }
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 下载文件
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/download", method = RequestMethod.GET)
|
|
|
+ public Result download(HttpServletResponse response, String id) {
|
|
|
+ Result res = new Result();
|
|
|
+
|
|
|
+ if (StringUtils.isEmpty(id)) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "科技需求订单ID"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+ DemandOrder order = demandOrderService.selectByPrimaryKey(id);
|
|
|
+ if (null == order) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "科技需求订单ID"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+ downloadUnPrivateFile(response, order.getEnclosureDownloadFileName(), order.getEnclosureUrl());
|
|
|
+ return res;
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* "我要接单"
|
|
|
@@ -38,6 +81,11 @@ public class PortalOrderApiController extends CertifyApiController {
|
|
|
@RequestMapping(value = "/orderDemand", method = RequestMethod.POST)
|
|
|
public Result order(@Valid InputDemandOrder inputDemandOrder, BindingResult bindingResult) {
|
|
|
Result res = new Result();
|
|
|
+ if (bindingResult.hasErrors()) {
|
|
|
+ res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
|
|
|
+ DemandOrderFields.getFieldDesc(bindingResult.getFieldError().getField())));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
if (StringUtils.isBlank(inputDemandOrder.getDemandId())) {
|
|
|
res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到需求ID", "需求ID"));
|
|
|
return res;
|
|
|
@@ -63,4 +111,6 @@ public class PortalOrderApiController extends CertifyApiController {
|
|
|
demandOrderService.saveDemandOrder(order, dol);
|
|
|
return res;
|
|
|
}
|
|
|
+
|
|
|
+ //@RequestMapping(value = "/shutdown", method = )
|
|
|
}
|