Przeglądaj źródła

Merge branch 'test' of jishutao/jitao-server into prod

anderx 5 lat temu
rodzic
commit
75074a32cf
28 zmienionych plików z 4154 dodań i 3587 usunięć
  1. 1 1
      README.md
  2. 2 2
      pom.xml
  3. 396 401
      src/main/java/com/goafanti/achievement/controller/UserAchievementApiController.java
  4. 105 102
      src/main/java/com/goafanti/achievement/service/AchievementService.java
  5. 108 111
      src/main/java/com/goafanti/achievement/service/impl/AchievementPublishServiceImpl.java
  6. 1033 882
      src/main/java/com/goafanti/achievement/service/impl/AchievementServiceImpl.java
  7. 32 0
      src/main/java/com/goafanti/admin/controller/AdminApiController.java
  8. 148 147
      src/main/java/com/goafanti/common/constant/ErrorConstants.java
  9. 286 285
      src/main/java/com/goafanti/common/controller/BaseApiController.java
  10. 3 3
      src/main/java/com/goafanti/common/controller/PortalController.java
  11. 2 0
      src/main/java/com/goafanti/common/dao/AchievementPublishMapper.java
  12. 2 0
      src/main/java/com/goafanti/common/dao/DemandPublishMapper.java
  13. 4 3
      src/main/java/com/goafanti/common/mapper/AchievementMapper.xml
  14. 14 0
      src/main/java/com/goafanti/common/mapper/AchievementPublishMapper.xml
  15. 6 4
      src/main/java/com/goafanti/common/mapper/DemandMapper.xml
  16. 14 0
      src/main/java/com/goafanti/common/mapper/DemandPublishMapper.xml
  17. 1 1
      src/main/java/com/goafanti/common/mapper/JtBusinessProjectMapper.xml
  18. 1408 1380
      src/main/java/com/goafanti/common/model/Achievement.java
  19. 343 234
      src/main/java/com/goafanti/common/utils/FileUtils.java
  20. 43 10
      src/main/java/com/goafanti/demand/controller/UserDemandApiController.java
  21. 4 0
      src/main/java/com/goafanti/demand/service/DemandService.java
  22. 140 12
      src/main/java/com/goafanti/demand/service/impl/DemandServiceImpl.java
  23. 2 0
      src/main/java/com/goafanti/user/service/UserService.java
  24. 8 0
      src/main/java/com/goafanti/user/service/impl/UserServiceImpl.java
  25. 5 5
      src/main/resources/props/config_local.properties
  26. 3 3
      src/main/resources/props/config_test.properties
  27. 1 1
      src/main/resources/shiro_base_auth.ini
  28. 40 0
      src/main/webapp/WEB-INF/views/portal/aboutUs.html

+ 1 - 1
README.md

@@ -1 +1 @@
-#AFT
+#jitao-server

+ 2 - 2
pom.xml

@@ -4,8 +4,8 @@
 
 	<modelVersion>4.0.0</modelVersion>
 	<groupId>com.goafanti</groupId>
-	<artifactId>aft</artifactId>
-	<name>aft</name>
+	<artifactId>jitao-server</artifactId>
+	<name>jitao-server</name>
 
 	<packaging>war</packaging>
 	<version>1.0.0-BUILD-SNAPSHOT</version>

+ 396 - 401
src/main/java/com/goafanti/achievement/controller/UserAchievementApiController.java

@@ -1,401 +1,396 @@
-package com.goafanti.achievement.controller;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Date;
-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.beans.factory.annotation.Autowired;
-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.achievement.bo.InputAchievement;
-import com.goafanti.achievement.service.AchievementService;
-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.dao.AchievementKeywordMapper;
-import com.goafanti.common.dao.AchievementPublishMapper;
-import com.goafanti.common.enums.AchievementAuditStatus;
-import com.goafanti.common.enums.AchievementFields;
-import com.goafanti.common.enums.AttachmentType;
-import com.goafanti.common.model.Achievement;
-import com.goafanti.common.utils.StringUtils;
-import com.goafanti.core.shiro.token.TokenManager;
-import com.goafanti.portal.bo.AchievementResultObject;
-
-@RestController
-@RequestMapping(value = "/api/user/achievement")
-public class UserAchievementApiController extends CertifyApiController {
-	@Resource
-	private AchievementService		achievementService;
-	@Autowired
-	private AchievementKeywordMapper		achievementKeywordMapper;
-	@Autowired
-	private AchievementPublishMapper achievementPublishMapper;
-	/**
-	 * 成果需求匹配列表
-	 */
-	@RequestMapping(value = "/achievementDemand", method = RequestMethod.GET)
-	public Result achievementDemand(String id) {
-		Result res = new Result();
-		res.setData(achievementService.selectAchievementDemandListByAchievementId(id));
-		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;
-		}
-
-		Achievement a = achievementService.selectByPrimaryKey(id);
-		if (null == a) {
-			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "成果ID"));
-			return res;
-		}
-		if(a.getAuditStatus() != AchievementAuditStatus.AUDITED.getCode()) {
-			res.getError().add(buildError(ErrorConstants.STATUS_ERROR,"","当前状态不可撤销发布"));
-			return res;
-		}
-
-
-		res.setData(achievementService.updateReleaseStatus(a));
-		return res;
-	}
-
-	/**
-	 * 成果列表
-	 */
-	@RequestMapping(value = "/list", method = RequestMethod.GET)
-	private Result list(Integer auditStatus, String name, Integer dataCategory,
-		 String startDate, String endDate,
-		 Integer pageNo, Integer pageSize) {
-		Result res = new Result();
-		res.setData(achievementService.listMyAchievement(auditStatus, name, dataCategory,
-				 startDate, endDate, pageNo, pageSize));
-		return res;
-	}
-
-	/**
-	 * 新增成果
-	 */
-	@RequestMapping(value = "/apply", method = RequestMethod.POST)
-	private Result apply(@Valid InputAchievement ia, BindingResult bindingResult,
-			@RequestParam(name = "keywords[]", required = false) String[] keywords,
-			@RequestParam(name = "publishPages[]", required = false)  String[] publishPages) {
-		Result res = new Result();
-		if (bindingResult.hasErrors()) {
-			res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
-					AchievementFields.getFieldDesc(bindingResult.getFieldError().getField())));
-			return res;
-		}
-
-		res = disposeInputAchievement(res, ia, keywords,publishPages);
-		if (!res.getError().isEmpty()) {
-			return res;
-		}
-
-		if(TokenManager.getUserId()==null) {
-			res.getError().add(buildError(ErrorConstants.NON_LOGIN, "", ""));return res;
-		}
-		Achievement a = new Achievement();
-		BeanUtils.copyProperties(ia, a);
-		a.setOwnerId(TokenManager.getUserId());
-		a.setInfoSources(1);
-		List<String> webPages = new ArrayList<String>();
-		List<String> appPages = new ArrayList<String>();
-		PageConstants.putAchievement(publishPages, webPages, appPages);
-		achievementService.saveAchievement(a, keywords,webPages,appPages);
-		return res;
-	}
-
-	@RequestMapping(value = "/achievementDetail",method=RequestMethod.GET)
-	private Result Detail(String id) {
-		Result result=new Result();
-		if (StringUtils.isBlank(id)) {
-			result.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到成果ID", "成果ID"));
-			return result;
-		}
-		
-		AchievementResultObject achievementObjects=achievementService.getAchievementDetailById(id);
-		List<String>keywords=achievementKeywordMapper.getKeywordsByAchievementId(id);
-		List<String> publishPages=achievementPublishMapper.getPublishPagesById(id);
-		achievementObjects.setKeywords(keywords);
-		achievementObjects.setPublishPages(publishPages);
-		result.setData(achievementObjects);
-//		AchievementResultObject achievementResultObject=new AchievementResultObject()
-		return result;
-	}
-	/**
-	 * 个人成果详情详情
-	 */
-	@RequestMapping(value = "/userDetail", method = RequestMethod.GET)
-	private Result userDetail(String id) {
-		Result res = new Result();
-		if (StringUtils.isBlank(id)) {
-			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到成果ID", "成果ID"));
-			return res;
-		}
-		res.setData(achievementService.selectUserOwnerDetail(id));
-		return res;
-	}
-
-	/**
-	 * 组织用户成果详情详情
-	 */
-	@RequestMapping(value = "/orgDetail", method = RequestMethod.GET)
-	private Result orgDetail(String id) {
-		Result res = new Result();
-		if (StringUtils.isBlank(id)) {
-			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到成果ID", "成果ID"));
-			return res;
-		}
-		res.setData(achievementService.selectOrgOwnerDetail(id));
-		return res;
-	}
-
-	/**
-	 * 修改成果
-	 */
-	@RequestMapping(value = "/update", method = RequestMethod.POST)
-	public Result update(@Valid InputAchievement ia, BindingResult bindingResult,
-			@RequestParam(name = "keywords[]", required = false) String[] keywords,
-			@RequestParam(name = "publishPages[]", required = false)  String[] publishPages) {
-		Result res = new Result();
-		if (bindingResult.hasErrors()) {
-			res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
-					AchievementFields.getFieldDesc(bindingResult.getFieldError().getField())));
-			return res;
-		}
-
-		if (StringUtils.isBlank(ia.getId())) {
-			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到需求ID", "需求ID"));
-			return res;
-		}
-
-//		if (!AchievementAuditStatus.CREATE.getCode().equals(ia.getAuditStatus())
-//				&& !AchievementAuditStatus.SUBMIT.getCode().equals(ia.getAuditStatus())
-//				&& !AchievementAuditStatus.UNAUDITED.getCode().equals(ia.getAuditStatus())) {
-//			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "当前状态无法提交审核!"));
-//			return res;
-//		}
-		List<String> webPages = new ArrayList<String>();
-		List<String> appPages = new ArrayList<String>();
-		PageConstants.putAchievement(publishPages, webPages, appPages);
-		res = disposeInputAchievement(res, ia, keywords,publishPages);
-		if (!res.getError().isEmpty()) {
-			return res;
-		}
-		if(webPages.size()==0 && appPages.size() == 0){
-
-			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "页面参数错误","页面参数"));
-			return res;
-		}
-		if(TokenManager.getUserId() ==null) {
-			res.getError().add(buildError(ErrorConstants.NON_LOGIN, "", ""));return res;
-		}
-		Achievement a = new Achievement();
-		BeanUtils.copyProperties(ia, a);
-		a.setOwnerId(TokenManager.getUserId());
-		res.setData(achievementService.updateAchievement(a, keywords, null,webPages,appPages));
-		return res;
-	}
-	/**
-	 * 刷新发布时间
-	 * @param id
-	 * @param auditStatus
-	 * @return
-	 */
-	@RequestMapping(value = "/refreshPublish", method = RequestMethod.POST)
-	public Result refreshPublish(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 (AchievementAuditStatus.AUDITED.getCode() != auditStatus) {
-			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "当前状态无法刷新发布,"));
-			return res;
-		}
-		Achievement a = new Achievement();
-		a.setId(id);
-		a.setReleaseDate(new Date());
-//		a.setAuditStatus(auditStatus);
-		achievementService.updateByPrimaryKeySelective(a);
-		return res;
-	}
-	
-	/**
-	 * 提交审核
-	 * @param id
-	 * @param auditStatus
-	 * @return
-	 */
-	@RequestMapping(value = "/commit", method = RequestMethod.POST)
-	public Result refreshAuditStatus(String id){
-		Result res = new Result();
-		if (StringUtils.isBlank(id)) {
-			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到成果ID", "成果ID"));
-			return res;
-		}
-		AchievementResultObject achievementResultObject=achievementService.getAchievementDetailById(id);
-		if(achievementResultObject==null) {
-			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到成果ID", "成果ID"));
-			return res;
-		}
-		if (AchievementAuditStatus.CREATE.getCode() != achievementResultObject.getAuditStatus() && AchievementAuditStatus.REVOKE.getCode()!=achievementResultObject.getAuditStatus()
-				&&AchievementAuditStatus.UNAUDITED.getCode()!=achievementResultObject.getAuditStatus()) {
-		res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "当前状态无法提交审核,"));
-		return res;
-	} 
-		Achievement a = new Achievement();
-		a.setId(id);
-		a.setAuditStatus(AchievementAuditStatus.SUBMIT.getCode());
-		achievementService.updateByPrimaryKeySelective(a);
-		return res;
-	}
-	/**
-	 * 下载文本文件
-	 */
-	@RequestMapping(value = "/download", method = RequestMethod.GET)
-	public Result download(HttpServletResponse response, String id, String sign) {
-		Result res = new Result();
-
-		if (StringUtils.isBlank(id)) {
-			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "科技成果ID"));
-			return res;
-		}
-
-		Achievement a = achievementService.selectByPrimaryKey(id);
-		if (null == a) {
-			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "科技成果ID"));
-			return res;
-		}
-
-		AttachmentType attachmentType = AttachmentType.getField(sign);
-		/*if (attachmentType == AttachmentType.ACHIEVEMENT_MATURITY_TEXT_FILE) {
-			downloadUnPrivateFile(response, a.getMaturityTextFileDownloadFileName(), a.getMaturityTextFileUrl());
-		} else if (attachmentType == AttachmentType.ACHIEVEMENT_TECH_PLAN) {
-			downloadUnPrivateFile(response, a.getTechPlanDownloadFileName(), a.getTechPlanUrl());
-		} else if (attachmentType == AttachmentType.ACHIEVEMENT_BUSINESS_PLAN) {
-			downloadUnPrivateFile(response, a.getBusinessPlanDownloadFileName(), a.getBusinessPlanUrl());
-		} 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.ACHIEVEMENT_MATURITY_TEXT_FILE
-				|| attachmentType == AttachmentType.ACHIEVEMENT_TECH_PLAN
-				|| attachmentType == AttachmentType.ACHIEVEMENT_BUSINESS_PLAN) {
-			res.setData(handleFiles(res, "/achievement/", false, req, sign, "achievement"));
-		} else {
-			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
-		}*/
-		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.ACHIEVEMENT_PICTURE
-				) {
-			res.setData(handleFiles(res, "/achievement/", false, req, sign, "achievement"));
-		} else {
-			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
-		}
-
-		return res;
-	}
-
-	/**
-	 * 删除
-	 */
-	@RequestMapping(value = "/delete", method = RequestMethod.POST)
-	private 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<AchievementOrder> list = achievementOrderService.selectAchievementOrderByAchievementId(ids[0]);
-			for (AchievementOrder order : list) {
-				if (!AchievementOrderStatus.UNPAYED.getCode().equals(order.getStatus())) {
-					res.getError().add(buildError("", "当前科技成果有订单,无法删除!"));
-					return res;
-				}
-			}*/
-			res.setData(achievementService.deleteByPrimaryKey(Arrays.asList(ids)));
-		}
-		return res;
-	}
-
-	private Result disposeInputAchievement(Result res, InputAchievement ia, String[] keywords,String[] publishPages) {
-		if (StringUtils.isBlank(ia.getName())) {
-			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到成果名称", "成果名称"));
-			return res;
-		}
-
-		if (null == ia.getCategory()) {
-			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到数据类别", "数据类别"));
-			return res;
-		}
-
-		if (StringUtils.isBlank(ia.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;
-		}
-		
-	
-		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.achievement.controller;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Date;
+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.beans.factory.annotation.Autowired;
+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 org.springframework.web.multipart.MultipartFile;
+
+import com.goafanti.achievement.bo.InputAchievement;
+import com.goafanti.achievement.service.AchievementService;
+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.dao.AchievementKeywordMapper;
+import com.goafanti.common.dao.AchievementPublishMapper;
+import com.goafanti.common.enums.AchievementAuditStatus;
+import com.goafanti.common.enums.AchievementFields;
+import com.goafanti.common.enums.AttachmentType;
+import com.goafanti.common.model.Achievement;
+import com.goafanti.common.utils.StringUtils;
+import com.goafanti.core.shiro.token.TokenManager;
+import com.goafanti.portal.bo.AchievementResultObject;
+
+@RestController
+@RequestMapping(value = "/api/user/achievement")
+public class UserAchievementApiController extends CertifyApiController {
+	@Resource
+	private AchievementService		achievementService;
+	@Autowired
+	private AchievementKeywordMapper		achievementKeywordMapper;
+	@Autowired
+	private AchievementPublishMapper achievementPublishMapper;
+	/**
+	 * 成果需求匹配列表
+	 */
+	@RequestMapping(value = "/achievementDemand", method = RequestMethod.GET)
+	public Result achievementDemand(String id) {
+		Result res = new Result();
+		res.setData(achievementService.selectAchievementDemandListByAchievementId(id));
+		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;
+		}
+
+		Achievement a = achievementService.selectByPrimaryKey(id);
+		if (null == a) {
+			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "成果ID"));
+			return res;
+		}
+		if(a.getAuditStatus() != AchievementAuditStatus.AUDITED.getCode()) {
+			res.getError().add(buildError(ErrorConstants.STATUS_ERROR,"","当前状态不可撤销发布"));
+			return res;
+		}
+
+
+		res.setData(achievementService.updateReleaseStatus(a));
+		return res;
+	}
+
+	/**
+	 * 成果列表
+	 */
+	@RequestMapping(value = "/list", method = RequestMethod.GET)
+	private Result list(Integer auditStatus, String name, Integer dataCategory,
+		 String startDate, String endDate,
+		 Integer pageNo, Integer pageSize) {
+		Result res = new Result();
+		res.setData(achievementService.listMyAchievement(auditStatus, name, dataCategory,
+				 startDate, endDate, pageNo, pageSize));
+		return res;
+	}
+
+	/**
+	 * 新增成果
+	 */
+	@RequestMapping(value = "/apply", method = RequestMethod.POST)
+	private Result apply(@Valid InputAchievement ia, BindingResult bindingResult,
+			@RequestParam(name = "keywords[]", required = false) String[] keywords,
+			@RequestParam(name = "publishPages[]", required = false)  String[] publishPages) {
+		Result res = new Result();
+		if (bindingResult.hasErrors()) {
+			res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
+					AchievementFields.getFieldDesc(bindingResult.getFieldError().getField())));
+			return res;
+		}
+
+		res = disposeInputAchievement(res, ia, keywords,publishPages);
+		if (!res.getError().isEmpty()) {
+			return res;
+		}
+
+		if(TokenManager.getUserId()==null) {
+			res.getError().add(buildError(ErrorConstants.NON_LOGIN, "", ""));return res;
+		}
+		Achievement a = new Achievement();
+		BeanUtils.copyProperties(ia, a);
+		a.setOwnerId(TokenManager.getUserId());
+		a.setInfoSources(1);
+		List<String> webPages = new ArrayList<String>();
+		List<String> appPages = new ArrayList<String>();
+		PageConstants.putAchievement(publishPages, webPages, appPages);
+		achievementService.saveAchievement(a, keywords,webPages,appPages);
+		return res;
+	}
+
+	@RequestMapping(value = "/achievementDetail",method=RequestMethod.GET)
+	private Result Detail(String id) {
+		Result result=new Result();
+		if (StringUtils.isBlank(id)) {
+			result.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到成果ID", "成果ID"));
+			return result;
+		}
+		
+		AchievementResultObject achievementObjects=achievementService.getAchievementDetailById(id);
+		List<String>keywords=achievementKeywordMapper.getKeywordsByAchievementId(id);
+		List<String> publishPages=achievementPublishMapper.getPublishPagesById(id);
+		achievementObjects.setKeywords(keywords);
+		achievementObjects.setPublishPages(publishPages);
+		result.setData(achievementObjects);
+//		AchievementResultObject achievementResultObject=new AchievementResultObject()
+		return result;
+	}
+	/**
+	 * 个人成果详情详情
+	 */
+	@RequestMapping(value = "/userDetail", method = RequestMethod.GET)
+	private Result userDetail(String id) {
+		Result res = new Result();
+		if (StringUtils.isBlank(id)) {
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到成果ID", "成果ID"));
+			return res;
+		}
+		res.setData(achievementService.selectUserOwnerDetail(id));
+		return res;
+	}
+
+	/**
+	 * 组织用户成果详情详情
+	 */
+	@RequestMapping(value = "/orgDetail", method = RequestMethod.GET)
+	private Result orgDetail(String id) {
+		Result res = new Result();
+		if (StringUtils.isBlank(id)) {
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到成果ID", "成果ID"));
+			return res;
+		}
+		res.setData(achievementService.selectOrgOwnerDetail(id));
+		return res;
+	}
+
+	/**
+	 * 修改成果
+	 */
+	@RequestMapping(value = "/update", method = RequestMethod.POST)
+	public Result update(@Valid InputAchievement ia, BindingResult bindingResult,
+			@RequestParam(name = "keywords[]", required = false) String[] keywords,
+			@RequestParam(name = "publishPages[]", required = false)  String[] publishPages) {
+		Result res = new Result();
+		if (bindingResult.hasErrors()) {
+			res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
+					AchievementFields.getFieldDesc(bindingResult.getFieldError().getField())));
+			return res;
+		}
+
+		if (StringUtils.isBlank(ia.getId())) {
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到需求ID", "需求ID"));
+			return res;
+		}
+
+//		if (!AchievementAuditStatus.CREATE.getCode().equals(ia.getAuditStatus())
+//				&& !AchievementAuditStatus.SUBMIT.getCode().equals(ia.getAuditStatus())
+//				&& !AchievementAuditStatus.UNAUDITED.getCode().equals(ia.getAuditStatus())) {
+//			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "当前状态无法提交审核!"));
+//			return res;
+//		}
+		List<String> webPages = new ArrayList<String>();
+		List<String> appPages = new ArrayList<String>();
+		PageConstants.putAchievement(publishPages, webPages, appPages);
+		res = disposeInputAchievement(res, ia, keywords,publishPages);
+		if (!res.getError().isEmpty()) {
+			return res;
+		}
+		if(webPages.size()==0 && appPages.size() == 0){
+
+			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "页面参数错误","页面参数"));
+			return res;
+		}
+		if(TokenManager.getUserId() ==null) {
+			res.getError().add(buildError(ErrorConstants.NON_LOGIN, "", ""));return res;
+		}
+		Achievement a = new Achievement();
+		BeanUtils.copyProperties(ia, a);
+		a.setOwnerId(TokenManager.getUserId());
+		res.setData(achievementService.updateAchievement(a, keywords, null,webPages,appPages));
+		return res;
+	}
+	/**
+	 * 刷新发布时间
+	 * @param id
+	 * @param auditStatus
+	 * @return
+	 */
+	@RequestMapping(value = "/refreshPublish", method = RequestMethod.POST)
+	public Result refreshPublish(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 (AchievementAuditStatus.AUDITED.getCode() != auditStatus) {
+			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "当前状态无法刷新发布,"));
+			return res;
+		}
+		Achievement a = new Achievement();
+		a.setId(id);
+		a.setReleaseDate(new Date());
+//		a.setAuditStatus(auditStatus);
+		achievementService.updateByPrimaryKeySelective(a);
+		return res;
+	}
+	
+	/**
+	 * 提交审核
+	 * @param id
+	 * @param auditStatus
+	 * @return
+	 */
+	@RequestMapping(value = "/commit", method = RequestMethod.POST)
+	public Result refreshAuditStatus(String id){
+		Result res = new Result();
+		if (StringUtils.isBlank(id)) {
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到成果ID", "成果ID"));
+			return res;
+		}
+		AchievementResultObject achievementResultObject=achievementService.getAchievementDetailById(id);
+		if(achievementResultObject==null) {
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到成果ID", "成果ID"));
+			return res;
+		}
+		if (AchievementAuditStatus.CREATE.getCode() != achievementResultObject.getAuditStatus() && AchievementAuditStatus.REVOKE.getCode()!=achievementResultObject.getAuditStatus()
+				&&AchievementAuditStatus.UNAUDITED.getCode()!=achievementResultObject.getAuditStatus()) {
+		res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "当前状态无法提交审核,"));
+		return res;
+	} 
+		Achievement a = new Achievement();
+		a.setId(id);
+		a.setAuditStatus(AchievementAuditStatus.SUBMIT.getCode());
+		achievementService.updateByPrimaryKeySelective(a);
+		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.ACHIEVEMENT_PICTURE
+				) {
+			res.setData(handleFiles(res, "/achievement/", false, req, sign, "achievement"));
+		} else {
+			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
+		}
+
+		return res;
+	}
+
+	/**
+	 * 删除
+	 */
+	@RequestMapping(value = "/delete", method = RequestMethod.POST)
+	private 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<AchievementOrder> list = achievementOrderService.selectAchievementOrderByAchievementId(ids[0]);
+			for (AchievementOrder order : list) {
+				if (!AchievementOrderStatus.UNPAYED.getCode().equals(order.getStatus())) {
+					res.getError().add(buildError("", "当前科技成果有订单,无法删除!"));
+					return res;
+				}
+			}*/
+			res.setData(achievementService.deleteByPrimaryKey(Arrays.asList(ids)));
+		}
+		return res;
+	}
+
+	private Result disposeInputAchievement(Result res, InputAchievement ia, String[] keywords,String[] publishPages) {
+		if (StringUtils.isBlank(ia.getName())) {
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到成果名称", "成果名称"));
+			return res;
+		}
+
+		if (null == ia.getCategory()) {
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到数据类别", "数据类别"));
+			return res;
+		}
+
+		if (StringUtils.isBlank(ia.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;
+		}
+		
+	
+		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;
+	}
+	
+	
+    /**
+     * 下载技术成果批量导入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.ACHIEVEMENT_TEMPLATE) {
+                String path = "/tmp/achievement_template.xls";
+                String suffix = path.substring(path.lastIndexOf("."));
+                String fileName = AttachmentType.ACHIEVEMENT_TEMPLATE.getDesc() + suffix;
+                downloadFile(response, fileName, path);
+        } else {
+            res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
+        }
+        return res;
+    }
+    
+    
+    /**
+     * 批量导入科技成果
+     */
+    @RequestMapping(value = "/importAchievement", method = RequestMethod.POST)
+    public Result importTemplate(@RequestParam(value = "file", required = false) MultipartFile file, HttpServletRequest request) {
+    	Result res=new Result();
+    	//判断文件是否存在
+        if(null == file){
+      	  res.getError().add(buildError("文件不存在!","文件不存在!"));
+      	  return res;
+        }
+    	String fileName = file.getOriginalFilename();
+    	if (!fileName.matches("^.+\\.(?i)(xls)$") && !fileName.matches("^.+\\.(?i)(xlsx)$")) {
+        	  res.getError().add(buildError("格式不正确","格式不正确"));
+        	  return res;
+          }
+    	achievementService.batchSaveAchievement(file);
+         res.data(1); 
+    	return res;
+    }
+}

