功能修改

master
zhouxinyu 11 months ago
parent 1ffd6befdf
commit ad674601b1
  1. 1
      src/main/java/org/springblade/modules/business/contraller/DeviceController.java
  2. 107
      src/main/java/org/springblade/modules/business/contraller/DeviceTypeController.java
  3. 3
      src/main/java/org/springblade/modules/business/contraller/FeedbackController.java
  4. 3
      src/main/java/org/springblade/modules/business/contraller/MaintenanceController.java
  5. 35
      src/main/java/org/springblade/modules/business/mapper/DeviceTypeMapper.java
  6. 45
      src/main/java/org/springblade/modules/business/mapper/DeviceTypeMapper.xml
  7. 49
      src/main/java/org/springblade/modules/business/pojo/dto/DeviceTypeDTO.java
  8. 111
      src/main/java/org/springblade/modules/business/pojo/entity/DeviceType.java
  9. 91
      src/main/java/org/springblade/modules/business/pojo/entity/DeviceTypeVO.java
  10. 36
      src/main/java/org/springblade/modules/business/service/IDeviceTypeService.java
  11. 83
      src/main/java/org/springblade/modules/business/service/impl/DeviceTypeServiceImpl.java
  12. 8
      src/main/java/org/springblade/modules/system/controller/UserRegisterController.java
  13. 15
      src/main/java/org/springblade/modules/system/service/impl/UserServiceImpl.java

