|
|
@@ -0,0 +1,57 @@
|
|
|
+package com.jpsoft.employment.modules.mobile.controller;
|
|
|
+
|
|
|
+import com.github.pagehelper.Page;
|
|
|
+import com.jpsoft.employment.modules.common.dto.MessageResult;
|
|
|
+import com.jpsoft.employment.modules.common.dto.MessageResultBuilder;
|
|
|
+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.service.UserBrowseService;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+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 = "移动端接口:求职人职位浏览记录")
|
|
|
+@Slf4j
|
|
|
+public class UserBrowseApiController {
|
|
|
+
|
|
|
+
|
|
|
+ private Logger logger = LoggerFactory.getLogger(getClass());
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private UserBrowseService userBrowseService;
|
|
|
+
|
|
|
+
|
|
|
+ @PostMapping("pagedLoad")
|
|
|
+ @ApiOperation(value = "分页加载职位浏览记录(浏览时间倒序)")
|
|
|
+ public MessageResult<Map> pagedLoad( @RequestParam(value="pageIndex",defaultValue="1") int pageIndex,
|
|
|
+ @RequestParam(value="pageSize",defaultValue="20") int pageSize,
|
|
|
+ @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);
|
|
|
+ return MessageResultBuilder.ok(PojoUtils.pageWrapper(page));
|
|
|
+ }
|
|
|
+ catch(Exception ex){
|
|
|
+ log.error(ex.getMessage());
|
|
|
+ return MessageResultBuilder.error(ex.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+}
|