+ 105 - 102
src/main/java/com/goafanti/achievement/service/AchievementService.java

@@ -1,102 +1,105 @@
-package com.goafanti.achievement.service;
-
-import java.util.List;
-
-import com.goafanti.achievement.bo.AchievementEntity;
-import com.goafanti.achievement.bo.AchievementImportBo;
-import com.goafanti.achievement.bo.AchievementListBo;
-import com.goafanti.achievement.bo.AchievementOrgOwnerDetailBo;
-import com.goafanti.achievement.bo.AchievementPartnerListBo;
-import com.goafanti.achievement.bo.AchievementUserOwnerDetailBo;
-import com.goafanti.common.bo.MyCollection;
-import com.goafanti.common.bo.PolicyEntity;
-import com.goafanti.common.model.Achievement;
-import com.goafanti.core.mybatis.page.Pagination;
-import com.goafanti.demand.bo.DemandAchievementListBo;
-import com.goafanti.portal.bo.AchievementDetailBo;
-import com.goafanti.portal.bo.AchievementObject;
-import com.goafanti.portal.bo.AchievementPortalDetailBo;
-import com.goafanti.portal.bo.AchievementResultObject;
-
-public interface AchievementService {
-
-	void saveAchievement(Achievement a, String[] keywords,List<String>webPages,List<String>appPages);
-
-	int updateAchievement(Achievement a, String[] keywords, Integer sIgnin,List<String>webPages,List<String>appPages);
-
-	Achievement selectByPrimaryKey(String id);
-
-	int deleteByPrimaryKey(List<String> asList);
-
-	Pagination<AchievementObject> listMyAchievement(Integer auditStatus, String name,Integer dataCategory,  String startDate,
-			String endDate,  Integer pNo, Integer pSize);
-
-	Pagination<AchievementObject> listAchievement(String name,String ownerName,Integer category,Integer dataCategory,Integer auditStatus, 
-			String startDate,String endDate,Integer pageNo,Integer pageSize);
-	
-	int updateAuditAchievement(Achievement a, String techBroderId, Integer auditStatus);
-
-	int updateReleaseStatus(Achievement a);
-
-	AchievementUserOwnerDetailBo selectUserOwnerDetail(String id );
-
-	AchievementOrgOwnerDetailBo selectOrgOwnerDetail(String id);
-
-	List<DemandAchievementListBo> selectAchievementDemandListByAchievementId(String id);
-
-	void insertImport(List<AchievementImportBo> data);
-
-	AchievementDetailBo selectAchievementDetail(String uid, String id);
-	
-	Achievement selectAchievementDetail(String id);
-
-	int updateMatchDemand(Achievement a);
-
-	Pagination<AchievementPartnerListBo> listPartnerAchievement(String ownerId, Integer pNo, Integer pSize);
-
-	AchievementPortalDetailBo findUserPortalAchievementDetail(String id);
-
-	AchievementPortalDetailBo findOrgPortalAchievementDetail(String id);
-
-	int updateByPrimaryKeySelective(Achievement a);
-
-	Pagination<AchievementPartnerListBo> listAppUserAchievement(Integer auditStatus, Integer serialNumber, String name, String keyword,Integer dataCategory,
-			Integer category, Integer ownerType, Integer status, String releaseDateStartDate, String releaseDateEndDate,
-			Integer releaseStatus,String ownerId,Integer fieldA, Integer pNo, Integer pSize);
-
-	Pagination<AchievementPartnerListBo> listAppMyAchievement(Integer pNo, Integer pSize);
-
-	AchievementEntity selectAppUserOwnerDetail(String id);
-
-	int saveAppAchievement(Achievement a, String[] keywords);
-
-	public List<AchievementObject> recentAchievements(int size,String url,String showLocation);
-	
-	public List<AchievementObject>getHotAchievements(int size,String url,String showLocation); 
-	
-	public List<AchievementObject>getPatentList(int size,String url,String showLocation);
-	
-	public List<AchievementObject>getPracticalTechnologys(int size,String url,String showLocation);
-	
-	List<PolicyEntity> getIntellectualProperty(int size);
-	
-	AchievementObject getAchievementDetail(String id,Integer type);
-	
-	AchievementResultObject getAchievementDetailById(String id);
-	
-	List<AchievementObject>getBoutiquePatent(int size, int deletedSign);
-	
-	List<AchievementObject>guessYouLike(int size);
-	
-	int updateAuditAchievement(String id,Integer auditResult,String auditInfo);
-	
-	Pagination<AchievementObject>getAchievementObjects(AchievementObject achievementObject,Integer pageNo,Integer pageSize);
-	
-	   /**查询智者的科技成果**/
-    public List<AchievementPartnerListBo> findPartnerAchievementList(String uid);
-    
-    Pagination<AchievementObject>listInterestedAchievement(Integer pageNo,Integer pageSize);
-
-	Pagination<MyCollection> myCollectionAchievement(Integer pageNo, Integer pageSize);
-
-}
+package com.goafanti.achievement.service;
+
+import java.util.List;
+
+import org.springframework.web.multipart.MultipartFile;
+
+import com.goafanti.achievement.bo.AchievementEntity;
+import com.goafanti.achievement.bo.AchievementImportBo;
+import com.goafanti.achievement.bo.AchievementOrgOwnerDetailBo;
+import com.goafanti.achievement.bo.AchievementPartnerListBo;
+import com.goafanti.achievement.bo.AchievementUserOwnerDetailBo;
+import com.goafanti.common.bo.MyCollection;
+import com.goafanti.common.bo.PolicyEntity;
+import com.goafanti.common.model.Achievement;
+import com.goafanti.core.mybatis.page.Pagination;
+import com.goafanti.demand.bo.DemandAchievementListBo;
+import com.goafanti.portal.bo.AchievementDetailBo;
+import com.goafanti.portal.bo.AchievementObject;
+import com.goafanti.portal.bo.AchievementPortalDetailBo;
+import com.goafanti.portal.bo.AchievementResultObject;
+
+public interface AchievementService {
+
+	void saveAchievement(Achievement a, String[] keywords,List<String>webPages,List<String>appPages);
+
+	int updateAchievement(Achievement a, String[] keywords, Integer sIgnin,List<String>webPages,List<String>appPages);
+
+	Achievement selectByPrimaryKey(String id);
+
+	int deleteByPrimaryKey(List<String> asList);
+
+	Pagination<AchievementObject> listMyAchievement(Integer auditStatus, String name,Integer dataCategory,  String startDate,
+			String endDate,  Integer pNo, Integer pSize);
+
+	Pagination<AchievementObject> listAchievement(String name,String ownerName,Integer category,Integer dataCategory,Integer auditStatus, 
+			String startDate,String endDate,Integer pageNo,Integer pageSize);
+	
+	int updateAuditAchievement(Achievement a, String techBroderId, Integer auditStatus);
+
+	int updateReleaseStatus(Achievement a);
+
+	AchievementUserOwnerDetailBo selectUserOwnerDetail(String id );
+
+	AchievementOrgOwnerDetailBo selectOrgOwnerDetail(String id);
+
+	List<DemandAchievementListBo> selectAchievementDemandListByAchievementId(String id);
+
+	void insertImport(List<AchievementImportBo> data);
+
+	AchievementDetailBo selectAchievementDetail(String uid, String id);
+	
+	Achievement selectAchievementDetail(String id);
+
+	int updateMatchDemand(Achievement a);
+
+	Pagination<AchievementPartnerListBo> listPartnerAchievement(String ownerId, Integer pNo, Integer pSize);
+
+	AchievementPortalDetailBo findUserPortalAchievementDetail(String id);
+
+	AchievementPortalDetailBo findOrgPortalAchievementDetail(String id);
+
+	int updateByPrimaryKeySelective(Achievement a);
+
+	Pagination<AchievementPartnerListBo> listAppUserAchievement(Integer auditStatus, Integer serialNumber, String name, String keyword,Integer dataCategory,
+			Integer category, Integer ownerType, Integer status, String releaseDateStartDate, String releaseDateEndDate,
+			Integer releaseStatus,String ownerId,Integer fieldA, Integer pNo, Integer pSize);
+
+	Pagination<AchievementPartnerListBo> listAppMyAchievement(Integer pNo, Integer pSize);
+
+	AchievementEntity selectAppUserOwnerDetail(String id);
+
+	int saveAppAchievement(Achievement a, String[] keywords);
+
+	public List<AchievementObject> recentAchievements(int size,String url,String showLocation);
+	
+	public List<AchievementObject>getHotAchievements(int size,String url,String showLocation); 
+	
+	public List<AchievementObject>getPatentList(int size,String url,String showLocation);
+	
+	public List<AchievementObject>getPracticalTechnologys(int size,String url,String showLocation);
+	
+	List<PolicyEntity> getIntellectualProperty(int size);
+	
+	AchievementObject getAchievementDetail(String id,Integer type);
+	
+	AchievementResultObject getAchievementDetailById(String id);
+	
+	List<AchievementObject>getBoutiquePatent(int size, int deletedSign);
+	
+	List<AchievementObject>guessYouLike(int size);
+	
+	int updateAuditAchievement(String id,Integer auditResult,String auditInfo);
+	
+	Pagination<AchievementObject>getAchievementObjects(AchievementObject achievementObject,Integer pageNo,Integer pageSize);
+	
+	   /**查询智者的科技成果**/
+    public List<AchievementPartnerListBo> findPartnerAchievementList(String uid);
+    
+    Pagination<AchievementObject>listInterestedAchievement(Integer pageNo,Integer pageSize);
+
+	Pagination<MyCollection> myCollectionAchievement(Integer pageNo, Integer pageSize);
+
+	void batchSaveAchievement(MultipartFile file);
+
+}

