Antiloveg лет назад: 9
Родитель
Сommit
32b8adcc43
22 измененных файлов с 864 добавлено и 131 удалено
  1. 15 0
      schema/2017-05-24.sql
  2. 55 25
      src/main/java/com/goafanti/achievement/bo/AchievementListBo.java
  3. 48 0
      src/main/java/com/goafanti/achievement/bo/AchievementOrgOwnerDetailBo.java
  4. 65 0
      src/main/java/com/goafanti/achievement/bo/AchievementUserOwnerDetailBo.java
  5. 33 27
      src/main/java/com/goafanti/achievement/controller/AchievementApiController.java
  6. 12 4
      src/main/java/com/goafanti/achievement/service/AchievementService.java
  7. 66 18
      src/main/java/com/goafanti/achievement/service/impl/AchievementServiceImpl.java
  8. 51 22
      src/main/java/com/goafanti/admin/controller/AdminAchievementApiController.java
  9. 12 5
      src/main/java/com/goafanti/admin/controller/AdminDemandApiController.java
  10. 25 0
      src/main/java/com/goafanti/common/dao/AchievementKeywordMapper.java
  11. 3 0
      src/main/java/com/goafanti/common/dao/AchievementMapper.java
  12. 25 0
      src/main/java/com/goafanti/common/dao/DemandKeywordMapper.java
  13. 93 0
      src/main/java/com/goafanti/common/mapper/AchievementKeywordMapper.xml
  14. 126 12
      src/main/java/com/goafanti/common/mapper/AchievementMapper.xml
  15. 92 0
      src/main/java/com/goafanti/common/mapper/DemandKeywordMapper.xml
  16. 39 0
      src/main/java/com/goafanti/common/model/AchievementKeyword.java
  17. 39 0
      src/main/java/com/goafanti/common/model/DemandKeyword.java
  18. 12 5
      src/main/java/com/goafanti/demand/controller/DemandApiController.java
  19. 5 0
      src/main/java/com/goafanti/demand/service/DemandKeywordService.java
  20. 3 3
      src/main/java/com/goafanti/demand/service/DemandService.java
  21. 11 0
      src/main/java/com/goafanti/demand/service/impl/DemandKeywordServiceImpl.java
  22. 34 10
      src/main/java/com/goafanti/demand/service/impl/DemandServiceImpl.java

+ 15 - 0
schema/2017-05-24.sql

@@ -0,0 +1,15 @@
+CREATE TABLE `demand_keyword` (
+  `id` VARCHAR(36) NOT NULL,
+  `demand_id` VARCHAR(36) NOT NULL COMMENT '科技需求ID',
+  `keyword` VARCHAR(16) NOT NULL COMMENT '关键词',
+  PRIMARY KEY (`id`))
+ENGINE = InnoDB
+COMMENT = '科技需求关键词'
+
+CREATE TABLE `achievement_keyword` (
+  `id` VARCHAR(36) NOT NULL,
+  `achievement_id` VARCHAR(36) NOT NULL COMMENT '科技成果ID',
+  `keyword` VARCHAR(36) NOT NULL COMMENT '科技成果关键词',
+  PRIMARY KEY (`id`))
+ENGINE = InnoDB
+COMMENT = '科技成果关键词'

+ 55 - 25
src/main/java/com/goafanti/achievement/bo/AchievementListBo.java

