This commit is contained in:
parent
f1192045c7
commit
1a05b1922f
|
@ -129,6 +129,8 @@ public class XcxAuthStrategy implements IAuthStrategy {
|
||||||
// 使用 openid 查询绑定用户 如未绑定用户 则根据业务自行处理 例如 创建默认用户
|
// 使用 openid 查询绑定用户 如未绑定用户 则根据业务自行处理 例如 创建默认用户
|
||||||
return TenantHelper.ignore(() -> {
|
return TenantHelper.ignore(() -> {
|
||||||
SysUser user = userMapper.selectOne(new LambdaQueryWrapper<SysUser>().eq(SysUser::getUserName, phoneNumber));
|
SysUser user = userMapper.selectOne(new LambdaQueryWrapper<SysUser>().eq(SysUser::getUserName, phoneNumber));
|
||||||
|
//.eq(SysUser::getStatus, 0)
|
||||||
|
//.eq(SysUser::getDelFlag, 0));
|
||||||
if (ObjectUtil.isNull(user)) {
|
if (ObjectUtil.isNull(user)) {
|
||||||
//newUser.setDeptId(100L);
|
//newUser.setDeptId(100L);
|
||||||
SysUser newUser = new SysUser();
|
SysUser newUser = new SysUser();
|
||||||
|
@ -142,7 +144,14 @@ public class XcxAuthStrategy implements IAuthStrategy {
|
||||||
userMapper.insert(newUser);
|
userMapper.insert(newUser);
|
||||||
return newUser;
|
return newUser;
|
||||||
} else {
|
} else {
|
||||||
if (user.getOpenId().equals(openid)) {
|
String userOpenId = user.getOpenId();
|
||||||
|
if (StringUtils.isEmpty(userOpenId)) {
|
||||||
|
user.setOpenId(openid);
|
||||||
|
userMapper.updateOpenIdById(openid, user.getUserId());
|
||||||
|
//userMapper.updateById(user);
|
||||||
|
return user;
|
||||||
|
}
|
||||||
|
if (userOpenId.equals(openid)) {
|
||||||
return user;
|
return user;
|
||||||
} else {
|
} else {
|
||||||
throw new UserException("此用户已被其他微信号绑定", phoneNumber);
|
throw new UserException("此用户已被其他微信号绑定", phoneNumber);
|
||||||
|
|
|
@ -22,7 +22,9 @@ public enum UserType {
|
||||||
/**
|
/**
|
||||||
* app端
|
* app端
|
||||||
*/
|
*/
|
||||||
APP_USER("app_user");
|
APP_USER("app_user"),
|
||||||
|
|
||||||
|
SYS_COUNSELOR("sys_counselor");
|
||||||
|
|
||||||
private final String userType;
|
private final String userType;
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
|
import org.dromara.common.tenant.helper.TenantHelper;
|
||||||
import org.dromara.common.web.core.BaseController;
|
import org.dromara.common.web.core.BaseController;
|
||||||
import org.dromara.system.domain.vo.ArchiveStatisticVo;
|
import org.dromara.system.domain.vo.ArchiveStatisticVo;
|
||||||
import org.dromara.system.domain.vo.ArchiveVo;
|
import org.dromara.system.domain.vo.ArchiveVo;
|
||||||
|
@ -35,13 +36,14 @@ public class ArchiveController extends BaseController {
|
||||||
public TableDataInfo<ArchiveVo> pageList(ArchiveVo vo, PageQuery pageQuery) {
|
public TableDataInfo<ArchiveVo> pageList(ArchiveVo vo, PageQuery pageQuery) {
|
||||||
return archiveService.queryPageList(vo, pageQuery);
|
return archiveService.queryPageList(vo, pageQuery);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取档案静态列表
|
* 获取档案静态列表
|
||||||
*/
|
*/
|
||||||
@SaCheckPermission("scale:archive:list")
|
@SaCheckPermission("scale:archive:list")
|
||||||
@GetMapping("/statistic/pageList")
|
@GetMapping("/statistic/pageList")
|
||||||
public TableDataInfo<ArchiveStatisticVo> statisticPageList(Long userId, PageQuery pageQuery) {
|
public TableDataInfo<ArchiveStatisticVo> statisticPageList(Long userId, PageQuery pageQuery) {
|
||||||
return archiveService.queryStatisticPageList(userId, pageQuery);
|
return TenantHelper.ignore(() -> archiveService.queryStatisticPageList(userId, pageQuery));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,7 +85,7 @@ public class SysUserController extends BaseController {
|
||||||
@SaCheckPermission("system:user:import")
|
@SaCheckPermission("system:user:import")
|
||||||
@PostMapping(value = "/importData", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
@PostMapping(value = "/importData", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
||||||
public R<Void> importData(@RequestPart("file") MultipartFile file, boolean updateSupport) throws Exception {
|
public R<Void> importData(@RequestPart("file") MultipartFile file, boolean updateSupport) throws Exception {
|
||||||
ExcelResult<SysUserImportVo> result = ExcelUtil.importExcel(file.getInputStream(), SysUserImportVo.class, new SysUserImportListener(updateSupport));
|
ExcelResult<SysUserImportVo> result = ExcelUtil.importExcel(file.getInputStream(), SysUserImportVo.class, new SysUserImportListener());
|
||||||
return R.ok(result.getAnalysis());
|
return R.ok(result.getAnalysis());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ import com.github.binarywang.wxpay.bean.order.WxPayMpOrderResult;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.dromara.common.core.constant.TenantConstants;
|
||||||
import org.dromara.common.core.domain.R;
|
import org.dromara.common.core.domain.R;
|
||||||
import org.dromara.common.core.validate.AddGroup;
|
import org.dromara.common.core.validate.AddGroup;
|
||||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||||
|
@ -48,7 +49,7 @@ public class WxOrderController extends BaseController {
|
||||||
public TableDataInfo<SysScaleOrderVo> scaleOrderList(SysScaleOrderBo bo, PageQuery pageQuery) {
|
public TableDataInfo<SysScaleOrderVo> scaleOrderList(SysScaleOrderBo bo, PageQuery pageQuery) {
|
||||||
Long userId = LoginHelper.getUserId();
|
Long userId = LoginHelper.getUserId();
|
||||||
bo.setCreateBy(userId);
|
bo.setCreateBy(userId);
|
||||||
return scaleOrderService.queryPageList(bo, pageQuery);
|
return TenantHelper.dynamic(TenantConstants.DEFAULT_TENANT_ID, () -> scaleOrderService.queryPageList(bo, pageQuery));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -71,7 +72,13 @@ public class WxOrderController extends BaseController {
|
||||||
public R<WxPayMpOrderResult> addScale(@Validated(AddGroup.class) @RequestBody SysScaleOrderBo bo, HttpServletRequest request) throws Exception {
|
public R<WxPayMpOrderResult> addScale(@Validated(AddGroup.class) @RequestBody SysScaleOrderBo bo, HttpServletRequest request) throws Exception {
|
||||||
String clientIpAddress = getClientIpAddress(request);
|
String clientIpAddress = getClientIpAddress(request);
|
||||||
bo.setSpbillCreateIp(clientIpAddress);
|
bo.setSpbillCreateIp(clientIpAddress);
|
||||||
return R.ok(scaleOrderService.insertByBo(bo));
|
return R.ok(TenantHelper.dynamic(TenantConstants.DEFAULT_TENANT_ID, () -> {
|
||||||
|
try {
|
||||||
|
return scaleOrderService.insertByBo(bo);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -105,7 +112,7 @@ public class WxOrderController extends BaseController {
|
||||||
Long userId = LoginHelper.getUserId();
|
Long userId = LoginHelper.getUserId();
|
||||||
bo.setCounselorId(userId);
|
bo.setCounselorId(userId);
|
||||||
bo.setCreateBy(null);
|
bo.setCreateBy(null);
|
||||||
return TenantHelper.ignore(() ->reservationOrderService.queryPageList(bo, pageQuery));
|
return TenantHelper.ignore(() -> reservationOrderService.queryPageList(bo, pageQuery));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -97,7 +97,7 @@ public class SysUserBo extends BaseEntity {
|
||||||
/**
|
/**
|
||||||
* 角色组
|
* 角色组
|
||||||
*/
|
*/
|
||||||
@Size(min = 1, message = "用户角色不能为空")
|
//@Size(min = 1, message = "用户角色不能为空")
|
||||||
private Long[] roleIds;
|
private Long[] roleIds;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -31,6 +31,8 @@ public class SysEvaluationConclusionVo implements Serializable {
|
||||||
@ExcelProperty(value = "")
|
@ExcelProperty(value = "")
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
|
private String tenantId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* td_evaluation_record表id
|
* td_evaluation_record表id
|
||||||
*/
|
*/
|
||||||
|
@ -92,6 +94,4 @@ public class SysEvaluationConclusionVo implements Serializable {
|
||||||
private String situationName;
|
private String situationName;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,42 +23,25 @@ public class SysUserImportVo implements Serializable {
|
||||||
@Serial
|
@Serial
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户ID
|
|
||||||
*/
|
|
||||||
@ExcelProperty(value = "用户序号")
|
|
||||||
private Long userId;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 部门ID
|
* 部门ID
|
||||||
*/
|
*/
|
||||||
@ExcelProperty(value = "部门编号")
|
@ExcelProperty(value = "部门名称")
|
||||||
private Long deptId;
|
@ExcelDictFormat(dictType = "dept")
|
||||||
|
private String deptName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户账号
|
* 用户账号
|
||||||
*/
|
*/
|
||||||
@ExcelProperty(value = "登录名称")
|
@ExcelProperty(value = "登录账号(手机号)")
|
||||||
private String userName;
|
private String userName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户昵称
|
* 用户昵称
|
||||||
*/
|
*/
|
||||||
@ExcelProperty(value = "用户名称")
|
@ExcelProperty(value = "姓名")
|
||||||
private String nickName;
|
private String nickName;
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户邮箱
|
|
||||||
*/
|
|
||||||
@ExcelProperty(value = "用户邮箱")
|
|
||||||
private String email;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 手机号码
|
|
||||||
*/
|
|
||||||
@ExcelProperty(value = "手机号码")
|
|
||||||
private String phonenumber;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户性别
|
* 用户性别
|
||||||
*/
|
*/
|
||||||
|
@ -66,11 +49,4 @@ public class SysUserImportVo implements Serializable {
|
||||||
@ExcelDictFormat(dictType = "sys_user_sex")
|
@ExcelDictFormat(dictType = "sys_user_sex")
|
||||||
private String sex;
|
private String sex;
|
||||||
|
|
||||||
/**
|
|
||||||
* 帐号状态(0正常 1停用)
|
|
||||||
*/
|
|
||||||
@ExcelProperty(value = "帐号状态", converter = ExcelDictConvert.class)
|
|
||||||
@ExcelDictFormat(dictType = "sys_normal_disable")
|
|
||||||
private String status;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,16 +5,19 @@ import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.crypto.digest.BCrypt;
|
import cn.hutool.crypto.digest.BCrypt;
|
||||||
import com.alibaba.excel.context.AnalysisContext;
|
import com.alibaba.excel.context.AnalysisContext;
|
||||||
import com.alibaba.excel.event.AnalysisEventListener;
|
import com.alibaba.excel.event.AnalysisEventListener;
|
||||||
|
import org.dromara.common.core.enums.UserType;
|
||||||
import org.dromara.common.core.exception.ServiceException;
|
import org.dromara.common.core.exception.ServiceException;
|
||||||
import org.dromara.common.core.utils.SpringUtils;
|
import org.dromara.common.core.utils.SpringUtils;
|
||||||
import org.dromara.common.core.utils.ValidatorUtils;
|
import org.dromara.common.core.utils.ValidatorUtils;
|
||||||
import org.dromara.common.excel.core.ExcelListener;
|
import org.dromara.common.excel.core.ExcelListener;
|
||||||
import org.dromara.common.excel.core.ExcelResult;
|
import org.dromara.common.excel.core.ExcelResult;
|
||||||
import org.dromara.common.satoken.utils.LoginHelper;
|
import org.dromara.common.satoken.utils.LoginHelper;
|
||||||
|
import org.dromara.common.tenant.helper.TenantHelper;
|
||||||
import org.dromara.system.domain.bo.SysUserBo;
|
import org.dromara.system.domain.bo.SysUserBo;
|
||||||
import org.dromara.system.domain.vo.SysUserImportVo;
|
import org.dromara.system.domain.vo.SysUserImportVo;
|
||||||
import org.dromara.system.domain.vo.SysUserVo;
|
import org.dromara.system.domain.vo.SysUserVo;
|
||||||
import org.dromara.system.service.ISysConfigService;
|
import org.dromara.system.service.ISysConfigService;
|
||||||
|
import org.dromara.system.service.ISysDeptService;
|
||||||
import org.dromara.system.service.ISysUserService;
|
import org.dromara.system.service.ISysUserService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
@ -32,7 +35,7 @@ public class SysUserImportListener extends AnalysisEventListener<SysUserImportVo
|
||||||
|
|
||||||
private final String password;
|
private final String password;
|
||||||
|
|
||||||
private final Boolean isUpdateSupport;
|
private final ISysDeptService deptService;
|
||||||
|
|
||||||
private final Long operUserId;
|
private final Long operUserId;
|
||||||
|
|
||||||
|
@ -41,41 +44,42 @@ public class SysUserImportListener extends AnalysisEventListener<SysUserImportVo
|
||||||
private final StringBuilder successMsg = new StringBuilder();
|
private final StringBuilder successMsg = new StringBuilder();
|
||||||
private final StringBuilder failureMsg = new StringBuilder();
|
private final StringBuilder failureMsg = new StringBuilder();
|
||||||
|
|
||||||
public SysUserImportListener(Boolean isUpdateSupport) {
|
public SysUserImportListener() {
|
||||||
String initPassword = SpringUtils.getBean(ISysConfigService.class).selectConfigByKey("sys.user.initPassword");
|
String initPassword = SpringUtils.getBean(ISysConfigService.class).selectConfigByKey("sys.user.initPassword");
|
||||||
this.userService = SpringUtils.getBean(ISysUserService.class);
|
this.userService = SpringUtils.getBean(ISysUserService.class);
|
||||||
|
this.deptService = SpringUtils.getBean(ISysDeptService.class);
|
||||||
this.password = BCrypt.hashpw(initPassword);
|
this.password = BCrypt.hashpw(initPassword);
|
||||||
this.isUpdateSupport = isUpdateSupport;
|
|
||||||
this.operUserId = LoginHelper.getUserId();
|
this.operUserId = LoginHelper.getUserId();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void invoke(SysUserImportVo userVo, AnalysisContext context) {
|
public void invoke(SysUserImportVo userVo, AnalysisContext context) {
|
||||||
SysUserVo sysUser = this.userService.selectUserByUserName(userVo.getUserName());
|
SysUserVo sysUser = TenantHelper.ignore(() -> this.userService.selectUserByUserName(userVo.getUserName()));
|
||||||
|
|
||||||
|
Long deptId = deptService.selectIdByName(userVo.getDeptName());
|
||||||
|
if (deptId == null) {
|
||||||
|
deptId = deptService.selectId4Parent();
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
// 验证是否存在这个用户
|
if (deptId != null) {
|
||||||
if (ObjectUtil.isNull(sysUser)) {
|
// 验证是否存在这个用户
|
||||||
SysUserBo user = BeanUtil.toBean(userVo, SysUserBo.class);
|
if (ObjectUtil.isNull(sysUser)) {
|
||||||
ValidatorUtils.validate(user);
|
SysUserBo user = BeanUtil.toBean(userVo, SysUserBo.class);
|
||||||
user.setPassword(password);
|
user.setUserType(UserType.APP_USER.getUserType());
|
||||||
user.setCreateBy(operUserId);
|
user.setPassword(password);
|
||||||
userService.insertUser(user);
|
user.setDeptId(deptId);
|
||||||
successNum++;
|
user.setCreateBy(operUserId);
|
||||||
successMsg.append("<br/>").append(successNum).append("、账号 ").append(user.getUserName()).append(" 导入成功");
|
ValidatorUtils.validate(user);
|
||||||
} else if (isUpdateSupport) {
|
userService.insertUser(user);
|
||||||
Long userId = sysUser.getUserId();
|
successNum++;
|
||||||
SysUserBo user = BeanUtil.toBean(userVo, SysUserBo.class);
|
successMsg.append("<br/>").append(successNum).append("、账号 ").append(user.getUserName()).append(" 导入成功");
|
||||||
user.setUserId(userId);
|
} else {
|
||||||
ValidatorUtils.validate(user);
|
failureNum++;
|
||||||
userService.checkUserAllowed(user.getUserId());
|
failureMsg.append("<br/>").append(failureNum).append("、账号 ").append(userVo.getUserName()).append(" 已存在");
|
||||||
userService.checkUserDataScope(user.getUserId());
|
}
|
||||||
user.setUpdateBy(operUserId);
|
|
||||||
userService.updateUser(user);
|
|
||||||
successNum++;
|
|
||||||
successMsg.append("<br/>").append(successNum).append("、账号 ").append(user.getUserName()).append(" 更新成功");
|
|
||||||
} else {
|
} else {
|
||||||
failureNum++;
|
failureNum++;
|
||||||
failureMsg.append("<br/>").append(failureNum).append("、账号 ").append(sysUser.getUserName()).append(" 已存在");
|
failureMsg.append("<br/>").append(failureNum).append("、账号 ").append(userVo.getUserName()).append(" 的部门不存在或没有主公司");
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
failureNum++;
|
failureNum++;
|
||||||
|
|
|
@ -92,4 +92,5 @@ public interface SysUserMapper extends BaseMapperPlus<SysUser, SysUserVo> {
|
||||||
|
|
||||||
List<SysUser> findUserByIds(String userIds);
|
List<SysUser> findUserByIds(String userIds);
|
||||||
|
|
||||||
|
int updateOpenIdById(@Param("openId") String openId, @Param("userId") Long userId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,4 +122,8 @@ public interface ISysDeptService {
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
int deleteDeptById(Long deptId);
|
int deleteDeptById(Long deptId);
|
||||||
|
|
||||||
|
Long selectIdByName(String deptName);
|
||||||
|
|
||||||
|
Long selectId4Parent();
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.dromara.common.core.enums.UserType;
|
||||||
import org.dromara.common.core.exception.ServiceException;
|
import org.dromara.common.core.exception.ServiceException;
|
||||||
import org.dromara.common.core.service.DictService;
|
import org.dromara.common.core.service.DictService;
|
||||||
import org.dromara.common.core.service.OssService;
|
import org.dromara.common.core.service.OssService;
|
||||||
|
@ -229,7 +230,7 @@ public class CounselorServiceImpl implements ICounselorService {
|
||||||
}
|
}
|
||||||
user.setNickName(bo.getName());
|
user.setNickName(bo.getName());
|
||||||
user.setPassword(BCrypt.hashpw("Mz123456!"));
|
user.setPassword(BCrypt.hashpw("Mz123456!"));
|
||||||
user.setUserType("sys_counselor");
|
user.setUserType(UserType.SYS_COUNSELOR.getUserType());
|
||||||
userService.insertUser(user);
|
userService.insertUser(user);
|
||||||
Counselor add = MapstructUtils.convert(bo, Counselor.class);
|
Counselor add = MapstructUtils.convert(bo, Counselor.class);
|
||||||
add.setId(user.getUserId());
|
add.setId(user.getUserId());
|
||||||
|
|
|
@ -137,7 +137,7 @@ public class EvaluationServiceImpl implements IEvaluationService {
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> submitAnswer(SubmitAnswerBo bo) {
|
public Map<String, Object> submitAnswer(SubmitAnswerBo bo) {
|
||||||
LoginUser loginUser = getLoginUser();
|
LoginUser loginUser = getLoginUser();
|
||||||
String userType = loginUser.getUserType();
|
//String userType = loginUser.getUserType();
|
||||||
// if (!UserType.STUDENT.getName().equals(userType)) {
|
// if (!UserType.STUDENT.getName().equals(userType)) {
|
||||||
// throw new ServiceException("只有学生账户才能测评");
|
// throw new ServiceException("只有学生账户才能测评");
|
||||||
// }
|
// }
|
||||||
|
@ -156,6 +156,7 @@ public class EvaluationServiceImpl implements IEvaluationService {
|
||||||
boolean allowQueryResult = true;
|
boolean allowQueryResult = true;
|
||||||
Long scaleId = bo.getScaleId();
|
Long scaleId = bo.getScaleId();
|
||||||
SysScale sysScale = scaleMapper.selectById(scaleId);
|
SysScale sysScale = scaleMapper.selectById(scaleId);
|
||||||
|
String tenantId = sysScale.getTenantId();
|
||||||
Map<String, List<SysScaleAnswerVo>> answerMapByQuestion = scaleAnswerService.getScaleAnswerMap(scaleId);
|
Map<String, List<SysScaleAnswerVo>> answerMapByQuestion = scaleAnswerService.getScaleAnswerMap(scaleId);
|
||||||
int keySize = answerMapByQuestion.keySet().size();
|
int keySize = answerMapByQuestion.keySet().size();
|
||||||
if (ObjectUtil.isEmpty(answerList)) {
|
if (ObjectUtil.isEmpty(answerList)) {
|
||||||
|
@ -175,10 +176,10 @@ public class EvaluationServiceImpl implements IEvaluationService {
|
||||||
List<SysEvaluationConclusionVo> list;
|
List<SysEvaluationConclusionVo> list;
|
||||||
if (sysScale.getScaleName().contains("MBTI")) {
|
if (sysScale.getScaleName().contains("MBTI")) {
|
||||||
//MBTI 另外处理
|
//MBTI 另外处理
|
||||||
list = calculateMBTIResult(scaleId, answerList);
|
list = calculateMBTIResult(scaleId, tenantId, answerList);
|
||||||
} else {
|
} else {
|
||||||
//计算
|
//计算
|
||||||
list = calculateEvaluationResult(scaleId, answerList);
|
list = calculateEvaluationResult(scaleId, tenantId, answerList);
|
||||||
}
|
}
|
||||||
List<SysEvaluationConclusion> conclusionAdd = MapstructUtils.convert(list, SysEvaluationConclusion.class);
|
List<SysEvaluationConclusion> conclusionAdd = MapstructUtils.convert(list, SysEvaluationConclusion.class);
|
||||||
evaluationConclusionMapper.insertBatch(conclusionAdd);
|
evaluationConclusionMapper.insertBatch(conclusionAdd);
|
||||||
|
@ -219,7 +220,7 @@ public class EvaluationServiceImpl implements IEvaluationService {
|
||||||
} else {
|
} else {
|
||||||
Integer freeFlag = sysScale.getFreeFlag();
|
Integer freeFlag = sysScale.getFreeFlag();
|
||||||
//不是免费的
|
//不是免费的
|
||||||
if(StatusEnum.DISABLED.getValue().equals(freeFlag)) {
|
if (StatusEnum.DISABLED.getValue().equals(freeFlag)) {
|
||||||
//个人要更新订单状态
|
//个人要更新订单状态
|
||||||
SysScaleOrder scaleOrder = orderMapper.selectOne(new LambdaQueryWrapper<SysScaleOrder>().eq(SysScaleOrder::getRecordId, recordId));
|
SysScaleOrder scaleOrder = orderMapper.selectOne(new LambdaQueryWrapper<SysScaleOrder>().eq(SysScaleOrder::getRecordId, recordId));
|
||||||
SysScaleOrder order = new SysScaleOrder();
|
SysScaleOrder order = new SysScaleOrder();
|
||||||
|
@ -248,7 +249,9 @@ public class EvaluationServiceImpl implements IEvaluationService {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private List<SysEvaluationConclusionVo> calculateEvaluationResult(Long scaleId, List<SysEvaluationAnswerBo> answerList) {
|
private List<SysEvaluationConclusionVo> calculateEvaluationResult(Long scaleId, String tenantId, List<SysEvaluationAnswerBo> answerList) {
|
||||||
|
//LoginUser loginUser = getLoginUser();
|
||||||
|
//String tenantId = loginUser.getTenantId();
|
||||||
Long recordId = answerList.get(0).getRecordId();
|
Long recordId = answerList.get(0).getRecordId();
|
||||||
//暂时使用string解决redis转换问题
|
//暂时使用string解决redis转换问题
|
||||||
//key为factorId
|
//key为factorId
|
||||||
|
@ -265,6 +268,7 @@ public class EvaluationServiceImpl implements IEvaluationService {
|
||||||
|
|
||||||
SysEvaluationConclusionVo evalConclusion = new SysEvaluationConclusionVo();
|
SysEvaluationConclusionVo evalConclusion = new SysEvaluationConclusionVo();
|
||||||
evalConclusion.setFactorName(scaleFactor.getFactorName());
|
evalConclusion.setFactorName(scaleFactor.getFactorName());
|
||||||
|
evalConclusion.setTenantId(tenantId);
|
||||||
evalConclusion.setFactorId(factorId);
|
evalConclusion.setFactorId(factorId);
|
||||||
evalConclusion.setRecordId(recordId);
|
evalConclusion.setRecordId(recordId);
|
||||||
evalConclusion.setStatus(StatusEnum.DISABLED.getValue());
|
evalConclusion.setStatus(StatusEnum.DISABLED.getValue());
|
||||||
|
@ -419,7 +423,9 @@ public class EvaluationServiceImpl implements IEvaluationService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<SysEvaluationConclusionVo> calculateMBTIResult(Long scaleId, List<SysEvaluationAnswerBo> answerList) {
|
private List<SysEvaluationConclusionVo> calculateMBTIResult(Long scaleId, String tenantId, List<SysEvaluationAnswerBo> answerList) {
|
||||||
|
//LoginUser loginUser = getLoginUser();
|
||||||
|
//String tenantId = loginUser.getTenantId();
|
||||||
Long recordId = answerList.get(0).getRecordId();
|
Long recordId = answerList.get(0).getRecordId();
|
||||||
//key为questionID
|
//key为questionID
|
||||||
ConcurrentHashMap<String, Integer> charNumMap = new ConcurrentHashMap<>(8);
|
ConcurrentHashMap<String, Integer> charNumMap = new ConcurrentHashMap<>(8);
|
||||||
|
@ -460,6 +466,7 @@ public class EvaluationServiceImpl implements IEvaluationService {
|
||||||
if (Objects.equals(collect, split)) {
|
if (Objects.equals(collect, split)) {
|
||||||
SysEvaluationConclusionVo evalConclusion = new SysEvaluationConclusionVo();
|
SysEvaluationConclusionVo evalConclusion = new SysEvaluationConclusionVo();
|
||||||
evalConclusion.setFactorName(scaleFactor.getFactorName());
|
evalConclusion.setFactorName(scaleFactor.getFactorName());
|
||||||
|
evalConclusion.setTenantId(tenantId);
|
||||||
evalConclusion.setFactorId(scaleFactor.getFactorId());
|
evalConclusion.setFactorId(scaleFactor.getFactorId());
|
||||||
evalConclusion.setRecordId(recordId);
|
evalConclusion.setRecordId(recordId);
|
||||||
evalConclusion.setStatus(StatusEnum.IN_USE.getValue());
|
evalConclusion.setStatus(StatusEnum.IN_USE.getValue());
|
||||||
|
|
|
@ -334,4 +334,28 @@ public class SysDeptServiceImpl implements ISysDeptService, DeptService {
|
||||||
return baseMapper.deleteById(deptId);
|
return baseMapper.deleteById(deptId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long selectIdByName(String deptName) {
|
||||||
|
SysDept sysDept = baseMapper.selectOne(new LambdaQueryWrapper<SysDept>()
|
||||||
|
.select(SysDept::getDeptId)
|
||||||
|
.eq(SysDept::getDeptName, deptName)
|
||||||
|
.eq(SysDept::getStatus, 0));
|
||||||
|
if (ObjectUtil.isNotEmpty(sysDept)) {
|
||||||
|
return sysDept.getDeptId();
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public Long selectId4Parent(){
|
||||||
|
SysDept sysDept = baseMapper.selectOne(new LambdaQueryWrapper<SysDept>()
|
||||||
|
.select(SysDept::getDeptId)
|
||||||
|
.eq(SysDept::getParentId, 0)
|
||||||
|
.eq(SysDept::getStatus, 0));
|
||||||
|
if (ObjectUtil.isNotEmpty(sysDept)) {
|
||||||
|
return sysDept.getDeptId();
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,8 @@
|
||||||
from sys_user u
|
from sys_user u
|
||||||
left join sys_dept d on d.dept_id = u.dept_id
|
left join sys_dept d on d.dept_id = u.dept_id
|
||||||
where u.user_type = 'app_user'
|
where u.user_type = 'app_user'
|
||||||
|
and u.status = 0
|
||||||
|
and u.del_flag = 0
|
||||||
<if test="query.nickName != null and query.nickName != ''">
|
<if test="query.nickName != null and query.nickName != ''">
|
||||||
and u.nick_name like CONCAT('%', #{query.nickName}, '%')
|
and u.nick_name like CONCAT('%', #{query.nickName}, '%')
|
||||||
</if>
|
</if>
|
||||||
|
|
|
@ -80,5 +80,8 @@
|
||||||
<select id="findUserByIds" resultType="org.dromara.system.domain.SysUser">
|
<select id="findUserByIds" resultType="org.dromara.system.domain.SysUser">
|
||||||
select * from sys_user where find_in_set(user_id, #{userIds})
|
select * from sys_user where find_in_set(user_id, #{userIds})
|
||||||
</select>
|
</select>
|
||||||
|
<update id="updateOpenIdById">
|
||||||
|
update sys_user set open_id = #{openId} where user_id= #{userId}
|
||||||
|
</update>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
Loading…
Reference in New Issue