新增功能:无人机、单兵设备审批

This commit is contained in:
lizhicheng 2022-09-21 21:57:38 +08:00
parent 98ae1d69bd
commit 51682736e6
31 changed files with 1061 additions and 2 deletions

View File

@ -0,0 +1,35 @@
CREATE TABLE `t_meetingroom` (
`id` bigint NOT NULL AUTO_INCREMENT,
`num` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '房间号',
`name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '名称',
`area` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '面积',
`capacity` int DEFAULT NULL COMMENT '可容纳人数',
`pic` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '会议室图片',
`description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '描述',
`create_date` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`modify_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
`del_flag` int DEFAULT '0' COMMENT '是否删除',
`creator` bigint DEFAULT NULL COMMENT '创建者',
`modifier` bigint DEFAULT NULL COMMENT '修改者',
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=100 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='会议室';
CREATE TABLE `t_meetingroom_book` (
`id` bigint NOT NULL AUTO_INCREMENT,
`room_id` bigint NOT NULL COMMENT '会议室id',
`book_date` datetime DEFAULT NULL COMMENT '预约日期',
`start_time` datetime DEFAULT NULL COMMENT '预约开始时间',
`end_time` datetime DEFAULT NULL COMMENT '预约结束时间',
`name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '预约人',
`phone` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '联系电话',
`dept` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '预约部门',
`matter` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '使用事项',
`file` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '附件',
`create_date` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`creator` bigint DEFAULT NULL COMMENT '创建者',
`state` int DEFAULT '0' COMMENT '审核状态',
`audit_viem` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '审核意见',
`auditor` bigint DEFAULT NULL COMMENT '审核者',
`audit_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '审核时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=100 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='会议室预约';

View File

@ -0,0 +1,5 @@
ALTER TABLE `t_meetingroom`
MODIFY COLUMN `pic` varchar(8000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '会议室图片' AFTER `capacity`;
ALTER TABLE `t_meetingroom_book`
MODIFY COLUMN `matter` varchar(8000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '使用事项' AFTER `dept`;

View File

@ -0,0 +1,3 @@
alter table `tb_data_resource`
ADD COLUMN `undercarriage_title` varchar(255) NULL comment '下架申请标题' ,
ADD COLUMN `undercarriage_phone` varchar(255) NULL comment '下架申请电话';

View File

@ -0,0 +1,2 @@
alter table `tb_data_resource`
ADD COLUMN `undercarriage_enclosure_name` varchar(255) NULL comment '下架申请文件名';

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
alter table sys_user add column yw_mobile varchar(100);

View File

@ -0,0 +1,57 @@
CREATE TABLE `tb_device`
(
`id` bigint NOT NULL AUTO_INCREMENT,
`name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '名称',
`description` varchar(4096) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '描述',
`type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '类型',
`dept_id` bigint DEFAULT NULL COMMENT '所属部门',
`del_flag` int DEFAULT '0' COMMENT '是否删除',
`creator` bigint DEFAULT NULL COMMENT '创建人',
`create_date` datetime DEFAULT NULL COMMENT '创建时间',
`updater` bigint DEFAULT NULL COMMENT '修改人',
`update_date` datetime DEFAULT NULL COMMENT '修改时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB
AUTO_INCREMENT = 100
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci
ROW_FORMAT = DYNAMIC COMMENT ='设备表';
CREATE TABLE `tb_device_attr`
(
`id` bigint NOT NULL AUTO_INCREMENT,
`device_id` bigint DEFAULT NULL COMMENT '设备id',
`attr_type` varchar(255) DEFAULT NULL COMMENT '属性类型',
`attr_value` varchar(4096) DEFAULT NULL COMMENT '属性值',
`del_flag` int DEFAULT '0' COMMENT '是否删除',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB
AUTO_INCREMENT = 100
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci
ROW_FORMAT = DYNAMIC COMMENT ='设备属性表';
CREATE TABLE `tb_device_apply`
(
`id` bigint NOT NULL AUTO_INCREMENT,
`device_id` bigint DEFAULT NULL COMMENT '设备id',
`name` varchar(255) DEFAULT NULL COMMENT '申请人',
`phone` varchar(255) DEFAULT NULL COMMENT '联系电话',
`dept` varchar(255) DEFAULT NULL COMMENT '申请人部门',
`title` varchar(255) DEFAULT NULL COMMENT '申请标题',
`application_system` varchar(255) DEFAULT NULL COMMENT '应用系统',
`application_area` varchar(255) DEFAULT NULL COMMENT '应用领域',
`demand` varchar(4096) DEFAULT NULL COMMENT '需求依据',
`creator` bigint DEFAULT NULL COMMENT '创建者',
`creat_date` datetime DEFAULT NULL COMMENT '创建时间',
`state` int DEFAULT '0' COMMENT '审核状态',
`audit_viem` varchar(255) DEFAULT NULL COMMENT '审核意见',
`auditor` bigint DEFAULT NULL COMMENT '审核者',
`audit_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '审核时间',
`del_flag` int DEFAULT '0' COMMENT '是否删除',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB
AUTO_INCREMENT = 100
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci
ROW_FORMAT = DYNAMIC COMMENT ='设备申请表';

View File

@ -5,6 +5,7 @@ import io.renren.common.annotation.ActivitiNoticeOperation;
import io.renren.modules.notice.dto.SysNoticeDTO;
import io.renren.modules.notice.enums.NoticeStatusEnum;
import io.renren.modules.notice.service.SysNoticeService;
import io.renren.modules.processForm.dto.TAbilityApplicationDTO;
import io.renren.modules.resource.service.ResourceService;
import io.renren.modules.sys.dto.SysDeptDTO;
import io.renren.modules.sys.dto.SysRoleDTO;
@ -137,7 +138,13 @@ public class ActivitiNoticeAspect {
}
final StringBuilder resourceName = new StringBuilder();
if (kv.containsKey("resourceDTO")) {
resourceName.append("'");
resourceName.append(((Map) kv.get("resourceDTO")).get("name"));
resourceName.append("'");
}else if(kv.containsKey("tAbilityApplicationDTOList")){
resourceName.append("'");
resourceName.append(((List<TAbilityApplicationDTO>) kv.get("tAbilityApplicationDTOList")).get(0).getTitle());
resourceName.append("'");
}
final String workKey = TaskListener.EVENTNAME_COMPLETE + key;
if (work.contains(workKey)) {
@ -226,7 +233,13 @@ public class ActivitiNoticeAspect {
}
final StringBuilder resourceName = new StringBuilder();
if (kv.containsKey("resourceDTO")) {
resourceName.append("'");
resourceName.append(((Map) kv.get("resourceDTO")).get("name"));
resourceName.append("'");
}else if(kv.containsKey("tAbilityApplicationDTOList")){
resourceName.append("'");
resourceName.append(((List<TAbilityApplicationDTO>) kv.get("tAbilityApplicationDTOList")).get(0).getTitle());
resourceName.append("'");
}
final String workKey = ExecutionListener.EVENTNAME_END + key;
if (work.contains(workKey)) {
@ -344,7 +357,13 @@ public class ActivitiNoticeAspect {
}
final StringBuilder resourceName = new StringBuilder();
if (kv.containsKey("resourceDTO")) {
resourceName.append("'");
resourceName.append(((Map) kv.get("resourceDTO")).get("name"));
resourceName.append("'");
}else if(kv.containsKey("tAbilityApplicationDTOList")){
resourceName.append("'");
resourceName.append(((List<TAbilityApplicationDTO>) kv.get("tAbilityApplicationDTOList")).get(0).getTitle());
resourceName.append("'");
}
final String workKey = TaskListener.EVENTNAME_ASSIGNMENT + key;
if (work.contains(workKey)) {

View File

@ -0,0 +1,175 @@
package io.renren.modules.device.controller;
import io.renren.common.annotation.LogOperation;
import io.renren.common.constant.Constant;
import io.renren.common.page.PageData;
import io.renren.common.utils.Result;
import io.renren.common.validator.ValidatorUtils;
import io.renren.common.validator.group.AddGroup;
import io.renren.common.validator.group.DefaultGroup;
import io.renren.common.validator.group.UpdateGroup;
import io.renren.modules.device.dto.TbDeviceApplyDTO;
import io.renren.modules.device.service.TbDeviceApplyService;
import io.renren.modules.device.service.TbDeviceService;
import io.renren.modules.notice.dto.SysNoticeDTO;
import io.renren.modules.notice.enums.NoticeStatusEnum;
import io.renren.modules.notice.service.SysNoticeService;
import io.renren.modules.security.user.SecurityUser;
import io.renren.modules.sys.dto.SysRoleDTO;
import io.renren.modules.sys.dto.SysUserDTO;
import io.renren.modules.sys.service.SysDeptService;
import io.renren.modules.sys.service.SysRoleService;
import io.renren.modules.sys.service.SysUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import java.util.Date;
import java.util.Map;
/**
* @Auther:lizhicheng2@hisense.com
* @date:2022/9/20
* @des
*/
@Api(tags = "设备申请")
@RestController
@RequestMapping("deviceApply")
public class TbDeviceApplyController {
@Value("${big_date.name}")
private String bigDateDeptName; // 大数据局名称
@Value("${big_date.default_assignee_role_id}")
private String defaultAssigneeRoleId; // 当某部门未设置部门审批人时将使用该用户审批
@Value("${big_date.assignee_role_name}")
private String roleName; // 具备审批的角色名称
@Autowired
TbDeviceApplyService tbDeviceApplyService;
@Autowired
SysNoticeService sysNoticeService;
@Autowired
SysRoleService sysRoleService;
@Autowired
SysDeptService sysDeptService;
@Autowired
SysUserService sysUserService;
@Autowired
TbDeviceService tbDeviceService;
@GetMapping("{id}")
@ApiOperation("查看申请信息")
public Result<TbDeviceApplyDTO> get(@PathVariable("id") Long id){
TbDeviceApplyDTO data = tbDeviceApplyService.get(id);
return new Result<TbDeviceApplyDTO>().ok(data);
}
@GetMapping("auditPage")
@ApiOperation("分页查询申请记录(管理端)")
@ApiImplicitParams({
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码从1开始", paramType = "query", required = true, dataType="int") ,
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") ,
@ApiImplicitParam(name = "deviceName", value = "设备名称", paramType = "query", dataType="String"),
@ApiImplicitParam(name = "state", value = "申请状态", paramType = "query", dataType="int")
})
public Result<PageData<TbDeviceApplyDTO>> auditPage(@ApiIgnore @RequestParam Map<String, Object> params){
PageData<TbDeviceApplyDTO> page = tbDeviceApplyService.queryAuditList(params);
return new Result<PageData<TbDeviceApplyDTO>>().ok(page);
}
@PostMapping
@ApiOperation("新增申请")
@LogOperation("新增")
public Result save(@RequestBody TbDeviceApplyDTO dto) {
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
dto.setCreator(SecurityUser.getUserId());
dto.setCreatDate(new Date());
if(dto.getDeviceName()==null){
dto.setDeviceName(tbDeviceService.get(dto.getDeviceId()).getName());
}
// 发起预约后推送消息
SysRoleDTO roleDTO = sysRoleService.getByName(roleName);
SysUserDTO userDTO = sysUserService.getByDeptIdAndRoleId(sysDeptService.getByName(bigDateDeptName).getId(), roleDTO.getId());
dto.setAuditor(userDTO==null ? Long.parseLong(defaultAssigneeRoleId) : userDTO.getId());
tbDeviceApplyService.save(dto);
String content = "【通知】请审核" + dto.getName() + "发起的" + dto.getDeviceName() +
"设备申请";
SysNoticeDTO sysNoticeDTO = new SysNoticeDTO();
sysNoticeDTO.setType(2);
sysNoticeDTO.setTitle("设备申请审核通知");
sysNoticeDTO.setContent(content); // 通知内容
sysNoticeDTO.setReceiverType(1);
sysNoticeDTO.setReceiverTypeIds(userDTO==null ? defaultAssigneeRoleId : userDTO.getId().toString());
sysNoticeDTO.setStatus(NoticeStatusEnum.SEND.value());
sysNoticeDTO.setSenderName("流程系统");
sysNoticeDTO.setSenderDate(new Date());
sysNoticeDTO.setCreator(dto.getCreator());
sysNoticeDTO.setCreateDate(new Date());
sysNoticeDTO.setFrom("通知");
sysNoticeService.save(sysNoticeDTO);
// 还要发送自己能看到的的谁给我审核的消息
String ownedContent = "【通知】您发起的" + dto.getDeviceName() +
"设备申请,当前审核部门为:" + bigDateDeptName + ",审核负责人:" + userDTO.getRealName();
SysNoticeDTO ownedSysNoticeDTO = new SysNoticeDTO();
ownedSysNoticeDTO.setType(2);
ownedSysNoticeDTO.setTitle("设备申请发起通知");
ownedSysNoticeDTO.setContent(ownedContent); // 通知内容
ownedSysNoticeDTO.setReceiverType(1);
ownedSysNoticeDTO.setReceiverTypeIds(dto.getCreator().toString());
ownedSysNoticeDTO.setStatus(NoticeStatusEnum.SEND.value());
ownedSysNoticeDTO.setSenderName("流程系统");
ownedSysNoticeDTO.setSenderDate(new Date());
ownedSysNoticeDTO.setCreator(dto.getCreator());
ownedSysNoticeDTO.setCreateDate(new Date());
ownedSysNoticeDTO.setFrom("通知");
sysNoticeService.save(ownedSysNoticeDTO);
return new Result();
}
@PutMapping
@ApiOperation("审核")
@LogOperation("修改")
public Result update(@RequestBody TbDeviceApplyDTO dto) {
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
dto.setAuditTime(new Date());
tbDeviceApplyService.update(dto);
if(dto.getDeviceName()==null){
dto.setDeviceName(tbDeviceService.get(dto.getDeviceId()).getName());
}
// 修改之后推送存通知sysNotice
String state = dto.getState() == 2 ? "通过" : "不通过";
SysUserDTO userDTO=sysUserService.get(dto.getAuditor());
String content = "【通知】" + dto.getName() + ",您发起的" + dto.getDeviceName() +
"设备申请,审核结果为:" + state + ",请联系技术人员:"+userDTO.getRealName()+",手机号:"+userDTO.getMobile()+"获取设备";
SysNoticeDTO sysNoticeDTO = new SysNoticeDTO();
sysNoticeDTO.setType(2);
sysNoticeDTO.setTitle("设备申请审核结果通知");
sysNoticeDTO.setContent(content); // 通知内容
sysNoticeDTO.setReceiverType(1);
sysNoticeDTO.setReceiverTypeIds(dto.getCreator().toString());
sysNoticeDTO.setStatus(NoticeStatusEnum.SEND.value());
sysNoticeDTO.setSenderName("流程系统");
sysNoticeDTO.setSenderDate(new Date());
sysNoticeDTO.setCreator(dto.getAuditor());
sysNoticeDTO.setCreateDate(new Date());
sysNoticeDTO.setFrom("通知");
sysNoticeService.save(sysNoticeDTO);
return new Result();
}
}

View File

@ -0,0 +1,83 @@
package io.renren.modules.device.controller;
import io.renren.common.annotation.LogOperation;
import io.renren.common.constant.Constant;
import io.renren.common.page.PageData;
import io.renren.common.utils.Result;
import io.renren.common.validator.ValidatorUtils;
import io.renren.common.validator.group.AddGroup;
import io.renren.common.validator.group.DefaultGroup;
import io.renren.common.validator.group.UpdateGroup;
import io.renren.modules.device.dto.TbDeviceDTO;
import io.renren.modules.device.service.TbDeviceAttrService;
import io.renren.modules.device.service.TbDeviceService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import java.util.Map;
/**
* @Auther:lizhicheng2@hisense.com
* @date:2022/9/20
* @des
*/
@Api(tags="设备")
@RestController
@RequestMapping("device")
public class TbDeviceController {
@Autowired
TbDeviceService tbDeviceService;
@Autowired
TbDeviceAttrService tbDeviceAttrService;
@GetMapping("page")
@ApiOperation("分页")
@ApiImplicitParams({
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码从1开始", paramType = "query", required = true, dataType="int") ,
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") ,
@ApiImplicitParam(name = "type", value = "设备类型", paramType = "query",dataType="String") ,
})
public Result<PageData<TbDeviceDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){
PageData<TbDeviceDTO> page = tbDeviceService.page(params);
return new Result<PageData<TbDeviceDTO>>().ok(page);
}
@GetMapping("{id}")
@ApiOperation("信息")
@LogOperation("信息")
public Result<TbDeviceDTO> get(@PathVariable("id") Long id) {
return new Result<TbDeviceDTO>().ok(tbDeviceService.getDeviceById(id));
}
@PostMapping
@ApiOperation("新增")
@LogOperation("新增")
public Result save(@RequestBody TbDeviceDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
tbDeviceService.save(dto);
dto.getDeviceAttrDTOList().stream().forEach(attr->{
attr.setDeviceId(dto.getId());
tbDeviceAttrService.save(attr);
});
return new Result();
}
@PutMapping
@ApiOperation("修改、删除")
@LogOperation("修改、删除")
public Result update(@RequestBody TbDeviceDTO dto) {
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
return new Result().ok(tbDeviceService.updateDevice(dto));
}
}

View File

@ -0,0 +1,20 @@
package io.renren.modules.device.dao;
import io.renren.common.dao.BaseDao;
import io.renren.modules.device.entity.TbDeviceApplyEntity;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
import java.util.Map;
/**
* @Auther:lizhicheng2@hisense.com
* @date:2022/9/20
* @des
*/
@Mapper
public interface TbDeviceApplyDao extends BaseDao<TbDeviceApplyEntity> {
List queryListForAudit(Map params);
}

View File

@ -0,0 +1,14 @@
package io.renren.modules.device.dao;
import io.renren.common.dao.BaseDao;
import io.renren.modules.device.entity.TbDeviceAttrEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* @Auther:lizhicheng2@hisense.com
* @date:2022/9/20
* @des
*/
@Mapper
public interface TbDeviceAttrDao extends BaseDao<TbDeviceAttrEntity> {
}

View File

@ -0,0 +1,21 @@
package io.renren.modules.device.dao;
import io.renren.common.dao.BaseDao;
import io.renren.modules.device.dto.TbDeviceDTO;
import io.renren.modules.device.entity.TbDeviceEntity;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
import java.util.Map;
/**
* @Auther:lizhicheng2@hisense.com
* @date:2022/9/20
* @des
*/
@Mapper
public interface TbDeviceDao extends BaseDao<TbDeviceEntity> {
List<TbDeviceDTO> getDeviceDTOList(Map params);
}

View File

@ -0,0 +1,55 @@
package io.renren.modules.device.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* @Auther:lizhicheng2@hisense.com
* @date:2022/9/20
* @des
*/
@Data
@ApiModel(value = "设备申请")
public class TbDeviceApplyDTO implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键,新增时不传")
private Long id;
@ApiModelProperty(value = "设备id")
private Long deviceId;
@ApiModelProperty(value = "申请标题")
private String title;
@ApiModelProperty(value = "申请人")
private String name;
@ApiModelProperty(value = "联系电话")
private String phone;
@ApiModelProperty(value = "预约部门")
private String dept;
@ApiModelProperty(value = "应用系统")
private String applicationSystem;
@ApiModelProperty(value = "应用领域")
private String applicationArea;
@ApiModelProperty(value = "需求依据")
private String demand;
@ApiModelProperty(value = "创建者")
private Long creator;
@ApiModelProperty(value = "创建时间")
private Date creatDate;
@ApiModelProperty(value = "审核状态")
private Integer state;
@ApiModelProperty(value = "审核意见")
private String auditViem;
@ApiModelProperty(value = "审核者")
private Long auditor;
@ApiModelProperty(value = "审核时间")
private Date auditTime;
@ApiModelProperty(value = "删除标志")
private Integer delFlag;
private String deviceName;
}

View File

@ -0,0 +1,27 @@
package io.renren.modules.device.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @Auther:lizhicheng2@hisense.com
* @date:2022/9/20
* @des
*/
@Data
@ApiModel(value = "设备属性表")
public class TbDeviceAttrDTO {
@ApiModelProperty(value = "主键,新增时不传")
private Long id;
@ApiModelProperty(value = "设备id")
private Long deviceId;
@ApiModelProperty(value = "属性类型")
private String attrType;
@ApiModelProperty(value = "属性值")
private String attrValue;
@ApiModelProperty(value = "删除标志")
private Integer delFlag;
}

View File

@ -0,0 +1,45 @@
package io.renren.modules.device.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* @Auther:lizhicheng2@hisense.com
* @date:2022/9/20
* @des
*/
@Data
@ApiModel(value = "设备表")
public class TbDeviceDTO implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键,新增时不传")
private Long id;
@ApiModelProperty(value = "名称")
private String name;
@ApiModelProperty(value = "描述")
private String description;
@ApiModelProperty(value = "类型")
private String type;
@ApiModelProperty(value = "所属部门")
private Long deptId;
@ApiModelProperty(value = "审核状态0-待审批1-未申请2-通过3-不通过")
private Integer state;
@ApiModelProperty(value = "是否删除0-未删除1-删除")
private Integer delFlag;
@ApiModelProperty(value = "创建人")
private Long creator;
@ApiModelProperty(value = "创建时间")
private Date createDate;
@ApiModelProperty(value = "修改人")
private Long updater;
@ApiModelProperty(value = "更新时间")
private Date updateDate;
@ApiModelProperty(value = "设备属性表")
private List<TbDeviceAttrDTO> deviceAttrDTOList;
}

View File

@ -0,0 +1,103 @@
package io.renren.modules.device.entity;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* @Auther:lizhicheng2@hisense.com
* @date:2022/9/20
* @des
*/
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("tb_device_apply")
public class TbDeviceApplyEntity {
private static final long serialVersionUID = 1L;
@TableId
private Long id;
/**
* 设备id
*/
private Long deviceId;
/**
* 申请标题
*/
private String title;
/**
* 申请人
*/
private String name;
/**
* 联系电话
*/
private String phone;
/**
* 预约部门
*/
private String dept;
/**
* 应用系统
*/
private String applicationSystem;
/**
* 应用领域
*/
private String applicationArea;
/**
* 需求依据
*/
private String demand;
/**
* 创建者
*/
@TableField(fill = FieldFill.INSERT)
private Long creator;
/**
* 创建时间
*/
@TableField(fill = FieldFill.INSERT)
private Long creatDate;
/**
* 审核状态
*/
private Integer state;
/**
* 审核意见
*/
private String auditViem;
/**
* 审核者
*/
private Long auditor;
/**
* 审核时间
*/
private Date auditTime;
/**
* 删除标志
*/
private Integer delFlag;
}

View File

@ -0,0 +1,37 @@
package io.renren.modules.device.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* @Auther:lizhicheng2@hisense.com
* @date:2022/9/20
* @des
*/
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("tb_device_attr")
public class TbDeviceAttrEntity {
private static final long serialVersionUID = 1L;
@TableId
private Long id;
/**
* 设备id
*/
private Long deviceId;
/**
* 属性类型
*/
private String attrType;
/**
* 属性值
*/
private String attrValue;
/**
* 删除标志
*/
private Integer delFlag;
}

View File

@ -0,0 +1,65 @@
package io.renren.modules.device.entity;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import io.renren.common.entity.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* @Auther:lizhicheng2@hisense.com
* @date:2022/9/20
* @des
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("tb_device")
public class TbDeviceEntity extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 名称
*/
private String name;
/**
* 描述
*/
private String description;
/**
* 类型
*/
private String type;
/**
* 所属部门
*/
@TableField(fill = FieldFill.INSERT)
private Long deptId;
/**
* 删除标志
*/
private Integer delFlag;
/**
* 创建人
*/
@TableField(fill = FieldFill.INSERT)
private Long creator;
/**
* 创建时间
*/
@TableField(fill = FieldFill.INSERT)
private Date createDate;
/**
* 修改人
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
private Long updater;
/**
* 更新时间
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
private Date updateDate;
}

View File

@ -0,0 +1,53 @@
package io.renren.modules.device.service.Impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.renren.common.page.PageData;
import io.renren.common.service.impl.CrudServiceImpl;
import io.renren.modules.device.dao.TbDeviceApplyDao;
import io.renren.modules.device.dto.TbDeviceApplyDTO;
import io.renren.modules.device.entity.TbDeviceApplyEntity;
import io.renren.modules.device.service.TbDeviceApplyService;
import io.renren.modules.fuse.dto.TbFuseDTO;
import io.renren.modules.meeting.dto.TMeetingroomBookDTO;
import io.renren.modules.security.user.SecurityUser;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @Auther:lizhicheng2@hisense.com
* @date:2022/9/20
* @des
*/
@Service
public class TbDeviceApplyServiceImpl extends CrudServiceImpl<TbDeviceApplyDao, TbDeviceApplyEntity, TbDeviceApplyDTO> implements TbDeviceApplyService {
@Autowired
private TbDeviceApplyDao tbDeviceApplyDao;
@Override
public QueryWrapper<TbDeviceApplyEntity> getWrapper(Map<String, Object> params) {
return null;
}
@Override
public PageData<TbDeviceApplyDTO> queryAuditList(Map<String, Object> params) {
//分页参数
int curPage = 1;
int limit = 10;
if(params.containsKey("limit") && StringUtils.isNotBlank(params.get("limit").toString())){
limit = Integer.parseInt(params.get("limit").toString());
}
if(params.containsKey("page") && StringUtils.isNotBlank(params.get("page").toString())){
curPage = Integer.parseInt(params.get("page").toString());
}
params.put("userId", SecurityUser.getUserId());
List<TbDeviceApplyDTO> dtoList = tbDeviceApplyDao.queryListForAudit(params);
List<TbDeviceApplyDTO> result = dtoList.stream().skip((curPage - 1) * limit).limit(limit).collect(Collectors.toList());
return new PageData(result, dtoList.size());
}
}

View File

@ -0,0 +1,24 @@
package io.renren.modules.device.service.Impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.renren.common.service.impl.CrudServiceImpl;
import io.renren.modules.device.dao.TbDeviceAttrDao;
import io.renren.modules.device.dto.TbDeviceAttrDTO;
import io.renren.modules.device.entity.TbDeviceAttrEntity;
import io.renren.modules.device.service.TbDeviceAttrService;
import org.springframework.stereotype.Service;
import java.util.Map;
/**
* @Auther:lizhicheng2@hisense.com
* @date:2022/9/20
* @des
*/
@Service
public class TbDeviceAttrServiceImpl extends CrudServiceImpl<TbDeviceAttrDao, TbDeviceAttrEntity, TbDeviceAttrDTO> implements TbDeviceAttrService {
@Override
public QueryWrapper<TbDeviceAttrEntity> getWrapper(Map<String, Object> params) {
return null;
}
}

View File

@ -0,0 +1,94 @@
package io.renren.modules.device.service.Impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.renren.common.constant.Constant;
import io.renren.common.page.PageData;
import io.renren.common.service.impl.CrudServiceImpl;
import io.renren.modules.device.dao.TbDeviceAttrDao;
import io.renren.modules.device.dao.TbDeviceDao;
import io.renren.modules.device.dto.TbDeviceAttrDTO;
import io.renren.modules.device.dto.TbDeviceDTO;
import io.renren.modules.device.entity.TbDeviceAttrEntity;
import io.renren.modules.device.entity.TbDeviceEntity;
import io.renren.modules.device.service.TbDeviceService;
import io.renren.modules.security.user.SecurityUser;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @Auther:lizhicheng2@hisense.com
* @date:2022/9/20
* @des
*/
@Service
public class TbDeviceServiceImpl extends CrudServiceImpl<TbDeviceDao, TbDeviceEntity, TbDeviceDTO> implements TbDeviceService {
@Autowired
TbDeviceAttrDao tbDeviceAttrDao;
@Override
public QueryWrapper<TbDeviceEntity> getWrapper(Map<String, Object> params) {
return null;
}
@Override
public PageData<TbDeviceDTO> page(Map<String, Object> params) {
long curPage = 1;
long limit = 10;
if (params.get(Constant.PAGE) != null) {
curPage = Long.parseLong((String) params.get(Constant.PAGE));
}
if (params.get(Constant.LIMIT) != null) {
limit = Long.parseLong((String) params.get(Constant.LIMIT));
}
params.put("userId", SecurityUser.getUserId());
List<TbDeviceDTO> dtoList = baseDao.getDeviceDTOList(params);
dtoList.forEach(dto -> {
dto.setDeviceAttrDTOList(getAttrByDeviceId(dto.getId()));
});
List<TbDeviceDTO> result = dtoList.stream().skip((curPage - 1) * limit).limit(limit).collect(Collectors.toList());
return new PageData(result, dtoList.size());
}
private List<TbDeviceAttrDTO> getAttrByDeviceId(Long deviceId) {
QueryWrapper wrapper = new QueryWrapper();
wrapper.eq("device_id", deviceId);
List<TbDeviceAttrEntity> list = tbDeviceAttrDao.selectList(wrapper);
return list.stream().map(attr -> {
TbDeviceAttrDTO dto = new TbDeviceAttrDTO();
BeanUtils.copyProperties(attr, dto);
return dto;
}).collect(Collectors.toList());
}
@Override
public TbDeviceDTO getDeviceById(Long id) {
TbDeviceEntity deviceEntity = baseDao.selectById(id);
if(deviceEntity==null){
return null;
}
TbDeviceDTO deviceDTO = new TbDeviceDTO();
BeanUtils.copyProperties(deviceEntity, deviceDTO);
deviceDTO.setDeviceAttrDTOList(getAttrByDeviceId(id));
return deviceDTO;
}
@Override
@Transactional(rollbackFor = Exception.class)
public Integer updateDevice(TbDeviceDTO dto) {
TbDeviceEntity deviceEntity = new TbDeviceEntity();
BeanUtils.copyProperties(dto, deviceEntity);
dto.getDeviceAttrDTOList().forEach(deviceAttrDTO -> {
TbDeviceAttrEntity deviceAttrEntity = new TbDeviceAttrEntity();
BeanUtils.copyProperties(deviceAttrDTO, deviceAttrEntity);
tbDeviceAttrDao.updateById(deviceAttrEntity);
});
return baseDao.updateById(deviceEntity);
}
}

View File

@ -0,0 +1,19 @@
package io.renren.modules.device.service;
import io.renren.common.page.PageData;
import io.renren.common.service.CrudService;
import io.renren.modules.device.dto.TbDeviceApplyDTO;
import io.renren.modules.device.entity.TbDeviceApplyEntity;
import java.util.Map;
/**
* @Auther:lizhicheng2@hisense.com
* @date:2022/9/20
* @des
*/
public interface TbDeviceApplyService extends CrudService<TbDeviceApplyEntity, TbDeviceApplyDTO> {
PageData<TbDeviceApplyDTO> queryAuditList(Map<String, Object> params);
}

View File

@ -0,0 +1,14 @@
package io.renren.modules.device.service;
import io.renren.common.service.CrudService;
import io.renren.modules.device.dto.TbDeviceAttrDTO;
import io.renren.modules.device.entity.TbDeviceAttrEntity;
/**
* @Auther:lizhicheng2@hisense.com
* @date:2022/9/20
* @des
*/
public interface TbDeviceAttrService extends CrudService<TbDeviceAttrEntity, TbDeviceAttrDTO> {
}

View File

@ -0,0 +1,17 @@
package io.renren.modules.device.service;
import io.renren.common.service.CrudService;
import io.renren.modules.device.dto.TbDeviceDTO;
import io.renren.modules.device.entity.TbDeviceEntity;
/**
* @Auther:lizhicheng2@hisense.com
* @date:2022/9/20
* @des
*/
public interface TbDeviceService extends CrudService<TbDeviceEntity, TbDeviceDTO> {
TbDeviceDTO getDeviceById(Long id);
Integer updateDevice(TbDeviceDTO dto);
}

View File

@ -74,7 +74,7 @@ public class CorrectionListenerV2 implements TaskListener, ExecutionListener, Ac
private TAbilityApplicationService tAbilityApplicationService;
@Override
@ActivitiNoticeOperation(value = "资源部门负责人审批", process = "能力申请流程v2")
@ActivitiNoticeOperation(value = "资源部门负责人审批", process = "能力申请流程")
public void notify(DelegateTask delegateTask) {
logger.error("-------------------------进入部门动态审批人流程-------------------------------");
final String eventName = delegateTask.getEventName();
@ -91,7 +91,7 @@ public class CorrectionListenerV2 implements TaskListener, ExecutionListener, Ac
}
@Override
@ActivitiNoticeOperation(value = "流程结束", process = "能力申请流程v2", type = 2)
@ActivitiNoticeOperation(value = "流程结束", process = "能力申请流程", type = 2)
public void notify(DelegateExecution delegateExecution) throws Exception {
logger.error("----------------------进入部门审批结束节点---------------------------");
delegateExecution.getProcessBusinessKey();

View File

@ -0,0 +1,17 @@
<?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="io.renren.modules.device.dao.TbDeviceApplyDao">
<select id="queryListForAudit" resultType="io.renren.modules.device.dto.TbDeviceApplyDTO">
select * from tb_device_apply
where 1=1
<if test="userId != null and userId != ''">
and auditor = #{userId}
</if>
<if test="state != null and state != ''">
and state = #{state}
</if>
</select>
</mapper>

View File

@ -0,0 +1,7 @@
<?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="io.renren.modules.device.dao.TbDeviceAttrDao">
</mapper>

View File

@ -0,0 +1,32 @@
<?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="io.renren.modules.device.dao.TbDeviceDao">
<resultMap id="deviceDTO" type="io.renren.modules.device.dto.TbDeviceDTO">
<result property="id" column="id"/>
<result property="name" column="name"/>
<result property="description" column="description"/>
<result property="deptId" column="dept_id"/>
<result property="type" column="type"/>
<result property="state" column="state"/>
<result property="delFlag" column="del_flag"/>
<result property="creator" column="creator"/>
<result property="createDate" column="create_date"/>
<result property="updater" column="updater"/>
<result property="updateDate" column="update_date"/>
</resultMap>
<select id="getDeviceDTOList" resultMap="deviceDTO">
select td.*, IFNULL(tda.state,1) as state from tb_device td left join tb_device_apply tda on td.id=tda.device_id
<if test="userId != null and userId != ''">
and tda.creator = #{userId}
</if>
where 1=1
<if test="type != null and type != ''">
and type = #{type}
</if>
ORDER BY td.create_date desc
</select>
</mapper>