|
|
@@ -25,6 +25,7 @@ import com.goafanti.common.model.DemandOrder;
|
|
|
import com.goafanti.common.model.DemandOrderLog;
|
|
|
import com.goafanti.core.shiro.token.TokenManager;
|
|
|
import com.goafanti.demand.bo.InputDemandOrder;
|
|
|
+import com.goafanti.demand.service.DemandOrderLogService;
|
|
|
import com.goafanti.demand.service.DemandOrderService;
|
|
|
import com.goafanti.demand.service.DemandService;
|
|
|
|
|
|
@@ -32,14 +33,53 @@ import com.goafanti.demand.service.DemandService;
|
|
|
@RequestMapping(value = "/api/user/portal/order")
|
|
|
public class PortalOrderApiController extends CertifyApiController {
|
|
|
@Resource
|
|
|
- private DemandOrderService demandOrderService;
|
|
|
+ private DemandOrderService demandOrderService;
|
|
|
@Resource
|
|
|
- private DemandService demandService;
|
|
|
-
|
|
|
+ private DemandService demandService;
|
|
|
+ @Resource
|
|
|
+ private DemandOrderLogService demandOrderLogService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 科技需求订单log
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/demandOrderLog", method = RequestMethod.GET)
|
|
|
+ public Result demandOrderDetail(String demandOrderId) {
|
|
|
+ Result res = new Result();
|
|
|
+ if (StringUtils.isEmpty(demandOrderId)) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "科技需求订单ID"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ DemandOrder order = demandOrderService.selectByPrimaryKey(demandOrderId);
|
|
|
+ if (null != order && TokenManager.getUserId().equals(order.getUid())) {
|
|
|
+ res.setData(demandOrderLogService.selectDemandOrderLogByDemandOrderId(demandOrderId));
|
|
|
+ } else {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "科技需求订单ID"));
|
|
|
+ }
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 订单列表
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/demandOrderList", method = RequestMethod.GET)
|
|
|
+ public Result orderList(Integer status, 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(demandOrderService.listOrderList(status, pNo, pSize));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 附件上传
|
|
|
*/
|
|
|
- @RequestMapping(value = "/upload", method = RequestMethod.POST)
|
|
|
+ @RequestMapping(value = "/demandUpload", method = RequestMethod.POST)
|
|
|
public Result uploadTextFile(HttpServletRequest req, String sign) {
|
|
|
Result res = new Result();
|
|
|
|
|
|
@@ -52,11 +92,11 @@ public class PortalOrderApiController extends CertifyApiController {
|
|
|
}
|
|
|
return res;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 下载文件
|
|
|
*/
|
|
|
- @RequestMapping(value = "/download", method = RequestMethod.GET)
|
|
|
+ @RequestMapping(value = "/demandDownload", method = RequestMethod.GET)
|
|
|
public Result download(HttpServletResponse response, String id) {
|
|
|
Result res = new Result();
|
|
|
|
|
|
@@ -90,7 +130,8 @@ public class PortalOrderApiController extends CertifyApiController {
|
|
|
res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到需求ID", "需求ID"));
|
|
|
return res;
|
|
|
}
|
|
|
- DemandOrder demandOrder = demandOrderService.selectDemandOrderByUidAndDemandId(TokenManager.getUserId(), inputDemandOrder.getDemandId());
|
|
|
+ DemandOrder demandOrder = demandOrderService.selectDemandOrderByUidAndDemandId(TokenManager.getUserId(),
|
|
|
+ inputDemandOrder.getDemandId());
|
|
|
if (null != demandOrder) {
|
|
|
res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "当前科技需求已接单!"));
|
|
|
return res;
|
|
|
@@ -102,15 +143,33 @@ public class PortalOrderApiController extends CertifyApiController {
|
|
|
res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "科技需求ID"));
|
|
|
return res;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
DemandOrder order = new DemandOrder();
|
|
|
DemandOrderLog dol = new DemandOrderLog();
|
|
|
BeanUtils.copyProperties(inputDemandOrder, order);
|
|
|
BeanUtils.copyProperties(inputDemandOrder, dol);
|
|
|
-
|
|
|
+
|
|
|
demandOrderService.saveDemandOrder(order, dol);
|
|
|
return res;
|
|
|
}
|
|
|
-
|
|
|
- //@RequestMapping(value = "/shutdown", method = )
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 关闭订单
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/demandShutdown", method = RequestMethod.POST)
|
|
|
+ public Result shutdown(String id) {
|
|
|
+ Result res = new Result();
|
|
|
+ if (StringUtils.isBlank(id)) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到订单ID", "订单ID"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+ DemandOrder order = demandOrderService.selectByPrimaryKey(id);
|
|
|
+ if (null == order) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "订单ID"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
}
|