|
|
@@ -7,26 +7,26 @@ import com.jpsoft.employment.modules.common.dto.Sort;
|
|
|
import com.jpsoft.employment.modules.common.utils.MapUtils;
|
|
|
import com.jpsoft.employment.modules.common.utils.PojoUtils;
|
|
|
import com.jpsoft.employment.modules.job.entity.Recruitment;
|
|
|
-import com.jpsoft.employment.modules.job.entity.UserBrowse;
|
|
|
+import com.jpsoft.employment.modules.job.entity.UserCollection;
|
|
|
import com.jpsoft.employment.modules.job.service.UserBrowseService;
|
|
|
+import com.jpsoft.employment.modules.job.service.UserCollectionService;
|
|
|
import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiImplicitParam;
|
|
|
+import io.swagger.annotations.ApiImplicitParams;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
-import org.apache.commons.lang3.StringUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
-import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
@RestController
|
|
|
@RequestMapping("/mobile/userBrowseApi")
|
|
|
-@Api(tags = "移动端接口:求职人职位浏览记录")
|
|
|
+@Api(tags = "移动端接口:求职人职位浏览、收藏记录")
|
|
|
@Slf4j
|
|
|
public class UserBrowseApiController {
|
|
|
|
|
|
@@ -36,16 +36,32 @@ public class UserBrowseApiController {
|
|
|
@Autowired
|
|
|
private UserBrowseService userBrowseService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private UserCollectionService userCollectionService;
|
|
|
+
|
|
|
|
|
|
@PostMapping("pagedLoad")
|
|
|
- @ApiOperation(value = "分页加载职位浏览记录(按浏览时间倒序)")
|
|
|
+ @ApiOperation(value = "分页加载职位浏览、收藏记录(按浏览或收藏时间倒序)")
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name = "type", value = "数据类型(1:收藏;其他:浏览)", required = true, paramType = "form")
|
|
|
+ })
|
|
|
public MessageResult<Map> pagedLoad( @RequestParam(value="pageIndex",defaultValue="1") int pageIndex,
|
|
|
@RequestParam(value="pageSize",defaultValue="20") int pageSize,
|
|
|
+ @RequestParam(value="type",defaultValue="0") int type,
|
|
|
@RequestAttribute String subject){
|
|
|
try{
|
|
|
List<Sort> sortList = new ArrayList<>();
|
|
|
- sortList.add(new Sort("update_time","desc"));
|
|
|
- Page<Recruitment> page = userBrowseService.loadUserBrowses(MapUtils.builder("jobUserId",subject),pageIndex,pageSize,true,sortList);
|
|
|
+
|
|
|
+ Page<Recruitment> page = null;
|
|
|
+ if(1==type){ //查询收藏记录
|
|
|
+ sortList.add(new Sort("collectionTime","desc"));
|
|
|
+ page=userCollectionService.loadUserCollection(MapUtils.builder("jobUserId",subject),pageIndex,pageSize,true,sortList);
|
|
|
+ }
|
|
|
+ else{ //其他查询浏览过记录
|
|
|
+ sortList.add(new Sort("browseTime","desc"));
|
|
|
+ page=userBrowseService.loadUserBrowses(MapUtils.builder("jobUserId",subject),pageIndex,pageSize,true,sortList);
|
|
|
+ }
|
|
|
+
|
|
|
return MessageResultBuilder.ok(PojoUtils.pageWrapper(page));
|
|
|
}
|
|
|
catch(Exception ex){
|
|
|
@@ -54,4 +70,5 @@ public class UserBrowseApiController {
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+
|
|
|
}
|