+ 108 - 111
src/main/java/com/goafanti/achievement/service/impl/AchievementPublishServiceImpl.java

@@ -1,111 +1,108 @@
-package com.goafanti.achievement.service.impl;
-
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import com.goafanti.achievement.bo.AchievementPublishBo;
-import com.goafanti.achievement.service.AchievementPublishPageService;
-import com.goafanti.achievement.service.AchievementPublishService;
-import com.goafanti.common.bo.PublishPageBo;
-import com.goafanti.common.dao.AchievementPublishMapper;
-import com.goafanti.common.model.AchievementPublish;
-import com.goafanti.core.mybatis.BaseMybatisDao;
-import com.goafanti.core.mybatis.page.Pagination;
-import com.goafanti.core.shiro.token.TokenManager;
-
-
-@Service
-public class AchievementPublishServiceImpl extends BaseMybatisDao<AchievementPublishMapper> implements AchievementPublishService {
-
-	@Autowired
-	private AchievementPublishMapper	achievementPublishMapper;
-
-	private static final Logger				logger	= LoggerFactory.getLogger(AchievementPublishServiceImpl.class);
-
-	@Override
-	public int insertachievementPublish(AchievementPublish a) {
-		String [] aid=a.getAchievementId().split(",");
-		for (String s : aid) {
-			a.setAchievementId(s);
-			if (achievementPublishMapper.checkExisting(a)>0) {
-				continue;
-			}
-			a.setId(UUID.randomUUID().toString());
-			if (null!=TokenManager.getAdminId()) {
-				a.setPublisher(TokenManager.getAdminId());
-			}
-			if (null==a.getShowNumber()) {
-				a.setShowNumber(9999999);
-			}
-			if (null==a.getTopNumber()) {
-				a.setTopNumber(9999999);
-			}
-			a.setPublishTime(new Date());
-			achievementPublishMapper.insertSelective(a);
-		}
-		return 1;
-	}
-
-	@Override
-	public int deletePublish(String id) {
-		return achievementPublishMapper.deleteByPrimaryKey(id);
-	}
-
-	@Override
-	public int updatePublish(AchievementPublish a) {
-		AchievementPublish a1=achievementPublishMapper.selectByPrimaryKey(a.getId());
-		if (a1.getIfTop()!=a.getIfTop()&&a.getIfTop()==1) {
-			a.setTopNumber(9999999);
-		}
-		
-		return achievementPublishMapper.updateByPrimaryKeySelective(a);
-	}
-
-	@SuppressWarnings("unchecked")
-	@Override
-	public Pagination<AchievementPublishBo> listPublish(String name, String publishPlatform, Integer publishClient,
-			String publishPage, Integer ifTop, Integer pageNo, Integer pageSize,String ownerName) {
-		Map<String, Object> params=new HashMap<String, Object>();
-		if (null!=name) {
-			params.put("name", name);
-		}
-		if (null!=publishPlatform) {
-			params.put("publishPlatform", publishPlatform);
-		}
-		if (null!=publishClient) {
-			params.put("publishClient", publishClient);
-		}
-		if (null!=publishPage) {
-			params.put("publishPage", publishPage);
-		}
-		if (null!=ifTop) {
-			params.put("ifTop", ifTop);
-		}
-		if (null!=ownerName) {
-			params.put("ownerName", ownerName);
-		}
-		
-		Pagination<AchievementPublishBo> p=(Pagination<AchievementPublishBo>) findPage("findAchievementPublishByPage", "findAchievementPublishCount",
-				params,pageNo, pageSize);
-		List<AchievementPublishBo> ap=(List<AchievementPublishBo>) p.getList();
-		List <PublishPageBo> pp=AchievementPublishPageService.getBranchInformation();
-		for (AchievementPublishBo a : ap) {
-			for (PublishPageBo b : pp) {
-				if (a.getPublishPage().equals(b.getId())) {
-					a.setPublishPageName(b.getName());
-				}
-			}
-		}
-		return p;
-	}
-
-	
-	
-
-}
+package com.goafanti.achievement.service.impl;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.goafanti.achievement.bo.AchievementPublishBo;
+import com.goafanti.achievement.service.AchievementPublishPageService;
+import com.goafanti.achievement.service.AchievementPublishService;
+import com.goafanti.common.bo.PublishPageBo;
+import com.goafanti.common.dao.AchievementPublishMapper;
+import com.goafanti.common.model.AchievementPublish;
+import com.goafanti.core.mybatis.BaseMybatisDao;
+import com.goafanti.core.mybatis.page.Pagination;
+import com.goafanti.core.shiro.token.TokenManager;
+
+
+@Service
+public class AchievementPublishServiceImpl extends BaseMybatisDao<AchievementPublishMapper> implements AchievementPublishService {
+
+	@Autowired
+	private AchievementPublishMapper	achievementPublishMapper;
+
+
+	@Override
+	public int insertachievementPublish(AchievementPublish a) {
+		String [] aid=a.getAchievementId().split(",");
+		for (String s : aid) {
+			a.setAchievementId(s);
+			if (achievementPublishMapper.checkExisting(a)>0) {
+				continue;
+			}
+			a.setId(UUID.randomUUID().toString());
+			if (null!=TokenManager.getAdminId()) {
+				a.setPublisher(TokenManager.getAdminId());
+			}
+			if (null==a.getShowNumber()) {
+				a.setShowNumber(9999999);
+			}
+			if (null==a.getTopNumber()) {
+				a.setTopNumber(9999999);
+			}
+			a.setPublishTime(new Date());
+			achievementPublishMapper.insertSelective(a);
+		}
+		return 1;
+	}
+
+	@Override
+	public int deletePublish(String id) {
+		return achievementPublishMapper.deleteByPrimaryKey(id);
+	}
+
+	@Override
+	public int updatePublish(AchievementPublish a) {
+		AchievementPublish a1=achievementPublishMapper.selectByPrimaryKey(a.getId());
+		if (a1.getIfTop()!=a.getIfTop()&&a.getIfTop()==1) {
+			a.setTopNumber(9999999);
+		}
+		
+		return achievementPublishMapper.updateByPrimaryKeySelective(a);
+	}
+
+	@SuppressWarnings("unchecked")
+	@Override
+	public Pagination<AchievementPublishBo> listPublish(String name, String publishPlatform, Integer publishClient,
+			String publishPage, Integer ifTop, Integer pageNo, Integer pageSize,String ownerName) {
+		Map<String, Object> params=new HashMap<String, Object>();
+		if (null!=name) {
+			params.put("name", name);
+		}
+		if (null!=publishPlatform) {
+			params.put("publishPlatform", publishPlatform);
+		}
+		if (null!=publishClient) {
+			params.put("publishClient", publishClient);
+		}
+		if (null!=publishPage) {
+			params.put("publishPage", publishPage);
+		}
+		if (null!=ifTop) {
+			params.put("ifTop", ifTop);
+		}
+		if (null!=ownerName) {
+			params.put("ownerName", ownerName);
+		}
+		
+		Pagination<AchievementPublishBo> p=(Pagination<AchievementPublishBo>) findPage("findAchievementPublishByPage", "findAchievementPublishCount",
+				params,pageNo, pageSize);
+		List<AchievementPublishBo> ap=(List<AchievementPublishBo>) p.getList();
+		List <PublishPageBo> pp=AchievementPublishPageService.getBranchInformation();
+		for (AchievementPublishBo a : ap) {
+			for (PublishPageBo b : pp) {
+				if (a.getPublishPage().equals(b.getId())) {
+					a.setPublishPageName(b.getName());
+				}
+			}
+		}
+		return p;
+	}
+
+	
+	
+
+}

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


+ 32 - 0
src/main/java/com/goafanti/admin/controller/AdminApiController.java

@@ -5,6 +5,7 @@ import java.util.Calendar;
 import java.util.UUID;
 
 import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
 import javax.validation.Valid;
 
 import org.springframework.beans.BeanUtils;
@@ -22,6 +23,7 @@ import com.goafanti.common.constant.ErrorConstants;
 import com.goafanti.common.controller.CertifyApiController;
 import com.goafanti.common.enums.AchievementAuditStatus;
 import com.goafanti.common.enums.AdminFields;
+import com.goafanti.common.enums.AttachmentType;
 import com.goafanti.common.enums.CertifySubmitType;
 import com.goafanti.common.enums.IdentityAuditStatus;
 import com.goafanti.common.enums.IdentityProcess;
@@ -440,6 +442,36 @@ public class AdminApiController extends CertifyApiController {
 		return res;
 	}
 	
+	//管理员修改用户图片
+		@RequestMapping(value="/updatePictureUrl", method = RequestMethod.GET)
+		public Result updatePictureUrl(String uid,String url){
+			Result res = new Result();
+			if (StringUtils.isBlank(uid)||StringUtils.isBlank(url)) {
+				res.getError().add(buildError(ErrorConstants.PARAM_ERROR,"",""));
+				return res;
+			}
+			res.setData(userService.updatePictureUrl(uid, url));
+			return res;
+		}
+	
+		
+		/**
+		 * 	管理员上传用户图片
+		 * @param req
+		 * @param sign
+		 * @return
+		 */
+	    @RequestMapping(value = "/uploadPicture", method = RequestMethod.POST)
+	    public Result uploadPicture(HttpServletRequest req, String sign,String aid) {
+	        Result res = new Result();
+	        AttachmentType attachmentType = AttachmentType.getField(sign);
+	        if (attachmentType == AttachmentType.USER_PICTURE) {
+	            res.setData(handleFiles(res, "/user/", false, req, sign, aid));
+	        } else {
+	            res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
+	        }
+	        return res;
+	    }
 	
 	
 }

+ 148 - 147
src/main/java/com/goafanti/common/constant/ErrorConstants.java

