فهرست منبع

1、增加根据职位id查询的接口

rayson 1 سال پیش
والد
کامیت
c52c83de2f

+ 521 - 522
src/main/java/com/wechat/controller/PositionController.java

@@ -1,20 +1,15 @@
 package com.wechat.controller;
 
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.InputStream;
-import java.io.UnsupportedEncodingException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.annotation.Resource;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.validation.Valid;
-
+import com.wechat.common.CommonHelper;
+import com.wechat.common.utils.StringsUtils;
+import com.wechat.global.base.dao.PagingResult;
+import com.wechat.global.message.InfoMsg;
+import com.wechat.model.dto.*;
 import com.wechat.model.requestDto.*;
+import com.wechat.model.responseDto.*;
+import com.wechat.service.CommonService;
+import com.wechat.service.MdeJobAdvertisedService;
+import com.wechat.service.PositionService;
 import org.apache.commons.lang.StringEscapeUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -33,309 +28,53 @@ import org.docx4j.openpackaging.parts.WordprocessingML.BinaryPartAbstractImage;
 import org.docx4j.openpackaging.parts.WordprocessingML.MainDocumentPart;
 import org.docx4j.openpackaging.parts.WordprocessingML.NumberingDefinitionsPart;
 import org.docx4j.org.apache.poi.util.IOUtils;
-import org.docx4j.wml.Body;
-import org.docx4j.wml.CTBookmark;
-import org.docx4j.wml.Document;
-import org.docx4j.wml.Drawing;
-import org.docx4j.wml.ObjectFactory;
-import org.docx4j.wml.P;
-import org.docx4j.wml.R;
-import org.docx4j.wml.RFonts;
+import org.docx4j.wml.*;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.*;
 
