refactor(system): 优化用户和部门相关接口

- 修改用户外勤打卡权限接口,支持批量更新
- 移除获取部门列表_by_Leader接口
- 新增获取工厂部门列表接口
-优化部门简单响应VO,增加工厂编号字段
- 修复租金订单控制器中的退款金额设置问题
This commit is contained in:
furongxin 2024-12-13 11:40:10 +08:00
parent d9fbd61195
commit 0703f3d8ef
11 changed files with 36 additions and 20 deletions

View File

@ -73,10 +73,6 @@ public interface DeptApi {
@Parameter(name = "factoryId", description = "工厂编号", example = "100001", required = true)
CommonResult<DeptRespDTO> getDeptByFactoryId(@RequestParam("factoryId") Long factoryId);
@GetMapping(PREFIX + "/getListByLeader")
@Operation(summary = "获取所有部门信息")
@Parameter(name = "userId", description = "用户编号", example = "146", required = true)
CommonResult<List<DeptRespDTO>> getDeptListByLeader(@RequestParam("userId") Long userId);
/**
* 获得指定编号的部门 Map

View File

@ -85,7 +85,7 @@ public interface AdminUserApi {
@Operation(summary = "修改用户外勤打卡权限")
@Parameter(name = "userId", description = "用户id", example = "1024", required = true)
@Parameter(name = "fieldworkFlag", description = "是否可外勤打卡 | 0否 1是", example = "1", required = true)
void updateFieldworkType(@RequestParam("userId") Long userId,
void updateFieldworkType(@RequestParam("userId") Collection<Long> userId,
@RequestParam("fieldworkFlag") Integer fieldworkFlag);
@PostMapping(PREFIX + "/updateUserStaffing")

View File

@ -108,13 +108,6 @@ public class DeptApiImpl implements DeptApi {
return success(BeanUtils.toBean(deptDO, DeptRespDTO.class));
}
@Override
public CommonResult<List<DeptRespDTO>> getDeptListByLeader(Long userId) {
List<DeptDO> deptDOS = deptService.getDeptByLeaderId(userId);
return success(BeanUtils.toBean(deptDOS, DeptRespDTO.class));
}
@Override
@DataPermission(enable = false)
public CommonResult<List<Long>> getChildDeptList(Long deptId) {

View File

@ -100,7 +100,7 @@ public class AdminUserApiImpl implements AdminUserApi {
}
@Override
public void updateFieldworkType(Long userId, Integer fieldworkFlag) {
public void updateFieldworkType(Collection<Long> userId, Integer fieldworkFlag) {
userService.updateFieldworkType(userId, fieldworkFlag);
}

View File

@ -164,6 +164,15 @@ public class DeptController {
return success(BeanUtils.toBean(list, DeptSimpleRespVO.class));
}
@GetMapping(value = { "/get-factory-dept"})
@Operation(summary = "获取工厂部门精简信息列表", description = "只包含被开启的部门,主要用于前端的下拉选项")
@DataPermission(enable = false)
public CommonResult<List<DeptSimpleRespVO>> getFactoryDept() {
List<DeptDO> list = deptService.getFactoryDept();
return success(BeanUtils.toBean(list, DeptSimpleRespVO.class));
}
@GetMapping(value = {"/getListByType"})
@Operation(summary = "获取指定类型的部门精简信息列表", description = "只包含被开启的部门,主要用于前端的下拉选项")
@Parameter(name = "type", description = "类型", required = true, example = "1")

View File

@ -25,4 +25,7 @@ public class DeptSimpleRespVO {
@Schema(description = "是否为虚机构 | 0否 1是")
private Integer virtuallyStatus;
@Schema(description = "工厂编号")
private Long factoryId;
}

View File

@ -117,8 +117,10 @@ public class RentalOrderController {
if (CollectionUtil.isNotEmpty(refundMap)) {
// 设置对应的订单号中的 申请退款和扣款金额
pageResult.getList().forEach(item -> {
if (refundMap.get(item.getOrderNo()) != null) {
item.setApplyRefundAmount(refundMap.get(item.getOrderNo()).getRefundAmount());
item.setApplyChargebacksAmount(refundMap.get(item.getOrderNo()).getChargebacksAmount());
}
});
}

View File

@ -191,4 +191,10 @@ public interface DeptService {
* @return 部门列表
*/
List<DeptDO> getDeptListByType(String type);
/**
* 获取工厂部门
* @return 部门列表
*/
List<DeptDO> getFactoryDept();
}

View File

@ -392,6 +392,14 @@ public class DeptServiceImpl implements DeptService {
.eq(DeptDO::getStatus, CommonStatusEnum.ENABLE.getStatus()));
}
@Override
public List<DeptDO> getFactoryDept() {
return deptMapper.selectList(new LambdaQueryWrapperX<DeptDO>()
.eq(DeptDO::getStatus, CommonStatusEnum.ENABLE.getStatus())
.isNotNull(DeptDO::getFactoryId));
}
@Override
public List<DeptDO> getDeptList(DeptApiDTO dto) {
List<DeptDO> list = deptMapper.selectList(new LambdaQueryWrapperX<DeptDO>()

View File

@ -122,7 +122,7 @@ public interface AdminUserService {
* @param id 用户编号
* @param fieldworkFlag 状态
*/
void updateFieldworkType(Long id, Integer fieldworkFlag);
void updateFieldworkType(Collection<Long> id, Integer fieldworkFlag);
/**
* 删除用户

View File

@ -289,14 +289,13 @@ public class AdminUserServiceImpl implements AdminUserService {
}
@Override
public void updateFieldworkType(Long id, Integer fieldworkFlag) {
public void updateFieldworkType(Collection<Long> id, Integer fieldworkFlag) {
// 更新状态
AdminUserDO updateObj = new AdminUserDO();
updateObj.setId(id);
updateObj.setFieldworkFlag(fieldworkFlag);
updateObj.setFieldworkType(fieldworkFlag == 1 ? 2 : 0); //设置为 临时外勤类型
userMapper.update(updateObj, new LambdaQueryWrapper<AdminUserDO>()
.eq(AdminUserDO::getId, id)
userMapper.update(updateObj, new LambdaQueryWrapperX<AdminUserDO>()
.in(AdminUserDO::getId, id)
.ne(AdminUserDO::getFieldworkType, 1));
}