Przeglądaj źródła

Merge branch 'master' of
ssh://git.jishutao.com:55555/jishutao/jitao-server

# Conflicts:
# src/main/java/com/goafanti/common/mapper/DemandMapper.xml
# src/main/java/com/goafanti/demand/service/impl/DemandServiceImpl.java

liliang4869 7 lat temu
rodzic
commit
d205baaa15

Plik diff jest za duży
+ 877 - 880
src/main/java/com/goafanti/achievement/service/impl/AchievementServiceImpl.java


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

@@ -1,194 +1,194 @@
-package com.goafanti.admin.controller;
-
-import javax.annotation.Resource;
-
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RestController;
-
-import com.goafanti.achievement.service.AchievementService;
-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.AchievementAuditStatus;
-import com.goafanti.common.enums.DemandAuditStatus;
-import com.goafanti.common.model.Achievement;
-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;
-	@Resource
-	private DemandService		demandService;
-	@Resource
-	private AchievementService	achievementService;
-	
-	/**
-	 * 科技成果技术经纪人流转
-	 */
-	@RequestMapping(value = "/modifyAchievementTechBroker", method = RequestMethod.POST)
-	public Result modifyAchievementTechBroker(String id, String techBrokerId){
-		Result res =new Result();
-		if (StringUtils.isBlank(id)){
-			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "科技成果ID"));
-			return res;
-		}
-		
-		if(StringUtils.isBlank(techBrokerId)){
-			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "技术经纪人ID"));
-			return res;
-		}
-		
-		Achievement a = achievementService.selectByPrimaryKey(id);
-		if (null == a){
-			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "科技成果ID"));
-			return res;
-		}
-		
-		if (!AchievementAuditStatus.AUDITED.getCode().equals(a.getAuditStatus())){
-			res.getError().add(buildError("", "当前状态无法更改技术经纪人!"));
-			return res;
-		}
-		
-		
-		a.setTechBrokerId(techBrokerId);
-		res.setData(achievementService.updateByPrimaryKeySelective(a));
-		return res;
-	}
-	
-	/**
-	 * 科技需求技术经纪人流转
-	 */
-	@RequestMapping(value = "/modifyDemandTechBroker", method = RequestMethod.POST)
-	public Result modifyDemandTechBroker(String id, String techBrokerId){
-		Result res =new Result();
-		if (StringUtils.isBlank(id)){
-			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "科技需求ID"));
-			return res;
-		}
-		
-		if(StringUtils.isBlank(techBrokerId)){
-			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "技术经纪人ID"));
-			return res;
-		}
-		
-		Demand d = demandService.selectByPrimaryKey(id);
-		if (null == d){
-			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "科技需求ID"));
-			return res;
-		}
-		
-		if (!DemandAuditStatus.AUDITED.getCode().equals(d.getAuditStatus())){
-			res.getError().add(buildError("", "当前状态无法更改技术经纪人!"));
-			return res;
-		}
-		d.setTechBrokerId(techBrokerId);
-		res.setData(demandService.updateByPrimaryKeySelective(d));
-		return res;
-	}
-
-	/**
-	 * 获取技术经纪人下拉
-	 */
-	@RequestMapping(value = "/techBroders", method = RequestMethod.GET)
-	public Result getTechBroders() {
-		Result res = new Result();
-		res.setData(adminService.selectTechBroder());
-		return res;
-	}
-
-	/**
-	 * 审核科技需求
-	 */
-	@RequestMapping(value = "/demand", method = RequestMethod.POST)
-	public Result demand(String id, String techBroderId, Integer auditStatus) {
-		Result res = new Result();
-		res = disposeDmandAchievement(res, "demand", id, techBroderId, auditStatus);
-		if (!res.getError().isEmpty()) {
-			return res;
-		}
-		Demand d = demandService.selectByPrimaryKey(id);
-		if (null == d) {
-			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "需求ID"));
-			return res;
-		}
-
-		if (!DemandAuditStatus.INAUDIT.getCode().equals(d.getAuditStatus())) {
-			res.getError().add(buildError("", "当前需求状态无法审核!"));
-			return res;
-		}
-
-		res.setData(demandService.updateAuditDemand(d, techBroderId, auditStatus));
-		return res;
-	}
-
-	/**
-	 * 审核科技成果
-	 */
-	@RequestMapping(value = "/achievement", method = RequestMethod.POST)
-	public Result achievement(String id, String techBroderId, Integer auditStatus) {
-		Result res = new Result();
-		res = disposeDmandAchievement(res, "achievement", id, techBroderId, auditStatus);
-		if (!res.getError().isEmpty()) {
-			return res;
-		}
-		Achievement a = achievementService.selectByPrimaryKey(id);
-		if (null == a) {
-			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "成果ID"));
-			return res;
-		}
-
-		if (!AchievementAuditStatus.INAUDIT.getCode().equals(a.getAuditStatus())) {
-			res.getError().add(buildError("", "当前成果状态无法审核!"));
-			return res;
-		}
-
-		res.setData(achievementService.updateAuditAchievement(a, techBroderId, auditStatus));
-		return res;
-	}
-
-	private Result disposeDmandAchievement(Result res, String sign, String id, String techBroderId,
-			Integer auditStatus) {
-		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 (sign.equals("demand")) {
-			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;
-				}
-			}
-		} else {
-			if (!AchievementAuditStatus.AUDITED.getCode().equals(auditStatus)
-					&& !AchievementAuditStatus.UNAUDITED.getCode().equals(auditStatus)) {
-				res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "审核状态"));
-				return res;
-			}
-			if (AchievementAuditStatus.AUDITED.getCode().equals(auditStatus)) {
-				if (StringUtils.isBlank(techBroderId)) {
-					res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到技术经纪人", "技术经纪人"));
-					return res;
-				}
-			}
-		}
-		return res;
-	}
-}
+package com.goafanti.admin.controller;
+
+import javax.annotation.Resource;
+
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+import com.goafanti.achievement.service.AchievementService;
+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.AchievementAuditStatus;
+import com.goafanti.common.enums.DemandAuditStatus;
+import com.goafanti.common.model.Achievement;
+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;
+	@Resource
+	private DemandService		demandService;
+	@Resource
+	private AchievementService	achievementService;
+	
+	/**
+	 * 科技成果技术经纪人流转
+	 */
+	@RequestMapping(value = "/modifyAchievementTechBroker", method = RequestMethod.POST)
+	public Result modifyAchievementTechBroker(String id, String techBrokerId){
+		Result res =new Result();
+		if (StringUtils.isBlank(id)){
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "科技成果ID"));
+			return res;
+		}
+		
+		if(StringUtils.isBlank(techBrokerId)){
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "技术经纪人ID"));
+			return res;
+		}
+		
+		Achievement a = achievementService.selectByPrimaryKey(id);
+		if (null == a){
+			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "科技成果ID"));
+			return res;
+		}
+		
+		if (!AchievementAuditStatus.AUDITED.getCode().equals(a.getAuditStatus())){
+			res.getError().add(buildError("", "当前状态无法更改技术经纪人!"));
+			return res;
+		}
+		
+		
+		a.setTechBrokerId(techBrokerId);
+		res.setData(achievementService.updateByPrimaryKeySelective(a));
+		return res;
+	}
+	
+	/**
+	 * 科技需求技术经纪人流转
+	 */
+	@RequestMapping(value = "/modifyDemandTechBroker", method = RequestMethod.POST)
+	public Result modifyDemandTechBroker(String id, String techBrokerId){
+		Result res =new Result();
+		if (StringUtils.isBlank(id)){
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "科技需求ID"));
+			return res;
+		}
+		
+		if(StringUtils.isBlank(techBrokerId)){
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "技术经纪人ID"));
+			return res;
+		}
+		
+		Demand d = demandService.selectByPrimaryKey(id);
+		if (null == d){
+			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "科技需求ID"));
+			return res;
+		}
+		
+		if (!DemandAuditStatus.AUDITED.getCode().equals(d.getAuditStatus())){
+			res.getError().add(buildError("", "当前状态无法更改技术经纪人!"));
+			return res;
+		}
+		d.setTechBrokerId(techBrokerId);
+		res.setData(demandService.updateByPrimaryKeySelective(d));
+		return res;
+	}
+
+	/**
+	 * 获取技术经纪人下拉
+	 */
+	@RequestMapping(value = "/techBroders", method = RequestMethod.GET)
+	public Result getTechBroders() {
+		Result res = new Result();
+		res.setData(adminService.selectTechBroder());
+		return res;
+	}
+
+	/**
+	 * 审核科技需求
+	 */
+	@RequestMapping(value = "/demand", method = RequestMethod.POST)
+	public Result demand(String id, String techBroderId, Integer auditStatus) {
+		Result res = new Result();
+		res = disposeDmandAchievement(res, "demand", id, techBroderId, auditStatus);
+		if (!res.getError().isEmpty()) {
+			return res;
+		}
+		Demand d = demandService.selectByPrimaryKey(id);
+		if (null == d) {
+			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "需求ID"));
+			return res;
+		}
+
+		/*if (!DemandAuditStatus.INAUDIT.getCode().equals(d.getAuditStatus())) {
+			res.getError().add(buildError("", "当前需求状态无法审核!"));
+			return res;
+		}
+*/
+		res.setData(demandService.updateAuditDemand(d, techBroderId, auditStatus));
+		return res;
+	}
+
+	/**
+	 * 审核科技成果
+	 */
+	@RequestMapping(value = "/achievement", method = RequestMethod.POST)
+	public Result achievement(String id, String techBroderId, Integer auditStatus) {
+		Result res = new Result();
+		res = disposeDmandAchievement(res, "achievement", id, techBroderId, auditStatus);
+		if (!res.getError().isEmpty()) {
+			return res;
+		}
+		Achievement a = achievementService.selectByPrimaryKey(id);
+		if (null == a) {
+			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "成果ID"));
+			return res;
+		}
+
+		if (!AchievementAuditStatus.INAUDIT.getCode().equals(a.getAuditStatus())) {
+			res.getError().add(buildError("", "当前成果状态无法审核!"));
+			return res;
+		}
+
+		res.setData(achievementService.updateAuditAchievement(a, techBroderId, auditStatus));
+		return res;
+	}
+
+	private Result disposeDmandAchievement(Result res, String sign, String id, String techBroderId,
+			Integer auditStatus) {
+		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 (sign.equals("demand")) {
+			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;
+				}
+			}
+		} else {
+			if (!AchievementAuditStatus.AUDITED.getCode().equals(auditStatus)
+					&& !AchievementAuditStatus.UNAUDITED.getCode().equals(auditStatus)) {
+				res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "审核状态"));
+				return res;
+			}
+			if (AchievementAuditStatus.AUDITED.getCode().equals(auditStatus)) {
+				if (StringUtils.isBlank(techBroderId)) {
+					res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到技术经纪人", "技术经纪人"));
+					return res;
+				}
+			}
+		}
+		return res;
+	}
+}

Plik diff jest za duży
+ 535 - 535
src/main/java/com/goafanti/app/controller/AppUserController.java


+ 85 - 85
src/main/java/com/goafanti/app/controller/OpenAppUserController.java

@@ -1,85 +1,85 @@
-package com.goafanti.app.controller;
-
-import javax.annotation.Resource;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RestController;
-
-import com.goafanti.achievement.service.AchievementInterestService;
-import com.goafanti.achievement.service.AchievementService;
-import com.goafanti.banners.service.BannersService;
-import com.goafanti.common.bo.Result;
-import com.goafanti.common.constant.ErrorConstants;
-import com.goafanti.common.controller.BaseApiController;
-import com.goafanti.demand.service.DemandService;
-import com.goafanti.easemob.EasemobUtils;
-import com.goafanti.message.service.MessageService;
-import com.goafanti.news.service.NewsService;
-import com.goafanti.user.service.UserCareerService;
-import com.goafanti.user.service.UserIdentityService;
-import com.goafanti.user.service.UserInterestService;
-import com.goafanti.user.service.UserService;
-
-@RestController
-@RequestMapping(path = "/open/app/user", method = RequestMethod.GET)
-public class OpenAppUserController extends BaseApiController {
-	@Resource
-	private UserService userServiceImpl;
-	@Resource
-	private MessageService messageService;
-	@Resource
-	private EasemobUtils   easemobUtils;
-	@Resource
-	private BannersService		bannersService;
-	@Resource
-	private NewsService			newsService;
-	@Resource
-	private AchievementService	achievementService;
-	@Resource
-	private DemandService		demandService;
-	@Resource
-	private UserCareerService	userCareerService;
-	@Resource
-	private UserInterestService userInterestService; 
-	@Resource
-	private UserIdentityService	userIdentityService;
-	@Resource
-	AchievementInterestService achievementInterestService;
-	
-	/**
-	 * 成果详情
-	 * @param id
-	 * @return
-	 */
-	@RequestMapping(value = "/achievementDetail", method = RequestMethod.GET)
-	private Result userDetail(String id ) {
-		Result res = new Result();
-		if (StringUtils.isBlank(id)) {
-			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"成果必须指定","成果"));
-			return res;
-		}
-		res.setData(achievementService.selectAppUserOwnerDetail(id));
-		return res;
-	}
-	/**
-	 * 需求详情
-	 */
-	@RequestMapping(value = "/demandDetail", method = RequestMethod.GET)
-	public Result DemandDetail(String id ) {
-		Result res = new Result();
-		if (StringUtils.isBlank(id)) {
-			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"需求必须指定","需求"));
-			return res;
-		}
-		res.setData(demandService.selectDemandDetail( id));
-		return res;
-	}
-	
-	@RequestMapping(value = "/index", method = RequestMethod.GET)
-	public Result index(){
-		Result res = new Result();
-		res.setData(messageService.selectMessageWithGroup());
-		return res;
-	}
-}
+package com.goafanti.app.controller;
+
+import javax.annotation.Resource;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+import com.goafanti.achievement.service.AchievementInterestService;
+import com.goafanti.achievement.service.AchievementService;
+import com.goafanti.banners.service.BannersService;
+import com.goafanti.common.bo.Result;
+import com.goafanti.common.constant.ErrorConstants;
+import com.goafanti.common.controller.BaseApiController;
+import com.goafanti.demand.service.DemandService;
+import com.goafanti.easemob.EasemobUtils;
+import com.goafanti.message.service.MessageService;
+import com.goafanti.news.service.NewsService;
+import com.goafanti.user.service.UserCareerService;
+import com.goafanti.user.service.UserIdentityService;
+import com.goafanti.user.service.UserInterestService;
+import com.goafanti.user.service.UserService;
+
+@RestController
+@RequestMapping(path = "/open/app/user", method = RequestMethod.GET)
+public class OpenAppUserController extends BaseApiController {
+	@Resource
+	private UserService userServiceImpl;
+	@Resource
+	private MessageService messageService;
+	@Resource
+	private EasemobUtils   easemobUtils;
+	@Resource
+	private BannersService		bannersService;
+	@Resource
+	private NewsService			newsService;
+	@Resource
+	private AchievementService	achievementService;
+	@Resource
+	private DemandService		demandService;
+	@Resource
+	private UserCareerService	userCareerService;
+	@Resource
+	private UserInterestService userInterestService; 
+	@Resource
+	private UserIdentityService	userIdentityService;
+	@Resource
+	AchievementInterestService achievementInterestService;
+	
+	/**
+	 * 成果详情
+	 * @param id
+	 * @return
+	 */
+	@RequestMapping(value = "/achievementDetail", method = RequestMethod.GET)
+	private Result userDetail(String id ) {
+		Result res = new Result();
+		if (StringUtils.isBlank(id)) {
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"成果必须指定","成果"));
+			return res;
+		}
+		res.setData(achievementService.selectAppUserOwnerDetail(id));
+		return res;
+	}
+	/**
+	 * 需求详情
+	 */
+	@RequestMapping(value = "/demandDetail", method = RequestMethod.GET)
+	public Result DemandDetail(String id ) {
+		Result res = new Result();
+		if (StringUtils.isBlank(id)) {
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"需求必须指定","需求"));
+			return res;
+		}
+		res.setData(demandService.selectAppDemandDetail( id));
+		return res;
+	}
+	
+	@RequestMapping(value = "/index", method = RequestMethod.GET)
+	public Result index(){
+		Result res = new Result();
+		res.setData(messageService.selectMessageWithGroup());
+		return res;
+	}
+}

+ 4 - 7
src/main/java/com/goafanti/common/dao/DemandMapper.java

@@ -1,13 +1,12 @@
 package com.goafanti.common.dao;
 
-import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.ibatis.annotations.Param;
 
 import com.goafanti.common.model.Demand;
+import com.goafanti.demand.bo.DemandDetailBo;
 import com.goafanti.demand.bo.DemandListBo;
-import com.goafanti.demand.bo.DemandManageDetailBo;
 import com.goafanti.demand.bo.DemandRecommended;
 import com.goafanti.portal.bo.DemandPortalDetailBo;
 import com.goafanti.portal.bo.DemandPortalSimilarListBo;