-import com.wechat.common.CommonHelper;
-import com.wechat.common.utils.StringsUtils;
-import com.wechat.global.base.dao.PagingResult;
-import com.wechat.global.message.InfoMsg;
-import com.wechat.model.dto.City;
-import com.wechat.model.dto.JobAdvertisedListDto;
-import com.wechat.model.dto.JobRepFormDtlDto;
-import com.wechat.model.dto.JobRepFormPvDto;
-import com.wechat.model.dto.JobViewDateViewDto;
-import com.wechat.model.responseDto.DPResp;
-import com.wechat.model.responseDto.JobAdvertisedNologinResp;
-import com.wechat.model.responseDto.JobFairByHotelResp;
-import com.wechat.model.responseDto.JobfairDepdsCitys;
-import com.wechat.model.responseDto.LVResp;
-import com.wechat.model.responseDto.ResultEntity;
-import com.wechat.service.CommonService;
-import com.wechat.service.MdeJobAdvertisedService;
-import com.wechat.service.PositionService;
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.validation.Valid;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 
 /**
  * 职位
- * @author tangwc
  *
+ * @author tangwc
  */
 @Controller
 @RequestMapping("position")
 public class PositionController {
-	
-	@Autowired
-	private PositionService positionService;
-	
-	@Autowired
-	private MdeJobAdvertisedService jobAdvertisedService;
-	
-	@Resource
-	private CommonHelper commonHelper;
-	
-	@Autowired
-	private CommonService commonService;
-	
-	@Value("#{configProperties['upload.base.path']}")
-	private String basePackagePath;
-	@Value("#{configProperties['upload.path.file']}")
-	private String uploadFilePath;
-	
-	// log 处理
-	protected static final Log log = LogFactory.getLog(PositionController.class);
-	
-	/**
-	 * 职位页面初始化
-	 * @param userCode
-	 * @return
-	 * @throws Exception
-	 */
-	@RequestMapping(method = RequestMethod.GET)
-    @ResponseBody
-    public ResultEntity<Map<String,Object>> initMainPage(HttpServletRequest request) throws Exception {
-		String userCode = commonService.getUserCode(request);
-		String lang = commonService.getLanguage(request);
-		Map<String,Object> map = positionService.init(userCode,lang);
-		
-		return new ResultEntity<Map<String,Object>>(InfoMsg.SUCCESS_REQUEST,map);
-	}
-	
-	/**
-	 * 获取推荐职位-分页查询
-	 * @param userCode
-	 * @return
-	 * @throws Exception
-	 */
-	@RequestMapping(value="getPagingRecommentJobs", method = RequestMethod.POST)
-    @ResponseBody
-    public ResultEntity<PagingResult<JobAdvertisedListDto>> getPagingRecommentJobs(HttpServletRequest request,@RequestBody PageReq page) throws Exception {
-		ResultEntity<PagingResult<JobAdvertisedListDto>> rest = new ResultEntity<PagingResult<JobAdvertisedListDto>>();
-		String userCode = commonService.getUserCode(request);
-
-		rest.setResult(positionService.getPagingRecommentJobs(page, userCode));
-		
-		return rest;
-	}
-	
-	/**
-	 * 获取企业邀请数量
-	 * @param userCode
-	 * @return
-	 * @throws Exception
-	 */
-	@RequestMapping(value="getHotelInvitationCount", method = RequestMethod.GET)
-    @ResponseBody
-    public ResultEntity<Integer> getHotelInvitationCount(HttpServletRequest request) throws Exception {
-		String userCode = commonService.getUserCode(request);
-		return new ResultEntity<Integer>(InfoMsg.SUCCESS_REQUEST,positionService.getRecievedHotelInvationInfoCounts(userCode));
-	}
-	
-	/**
-	 * 职位检索 按照关键词检索
-	 * @param searchReq > keyWord index size
-	 * @return
-	 */
-//	@Deprecated
-//	@RequestMapping(value="searchPosition", method = RequestMethod.POST)
-//    @ResponseBody
-//    public ResultEntity<PagingResult<JobAdvertisedListDto>> searchPositionByKeyWord(@RequestBody PositionSearchReq searchReq, HttpServletRequest request){
-//		String lang = commonService.getLanguage(request);
-//		return new ResultEntity<PagingResult<JobAdvertisedListDto>>(InfoMsg.SUCCESS_REQUEST,positionService.searchPositionByKeyWord(searchReq,lang));
-//	}
 
-	/**
-	 * @description 职位关键词搜索(用户版)
-	 * @author rayson
-	 * @param searchReq 职位检索 按照关键词检索
-	 * @param request
-	 * @date 2023-09-13 14:15
-	 * @return ResultEntity<PagingResult<JobAdvertisedListDto>>
-	 **/
-	@RequestMapping(value="searchPosition", method = RequestMethod.POST)
-	@ResponseBody
-	public ResultEntity<PagingResult<JobAdvertisedListDto>> searchPositionByKeyWord(@RequestBody KeyWordReq searchReq, HttpServletRequest request){
-		return new ResultEntity<PagingResult<JobAdvertisedListDto>>(InfoMsg.SUCCESS_REQUEST,positionService.searchPositionByKeyWord(searchReq,request));
-	}
-
-	/**
-	 * 职位检索 按条件检索
-	 * @param searchReq > position addProvince addCity addArea index size
-	 * @return
-	 */
-	@RequestMapping(value="searchPositionByCondition", method = RequestMethod.POST)
-	@ResponseBody
-	public ResultEntity<PagingResult<JobAdvertisedListDto>> searchPositionByCondition(@RequestBody PositionSearchReq searchReq, HttpServletRequest request){
-		String lang = commonService.getLanguage(request);
-		return new ResultEntity<PagingResult<JobAdvertisedListDto>>(InfoMsg.SUCCESS_REQUEST,positionService.searchPositionByCondition(searchReq,lang));
-	}
-	
-	/**
-	 * 职位详情
-	 * @param jobId 发布职位id
-	 * @return
-	 */
-	@RequestMapping(value="getPositionDetail", method = RequestMethod.GET)
-	@ResponseBody
-	public ResultEntity<Map<String,Object>> getPositionDetail(@RequestParam Integer jobId,@RequestParam(required=false) String shareJob,HttpServletRequest request){
-		String userCode = commonService.getUserCode(request);
-		String lang = commonService.getLanguage(request);
-		if(jobId==0 && !StringsUtils.isEmpty(shareJob))
-		{
-			jobId = commonHelper.getJobId(shareJob);
-		}
-		Map<String, Object> mapResult = positionService.getPositionDetail(jobId,userCode,lang,null);
-		//职位id不正确
-		if(mapResult == null)
-		{
-			log.error("有攻击嫌疑!!ip:【"+ commonHelper.getIRealIPAddr(request)+"】");
-		} else {
-			//记录pv uv
-			positionService.recodeJobDtlPvUv(jobId,request);
-		}
-		return new ResultEntity<Map<String,Object>>(InfoMsg.SUCCESS_REQUEST,mapResult);
-	}
-	
-	/**
-	 * 职位PV获取
-	 * @param jobId 发布职位id
-	 * @return
-	 */
-	@RequestMapping(value="getPositionPv", method = RequestMethod.GET)
-	@ResponseBody
-	public ResultEntity<Integer> getPositionPv(@RequestParam Integer jobId,@RequestParam(required=false) String shareJob,HttpServletRequest request){
-		if(jobId==0 && !StringsUtils.isEmpty(shareJob))
-		{
-			jobId = commonHelper.getJobId(shareJob);
-		}
-		int jobPv = positionService.getPvByJobId(jobId);
-		return new ResultEntity<Integer>(InfoMsg.SUCCESS_REQUEST,jobPv);
-	}
-	
-	/**
-	 * 职位详情 未登录状态
-	 * @param jobId 发布职位id
-	 * @return
-	 */
-	@RequestMapping(value="getDetailNoLogin", method = RequestMethod.GET)
-	@ResponseBody
-	public ResultEntity<Map<String,Object>> getDetailNoLogin(@RequestParam String shareJob,HttpServletRequest request){
-		Integer jobId = commonHelper.getJobId(shareJob);
-		String lang = commonService.getLanguage(request);
-		Map<String, Object> mapResult = positionService.getPositionDetail(jobId,null,lang,shareJob);
-		//职位id不正确
-		if(mapResult == null)
-		{
-			log.error("有攻击嫌疑!!ip:【"+ commonHelper.getIRealIPAddr(request)+"】");
-		} else {
-			//记录pv uv
-			positionService.recodeJobDtlPvUv(jobId,request);
-		}
-
-		return new ResultEntity<Map<String,Object>>(InfoMsg.SUCCESS_REQUEST,mapResult);
-	}
-	
-	/**
-	 * 职位收藏与取消
-	 * @param userCode  jobId 发布职位id
-	 * @return
-	 */
-	@RequestMapping(value="jobCollection", method = RequestMethod.POST)
-	@ResponseBody
-	public ResultEntity<Integer> jobCollection(@RequestBody JobCollectionReq collection){
-		
-		return new ResultEntity<Integer>(InfoMsg.SUCCESS_REQUEST,positionService.updateUserJobCollection(collection));
-	}
-	
-	
-	/**
-	 * 投递简历
-	 * @param jobId 发布职位id  curriculumVitae
-	 * @return
-	 */
-	@RequestMapping(value="postCurriculumVitae", method = RequestMethod.POST)
-	@ResponseBody
-	public ResultEntity<Integer> postCurriculumVitae(@Valid @RequestBody JobCollectionReq collection,HttpServletRequest req){
-		int i = positionService.postCurriculumVitae(collection,req);
-		if(i == 1) {
-			return new ResultEntity<Integer>(InfoMsg.SUCCESS_REQUEST,i);
-		}
-		return new ResultEntity<Integer>(InfoMsg.ERROR_SAVE_FIELD,i);
-		
-	}
-	
-	/**
-	 * 创建简历
-	 * @param jobId 发布职位id  curriculumVitae
-	 * @throws Exception 
-	 */
-	@RequestMapping(value="makeCV", method = RequestMethod.POST)
-	@ResponseBody
-	public void makeCV(@RequestParam String html) throws Exception{
-	        String baseURL = "C:\\Users\\Administrator\\Desktop";
-
-	        String content = "<html>" +
-	                "<head>你好</head>" +
-	               "<body>" +
-	                 "<table>" +
-	                  "<tr>" +
-	                   "<td>信息1</td>" +              
-	                   "<td>信息2</td>" +              
-	                   "<td>t3</td>" +              
-	                  "<tr>" +
-	                 "</table>" +
-	                 "</body>" +
-	                 "</html>";
-
-	        
-	        String unescaped = html;
-	        if (html.contains("&lt;") ) {
-	            unescaped = StringEscapeUtils.unescapeHtml(html);
-	        }
-	        // 设置字体映射
-	        RFonts rfonts = Context.getWmlObjectFactory().createRFonts();
-	        rfonts.setAscii("Century Gothic");
-	        XHTMLImporterImpl.addFontMapping("Century Gothic", rfonts);
-
-	        // 创建一个空的docx对象
-	        ImportXHTMLProperties.setProperty("docx4j-ImportXHTML.Element.Heading.MapToStyle", true);
-	        WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.createPackage();
-
-	        XHTMLImporter importer = new XHTMLImporterImpl(wordMLPackage);
-	        importer.setRunFormatting(FormattingOption.CLASS_PLUS_OTHER);
-
-
-	        NumberingDefinitionsPart ndp = new NumberingDefinitionsPart();
-	        wordMLPackage.getMainDocumentPart().addTargetPart(ndp);
-	        ndp.unmarshalDefaultNumbering();
-
-	        // 转换XHTML,并将其添加到我们制作的空docx中
-	        XHTMLImporterImpl XHTMLImporter = new XHTMLImporterImpl(wordMLPackage);
-
-	        XHTMLImporter.setHyperlinkStyle("Hyperlink");
-	        wordMLPackage.getMainDocumentPart().getContent().addAll(
-	                XHTMLImporter.convert(unescaped, basePackagePath+uploadFilePath));
-	        wordMLPackage.save(new java.io.File(basePackagePath+uploadFilePath+"test.docx"));
-		
-	}
-	
-	@RequestMapping(value="makeCV2", method = RequestMethod.POST)
-	@ResponseBody
-	public static void main(@RequestParam String img) throws Exception {
+    // log 处理
+    protected static final Log log = LogFactory.getLog(PositionController.class);
+    @Autowired
+    private PositionService positionService;
+    @Autowired
+    private MdeJobAdvertisedService jobAdvertisedService;
+    @Resource
+    private CommonHelper commonHelper;
+    @Autowired
+    private CommonService commonService;
+    @Value("#{configProperties['upload.base.path']}")
+    private String basePackagePath;
+    @Value("#{configProperties['upload.path.file']}")
+    private String uploadFilePath;
+
+    @RequestMapping(value = "makeCV2", method = RequestMethod.POST)
+    @ResponseBody
+    public static void main(@RequestParam String img) throws Exception {
 
         org.docx4j.wml.ObjectFactory foo = Context.getWmlObjectFactory();
 
@@ -343,9 +82,9 @@ public class PositionController {
 
         boolean save = true;
         String outputfilepath = "C:/Users/LENOVO/Desktop/test.docx";
-        
+
         String imagePath = "C:/Users/LENOVO/Desktop/1537933417000_11861375768989696_mini.jpg";
-        
+
         // 书签名
         String bookmarkName = "headimg";
         // 载入模板文件
@@ -365,34 +104,35 @@ public class PositionController {
         mappings.put("img", img);
         mappings.put("name", "25");
         /*        mappings.put("username", "qlq");*/
-        
-        
-     // 遍历书签
+
+
+        // 遍历书签
         for (CTBookmark bm : rt.getStarts()) {
             // 这儿可以对单个书签进行操作,也可以用一个map对所有的书签进行处理
             if (bm.getName().equals(bookmarkName)) {
-        // 读入图片并转化为字节数组,因为docx4j只能字节数组的方式插入图片
-        InputStream is = new FileInputStream(imagePath);
-        byte[] bytes = IOUtils.toByteArray(is);
-        // 穿件一个行内图片
-        BinaryPartAbstractImage imagePart = BinaryPartAbstractImage.createImagePart(wordMLPackage, bytes);
-
-        // createImageInline函数的前四个参数我都没有找到具体啥意思,,,,
-        // 最有一个是限制图片的宽度,缩放的依据
-        Inline inline = imagePart.createImageInline(null, null, 0, 1, false, 800);
-        // 获取该书签的父级段落headimg
-        P p = (P) (bm.getParent());
-
-        ObjectFactory factory = new ObjectFactory();
-        // R对象是匿名的复杂类型,然而我并不知道具体啥意思,估计这个要好好去看看ooxml才知道
-        R run = factory.createR();
-        // drawing理解为画布?
-        Drawing drawing = factory.createDrawing();
-        drawing.getAnchorOrInline().add(inline);
-        run.getContent().add(drawing);
-        p.getContent().add(run);
-
-            }}
+                // 读入图片并转化为字节数组,因为docx4j只能字节数组的方式插入图片
+                InputStream is = new FileInputStream(imagePath);
+                byte[] bytes = IOUtils.toByteArray(is);
+                // 穿件一个行内图片
+                BinaryPartAbstractImage imagePart = BinaryPartAbstractImage.createImagePart(wordMLPackage, bytes);
+
+                // createImageInline函数的前四个参数我都没有找到具体啥意思,,,,
+                // 最有一个是限制图片的宽度,缩放的依据
+                Inline inline = imagePart.createImageInline(null, null, 0, 1, false, 800);
+                // 获取该书签的父级段落headimg
+                P p = (P) (bm.getParent());
+
+                ObjectFactory factory = new ObjectFactory();
+                // R对象是匿名的复杂类型,然而我并不知道具体啥意思,估计这个要好好去看看ooxml才知道
+                R run = factory.createR();
+                // drawing理解为画布?
+                Drawing drawing = factory.createDrawing();
+                drawing.getAnchorOrInline().add(inline);
+                run.getContent().add(drawing);
+                p.getContent().add(run);
+
+            }
+        }
 
         long start = System.currentTimeMillis();
 
@@ -404,202 +144,461 @@ public class PositionController {
 
         // Save it
         if (save) {
-        	Save saver = new Save(wordMLPackage);
-        	saver.save(new FileOutputStream(outputfilepath));
+            Save saver = new Save(wordMLPackage);
+            saver.save(new FileOutputStream(outputfilepath));
 /*            SaveToZipFile saver = new SaveToZipFile(wordMLPackage);
             saver.save(outputfilepath);*/
         } else {
             System.out.println(XmlUtils.marshaltoString(documentPart.getJaxbElement(), true, true));
         }
     }
-	
-	
-	/**
-	 * 获取招聘会信息
-	 * @return
-	 * @throws UnsupportedEncodingException 
-	 */
-	@RequestMapping(value="getJobFair", method = RequestMethod.POST)
-	@ResponseBody
-	public ResultEntity<JobFairByHotelResp> getJobFair(@RequestBody JobFairReq fairReq,HttpServletRequest request) throws UnsupportedEncodingException{
-		ResultEntity<JobFairByHotelResp> result = new ResultEntity<JobFairByHotelResp>();
-		JobFairByHotelResp hotels = positionService.getJobFairByHotel(fairReq.getFairId());
-		//招聘会获取为空
-		if(null == hotels)
-		{
-			result.setMsg(InfoMsg.ERROR_JOBFAIR_OFF);
-		}
-		result.setResult(hotels);
-
-		return result;
-	}
-	
-	/**
-	 * 获取招聘会
-			酒店在招职位列表信息
-	 * @param usercode 用户id
-	 * @return
-	 */
-	@RequestMapping(value="getFairJobList", method = RequestMethod.GET)
-	@ResponseBody
-	public ResultEntity<List<JobAdvertisedNologinResp>> getFairJobListByHotel(@RequestParam String shareCode,HttpServletRequest request){
-		ResultEntity<List<JobAdvertisedNologinResp>> result = new ResultEntity<List<JobAdvertisedNologinResp>>();
-		String code[] = commonHelper.getUserCodeAes(shareCode);
-		String userCode= code[0];
-		
-		List<JobAdvertisedNologinResp> jobList = jobAdvertisedService.getPublishingJobsNologin(userCode);
-		//职位列表为空
-		if(jobList == null)
-		{
-			result.setMsg(InfoMsg.ERROR_JOBFAIR_OFF);
-		}
-		result.setResult(jobList);
-
-		return result;
-	}
-	
-	/**
-	 * 获取招聘会参与酒店的
-	 *  职位列表信息和城市信息
-	 * @return
-	 */
-	@RequestMapping(value="getJobFairDepdCitys", method = RequestMethod.GET)
-	@ResponseBody
-	public ResultEntity<JobfairDepdsCitys> getJobFairDepdCitys(@RequestParam Integer fairId,HttpServletRequest request){
-		ResultEntity<JobfairDepdsCitys> result = new ResultEntity<JobfairDepdsCitys>();
-		List<City> citys = positionService.getJobFairCitys(fairId);
-		List<DPResp> depds = positionService.getJobFairDepartments(fairId);
-		//招聘会获取为空
-		if(citys == null || depds == null || depds.isEmpty() || citys.isEmpty())
-		{
-			result.setMsg(InfoMsg.ERROR_JOBFAIR_OFF);
-		}
-		
-		JobfairDepdsCitys fairInfo = new JobfairDepdsCitys();
-		fairInfo.setCitys(citys);
-		fairInfo.setDepds(depds);
-		result.setResult(fairInfo);
-
-		return result;
-	}
-	
-	
-	/**
-	 * 根据时间查询 某企业简历投递数据
-	 * @param usercode 用户id
-	 * @return
-	 */
-	@RequestMapping(value="getJobViewByDate", method = RequestMethod.POST)
-	@ResponseBody
-	public ResultEntity<List<JobRepFormPvDto>> getJobViewByDate(@RequestBody JobReportFormReq req, HttpServletRequest request, HttpServletResponse response) {
-		ResultEntity<List<JobRepFormPvDto>> result = new ResultEntity<List<JobRepFormPvDto>>();
-		String userCode = commonService.getUserCode(request);
-		
-		//按时间统计
-		List<JobRepFormPvDto> resultList = new ArrayList<JobRepFormPvDto>();
-		//统计类型
-		String statisticType = req.getStatisticType();
-		if(StringsUtils.isEmpty(statisticType) && req.getDayStart() ==null) {
-			req.setStatisticType("0");
-			statisticType = "0";
-		}
-		
-		//根据集记方式处理起止时间
-		JobViewDateViewDto dvDto = positionService.getStrEndDataByType(statisticType,req.getDayStart(),req.getDayEnd());
-		
-		//按时间集记
-		resultList = positionService.findRepFormPvByDate(userCode,dvDto,req.getJobId());
-
-		result.setResult(resultList);
-		
-		return result;
-	}
-	
-	/**
-	 * 根据时间查询 某企业简历投递数据
-	 * 总分析图表
-	 * @param usercode 用户id
-	 * @return
-	 */
-	@RequestMapping(value="getGeneralJobViewByDate", method = RequestMethod.POST)
-	@ResponseBody
-	public ResultEntity<Map<String, Integer>> getGeneralJobViewByDate(@RequestBody JobReportFormReq req, HttpServletRequest request, HttpServletResponse response) {
-		ResultEntity<Map<String, Integer>> result = new ResultEntity<Map<String, Integer>>();
-		String userCode = commonService.getUserCode(request);
-		//统计类型
-		String statisticType = req.getStatisticType();
-		if(StringsUtils.isEmpty(statisticType) && req.getDayStart() ==null) {
-			req.setStatisticType("0");
-			statisticType = "0";
-		}
-		
-		//根据集记方式处理起止时间
-		JobViewDateViewDto dvDto = positionService.getStrEndDataByType(statisticType,req.getDayStart(),req.getDayEnd());
-		
-		//按时间集记
-		Map<String, Integer> resultMap = positionService.findGeneralViewByDate(userCode,dvDto,req.getJobId());
-
-		result.setResult(resultMap);
-		
-		return result;
-	}
-	
-	/**
-	 * 根据时间查询 候选者的学历分步
-	 * 总分析图表
-	 * @param usercode 用户id
-	 * @return
-	 */
-	@RequestMapping(value="countEducationByDate", method = RequestMethod.POST)
-	@ResponseBody
-	public ResultEntity<List<LVResp>> countEducationByDate(@RequestBody JobReportFormReq req, HttpServletRequest request, HttpServletResponse response) {
-		ResultEntity<List<LVResp>> result = new ResultEntity<List<LVResp>>();
-		String userCode = commonService.getUserCode(request);
-		//统计类型
-		String statisticType = req.getStatisticType();
-		if(StringsUtils.isEmpty(statisticType) && req.getDayStart() ==null) {
-			req.setStatisticType("0");
-			statisticType = "0";
-		}
-		
-		//根据集记方式处理起止时间
-		JobViewDateViewDto dvDto = positionService.getStrEndDataByType(statisticType,req.getDayStart(),req.getDayEnd());
-		
-		//按时间集记
-		List<LVResp> resultMap = positionService.countEducationByDate(userCode,dvDto,req.getJobId());
-
-		result.setResult(resultMap);
-		
-		return result;
-	}
-	
-	/**
-	 * 根据时间查询 某企业简历投递数据
-	 * 数据列表
-	 * @param usercode 用户id
-	 * @return
-	 */
-	@RequestMapping(value="getReportsFormByDate", method = RequestMethod.POST)
-	@ResponseBody
-	public ResultEntity<List<JobRepFormDtlDto>> getReportsFormByDate(@RequestBody JobReportFormReq req, HttpServletRequest request, HttpServletResponse response) {
-		ResultEntity<List<JobRepFormDtlDto>> result = new ResultEntity<List<JobRepFormDtlDto>>();
-		String userCode = commonService.getUserCode(request);
-		//统计类型
-		String statisticType = req.getStatisticType();
-		if(StringsUtils.isEmpty(statisticType) && req.getDayStart() ==null) {
-			req.setStatisticType("0");
-			statisticType = "0";
-		}
-		
-		//根据集记方式处理起止时间
-		JobViewDateViewDto dvDto = positionService.getStrEndDataByType(statisticType,req.getDayStart(),req.getDayEnd());
-		
-		//按时间集记
-		List<JobRepFormDtlDto> resultList = positionService.getReportsFormByDate(userCode,dvDto);
-
-		result.setResult(resultList);
-		
-		return result;
-	}
-	
+
+    /**
+     * 职位页面初始化
+     *
+     * @param userCode
+     * @return
+     * @throws Exception
+     */
+    @RequestMapping(method = RequestMethod.GET)
+    @ResponseBody
+    public ResultEntity<Map<String, Object>> initMainPage(HttpServletRequest request) throws Exception {
+        String userCode = commonService.getUserCode(request);
+        String lang = commonService.getLanguage(request);
+        Map<String, Object> map = positionService.init(userCode, lang);
+
+        return new ResultEntity<Map<String, Object>>(InfoMsg.SUCCESS_REQUEST, map);
+    }
+
+    /**
+     * 获取推荐职位-分页查询
+     *
+     * @param userCode
+     * @return
+     * @throws Exception
+     */
+    @RequestMapping(value = "getPagingRecommentJobs", method = RequestMethod.POST)
+    @ResponseBody
+    public ResultEntity<PagingResult<JobAdvertisedListDto>> getPagingRecommentJobs(HttpServletRequest request, @RequestBody PageReq page) throws Exception {
+        ResultEntity<PagingResult<JobAdvertisedListDto>> rest = new ResultEntity<PagingResult<JobAdvertisedListDto>>();
+        String userCode = commonService.getUserCode(request);
+
+        rest.setResult(positionService.getPagingRecommentJobs(page, userCode));
+
+        return rest;
+    }
+
+    /**
+     * 职位检索 按照关键词检索
+     * @param searchReq > keyWord index size
+     * @return
+     */
+//	@Deprecated
+//	@RequestMapping(value="searchPosition", method = RequestMethod.POST)
+//    @ResponseBody
+//    public ResultEntity<PagingResult<JobAdvertisedListDto>> searchPositionByKeyWord(@RequestBody PositionSearchReq searchReq, HttpServletRequest request){
+//		String lang = commonService.getLanguage(request);
+//		return new ResultEntity<PagingResult<JobAdvertisedListDto>>(InfoMsg.SUCCESS_REQUEST,positionService.searchPositionByKeyWord(searchReq,lang));
+//	}
+
+    /**
+     * 获取企业邀请数量
+     *
+     * @param userCode
+     * @return
+     * @throws Exception
+     */
+    @RequestMapping(value = "getHotelInvitationCount", method = RequestMethod.GET)
+    @ResponseBody
+    public ResultEntity<Integer> getHotelInvitationCount(HttpServletRequest request) throws Exception {
+        String userCode = commonService.getUserCode(request);
+        return new ResultEntity<Integer>(InfoMsg.SUCCESS_REQUEST, positionService.getRecievedHotelInvationInfoCounts(userCode));
+    }
+
+    /**
+     * @param searchReq 职位检索 按照关键词检索
+     * @param request
+     * @return ResultEntity<PagingResult < JobAdvertisedListDto>>
+     * @description 职位关键词搜索(用户版)
+     * @author rayson
+     * @date 2023-09-13 14:15
+     **/
+    @RequestMapping(value = "searchPosition", method = RequestMethod.POST)
+    @ResponseBody
+    public ResultEntity<PagingResult<JobAdvertisedListDto>> searchPositionByKeyWord(@RequestBody KeyWordReq searchReq, HttpServletRequest request) {
+        return new ResultEntity<PagingResult<JobAdvertisedListDto>>(InfoMsg.SUCCESS_REQUEST, positionService.searchPositionByKeyWord(searchReq, request));
+    }
+
+    /**
+     * 职位检索 按条件检索
+     *
+     * @param searchReq > position addProvince addCity addArea index size
+     * @return
+     */
+    @RequestMapping(value = "searchPositionByCondition", method = RequestMethod.POST)
+    @ResponseBody
+    public ResultEntity<PagingResult<JobAdvertisedListDto>> searchPositionByCondition(@RequestBody PositionSearchReq searchReq, HttpServletRequest request) {
+        String lang = commonService.getLanguage(request);
+        return new ResultEntity<PagingResult<JobAdvertisedListDto>>(InfoMsg.SUCCESS_REQUEST, positionService.searchPositionByCondition(searchReq, lang));
+    }
+
+    /**
+     * 职位详情
+     *
+     * @param jobId 发布职位id
+     * @return
+     */
+    @RequestMapping(value = "getPositionDetail", method = RequestMethod.GET)
+    @ResponseBody
+    public ResultEntity<Map<String, Object>> getPositionDetail(@RequestParam Integer jobId, @RequestParam(required = false) String shareJob, HttpServletRequest request) {
+        String userCode = commonService.getUserCode(request);
+        String lang = commonService.getLanguage(request);
+        if (jobId == 0 && !StringsUtils.isEmpty(shareJob)) {
+            jobId = commonHelper.getJobId(shareJob);
+        }
+        Map<String, Object> mapResult = positionService.getPositionDetail(jobId, userCode, lang, null);
+        //职位id不正确
+        if (mapResult == null) {
+            log.error("有攻击嫌疑!!ip:【" + commonHelper.getIRealIPAddr(request) + "】");
+        } else {
+            //记录pv uv
+            positionService.recodeJobDtlPvUv(jobId, request);
+        }
+        return new ResultEntity<Map<String, Object>>(InfoMsg.SUCCESS_REQUEST, mapResult);
+    }
+
+    /**
+     * 职位PV获取
+     *
+     * @param jobId 发布职位id
+     * @return
+     */
+    @RequestMapping(value = "getPositionPv", method = RequestMethod.GET)
+    @ResponseBody
+    public ResultEntity<Integer> getPositionPv(@RequestParam Integer jobId, @RequestParam(required = false) String shareJob, HttpServletRequest request) {
+        if (jobId == 0 && !StringsUtils.isEmpty(shareJob)) {
+            jobId = commonHelper.getJobId(shareJob);
+        }
+        int jobPv = positionService.getPvByJobId(jobId);
+        return new ResultEntity<Integer>(InfoMsg.SUCCESS_REQUEST, jobPv);
+    }
+
+    /**
+     * 职位详情 未登录状态
+     *
+     * @param jobId 发布职位id
+     * @return
+     */
+    @RequestMapping(value = "getDetailNoLogin", method = RequestMethod.GET)
+    @ResponseBody
+    public ResultEntity<Map<String, Object>> getDetailNoLogin(@RequestParam String shareJob, HttpServletRequest request) {
+        Integer jobId = commonHelper.getJobId(shareJob);
+        String lang = commonService.getLanguage(request);
+        Map<String, Object> mapResult = positionService.getPositionDetail(jobId, null, lang, shareJob);
+        //职位id不正确
+        if (mapResult == null) {
+            log.error("有攻击嫌疑!!ip:【" + commonHelper.getIRealIPAddr(request) + "】");
+        } else {
+            //记录pv uv
+            positionService.recodeJobDtlPvUv(jobId, request);
+        }
+
+        return new ResultEntity<Map<String, Object>>(InfoMsg.SUCCESS_REQUEST, mapResult);
+    }
+
+    /**
+     * 职位收藏与取消
+     *
+     * @param userCode jobId 发布职位id
+     * @return
+     */
+    @RequestMapping(value = "jobCollection", method = RequestMethod.POST)
+    @ResponseBody
+    public ResultEntity<Integer> jobCollection(@RequestBody JobCollectionReq collection) {
+
+        return new ResultEntity<Integer>(InfoMsg.SUCCESS_REQUEST, positionService.updateUserJobCollection(collection));
+    }
+
+    /**
+     * 投递简历
+     *
+     * @param jobId 发布职位id  curriculumVitae
+     * @return
+     */
+    @RequestMapping(value = "postCurriculumVitae", method = RequestMethod.POST)
+    @ResponseBody
+    public ResultEntity<Integer> postCurriculumVitae(@Valid @RequestBody JobCollectionReq collection, HttpServletRequest req) {
+        int i = positionService.postCurriculumVitae(collection, req);
+        if (i == 1) {
+            return new ResultEntity<Integer>(InfoMsg.SUCCESS_REQUEST, i);
+        }
+        return new ResultEntity<Integer>(InfoMsg.ERROR_SAVE_FIELD, i);
+
+    }
+
+    /**
+     * 创建简历
+     *
+     * @param jobId 发布职位id  curriculumVitae
+     * @throws Exception
+     */
+    @RequestMapping(value = "makeCV", method = RequestMethod.POST)
+    @ResponseBody
+    public void makeCV(@RequestParam String html) throws Exception {
+        String baseURL = "C:\\Users\\Administrator\\Desktop";
+
+        String content = "<html>" +
+                "<head>你好</head>" +
+                "<body>" +
+                "<table>" +
+                "<tr>" +
+                "<td>信息1</td>" +
+                "<td>信息2</td>" +
+                "<td>t3</td>" +
+                "<tr>" +
+                "</table>" +
+                "</body>" +
+                "</html>";
+
+
+        String unescaped = html;
+        if (html.contains("&lt;")) {
+            unescaped = StringEscapeUtils.unescapeHtml(html);
+        }
+        // 设置字体映射
+        RFonts rfonts = Context.getWmlObjectFactory().createRFonts();
+        rfonts.setAscii("Century Gothic");
+        XHTMLImporterImpl.addFontMapping("Century Gothic", rfonts);
+
+        // 创建一个空的docx对象
+        ImportXHTMLProperties.setProperty("docx4j-ImportXHTML.Element.Heading.MapToStyle", true);
+        WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.createPackage();
+
+        XHTMLImporter importer = new XHTMLImporterImpl(wordMLPackage);
+        importer.setRunFormatting(FormattingOption.CLASS_PLUS_OTHER);
+
+
+        NumberingDefinitionsPart ndp = new NumberingDefinitionsPart();
+        wordMLPackage.getMainDocumentPart().addTargetPart(ndp);
+        ndp.unmarshalDefaultNumbering();
+
+        // 转换XHTML,并将其添加到我们制作的空docx中
+        XHTMLImporterImpl XHTMLImporter = new XHTMLImporterImpl(wordMLPackage);
+
+        XHTMLImporter.setHyperlinkStyle("Hyperlink");
+        wordMLPackage.getMainDocumentPart().getContent().addAll(
+                XHTMLImporter.convert(unescaped, basePackagePath + uploadFilePath));
+        wordMLPackage.save(new java.io.File(basePackagePath + uploadFilePath + "test.docx"));
+
+    }
+
+    /**
+     * 获取招聘会信息
+     *
+     * @return
+     * @throws UnsupportedEncodingException
+     */
+    @RequestMapping(value = "getJobFair", method = RequestMethod.POST)
+    @ResponseBody
+    public ResultEntity<JobFairByHotelResp> getJobFair(@RequestBody JobFairReq fairReq, HttpServletRequest request) throws UnsupportedEncodingException {
+        ResultEntity<JobFairByHotelResp> result = new ResultEntity<JobFairByHotelResp>();
+        JobFairByHotelResp hotels = positionService.getJobFairByHotel(fairReq.getFairId());
+        //招聘会获取为空
+        if (null == hotels) {
+            result.setMsg(InfoMsg.ERROR_JOBFAIR_OFF);
+        }
+        result.setResult(hotels);
+
+        return result;
+    }
+
+    /**
+     * 获取招聘会
+     * 酒店在招职位列表信息
+     *
+     * @param usercode 用户id
+     * @return
+     */
+    @RequestMapping(value = "getFairJobList", method = RequestMethod.GET)
+    @ResponseBody
+    public ResultEntity<List<JobAdvertisedNologinResp>> getFairJobListByHotel(@RequestParam String shareCode, HttpServletRequest request) {
+        ResultEntity<List<JobAdvertisedNologinResp>> result = new ResultEntity<List<JobAdvertisedNologinResp>>();
+        String code[] = commonHelper.getUserCodeAes(shareCode);
+        String userCode = code[0];
+
+        List<JobAdvertisedNologinResp> jobList = jobAdvertisedService.getPublishingJobsNologin(userCode);
+        //职位列表为空
+        if (jobList == null) {
+            result.setMsg(InfoMsg.ERROR_JOBFAIR_OFF);
+        }
+        result.setResult(jobList);
+
+        return result;
+    }
+
+    /**
+     * 获取招聘会参与酒店的
+     * 职位列表信息和城市信息
+     *
+     * @return
+     */
+    @RequestMapping(value = "getJobFairDepdCitys", method = RequestMethod.GET)
+    @ResponseBody
+    public ResultEntity<JobfairDepdsCitys> getJobFairDepdCitys(@RequestParam Integer fairId, HttpServletRequest request) {
+        ResultEntity<JobfairDepdsCitys> result = new ResultEntity<JobfairDepdsCitys>();
+        List<City> citys = positionService.getJobFairCitys(fairId);
+        List<DPResp> depds = positionService.getJobFairDepartments(fairId);
+        //招聘会获取为空
+        if (citys == null || depds == null || depds.isEmpty() || citys.isEmpty()) {
+            result.setMsg(InfoMsg.ERROR_JOBFAIR_OFF);
+        }
+
+        JobfairDepdsCitys fairInfo = new JobfairDepdsCitys();
+        fairInfo.setCitys(citys);
+        fairInfo.setDepds(depds);
+        result.setResult(fairInfo);
+
+        return result;
+    }
+
+
+    /**
+     * 根据时间查询 某企业简历投递数据
+     *
+     * @param usercode 用户id
+     * @return
+     */
+    @RequestMapping(value = "getJobViewByDate", method = RequestMethod.POST)
+    @ResponseBody
+    public ResultEntity<List<JobRepFormPvDto>> getJobViewByDate(@RequestBody JobReportFormReq req, HttpServletRequest request, HttpServletResponse response) {
+        ResultEntity<List<JobRepFormPvDto>> result = new ResultEntity<List<JobRepFormPvDto>>();
+        String userCode = commonService.getUserCode(request);
+
+        //按时间统计
+        List<JobRepFormPvDto> resultList = new ArrayList<JobRepFormPvDto>();
+        //统计类型
+        String statisticType = req.getStatisticType();
+        if (StringsUtils.isEmpty(statisticType) && req.getDayStart() == null) {
+            req.setStatisticType("0");
+            statisticType = "0";
+        }
+
+        //根据集记方式处理起止时间
+        JobViewDateViewDto dvDto = positionService.getStrEndDataByType(statisticType, req.getDayStart(), req.getDayEnd());
+
+        //按时间集记
+        resultList = positionService.findRepFormPvByDate(userCode, dvDto, req.getJobId());
+
+        result.setResult(resultList);
+
+        return result;
+    }
+
+    /**
+     * 根据时间查询 某企业简历投递数据
+     * 总分析图表
+     *
+     * @param usercode 用户id
+     * @return
+     */
+    @RequestMapping(value = "getGeneralJobViewByDate", method = RequestMethod.POST)
+    @ResponseBody
+    public ResultEntity<Map<String, Integer>> getGeneralJobViewByDate(@RequestBody JobReportFormReq req, HttpServletRequest request, HttpServletResponse response) {
+        ResultEntity<Map<String, Integer>> result = new ResultEntity<Map<String, Integer>>();
+        String userCode = commonService.getUserCode(request);
+        //统计类型
+        String statisticType = req.getStatisticType();
+        if (StringsUtils.isEmpty(statisticType) && req.getDayStart() == null) {
+            req.setStatisticType("0");
+            statisticType = "0";
+        }
+
+        //根据集记方式处理起止时间
+        JobViewDateViewDto dvDto = positionService.getStrEndDataByType(statisticType, req.getDayStart(), req.getDayEnd());
+
+        //按时间集记
+        Map<String, Integer> resultMap = positionService.findGeneralViewByDate(userCode, dvDto, req.getJobId());
+
+        result.setResult(resultMap);
+
+        return result;
+    }
+
+    /**
+     * 根据时间查询 候选者的学历分步
+     * 总分析图表
+     *
+     * @param usercode 用户id
+     * @return
+     */
+    @RequestMapping(value = "countEducationByDate", method = RequestMethod.POST)
+    @ResponseBody
+    public ResultEntity<List<LVResp>> countEducationByDate(@RequestBody JobReportFormReq req, HttpServletRequest request, HttpServletResponse response) {
+        ResultEntity<List<LVResp>> result = new ResultEntity<List<LVResp>>();
+        String userCode = commonService.getUserCode(request);
+        //统计类型
+        String statisticType = req.getStatisticType();
+        if (StringsUtils.isEmpty(statisticType) && req.getDayStart() == null) {
+            req.setStatisticType("0");
+            statisticType = "0";
+        }
+
+        //根据集记方式处理起止时间
+        JobViewDateViewDto dvDto = positionService.getStrEndDataByType(statisticType, req.getDayStart(), req.getDayEnd());
+
+        //按时间集记
+        List<LVResp> resultMap = positionService.countEducationByDate(userCode, dvDto, req.getJobId());
+
+        result.setResult(resultMap);
+
+        return result;
+    }
+
+    /**
+     * 根据时间查询 某企业简历投递数据
+     * 数据列表
+     *
+     * @param usercode 用户id
+     * @return
+     */
+    @RequestMapping(value = "getReportsFormByDate", method = RequestMethod.POST)
+    @ResponseBody
+    public ResultEntity<List<JobRepFormDtlDto>> getReportsFormByDate(@RequestBody JobReportFormReq req, HttpServletRequest request, HttpServletResponse response) {
+        ResultEntity<List<JobRepFormDtlDto>> result = new ResultEntity<List<JobRepFormDtlDto>>();
+        String userCode = commonService.getUserCode(request);
+        //统计类型
+        String statisticType = req.getStatisticType();
+        if (StringsUtils.isEmpty(statisticType) && req.getDayStart() == null) {
+            req.setStatisticType("0");
+            statisticType = "0";
+        }
+
+        //根据集记方式处理起止时间
+        JobViewDateViewDto dvDto = positionService.getStrEndDataByType(statisticType, req.getDayStart(), req.getDayEnd());
+
+        //按时间集记
+        List<JobRepFormDtlDto> resultList = positionService.getReportsFormByDate(userCode, dvDto);
+
+        result.setResult(resultList);
+
+        return result;
+    }
+
+
+    @RequestMapping(value = "getId", method = RequestMethod.GET)
+    @ResponseBody
+    public ResultEntity<PositionResp> getId(@RequestParam Integer id, HttpServletRequest request) {
+
+        ResultEntity<PositionResp> result = new ResultEntity<PositionResp>();
+
+        if (null == id) {
+            result.setMsg(InfoMsg.EERROE_POSITION_ERROR);
+            return result;
+        }
+        PositionResp resp = positionService.getId(id);
+        result.setResult(resp);
+        return result;
+    }
+
+
 }

+ 3 - 0
src/main/java/com/wechat/dao/MdePositionDao.java

@@ -27,4 +27,7 @@ public class MdePositionDao extends BaseDao  {
 		return super.selectOne("MdePositionMapper.getPvByJobId",jobId);
 	}
 
+
+	public MdePosition getId(Integer id){ return super.selectOne("MdePositionMapper.getId",id);}
+
 }

+ 28 - 3
src/main/java/com/wechat/model/dbEntity/MdePosition.java

@@ -16,7 +16,10 @@ public class MdePosition extends BaseEntity {
 	private String positionNameCn;		// 职位名称-中文
 	private String positionNameEn;		// 职位名称-英文
 	private Integer positionGrade;		// 职位等级
-	
+
+	private String  requirement; // 默认职位要求
+	private String  describe; // 默认职位内容
+	private String depdName; // 部门名称
 	private String positionName;		// 职位名称(传给前台)
 	
 	public MdePosition() {
@@ -75,6 +78,28 @@ public class MdePosition extends BaseEntity {
 	public void setPositionName(String positionName) {
 		this.positionName = positionName;
 	}
-	
-	
+
+	public String getRequirement() {
+		return requirement;
+	}
+
+	public void setRequirement(String requirement) {
+		this.requirement = requirement;
+	}
+
+	public String getDescribe() {
+		return describe;
+	}
+
+	public void setDescribe(String describe) {
+		this.describe = describe;
+	}
+
+	public String getDepdName() {
+		return depdName;
+	}
+
+	public void setDepdName(String depdName) {
+		this.depdName = depdName;
+	}
 }

+ 91 - 0
src/main/java/com/wechat/model/responseDto/PositionResp.java

@@ -0,0 +1,91 @@
+package com.wechat.model.responseDto;
+
+/**
+ * @author rayson
+ * @description PositionResp 职位 resp
+ * @create 2023-10-08 15:37
+ **/
+public class PositionResp {
+    private Integer positionId;		// 职位id
+    private Integer depdId;		// 部门id(部门信息表)
+    private String positionNameCn;		// 职位名称-中文
+    private String positionNameEn;		// 职位名称-英文
+    private Integer positionGrade;		// 职位等级
+    private String  requirement; // 默认职位要求
+    private String  describe; // 默认职位内容
+    private String depdName; // 部门名称
+    private String positionName;		// 职位名称(传给前台)
+
+
+    public Integer getPositionId() {
+        return positionId;
+    }
+
+    public void setPositionId(Integer positionId) {
+        this.positionId = positionId;
+    }
+
+    public Integer getDepdId() {
+        return depdId;
+    }
+
+    public void setDepdId(Integer depdId) {
+        this.depdId = depdId;
+    }
+
+    public String getPositionNameCn() {
+        return positionNameCn;
+    }
+
+    public void setPositionNameCn(String positionNameCn) {
+        this.positionNameCn = positionNameCn;
+    }
+
+    public String getPositionNameEn() {
+        return positionNameEn;
+    }
+
+    public void setPositionNameEn(String positionNameEn) {
+        this.positionNameEn = positionNameEn;
+    }
+
+    public Integer getPositionGrade() {
+        return positionGrade;
+    }
+
+    public void setPositionGrade(Integer positionGrade) {
+        this.positionGrade = positionGrade;
+    }
+
+    public String getRequirement() {
+        return requirement;
+    }
+
+    public void setRequirement(String requirement) {
+        this.requirement = requirement;
+    }
+
+    public String getDescribe() {
+        return describe;
+    }
+
+    public void setDescribe(String describe) {
+        this.describe = describe;
+    }
+
+    public String getDepdName() {
+        return depdName;
+    }
+
+    public void setDepdName(String depdName) {
+        this.depdName = depdName;
+    }
+
+    public String getPositionName() {
+        return positionName;
+    }
+
+    public void setPositionName(String positionName) {
+        this.positionName = positionName;
+    }
+}

+ 25 - 4
src/main/java/com/wechat/service/PositionService.java

@@ -18,10 +18,7 @@ import com.wechat.model.requestDto.JobCollectionReq;
 import com.wechat.model.requestDto.KeyWordReq;
 import com.wechat.model.requestDto.PageReq;
 import com.wechat.model.requestDto.PositionSearchReq;
-import com.wechat.model.responseDto.BaseEnterpriseUserResp;
-import com.wechat.model.responseDto.DPResp;
-import com.wechat.model.responseDto.JobFairByHotelResp;
-import com.wechat.model.responseDto.LVResp;
+import com.wechat.model.responseDto.*;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
@@ -981,4 +978,28 @@ public class PositionService extends BaseService {
 
         return positionCvDao.getReportsFormByDate(map);
     }
+
+    /**
+     * @description 根据id查询职位
+     * @author rayson
+     * @param id 职位id  positionId
+     * @date 2023-10-08 15:21
+     * @return MdePosition
+     **/
+    public PositionResp getId(Integer id) {
+        MdePosition position= mdePositionDao.getId(id);
+        if(null == position) {
+            return null;
+        }
+        PositionResp resp =new PositionResp();
+        resp.setPositionId(position.getPositionId());
+        resp.setDepdId(position.getDepdId());
+        resp.setDepdName(position.getDepdName());
+        resp.setPositionNameCn(position.getPositionNameCn());
+        resp.setPositionNameEn(position.getPositionNameEn());
+        resp.setPositionGrade(position.getPositionGrade());
+        resp.setRequirement(position.getRequirement());
+        resp.setDescribe(position.getDescribe());
+        return resp;
+    }
 }

+ 158 - 130
src/main/resources/mybatis/MdePositionMapper.xml

@@ -1,27 +1,32 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="MdePositionMapper">
-	<resultMap type="com.wechat.model.dbEntity.MdePosition"
-		id="MdePosition">
-		<id column="position_id" property="positionId" />
-		<result column="depd_id" property="depdId" />
-		<result column="position_name_cn" property="positionNameCn" />
-		<result column="position_name_en" property="positionNameEn" />
-		<result column="position_grade" property="positionGrade" />
-		<result column="version_no" property="versionNo" />
-		<result column="create_by" property="createBy" />
-		<result column="create_date" property="createDate" />
-		<result column="update_by" property="updateBy" />
-		<result column="update_date" property="updateDate" />
-		<result column="remarks" property="remarks" />
-		<result column="del_flag" property="delFlag" />
-	</resultMap>
-	<sql id="mdePositionColumns">
-		a.position_id AS "positionId",
+    <resultMap type="com.wechat.model.dbEntity.MdePosition"
+               id="MdePositionMap">
+        <id column="position_id" property="positionId"/>
+        <result column="depd_id" property="depdId"/>
+        <result column="position_name_cn" property="positionNameCn"/>
+        <result column="position_name_en" property="positionNameEn"/>
+        <result column="position_grade" property="positionGrade"/>
+        <result column="requirement" property="requirement"/>
+        <result column="describe" property="describe"/>
+        <result column="depdName" property="depdName"/>
+        <result column="version_no" property="versionNo"/>
+        <result column="create_by" property="createBy"/>
+        <result column="create_date" property="createDate"/>
+        <result column="update_by" property="updateBy"/>
+        <result column="update_date" property="updateDate"/>
+        <result column="remarks" property="remarks"/>
+        <result column="del_flag" property="delFlag"/>
+    </resultMap>
+    <sql id="mdePositionColumns">
+        a.position_id AS "positionId",
 		a.depd_id AS "depdId",
 		a.position_name_cn AS "positionNameCn",
 		a.position_name_en AS "positionNameEn",
 		a.position_grade AS "positionGrade",
+		a.requirement AS "requirement",
+		a.describe AS "describe",
 		a.version_no AS "versionNo",
 		a.create_by AS "createBy",
 		a.create_date AS "createDate",
@@ -29,125 +34,148 @@
 		a.update_date AS "updateDate",
 		a.remarks AS "remarks",
 		a.del_flag AS "delFlag"
-	</sql>
+    </sql>
 
-	<sql id="mdePositionJoins">
-	</sql>
+    <sql id="mdePositionJoins">
+        INNER JOIN mde_department d ON a.DEPD_ID = d.DEPD_ID
+    </sql>
 
-	<select id="get" resultMap="MdePosition">
-		SELECT
-		<include refid="mdePositionColumns" />
-		FROM mde_position a
-		<include refid="mdePositionJoins" />
-		WHERE a.id = #{id}
-	</select>
+    <select id="get" resultMap="MdePositionMap">
+        SELECT
+        <include refid="mdePositionColumns"/>
+        FROM mde_position a
+        <include refid="mdePositionJoins"/>
+        WHERE a.id = #{id}
+    </select>
 
-	<select id="getAllPositions" resultMap="MdePosition">
-		SELECT
-		<include refid="mdePositionColumns" />
-		FROM mde_position a
-		<where>
-			a.del_flag = 0
-		</where>
-		order by if(a.depd_id='0','990',a.depd_id) asc , a.POSITION_GRADE desc, a.position_id asc
-	</select>
-	<select id="findList" resultMap="MdePosition">
-		SELECT
-		<include refid="mdePositionColumns" />
-		FROM mde_position a
-		<include refid="mdePositionJoins" />
-		<where>
-			a.del_flag = #{DEL_FLAG_NORMAL}
-		</where>
-		<choose>
-			<when
-				test="page !=null and page.orderBy != null and page.orderBy != ''">
-				ORDER BY #{page.orderBy}
-			</when>
-			<otherwise>
-				ORDER BY a.update_date DESC
-			</otherwise>
-		</choose>
-	</select>
+    <select id="getId" resultMap="MdePositionMap">
+        SELECT
+        <include refid="mdePositionColumns"/>
+        ,d.DEPD_NAME_CN as 'depdName'
+        FROM mde_position a
+        <include refid="mdePositionJoins"/>
+        WHERE a.position_id = #{id}
+    </select>
 
-	<select id="findAllList" resultMap="MdePosition">
-		SELECT
-		<include refid="mdePositionColumns" />
-		FROM mde_position a
-		<include refid="mdePositionJoins" />
-		<where>
-			a.del_flag = #{DEL_FLAG_NORMAL}
-		</where>
-		<choose>
-			<when
-				test="page !=null and page.orderBy != null and page.orderBy != ''">
-				ORDER BY #{page.orderBy}
-			</when>
-			<otherwise>
-				ORDER BY a.update_date DESC
-			</otherwise>
-		</choose>
-	</select>
+    <select id="getAllPositions" resultMap="MdePositionMap">
+        SELECT
+        <include refid="mdePositionColumns"/>
+        FROM mde_position a
+        <where>
+            a.del_flag = 0
+        </where>
+        order by if(a.depd_id='0','990',a.depd_id) asc , a.POSITION_GRADE desc, a.position_id asc
+    </select>
+    <select id="findList" resultMap="MdePositionMap">
+        SELECT
+        <include refid="mdePositionColumns"/>
+        ,d.DEPD_NAME_CN as 'depdName'
+        FROM mde_position a
+        <include refid="mdePositionJoins"/>
+        <where>
+            a.del_flag = #{DEL_FLAG_NORMAL}
+            <if test="positionNameCn != null and positionNameCn != ''">
+                AND a.POSITION_NAME_CN like concat('%',#{positionNameCn},'%')
+            </if>
+            <if test="positionNameEn != null and positionNameEn != ''">
+                AND a.POSITION_NAME_EN like concat('%',#{positionNameEn},'%')
+            </if>
+            <if test="positionGrade != null and positionGrade != ''">
+                AND a.POSITION_GRADE = #{positionGrade}
+            </if>
+            <if test="depdId != null and depdId != ''">
+                AND a.DEPD_ID = #{depdId}
+            </if>
+        </where>
+        <choose>
+            <when
+                    test="page !=null and page.orderBy != null and page.orderBy != ''">
+                ORDER BY #{page.orderBy}
+            </when>
+            <otherwise>
+                ORDER BY a.update_date DESC
+            </otherwise>
+        </choose>
+    </select>
 
-	<insert id="insert">
-		INSERT INTO mde_position(
-		depd_id,
-		position_name_cn,
-		position_name_en,
-		position_grade,
-		version_no,
-		create_by,
-		create_date,
-		update_by,
-		update_date,
-		remarks,
-		del_flag
-		) VALUES (
-		#{depdId},
-		#{positionNameCn},
-		#{positionNameEn},
-		#{positionGrade},
-		#{versionNo},
-		#{createBy},
-		#{createDate},
-		#{updateBy},
-		#{updateDate},
-		#{remarks},
-		#{delFlag}
-		)
-	</insert>
+    <select id="findAllList" resultMap="MdePositionMap">
+        SELECT
+        <include refid="mdePositionColumns"/>
+        FROM mde_position a
+        <include refid="mdePositionJoins"/>
+        <where>
+            a.del_flag = #{DEL_FLAG_NORMAL}
+        </where>
+        <choose>
+            <when
+                    test="page !=null and page.orderBy != null and page.orderBy != ''">
+                ORDER BY #{page.orderBy}
+            </when>
+            <otherwise>
+                ORDER BY a.update_date DESC
+            </otherwise>
+        </choose>
+    </select>
 
-	<update id="update">
-		UPDATE mde_position SET
-		depd_id = #{depdId},
-		position_name_cn = #{positionNameCn},
-		position_name_en = #{positionNameEn},
-		position_grade = #{positionGrade},
-		update_by = #{updateBy},
-		update_date = #{updateDate},
-		remarks = #{remarks},
-		version_no = version_no +1,
-		WHERE position_id = #{positionId} and version_no =
-		#{versionNo}
-	</update>
+    <insert id="insert">
+        INSERT INTO mde_position(position_id,
+                                 depd_id,
+                                 position_name_cn,
+                                 position_name_en,
+                                 position_grade,
+                                 requirement,
+                                 `describe`,
+                                 create_by,
+                                 create_date,
+                                 update_by,
+                                 update_date,
+                                 remarks,
+                                 del_flag)
+        VALUES (#{positionId},
+                #{depdId},
+                #{positionNameCn},
+                #{positionNameEn},
+                #{positionGrade},
+                #{requirement},
+                #{describe},
+                #{createBy.id},
+                #{createDate},
+                #{updateBy.id},
+                #{updateDate},
+                #{remarks},
+                #{delFlag})
+    </insert>
 
-	<update id="delete">
-		UPDATE mde_position SET
-		version_no = version_no +1,
-		del_flag = #{delFlag}
-		WHERE position_id = #{positionId} and version_no =
-		#{versionNo}
-	</update>
+    <update id="update">
+        UPDATE mde_position
+        SET depd_id          = #{depdId},
+            position_name_cn = #{positionNameCn},
+            position_name_en = #{positionNameEn},
+            position_grade   = #{positionGrade},
+            requirement      = #{requirement},
+            `describe`       = #{describe},
+            version_no       =version_no + 1,
+            update_by        = #{updateBy.id},
+            update_date      = #{updateDate},
+            remarks          = #{remarks}
+        WHERE position_id = #{positionId}
+    </update>
 
-	<select id="getPvByJobId" resultType="java.lang.Integer">
-		SELECT
-			PAGE_VIEW as pageView
-		FROM MDE_VIEW_JOB_PUV_ALL
-		<where>
-			JOB_ID = #{jobId}
-		</where>
-	</select>
-	
-	
-	
+    <update id="delete">
+        UPDATE mde_position
+        SET version_no = version_no + 1,
+            del_flag   = #{delFlag}
+        WHERE position_id = #{positionId}
+          and version_no =
+              #{versionNo}
+    </update>
+
+    <select id="getPvByJobId" resultType="java.lang.Integer">
+        SELECT
+        PAGE_VIEW as pageView
+        FROM MDE_VIEW_JOB_PUV_ALL
+        <where>
+            JOB_ID = #{jobId}
+        </where>
+    </select>
 </mapper>