Browse Source

Merge remote-tracking branch 'origin/master'

LiFei 6 years ago
parent
commit
291a133e14

+ 16 - 7
happy-boot-module-hppay/src/main/java/org/jeecg/modules/api/dpresume/DpResumeControllerAPI.java

@@ -16,7 +16,6 @@ import org.springframework.web.servlet.view.json.MappingJackson2JsonView;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
-import java.util.HashMap;
 import java.util.Map;
 
 @Slf4j
@@ -72,10 +71,15 @@ public class DpResumeControllerAPI extends BaseAppController {
         response.setHeader("Access-Control-Allow-Origin", "*");
         response.setHeader("Access-Control-Allow-Method", "POST,GET");
         Map<String, Object> obj = null;
-        Map<String, Object> returnMap = new HashMap<>();
+        JSONObject returnMap = new JSONObject();
+        Map<String, String> requestMap = findRequestMap(request);
         try {
-
-            obj = successResult(ErrorCode.code_1000, "", returnMap);
+            returnMap = resumeService.getApplyResume(requestMap);
+            if ("1004".equals(returnMap.get("success"))) {
+                obj = errorResult(ErrorCode.code_2008, "用户信息验证失败");
+            } else {
+                obj = successResult(ErrorCode.code_1000, "", returnMap);
+            }
         } catch (Exception e) {
             e.printStackTrace();
             obj = errorResult(ErrorCode.code_2006, "获取数据失败");
@@ -99,10 +103,15 @@ public class DpResumeControllerAPI extends BaseAppController {
         response.setHeader("Access-Control-Allow-Origin", "*");
         response.setHeader("Access-Control-Allow-Method", "POST,GET");
         Map<String, Object> obj = null;
-        Map<String, Object> returnMap = new HashMap<>();
+        JSONObject returnMap = new JSONObject();
+        Map<String, String> requestMap = findRequestMap(request);
         try {
-
-            obj = successResult(ErrorCode.code_1000, "", returnMap);
+            returnMap = resumeService.getResumeDetail(requestMap);
+            if ("1004".equals(returnMap.get("success"))) {
+                obj = errorResult(ErrorCode.code_2008, "用户信息验证失败");
+            } else {
+                obj = successResult(ErrorCode.code_1000, "", returnMap);
+            }
         } catch (Exception e) {
             e.printStackTrace();
             obj = errorResult(ErrorCode.code_2006, "获取数据失败");

+ 5 - 0
happy-boot-module-hppay/src/main/java/org/jeecg/modules/api/dpresume/service/ResumeService.java

@@ -8,5 +8,10 @@ import java.util.Map;
  * 简历接口
  */
 public interface ResumeService {
+
     JSONObject getRecommendResume(Map<String, String> requestMap);
+
+    JSONObject getApplyResume(Map<String, String> requestMap);
+
+    JSONObject getResumeDetail(Map<String,String> requestMap);
 }

+ 91 - 6
happy-boot-module-hppay/src/main/java/org/jeecg/modules/api/dpresume/service/impl/ResumeServiceImpl.java

@@ -1,12 +1,19 @@
 package org.jeecg.modules.api.dpresume.service.impl;
 
 import com.alibaba.fastjson.JSONObject;
+import net.bytebuddy.asm.Advice;
 import org.jeecg.common.util.CommUtil;
+import org.jeecg.common.util.StringUtils;
 import org.jeecg.modules.api.dpresume.service.ResumeService;
+import org.jeecg.modules.hpposition.service.IPositionService;
 import org.jeecg.modules.util.TokenUtil;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -16,6 +23,8 @@ import java.util.Map;
 public class ResumeServiceImpl implements ResumeService {
     @Value("${jeecg.c_port.path}")
     private String path;
+    @Autowired
+    private IPositionService positionService;
 
     /**
      * 获取推荐简历
@@ -30,12 +39,88 @@ public class ResumeServiceImpl implements ResumeService {
         String userToken = requestMap.get("user_token");
         //验证用户合法性
         if (TokenUtil.validateToken(userId, userToken)) {
-            //搜索条件
-            String pageNo = requestMap.get("pageNo");
-            String pageSize = requestMap.get("pageSize");
-            String searchKey = requestMap.get("search_key");
-            //搜索简历接口路径(c端)
-            String url = path + "/f/api/sendResume/recommendResume?searchKey=" + searchKey + "&pageNo=" + pageNo + "&pageSize=" + pageSize;
+            try {
+                //搜索条件
+                String pageNo = requestMap.get("pageNo");
+                String pageSize = requestMap.get("pageSize");
+                String searchKey = requestMap.get("search_key");
+                //搜索简历接口路径(c端)
+                if (StringUtils.isBlank(searchKey)) {
+                    searchKey = "";
+                }
+                String url = path + "/f/api/sendResume/recommendResume?searchKey=" + URLEncoder.encode(searchKey, "utf-8") + "&pageNo=" + pageNo + "&pageSize=" + pageSize;
+                String data = CommUtil.get(url, null);
+                jsonObject = JSONObject.parseObject(data);
+            } catch (UnsupportedEncodingException e) {
+                e.printStackTrace();
+            }
+        } else {
+            jsonObject.put("success", "1004");
+        }
+        return jsonObject;
+    }
+
+    /**
+     * 投递简历分页列表
+     *
+     * @param requestMap
+     * @return
+     */
+    @Override
+    public JSONObject getApplyResume(Map<String, String> requestMap) {
+        JSONObject jsonObject = new JSONObject();
+        String userId = requestMap.get("user_id");
+        String userToken = requestMap.get("user_token");
+        //验证用户合法性
+        if (TokenUtil.validateToken(userId, userToken)) {
+            try {
+                //搜索条件
+                String pageNo = requestMap.get("pageNo");
+                String pageSize = requestMap.get("pageSize");
+                String searchKey = requestMap.get("search_key");
+                //搜索简历接口路径(c端)
+                if (StringUtils.isBlank(searchKey)) {
+                    searchKey = "";
+                }
+                //该公司所有职位
+                List<String> list = positionService.findListByUserId(userId);
+                StringBuilder stringBuilder = new StringBuilder();
+                String positionIds = "";
+                if (list != null && !list.isEmpty()) {
+                    for (String str : list) {
+                        stringBuilder.append(str + ",");
+                    }
+                    positionIds = stringBuilder.toString();
+                    positionIds = positionIds.substring(0, positionIds.length() - 1);
+                }
+                String url = path + "/f/api/sendResume/applyResume?searchKey=" + URLEncoder.encode(searchKey, "utf-8") + "&pageNo=" + pageNo + "&pageSize="
+                        + pageSize + "&positionIds=" + URLEncoder.encode(positionIds, "utf-8");
+                String data = CommUtil.get(url, null);
+                jsonObject = JSONObject.parseObject(data);
+            } catch (UnsupportedEncodingException e) {
+                e.printStackTrace();
+            }
+        } else {
+            jsonObject.put("success", "1004");
+        }
+        return jsonObject;
+    }
+
+    /**
+     * 简历详情
+     *
+     * @param requestMap
+     * @return
+     */
+    @Override
+    public JSONObject getResumeDetail(Map<String, String> requestMap) {
+        JSONObject jsonObject = new JSONObject();
+        String userId = requestMap.get("user_id");
+        String userToken = requestMap.get("user_token");
+        //验证用户合法性
+        if (TokenUtil.validateToken(userId, userToken)) {
+            String resumeId = requestMap.get("resumeId");
+            String url = path + "/f/api/sendResume/resumeDetail?resumeId=" + resumeId;
             String data = CommUtil.get(url, null);
             jsonObject = JSONObject.parseObject(data);
         } else {

+ 2 - 0
happy-boot-module-hppay/src/main/java/org/jeecg/modules/hpposition/mapper/PositionMapper.java

@@ -26,4 +26,6 @@ public interface PositionMapper extends BaseMapper<Position> {
     void save(@Param("Position")Position position);
 
     PositionAPI getPosition(String id);
+
+    List<String> findListByUserId(@Param("userId") String userId);
 }

+ 9 - 0
happy-boot-module-hppay/src/main/java/org/jeecg/modules/hpposition/mapper/xml/PositionMapper.xml

@@ -204,4 +204,13 @@
 
 		</where>
 	</select>
+
+	<select id="findListByUserId" resultType="String">
+		SELECT
+		<include refid="positionColumns"/>
+		FROM dp_position a
+		<where>
+			a.user_id = #{userId}
+		</where>
+	</select>
 </mapper>

+ 3 - 0
happy-boot-module-hppay/src/main/java/org/jeecg/modules/hpposition/service/IPositionService.java

@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -37,4 +38,6 @@ public interface IPositionService extends IService<Position> {
     Map<String,Object> changeApplyStatus(Map<String,String> requestMap, HttpServletRequest request, HttpServletResponse response);
 
     Map<String,Object> interviewInvite(Map<String,String> requestMap, HttpServletRequest request, HttpServletResponse response);
+
+    List<String> findListByUserId(String userId);
 }

+ 6 - 0
happy-boot-module-hppay/src/main/java/org/jeecg/modules/hpposition/service/impl/PositionServiceImpl.java

@@ -26,6 +26,7 @@ import java.net.URLEncoder;
 import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -540,4 +541,9 @@ public class PositionServiceImpl extends ServiceImpl<PositionMapper, Position> i
         }
         return returnMap;
     }
+
+    @Override
+    public List<String> findListByUserId(String userId) {
+        return positionMapper.findListByUserId(userId);
+    }
 }