@@ -26,11 +25,11 @@ public interface DemandMapper {
 
 	int updateByPrimaryKey(Demand record);
 
-	DemandManageDetailBo selectUserDemandDetail(String id);
+	DemandDetailBo selectUserDemandDetail(String id);
 
 	int batchDeleteByPrimaryKey(List<String> id);
 
-	DemandManageDetailBo selectOrgDemandDetail(String id);
+	DemandDetailBo selectOrgDemandDetail(String id);
 
 	int updateReleaseDate(String id);
 
@@ -48,12 +47,10 @@ public interface DemandMapper {
 			@Param("id") String id);
 
 	int updateEmployerId(String id);
-	
-	ArrayList<DemandListBo> selectDemandList (Integer boutique);
 
 	int countInterest(String demandId);
 	
-	Demand selectDemandDetail(String id);
+	DemandDetailBo selectDemandDetail(String id);
 
 	DemandListBo selectAppByPrimaryKey(String id);
 

+ 81 - 76
src/main/java/com/goafanti/common/dao/DemandPublishMapper.java

@@ -1,77 +1,82 @@
-package com.goafanti.common.dao;
-
-import com.goafanti.common.model.DemandPublish;
-import com.goafanti.common.model.DemandPublishExample;
-import java.util.List;
-import org.apache.ibatis.annotations.Param;
-
-public interface DemandPublishMapper {
-
-	/**
-	 * This method was generated by MyBatis Generator. This method corresponds to the database table demand_publish
-	 * @mbg.generated  Wed Jan 31 09:34:27 CST 2018
-	 */
-	long countByExample(DemandPublishExample example);
-
-	/**
-	 * This method was generated by MyBatis Generator. This method corresponds to the database table demand_publish
-	 * @mbg.generated  Wed Jan 31 09:34:27 CST 2018
-	 */
-	int deleteByExample(DemandPublishExample example);
-
-	/**
-	 * This method was generated by MyBatis Generator. This method corresponds to the database table demand_publish
-	 * @mbg.generated  Wed Jan 31 09:34:27 CST 2018
-	 */
-	int deleteByPrimaryKey(String id);
-
-	/**
-	 * This method was generated by MyBatis Generator. This method corresponds to the database table demand_publish
-	 * @mbg.generated  Wed Jan 31 09:34:27 CST 2018
-	 */
-	int insert(DemandPublish record);
-
-	/**
-	 * This method was generated by MyBatis Generator. This method corresponds to the database table demand_publish
-	 * @mbg.generated  Wed Jan 31 09:34:27 CST 2018
-	 */
-	int insertSelective(DemandPublish record);
-
-	/**
-	 * This method was generated by MyBatis Generator. This method corresponds to the database table demand_publish
-	 * @mbg.generated  Wed Jan 31 09:34:27 CST 2018
-	 */
-	List<DemandPublish> selectByExample(DemandPublishExample example);
-
-	/**
-	 * This method was generated by MyBatis Generator. This method corresponds to the database table demand_publish
-	 * @mbg.generated  Wed Jan 31 09:34:27 CST 2018
-	 */
-	DemandPublish selectByPrimaryKey(String id);
-
-	/**
-	 * This method was generated by MyBatis Generator. This method corresponds to the database table demand_publish
-	 * @mbg.generated  Wed Jan 31 09:34:27 CST 2018
-	 */
-	int updateByExampleSelective(@Param("record") DemandPublish record, @Param("example") DemandPublishExample example);
-
-	/**
-	 * This method was generated by MyBatis Generator. This method corresponds to the database table demand_publish
-	 * @mbg.generated  Wed Jan 31 09:34:27 CST 2018
-	 */
-	int updateByExample(@Param("record") DemandPublish record, @Param("example") DemandPublishExample example);
-
-	/**
-	 * This method was generated by MyBatis Generator. This method corresponds to the database table demand_publish
-	 * @mbg.generated  Wed Jan 31 09:34:27 CST 2018
-	 */
-	int updateByPrimaryKeySelective(DemandPublish record);
-
-	/**
-	 * This method was generated by MyBatis Generator. This method corresponds to the database table demand_publish
-	 * @mbg.generated  Wed Jan 31 09:34:27 CST 2018
-	 */
-	int updateByPrimaryKey(DemandPublish record);
-	
-	int checkExisting(DemandPublish a);
+package com.goafanti.common.dao;
+
+import com.goafanti.common.model.DemandPublish;
+import com.goafanti.common.model.DemandPublishExample;
+
+import java.util.List;
+import org.apache.ibatis.annotations.Param;
+
+public interface DemandPublishMapper {
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table demand_publish
+	 * @mbg.generated  Wed Jan 31 09:34:27 CST 2018
+	 */
+	long countByExample(DemandPublishExample example);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table demand_publish
+	 * @mbg.generated  Wed Jan 31 09:34:27 CST 2018
+	 */
+	int deleteByExample(DemandPublishExample example);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table demand_publish
+	 * @mbg.generated  Wed Jan 31 09:34:27 CST 2018
+	 */
+	int deleteByPrimaryKey(String id);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table demand_publish
+	 * @mbg.generated  Wed Jan 31 09:34:27 CST 2018
+	 */
+	int insert(DemandPublish record);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table demand_publish
+	 * @mbg.generated  Wed Jan 31 09:34:27 CST 2018
+	 */
+	int insertSelective(DemandPublish record);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table demand_publish
+	 * @mbg.generated  Wed Jan 31 09:34:27 CST 2018
+	 */
+	List<DemandPublish> selectByExample(DemandPublishExample example);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table demand_publish
+	 * @mbg.generated  Wed Jan 31 09:34:27 CST 2018
+	 */
+	DemandPublish selectByPrimaryKey(String id);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table demand_publish
+	 * @mbg.generated  Wed Jan 31 09:34:27 CST 2018
+	 */
+	int updateByExampleSelective(@Param("record") DemandPublish record, @Param("example") DemandPublishExample example);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table demand_publish
+	 * @mbg.generated  Wed Jan 31 09:34:27 CST 2018
+	 */
+	int updateByExample(@Param("record") DemandPublish record, @Param("example") DemandPublishExample example);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table demand_publish
+	 * @mbg.generated  Wed Jan 31 09:34:27 CST 2018
+	 */
+	int updateByPrimaryKeySelective(DemandPublish record);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table demand_publish
+	 * @mbg.generated  Wed Jan 31 09:34:27 CST 2018
+	 */
+	int updateByPrimaryKey(DemandPublish record);
+	
+	int checkExisting(DemandPublish a);
+	
+	List<DemandPublish> selectPublishPages(String demandId);
+
+	int batchDeleteByDemandId(String id);
 }

+ 57 - 57
src/main/java/com/goafanti/common/enums/DemandAuditStatus.java

@@ -1,57 +1,57 @@
-package com.goafanti.common.enums;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.commons.lang3.StringUtils;
-
-public enum DemandAuditStatus {
-	CREATE(0, "草稿"),
-	SUBMIT(1, "提交审核"),
-	INAUDIT(2, "审核中"),
-	AUDITED(3,"审核通过"),
-	UNAUDITED(4,"审核未通过"),
-	OTHER(5, "其他");
-
-	private DemandAuditStatus(Integer code, String desc) {
-		this.code = code;
-		this.desc = desc;
-	}
-
-	private static Map<Integer, DemandAuditStatus> status = new HashMap<Integer, DemandAuditStatus>();
-
-	static {
-		for (DemandAuditStatus value : DemandAuditStatus.values()) {
-			status.put(value.getCode(), value);
-		}
-	}
-
-	public static DemandAuditStatus getStatus(Integer code) {
-		if (containsType(code)) {
-			return status.get(code);
-		}
-		return OTHER;
-	}
-
-	public static DemandAuditStatus getStatus(String code) {
-		if (StringUtils.isNumeric(code)) {
-			return getStatus(Integer.parseInt(code));
-		}
-		return OTHER;
-	}
-
-	public static boolean containsType(Integer code) {
-		return status.containsKey(code);
-	}
-
-	private Integer	code;
-	private String	desc;
-
-	public Integer getCode() {
-		return code;
-	}
-
-	public String getDesc() {
-		return desc;
-	}
-}
+package com.goafanti.common.enums;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.commons.lang3.StringUtils;
+
+public enum DemandAuditStatus {
+	CREATE(0, "草稿"),
+	INAUDIT(1, "提交审核"),
+	AUDITED(2,"审核通过"),
+	UNAUDITED(3,"审核通过"),
+	REVOKE(4,"撤销发布"),
+	OTHER(5, "其他");
+
+	private DemandAuditStatus(Integer code, String desc) {
+		this.code = code;
+		this.desc = desc;
+	}
+
+	private static Map<Integer, DemandAuditStatus> status = new HashMap<Integer, DemandAuditStatus>();
+
+	static {
+		for (DemandAuditStatus value : DemandAuditStatus.values()) {
+			status.put(value.getCode(), value);
+		}
+	}
+
+	public static DemandAuditStatus getStatus(Integer code) {
+		if (containsType(code)) {
+			return status.get(code);
+		}
+		return OTHER;
+	}
+
+	public static DemandAuditStatus getStatus(String code) {
+		if (StringUtils.isNumeric(code)) {
+			return getStatus(Integer.parseInt(code));
+		}
+		return OTHER;
+	}
+
+	public static boolean containsType(Integer code) {
+		return status.containsKey(code);
+	}
+
+	private Integer	code;
+	private String	desc;
+
+	public Integer getCode() {
+		return code;
+	}
+
+	public String getDesc() {
+		return desc;
+	}
+}

+ 224 - 102
src/main/java/com/goafanti/common/mapper/DemandMapper.xml

@@ -528,51 +528,111 @@
   
  
   
-  <select id="selectUserDemandDetail" parameterType="java.lang.String" resultType="com.goafanti.demand.bo.DemandManageDetailBo">
+
+  
+  <select id="findAppDemandListByPage" parameterType="String" resultType="com.goafanti.demand.bo.DemandListBo">
   	select 
-  		d.id, d.serial_number as serialNumber, d.data_category as dataCategory,
-  		d.name, d.keyword, d.info_sources as infoSources,
-  		ui.username, d.demand_type as demandType, d.validity_period as validityPeriod,
-  		ui.province, d.status, d.release_status as releaseStatus,
-  		d.release_date as releaseDate, d.principal_id as principalId, d.industry_category_a as industryCategoryA,
-  		d.industry_category_b as industryCategoryB, d.problem_des as problemDes, d.technical_requirements as technicalRequirements,
-  		d.picture_url as pictureUrl, d.text_file_url as textFileUrl, d.video_url as videoUrl,
-  		d.budget_cost as budgetCost, d.fixed_cycle as fixedCycle, d.people_number as peopleNumber,
-  		d.fixed_scheme as fixedScheme, d.cost_escrow as costEscrow, d.employer_id as employerId,
-  		u.email as mailbox,  u.mobile as mobile, d.audit_status as auditStatus,
-  		d.employer_address as employerAddress, d.employer_contacts_mobile as employerContactsMobile,
-  		d.employer_contacts_mailbox as employerContactsMailbox, d.employer_name as employerName,
-  		d.tech_broker_id as techBrokerId,  u.mobile as contactsName,d.urgent_days as urgentDays,d.urgent_money as urgentMoney,
-  		d.boutique,ifnull(mm.effective,0) as hot,mm.cover_img as coverImg,d.remark,d.contacts,d.contact_mobile as contactMobile
-  	from demand d 
-  	left join user_identity ui on ui.uid = d.employer_id
-  	left join user u on u.id = d.employer_id
-  	left join marketing_management mm on d.id = mm.product_id
-  	where d.data_category = 0 and d.id = #{id,jdbcType=VARCHAR}
+	  d.id, d.serial_number as serialNumber, d.data_category as dataCategory, d.boutique,
+	  d.name, d.keyword, d.demand_type as demandType, d.industry_category_a as industryCategoryA, d.industry_category_b as industryCategoryB, d.industry_category_c as industryCategoryC,
+	  d.validity_period as validityPeriod, d.status, d.release_status as releaseStatus, 
+	  d.release_date as releaseDate, d.employer_id as employerId, d.audit_status as auditStatus,t.city as cityname,
+	  d.urgent_money as urgentMoney,d.urgent_days as  urgentDays,d.employer_address as employerAddress,d.problem_des as problemDes,ifnull(t.countInterest,0) as countInterest,g.name as industryCategory1,g2.name as industryCategory2
+	from  demand d 
+	left join  user_identity t on d.employer_id=t.uid
+	left join	field_glossory g on d.industry_category_a=g.id
+	left join	field_glossory g2 on d.industry_category_b=g2.id
+	left join (select count(0)  as countInterest ,demand_id from demand_interest 
+				group by demand_id) t on d.id=t.demand_id
+	where d.deleted_sign = 0 
+	and d.audit_status=3
+	<if test="employerId != null">
+	and d.employer_id = #{employerId, jdbcType=VARCHAR}
+	</if>
+	<if test="serialNumber != null">
+		and  d.serial_number = #{serialNumber,jdbcType=INTEGER}
+	</if>
+	<if test="auditStatus != null">
+		and  d.audit_status = #{auditStatus,jdbcType=INTEGER}
+	</if>
+	<if test="name != null">
+		and  d.name like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
+	</if>
+	<if test="keyword != null">
+		and  d.keyword like "%"#{keyword,jdbcType=VARCHAR}"%"
+	</if>
+	<if test="demandType != null">
+		and  d.demand_type = #{demandType,jdbcType=INTEGER}
+	</if>
+	<if test="industryCategoryA != null">
+		and  d.industry_category_a = #{industryCategoryA,jdbcType=INTEGER}
+	</if>
+	<if test="status != null">
+		and  d.status = #{status,jdbcType=VARCHAR}
+	</if>
+	<if test="releaseStatus != null">
+		and  d.release_status = #{releaseStatus,jdbcType=VARCHAR}
+	</if>
+	<if test="vStart != null">
+	   and d.validity_period <![CDATA[ >= ]]> #{vStart,jdbcType=TIMESTAMP}
+	</if>
+	<if test="vEnd != null">
+	   and d.validity_period <![CDATA[ < ]]> #{vEnd,jdbcType=TIMESTAMP}
+	</if>
+	<if test="rStart != null">
+       and	d.release_date <![CDATA[ >= ]]> #{rStart,jdbcType=TIMESTAMP}
+	</if>
+	<if test="rEnd != null">
+	   and d.release_date <![CDATA[ < ]]> #{rEnd,jdbcType=TIMESTAMP}
+	</if>
+  	order by d.boutique desc
+  	<if test="page_sql!=null">
+		${page_sql}
+	</if>
   </select>
   
-  
-   <select id="selectOrgDemandDetail" parameterType="java.lang.String" resultType="com.goafanti.demand.bo.DemandManageDetailBo">
-	select 
-  		d.id, d.serial_number as serialNumber, d.data_category as dataCategory,
-  		d.name, d.keyword, d.info_sources as infoSources,
-  		oi.unit_name as username, d.demand_type as demandType, d.validity_period as validityPeriod,
-  		oi.licence_province as province, d.status, d.release_status as releaseStatus,
-  		d.release_date as releaseDate, d.principal_id as principalId, d.industry_category_a as industryCategoryA,
-  		d.industry_category_b as industryCategoryB, d.problem_des as problemDes, d.technical_requirements as technicalRequirements,
-  		d.picture_url as pictureUrl, d.text_file_url as textFileUrl, d.video_url as videoUrl,
-  		d.budget_cost as budgetCost, d.fixed_cycle as fixedCycle, d.people_number as peopleNumber,
-  		d.fixed_scheme as fixedScheme, d.cost_escrow as costEscrow, d.employer_id as employerId,
-  		oi.postal_address as address, u.email as mailbox,  d.contacts, d.audit_status as auditStatus,
-  		d.tech_broker_id as techBrokerId,d.remark,d.urgent_days as urgentDays,d.urgent_money as urgentMoney, 
-  		d.employer_address as employerAddress, d.employer_contacts_mobile as employerContactsMobile,
-  		d.employer_contacts_mailbox as employerContactsMailbox, d.employer_name as employerName,
-  		d.boutique,ifnull(mm.effective,0) as hot,mm.cover_img as coverImg,d.contacts,d.contact_mobile as contactMobile
-  	from demand d 
-  	left join organization_identity oi on oi.uid = d.employer_id
-  	left join user u on u.id = d.employer_id
-  	left join marketing_management mm on d.id = mm.product_id
-  	where <!-- d.data_category = 1 and --> d.id = #{id,jdbcType=VARCHAR}
+  <select id="findAppDemandCount" parameterType="String" resultType="java.lang.Integer">
+  		select count(1)
+	from  demand d 
+	where d.deleted_sign = 0 
+	<if test="employerId != null">
+	and d.employer_id = #{employerId, jdbcType=VARCHAR}
+	</if>
+	<if test="serialNumber != null">
+		and  d.serial_number = #{serialNumber,jdbcType=INTEGER}
+	</if>
+	<if test="auditStatus != null">
+		and  d.audit_status = #{auditStatus,jdbcType=INTEGER}
+	</if>
+	<if test="industryCategoryA != null">
+		and  d.industry_category_a = #{industryCategoryA,jdbcType=INTEGER}
+	</if>
+	<if test="name != null">
+		and  d.name like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
+	</if>
+	<if test="keyword != null">
+		and  d.keyword like "%"#{keyword,jdbcType=VARCHAR}"%"
+	</if>
+	<if test="demandType != null">
+		and  d.demand_type = #{demandType,jdbcType=INTEGER}
+	</if>
+	<if test="status != null">
+		and  d.status = #{status,jdbcType=VARCHAR}
+	</if>
+	<if test="releaseStatus != null">
+		and  d.release_status = #{releaseStatus,jdbcType=VARCHAR}
+	</if>
+	<if test="vStart != null">
+	   and d.validity_period <![CDATA[ >= ]]> #{vStart,jdbcType=TIMESTAMP}
+	</if>
+	<if test="vEnd != null">
+	   and d.validity_period <![CDATA[ < ]]> #{vEnd,jdbcType=TIMESTAMP}
+	</if>
+	<if test="rStart != null">
+       and	d.release_date <![CDATA[ >= ]]> #{rStart,jdbcType=TIMESTAMP}
+	</if>
+	<if test="rEnd != null">
+	   and  d.release_date <![CDATA[ < ]]> #{rEnd,jdbcType=TIMESTAMP}
+	</if>
   </select>
   
   <update id="batchDeleteByPrimaryKey" parameterType="java.util.List">
@@ -784,47 +844,76 @@
   </update>
    
   <!-- 查询需求列表 -->
-	<select id="selectDemandList" 
-		resultType="com.goafanti.demand.bo.DemandListBo">
-		SELECT
-		d.id,
-		d.name,
-		d.keyword,
-		d.data_category as dataCategory,
-		d.fixed_budget as fixedbudget,
-		d.demand_type as demandType,
-		d.picture_url as pictureUrl,
-		d.industry_category_a AS industryCategoryA,
-		fg.name AS
-		industryCategoryAS,
-		fgg.name AS industryCategorBS,
-		d.budget_cost AS
-		budgetCost,
-		d.problem_des AS problemDes,
-		dg.name AS
-		province,
-		dgg.name AS
-		city,
-		d.employer_name as
-		employerName,
-		u.lvl as
-		level
-		FROM
-		demand d
-		LEFT JOIN `user` u on u.id = d.employer_id
-		LEFT JOIN
-		user_identity ui on ui.uid = d.employer_id
-		LEFT JOIN district_glossory
-		dg ON dg.id = ui.province
-		LEFT JOIN district_glossory dgg ON dgg.id =
-		ui.city
-		LEFT JOIN field_glossory fg on fg.id = d.industry_category_a
-		LEFT JOIN field_glossory fgg on fgg.id = d.industry_category_b
-		WHERE
-		<if test="_parameter!= null">
-			d.boutique = #{_parameter,jdbcType=INTEGER}
+	<select id="selectDemandListByPage" resultType="com.goafanti.demand.bo.DemandListBo">
+		select
+			a.id,
+			a.serial_number as serialNumber,
+			a.name,
+			a.demand_type as demandType,
+			a.audit_status as auditStatus,
+			a.create_time as createTime,
+			a.budget_cost as budgetCost,
+			b.identify_name as employerName
+		from demand a left join user b on a.employer_id = b.id 
+		where a.deleted_sign = 0
+		<if test="employerId != null">
+			a.employer_id = #{employerId,jdbcType=VARCHAR}
+		</if>
+		<if test="startDate != null">
+			and a.create_time <![CDATA[ >= ]]> #{startDate,jdbcType=TIMESTAMP}
+		</if>
+		<if test="endDate != null">
+			and a.create_time <![CDATA[ <= ]]> #{endDate,jdbcType=TIMESTAMP}
+		</if>
+		<if test="name != null">
+			and a.name like concat('%',#{name,jdbcType=VARCHAR},'%')
+		</if>
+		<if test="demandType != null">
+			and a.demand_type = #{demandType,jdbcType=INTEGER}
+		</if>
+		<if test="auditStatus != null">
+			and a.audit_status = #{auditStatus,jdbcType=INTEGER}
+		</if>
+		<if test="status != null">
+			and a.status = #{status,jdbcType=INTEGER}
+		</if>
+		<if test="identifyName != null">
+			b.identify_name like concat('%',#{identifyName,jdbcType=VARCHAR},'%')
+		</if>
+		<if test="page_sql!=null">
+			${page_sql}
+		</if>
+	</select>
+	<select id="selectDemandListCount" resultType="java.lang.Integer">
+		select
+			count(0)
+		from
+			demand
+		where a.deleted_sign = 0
+		<if test="employerId != null">
+			a.employer_id = #{employerId,jdbcType=VARCHAR}
+		</if>
+		<if test="startDate != null">
+			and a.create_time <![CDATA[ >= ]]> #{startDate,jdbcType=TIMESTAMP}
+		</if>
+		<if test="endDate != null">
+			and a.create_time <![CDATA[ <= ]]> #{endDate,jdbcType=TIMESTAMP}
+		</if>
+		<if test="name != null">
+			and a.name like concat('%',#{name,jdbcType=VARCHAR},'%')
+		</if>
+		<if test="demandType != null">
+			and a.demand_type = #{demandType,jdbcType=INTEGER}
+		</if>
+		<if test="auditStatus != null">
+			and a.audit_status = #{auditStatus,jdbcType=INTEGER}
+		</if>
+		<if test="status != null">
+			and a.status = #{status,jdbcType=INTEGER}
+		</if>
+		<if test="identifyName != null">
+			b.identify_name like concat('%',#{identifyName,jdbcType=VARCHAR},'%')
 		</if>
-		limit 0,30
 	</select>
   
 	<select id="countInterest" resultType="Integer">
@@ -863,22 +952,32 @@
 	</if>
 	
   </select>
-  <select id="selectDemandDetail" resultMap="BaseResultMap" parameterType="java.lang.String" >
-     select 
-    d.id, d.serial_number AS serialNumber, d.data_category AS serialNumber,d.name, d.keyword, d.info_sources AS infoSources, d.industry_category_a AS industryCategoryA, 
-    d.industry_category_b AS industryCategoryB, d.industry_category_c AS industryCategoryC, d.demand_type AS demandType, d.problem_des AS problemDes, d.technical_requirements AS technicalRequirements, 
-    d.picture_url AS pictureUrl, d.text_file_url AS textFileUrl, d.video_url AS videoUrl, d.fixed_budget AS fixedBudget, d.fixed_cycle AS fixedCycle, d.people_number AS peopleNumber, 
-    d.fixed_scheme as fixedScheme, d.cost_escrow AS costEscrow, d.budget_cost AS budgetCost, d.validity_period AS validityPeriod, d.employer_id AS employerId, d.employer_name AS employerName, 
-    d.employer_address as employerAddress, d.employer_contacts as employerContacts, d.employer_contacts_mobile as employerContactsMobile, d.employer_contacts_mailbox as employerContactsMailbox, 
-    d.contacts, d.status,d.release_status as releaseStatus, d.release_date as releaseDate, d.create_time as createTime, d.principal_id as principalId, d.deleted_sign as deletedSign,j.easemob_name as easemobName,
-    d.audit_status as auditStatus, d.tech_broker_id as techBrokerId,d.boutique,d.urgent_money as urgentMoney,d.urgent_days as urgentDays
-    from demand d
-    left join jpush_easemob_account j on d.employer_id=j.uid
-   	where d.id = #{id,jdbcType=VARCHAR}
-  	</select>
-  	
-  	
-	
+  
+  <select id="selectDemandDetail" resultType="com.goafanti.demand.bo.DemandDetailBo" parameterType="java.lang.String" >
+	select
+		id,
+		name,
+		problem_des as problemDes,
+		industry_category_a as industryCategoryA,
+		industry_category_b as industryCategoryB,
+		industry_category_c as industryCategoryC,
+		demand_type as demandType,
+		research_type as researchType,
+		budget_cost as budgetCost,
+		crowd_cost as crowdCost,
+		is_hot as isHot,
+		is_urgent as isUrgent,
+		urgent_money as urgentMoney,
+		urgent_days as urgentDays,
+		status,
+		picture_url as pictureUrl,
+		audit_status as auditStatus,
+		audit_info as auditInfo
+	from
+		demand
+	where id = #{id,jdbcType=VARCHAR}
+  </select>
+ 
 	<select id="findAppNewsInterestByPage" parameterType="String" resultType="com.goafanti.demand.bo.ObjectInterestListBo">
   	select	n.id,n.title as name,n.create_time as createTime
 	from news_interest ni
@@ -1057,7 +1156,7 @@ left join demand_publish dp on dp.demand_id=d.id and dp.publish_platform=branchI
   order by  release_date  desc limit #{0}
   </select>
   
-     <select id="getProLearnStudyDemand" resultType="com.goafanti.demand.bo.DemandListBo">
+   <select id="getProLearnStudyDemand" resultType="com.goafanti.demand.bo.DemandListBo">
     select d.name as name,picture_url as pictureUrl ,problem_des as problemDes,employer_name as employerName,d.id,fg.name as industryCategory1,fgg.name as industryCategory2 from demand d  
     left join aft.field_glossory  fg  on fg.id=d.industry_category_a
     left join aft.field_glossory fgg  on fgg.id=d.industry_category_b
@@ -1083,7 +1182,7 @@ left join demand_publish dp on dp.demand_id=d.id and dp.publish_platform=branchI
   order by  release_date  desc limit #{0}
   </select>
   
-  <select id="getDemandDetail" resultType="com.goafanti.demand.bo.DemandListBo">
+ <select id="getDemandDetail" resultType="com.goafanti.demand.bo.DemandListBo">
   select d.name,d.budget_cost as budgetCost,d.validity_period as validityPeriod,d.picture_url as pictureUrl,problem_des as problemDes,
   fg.name as industryCategory1,fgg.name as industryCategory2
    from demand d
@@ -1098,5 +1197,28 @@ left join demand_publish dp on dp.demand_id=d.id and dp.publish_platform=branchI
 left join demand_publish dp on dp.demand_id=d.id and dp.publish_platform=branchInfo.id 
 where d.boutique=1 and  dp.demand_id=d.id and dp.publish_platform=branchInfo.id 
 order by release_date desc limit #{0}
-  </select>
-</mapper>
+  </select>  <select id="listMyDemand" resultType="com.goafanti.portal.bo.DemandSearchListBo">
+	select
+		id,
+		serial_number as serialNumber,
+		name,
+		demand_type as demandType,
+		audit_status as auditStatus,
+		create_time as createTime
+	from
+		demand
+	where
+		employer_id = #{uid,jdbcType=VARCHAR}
+	<if test="status != null">
+		and status = #{status,jdbcType=INTEGER}
+	</if>
+	<if test="name != null">
+		and name = #{name,jdbcType=VARCHAR}
+	</if>
+	<if test="startDate != null">
+		and create_time <![CDATA[ > ]]>  #{startDate,jdbcType=VARCHAR}
+	</if>
+	<if test="endDate != null">
+		and create_time <![CDATA[ < ]]>  #{endDate,jdbcType=VARCHAR}
+	</if>
+  </select></mapper>

+ 447 - 439
src/main/java/com/goafanti/common/mapper/DemandPublishMapper.xml

@@ -1,440 +1,448 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.goafanti.common.dao.DemandPublishMapper">
-  <resultMap id="BaseResultMap" type="com.goafanti.common.model.DemandPublish">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Wed Jan 31 09:34:27 CST 2018.
-    -->
-    <id column="id" jdbcType="VARCHAR" property="id" />
-    <result column="demand_id" jdbcType="VARCHAR" property="demandId" />
-    <result column="publish_platform" jdbcType="VARCHAR" property="publishPlatform" />
-    <result column="publish_client" jdbcType="INTEGER" property="publishClient" />
-    <result column="publish_page" jdbcType="VARCHAR" property="publishPage" />
-    <result column="if_top" jdbcType="INTEGER" property="ifTop" />
-    <result column="top_number" jdbcType="INTEGER" property="topNumber" />
-    <result column="show_number" jdbcType="INTEGER" property="showNumber" />
-    <result column="publisher" jdbcType="VARCHAR" property="publisher" />
-    <result column="publish_time" jdbcType="TIMESTAMP" property="publishTime" />
-  </resultMap>
-  <sql id="Example_Where_Clause">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Wed Jan 31 09:34:27 CST 2018.
-    -->
-    <where>
-      <foreach collection="oredCriteria" item="criteria" separator="or">
-        <if test="criteria.valid">
-          <trim prefix="(" prefixOverrides="and" suffix=")">
-            <foreach collection="criteria.criteria" item="criterion">
-              <choose>
-                <when test="criterion.noValue">
-                  and ${criterion.condition}
-                </when>
-                <when test="criterion.singleValue">
-                  and ${criterion.condition} #{criterion.value}
-                </when>
-                <when test="criterion.betweenValue">
-                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
-                </when>
-                <when test="criterion.listValue">
-                  and ${criterion.condition}
-                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
-                    #{listItem}
-                  </foreach>
-                </when>
-              </choose>
-            </foreach>
-          </trim>
-        </if>
-      </foreach>
-    </where>
-  </sql>
-  <sql id="Update_By_Example_Where_Clause">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Wed Jan 31 09:34:27 CST 2018.
-    -->
-    <where>
-      <foreach collection="example.oredCriteria" item="criteria" separator="or">
-        <if test="criteria.valid">
-          <trim prefix="(" prefixOverrides="and" suffix=")">
-            <foreach collection="criteria.criteria" item="criterion">
-              <choose>
-                <when test="criterion.noValue">
-                  and ${criterion.condition}
-                </when>
-                <when test="criterion.singleValue">
-                  and ${criterion.condition} #{criterion.value}
-                </when>
-                <when test="criterion.betweenValue">
-                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
-                </when>
-                <when test="criterion.listValue">
-                  and ${criterion.condition}
-                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
-                    #{listItem}
-                  </foreach>
-                </when>
-              </choose>
-            </foreach>
-          </trim>
-        </if>
-      </foreach>
-    </where>
-  </sql>
-  <sql id="Base_Column_List">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Wed Jan 31 09:34:27 CST 2018.
-    -->
-    id, demand_id, publish_platform, publish_client, publish_page, if_top, top_number, 
-    show_number, publisher, publish_time
-  </sql>
-  <select id="selectByExample" parameterType="com.goafanti.common.model.DemandPublishExample" resultMap="BaseResultMap">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Wed Jan 31 09:34:27 CST 2018.
-    -->
-    select
-    <if test="distinct">
-      distinct
-    </if>
-    <include refid="Base_Column_List" />
-    from demand_publish
-    <if test="_parameter != null">
-      <include refid="Example_Where_Clause" />
-    </if>
-    <if test="orderByClause != null">
-      order by ${orderByClause}
-    </if>
-  </select>
-  <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Wed Jan 31 09:34:27 CST 2018.
-    -->
-    select 
-    <include refid="Base_Column_List" />
-    from demand_publish
-    where id = #{id,jdbcType=VARCHAR}
-  </select>
-  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Wed Jan 31 09:34:27 CST 2018.
-    -->
-    delete from demand_publish
-    where id = #{id,jdbcType=VARCHAR}
-  </delete>
-  <delete id="deleteByExample" parameterType="com.goafanti.common.model.DemandPublishExample">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Wed Jan 31 09:34:27 CST 2018.
-    -->
-    delete from demand_publish
-    <if test="_parameter != null">
-      <include refid="Example_Where_Clause" />
-    </if>
-  </delete>
-  <insert id="insert" parameterType="com.goafanti.common.model.DemandPublish">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Wed Jan 31 09:34:27 CST 2018.
-    -->
-    insert into demand_publish (id, demand_id, publish_platform, 
-      publish_client, publish_page, if_top, 
-      top_number, show_number, publisher, 
-      publish_time)
-    values (#{id,jdbcType=VARCHAR}, #{demandId,jdbcType=VARCHAR}, #{publishPlatform,jdbcType=VARCHAR}, 
-      #{publishClient,jdbcType=INTEGER}, #{publishPage,jdbcType=VARCHAR}, #{ifTop,jdbcType=INTEGER}, 
-      #{topNumber,jdbcType=INTEGER}, #{showNumber,jdbcType=INTEGER}, #{publisher,jdbcType=VARCHAR}, 
-      #{publishTime,jdbcType=TIMESTAMP})
-  </insert>
-  <insert id="insertSelective" parameterType="com.goafanti.common.model.DemandPublish">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Wed Jan 31 09:34:27 CST 2018.
-    -->
-    insert into demand_publish
-    <trim prefix="(" suffix=")" suffixOverrides=",">
-      <if test="id != null">
-        id,
-      </if>
-      <if test="demandId != null">
-        demand_id,
-      </if>
-      <if test="publishPlatform != null">
-        publish_platform,
-      </if>
-      <if test="publishClient != null">
-        publish_client,
-      </if>
-      <if test="publishPage != null">
-        publish_page,
-      </if>
-      <if test="ifTop != null">
-        if_top,
-      </if>
-      <if test="topNumber != null">
-        top_number,
-      </if>
-      <if test="showNumber != null">
-        show_number,
-      </if>
-      <if test="publisher != null">
-        publisher,
-      </if>
-      <if test="publishTime != null">
-        publish_time,
-      </if>
-    </trim>
-    <trim prefix="values (" suffix=")" suffixOverrides=",">
-      <if test="id != null">
-        #{id,jdbcType=VARCHAR},
-      </if>
-      <if test="demandId != null">
-        #{demandId,jdbcType=VARCHAR},
-      </if>
-      <if test="publishPlatform != null">
-        #{publishPlatform,jdbcType=VARCHAR},
-      </if>
-      <if test="publishClient != null">
-        #{publishClient,jdbcType=INTEGER},
-      </if>
-      <if test="publishPage != null">
-        #{publishPage,jdbcType=VARCHAR},
-      </if>
-      <if test="ifTop != null">
-        #{ifTop,jdbcType=INTEGER},
-      </if>
-      <if test="topNumber != null">
-        #{topNumber,jdbcType=INTEGER},
-      </if>
-      <if test="showNumber != null">
-        #{showNumber,jdbcType=INTEGER},
-      </if>
-      <if test="publisher != null">
-        #{publisher,jdbcType=VARCHAR},
-      </if>
-      <if test="publishTime != null">
-        #{publishTime,jdbcType=TIMESTAMP},
-      </if>
-    </trim>
-  </insert>
-  <select id="countByExample" parameterType="com.goafanti.common.model.DemandPublishExample" resultType="java.lang.Long">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Wed Jan 31 09:34:27 CST 2018.
-    -->
-    select count(*) from demand_publish
-    <if test="_parameter != null">
-      <include refid="Example_Where_Clause" />
-    </if>
-  </select>
-  <update id="updateByExampleSelective" parameterType="map">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Wed Jan 31 09:34:27 CST 2018.
-    -->
-    update demand_publish
-    <set>
-      <if test="record.id != null">
-        id = #{record.id,jdbcType=VARCHAR},
-      </if>
-      <if test="record.demandId != null">
-        demand_id = #{record.demandId,jdbcType=VARCHAR},
-      </if>
-      <if test="record.publishPlatform != null">
-        publish_platform = #{record.publishPlatform,jdbcType=VARCHAR},
-      </if>
-      <if test="record.publishClient != null">
-        publish_client = #{record.publishClient,jdbcType=INTEGER},
-      </if>
-      <if test="record.publishPage != null">
-        publish_page = #{record.publishPage,jdbcType=VARCHAR},
-      </if>
-      <if test="record.ifTop != null">
-        if_top = #{record.ifTop,jdbcType=INTEGER},
-      </if>
-      <if test="record.topNumber != null">
-        top_number = #{record.topNumber,jdbcType=INTEGER},
-      </if>
-      <if test="record.showNumber != null">
-        show_number = #{record.showNumber,jdbcType=INTEGER},
-      </if>
-      <if test="record.publisher != null">
-        publisher = #{record.publisher,jdbcType=VARCHAR},
-      </if>
-      <if test="record.publishTime != null">
-        publish_time = #{record.publishTime,jdbcType=TIMESTAMP},
-      </if>
-    </set>
-    <if test="_parameter != null">
-      <include refid="Update_By_Example_Where_Clause" />
-    </if>
-  </update>
-  <update id="updateByExample" parameterType="map">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Wed Jan 31 09:34:27 CST 2018.
-    -->
-    update demand_publish
-    set id = #{record.id,jdbcType=VARCHAR},
-      demand_id = #{record.demandId,jdbcType=VARCHAR},
-      publish_platform = #{record.publishPlatform,jdbcType=VARCHAR},
-      publish_client = #{record.publishClient,jdbcType=INTEGER},
-      publish_page = #{record.publishPage,jdbcType=VARCHAR},
-      if_top = #{record.ifTop,jdbcType=INTEGER},
-      top_number = #{record.topNumber,jdbcType=INTEGER},
-      show_number = #{record.showNumber,jdbcType=INTEGER},
-      publisher = #{record.publisher,jdbcType=VARCHAR},
-      publish_time = #{record.publishTime,jdbcType=TIMESTAMP}
-    <if test="_parameter != null">
-      <include refid="Update_By_Example_Where_Clause" />
-    </if>
-  </update>
-  <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.DemandPublish">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Wed Jan 31 09:34:27 CST 2018.
-    -->
-    update demand_publish
-    <set>
-      <if test="demandId != null">
-        demand_id = #{demandId,jdbcType=VARCHAR},
-      </if>
-      <if test="publishPlatform != null">
-        publish_platform = #{publishPlatform,jdbcType=VARCHAR},
-      </if>
-      <if test="publishClient != null">
-        publish_client = #{publishClient,jdbcType=INTEGER},
-      </if>
-      <if test="publishPage != null">
-        publish_page = #{publishPage,jdbcType=VARCHAR},
-      </if>
-      <if test="ifTop != null">
-        if_top = #{ifTop,jdbcType=INTEGER},
-      </if>
-      <if test="topNumber != null">
-        top_number = #{topNumber,jdbcType=INTEGER},
-      </if>
-      <if test="showNumber != null">
-        show_number = #{showNumber,jdbcType=INTEGER},
-      </if>
-      <if test="publisher != null">
-        publisher = #{publisher,jdbcType=VARCHAR},
-      </if>
-      <if test="publishTime != null">
-        publish_time = #{publishTime,jdbcType=TIMESTAMP},
-      </if>
-    </set>
-    where id = #{id,jdbcType=VARCHAR}
-  </update>
-  <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.DemandPublish">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Wed Jan 31 09:34:27 CST 2018.
-    -->
-    update demand_publish
-    set demand_id = #{demandId,jdbcType=VARCHAR},
-      publish_platform = #{publishPlatform,jdbcType=VARCHAR},
-      publish_client = #{publishClient,jdbcType=INTEGER},
-      publish_page = #{publishPage,jdbcType=VARCHAR},
-      if_top = #{ifTop,jdbcType=INTEGER},
-      top_number = #{topNumber,jdbcType=INTEGER},
-      show_number = #{showNumber,jdbcType=INTEGER},
-      publisher = #{publisher,jdbcType=VARCHAR},
-      publish_time = #{publishTime,jdbcType=TIMESTAMP}
-    where id = #{id,jdbcType=VARCHAR}
-  </update>
-  <select id="findDemandPublishByPage" parameterType="String" resultType="com.goafanti.demand.bo.DemandPublishBo">
-select dp.id,dp.demand_id as demandId, d.serial_number as serialNumber,d.name as name ,d.employer_name as userName,dp.publish_platform as publishPlatform,bi.platform_name as platformName,dp.publish_client as  publishClient,
-		dp.publish_page as publishPage,dp.if_top as ifTop,dp.show_number as showNumber,dp.top_number as topNumber,dp.publisher,ad.name as publisherName,dp.publish_time as publishTime
-from demand_publish dp 
-left join demand d on dp.demand_id=d.id
-left join admin ad on dp.publisher=ad.id
-left join branch_information bi on dp.publish_platform=bi.id
-where 1=1
-<if test="name != null">
-  	and d.name like "%"#{name,jdbcType=VARCHAR}"%"
-  	</if>
-  	<if test="userName != null">
-  	and d.owner_name = = #{userName,jdbcType=VARCHAR}
-  	</if>
-  	<if test="publishPlatform != null">
-		and dp.publish_platform = #{publishPlatform,jdbcType=VARCHAR}
-	</if>
-	<if test="publishClient != null">
-		and dp.publish_client = #{publishClient,jdbcType=INTEGER}
-	</if>
-	
-	<if test="publishPage != null">
-		and dp.publish_page =#{publishPage,jdbcType=INTEGER}
-	</if>
-	<if test="ifTop != null">
-		and dp.if_top =#{ifTop,jdbcType=INTEGER}
-
-	</if>
-	<if test="employerName != null">
-		and d.employer_name like #{employerName,jdbcType=INTEGER}'%'
-	</if>
-		order by dp.if_top, dp.top_number,dp.show_number asc
-	<if test="page_sql!=null">
-			${page_sql}
-	</if>
-  </select>
-  
-  <select id="findDemandPublishCount" parameterType="String" resultType="java.lang.Integer">
-  	select count(1)
-from demand_publish dp 
-left join demand d on dp.demand_id=d.id
-left join admin ad on dp.publisher=ad.id
-left join branch_information bi on dp.publish_platform=bi.id
-where 1=1
-<if test="name != null">
-  	and d.name like "%"#{name,jdbcType=VARCHAR}"%"
-  	</if>
-  	<if test="publishPage != null">
-		and dp.publish_page =#{publishPage,jdbcType=INTEGER}
-	</if>
-  	<if test="userName != null">
-  	and d.owner_name = = #{userName,jdbcType=VARCHAR}
-  	</if>
-  	<if test="publishPlatform != null">
-		and dp.publish_platform = #{publishPlatform,jdbcType=VARCHAR}
-	</if>
-	<if test="publishClient != null">
-		and dp.publish_client = #{publishClient,jdbcType=INTEGER}
-	</if>
-	<if test="ifTop != null">
-		and dp.if_top=#{ifTop,jdbcType=INTEGER}
-
-	</if>
-	</select>
-	
-	<select id="checkExisting"  resultType="java.lang.Integer">
-	 	select count(1) 
-	 	from demand_publish
-	 	where 1=1
-	 	and demand_id= #{demandId,jdbcType=VARCHAR}
-	 	and publish_platform= #{publishPlatform,jdbcType=VARCHAR}
-	 	and publish_client= #{publishClient,jdbcType=INTEGER}
-	 	and publish_page= #{publishPage,jdbcType=VARCHAR}
-	 </select>
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.goafanti.common.dao.DemandPublishMapper">
+  <resultMap id="BaseResultMap" type="com.goafanti.common.model.DemandPublish">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Wed Jan 31 09:34:27 CST 2018.
+    -->
+    <id column="id" jdbcType="VARCHAR" property="id" />
+    <result column="demand_id" jdbcType="VARCHAR" property="demandId" />
+    <result column="publish_platform" jdbcType="VARCHAR" property="publishPlatform" />
+    <result column="publish_client" jdbcType="INTEGER" property="publishClient" />
+    <result column="publish_page" jdbcType="VARCHAR" property="publishPage" />
+    <result column="if_top" jdbcType="INTEGER" property="ifTop" />
+    <result column="top_number" jdbcType="INTEGER" property="topNumber" />
+    <result column="show_number" jdbcType="INTEGER" property="showNumber" />
+    <result column="publisher" jdbcType="VARCHAR" property="publisher" />
+    <result column="publish_time" jdbcType="TIMESTAMP" property="publishTime" />
+  </resultMap>
+  <sql id="Example_Where_Clause">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Wed Jan 31 09:34:27 CST 2018.
+    -->
+    <where>
+      <foreach collection="oredCriteria" item="criteria" separator="or">
+        <if test="criteria.valid">
+          <trim prefix="(" prefixOverrides="and" suffix=")">
+            <foreach collection="criteria.criteria" item="criterion">
+              <choose>
+                <when test="criterion.noValue">
+                  and ${criterion.condition}
+                </when>
+                <when test="criterion.singleValue">
+                  and ${criterion.condition} #{criterion.value}
+                </when>
+                <when test="criterion.betweenValue">
+                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
+                </when>
+                <when test="criterion.listValue">
+                  and ${criterion.condition}
+                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
+                    #{listItem}
+                  </foreach>
+                </when>
+              </choose>
+            </foreach>
+          </trim>
+        </if>
+      </foreach>
+    </where>
+  </sql>
+  <sql id="Update_By_Example_Where_Clause">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Wed Jan 31 09:34:27 CST 2018.
+    -->
+    <where>
+      <foreach collection="example.oredCriteria" item="criteria" separator="or">
+        <if test="criteria.valid">
+          <trim prefix="(" prefixOverrides="and" suffix=")">
+            <foreach collection="criteria.criteria" item="criterion">
+              <choose>
+                <when test="criterion.noValue">
+                  and ${criterion.condition}
+                </when>
+                <when test="criterion.singleValue">
+                  and ${criterion.condition} #{criterion.value}
+                </when>
+                <when test="criterion.betweenValue">
+                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
+                </when>
+                <when test="criterion.listValue">
+                  and ${criterion.condition}
+                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
+                    #{listItem}
+                  </foreach>
+                </when>
+              </choose>
+            </foreach>
+          </trim>
+        </if>
+      </foreach>
+    </where>
+  </sql>
+  <sql id="Base_Column_List">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Wed Jan 31 09:34:27 CST 2018.
+    -->
+    id, demand_id, publish_platform, publish_client, publish_page, if_top, top_number, 
+    show_number, publisher, publish_time
+  </sql>
+  <select id="selectByExample" parameterType="com.goafanti.common.model.DemandPublishExample" resultMap="BaseResultMap">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Wed Jan 31 09:34:27 CST 2018.
+    -->
+    select
+    <if test="distinct">
+      distinct
+    </if>
+    <include refid="Base_Column_List" />
+    from demand_publish
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+    <if test="orderByClause != null">
+      order by ${orderByClause}
+    </if>
+  </select>
+  <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Wed Jan 31 09:34:27 CST 2018.
+    -->
+    select 
+    <include refid="Base_Column_List" />
+    from demand_publish
+    where id = #{id,jdbcType=VARCHAR}
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Wed Jan 31 09:34:27 CST 2018.
+    -->
+    delete from demand_publish
+    where id = #{id,jdbcType=VARCHAR}
+  </delete>
+  <delete id="deleteByExample" parameterType="com.goafanti.common.model.DemandPublishExample">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Wed Jan 31 09:34:27 CST 2018.
+    -->
+    delete from demand_publish
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+  </delete>
+  <insert id="insert" parameterType="com.goafanti.common.model.DemandPublish">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Wed Jan 31 09:34:27 CST 2018.
+    -->
+    insert into demand_publish (id, demand_id, publish_platform, 
+      publish_client, publish_page, if_top, 
+      top_number, show_number, publisher, 
+      publish_time)
+    values (#{id,jdbcType=VARCHAR}, #{demandId,jdbcType=VARCHAR}, #{publishPlatform,jdbcType=VARCHAR}, 
+      #{publishClient,jdbcType=INTEGER}, #{publishPage,jdbcType=VARCHAR}, #{ifTop,jdbcType=INTEGER}, 
+      #{topNumber,jdbcType=INTEGER}, #{showNumber,jdbcType=INTEGER}, #{publisher,jdbcType=VARCHAR}, 
+      #{publishTime,jdbcType=TIMESTAMP})
+  </insert>
+  <insert id="insertSelective" parameterType="com.goafanti.common.model.DemandPublish">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Wed Jan 31 09:34:27 CST 2018.
+    -->
+    insert into demand_publish
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="id != null">
+        id,
+      </if>
+      <if test="demandId != null">
+        demand_id,
+      </if>
+      <if test="publishPlatform != null">
+        publish_platform,
+      </if>
+      <if test="publishClient != null">
+        publish_client,
+      </if>
+      <if test="publishPage != null">
+        publish_page,
+      </if>
+      <if test="ifTop != null">
+        if_top,
+      </if>
+      <if test="topNumber != null">
+        top_number,
+      </if>
+      <if test="showNumber != null">
+        show_number,
+      </if>
+      <if test="publisher != null">
+        publisher,
+      </if>
+      <if test="publishTime != null">
+        publish_time,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="id != null">
+        #{id,jdbcType=VARCHAR},
+      </if>
+      <if test="demandId != null">
+        #{demandId,jdbcType=VARCHAR},
+      </if>
+      <if test="publishPlatform != null">
+        #{publishPlatform,jdbcType=VARCHAR},
+      </if>
+      <if test="publishClient != null">
+        #{publishClient,jdbcType=INTEGER},
+      </if>
+      <if test="publishPage != null">
+        #{publishPage,jdbcType=VARCHAR},
+      </if>
+      <if test="ifTop != null">
+        #{ifTop,jdbcType=INTEGER},
+      </if>
+      <if test="topNumber != null">
+        #{topNumber,jdbcType=INTEGER},
+      </if>
+      <if test="showNumber != null">
+        #{showNumber,jdbcType=INTEGER},
+      </if>
+      <if test="publisher != null">
+        #{publisher,jdbcType=VARCHAR},
+      </if>
+      <if test="publishTime != null">
+        #{publishTime,jdbcType=TIMESTAMP},
+      </if>
+    </trim>
+  </insert>
+  <select id="countByExample" parameterType="com.goafanti.common.model.DemandPublishExample" resultType="java.lang.Long">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Wed Jan 31 09:34:27 CST 2018.
+    -->
+    select count(*) from demand_publish
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+  </select>
+  <update id="updateByExampleSelective" parameterType="map">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Wed Jan 31 09:34:27 CST 2018.
+    -->
+    update demand_publish
+    <set>
+      <if test="record.id != null">
+        id = #{record.id,jdbcType=VARCHAR},
+      </if>
+      <if test="record.demandId != null">
+        demand_id = #{record.demandId,jdbcType=VARCHAR},
+      </if>
+      <if test="record.publishPlatform != null">
+        publish_platform = #{record.publishPlatform,jdbcType=VARCHAR},
+      </if>
+      <if test="record.publishClient != null">
+        publish_client = #{record.publishClient,jdbcType=INTEGER},
+      </if>
+      <if test="record.publishPage != null">
+        publish_page = #{record.publishPage,jdbcType=VARCHAR},
+      </if>
+      <if test="record.ifTop != null">
+        if_top = #{record.ifTop,jdbcType=INTEGER},
+      </if>
+      <if test="record.topNumber != null">
+        top_number = #{record.topNumber,jdbcType=INTEGER},
+      </if>
+      <if test="record.showNumber != null">
+        show_number = #{record.showNumber,jdbcType=INTEGER},
+      </if>
+      <if test="record.publisher != null">
+        publisher = #{record.publisher,jdbcType=VARCHAR},
+      </if>
+      <if test="record.publishTime != null">
+        publish_time = #{record.publishTime,jdbcType=TIMESTAMP},
+      </if>
+    </set>
+    <if test="_parameter != null">
+      <include refid="Update_By_Example_Where_Clause" />
+    </if>
+  </update>
+  <update id="updateByExample" parameterType="map">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Wed Jan 31 09:34:27 CST 2018.
+    -->
+    update demand_publish
+    set id = #{record.id,jdbcType=VARCHAR},
+      demand_id = #{record.demandId,jdbcType=VARCHAR},
+      publish_platform = #{record.publishPlatform,jdbcType=VARCHAR},
+      publish_client = #{record.publishClient,jdbcType=INTEGER},
+      publish_page = #{record.publishPage,jdbcType=VARCHAR},
+      if_top = #{record.ifTop,jdbcType=INTEGER},
+      top_number = #{record.topNumber,jdbcType=INTEGER},
+      show_number = #{record.showNumber,jdbcType=INTEGER},
+      publisher = #{record.publisher,jdbcType=VARCHAR},
+      publish_time = #{record.publishTime,jdbcType=TIMESTAMP}
+    <if test="_parameter != null">
+      <include refid="Update_By_Example_Where_Clause" />
+    </if>
+  </update>
+  <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.DemandPublish">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Wed Jan 31 09:34:27 CST 2018.
+    -->
+    update demand_publish
+    <set>
+      <if test="demandId != null">
+        demand_id = #{demandId,jdbcType=VARCHAR},
+      </if>
+      <if test="publishPlatform != null">
+        publish_platform = #{publishPlatform,jdbcType=VARCHAR},
+      </if>
+      <if test="publishClient != null">
+        publish_client = #{publishClient,jdbcType=INTEGER},
+      </if>
+      <if test="publishPage != null">
+        publish_page = #{publishPage,jdbcType=VARCHAR},
+      </if>
+      <if test="ifTop != null">
+        if_top = #{ifTop,jdbcType=INTEGER},
+      </if>
+      <if test="topNumber != null">
+        top_number = #{topNumber,jdbcType=INTEGER},
+      </if>
+      <if test="showNumber != null">
+        show_number = #{showNumber,jdbcType=INTEGER},
+      </if>
+      <if test="publisher != null">
+        publisher = #{publisher,jdbcType=VARCHAR},
+      </if>
+      <if test="publishTime != null">
+        publish_time = #{publishTime,jdbcType=TIMESTAMP},
+      </if>
+    </set>
+    where id = #{id,jdbcType=VARCHAR}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.DemandPublish">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Wed Jan 31 09:34:27 CST 2018.
+    -->
+    update demand_publish
+    set demand_id = #{demandId,jdbcType=VARCHAR},
+      publish_platform = #{publishPlatform,jdbcType=VARCHAR},
+      publish_client = #{publishClient,jdbcType=INTEGER},
+      publish_page = #{publishPage,jdbcType=VARCHAR},
+      if_top = #{ifTop,jdbcType=INTEGER},
+      top_number = #{topNumber,jdbcType=INTEGER},
+      show_number = #{showNumber,jdbcType=INTEGER},
+      publisher = #{publisher,jdbcType=VARCHAR},
+      publish_time = #{publishTime,jdbcType=TIMESTAMP}
+    where id = #{id,jdbcType=VARCHAR}
+  </update>
+  <select id="findDemandPublishByPage" parameterType="String" resultType="com.goafanti.demand.bo.DemandPublishBo">
+select dp.id,dp.demand_id as demandId, d.serial_number as serialNumber,d.name as name ,d.employer_name as userName,dp.publish_platform as publishPlatform,bi.platform_name as platformName,dp.publish_client as  publishClient,
+		dp.publish_page as publishPage,dp.if_top as ifTop,dp.show_number as showNumber,dp.top_number as topNumber,dp.publisher,ad.name as publisherName,dp.publish_time as publishTime
+from demand_publish dp 
+left join demand d on dp.demand_id=d.id
+left join admin ad on dp.publisher=ad.id
+left join branch_information bi on dp.publish_platform=bi.id
+where 1=1
+<if test="name != null">
+  	and d.name like "%"#{name,jdbcType=VARCHAR}"%"
+  	</if>
+  	<if test="userName != null">
+  	and d.owner_name = = #{userName,jdbcType=VARCHAR}
+  	</if>
+  	<if test="publishPlatform != null">
+		and dp.publish_platform = #{publishPlatform,jdbcType=VARCHAR}
+	</if>
+	<if test="publishClient != null">
+		and dp.publish_client = #{publishClient,jdbcType=INTEGER}
+	</if>
+	
+	<if test="publishPage != null">
+		and dp.publish_page =#{publishPage,jdbcType=INTEGER}
+	</if>
+	<if test="ifTop != null">
+		and dp.if_top =#{ifTop,jdbcType=INTEGER}
+
+	</if>
+	<if test="employerName != null">
+		and d.employer_name like #{employerName,jdbcType=INTEGER}'%'
+	</if>
+		order by dp.if_top, dp.top_number,dp.show_number asc
+	<if test="page_sql!=null">
+			${page_sql}
+	</if>
+  </select>
+  
+  <select id="findDemandPublishCount" parameterType="String" resultType="java.lang.Integer">
+  	select count(1)
+from demand_publish dp 
+left join demand d on dp.demand_id=d.id
+left join admin ad on dp.publisher=ad.id
+left join branch_information bi on dp.publish_platform=bi.id
+where 1=1
+<if test="name != null">
+  	and d.name like "%"#{name,jdbcType=VARCHAR}"%"
+  	</if>
+  	<if test="publishPage != null">
+		and dp.publish_page =#{publishPage,jdbcType=INTEGER}
+	</if>
+  	<if test="userName != null">
+  	and d.owner_name = = #{userName,jdbcType=VARCHAR}
+  	</if>
+  	<if test="publishPlatform != null">
+		and dp.publish_platform = #{publishPlatform,jdbcType=VARCHAR}
+	</if>
+	<if test="publishClient != null">
+		and dp.publish_client = #{publishClient,jdbcType=INTEGER}
+	</if>
+	<if test="ifTop != null">
+		and dp.if_top=#{ifTop,jdbcType=INTEGER}
+
+	</if>
+	</select>
+	
+	<select id="checkExisting"  resultType="java.lang.Integer">
+	 	select count(1) 
+	 	from demand_publish
+	 	where 1=1
+	 	and demand_id= #{demandId,jdbcType=VARCHAR}
+	 	and publish_platform= #{publishPlatform,jdbcType=VARCHAR}
+	 	and publish_client= #{publishClient,jdbcType=INTEGER}
+	 	and publish_page= #{publishPage,jdbcType=VARCHAR}
+	 </select>
+	 
+	 <select id="selectPublishPages" resultMap="BaseResultMap" parameterType="java.lang.String">
+	 	select id,publish_client,publish_page from demand_publish where demand_id = #{demandId,jdbcType=VARCHAR}
+	 </select>
+	 
+	 <delete id="batchDeleteByDemandId" parameterType="java.lang.String">
+	 	delete from demand_publish where demand_id = #{demandId,jdbcType=VARCHAR}
+	 </delete>
 </mapper>

+ 19 - 0
src/main/java/com/goafanti/demand/bo/DemandDetailBo.java

@@ -0,0 +1,19 @@
+package com.goafanti.demand.bo;
+
+import java.util.List;
+
+import com.goafanti.common.model.DemandPublish;
+
+public class DemandDetailBo extends InputDemand{
+	List< DemandPublish> publishPages;
+
+	public List<DemandPublish> getPublishPages() {
+		return publishPages;
+	}
+
+	public void setPublishPages(List<DemandPublish> publishPages) {
+		this.publishPages = publishPages;
+	}
+	
+	
+}

+ 0 - 234
src/main/java/com/goafanti/demand/bo/DemandManageDetailBo.java

@@ -1,234 +0,0 @@
-package com.goafanti.demand.bo;
-
-import java.math.BigDecimal;
-
-import com.fasterxml.jackson.annotation.JsonFormat;
-import com.fasterxml.jackson.annotation.JsonFormat.Shape;
-
-public class DemandManageDetailBo extends DemandManageListBo {
-
-	private Integer		industryCategoryA;
-
-	private Integer		industryCategoryB;
-
-	private String		problemDes;
-
-	private String		technicalRequirements;
-
-	private String		pictureUrl;
-
-	private String		textFileUrl;
-
-	private String		videoUrl;
-
-	private BigDecimal	budgetCost;
-
-	private String		fixedCycle;
-
-	private Integer		peopleNumber;
-
-	private String		fixedScheme;
-
-	private BigDecimal	costEscrow;
-
-	private String		employerId;
-
-	private String		address;
-
-	private String		contactsName;
-
-	private String		mobile;
-
-	private String		mailbox;
-
-	private String		contacts;
-
-	private String		employerAddress;
-
-	private String		employerContactsMobile;
-
-	private String		employerContactsMailbox;
-
-	private String      coverImg;
-	
-	
-	
-
-	public String getEmployerAddress() {
-		return employerAddress;
-	}
-
-	public void setEmployerAddress(String employerAddress) {
-		this.employerAddress = employerAddress;
-	}
-
-	public String getEmployerContactsMobile() {
-		return employerContactsMobile;
-	}
-
-	public void setEmployerContactsMobile(String employerContactsMobile) {
-		this.employerContactsMobile = employerContactsMobile;
-	}
-
-	public String getEmployerContactsMailbox() {
-		return employerContactsMailbox;
-	}
-
-	public void setEmployerContactsMailbox(String employerContactsMailbox) {
-		this.employerContactsMailbox = employerContactsMailbox;
-	}
-
-	@JsonFormat(shape = Shape.STRING)
-	public String getContacts() {
-		return contacts;
-	}
-
-	public void setContacts(String contacts) {
-		this.contacts = contacts;
-	}
-
-	public Integer getIndustryCategoryA() {
-		return industryCategoryA;
-	}
-
-	public void setIndustryCategoryA(Integer industryCategoryA) {
-		this.industryCategoryA = industryCategoryA;
-	}
-
-	public Integer getIndustryCategoryB() {
-		return industryCategoryB;
-	}
-
-	public void setIndustryCategoryB(Integer industryCategoryB) {
-		this.industryCategoryB = industryCategoryB;
-	}
-
-	public String getProblemDes() {
-		return problemDes;
-	}
-
-	public void setProblemDes(String problemDes) {
-		this.problemDes = problemDes;
-	}
-
-	public String getTechnicalRequirements() {
-		return technicalRequirements;
-	}
-
-	public void setTechnicalRequirements(String technicalRequirements) {
-		this.technicalRequirements = technicalRequirements;
-	}
-
-	public String getPictureUrl() {
-		return pictureUrl;
-	}
-
-	public void setPictureUrl(String pictureUrl) {
-		this.pictureUrl = pictureUrl;
-	}
-
-	public String getTextFileUrl() {
-		return textFileUrl;
-	}
-
-	public void setTextFileUrl(String textFileUrl) {
-		this.textFileUrl = textFileUrl;
-	}
-
-	public String getVideoUrl() {
-		return videoUrl;
-	}
-
-	public void setVideoUrl(String videoUrl) {
-		this.videoUrl = videoUrl;
-	}
-
-	public BigDecimal getBudgetCost() {
-		return budgetCost;
-	}
-
-	public void setBudgetCost(BigDecimal budgetCost) {
-		this.budgetCost = budgetCost;
-	}
-
-	public String getFixedCycle() {
-		return fixedCycle;
-	}
-
-	public void setFixedCycle(String fixedCycle) {
-		this.fixedCycle = fixedCycle;
-	}
-
-	public Integer getPeopleNumber() {
-		return peopleNumber;
-	}
-
-	public void setPeopleNumber(Integer peopleNumber) {
-		this.peopleNumber = peopleNumber;
-	}
-
-	public String getFixedScheme() {
-		return fixedScheme;
-	}
-
-	public void setFixedScheme(String fixedScheme) {
-		this.fixedScheme = fixedScheme;
-	}
-
-	public BigDecimal getCostEscrow() {
-		return costEscrow;
-	}
-
-	public void setCostEscrow(BigDecimal costEscrow) {
-		this.costEscrow = costEscrow;
-	}
-
-	public String getEmployerId() {
-		return employerId;
-	}
-
-	public void setEmployerId(String employerId) {
-		this.employerId = employerId;
-	}
-
-	public String getAddress() {
-		return address;
-	}
-
-	public void setAddress(String address) {
-		this.address = address;
-	}
-
-	public String getContactsName() {
-		return contactsName;
-	}
-
-	public void setContactsName(String contactsName) {
-		this.contactsName = contactsName;
-	}
-
-	public String getMobile() {
-		return mobile;
-	}
-
-	public void setMobile(String mobile) {
-		this.mobile = mobile;
-	}
-
-	public String getMailbox() {
-		return mailbox;
-	}
-
-	public void setMailbox(String mailbox) {
-		this.mailbox = mailbox;
-	}
-
-	public String getCoverImg() {
-		return coverImg;
-	}
-
-	public void setCoverImg(String coverImg) {
-		this.coverImg = coverImg;
-	}
-
-}

+ 0 - 114
src/main/java/com/goafanti/demand/bo/DemandManageListBo.java

@@ -1,114 +0,0 @@
-package com.goafanti.demand.bo;
-
-import com.fasterxml.jackson.annotation.JsonFormat;
-import com.fasterxml.jackson.annotation.JsonFormat.Shape;
-
-public class DemandManageListBo extends DemandListBo {
-
-	/**
-	 * 信息来源(0-平台采集,1-客户发布)
-	 */
-	private Integer	infoSources;
-
-	private String	username;
-
-	private String	employerName;
-
-	private Integer	province;
-	/**
-	 * 是否在首页 0-否 1-是
-	 */
-	private Integer hot;
-	/**
-	 * 是否属于精品  0- 否 1-是
-	 */
-	private Integer boutique;
-	/**
-	 * 负责人(营销员)
-	 */
-	private String	principalId;
-
-	/**
-	 * 技术经纪人
-	 */
-	private String	techBrokerId;
-	
-	/**
-	 * 技术经纪人idd
-	 */
-	private String	techBrokerIdd;
-	
-	public String getTechBrokerIdd() {
-		return techBrokerIdd;
-	}
-
-	public void setTechBrokerIdd(String techBrokerIdd) {
-		this.techBrokerIdd = techBrokerIdd;
-	}
-
-	public String getTechBrokerId() {
-		return techBrokerId;
-	}
-
-	public void setTechBrokerId(String techBrokerId) {
-		this.techBrokerId = techBrokerId;
-	}
-
-	@JsonFormat(shape = Shape.STRING)
-	public Integer getInfoSources() {
-		return infoSources;
-	}
-
-	public void setInfoSources(Integer infoSources) {
-		this.infoSources = infoSources;
-	}
-
-	public String getUsername() {
-		return username;
-	}
-
-	public void setUsername(String username) {
-		this.username = username;
-	}
-
-	public String getEmployerName() {
-		return employerName;
-	}
-
-	public void setEmployerName(String employerName) {
-		this.employerName = employerName;
-	}
-
-	public Integer getProvince() {
-		return province;
-	}
-
-	public void setProvince(Integer province) {
-		this.province = province;
-	}
-
-	public String getPrincipalId() {
-		return principalId;
-	}
-
-	public void setPrincipalId(String principalId) {
-		this.principalId = principalId;
-	}
-	
-	@JsonFormat(shape = Shape.STRING)
-	public Integer getBoutique() {
-		return boutique;
-	}
-
-	public void setBoutique(Integer boutique) {
-		this.boutique = boutique;
-	}
-	@JsonFormat(shape = Shape.STRING)
-	public Integer getHot() {
-		return hot;
-	}
-
-	public void setHot(Integer hot) {
-		this.hot = hot;
-	}
-}

+ 315 - 303
src/main/java/com/goafanti/demand/bo/InputDemand.java

@@ -1,303 +1,315 @@
-package com.goafanti.demand.bo;
-
-import java.math.BigDecimal;
-import java.util.Date;
-
-import javax.validation.constraints.Max;
-import javax.validation.constraints.Min;
-import javax.validation.constraints.Size;
-
-import com.goafanti.common.constant.ErrorConstants;
-
-public class InputDemand {
-	
-	@Size(min = 0, max = 128, message = "{" + ErrorConstants.PARAM_SIZE_ERROR + "}")
-	private String		name;
-	
-	@Size(min = 0, max = 36, message = "{" + ErrorConstants.PARAM_SIZE_ERROR + "}")
-	private String		id;
-	
-	@Max(value = 99999999, message = "{" + ErrorConstants.PARAM_ERROR + "}")
-	@Min(value = 0, message = "{" + ErrorConstants.PARAM_ERROR + "}")
-	private Integer		serialNumber;
-	
-	@Max(value = 1, message = "{" + ErrorConstants.PARAM_ERROR + "}")
-	@Min(value = 0, message = "{" + ErrorConstants.PARAM_ERROR + "}")
-	private Integer		dataCategory;
-
-	@Max(value = 9, message = "{" + ErrorConstants.PARAM_ERROR + "}")
-	@Min(value = 0, message = "{" + ErrorConstants.PARAM_ERROR + "}")
-	private Integer		demandType;
-	
-	@Size(min = 0, max = 45, message = "{" + ErrorConstants.PARAM_SIZE_ERROR + "}")
-	private String		keyword;
-
-	@Max(value = 999, message = "{" + ErrorConstants.PARAM_ERROR + "}")
-	@Min(value = 0, message = "{" + ErrorConstants.PARAM_ERROR + "}")
-	private Integer		industryCategoryA;
-
-	@Max(value = 999, message = "{" + ErrorConstants.PARAM_ERROR + "}")
-	@Min(value = 0, message = "{" + ErrorConstants.PARAM_ERROR + "}")
-	private Integer		industryCategoryB;
-
-	@Max(value = 999, message = "{" + ErrorConstants.PARAM_ERROR + "}")
-	@Min(value = 0, message = "{" + ErrorConstants.PARAM_ERROR + "}")
-	private Integer		industryCategoryC;
-	
-	@Max(value = (long) 999999.99, message = "{" + ErrorConstants.PARAM_ERROR + "}")
-	@Min(value = 0, message = "{" + ErrorConstants.PARAM_ERROR + "}")
-	private BigDecimal	budgetCost;
-	
-	@Max(value = 1, message = "{" + ErrorConstants.PARAM_ERROR + "}")
-	@Min(value = 0, message = "{" + ErrorConstants.PARAM_ERROR + "}")
-	private Integer isHot;
-
-	@Max(value = 1, message = "{" + ErrorConstants.PARAM_ERROR + "}")
-	@Min(value = 0, message = "{" + ErrorConstants.PARAM_ERROR + "}")
-	private Integer isUrgent;
-	
-	@Max(value = 10, message = "{" + ErrorConstants.PARAM_ERROR + "}")
-	@Min(value = 0, message = "{" + ErrorConstants.PARAM_ERROR + "}")
-	private Integer researchType;
-	
-	@Size(min = 0, max = 11, message = "{" + ErrorConstants.PARAM_SIZE_ERROR + "}")
-	private String urgentDays;
-	
-	@Max(value = (long) 999999.99, message = "{" + ErrorConstants.PARAM_ERROR + "}")
-	@Min(value = 0, message = "{" + ErrorConstants.PARAM_ERROR + "}")
-	private BigDecimal urgentMoney;
-	
-	@Max(value = 1, message = "{" + ErrorConstants.PARAM_ERROR + "}")
-	@Min(value = 0, message = "{" + ErrorConstants.PARAM_ERROR + "}")
-	private Integer		releaseStatus;
-	
-	private Date		releaseDate;
-	
-	@Max(value = 4, message = "{" + ErrorConstants.PARAM_ERROR + "}")
-	@Min(value = 0, message = "{" + ErrorConstants.PARAM_ERROR + "}")
-	private Integer		auditStatus;
-	
-	@Size(min = 0, max = 128, message = "{" + ErrorConstants.PARAM_SIZE_ERROR + "}")
-	private String auditInfo;
-	
-	@Max(value = 2, message = "{" + ErrorConstants.PARAM_ERROR + "}")
-	@Min(value = 0, message = "{" + ErrorConstants.PARAM_ERROR + "}")
-	private Integer		status;
-	
-	@Size(min = 0, max = 512, message = "{" + ErrorConstants.PARAM_SIZE_ERROR + "}")
-	private String		problemDes;
-	
-	@Size(min = 0, max = 1000, message = "{" + ErrorConstants.PARAM_SIZE_ERROR + "}")
-	private String		pictureUrl;
-	
-	@Size(min = 0, max = 36, message = "{" + ErrorConstants.PARAM_SIZE_ERROR + "}")
-	private String		employerId;
-
-	@Size(min = 0, max = 36, message = "{" + ErrorConstants.PARAM_SIZE_ERROR + "}")
-	private String		techBrokerId;
-
-	@Max(value = 1, message = "{" + ErrorConstants.PARAM_ERROR + "}")
-	@Min(value = 0, message = "{" + ErrorConstants.PARAM_ERROR + "}")
-	private Integer		infoSources;
-
-	public String getName() {
-		return name;
-	}
-
-	public void setName(String name) {
-		this.name = name;
-	}
-
-	public String getId() {
-		return id;
-	}
-
-	public void setId(String id) {
-		this.id = id;
-	}
-
-	public Integer getSerialNumber() {
-		return serialNumber;
-	}
-
-	public void setSerialNumber(Integer serialNumber) {
-		this.serialNumber = serialNumber;
-	}
-
-	public Integer getDataCategory() {
-		return dataCategory;
-	}
-
-	public void setDataCategory(Integer dataCategory) {
-		this.dataCategory = dataCategory;
-	}
-
-	public Integer getDemandType() {
-		return demandType;
-	}
-
-	public void setDemandType(Integer demandType) {
-		this.demandType = demandType;
-	}
-
-	public String getKeyword() {
-		return keyword;
-	}
-
-	public void setKeyword(String keyword) {
-		this.keyword = keyword;
-	}
-
-	public Integer getIndustryCategoryA() {
-		return industryCategoryA;
-	}
-
-	public void setIndustryCategoryA(Integer industryCategoryA) {
-		this.industryCategoryA = industryCategoryA;
-	}
-
-	public Integer getIndustryCategoryB() {
-		return industryCategoryB;
-	}
-
-	public void setIndustryCategoryB(Integer industryCategoryB) {
-		this.industryCategoryB = industryCategoryB;
-	}
-
-	public Integer getIndustryCategoryC() {
-		return industryCategoryC;
-	}
-
-	public void setIndustryCategoryC(Integer industryCategoryC) {
-		this.industryCategoryC = industryCategoryC;
-	}
-
-	public BigDecimal getBudgetCost() {
-		return budgetCost;
-	}
-
-	public void setBudgetCost(BigDecimal budgetCost) {
-		this.budgetCost = budgetCost;
-	}
-
-	public Integer getIsHot() {
-		return isHot;
-	}
-
-	public void setIsHot(Integer isHot) {
-		this.isHot = isHot;
-	}
-
-	public Integer getIsUrgent() {
-		return isUrgent;
-	}
-
-	public void setIsUrgent(Integer isUrgent) {
-		this.isUrgent = isUrgent;
-	}
-
-	public Integer getResearchType() {
-		return researchType;
-	}
-
-	public void setResearchType(Integer researchType) {
-		this.researchType = researchType;
-	}
-
-	public String getUrgentDays() {
-		return urgentDays;
-	}
-
-	public void setUrgentDays(String urgentDays) {
-		this.urgentDays = urgentDays;
-	}
-
-	public BigDecimal getUrgentMoney() {
-		return urgentMoney;
-	}
-
-	public void setUrgentMoney(BigDecimal urgentMoney) {
-		this.urgentMoney = urgentMoney;
-	}
-
-	public Integer getReleaseStatus() {
-		return releaseStatus;
-	}
-
-	public void setReleaseStatus(Integer releaseStatus) {
-		this.releaseStatus = releaseStatus;
-	}
-
-	public Date getReleaseDate() {
-		return releaseDate;
-	}
-
-	public void setReleaseDate(Date releaseDate) {
-		this.releaseDate = releaseDate;
-	}
-
-	public Integer getAuditStatus() {
-		return auditStatus;
-	}
-
-	public void setAuditStatus(Integer auditStatus) {
-		this.auditStatus = auditStatus;
-	}
-
-	public String getAuditInfo() {
-		return auditInfo;
-	}
-
-	public void setAuditInfo(String auditInfo) {
-		this.auditInfo = auditInfo;
-	}
-
-	public Integer getStatus() {
-		return status;
-	}
-
-	public void setStatus(Integer status) {
-		this.status = status;
-	}
-
-	public String getProblemDes() {
-		return problemDes;
-	}
-
-	public void setProblemDes(String problemDes) {
-		this.problemDes = problemDes;
-	}
-
-	public String getPictureUrl() {
-		return pictureUrl;
-	}
-
-	public void setPictureUrl(String pictureUrl) {
-		this.pictureUrl = pictureUrl;
-	}
-
-	public String getEmployerId() {
-		return employerId;
-	}
-
-	public void setEmployerId(String employerId) {
-		this.employerId = employerId;
-	}
-
-	public String getTechBrokerId() {
-		return techBrokerId;
-	}
-
-	public void setTechBrokerId(String techBrokerId) {
-		this.techBrokerId = techBrokerId;
-	}
-
-	public Integer getInfoSources() {
-		return infoSources;
-	}
-
-	public void setInfoSources(Integer infoSources) {
-		this.infoSources = infoSources;
-	}
-
-}
+package com.goafanti.demand.bo;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+import javax.validation.constraints.Max;
+import javax.validation.constraints.Min;
+import javax.validation.constraints.Size;
+
+import com.goafanti.common.constant.ErrorConstants;
+
+public class InputDemand {
+	
+	@Size(min = 0, max = 128, message = "{" + ErrorConstants.PARAM_SIZE_ERROR + "}")
+	private String		name;
+	
+	@Size(min = 0, max = 36, message = "{" + ErrorConstants.PARAM_SIZE_ERROR + "}")
+	private String		id;
+	
+	@Max(value = 99999999, message = "{" + ErrorConstants.PARAM_ERROR + "}")
+	@Min(value = 0, message = "{" + ErrorConstants.PARAM_ERROR + "}")
+	private Integer		serialNumber;
+	
+	@Max(value = 1, message = "{" + ErrorConstants.PARAM_ERROR + "}")
+	@Min(value = 0, message = "{" + ErrorConstants.PARAM_ERROR + "}")
+	private Integer		dataCategory;
+
+	@Max(value = 9, message = "{" + ErrorConstants.PARAM_ERROR + "}")
+	@Min(value = 0, message = "{" + ErrorConstants.PARAM_ERROR + "}")
+	private Integer		demandType;
+	
+	@Size(min = 0, max = 45, message = "{" + ErrorConstants.PARAM_SIZE_ERROR + "}")
+	private String		keyword;
+
+	@Max(value = 999, message = "{" + ErrorConstants.PARAM_ERROR + "}")
+	@Min(value = 0, message = "{" + ErrorConstants.PARAM_ERROR + "}")
+	private Integer		industryCategoryA;
+
+	@Max(value = 999, message = "{" + ErrorConstants.PARAM_ERROR + "}")
+	@Min(value = 0, message = "{" + ErrorConstants.PARAM_ERROR + "}")
+	private Integer		industryCategoryB;
+
+	@Max(value = 999, message = "{" + ErrorConstants.PARAM_ERROR + "}")
+	@Min(value = 0, message = "{" + ErrorConstants.PARAM_ERROR + "}")
+	private Integer		industryCategoryC;
+	
+	@Max(value = (long) 999999.99, message = "{" + ErrorConstants.PARAM_ERROR + "}")
+	@Min(value = 0, message = "{" + ErrorConstants.PARAM_ERROR + "}")
+	private BigDecimal	budgetCost;
+	
+	@Max(value = (long) 999999.99, message = "{" + ErrorConstants.PARAM_ERROR + "}")
+	@Min(value = 0, message = "{" + ErrorConstants.PARAM_ERROR + "}")
+	private BigDecimal crowdCost;
+	
+	@Max(value = 1, message = "{" + ErrorConstants.PARAM_ERROR + "}")
+	@Min(value = 0, message = "{" + ErrorConstants.PARAM_ERROR + "}")
+	private Integer isHot;
+
+	@Max(value = 1, message = "{" + ErrorConstants.PARAM_ERROR + "}")
+	@Min(value = 0, message = "{" + ErrorConstants.PARAM_ERROR + "}")
+	private Integer isUrgent;
+	
+	@Max(value = 10, message = "{" + ErrorConstants.PARAM_ERROR + "}")
+	@Min(value = 0, message = "{" + ErrorConstants.PARAM_ERROR + "}")
+	private Integer researchType;
+	
+	@Size(min = 0, max = 11, message = "{" + ErrorConstants.PARAM_SIZE_ERROR + "}")
+	private String urgentDays;
+	
+	@Max(value = (long) 999999.99, message = "{" + ErrorConstants.PARAM_ERROR + "}")
+	@Min(value = 0, message = "{" + ErrorConstants.PARAM_ERROR + "}")
+	private BigDecimal urgentMoney;
+	
+	@Max(value = 1, message = "{" + ErrorConstants.PARAM_ERROR + "}")
+	@Min(value = 0, message = "{" + ErrorConstants.PARAM_ERROR + "}")
+	private Integer		releaseStatus;
+	
+	private Date		releaseDate;
+	
+	@Max(value = 4, message = "{" + ErrorConstants.PARAM_ERROR + "}")
+	@Min(value = 0, message = "{" + ErrorConstants.PARAM_ERROR + "}")
+	private Integer		auditStatus;
+	
+	@Size(min = 0, max = 128, message = "{" + ErrorConstants.PARAM_SIZE_ERROR + "}")
+	private String auditInfo;
+	
+	@Max(value = 2, message = "{" + ErrorConstants.PARAM_ERROR + "}")
+	@Min(value = 0, message = "{" + ErrorConstants.PARAM_ERROR + "}")
+	private Integer		status;
+	
+	@Size(min = 0, max = 512, message = "{" + ErrorConstants.PARAM_SIZE_ERROR + "}")
+	private String		problemDes;
+	
+	@Size(min = 0, max = 1000, message = "{" + ErrorConstants.PARAM_SIZE_ERROR + "}")
+	private String		pictureUrl;
+	
+	@Size(min = 0, max = 36, message = "{" + ErrorConstants.PARAM_SIZE_ERROR + "}")
+	private String		employerId;
+
+	@Size(min = 0, max = 36, message = "{" + ErrorConstants.PARAM_SIZE_ERROR + "}")
+	private String		techBrokerId;
+
+	@Max(value = 1, message = "{" + ErrorConstants.PARAM_ERROR + "}")
+	@Min(value = 0, message = "{" + ErrorConstants.PARAM_ERROR + "}")
+	private Integer		infoSources;
+
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	public String getId() {
+		return id;
+	}
+
+	public void setId(String id) {
+		this.id = id;
+	}
+
+	public Integer getSerialNumber() {
+		return serialNumber;
+	}
+
+	public void setSerialNumber(Integer serialNumber) {
+		this.serialNumber = serialNumber;
+	}
+
+	public Integer getDataCategory() {
+		return dataCategory;
+	}
+
+	public void setDataCategory(Integer dataCategory) {
+		this.dataCategory = dataCategory;
+	}
+
+	public Integer getDemandType() {
+		return demandType;
+	}
+
+	public void setDemandType(Integer demandType) {
+		this.demandType = demandType;
+	}
+
+	public String getKeyword() {
+		return keyword;
+	}
+
+	public void setKeyword(String keyword) {
+		this.keyword = keyword;
+	}
+
+	public Integer getIndustryCategoryA() {
+		return industryCategoryA;
+	}
+
+	public void setIndustryCategoryA(Integer industryCategoryA) {
+		this.industryCategoryA = industryCategoryA;
+	}
+
+	public Integer getIndustryCategoryB() {
+		return industryCategoryB;
+	}
+
+	public void setIndustryCategoryB(Integer industryCategoryB) {
+		this.industryCategoryB = industryCategoryB;
+	}
+
+	public Integer getIndustryCategoryC() {
+		return industryCategoryC;
+	}
+
+	public void setIndustryCategoryC(Integer industryCategoryC) {
+		this.industryCategoryC = industryCategoryC;
+	}
+
+	public BigDecimal getBudgetCost() {
+		return budgetCost;
+	}
+
+	public void setBudgetCost(BigDecimal budgetCost) {
+		this.budgetCost = budgetCost;
+	}
+
+	public BigDecimal getCrowdCost() {
+		return crowdCost;
+	}
+
+	public void setCrowdCost(BigDecimal crowdCost) {
+		this.crowdCost = crowdCost;
+	}
+
+	public Integer getIsHot() {
+		return isHot;
+	}
+
+	public void setIsHot(Integer isHot) {
+		this.isHot = isHot;
+	}
+
+	public Integer getIsUrgent() {
+		return isUrgent;
+	}
+
+	public void setIsUrgent(Integer isUrgent) {
+		this.isUrgent = isUrgent;
+	}
+
+	public Integer getResearchType() {
+		return researchType;
+	}
+
+	public void setResearchType(Integer researchType) {
+		this.researchType = researchType;
+	}
+
+	public String getUrgentDays() {
+		return urgentDays;
+	}
+
+	public void setUrgentDays(String urgentDays) {
+		this.urgentDays = urgentDays;
+	}
+
+	public BigDecimal getUrgentMoney() {
+		return urgentMoney;
+	}
+
+	public void setUrgentMoney(BigDecimal urgentMoney) {
+		this.urgentMoney = urgentMoney;
+	}
+
+	public Integer getReleaseStatus() {
+		return releaseStatus;
+	}
+
+	public void setReleaseStatus(Integer releaseStatus) {
+		this.releaseStatus = releaseStatus;
+	}
+
+	public Date getReleaseDate() {
+		return releaseDate;
+	}
+
+	public void setReleaseDate(Date releaseDate) {
+		this.releaseDate = releaseDate;
+	}
+
+	public Integer getAuditStatus() {
+		return auditStatus;
+	}
+
+	public void setAuditStatus(Integer auditStatus) {
+		this.auditStatus = auditStatus;
+	}
+
+	public String getAuditInfo() {
+		return auditInfo;
+	}
+
+	public void setAuditInfo(String auditInfo) {
+		this.auditInfo = auditInfo;
+	}
+
+	public Integer getStatus() {
+		return status;
+	}
+
+	public void setStatus(Integer status) {
+		this.status = status;
+	}
+
+	public String getProblemDes() {
+		return problemDes;
+	}
+
+	public void setProblemDes(String problemDes) {
+		this.problemDes = problemDes;
+	}
+
+	public String getPictureUrl() {
+		return pictureUrl;
+	}
+
+	public void setPictureUrl(String pictureUrl) {
+		this.pictureUrl = pictureUrl;
+	}
+
+	public String getEmployerId() {
+		return employerId;
+	}
+
+	public void setEmployerId(String employerId) {
+		this.employerId = employerId;
+	}
+
+	public String getTechBrokerId() {
+		return techBrokerId;
+	}
+
+	public void setTechBrokerId(String techBrokerId) {
+		this.techBrokerId = techBrokerId;
+	}
+
+	public Integer getInfoSources() {
+		return infoSources;
+	}
+
+	public void setInfoSources(Integer infoSources) {
+		this.infoSources = infoSources;
+	}
+
+}

+ 386 - 453
src/main/java/com/goafanti/demand/controller/AdminDemandApiController.java

@@ -1,453 +1,386 @@
-package com.goafanti.demand.controller;
-
-import javax.annotation.Resource;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RestController;
-import com.goafanti.admin.service.AftFileService;
-import com.goafanti.common.bo.Result;
-import com.goafanti.common.constant.ErrorConstants;
-import com.goafanti.common.controller.CertifyApiController;
-import com.goafanti.common.enums.AttachmentType;
-import com.goafanti.common.enums.DeleteStatus;
-import com.goafanti.common.enums.DemandAuditStatus;
-import com.goafanti.common.model.AftFile;
-import com.goafanti.common.model.Demand;
-import com.goafanti.common.model.DemandFollow;
-import com.goafanti.common.model.DemandFollowDetail;
-import com.goafanti.common.model.DemandPublish;
-import com.goafanti.common.utils.StringUtils;
-import com.goafanti.demand.service.DemandFollowService;
-import com.goafanti.demand.service.DemandOrderService;
-import com.goafanti.demand.service.DemandPublishPageService;
-import com.goafanti.demand.service.DemandPublishService;
-import com.goafanti.demand.service.DemandService;
-import com.goafanti.user.service.UserService;
-
-@RestController
-@RequestMapping(value = "/api/admin/demand")
-public class AdminDemandApiController extends CertifyApiController {
-	@Resource
-	private DemandService		demandService;
-	@Resource
-	private UserService			userService;
-	@Resource
-	private AftFileService		aftFileService;
-	@Resource
-	private DemandOrderService	demandOrderService;
-	@Resource
-	DemandPublishService	demandPublishService;
-	@Resource
-	DemandFollowService		demandFollowService;
-	/**
-	 * 科技需求匹配科技成果
-	 */
-	@RequestMapping(value = "/matchAchievement", method = RequestMethod.POST)
-	public Result matchAchievement(String id) {
-		Result res = new Result();
-		if (StringUtils.isBlank(id)) {
-			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到需求ID", "成果ID"));
-			return res;
-		}
-		Demand d = demandService.selectByPrimaryKey(id);
-		if (null == d|| !DeleteStatus.UNDELETE.getCode().equals(d.getDeletedSign())
-				|| !DemandAuditStatus.AUDITED.getCode().equals(d.getAuditStatus())) {
-			res.getError().add(buildError("", "当前状态无法匹配!"));
-			return res;
-		}
-		res.setData(demandService.updateMatchAchievement(d));
-		return res;
-	}
-
-	
-
-	/**
-	 * 成果需求匹配列表
-	 */
-	@RequestMapping(value = "/achievementDemand", method = RequestMethod.GET)
-	public Result achievementDemand(String id) {
-		Result res = new Result();
-		res.setData(demandService.selectAchievementDemandListByDemandId(id));
-		return res;
-	}
-	/**
-	 * 下载技术需求批量导入Excel模板
-	 * 
-	 * @param response
-	 * @return
-	 */
-	@RequestMapping(value = "/downloadTemplate", method = RequestMethod.GET)
-	public Result downloadTemplateFile(HttpServletResponse response, String sign) {
-		Result res = new Result();
-		AttachmentType attachmentType = AttachmentType.getField(sign);
-		if (attachmentType == AttachmentType.DEMAND_TEMPLATE) {
-			String fileName = "";
-			AftFile af = aftFileService.selectAftFileBySign(sign);
-			if (null == af) {
-				res.getError().add(buildError(ErrorConstants.FILE_NON_EXISTENT, "", "找不到文件!"));
-			} else {
-				String path = af.getFilePath();
-				String suffix = path.substring(path.lastIndexOf("."));
-				fileName = AttachmentType.DEMAND_TEMPLATE.getDesc() + suffix;
-				downloadFile(response, fileName, path);
-			}
-		} else {
-			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
-		}
-		return res;
-	}
-
-	/**
-	 * 个人用户--需求列表
-	 */
-	@RequestMapping(value = "/userList", method = RequestMethod.GET)
-	public Result userList(String pageNo, String pageSize) {
-		Result res = new Result();
-		//res.setData(null); TODO
-		return res;
-	}
-
-	/**
-	 * 组织用户--需求列表(个人组织合并)
-	 */
-	@RequestMapping(value = "/orgList", method = RequestMethod.GET)
-	public Result orgList(String pageNo, String pageSize) {
-		Result res = new Result();
-		//res.setData(null); TODO
-		return res;
-	}
-
-	/**
-	 * 个人需求详情
-	 */
-	@RequestMapping(value = "/userDemandDetail", method = RequestMethod.GET)
-	public Result userDemandDetail(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.selectUserDemandDetail(id));
-		return res;
-	}
-
-	/**
-	 * 组织用户详情(个人组织合并)
-	 */
-	@RequestMapping(value = "/orgDemandDetail", method = RequestMethod.GET)
-	public Result orgDemandDetail(String id,Integer dataCategory) {
-		Result res = new Result();
-
-		if (StringUtils.isBlank(id)) {
-			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到需求ID", "需求ID"));
-			return res;
-		}
-		if(dataCategory==0){
-			res.setData(demandService.selectUserDemandDetail(id));
-			return res;
-		}else if(dataCategory==1){
-			res.setData(demandService.selectOrgDemandDetail(id));
-			return res;
-		}
-		return res;
-	}
-
-	/**
-	 * 需求管理--获取个人用户下拉
-	 */
-	@RequestMapping(value = "/userNames", method = RequestMethod.GET)
-	public Result getUserNames() {
-		Result res = new Result();
-		res.setData(userService.selectDemandUserNames());
-		return res;
-	}
-
-	/**
-	 * 需求管理--获取组织用户下拉
-	 */
-	@RequestMapping(value = "/unitNames", method = RequestMethod.GET)
-	public Result getUnitNames() {
-		Result res = new Result();
-		res.setData(userService.selectDemandUnitNames());
-		return res;
-	}
-
-	/**
-	 * 需求资料--图片上传
-	 */
-	@RequestMapping(value = "/uploadPicture", method = RequestMethod.POST)
-	public Result uploadPicture(HttpServletRequest req, String sign, String uid) {
-		Result res = new Result();
-		if (StringUtils.isBlank(uid)) {
-			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户ID", "用户ID"));
-			return res;
-		}
-
-		AttachmentType attachmentType = AttachmentType.getField(sign);
-
-		if (attachmentType == AttachmentType.DEMAND_PICTURE|| attachmentType == AttachmentType.DEMAND_COVER_PICTURE) {
-			res.setData(handleFiles(res, "/demand/", false, req, sign, uid));
-		} else {
-			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
-		}
-
-		return res;
-	}
-
-	/**
-	 * 需求资料--文本文件上传
-	 */
-	@RequestMapping(value = "/uploadTextFile", method = RequestMethod.POST)
-	public Result uploadTextFile(HttpServletRequest req, String sign, String uid) {
-		Result res = new Result();
-
-		if (StringUtils.isBlank(uid)) {
-			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户ID", "用户ID"));
-			return res;
-		}
-
-		AttachmentType attachmentType = AttachmentType.getField(sign);
-
-		if (attachmentType == AttachmentType.DEMAND_TEXT_FILE) {
-			res.setData(handleFiles(res, "/demand/", false, req, sign, uid));
-		} else {
-			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
-		}
-		return res;
-	}
-
-	/**
-	 * 需求撤消发布(下架)
-	 */
-	@RequestMapping(value = "/offShelf", method = RequestMethod.POST)
-	public Result offShelf(String id,Integer releaseStatus) {
-		Result res = new Result();
-		if (StringUtils.isBlank(id)) {
-			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到需求ID", "需求ID"));
-			return res;
-		}
-
-		Demand d = demandService.selectByPrimaryKey(id);
-
-		if (null == d) {
-			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "需求ID"));
-			return res;
-		}
-		d.setReleaseStatus(releaseStatus);
-		res.setData(demandService.updateReleaseStatus(d));
-		return res;
-	}
-
-	/**
-	 * 下载需求文件--文本文件
-	 */
-	@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;
-		}
-
-		downloadUnPrivateFile(response, d.getTextFileDownloadFileName(), d.getTextFileUrl());
-		return res;
-	}
-
-	/**
-	 * 我的需求列表
-	 */
-	@RequestMapping(value = "/myList", method = RequestMethod.GET)
-	public Result myList(String pageNo, String pageSize) {
-		Result res = new Result();
-		// res.setData(null) todo;
-		return res;
-	}
-	
-	/**
-     * 需求发布
-     */
-    @RequestMapping(value = "/addDemandPublish", method = RequestMethod.POST)
-    private Result addDemandPublish(DemandPublish d) {
-    	Result res = new Result();
-    	if (StringUtils.isBlank(d.getDemandId())) {
-            res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到需求", "需求"));
-            return res;
-        }
-        res.setData(demandPublishService.insertDemandPublish(d));     
-        return res;
-    }
-    /**
-     * 撤销发布
-     */
-    @RequestMapping(value = "/deletePublish", method = RequestMethod.GET)
-    private Result deletePublish(String id) {
-        Result res = new Result();
-        res.setData(demandPublishService.deletePublish(id));     
-        return res;
-    }
-    /**
-     * 修改发布
-     */
-    @RequestMapping(value = "/updatePublish", method = RequestMethod.GET)
-    private Result updatePublish(DemandPublish d) {
-        Result res = new Result();
-        res.setData(demandPublishService.updatePublish(d));     
-        return res;
-    }
-    
-    /**
-     * 发布列表
-     */
-    @RequestMapping(value = "/listPublish", method = RequestMethod.GET)
-    private Result listPublish(String name,String publishPlatform,Integer publishClient,String publishPage,
-    		Integer ifTop, Integer pageNo, Integer pageSize,String employerName) {
-        Result res = new Result();
-        if (null==pageNo) {
-			pageNo=1;
-		}
-        if (null==pageSize) {
-			pageSize=10;
-		}
-        res.setData(demandPublishService.listPublish( name, publishPlatform, publishClient, publishPage,
-        		 ifTop,  pageNo,  pageSize,employerName));     
-        return res;
-    }
-    /**
-     * 获取需求页面位置
-     */
-    @RequestMapping(value="/getPublishPage",method = RequestMethod.GET)
-    private Result getPublishPage(){
-    	Result res=new Result();
-    	return res.data(DemandPublishPageService.getBranchInformation());
-    }
-    /**
-     * 新增匹配跟进保存
-     */
-    @RequestMapping(value = "/addDemandFollow", method = RequestMethod.POST)
-    private Result addDemandFollow(DemandFollow d) {
-    	Result res = new Result();
-    	if (StringUtils.isBlank(d.getDemandId())) {
-            res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到需求", "需求"));
-            return res;
-        }
-    	if (StringUtils.isBlank(d.getContactMobile())) {
-            res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到联系人电话", "联系人电话"));
-            return res;
-        }
-    	if (StringUtils.isBlank(d.getContacts())) {
-            res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到联系人", "联系人"));
-            return res;
-        }
-    	if (StringUtils.isBlank(d.getOrganization())) {
-            res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到机构", "机构"));
-            return res;
-        }
-    	res.data(demandFollowService.insertDemandFollow(d));     
-        return res;
-    }
-    
-    /**
-     * 修改匹配跟进
-     */
-    @RequestMapping(value = "/updateDemandFollow", method = RequestMethod.POST)
-    private Result DemandFollow(DemandFollow d) {
-    	Result res = new Result();
-    	if (StringUtils.isBlank(d.getId())) {
-            res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到需求匹配", "匹配跟进"));
-            return res;
-        }
-    	res.setData(demandFollowService.updateDemandFollow(d));     
-        return res;
-    }
-    
-    /**
-     * 新增跟进情况
-     */
-    @RequestMapping(value = "/addDemandFollowDetail", method = RequestMethod.POST)
-    private Result addDemandFollowDetail(DemandFollowDetail d,String createTimeFormattedDate) {
-    	Result res = new Result();
-    	if (StringUtils.isBlank(d.getDemandFollowId())) {
-            res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到需求匹配跟进", "需求匹配跟进"));
-            return res;
-        }
-    	if (StringUtils.isBlank(d.getRemarks())) {
-            res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到跟进情况", "跟进情况"));
-            return res;
-        }
-    	if (null==d.getResult()) {
-            res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到跟进结果", "跟进结果"));
-            return res;
-        }
-    	if (StringUtils.isBlank(createTimeFormattedDate)) {
-            res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到跟进时间", "跟进时间"));
-            return res;
-        }
-    	res.data(demandFollowService.insertDemandFollowDetail(d,createTimeFormattedDate));     
-        return res;
-    }
-    
-    /**
-     * 跟进列表
-     */
-    @RequestMapping(value = "/listDemandFollow", method = RequestMethod.GET)
-    private Result listDemandFollow(String id,Integer pNo,Integer pSize) {
-    	Result res = new Result();
-    	if (StringUtils.isBlank(id)) {
-            res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到需求匹配跟进", "需求匹配跟进"));
-            return res;
-        }
-    	res.data(demandFollowService.selectDemandFollow( id, pNo, pSize));
-        return res;
-    }
-    
-    /**
-     * 删除跟进
-     */
-    @RequestMapping(value = "/deleteDemandFollow", method = RequestMethod.GET)
-    private Result deleteDemandFollow(String id) {
-    	Result res = new Result();
-    	if (StringUtils.isBlank(id)) {
-            res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到需求匹配跟进", "需求匹配跟进"));
-            return res;
-        }
-    	res.data(demandFollowService.deleteDemandFollow( id));
-        return res;
-    }
-    
-    /**
-     * 跟进情况列表
-     */
-    @RequestMapping(value = "/listDemandFollowDetail", method = RequestMethod.GET)
-    private Result listDemandFollowDetail(String id,Integer pNo, Integer pSize) {
-    	Result res = new Result();
-    	if (StringUtils.isBlank(id)) {
-            res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到需求跟进", "需求跟进"));
-            return res;
-        }
-    	res.data(demandFollowService.selectDemandFollowDetail( id,pNo,  pSize));
-        return res;
-    }
-    /**
-     * 匹配跟进
-     */
-    @RequestMapping(value = "/DemandFollowDetails", method = RequestMethod.GET)
-    private Result DemandFollowDetails(String id) {
-    	Result res = new Result();
-    	if (StringUtils.isBlank(id)) {
-            res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到需求跟进", "需求跟进"));
-            return res;
-        }
-    	res.data(demandService.DemandFollowDetails(id));
-        return res;
-    }
-}
+package com.goafanti.demand.controller;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+import com.goafanti.admin.service.AftFileService;
+import com.goafanti.common.bo.Result;
+import com.goafanti.common.constant.AFTConstants;
+import com.goafanti.common.constant.ErrorConstants;
+import com.goafanti.common.controller.CertifyApiController;
+import com.goafanti.common.enums.AttachmentType;
+import com.goafanti.common.enums.DeleteStatus;
+import com.goafanti.common.enums.DemandAuditStatus;
+import com.goafanti.common.model.AftFile;
+import com.goafanti.common.model.Demand;
+import com.goafanti.common.model.DemandPublish;
+import com.goafanti.common.utils.StringUtils;
+import com.goafanti.demand.service.DemandFollowService;
+import com.goafanti.demand.service.DemandOrderService;
+import com.goafanti.demand.service.DemandPublishPageService;
+import com.goafanti.demand.service.DemandPublishService;
+import com.goafanti.demand.service.DemandService;
+import com.goafanti.user.service.UserService;
+
+@RestController
+@RequestMapping(value = "/api/admin/demand")
+public class AdminDemandApiController extends CertifyApiController {
+	@Resource
+	private DemandService		demandService;
+	@Resource
+	private UserService			userService;
+	@Resource
+	private AftFileService		aftFileService;
+	@Resource
+	private DemandOrderService	demandOrderService;
+	@Resource
+	DemandPublishService	demandPublishService;
+	@Resource
+	DemandFollowService		demandFollowService;
+	/**
+	 * 科技需求匹配科技成果
+	 */
+	@RequestMapping(value = "/matchAchievement", method = RequestMethod.POST)
+	public Result matchAchievement(String id) {
+		Result res = new Result();
+		if (StringUtils.isBlank(id)) {
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到需求ID", "成果ID"));
+			return res;
+		}
+		Demand d = demandService.selectByPrimaryKey(id);
+		if (null == d|| !DeleteStatus.UNDELETE.getCode().equals(d.getDeletedSign())
+				|| !DemandAuditStatus.AUDITED.getCode().equals(d.getAuditStatus())) {
+			res.getError().add(buildError("", "当前状态无法匹配!"));
+			return res;
+		}
+		res.setData(demandService.updateMatchAchievement(d));
+		return res;
+	}
+
+	
+	/**
+	 * 下载技术需求批量导入Excel模板
+	 * 
+	 * @param response
+	 * @return
+	 */
+	@RequestMapping(value = "/downloadTemplate", method = RequestMethod.GET)
+	public Result downloadTemplateFile(HttpServletResponse response, String sign) {
+		Result res = new Result();
+		AttachmentType attachmentType = AttachmentType.getField(sign);
+		if (attachmentType == AttachmentType.DEMAND_TEMPLATE) {
+			String fileName = "";
+			AftFile af = aftFileService.selectAftFileBySign(sign);
+			if (null == af) {
+				res.getError().add(buildError(ErrorConstants.FILE_NON_EXISTENT, "", "找不到文件!"));
+			} else {
+				String path = af.getFilePath();
+				String suffix = path.substring(path.lastIndexOf("."));
+				fileName = AttachmentType.DEMAND_TEMPLATE.getDesc() + suffix;
+				downloadFile(response, fileName, path);
+			}
+		} else {
+			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
+		}
+		return res;
+	}
+
+	/**
+	 * 个人用户--需求列表
+	 */
+	@RequestMapping(value = "/userList", method = RequestMethod.GET)
+	public Result userList(String pageNo, String pageSize) {
+		Result res = new Result();
+		//res.setData(null); TODO
+		return res;
+	}
+
+	/**
+	 * 组织用户--需求列表(个人组织合并)
+	 */
+	@RequestMapping(value = "/orgList", method = RequestMethod.GET)
+	public Result orgList(String pageNo, String pageSize) {
+		Result res = new Result();
+		//res.setData(null); TODO
+		return res;
+	}
+
+	/**
+	 * 需求列表
+	 * @param pageNo
+	 * @param pageSize
+	 * @return
+	 */
+	@RequestMapping(value = "/list", method = RequestMethod.GET)
+	public Result list(String name,String employerName,Integer demandType,
+			Integer auditStatus,Integer status,String startDate, String endDate,Integer pageNo, Integer pageSize){
+		Result res = new Result();
+		res.setData(demandService.listDemand(name, employerName, demandType, auditStatus, status,startDate,endDate, pageNo, pageSize));
+		return res;
+	}
+	
+	/**
+	 * 个人需求详情
+	 */
+	@RequestMapping(value = "/userDemandDetail", method = RequestMethod.GET)
+	public Result userDemandDetail(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.selectUserDemandDetail(id));
+		return res;
+	}
+
+	/**
+	 * 组织用户详情(个人组织合并)
+	 */
+	@RequestMapping(value = "/orgDemandDetail", method = RequestMethod.GET)
+	public Result orgDemandDetail(String id,Integer dataCategory) {
+		Result res = new Result();
+
+		if (StringUtils.isBlank(id)) {
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到需求ID", "需求ID"));
+			return res;
+		}
+		if(dataCategory==0){
+			res.setData(demandService.selectUserDemandDetail(id));
+			return res;
+		}else if(dataCategory==1){
+			res.setData(demandService.selectOrgDemandDetail(id));
+			return res;
+		}
+		return res;
+	}
+	
+	/**
+	 * 需求详情
+	 * @param id
+	 * @return
+	 */
+	@RequestMapping(value = "/demandDetail", 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.selectDemandDetail(id));
+		return res;
+	}
+	
+	/**
+	 * 审核需求
+	 * @param id
+	 * @param auditResult
+	 * @return
+	 */
+	
+	@RequestMapping(value = "/auditDemand", method = RequestMethod.GET)
+	public Result auditDemand(String id, Integer auditResult,String auditInfo){
+		Result res = new Result();
+		if (StringUtils.isBlank(id)) {
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到需求ID", "需求ID"));
+			return res;
+		}
+		Demand d = demandService.selectByPrimaryKey(id);
+		if (null == d) {
+			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "需求ID"));
+			return res;
+		}
+		if(d.getAuditStatus() != DemandAuditStatus.INAUDIT.getCode()){
+			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "需求未达审核条件"));
+			return res;
+		}
+		if(AFTConstants.NO == auditResult && StringUtils.isBlank(auditInfo)){
+			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "需填写审核意见"));
+			return res;
+		}
+		if(AFTConstants.YES == auditResult || AFTConstants.NO == auditResult){
+			d.setAuditStatus(auditResult);
+		}
+		demandService.updateByPrimaryKeySelective(d);
+		return res;
+	}
+	
+	/**
+	 * 需求管理--获取个人用户下拉
+	 */
+	@RequestMapping(value = "/userNames", method = RequestMethod.GET)
+	public Result getUserNames() {
+		Result res = new Result();
+		res.setData(userService.selectDemandUserNames());
+		return res;
+	}
+
+	/**
+	 * 需求管理--获取组织用户下拉
+	 */
+	@RequestMapping(value = "/unitNames", method = RequestMethod.GET)
+	public Result getUnitNames() {
+		Result res = new Result();
+		res.setData(userService.selectDemandUnitNames());
+		return res;
+	}
+
+	/**
+	 * 需求资料--图片上传
+	 */
+	@RequestMapping(value = "/uploadPicture", method = RequestMethod.POST)
+	public Result uploadPicture(HttpServletRequest req, String sign, String uid) {
+		Result res = new Result();
+		if (StringUtils.isBlank(uid)) {
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户ID", "用户ID"));
+			return res;
+		}
+
+		AttachmentType attachmentType = AttachmentType.getField(sign);
+
+		if (attachmentType == AttachmentType.DEMAND_PICTURE|| attachmentType == AttachmentType.DEMAND_COVER_PICTURE) {
+			res.setData(handleFiles(res, "/demand/", false, req, sign, uid));
+		} else {
+			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
+		}
+
+		return res;
+	}
+
+	/**
+	 * 需求资料--文本文件上传
+	 */
+	@RequestMapping(value = "/uploadTextFile", method = RequestMethod.POST)
+	public Result uploadTextFile(HttpServletRequest req, String sign, String uid) {
+		Result res = new Result();
+
+		if (StringUtils.isBlank(uid)) {
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户ID", "用户ID"));
+			return res;
+		}
+
+		AttachmentType attachmentType = AttachmentType.getField(sign);
+
+		if (attachmentType == AttachmentType.DEMAND_TEXT_FILE) {
+			res.setData(handleFiles(res, "/demand/", false, req, sign, uid));
+		} else {
+			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
+		}
+		return res;
+	}
+
+	/**
+	 * 需求撤消发布(下架)
+	 */
+	@RequestMapping(value = "/offShelf", method = RequestMethod.POST)
+	public Result offShelf(String id,Integer releaseStatus) {
+		Result res = new Result();
+		if (StringUtils.isBlank(id)) {
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到需求ID", "需求ID"));
+			return res;
+		}
+
+		Demand d = demandService.selectByPrimaryKey(id);
+
+		if (null == d) {
+			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "需求ID"));
+			return res;
+		}
+		d.setReleaseStatus(releaseStatus);
+		res.setData(demandService.updateReleaseStatus(d));
+		return res;
+	}
+
+	/**
+	 * 下载需求文件--文本文件
+	 */
+	@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;
+		}
+
+		downloadUnPrivateFile(response, d.getTextFileDownloadFileName(), d.getTextFileUrl());
+		return res;
+	}
+
+	/**
+	 * 我的需求列表
+	 */
+	@RequestMapping(value = "/myList", method = RequestMethod.GET)
+	public Result myList(String pageNo, String pageSize) {
+		Result res = new Result();
+		// res.setData(null) todo;
+		return res;
+	}
+	
+	/**
+     * 需求发布
+     */
+    @RequestMapping(value = "/addDemandPublish", method = RequestMethod.POST)
+    private Result addDemandPublish(DemandPublish d) {
+    	Result res = new Result();
+    	if (StringUtils.isBlank(d.getDemandId())) {
+            res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到需求", "需求"));
+            return res;
+        }
+        res.setData(demandPublishService.insertDemandPublish(d));     
+        return res;
+    }
+    /**
+     * 撤销发布
+     */
+    @RequestMapping(value = "/deletePublish", method = RequestMethod.GET)
+    private Result deletePublish(String id) {
+        Result res = new Result();
+        res.setData(demandPublishService.deletePublish(id));     
+        return res;
+    }
+    /**
+     * 修改发布
+     */
+    @RequestMapping(value = "/updatePublish", method = RequestMethod.GET)
+    private Result updatePublish(DemandPublish d) {
+        Result res = new Result();
+        res.setData(demandPublishService.updatePublish(d));     
+        return res;
+    }
+    
+    /**
+     * 发布列表
+     */
+    @RequestMapping(value = "/listPublish", method = RequestMethod.GET)
+    private Result listPublish(String name,String publishPlatform,Integer publishClient,String publishPage,
+    		Integer ifTop, Integer pageNo, Integer pageSize,String employerName) {
+        Result res = new Result();
+        if (null==pageNo) {
+			pageNo=1;
+		}
+        if (null==pageSize) {
+			pageSize=10;
+		}
+        res.setData(demandPublishService.listPublish( name, publishPlatform, publishClient, publishPage,
+        		 ifTop,  pageNo,  pageSize,employerName));     
+        return res;
+    }
+    /**
+     * 获取需求页面位置
+     */
+    @RequestMapping(value="/getPublishPage",method = RequestMethod.GET)
+    private Result getPublishPage(){
+    	Result res=new Result();
+    	return res.data(DemandPublishPageService.getBranchInformation());
+    }
+   
+}

