Sfoglia il codice sorgente

管理端--科技需求线索单/意向单修改

Antiloveg 8 anni fa
parent
commit
368cd88ed2

+ 4 - 6
src/main/java/com/goafanti/admin/controller/AdminAuditApiController.java

@@ -54,9 +54,8 @@ public class AdminAuditApiController extends CertifyApiController {
 			return res;
 		}
 
-		if (DemandAuditStatus.INAUDIT.getCode().equals(d.getAuditStatus())
-				|| DemandAuditStatus.UNAUDITED.getCode().equals(d.getAuditStatus())) {
-			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "当前需求状态无法审核!"));
+		if (!DemandAuditStatus.INAUDIT.getCode().equals(d.getAuditStatus())) {
+			res.getError().add(buildError("", "当前需求状态无法审核!"));
 			return res;
 		}
 
@@ -80,9 +79,8 @@ public class AdminAuditApiController extends CertifyApiController {
 			return res;
 		}
 
-		if (AchievementAuditStatus.INAUDIT.getCode().equals(a.getAuditStatus())
-				|| AchievementAuditStatus.UNAUDITED.getCode().equals(a.getAuditStatus())) {
-			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "当前成果状态无法审核!"));
+		if (!AchievementAuditStatus.INAUDIT.getCode().equals(a.getAuditStatus())) {
+			res.getError().add(buildError("", "当前成果状态无法审核!"));
 			return res;
 		}
 

+ 46 - 0
src/main/java/com/goafanti/admin/controller/AdminOrderApiController.java

@@ -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;
+
+	}
 }

+ 1 - 1
src/main/java/com/goafanti/common/model/PatentLog.java

@@ -105,7 +105,7 @@ public class PatentLog {
 		}
 	}
 	
-	public void setRecordTimeFormattedDate(String createTimeFormattedDate){
+	public void setRecordTimeFormattedDate(String recordTimeFormattedDate){
 		
 	}
 }

+ 2 - 0
src/main/java/com/goafanti/demand/service/DemandOrderService.java

@@ -27,4 +27,6 @@ public interface DemandOrderService {
 
 	Pagination<OrgDemandOrderListBo> listOrgDemandOrder(String uid, String unitName, Integer status, Integer pNo, Integer pSize);
 
+	int updateDemandOrder(DemandOrder order, DemandOrderLog dol, String recordTimeFormattedDate);
+
 }

+ 21 - 0
src/main/java/com/goafanti/demand/service/impl/DemandOrderServiceImpl.java

@@ -1,14 +1,18 @@
 package com.goafanti.demand.service.impl;
 
+import java.text.ParseException;
 import java.util.Calendar;
+import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.UUID;
 
+import org.apache.commons.lang3.time.DateUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import com.goafanti.common.constant.AFTConstants;
 import com.goafanti.common.dao.DemandOrderLogMapper;
 import com.goafanti.common.dao.DemandOrderMapper;
 import com.goafanti.common.enums.DeleteStatus;
@@ -117,6 +121,23 @@ public class DemandOrderServiceImpl extends BaseMybatisDao<DemandOrderMapper> im
 				disposeDemandOrderList(uid, null, unitName, status, true), pNo, pSize);
 	}
 
+	@Override
+	public int updateDemandOrder(DemandOrder order, DemandOrderLog dol, String recordTimeFormattedDate) {
+		if (!StringUtils.isBlank(recordTimeFormattedDate)) {
+			dol.setOperator(TokenManager.getAdminId());
+			dol.setId(UUID.randomUUID().toString());
+			dol.setDemandOrderId(order.getId());
+			Date recordTime = null;
+			try {
+				recordTime = DateUtils.parseDate(recordTimeFormattedDate, AFTConstants.YYYYMMDDHHMMSS);
+			} catch (ParseException e) {
+			}
+			dol.setRecordTime(recordTime);
+			demandOrderLogMapper.insert(dol);
+		}
+		return demandOrderMapper.updateByPrimaryKeySelective(order);
+	}
+
 	private Map<String, Object> disposeDemandOrderList(String uid, String username, String unitName, Integer status,
 			Boolean flag) {
 		Map<String, Object> params = new HashMap<>();