From 63a6fd5b26ebe1e0261336fa2f202ad6c20dd8a9 Mon Sep 17 00:00:00 2001 From: Unique-Jerry <10902054+unique-jerry@user.noreply.gitee.com> Date: Wed, 28 Feb 2024 15:13:03 +0800 Subject: [PATCH] =?UTF-8?q?=E9=82=80=E8=AF=B7=E9=9D=A2=E8=AF=95=E5=AE=8C?= =?UTF-8?q?=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 13 +++++ .../AiInterviewerApplication.java | 3 + .../controller/CompanyController.java | 37 ++++++++++++ .../controller/InterviewController.java | 32 ++++++++++ .../controller/QuestionController.java | 2 +- .../controller/UploadController.java | 5 +- .../VxController/VxInterviewController.java | 14 +++++ .../VxController/VxUserController.java | 21 ++++++- .../entity/ApplicationCount.java | 21 +++++++ .../entity/vxEntity/VxFeedBack.java | 2 + .../mapper/ApplicationCountMapper.java | 22 +++++++ .../yzdx/AiInterviewer/mapper/JobMapper.java | 38 ++++++++++++ .../mapper/VxMapper/VxFeedBackMapper.java | 7 +++ .../service/ApplicationCountService.java | 26 +++++++++ .../VxService/VxCarouselChartService.java | 8 +++ .../service/VxService/VxFeedBackService.java | 8 ++- .../VxService/VxInterviewRecordService.java | 13 ++++- .../impl/VxCarouselChartServiceImpl.java | 13 +++++ .../VxService/impl/VxFeedBackServiceImpl.java | 39 ++++++++++++- .../VxInterviewApplicationServiceImpl.java | 20 +++++-- .../impl/VxInterviewRecordServiceImpl.java | 58 ++++++++++++++++++- .../impl/ApplicationCountServiceImpl.java | 34 +++++++++++ .../service/impl/UserServiceImpl.java | 2 +- .../yzdx/AiInterviewer/utiles/PhoneUtils.java | 52 +++++++++++++++++ .../yzdx/AiInterviewer/utiles/TaskUtils.java | 44 ++++++++++++++ src/main/resources/application.yml | 12 ++-- 26 files changed, 522 insertions(+), 24 deletions(-) create mode 100644 src/main/java/com/yzdx/AiInterviewer/controller/CompanyController.java create mode 100644 src/main/java/com/yzdx/AiInterviewer/entity/ApplicationCount.java create mode 100644 src/main/java/com/yzdx/AiInterviewer/mapper/ApplicationCountMapper.java create mode 100644 src/main/java/com/yzdx/AiInterviewer/service/ApplicationCountService.java create mode 100644 src/main/java/com/yzdx/AiInterviewer/service/impl/ApplicationCountServiceImpl.java create mode 100644 src/main/java/com/yzdx/AiInterviewer/utiles/PhoneUtils.java create mode 100644 src/main/java/com/yzdx/AiInterviewer/utiles/TaskUtils.java diff --git a/pom.xml b/pom.xml index 298ab6f..d47bd4d 100644 --- a/pom.xml +++ b/pom.xml @@ -23,6 +23,8 @@ 8 + + @@ -58,6 +60,12 @@ mybatis-plus-boot-starter 3.4.3 + + + org.mybatis + mybatis + 3.5.11 + org.springframework.boot spring-boot-starter-test @@ -163,6 +171,11 @@ commons-collections4 4.1 + + + org.springframework + spring-context + diff --git a/src/main/java/com/yzdx/AiInterviewer/AiInterviewerApplication.java b/src/main/java/com/yzdx/AiInterviewer/AiInterviewerApplication.java index a92fff7..b4e0937 100644 --- a/src/main/java/com/yzdx/AiInterviewer/AiInterviewerApplication.java +++ b/src/main/java/com/yzdx/AiInterviewer/AiInterviewerApplication.java @@ -2,6 +2,9 @@ package com.yzdx.AiInterviewer; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.scheduling.annotation.EnableScheduling; + +@EnableScheduling @SpringBootApplication public class AiInterviewerApplication { public static void main(String[] args) { diff --git a/src/main/java/com/yzdx/AiInterviewer/controller/CompanyController.java b/src/main/java/com/yzdx/AiInterviewer/controller/CompanyController.java new file mode 100644 index 0000000..b7f3c37 --- /dev/null +++ b/src/main/java/com/yzdx/AiInterviewer/controller/CompanyController.java @@ -0,0 +1,37 @@ +package com.yzdx.AiInterviewer.controller; + +import com.yzdx.AiInterviewer.comment.R; +import com.yzdx.AiInterviewer.entity.ApplicationCount; +import com.yzdx.AiInterviewer.service.ApplicationCountService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +@RestController +@RequestMapping("/company") +public class CompanyController { + + @Autowired + private ApplicationCountService applicationCountService; + + @GetMapping("/getApplicationCount") + public R getApplicationCount(Integer days,String encoding){ + + if(days==7){ + + List applicationCountSevenDays = applicationCountService.getApplicationCountSevenDays(encoding); + + return R.success(applicationCountSevenDays); + + }else { + + List applicationCountThirtyDays = applicationCountService.getApplicationCountThirtyDays(encoding); + + return R.success(applicationCountThirtyDays); + } + + } +} diff --git a/src/main/java/com/yzdx/AiInterviewer/controller/InterviewController.java b/src/main/java/com/yzdx/AiInterviewer/controller/InterviewController.java index 644031b..79fe80f 100644 --- a/src/main/java/com/yzdx/AiInterviewer/controller/InterviewController.java +++ b/src/main/java/com/yzdx/AiInterviewer/controller/InterviewController.java @@ -296,6 +296,14 @@ public class InterviewController { return R.success(interviewRecordDtoList); + } + @GetMapping("/getInterviewRecordListByUserId") + public R getInterviewRecordListByUserId(Integer userId){ + + List interviewRecordDtoList=vxInterviewRecordService.getInterviewRecordListByUserId(userId); + + return R.success(interviewRecordDtoList); + } @GetMapping("/getPostingInfoList") @@ -329,6 +337,30 @@ public class InterviewController { } + + @PostMapping("/VxSendInterviewNotice") + public R VxSendInterviewNotice(@RequestBody Map addInfo){ + String encoding=(String) addInfo.get("encoding"); + Integer recipient=(Integer) addInfo.get("inviteUser"); + Integer jobId=(Integer) addInfo.get("jobId"); + Integer postId=(Integer) addInfo.get("postId"); + Integer userId=(Integer) addInfo.get("userId"); + String promote=(String) addInfo.get("promote"); + String selectQuestions=(String) addInfo.get("selectQuestions"); + Integer applicationId=(Integer)addInfo.get("applicationId"); + String endTime=(String)addInfo.get("endTime"); + + Integer rows = interviewNoticeService.addInterviewNotice(encoding,recipient, + jobId, postId,userId,promote,selectQuestions,applicationId,endTime); + if(rows==-2){ + return R.error("您已经邀请过他面试啦"); + } + if(rows==-3){ + return R.error("邀请失败,请联系管理员"); + } + return R.success("邀请成功"); + + } } diff --git a/src/main/java/com/yzdx/AiInterviewer/controller/QuestionController.java b/src/main/java/com/yzdx/AiInterviewer/controller/QuestionController.java index 846c6e9..1dd69ac 100644 --- a/src/main/java/com/yzdx/AiInterviewer/controller/QuestionController.java +++ b/src/main/java/com/yzdx/AiInterviewer/controller/QuestionController.java @@ -382,7 +382,7 @@ public class QuestionController { @PostMapping("/add_QuestionBankFromShare") @ApiOperation(value = "从题库广场中导入到本地",notes = "") public R addQuestionBankFromShare(@RequestBody Map addInfo){ - ListsharedBankIds =(List)addInfo.get("sharedBankIds"); + ListsharedBankIds =(List)addInfo.get("SharedBankIds"); Integer userId=(Integer)addInfo.get("userId"); String encoding=(String) addInfo.get("encoding"); diff --git a/src/main/java/com/yzdx/AiInterviewer/controller/UploadController.java b/src/main/java/com/yzdx/AiInterviewer/controller/UploadController.java index 0e08d76..21debe9 100644 --- a/src/main/java/com/yzdx/AiInterviewer/controller/UploadController.java +++ b/src/main/java/com/yzdx/AiInterviewer/controller/UploadController.java @@ -38,9 +38,9 @@ public class UploadController { } //http://aiinterviewersystem.kooldns.cn // http://117.88.94.226:5380 - //http://101.43.255.47/8080 + //http://101.43.255.47:8080 - private static final String BASE_URL = "http://117.88.94.226:5380"; + private static final String BASE_URL = "http://101.43.255.47:8080"; /** * 上传图片 @@ -100,6 +100,7 @@ public class UploadController { } catch (IOException e) { + System.out.println(e.getMessage()); return R.error("文件存储出现异常"); } diff --git a/src/main/java/com/yzdx/AiInterviewer/controller/VxController/VxInterviewController.java b/src/main/java/com/yzdx/AiInterviewer/controller/VxController/VxInterviewController.java index 8104255..a043d97 100644 --- a/src/main/java/com/yzdx/AiInterviewer/controller/VxController/VxInterviewController.java +++ b/src/main/java/com/yzdx/AiInterviewer/controller/VxController/VxInterviewController.java @@ -30,6 +30,20 @@ public class VxInterviewController { public R getCarouselChart(){ return R.success(vxCarouselChartService.getVxCarouselChartService()); } + @PostMapping("/updateCarouselChart") + public R updateCarouselChart(@RequestBody Map updateInfo){ + String images=(String) updateInfo.get("submitImages"); + + Integer integer = vxCarouselChartService.updateCarouselChartService(images); + + if(integer!=1){ + return R.error("更新轮播图失败"); + } + return R.success("更新轮播图成功"); + + + } + @PostMapping("addInterviewApplication") public R addInterviewApplication( @RequestParam(value = "jobId")Integer jobId, @RequestParam(value = "userId")Integer userId, diff --git a/src/main/java/com/yzdx/AiInterviewer/controller/VxController/VxUserController.java b/src/main/java/com/yzdx/AiInterviewer/controller/VxController/VxUserController.java index ef701a7..de673b6 100644 --- a/src/main/java/com/yzdx/AiInterviewer/controller/VxController/VxUserController.java +++ b/src/main/java/com/yzdx/AiInterviewer/controller/VxController/VxUserController.java @@ -55,7 +55,6 @@ public class VxUserController { String param = "appid=wx7c972ceb65b45c49&secret=72ad166ce138375593026a2fc5bf9eee&js_code=" + js_code + "&grant_type=authorization_code"; //调用获取session_key接口 请求方式get String jsonString = GetPostUntil.sendGet(wxLoginUrl, param); - System.out.println(jsonString); //因为json字符串是大括号包围,所以用JSONObject解析 JSONObject json = new JSONObject(jsonString); //json解析session_key值 @@ -354,8 +353,24 @@ public R getResume(Integer userId){ */ @GetMapping("/getFeedBack") public R getFeedBack(Integer userId){ - VxFeedBack vxFeedBack= vxFeedBackService.getFeedBack(userId); - return R.success(vxFeedBack); + List vxFeedBacks= vxFeedBackService.getFeedBack(userId); + return R.success(vxFeedBacks); + } + @GetMapping("/getAllFeedBack") + public R getAllFeedBack(Integer status){ + + List allFeedBack = vxFeedBackService.getAllFeedBack(status); + + return R.success(allFeedBack); + + } + @GetMapping("/changeFeedBackStatus") + public R changeFeedBackStatus(Integer id,Integer userId){ + + Integer rows=vxFeedBackService.changeFeedBackStatus(id,userId); + + return R.success("修改成功"); + } } diff --git a/src/main/java/com/yzdx/AiInterviewer/entity/ApplicationCount.java b/src/main/java/com/yzdx/AiInterviewer/entity/ApplicationCount.java new file mode 100644 index 0000000..4ca7606 --- /dev/null +++ b/src/main/java/com/yzdx/AiInterviewer/entity/ApplicationCount.java @@ -0,0 +1,21 @@ +package com.yzdx.AiInterviewer.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +@Data +@TableName("application_count") +public class ApplicationCount { + + @TableId(type = IdType.AUTO) + private Integer id; + + private Integer count; + + private String createTime; + + private String encoding; + +} diff --git a/src/main/java/com/yzdx/AiInterviewer/entity/vxEntity/VxFeedBack.java b/src/main/java/com/yzdx/AiInterviewer/entity/vxEntity/VxFeedBack.java index 07fa214..f85aa25 100644 --- a/src/main/java/com/yzdx/AiInterviewer/entity/vxEntity/VxFeedBack.java +++ b/src/main/java/com/yzdx/AiInterviewer/entity/vxEntity/VxFeedBack.java @@ -19,6 +19,8 @@ public class VxFeedBack extends BaseEntity { private Integer userId; @ApiModelProperty("反馈内容") private String content; + @ApiModelProperty("状态") + private Integer status; @ApiModelProperty("图片地址") private String imgUrl; @ApiModelProperty("联系方式") diff --git a/src/main/java/com/yzdx/AiInterviewer/mapper/ApplicationCountMapper.java b/src/main/java/com/yzdx/AiInterviewer/mapper/ApplicationCountMapper.java new file mode 100644 index 0000000..a9b90bb --- /dev/null +++ b/src/main/java/com/yzdx/AiInterviewer/mapper/ApplicationCountMapper.java @@ -0,0 +1,22 @@ +package com.yzdx.AiInterviewer.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.yzdx.AiInterviewer.entity.ApplicationCount; +import org.apache.ibatis.annotations.*; + +import java.util.List; + +@Mapper +public interface ApplicationCountMapper extends BaseMapper { + + @Delete("DELETE FROM application_count WHERE create_time < DATE_SUB(NOW(), INTERVAL 7 DAY);") + void autoDeleteApplicationCount(); + + @Select("SELECT * FROM application_count WHERE encoding=#{encoding} and create_time >= DATE_SUB(CURDATE(), INTERVAL 7 DAY)ORDER BY create_time ASC;") + List selectSevenData(@Param("encoding") String encoding); + + @Select("SELECT * FROM application_count WHERE encoding=#{encoding} and create_time >= DATE_SUB(CURDATE(), INTERVAL 30 DAY)ORDER BY create_time ASC;") + List selectThirtyData(@Param("encoding") String encoding); + + +} diff --git a/src/main/java/com/yzdx/AiInterviewer/mapper/JobMapper.java b/src/main/java/com/yzdx/AiInterviewer/mapper/JobMapper.java index d8ba862..82566fd 100644 --- a/src/main/java/com/yzdx/AiInterviewer/mapper/JobMapper.java +++ b/src/main/java/com/yzdx/AiInterviewer/mapper/JobMapper.java @@ -3,7 +3,45 @@ package com.yzdx.AiInterviewer.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.yzdx.AiInterviewer.entity.JobEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Select; + +import java.util.List; @Mapper public interface JobMapper extends BaseMapper { + @Select("WITH CompanyFullAddress AS ( \n" + + " SELECT \n" + + " id, \n" + + " CONCAT(adress, addressDetail) AS full_address \n" + + " FROM \n" + + " company \n" + + "), \n" + + "CompanyCoordinates AS ( \n" + + " SELECT \n" + + " id, \n" + + " full_address, \n" + + " Geocode(full_address).latitude AS company_latitude, \n" + + " Geocode(full_address).longitude AS company_longitude \n" + + " FROM \n" + + " CompanyFullAddress \n" + + "), \n" + + "InputCoordinates AS ( \n" + + " SELECT \n" + + " Geocode(#{address}).latitude AS input_latitude, \n" + + " Geocode(#{address}).longitude AS input_longitude \n" + + ") \n" + + "SELECT \n" + + " c.id, \n" + + " c.full_address, \n" + + " (6371 * acos(cos(radians(i.input_latitude)) \n" + + " * cos(radians(c.company_latitude)) \n" + + " * cos(radians(c.company_longitude) - radians(i.input_longitude)) \n" + + " + sin(radians(i.input_latitude)) \n" + + " * sin(radians(c.company_latitude)))) AS distance_in_km \n" + + "FROM \n" + + " CompanyCoordinates c, InputCoordinates i \n" + + "ORDER BY \n" + + " distance_in_km ASC;") + List searchJob(String jobName,String address); + } diff --git a/src/main/java/com/yzdx/AiInterviewer/mapper/VxMapper/VxFeedBackMapper.java b/src/main/java/com/yzdx/AiInterviewer/mapper/VxMapper/VxFeedBackMapper.java index 3f200ab..b85b9d2 100644 --- a/src/main/java/com/yzdx/AiInterviewer/mapper/VxMapper/VxFeedBackMapper.java +++ b/src/main/java/com/yzdx/AiInterviewer/mapper/VxMapper/VxFeedBackMapper.java @@ -3,7 +3,14 @@ package com.yzdx.AiInterviewer.mapper.VxMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.yzdx.AiInterviewer.entity.vxEntity.VxFeedBack; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; + +import java.util.List; @Mapper public interface VxFeedBackMapper extends BaseMapper { + + @Select("SELECT * FROM feedback where status=#{status} ORDER BY ABS(TIMESTAMPDIFF(DAY, create_time, NOW())) ASC;") + List getAllFeedBack(@Param("status") Integer status); } diff --git a/src/main/java/com/yzdx/AiInterviewer/service/ApplicationCountService.java b/src/main/java/com/yzdx/AiInterviewer/service/ApplicationCountService.java new file mode 100644 index 0000000..2337e5e --- /dev/null +++ b/src/main/java/com/yzdx/AiInterviewer/service/ApplicationCountService.java @@ -0,0 +1,26 @@ +package com.yzdx.AiInterviewer.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.yzdx.AiInterviewer.entity.ApplicationCount; + +import java.util.List; + +public interface ApplicationCountService extends IService { + + /** + * 获取7天内投递简历人数 + * @param encoding 公司编码 + * @return List + * */ + + List getApplicationCountSevenDays(String encoding); + + /** + * 获取30天内投递简历人数 + * @param encoding 公司编码 + * @return List + * */ + + List getApplicationCountThirtyDays(String encoding); + +} diff --git a/src/main/java/com/yzdx/AiInterviewer/service/VxService/VxCarouselChartService.java b/src/main/java/com/yzdx/AiInterviewer/service/VxService/VxCarouselChartService.java index 57a7fb5..0edbf26 100644 --- a/src/main/java/com/yzdx/AiInterviewer/service/VxService/VxCarouselChartService.java +++ b/src/main/java/com/yzdx/AiInterviewer/service/VxService/VxCarouselChartService.java @@ -11,4 +11,12 @@ public interface VxCarouselChartService extends IService { * */ String getVxCarouselChartService(); + /** + * 更新轮播退信息 + * @param images 图片信息 + * @return 返回影响的行数 + * */ + + Integer updateCarouselChartService(String images); + } diff --git a/src/main/java/com/yzdx/AiInterviewer/service/VxService/VxFeedBackService.java b/src/main/java/com/yzdx/AiInterviewer/service/VxService/VxFeedBackService.java index e0f60ab..570a7be 100644 --- a/src/main/java/com/yzdx/AiInterviewer/service/VxService/VxFeedBackService.java +++ b/src/main/java/com/yzdx/AiInterviewer/service/VxService/VxFeedBackService.java @@ -3,10 +3,16 @@ package com.yzdx.AiInterviewer.service.VxService; import com.baomidou.mybatisplus.extension.service.IService; import com.yzdx.AiInterviewer.entity.vxEntity.VxFeedBack; +import java.util.List; + public interface VxFeedBackService extends IService { Integer writeFeedBack(Integer userid, String imgUrl, String phone, String content); Integer updateFeedBack(Integer id, Integer userid, String imgUrl, String phone, String content); - VxFeedBack getFeedBack(Integer userId); + List getFeedBack(Integer userId); + + List getAllFeedBack(Integer status); + + Integer changeFeedBackStatus(Integer id,Integer userId); } diff --git a/src/main/java/com/yzdx/AiInterviewer/service/VxService/VxInterviewRecordService.java b/src/main/java/com/yzdx/AiInterviewer/service/VxService/VxInterviewRecordService.java index 44d1dff..5e4d4bc 100644 --- a/src/main/java/com/yzdx/AiInterviewer/service/VxService/VxInterviewRecordService.java +++ b/src/main/java/com/yzdx/AiInterviewer/service/VxService/VxInterviewRecordService.java @@ -6,7 +6,6 @@ import com.yzdx.AiInterviewer.entity.dto.InterviewRecordDto; import com.yzdx.AiInterviewer.entity.vxEntity.VxInterviewRecord; import java.util.List; -import java.util.Map; public interface VxInterviewRecordService extends IService { @@ -17,7 +16,7 @@ public interface VxInterviewRecordService extends IService { List searchInterviewRecordList(String searchCompany,Integer userId); /** - * 添加面试巨鹿 + * 添加面试记录 * @param encoding 公司编码 * @param interviewer 面试者id * @param comments 面试评语 @@ -31,7 +30,7 @@ public interface VxInterviewRecordService extends IService { Integer addInterviewRecord(String encoding, String comments, Integer interviewer, Integer noticeId,Integer talentId,String detail); /** - * 后台网页或取 + * 后台网页获取 * @param jobId 岗位id * @param encoding 公司编码 * @param postId 招聘ID @@ -50,4 +49,12 @@ public interface VxInterviewRecordService extends IService { * * */ Integer agreeUsersPassInterview(Integer jobId, Integer postId, String userList,Integer userId); + + /** + * 根据用户id获取面试记录 + * @param userId 用户id + * @return List + * + * */ + List getInterviewRecordListByUserId(Integer userId); } diff --git a/src/main/java/com/yzdx/AiInterviewer/service/VxService/impl/VxCarouselChartServiceImpl.java b/src/main/java/com/yzdx/AiInterviewer/service/VxService/impl/VxCarouselChartServiceImpl.java index 82cc958..1b4d4f4 100644 --- a/src/main/java/com/yzdx/AiInterviewer/service/VxService/impl/VxCarouselChartServiceImpl.java +++ b/src/main/java/com/yzdx/AiInterviewer/service/VxService/impl/VxCarouselChartServiceImpl.java @@ -21,4 +21,17 @@ public class VxCarouselChartServiceImpl extends ServiceImpl implements VxFeedBackService { @Autowired @@ -46,10 +50,39 @@ public class VxFeedBackServiceImpl extends ServiceImpl getFeedBack(Integer userId) { LambdaQueryWrapper queryWrapper=new LambdaQueryWrapper<>(); queryWrapper.eq(VxFeedBack::getUserId,userId); - VxFeedBack vxFeedBack = vxFeedBackMapper.selectOne(queryWrapper); - return vxFeedBack; + List vxFeedBacks = vxFeedBackMapper.selectList(queryWrapper); + return vxFeedBacks; } + + @Override + public List getAllFeedBack(Integer status) { + + List allFeedBack = vxFeedBackMapper.getAllFeedBack(status); + + allFeedBack=allFeedBack.stream().map(item->{ + String phone=item.getPhone(); + + String s = PhoneUtils.blurPhone(phone); + + item.setPhone(s); + return item; + }).collect(Collectors.toList()); + + return allFeedBack; + } + + @Override + public Integer changeFeedBackStatus(Integer id,Integer userId) { + VxFeedBack vxFeedBack = vxFeedBackMapper.selectById(id); + + vxFeedBack.setStatus(2); + vxFeedBack.setUpdateUser(userId); + vxFeedBack.setUpdateTime(TimeUtil.getTime()); + return vxFeedBackMapper.updateById(vxFeedBack); + } + + } diff --git a/src/main/java/com/yzdx/AiInterviewer/service/VxService/impl/VxInterviewApplicationServiceImpl.java b/src/main/java/com/yzdx/AiInterviewer/service/VxService/impl/VxInterviewApplicationServiceImpl.java index 2b06b08..cceb32b 100644 --- a/src/main/java/com/yzdx/AiInterviewer/service/VxService/impl/VxInterviewApplicationServiceImpl.java +++ b/src/main/java/com/yzdx/AiInterviewer/service/VxService/impl/VxInterviewApplicationServiceImpl.java @@ -4,12 +4,10 @@ import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.yzdx.AiInterviewer.entity.BaseEntity; -import com.yzdx.AiInterviewer.entity.JobEntity; -import com.yzdx.AiInterviewer.entity.Resume; -import com.yzdx.AiInterviewer.entity.User; +import com.yzdx.AiInterviewer.entity.*; import com.yzdx.AiInterviewer.entity.VxEntityDto.VxInterviewApplicationDto; import com.yzdx.AiInterviewer.entity.vxEntity.VxInterviewApplication; +import com.yzdx.AiInterviewer.mapper.ApplicationCountMapper; import com.yzdx.AiInterviewer.mapper.JobMapper; import com.yzdx.AiInterviewer.mapper.ResumeMapper; import com.yzdx.AiInterviewer.mapper.UserMapper; @@ -35,6 +33,8 @@ public class VxInterviewApplicationServiceImpl extends ServiceImpl queryWrapper2=new LambdaQueryWrapper<>(); + + queryWrapper2.eq(ApplicationCount::getEncoding,companyEncoding).eq(ApplicationCount::getCreateTime,TimeUtil.getTime()); + + ApplicationCount applicationCount = applicationCountMapper.selectOne(queryWrapper2); + + applicationCount.setCount(applicationCount.getCount()+1); + + applicationCountMapper.updateById(applicationCount); + + return insert; } @Override diff --git a/src/main/java/com/yzdx/AiInterviewer/service/VxService/impl/VxInterviewRecordServiceImpl.java b/src/main/java/com/yzdx/AiInterviewer/service/VxService/impl/VxInterviewRecordServiceImpl.java index 32cd4ed..cb48b38 100644 --- a/src/main/java/com/yzdx/AiInterviewer/service/VxService/impl/VxInterviewRecordServiceImpl.java +++ b/src/main/java/com/yzdx/AiInterviewer/service/VxService/impl/VxInterviewRecordServiceImpl.java @@ -182,12 +182,11 @@ public class VxInterviewRecordServiceImpl extends ServiceImpl interviewRecordDtoList=vxInterviewRecords.stream().map(item->{ @@ -292,4 +291,59 @@ public class VxInterviewRecordServiceImpl extends ServiceImpl getInterviewRecordListByUserId(Integer userId) { + LambdaQueryWrapper queryWrapper=new LambdaQueryWrapper<>(); + + queryWrapper.eq(VxInterviewRecord::getInterviewer,userId); + + List vxInterviewRecords = vxInterviewRecordMapper.selectList(queryWrapper); + + if(vxInterviewRecords.size()==0||(vxInterviewRecords.size()==1&&vxInterviewRecords.get(0)==null)){ + return null; + } + List interviewRecordDtoList=vxInterviewRecords.stream().map(item->{ + + InterviewRecordDto interviewRecordDto=new InterviewRecordDto(); + + BeanUtils.copyProperties(item,interviewRecordDto); + + Map postInfo=new HashMap<>(); + + VxInterviewRecord vxInterviewRecord = vxInterviewRecordMapper.selectById(item.getId()); + + VxInterviewNotice vxInterviewNotice = vxInterviewNoticeMapper.selectById(vxInterviewRecord.getNoticeId()); + + postInfo.put("postId",vxInterviewNotice.getPostId()); + + postInfo.put("jobId",vxInterviewNotice.getJobId()); + + interviewRecordDto.setPostInfo(postInfo); + + Map talentInfo=new HashMap<>(); + + Talent talent = talentMapper.selectById(item.getTalentId()); + + talentInfo.put("talentInfo",talent); + + interviewRecordDto.setPostInfo(talentInfo); + + User userInfo=userMapper.selectById(item.getInterviewer()); + + userInfo.setPassword(null); + + userInfo.setSalt(null); + + interviewRecordDto.setUserInfo(userInfo); + + return interviewRecordDto; + + }).collect(Collectors.toList()); + + return interviewRecordDtoList; + + + + } } diff --git a/src/main/java/com/yzdx/AiInterviewer/service/impl/ApplicationCountServiceImpl.java b/src/main/java/com/yzdx/AiInterviewer/service/impl/ApplicationCountServiceImpl.java new file mode 100644 index 0000000..2ded45e --- /dev/null +++ b/src/main/java/com/yzdx/AiInterviewer/service/impl/ApplicationCountServiceImpl.java @@ -0,0 +1,34 @@ +package com.yzdx.AiInterviewer.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.yzdx.AiInterviewer.entity.ApplicationCount; +import com.yzdx.AiInterviewer.mapper.ApplicationCountMapper; +import com.yzdx.AiInterviewer.service.ApplicationCountService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class ApplicationCountServiceImpl extends ServiceImpl implements ApplicationCountService { + + @Autowired + private ApplicationCountMapper applicationCountMapper; + + + @Override + public List getApplicationCountSevenDays(String encoding) { + + List applicationCounts = applicationCountMapper.selectSevenData(encoding); + + return applicationCounts; + } + + @Override + public List getApplicationCountThirtyDays(String encoding) { + + List applicationCounts = applicationCountMapper.selectThirtyData(encoding); + + return applicationCounts; + } +} diff --git a/src/main/java/com/yzdx/AiInterviewer/service/impl/UserServiceImpl.java b/src/main/java/com/yzdx/AiInterviewer/service/impl/UserServiceImpl.java index 1bdd332..5b12593 100644 --- a/src/main/java/com/yzdx/AiInterviewer/service/impl/UserServiceImpl.java +++ b/src/main/java/com/yzdx/AiInterviewer/service/impl/UserServiceImpl.java @@ -167,7 +167,7 @@ public class UserServiceImpl extends ServiceImpl implements Us String userRole =user.getRole(); - if(!(userRole.equals("2"))){ + if(userRole.equals("3")){ return -3; } diff --git a/src/main/java/com/yzdx/AiInterviewer/utiles/PhoneUtils.java b/src/main/java/com/yzdx/AiInterviewer/utiles/PhoneUtils.java new file mode 100644 index 0000000..43c96fd --- /dev/null +++ b/src/main/java/com/yzdx/AiInterviewer/utiles/PhoneUtils.java @@ -0,0 +1,52 @@ +package com.yzdx.AiInterviewer.utiles; + +import com.aliyuncs.utils.StringUtils; + +/** + * 手机号码处理工具类 + * Created by Hilox on 2018/12/29 0029. + */ +public class PhoneUtils { + + private PhoneUtils() {} + + /** + * 手机号格式校验正则 + */ + public static final String PHONE_REGEX = "^1(3[0-9]|4[57]|5[0-35-9]|7[0135678]|8[0-9])\\d{8}$"; + + /** + * 手机号脱敏筛选正则 + */ + public static final String PHONE_BLUR_REGEX = "(\\d{3})\\d{4}(\\d{4})"; + + /** + * 手机号脱敏替换正则 + */ + public static final String PHONE_BLUR_REPLACE_REGEX = "$1****$2"; + + /** + * 手机号格式校验 + * @param phone + * @return + */ + public static final boolean checkPhone(String phone) { + if (StringUtils.isEmpty(phone)) { + return false; + } + return phone.matches(PHONE_REGEX); + } + + /** + * 手机号脱敏处理 + * @param phone + * @return + */ + public static final String blurPhone(String phone) { + boolean checkFlag = checkPhone(phone); + if (!checkFlag) { + throw new IllegalArgumentException("手机号格式不正确!"); + } + return phone.replaceAll(PHONE_BLUR_REGEX, PHONE_BLUR_REPLACE_REGEX); + } +} diff --git a/src/main/java/com/yzdx/AiInterviewer/utiles/TaskUtils.java b/src/main/java/com/yzdx/AiInterviewer/utiles/TaskUtils.java new file mode 100644 index 0000000..7ecbea0 --- /dev/null +++ b/src/main/java/com/yzdx/AiInterviewer/utiles/TaskUtils.java @@ -0,0 +1,44 @@ +package com.yzdx.AiInterviewer.utiles; + +import com.yzdx.AiInterviewer.entity.ApplicationCount; +import com.yzdx.AiInterviewer.entity.Company; +import com.yzdx.AiInterviewer.mapper.ApplicationCountMapper; +import com.yzdx.AiInterviewer.mapper.CompanyMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; + +import java.util.List; + +@Component // 把此类托管给 Spring,不能省略 +public class TaskUtils { +//0 0 * * * ? +// 0/2 * * * * ? + @Autowired + private ApplicationCountMapper applicationCountMapper; + + @Autowired + private CompanyMapper companyMapper; + // 添加定时任务 + @Scheduled(cron = "0 0 0 * * ? ") // cron表达式:每天2:00 执行 + public void doTask(){ + applicationCountMapper.autoDeleteApplicationCount(); + + List companies = companyMapper.selectList(null); + + ApplicationCount applicationCount=new ApplicationCount(); + + for (Company company:companies) { + + applicationCount.setCount(0); + + applicationCount.setEncoding(company.getEncoding()); + + applicationCount.setCreateTime(TimeUtil.getTime()); + + applicationCountMapper.insert(applicationCount); + } + + } + +} diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 0d90dc2..f787843 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -1,11 +1,13 @@ server: - port: 5380 + port: 8080 spring: datasource: - url: jdbc:mysql://117.88.94.226:3306/ai_interviewer?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai + url: jdbc:mysql://101.43.255.47:3306/ai_interviewer?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai username: root - password: Jerry + password: 123456 + hikari: + max-lifetime: 5000000000 jackson: default-property-inclusion: non_null @@ -21,4 +23,6 @@ spring: servlet: multipart: max-file-size: 50MB #单个文件大小限制 - max-request-size: 50MB #总文件大小限制(允许存储文件的文件夹大小) \ No newline at end of file + max-request-size: 50MB #总文件大小限制(允许存储文件的文件夹大小) +mybatis-plus: + mapper-locations: classpath:mapper/*.xml