+ 370 - 341
src/main/java/com/goafanti/demand/controller/UserDemandApiController.java

@@ -1,341 +1,370 @@
-package com.goafanti.demand.controller;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import javax.annotation.Resource;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.validation.Valid;
-
-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.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
-
-import com.goafanti.admin.service.AftFileService;
-import com.goafanti.common.bo.Result;
-import com.goafanti.common.constant.AFTConstants;
-import com.goafanti.common.constant.ErrorConstants;
-import com.goafanti.common.constant.PageConstants;
-import com.goafanti.common.controller.CertifyApiController;
-import com.goafanti.common.enums.AttachmentType;
-import com.goafanti.common.enums.DemandAuditStatus;
-import com.goafanti.common.enums.DemandDataCategory;
-import com.goafanti.common.enums.DemandFields;
-import com.goafanti.common.enums.DemandOrderStatus;
-import com.goafanti.common.model.AftFile;
-import com.goafanti.common.model.Demand;
-import com.goafanti.common.model.DemandOrder;
-import com.goafanti.common.utils.StringUtils;
-import com.goafanti.core.shiro.token.TokenManager;
-import com.goafanti.demand.bo.InputDemand;
-import com.goafanti.demand.service.DemandOrderService;
-import com.goafanti.demand.service.DemandService;
-
-@RestController
-@RequestMapping(value = "/api/user/demand")
-public class UserDemandApiController extends CertifyApiController {
-	@Resource
-	private DemandService		demandService;
-	@Resource
-	private AftFileService		aftFileService;
-	@Resource
-	private DemandOrderService	demandOrderService;
-
-	/**
-	 * 成果需求匹配列表
-	 */
-	@RequestMapping(value = "/achievementDemand", method = RequestMethod.GET)
-	public Result achievementDemand(String id) {
-		Result res = new Result();
-		res.setData(demandService.selectAchievementDemandListByDemandId(id));
-		return res;
-	}
-
-	/**
-	 * 下载技术需求批量导入Excel模板
-	 */
-	@RequestMapping(value = "/downloadTemplate", method = RequestMethod.GET)
-	public Result downloadTemplateFile(HttpServletResponse response, String sign) {
-		Result res = new Result();
-		AttachmentType attachmentType = AttachmentType.getField(sign);
-		if (attachmentType == AttachmentType.DEMAND_TEMPLATE) {
-			String fileName = "";
-			AftFile af = aftFileService.selectAftFileBySign(sign);
-			if (null == af) {
-				res.getError().add(buildError(ErrorConstants.FILE_NON_EXISTENT, "", "找不到文件!"));
-			} else {
-				String path = af.getFilePath();
-				String suffix = path.substring(path.lastIndexOf("."));
-				fileName = AttachmentType.DEMAND_TEMPLATE.getDesc() + suffix;
-				downloadFile(response, fileName, path);
-			}
-		} else {
-			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
-		}
-		return res;
-	}
-
-	/**
-	 * 用户需求列表
-	 */
-	@RequestMapping(value = "/list", method = RequestMethod.GET)
-	public Result list(String pageNo, String pageSize) {
-		Result res = new Result();
-		// res.setData(); TODO
-		return res;
-	}
-
-	/**
-	 * 新增需求
-	 */
-	@RequestMapping(value = "/apply", method = RequestMethod.POST)
-	public Result userApply(@Valid InputDemand demand, BindingResult bindingResult,
-			@RequestParam(name = "keywords[]", required = false) String[] keywords,
-			@RequestParam(value = "publishPages[]", required = false)String[] publishPages,
-			String validityPeriodFormattedDate) {
-		Result res = new Result();
-		if (bindingResult.hasErrors()) {
-			res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
-					DemandFields.getFieldDesc(bindingResult.getFieldError().getField())));
-			return res;
-		}
-		res = disposeDemand(res, demand, keywords,publishPages);
-		if (!res.getError().isEmpty()) {
-			return res;
-		}
-		Demand d = new Demand();
-		BeanUtils.copyProperties(demand, d);
-		d.setEmployerId(TokenManager.getUserId());
-		List<String> webPages = new ArrayList<String>();
-		List<String> appPages = new ArrayList<String>();
-		PageConstants.putDemand(publishPages, webPages, appPages);
-		if(webPages.size()==0 && appPages.size() == 0){
-			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "页面参数错误"));
-		}
-		demandService.saveDemand(d, validityPeriodFormattedDate, keywords,webPages, appPages);
-		return res;
-	}
-
-	/**
-	 * 组织用户详情
-	 */
-	@RequestMapping(value = "/orgDemandDetail", method = RequestMethod.GET)
-	public Result orgDemandDetail(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.selectOrgDemandDetail(id));
-		return res;
-	}
-
-	/**
-	 * 个人需求详情
-	 */
-	@RequestMapping(value = "/userDemandDetail", method = RequestMethod.GET)
-	public Result userDemandDetail(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.selectUserDemandDetail(id));
-		return res;
-	}
-
-	/**
-	 * 修改需求
-	 */
-	@RequestMapping(value = "/update", method = RequestMethod.POST)
-	public Result updateUser(@Valid InputDemand demand, BindingResult bindingResult,
-			@RequestParam(name = "keywords[]", required = false) String[] keywords,
-			@RequestParam(value = "publishPages[]", required = false)  String[] publishPages,
-			String validityPeriodFormattedDate) {
-		Result res = new Result();
-		if (bindingResult.hasErrors()) {
-			res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
-					DemandFields.getFieldDesc(bindingResult.getFieldError().getField())));
-			return res;
-		}
-
-		if (StringUtils.isBlank(demand.getId())) {
-			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到需求ID", "需求ID"));
-			return res;
-		}
-
-		if (!DemandAuditStatus.CREATE.getCode().equals(demand.getAuditStatus())
-				&& !DemandAuditStatus.SUBMIT.getCode().equals(demand.getAuditStatus())
-				&& !DemandAuditStatus.UNAUDITED.getCode().equals(demand.getAuditStatus())) {
-			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "当前状态无法提交审核!"));
-			return res;
-		}
-
-		res = disposeDemand(res, demand, keywords,publishPages);
-		if (!res.getError().isEmpty()) {
-			return res;
-		}
-
-		Demand d = new Demand();
-		BeanUtils.copyProperties(demand, d);
-		d.setEmployerId(TokenManager.getUserId());
-		res.setData(demandService.updateUserDemand(d, validityPeriodFormattedDate, keywords, null));
-		return res;
-	}
-
-	/**
-	 * 需求撤消发布(下架)
-	 */
-	@RequestMapping(value = "/offShelf", method = RequestMethod.POST)
-	public Result offShelf(String id) {
-		Result res = new Result();
-		if (StringUtils.isBlank(id)) {
-			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到需求ID", "需求ID"));
-			return res;
-		}
-
-		Demand d = demandService.selectByPrimaryKey(id);
-
-		if (null == d) {
-			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "需求ID"));
-			return res;
-		}
-
-		res.setData(demandService.updateReleaseStatus(d));
-		return res;
-	}
-
-	/**
-	 * 删除需求(个人&团体)
-	 */
-	@RequestMapping(value = "/delete", method = RequestMethod.POST)
-	public Result delete(@RequestParam(name = "ids[]", required = false) String[] ids) {
-		Result res = new Result();
-		if (ids == null || ids.length != 1) {
-			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", ""));
-		} else {
-			List<DemandOrder> list = demandOrderService.selectDemandOrderByDemandId(ids[0]);
-			for (DemandOrder order : list){
-				if (!DemandOrderStatus.CREATE.getCode().equals(order.getStatus())){
-					res.getError().add(buildError("", "当前科技需求有订单,无法删除!"));
-					return res;
-				}
-			}
-			res.setData(demandService.deleteByPrimaryKey(Arrays.asList(ids)));
-		}
-		return res;
-	}
-
-	/**
-	 * 需求资料--图片上传
-	 */
-	@RequestMapping(value = "/uploadPicture", method = RequestMethod.POST)
-	public Result uploadPicture(HttpServletRequest req, String sign) {
-		Result res = new Result();
-
-		AttachmentType attachmentType = AttachmentType.getField(sign);
-
-		if (attachmentType == AttachmentType.DEMAND_PICTURE) {
-			res.setData(handleFiles(res, "/demand/", false, req, sign, TokenManager.getUserId()));
-		} else {
-			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
-		}
-
-		return res;
-	}
-
-	/**
-	 * 需求资料--文本文件上传
-	 */
-	@RequestMapping(value = "/uploadTextFile", method = RequestMethod.POST)
-	public Result uploadTextFile(HttpServletRequest req, String sign) {
-		Result res = new Result();
-
-		AttachmentType attachmentType = AttachmentType.getField(sign);
-
-		if (attachmentType == AttachmentType.DEMAND_TEXT_FILE) {
-			res.setData(handleFiles(res, "/demand/", false, req, sign, TokenManager.getUserId()));
-		} else {
-			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
-		}
-		return res;
-	}
-
-	/**
-	 * 下载需求文件--文本文件
-	 */
-	@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;
-		}
-
-		downloadUnPrivateFile(response, d.getTextFileDownloadFileName(), d.getTextFileUrl());
-		return res;
-	}
-
-	private Result disposeDemand(Result res, InputDemand demand, String[] keywords,String[] publishPages) {
-		if (StringUtils.isBlank(demand.getName())) {
-			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到需求名称", "需求名称"));
-			return res;
-		}
-
-		if (!DemandDataCategory.USERDEMAND.getCode().equals(demand.getDataCategory())
-				&& !DemandDataCategory.ORGDEMAND.getCode().equals(demand.getDataCategory())) {
-			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "数据类型"));
-			return res;
-		}
-
-		/*if (StringUtils.isBlank(demand.getKeyword())) {
-			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到关键词", "关键词"));
-			return res;
-		}
-
-		if (null == keywords || keywords.length < 1) {
-			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到关键词", "关键词"));
-			return res;
-		}*/
-
-		if (null == demand.getIndustryCategoryA()) {
-			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到行业类别", "行业类别"));
-			return res;
-		}
-
-		if (null == demand.getDemandType()) {
-			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到需求类型", "需求类型"));
-			return res;
-		}
-
-		if (StringUtils.isBlank(demand.getProblemDes())) {
-			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到问题说明", "问题说明"));
-			return res;
-		}
-
-		for (int i = 0; i < keywords.length; i++) {
-			if (AFTConstants.KEYWORDLENTH < keywords[i].length()) {
-				res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "关键词长度"));
-				return res;
-			}
-		}
-
-		return res;
-	}
-
-}
+package com.goafanti.demand.controller;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.validation.Valid;
+
+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.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import com.goafanti.admin.service.AftFileService;
+import com.goafanti.common.bo.Result;
+import com.goafanti.common.constant.AFTConstants;
+import com.goafanti.common.constant.ErrorConstants;
+import com.goafanti.common.constant.PageConstants;
+import com.goafanti.common.controller.CertifyApiController;
+import com.goafanti.common.enums.AttachmentType;
+import com.goafanti.common.enums.DemandAuditStatus;
+import com.goafanti.common.enums.DemandDataCategory;
+import com.goafanti.common.enums.DemandFields;
+import com.goafanti.common.enums.DemandOrderStatus;
+import com.goafanti.common.model.AftFile;
+import com.goafanti.common.model.Demand;
+import com.goafanti.common.model.DemandOrder;
+import com.goafanti.common.utils.StringUtils;
+import com.goafanti.core.shiro.token.TokenManager;
+import com.goafanti.demand.bo.InputDemand;
+import com.goafanti.demand.service.DemandOrderService;
+import com.goafanti.demand.service.DemandService;
+
+@RestController
+@RequestMapping(value = "/api/user/demand")
+public class UserDemandApiController extends CertifyApiController {
+	@Resource
+	private DemandService		demandService;
+	@Resource
+	private AftFileService		aftFileService;
+	@Resource
+	private DemandOrderService	demandOrderService;
+
+
+	/**
+	 * 下载技术需求批量导入Excel模板
+	 */
+	@RequestMapping(value = "/downloadTemplate", method = RequestMethod.GET)
+	public Result downloadTemplateFile(HttpServletResponse response, String sign) {
+		Result res = new Result();
+		AttachmentType attachmentType = AttachmentType.getField(sign);
+		if (attachmentType == AttachmentType.DEMAND_TEMPLATE) {
+			String fileName = "";
+			AftFile af = aftFileService.selectAftFileBySign(sign);
+			if (null == af) {
+				res.getError().add(buildError(ErrorConstants.FILE_NON_EXISTENT, "", "找不到文件!"));
+			} else {
+				String path = af.getFilePath();
+				String suffix = path.substring(path.lastIndexOf("."));
+				fileName = AttachmentType.DEMAND_TEMPLATE.getDesc() + suffix;
+				downloadFile(response, fileName, path);
+			}
+		} else {
+			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
+		}
+		return res;
+	}
+
+	/**
+	 * 用户需求列表
+	 */
+	@RequestMapping(value = "/list", method = RequestMethod.GET)
+	public Result list(String name,String startDate,String endDate,Integer pageNo, Integer pageSize) {
+		Result res = new Result();
+		res.setData(demandService.listMyDemand(name, startDate, endDate, pageNo, pageSize));
+		return res;
+	}
+
+	/**
+	 * 新增需求
+	 */
+	@RequestMapping(value = "/apply", method = RequestMethod.POST)
+	public Result userApply(@Valid InputDemand demand, BindingResult bindingResult,
+			@RequestParam(name = "keywords[]", required = false) String[] keywords,
+			@RequestParam(value = "publishPages[]", required = false)String[] publishPages,
+			String validityPeriodFormattedDate) {
+		Result res = new Result();
+		if (bindingResult.hasErrors()) {
+			res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
+					DemandFields.getFieldDesc(bindingResult.getFieldError().getField())));
+			return res;
+		}
+		res = disposeDemand(res, demand, keywords,publishPages);
+		if (!res.getError().isEmpty()) {
+			return res;
+		}
+		Demand d = new Demand();
+		BeanUtils.copyProperties(demand, d);
+		d.setEmployerId(TokenManager.getUserId());
+		List<String> webPages = new ArrayList<String>();
+		List<String> appPages = new ArrayList<String>();
+		PageConstants.putDemand(publishPages, webPages, appPages);
+		if(webPages.size()==0 && appPages.size() == 0){
+			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "页面参数错误"));
+			return res;
+		}
+		demandService.saveDemand(d, validityPeriodFormattedDate, keywords,webPages, appPages);
+		return res;
+	}
+
+	@RequestMapping(value = "/demandDetail", 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.selectDemandDetail(id));
+		return res;
+	}
+	
+	
+	/**
+	 * 组织用户详情
+	 */
+	@RequestMapping(value = "/orgDemandDetail", method = RequestMethod.GET)
+	public Result orgDemandDetail(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.selectOrgDemandDetail(id));
+		return res;
+	}
+
+	/**
+	 * 个人需求详情
+	 */
+	@RequestMapping(value = "/userDemandDetail", method = RequestMethod.GET)
+	public Result userDemandDetail(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.selectUserDemandDetail(id));
+		return res;
+	}
+
+	/**
+	 * 修改需求
+	 */
+	@RequestMapping(value = "/updateDemand", method = RequestMethod.POST)
+	public Result updateDemand(@Valid InputDemand demand, BindingResult bindingResult,
+			@RequestParam(name = "keywords[]", required = false) String[] keywords,
+			@RequestParam(value = "publishPages[]", required = false)  String[] publishPages,
+			String validityPeriodFormattedDate) {
+		Result res = new Result();
+		if (bindingResult.hasErrors()) {
+			res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
+					DemandFields.getFieldDesc(bindingResult.getFieldError().getField())));
+			return res;
+		}
+		if (StringUtils.isBlank(demand.getId())) {
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到需求ID", "需求ID"));
+			return res;
+		}
+		if (!DemandAuditStatus.CREATE.getCode().equals(demand.getAuditStatus())
+				&& !DemandAuditStatus.UNAUDITED.getCode().equals(demand.getAuditStatus())
+				&& !DemandAuditStatus.REVOKE.getCode().equals(demand.getAuditStatus())) {
+			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "当前状态无法提交审核!"));
+			return res;
+		}
+		//demand.setAuditStatus(DemandAuditStatus.INAUDIT.getCode()); 两步操作,先保存后提交
+		res = disposeDemand(res, demand, keywords,publishPages);
+		if (!res.getError().isEmpty()) {
+			return res;
+		}
+		List<String> webPages = new ArrayList<String>();
+		List<String> appPages = new ArrayList<String>();
+		PageConstants.putDemand(publishPages, webPages, appPages);
+		if(webPages.size()==0 && appPages.size() == 0){
+			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "页面参数错误"));
+			return res;
+		}
+		Demand d = new Demand();
+		BeanUtils.copyProperties(demand, d);
+		d.setEmployerId(TokenManager.getUserId());
+		res.setData(demandService.updateUserDemand(d, validityPeriodFormattedDate, keywords, webPages,appPages));
+		return res;
+	}
+	
+	@RequestMapping(value = "/publishDemand", method = RequestMethod.POST)
+	public Result publishDemand(String id,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.CREATE.getCode() != auditStatus
+				&& DemandAuditStatus.UNAUDITED.getCode() != auditStatus
+				&& DemandAuditStatus.REVOKE.getCode() != auditStatus) {
+			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "当前状态无法提交审核!"));
+			return res;
+		}
+		Demand d = new Demand();
+		d.setId(id);
+		d.setAuditStatus(DemandAuditStatus.INAUDIT.getCode());
+		demandService.updateByPrimaryKeySelective(d);
+		return res;
+	}
+	
+	/**
+	 * 需求撤消发布(下架)
+	 */
+	@RequestMapping(value = "/offShelf", method = RequestMethod.POST)
+	public Result offShelf(String id) {
+		Result res = new Result();
+		if (StringUtils.isBlank(id)) {
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到需求ID", "需求ID"));
+			return res;
+		}
+		Demand d = demandService.selectByPrimaryKey(id);
+		if (null == d) {
+			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "需求ID"));
+			return res;
+		}
+		res.setData(demandService.updateReleaseStatus(d));
+		return res;
+	}
+
+	/**
+	 * 删除需求(个人&团体)
+	 */
+	@RequestMapping(value = "/delete", method = RequestMethod.POST)
+	public Result delete(@RequestParam(name = "ids[]", required = false) String[] ids) {
+		Result res = new Result();
+		if (ids == null || ids.length != 1) {
+			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", ""));
+		} else {
+			List<DemandOrder> list = demandOrderService.selectDemandOrderByDemandId(ids[0]);
+			for (DemandOrder order : list){
+				if (!DemandOrderStatus.CREATE.getCode().equals(order.getStatus())){
+					res.getError().add(buildError("", "当前科技需求有订单,无法删除!"));
+					return res;
+				}
+			}
+			res.setData(demandService.deleteByPrimaryKey(Arrays.asList(ids)));
+		}
+		return res;
+	}
+
+	/**
+	 * 需求资料--图片上传
+	 */
+	@RequestMapping(value = "/uploadPicture", method = RequestMethod.POST)
+	public Result uploadPicture(HttpServletRequest req, String sign) {
+		Result res = new Result();
+
+		AttachmentType attachmentType = AttachmentType.getField(sign);
+
+		if (attachmentType == AttachmentType.DEMAND_PICTURE) {
+			res.setData(handleFiles(res, "/demand/", false, req, sign, TokenManager.getUserId()));
+		} else {
+			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
+		}
+
+		return res;
+	}
+
+	/**
+	 * 需求资料--文本文件上传
+	 */
+	@RequestMapping(value = "/uploadTextFile", method = RequestMethod.POST)
+	public Result uploadTextFile(HttpServletRequest req, String sign) {
+		Result res = new Result();
+
+		AttachmentType attachmentType = AttachmentType.getField(sign);
+
+		if (attachmentType == AttachmentType.DEMAND_TEXT_FILE) {
+			res.setData(handleFiles(res, "/demand/", false, req, sign, TokenManager.getUserId()));
+		} else {
+			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
+		}
+		return res;
+	}
+
+	/**
+	 * 下载需求文件--文本文件
+	 */
+	@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;
+		}
+
+		downloadUnPrivateFile(response, d.getTextFileDownloadFileName(), d.getTextFileUrl());
+		return res;
+	}
+
+	private Result disposeDemand(Result res, InputDemand demand, String[] keywords,String[] publishPages) {
+		if (StringUtils.isBlank(demand.getName())) {
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到需求名称", "需求名称"));
+			return res;
+		}
+
+		if (!DemandDataCategory.USERDEMAND.getCode().equals(demand.getDataCategory())
+				&& !DemandDataCategory.ORGDEMAND.getCode().equals(demand.getDataCategory())) {
+			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "数据类型"));
+			return res;
+		}
+
+		/*if (StringUtils.isBlank(demand.getKeyword())) {
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到关键词", "关键词"));
+			return res;
+		}
+
+		if (null == keywords || keywords.length < 1) {
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到关键词", "关键词"));
+			return res;
+		}*/
+
+		if (null == demand.getIndustryCategoryA()) {
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到行业类别", "行业类别"));
+			return res;
+		}
+
+		if (null == demand.getDemandType()) {
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到需求类型", "需求类型"));
+			return res;
+		}
+
+		if (StringUtils.isBlank(demand.getProblemDes())) {
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到问题说明", "问题说明"));
+			return res;
+		}
+
+		for (int i = 0; i < keywords.length; i++) {
+			if (AFTConstants.KEYWORDLENTH < keywords[i].length()) {
+				res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "关键词长度"));
+				return res;
+			}
+		}
+
+		return res;
+	}
+
+}