@ -120,6 +120,7 @@ public class DeviceController extends BladeController {
wrapper.like(StringUtils.isNotBlank(device.getSupplier()), Device::getSupplier, device.getSupplier());
wrapper.eq(device.getLimsId() != null, Device::getLimsId, device.getLimsId());
wrapper.eq(device.getRunStatus() != null, Device::getRunStatus, device.getRunStatus());
wrapper.like(StringUtils.isNotBlank(device.getLimsName()), Device::getLimsName, device.getLimsName());
if (device.getCreateUser() != null) {
User user1 = userService.getById(device.getCreateUser());
wrapper.eq(Device::getLimsId, user1.getDeptId());

@ -0,0 +1,107 @@
package org.springblade.modules.business.contraller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.Valid;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.secure.BladeUser;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.constant.BladeConstant;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.modules.business.pojo.dto.DeviceDTO;
import org.springblade.modules.business.pojo.entity.Device;
import org.springblade.modules.business.pojo.entity.DeviceType;
import org.springblade.modules.business.pojo.entity.DeviceTypeVO;
import org.springblade.modules.business.service.IDeviceAttachService;
import org.springblade.modules.business.service.IDeviceMaintenanceService;
import org.springblade.modules.business.service.IDeviceService;
import org.springblade.modules.business.service.IDeviceTypeService;
import org.springblade.modules.system.pojo.entity.Dept;
import org.springblade.modules.system.pojo.entity.User;
import org.springblade.modules.system.pojo.vo.DeptVO;
import org.springblade.modules.system.service.IDeptService;
import org.springblade.modules.system.service.IUserService;
import org.springblade.modules.system.wrapper.DeptWrapper;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 设备类型表 控制器
*
* @author BladeX
* @since 2024-10-14
*/
@Slf4j
@RestController
@AllArgsConstructor
@RequestMapping("/deviceType")
public class DeviceTypeController extends BladeController {
private final IDeviceTypeService typeService;
/**
* 设备表 详情
*/
@GetMapping("/detail")
@ApiOperationSupport(order = 1)
public R<DeviceType> detail(DeviceType type) {
DeviceType detail = typeService.getOne(Condition.getQueryWrapper(type));
return R.data(detail);
}
/**
* 懒加载列表
*/
@GetMapping("/lazy-list")
@Parameters({
@Parameter(name = "typeName", description = "分类名称", in = ParameterIn.QUERY, schema = @Schema(type = "string")),
@Parameter(name = "typeNameSymbol", description = "分类简称", in = ParameterIn.QUERY, schema = @Schema(type = "string"))
})
@ApiOperationSupport(order = 3)
@Operation(summary = "懒加载列表", description = "传入dept")
public R<List<DeviceTypeVO>> lazyList(@Parameter(hidden = true) @RequestParam Map<String, Object> dept, Long parentId) {
List<DeviceTypeVO> list = typeService.lazyList(parentId, dept);
return R.data(list);
}
/**
* 设备表 新增或修改
*/
@PostMapping("/submit")
@ApiOperationSupport(order = 6)
public R submit(@Valid @RequestBody DeviceType device) {
device.setTenantId(AuthUtil.getTenantId());
device.setIsDeleted(BladeConstant.DB_NOT_DELETED);
return R.status(typeService.saveOrUpdate(device));
}
/**
* 设备表 删除
*/
@PostMapping("/remove")
@ApiOperationSupport(order = 7)
public R remove(@RequestParam String ids) {
return R.status(typeService.deleteLogic(Func.toLongList(ids)));
}
}

@ -123,7 +123,8 @@ public class FeedbackController extends BladeController {
@ApiOperationSupport(order = 4)
public R save(@RequestBody Feedback feedback) {
feedback.setCode("编码格式待定");
feedback.setUnitName("测试单位名称");
Dept dept = deptService.getById(AuthUtil.getDeptId());
feedback.setUnitName(dept.getDeptName());
feedback.setStatus(0);
boolean saveOrUpdate = feedbackService.saveOrUpdate(feedback);

@ -249,6 +249,9 @@ public class MaintenanceController extends BladeController {
public R taskCustomerConfirm(@RequestBody MaintenanceTask task) {
MaintenanceTask taskOld = taskService.getById(task.getId());
taskOld.setTaskStatus(MaintenanceStatusEnum.TASK_CUSTOMER_CONFIRM.getValue());
taskOld.setApproveResult(task.getApproveResult());
taskOld.setApprovePerson(task.getApprovePerson());
taskOld.setApproveRemark(task.getApproveRemark());
taskService.updateById(taskOld);
//发送消息
String role = "1839536982874193922";

@ -0,0 +1,35 @@
package org.springblade.modules.business.mapper;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Param;
import org.springblade.modules.business.excel.DeviceExcel;
import org.springblade.modules.business.pojo.entity.Device;
import org.springblade.modules.business.pojo.entity.DeviceType;
import org.springblade.modules.business.pojo.entity.DeviceTypeVO;
import org.springblade.modules.business.pojo.vo.DeviceVO;
import org.springblade.modules.business.pojo.vo.PieStatVO;
import org.springblade.modules.system.pojo.vo.DeptVO;
import java.util.List;
import java.util.Map;
/**
* 设备表 Mapper 接口
*
* @author BladeX
* @since 2024-10-14
*/
public interface DeviceTypeMapper extends BaseMapper<DeviceType> {
/**
* 懒加载部门列表
*
* @param parentId
* @param param
* @return
*/
List<DeviceTypeVO> lazyList(Long parentId, Map<String, Object> param);
}

@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.springblade.modules.business.mapper.DeviceTypeMapper">
<!-- 通用查询映射结果 -->
<resultMap id="deviceResultMap" type="org.springblade.modules.business.pojo.entity.DeviceType">
</resultMap>
<resultMap id="deptVOResultMap" type="org.springblade.modules.business.pojo.entity.DeviceTypeVO">
<id column="id" property="id"/>
<result column="parent_id" property="parentId"/>
<result column="type_name" property="typeName"/>
<result column="type_name_symbol" property="typeNameSymbol"/>
<result column="sort" property="sort"/>
<result column="remark" property="remark"/>
<result column="is_deleted" property="isDeleted"/>
<result column="has_children" property="hasChildren"/>
</resultMap>
<select id="lazyList" resultMap="deptVOResultMap">
SELECT
type.* ,
(
SELECT
CASE WHEN count(1) > 0 THEN 1 ELSE 0 END
FROM
lab_device_type
WHERE
parent_id = type.id and is_deleted = 0
) AS "has_children"
FROM
lab_device_type type
WHERE type.is_deleted = 0
<if test="parentId!=null">
and type.parent_id = #{parentId}
</if>
<if test="param.typeName!=null and param.typeName!=''">
and type.type_name like concat(concat('%', #{param.typeName}),'%')
</if>
<if test="param.typeNameSymbol!=null and param.typeNameSymbol!=''">
and type.type_name_symbol like concat(concat('%', #{param.typeNameSymbol}),'%')
</if>
ORDER BY type.sort
</select>
</mapper>

@ -0,0 +1,49 @@
package org.springblade.modules.business.pojo.dto;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.modules.business.pojo.entity.Device;
import org.springblade.modules.business.pojo.entity.DeviceAttach;
import org.springblade.modules.business.pojo.entity.DeviceMaintenance;
import java.util.List;
/**
* 设备表 数据传输对象实体类
*
* @author BladeX
* @since 2024-10-14
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class DeviceTypeDTO extends Device {
private static final long serialVersionUID = 1L;
// 设备名称
private String name;
// 设备位置
private String position;
// 设备类型
private String type;
// 供应商
private String supplier;
//品牌
private String brand;
//状态
private Integer runStatus;
//实验室id
private Long limsId;
//单位
private String unit;
//用户
private Long createUser;
}

@ -0,0 +1,111 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.modules.business.pojo.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springblade.core.mp.base.BaseEntity;
import java.io.Serial;
import java.io.Serializable;
/**
* 实体类
*
* @author Chill
*/
@Data
@TableName("lab_device_type")
@Schema(description = "设备类型表")
public class DeviceType extends BaseEntity {
/**
* 主键
*/
@JsonSerialize(using = ToStringSerializer.class)
@Schema(description = "主键")
@TableId(value = "id", type = IdType.ASSIGN_ID)
private Long id;
/**
* 租户ID
*/
@Schema(description = "租户ID")
private String tenantId;
/**
* 父主键
*/
@JsonSerialize(using = ToStringSerializer.class)
@Schema(description = "父主键")
private Long parentId;
/**
* 类型名称
*/
@Schema(description = "类型名称")
private String typeName;
/**
* 类型名称
*/
@Schema(description = "类型简称")
private String typeNameSymbol;
/**
* 排序
*/
@Schema(description = "排序")
private Integer sort;
/**
* 备注
*/
@Schema(description = "备注")
private String remark;
/**
* 业务状态
*/
@Schema(description = "业务状态")
private Integer status;
/**
* 是否已删除
*/
@TableLogic
@Schema(description = "是否已删除")
private Integer isDeleted;
}

@ -0,0 +1,91 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.modules.business.pojo.entity;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.tool.node.INode;
import org.springblade.modules.system.pojo.entity.Dept;
import java.io.Serial;
import java.util.ArrayList;
import java.util.List;
/**
* 视图实体类
*
* @author Chill
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Schema(description = "DeviceTypeVO对象")
public class DeviceTypeVO extends DeviceType implements INode<DeviceTypeVO> {
@Serial
private static final long serialVersionUID = 1L;
/**
* 主键ID
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
/**
* 父节点ID
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long parentId;
/**
* 子孙节点
*/
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private List<DeviceTypeVO> children;
/**
* 是否有子孙节点
*/
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private Boolean hasChildren;
@Override
public List<DeviceTypeVO> getChildren() {
if (this.children == null) {
this.children = new ArrayList<>();
}
return this.children;
}
/**
* 上级机构
*/
private String parentName;
}

@ -0,0 +1,36 @@
package org.springblade.modules.business.service;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.core.mp.base.BaseService;
import org.springblade.modules.business.excel.DeviceExcel;
import org.springblade.modules.business.excel.DeviceImportExcel;
import org.springblade.modules.business.pojo.dto.DeviceDTO;
import org.springblade.modules.business.pojo.entity.Device;
import org.springblade.modules.business.pojo.entity.DeviceType;
import org.springblade.modules.business.pojo.entity.DeviceTypeVO;
import org.springblade.modules.business.pojo.vo.DeviceVO;
import org.springblade.modules.business.pojo.vo.PieStatVO;
import org.springblade.modules.system.pojo.vo.DeptVO;
import java.util.List;
import java.util.Map;
/**
* 设备类型表 服务类
*
* @author BladeX
* @since 2025-02-10
*/
public interface IDeviceTypeService extends BaseService<DeviceType> {
/**
* 懒加载部门列表
*
* @param parentId
* @param param
* @return
*/
List<DeviceTypeVO> lazyList(Long parentId, Map<String, Object> param);
}

@ -0,0 +1,83 @@
package org.springblade.modules.business.service.impl;
import com.aliyun.oss.ServiceException;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.google.zxing.WriterException;
import lombok.AllArgsConstructor;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springblade.common.cache.DictCache;
import org.springblade.common.cache.SysCache;
import org.springblade.common.constant.CommonConstant;
import org.springblade.common.enums.DictEnum;
import org.springblade.common.utils.CommonUtil;
import org.springblade.core.mp.base.BaseEntity;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.node.ForestNodeMerger;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.StringPool;
import org.springblade.modules.business.excel.DeviceExcel;
import org.springblade.modules.business.excel.DeviceImportExcel;
import org.springblade.modules.business.mapper.DeviceMapper;
import org.springblade.modules.business.mapper.DeviceTypeMapper;
import org.springblade.modules.business.pojo.dto.DeviceDTO;
import org.springblade.modules.business.pojo.entity.*;
import org.springblade.modules.business.pojo.vo.DeviceVO;
import org.springblade.modules.business.pojo.vo.PieStatVO;
import org.springblade.modules.business.service.IDeviceAttachService;
import org.springblade.modules.business.service.IDeviceMaintenanceService;
import org.springblade.modules.business.service.IDeviceService;
import org.springblade.modules.business.service.IDeviceTypeService;
import org.springblade.modules.system.pojo.entity.Dept;
import org.springblade.modules.system.pojo.vo.DeptVO;
import org.springblade.modules.system.service.IDeptService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.io.IOException;
import java.util.*;
import java.util.stream.Collectors;
/**
* 设备表 服务实现类
*
* @author BladeX
* @since 2024-10-14
*/
@Service
@AllArgsConstructor
public class DeviceTypeServiceImpl extends BaseServiceImpl<DeviceTypeMapper, DeviceType> implements IDeviceTypeService {
private static final String PARENT_ID = "parentId";
@Override
public List<DeviceTypeVO> lazyList(Long parentId, Map<String, Object> param) {
Object o = param.get(PARENT_ID);
int size = param.size();
// 判断点击搜索但是没有查询条件的情况
if (Func.isEmpty(param.get(PARENT_ID)) && param.size() == 1) {
parentId = 0L;
}
// // 判断数据权限控制,非超管角色只可看到本级及以下数据
// if (Func.toLong(parentId) == 0L && !AuthUtil.isAdministrator()) {
// Long deptId = Func.firstLong(AuthUtil.getDeptId());
// Dept dept = SysCache.getDept(deptId);
// if (dept.getParentId() != 0) {
// parentId = dept.getParentId();
// }
// }
// 判断点击搜索带有查询条件的情况
if (Func.isEmpty(param.get(PARENT_ID)) && param.size() > 1 && Func.toLong(parentId) == 0L) {
parentId = null;
}
return baseMapper.lazyList(parentId, param);
}
}

@ -115,7 +115,13 @@ public class UserRegisterController {
user1.setDeptName(user.getDeptName());
user1.setParentDeptName(user.getParentDeptName());
user1.setStatus(1);
return R.status(userService.updateUser(user1));
boolean b = userService.updateUser(user1);
if (b) {
Dept dept = deptService.getById(user1.getDeptId());
dept.setLabAddress(user1.getAddress());
deptService.updateById(dept);
}
return R.status(b);
}
/**

@ -55,10 +55,7 @@ import org.springblade.modules.system.mapper.UserMapper;
import org.springblade.modules.system.pojo.entity.*;
import org.springblade.modules.system.pojo.vo.LimsUserVO;
import org.springblade.modules.system.pojo.vo.UserVO;
import org.springblade.modules.system.service.IRoleService;
import org.springblade.modules.system.service.IUserDeptService;
import org.springblade.modules.system.service.IUserOauthService;
import org.springblade.modules.system.service.IUserService;
import org.springblade.modules.system.service.*;
import org.springblade.modules.system.wrapper.UserWrapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -85,6 +82,7 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
private final IRoleService roleService;
private final BladeTenantProperties tenantProperties;
private final BladeRedis bladeRedis;
private final IDeptService deptService;
@Override
@Transactional(rollbackFor = Exception.class)
@ -157,7 +155,14 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
throw new ServiceException(StringUtil.format("当前手机 [{}] 已存在!", user.getPhone()));
}
user.setPassword(null);
return updateById(user);
boolean b = updateById(user);
if (b) {
User user1 = getById(user.getId());
Dept dept = deptService.getById(user1.getDeptId());
dept.setLabAddress(user.getAddress());
deptService.updateById(dept);
}
return b;
}
private boolean submitUserDept(User user) {

Loading…
Cancel
Save