Browse Source

审核员--审核员--审核科技需求&需求详情技术经纪人

Antiloveg 8 years ago
parent
commit
34ea52244e

+ 55 - 7
src/main/java/com/goafanti/admin/controller/AdminAuditApiController.java

@@ -8,20 +8,23 @@ import org.springframework.web.bind.annotation.RestController;
 
 import com.goafanti.admin.service.AdminService;
 import com.goafanti.common.bo.Result;
+import com.goafanti.common.constant.ErrorConstants;
 import com.goafanti.common.controller.CertifyApiController;
+import com.goafanti.common.enums.DemandAuditStatus;
+import com.goafanti.common.model.Demand;
+import com.goafanti.common.utils.StringUtils;
 import com.goafanti.demand.service.DemandService;
 
 @RestController
 @RequestMapping(value = "/api/admin/audit")
 public class AdminAuditApiController extends CertifyApiController {
 	@Resource
-	private AdminService adminService;
+	private AdminService	adminService;
 	@Resource
-	private DemandService demandService;
-
+	private DemandService	demandService;
 
 	/**
-	 * 审核员--获取技术经纪人
+	 * 审核员--获取技术经纪人下拉
 	 */
 	@RequestMapping(value = "/techBroders", method = RequestMethod.GET)
 	public Result getTechBroders() {
@@ -31,11 +34,56 @@ public class AdminAuditApiController extends CertifyApiController {
 	}
 
 	/**
-	 * 科技需求详情
+	 * 审核员--需求详情技术经纪人
+	 */
+	@RequestMapping(value = "/techBroder", method = RequestMethod.GET)
+	public Result demandDetail(String id) {
+		Result res = new Result();
+
+		if (StringUtils.isBlank(id)) {
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到需求ID", "需求ID"));
+			return res;
+		}
+
+		res.setData(demandService.selectByPrimaryKey(id).getTechBrokerId());
+		return res;
+	}
+
+	/**
+	 * 审核员--审核科技需求
 	 */
-	@RequestMapping(value = "/demandDetail", method = RequestMethod.GET)
-	public Result demandDetail() {
+	@RequestMapping(value = "/demand", method = RequestMethod.POST)
+	public Result demand(String id, String techBroderId, Integer auditStatus) {
 		Result res = new Result();
+		if (StringUtils.isBlank(id)) {
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到需求ID", "需求ID"));
+			return res;
+		}
+		
+		if (null == auditStatus){
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到审核状态", "审核状态"));
+			return res;
+		}
+
+		if (!DemandAuditStatus.AUDITED.getCode().equals(auditStatus)
+				&& !DemandAuditStatus.UNAUDITED.getCode().equals(auditStatus)){
+			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "审核状态"));
+			return res;
+		}
+		
+		if (DemandAuditStatus.AUDITED.getCode().equals(auditStatus)){
+			if (StringUtils.isBlank(techBroderId)){
+				res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到技术经纪人", "技术经纪人"));
+				return res;
+			}
+		}
+		
+		Demand d = demandService.selectByPrimaryKey(id);
+		if (null == d){
+			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "需求ID"));
+			return res;
+		}
+		res.setData(demandService.updateAuditDemand(d, techBroderId, auditStatus));
 		return res;
 	}
 }

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

@@ -39,4 +39,6 @@ public interface DemandService {
 
 	int updateReleaseStatus(Demand d);
 
+	int updateAuditDemand(Demand d, String techBroderId, Integer auditStatus);
+
 }

+ 13 - 0
src/main/java/com/goafanti/demand/service/impl/DemandServiceImpl.java

@@ -490,4 +490,17 @@ public class DemandServiceImpl extends BaseMybatisDao<DemandMapper> implements D
 		demandMapper.updateReleaseDate(d.getId());
 		return demandMapper.updateByPrimaryKeySelective(d);
 	}
+
+	@Override
+	public int updateAuditDemand(Demand d, String techBroderId, Integer auditStatus) {
+		d.setAuditStatus(auditStatus);
+		if (DemandAuditStatus.AUDITED.getCode().equals(auditStatus)){
+			Calendar now = Calendar.getInstance();
+			now.set(Calendar.MILLISECOND, 0);
+			d.setReleaseDate(now.getTime());
+		} else {
+			d.setReleaseStatus(DemandReleaseStatus.UNRELEASE.getCode());
+		}
+		return demandMapper.updateByPrimaryKeySelective(d);
+	}
 }