@@ -36,6 +36,11 @@ public class AchievementListBo {
 	 * 类型(0--专利, 2--软著, 3--项目, 4--版权, 5--工业设计, 6--配方, 7--非标)
 	 * 类型(0--专利, 2--软著, 3--项目, 4--版权, 5--工业设计, 6--配方, 7--非标)
 	 */
 	 */
 	private Integer	category;
 	private Integer	category;
+	
+	/**
+	 * 成果所有人ID
+	 */
+	private String ownerId;
 
 
 	/**
 	/**
 	 * 成果所有人名称
 	 * 成果所有人名称
@@ -47,15 +52,6 @@ public class AchievementListBo {
 	 */
 	 */
 	private Integer	ownerType;
 	private Integer	ownerType;
 
 
-	/**
-	 * 所有人联系电话
-	 */
-	private String	ownerMobile;
-
-	/**
-	 * 状态
-	 */
-	private Integer	status;
 
 
 
 
 	/**
 	/**
@@ -72,6 +68,46 @@ public class AchievementListBo {
 	 * 技术经纪人
 	 * 技术经纪人
 	 */
 	 */
 	private String techBrokerId;
 	private String techBrokerId;
+	
+	/**
+	 * 认证所有人名称
+	 */
+	private String username;
+	
+	/**
+	 * 所属组织ID
+	 */
+	private String orgId;
+	
+	/**
+	 * 所属组织联系方式
+	 */
+	private Integer contacts;
+	
+	public String getOrgId() {
+		return orgId;
+	}
+
+	public void setOrgId(String orgId) {
+		this.orgId = orgId;
+	}
+	
+	@JsonFormat(shape = Shape.STRING)
+	public Integer getContacts() {
+		return contacts;
+	}
+
+	public void setContacts(Integer contacts) {
+		this.contacts = contacts;
+	}
+
+	public String getUsername() {
+		return username;
+	}
+
+	public void setUsername(String username) {
+		this.username = username;
+	}
 
 
 	public String getId() {
 	public String getId() {
 		return id;
 		return id;
@@ -140,22 +176,6 @@ public class AchievementListBo {
 		this.ownerType = ownerType;
 		this.ownerType = ownerType;
 	}
 	}
 
 
-	public String getOwnerMobile() {
-		return ownerMobile;
-	}
-
-	public void setOwnerMobile(String ownerMobile) {
-		this.ownerMobile = ownerMobile;
-	}
-	
-	@JsonFormat(shape = Shape.STRING)
-	public Integer getStatus() {
-		return status;
-	}
-
-	public void setStatus(Integer status) {
-		this.status = status;
-	}
 
 
 	public Date getReleaseDate() {
 	public Date getReleaseDate() {
 		return releaseDate;
 		return releaseDate;
@@ -181,6 +201,16 @@ public class AchievementListBo {
 	public void setTechBrokerId(String techBrokerId) {
 	public void setTechBrokerId(String techBrokerId) {
 		this.techBrokerId = techBrokerId;
 		this.techBrokerId = techBrokerId;
 	}
 	}
+	
+	
+
+	public String getOwnerId() {
+		return ownerId;
+	}
+
+	public void setOwnerId(String ownerId) {
+		this.ownerId = ownerId;
+	}
 
 
 	public String getReleaseDateFormattedDate() {
 	public String getReleaseDateFormattedDate() {
 		if (this.releaseDate == null) {
 		if (this.releaseDate == null) {

+ 48 - 0
src/main/java/com/goafanti/achievement/bo/AchievementOrgOwnerDetailBo.java

@@ -0,0 +1,48 @@
+package com.goafanti.achievement.bo;
+
+import com.goafanti.common.model.Achievement;
+
+public class AchievementOrgOwnerDetailBo extends Achievement {
+	private String	iOwnerName;
+
+	private String	iOwnerIdNumber;
+
+	private String	iOwnerMobile;
+
+	private String	iOwnerEmail;
+
+	public String getiOwnerName() {
+		return iOwnerName;
+	}
+
+	public void setiOwnerName(String iOwnerName) {
+		this.iOwnerName = iOwnerName;
+	}
+
+	public String getiOwnerIdNumber() {
+		return iOwnerIdNumber;
+	}
+
+	public void setiOwnerIdNumber(String iOwnerIdNumber) {
+		this.iOwnerIdNumber = iOwnerIdNumber;
+	}
+
+	public String getiOwnerMobile() {
+		return iOwnerMobile;
+	}
+
+	public void setiOwnerMobile(String iOwnerMobile) {
+		this.iOwnerMobile = iOwnerMobile;
+	}
+
+	public String getiOwnerEmail() {
+		return iOwnerEmail;
+	}
+
+	public void setiOwnerEmail(String iOwnerEmail) {
+		this.iOwnerEmail = iOwnerEmail;
+	}
+	
+	
+
+}

+ 65 - 0
src/main/java/com/goafanti/achievement/bo/AchievementUserOwnerDetailBo.java

@@ -0,0 +1,65 @@
+package com.goafanti.achievement.bo;
+
+public class AchievementUserOwnerDetailBo extends AchievementOrgOwnerDetailBo {
+	
+	private String iOrgName;
+	
+	private String iOrgAddress;
+	
+	private String iOrgEmail;
+	
+	private String province;
+	
+	private String city;
+	
+	private String area;
+
+	public String getiOrgName() {
+		return iOrgName;
+	}
+
+	public void setiOrgName(String iOrgName) {
+		this.iOrgName = iOrgName;
+	}
+
+	public String getiOrgAddress() {
+		return iOrgAddress;
+	}
+
+	public void setiOrgAddress(String iOrgAddress) {
+		this.iOrgAddress = iOrgAddress;
+	}
+
+	public String getiOrgEmail() {
+		return iOrgEmail;
+	}
+
+	public void setiOrgEmail(String iOrgEmail) {
+		this.iOrgEmail = iOrgEmail;
+	}
+
+	public String getProvince() {
+		return province;
+	}
+
+	public void setProvince(String province) {
+		this.province = province;
+	}
+
+	public String getCity() {
+		return city;
+	}
+
+	public void setCity(String city) {
+		this.city = city;
+	}
+
+	public String getArea() {
+		return area;
+	}
+
+	public void setArea(String area) {
+		this.area = area;
+	}
+	
+}

+ 33 - 27
src/main/java/com/goafanti/achievement/controller/AchievementApiController.java

@@ -28,10 +28,10 @@ import com.goafanti.core.shiro.token.TokenManager;
 
 
 @RestController
 @RestController
 @RequestMapping(value = "/api/user/achievement")
 @RequestMapping(value = "/api/user/achievement")
-public class AchievementApiController extends CertifyApiController{
+public class AchievementApiController extends CertifyApiController {
 	@Resource
 	@Resource
 	private AchievementService achievementService;
 	private AchievementService achievementService;
-	
+
 	/**
 	/**
 	 * 成果撤消发布(下架)
 	 * 成果撤消发布(下架)
 	 */
 	 */
@@ -53,14 +53,14 @@ public class AchievementApiController extends CertifyApiController{
 		res.setData(achievementService.updateReleaseStatus(a));
 		res.setData(achievementService.updateReleaseStatus(a));
 		return res;
 		return res;
 	}
 	}
-	
+
 	/**
 	/**
 	 * 成果列表
 	 * 成果列表
 	 */
 	 */
 	@RequestMapping(value = "/list", method = RequestMethod.GET)
 	@RequestMapping(value = "/list", method = RequestMethod.GET)
-	private Result list(Integer auditStatus, Integer serialNumber, String name, String keyword, Integer category, Integer ownerType,
-			Integer status, String releaseDateStartDate, String releaseDateEndDate, Integer releaseStatus,
-			String pageNo, String pageSize) {
+	private Result list(Integer auditStatus, Integer serialNumber, String name, String keyword, Integer category,
+			Integer ownerType, Integer status, String releaseDateStartDate, String releaseDateEndDate,
+			Integer releaseStatus, String pageNo, String pageSize) {
 		Result res = new Result();
 		Result res = new Result();
 		Integer pNo = 1;
 		Integer pNo = 1;
 		Integer pSize = 10;
 		Integer pSize = 10;
@@ -71,16 +71,17 @@ public class AchievementApiController extends CertifyApiController{
 		if (StringUtils.isNumeric(pageNo)) {
 		if (StringUtils.isNumeric(pageNo)) {
 			pNo = Integer.parseInt(pageNo);
 			pNo = Integer.parseInt(pageNo);
 		}
 		}
-		res.setData(achievementService.listUserAchievement(auditStatus, serialNumber, name, keyword, category, ownerType, status,
-				releaseDateStartDate, releaseDateEndDate, releaseStatus, pNo, pSize));
+		res.setData(achievementService.listUserAchievement(auditStatus, serialNumber, name, keyword, category,
+				ownerType, status, releaseDateStartDate, releaseDateEndDate, releaseStatus, pNo, pSize));
 		return res;
 		return res;
 	}
 	}
-	
+
 	/**
 	/**
 	 * 新增成果
 	 * 新增成果
 	 */
 	 */
 	@RequestMapping(value = "/apply", method = RequestMethod.POST)
 	@RequestMapping(value = "/apply", method = RequestMethod.POST)
-	private Result apply(@Valid InputAchievement ia, BindingResult bindingResult) {
+	private Result apply(@Valid InputAchievement ia, BindingResult bindingResult,
+			@RequestParam(name = "keywords[]", required = false) String[] keywords) {
 		Result res = new Result();
 		Result res = new Result();
 
 
 		if (bindingResult.hasErrors()) {
 		if (bindingResult.hasErrors()) {
@@ -89,7 +90,7 @@ public class AchievementApiController extends CertifyApiController{
 			return res;
 			return res;
 		}
 		}
 
 
-		res = disposeInputAchievement(res, ia);
+		res = disposeInputAchievement(res, ia, keywords);
 		if (!res.getError().isEmpty()) {
 		if (!res.getError().isEmpty()) {
 			return res;
 			return res;
 		}
 		}
@@ -97,10 +98,10 @@ public class AchievementApiController extends CertifyApiController{
 		Achievement a = new Achievement();
 		Achievement a = new Achievement();
 		BeanUtils.copyProperties(ia, a);
 		BeanUtils.copyProperties(ia, a);
 		a.setOwnerId(TokenManager.getUserId());
 		a.setOwnerId(TokenManager.getUserId());
-		achievementService.saveAchievement(a);
+		achievementService.saveAchievement(a, keywords);
 		return res;
 		return res;
 	}
 	}
-	
+
 	/**
 	/**
 	 * 详情
 	 * 详情
 	 */
 	 */
@@ -114,12 +115,13 @@ public class AchievementApiController extends CertifyApiController{
 		res.setData(achievementService.selectByPrimaryKey(id));
 		res.setData(achievementService.selectByPrimaryKey(id));
 		return res;
 		return res;
 	}
 	}
-	
+
 	/**
 	/**
 	 * 修改成果
 	 * 修改成果
 	 */
 	 */
 	@RequestMapping(value = "/update", method = RequestMethod.POST)
 	@RequestMapping(value = "/update", method = RequestMethod.POST)
-	public Result update(@Valid InputAchievement ia, BindingResult bindingResult) {
+	public Result update(@Valid InputAchievement ia, BindingResult bindingResult,
+			@RequestParam(name = "keywords[]", required = false) String[] keywords) {
 		Result res = new Result();
 		Result res = new Result();
 		if (bindingResult.hasErrors()) {
 		if (bindingResult.hasErrors()) {
 			res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
 			res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
@@ -131,25 +133,25 @@ public class AchievementApiController extends CertifyApiController{
 			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到成果ID", "成果ID"));
 			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到成果ID", "成果ID"));
 			return res;
 			return res;
 		}
 		}
-		
+
 		if (!AchievementAuditStatus.CREATE.getCode().equals(ia.getAuditStatus())
 		if (!AchievementAuditStatus.CREATE.getCode().equals(ia.getAuditStatus())
 				&& !AchievementAuditStatus.SUBMIT.getCode().equals(ia.getAuditStatus())
 				&& !AchievementAuditStatus.SUBMIT.getCode().equals(ia.getAuditStatus())
 				&& !AchievementAuditStatus.UNAUDITED.getCode().equals(ia.getAuditStatus())) {
 				&& !AchievementAuditStatus.UNAUDITED.getCode().equals(ia.getAuditStatus())) {
 			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "当前状态无法提交审核!"));
 			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "当前状态无法提交审核!"));
 			return res;
 			return res;
 		}
 		}
-		
-		res = disposeInputAchievement(res, ia);
+
+		res = disposeInputAchievement(res, ia, keywords);
 		if (!res.getError().isEmpty()) {
 		if (!res.getError().isEmpty()) {
 			return res;
 			return res;
 		}
 		}
 
 
 		Achievement a = new Achievement();
 		Achievement a = new Achievement();
 		BeanUtils.copyProperties(ia, a);
 		BeanUtils.copyProperties(ia, a);
-		achievementService.updateAchievement(a);
+		achievementService.updateAchievement(a, keywords);
 		return res;
 		return res;
 	}
 	}
-	
+
 	/**
 	/**
 	 * 下载文本文件
 	 * 下载文本文件
 	 */
 	 */
@@ -167,14 +169,14 @@ public class AchievementApiController extends CertifyApiController{
 			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "科技成果ID"));
 			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "科技成果ID"));
 			return res;
 			return res;
 		}
 		}
-		
-		if (TokenManager.getUserId().equals(a.getOwnerId())){
+
+		if (TokenManager.getUserId().equals(a.getOwnerId())) {
 			AttachmentType attachmentType = AttachmentType.getField(sign);
 			AttachmentType attachmentType = AttachmentType.getField(sign);
 			if (attachmentType == AttachmentType.ACHIEVEMENT_MATURITY_TEXT_FILE) {
 			if (attachmentType == AttachmentType.ACHIEVEMENT_MATURITY_TEXT_FILE) {
 				downloadUnPrivateFile(response, a.getMaturityTextFileDownloadFileName(), a.getMaturityTextFileUrl());
 				downloadUnPrivateFile(response, a.getMaturityTextFileDownloadFileName(), a.getMaturityTextFileUrl());
-			} else if (attachmentType == AttachmentType.ACHIEVEMENT_TECH_PLAN){
+			} else if (attachmentType == AttachmentType.ACHIEVEMENT_TECH_PLAN) {
 				downloadUnPrivateFile(response, a.getTechPlanDownloadFileName(), a.getTechPlanUrl());
 				downloadUnPrivateFile(response, a.getTechPlanDownloadFileName(), a.getTechPlanUrl());
-			} else if (attachmentType == AttachmentType.ACHIEVEMENT_BUSINESS_PLAN){
+			} else if (attachmentType == AttachmentType.ACHIEVEMENT_BUSINESS_PLAN) {
 				downloadUnPrivateFile(response, a.getBusinessPlanDownloadFileName(), a.getBusinessPlanUrl());
 				downloadUnPrivateFile(response, a.getBusinessPlanDownloadFileName(), a.getBusinessPlanUrl());
 			} else {
 			} else {
 				res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
 				res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
@@ -184,7 +186,6 @@ public class AchievementApiController extends CertifyApiController{
 			return res;
 			return res;
 		}
 		}
 
 
-		
 		return res;
 		return res;
 	}
 	}
 
 
@@ -239,8 +240,8 @@ public class AchievementApiController extends CertifyApiController{
 		}
 		}
 		return res;
 		return res;
 	}
 	}
-	
-	private Result disposeInputAchievement(Result res, InputAchievement ia) {
+
+	private Result disposeInputAchievement(Result res, InputAchievement ia, String[] keywords) {
 		if (StringUtils.isBlank(ia.getName())) {
 		if (StringUtils.isBlank(ia.getName())) {
 			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到成果名称", "成果名称"));
 			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到成果名称", "成果名称"));
 			return res;
 			return res;
@@ -256,6 +257,11 @@ public class AchievementApiController extends CertifyApiController{
 			return res;
 			return res;
 		}
 		}
 
 
+		if (null == keywords || keywords.length < 1) {
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到关键词", "关键词"));
+			return res;
+		}
+
 		if (StringUtils.isBlank(ia.getOwnerName())) {
 		if (StringUtils.isBlank(ia.getOwnerName())) {
 			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到成果所有人名称", "成果所有人名称"));
 			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到成果所有人名称", "成果所有人名称"));
 			return res;
 			return res;

+ 12 - 4
src/main/java/com/goafanti/achievement/service/AchievementService.java

@@ -3,18 +3,19 @@ package com.goafanti.achievement.service;
 import java.util.List;
 import java.util.List;
 
 
 import com.goafanti.achievement.bo.AchievementListBo;
 import com.goafanti.achievement.bo.AchievementListBo;
+import com.goafanti.achievement.bo.AchievementUserOwnerDetailBo;
 import com.goafanti.common.model.Achievement;
 import com.goafanti.common.model.Achievement;
 import com.goafanti.core.mybatis.page.Pagination;
 import com.goafanti.core.mybatis.page.Pagination;
 
 
 public interface AchievementService {
 public interface AchievementService {
 
 
-	Pagination<AchievementListBo> listAchievement(Integer auditStatus, Integer serialNumber, String name, String keyword, Integer category,
-			Integer ownerType, Integer status, String releaseDateStartDate,
+	Pagination<AchievementListBo> listUserOwnerAchievement(String ownerId, Integer auditStatus, Integer serialNumber, String name, String keyword, Integer category,
+			Integer status, String releaseDateStartDate,
 			String releaseDateEndDate, Integer releaseStatus, Integer pNo, Integer pSize);
 			String releaseDateEndDate, Integer releaseStatus, Integer pNo, Integer pSize);
 
 
-	void saveAchievement(Achievement a);
+	void saveAchievement(Achievement a, String[] keywords);
 
 
-	int updateAchievement(Achievement a);
+	int updateAchievement(Achievement a, String[] keywords);
 
 
 	Achievement selectByPrimaryKey(String id);
 	Achievement selectByPrimaryKey(String id);
 
 
@@ -28,4 +29,11 @@ public interface AchievementService {
 
 
 	int updateReleaseStatus(Achievement a);
 	int updateReleaseStatus(Achievement a);
 
 
+	Pagination<AchievementListBo> listOrgOwnerAchievement(String ownerId, Integer auditStatus, Integer serialNumber, String name, String keyword,
+			Integer category, Integer status, String releaseDateStartDate, String releaseDateEndDate,
+			Integer releaseStatus, Integer pNo, Integer pSize);
+
+	AchievementUserOwnerDetailBo selectUserOwnerDetail(String id);
+
+
 }
 }

+ 66 - 18
src/main/java/com/goafanti/achievement/service/impl/AchievementServiceImpl.java

@@ -14,8 +14,10 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
 import com.goafanti.achievement.bo.AchievementListBo;
 import com.goafanti.achievement.bo.AchievementListBo;
+import com.goafanti.achievement.bo.AchievementUserOwnerDetailBo;
 import com.goafanti.achievement.service.AchievementService;
 import com.goafanti.achievement.service.AchievementService;
 import com.goafanti.common.constant.AFTConstants;
 import com.goafanti.common.constant.AFTConstants;
+import com.goafanti.common.dao.AchievementKeywordMapper;
 import com.goafanti.common.dao.AchievementMapper;
 import com.goafanti.common.dao.AchievementMapper;
 import com.goafanti.common.dao.NoticeMapper;
 import com.goafanti.common.dao.NoticeMapper;
 import com.goafanti.common.dao.UserRoleMapper;
 import com.goafanti.common.dao.UserRoleMapper;
@@ -28,6 +30,7 @@ import com.goafanti.common.enums.NoticeReadStatus;
 import com.goafanti.common.enums.NoticeStatus;
 import com.goafanti.common.enums.NoticeStatus;
 import com.goafanti.common.enums.UserType;
 import com.goafanti.common.enums.UserType;
 import com.goafanti.common.model.Achievement;
 import com.goafanti.common.model.Achievement;
+import com.goafanti.common.model.AchievementKeyword;
 import com.goafanti.common.model.Admin;
 import com.goafanti.common.model.Admin;
 import com.goafanti.common.model.Notice;
 import com.goafanti.common.model.Notice;
 import com.goafanti.common.utils.DateUtils;
 import com.goafanti.common.utils.DateUtils;
@@ -44,12 +47,14 @@ public class AchievementServiceImpl extends BaseMybatisDao<AchievementMapper> im
 	private UserRoleMapper		userRoleMapper;
 	private UserRoleMapper		userRoleMapper;
 	@Autowired
 	@Autowired
 	private NoticeMapper		noticeMapper;
 	private NoticeMapper		noticeMapper;
+	@Autowired
+	private AchievementKeywordMapper achievementKeywordMapper;
 
 
 	@SuppressWarnings("unchecked")
 	@SuppressWarnings("unchecked")
 	@Override
 	@Override
-	public Pagination<AchievementListBo> listAchievement(Integer auditStatus, Integer serialNumber, String name,
-			String keyword, Integer category, Integer ownerType, Integer status, String releaseDateStartDate,
-			String releaseDateEndDate, Integer releaseStatus, Integer pNo, Integer pSize) {
+	public Pagination<AchievementListBo> listUserOwnerAchievement(String ownerId, Integer auditStatus,
+			Integer serialNumber, String name, String keyword, Integer category, Integer status,
+			String releaseDateStartDate, String releaseDateEndDate, Integer releaseStatus, Integer pNo, Integer pSize) {
 		if (pNo == null || pNo < 0) {
 		if (pNo == null || pNo < 0) {
 			pNo = 1;
 			pNo = 1;
 		}
 		}
@@ -57,14 +62,32 @@ public class AchievementServiceImpl extends BaseMybatisDao<AchievementMapper> im
 		if (pSize == null || pSize < 0) {
 		if (pSize == null || pSize < 0) {
 			pSize = 10;
 			pSize = 10;
 		}
 		}
-		return (Pagination<AchievementListBo>) findPage("findManageAchievementListByPage", "findManageAchievementCount",
-				disposeParams(auditStatus, serialNumber, name, keyword, category, ownerType, status,
-						releaseDateStartDate, releaseDateEndDate, releaseStatus),
+		return (Pagination<AchievementListBo>) findPage("findUserOwnerAchievementListByPage",
+				"findUserOwnerAchievementCount", disposeParams(ownerId, auditStatus, serialNumber, name, keyword,
+						category, status, releaseDateStartDate, releaseDateEndDate, releaseStatus),
 				pNo, pSize);
 				pNo, pSize);
 	}
 	}
 
 
+	@SuppressWarnings("unchecked")
 	@Override
 	@Override
-	public void saveAchievement(Achievement a) {
+	public Pagination<AchievementListBo> listOrgOwnerAchievement(String ownerId, Integer auditStatus,
+			Integer serialNumber, String name, String keyword, Integer category, Integer status,
+			String releaseDateStartDate, String releaseDateEndDate, Integer releaseStatus, Integer pNo, Integer pSize) {
+		if (pNo == null || pNo < 0) {
+			pNo = 1;
+		}
+
+		if (pSize == null || pSize < 0) {
+			pSize = 10;
+		}
+		return (Pagination<AchievementListBo>) findPage("findOrgOwnerAchievementListByPage",
+				"findOrgOwnerAchievementCount", disposeParams(ownerId, auditStatus, serialNumber, name, keyword,
+						category, status, releaseDateStartDate, releaseDateEndDate, releaseStatus),
+				pNo, pSize);
+	}
+
+	@Override
+	public void saveAchievement(Achievement a, String[] keywords) {
 		a.setId(UUID.randomUUID().toString());
 		a.setId(UUID.randomUUID().toString());
 		a.setDeletedSign(DeleteStatus.UNDELETE.getCode());
 		a.setDeletedSign(DeleteStatus.UNDELETE.getCode());
 		Calendar now = Calendar.getInstance();
 		Calendar now = Calendar.getInstance();
@@ -83,14 +106,16 @@ public class AchievementServiceImpl extends BaseMybatisDao<AchievementMapper> im
 
 
 		a.setCreateTime(now.getTime());
 		a.setCreateTime(now.getTime());
 		achievementMapper.insert(a);
 		achievementMapper.insert(a);
+		disposeAchievementKeyword(keywords, a, false);
 	}
 	}
 
 
 	@Override
 	@Override
-	public int updateAchievement(Achievement a) {
+	public int updateAchievement(Achievement a, String[] keywords) {
 		if (AchievementAuditStatus.SUBMIT.getCode().equals(a.getAuditStatus())) {
 		if (AchievementAuditStatus.SUBMIT.getCode().equals(a.getAuditStatus())) {
 			a.setAuditStatus(DemandAuditStatus.INAUDIT.getCode());
 			a.setAuditStatus(DemandAuditStatus.INAUDIT.getCode());
 			createAuditorNotice(a);
 			createAuditorNotice(a);
 		}
 		}
+		disposeAchievementKeyword(keywords, a, true);
 		return achievementMapper.updateByPrimaryKeySelective(a);
 		return achievementMapper.updateByPrimaryKeySelective(a);
 	}
 	}
 
 
@@ -101,6 +126,7 @@ public class AchievementServiceImpl extends BaseMybatisDao<AchievementMapper> im
 
 
 	@Override
 	@Override
 	public int deleteByPrimaryKey(List<String> id) {
 	public int deleteByPrimaryKey(List<String> id) {
+		achievementKeywordMapper.batcheDeleteByDemandIds(id);
 		return achievementMapper.batchDeleteByPrimaryKey(id);
 		return achievementMapper.batchDeleteByPrimaryKey(id);
 	}
 	}
 
 
@@ -109,9 +135,8 @@ public class AchievementServiceImpl extends BaseMybatisDao<AchievementMapper> im
 	public Pagination<AchievementListBo> listUserAchievement(Integer auditStatus, Integer serialNumber, String name,
 	public Pagination<AchievementListBo> listUserAchievement(Integer auditStatus, Integer serialNumber, String name,
 			String keyword, Integer category, Integer ownerType, Integer status, String releaseDateStartDate,
 			String keyword, Integer category, Integer ownerType, Integer status, String releaseDateStartDate,
 			String releaseDateEndDate, Integer releaseStatus, Integer pNo, Integer pSize) {
 			String releaseDateEndDate, Integer releaseStatus, Integer pNo, Integer pSize) {
-		Map<String, Object> params = disposeParams(auditStatus, serialNumber, name, keyword, category, ownerType,
-				status, releaseDateStartDate, releaseDateEndDate, releaseStatus);
-		params.put("ownerId", TokenManager.getUserId());
+		Map<String, Object> params = disposeParams(TokenManager.getUserId(), auditStatus, serialNumber, name, keyword,
+				category, status, releaseDateStartDate, releaseDateEndDate, releaseStatus);
 		if (pNo == null || pNo < 0) {
 		if (pNo == null || pNo < 0) {
 			pNo = 1;
 			pNo = 1;
 		}
 		}
@@ -123,8 +148,8 @@ public class AchievementServiceImpl extends BaseMybatisDao<AchievementMapper> im
 				pNo, pSize);
 				pNo, pSize);
 	}
 	}
 
 
-	private Map<String, Object> disposeParams(Integer auditStatus, Integer serialNumber, String name, String keyword,
-			Integer category, Integer ownerType, Integer status, String releaseDateStartDate, String releaseDateEndDate,
+	private Map<String, Object> disposeParams(String ownerId, Integer auditStatus, Integer serialNumber, String name,
+			String keyword, Integer category, Integer status, String releaseDateStartDate, String releaseDateEndDate,
 			Integer releaseStatus) {
 			Integer releaseStatus) {
 		Map<String, Object> params = new HashMap<>();
 		Map<String, Object> params = new HashMap<>();
 
 
@@ -157,6 +182,10 @@ public class AchievementServiceImpl extends BaseMybatisDao<AchievementMapper> im
 			params.put("auditStatus", auditStatus);
 			params.put("auditStatus", auditStatus);
 		}
 		}
 
 
+		if (!StringUtils.isBlank(ownerId)) {
+			params.put("ownerId", ownerId);
+		}
+
 		if (null != serialNumber) {
 		if (null != serialNumber) {
 			params.put("serialNumber", serialNumber);
 			params.put("serialNumber", serialNumber);
 		}
 		}
@@ -173,10 +202,6 @@ public class AchievementServiceImpl extends BaseMybatisDao<AchievementMapper> im
 			params.put("category", category);
 			params.put("category", category);
 		}
 		}
 
 
-		if (null != ownerType) {
-			params.put("ownerType", ownerType);
-		}
-
 		if (null != status) {
 		if (null != status) {
 			params.put("status", status);
 			params.put("status", status);
 		}
 		}
@@ -211,6 +236,12 @@ public class AchievementServiceImpl extends BaseMybatisDao<AchievementMapper> im
 		achievementMapper.updateReleaseDate(a.getId());
 		achievementMapper.updateReleaseDate(a.getId());
 		return achievementMapper.updateByPrimaryKeySelective(a);
 		return achievementMapper.updateByPrimaryKeySelective(a);
 	}
 	}
+	
+	@Override
+	public AchievementUserOwnerDetailBo selectUserOwnerDetail(String id) {
+		return achievementMapper.selectUserOwnerDetail(id);
+	}
+
 
 
 	private void createTechBorkerNotice(Achievement a) {
 	private void createTechBorkerNotice(Achievement a) {
 		noticeMapper.insert(disposeNotice(a, null));
 		noticeMapper.insert(disposeNotice(a, null));
@@ -264,8 +295,25 @@ public class AchievementServiceImpl extends BaseMybatisDao<AchievementMapper> im
 				n.setNoticeType(NoticeStatus.ORGANIZATIONACHIEVEMENT.getCode());
 				n.setNoticeType(NoticeStatus.ORGANIZATIONACHIEVEMENT.getCode());
 			}
 			}
 		}
 		}
