Antiloveg 8 years ago
parent
commit
11dd3925e7

+ 20 - 0
src/main/java/com/goafanti/admin/controller/AdminDemandApiController.java

@@ -4,6 +4,7 @@ import java.util.Arrays;
 
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
 import javax.validation.Valid;
 
 import org.springframework.beans.BeanUtils;
@@ -33,6 +34,25 @@ public class AdminDemandApiController extends CertifyApiController {
 	private DemandService	demandService;
 	@Resource
 	private UserService		userService;
+	
+	@RequestMapping(value = "/download", method = RequestMethod.GET)
+	public Result download(HttpServletResponse response, String id) {
+		Result res = new Result();
+
+		if (StringUtils.isEmpty(id)) {
+			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "需求ID"));
+			return res;
+		}
+
+		Demand d = demandService.selectByPrimaryKey(id);
+		if (null == d) {
+			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "需求ID"));
+			return res;
+		}
+
+		//downloadFile(response, t.getApprovalDownloadFileName(), t.getApprovalUrl());
+		return res;
+	}
 
 	/**
 	 * 需求管理--获取组织用户下拉

+ 1 - 0
src/main/java/com/goafanti/admin/controller/AdminPreviewApiController.java

@@ -530,5 +530,6 @@ public class AdminPreviewApiController extends CertifyApiController {
 		}
 		return res;
 	}
+	
 
 }

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

@@ -29,4 +29,6 @@ public interface DemandService {
 
 	DemandManageDetailBo selectOrgDemandDetail(String id);
 
+	Demand selectByPrimaryKey(String id);
+
 }

+ 5 - 1
src/main/java/com/goafanti/demand/service/impl/DemandServiceImpl.java

@@ -274,7 +274,6 @@ public class DemandServiceImpl extends BaseMybatisDao<DemandMapper> implements D
 		d.setValidityPeriod(validityPeriod);
 		d.setId(UUID.randomUUID().toString());
 
-		d.setDataCategory(DemandDataCategory.USERDEMAND.getCode());
 		d.setDeletedSign(DeleteStatus.UNDELETE.getCode());
 
 		Calendar now = Calendar.getInstance();
@@ -369,4 +368,9 @@ public class DemandServiceImpl extends BaseMybatisDao<DemandMapper> implements D
 	public DemandManageDetailBo selectOrgDemandDetail(String id) {
 		return demandMapper.selectOrgDemandDetail(id);
 	}
+
+	@Override
+	public Demand selectByPrimaryKey(String id) {
+		return demandMapper.selectByPrimaryKey(id);
+	}
 }