1.添加岗位取消接口
2.添加岗位取消列表 3.修改对应的统计 4.app_user添加orgType机构类型字段
This commit is contained in:
@@ -2,17 +2,16 @@ package com.ruoyi.cms.controller.app;
|
|||||||
|
|
||||||
import com.ruoyi.cms.domain.ESJobDocument;
|
import com.ruoyi.cms.domain.ESJobDocument;
|
||||||
import com.ruoyi.cms.domain.Job;
|
import com.ruoyi.cms.domain.Job;
|
||||||
|
import com.ruoyi.cms.domain.JobApply;
|
||||||
import com.ruoyi.cms.domain.query.ESJobSearch;
|
import com.ruoyi.cms.domain.query.ESJobSearch;
|
||||||
import com.ruoyi.cms.service.ICompanyService;
|
import com.ruoyi.cms.service.*;
|
||||||
import com.ruoyi.cms.service.IESJobSearchService;
|
|
||||||
import com.ruoyi.cms.service.IJobCollectionService;
|
|
||||||
import com.ruoyi.cms.service.IJobService;
|
|
||||||
import com.ruoyi.cms.util.RoleUtils;
|
import com.ruoyi.cms.util.RoleUtils;
|
||||||
import com.ruoyi.cms.util.sensitiveWord.SensitiveWordChecker;
|
import com.ruoyi.cms.util.sensitiveWord.SensitiveWordChecker;
|
||||||
import com.ruoyi.common.annotation.BussinessLog;
|
import com.ruoyi.common.annotation.BussinessLog;
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
import com.ruoyi.common.core.page.TableDataInfo;
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
import com.ruoyi.common.utils.SiteSecurityUtils;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import io.swagger.annotations.ApiParam;
|
import io.swagger.annotations.ApiParam;
|
||||||
@@ -43,6 +42,8 @@ public class AppJobController extends BaseController
|
|||||||
private IESJobSearchService esJobSearchService;
|
private IESJobSearchService esJobSearchService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private SensitiveWordChecker sensitiveWordChecker;
|
private SensitiveWordChecker sensitiveWordChecker;
|
||||||
|
@Autowired
|
||||||
|
private IJobApplyService jobApplyService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询岗位列表
|
* 查询岗位列表
|
||||||
@@ -253,4 +254,33 @@ public class AppJobController extends BaseController
|
|||||||
}
|
}
|
||||||
return success(jobService.selectApplyJobUserList(jobId));
|
return success(jobService.selectApplyJobUserList(jobId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation("删除岗位申请")
|
||||||
|
@DeleteMapping("/applyJobCencal")
|
||||||
|
public AjaxResult applyJobCencal(@RequestBody JobApply apply){
|
||||||
|
if(apply==null){
|
||||||
|
return AjaxResult.error("参数为空!");
|
||||||
|
}
|
||||||
|
if (apply.getJobId() == null) {
|
||||||
|
return AjaxResult.error("岗位id为空!");
|
||||||
|
}
|
||||||
|
if(!SiteSecurityUtils.isLogin()){
|
||||||
|
return AjaxResult.error("用户未登录!");
|
||||||
|
}
|
||||||
|
if (apply.getUserId() == null) {
|
||||||
|
apply.setUserId(SiteSecurityUtils.getUserId());
|
||||||
|
}
|
||||||
|
return toAjax(jobApplyService.applyJobCencal(apply));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("获取取消岗位岗位详情")
|
||||||
|
@GetMapping("/selectCencalList")
|
||||||
|
public TableDataInfo selectCencalList(){
|
||||||
|
JobApply queryApply = new JobApply();
|
||||||
|
if (queryApply.getUserId() == null) {
|
||||||
|
queryApply.setUserId(SiteSecurityUtils.getUserId());
|
||||||
|
}
|
||||||
|
List<Job> list=jobApplyService.selectCencalList(queryApply);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import com.ruoyi.cms.domain.Job;
|
|||||||
import com.ruoyi.cms.domain.JobApply;
|
import com.ruoyi.cms.domain.JobApply;
|
||||||
import com.ruoyi.cms.domain.vo.CandidateVO;
|
import com.ruoyi.cms.domain.vo.CandidateVO;
|
||||||
import com.ruoyi.common.core.domain.entity.AppUser;
|
import com.ruoyi.common.core.domain.entity.AppUser;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 岗位申请Mapper接口
|
* 岗位申请Mapper接口
|
||||||
@@ -39,4 +40,10 @@ public interface JobApplyMapper extends BaseMapper<JobApply>
|
|||||||
List<Job> selectJobApplyListJob(JobApply jobApply);
|
List<Job> selectJobApplyListJob(JobApply jobApply);
|
||||||
|
|
||||||
public int updateJobZphApply(JobApply jobApply);
|
public int updateJobZphApply(JobApply jobApply);
|
||||||
|
|
||||||
|
public List<Job> selectCencalList(JobApply jobApply);
|
||||||
|
|
||||||
|
public int applyJobCencal(JobApply jobApply);
|
||||||
|
|
||||||
|
int applyCencalCount(@Param("userId") Long userId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,4 +72,8 @@ public interface IJobApplyService
|
|||||||
public List<Job> selectJobApplyListJob(JobApply jobApply);
|
public List<Job> selectJobApplyListJob(JobApply jobApply);
|
||||||
|
|
||||||
public int updateJobZphApply(JobApply jobApply);
|
public int updateJobZphApply(JobApply jobApply);
|
||||||
|
|
||||||
|
public int applyJobCencal(JobApply jobApply);
|
||||||
|
|
||||||
|
public List<Job> selectCencalList(JobApply jobApply);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@@ -109,12 +108,14 @@ public class JobApplyServiceImpl extends ServiceImpl<JobApplyMapper,JobApply> im
|
|||||||
@Override
|
@Override
|
||||||
public HashMap<String, Integer> statistics() {
|
public HashMap<String, Integer> statistics() {
|
||||||
Integer applyCount = jobApplyMapper.applyJob(SiteSecurityUtils.getUserId()).size();
|
Integer applyCount = jobApplyMapper.applyJob(SiteSecurityUtils.getUserId()).size();
|
||||||
|
Integer applyCencalCount=jobApplyMapper.applyCencalCount(SiteSecurityUtils.getUserId());
|
||||||
Integer collectionJobCount = jobCollectionMapper.collectionJob(SiteSecurityUtils.getUserId()).size();
|
Integer collectionJobCount = jobCollectionMapper.collectionJob(SiteSecurityUtils.getUserId()).size();
|
||||||
Integer collectionCompanyCount = companyCollectionMapper.collectionJob(SiteSecurityUtils.getUserId()).size();
|
Integer collectionCompanyCount = companyCollectionMapper.collectionJob(SiteSecurityUtils.getUserId()).size();
|
||||||
Integer jobReviewCount = appReviewJobMapper.review(SiteSecurityUtils.getUserId(),new MineJobQuery()).size();
|
Integer jobReviewCount = appReviewJobMapper.review(SiteSecurityUtils.getUserId(),new MineJobQuery()).size();
|
||||||
Integer fairCollecitonCount = fairCollectionMapper.selectList(Wrappers.<FairCollection>lambdaQuery().eq(FairCollection::getUserId, SiteSecurityUtils.getUserId())).size();
|
Integer fairCollecitonCount = fairCollectionMapper.selectList(Wrappers.<FairCollection>lambdaQuery().eq(FairCollection::getUserId, SiteSecurityUtils.getUserId())).size();
|
||||||
HashMap<String, Integer> map = new HashMap<>();
|
HashMap<String, Integer> map = new HashMap<>();
|
||||||
map.put("applyCount", applyCount);
|
map.put("applyCount", applyCount);
|
||||||
|
map.put("applyCencalCount", applyCencalCount);
|
||||||
map.put("collectionCount", collectionJobCount+collectionCompanyCount);
|
map.put("collectionCount", collectionJobCount+collectionCompanyCount);
|
||||||
map.put("jobReviewCount", jobReviewCount);
|
map.put("jobReviewCount", jobReviewCount);
|
||||||
map.put("fairCollecitonCount", fairCollecitonCount);
|
map.put("fairCollecitonCount", fairCollecitonCount);
|
||||||
@@ -160,4 +161,14 @@ public class JobApplyServiceImpl extends ServiceImpl<JobApplyMapper,JobApply> im
|
|||||||
public int updateJobZphApply(JobApply jobApply) {
|
public int updateJobZphApply(JobApply jobApply) {
|
||||||
return jobApplyMapper.updateJobZphApply(jobApply);
|
return jobApplyMapper.updateJobZphApply(jobApply);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Job> selectCencalList(JobApply jobApply) {
|
||||||
|
return jobApplyMapper.selectCencalList(jobApply);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int applyJobCencal(JobApply jobApply) {
|
||||||
|
return jobApplyMapper.applyJobCencal(jobApply);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -110,10 +110,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<select id="getMyTj" resultType="com.ruoyi.common.core.domain.entity.MyChart">
|
<select id="getMyTj" resultType="com.ruoyi.common.core.domain.entity.MyChart">
|
||||||
SELECT t1.yzj,t2.ysc,t3.ytd,0 AS yyy FROM
|
SELECT t1.yzj,t2.ysc,t3.ytd,0 AS yyy,t4.yqx FROM
|
||||||
(SELECT COUNT(user_id) AS yzj FROM app_review_job WHERE user_id = #{userId} AND del_flag = '0') t1
|
(SELECT COUNT(user_id) AS yzj FROM app_review_job WHERE user_id = #{userId} AND del_flag = '0') t1
|
||||||
CROSS JOIN (SELECT COUNT(user_id) AS ysc FROM job_collection WHERE user_id = #{userId} AND del_flag = '0') t2
|
CROSS JOIN (SELECT COUNT(user_id) AS ysc FROM job_collection WHERE user_id = #{userId} AND del_flag = '0') t2
|
||||||
CROSS JOIN (SELECT COUNT(user_id) AS ytd FROM job_apply WHERE user_id = #{userId} AND del_flag = '0') t3
|
CROSS JOIN (SELECT COUNT(user_id) AS ytd FROM job_apply WHERE user_id = #{userId} AND del_flag = '0') t3
|
||||||
|
CROSS JOIN (SELECT COUNT(user_id) AS yqx FROM job_apply WHERE user_id = #{userId} AND del_flag = '2') t4
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectSysUserIdcard" resultType="com.ruoyi.common.core.domain.entity.SysUser">
|
<select id="selectSysUserIdcard" resultType="com.ruoyi.common.core.domain.entity.SysUser">
|
||||||
|
|||||||
@@ -130,4 +130,20 @@
|
|||||||
update job_apply set update_time=sysdate(),update_by=#{updateBy},hire=#{hire},hire_source=#{hireSource} where user_id=#{userId} AND job_id=#{jobId}
|
update job_apply set update_time=sysdate(),update_by=#{updateBy},hire=#{hire},hire_source=#{hireSource} where user_id=#{userId} AND job_id=#{jobId}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
<update id="applyJobCencal" parameterType="JobApply">
|
||||||
|
update job_apply set del_flag='2',update_time=sysdate(),update_by=#{updateBy} where user_id=#{userId} and job_id=#{jobId}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<select id="selectCencalList" parameterType="JobApply" resultType="com.ruoyi.cms.domain.Job">
|
||||||
|
select b.*,a.create_time as shareTime from job_apply a inner join job b on a.job_id=b.job_id and b.del_flag='0'
|
||||||
|
<where> a.del_flag = '2'
|
||||||
|
<if test="jobId != null "> and a.job_id = #{jobId}</if>
|
||||||
|
<if test="userId != null "> and a.user_id = #{userId}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="applyCencalCount" resultType="java.lang.Integer">
|
||||||
|
select count(user_id) from job_apply where del_flag = '2' and user_id=#{userId}
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
package com.ruoyi.common.core.domain.entity;
|
package com.ruoyi.common.core.domain.entity;
|
||||||
|
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -135,6 +134,9 @@ public class AppUser extends BaseEntity
|
|||||||
@ApiModelProperty("工作经验")
|
@ApiModelProperty("工作经验")
|
||||||
private String workExperience;
|
private String workExperience;
|
||||||
|
|
||||||
|
@ApiModelProperty("机构类型 0用人单位 1培训机构 2评价机构 3人力资源机构")
|
||||||
|
private String orgType;
|
||||||
|
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
@ApiModelProperty("公司信息")
|
@ApiModelProperty("公司信息")
|
||||||
private Company company;
|
private Company company;
|
||||||
|
|||||||
@@ -4,8 +4,9 @@ import lombok.Data;
|
|||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class MyChart {
|
public class MyChart {
|
||||||
private String ytd;
|
private String ytd;//投递
|
||||||
private String ysc;
|
private String ysc;//收藏
|
||||||
private String yzj;
|
private String yzj;//足迹
|
||||||
private String yyy;
|
private String yyy;//已预约
|
||||||
|
private String yqx;//已取消
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,6 +44,11 @@ public class LoginBody
|
|||||||
*/
|
*/
|
||||||
private String idCard;
|
private String idCard;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 企业类型
|
||||||
|
*/
|
||||||
|
public String orgType;
|
||||||
|
|
||||||
public String getUsername()
|
public String getUsername()
|
||||||
{
|
{
|
||||||
return username;
|
return username;
|
||||||
@@ -115,4 +120,12 @@ public class LoginBody
|
|||||||
public void setIdCard(String idCard) {
|
public void setIdCard(String idCard) {
|
||||||
this.idCard = idCard;
|
this.idCard = idCard;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getOrgType() {
|
||||||
|
return orgType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOrgType(String orgType) {
|
||||||
|
this.orgType = orgType;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -269,7 +269,7 @@ public class SysLoginService
|
|||||||
AppUser existingUser=appUserService.selectByOpenid(openid,dto.getUserType());
|
AppUser existingUser=appUserService.selectByOpenid(openid,dto.getUserType());
|
||||||
if(existingUser!=null){
|
if(existingUser!=null){
|
||||||
if(StringUtils.isEmpty(existingUser.getIsCompanyUser())){
|
if(StringUtils.isEmpty(existingUser.getIsCompanyUser())){
|
||||||
updateAppUserCommon(existingUser,openid,unionid,dto.getUserType());
|
updateAppUserCommon(existingUser,openid,unionid,dto.getUserType(),dto.getOrgType());
|
||||||
}
|
}
|
||||||
String token = loginUserIdApp(existingUser);
|
String token = loginUserIdApp(existingUser);
|
||||||
ajax.put(Constants.TOKEN, token);
|
ajax.put(Constants.TOKEN, token);
|
||||||
@@ -290,7 +290,7 @@ public class SysLoginService
|
|||||||
String token="";
|
String token="";
|
||||||
boolean isNewUser=false;
|
boolean isNewUser=false;
|
||||||
if (existUser != null) {
|
if (existUser != null) {
|
||||||
updateAppUserCommon(existUser,openid,unionid,dto.getUserType());
|
updateAppUserCommon(existUser,openid,unionid,dto.getUserType(),dto.getOrgType());
|
||||||
// 5. 生成系统令牌
|
// 5. 生成系统令牌
|
||||||
token = loginUserIdApp(existUser);
|
token = loginUserIdApp(existUser);
|
||||||
ajax.put("idCard",existUser.getIdCard());
|
ajax.put("idCard",existUser.getIdCard());
|
||||||
@@ -374,12 +374,12 @@ public class SysLoginService
|
|||||||
// 6.1 优先匹配「OpenID+前端传入角色」的老用户
|
// 6.1 优先匹配「OpenID+前端传入角色」的老用户
|
||||||
AppUser existingUser = appUserService.selectByOpenid(openid, userType);
|
AppUser existingUser = appUserService.selectByOpenid(openid, userType);
|
||||||
if (existingUser != null) {
|
if (existingUser != null) {
|
||||||
System.out.printf("小程序登录-匹配到普通老用户:openid=%s, userType=%s%n", openid, userType);
|
System.out.printf("小程序登录-匹配到普通老用户:openid=%s, userType=%s%n", openid, userType, dto.getOrgType());
|
||||||
return handleExistingUser(existingUser, userType);
|
return handleExistingUser(existingUser, userType,dto.getOrgType());
|
||||||
}
|
}
|
||||||
|
|
||||||
// 6.2 处理普通用户的匹配与注册(手机号绑定、新用户创建等)
|
// 6.2 处理普通用户的匹配与注册(手机号绑定、新用户创建等)
|
||||||
return handleUserMatchAndRegister(openid, unionid, phone, userType);
|
return handleUserMatchAndRegister(openid, unionid, phone, userType,dto.getOrgType());
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
System.err.println("小程序登录异常:" + e.getMessage());
|
System.err.println("小程序登录异常:" + e.getMessage());
|
||||||
@@ -470,21 +470,21 @@ public class SysLoginService
|
|||||||
* @param userType
|
* @param userType
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private AjaxResult handleUserMatchAndRegister(String openid, String unionid, String phone, String userType) {
|
private AjaxResult handleUserMatchAndRegister(String openid, String unionid, String phone, String userType,String orgType) {
|
||||||
// 匹配「手机号+角色」的用户
|
// 匹配「手机号+角色」的用户
|
||||||
AppUser phoneRoleUser = appUserService.getPhoneAndUserType(phone, userType);
|
AppUser phoneRoleUser = appUserService.getPhoneAndUserType(phone, userType);
|
||||||
if (phoneRoleUser != null) {
|
if (phoneRoleUser != null) {
|
||||||
return handlePhoneBoundUser(phoneRoleUser, openid, unionid, userType);
|
return handlePhoneBoundUser(phoneRoleUser, openid, unionid, userType,orgType);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 匹配无角色历史数据
|
// 匹配无角色历史数据
|
||||||
AppUser noRoleUser = appUserService.getPhoneAndNoRole(phone);
|
AppUser noRoleUser = appUserService.getPhoneAndNoRole(phone);
|
||||||
if (noRoleUser != null) {
|
if (noRoleUser != null) {
|
||||||
return handleNoRoleUserBinding(openid, unionid, phone, userType, noRoleUser);
|
return handleNoRoleUserBinding(openid, unionid, phone, userType, noRoleUser,orgType);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 全新用户注册
|
// 全新用户注册
|
||||||
return handleNewUserRegistration(openid, unionid, phone, userType);
|
return handleNewUserRegistration(openid, unionid, phone, userType,orgType);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -496,7 +496,7 @@ public class SysLoginService
|
|||||||
* @param noRoleUser
|
* @param noRoleUser
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private AjaxResult handleNoRoleUserBinding(String openid, String unionid, String phone, String userType, AppUser noRoleUser) {
|
private AjaxResult handleNoRoleUserBinding(String openid, String unionid, String phone, String userType, AppUser noRoleUser,String orgType) {
|
||||||
String lockKey = "login_no_role_bind_" + phone + "_" + userType;
|
String lockKey = "login_no_role_bind_" + phone + "_" + userType;
|
||||||
try (DistributedLockUtil.AutoReleaseLock lock = distributedLockUtil.tryLock(lockKey, 3, TimeUnit.SECONDS)) {
|
try (DistributedLockUtil.AutoReleaseLock lock = distributedLockUtil.tryLock(lockKey, 3, TimeUnit.SECONDS)) {
|
||||||
if (!lock.isLocked()) {
|
if (!lock.isLocked()) {
|
||||||
@@ -505,9 +505,9 @@ public class SysLoginService
|
|||||||
// 双重检查
|
// 双重检查
|
||||||
AppUser doubleCheck = appUserService.getPhoneAndUserType(phone, userType);
|
AppUser doubleCheck = appUserService.getPhoneAndUserType(phone, userType);
|
||||||
if (doubleCheck != null) {
|
if (doubleCheck != null) {
|
||||||
return handlePhoneBoundUser(doubleCheck, openid, unionid, userType);
|
return handlePhoneBoundUser(doubleCheck, openid, unionid, userType,orgType);
|
||||||
}
|
}
|
||||||
return handlePhoneBoundUser(noRoleUser, openid, unionid, userType);
|
return handlePhoneBoundUser(noRoleUser, openid, unionid, userType,orgType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -519,7 +519,7 @@ public class SysLoginService
|
|||||||
* @param userType
|
* @param userType
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private AjaxResult handleNewUserRegistration(String openid, String unionid, String phone, String userType) {
|
private AjaxResult handleNewUserRegistration(String openid, String unionid, String phone, String userType,String orgType) {
|
||||||
String createLockKey = "login_create_" + phone + "_" + userType;
|
String createLockKey = "login_create_" + phone + "_" + userType;
|
||||||
try (DistributedLockUtil.AutoReleaseLock lock = distributedLockUtil.tryLock(createLockKey, 3, TimeUnit.SECONDS)) {
|
try (DistributedLockUtil.AutoReleaseLock lock = distributedLockUtil.tryLock(createLockKey, 3, TimeUnit.SECONDS)) {
|
||||||
if (!lock.isLocked()) {
|
if (!lock.isLocked()) {
|
||||||
@@ -528,9 +528,9 @@ public class SysLoginService
|
|||||||
// 双重检查
|
// 双重检查
|
||||||
AppUser checkNew = appUserService.getPhoneAndUserType(phone, userType);
|
AppUser checkNew = appUserService.getPhoneAndUserType(phone, userType);
|
||||||
if (checkNew != null) {
|
if (checkNew != null) {
|
||||||
return handlePhoneBoundUser(checkNew, openid, unionid, userType);
|
return handlePhoneBoundUser(checkNew, openid, unionid, userType,orgType);
|
||||||
}
|
}
|
||||||
return handleNewUser(openid, unionid, phone, userType);
|
return handleNewUser(openid, unionid, phone, userType,orgType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -548,7 +548,7 @@ public class SysLoginService
|
|||||||
}
|
}
|
||||||
// 原有逻辑(更新登录时间、生成token)
|
// 原有逻辑(更新登录时间、生成token)
|
||||||
AjaxResult ajax = AjaxResult.success();
|
AjaxResult ajax = AjaxResult.success();
|
||||||
updateAppUserCommon(specialUser, null, null, null);
|
updateAppUserCommon(specialUser, null, null, null,specialUser.getOrgType());
|
||||||
String token = loginUserIdApp(specialUser);
|
String token = loginUserIdApp(specialUser);
|
||||||
ajax.put(Constants.TOKEN, token);
|
ajax.put(Constants.TOKEN, token);
|
||||||
ajax.put("isNewUser", false);
|
ajax.put("isNewUser", false);
|
||||||
@@ -565,9 +565,9 @@ public class SysLoginService
|
|||||||
* 处理老用户登录(日志用println)
|
* 处理老用户登录(日志用println)
|
||||||
*/
|
*/
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public AjaxResult handleExistingUser(AppUser existingUser, String userType) {
|
public AjaxResult handleExistingUser(AppUser existingUser, String userType,String orgType) {
|
||||||
AjaxResult ajax = AjaxResult.success();
|
AjaxResult ajax = AjaxResult.success();
|
||||||
updateAppUserCommon(existingUser, null, null, userType);
|
updateAppUserCommon(existingUser, null, null, userType,orgType);
|
||||||
String token = loginUserIdApp(existingUser);
|
String token = loginUserIdApp(existingUser);
|
||||||
ajax.put(Constants.TOKEN, token);
|
ajax.put(Constants.TOKEN, token);
|
||||||
ajax.put("isNewUser", false);
|
ajax.put("isNewUser", false);
|
||||||
@@ -583,7 +583,7 @@ public class SysLoginService
|
|||||||
* 处理手机号已绑定的用户
|
* 处理手机号已绑定的用户
|
||||||
*/
|
*/
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public AjaxResult handlePhoneBoundUser(AppUser phoneUser, String openid, String unionid, String userType) {
|
public AjaxResult handlePhoneBoundUser(AppUser phoneUser, String openid, String unionid, String userType,String orgType) {
|
||||||
AjaxResult ajax = AjaxResult.success();
|
AjaxResult ajax = AjaxResult.success();
|
||||||
if (StringUtils.hasText(phoneUser.getOpenid()) && !openid.equals(phoneUser.getOpenid())) {
|
if (StringUtils.hasText(phoneUser.getOpenid()) && !openid.equals(phoneUser.getOpenid())) {
|
||||||
System.out.printf("手机号绑定冲突,phone:%s, oldOpenid:%s, newOpenid:%s%n",
|
System.out.printf("手机号绑定冲突,phone:%s, oldOpenid:%s, newOpenid:%s%n",
|
||||||
@@ -591,7 +591,7 @@ public class SysLoginService
|
|||||||
return AjaxResult.error("该手机号已绑定其他微信账号");
|
return AjaxResult.error("该手机号已绑定其他微信账号");
|
||||||
}
|
}
|
||||||
//修改用户信息
|
//修改用户信息
|
||||||
updateAppUserCommon(phoneUser, openid, unionid, userType);
|
updateAppUserCommon(phoneUser, openid, unionid, userType,orgType);
|
||||||
phoneUser.setOpenid(openid);
|
phoneUser.setOpenid(openid);
|
||||||
phoneUser.setUnionid(unionid);
|
phoneUser.setUnionid(unionid);
|
||||||
phoneUser.setIsCompanyUser(userType);
|
phoneUser.setIsCompanyUser(userType);
|
||||||
@@ -609,7 +609,7 @@ public class SysLoginService
|
|||||||
* 处理新用户注册
|
* 处理新用户注册
|
||||||
*/
|
*/
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public AjaxResult handleNewUser(String openid, String unionid, String phone, String userType) {
|
public AjaxResult handleNewUser(String openid, String unionid, String phone, String userType,String orgType) {
|
||||||
AjaxResult ajax = AjaxResult.success();
|
AjaxResult ajax = AjaxResult.success();
|
||||||
AppUser newUser = new AppUser();
|
AppUser newUser = new AppUser();
|
||||||
newUser.setOpenid(openid);
|
newUser.setOpenid(openid);
|
||||||
@@ -617,6 +617,7 @@ public class SysLoginService
|
|||||||
newUser.setPhone(phone);
|
newUser.setPhone(phone);
|
||||||
newUser.setIsCompanyUser(userType);
|
newUser.setIsCompanyUser(userType);
|
||||||
newUser.setLoginDate(new Date());
|
newUser.setLoginDate(new Date());
|
||||||
|
newUser.setOrgType(orgType);
|
||||||
appUserService.insertAppUser(newUser);
|
appUserService.insertAppUser(newUser);
|
||||||
String token = loginUserIdApp(newUser);
|
String token = loginUserIdApp(newUser);
|
||||||
ajax.put(Constants.TOKEN, token);
|
ajax.put(Constants.TOKEN, token);
|
||||||
@@ -631,7 +632,7 @@ public class SysLoginService
|
|||||||
/**
|
/**
|
||||||
* 抽取用户更新公共方法
|
* 抽取用户更新公共方法
|
||||||
*/
|
*/
|
||||||
private void updateAppUserCommon(AppUser targetUser, String openid, String unionid, String userType) {
|
private void updateAppUserCommon(AppUser targetUser, String openid, String unionid, String userType,String orgType) {
|
||||||
AppUser updateParm = new AppUser();
|
AppUser updateParm = new AppUser();
|
||||||
updateParm.setUserId(targetUser.getUserId());
|
updateParm.setUserId(targetUser.getUserId());
|
||||||
|
|
||||||
@@ -651,6 +652,9 @@ public class SysLoginService
|
|||||||
updateParm.setUnionid(unionid);
|
updateParm.setUnionid(unionid);
|
||||||
targetUser.setUnionid(unionid);
|
targetUser.setUnionid(unionid);
|
||||||
}
|
}
|
||||||
|
if(StringUtils.isNotBlank(orgType)){
|
||||||
|
updateParm.setOrgType(orgType);
|
||||||
|
}
|
||||||
//最后登录时间
|
//最后登录时间
|
||||||
updateParm.setLoginDate(new Date());
|
updateParm.setLoginDate(new Date());
|
||||||
appUserService.updateAppUser(updateParm);
|
appUserService.updateAppUser(updateParm);
|
||||||
|
|||||||
Reference in New Issue
Block a user