更新
This commit is contained in:
parent
b8d11f8e52
commit
999ee4d29c
@ -115,7 +115,7 @@ public class ApiAppLoginServiceImpl implements ApiAppLoginService {
|
||||
flag = this.checkRepairCanLogin(user, roleCodeList);
|
||||
} else if (SystemEnum.INSPECTION.getCode().equals(loginBody.getSysCode())) {
|
||||
//检测业务系统
|
||||
|
||||
flag = true;
|
||||
} else if (SystemEnum.SCHOOL.getCode().equals(loginBody.getSysCode())) {
|
||||
//驾校业务系统
|
||||
flag = this.checkSchoolCanLogin(user, roleCodeList,loginBody.getTypes());
|
||||
|
@ -1,5 +1,7 @@
|
||||
package cn.iocoder.yudao.module.constant;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* @Description: 检测常量信息
|
||||
* @Author: 86187
|
||||
@ -90,4 +92,13 @@ public class InspectionConstants {
|
||||
*/
|
||||
public static final String INSPECTION_NOTICE_TEMPLATE_BUSINESS_MANAGER_MEET_CAR_ORDER_CREATE = "%s的工单已创建,详细信息请前往列表查看";
|
||||
|
||||
/**
|
||||
* 检测站内信模板-提示业务经理 接车订单以完成
|
||||
*/
|
||||
public static final String INSPECTION_NOTICE_TEMPLATE_BUSINESS_MANAGER_MEET_CAR_ORDER_COMPLETE = "%s的工单已完成,详细信息请前往列表查看";
|
||||
|
||||
/**
|
||||
* 检测站内信模板-提示业务经理 接车订单不合格
|
||||
*/
|
||||
public static final String INSPECTION_NOTICE_TEMPLATE_BUSINESS_MANAGER_MEET_CAR_ORDER_UNQUALIFIED = "%s的工单不合格,详细信息请前往列表查看";
|
||||
}
|
||||
|
@ -44,6 +44,7 @@ public class AppGoodsController extends BaseController {
|
||||
* 商品列表查询
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
@TenantIgnore
|
||||
public CommonResult goodsList(GoodsQuery goodsQuery)
|
||||
{
|
||||
List<GoodsVo> list = appInspectionGoodsService.goodsList(goodsQuery);
|
||||
|
@ -9,8 +9,10 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.PhoneUtil;
|
||||
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
import cn.iocoder.yudao.module.core.controller.BaseController;
|
||||
import cn.iocoder.yudao.module.inspection.entity.InspectionStaff;
|
||||
import cn.iocoder.yudao.module.inspection.enums.DriverLicenseType;
|
||||
import cn.iocoder.yudao.module.inspection.query.InspectionListQuery;
|
||||
import cn.iocoder.yudao.module.inspection.query.InspectionStaffQuery;
|
||||
@ -20,8 +22,11 @@ import cn.iocoder.yudao.module.inspection.vo.InspectionStaffSaveVo;
|
||||
import cn.iocoder.yudao.module.inspection.vo.StaffImportExcelVO;
|
||||
import cn.iocoder.yudao.module.system.api.dict.DictDataApi;
|
||||
import cn.iocoder.yudao.module.system.api.dict.dto.DictDataRespDTO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserPageReqVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.permission.RoleDO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
|
||||
import cn.iocoder.yudao.module.system.service.permission.RoleService;
|
||||
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -30,8 +35,10 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
|
||||
import static cn.iocoder.yudao.framework.excel.core.util.ExcelUtils.exportBlankTemplate;
|
||||
@ -52,6 +59,9 @@ public class InspectionStaffController extends BaseController {
|
||||
@Resource
|
||||
private RoleService roleService;
|
||||
|
||||
@Resource
|
||||
private AdminUserService userService;
|
||||
|
||||
/**
|
||||
* 获取检测员工列表
|
||||
*
|
||||
@ -67,6 +77,17 @@ public class InspectionStaffController extends BaseController {
|
||||
return success(list);
|
||||
}
|
||||
|
||||
@GetMapping("/listSelectUser")
|
||||
public CommonResult<?> listSelectUser(@Valid UserPageReqVO pageReqVO){
|
||||
// 查询目前所有的userId
|
||||
List<InspectionStaff> list = inspectionStaffService.list();
|
||||
List<Long> ids = list.stream().map(InspectionStaff::getUserId).collect(Collectors.toList());
|
||||
pageReqVO.setUserIds(ids);
|
||||
// 获得用户分页列表
|
||||
PageResult<AdminUserDO> pageResult = userService.getUserPage(pageReqVO);
|
||||
return success(new PageResult<>(pageResult.getList(), pageResult.getTotal()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取检测员工详情
|
||||
*
|
||||
|
@ -34,6 +34,13 @@ public class InspectionBusinessChannelController {
|
||||
*/
|
||||
@PostMapping("/add")
|
||||
public boolean addChannel(@RequestBody InspectionBusinessChannel channel) {
|
||||
if (ObjectUtil.isNotEmpty(channel.getUserIdList())) {
|
||||
String userIds = channel.getUserIdList().stream()
|
||||
.map(String::valueOf)
|
||||
.collect(Collectors.joining(","));
|
||||
channel.setUserIds(userIds);
|
||||
|
||||
}
|
||||
return inspectionBusinessChannelService.save(channel);
|
||||
}
|
||||
|
||||
|
@ -212,4 +212,6 @@ public class InspectionInfo extends TenantBaseDO
|
||||
private Integer meetType;
|
||||
@TableField(exist = false)
|
||||
private String content;
|
||||
@TableField(exist = false)
|
||||
private Long inspectionInfoId;
|
||||
}
|
||||
|
@ -106,9 +106,12 @@ public class InspectionStaffServiceImpl extends ServiceImpl<InspectionStaffMappe
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean edit(InspectionStaffSaveVo inspectionStaffVo) {
|
||||
//获取tenantIDd
|
||||
Long tenantId = SecurityFrameworkUtils.getLoginUser().getTenantId();
|
||||
//更新system_users主表
|
||||
UserSaveReqVO userDTO = BeanUtil.copyProperties(inspectionStaffVo, UserSaveReqVO.class);
|
||||
userDTO.setId(inspectionStaffVo.getUserId());
|
||||
userDTO.setTenantId(tenantId);
|
||||
userService.updateUser(userDTO);
|
||||
|
||||
|
||||
@ -191,48 +194,50 @@ public class InspectionStaffServiceImpl extends ServiceImpl<InspectionStaffMappe
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Long saveInspectionStaff(InspectionStaffSaveVo inspectionStaffVo) {
|
||||
//新增system_users主表
|
||||
// 判断账号是否存在
|
||||
AdminUserDO one = userService.getOne(Wrappers.<AdminUserDO>lambdaQuery().eq(AdminUserDO::getUsername, inspectionStaffVo.getUsername()).last("LIMIT 1"));
|
||||
Long userId = null;
|
||||
if (one == null) {
|
||||
UserSaveReqVO userDTO = BeanUtil.copyProperties(inspectionStaffVo, UserSaveReqVO.class);
|
||||
userDTO.setId(inspectionStaffVo.getUserId());
|
||||
//获取当前人的租户id
|
||||
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||
userDTO.setTenantId(loginUser.getTenantId());
|
||||
userId = userService.createUser(userDTO);
|
||||
} else {
|
||||
userId = one.getId();
|
||||
}
|
||||
//获取当前人的租户id
|
||||
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||
if (CollUtil.isEmpty(inspectionStaffVo.getAdminUsers())) {
|
||||
//新增system_users主表
|
||||
// 判断账号是否存在
|
||||
AdminUserDO one = userService.getOne(Wrappers.<AdminUserDO>lambdaQuery().eq(AdminUserDO::getUsername, inspectionStaffVo.getUsername()).eq(AdminUserDO::getTenantId, loginUser.getTenantId()).last("LIMIT 1"));
|
||||
Long userId = null;
|
||||
if (one == null) {
|
||||
UserSaveReqVO userDTO = BeanUtil.copyProperties(inspectionStaffVo, UserSaveReqVO.class);
|
||||
userDTO.setId(inspectionStaffVo.getUserId());
|
||||
|
||||
// //查询检测基础员工角色
|
||||
// List<RoleDO> role = roleService.getRoleListByCodesTenant(Collections.singletonList(InspectionConstants.INSPECTION_BASE_STAFF_ROLE));
|
||||
//
|
||||
// if (ObjectUtil.isNull(role)) {
|
||||
// throw new RuntimeException("检测基础员工角色不存在");
|
||||
// }
|
||||
//
|
||||
// Set<Long> roleIds = role.stream().map(RoleDO::getId).collect(Collectors.toSet());
|
||||
// //设置角色为检测基础员工
|
||||
// permissionService.assignUserRole(userId, roleIds);
|
||||
|
||||
// 查询子表中是否存在
|
||||
InspectionStaff staff = this.getOne(Wrappers.<InspectionStaff>lambdaQuery().eq(InspectionStaff::getUserId, userId));
|
||||
if (ObjectUtil.isNull(staff)) {
|
||||
|
||||
InspectionStaff inspectionStaff = BeanUtil.copyProperties(inspectionStaffVo, InspectionStaff.class);
|
||||
inspectionStaff.setUserId(userId);
|
||||
//新增检测员工子表
|
||||
this.save(inspectionStaff);
|
||||
if (ObjectUtil.isNotEmpty(inspectionStaffVo.getFileList())) {
|
||||
addFile(inspectionStaffVo.getFileList(), inspectionStaffVo.getNickname(), null, inspectionStaff.getUserId());
|
||||
userDTO.setTenantId(loginUser.getTenantId());
|
||||
userId = userService.createUser(userDTO);
|
||||
} else {
|
||||
userId = one.getId();
|
||||
}
|
||||
return inspectionStaff.getUserId();
|
||||
}else {
|
||||
throw new RuntimeException("该员工已存在");
|
||||
}
|
||||
|
||||
// 查询子表中是否存在
|
||||
InspectionStaff staff = this.getOne(Wrappers.<InspectionStaff>lambdaQuery().eq(InspectionStaff::getUserId, userId));
|
||||
if (ObjectUtil.isNull(staff)) {
|
||||
|
||||
InspectionStaff inspectionStaff = BeanUtil.copyProperties(inspectionStaffVo, InspectionStaff.class);
|
||||
inspectionStaff.setUserId(userId);
|
||||
//新增检测员工子表
|
||||
this.save(inspectionStaff);
|
||||
if (ObjectUtil.isNotEmpty(inspectionStaffVo.getFileList())) {
|
||||
addFile(inspectionStaffVo.getFileList(), inspectionStaffVo.getNickname(), null, inspectionStaff.getUserId());
|
||||
}
|
||||
return inspectionStaff.getUserId();
|
||||
}else {
|
||||
throw new RuntimeException("该员工已存在");
|
||||
}
|
||||
}else {
|
||||
// 循环adminusers 查询子表中是否存在如果存在不添加
|
||||
for (AdminUserDO adminUser : inspectionStaffVo.getAdminUsers()) {
|
||||
InspectionStaff staff = this.getOne(Wrappers.<InspectionStaff>lambdaQuery().eq(InspectionStaff::getUserId, adminUser.getId()));
|
||||
if (ObjectUtil.isNull(staff)) {
|
||||
InspectionStaff inspectionStaff = BeanUtil.copyProperties(inspectionStaffVo, InspectionStaff.class);
|
||||
inspectionStaff.setUserId(adminUser.getId());
|
||||
this.save(inspectionStaff);
|
||||
}
|
||||
}
|
||||
}
|
||||
return inspectionStaffVo.getUserId();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3,18 +3,14 @@ package cn.iocoder.yudao.module.inspection.service.impl;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.iocoder.yudao.common.service.InspectionNoticeService;
|
||||
import cn.iocoder.yudao.framework.security.core.LoginUser;
|
||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import cn.iocoder.yudao.module.appBase.controller.admin.InspectionSocket;
|
||||
import cn.iocoder.yudao.module.inspection.entity.DlInspectionProject;
|
||||
import cn.iocoder.yudao.module.inspection.entity.InspectionInfo;
|
||||
import cn.iocoder.yudao.module.inspection.entity.InspectionStepInfo;
|
||||
import cn.iocoder.yudao.module.inspection.entity.InspectionWorkNode;
|
||||
import cn.iocoder.yudao.module.constant.InspectionConstants;
|
||||
import cn.iocoder.yudao.module.inspection.entity.*;
|
||||
import cn.iocoder.yudao.module.inspection.mapper.InspectionWorkNodeMapper;
|
||||
import cn.iocoder.yudao.module.inspection.service.DlInspectionProjectService;
|
||||
import cn.iocoder.yudao.module.inspection.service.IInspectionInfoService;
|
||||
import cn.iocoder.yudao.module.inspection.service.IInspectionWorkNodeService;
|
||||
import cn.iocoder.yudao.module.inspection.service.InspectionStepInfoService;
|
||||
import cn.iocoder.yudao.module.inspection.service.*;
|
||||
import cn.iocoder.yudao.module.inspection.vo.StaffProjectCountVO;
|
||||
import cn.iocoder.yudao.module.system.api.user.dto.UserDTO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
|
||||
@ -56,6 +52,10 @@ public class InspectionWorkNodeServiceImpl extends ServiceImpl<InspectionWorkNod
|
||||
private InspectionSocket inspectionSocket;
|
||||
@Autowired
|
||||
private RoleService roleService;
|
||||
@Autowired
|
||||
private InspectionMeetCarOrderService inspectionMeetCarOrderService;
|
||||
@Autowired
|
||||
private InspectionNoticeService noticeService;
|
||||
|
||||
/**
|
||||
* 员工接单
|
||||
@ -214,7 +214,7 @@ public class InspectionWorkNodeServiceImpl extends ServiceImpl<InspectionWorkNod
|
||||
List<InspectionWorkNode> inspectionWorkNodes = this.list(queryWrapper);
|
||||
boolean flag = true;
|
||||
//判断是否是最后一个流程
|
||||
if (inspectionWorkNodes.size() == 1 && inspectionWorkNodes.get(0).getId().equals(workNode.getId())) {
|
||||
if (inspectionWorkNodes.size() == 1 && inspectionWorkNodes.get(0).getId().equals(workNode.getId()) && "1".equals(inspectionWorkNode.getType())) {
|
||||
flag = false;
|
||||
}
|
||||
|
||||
@ -278,6 +278,16 @@ public class InspectionWorkNodeServiceImpl extends ServiceImpl<InspectionWorkNod
|
||||
stepInfo.setCreateTime(DateUtil.date());
|
||||
stepInfo.setCreator(Integer.parseInt(String.valueOf(loginUser.getId())));
|
||||
inspectionStepService.save(stepInfo);
|
||||
|
||||
// 如果是业务经理需要发送提示
|
||||
// 查询接车订单表中的工单
|
||||
InspectionMeetCarOrder inspectionMeetCarOrder = inspectionMeetCarOrderService.getOne(new LambdaQueryWrapper<InspectionMeetCarOrder>()
|
||||
.eq(InspectionMeetCarOrder::getInspectionInfoId, workNode.getInspectionInfoId()).last("limit 1").orderByAsc(InspectionMeetCarOrder::getCreateTime));
|
||||
if (ObjectUtil.isNotEmpty(inspectionMeetCarOrder) && inspectionMeetCarOrder.getMeetType() == 2) {
|
||||
// 发送订单返程的站内信
|
||||
String msg = String.format(InspectionConstants.INSPECTION_NOTICE_TEMPLATE_BUSINESS_MANAGER_MEET_CAR_ORDER_COMPLETE, inspectionMeetCarOrder.getBuyName() == null ? inspectionMeetCarOrder.getBuyPhone() : inspectionMeetCarOrder.getBuyName());
|
||||
noticeService.sentMessage(inspectionMeetCarOrder.getMeetManId(), msg);
|
||||
}
|
||||
}
|
||||
// else {
|
||||
// //修改工单表当前流程
|
||||
@ -458,6 +468,7 @@ public class InspectionWorkNodeServiceImpl extends ServiceImpl<InspectionWorkNod
|
||||
|
||||
// 添加项目
|
||||
List<Map<String, Object>> children = (List<Map<String, Object>>) userEntry.get("children");
|
||||
vo.setCount(vo.getCount() == null ? 0 : vo.getCount());
|
||||
if (vo.getCount() == 0) {
|
||||
continue;
|
||||
}
|
||||
@ -579,6 +590,16 @@ public class InspectionWorkNodeServiceImpl extends ServiceImpl<InspectionWorkNod
|
||||
stepInfo.setCreator(Integer.parseInt(loginUser.getId().toString()));
|
||||
inspectionStepService.save(stepInfo);
|
||||
|
||||
// 如果是业务经理需要发送提示
|
||||
// 查询接车订单表中的工单
|
||||
InspectionMeetCarOrder inspectionMeetCarOrder = inspectionMeetCarOrderService.getOne(new LambdaQueryWrapper<InspectionMeetCarOrder>()
|
||||
.eq(InspectionMeetCarOrder::getInspectionInfoId, inspectionWorkNode.getInspectionInfoId()).last("limit 1").orderByAsc(InspectionMeetCarOrder::getCreateTime));
|
||||
if (ObjectUtil.isNotEmpty(inspectionMeetCarOrder) && inspectionMeetCarOrder.getMeetType() == 2) {
|
||||
// 发送订单返程的站内信
|
||||
String msg = String.format(InspectionConstants.INSPECTION_NOTICE_TEMPLATE_BUSINESS_MANAGER_MEET_CAR_ORDER_UNQUALIFIED, inspectionMeetCarOrder.getBuyName() == null ? inspectionMeetCarOrder.getBuyName() : inspectionMeetCarOrder.getBuyPhone());
|
||||
noticeService.sentMessage(inspectionMeetCarOrder.getMeetManId(), msg);
|
||||
}
|
||||
|
||||
//将流程节点改为已完成
|
||||
// InspectionWorkNode byId = this.getById(inspectionWorkNode.getId());
|
||||
// byId.setStatus("2");
|
||||
|
@ -5,6 +5,7 @@ import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileDO;
|
||||
import cn.iocoder.yudao.module.inspection.entity.InspectionStaff;
|
||||
import cn.iocoder.yudao.module.system.api.user.dto.UserRoleDTO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.permission.RoleDO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
|
||||
import com.alibaba.excel.annotation.ExcelIgnore;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
@ -116,4 +117,6 @@ public class InspectionStaffSaveVo extends InspectionStaff {
|
||||
* 角色集合
|
||||
*/
|
||||
private List<UserRoleDTO> userRoles;
|
||||
|
||||
private List<AdminUserDO> adminUsers;
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.payment.controller;
|
||||
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
|
||||
import cn.iocoder.yudao.module.core.controller.BaseController;
|
||||
import cn.iocoder.yudao.module.core.page.PageDomain;
|
||||
import cn.iocoder.yudao.module.core.page.TableSupport;
|
||||
@ -159,7 +160,9 @@ public class OrderController extends BaseController {
|
||||
*/
|
||||
|
||||
@GetMapping("/getCommentOrderList")
|
||||
public CommonResult getCommentOrderList(Long partnerId,
|
||||
@TenantIgnore
|
||||
public CommonResult getCommentOrderList(
|
||||
@RequestParam(value = "tenantId" ,required = false ,defaultValue = "1") Long tenantId,
|
||||
@RequestParam(value = "pageNum" ,required = false ,defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(value ="pageSize" ,required = false ,defaultValue = "10") Integer pageSize) {
|
||||
//判断商家是否开启评论区
|
||||
@ -168,7 +171,7 @@ public class OrderController extends BaseController {
|
||||
// return success(new ArrayList<>());
|
||||
// }
|
||||
Page<commentVo> page = new Page<>(pageNum, pageSize);
|
||||
IPage<commentVo> commentOrderList = orderInfoService.getCommentOrderList(page,partnerId);
|
||||
IPage<commentVo> commentOrderList = orderInfoService.getCommentOrderList(page,tenantId);
|
||||
return success(commentOrderList);
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@ public interface OrderInfoMapper extends BaseMapper<OrderInfo> {
|
||||
|
||||
Integer getNoCommentOrder(@Param("userId") Long userId);
|
||||
|
||||
IPage<commentVo> getCommentOrderList(Page<commentVo> page, @Param("partnerId") Long partnerId);
|
||||
IPage<commentVo> getCommentOrderList(Page<commentVo> page, @Param("tenantId") Long tenantId);
|
||||
|
||||
IPage<OrderInfo> orderListPc(Page<OrderInfo> page,@Param("vo") OrderInfo orderInfo);
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ public interface OrderInfoService extends IService<OrderInfo> {
|
||||
|
||||
Integer getNoCommentOrder();
|
||||
|
||||
IPage<commentVo> getCommentOrderList(Page<commentVo> page,Long partnerId);
|
||||
IPage<commentVo> getCommentOrderList(Page<commentVo> page,Long tenantId);
|
||||
|
||||
IPage<OrderInfo> orderListPc(Page<OrderInfo> page,OrderInfo orderInfo);
|
||||
|
||||
|
@ -855,8 +855,8 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<commentVo> getCommentOrderList(Page<commentVo> page, Long partnerId) {
|
||||
return baseMapper.getCommentOrderList(page, partnerId);
|
||||
public IPage<commentVo> getCommentOrderList(Page<commentVo> page, Long tenantId) {
|
||||
return baseMapper.getCommentOrderList(page, tenantId);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -252,21 +252,22 @@
|
||||
FROM
|
||||
inspection_staff staff
|
||||
LEFT JOIN inspection_work_node iwn ON iwn.deal_user_id = staff.user_id
|
||||
<if test="datetimeRange != null">
|
||||
AND iwn.create_time BETWEEN concat(#{datetimeRange[0]}, ' 00:00:00') AND concat(#{datetimeRange[1]}, ' 23:59:59')
|
||||
</if>
|
||||
LEFT JOIN inspection_project ip ON ip.id = iwn.project_id
|
||||
LEFT JOIN (
|
||||
SELECT DISTINCT sur.user_id
|
||||
FROM system_user_role sur
|
||||
JOIN system_role sr ON sur.role_id = sr.id
|
||||
WHERE sr.service_package_id = 'jiance'
|
||||
AND sr.CODE NOT IN ('jcyh', 'jcywjl')
|
||||
) valid_roles ON staff.user_id = valid_roles.user_id
|
||||
-- LEFT JOIN (
|
||||
-- SELECT DISTINCT sur.user_id
|
||||
-- FROM system_user_role sur
|
||||
-- JOIN system_role sr ON sur.role_id = sr.id
|
||||
-- WHERE sr.service_package_id = 'jiance'
|
||||
-- AND sr.CODE NOT IN ('jcyh', 'jcywjl')
|
||||
-- ) valid_roles ON staff.user_id = valid_roles.user_id
|
||||
LEFT JOIN system_users su ON su.id = staff.user_id
|
||||
<where>
|
||||
staff.deleted = 0
|
||||
AND (valid_roles.user_id IS NOT NULL) -- 只保留有合格角色的用户
|
||||
<if test="datetimeRange != null">
|
||||
AND iwn.create_time BETWEEN #{datetimeRange[0]} AND #{datetimeRange[1]}
|
||||
</if>
|
||||
-- AND (valid_roles.user_id IS NOT NULL) -- 只保留有合格角色的用户
|
||||
|
||||
</where>
|
||||
GROUP BY staff.user_id ,ip.id
|
||||
|
||||
@ -338,6 +339,7 @@
|
||||
ii.worker_name AS workerName,
|
||||
ii.worker_phone AS workerPhone,
|
||||
ii.worker_avatar AS workerAvatar,
|
||||
oi.sku_name AS skuName,
|
||||
CASE
|
||||
WHEN ii.is_pass = '0' THEN '不通过'
|
||||
WHEN ii.is_pass = '1' THEN '通过'
|
||||
@ -348,6 +350,7 @@
|
||||
FROM inspection_work_node iwn
|
||||
LEFT JOIN inspection_info ii ON iwn.inspection_info_id = ii.id
|
||||
LEFT JOIN inspection_project ip ON ip.id = iwn.project_id
|
||||
LEFT JOIN order_info oi ON oi.id = ii.inspection_order_id
|
||||
<where>
|
||||
<if test="query.userId != null">
|
||||
AND iwn.deal_user_id = #{query.userId}
|
||||
|
@ -20,7 +20,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
shop_inspection_category category
|
||||
INNER JOIN shop_inspection_goods goods ON category.id = goods.goods_category_id and goods.is_listing='1'
|
||||
INNER JOIN inspection_goods_sku sku ON goods.id = sku.goods_id
|
||||
where goods.partner_id = #{partnerId}
|
||||
where goods.tenant_id = #{tenantId}
|
||||
group by goods.id
|
||||
ORDER BY category.order_num
|
||||
</select>
|
||||
|
@ -618,39 +618,44 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</if>
|
||||
</if>
|
||||
</select>
|
||||
<select id="geStelectInspectionByBusiness"
|
||||
resultType="cn.iocoder.yudao.module.inspection.entity.InspectionInfo">
|
||||
SELECT imco.meet_man_id,imco.buy_name,imco.buy_phone, imco.car_num,imco.other_phone
|
||||
<select id="geStelectInspectionByBusiness" resultType="cn.iocoder.yudao.module.inspection.entity.InspectionInfo">
|
||||
SELECT
|
||||
imco.meet_man_id,
|
||||
imco.buy_name,
|
||||
imco.buy_phone,
|
||||
imco.car_num,
|
||||
imco.other_phone,
|
||||
imco.inspection_info_id AS inspectionInfoId
|
||||
<if test="info.status != 1">
|
||||
,ii.id AS id,imco.id AS meetCarId,oi.sku_name AS skuName,oi.goods_title,ii.*
|
||||
,ii.id AS id,
|
||||
imco.id AS meetCarId,
|
||||
oi.sku_name AS skuName,
|
||||
oi.goods_title,
|
||||
ii.*
|
||||
</if>
|
||||
<if test="info.status == 1">
|
||||
,imco.id AS id
|
||||
</if>
|
||||
FROM inspection_meet_car_order imco
|
||||
JOIN inspection_business_channel ibc
|
||||
ON imco.customer_source_id = ibc.id
|
||||
<if test="info.status != 1">
|
||||
INNER JOIN inspection_info ii ON imco.inspection_info_id = ii.id AND ii.deleted = 0
|
||||
LEFT JOIN order_info oi ON ii.inspection_order_id = oi.id AND oi.deleted = 0
|
||||
INNER JOIN inspection_info ii
|
||||
ON imco.inspection_info_id = ii.id AND ii.deleted = 0
|
||||
LEFT JOIN order_info oi
|
||||
ON ii.inspection_order_id = oi.id AND oi.deleted = 0
|
||||
</if>
|
||||
WHERE imco.deleted = 0
|
||||
<if test="info.userId != null and info.userId != ''">
|
||||
AND imco.meet_man_id = #{info.userId}
|
||||
</if>
|
||||
<if test="info.carNum != null and info.carNum != ''">
|
||||
AND imco.car_num LIKE CONCAT('%', #{info.carNum}, '%')
|
||||
</if>
|
||||
<if test="info.status != null and info.status == 2">
|
||||
AND ii.status = '0'
|
||||
</if>
|
||||
<if test="info.status != null and info.status == 3">
|
||||
AND ii.status = '1'
|
||||
</if>
|
||||
<where>
|
||||
ibc.deleted = 0
|
||||
AND imco.deleted = 0
|
||||
<if test="info.userId != null and info.userId != ''">
|
||||
AND FIND_IN_SET(#{info.userId}, ibc.user_ids)
|
||||
AND imco.creator = #{info.userId}
|
||||
</if>
|
||||
<if test="info.carNum != null and info.carNum != ''">
|
||||
AND imco.car_num LIKE CONCAT('%', #{info.carNum}, '%')
|
||||
</if>
|
||||
<if test="info.status == 2">
|
||||
AND ii.status = '0'
|
||||
</if>
|
||||
<if test="info.status == 3">
|
||||
AND ii.status = '1'
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="selectMeetCarList" resultType="cn.iocoder.yudao.module.inspection.entity.InspectionInfo">
|
||||
SELECT ii.*, imco.meet_type
|
||||
|
@ -30,7 +30,7 @@
|
||||
FROM inspection_staff iss
|
||||
Inner join system_users su on iss.user_id = su.id
|
||||
<where>
|
||||
su.deleted = 0
|
||||
su.deleted = 0 AND iss.deleted = 0
|
||||
<if test="query.nickname != null and query.nickname != ''">
|
||||
and su.nickname like concat('%', #{query.nickname}, '%')
|
||||
</if>
|
||||
|
@ -236,6 +236,9 @@
|
||||
order_info oi
|
||||
LEFT JOIN inspection_info info ON oi.id = info.inspection_order_id
|
||||
where comment_star is not null
|
||||
<if test="tenantId!=null">
|
||||
and info.tenant_id = #{tenantId}
|
||||
</if>
|
||||
ORDER BY comment_time desc
|
||||
</select>
|
||||
<select id="pageOrderListSystem" resultType="cn.iocoder.yudao.module.payment.entity.OrderInfo">
|
||||
|
@ -132,4 +132,10 @@ public class LambdaQueryWrapperX<T> extends LambdaQueryWrapper<T> {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LambdaQueryWrapperX<T> notIn(boolean condition, SFunction<T, ?> column, Collection<?> coll) {
|
||||
super.notIn(condition, column, coll);
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ import org.hibernate.validator.constraints.Length;
|
||||
|
||||
import javax.validation.constraints.AssertTrue;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Pattern;
|
||||
|
||||
@Schema(description = "管理后台 - 账号密码登录 Request VO,如果登录并绑定社交用户,需要传递 social 开头的参数")
|
||||
@ -32,6 +33,10 @@ public class AuthLoginReqVO {
|
||||
@Length(min = 4, max = 16, message = "密码长度为 4-16 位")
|
||||
private String password;
|
||||
|
||||
@Schema(description = "租户编号", example = "1024")
|
||||
@NotNull(message = "租户编号不能为空")
|
||||
private Long tenantId;
|
||||
|
||||
// ========== 图片验证码相关 ==========
|
||||
|
||||
@Schema(description = "验证码,验证码开启时,需要传递", requiredMode = Schema.RequiredMode.REQUIRED,
|
||||
|
@ -28,4 +28,7 @@ public class UserProfileUpdateReqVO {
|
||||
@Schema(description = "用户性别,参见 SexEnum 枚举类", example = "1")
|
||||
private Integer sex;
|
||||
|
||||
@Schema(description = "租户编号", example = "1024")
|
||||
private Long tenantId;
|
||||
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ import lombok.NoArgsConstructor;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@ -35,4 +36,13 @@ public class UserPageReqVO extends PageParam {
|
||||
@Schema(description = "部门编号,同时筛选子部门", example = "1024")
|
||||
private Long deptId;
|
||||
|
||||
@Schema(description = "租户编号", example = "1024")
|
||||
private Long tenantId;
|
||||
|
||||
/**
|
||||
* 排除用的户编号
|
||||
*/
|
||||
@Schema(description = "用户编号列表", example = "1024")
|
||||
private List<Long> userIds;
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
package cn.iocoder.yudao.module.system.dal.mysql.user;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
@ -11,6 +13,7 @@ import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserPageReqV
|
||||
import cn.iocoder.yudao.module.system.controller.app.user.UserInfoVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
@ -25,30 +28,37 @@ public interface AdminUserMapper extends BaseMapperX<AdminUserDO> {
|
||||
default AdminUserDO selectByUsername(String username) {
|
||||
return selectOne(AdminUserDO::getUsername, username);
|
||||
}
|
||||
default AdminUserDO selectByUsername(String username,Long tenantId) {
|
||||
return selectList(new LambdaQueryWrapperX<AdminUserDO>().eq(AdminUserDO::getUsername, username).eq(TenantBaseDO::getTenantId,tenantId)).get(0);
|
||||
|
||||
default AdminUserDO selectByUsername(String username, Long tenantId) {
|
||||
return selectOne(new LambdaQueryWrapperX<AdminUserDO>().eq(AdminUserDO::getUsername, username).eq(TenantBaseDO::getTenantId, tenantId).last("limit 1"));
|
||||
}
|
||||
|
||||
default AdminUserDO selectByEmail(String email) {
|
||||
return selectOne(AdminUserDO::getEmail, email);
|
||||
}
|
||||
|
||||
default AdminUserDO selectByEmail(String email, Long tenantId) {
|
||||
return selectOne(Wrappers.<AdminUserDO>lambdaQuery().eq(AdminUserDO::getEmail, email).eq(TenantBaseDO::getTenantId, tenantId).last("limit 1"));
|
||||
}
|
||||
|
||||
default AdminUserDO selectByMobile(String mobile) {
|
||||
Long tenantId=null;
|
||||
Long tenantId = null;
|
||||
try {
|
||||
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||
tenantId = loginUser.getTenantId();
|
||||
|
||||
}catch (Exception e){
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
return getUserByMobileWithoutTenant(mobile,tenantId);
|
||||
return getUserByMobileWithoutTenant(mobile, tenantId);
|
||||
}
|
||||
|
||||
default PageResult<AdminUserDO> selectPage(UserPageReqVO reqVO, Collection<Long> deptIds) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<AdminUserDO>()
|
||||
// .likeIfPresent(AdminUserDO::getUsername, reqVO.getUsername())
|
||||
.likeIfPresent(AdminUserDO::getMobile, reqVO.getMobile())
|
||||
.eq(ObjectUtil.isNotEmpty(reqVO.getTenantId()), AdminUserDO::getTenantId, reqVO.getTenantId())
|
||||
.notIn(CollUtil.isNotEmpty(reqVO.getUserIds()), AdminUserDO::getId, reqVO.getUserIds())
|
||||
// 这里加了个模糊查询,用户名称搜索时可以模糊查用户昵称
|
||||
.likeIfPresent(AdminUserDO::getNickname, reqVO.getUsername())
|
||||
.eqIfPresent(AdminUserDO::getStatus, reqVO.getStatus())
|
||||
@ -68,9 +78,10 @@ public interface AdminUserMapper extends BaseMapperX<AdminUserDO> {
|
||||
default List<AdminUserDO> selectListByDeptIds(Collection<Long> deptIds) {
|
||||
return selectList(AdminUserDO::getDeptId, deptIds);
|
||||
}
|
||||
|
||||
List<AdminUserDO> getUsersByRoleRescue(@Param("roleCode") String roleCode, @Param("searchValue") String searchValue, @Param("deptIds") List<String> deptIds);
|
||||
|
||||
IPage<AdminUserDO> getUsersByRoleRescueTwo(Page<AdminUserDO> page,@Param("roleCode") String roleCode, @Param("searchValue") String searchValue, @Param("deptIds") List<String> deptIds);
|
||||
IPage<AdminUserDO> getUsersByRoleRescueTwo(Page<AdminUserDO> page, @Param("roleCode") String roleCode, @Param("searchValue") String searchValue, @Param("deptIds") List<String> deptIds);
|
||||
|
||||
|
||||
Integer getStudentNumberByUserId(Long jlId);
|
||||
@ -79,9 +90,9 @@ public interface AdminUserMapper extends BaseMapperX<AdminUserDO> {
|
||||
|
||||
AdminUserDO selectUserByPhone(String phone);
|
||||
|
||||
AdminUserDO getUserByMobileWithoutTenant(@Param("phoneNumber") String phoneNumber,@Param("tenantId") Long tenantId);
|
||||
AdminUserDO getUserByMobileWithoutTenant(@Param("phoneNumber") String phoneNumber, @Param("tenantId") Long tenantId);
|
||||
|
||||
int updateSetOpenId(@Param("userId")Long userId,@Param("openId")String openId);
|
||||
int updateSetOpenId(@Param("userId") Long userId, @Param("openId") String openId);
|
||||
|
||||
int updateCusInfo(@Param("entity") UserInfoVO userInfoVO);
|
||||
|
||||
@ -91,6 +102,7 @@ public interface AdminUserMapper extends BaseMapperX<AdminUserDO> {
|
||||
|
||||
/**
|
||||
* 根据用户名,查询用户信息(排除租户id)
|
||||
*
|
||||
* @param reqVO
|
||||
* @return
|
||||
*/
|
||||
|
@ -133,7 +133,7 @@ public class AdminAuthServiceImpl implements AdminAuthService {
|
||||
validateCaptcha(reqVO);
|
||||
|
||||
// 使用账号密码,进行登录
|
||||
AdminUserDO user = authenticate(reqVO.getUsername(), reqVO.getPassword());
|
||||
AdminUserDO user = authenticateApp(reqVO.getUsername(), reqVO.getPassword(), reqVO.getTenantId());
|
||||
|
||||
// 如果 socialType 非空,说明需要绑定社交用户
|
||||
if (reqVO.getSocialType() != null) {
|
||||
|
@ -123,15 +123,13 @@ public class TenantServiceImpl extends ServiceImpl<TenantMapper, TenantDO> imple
|
||||
// 校验套餐被禁用
|
||||
Set<String> packageSet = createReqVO.getPackageId();
|
||||
Set<Long> menuIds = new HashSet<>();
|
||||
for (String packageId:packageSet){
|
||||
for (String packageId : packageSet) {
|
||||
ServicePackageDO servicePackageDO = servicePackageService.validServicePackage(packageId);
|
||||
menuIds.addAll(servicePackageDO.getMenuIds());
|
||||
}
|
||||
// 创建租户
|
||||
TenantDO tenant = BeanUtils.toBean(createReqVO, TenantDO.class);
|
||||
tenantMapper.insert(tenant);
|
||||
// 设置本次请求的租户id
|
||||
TenantUtils.execute(tenant.getId(), () -> {});
|
||||
// 创建租户的管理员
|
||||
TenantUtils.execute(tenant.getId(), () -> {
|
||||
// 创建角色
|
||||
@ -141,26 +139,51 @@ public class TenantServiceImpl extends ServiceImpl<TenantMapper, TenantDO> imple
|
||||
// 修改租户的管理员
|
||||
tenantMapper.updateById(new TenantDO().setId(tenant.getId()).setContactUserId(userId));
|
||||
//创建租户顶级部门
|
||||
Long deptId = createDept(userId,createReqVO.getName(),createReqVO.getContactMobile(),null,"0");
|
||||
Long deptId = createDept(userId, createReqVO.getName(), createReqVO.getContactMobile(), null, "0");
|
||||
//创建三个客户部门:私人客户、代办客户、政企客户
|
||||
createDept(null,PRIVATE_CUS.getName(),null,deptId,"0,"+deptId);
|
||||
createDept(null,AGENT_CUS.getName(),null,deptId,"0,"+deptId);
|
||||
createDept(null,GOV_CUS.getName(),null,deptId,"0,"+deptId);
|
||||
createDept(null, PRIVATE_CUS.getName(), null, deptId, "0," + deptId);
|
||||
createDept(null, AGENT_CUS.getName(), null, deptId, "0," + deptId);
|
||||
createDept(null, GOV_CUS.getName(), null, deptId, "0," + deptId);
|
||||
//拉取本租户配置的服务套餐对应的角色和权限,存入本租户对应信息
|
||||
createServiceRole(createReqVO.getPackageId());
|
||||
//根据服务套餐创建基本业务配置
|
||||
createServiceConfig(createReqVO.getPackageId());
|
||||
});
|
||||
return tenant.getId();
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建本租户的基本业务配置
|
||||
*
|
||||
* @param packageIds 服务套餐标识
|
||||
*/
|
||||
private void createServiceConfig(Set<String> packageIds) {
|
||||
// for (String packageId : packageIds) {
|
||||
// if (SystemEnum.REPAIR.getCode().equals(packageId)) {
|
||||
// //维修业务系统
|
||||
// } else if (SystemEnum.INSPECTION.getCode().equals(packageId)) {
|
||||
// //检测业务系统
|
||||
// } else if (SystemEnum.SCHOOL.getCode().equals(packageId)) {
|
||||
// //驾校业务系统
|
||||
// } else if (SystemEnum.RESCUE.getCode().equals(packageId)) {
|
||||
// //救援业务系统
|
||||
// } else if (SystemEnum.INSURE.getCode().equals(packageId)) {
|
||||
// //保险业务系统
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
* 拉取本租户配置的服务套餐对应的角色和权限,存入本租户对应信息
|
||||
*
|
||||
* @param serviceCodeSet 服务标识
|
||||
* @author vinjor-M
|
||||
* @date 16:39 2024/8/2
|
||||
* @param serviceCodeSet 服务标识
|
||||
**/
|
||||
private void createServiceRole(Set<String> serviceCodeSet){
|
||||
**/
|
||||
private void createServiceRole(Set<String> serviceCodeSet) {
|
||||
//先查出这些服务在点亮租户下对应角色(预先配置好的)
|
||||
List<RoleDO> roleDOList = roleService.getRoleListByCodes(serviceCodeSet);
|
||||
for (RoleDO roleDO:roleDOList){
|
||||
for (RoleDO roleDO : roleDOList) {
|
||||
Set<Long> menuIds = permissionService.getRoleMenuListByRoleIdCus(roleDO.getId());
|
||||
// 创建角色
|
||||
RoleSaveReqVO reqVO = new RoleSaveReqVO();
|
||||
@ -172,19 +195,19 @@ public class TenantServiceImpl extends ServiceImpl<TenantMapper, TenantDO> imple
|
||||
}
|
||||
}
|
||||
|
||||
private Long createDept(Long userId,String deptName,String phone,Long parentId,String ancestors){
|
||||
private Long createDept(Long userId, String deptName, String phone, Long parentId, String ancestors) {
|
||||
DeptSaveReqVO deptSaveReqVO = new DeptSaveReqVO();
|
||||
deptSaveReqVO.setName(deptName);
|
||||
deptSaveReqVO.setSort(0);
|
||||
deptSaveReqVO.setAncestors(ancestors);
|
||||
deptSaveReqVO.setStatus(CommonStatusEnum.ENABLE.getStatus());
|
||||
if(null!=phone){
|
||||
if (null != phone) {
|
||||
deptSaveReqVO.setPhone(phone);
|
||||
}
|
||||
if(null!=userId){
|
||||
if (null != userId) {
|
||||
deptSaveReqVO.setLeaderUserId(userId);
|
||||
}
|
||||
if(null!=parentId){
|
||||
if (null != parentId) {
|
||||
deptSaveReqVO.setParentId(parentId);
|
||||
}
|
||||
return deptService.createDeptNoVerify(deptSaveReqVO);
|
||||
@ -223,7 +246,7 @@ public class TenantServiceImpl extends ServiceImpl<TenantMapper, TenantDO> imple
|
||||
// 校验套餐被禁用
|
||||
Set<String> packageSet = updateReqVO.getPackageId();
|
||||
Set<Long> menuIds = new HashSet<>();
|
||||
for (String packageId:packageSet){
|
||||
for (String packageId : packageSet) {
|
||||
ServicePackageDO servicePackageDO = servicePackageService.validServicePackage(packageId);
|
||||
menuIds.addAll(servicePackageDO.getMenuIds());
|
||||
}
|
||||
@ -238,7 +261,7 @@ public class TenantServiceImpl extends ServiceImpl<TenantMapper, TenantDO> imple
|
||||
//更新租户顶级部门名称
|
||||
DeptDO deptDO = deptService.getTenantDeptTop(updateReqVO.getId());
|
||||
deptDO.setName(updateReqVO.getName());
|
||||
DeptSaveReqVO deptSaveReqVO = BeanUtils.toBean(deptDO,DeptSaveReqVO.class);
|
||||
DeptSaveReqVO deptSaveReqVO = BeanUtils.toBean(deptDO, DeptSaveReqVO.class);
|
||||
deptService.updateDept(deptSaveReqVO);
|
||||
}
|
||||
|
||||
@ -328,11 +351,11 @@ public class TenantServiceImpl extends ServiceImpl<TenantMapper, TenantDO> imple
|
||||
PageResult<TenantDO> result = tenantMapper.selectPage(pageReqVO);
|
||||
//查出所有服务
|
||||
List<ServicePackageDO> list = servicePackageService.getServicePackageListByStatus(CommonStatusEnum.ENABLE.getStatus());
|
||||
Map<String,String> map = list.stream().collect(Collectors.toMap(ServicePackageDO::getId,ServicePackageDO::getName));
|
||||
result.getList().forEach(item->{
|
||||
Map<String, String> map = list.stream().collect(Collectors.toMap(ServicePackageDO::getId, ServicePackageDO::getName));
|
||||
result.getList().forEach(item -> {
|
||||
Set<String> strSet = new HashSet<>();
|
||||
if(null!=item.getPackageId()){
|
||||
for (String id :item.getPackageId()){
|
||||
if (null != item.getPackageId()) {
|
||||
for (String id : item.getPackageId()) {
|
||||
strSet.add(map.get(id));
|
||||
}
|
||||
}
|
||||
@ -365,7 +388,7 @@ public class TenantServiceImpl extends ServiceImpl<TenantMapper, TenantDO> imple
|
||||
@Override
|
||||
@TenantIgnore
|
||||
public Long getTenantCountByPackageId(String packageId) {
|
||||
return tenantMapper.selectCount(new LambdaQueryWrapper<TenantDO>().like(TenantDO::getPackageId,packageId));
|
||||
return tenantMapper.selectCount(new LambdaQueryWrapper<TenantDO>().like(TenantDO::getPackageId, packageId));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -397,7 +420,7 @@ public class TenantServiceImpl extends ServiceImpl<TenantMapper, TenantDO> imple
|
||||
if (isSystemTenant(tenant)) { // 系统租户,菜单是全量的
|
||||
menuIds = CollectionUtils.convertSet(menuService.getMenuList(), MenuDO::getId);
|
||||
} else {
|
||||
for (String packageId:tenant.getPackageId()){
|
||||
for (String packageId : tenant.getPackageId()) {
|
||||
menuIds.addAll(servicePackageService.getServicePackage(packageId).getMenuIds());
|
||||
}
|
||||
}
|
||||
@ -406,7 +429,7 @@ public class TenantServiceImpl extends ServiceImpl<TenantMapper, TenantDO> imple
|
||||
}
|
||||
|
||||
private static boolean isSystemTenant(TenantDO tenant) {
|
||||
return null==tenant.getPackageId();
|
||||
return null == tenant.getPackageId();
|
||||
}
|
||||
|
||||
private boolean isTenantDisable() {
|
||||
|
@ -116,7 +116,7 @@ public class AdminUserServiceImpl extends ServiceImpl<AdminUserMapper, AdminUser
|
||||
// });
|
||||
// 1.2 校验正确性
|
||||
validateUserForCreateOrUpdate(null, createReqVO.getUsername(),
|
||||
createReqVO.getMobile(), createReqVO.getEmail(), createReqVO.getDeptId(), createReqVO.getPostIds());
|
||||
createReqVO.getMobile(),createReqVO.getTenantId(), createReqVO.getEmail(), createReqVO.getDeptId(), createReqVO.getPostIds());
|
||||
// 2.1 插入用户
|
||||
AdminUserDO user = BeanUtils.toBean(createReqVO, AdminUserDO.class);
|
||||
user.setStatus(CommonStatusEnum.ENABLE.getStatus()); // 默认开启
|
||||
@ -145,7 +145,7 @@ public class AdminUserServiceImpl extends ServiceImpl<AdminUserMapper, AdminUser
|
||||
updateReqVO.setPassword(null); // 特殊:此处不更新密码
|
||||
// 1. 校验正确性
|
||||
AdminUserDO oldUser = validateUserForCreateOrUpdate(updateReqVO.getId(), updateReqVO.getUsername(),
|
||||
updateReqVO.getMobile(), updateReqVO.getEmail(), updateReqVO.getDeptId(), updateReqVO.getPostIds());
|
||||
updateReqVO.getMobile(),updateReqVO.getTenantId(), updateReqVO.getEmail(), updateReqVO.getDeptId(), updateReqVO.getPostIds());
|
||||
|
||||
// 2.1 更新用户
|
||||
AdminUserDO updateObj = BeanUtils.toBean(updateReqVO, AdminUserDO.class);
|
||||
@ -196,8 +196,8 @@ public class AdminUserServiceImpl extends ServiceImpl<AdminUserMapper, AdminUser
|
||||
public void updateUserProfile(Long id, UserProfileUpdateReqVO reqVO) {
|
||||
// 校验正确性
|
||||
validateUserExists(id);
|
||||
validateEmailUnique(id, reqVO.getEmail());
|
||||
validateMobileUnique(id, reqVO.getMobile());
|
||||
validateEmailUnique(id, reqVO.getEmail(), reqVO.getTenantId());
|
||||
validateMobileUnique(id, reqVO.getMobile(), reqVO.getTenantId());
|
||||
// 执行更新
|
||||
userMapper.updateById(BeanUtils.toBean(reqVO, AdminUserDO.class).setId(id));
|
||||
}
|
||||
@ -395,18 +395,18 @@ public class AdminUserServiceImpl extends ServiceImpl<AdminUserMapper, AdminUser
|
||||
return deptIds;
|
||||
}
|
||||
|
||||
private AdminUserDO validateUserForCreateOrUpdate(Long id, String username, String mobile, String email,
|
||||
private AdminUserDO validateUserForCreateOrUpdate(Long id, String username, String mobile,Long tenantId, String email,
|
||||
Long deptId, Set<Long> postIds) {
|
||||
// 关闭数据权限,避免因为没有数据权限,查询不到数据,进而导致唯一校验不正确
|
||||
return DataPermissionUtils.executeIgnore(() -> {
|
||||
// 校验用户存在
|
||||
AdminUserDO user = validateUserExists(id);
|
||||
// 校验用户名唯一
|
||||
validateUsernameUnique(id, username);
|
||||
validateUsernameUnique(id, username,tenantId);
|
||||
// 校验手机号唯一
|
||||
validateMobileUnique(id, mobile);
|
||||
validateMobileUnique(id, mobile,tenantId);
|
||||
// 校验邮箱唯一
|
||||
validateEmailUnique(id, email);
|
||||
validateEmailUnique(id, email,tenantId);
|
||||
// 校验部门处于开启状态
|
||||
deptService.validateDeptList(CollectionUtils.singleton(deptId));
|
||||
// 校验岗位处于开启状态
|
||||
@ -428,11 +428,11 @@ public class AdminUserServiceImpl extends ServiceImpl<AdminUserMapper, AdminUser
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
void validateUsernameUnique(Long id, String username) {
|
||||
void validateUsernameUnique(Long id, String username,Long tenantId) {
|
||||
if (StrUtil.isBlank(username)) {
|
||||
return;
|
||||
}
|
||||
AdminUserDO user = userMapper.selectByUsername(username);
|
||||
AdminUserDO user = userMapper.selectByUsername(username,tenantId);
|
||||
if (user == null) {
|
||||
return;
|
||||
}
|
||||
@ -446,11 +446,11 @@ public class AdminUserServiceImpl extends ServiceImpl<AdminUserMapper, AdminUser
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
void validateEmailUnique(Long id, String email) {
|
||||
void validateEmailUnique(Long id, String email,Long tenantId) {
|
||||
if (StrUtil.isBlank(email)) {
|
||||
return;
|
||||
}
|
||||
AdminUserDO user = userMapper.selectByEmail(email);
|
||||
AdminUserDO user = userMapper.selectByEmail(email,tenantId);
|
||||
if (user == null) {
|
||||
return;
|
||||
}
|
||||
@ -464,14 +464,13 @@ public class AdminUserServiceImpl extends ServiceImpl<AdminUserMapper, AdminUser
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
void validateMobileUnique(Long id, String mobile) {
|
||||
void validateMobileUnique(Long id, String mobile, Long tenantId) {
|
||||
if (StrUtil.isBlank(mobile)) {
|
||||
return;
|
||||
}
|
||||
Long tenantId=null;
|
||||
try {
|
||||
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||
tenantId = loginUser.getTenantId();
|
||||
// LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||
// tenantId = loginUser.getTenantId();
|
||||
|
||||
}catch (Exception e){
|
||||
|
||||
@ -524,7 +523,7 @@ public class AdminUserServiceImpl extends ServiceImpl<AdminUserMapper, AdminUser
|
||||
importUsers.forEach(importUser -> {
|
||||
// 校验,判断是否有不符合的原因
|
||||
try {
|
||||
validateUserForCreateOrUpdate(null, null, importUser.getMobile(), importUser.getEmail(),
|
||||
validateUserForCreateOrUpdate(null, null, importUser.getMobile(),0L, importUser.getEmail(),
|
||||
importUser.getDeptId(), null);
|
||||
} catch (ServiceException ex) {
|
||||
respVO.getFailureUsernames().put(importUser.getUsername(), ex.getMessage());
|
||||
|
@ -22,12 +22,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<select id="selectListByRoleId" resultType="cn.iocoder.yudao.module.system.api.user.dto.UserDTO"
|
||||
parameterType="cn.iocoder.yudao.module.system.controller.admin.permission.vo.role.RolePageReqVO">
|
||||
select distinct su.*,GROUP_CONCAT(DISTINCT sr2.name SEPARATOR ',') AS roleNames
|
||||
from system_users su
|
||||
from inspection_staff staff
|
||||
LEFT JOIN system_users su on staff.user_id = su.id
|
||||
left join system_user_role sr on su.id = sr.user_id
|
||||
left join system_role sr2 on sr.role_id = sr2.id
|
||||
<where>
|
||||
su.deleted = 0 and sr2.service_package_id = 'jiance' and sr2.code != 'jcyh'
|
||||
|
||||
su.deleted = 0
|
||||
<if test="role.nickname != null">
|
||||
and (su.nickname like CONCAT('%',#{role.nickname},'%') OR su.username like CONCAT('%',#{role.nickname},'%'))
|
||||
</if>
|
||||
|
Loading…
Reference in New Issue
Block a user