@@ -1,148 +1,149 @@
-package com.goafanti.common.constant;
-
-public class ErrorConstants {
-
-	public static final String	NON_LOGIN							= "NON_LOGIN";
-	
-	public static final String	NO_CERTIFY							= "NO_CERTIFY";
-
-	public static final String	VCODE_ERROR							= "VCODE_ERROR";
-
-	public static final String	NO_AUTH_ERROR						= "NO_AUTH_ERROR";
-
-	public static final String	PARAM_ERROR							= "PARAM_ERROR";
-
-	public static final String	PARAM_INTEGER_ERROR					= "PARAM_INTEGER_ERROR";
-
-	public static final String	PARAM_EMPTY_ERROR					= "PARAM_EMPTY_ERROR";
-	
-	public static final String	PARAM_BEING_ERROR					= "PARAM_BEING_ERROR";
-	
-	public static final String	PARAM_SIZE_ERROR					= "PARAM_SIZE_ERROR";
-
-	public static final String	PARAM_PATTERN_ERROR					= "PARAM_PATTERN_ERROR";
-
-	public static final String	EMAIL_SIZE_ERROR					= "EMAIL_SIZE_ERROR";
-
-	public static final String	EMAIL_PATTERN_ERROR					= "EMAIL_PATTERN_ERROR";
-
-	public static final String	DUNPLICATE_KAY_ERROR				= "DUNPLICATE_KAY_ERROR";
-
-	public static final String	DATA_EMPTY_ERROR					= "DATA_EMPTY_ERROR";
-
-	public static final String	PWD_NOT_MATCH_ERROR					= "PWD_NOT_MATCH_ERROR";
-
-	public static final String	PWD_SAME_ERROR						= "PWD_SAME_ERROR";
-
-	public static final String	USER_ALREADY_EXIST					= "USER_ALREADY_EXIST";
-
-	public static final String	MOBILE_PATTERN_ERROR				= "MOBILE_PATTERN_ERROR";
-
-	public static final String	MOBILE_SIZE_ERROR					= "MOBILE_SIZE_ERROR";
-
-	public static final String	MOBILE_SAME_ERROR					= "MOBILE_SAME_ERROR";
-
-	public static final String	MOBILE_EMPTY_ERROR					= "MOBILE_EMPTY_ERROR";
-
-	public static final String	IDNUMBER_SIZE_ERROR					= "IDNUMBER_SIZE_ERROR";
-
-	public static final String	IDNUMBER_PATTERN_ERROR				= "IDNUMBER_PATTERN_ERROR";
-
-	public static final String	MCODE_ERROR							= "MCODE_ERROR";
-
-	public static final String	MCODE_OVERTIME_ERROR				= "MCODE_OVERTIME_ERROR";
-
-	public static final String	NON_REGISTER						= "NON_REGISTER";
-
-	public static final String	RESET_CODE_ERROR					= "RESET_CODE_ERROR";
-
-	public static final String	RESET_CODE_OVERTIME					= "RESET_CODE_OVERTIME";
-
-	public static final String	FILE_NON_EXISTENT					= "FILE_NON_EXISTENT";
-
-	public static final String	INSUFFICIENT_AUTHORITY_ERROR		= "INSUFFICIENT_AUTHORITY_ERROR";
-
-	public static final String	NON_CERTIFIED						= "NON_CERTIFIED";
-
-	public static final String	DUPLICATE_DATA_ERROR				= "DUPLICATE_DATA_ERROR";
-
-	public static final String	FILE_PATTERN_ERROR					= "FILE_PATTERN_ERROR";
-
-	public static final String	RECORD_CALLBACK						= "RECORD_CALLBACK";
-
-	public static final String	RECORD_SETTLEMENT					= "RECORD_SETTLEMENT";
-
-	public static final String	STATUS_ERROR						= "STATUS_ERROR";
-
-	public static final String	CONTRACT_PATENT_CREATED				= "CONTRACT_PATENT_CREATED";
-
-	public static final String	CONTRACT_COPYRIGHT_CREATED			= "CONTRACT_COPYRIGHT_CREATED";
-
-	public static final String	CONTRACT_TECHPROJECT_CREATED		= "CONTRACT_TECHPROJECT_CREATED";
-
-	public static final String	CONTRACT_COGNIZANCE_CREATED			= "CONTRACT_COGNIZANCE_CREATED";
-
-	public static final String	RECORD_REJECT						= "RECORD_REJECT";
-
-	public static final String	EVALUATE_ID							= "EVALUATE_ID";
-
-	public static final String	EVALUATE_STEP						= "EVALUATE_STEP";
-
-	public static final String	EVALUATE_PARAM						= "EVALUATE_PARAM";
-
-	public static final String	CONTRACT_YEAR_SECTION				= "CONTRACT_YEAR_SECTION";
-
-	public static final String	VCODE_EMPTY_ERROR					= "VCODE_EMPTY_ERROR";
-
-	public static final String	MCODE_FREQUENCY_ERROR				= "MCODE_FREQUENCY_ERROR";
-
-	public static final String	MCODE_EMPTY_ERROR					= "MCODE_EMPTY_ERROR";
-
-	public static final String	IDENTITY_PAY_OVER_TIME				= "IDENTITY_PAY_OVER_TIME";
-
-	public static final String	OVER_MAX_WRONG_COUNT				= "OVER_MAX_WRONG_COUNT";
-
-	public static final String	WRONG_MONEY							= "WRONG_MONEY";
-
-	public static final String	M_CODE_ERROR						= "M_CODE_ERROR";
-	
-	public static final String MARKET_BOOTH_MAX						= "MARKET_BOOTH_MAX";	
-	
-	public static final String CUSTOMER_ALREADY_EXIST				= "CUSTOMER_ALREADY_EXIST";
-	
-	public static final String CUSTOMER_ALREADY_LOCKED				= "CUSTOMER_ALREADY_LOCKED";
-	
-	public static final String CUSTOMER_ALREADY_RECEIVE				= "CUSTOMER_ALREADY_RECEIVE";
-			
-	public static final String CUSTOMER_TRANSFER_FAIL				= "CUSTOMER_ALREADY_RECEIVE";
-	
-	public static final String BUSINESS_ALREADY_LOCKED				= "BUSINESS_ALREADY_LOCKED";
-	
-	public static final String BUSINESS_ALREADY_EXIST				= "BUSINESS_ALREADY_EXIST";
-	
-	public static final String AT_LEAST_A_BUSINESS					= "AT_LEAST_A_BUSINESS";
-	
-	public static final String	SON_ALREADY_EXIST					= "SON_ALREADY_EXIST";
-	
-	public static final String USER_NICKNAME_EXIST					= "USER_NICKNAME_EXIST";
-	
-	public static final String NOT_ACCORD_WITH_NEXT					= "NOT_ACCORD_WITH_NEXT";
-	
-	public static final String ORDER_CAN_NOT_MODIFY					= "ORDER_CAN_NOT_MODIFY";
-	
-	public static final String ORDER_ALREADY_FREEZE                 = "ORDER_ALREADY_FREEZE";
-	
-	public static final String ORDER_ALREADY_REVOKE					= "ORDER_ALREADY_REVOKE";
-	
-	public static final String ORDER_NOT_EXIST						= "ORDER_NOT_EXIST";
-	
-	public static final String PAY_BEYOND_SIGN						= "PAY_BEYOND_SIGN";
-	
-	public static final String REFUND_BEYOND_SIGN					= "REFUND_BEYOND_SIGN";
-	
-	public static final String BILL_ALREADY_EXPIRE					= "BILL_ALREADY_EXPIRE";
-	
-	public static final String USER_CONTACT_ALREADY_EXIST           = "USER_CONTACT_ALREADY_EXIST";
-	
-	public static final String USER_UN_AUTHENTICATION				= "USER_UN_AUTHENTICATION";
+package com.goafanti.common.constant;
+
+public class ErrorConstants {
+
+	public static final String	NON_LOGIN							= "NON_LOGIN";
+	
+	public static final String	NO_CERTIFY							= "NO_CERTIFY";
+
+	public static final String	VCODE_ERROR							= "VCODE_ERROR";
+
+	public static final String	NO_AUTH_ERROR						= "NO_AUTH_ERROR";
+
+	/** 参数错误 */
+	public static final String	PARAM_ERROR							= "PARAM_ERROR";
+
+	public static final String	PARAM_INTEGER_ERROR					= "PARAM_INTEGER_ERROR";
+
+	public static final String	PARAM_EMPTY_ERROR					= "PARAM_EMPTY_ERROR";
+	
+	public static final String	PARAM_BEING_ERROR					= "PARAM_BEING_ERROR";
+	
+	public static final String	PARAM_SIZE_ERROR					= "PARAM_SIZE_ERROR";
+
+	public static final String	PARAM_PATTERN_ERROR					= "PARAM_PATTERN_ERROR";
+
+	public static final String	EMAIL_SIZE_ERROR					= "EMAIL_SIZE_ERROR";
+
+	public static final String	EMAIL_PATTERN_ERROR					= "EMAIL_PATTERN_ERROR";
+
+	public static final String	DUNPLICATE_KAY_ERROR				= "DUNPLICATE_KAY_ERROR";
+
+	public static final String	DATA_EMPTY_ERROR					= "DATA_EMPTY_ERROR";
+
+	public static final String	PWD_NOT_MATCH_ERROR					= "PWD_NOT_MATCH_ERROR";
+
+	public static final String	PWD_SAME_ERROR						= "PWD_SAME_ERROR";
+
+	public static final String	USER_ALREADY_EXIST					= "USER_ALREADY_EXIST";
+
+	public static final String	MOBILE_PATTERN_ERROR				= "MOBILE_PATTERN_ERROR";
+
+	public static final String	MOBILE_SIZE_ERROR					= "MOBILE_SIZE_ERROR";
+
+	public static final String	MOBILE_SAME_ERROR					= "MOBILE_SAME_ERROR";
+
+	public static final String	MOBILE_EMPTY_ERROR					= "MOBILE_EMPTY_ERROR";
+
+	public static final String	IDNUMBER_SIZE_ERROR					= "IDNUMBER_SIZE_ERROR";
+
+	public static final String	IDNUMBER_PATTERN_ERROR				= "IDNUMBER_PATTERN_ERROR";
+
+	public static final String	MCODE_ERROR							= "MCODE_ERROR";
+
+	public static final String	MCODE_OVERTIME_ERROR				= "MCODE_OVERTIME_ERROR";
+
+	public static final String	NON_REGISTER						= "NON_REGISTER";
+
+	public static final String	RESET_CODE_ERROR					= "RESET_CODE_ERROR";
+
+	public static final String	RESET_CODE_OVERTIME					= "RESET_CODE_OVERTIME";
+
+	public static final String	FILE_NON_EXISTENT					= "FILE_NON_EXISTENT";
+
+	public static final String	INSUFFICIENT_AUTHORITY_ERROR		= "INSUFFICIENT_AUTHORITY_ERROR";
+
+	public static final String	NON_CERTIFIED						= "NON_CERTIFIED";
+
+	public static final String	DUPLICATE_DATA_ERROR				= "DUPLICATE_DATA_ERROR";
+
+	public static final String	FILE_PATTERN_ERROR					= "FILE_PATTERN_ERROR";
+
+	public static final String	RECORD_CALLBACK						= "RECORD_CALLBACK";
+
+	public static final String	RECORD_SETTLEMENT					= "RECORD_SETTLEMENT";
+
+	public static final String	STATUS_ERROR						= "STATUS_ERROR";
+
+	public static final String	CONTRACT_PATENT_CREATED				= "CONTRACT_PATENT_CREATED";
+
+	public static final String	CONTRACT_COPYRIGHT_CREATED			= "CONTRACT_COPYRIGHT_CREATED";
+
+	public static final String	CONTRACT_TECHPROJECT_CREATED		= "CONTRACT_TECHPROJECT_CREATED";
+
+	public static final String	CONTRACT_COGNIZANCE_CREATED			= "CONTRACT_COGNIZANCE_CREATED";
+
+	public static final String	RECORD_REJECT						= "RECORD_REJECT";
+
+	public static final String	EVALUATE_ID							= "EVALUATE_ID";
+
+	public static final String	EVALUATE_STEP						= "EVALUATE_STEP";
+
+	public static final String	EVALUATE_PARAM						= "EVALUATE_PARAM";
+
+	public static final String	CONTRACT_YEAR_SECTION				= "CONTRACT_YEAR_SECTION";
+
+	public static final String	VCODE_EMPTY_ERROR					= "VCODE_EMPTY_ERROR";
+
+	public static final String	MCODE_FREQUENCY_ERROR				= "MCODE_FREQUENCY_ERROR";
+
+	public static final String	MCODE_EMPTY_ERROR					= "MCODE_EMPTY_ERROR";
+
+	public static final String	IDENTITY_PAY_OVER_TIME				= "IDENTITY_PAY_OVER_TIME";
+
+	public static final String	OVER_MAX_WRONG_COUNT				= "OVER_MAX_WRONG_COUNT";
+
+	public static final String	WRONG_MONEY							= "WRONG_MONEY";
+
+	public static final String	M_CODE_ERROR						= "M_CODE_ERROR";
+	
+	public static final String MARKET_BOOTH_MAX						= "MARKET_BOOTH_MAX";	
+	
+	public static final String CUSTOMER_ALREADY_EXIST				= "CUSTOMER_ALREADY_EXIST";
+	
+	public static final String CUSTOMER_ALREADY_LOCKED				= "CUSTOMER_ALREADY_LOCKED";
+	
+	public static final String CUSTOMER_ALREADY_RECEIVE				= "CUSTOMER_ALREADY_RECEIVE";
+			
+	public static final String CUSTOMER_TRANSFER_FAIL				= "CUSTOMER_ALREADY_RECEIVE";
+	
+	public static final String BUSINESS_ALREADY_LOCKED				= "BUSINESS_ALREADY_LOCKED";
+	
+	public static final String BUSINESS_ALREADY_EXIST				= "BUSINESS_ALREADY_EXIST";
+	
+	public static final String AT_LEAST_A_BUSINESS					= "AT_LEAST_A_BUSINESS";
+	
+	public static final String	SON_ALREADY_EXIST					= "SON_ALREADY_EXIST";
+	
+	public static final String USER_NICKNAME_EXIST					= "USER_NICKNAME_EXIST";
+	
+	public static final String NOT_ACCORD_WITH_NEXT					= "NOT_ACCORD_WITH_NEXT";
+	
+	public static final String ORDER_CAN_NOT_MODIFY					= "ORDER_CAN_NOT_MODIFY";
+	
+	public static final String ORDER_ALREADY_FREEZE                 = "ORDER_ALREADY_FREEZE";
+	
+	public static final String ORDER_ALREADY_REVOKE					= "ORDER_ALREADY_REVOKE";
+	
+	public static final String ORDER_NOT_EXIST						= "ORDER_NOT_EXIST";
+	
+	public static final String PAY_BEYOND_SIGN						= "PAY_BEYOND_SIGN";
+	
+	public static final String REFUND_BEYOND_SIGN					= "REFUND_BEYOND_SIGN";
+	
+	public static final String BILL_ALREADY_EXPIRE					= "BILL_ALREADY_EXPIRE";
+	
+	public static final String USER_CONTACT_ALREADY_EXIST           = "USER_CONTACT_ALREADY_EXIST";
+	
+	public static final String USER_UN_AUTHENTICATION				= "USER_UN_AUTHENTICATION";
 }

+ 286 - 285
src/main/java/com/goafanti/common/controller/BaseApiController.java

@@ -1,285 +1,286 @@
-package com.goafanti.common.controller;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.commons.fileupload.servlet.ServletFileUpload;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-import org.springframework.web.multipart.MultipartFile;
-import org.springframework.web.multipart.MultipartRequest;
-
-import com.goafanti.common.bo.Result;
-import com.goafanti.common.utils.FileUtils;
-import com.goafanti.common.utils.LoggerUtils;
-import com.goafanti.core.shiro.token.TokenManager;
-
-@RestController
-@RequestMapping(value = "/api")
-public class BaseApiController extends BaseController {
-
-	@Value(value = "${upload.path}")
-	private String	uploadPath			= null;
-	@Value(value = "${upload.private.path}")
-	private String	uploadPrivatePath	= null;
-
-	/**
-	 * 
-	 * @param request
-	 * @return
-	 */
-	protected List<MultipartFile> getFiles(HttpServletRequest request) {
-		if (ServletFileUpload.isMultipartContent(request)) {
-			Iterator<String> itr = ((MultipartRequest) request).getFileNames();
-			List<MultipartFile> files = new ArrayList<MultipartFile>();
-			if (itr.hasNext()) {
-				files.add(((MultipartRequest) request).getFile(itr.next()));
-			}
-			return files;
-		}
-		return new ArrayList<MultipartFile>();
-	}
-
-	/**
-	 * 
-	 * @param res
-	 * @param path
-	 * @param isPrivate
-	 * @param req
-	 * @param sign
-	 * @return
-	 */
-	protected String handleFile(Result res, String path, boolean isPrivate, HttpServletRequest req, String sign) {
-		List<MultipartFile> files = getFiles(req);
-		String fileName = "";
-		if (!files.isEmpty()) {
-			try {
-				MultipartFile mf = files.get(0);
-				fileName = FileUtils.mosaicFileName(mf, isPrivate, sign, path, TokenManager.getUserId());
-				mf.transferTo(isPrivate ? toPrivateFile(fileName) : toFile(fileName));
-				LoggerUtils.debug(getClass(), fileName + " 文件上传成功");
-			} catch (Exception e) {
-				LoggerUtils.error(getClass(), "文件上传失败", e);
-				res.getError().add(buildError("", "文件上传失败!"));
-			}
-		} else {
-			res.getError().add(buildError("", "文件上传失败!"));
-		}
-		return fileName;
-	}
-
-	/**
-	 * 
-	 * @param res
-	 * @param path
-	 * @param isPrivate
-	 * @param req
-	 * @param sign
-	 * @return
-	 */
-	protected String handleFile(Result res, boolean isPrivate, HttpServletRequest req, String... fileName) {
-		List<MultipartFile> files = getFiles(req);
-		String realFilePath = "";
-		if (!files.isEmpty()) {
-			try {
-				MultipartFile mf = files.get(0);
-				realFilePath = FileUtils.buildFilePath(fileName) + FileUtils.getSuffix(mf.getOriginalFilename());
-				File f = isPrivate ? toPrivateFile(realFilePath) : toFile(realFilePath);
-				mf.transferTo(f);
-				LoggerUtils.debug(getClass(), realFilePath + " 文件上传成功");
-			} catch (Exception e) {
-				LoggerUtils.error(getClass(), "文件上传失败", e);
-				res.getError().add(buildError("", "文件上传失败!"));
-			}
-		} else {
-			res.getError().add(buildError("", "文件上传失败!"));
-		}
-		return realFilePath;
-	}
-
-	/**
-	 * 
-	 * @param res
-	 * @param fileName
-	 * @param filePath
-	 */
-	protected void downloadFile(HttpServletResponse res, String fileName, String filePath) {
-		FileUtils.downloadFile(res, fileName, uploadPrivatePath + filePath);
-	}
-
-	protected void downloadUnPrivateFile(HttpServletResponse res, String fileName, String filePath) {
-		FileUtils.downloadFile(res, fileName, uploadPath + filePath);
-	}
-
-	private File buildFile(String filePath) {
-		File toFile = new File(filePath);
-		toFile.mkdirs();
-		return toFile;
-	}
-
-	/**
-	 * 
-	 * @param fileName
-	 * @return
-	 */
-	protected File toFile(String fileName) {
-		return buildFile(uploadPath + fileName);
-	}
-
-	/**
-	 * 
-	 * @param fileName
-	 * @return
-	 */
-	protected File toPrivateFile(String fileName) {
-		return buildFile(uploadPrivatePath + fileName);
-	}
-
-	/**
-	 * 
-	 * @param fileName
-	 * @return
-	 */
-	protected File toAdminPrivateFile(String fileName) {
-		return buildFile(uploadPrivatePath + FileUtils.buildFilePath("/admin/", fileName));
-	}
-
-	protected Integer getPageNo(String pageNo) {
-		if (StringUtils.isNumeric(pageNo)) {
-			Integer pn = Integer.parseInt(pageNo);
-			return pn < 1 ? 1 : pn;
-		}
-		return 1;
-	}
-
-	protected Integer getPageSize(String pageSize) {
-		if (StringUtils.isNumeric(pageSize)) {
-			Integer ps = Integer.parseInt(pageSize);
-			return ps > 50 ? 50 : (ps < 10 ? 10 : ps);
-		}
-		return 10;
-	}
-
-	protected String handleFiles(Result res, String path, boolean isPrivate, HttpServletRequest req, String sign,
-			String uid) {
-		List<MultipartFile> files = getFiles(req);
-		MultipartFile mf = files.get(0);
-		String fileName = FileUtils.mosaicFileName(mf, isPrivate, sign, path,
-				StringUtils.isBlank(uid) ? TokenManager.getUserId() : uid);
-		if (!files.isEmpty()) {
-			try {
-				if (isPrivate) {
-					mf.transferTo(toPrivateFile(fileName));
-				} else {
-					mf.transferTo(toFile(fileName));
-				}
-				LoggerUtils.debug(getClass(), fileName + " 文件上传成功");
-			} catch (IllegalStateException | IOException e) {
-				LoggerUtils.error(getClass(), "文件上传失败", e);
-				res.getError().add(buildError("", "文件上传失败!"));
-				return "";
-			}
-		} else {
-			res.getError().add(buildError("", "文件上传失败!"));
-			return "";
-		}
-		return fileName;
-	}
-
-	protected Integer handlePageNo(String pageNo) {
-		try {
-			Integer n = Integer.valueOf(pageNo);
-			return n < 1 ? 1 : n;
-		} catch (Exception e) {
-			return 1;
-		}
-	}
-
-	protected Integer handlePageSize(String pageSize) {
-		try {
-			Integer s = Integer.valueOf(pageSize);
-			return s < 5 ? 5 : s > 100 ? 100 : s;
-		} catch (Exception e) {
-			return 10;
-		}
-	}
-
-	protected Result res() {
-		return new Result();
-	}
-	
-	
-	@SuppressWarnings("resource")
-	protected String handleBaseFiles(Result res, String path, boolean isPrivate, byte[] bs, String sign,
-			String uid,String fn) {
-		String fileName = FileUtils.mosaicFileName("", isPrivate, path, StringUtils.isBlank(uid) ? TokenManager.getUserId() : uid);
-		OutputStream fos = null;
-		if (bs != null && bs.length>0) {
-			try {
-				if (isPrivate) {
-					File filePath = new File(uploadPrivatePath + fileName);
-					if(!filePath.exists()){
-						filePath.mkdirs();
-					}
-					fileName += "/"+ fn; 
-					System.out.println("------------"+ uploadPrivatePath + fileName);
-					fos = new FileOutputStream(new File(uploadPrivatePath + fileName));
-				} else {
-					File filePath = new File(uploadPath + fileName);
-					if(!filePath.exists()){
-						filePath.mkdirs();
-					}
-					fileName += "/" + fn; 
-					System.out.println("------------"+ uploadPath + fileName);
-					fos = new FileOutputStream(new File(uploadPath + fileName));
-				}
-				fos.write(bs);
-				LoggerUtils.debug(getClass(), fileName + " 文件上传成功");
-			} catch (IllegalStateException | IOException e) {
-				LoggerUtils.error(getClass(), "文件上传失败", e);
-				res.getError().add(buildError("", "文件上传失败!"));
-				return "";
-			}
-		} else {
-			res.getError().add(buildError("", "文件上传失败!"));
-			return "";
-		}
-		return fileName;
-	}
-	
-	protected String handleVideoFiles(Result res, HttpServletRequest req,String local) {
-		List<MultipartFile> files = getFiles(req);
-		MultipartFile mf = files.get(0);
-		File fd = new File(local);
-		if(!fd.exists()){
-			fd.mkdirs();
-		}
-		String fileName = local + "/" + System.nanoTime() + ".mp4" ;
-		if (!files.isEmpty()) {
-			try {
-				File f = new File(fileName);
-				mf.transferTo(f);
-				LoggerUtils.debug(getClass(), fileName + " 文件上传成功");
-				LoggerUtils.debug(getClass(), f.getAbsolutePath() + " 文件上传成功");
-			} catch (IllegalStateException | IOException e) {
-				LoggerUtils.error(getClass(), "文件上传失败", e);
-				res.getError().add(buildError("", "文件上传失败!"));
-				return "";
-			}
-		} else {
-			res.getError().add(buildError("", "文件上传失败!"));
-			return "";
-		}
-		return fileName;
-	}
-}
+package com.goafanti.common.controller;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.fileupload.servlet.ServletFileUpload;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.MultipartRequest;
+
+import com.goafanti.common.bo.Result;
+import com.goafanti.common.utils.FileUtils;
+import com.goafanti.common.utils.LoggerUtils;
+import com.goafanti.core.shiro.token.TokenManager;
+
+@RestController
+@RequestMapping(value = "/api")
+public class BaseApiController extends BaseController {
+
+	@Value(value = "${upload.path}")
+	private String	uploadPath			= null;
+	@Value(value = "${upload.private.path}")
+	private String	uploadPrivatePath	= null;
+
+	/**
+	 * 
+	 * @param request
+	 * @return
+	 */
+	protected List<MultipartFile> getFiles(HttpServletRequest request) {
+		if (ServletFileUpload.isMultipartContent(request)) {
+			Iterator<String> itr = ((MultipartRequest) request).getFileNames();
+			List<MultipartFile> files = new ArrayList<MultipartFile>();
+			if (itr.hasNext()) {
+				files.add(((MultipartRequest) request).getFile(itr.next()));
+			}
+			return files;
+		}
+		return new ArrayList<MultipartFile>();
+	}
+
+	/**
+	 * 
+	 * @param res
+	 * @param path
+	 * @param isPrivate
+	 * @param req
+	 * @param sign
+	 * @return
+	 */
+	protected String handleFile(Result res, String path, boolean isPrivate, HttpServletRequest req, String sign) {
+		List<MultipartFile> files = getFiles(req);
+		String fileName = "";
+		if (!files.isEmpty()) {
+			try {
+				MultipartFile mf = files.get(0);
+				fileName = FileUtils.mosaicFileName(mf, isPrivate, sign, path, TokenManager.getUserId());
+				mf.transferTo(isPrivate ? toPrivateFile(fileName) : toFile(fileName));
+				LoggerUtils.debug(getClass(), fileName + " 文件上传成功");
+			} catch (Exception e) {
+				LoggerUtils.error(getClass(), "文件上传失败", e);
+				res.getError().add(buildError("", "文件上传失败!"));
+			}
+		} else {
+			res.getError().add(buildError("", "文件上传失败!"));
+		}
+		return fileName;
+	}
+	
+
+	/**
+	 * 
+	 * @param res
+	 * @param path
+	 * @param isPrivate
+	 * @param req
+	 * @param sign
+	 * @return
+	 */
+	protected String handleFile(Result res, boolean isPrivate, HttpServletRequest req, String... fileName) {
+		List<MultipartFile> files = getFiles(req);
+		String realFilePath = "";
+		if (!files.isEmpty()) {
+			try {
+				MultipartFile mf = files.get(0);
+				realFilePath = FileUtils.buildFilePath(fileName) + FileUtils.getSuffix(mf.getOriginalFilename());
+				File f = isPrivate ? toPrivateFile(realFilePath) : toFile(realFilePath);
+				mf.transferTo(f);
+				LoggerUtils.debug(getClass(), realFilePath + " 文件上传成功");
+			} catch (Exception e) {
+				LoggerUtils.error(getClass(), "文件上传失败", e);
+				res.getError().add(buildError("", "文件上传失败!"));
+			}
+		} else {
+			res.getError().add(buildError("", "文件上传失败!"));
+		}
+		return realFilePath;
+	}
+
+	/**
+	 * 
+	 * @param res
+	 * @param fileName
+	 * @param filePath
+	 */
+	protected void downloadFile(HttpServletResponse res, String fileName, String filePath) {
+		FileUtils.downloadFile(res, fileName, uploadPath + filePath);
+	}
+
+	protected void downloadUnPrivateFile(HttpServletResponse res, String fileName, String filePath) {
+		FileUtils.downloadFile(res, fileName, uploadPrivatePath + filePath);
+	}
+
+	private File buildFile(String filePath) {
+		File toFile = new File(filePath);
+		toFile.mkdirs();
+		return toFile;
+	}
+
+	/**
+	 * 
+	 * @param fileName
+	 * @return
+	 */
+	protected File toFile(String fileName) {
+		return buildFile(uploadPath + fileName);
+	}
+
+	/**
+	 * 
+	 * @param fileName
+	 * @return
+	 */
+	protected File toPrivateFile(String fileName) {
+		return buildFile(uploadPrivatePath + fileName);
+	}
+
+	/**
+	 * 
+	 * @param fileName
+	 * @return
+	 */
+	protected File toAdminPrivateFile(String fileName) {
+		return buildFile(uploadPrivatePath + FileUtils.buildFilePath("/admin/", fileName));
+	}
+
+	protected Integer getPageNo(String pageNo) {
+		if (StringUtils.isNumeric(pageNo)) {
+			Integer pn = Integer.parseInt(pageNo);
+			return pn < 1 ? 1 : pn;
+		}
+		return 1;
+	}
+
+	protected Integer getPageSize(String pageSize) {
+		if (StringUtils.isNumeric(pageSize)) {
+			Integer ps = Integer.parseInt(pageSize);
+			return ps > 50 ? 50 : (ps < 10 ? 10 : ps);
+		}
+		return 10;
+	}
+
+	protected String handleFiles(Result res, String path, boolean isPrivate, HttpServletRequest req, String sign,
+			String uid) {
+		List<MultipartFile> files = getFiles(req);
+		MultipartFile mf = files.get(0);
+		String fileName = FileUtils.mosaicFileName(mf, isPrivate, sign, path,
+				StringUtils.isBlank(uid) ? TokenManager.getUserId() : uid);
+		if (!files.isEmpty()) {
+			try {
+				if (isPrivate) {
+					mf.transferTo(toPrivateFile(fileName));
+				} else {
+					mf.transferTo(toFile(fileName));
+				}
+				LoggerUtils.debug(getClass(), fileName + " 文件上传成功");
+			} catch (IllegalStateException | IOException e) {
+				LoggerUtils.error(getClass(), "文件上传失败", e);
+				res.getError().add(buildError("", "文件上传失败!"));
+				return "";
+			}
+		} else {
+			res.getError().add(buildError("", "文件上传失败!"));
+			return "";
+		}
+		return fileName;
+	}
+
+	protected Integer handlePageNo(String pageNo) {
+		try {
+			Integer n = Integer.valueOf(pageNo);
+			return n < 1 ? 1 : n;
+		} catch (Exception e) {
+			return 1;
+		}
+	}
+
+	protected Integer handlePageSize(String pageSize) {
+		try {
+			Integer s = Integer.valueOf(pageSize);
+			return s < 5 ? 5 : s > 100 ? 100 : s;
+		} catch (Exception e) {
+			return 10;
+		}
+	}
+
+	protected Result res() {
+		return new Result();
+	}
+	
+	
+	@SuppressWarnings("resource")
+	protected String handleBaseFiles(Result res, String path, boolean isPrivate, byte[] bs, String sign,
+			String uid,String fn) {
+		String fileName = FileUtils.mosaicFileName("", isPrivate, path, StringUtils.isBlank(uid) ? TokenManager.getUserId() : uid);
+		OutputStream fos = null;
+		if (bs != null && bs.length>0) {
+			try {
+				if (isPrivate) {
+					File filePath = new File(uploadPrivatePath + fileName);
+					if(!filePath.exists()){
+						filePath.mkdirs();
+					}
+					fileName += "/"+ fn; 
+					System.out.println("------------"+ uploadPrivatePath + fileName);
+					fos = new FileOutputStream(new File(uploadPrivatePath + fileName));
+				} else {
+					File filePath = new File(uploadPath + fileName);
+					if(!filePath.exists()){
+						filePath.mkdirs();
+					}
+					fileName += "/" + fn; 
+					System.out.println("------------"+ uploadPath + fileName);
+					fos = new FileOutputStream(new File(uploadPath + fileName));
+				}
+				fos.write(bs);
+				LoggerUtils.debug(getClass(), fileName + " 文件上传成功");
+			} catch (IllegalStateException | IOException e) {
+				LoggerUtils.error(getClass(), "文件上传失败", e);
+				res.getError().add(buildError("", "文件上传失败!"));
+				return "";
+			}
+		} else {
+			res.getError().add(buildError("", "文件上传失败!"));
+			return "";
+		}
+		return fileName;
+	}
+	
+	protected String handleVideoFiles(Result res, HttpServletRequest req,String local) {
+		List<MultipartFile> files = getFiles(req);
+		MultipartFile mf = files.get(0);
+		File fd = new File(local);
+		if(!fd.exists()){
+			fd.mkdirs();
+		}
+		String fileName = local + "/" + System.nanoTime() + ".mp4" ;
+		if (!files.isEmpty()) {
+			try {
+				File f = new File(fileName);
+				mf.transferTo(f);
+				LoggerUtils.debug(getClass(), fileName + " 文件上传成功");
+				LoggerUtils.debug(getClass(), f.getAbsolutePath() + " 文件上传成功");
+			} catch (IllegalStateException | IOException e) {
+				LoggerUtils.error(getClass(), "文件上传失败", e);
+				res.getError().add(buildError("", "文件上传失败!"));
+				return "";
+			}
+		} else {
+			res.getError().add(buildError("", "文件上传失败!"));
+			return "";
+		}
+		return fileName;
+	}
+}

+ 3 - 3
src/main/java/com/goafanti/common/controller/PortalController.java

@@ -350,7 +350,7 @@ public class PortalController extends BaseController {
 		Result result = new Result();
 		result.setData(communityService.addRead(id));
 		return result;
-	}
+	}
 	//新增评论
 	@RequestMapping(value="/portal/special/addComment",method = RequestMethod.GET)
 	@ResponseBody