-
 		return n;
 		return n;
 	}
 	}
+	
+	private void disposeAchievementKeyword(String[] keywords, Achievement a, boolean delete){
+		if (null != keywords && keywords.length > 0) {
+			if (delete){
+				achievementKeywordMapper.batcheDeleteByDemandId(a.getId());
+			}
+			List<AchievementKeyword> list = new ArrayList<>();
+			for (int i = 0; i < keywords.length; i++) {
+				AchievementKeyword ak = new AchievementKeyword();
+				ak.setId(UUID.randomUUID().toString());
+				ak.setAchievementId(a.getId());
+				ak.setKeyword(keywords[i].trim());
+				list.add(ak);
+			}
+			achievementKeywordMapper.insertBatch(list);
+		}
+	}
 
 
+	
 }
 }

+ 51 - 22
src/main/java/com/goafanti/admin/controller/AdminAchievementApiController.java

@@ -30,7 +30,7 @@ import com.goafanti.common.utils.StringUtils;
 public class AdminAchievementApiController extends CertifyApiController {
 public class AdminAchievementApiController extends CertifyApiController {
 	@Resource
 	@Resource
 	private AchievementService achievementService;
 	private AchievementService achievementService;
-	
+
 	/**
 	/**
 	 * 成果撤消发布(下架)
 	 * 成果撤消发布(下架)
 	 */
 	 */
@@ -74,9 +74,9 @@ public class AdminAchievementApiController extends CertifyApiController {
 		AttachmentType attachmentType = AttachmentType.getField(sign);
 		AttachmentType attachmentType = AttachmentType.getField(sign);
 		if (attachmentType == AttachmentType.ACHIEVEMENT_MATURITY_TEXT_FILE) {
 		if (attachmentType == AttachmentType.ACHIEVEMENT_MATURITY_TEXT_FILE) {
 			downloadUnPrivateFile(response, a.getMaturityTextFileDownloadFileName(), a.getMaturityTextFileUrl());
 			downloadUnPrivateFile(response, a.getMaturityTextFileDownloadFileName(), a.getMaturityTextFileUrl());
-		} else if (attachmentType == AttachmentType.ACHIEVEMENT_TECH_PLAN){
+		} else if (attachmentType == AttachmentType.ACHIEVEMENT_TECH_PLAN) {
 			downloadUnPrivateFile(response, a.getTechPlanDownloadFileName(), a.getTechPlanUrl());
 			downloadUnPrivateFile(response, a.getTechPlanDownloadFileName(), a.getTechPlanUrl());
-		} else if (attachmentType == AttachmentType.ACHIEVEMENT_BUSINESS_PLAN){
+		} else if (attachmentType == AttachmentType.ACHIEVEMENT_BUSINESS_PLAN) {
 			downloadUnPrivateFile(response, a.getBusinessPlanDownloadFileName(), a.getBusinessPlanUrl());
 			downloadUnPrivateFile(response, a.getBusinessPlanDownloadFileName(), a.getBusinessPlanUrl());
 		} else {
 		} else {
 			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
 			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
@@ -137,26 +137,48 @@ public class AdminAchievementApiController extends CertifyApiController {
 	}
 	}
 
 
 	/**
 	/**
-	 * 详情
+	 * 个人成果详情详情
 	 */
 	 */
-	@RequestMapping(value = "/detail", method = RequestMethod.GET)
+	@RequestMapping(value = "/userDetail", method = RequestMethod.GET)
 	private Result detail(String id) {
 	private Result detail(String id) {
 		Result res = new Result();
 		Result res = new Result();
 		if (StringUtils.isBlank(id)) {
 		if (StringUtils.isBlank(id)) {
 			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到成果ID", "成果ID"));
 			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到成果ID", "成果ID"));
 			return res;
 			return res;
 		}
 		}
-		res.setData(achievementService.selectByPrimaryKey(id));
+		res.setData(achievementService.selectUserOwnerDetail(id));
+		return res;
+	}
+
+	/**
+	 * 个人成果列表
+	 */
+	@RequestMapping(value = "/userList", method = RequestMethod.GET)
+	private Result userList(String ownerId, Integer auditStatus, Integer serialNumber, String name, String keyword,
+			Integer category, Integer status, String releaseDateStartDate, String releaseDateEndDate,
+			Integer releaseStatus, String pageNo, String pageSize) {
+		Result res = new Result();
+		Integer pNo = 1;
+		Integer pSize = 10;
+		if (StringUtils.isNumeric(pageSize)) {
+			pSize = Integer.parseInt(pageSize);
+		}
+
+		if (StringUtils.isNumeric(pageNo)) {
+			pNo = Integer.parseInt(pageNo);
+		}
+		res.setData(achievementService.listUserOwnerAchievement(ownerId, auditStatus, serialNumber, name, keyword,
+				category, status, releaseDateStartDate, releaseDateEndDate, releaseStatus, pNo, pSize));
 		return res;
 		return res;
 	}
 	}
 
 
 	/**
 	/**
-	 * 成果列表
+	 * 组织用户成果列表
 	 */
 	 */
-	@RequestMapping(value = "/list", method = RequestMethod.GET)
-	private Result list(Integer auditStatus, Integer serialNumber, String name, String keyword, Integer category, Integer ownerType,
-			Integer status, String releaseDateStartDate, String releaseDateEndDate, Integer releaseStatus,
-			String pageNo, String pageSize) {
+	@RequestMapping(value = "/orgList", method = RequestMethod.GET)
+	private Result orgList(String ownerId, Integer auditStatus, Integer serialNumber, String name, String keyword,
+			Integer category, Integer status, String releaseDateStartDate, String releaseDateEndDate,
+			Integer releaseStatus, String pageNo, String pageSize) {
 		Result res = new Result();
 		Result res = new Result();
 		Integer pNo = 1;
 		Integer pNo = 1;
 		Integer pSize = 10;
 		Integer pSize = 10;
@@ -167,8 +189,8 @@ public class AdminAchievementApiController extends CertifyApiController {
 		if (StringUtils.isNumeric(pageNo)) {
 		if (StringUtils.isNumeric(pageNo)) {
 			pNo = Integer.parseInt(pageNo);
 			pNo = Integer.parseInt(pageNo);
 		}
 		}
-		res.setData(achievementService.listAchievement(auditStatus, serialNumber, name, keyword, category, ownerType, status,
-				releaseDateStartDate, releaseDateEndDate, releaseStatus, pNo, pSize));
+		res.setData(achievementService.listOrgOwnerAchievement(ownerId, auditStatus, serialNumber, name, keyword,
+				category, status, releaseDateStartDate, releaseDateEndDate, releaseStatus, pNo, pSize));
 		return res;
 		return res;
 	}
 	}
 
 
@@ -176,7 +198,8 @@ public class AdminAchievementApiController extends CertifyApiController {
 	 * 新增成果
 	 * 新增成果
 	 */
 	 */
 	@RequestMapping(value = "/apply", method = RequestMethod.POST)
 	@RequestMapping(value = "/apply", method = RequestMethod.POST)
-	private Result apply(@Valid InputAchievement ia, BindingResult bindingResult) {
+	private Result apply(@Valid InputAchievement ia, BindingResult bindingResult,
+			@RequestParam(name = "keywords[]", required = false) String[] keywords) {
 		Result res = new Result();
 		Result res = new Result();
 
 
 		if (bindingResult.hasErrors()) {
 		if (bindingResult.hasErrors()) {
@@ -185,14 +208,14 @@ public class AdminAchievementApiController extends CertifyApiController {
 			return res;
 			return res;
 		}
 		}
 
 
-		res = disposeInputAchievement(res, ia);
+		res = disposeInputAchievement(res, ia, keywords);
 		if (!res.getError().isEmpty()) {
 		if (!res.getError().isEmpty()) {
 			return res;
 			return res;
 		}
 		}
 
 
 		Achievement a = new Achievement();
 		Achievement a = new Achievement();
 		BeanUtils.copyProperties(ia, a);
 		BeanUtils.copyProperties(ia, a);
-		achievementService.saveAchievement(a);
+		achievementService.saveAchievement(a,keywords);
 		return res;
 		return res;
 	}
 	}
 
 
@@ -200,7 +223,8 @@ public class AdminAchievementApiController extends CertifyApiController {
 	 * 修改成果
 	 * 修改成果
 	 */
 	 */
 	@RequestMapping(value = "/update", method = RequestMethod.POST)
 	@RequestMapping(value = "/update", method = RequestMethod.POST)
-	public Result update(@Valid InputAchievement ia, BindingResult bindingResult) {
+	public Result update(@Valid InputAchievement ia, BindingResult bindingResult,
+			@RequestParam(name = "keywords[]", required = false) String[] keywords) {
 		Result res = new Result();
 		Result res = new Result();
 		if (bindingResult.hasErrors()) {
 		if (bindingResult.hasErrors()) {
 			res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
 			res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
@@ -212,26 +236,26 @@ public class AdminAchievementApiController extends CertifyApiController {
 			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到成果ID", "成果ID"));
 			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到成果ID", "成果ID"));
 			return res;
 			return res;
 		}
 		}
-		
+
 		if (!AchievementAuditStatus.CREATE.getCode().equals(ia.getAuditStatus())
 		if (!AchievementAuditStatus.CREATE.getCode().equals(ia.getAuditStatus())
 				&& !AchievementAuditStatus.SUBMIT.getCode().equals(ia.getAuditStatus())
 				&& !AchievementAuditStatus.SUBMIT.getCode().equals(ia.getAuditStatus())
 				&& !AchievementAuditStatus.UNAUDITED.getCode().equals(ia.getAuditStatus())) {
 				&& !AchievementAuditStatus.UNAUDITED.getCode().equals(ia.getAuditStatus())) {
 			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "当前状态无法提交审核!"));
 			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "当前状态无法提交审核!"));
 			return res;
 			return res;
 		}
 		}
-		
-		res = disposeInputAchievement(res, ia);
+
+		res = disposeInputAchievement(res, ia, keywords);
 		if (!res.getError().isEmpty()) {
 		if (!res.getError().isEmpty()) {
 			return res;
 			return res;
 		}
 		}
 
 
 		Achievement a = new Achievement();
 		Achievement a = new Achievement();
 		BeanUtils.copyProperties(ia, a);
 		BeanUtils.copyProperties(ia, a);
-		achievementService.updateAchievement(a);
+		achievementService.updateAchievement(a, keywords);
 		return res;
 		return res;
 	}
 	}
 
 
-	private Result disposeInputAchievement(Result res, InputAchievement ia) {
+	private Result disposeInputAchievement(Result res, InputAchievement ia, String[] keywords) {
 		if (StringUtils.isBlank(ia.getName())) {
 		if (StringUtils.isBlank(ia.getName())) {
 			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到成果名称", "成果名称"));
 			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到成果名称", "成果名称"));
 			return res;
 			return res;
@@ -247,6 +271,11 @@ public class AdminAchievementApiController extends CertifyApiController {
 			return res;
 			return res;
 		}
 		}
 
 
+		if (null == keywords || keywords.length < 1) {
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到关键词", "关键词"));
+			return res;
+		}
+
 		if (StringUtils.isBlank(ia.getOwnerName())) {
 		if (StringUtils.isBlank(ia.getOwnerName())) {
 			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到成果所有人名称", "成果所有人名称"));
 			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到成果所有人名称", "成果所有人名称"));
 			return res;
 			return res;

+ 12 - 5
src/main/java/com/goafanti/admin/controller/AdminDemandApiController.java

@@ -88,6 +88,7 @@ public class AdminDemandApiController extends CertifyApiController {
 	 */
 	 */
 	@RequestMapping(value = "/apply", method = RequestMethod.POST)
 	@RequestMapping(value = "/apply", method = RequestMethod.POST)
 	public Result userApply(@Valid InputDemand demand, BindingResult bindingResult,
 	public Result userApply(@Valid InputDemand demand, BindingResult bindingResult,
+			@RequestParam(name = "keywords[]", required = false) String[] keywords,
 			String validityPeriodFormattedDate) {
 			String validityPeriodFormattedDate) {
 		Result res = new Result();
 		Result res = new Result();
 		if (bindingResult.hasErrors()) {
 		if (bindingResult.hasErrors()) {
@@ -96,14 +97,14 @@ public class AdminDemandApiController extends CertifyApiController {
 			return res;
 			return res;
 		}
 		}
 
 
-		res = disposeDemand(res, demand);
+		res = disposeDemand(res, demand, keywords);
 		if (!res.getError().isEmpty()) {
 		if (!res.getError().isEmpty()) {
 			return res;
 			return res;
 		}
 		}
 
 
 		Demand d = new Demand();
 		Demand d = new Demand();
 		BeanUtils.copyProperties(demand, d);
 		BeanUtils.copyProperties(demand, d);
-		demandService.saveUserDemand(d, validityPeriodFormattedDate);
+		demandService.saveUserDemand(d, validityPeriodFormattedDate, keywords);
 		return res;
 		return res;
 	}
 	}
 
 
@@ -208,6 +209,7 @@ public class AdminDemandApiController extends CertifyApiController {
 	 */
 	 */
 	@RequestMapping(value = "/update", method = RequestMethod.POST)
 	@RequestMapping(value = "/update", method = RequestMethod.POST)
 	public Result updateUser(@Valid InputDemand demand, BindingResult bindingResult,
 	public Result updateUser(@Valid InputDemand demand, BindingResult bindingResult,
+			@RequestParam(name = "keywords[]", required = false) String[] keywords,
 			String validityPeriodFormattedDate) {
 			String validityPeriodFormattedDate) {
 		Result res = new Result();
 		Result res = new Result();
 		if (bindingResult.hasErrors()) {
 		if (bindingResult.hasErrors()) {
@@ -228,14 +230,14 @@ public class AdminDemandApiController extends CertifyApiController {
 			return res;
 			return res;
 		}
 		}
 
 
-		res = disposeDemand(res, demand);
+		res = disposeDemand(res, demand, keywords);
 		if (!res.getError().isEmpty()) {
 		if (!res.getError().isEmpty()) {
 			return res;
 			return res;
 		}
 		}
 
 
 		Demand d = new Demand();
 		Demand d = new Demand();
 		BeanUtils.copyProperties(demand, d);
 		BeanUtils.copyProperties(demand, d);
-		res.setData(demandService.updateUserDemand(d, validityPeriodFormattedDate));
+		res.setData(demandService.updateUserDemand(d, validityPeriodFormattedDate, keywords));
 		return res;
 		return res;
 	}
 	}
 
 
@@ -297,7 +299,7 @@ public class AdminDemandApiController extends CertifyApiController {
 		return res;
 		return res;
 	}
 	}
 
 
-	private Result disposeDemand(Result res, InputDemand demand) {
+	private Result disposeDemand(Result res, InputDemand demand, String[] keywords) {
 		if (StringUtils.isBlank(demand.getName())) {
 		if (StringUtils.isBlank(demand.getName())) {
 			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到需求名称", "需求名称"));
 			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到需求名称", "需求名称"));
 			return res;
 			return res;
@@ -319,6 +321,11 @@ public class AdminDemandApiController extends CertifyApiController {
 			return res;
 			return res;
 		}
 		}
 
 
+		if (null == keywords || keywords.length < 1) {
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到关键词", "关键词"));
+			return res;
+		}
+
 		if (null == demand.getInfoSources()) {
 		if (null == demand.getInfoSources()) {
 			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到信息来源", "信息来源"));
 			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到信息来源", "信息来源"));
 			return res;
 			return res;

+ 25 - 0
src/main/java/com/goafanti/common/dao/AchievementKeywordMapper.java

@@ -0,0 +1,25 @@
+package com.goafanti.common.dao;
+
+import java.util.List;
+
+import com.goafanti.common.model.AchievementKeyword;
+
+public interface AchievementKeywordMapper {
+    int deleteByPrimaryKey(String id);
+
+    int insert(AchievementKeyword record);
+
+    int insertSelective(AchievementKeyword record);
+
+    AchievementKeyword selectByPrimaryKey(String id);
+
+    int updateByPrimaryKeySelective(AchievementKeyword record);
+
+    int updateByPrimaryKey(AchievementKeyword record);
+
+	void insertBatch(List<AchievementKeyword> list);
+
+	int batcheDeleteByDemandId(String id);
+
+	int batcheDeleteByDemandIds(List<String> id);
+}

+ 3 - 0
src/main/java/com/goafanti/common/dao/AchievementMapper.java

@@ -2,6 +2,7 @@ package com.goafanti.common.dao;
 
 
 import java.util.List;
 import java.util.List;
 
 
+import com.goafanti.achievement.bo.AchievementUserOwnerDetailBo;
 import com.goafanti.common.model.Achievement;
 import com.goafanti.common.model.Achievement;
 
 
 public interface AchievementMapper {
 public interface AchievementMapper {
@@ -20,4 +21,6 @@ public interface AchievementMapper {
 	int updateReleaseDate(String id);
 	int updateReleaseDate(String id);
 
 
 	int batchDeleteByPrimaryKey(List<String> id);
 	int batchDeleteByPrimaryKey(List<String> id);
+
+	AchievementUserOwnerDetailBo selectUserOwnerDetail(String id);
 }
 }

+ 25 - 0
src/main/java/com/goafanti/common/dao/DemandKeywordMapper.java

@@ -0,0 +1,25 @@
+package com.goafanti.common.dao;
+
+import java.util.List;
+
+import com.goafanti.common.model.DemandKeyword;
+
+public interface DemandKeywordMapper {
+    int deleteByPrimaryKey(String id);
+
+    int insert(DemandKeyword record);
+
+    int insertSelective(DemandKeyword record);
+
+    DemandKeyword selectByPrimaryKey(String id);
+
+    int updateByPrimaryKeySelective(DemandKeyword record);
+
+    int updateByPrimaryKey(DemandKeyword record);
+
+	void insertBatch(List<DemandKeyword> list);
+
+	int batcheDeleteByDemandId(String demandId);
+
+	int batcheDeleteByDemandIds(List<String> id);
+}

+ 93 - 0
src/main/java/com/goafanti/common/mapper/AchievementKeywordMapper.xml

@@ -0,0 +1,93 @@
+<?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.AchievementKeywordMapper" >
+  <resultMap id="BaseResultMap" type="com.goafanti.common.model.AchievementKeyword" >
+    <id column="id" property="id" jdbcType="VARCHAR" />
+    <result column="achievement_id" property="achievementId" jdbcType="VARCHAR" />
+    <result column="keyword" property="keyword" jdbcType="VARCHAR" />
+  </resultMap>
+  <sql id="Base_Column_List" >
+    id, achievement_id, keyword
+  </sql>
+  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
+    select 
+    <include refid="Base_Column_List" />
+    from achievement_keyword
+    where id = #{id,jdbcType=VARCHAR}
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
+    delete from achievement_keyword
+    where id = #{id,jdbcType=VARCHAR}
+  </delete>
+  <insert id="insert" parameterType="com.goafanti.common.model.AchievementKeyword" >
+    insert into achievement_keyword (id, achievement_id, keyword
+      )
+    values (#{id,jdbcType=VARCHAR}, #{achievementId,jdbcType=VARCHAR}, #{keyword,jdbcType=VARCHAR}
+      )
+  </insert>
+  <insert id="insertSelective" parameterType="com.goafanti.common.model.AchievementKeyword" >
+    insert into achievement_keyword
+    <trim prefix="(" suffix=")" suffixOverrides="," >
+      <if test="id != null" >
+        id,
+      </if>
+      <if test="achievementId != null" >
+        achievement_id,
+      </if>
+      <if test="keyword != null" >
+        keyword,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides="," >
+      <if test="id != null" >
+        #{id,jdbcType=VARCHAR},
+      </if>
+      <if test="achievementId != null" >
+        #{achievementId,jdbcType=VARCHAR},
+      </if>
+      <if test="keyword != null" >
+        #{keyword,jdbcType=VARCHAR},
+      </if>
+    </trim>
+  </insert>
+  <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.AchievementKeyword" >
+    update achievement_keyword
+    <set >
+      <if test="achievementId != null" >
+        achievement_id = #{achievementId,jdbcType=VARCHAR},
+      </if>
+      <if test="keyword != null" >
+        keyword = #{keyword,jdbcType=VARCHAR},
+      </if>
+    </set>
+    where id = #{id,jdbcType=VARCHAR}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.AchievementKeyword" >
+    update achievement_keyword
+    set achievement_id = #{achievementId,jdbcType=VARCHAR},
+      keyword = #{keyword,jdbcType=VARCHAR}
+    where id = #{id,jdbcType=VARCHAR}
+  </update>
+  
+  <insert id="insertBatch" parameterType="com.goafanti.common.model.AchievementKeyword">
+    insert into achievement_keyword (id, achievement_id, keyword)
+    values 
+    <foreach item="item" index="index" collection="list" separator=",">
+      (
+      	#{item.id,jdbcType=VARCHAR}, #{item.achievementId,jdbcType=VARCHAR}, #{item.keyword,jdbcType=VARCHAR}
+      )
+    </foreach>
+  </insert>
+  
+  <delete id="batcheDeleteByAchievementId" parameterType="java.lang.String">
+  	 delete from achievement_keyword where achievement_id = #{achievementId,jdbcType=VARCHAR}
+       
+  </delete>
+  
+  <delete id="batcheDeleteByAchievementIds" parameterType="java.util.List">
+  	 delete from achievement_keyword where achievement_id in
+        <foreach item="item" collection="index" open="(" separator="," close=")">
+            #{item}
+        </foreach>
+  </delete>
+</mapper>

+ 126 - 12
src/main/java/com/goafanti/common/mapper/AchievementMapper.xml

@@ -645,15 +645,19 @@
     where id = #{id,jdbcType=VARCHAR}
     where id = #{id,jdbcType=VARCHAR}
   </update>
   </update>
   
   
-  <select id="findManageAchievementListByPage" parameterType="String" resultType="com.goafanti.achievement.bo.AchievementListBo">
+  <select id="findUserOwnerAchievementListByPage" parameterType="String" resultType="com.goafanti.achievement.bo.AchievementListBo">
   	select 
   	select 
   		a.id, a.serial_number as serialNumber, a.data_category as dataCategory, 
   		a.id, a.serial_number as serialNumber, a.data_category as dataCategory, 
-  		a.name, a.keyword, a.category, 
-  		a.owner_name as ownerName, a.owner_type as ownerType, a.owner_mobile as ownerMobile,
-  		a.status, a.release_date as releaseDate, a.audit_status as auditStatus, ad.name as techBrokerId
+  		a.name, a.keyword, a.category, a.owner_name as ownerName, a.owner_type as ownerType, 
+  		ui.username as username, a.owner_id as ownerId, a.org_id as orgId, a.contacts,
+  		a.release_date as releaseDate, a.audit_status as auditStatus, ad.name as techBrokerId
   	from achievement a
   	from achievement a
   	LEFT JOIN admin ad on a.id = a.tech_broker_id
   	LEFT JOIN admin ad on a.id = a.tech_broker_id
-  	where deleted_sign = 0
+  	LEFT JOIN user_identity ui on a.owner_id = ui.uid
+  	where deleted_sign = 0 and owner_type = 0
+  	<if test="ownerId != null">
+		and  owner_id = #{ownerId,jdbcType=VARCHAR}
+	</if>
   	<if test="serialNumber != null">
   	<if test="serialNumber != null">
 		and  serial_number = #{serialNumber,jdbcType=INTEGER}
 		and  serial_number = #{serialNumber,jdbcType=INTEGER}
 	</if>
 	</if>
@@ -669,9 +673,6 @@
 	<if test="category != null">
 	<if test="category != null">
 		and  category = #{category,jdbcType=INTEGER}
 		and  category = #{category,jdbcType=INTEGER}
 	</if>
 	</if>
-	<if test="ownerType != null">
-		and  owner_type = #{ownerType,jdbcType=INTEGER}
-	</if>
 	<if test="status != null">
 	<if test="status != null">
 		and  status = #{status,jdbcType=INTEGER}
 		and  status = #{status,jdbcType=INTEGER}
 	</if>
 	</if>
@@ -690,11 +691,14 @@
 	</if>
 	</if>
   </select>
   </select>
   
   
-  <select id="findManageAchievementCount" parameterType="String" resultType="java.lang.Integer">
+  <select id="findUserOwnerAchievementCount" parameterType="String" resultType="java.lang.Integer">
   	select 
   	select 
   		count(1)
   		count(1)
   	from achievement
   	from achievement
-  	where deleted_sign = 0
+  	where deleted_sign = 0 and owner_type = 0
+  	<if test="ownerId != null">
+		and  owner_id = #{ownerId,jdbcType=VARCHAR}
+	</if>
   	<if test="serialNumber != null">
   	<if test="serialNumber != null">
 		and  serial_number = #{serialNumber,jdbcType=INTEGER}
 		and  serial_number = #{serialNumber,jdbcType=INTEGER}
 	</if>
 	</if>
@@ -710,8 +714,49 @@
 	<if test="category != null">
 	<if test="category != null">
 		and  category = #{category,jdbcType=INTEGER}
 		and  category = #{category,jdbcType=INTEGER}
 	</if>
 	</if>
-	<if test="ownerType != null">
-		and  owner_type = #{ownerType,jdbcType=INTEGER}
+	<if test="status != null">
+		and  status = #{status,jdbcType=INTEGER}
+	</if>
+	<if test="rStart != null">
+       and	release_date <![CDATA[ > ]]> #{rStart,jdbcType=TIMESTAMP}
+	</if>
+	<if test="rEnd != null">
+	   and release_date <![CDATA[ < ]]> #{rEnd,jdbcType=TIMESTAMP}
+	</if>
+	<if test="releaseStatus != null">
+	   and  release_status = #{releaseStatus,jdbcType=INTEGER}
+	</if>
+  </select>
+  
+  
+  
+  <select id="findOrgOwnerAchievementListByPage" parameterType="String" resultType="com.goafanti.achievement.bo.AchievementListBo">
+  	select 
+  		a.id, a.serial_number as serialNumber, a.data_category as dataCategory, 
+  		a.name, a.keyword, a.category, a.owner_name as ownerName, a.owner_type as ownerType, 
+  		oi.unit_name as username, a.owner_id as ownerId, a.org_id as orgId, a.contacts,
+  		a.release_date as releaseDate, a.audit_status as auditStatus, ad.name as techBrokerId
+  	from achievement a
+  	LEFT JOIN admin ad on a.id = a.tech_broker_id
+  	LEFT JOIN organization_identity oi on a.owner_id = oi.uid
+  	where deleted_sign = 0 and owner_type = 1
+  	<if test="ownerId != null">
+		and  owner_id = #{ownerId,jdbcType=VARCHAR}
+	</if>
+  	<if test="serialNumber != null">
+		and  serial_number = #{serialNumber,jdbcType=INTEGER}
+	</if>
+	<if test="auditStatus != null">
+		and  audit_status = #{auditStatus,jdbcType=INTEGER}
+	</if>
+	<if test="name != null">
+		and  name = #{name,jdbcType=VARCHAR}
+	</if>
+	<if test="keyword != null">
+		and  keyword like "%"#{keyword,jdbcType=VARCHAR}"%"
+	</if>
+	<if test="category != null">
+		and  category = #{category,jdbcType=INTEGER}
 	</if>
 	</if>
 	<if test="status != null">
 	<if test="status != null">
 		and  status = #{status,jdbcType=INTEGER}
 		and  status = #{status,jdbcType=INTEGER}
@@ -725,8 +770,50 @@
 	<if test="releaseStatus != null">
 	<if test="releaseStatus != null">
 	   and  release_status = #{releaseStatus,jdbcType=INTEGER}
 	   and  release_status = #{releaseStatus,jdbcType=INTEGER}
 	</if>
 	</if>
+	order by serial_number desc
+	<if test="page_sql!=null">
+			${page_sql}
+	</if>
   </select>
   </select>
   
   
+  <select id="findOrgOwnerAchievementCount" parameterType="String" resultType="java.lang.Integer">
+  	select 
+  		count(1)
+  	from achievement
+  	where deleted_sign = 0 and owner_type = 1
+  	<if test="ownerId != null">
+		and  owner_id = #{ownerId,jdbcType=VARCHAR}
+	</if>
+  	<if test="serialNumber != null">
+		and  serial_number = #{serialNumber,jdbcType=INTEGER}
+	</if>
+	<if test="auditStatus != null">
+		and  audit_status = #{auditStatus,jdbcType=INTEGER}
+	</if>
+	<if test="name != null">
+		and  name = #{name,jdbcType=VARCHAR}
+	</if>
+	<if test="keyword != null">
+		and  keyword like "%"#{keyword,jdbcType=VARCHAR}"%"
+	</if>
+	<if test="category != null">
+		and  category = #{category,jdbcType=INTEGER}
+	</if>
+	<if test="status != null">
+		and  status = #{status,jdbcType=INTEGER}
+	</if>
+	<if test="rStart != null">
+       and	release_date <![CDATA[ > ]]> #{rStart,jdbcType=TIMESTAMP}
+	</if>
+	<if test="rEnd != null">
+	   and release_date <![CDATA[ < ]]> #{rEnd,jdbcType=TIMESTAMP}
+	</if>
+	<if test="releaseStatus != null">
+	   and  release_status = #{releaseStatus,jdbcType=INTEGER}
+	</if>
+  </select>
+  
+  
   <update id="updateReleaseDate" parameterType="java.lang.String">
   <update id="updateReleaseDate" parameterType="java.lang.String">
   	update achievement set release_date = null
   	update achievement set release_date = null
   	where id = #{id,jdbcType=VARCHAR}
   	where id = #{id,jdbcType=VARCHAR}
@@ -819,5 +906,32 @@
 	<if test="releaseStatus != null">
 	<if test="releaseStatus != null">
 	   and  release_status = #{releaseStatus,jdbcType=INTEGER}
 	   and  release_status = #{releaseStatus,jdbcType=INTEGER}
 	</if>
 	</if>
+  </select>
+  
+  <select id="selectUserOwnerDetail" parameterType="java.lang.String" resultType="com.goafanti.achievement.bo.AchievementUserOwnerDetailBo">
+  	select  
+		  	a.id, a.serial_number as serialNumber, a.data_category as dataCategory, 
+		  	a.name, a.keyword, a.category, 
+		  	a.summary, a.introduction, a.technical_picture_url as technicalPictureUrl, 
+		  	a.field_a as fieldA, a.field_b as fieldB, a.field_c as fieldC, 
+		  	a.maturity, a.maturity_picture_url as maturityPictureUrl, a.maturity_text_file_url as maturityTextFileUrl, 
+		  	a.maturity_video_url as maturityVideoUrl, a.innovation, a.owner_id as ownerId, 
+		  	a.owner_name as ownerName, a.owner_type as ownerType, a.owner_id_number as ownerIdNumber, 
+		    a.owner_mobile as ownerMobile, a.owner_email as ownerEmail, a.owner_postal_address as ownerPostalAddress, 
+		    a.cooperation_mode as cooperationMode, a.transfer_mode as transferMode, a.bargaining_mode as bargainingMode, 
+		    a.transfer_price as transferPrice, a.technical_scene as technicalScene, a.breakthrough, 
+		    a.patent_case as patentCase, a.awards, a.team_des as teamDes, 
+		    a.parameter, a.tech_plan_url as techPlanUrl, a.business_plan_url as businessPlanUrl, 
+		    a.org_id as orgId, a.org_name as orgName, a.org_address as orgAddress, 
+		    a.org_email as orgEmail, a.org_contacts as orgContacts, a.org_contacts_mobile as orgContactsMobile, 
+		    a.contacts, a.manager_id as managerId, a.salesman_id as salesmanId, 
+		    a.create_time as createTime, a.release_status as releaseStatus, 
+		    a.release_date as releaseDate, a.audit_status as auditStatus, a.tech_broker_id as techBrokerId,
+		    ui.username as iOwnerName, ui.province, ui.city, ui.area, u.email as iOwnerEmail
+    from achievement a
+    left join user_identity ui on a.owner_id = ui.uid
+    left join organization_identity oi on a.org_id = oi.uid
+    left join user u on u.id = a.owner_id
+    where a.id = #id,jdbcType=VARCHAR}
   </select>
   </select>
 </mapper>
 </mapper>

+ 92 - 0
src/main/java/com/goafanti/common/mapper/DemandKeywordMapper.xml

@@ -0,0 +1,92 @@
+<?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.DemandKeywordMapper" >
+  <resultMap id="BaseResultMap" type="com.goafanti.common.model.DemandKeyword" >
+    <id column="id" property="id" jdbcType="VARCHAR" />
+    <result column="demand_id" property="demandId" jdbcType="VARCHAR" />
+    <result column="keyword" property="keyword" jdbcType="VARCHAR" />
+  </resultMap>
+  <sql id="Base_Column_List" >
+    id, demand_id, keyword
+  </sql>
+  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
+    select 
+    <include refid="Base_Column_List" />
+    from demand_keyword
+    where id = #{id,jdbcType=VARCHAR}
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
+    delete from demand_keyword
+    where id = #{id,jdbcType=VARCHAR}
+  </delete>
+  <insert id="insert" parameterType="com.goafanti.common.model.DemandKeyword" >
+    insert into demand_keyword (id, demand_id, keyword
+      )
+    values (#{id,jdbcType=VARCHAR}, #{demandId,jdbcType=VARCHAR}, #{keyword,jdbcType=VARCHAR}
+      )
+  </insert>
+  <insert id="insertSelective" parameterType="com.goafanti.common.model.DemandKeyword" >
+    insert into demand_keyword
+    <trim prefix="(" suffix=")" suffixOverrides="," >
+      <if test="id != null" >
+        id,
+      </if>
+      <if test="demandId != null" >
+        demand_id,
+      </if>
+      <if test="keyword != null" >
+        keyword,
+      </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="keyword != null" >
+        #{keyword,jdbcType=VARCHAR},
+      </if>
+    </trim>
+  </insert>
+  <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.DemandKeyword" >
+    update demand_keyword
+    <set >
+      <if test="demandId != null" >
+        demand_id = #{demandId,jdbcType=VARCHAR},
+      </if>
+      <if test="keyword != null" >
+        keyword = #{keyword,jdbcType=VARCHAR},
+      </if>
+    </set>
+    where id = #{id,jdbcType=VARCHAR}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.DemandKeyword" >
+    update demand_keyword
+    set demand_id = #{demandId,jdbcType=VARCHAR},
+      keyword = #{keyword,jdbcType=VARCHAR}
+    where id = #{id,jdbcType=VARCHAR}
+  </update>
+  
+   <insert id="insertBatch" parameterType="com.goafanti.common.model.DemandKeyword">
+    insert into demand_keyword (id, demand_id, keyword)
+    values 
+    <foreach item="item" index="index" collection="list" separator=",">
+      (
+      	#{item.id,jdbcType=VARCHAR}, #{item.demandId,jdbcType=VARCHAR}, #{item.keyword,jdbcType=VARCHAR}
+      )
+    </foreach>
+  </insert>
+  
+  <delete id="batcheDeleteByDemandId" parameterType="java.lang.String">
+  	 delete from demand_keyword where demand_id = #{demandId,jdbcType=VARCHAR}
+  </delete>
+  
+  <delete id="batcheDeleteByDemandIds" parameterType="java.util.List">
+  	 delete from demand_keyword where demand_id in
+        <foreach item="item" collection="index" open="(" separator="," close=")">
+            #{item}
+        </foreach>
+  </delete>
+</mapper>

+ 39 - 0
src/main/java/com/goafanti/common/model/AchievementKeyword.java

@@ -0,0 +1,39 @@
+package com.goafanti.common.model;
+
+public class AchievementKeyword {
+    private String id;
+
+    /**
+    * 科技成果ID
+    */
+    private String achievementId;
+
+    /**
+    * 科技成果关键词
+    */
+    private String keyword;
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public String getAchievementId() {
+        return achievementId;
+    }
+
+    public void setAchievementId(String achievementId) {
+        this.achievementId = achievementId;
+    }
+
+    public String getKeyword() {
+        return keyword;
+    }
+
+    public void setKeyword(String keyword) {
+        this.keyword = keyword;
+    }
+}

+ 39 - 0
src/main/java/com/goafanti/common/model/DemandKeyword.java

@@ -0,0 +1,39 @@
+package com.goafanti.common.model;
+
+public class DemandKeyword {
+    private String id;
+
+    /**
+    * 科技需求ID
+    */
+    private String demandId;
+
+    /**
+    * 关键词
+    */
+    private String keyword;
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public String getDemandId() {
+        return demandId;
+    }
+
+    public void setDemandId(String demandId) {
+        this.demandId = demandId;
+    }
+
+    public String getKeyword() {
+        return keyword;
+    }
+
+    public void setKeyword(String keyword) {
+        this.keyword = keyword;
+    }
+}

+ 12 - 5
src/main/java/com/goafanti/demand/controller/DemandApiController.java

@@ -62,6 +62,7 @@ public class DemandApiController extends CertifyApiController{
 	 */
 	 */
 	@RequestMapping(value = "/apply", method = RequestMethod.POST)
 	@RequestMapping(value = "/apply", method = RequestMethod.POST)
 	public Result userApply(@Valid InputDemand demand, BindingResult bindingResult,
 	public Result userApply(@Valid InputDemand demand, BindingResult bindingResult,
+			@RequestParam(name = "keywords[]", required = false) String[] keywords,
 			String validityPeriodFormattedDate) {
 			String validityPeriodFormattedDate) {
 		Result res = new Result();
 		Result res = new Result();
 		if (bindingResult.hasErrors()) {
 		if (bindingResult.hasErrors()) {
@@ -69,7 +70,7 @@ public class DemandApiController extends CertifyApiController{
 					DemandFields.getFieldDesc(bindingResult.getFieldError().getField())));
 					DemandFields.getFieldDesc(bindingResult.getFieldError().getField())));
 			return res;
 			return res;
 		}
 		}
-		res = disposeDemand(res, demand);
+		res = disposeDemand(res, demand, keywords);
 		if (!res.getError().isEmpty()) {
 		if (!res.getError().isEmpty()) {
 			return res;
 			return res;
 		}
 		}
@@ -77,7 +78,7 @@ public class DemandApiController extends CertifyApiController{
 		Demand d = new Demand();
 		Demand d = new Demand();
 		BeanUtils.copyProperties(demand, d);
 		BeanUtils.copyProperties(demand, d);
 		d.setEmployerId(TokenManager.getUserId());
 		d.setEmployerId(TokenManager.getUserId());
-		demandService.saveDemand(d, validityPeriodFormattedDate);
+		demandService.saveDemand(d, validityPeriodFormattedDate, keywords);
 		return res;
 		return res;
 	}
 	}
 	
 	
@@ -118,6 +119,7 @@ public class DemandApiController extends CertifyApiController{
 	 */
 	 */
 	@RequestMapping(value = "/update", method = RequestMethod.POST)
 	@RequestMapping(value = "/update", method = RequestMethod.POST)
 	public Result updateUser(@Valid InputDemand demand, BindingResult bindingResult,
 	public Result updateUser(@Valid InputDemand demand, BindingResult bindingResult,
+			@RequestParam(name = "keywords[]", required = false) String[] keywords,
 			String validityPeriodFormattedDate) {
 			String validityPeriodFormattedDate) {
 		Result res = new Result();
 		Result res = new Result();
 		if (bindingResult.hasErrors()) {
 		if (bindingResult.hasErrors()) {
@@ -138,7 +140,7 @@ public class DemandApiController extends CertifyApiController{
 			return res;
 			return res;
 		}
 		}
 
 
-		res = disposeDemand(res, demand);
+		res = disposeDemand(res, demand, keywords);
 		if (!res.getError().isEmpty()) {
 		if (!res.getError().isEmpty()) {
 			return res;
 			return res;
 		}
 		}
@@ -146,7 +148,7 @@ public class DemandApiController extends CertifyApiController{
 		Demand d = new Demand();
 		Demand d = new Demand();
 		BeanUtils.copyProperties(demand, d);
 		BeanUtils.copyProperties(demand, d);
 		d.setEmployerId(TokenManager.getUserId());
 		d.setEmployerId(TokenManager.getUserId());
-		res.setData(demandService.updateUserDemand(d, validityPeriodFormattedDate));
+		res.setData(demandService.updateUserDemand(d, validityPeriodFormattedDate, keywords));
 		return res;
 		return res;
 	}
 	}
 	
 	
@@ -245,7 +247,7 @@ public class DemandApiController extends CertifyApiController{
 	
 	
 	
 	
 	
 	
-	private Result disposeDemand(Result res, InputDemand demand) {
+	private Result disposeDemand(Result res, InputDemand demand, String[] keywords) {
 		if (StringUtils.isBlank(demand.getName())) {
 		if (StringUtils.isBlank(demand.getName())) {
 			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到需求名称", "需求名称"));
 			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到需求名称", "需求名称"));
 			return res;
 			return res;
@@ -261,6 +263,11 @@ public class DemandApiController extends CertifyApiController{
 			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到关键词", "关键词"));
 			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到关键词", "关键词"));
 			return res;
 			return res;
 		}
 		}
+		
+		if (null == keywords || keywords.length < 1) {
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到关键词", "关键词"));
+			return res;
+		}
 
 
 		if (null == demand.getIndustryCategoryA()) {
 		if (null == demand.getIndustryCategoryA()) {
 			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到行业类别", "行业类别"));
 			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到行业类别", "行业类别"));

+ 5 - 0
src/main/java/com/goafanti/demand/service/DemandKeywordService.java

@@ -0,0 +1,5 @@
+package com.goafanti.demand.service;
+
+public interface DemandKeywordService {
+
+}

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

@@ -20,9 +20,9 @@ public interface DemandService {
 			String validityPeriodEndDate, String username, Integer status, Integer releaseStatus, String releaseDateStartDate,
 			String validityPeriodEndDate, String username, Integer status, Integer releaseStatus, String releaseDateStartDate,
 			String releaseDateEndDate, Integer pNo, Integer pSize);
 			String releaseDateEndDate, Integer pNo, Integer pSize);
 
 
-	void saveUserDemand(Demand d, String validityPeriodFormattedDate);
+	void saveUserDemand(Demand d, String validityPeriodFormattedDate, String[] keywords);
 
 
-	int updateUserDemand(Demand d, String validityPeriodFormattedDate);
+	int updateUserDemand(Demand d, String validityPeriodFormattedDate, String[] keywords);
 
 
 	DemandManageDetailBo selectUserDemandDetail(String id);
 	DemandManageDetailBo selectUserDemandDetail(String id);
 
 
@@ -41,6 +41,6 @@ public interface DemandService {
 
 
 	int updateAuditDemand(Demand d, String techBroderId, Integer auditStatus);
 	int updateAuditDemand(Demand d, String techBroderId, Integer auditStatus);
 
 
-	void saveDemand(Demand d, String validityPeriodFormattedDate);
+	void saveDemand(Demand d, String validityPeriodFormattedDate, String keywords[]);
 
 
 }
 }

+ 11 - 0
src/main/java/com/goafanti/demand/service/impl/DemandKeywordServiceImpl.java

@@ -0,0 +1,11 @@
+package com.goafanti.demand.service.impl;
+
+import org.springframework.stereotype.Service;
+
+import com.goafanti.demand.service.DemandKeywordService;
+@Service
+public class DemandKeywordServiceImpl implements DemandKeywordService {
+	/*@Autowired
+	private DemandKeywordMapper demandKeywordMapper;*/
+
+}

+ 34 - 10
src/main/java/com/goafanti/demand/service/impl/DemandServiceImpl.java

@@ -14,6 +14,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
 import com.goafanti.common.constant.AFTConstants;
 import com.goafanti.common.constant.AFTConstants;
+import com.goafanti.common.dao.DemandKeywordMapper;
 import com.goafanti.common.dao.DemandMapper;
 import com.goafanti.common.dao.DemandMapper;
 import com.goafanti.common.dao.NoticeMapper;
 import com.goafanti.common.dao.NoticeMapper;
 import com.goafanti.common.dao.UserMapper;
 import com.goafanti.common.dao.UserMapper;
@@ -26,6 +27,7 @@ import com.goafanti.common.enums.NoticeReadStatus;
 import com.goafanti.common.enums.NoticeStatus;
 import com.goafanti.common.enums.NoticeStatus;
 import com.goafanti.common.enums.UserType;
 import com.goafanti.common.enums.UserType;
 import com.goafanti.common.model.Demand;
 import com.goafanti.common.model.Demand;
+import com.goafanti.common.model.DemandKeyword;
 import com.goafanti.common.model.Notice;
 import com.goafanti.common.model.Notice;
 import com.goafanti.common.model.User;
 import com.goafanti.common.model.User;
 import com.goafanti.common.utils.DateUtils;
 import com.goafanti.common.utils.DateUtils;
@@ -47,6 +49,8 @@ public class DemandServiceImpl extends BaseMybatisDao<DemandMapper> implements D
 	private UserRoleMapper	userRoleMapper;
 	private UserRoleMapper	userRoleMapper;
 	@Autowired
 	@Autowired
 	private NoticeMapper	noticeMapper;
 	private NoticeMapper	noticeMapper;
+	@Autowired
+	private DemandKeywordMapper demandKeywordMapper;
 
 
 	@SuppressWarnings("unchecked")
 	@SuppressWarnings("unchecked")
 	@Override
 	@Override
@@ -54,11 +58,11 @@ public class DemandServiceImpl extends BaseMybatisDao<DemandMapper> implements D
 			Integer serialNumber, String name, String keyword, Integer infoSources, Integer demandType,
 			Integer serialNumber, String name, String keyword, Integer infoSources, Integer demandType,
 			String validityPeriodStartDate, String validityPeriodEndDate, String username, Integer status,
 			String validityPeriodStartDate, String validityPeriodEndDate, String username, Integer status,
 			Integer releaseStatus, String releaseDateStartDate, String releaseDateEndDate, Integer pNo, Integer pSize) {
 			Integer releaseStatus, String releaseDateStartDate, String releaseDateEndDate, Integer pNo, Integer pSize) {
-		
+
 		Map<String, Object> params = disposeParams(auditStatus, province, serialNumber, name, keyword, infoSources,
 		Map<String, Object> params = disposeParams(auditStatus, province, serialNumber, name, keyword, infoSources,
 				demandType, validityPeriodStartDate, validityPeriodEndDate, username, status, releaseStatus,
 				demandType, validityPeriodStartDate, validityPeriodEndDate, username, status, releaseStatus,
 				releaseDateStartDate, releaseDateEndDate);
 				releaseDateStartDate, releaseDateEndDate);
-		
+
 		if (pNo == null || pNo < 0) {
 		if (pNo == null || pNo < 0) {
 			pNo = 1;
 			pNo = 1;
 		}
 		}
@@ -119,7 +123,7 @@ public class DemandServiceImpl extends BaseMybatisDao<DemandMapper> implements D
 	}
 	}
 
 
 	@Override
 	@Override
-	public void saveUserDemand(Demand d, String validityPeriodFormattedDate) {
+	public void saveUserDemand(Demand d, String validityPeriodFormattedDate, String[] keywords) {
 		Date validityPeriod = null;
 		Date validityPeriod = null;
 		if (!StringUtils.isBlank(validityPeriodFormattedDate)) {
 		if (!StringUtils.isBlank(validityPeriodFormattedDate)) {
 			try {
 			try {
@@ -147,10 +151,11 @@ public class DemandServiceImpl extends BaseMybatisDao<DemandMapper> implements D
 
 
 		d.setCreateTime(now.getTime());
 		d.setCreateTime(now.getTime());
 		demandMapper.insert(d);
 		demandMapper.insert(d);
+		disposeDemandKeyword(keywords, d, false);
 	}
 	}
 
 
 	@Override
 	@Override
-	public int updateUserDemand(Demand d, String validityPeriodFormattedDate) {
+	public int updateUserDemand(Demand d, String validityPeriodFormattedDate, String[] keywords) {
 		Date validityPeriod = null;
 		Date validityPeriod = null;
 		if (!StringUtils.isBlank(validityPeriodFormattedDate)) {
 		if (!StringUtils.isBlank(validityPeriodFormattedDate)) {
 			try {
 			try {
@@ -164,6 +169,7 @@ public class DemandServiceImpl extends BaseMybatisDao<DemandMapper> implements D
 			d.setAuditStatus(DemandAuditStatus.INAUDIT.getCode());
 			d.setAuditStatus(DemandAuditStatus.INAUDIT.getCode());
 			createAuditorNotice(d);
 			createAuditorNotice(d);
 		}
 		}
+		disposeDemandKeyword(keywords, d, true);
 		return demandMapper.updateByPrimaryKeySelective(d);
 		return demandMapper.updateByPrimaryKeySelective(d);
 	}
 	}
 
 
@@ -174,6 +180,7 @@ public class DemandServiceImpl extends BaseMybatisDao<DemandMapper> implements D
 
 
 	@Override
 	@Override
 	public int deleteByPrimaryKey(List<String> id) {
 	public int deleteByPrimaryKey(List<String> id) {
+		demandKeywordMapper.batcheDeleteByDemandIds(id);
 		return demandMapper.batchDeleteByPrimaryKey(id);
 		return demandMapper.batchDeleteByPrimaryKey(id);
 	}
 	}
 
 
@@ -192,13 +199,12 @@ public class DemandServiceImpl extends BaseMybatisDao<DemandMapper> implements D
 	public Pagination<DemandListBo> listDemand(Integer auditStatus, Integer serialNumber, String name, String keyword,
 	public Pagination<DemandListBo> listDemand(Integer auditStatus, Integer serialNumber, String name, String keyword,
 			Integer demandType, String validityPeriodStartDate, String validityPeriodEndDate, Integer status,
 			Integer demandType, String validityPeriodStartDate, String validityPeriodEndDate, Integer status,
 			Integer releaseStatus, String releaseDateStartDate, String releaseDateEndDate, Integer pNo, Integer pSize) {
 			Integer releaseStatus, String releaseDateStartDate, String releaseDateEndDate, Integer pNo, Integer pSize) {
-		Map<String, Object> params = disposeParams(auditStatus, null, serialNumber, name, keyword, null,
-				demandType, validityPeriodStartDate, validityPeriodEndDate, null, status, releaseStatus,
-				releaseDateStartDate, releaseDateEndDate);
+		Map<String, Object> params = disposeParams(auditStatus, null, serialNumber, name, keyword, null, demandType,
+				validityPeriodStartDate, validityPeriodEndDate, null, status, releaseStatus, releaseDateStartDate,
+				releaseDateEndDate);
 
 
 		params.put("employerId", TokenManager.getUserId());
 		params.put("employerId", TokenManager.getUserId());
 
 
-
 		if (pNo == null || pNo < 0) {
 		if (pNo == null || pNo < 0) {
 			pNo = 1;
 			pNo = 1;
 		}
 		}
@@ -215,6 +221,7 @@ public class DemandServiceImpl extends BaseMybatisDao<DemandMapper> implements D
 		d.setReleaseStatus(DemandReleaseStatus.UNRELEASE.getCode());
 		d.setReleaseStatus(DemandReleaseStatus.UNRELEASE.getCode());
 		d.setStatus(DemandStatus.UNRESOLVED.getCode());
 		d.setStatus(DemandStatus.UNRESOLVED.getCode());
 		demandMapper.updateReleaseDate(d.getId());
 		demandMapper.updateReleaseDate(d.getId());
+		demandKeywordMapper.batcheDeleteByDemandId(d.getId());
 		return demandMapper.updateByPrimaryKeySelective(d);
 		return demandMapper.updateByPrimaryKeySelective(d);
 	}
 	}
 
 
@@ -235,7 +242,7 @@ public class DemandServiceImpl extends BaseMybatisDao<DemandMapper> implements D
 	}
 	}
 
 
 	@Override
 	@Override
-	public void saveDemand(Demand d, String validityPeriodFormattedDate) {
+	public void saveDemand(Demand d, String validityPeriodFormattedDate, String[] keywords) {
 		Date validityPeriod = null;
 		Date validityPeriod = null;
 		if (!StringUtils.isBlank(validityPeriodFormattedDate)) {
 		if (!StringUtils.isBlank(validityPeriodFormattedDate)) {
 			try {
 			try {
@@ -263,7 +270,7 @@ public class DemandServiceImpl extends BaseMybatisDao<DemandMapper> implements D
 
 
 		d.setCreateTime(now.getTime());
 		d.setCreateTime(now.getTime());
 		demandMapper.insert(d);
 		demandMapper.insert(d);
-
+		disposeDemandKeyword(keywords, d, false);
 	}
 	}
 
 
 	private Map<String, Object> disposeParams(Integer auditStatus, String province, Integer serialNumber, String name,
 	private Map<String, Object> disposeParams(Integer auditStatus, String province, Integer serialNumber, String name,
@@ -418,4 +425,21 @@ public class DemandServiceImpl extends BaseMybatisDao<DemandMapper> implements D
 		}
 		}
 		return n;
 		return n;
 	}
 	}
+	
+	private void disposeDemandKeyword(String[] keywords, Demand d, boolean delete){
+		if (null != keywords && keywords.length > 0) {
+			if (delete){
+				demandKeywordMapper.batcheDeleteByDemandId(d.getId());
+			}
+			List<DemandKeyword> list = new ArrayList<>();
+			for (int i = 0; i < keywords.length; i++) {
+				DemandKeyword dk = new DemandKeyword();
+				dk.setId(UUID.randomUUID().toString());
+				dk.setDemandId(d.getId());
+				dk.setKeyword(keywords[i].trim());
+				list.add(dk);
+			}
+			demandKeywordMapper.insertBatch(list);
+		}
+	}
 }
 }