|
@@ -18,6 +18,8 @@ import com.goafanti.common.bo.Result;
|
|
|
import com.goafanti.common.constant.ErrorConstants;
|
|
import com.goafanti.common.constant.ErrorConstants;
|
|
|
import com.goafanti.common.controller.BaseApiController;
|
|
import com.goafanti.common.controller.BaseApiController;
|
|
|
import com.goafanti.common.enums.AttachmentType;
|
|
import com.goafanti.common.enums.AttachmentType;
|
|
|
|
|
+import com.goafanti.common.enums.LectureDynamicType;
|
|
|
|
|
+import com.goafanti.common.enums.LectureHotType;
|
|
|
import com.goafanti.common.enums.PatentInfoFields;
|
|
import com.goafanti.common.enums.PatentInfoFields;
|
|
|
import com.goafanti.common.model.Lecture;
|
|
import com.goafanti.common.model.Lecture;
|
|
|
import com.goafanti.lecture.bo.InputLecture;
|
|
import com.goafanti.lecture.bo.InputLecture;
|
|
@@ -31,16 +33,40 @@ import com.goafanti.user.service.UserService;
|
|
|
@RequestMapping(value = "/api/admin/lecture")
|
|
@RequestMapping(value = "/api/admin/lecture")
|
|
|
public class AdminLectureApiController extends BaseApiController {
|
|
public class AdminLectureApiController extends BaseApiController {
|
|
|
@Resource
|
|
@Resource
|
|
|
- private LectureService lectureService;
|
|
|
|
|
|
|
+ private LectureService lectureService;
|
|
|
@Resource
|
|
@Resource
|
|
|
- private UserService userService;
|
|
|
|
|
|
|
+ private UserService userService;
|
|
|
|
|
+
|
|
|
|
|
+ private static final Integer HOT_MAX_NUM = 4;
|
|
|
|
|
+
|
|
|
|
|
+ private static final Integer DYNAMIC_MAX_NUM = 9;
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 大咖说页面展示列表
|
|
|
|
|
+ */
|
|
|
|
|
+ @RequestMapping(value = "/hotList", method = RequestMethod.GET)
|
|
|
|
|
+ public Result hotList() {
|
|
|
|
|
+ Result res = new Result();
|
|
|
|
|
+ res.setData(lectureService.listHot());
|
|
|
|
|
+ return res;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
|
|
+ * 科技明星页面展示列表
|
|
|
|
|
+ */
|
|
|
|
|
+ @RequestMapping(value = "/dynamic", method = RequestMethod.GET)
|
|
|
|
|
+ public Result dynamic(){
|
|
|
|
|
+ Result res = new Result();
|
|
|
|
|
+ res.setData(lectureService.listDynamic());
|
|
|
|
|
+ return res;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
* 专家及明星列表
|
|
* 专家及明星列表
|
|
|
*/
|
|
*/
|
|
|
- @RequestMapping(value= "/starAndExpertList", method = RequestMethod.GET)
|
|
|
|
|
|
|
+ @RequestMapping(value = "/starAndExpertList", method = RequestMethod.GET)
|
|
|
public Result starAndExpertList(Integer number, String engagedField, String username, String professionalTitle,
|
|
public Result starAndExpertList(Integer number, String engagedField, String username, String professionalTitle,
|
|
|
- String workUnit, String pageNo, String pageSize){
|
|
|
|
|
|
|
+ String workUnit, String pageNo, String pageSize) {
|
|
|
Result res = new Result();
|
|
Result res = new Result();
|
|
|
Integer pNo = 1;
|
|
Integer pNo = 1;
|
|
|
Integer pSize = 10;
|
|
Integer pSize = 10;
|
|
@@ -51,7 +77,8 @@ public class AdminLectureApiController extends BaseApiController {
|
|
|
if (StringUtils.isNumeric(pageNo)) {
|
|
if (StringUtils.isNumeric(pageNo)) {
|
|
|
pNo = Integer.parseInt(pageNo);
|
|
pNo = Integer.parseInt(pageNo);
|
|
|
}
|
|
}
|
|
|
- res.setData(userService.listStarAndExpert(number, engagedField, username, professionalTitle, workUnit, pNo, pSize));
|
|
|
|
|
|
|
+ res.setData(
|
|
|
|
|
+ userService.listStarAndExpert(number, engagedField, username, professionalTitle, workUnit, pNo, pSize));
|
|
|
return res;
|
|
return res;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -67,20 +94,10 @@ public class AdminLectureApiController extends BaseApiController {
|
|
|
return res;
|
|
return res;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if (StringUtils.isBlank(il.getUid())) {
|
|
|
|
|
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "讲堂开展人ID"));
|
|
|
|
|
- return res;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- if (StringUtils.isBlank(il.getName())) {
|
|
|
|
|
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "讲堂名称"));
|
|
|
|
|
|
|
+ if (!disposeLecture(res, il, lectureTimeFormattedDate).getError().isEmpty()) {
|
|
|
return res;
|
|
return res;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if (StringUtils.isBlank(lectureTimeFormattedDate)) {
|
|
|
|
|
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "讲堂开展时间"));
|
|
|
|
|
- return res;
|
|
|
|
|
- }
|
|
|
|
|
Lecture l = new Lecture();
|
|
Lecture l = new Lecture();
|
|
|
BeanUtils.copyProperties(il, l);
|
|
BeanUtils.copyProperties(il, l);
|
|
|
lectureService.save(l, lectureTimeFormattedDate);
|
|
lectureService.save(l, lectureTimeFormattedDate);
|
|
@@ -104,20 +121,10 @@ public class AdminLectureApiController extends BaseApiController {
|
|
|
return res;
|
|
return res;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if (StringUtils.isBlank(il.getUid())) {
|
|
|
|
|
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "讲堂开展人ID"));
|
|
|
|
|
- return res;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- if (StringUtils.isBlank(il.getName())) {
|
|
|
|
|
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "讲堂名称"));
|
|
|
|
|
|
|
+ if (!disposeLecture(res, il, lectureTimeFormattedDate).getError().isEmpty()) {
|
|
|
return res;
|
|
return res;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if (StringUtils.isBlank(lectureTimeFormattedDate)) {
|
|
|
|
|
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "讲堂开展时间"));
|
|
|
|
|
- return res;
|
|
|
|
|
- }
|
|
|
|
|
Lecture l = new Lecture();
|
|
Lecture l = new Lecture();
|
|
|
BeanUtils.copyProperties(il, l);
|
|
BeanUtils.copyProperties(il, l);
|
|
|
lectureService.update(l, lectureTimeFormattedDate);
|
|
lectureService.update(l, lectureTimeFormattedDate);
|
|
@@ -176,4 +183,48 @@ public class AdminLectureApiController extends BaseApiController {
|
|
|
}
|
|
}
|
|
|
return res;
|
|
return res;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ private Result disposeLecture(Result res, InputLecture il, String lectureTimeFormattedDate) {
|
|
|
|
|
+ if (StringUtils.isBlank(il.getUid())) {
|
|
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "讲堂开展人ID"));
|
|
|
|
|
+ return res;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (StringUtils.isBlank(il.getName())) {
|
|
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "讲堂名称"));
|
|
|
|
|
+ return res;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (StringUtils.isBlank(lectureTimeFormattedDate)) {
|
|
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "讲堂开展时间"));
|
|
|
|
|
+ return res;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (null == il.getHot()) {
|
|
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "是否展示在大咖说页面标记"));
|
|
|
|
|
+ return res;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (null == il.getDynamic()) {
|
|
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "是否展示在科技明星页面标记"));
|
|
|
|
|
+ return res;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (LectureDynamicType.DYNAMIC.getCode().equals(il.getDynamic())) {
|
|
|
|
|
+ Integer dynamicNum = lectureService.countDynamicNum();
|
|
|
|
|
+ if (null != dynamicNum && DYNAMIC_MAX_NUM == dynamicNum) {
|
|
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "展示在科技明星页面数量"));
|
|
|
|
|
+ return res;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (LectureHotType.HOT.getCode().equals(il.getHot())) {
|
|
|
|
|
+ Integer hotNum = lectureService.countHotNum();
|
|
|
|
|
+ if (null != hotNum && HOT_MAX_NUM == hotNum) {
|
|
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "展示在大咖说页面数量"));
|
|
|
|
|
+ return res;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return res;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|