|
|
@@ -18,6 +18,7 @@ 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.AchievementImportBo;
|
|
|
import com.goafanti.achievement.bo.InputAchievement;
|
|
|
import com.goafanti.achievement.service.AchievementService;
|
|
|
import com.goafanti.admin.service.AftFileService;
|
|
|
@@ -39,22 +40,44 @@ import com.goafanti.user.service.UserService;
|
|
|
@RequestMapping(value = "/api/admin/achievement")
|
|
|
public class AdminAchievementApiController extends CertifyApiController {
|
|
|
@Resource
|
|
|
- private AchievementService achievementService;
|
|
|
+ private AchievementService achievementService;
|
|
|
@Resource
|
|
|
- private UserService userService;
|
|
|
+ private UserService userService;
|
|
|
@Resource
|
|
|
- private AftFileService aftFileService;
|
|
|
-
|
|
|
+ private AftFileService aftFileService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 批量导入科技成果
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/importAchievement", method = RequestMethod.POST)
|
|
|
+ public Result importAchievement(@RequestParam(name = "data[]", required = false) AchievementImportBo[] data) {
|
|
|
+ Result res = new Result();
|
|
|
+ if (data == null || data.length < 1) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", ""));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+ /*for (int i = 0; i < data.length; i++) {
|
|
|
+ for(Field f : data[i].getClass().getDeclaredFields()){
|
|
|
+ f.setAccessible(true);
|
|
|
+ if(f.get(data[i]) == null){
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }*/
|
|
|
+ achievementService.insertImport(data);
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 成果需求匹配列表
|
|
|
*/
|
|
|
@RequestMapping(value = "/achievementDemand", method = RequestMethod.GET)
|
|
|
- public Result achievementDemand(String id){
|
|
|
+ public Result achievementDemand(String id) {
|
|
|
Result res = new Result();
|
|
|
res.setData(achievementService.selectAchievementDemandListByAchievementId(id));
|
|
|
return res;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 上传技术需求批量导入Excel模板
|
|
|
*
|
|
|
@@ -92,7 +115,7 @@ public class AdminAchievementApiController extends CertifyApiController {
|
|
|
}
|
|
|
return res;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 下载技术需求批量导入Excel模板
|
|
|
*
|
|
|
@@ -120,35 +143,31 @@ public class AdminAchievementApiController extends CertifyApiController {
|
|
|
return res;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
/**
|
|
|
* 个人成果所有人列表
|
|
|
*/
|
|
|
@RequestMapping(value = "/userOwner", method = RequestMethod.GET)
|
|
|
- public Result getAchievementUserOwner(String name){
|
|
|
+ public Result getAchievementUserOwner(String name) {
|
|
|
Result res = new Result();
|
|
|
- if (StringUtils.isBlank(name)){
|
|
|
+ if (StringUtils.isBlank(name)) {
|
|
|
return res;
|
|
|
}
|
|
|
res.setData(userService.selectAchievementUserOwner(name));
|
|
|
return res;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 组织成果所有人列表
|
|
|
*/
|
|
|
@RequestMapping(value = "/orgOwner", method = RequestMethod.GET)
|
|
|
- public Result getAchievementOrgOwner(String name){
|
|
|
+ public Result getAchievementOrgOwner(String name) {
|
|
|
Result res = new Result();
|
|
|
- if (StringUtils.isBlank(name)){
|
|
|
+ if (StringUtils.isBlank(name)) {
|
|
|
return res;
|
|
|
}
|
|
|
res.setData(userService.selectAchievementOrgOwner(name));
|
|
|
return res;
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
|
|
|
/**
|
|
|
* 成果撤消发布(下架)
|
|
|
@@ -268,7 +287,7 @@ public class AdminAchievementApiController extends CertifyApiController {
|
|
|
res.setData(achievementService.selectUserOwnerDetail(id));
|
|
|
return res;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 组织用户成果详情详情
|
|
|
*/
|
|
|
@@ -296,7 +315,6 @@ public class AdminAchievementApiController extends CertifyApiController {
|
|
|
if (StringUtils.isNumeric(pageSize)) {
|
|
|
pSize = Integer.parseInt(pageSize);
|
|
|
}
|
|
|
-
|
|
|
if (StringUtils.isNumeric(pageNo)) {
|
|
|
pNo = Integer.parseInt(pageNo);
|
|
|
}
|
|
|
@@ -348,7 +366,7 @@ public class AdminAchievementApiController extends CertifyApiController {
|
|
|
|
|
|
Achievement a = new Achievement();
|
|
|
BeanUtils.copyProperties(ia, a);
|
|
|
- achievementService.saveAchievement(a,keywords);
|
|
|
+ achievementService.saveAchievement(a, keywords);
|
|
|
return res;
|
|
|
}
|
|
|
|
|
|
@@ -408,7 +426,6 @@ public class AdminAchievementApiController extends CertifyApiController {
|
|
|
res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到关键词", "关键词"));
|
|
|
return res;
|
|
|
}
|
|
|
-
|
|
|
|
|
|
if (null == ia.getOwnerType()) {
|
|
|
res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到所有人类型", "所有人类型"));
|
|
|
@@ -419,16 +436,16 @@ public class AdminAchievementApiController extends CertifyApiController {
|
|
|
res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到合作方式", "合作方式"));
|
|
|
return res;
|
|
|
}
|
|
|
-
|
|
|
- for (int i=0; i<keywords.length; i++){
|
|
|
- if (AFTConstants.KEYWORDLENTH < keywords[i].length()){
|
|
|
+
|
|
|
+ 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;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
private String handleFile(Result res, HttpServletRequest req, String fileName, List<MultipartFile> files,
|
|
|
MultipartFile mf) {
|
|
|
if (!files.isEmpty()) {
|