|
|
@@ -1,8 +1,11 @@
|
|
|
package com.goafanti.admin.controller;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
+import javax.validation.Valid;
|
|
|
|
|
|
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.RequestMethod;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
@@ -11,6 +14,10 @@ import com.goafanti.achievement.service.AchievementOrderService;
|
|
|
import com.goafanti.common.bo.Result;
|
|
|
import com.goafanti.common.constant.ErrorConstants;
|
|
|
import com.goafanti.common.controller.CertifyApiController;
|
|
|
+import com.goafanti.common.enums.AchievementOrderFields;
|
|
|
+import com.goafanti.common.model.DemandOrder;
|
|
|
+import com.goafanti.common.model.DemandOrderLog;
|
|
|
+import com.goafanti.demand.bo.InputDemandOrder;
|
|
|
import com.goafanti.demand.service.DemandOrderLogService;
|
|
|
import com.goafanti.demand.service.DemandOrderService;
|
|
|
|
|
|
@@ -73,4 +80,43 @@ public class AdminOrderApiController extends CertifyApiController {
|
|
|
res.setData(demandOrderLogService.selectAdminDemandOrderLogByDemandOrderId(demandOrderId));
|
|
|
return res;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 科技需求线索单/意向单修改
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/updateDemandOrder", method = RequestMethod.POST)
|
|
|
+ public Result updateDemandOrder(@Valid InputDemandOrder inputDemandOrder, BindingResult bindingResult, String recordTimeFormattedDate,
|
|
|
+ Boolean flag) {
|
|
|
+ Result res = new Result();
|
|
|
+ if (bindingResult.hasErrors()) {
|
|
|
+ res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
|
|
|
+ AchievementOrderFields.getFieldDesc(bindingResult.getFieldError().getField())));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ if (StringUtils.isBlank(inputDemandOrder.getDemandId())){
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到科技需求ID", "科技需求ID"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ if (null == inputDemandOrder.getStatus()){
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到科技需求状态", "科技需求状态"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (null == flag){
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到科技需求修改标记", "科技需求修改标记"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (flag && StringUtils.isBlank(recordTimeFormattedDate)){
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到科技需求记录修改时间", "科技需求记录修改时间"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ DemandOrder order = new DemandOrder();
|
|
|
+ DemandOrderLog dol = new DemandOrderLog();
|
|
|
+ BeanUtils.copyProperties(inputDemandOrder, order);
|
|
|
+ BeanUtils.copyProperties(inputDemandOrder, dol);
|
|
|
+ res.setData(demandOrderService.updateDemandOrder(order, dol, recordTimeFormattedDate));
|
|
|
+ return res;
|
|
|
+
|
|
|
+ }
|
|
|
}
|