add: 手持设备操作记录
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
package org.nl.wms.das.devicecheck.controller;
|
||||
package org.nl.wms.das.device.check.controller;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
@@ -6,8 +6,8 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.base.TableDataInfo;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.nl.wms.das.devicecheck.service.IDasDeviceCheckRecordService;
|
||||
import org.nl.wms.das.devicecheck.service.dao.DasDeviceCheckRecord;
|
||||
import org.nl.wms.das.device.check.service.IDasDeviceCheckRecordService;
|
||||
import org.nl.wms.das.device.check.service.dao.DasDeviceCheckRecord;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
@@ -1,9 +1,9 @@
|
||||
package org.nl.wms.das.devicecheck.service;
|
||||
package org.nl.wms.das.device.check.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.wms.das.devicecheck.service.dao.DasDeviceCheckRecord;
|
||||
import org.nl.wms.das.device.check.service.dao.DasDeviceCheckRecord;
|
||||
import org.nl.wms.pda.service.dao.vo.PdaResponseVo;
|
||||
|
||||
import java.util.Map;
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.nl.wms.das.devicecheck.service.dao;
|
||||
package org.nl.wms.das.device.check.service.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
@@ -1,7 +1,7 @@
|
||||
package org.nl.wms.das.devicecheck.service.dao.mapper;
|
||||
package org.nl.wms.das.device.check.service.dao.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.nl.wms.das.devicecheck.service.dao.DasDeviceCheckRecord;
|
||||
import org.nl.wms.das.device.check.service.dao.DasDeviceCheckRecord;
|
||||
|
||||
/**
|
||||
* @author lyd
|
||||
@@ -1,5 +1,5 @@
|
||||
<?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.nl.wms.das.devicecheck.service.dao.mapper.DasDeviceCheckRecordMapper">
|
||||
<mapper namespace="org.nl.wms.das.device.check.service.dao.mapper.DasDeviceCheckRecordMapper">
|
||||
|
||||
</mapper>
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.nl.wms.das.devicecheck.service.dto;
|
||||
package org.nl.wms.das.device.check.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
@@ -1,7 +1,7 @@
|
||||
package org.nl.wms.das.devicecheck.service.dto;
|
||||
package org.nl.wms.das.device.check.service.dto;
|
||||
|
||||
import org.nl.common.domain.query.BaseQuery;
|
||||
import org.nl.wms.das.devicecheck.service.dao.DasDeviceCheckRecord;
|
||||
import org.nl.wms.das.device.check.service.dao.DasDeviceCheckRecord;
|
||||
|
||||
/**
|
||||
* @author lyd
|
||||
@@ -1,22 +1,19 @@
|
||||
package org.nl.wms.das.devicecheck.service.impl;
|
||||
package org.nl.wms.das.device.check.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.system.service.user.ISysUserService;
|
||||
import org.nl.system.service.user.dao.SysUser;
|
||||
import org.nl.wms.das.devicecheck.service.IDasDeviceCheckRecordService;
|
||||
import org.nl.wms.das.devicecheck.service.dao.mapper.DasDeviceCheckRecordMapper;
|
||||
import org.nl.wms.das.devicecheck.service.dao.DasDeviceCheckRecord;
|
||||
import org.nl.wms.das.device.check.service.IDasDeviceCheckRecordService;
|
||||
import org.nl.wms.das.device.check.service.dao.mapper.DasDeviceCheckRecordMapper;
|
||||
import org.nl.wms.das.device.check.service.dao.DasDeviceCheckRecord;
|
||||
import org.nl.wms.pda.service.dao.vo.PdaResponseVo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -0,0 +1,66 @@
|
||||
package org.nl.wms.das.device.operation.controller;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.base.TableDataInfo;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.nl.wms.das.device.operation.service.IDasDeviceOperationRecordService;
|
||||
import org.nl.wms.das.device.operation.service.dao.DasDeviceOperationRecord;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
/**
|
||||
* @author lyd
|
||||
* @date 2023-08-09
|
||||
**/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Api(tags = "设备动作操作记录管理")
|
||||
@RequestMapping("/api/dasDeviceOperationRecord")
|
||||
public class DasDeviceOperationRecordController {
|
||||
|
||||
@Autowired
|
||||
private IDasDeviceOperationRecordService dasDeviceOperationRecordService;
|
||||
|
||||
@GetMapping
|
||||
@Log("查询设备动作操作记录")
|
||||
@ApiOperation("查询设备动作操作记录")
|
||||
//@SaCheckPermission("@el.check('dasDeviceOperationRecord:list')")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, PageQuery page){
|
||||
return new ResponseEntity<>(TableDataInfo.build(dasDeviceOperationRecordService.queryAll(whereJson,page)),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增设备动作操作记录")
|
||||
@ApiOperation("新增设备动作操作记录")
|
||||
//@SaCheckPermission("@el.check('dasDeviceOperationRecord:add')")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody DasDeviceOperationRecord entity){
|
||||
dasDeviceOperationRecordService.create(entity);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改设备动作操作记录")
|
||||
@ApiOperation("修改设备动作操作记录")
|
||||
//@SaCheckPermission("@el.check('dasDeviceOperationRecord:edit')")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody DasDeviceOperationRecord entity){
|
||||
dasDeviceOperationRecordService.update(entity);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("删除设备动作操作记录")
|
||||
@ApiOperation("删除设备动作操作记录")
|
||||
//@SaCheckPermission("@el.check('dasDeviceOperationRecord:del')")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody Set<String> ids) {
|
||||
dasDeviceOperationRecordService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package org.nl.wms.das.device.operation.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.wms.das.device.operation.service.dao.DasDeviceOperationRecord;
|
||||
import org.nl.wms.pda.service.dao.vo.PdaResponseVo;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @description 服务接口
|
||||
* @author lyd
|
||||
* @date 2023-08-09
|
||||
**/
|
||||
public interface IDasDeviceOperationRecordService extends IService<DasDeviceOperationRecord> {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
* @param whereJson 条件
|
||||
* @param pageable 分页参数
|
||||
* @return IPage<DasDeviceOperationRecord>
|
||||
*/
|
||||
IPage<DasDeviceOperationRecord> queryAll(Map whereJson, PageQuery pageable);
|
||||
|
||||
/**
|
||||
* 创建
|
||||
* @param entity /
|
||||
*/
|
||||
PdaResponseVo create(DasDeviceOperationRecord entity);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param entity /
|
||||
*/
|
||||
void update(DasDeviceOperationRecord entity);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(Set<String> ids);
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package org.nl.wms.das.device.operation.service.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @description /
|
||||
* @author lyd
|
||||
* @date 2023-08-09
|
||||
**/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("das_device_operation_record")
|
||||
public class DasDeviceOperationRecord implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "record_id", type = IdType.NONE)
|
||||
@ApiModelProperty(value = "记录标识")
|
||||
private String record_id;
|
||||
|
||||
@ApiModelProperty(value = "账号")
|
||||
private String username;
|
||||
|
||||
@ApiModelProperty(value = "用户名")
|
||||
private String person_name;
|
||||
|
||||
@ApiModelProperty(value = "记录时间")
|
||||
private String record_time;
|
||||
|
||||
@ApiModelProperty(value = "设备号")
|
||||
private String device_code;
|
||||
|
||||
@ApiModelProperty(value = "动作")
|
||||
private String device_action;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package org.nl.wms.das.device.operation.service.dao.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.nl.wms.das.device.operation.service.dao.DasDeviceOperationRecord;
|
||||
|
||||
/**
|
||||
* @author lyd
|
||||
* @date 2023-08-09
|
||||
**/
|
||||
public interface DasDeviceOperationRecordMapper extends BaseMapper<DasDeviceOperationRecord> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<?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.nl.wms.das.device.operation.service.dao.mapper.DasDeviceOperationRecordMapper">
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,31 @@
|
||||
package org.nl.wms.das.device.operation.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @description /
|
||||
* @author lyd
|
||||
* @date 2023-08-09
|
||||
**/
|
||||
@Data
|
||||
public class DasDeviceOperationRecordDto implements Serializable {
|
||||
|
||||
/** 记录标识 */
|
||||
private String record_id;
|
||||
|
||||
/** 账号 */
|
||||
private String username;
|
||||
|
||||
/** 用户名 */
|
||||
private String person_name;
|
||||
|
||||
/** 记录时间 */
|
||||
private String record_time;
|
||||
|
||||
/** 设备号 */
|
||||
private String device_code;
|
||||
|
||||
/** 动作 */
|
||||
private String device_action;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package org.nl.wms.das.device.operation.service.dto;
|
||||
|
||||
import org.nl.common.domain.query.BaseQuery;
|
||||
import org.nl.wms.das.device.operation.service.dao.DasDeviceOperationRecord;
|
||||
|
||||
/**
|
||||
* @author lyd
|
||||
* @date 2023-08-09
|
||||
**/
|
||||
public class DasDeviceOperationRecordQuery extends BaseQuery<DasDeviceOperationRecord> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package org.nl.wms.das.device.operation.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.system.service.user.ISysUserService;
|
||||
import org.nl.system.service.user.dao.SysUser;
|
||||
import org.nl.wms.das.device.operation.service.IDasDeviceOperationRecordService;
|
||||
import org.nl.wms.das.device.operation.service.dao.mapper.DasDeviceOperationRecordMapper;
|
||||
import org.nl.wms.das.device.operation.service.dao.DasDeviceOperationRecord;
|
||||
import org.nl.wms.pda.service.dao.vo.PdaResponseVo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @description 服务实现
|
||||
* @author lyd
|
||||
* @date 2023-08-09
|
||||
**/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class DasDeviceOperationRecordServiceImpl extends ServiceImpl<DasDeviceOperationRecordMapper, DasDeviceOperationRecord> implements IDasDeviceOperationRecordService {
|
||||
|
||||
@Autowired
|
||||
private DasDeviceOperationRecordMapper dasDeviceOperationRecordMapper;
|
||||
@Autowired
|
||||
private ISysUserService userService;
|
||||
|
||||
@Override
|
||||
public IPage<DasDeviceOperationRecord> queryAll(Map whereJson, PageQuery page){
|
||||
LambdaQueryWrapper<DasDeviceOperationRecord> lam = new LambdaQueryWrapper<>();
|
||||
IPage<DasDeviceOperationRecord> pages = new Page<>(page.getPage() + 1, page.getSize());
|
||||
dasDeviceOperationRecordMapper.selectPage(pages, lam);
|
||||
return pages;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PdaResponseVo create(DasDeviceOperationRecord entity) {
|
||||
SysUser sysUser = userService.getOne(new LambdaQueryWrapper<SysUser>()
|
||||
.eq(SysUser::getUsername, entity.getUsername()));
|
||||
entity.setRecord_id(IdUtil.getSnowflake(1, 1).nextIdStr());
|
||||
entity.setRecord_time(DateUtil.now());
|
||||
entity.setPerson_name(sysUser.getPerson_name());
|
||||
dasDeviceOperationRecordMapper.insert(entity);
|
||||
return PdaResponseVo.pdaResultOk("设备[" + entity.getDevice_code() + "]动作切换成功,操作人: " + sysUser.getPerson_name());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(DasDeviceOperationRecord entity) {
|
||||
DasDeviceOperationRecord dto = dasDeviceOperationRecordMapper.selectById(entity.getRecord_id());
|
||||
if (dto == null) throw new BadRequestException("被删除或无权限,操作失败!");
|
||||
entity.setRecord_time(DateUtil.now());
|
||||
|
||||
dasDeviceOperationRecordMapper.updateById(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteAll(Set<String> ids) {
|
||||
// 真删除
|
||||
dasDeviceOperationRecordMapper.deleteBatchIds(ids);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,14 +1,14 @@
|
||||
package org.nl.wms.pda.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.nl.wms.das.devicecheck.service.IDasDeviceCheckRecordService;
|
||||
import org.nl.wms.das.devicecheck.service.dao.DasDeviceCheckRecord;
|
||||
import org.nl.wms.das.device.check.service.IDasDeviceCheckRecordService;
|
||||
import org.nl.wms.das.device.check.service.dao.DasDeviceCheckRecord;
|
||||
import org.nl.wms.das.device.operation.service.IDasDeviceOperationRecordService;
|
||||
import org.nl.wms.das.device.operation.service.dao.DasDeviceOperationRecord;
|
||||
import org.nl.wms.pda.service.PdaService;
|
||||
import org.nl.wms.pdm.workorder.service.dao.PdmBdWorkorder;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
@@ -31,6 +31,8 @@ public class PdaController {
|
||||
@Autowired
|
||||
private IDasDeviceCheckRecordService deviceCheckRecordService;
|
||||
@Autowired
|
||||
private IDasDeviceOperationRecordService deviceOperationRecordService;
|
||||
@Autowired
|
||||
private PdaService pdaService;
|
||||
@PostMapping("/deviceCheck/verify")
|
||||
@Log("设备点检")
|
||||
@@ -53,4 +55,17 @@ public class PdaController {
|
||||
return new ResponseEntity<>(pdaService.getDeviceStatus(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/deviceSwitchover/deviceAction")
|
||||
@Log("设备动作下拉框数据")
|
||||
@ApiOperation("设备动作下拉框数据")
|
||||
public ResponseEntity<Object> deviceAction(){
|
||||
return new ResponseEntity<>(pdaService.deviceAction(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/deviceSwitchover/verify")
|
||||
@Log("设备动作切换")
|
||||
@ApiOperation("设备动作切换")
|
||||
public ResponseEntity<Object> deviceSwitchover(@Validated @RequestBody DasDeviceOperationRecord entity){
|
||||
return new ResponseEntity<>(deviceOperationRecordService.create(entity), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,4 +13,6 @@ public interface PdaService {
|
||||
List<DropdownListVo> getDeviceInfo();
|
||||
|
||||
List<DropdownListVo> getDeviceStatus();
|
||||
|
||||
List<DropdownListVo> deviceAction();
|
||||
}
|
||||
|
||||
@@ -29,4 +29,9 @@ public class PdaServiceImpl implements PdaService {
|
||||
public List<DropdownListVo> getDeviceStatus() {
|
||||
return pdaMapper.getDictByCode("device_status");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DropdownListVo> deviceAction() {
|
||||
return pdaMapper.getDictByCode("device_action");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user