@@ -359,7 +359,7 @@ public class PortalController extends BaseController {
 		result.setData(communityService.addComment(id));
 		return result;
 	}
-	
+	
 	//新增点赞
 	@RequestMapping(value="/portal/special/addStar",method = RequestMethod.GET)
 	@ResponseBody
@@ -377,5 +377,5 @@ public class PortalController extends BaseController {
 		//查看更多
 		res.setData(communityService.getJtKnowledgeBaseList(knowledgeBase, pageNo, pageSize, 2));
 		return res;
-	}
+	}
 }

+ 2 - 0
src/main/java/com/goafanti/common/dao/AchievementPublishMapper.java

@@ -101,4 +101,6 @@ public interface AchievementPublishMapper {
 	List<String>getPublishPagesById(String id);
 
 	int deleteByAchievementId(String id);
+
+	void insertBatch(List<AchievementPublish> publish);
 }

+ 2 - 0
src/main/java/com/goafanti/common/dao/DemandPublishMapper.java

@@ -81,4 +81,6 @@ public interface DemandPublishMapper {
 	int batchDeleteByDemandIds(List<String> id);
 
 	int deleteByDemandId(String id);
+
+	void insertBatch(List<DemandPublish> publish);
 }

+ 4 - 3
src/main/java/com/goafanti/common/mapper/AchievementMapper.xml