+ 12 - 22
src/main/java/com/goafanti/demand/service/DemandService.java

@@ -2,30 +2,28 @@ package com.goafanti.demand.service;
 
 import java.util.List;
 
-import com.goafanti.achievement.bo.AchievementDemandListBo;
 import com.goafanti.common.model.Demand;
 import com.goafanti.core.mybatis.page.Pagination;
+import com.goafanti.demand.bo.DemandDetailBo;
 import com.goafanti.demand.bo.DemandImportBo;
 import com.goafanti.demand.bo.DemandListBo;
-import com.goafanti.demand.bo.DemandManageDetailBo;
-import com.goafanti.demand.bo.DemandPartnerListBo;
 import com.goafanti.demand.bo.ObjectInterestListBo;
-import com.goafanti.portal.bo.DemandPortalDetailBo;
-import com.goafanti.portal.bo.DemandPortalSimilarListBo;
 import com.goafanti.portal.bo.DemandSearchDetailBo;
 import com.goafanti.portal.bo.DemandSearchListBo;
 
 public interface DemandService {
+	Pagination<DemandListBo> listMyDemand(String name,String startDate,String endDate,Integer pageNo, Integer pageSize);
+	
+	Pagination<DemandListBo> listDemand(String name,String employerName,Integer demandType, 
+			Integer auditStatus,Integer status,String startDate, String endDate,Integer pageNo, Integer pageSize);
+	
+	int updateUserDemand(Demand d, String validityPeriodFormattedDate, String[] keywords,List<String> webPages,List<String> appPages);
 
-	void saveUserDemand(Demand d, String validityPeriodFormattedDate, String[] keywords);
-
-	int updateUserDemand(Demand d, String validityPeriodFormattedDate, String[] keywords, Integer switchSign);
-
-	DemandManageDetailBo selectUserDemandDetail(String id);
+	DemandDetailBo selectUserDemandDetail(String id);
 
 	int deleteByPrimaryKey(List<String> asList);
 
-	DemandManageDetailBo selectOrgDemandDetail(String id);
+	DemandDetailBo selectOrgDemandDetail(String id);
 
 	Demand selectByPrimaryKey(String id);
 
@@ -35,25 +33,15 @@ public interface DemandService {
 
 	void saveDemand(Demand d, String validityPeriodFormattedDate, String keywords[],List<String> webPages, List<String> appPages);
 
-	List<AchievementDemandListBo> selectAchievementDemandListByDemandId(String id);
-
 	void insertImport(List<DemandImportBo> data);
 
 	DemandSearchDetailBo selectDemandSearchDetail(String uid, String id);
 
 	int updateMatchAchievement(Demand d);
 
-	Pagination<DemandPartnerListBo> lisePartnerDemand(String employerId, Integer pNo, Integer pSize);
-
-	DemandPortalDetailBo findUserPortalDemandDetail(String id);
-
-	DemandPortalDetailBo findOrgPortalDemandDetail(String id);
-
-	List<DemandPortalSimilarListBo> findByIndustryCategoryA(Integer industryCategoryA, String id);
-
 	int updateByPrimaryKeySelective(Demand d);
 	
-	DemandListBo selectDemandDetail( String id);
+	DemandListBo selectAppDemandDetail( String id);
 	
 	Pagination<DemandSearchListBo> listAppDemand(Integer auditStatus, Integer serialNumber, String name, String keyword, Integer demandType,Integer industryCategoryA,
 			String validityPeriodStartDate, String validityPeriodEndDate, Integer status, Integer releaseStatus,
@@ -90,4 +78,6 @@ public interface DemandService {
 	
 	List<DemandListBo>getBoutiqueDemandList(int i,String pattern);
 	
+	DemandDetailBo selectDemandDetail(String id);
+	
 }

Plik diff jest za duży
+ 880 - 932
src/main/java/com/goafanti/demand/service/impl/DemandServiceImpl.java