feat:硬件广播、硬件授权代码修改
This commit is contained in:
1 parent
7ea1f7937e
commit
0ff7a302ea
15 files changed
+412
-95
No files matched your search
+9
@@ -3,6 +3,15 @@ package com.bsd.pjcloud.hard.api.dto;
|
||||
import com.bsd.pjcloud.hard.api.entity.HardAuthEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
@Data
|
||||
public class HardAuthDto extends HardAuthEntity {
|
||||
|
||||
private LocalDate[] createTimeList;
|
||||
|
||||
private LocalDate[] authTimeList;
|
||||
|
||||
private LocalDate[] isDoneTimeList;
|
||||
|
||||
}
|
||||
+7
@@ -3,6 +3,13 @@ package com.bsd.pjcloud.hard.api.dto;
|
||||
import com.bsd.pjcloud.hard.api.entity.HardBroadcastEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
@Data
|
||||
public class HardBroadcastDto extends HardBroadcastEntity {
|
||||
|
||||
private LocalDate[] createTimeList;
|
||||
|
||||
private LocalDate[] isDoneTimeList;
|
||||
|
||||
}
|
||||
+64
-57
@@ -6,6 +6,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import com.bsd.pjcloud.common.core.util.TenantTable;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
@@ -19,88 +20,94 @@ import java.time.LocalDateTime;
|
||||
public class HardAuthEntity extends Model<HardAuthEntity> {
|
||||
|
||||
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@Schema(description="编号")
|
||||
@Schema(description = "编号")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 预定用户
|
||||
*/
|
||||
@Schema(description="预定用户")
|
||||
/**
|
||||
* 预定用户
|
||||
*/
|
||||
@Schema(description = "预定用户")
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 硬件id
|
||||
*/
|
||||
@Schema(description="硬件id")
|
||||
/**
|
||||
* 硬件id
|
||||
*/
|
||||
@Schema(description = "硬件id")
|
||||
private Long hardId;
|
||||
|
||||
/**
|
||||
* 是否授权
|
||||
*/
|
||||
@Schema(description="是否授权")
|
||||
/**
|
||||
* 是否授权
|
||||
*/
|
||||
@Schema(description = "是否授权")
|
||||
private String authType;
|
||||
|
||||
/**
|
||||
* 是否授权
|
||||
*/
|
||||
@Schema(description = "是否授权")
|
||||
private String authStatus;
|
||||
|
||||
/**
|
||||
* 授权时间
|
||||
*/
|
||||
@Schema(description="授权时间")
|
||||
/**
|
||||
* 授权时间
|
||||
*/
|
||||
@Schema(description = "授权时间")
|
||||
private LocalDateTime authTime;
|
||||
|
||||
/**
|
||||
* 是否完成
|
||||
*/
|
||||
@Schema(description="是否完成")
|
||||
/**
|
||||
* 是否完成
|
||||
*/
|
||||
@Schema(description = "是否完成")
|
||||
private String isDone;
|
||||
|
||||
/**
|
||||
* 完成时间
|
||||
*/
|
||||
@Schema(description="完成时间")
|
||||
/**
|
||||
* 完成时间
|
||||
*/
|
||||
@Schema(description = "完成时间")
|
||||
private LocalDateTime isDoneTime;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description="创建人")
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description = "创建人")
|
||||
private String createBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description="创建时间")
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description = "创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
@Schema(description="修改人")
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
@Schema(description = "修改人")
|
||||
private String updateBy;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
@Schema(description="修改时间")
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
@Schema(description = "修改时间")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 删除标记
|
||||
*/
|
||||
/**
|
||||
* 删除标记
|
||||
*/
|
||||
@TableLogic
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description="删除标记")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description = "删除标记")
|
||||
private String delFlag;
|
||||
|
||||
/**
|
||||
* 租户ID
|
||||
*/
|
||||
@Schema(description="租户ID")
|
||||
/**
|
||||
* 租户ID
|
||||
*/
|
||||
@Schema(description = "租户ID")
|
||||
private Long tenantId;
|
||||
}
|
||||
+28
-1
@@ -1,8 +1,35 @@
|
||||
package com.bsd.pjcloud.hard.api.vo;
|
||||
|
||||
import com.bsd.pjcloud.admin.api.vo.base.BaseUserDeptInterface;
|
||||
import com.bsd.pjcloud.hard.api.entity.HardAuthEntity;
|
||||
import com.bsd.pjcloud.hard.api.vo.base.BaseHardInterface;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class HardAuthVo extends HardAuthEntity {
|
||||
public class HardAuthVo extends HardAuthEntity implements BaseHardInterface, BaseUserDeptInterface {
|
||||
|
||||
/**
|
||||
* 设备相关
|
||||
*/
|
||||
private String hardName;
|
||||
|
||||
private String hardType;
|
||||
|
||||
private List<String> hardTypeCodes;
|
||||
|
||||
/**
|
||||
* 用户相关
|
||||
*/
|
||||
private String username;
|
||||
|
||||
private String userMobile;
|
||||
|
||||
private String userAvatar;
|
||||
|
||||
private Long userDeptId;
|
||||
|
||||
private String userDeptName;
|
||||
|
||||
}
|
||||
+29
-1
@@ -1,8 +1,36 @@
|
||||
package com.bsd.pjcloud.hard.api.vo;
|
||||
|
||||
import com.bsd.pjcloud.admin.api.vo.base.BaseUserDeptInterface;
|
||||
import com.bsd.pjcloud.hard.api.entity.HardBroadcastEntity;
|
||||
import com.bsd.pjcloud.hard.api.vo.base.BaseHardInterface;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class HardBroadcastVo extends HardBroadcastEntity {
|
||||
public class HardBroadcastVo extends HardBroadcastEntity implements BaseHardInterface, BaseUserDeptInterface {
|
||||
|
||||
/**
|
||||
* 设备相关
|
||||
*/
|
||||
private String hardName;
|
||||
|
||||
private String hardType;
|
||||
|
||||
private List<String> hardTypeCodes;
|
||||
|
||||
/**
|
||||
* 用户相关
|
||||
*/
|
||||
private String username;
|
||||
|
||||
private String userMobile;
|
||||
|
||||
private String userAvatar;
|
||||
|
||||
private Long userDeptId;
|
||||
|
||||
private String userDeptName;
|
||||
|
||||
|
||||
}
|
||||
+7
-4
@@ -6,8 +6,11 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.common.log.annotation.SysLog;
|
||||
import com.bsd.pjcloud.hard.api.dto.HardAuthDto;
|
||||
import com.bsd.pjcloud.hard.api.entity.HardAuthEntity;
|
||||
import com.bsd.pjcloud.hard.api.vo.HardAuthVo;
|
||||
import com.bsd.pjcloud.hard.service.HardAuthService;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import com.bsd.pjcloud.common.excel.annotation.ResponseExcel;
|
||||
@@ -35,11 +38,11 @@ public class HardAuthController {
|
||||
private final HardAuthService hardAuthService;
|
||||
|
||||
@Operation(summary = "分页查询", description = "分页查询")
|
||||
@GetMapping("/page")
|
||||
@GetMapping("/page-join")
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardAuth_view')")
|
||||
public R getHardAuthPage(@ParameterObject Page page, @ParameterObject HardAuthEntity hardAuth) {
|
||||
LambdaQueryWrapper<HardAuthEntity> wrapper = Wrappers.lambdaQuery();
|
||||
return R.ok(hardAuthService.page(page, wrapper));
|
||||
public R<Page<HardAuthVo>> pageJoin(@ParameterObject Page page, @ParameterObject HardAuthDto dto) {
|
||||
DataScope dataScope = null;
|
||||
return R.ok(hardAuthService.scopePageJoin(page, dto, dataScope));
|
||||
}
|
||||
|
||||
@Operation(summary = "通过id查询", description = "通过id查询")
|
||||
|
||||
+28
-25
@@ -6,8 +6,11 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.common.log.annotation.SysLog;
|
||||
import com.bsd.pjcloud.hard.entity.HardBroadcastEntity;
|
||||
import com.bsd.pjcloud.hard.api.dto.HardBroadcastDto;
|
||||
import com.bsd.pjcloud.hard.api.entity.HardBroadcastEntity;
|
||||
import com.bsd.pjcloud.hard.api.vo.HardBroadcastVo;
|
||||
import com.bsd.pjcloud.hard.service.HardBroadcastService;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import com.bsd.pjcloud.common.excel.annotation.ResponseExcel;
|
||||
@@ -27,56 +30,56 @@ import java.util.Objects;
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/hard-broadcast" )
|
||||
@Tag(description = "hard-broadcast" , name = "设备广播管理" )
|
||||
@RequestMapping("/hard-broadcast")
|
||||
@Tag(description = "hard-broadcast", name = "设备广播管理")
|
||||
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
|
||||
public class HardBroadcastController {
|
||||
|
||||
private final HardBroadcastService hardBroadcastService;
|
||||
private final HardBroadcastService hardBroadcastService;
|
||||
|
||||
@Operation(summary = "分页查询" , description = "分页查询" )
|
||||
@GetMapping("/page" )
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardBroadcast_view')" )
|
||||
public R getHardBroadcastPage(@ParameterObject Page page, @ParameterObject HardBroadcastEntity hardBroadcast) {
|
||||
LambdaQueryWrapper<HardBroadcastEntity> wrapper = Wrappers.lambdaQuery();
|
||||
return R.ok(hardBroadcastService.page(page, wrapper));
|
||||
@Operation(summary = "分页查询", description = "分页查询")
|
||||
@GetMapping("/page-join")
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardBroadcast_view')")
|
||||
public R<Page<HardBroadcastVo>> pageJoin(@ParameterObject Page page, @ParameterObject HardBroadcastDto dto) {
|
||||
DataScope dataScope = null;
|
||||
return R.ok(hardBroadcastService.scopePageJoin(page, dto, dataScope));
|
||||
}
|
||||
|
||||
@Operation(summary = "通过id查询" , description = "通过id查询" )
|
||||
@GetMapping("/{id}" )
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardBroadcast_view')" )
|
||||
public R getById(@PathVariable("id" ) Long id) {
|
||||
@Operation(summary = "通过id查询", description = "通过id查询")
|
||||
@GetMapping("/{id}")
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardBroadcast_view')")
|
||||
public R getById(@PathVariable("id") Long id) {
|
||||
return R.ok(hardBroadcastService.getById(id));
|
||||
}
|
||||
|
||||
@Operation(summary = "新增设备广播" , description = "新增设备广播" )
|
||||
@SysLog("新增设备广播" )
|
||||
@Operation(summary = "新增设备广播", description = "新增设备广播")
|
||||
@SysLog("新增设备广播")
|
||||
@PostMapping
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardBroadcast_add')" )
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardBroadcast_add')")
|
||||
public R save(@RequestBody HardBroadcastEntity hardBroadcast) {
|
||||
return R.ok(hardBroadcastService.save(hardBroadcast));
|
||||
}
|
||||
|
||||
@Operation(summary = "修改设备广播" , description = "修改设备广播" )
|
||||
@SysLog("修改设备广播" )
|
||||
@Operation(summary = "修改设备广播", description = "修改设备广播")
|
||||
@SysLog("修改设备广播")
|
||||
@PutMapping
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardBroadcast_edit')" )
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardBroadcast_edit')")
|
||||
public R updateById(@RequestBody HardBroadcastEntity hardBroadcast) {
|
||||
return R.ok(hardBroadcastService.updateById(hardBroadcast));
|
||||
}
|
||||
|
||||
@Operation(summary = "通过id删除设备广播" , description = "通过id删除设备广播" )
|
||||
@SysLog("通过id删除设备广播" )
|
||||
@Operation(summary = "通过id删除设备广播", description = "通过id删除设备广播")
|
||||
@SysLog("通过id删除设备广播")
|
||||
@DeleteMapping
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardBroadcast_del')" )
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardBroadcast_del')")
|
||||
public R removeById(@RequestBody Long[] ids) {
|
||||
return R.ok(hardBroadcastService.removeBatchByIds(CollUtil.toList(ids)));
|
||||
}
|
||||
|
||||
@ResponseExcel
|
||||
@GetMapping("/export")
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardBroadcast_export')" )
|
||||
public List<HardBroadcastEntity> export(HardBroadcastEntity hardBroadcast,Long[] ids) {
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardBroadcast_export')")
|
||||
public List<HardBroadcastEntity> export(HardBroadcastEntity hardBroadcast, Long[] ids) {
|
||||
return hardBroadcastService.list(Wrappers.lambdaQuery(hardBroadcast).in(ArrayUtil.isNotEmpty(ids), HardBroadcastEntity::getId, ids));
|
||||
}
|
||||
}
|
||||
+6
@@ -1,11 +1,17 @@
|
||||
package com.bsd.pjcloud.hard.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
|
||||
import com.bsd.pjcloud.hard.api.dto.HardAuthDto;
|
||||
import com.bsd.pjcloud.hard.api.entity.HardAuthEntity;
|
||||
import com.bsd.pjcloud.hard.api.vo.HardAuthVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@Mapper
|
||||
public interface HardAuthMapper extends PjcloudBaseMapper<HardAuthEntity> {
|
||||
|
||||
Page<HardAuthVo> scopePageJoin(Page page, @Param("dto") HardAuthDto dto, DataScope dataScope);
|
||||
|
||||
}
|
||||
+6
-1
@@ -1,10 +1,15 @@
|
||||
package com.bsd.pjcloud.hard.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
|
||||
import com.bsd.pjcloud.hard.api.dto.HardBroadcastDto;
|
||||
import com.bsd.pjcloud.hard.api.entity.HardBroadcastEntity;
|
||||
import com.bsd.pjcloud.hard.api.vo.HardBroadcastVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@Mapper
|
||||
public interface HardBroadcastMapper extends PjcloudBaseMapper<HardBroadcastEntity> {
|
||||
|
||||
Page<HardBroadcastVo> scopePageJoin(Page page, @Param("dto") HardBroadcastDto dto, DataScope dataScope);
|
||||
}
|
||||
+5
@@ -1,8 +1,13 @@
|
||||
package com.bsd.pjcloud.hard.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.hard.api.dto.HardAuthDto;
|
||||
import com.bsd.pjcloud.hard.api.entity.HardAuthEntity;
|
||||
import com.bsd.pjcloud.hard.api.vo.HardAuthVo;
|
||||
|
||||
public interface HardAuthService extends IService<HardAuthEntity> {
|
||||
|
||||
Page<HardAuthVo> scopePageJoin(Page page, HardAuthDto dto, DataScope dataScope);
|
||||
}
|
||||
+6
@@ -1,8 +1,14 @@
|
||||
package com.bsd.pjcloud.hard.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.hard.api.dto.HardBroadcastDto;
|
||||
import com.bsd.pjcloud.hard.api.entity.HardBroadcastEntity;
|
||||
import com.bsd.pjcloud.hard.api.vo.HardBroadcastVo;
|
||||
|
||||
public interface HardBroadcastService extends IService<HardBroadcastEntity> {
|
||||
|
||||
Page<HardBroadcastVo> scopePageJoin(Page page, HardBroadcastDto dto, DataScope dataScope);
|
||||
|
||||
}
|
||||
+50
@@ -1,14 +1,31 @@
|
||||
package com.bsd.pjcloud.hard.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bsd.pjcloud.admin.api.feign.RemoteUserService;
|
||||
import com.bsd.pjcloud.admin.api.utils.DataUtil;
|
||||
import com.bsd.pjcloud.admin.api.vo.UserVO;
|
||||
import com.bsd.pjcloud.common.core.util.CollectionUtils;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.hard.api.dto.HardAuthDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.manager.HardManagerDto;
|
||||
import com.bsd.pjcloud.hard.api.entity.HardAuthEntity;
|
||||
import com.bsd.pjcloud.hard.api.entity.manager.HardManagerEntity;
|
||||
import com.bsd.pjcloud.hard.api.utils.HardUtil;
|
||||
import com.bsd.pjcloud.hard.api.vo.HardAuthVo;
|
||||
import com.bsd.pjcloud.hard.mapper.HardAuthMapper;
|
||||
import com.bsd.pjcloud.hard.mapper.manager.HardManagerMapper;
|
||||
import com.bsd.pjcloud.hard.service.HardAuthService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 硬件授权
|
||||
*/
|
||||
@@ -17,4 +34,37 @@ import org.springframework.validation.annotation.Validated;
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class HardAuthServiceImpl extends ServiceImpl<HardAuthMapper, HardAuthEntity> implements HardAuthService {
|
||||
|
||||
private final HardManagerMapper hardManagerMapper;
|
||||
|
||||
private final RemoteUserService remoteUserService;
|
||||
|
||||
@Override
|
||||
public Page<HardAuthVo> scopePageJoin(Page page, HardAuthDto dto, DataScope dataScope) {
|
||||
Page<HardAuthVo> pageList = baseMapper.scopePageJoin(page, dto, dataScope);
|
||||
disposeList(pageList.getRecords(), dto);
|
||||
return pageList;
|
||||
}
|
||||
|
||||
private void disposeList(List<HardAuthVo> list, HardAuthDto dto) {
|
||||
if (ObjectUtil.isEmpty(list)) return;
|
||||
// 设备
|
||||
List<Long> hardIds = list.stream().map(HardAuthVo::getHardId).filter(ObjectUtil::isNotEmpty).distinct().toList();
|
||||
if (ObjectUtil.isNotEmpty(hardIds)) {
|
||||
HardManagerDto hardManagerDto = new HardManagerDto();
|
||||
hardManagerDto.setIds(hardIds);
|
||||
List<HardManagerEntity> hardList = hardManagerMapper.list(hardManagerDto);
|
||||
if (ObjectUtil.isNotEmpty(hardList)) {
|
||||
HardUtil.convertHardList(list, CollectionUtils.convertMap(hardList, HardManagerEntity::getId));
|
||||
}
|
||||
}
|
||||
// 用户
|
||||
List<Long> userIds = list.stream().map(HardAuthVo::getUserId).distinct().toList();
|
||||
if (ObjectUtil.isNotEmpty(userIds)) {
|
||||
R<List<UserVO>> userList = remoteUserService.getUserDeptByIds(new ArrayList<>(userIds));
|
||||
if (ObjectUtil.isNotEmpty(userList.getData())) {
|
||||
DataUtil.convertUserDeptList(list, CollectionUtils.convertMap(userList.getData(), UserVO::getUserId));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+58
@@ -1,14 +1,72 @@
|
||||
package com.bsd.pjcloud.hard.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bsd.pjcloud.admin.api.feign.RemoteUserService;
|
||||
import com.bsd.pjcloud.admin.api.utils.DataUtil;
|
||||
import com.bsd.pjcloud.admin.api.vo.UserVO;
|
||||
import com.bsd.pjcloud.common.core.util.CollectionUtils;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.hard.api.dto.HardBroadcastDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.manager.HardManagerDto;
|
||||
import com.bsd.pjcloud.hard.api.entity.HardBroadcastEntity;
|
||||
import com.bsd.pjcloud.hard.api.entity.manager.HardManagerEntity;
|
||||
import com.bsd.pjcloud.hard.api.utils.HardUtil;
|
||||
import com.bsd.pjcloud.hard.api.vo.HardAuthVo;
|
||||
import com.bsd.pjcloud.hard.api.vo.HardBroadcastVo;
|
||||
import com.bsd.pjcloud.hard.mapper.HardBroadcastMapper;
|
||||
import com.bsd.pjcloud.hard.mapper.manager.HardManagerMapper;
|
||||
import com.bsd.pjcloud.hard.service.HardBroadcastService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 设备广播
|
||||
*/
|
||||
@Validated
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class HardBroadcastServiceImpl extends ServiceImpl<HardBroadcastMapper, HardBroadcastEntity> implements HardBroadcastService {
|
||||
|
||||
private final HardManagerMapper hardManagerMapper;
|
||||
|
||||
private final RemoteUserService remoteUserService;
|
||||
|
||||
@Override
|
||||
public Page<HardBroadcastVo> scopePageJoin(Page page, HardBroadcastDto dto, DataScope dataScope) {
|
||||
Page<HardBroadcastVo> pageList = baseMapper.scopePageJoin(page, dto, dataScope);
|
||||
disposeList(pageList.getRecords(), dto);
|
||||
return pageList;
|
||||
}
|
||||
|
||||
private void disposeList(List<HardBroadcastVo> list, HardBroadcastDto dto) {
|
||||
if (ObjectUtil.isEmpty(list)) return;
|
||||
// 设备
|
||||
List<Long> hardIds = list.stream().map(HardBroadcastVo::getHardId).filter(ObjectUtil::isNotEmpty).distinct().toList();
|
||||
if (ObjectUtil.isNotEmpty(hardIds)) {
|
||||
HardManagerDto hardManagerDto = new HardManagerDto();
|
||||
hardManagerDto.setIds(hardIds);
|
||||
List<HardManagerEntity> hardList = hardManagerMapper.list(hardManagerDto);
|
||||
if (ObjectUtil.isNotEmpty(hardList)) {
|
||||
HardUtil.convertHardList(list, CollectionUtils.convertMap(hardList, HardManagerEntity::getId));
|
||||
}
|
||||
}
|
||||
// 用户
|
||||
List<Long> userIds = list.stream().map(HardBroadcastVo::getUserId).distinct().toList();
|
||||
if (ObjectUtil.isNotEmpty(userIds)) {
|
||||
R<List<UserVO>> userList = remoteUserService.getUserDeptByIds(new ArrayList<>(userIds));
|
||||
if (ObjectUtil.isNotEmpty(userList.getData())) {
|
||||
DataUtil.convertUserDeptList(list, CollectionUtils.convertMap(userList.getData(), UserVO::getUserId));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,11 +2,11 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.bsd.pjcloud.hard.mapper.HardAuthMapper">
|
||||
|
||||
<resultMap id="hardAuthMap" type="com.bsd.pjcloud.hard.api.entity.HardAuthEntity">
|
||||
<resultMap id="hardAuthMap" type="com.bsd.pjcloud.hard.api.entity.HardAuthEntity">
|
||||
<id property="id" column="id"/>
|
||||
<result property="userId" column="user_id"/>
|
||||
<result property="hardId" column="hard_id"/>
|
||||
<result property="authType" column="auth_type"/>
|
||||
<result property="authStatus" column="auth_status"/>
|
||||
<result property="authTime" column="auth_time"/>
|
||||
<result property="isDone" column="is_done"/>
|
||||
@@ -17,5 +17,53 @@
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
<result property="tenantId" column="tenant_id"/>
|
||||
</resultMap>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectA">
|
||||
select a.id,
|
||||
a.user_id,
|
||||
a.hard_id,
|
||||
a.auth_type,
|
||||
a.auth_status,
|
||||
a.auth_time,
|
||||
a.is_done,
|
||||
a.is_done_time,
|
||||
a.create_by,
|
||||
a.create_time,
|
||||
a.update_by,
|
||||
a.update_time,
|
||||
a.del_flag,
|
||||
a.tenant_id,
|
||||
</sql>
|
||||
|
||||
<sql id="whereA">
|
||||
a.del_flag = '0'
|
||||
<if test="dto.userId != null">
|
||||
and a.userId = #{dto.userId}
|
||||
</if>
|
||||
<if test="dto.authStatus != null and dto.authStatus != '' ">
|
||||
and a.authStatus = #{dto.auth_status}
|
||||
</if>
|
||||
<if test="dto.isDone != null">
|
||||
and a.is_done = #{dto.isDone}
|
||||
</if>
|
||||
<if test="dto.createTimeList != null and dto.createTimeList.length == 2">
|
||||
and a.create_time between #{dto.createTimeList[0]} and #{dto.createTimeList[1]}
|
||||
</if>
|
||||
<if test="dto.authTimeList != null and dto.authTimeList.length == 2">
|
||||
and a.auth_time between #{dto.authTimeList[0]} and #{dto.authTimeList[1]}
|
||||
</if>
|
||||
<if test="dto.isDoneTimeList != null and dto.isDoneTimeList.length == 2">
|
||||
and a.is_done_time between #{dto.isDoneTimeList[0]} and #{dto.isDoneTimeList[1]}
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<select id="scopePageJoin" resultType="com.bsd.pjcloud.hard.api.vo.HardAuthVo">
|
||||
<include refid="selectA"/>
|
||||
1
|
||||
from hard_auth a
|
||||
<where>
|
||||
<include refid="whereA"/>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
+58
-3
@@ -2,8 +2,7 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.bsd.pjcloud.hard.mapper.HardBroadcastMapper">
|
||||
|
||||
<resultMap id="hardBroadcastMap" type="com.bsd.pjcloud.hard.api.entity.HardBroadcastEntity">
|
||||
<resultMap id="hardBroadcastMap" type="com.bsd.pjcloud.hard.api.entity.HardBroadcastEntity">
|
||||
<id property="id" column="id"/>
|
||||
<result property="userId" column="user_id"/>
|
||||
<result property="hardId" column="hard_id"/>
|
||||
@@ -22,5 +21,61 @@
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
<result property="tenantId" column="tenant_id"/>
|
||||
</resultMap>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectA">
|
||||
select a.id,
|
||||
a.user_id,
|
||||
a.hard_id,
|
||||
a.topic,
|
||||
a.biz_id,
|
||||
a.title,
|
||||
a.content,
|
||||
a.broadcast_count,
|
||||
a.broadcast_max_count,
|
||||
a.is_broadcast,
|
||||
a.is_done,
|
||||
a.is_done_time,
|
||||
a.create_by,
|
||||
a.create_time,
|
||||
a.update_by,
|
||||
a.update_time,
|
||||
a.del_flag,
|
||||
a.tenant_id,
|
||||
</sql>
|
||||
|
||||
<sql id="whereA">
|
||||
a.del_flag = '0'
|
||||
<if test="dto.userId != null">
|
||||
and a.userId = #{dto.userId}
|
||||
</if>
|
||||
<if test="dto.hardId != null">
|
||||
and a.hard_id = #{dto.hardId}
|
||||
</if>
|
||||
<if test="dto.bizId != null">
|
||||
and a.biz_id = #{dto.bizId}
|
||||
</if>
|
||||
<if test="dto.isBroadcast != null">
|
||||
and a.is_broadcast = #{dto.isBroadcast}
|
||||
</if>
|
||||
<if test="dto.isDone != null">
|
||||
and a.is_done = #{dto.isDone}
|
||||
</if>
|
||||
<if test="dto.createTimeList != null and dto.createTimeList.length == 2">
|
||||
and a.create_time between #{dto.createTimeList[0]} and #{dto.createTimeList[1]}
|
||||
</if>
|
||||
<if test="dto.isDoneTimeList != null and dto.isDoneTimeList.length == 2">
|
||||
and a.is_done_time between #{dto.isDoneTimeList[0]} and #{dto.isDoneTimeList[1]}
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<select id="scopePageJoin" resultType="com.bsd.pjcloud.hard.api.vo.HardBroadcastVo">
|
||||
<include refid="selectA"/>
|
||||
1
|
||||
from hard_broadcast a
|
||||
<where>
|
||||
<include refid="whereA"/>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
Reference in new issue
Block a user