@@ -820,8 +820,8 @@
   
    <insert id="insertBatch" parameterType="com.goafanti.common.model.Achievement">
     insert into achievement
-    	(id, deleted_sign, audit_status, 
-    	 create_time, release_status, data_category,
+    	(id, deleted_sign, audit_status, patent_case,parameter,owner_id,
+    	 create_time, release_status, data_category,info_sources,
     	 name, keyword, category,
     	 owner_name, owner_type, owner_id_number,
     	 owner_mobile, owner_email, owner_postal_address,
@@ -831,8 +831,9 @@
     <foreach item="item" index="index" collection="list" separator=",">
       (
       	#{item.id,jdbcType=VARCHAR}, #{item.deletedSign,jdbcType=INTEGER}, #{item.auditStatus,jdbcType=INTEGER}, 
+      	#{item.patentCase,jdbcType=LONGVARCHAR}, #{item.parameter,jdbcType=LONGVARCHAR},#{item.ownerId,jdbcType=VARCHAR},
       	#{item.createTime,jdbcType=TIMESTAMP}, #{item.releaseStatus,jdbcType=INTEGER}, #{item.dataCategory,jdbcType=INTEGER},
-      	#{item.name,jdbcType=VARCHAR}, #{item.keyword,jdbcType=VARCHAR}, #{item.category,jdbcType=INTEGER},
+      	#{item.infoSources,jdbcType=INTEGER},#{item.name,jdbcType=VARCHAR}, #{item.keyword,jdbcType=VARCHAR}, #{item.category,jdbcType=INTEGER},
       	#{item.ownerName,jdbcType=VARCHAR}, #{item.ownerType,jdbcType=VARCHAR}, #{item.ownerIdNumber,jdbcType=VARCHAR},
       	#{item.ownerMobile,jdbcType=VARCHAR}, #{item.ownerEmail,jdbcType=VARCHAR}, #{item.ownerPostalAddress,jdbcType=VARCHAR},
       	#{item.cooperationMode,jdbcType=INTEGER}, #{item.introduction,jdbcType=LONGVARCHAR},#{item.techBrokerId,jdbcType=VARCHAR},

+ 14 - 0
src/main/java/com/goafanti/common/mapper/AchievementPublishMapper.xml

@@ -451,4 +451,18 @@ where 1=1
 	 select publish_page from achievement_publish ap
 	 where ap.achievement_id = #{id}
 	 </select>
+	 
+	 <insert id="insertBatch" parameterType="com.goafanti.common.model.AchievementPublish">
+	  insert into achievement_publish (id, achievement_id, publish_platform, 
+      publish_client, publish_page, if_top, 
+      top_number, show_number, publisher, 
+      publish_time)
+    	values
+      <foreach item="item" index="index" collection="list" separator=",">
+    	 (#{item.id,jdbcType=VARCHAR}, #{item.achievementId,jdbcType=VARCHAR}, #{item.publishPlatform,jdbcType=INTEGER}, 
+      #{item.publishClient,jdbcType=INTEGER}, #{item.publishPage,jdbcType=VARCHAR}, #{item.ifTop,jdbcType=INTEGER}, 
+      #{item.topNumber,jdbcType=INTEGER}, #{item.showNumber,jdbcType=INTEGER}, #{item.publisher,jdbcType=VARCHAR}, 
+      #{item.publishTime,jdbcType=TIMESTAMP})
+      </foreach>
+	 </insert>
 </mapper>

+ 6 - 4
src/main/java/com/goafanti/common/mapper/DemandMapper.xml

@@ -671,18 +671,20 @@
     insert into demand 
     	(id, deleted_sign, audit_status, 
     	status, release_status, create_time, 
-    	keyword, data_category, name,
+    	keyword, data_category, name,employer_id,
     	demand_type, problem_des, employer_name,
-    	employer_contacts, employer_contacts_mobile, employer_contacts_mailbox, info_sources,tech_broker_id,remark,urgent_days ,urgent_money,is_hot)
+    	employer_contacts, employer_contacts_mobile, 
+    	employer_contacts_mailbox, info_sources,tech_broker_id,remark,urgent_days ,urgent_money,is_hot)
     values 
     <foreach item="item" index="index" collection="list" separator=",">
       (
       	#{item.id,jdbcType=VARCHAR}, #{item.deletedSign,jdbcType=INTEGER}, #{item.auditStatus,jdbcType=INTEGER},
       	#{item.status,jdbcType=INTEGER}, #{item.releaseStatus,jdbcType=INTEGER}, #{item.createTime,jdbcType=TIMESTAMP},
-      	#{item.keyword,jdbcType=VARCHAR}, #{item.dataCategory,jdbcType=INTEGER}, #{item.name,jdbcType=VARCHAR},
+      	#{item.keyword,jdbcType=VARCHAR}, #{item.dataCategory,jdbcType=INTEGER}, #{item.name,jdbcType=VARCHAR},#{item.employerId,jdbcType=VARCHAR},
       	#{item.demandType,jdbcType=INTEGER}, #{item.problemDes,jdbcType=VARCHAR}, #{item.employerName,jdbcType=VARCHAR},
       	#{item.employerContacts,jdbcType=VARCHAR}, #{item.employerContactsMobile,jdbcType=VARCHAR}, #{item.employerContactsMailbox,jdbcType=VARCHAR},
-      	#{item.infoSources,jdbcType=INTEGER},#{item.techBrokerId,jdbcType=VARCHAR},#{item.remark,jdbcType=VARCHAR},,#{item.urgentDays,jdbcType=VARCHAR},#{item.urgentMoney,jdbcType=VARCHAR},#{isHot,jdbcType=INTEGER}
+      	#{item.infoSources,jdbcType=INTEGER},#{item.techBrokerId,jdbcType=VARCHAR},#{item.remark,jdbcType=VARCHAR},#{item.urgentDays,jdbcType=VARCHAR},
+      	#{item.urgentMoney,jdbcType=VARCHAR},#{item.isHot,jdbcType=INTEGER}
       )
     </foreach>
   </insert>

+ 14 - 0
src/main/java/com/goafanti/common/mapper/DemandPublishMapper.xml

@@ -452,4 +452,18 @@ where 1=1
 	  <delete id="deleteByDemandId" parameterType="java.lang.String">
 	 	delete from demand_publish where demand_id = #{demandId,jdbcType=VARCHAR}
 	 </delete>
+	 
+	<insert id="insertBatch" parameterType="com.goafanti.common.model.DemandPublish">
+    insert into demand_publish (id, demand_id, publish_platform, 
+      publish_client, publish_page, if_top, 
+      top_number, show_number, publisher, 
+      publish_time)
+    values
+    <foreach item="item" index="index" collection="list" separator=",">
+     (#{item.id,jdbcType=VARCHAR}, #{item.demandId,jdbcType=VARCHAR}, #{item.publishPlatform,jdbcType=VARCHAR}, 
+      #{item.publishClient,jdbcType=INTEGER}, #{item.publishPage,jdbcType=VARCHAR}, #{item.ifTop,jdbcType=INTEGER}, 
+      #{item.topNumber,jdbcType=INTEGER}, #{item.showNumber,jdbcType=INTEGER}, #{item.publisher,jdbcType=VARCHAR}, 
+      #{item.publishTime,jdbcType=TIMESTAMP})
+      </foreach>
+  </insert>
 </mapper>

+ 1 - 1
src/main/java/com/goafanti/common/mapper/JtBusinessProjectMapper.xml

@@ -917,4 +917,4 @@
   limit #{size}
   </select>
   
-</mapper>
+</mapper>

Plik diff jest za duży
+ 1408 - 1380
src/main/java/com/goafanti/common/model/Achievement.java


+ 343 - 234
src/main/java/com/goafanti/common/utils/FileUtils.java

@@ -1,234 +1,343 @@
-package com.goafanti.common.utils;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.PrintWriter;
-import java.io.UnsupportedEncodingException;
-import java.net.URLEncoder;
-import java.util.regex.Pattern;
-
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.poi.hssf.usermodel.HSSFWorkbook;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.web.multipart.MultipartFile;
-
-
-public class FileUtils {
-	@Value(value = "${upload.private.path}")
-	private String					uploadPrivatePath	= null;
-
-	private static final Pattern	SLASH_PATTERN		= Pattern.compile("^/|/$");
-	private static final String		SLASH				= "/";
-	private static final String		UNDERLINE			= "_";
-
-	/**
-	 * response 输出JSON
-	 * 
-	 * @param hresponse
-	 * @param resultMap
-	 * @throws IOException
-	 */
-	public static void out(HttpServletResponse response, String jsonStr) {
-		PrintWriter out = null;
-		try {
-			response.setHeader("Content-Type", "application/json");
-			response.setCharacterEncoding("UTF-8");
-			out = response.getWriter();
-			out.println(jsonStr);
-		} catch (Exception e) {
-			LoggerUtils.fmtError(FileUtils.class, e, "输出数据失败");
-		} finally {
-			if (null != out) {
-				out.flush();
-				out.close();
-			}
-		}
-	}
-
-	/**
-	 * Excel报表导出
-	 * 
-	 * @param response
-	 * @param fileName
-	 * @param workbook
-	 */
-	public static void downloadExcel(HttpServletResponse response, String fileName, HSSFWorkbook workbook) {
-		String fn = null;
-		try {
-			fn = URLEncoder.encode(fileName, "UTF-8");
-		} catch (UnsupportedEncodingException e1) {
-			fn = fileName;
-		}
-		response.setContentType("application/x-download;charset=UTF-8");
-		response.setHeader("Content-Disposition", "attachment; filename=\"" + fn + "\";");
-		OutputStream out = null;
-		try {
-			out = response.getOutputStream();
-			workbook.write(out);
-		} catch (IOException e) {
-			LoggerUtils.fmtError(FileUtils.class, e, "输出Excel失败");
-		} finally {
-			if (null != out) {
-				try {
-					out.flush();
-					out.close();
-				} catch (IOException e) {
-					out = null;
-				}
-			}
-		}
-	}
-
-	/**
-	 * 根据上传文件 拼接fileName
-	 * 
-	 * @param mf
-	 * @param isPrivate
-	 * @param sign
-	 * @param path
-	 * @return
-	 */
-	public static String mosaicFileName(MultipartFile mf, boolean isPrivate, String sign, String path, String uid) {
-		String suffix = mf.getOriginalFilename().substring(mf.getOriginalFilename().lastIndexOf("."));
-		boolean uniq = false;
-		if (sign.indexOf("demand_picture") != -1|| sign.indexOf("achievement_picture") != -1 || sign.indexOf("user_picture")!=-1
-				|| sign.indexOf("jt_project_picture")!=-1 || sign.indexOf("jt_business_picture")!=-1 || sign.indexOf("honor_picture")!=-1
-				|| sign.indexOf("banners")!=-1|| sign.indexOf("head_portrait")!=-1 || sign.indexOf("video")!=-1 ) {
-			uniq = true;
-		}
-		String fileName = "";
-		if (isPrivate || StringUtils.isNotBlank(sign)) {
-			if (uniq) {
-				fileName = path + uid + "/" + System.nanoTime() + "_" + sign + suffix;
-			} else {
-				fileName = path + uid + "/" +  sign + suffix;
-			}
-		} else {
-			fileName = path + uid + "/" + System.nanoTime() + suffix;
-		}
-		return fileName;
-	}
-	
-	public static String mosaicFileName( String fn, boolean isPrivate, String path, String uid) {
-		String fileName = "";
-		if (isPrivate) {
-			fileName = path + uid + "/" + fn;
-		} else {
-			fileName = path + uid + "/" + "logo"  + fn ;
-		}
-		return fileName;
-	}
-
-	/**
-	 * 获取下载文件名称
-	 * 
-	 * @param path
-	 * @return
-	 */
-	public static String getDownloadFileName(String path) {
-		if (StringUtils.isBlank(path) || path.lastIndexOf(".") < 0) {
-			return null;
-		}
-		String prefix = "附件";
-		String suffix = path.substring(path.lastIndexOf("."));
-		return prefix + suffix;
-	}
-
-	public static String getSuffix(String path) {
-		if (StringUtils.isBlank(path) || path.lastIndexOf(".") < 0) {
-			return "";
-		}
-		return path.substring(path.lastIndexOf("."));
-	}
-
-	/**
-	 * 拼接文件路径
-	 * 
-	 * @param root
-	 * @param params
-	 * @return
-	 */
-	public static String buildFilePath(String... params) {
-		StringBuilder sb = new StringBuilder();
-		if (params != null) {
-			for (String s : params) {
-				sb.append(SLASH);
-				sb.append(SLASH_PATTERN.matcher(s).replaceAll(""));
-			}
-		}
-		return sb.toString();
-	}
-
-	/**
-	 * 拼接文件名字
-	 * 
-	 * @param root
-	 * @param params
-	 * @return
-	 */
-	public static String buildFileName(String... params) {
-		return StringUtils.join(params, UNDERLINE);
-	}
-
-	// year
-	private static String subStr(String s) {
-		return "企业" + s.substring(s.lastIndexOf(UNDERLINE) + 1, s.lastIndexOf("."));
-	}
-
-	public static boolean deleteFile(String realFilePath) {
-		return new File(realFilePath).delete();
-	}
-
-	/**
-	 * 
-	 * @param response
-	 * @param fileName
-	 * @param realFilePath
-	 */
-	public static void downloadFile(HttpServletResponse response, String fileName, String realFilePath) {
-		InputStream in = null;
-		OutputStream out = null;
-		byte[] buffer = new byte[8 * 1024];
-		try {
-			File file = new File(realFilePath);
-			in = new FileInputStream(file);
-			out = response.getOutputStream();
-			// 设置文件MIME类型
-			response.setContentType("application/octet-stream");
-			fileName = java.net.URLEncoder.encode(fileName, "UTF-8");
-			response.setHeader("Content-Disposition", "attachment; filename=" + fileName);
-			response.setHeader("Content-Length", String.valueOf(file.length()));
-			for (;;) {
-				int bytes = in.read(buffer);
-				if (bytes == -1) {
-					break;
-				}
-				out.write(buffer, 0, bytes);
-			}
-		} catch (IOException e) {
-			LoggerUtils.fmtError(FileUtils.class, e, "IO错误:%s", e.getMessage());
-		} finally {
-			try {
-				if (in != null) {
-					in.close();
-				}
-			} catch (IOException e) {
-				in = null;
-				LoggerUtils.fmtError(FileUtils.class, e, "IO错误:%s", e.getMessage());
-			}
-			try {
-				if (out != null) {
-					out.close();
-				}
-			} catch (IOException e) {
-				out = null;
-				LoggerUtils.fmtError(FileUtils.class, e, "IO错误:%s", e.getMessage());
-			}
-		}
-	}
-
-}
+package com.goafanti.common.utils;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.regex.Pattern;
+
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.CellType;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.usermodel.Sheet;
+import org.apache.poi.ss.usermodel.Workbook;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.web.multipart.MultipartFile;
+
+import com.goafanti.achievement.bo.InputAchievement;
+import com.goafanti.common.bo.Error;
+import com.goafanti.common.error.BusinessException;
+
+
+public class FileUtils {
+	@Value(value = "${upload.private.path}")
+	private String					uploadPrivatePath	= null;
+
+	private static final Pattern	SLASH_PATTERN		= Pattern.compile("^/|/$");
+	private static final String		SLASH				= "/";
+	private static final String		UNDERLINE			= "_";
+
+	/**
+	 * response 输出JSON
+	 * 
+	 * @param hresponse
+	 * @param resultMap
+	 * @throws IOException
+	 */
+	public static void out(HttpServletResponse response, String jsonStr) {
+		PrintWriter out = null;
+		try {
+			response.setHeader("Content-Type", "application/json");
+			response.setCharacterEncoding("UTF-8");
+			out = response.getWriter();
+			out.println(jsonStr);
+		} catch (Exception e) {
+			LoggerUtils.fmtError(FileUtils.class, e, "输出数据失败");
+		} finally {
+			if (null != out) {
+				out.flush();
+				out.close();
+			}
+		}
+	}
+
+	/**
+	 * Excel报表导出
+	 * 
+	 * @param response
+	 * @param fileName
+	 * @param workbook
+	 */
+	public static void downloadExcel(HttpServletResponse response, String fileName, HSSFWorkbook workbook) {
+		String fn = null;
+		try {
+			fn = URLEncoder.encode(fileName, "UTF-8");
+		} catch (UnsupportedEncodingException e1) {
+			fn = fileName;
+		}
+		response.setContentType("application/x-download;charset=UTF-8");
+		response.setHeader("Content-Disposition", "attachment; filename=\"" + fn + "\";");
+		OutputStream out = null;
+		try {
+			out = response.getOutputStream();
+			workbook.write(out);
+		} catch (IOException e) {
+			LoggerUtils.fmtError(FileUtils.class, e, "输出Excel失败");
+		} finally {
+			if (null != out) {
+				try {
+					out.flush();
+					out.close();
+				} catch (IOException e) {
+					out = null;
+				}
+			}
+		}
+	}
+
+	/**
+	 * 根据上传文件 拼接fileName
+	 * 
+	 * @param mf
+	 * @param isPrivate
+	 * @param sign
+	 * @param path
+	 * @return
+	 */
+	public static String mosaicFileName(MultipartFile mf, boolean isPrivate, String sign, String path, String uid) {
+		String suffix = mf.getOriginalFilename().substring(mf.getOriginalFilename().lastIndexOf("."));
+		boolean uniq = false;
+		if (sign.indexOf("demand_picture") != -1|| sign.indexOf("achievement_picture") != -1 || sign.indexOf("user_picture")!=-1
+				|| sign.indexOf("jt_project_picture")!=-1 || sign.indexOf("jt_business_picture")!=-1 || sign.indexOf("honor_picture")!=-1
+				|| sign.indexOf("banners")!=-1|| sign.indexOf("head_portrait")!=-1 || sign.indexOf("video")!=-1 ) {
+			uniq = true;
+		}
+		String fileName = "";
+		if (isPrivate || StringUtils.isNotBlank(sign)) {
+			if (uniq) {
+				fileName = path + uid + "/" + System.nanoTime() + "_" + sign + suffix;
+			} else {
+				fileName = path + uid + "/" +  sign + suffix;
+			}
+		} else {
+			fileName = path + uid + "/" + System.nanoTime() + suffix;
+		}
+		return fileName;
+	}
+	
+	public static String mosaicFileName( String fn, boolean isPrivate, String path, String uid) {
+		String fileName = "";
+		if (isPrivate) {
+			fileName = path + uid + "/" + fn;
+		} else {
+			fileName = path + uid + "/" + "logo"  + fn ;
+		}
+		return fileName;
+	}
+
+	/**
+	 * 获取下载文件名称
+	 * 
+	 * @param path
+	 * @return
+	 */
+	public static String getDownloadFileName(String path) {
+		if (StringUtils.isBlank(path) || path.lastIndexOf(".") < 0) {
+			return null;
+		}
+		String prefix = "附件";
+		String suffix = path.substring(path.lastIndexOf("."));
+		return prefix + suffix;
+	}
+
+	public static String getSuffix(String path) {
+		if (StringUtils.isBlank(path) || path.lastIndexOf(".") < 0) {
+			return "";
+		}
+		return path.substring(path.lastIndexOf("."));
+	}
+
+	/**
+	 * 拼接文件路径
+	 * 
+	 * @param root
+	 * @param params
+	 * @return
+	 */
+	public static String buildFilePath(String... params) {
+		StringBuilder sb = new StringBuilder();
+		if (params != null) {
+			for (String s : params) {
+				sb.append(SLASH);
+				sb.append(SLASH_PATTERN.matcher(s).replaceAll(""));
+			}
+		}
+		return sb.toString();
+	}
+
+	/**
+	 * 拼接文件名字
+	 * 
+	 * @param root
+	 * @param params
+	 * @return
+	 */
+	public static String buildFileName(String... params) {
+		return StringUtils.join(params, UNDERLINE);
+	}
+
+	// year
+	private static String subStr(String s) {
+		return "企业" + s.substring(s.lastIndexOf(UNDERLINE) + 1, s.lastIndexOf("."));
+	}
+
+	public static boolean deleteFile(String realFilePath) {
+		return new File(realFilePath).delete();
+	}
+
+	/**
+	 * 
+	 * @param response
+	 * @param fileName
+	 * @param realFilePath
+	 */
+	public static void downloadFile(HttpServletResponse response, String fileName, String realFilePath) {
+		InputStream in = null;
+		OutputStream out = null;
+		byte[] buffer = new byte[8 * 1024];
+		try {
+			File file = new File(realFilePath);
+			in = new FileInputStream(file);
+			out = response.getOutputStream();
+			// 设置文件MIME类型
+			response.setContentType("application/octet-stream");
+			fileName = java.net.URLEncoder.encode(fileName, "UTF-8");
+			response.setHeader("Content-Disposition", "attachment; filename=" + fileName);
+			response.setHeader("Content-Length", String.valueOf(file.length()));
+			for (;;) {
+				int bytes = in.read(buffer);
+				if (bytes == -1) {
+					break;
+				}
+				out.write(buffer, 0, bytes);
+			}
+		} catch (IOException e) {
+			LoggerUtils.fmtError(FileUtils.class, e, "IO错误:%s", e.getMessage());
+		} finally {
+			try {
+				if (in != null) {
+					in.close();
+				}
+			} catch (IOException e) {
+				in = null;
+				LoggerUtils.fmtError(FileUtils.class, e, "IO错误:%s", e.getMessage());
+			}
+			try {
+				if (out != null) {
+					out.close();
+				}
+			} catch (IOException e) {
+				out = null;
+				LoggerUtils.fmtError(FileUtils.class, e, "IO错误:%s", e.getMessage());
+			}
+		}
+	}
+
+	public static Workbook getWorkBook(MultipartFile file) {
+        //创建Workbook工作薄对象,表示整个excel
+        Workbook workbook = null;
+        try {
+        //获取excel文件的io流
+        InputStream is = file.getInputStream();
+        //如果是xls,使用HSSFWorkbook;如果是xlsx,使用XSSFWorkbook
+        if(file.getOriginalFilename().matches("^.+\\.(?i)(xls)$"))workbook = new HSSFWorkbook(is);
+        if(file.getOriginalFilename().matches("^.+\\.(?i)(xlsx)$"))workbook = new XSSFWorkbook(is);
+        } catch (IOException e) {
+        }
+        return workbook;
+        }
+	
+	public static Sheet pushReadFile(MultipartFile file) {
+		 //获得Workbook工作薄对象
+	       Workbook workbook = getWorkBook(file);
+	       Sheet sheet=null;
+	       if(workbook != null){
+	       	//获得当前sheet工作表
+	   		 sheet = workbook.getSheetAt(0);
+	   		if(sheet == null){
+	   			throw new BusinessException(new Error("未找到正确的参数。"));
+	   		}
+	   		//获得当前sheet的开始行
+	   		int firstRowNum = sheet.getFirstRowNum();
+	   		//获得当前sheet的结束行
+	   		int lastRowNum = sheet.getLastRowNum();
+	   		//处理空白行
+	   		for (int i = firstRowNum; i <= sheet.getLastRowNum();i++) {
+	   			Row r = sheet.getRow(i);
+	   			if(r == null){
+	   				// 如果是空行(即没有任何数据、格式),直接把它以下的数据往上移动
+	   				sheet.shiftRows(i+1, sheet.getLastRowNum(),-1);
+	   				continue;
+	   			}
+	   			boolean flag = false;
+	   			for(Cell c:r){
+	   				if(c.getCellTypeEnum() != CellType.BLANK){
+	   					flag = true;
+	   					break;
+	   				}
+	   			}
+	   			if(flag){
+	   				i++;
+	   				continue;
+	   			} else{//如果是空白行(即可能没有数据,但是有一定格式)
+	   				if(i == sheet.getLastRowNum())//如果到了最后一行,直接将那一行remove掉
+	   					sheet.removeRow(r);
+	   				else//如果还没到最后一行,则数据往上移一行
+	   				    sheet.shiftRows(i+1, sheet.getLastRowNum(),-1);
+	   			}
+	   		}
+	   		lastRowNum=sheet.getLastRowNum();
+	   		if (lastRowNum<2) {
+	   			throw new BusinessException(new Error("未找到正确的参数。"));
+				}
+	       }
+	       return sheet;
+	}
+	
+	public static String getCellValue(Cell cell){
+     	String cellValue = "";
+     	if(cell == null){
+     		return cellValue;
+     	}
+     	        //把数字当成String来读,避免出现1读成1.0的情况
+     	        if(cell.getCellTypeEnum() == CellType.NUMERIC){
+     	        cell.setCellType(CellType.STRING);
+     	        }
+     	        //判断数据的类型
+     	        switch (cell.getCellTypeEnum()){
+     	        case NUMERIC: //数字
+     	        cellValue = String.valueOf(cell.getNumericCellValue());
+     	        break;
+     	        case STRING: //字符串
+     	        cellValue = String.valueOf(cell.getStringCellValue());
+     	        break;
+     	        case BOOLEAN: //Boolean
+     	        cellValue = String.valueOf(cell.getBooleanCellValue());
+     	        break;
+     	        case FORMULA: //公式
+     	        cellValue = String.valueOf(cell.getCellFormula());
+     	        break;
+     	        case BLANK: //空值
+     	        cellValue = "";
+     	        break;
+     	        case ERROR: //故障
+     	        cellValue = "非法字符";
+     	        break;
+     	        default:
+     	        cellValue = "未知类型";
+     	        break;
+     	        }
+     	        return cellValue;
+	}
+
+}

+ 43 - 10
src/main/java/com/goafanti/demand/controller/UserDemandApiController.java

@@ -16,6 +16,7 @@ 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 org.springframework.web.multipart.MultipartFile;
 
 import com.goafanti.common.bo.Result;
 import com.goafanti.common.constant.AFTConstants;
@@ -300,9 +301,6 @@ public class UserDemandApiController extends CertifyApiController {
 	@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 {
@@ -338,13 +336,6 @@ public class UserDemandApiController extends CertifyApiController {
 			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;
@@ -379,4 +370,46 @@ public class UserDemandApiController extends CertifyApiController {
 
 		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 path = "/tmp/demand_template.xls";
+                String suffix = path.substring(path.lastIndexOf("."));
+                String fileName = AttachmentType.DEMAND_TEMPLATE.getDesc() + suffix;
+                downloadFile(response, fileName, path);
+        } else {
+            res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
+        }
+        return res;
+    }
+    
+    
+    /**
+     * 批量导入科技成果
+     */
+    @RequestMapping(value = "/importDemand", method = RequestMethod.POST)
+    public Result importTemplate(@RequestParam(value = "file", required = false) MultipartFile file, HttpServletRequest request) {
+    	Result res=new Result();
+    	//判断文件是否存在
+        if(null == file){
+      	  res.getError().add(buildError("文件不存在!","文件不存在!"));
+      	  return res;
+        }
+    	String fileName = file.getOriginalFilename();
+    	if (!fileName.matches("^.+\\.(?i)(xls)$") && !fileName.matches("^.+\\.(?i)(xlsx)$")) {
+        	  res.getError().add(buildError("格式不正确","格式不正确"));
+        	  return res;
+          }
+    	demandService.batchSaveDemand(file);
+         res.data(1); 
+    	return res;
+    }
 }

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

@@ -2,6 +2,8 @@ package com.goafanti.demand.service;
 
 import java.util.List;
 
+import org.springframework.web.multipart.MultipartFile;
+
 import com.goafanti.common.bo.MyCollection;
 import com.goafanti.common.model.Demand;
 import com.goafanti.core.mybatis.page.Pagination;
@@ -89,5 +91,7 @@ public interface DemandService {
 	Pagination<MyCollection> myCollectionDemand(Integer pageNo, Integer pageSize);
 
 	int addJtCollectSearch(Demand d);
+
+	void batchSaveDemand(MultipartFile file);
 	
 }

+ 140 - 12
src/main/java/com/goafanti/demand/service/impl/DemandServiceImpl.java

@@ -1,5 +1,6 @@
 package com.goafanti.demand.service.impl;
 
+import java.math.BigDecimal;
 import java.text.ParseException;
 import java.util.ArrayList;
 import java.util.Calendar;
@@ -11,11 +12,16 @@ import java.util.Map;
 import java.util.UUID;
 
 import org.apache.commons.lang3.StringUtils;
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.usermodel.Sheet;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
+import org.springframework.web.multipart.MultipartFile;
 
+import com.goafanti.common.bo.Error;
 import com.goafanti.common.bo.MyCollection;
 import com.goafanti.common.constant.AFTConstants;
 import com.goafanti.common.constant.PageConstants;
@@ -39,6 +45,7 @@ import com.goafanti.common.dao.UserIdentityMapper;
 import com.goafanti.common.dao.UserInterestMapper;
 import com.goafanti.common.dao.UserMapper;
 import com.goafanti.common.dao.UserRoleMapper;
+import com.goafanti.common.enums.AchievementAuditStatus;
 import com.goafanti.common.enums.DeleteStatus;
 import com.goafanti.common.enums.DemandAuditStatus;
 import com.goafanti.common.enums.DemandInfoSourceStatus;
@@ -49,6 +56,7 @@ import com.goafanti.common.enums.NoticeReadStatus;
 import com.goafanti.common.enums.NoticeStatus;
 import com.goafanti.common.enums.UserType;
 import com.goafanti.common.enums.collectType;
+import com.goafanti.common.error.BusinessException;
 import com.goafanti.common.model.AchievementDemand;
 import com.goafanti.common.model.AchievementDemandCount;
 import com.goafanti.common.model.Demand;
@@ -60,6 +68,7 @@ import com.goafanti.common.model.OrganizationIdentity;
 import com.goafanti.common.model.User;
 import com.goafanti.common.model.UserIdentity;
 import com.goafanti.common.utils.DateUtils;
+import com.goafanti.common.utils.FileUtils;
 import com.goafanti.core.mybatis.BaseMybatisDao;
 import com.goafanti.core.mybatis.page.Pagination;
 import com.goafanti.core.shiro.token.TokenManager;
@@ -762,50 +771,42 @@ public class DemandServiceImpl extends BaseMybatisDao<DemandMapper> implements D
 		
 	@Override
 	public List<DemandListBo> recentDemand(int size,String pattern,String showLocation) {
-		// TODO Auto-generated method stub
 		return demandMapper.selectRecentDemand(size,pattern,showLocation);
 	}
 	
 
 	@Override
 	public List<DemandListBo> companyDemand(int size,String pattern,String showLocation) {
-		// TODO Auto-generated method stub
 		return demandMapper.selectCompanyDemand(size,pattern,showLocation);
 	}
 
 	@Override
 	public List<DemandListBo> getUrgentDemand(int size,String pattern,String showLocation) {
-		// TODO Auto-generated method stub
 		return demandMapper.getUrgentDemand(size,pattern,showLocation);
 	}
 
 	@Override
 	public List<DemandListBo> getHotDemand(int size,String pattern,String showLocation, int deletedSign) {
-		// TODO Auto-generated method stub
 		return demandMapper.getHotDemand(size,pattern,showLocation,deletedSign);
 	}
 
 	@Override
 	public List<DemandListBo> areaDemand(int size,String pattern,String showLocation) {
-		// TODO Auto-generated method stub
 		return demandMapper.getAreaDemand(size,pattern,showLocation);
 	}
 
 	@Override
 	public List<DemandListBo> proLearnStudyDemand(int size,String pattern,String showLocation) {
-		// TODO Auto-generated method stub
 		return demandMapper.getProLearnStudyDemand(size,pattern,showLocation);
 	}
 
 	@Override
 	public List<DemandListBo> getFundCrowdDemand(int size,String pattern,String showLocation) {
-		// TODO Auto-generated method stub
 		return demandMapper.getFundCrowdDemand(size,pattern,showLocation);
 	}
 
 	@Override
 	public List<DemandListBo> getPersonnelDemand(int size,String pattern,String showLocation) {
-		// TODO Auto-generated method stub
 		return demandMapper.getPersonnelDemand(size,pattern,showLocation);
 	}
 	
@@ -839,19 +840,16 @@ public class DemandServiceImpl extends BaseMybatisDao<DemandMapper> implements D
 
 	@Override
 	public DemandListBo getDemandDetail(String id, Integer type) {
-		// TODO Auto-generated method stub
 		return demandMapper.getDemandDetail(id, type);
 	}
 
 	@Override
 	public int getInterestCount(String id) {
-		// TODO Auto-generated method stub
 		return demandMapper.countInterest(id);
 	}
 
 	@Override
 	public List<DemandListBo> getBoutiqueDemandList(int i,String pattern,String showLocation) {
-		// TODO Auto-generated method stub
 		return demandMapper.getBoutiqueDemandList(i,pattern,showLocation);
 	}
 	
@@ -893,7 +891,6 @@ public class DemandServiceImpl extends BaseMybatisDao<DemandMapper> implements D
 	@SuppressWarnings("unchecked")
 	@Override
 	public Pagination<DemandListBo> getDemandObjects(DemandListBo demandListBo, Integer pageNo, Integer pageSize) {
-		// TODO Auto-generated method stub
 		if(pageNo==null || pageNo<1) {
 			pageNo=1;
 		}
@@ -974,6 +971,137 @@ public class DemandServiceImpl extends BaseMybatisDao<DemandMapper> implements D
 		}
 		return i;
 	}
+
+	@Override
+	public void batchSaveDemand(MultipartFile file) {
+		//创建一个对象,用来存储数据
+	    List<Demand> list=new ArrayList<>();
+	    List<DemandKeyword> keyword = new ArrayList<>();
+	    List<DemandPublish> publish = new ArrayList<>();
+		Sheet sheet=FileUtils.pushReadFile(file);
+		//获得当前sheet的开始行
+		int firstRowNum = sheet.getFirstRowNum();
+		//获得当前sheet最后一行
+		int lastRowNum=sheet.getLastRowNum();
+   		//循环除了第2行的所有行
+		Date date=new Date();
+		//获取技淘网的id
+		String defaultPlatformId = branchInformationMapper.selectByDomain(PageConstants.DEFAULT_DOMAIN).getId();
+   		for(int rowNum = firstRowNum+2;rowNum <= lastRowNum;rowNum++){
+       		//获得当前行
+				Row row = sheet.getRow(rowNum);
+				if(row == null){
+					continue;
+				}
+	        	//获得当前行的开始列
+	        	int firstCellNum = row.getFirstCellNum();
+	        	//获得当前行的列数
+	        	int lastCellNum = row.getLastCellNum();
+		        //循环当前行 cellNum = (firstCellNum+1) 则是除开第一例
+	        	Demand in=new Demand();
+		        for(int cellNum = (firstCellNum); cellNum < lastCellNum;cellNum++){
+			        Cell cell = row.getCell(cellNum);
+			    	try {
+				        switch (cellNum) {
+						case 0:
+							in.setName(FileUtils.getCellValue(cell));
+							break;
+						case 1:
+							in.setDemandType(Integer.valueOf(FileUtils.getCellValue(cell)));
+							break;
+						case 2:
+							in.setDataCategory(Integer.valueOf(FileUtils.getCellValue(cell)));
+							break;
+						case 3:
+							in.setProblemDes(FileUtils.getCellValue(cell));
+							break;
+						case 4:
+							in.setKeyword(FileUtils.getCellValue(cell));
+							break;
+						case 5:
+							in.setIsHot(Integer.valueOf(FileUtils.getCellValue(cell)));
+							break;
+						case 6:
+							in.setIsUrgent(Integer.valueOf(FileUtils.getCellValue(cell)));
+							break;
+						case 7:
+							in.setUrgentDays(Integer.valueOf(FileUtils.getCellValue(cell)));
+							break;
+						case 8:
+							in.setUrgentMoney(new BigDecimal(FileUtils.getCellValue(cell)));
+							break;
+						}
+			    	} catch (Exception e) {
+			    		throw new BusinessException(new Error("表格第"+(rowNum+1)+"行输入内容不正确。"));
+					}
+		        }
+		        in.setDeletedSign(DeleteStatus.UNDELETE.getCode());
+		        in.setEmployerId(TokenManager.getAdminId());
+		        in.setCreateTime(date);
+		        in.setStatus(0);
+		        in.setReleaseStatus(AchievementAuditStatus.CREATE.getCode());
+		        in.setAuditStatus(0);
+		        in.setId(UUID.randomUUID().toString());
+		        in.setInfoSources(1);
+		        list.add(in);
+		        //关键字处理
+		        if(in.getKeyword()!=null) {
+		        	String [] keywords=null;
+		        	boolean flag= false;
+		        	if (in.getKeyword().contains(",")) {
+		        		keywords=in.getKeyword().split(",");
+		        		flag=true;
+					}else if (in.getKeyword().contains(",")) {
+						keywords=in.getKeyword().split(",");
+						flag=true;
+					}else {
+						DemandKeyword ak = new DemandKeyword();
+						ak.setId(UUID.randomUUID().toString());
+						ak.setDemandId(in.getId());
+						ak.setKeyword(in.getKeyword());
+						keyword.add(ak);
+					}
+		        	if (flag) {
+		        		for (String string : keywords) {
+		        			DemandKeyword ak = new DemandKeyword();
+							ak.setId(UUID.randomUUID().toString());
+							ak.setDemandId(in.getId());
+							ak.setKeyword(string);
+							keyword.add(ak);
+						}
+					}
+				}
+				
+		        DemandPublish ap =  new DemandPublish();
+				ap.setId(UUID.randomUUID().toString());
+				ap.setDemandId((in.getId()));
+				ap.setPublisher(TokenManager.getUserId());
+				ap.setPublishTime(date);
+				ap.setPublishClient(PageConstants.WEB_PLATFORM);
+				ap.setPublishPage("wep_demand_list");
+				ap.setPublishPlatform(defaultPlatformId);
+				ap.setIfTop(AFTConstants.NO);
+				ap.setTopNumber(PageConstants.DEFAULT_TOP_NUMBER);
+				ap.setShowNumber(PageConstants.DEFAULT_SHOW_NUMBER);
+				publish.add(ap);
+   				DemandPublish ap2 = new DemandPublish();
+				ap2.setId(UUID.randomUUID().toString());
+				ap2.setDemandId(in.getId());
+				ap2.setPublisher(TokenManager.getUserId());
+				ap2.setPublishTime(date);
+				ap2.setPublishClient(PageConstants.APP_PLATFORM);
+				ap2.setPublishPage("app_demand_list");
+				ap2.setPublishPlatform(defaultPlatformId);
+				ap2.setIfTop(AFTConstants.NO);
+				ap2.setTopNumber(PageConstants.DEFAULT_TOP_NUMBER);
+				ap2.setShowNumber(PageConstants.DEFAULT_SHOW_NUMBER);
+				publish.add(ap2);
+		        
+   		}
+   		demandMapper.insertBatch(list);
+   		demandKeywordMapper.insertBatch(keyword);
+		demandPublishMapper.insertBatch(publish);
+       }
 	
 	
 	}

+ 2 - 0
src/main/java/com/goafanti/user/service/UserService.java

@@ -77,5 +77,7 @@ public interface UserService {
 	boolean checkeToInviteCode(String beInviteCode);
 
 	Pagination<User> selectOrganizationList(User user, Integer pageNo, Integer pageSize);
+
+	int updatePictureUrl(String uid, String url);
 	
 }

+ 8 - 0
src/main/java/com/goafanti/user/service/impl/UserServiceImpl.java

@@ -327,4 +327,12 @@ public class UserServiceImpl extends BaseMybatisDao<UserMapper> implements UserS
 		
 		return  (Pagination<User>) findPage("selectOrganizationList", "selectOrganizationCount", params, pageNo, pageSize);
 	}
+
+	@Override
+	public int updatePictureUrl(String uid, String url) {
+		User u=new User();
+		u.setId(uid);
+		u.setHeadPortraitUrl(url);
+		return userMapper.updateByPrimaryKeySelective(u);
+	}
 }

+ 5 - 5
src/main/resources/props/config_local.properties

@@ -1,4 +1,4 @@
-#Driver
+
 jdbc.driverClassName=com.mysql.jdbc.Driver
 #jdbc.url=jdbc:mysql://localhost:3306/aft?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false
 #jdbc.username=dev
@@ -38,8 +38,8 @@ app.name=AFT
 app.mobile.website=http://m.jishutao.com/1.0/template/index.html
 template.cacheable=false
 
-static.host=//ss.jishutao.com/client/1.2.5
-portal.host=//ss.jishutao.com/portal/1.2.5
+static.host=//statics.jishutao.com/client/1.2.5
+portal.host=//statics.jishutao.com/portal/1.2.7
 skjt.host=//statics.jishutao.com/skjt/1.3
 
 #本地
@@ -49,8 +49,8 @@ skjt.host=//statics.jishutao.com/skjt/1.3
 avatar.host=//ss.jishutao.com
 avatar.upload.host=//ss.jishutao.com/upload
 
-upload.path=/data/static/junbang/upload
-upload.private.path=/data/static/private/jb/upload
+upload.path=F:/data/public/upload
+upload.private.path=F:/data/private/upload
 
 accessKey=LTAIqTgQLLwz252Z
 accessSecret=ICGuiUnqzaar7urw4zecVcJrJ1MHg9

+ 3 - 3
src/main/resources/props/config_test.properties

@@ -1,7 +1,7 @@
 #Driver
 jdbc.driverClassName=com.mysql.jdbc.Driver
 #\u6570\u636e\u5e93\u94fe\u63a5\uff0c
-jdbc.url=jdbc:mysql://127.0.0.1:3306/aft20200901?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false
+jdbc.url=jdbc:mysql://127.0.0.1:3306/aft?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false
 #\u5e10\u53f7
 jdbc.username=root
 #\u5bc6\u7801
@@ -56,8 +56,8 @@ app.name=AFT
 app.mobile.website=http://muat.jishutao.com
 template.cacheable=false
 
-static.host=//statics.jishutao.com/client/1.0.0
-portal.host=//statics.jishutao.com/portal/1.0.1
+static.host=//statics.jishutao.com/client/1.2.5
+portal.host=//statics.jishutao.com/portal/1.2.7
 skjt.host=//statics.jishutao.com/skjt/1.3
 skjt.userName=admin
 skjt.password=asd123..

+ 1 - 1
src/main/resources/shiro_base_auth.ini

@@ -25,4 +25,4 @@
 /admin/**=admin
 /role/**=admin,permission
 /permission/**=admin,permission
-/**=login
+/**=login

+ 40 - 0
src/main/webapp/WEB-INF/views/portal/aboutUs.html

@@ -324,6 +324,46 @@
  							</li>
  						</ol>
  					</li>
+					<li>
+						<ol>
+							<li>
+								<p>总部搬迁至位于国家级湘江新区的湖南省金融中心</p>
+								<span>2019年</span>
+							</li>
+							<li>
+								<p>以“科技厚生、正德卓行”价值观为核心的企业文化正式运行</p>
+								<span>2019年</span>
+							</li>
+							<li>
+								<p>集团董事长杨春生先生受聘为长沙市营商环境特约监督员</p>
+								<span>2019年</span>
+							</li>
+							<li>
+								<p>科德集团承办日本对华政府开发捐助40年回顾展</p>
+								<span>2019年</span>
+							</li>
+							<li>
+								<p>科德集团助力湘雅医院首届科技成果交易会</p>
+								<span>2019年</span>
+							</li>
+							<li>
+								<p>科德集团获邀参加“2019年长沙市科学技术学术年会”</p>
+								<span>2019年</span>
+							</li>
+							<li>
+								<p>荣获“湖南省发展非公有制经济和中小企业先进单位”</p>
+								<span>2020年</span>
+							</li>
+							<li>
+								<p>南省科技厅邀请集团董事长杨春生先生在公益直播厅主讲“协同创新战疫情科技志愿者服务活动”</p>
+								<span>2020年</span>
+							</li>
+							<li>
+								<p>应湖南省科技厅邀请,对湘南湘西800家高新技术企业面临的技术难题进行调研</p>
+								<span>2020年</span>
+							</li>
+						</ol>
+					</li>
  				</ul>
  			</div>
  			<div class="direction">