Compare commits
No commits in common. "3b2f80ec64639c99632b369842bfea54182c6e07" and "028dd45b4cd3c9de368334460a78e6feb9886b82" have entirely different histories.
3b2f80ec64
...
028dd45b4c
@ -2,11 +2,8 @@ package cn.iocoder.yudao.module.inspection.controller.admin;
|
|||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||||
import cn.iocoder.yudao.module.inspection.entity.InspectionInfo;
|
|
||||||
import cn.iocoder.yudao.module.inspection.service.IInspectionInfoService;
|
|
||||||
import cn.iocoder.yudao.module.payment.entity.OrderInfo;
|
import cn.iocoder.yudao.module.payment.entity.OrderInfo;
|
||||||
import cn.iocoder.yudao.module.payment.service.OrderInfoService;
|
import cn.iocoder.yudao.module.payment.service.OrderInfoService;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
@ -17,8 +14,6 @@ public class InspectionOrderInfoController {
|
|||||||
|
|
||||||
private final OrderInfoService orderInfoService;
|
private final OrderInfoService orderInfoService;
|
||||||
|
|
||||||
private final IInspectionInfoService inspectionInfoService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改订单信息
|
* 修改订单信息
|
||||||
*
|
*
|
||||||
@ -29,7 +24,7 @@ public class InspectionOrderInfoController {
|
|||||||
public CommonResult<?> cashier(@RequestBody OrderInfo orderInfo) {
|
public CommonResult<?> cashier(@RequestBody OrderInfo orderInfo) {
|
||||||
if ("accounting".equals(orderInfo.getType())) {
|
if ("accounting".equals(orderInfo.getType())) {
|
||||||
orderInfo.setAccountingConfirmUser(SecurityFrameworkUtils.getLoginUserId());
|
orderInfo.setAccountingConfirmUser(SecurityFrameworkUtils.getLoginUserId());
|
||||||
} else {
|
}else {
|
||||||
orderInfo.setCashierConfirmUser(SecurityFrameworkUtils.getLoginUserId());
|
orderInfo.setCashierConfirmUser(SecurityFrameworkUtils.getLoginUserId());
|
||||||
}
|
}
|
||||||
return CommonResult.success(orderInfoService.updateById(orderInfo));
|
return CommonResult.success(orderInfoService.updateById(orderInfo));
|
||||||
@ -37,18 +32,11 @@ public class InspectionOrderInfoController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取订单信息
|
* 获取订单信息
|
||||||
*
|
|
||||||
* @param id
|
* @param id
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping("/{id}")
|
@GetMapping("/{id}")
|
||||||
public CommonResult<?> get(@PathVariable Long id) {
|
public CommonResult<?> get(@PathVariable Long id){
|
||||||
OrderInfo byId = orderInfoService.getById(id);
|
return CommonResult.success(orderInfoService.getById(id));
|
||||||
InspectionInfo one = inspectionInfoService.getOne(Wrappers.<InspectionInfo>lambdaQuery()
|
|
||||||
.eq(InspectionInfo::getInspectionOrderId, id));
|
|
||||||
if (one != null) {
|
|
||||||
byId.setCarNo(one.getCarNum());
|
|
||||||
}
|
|
||||||
return CommonResult.success(byId);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2718,7 +2718,7 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl<AppInspectionPa
|
|||||||
Long realPayMoney = query.getRealPayMoney();
|
Long realPayMoney = query.getRealPayMoney();
|
||||||
Long reduceMoney = query.getReduceMoney();
|
Long reduceMoney = query.getReduceMoney();
|
||||||
long averageMoney = realPayMoney / query.getIds().size();
|
long averageMoney = realPayMoney / query.getIds().size();
|
||||||
long averageReduceMoney = reduceMoney != null ? reduceMoney / query.getIds().size() : 0L;
|
long averageReduceMoney = reduceMoney / query.getIds().size();
|
||||||
// 根据ids 修改工单结算
|
// 根据ids 修改工单结算
|
||||||
orderService.update(Wrappers.<OrderInfo>lambdaUpdate()
|
orderService.update(Wrappers.<OrderInfo>lambdaUpdate()
|
||||||
.in(OrderInfo::getId, orderIds)
|
.in(OrderInfo::getId, orderIds)
|
||||||
|
|||||||
@ -1,59 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.base.controller.admin;
|
|
||||||
|
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
|
||||||
import cn.iocoder.yudao.module.base.entity.RepairStaff;
|
|
||||||
import cn.iocoder.yudao.module.system.dal.dataobject.permission.RoleDO;
|
|
||||||
import cn.iocoder.yudao.module.system.dal.dataobject.permission.UserRoleDO;
|
|
||||||
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 lombok.RequiredArgsConstructor;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/base/repair-staff")
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
public class RepairStaffController {
|
|
||||||
private final AdminUserService userService;
|
|
||||||
private final RoleService roleService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取维修员工信息
|
|
||||||
*
|
|
||||||
* @param id 用户id
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@GetMapping("/get")
|
|
||||||
public CommonResult<?> getRepairStaff(Long id) {
|
|
||||||
// 查询信息
|
|
||||||
AdminUserDO user = userService.getUser(id);
|
|
||||||
if (user == null) {
|
|
||||||
return CommonResult.error(400,"用户不存在");
|
|
||||||
}
|
|
||||||
|
|
||||||
// 查询对应角色
|
|
||||||
List<RoleDO> roleDOS = roleService.selectRoleByUserId(id);
|
|
||||||
if (roleDOS == null) {
|
|
||||||
roleDOS = Collections.emptyList();
|
|
||||||
}
|
|
||||||
|
|
||||||
RepairStaff repairStaff = BeanUtil.copyProperties(user, RepairStaff.class);
|
|
||||||
|
|
||||||
// 过滤出服务套餐为 weixiu 的
|
|
||||||
List<RoleDO> weixiuRoleDOS = roleDOS.stream()
|
|
||||||
.filter(item -> "weixiu".equals(item.getServicePackageId()))
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
repairStaff.setRoles(weixiuRoleDOS);
|
|
||||||
|
|
||||||
return CommonResult.success(repairStaff);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,58 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.base.entity;
|
|
||||||
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.module.system.api.user.dto.UserDTO;
|
|
||||||
import cn.iocoder.yudao.module.system.dal.dataobject.permission.RoleDO;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public class RepairStaff {
|
|
||||||
/**
|
|
||||||
* 用户id
|
|
||||||
*/
|
|
||||||
private Long id;
|
|
||||||
/**
|
|
||||||
* 用户账号
|
|
||||||
*/
|
|
||||||
private String username;
|
|
||||||
/**
|
|
||||||
* 用户昵称
|
|
||||||
*/
|
|
||||||
private String nickname;
|
|
||||||
/**
|
|
||||||
* 备注
|
|
||||||
*/
|
|
||||||
private String remark;
|
|
||||||
/**
|
|
||||||
* 用户手机号码
|
|
||||||
*/
|
|
||||||
private String mobile;
|
|
||||||
/**
|
|
||||||
* 用户头像
|
|
||||||
*/
|
|
||||||
private String avatar;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户性别
|
|
||||||
**/
|
|
||||||
private String sex;
|
|
||||||
/**
|
|
||||||
* 用户openId
|
|
||||||
**/
|
|
||||||
private String openId;
|
|
||||||
/**
|
|
||||||
* 用户openId
|
|
||||||
**/
|
|
||||||
private Long tenantId;
|
|
||||||
/**
|
|
||||||
* 用户状态
|
|
||||||
*/
|
|
||||||
private Integer status;
|
|
||||||
/**
|
|
||||||
* 角色名称 多个角色以逗号隔开
|
|
||||||
*/
|
|
||||||
private String roleNames;
|
|
||||||
List<RoleDO> roles;
|
|
||||||
}
|
|
||||||
@ -76,11 +76,7 @@ public class PermissionController {
|
|||||||
@PostMapping("/assign-user-role")
|
@PostMapping("/assign-user-role")
|
||||||
@PreAuthorize("@ss.hasPermission('system:permission:assign-user-role')")
|
@PreAuthorize("@ss.hasPermission('system:permission:assign-user-role')")
|
||||||
public CommonResult<Boolean> assignUserRole(@Validated @RequestBody PermissionAssignUserRoleReqVO reqVO) {
|
public CommonResult<Boolean> assignUserRole(@Validated @RequestBody PermissionAssignUserRoleReqVO reqVO) {
|
||||||
if (reqVO.getServicePackageId() != null) {
|
permissionService.assignUserRole(reqVO.getUserId(), reqVO.getRoleIds());
|
||||||
permissionService.assignUserRoleByServicePackageId(reqVO.getUserId(), reqVO.getRoleIds(), reqVO.getServicePackageId());
|
|
||||||
}else {
|
|
||||||
permissionService.assignUserRole(reqVO.getUserId(), reqVO.getRoleIds());
|
|
||||||
}
|
|
||||||
return success(true);
|
return success(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -100,57 +100,52 @@ public class RoleController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* app端通过服务套餐id查询角色列表
|
* app端通过服务套餐id查询角色列表
|
||||||
*
|
|
||||||
* @param roleDO
|
* @param roleDO
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping("/pageByQuery")
|
@GetMapping("/pageByQuery")
|
||||||
public CommonResult pageByQuery(RoleDO roleDO) {
|
public CommonResult pageByQuery(RoleDO roleDO){
|
||||||
return success(roleService.pageByQuery(roleDO));
|
return success(roleService.pageByQuery(roleDO));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过角色id查询角色
|
* 通过角色id查询角色
|
||||||
*
|
|
||||||
* @param roleIds
|
* @param roleIds
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping("/selectListByRoleId")
|
@GetMapping("/selectListByRoleId")
|
||||||
public CommonResult selectListByRoleId(RolePageReqVO role) {
|
public CommonResult selectListByRoleId(RolePageReqVO role){
|
||||||
return success(roleService.selectListByRoleId(role));
|
return success(roleService.selectListByRoleId(role));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过角色id查询角色
|
* 通过角色id查询角色
|
||||||
*
|
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping("/selectListByRoleIdJX")
|
@GetMapping("/selectListByRoleIdJX")
|
||||||
public CommonResult selectListByRoleIdJX(RolePageReqVO role) {
|
public CommonResult selectListByRoleIdJX(RolePageReqVO role){
|
||||||
return success(roleService.selectListByRoleIdJX(role));
|
return success(roleService.selectListByRoleIdJX(role));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过角色id查询角色
|
* 通过角色id查询角色
|
||||||
*
|
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping("/selectListByRoleIdRepair")
|
@GetMapping("/selectListByRoleIdRepair")
|
||||||
public CommonResult selectListByRoleIdRepair(RolePageReqVO role) {
|
public CommonResult selectListByRoleIdRepair(RolePageReqVO role){
|
||||||
return success(roleService.selectListByRoleIdRepair(role));
|
return success(roleService.selectListByRoleIdRepair(role));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过角色code查询用户
|
* 通过角色code查询用户
|
||||||
*
|
|
||||||
* @param code
|
* @param code
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping("/getUsersByRoleCode")
|
@GetMapping("/getUsersByRoleCode")
|
||||||
public CommonResult getUsersByRoleCode(String code) {
|
public CommonResult getUsersByRoleCode(String code){
|
||||||
//获取当前登陆人的tenanId
|
//获取当前登陆人的tenanId
|
||||||
Long tenantId = SecurityFrameworkUtils.getLoginUser().getTenantId();
|
Long tenantId = SecurityFrameworkUtils.getLoginUser().getTenantId();
|
||||||
return success(roleService.selectByRoleCode(tenantId, code));
|
return success(roleService.selectByRoleCode(tenantId,code));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,7 +18,4 @@ public class PermissionAssignUserRoleReqVO {
|
|||||||
@Schema(description = "角色编号列表", example = "1,3,5")
|
@Schema(description = "角色编号列表", example = "1,3,5")
|
||||||
private Set<Long> roleIds = Collections.emptySet(); // 兜底
|
private Set<Long> roleIds = Collections.emptySet(); // 兜底
|
||||||
|
|
||||||
@Schema(description = "服务套餐编号", example = "1")
|
|
||||||
private String servicePackageId;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,8 +21,6 @@ public interface UserRoleMapper extends BaseMapperX<UserRoleDO> {
|
|||||||
return selectList(UserRoleDO::getUserId, userId);
|
return selectList(UserRoleDO::getUserId, userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<UserRoleDO> selectListByUserIdAndServicePackageId(@Param("userId")Long userId, @Param("servicePackageId")String servicePackageId);
|
|
||||||
|
|
||||||
default void deleteListByUserIdAndRoleIdIds(Long userId, Collection<Long> roleIds) {
|
default void deleteListByUserIdAndRoleIdIds(Long userId, Collection<Long> roleIds) {
|
||||||
delete(new LambdaQueryWrapper<UserRoleDO>()
|
delete(new LambdaQueryWrapper<UserRoleDO>()
|
||||||
.eq(UserRoleDO::getUserId, userId)
|
.eq(UserRoleDO::getUserId, userId)
|
||||||
|
|||||||
@ -182,11 +182,4 @@ public interface PermissionService {
|
|||||||
**/
|
**/
|
||||||
List<Long> getUserIdByRoleId(Long roleId);
|
List<Long> getUserIdByRoleId(Long roleId);
|
||||||
|
|
||||||
/**
|
|
||||||
* 赋予用户角色
|
|
||||||
* @param userId
|
|
||||||
* @param roleIds
|
|
||||||
* @param servicePackageId
|
|
||||||
*/
|
|
||||||
void assignUserRoleByServicePackageId(Long userId, Set<Long> roleIds, String servicePackageId);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -390,34 +390,4 @@ public class PermissionServiceImpl implements PermissionService {
|
|||||||
List<Long> userIds = userRoleDOS.stream().map(item -> item.getUserId()).collect(Collectors.toList());
|
List<Long> userIds = userRoleDOS.stream().map(item -> item.getUserId()).collect(Collectors.toList());
|
||||||
return userIds;
|
return userIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 赋予用户角色
|
|
||||||
*
|
|
||||||
* @param userId
|
|
||||||
* @param roleIds
|
|
||||||
* @param servicePackageId
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void assignUserRoleByServicePackageId(Long userId, Set<Long> roleIds, String servicePackageId) {
|
|
||||||
// 获得角色拥有角色编号
|
|
||||||
Set<Long> dbRoleIds = convertSet(userRoleMapper.selectListByUserIdAndServicePackageId(userId, servicePackageId),
|
|
||||||
UserRoleDO::getRoleId);
|
|
||||||
// 计算新增和删除的角色编号
|
|
||||||
Set<Long> roleIdList = CollUtil.emptyIfNull(roleIds);
|
|
||||||
Collection<Long> createRoleIds = CollUtil.subtract(roleIdList, dbRoleIds);
|
|
||||||
Collection<Long> deleteRoleIds = CollUtil.subtract(dbRoleIds, roleIdList);
|
|
||||||
// 执行新增和删除。对于已经授权的角色,不用做任何处理
|
|
||||||
if (!CollectionUtil.isEmpty(createRoleIds)) {
|
|
||||||
userRoleMapper.insertBatch(CollectionUtils.convertList(createRoleIds, roleId -> {
|
|
||||||
UserRoleDO entity = new UserRoleDO();
|
|
||||||
entity.setUserId(userId);
|
|
||||||
entity.setRoleId(roleId);
|
|
||||||
return entity;
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
if (!CollectionUtil.isEmpty(deleteRoleIds)) {
|
|
||||||
userRoleMapper.deleteListByUserIdAndRoleIdIds(userId, deleteRoleIds);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -172,9 +172,7 @@ public interface RoleService {
|
|||||||
List<RoleDO> pageByQuery(RoleDO roleDO);
|
List<RoleDO> pageByQuery(RoleDO roleDO);
|
||||||
|
|
||||||
IPage<UserDTO> selectListByRoleId(RolePageReqVO role);
|
IPage<UserDTO> selectListByRoleId(RolePageReqVO role);
|
||||||
|
|
||||||
IPage<UserDTO> selectListByRoleIdJX(RolePageReqVO role);
|
IPage<UserDTO> selectListByRoleIdJX(RolePageReqVO role);
|
||||||
|
|
||||||
IPage<UserDTO> selectListByRoleIdRepair(RolePageReqVO role);
|
IPage<UserDTO> selectListByRoleIdRepair(RolePageReqVO role);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -216,12 +214,4 @@ public interface RoleService {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<UserDTO> getUserListByCodesAndTenantId(List<String> codes, Long tenantId);
|
List<UserDTO> getUserListByCodesAndTenantId(List<String> codes, Long tenantId);
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据用户id查询角色
|
|
||||||
*
|
|
||||||
* @param userId 用户id
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
List<RoleDO> selectRoleByUserId(Long userId);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -435,21 +435,6 @@ public class RoleServiceImpl implements RoleService {
|
|||||||
return userRoleMapper.selectByRoleCodesAndTenantId(codes, tenantId);
|
return userRoleMapper.selectByRoleCodesAndTenantId(codes, tenantId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据用户id查询角色
|
|
||||||
*
|
|
||||||
* @param userId 用户id
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public List<RoleDO> selectRoleByUserId(Long userId) {
|
|
||||||
List<UserRoleDO> userRoleDOS = userRoleMapper.selectList(new LambdaQueryWrapper<UserRoleDO>()
|
|
||||||
.eq(UserRoleDO::getUserId, userId));
|
|
||||||
// 获取角色id集合
|
|
||||||
List<Long> roleIds = userRoleDOS.stream().map(item -> item.getRoleId()).collect(Collectors.toList());
|
|
||||||
return getRoleListFromCache(roleIds);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得自身的代理对象,解决 AOP 生效问题
|
* 获得自身的代理对象,解决 AOP 生效问题
|
||||||
*
|
*
|
||||||
|
|||||||
@ -97,7 +97,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
from system_users su
|
from system_users su
|
||||||
left join system_user_role sr on su.id = sr.user_id and sr.deleted = 0
|
left join system_user_role sr on su.id = sr.user_id and sr.deleted = 0
|
||||||
left join system_role sr2 on sr.role_id = sr2.id
|
left join system_role sr2 on sr.role_id = sr2.id
|
||||||
-- INNER JOIN dl_repair_worker dsc ON dsc.user_id = su.id
|
INNER JOIN dl_repair_worker dsc ON dsc.user_id = su.id
|
||||||
<where>
|
<where>
|
||||||
su.deleted = 0 and sr2.service_package_id = 'weixiu'
|
su.deleted = 0 and sr2.service_package_id = 'weixiu'
|
||||||
|
|
||||||
@ -210,11 +210,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
) AND sur.deleted = 0
|
) AND sur.deleted = 0
|
||||||
) AND deleted = 0
|
) AND deleted = 0
|
||||||
</select>
|
</select>
|
||||||
<select id="selectListByUserIdAndServicePackageId"
|
|
||||||
resultType="cn.iocoder.yudao.module.system.dal.dataobject.permission.UserRoleDO">
|
|
||||||
SELECT sur.*
|
|
||||||
FROM system_user_role sur
|
|
||||||
LEFT JOIN system_role sr ON sur.role_id = sr.id
|
|
||||||
WHERE sur.user_id = #{userId} AND sr.service_package_id = #{servicePackageId}
|
|
||||||
</select>
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user