|
@@ -1,8 +1,11 @@
|
|
|
package com.goafanti.portal.controller;
|
|
package com.goafanti.portal.controller;
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
|
|
|
+import javax.validation.Valid;
|
|
|
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
|
|
+import org.springframework.validation.BindingResult;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
@@ -15,7 +18,9 @@ import com.goafanti.common.enums.DemandAuditStatus;
|
|
|
import com.goafanti.common.enums.DemandReleaseStatus;
|
|
import com.goafanti.common.enums.DemandReleaseStatus;
|
|
|
import com.goafanti.common.model.Demand;
|
|
import com.goafanti.common.model.Demand;
|
|
|
import com.goafanti.common.model.DemandOrder;
|
|
import com.goafanti.common.model.DemandOrder;
|
|
|
|
|
+import com.goafanti.common.model.DemandOrderLog;
|
|
|
import com.goafanti.core.shiro.token.TokenManager;
|
|
import com.goafanti.core.shiro.token.TokenManager;
|
|
|
|
|
+import com.goafanti.demand.bo.InputDemandOrder;
|
|
|
import com.goafanti.demand.service.DemandOrderService;
|
|
import com.goafanti.demand.service.DemandOrderService;
|
|
|
import com.goafanti.demand.service.DemandService;
|
|
import com.goafanti.demand.service.DemandService;
|
|
|
|
|
|
|
@@ -30,19 +35,19 @@ public class PortalOrderApiController extends CertifyApiController {
|
|
|
/**
|
|
/**
|
|
|
* "我要接单"
|
|
* "我要接单"
|
|
|
*/
|
|
*/
|
|
|
- @RequestMapping(value = "/order", method = RequestMethod.POST)
|
|
|
|
|
- public Result order(String id) {
|
|
|
|
|
|
|
+ @RequestMapping(value = "/orderDemand", method = RequestMethod.POST)
|
|
|
|
|
+ public Result order(@Valid InputDemandOrder inputDemandOrder, BindingResult bindingResult) {
|
|
|
Result res = new Result();
|
|
Result res = new Result();
|
|
|
- if (StringUtils.isBlank(id)) {
|
|
|
|
|
|
|
+ if (StringUtils.isBlank(inputDemandOrder.getDemandId())) {
|
|
|
res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到需求ID", "需求ID"));
|
|
res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到需求ID", "需求ID"));
|
|
|
return res;
|
|
return res;
|
|
|
}
|
|
}
|
|
|
- DemandOrder demandOrder = demandOrderService.selectDemandOrderByUidAndDemandId(TokenManager.getUserId(), id);
|
|
|
|
|
|
|
+ DemandOrder demandOrder = demandOrderService.selectDemandOrderByUidAndDemandId(TokenManager.getUserId(), inputDemandOrder.getDemandId());
|
|
|
if (null != demandOrder) {
|
|
if (null != demandOrder) {
|
|
|
res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "当前科技需求已接单!"));
|
|
res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "当前科技需求已接单!"));
|
|
|
return res;
|
|
return res;
|
|
|
}
|
|
}
|
|
|
- Demand d = demandService.selectByPrimaryKey(id);
|
|
|
|
|
|
|
+ Demand d = demandService.selectByPrimaryKey(inputDemandOrder.getDemandId());
|
|
|
if (null == d || d.getDeletedSign().equals(DeleteStatus.DELETED.getCode())
|
|
if (null == d || d.getDeletedSign().equals(DeleteStatus.DELETED.getCode())
|
|
|
|| !d.getAuditStatus().equals(DemandAuditStatus.AUDITED.getCode())
|
|
|| !d.getAuditStatus().equals(DemandAuditStatus.AUDITED.getCode())
|
|
|
|| !d.getReleaseStatus().equals(DemandReleaseStatus.RELEASED.getCode())) {
|
|
|| !d.getReleaseStatus().equals(DemandReleaseStatus.RELEASED.getCode())) {
|
|
@@ -50,7 +55,12 @@ public class PortalOrderApiController extends CertifyApiController {
|
|
|
return res;
|
|
return res;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- demandOrderService.saveDemandOrder(id);
|
|
|
|
|
|
|
+ DemandOrder order = new DemandOrder();
|
|
|
|
|
+ DemandOrderLog dol = new DemandOrderLog();
|
|
|
|
|
+ BeanUtils.copyProperties(inputDemandOrder, order);
|
|
|
|
|
+ BeanUtils.copyProperties(inputDemandOrder, dol);
|
|
|
|
|
+
|
|
|
|
|
+ demandOrderService.saveDemandOrder(order, dol);
|
|
|
return res;
|
|
return res;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|