Commit 32bd3ce7 authored by 廖旭伟's avatar 廖旭伟

增加设备模块表

parent 3a1b91a3
......@@ -1207,6 +1207,232 @@ msg|String|消息|-
}
```
### 查询证照柜设备模块列表
**请求URL:** device/module/list
**请求方式:** POST
**内容类型:** application/json;charset=utf-8
**简要描述:** 查询证照柜设备模块
**请求参数:**
参数名称|类型|必填|描述
:---|:---|:---|:------
page|Integer|否|当前页
size|Integer|否|每页条数,值为-1,查询所有记录
**请求样例:**
```
{
"page":1,
"size":10
}
```
**响应参数:**
参数名称|参数类型|描述
:---|:---|:------
code|Integer|结果码(-1.失败,1.成功)
msg|String|消息
data|object|数据对象
 per_page|Integer|每页条数
 total|Integer|总条数
 last_page|Integer|总页数
 current_page|Integer|当前页
 data|array|结果集列表|数组
  id|Long|序号,主键,自增长
  deviceId|Long|设备Id
  deviceName|String|设备名称
  moduleName|String|模块名称
  productName|String|产品名称
  networkAddress|String|网络地址
  cartonType|String|纸盒
  createUserId|Long|创建用户
  createTime|Date|创建时间
  updateUserId|Long|更新用户
  updateTime|Date|更新时间
dict|object|字典对象
**响应消息样例:**
```
{
"code":1,
"data":{
}
}
```
### 查看证照柜设备模块
**请求URL:** device/module/info
**请求方式:** GET
**内容类型:** application/json;charset=utf-8
**简要描述:** 查看证照柜设备模块,返回实例详细信息
**请求参数:**
参数名称|类型|必填|描述
:---|:---|:---|:------
id|Long|是|ID
**请求样例:**
```
http://localhost/device/module/info?id=549
```
**响应参数:**
参数名称 |参数类型|描述
:---|:---|:-------
code|Integer|结果码(-1.失败,1.成功)
msg|String|消息
data|object|数据对象
 id|Long|序号,主键,自增长
 deviceId|Long|设备Id
 deviceName|String|设备名称
 moduleName|String|模块名称
 productName|String|产品名称
 networkAddress|String|网络地址
 cartonType|String|纸盒
 createUserId|Long|创建用户
 createTime|Date|创建时间
 updateUserId|Long|更新用户
 updateTime|Date|更新时间
dict|object|字典对象
**响应消息样例:**
```
{
"code": 1,
"data": {
"id":1223,
"deviceId":9452,
"deviceName":"2p4d5m",
"moduleName":"natbvq",
"productName":"7h9dq2",
"networkAddress":"s2a58c",
"cartonType":"h35dsu",
"createUserId":8676,
"createTime":"2022-10-26",
"updateUserId":845,
"updateTime":"2022-10-26"
}
}
```
### 保存更新证照柜设备模块
**请求URL:** device/module/save
**请求方式:** POST
**内容类型:** application/json;charset=utf-8
**简要描述:** 保存或更新证照柜设备模块:id为空时为新增保存,否则为更新提交
**请求参数:**
参数名称|类型|必填|描述
:---|:---|:---|:-------
id|Long|否|序号,主键,自增长
deviceName|String|是|设备名称
moduleName|String|是|模块名称
productName|String|是|产品名称
networkAddress|String|是|网络地址
cartonType|String|是|纸盒
createUserId|Long|否|创建用户
createTime|Date|否|创建时间
updateUserId|Long|否|更新用户
updateTime|Date|否|更新时间
**请求样例:**
```
{
"deviceId":4045,
"deviceName":"9bqrsn",
"moduleName":"awiz1g",
"productName":"xub2jg",
"networkAddress":"bhkrd2",
"cartonType":"6f0co4",
}
```
**响应参数:**
参数名称 |参数类型|描述
:---|:---|:------
code|Integer|结果码(-1.失败,1.成功)
msg|String|消息
data|object|数据对象
 id|Long|保存后主键id
 entity|object|保存更新实体
  id|Long|序号,主键,自增长
  deviceId|Long|设备Id
  deviceName|String|设备名称
  moduleName|String|模块名称
  productName|String|产品名称
  networkAddress|String|网络地址
  cartonType|String|纸盒
  createUserId|Long|创建用户
  createTime|Date|创建时间
  updateUserId|Long|更新用户
  updateTime|Date|更新时间
**响应消息样例:**
```
{
"msg":"新增模块成功",
"code":1,
"data":{}
}
}
```
### 删除证照柜设备模块
**请求URL:** device/module/delete
**请求方式:** GET
**内容类型:** application/json;charset=utf-8
**简要描述:** 删除证照柜设备模块
**请求参数:**
参数名称|类型|必填|描述
:---|:---|:---|:------
id|String|是|数组
**请求样例:**
```
http://localhost:8080/device/module/delete?id=1&id=2'
```
**响应参数:**
参数名称 |参数类型|备注|其它
---|---|---|---
code|Integer|结果码(-1.失败,1.成功)|-
msg|String|消息|-
**响应消息样例:**
```
{
"code":1,
"msg":"成功"
}
```
## 证照申请
### 查询证照申请列表
......
package com.mortals.xhx.common.code;
import com.mortals.framework.ap.SysConstains;
import com.mortals.framework.common.IBaseEnum;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* 纸盒类型
*/
public enum CartonType implements IBaseEnum {
A1(1, "A1", SysConstains.STYLE_DEFAULT),
A2(2, "A2", SysConstains.STYLE_DEFAULT),
A3(3, "A3", SysConstains.STYLE_DEFAULT),
A4(4, "A4", SysConstains.STYLE_DEFAULT),
A5(5, "A5", SysConstains.STYLE_DEFAULT);
private int value;
private String desc;
private String style;
CartonType(int value, String desc, String style) {
this.value = value;
this.desc = desc;
this.style = style;
}
@Override
public int getValue() {
return this.value;
}
public String getDesc() {
return desc;
}
public String getStyle()
{
return style;
}
public static CartonType getByValue(int value) {
for (CartonType e : CartonType.values()) {
if (e.getValue() == value) {
return e;
}
}
return null;
}
public static Map<String,String> getEnumMap(int... eItem) {
Map<String,String> resultMap= new LinkedHashMap<String,String>();
for (CartonType item : CartonType.values()) {
try{
boolean hasE = false;
for (int e : eItem){
if(item.getValue()==e){
hasE = true;
break;
}
}
if(!hasE){
resultMap.put(item.getValue()+"", item.getDesc());
}
}catch(Exception ex){
}
}
return resultMap;
}
}
\ No newline at end of file
......@@ -45,19 +45,19 @@ public enum ResolutionEnum {
return null;
}
public static Map<String,String> getEnumMap(int... eItem) {
public static Map<String,String> getEnumMap(String... eItem) {
Map<String,String> resultMap= new LinkedHashMap<String,String>();
for (ResolutionEnum item : ResolutionEnum.values()) {
try{
boolean hasE = false;
for (int e : eItem){
for (String e : eItem){
if(item.getValue().equals(e)){
hasE = true;
break;
}
}
if(!hasE){
resultMap.put(item.getValue()+"", item.getDesc());
resultMap.put(item.getValue(), item.getDesc());
}
}catch(Exception ex){
}
......
package com.mortals.xhx.module.device.dao;
import com.mortals.framework.dao.ICRUDDao;
import com.mortals.xhx.module.device.model.DeviceModuleEntity;
import java.util.List;
/**
* 证照柜设备Dao
* 证照柜设备 DAO接口
*
* @author zxfei
* @date 2022-10-26
*/
public interface DeviceModuleDao extends ICRUDDao<DeviceModuleEntity,Long>{
}
package com.mortals.xhx.module.device.dao.ibatis;
import org.springframework.stereotype.Repository;
import com.mortals.xhx.module.device.dao.DeviceModuleDao;
import com.mortals.xhx.module.device.model.DeviceModuleEntity;
import java.util.Date;
import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
import java.util.List;
/**
* 证照柜设备DaoImpl DAO接口
*
* @author zxfei
* @date 2022-10-26
*/
@Repository("deviceModuleDao")
public class DeviceModuleDaoImpl extends BaseCRUDDaoMybatis<DeviceModuleEntity,Long> implements DeviceModuleDao {
}
package com.mortals.xhx.module.device.model;
import java.util.List;
import java.util.ArrayList;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mortals.framework.annotation.Excel;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.device.model.vo.DeviceModuleVo;
/**
* 证照柜设备实体对象
*
* @author zxfei
* @date 2022-10-26
*/
public class DeviceModuleEntity extends DeviceModuleVo {
private static final long serialVersionUID = 1L;
/**
* 设备Id
*/
private Long deviceId;
/**
* 设备名称
*/
private String deviceName;
/**
* 模块名称
*/
private String moduleName;
/**
* 产品名称
*/
private String productName;
/**
* 网络地址
*/
private String networkAddress;
/**
* 纸盒
*/
private String cartonType;
public DeviceModuleEntity(){}
/**
* 获取 设备Id
* @return Long
*/
public Long getDeviceId(){
return deviceId;
}
/**
* 设置 设备Id
* @param deviceId
*/
public void setDeviceId(Long deviceId){
this.deviceId = deviceId;
}
/**
* 获取 设备名称
* @return String
*/
public String getDeviceName(){
return deviceName;
}
/**
* 设置 设备名称
* @param deviceName
*/
public void setDeviceName(String deviceName){
this.deviceName = deviceName;
}
/**
* 获取 模块名称
* @return String
*/
public String getModuleName(){
return moduleName;
}
/**
* 设置 模块名称
* @param moduleName
*/
public void setModuleName(String moduleName){
this.moduleName = moduleName;
}
/**
* 获取 产品名称
* @return String
*/
public String getProductName(){
return productName;
}
/**
* 设置 产品名称
* @param productName
*/
public void setProductName(String productName){
this.productName = productName;
}
/**
* 获取 网络地址
* @return String
*/
public String getNetworkAddress(){
return networkAddress;
}
/**
* 设置 网络地址
* @param networkAddress
*/
public void setNetworkAddress(String networkAddress){
this.networkAddress = networkAddress;
}
/**
* 获取 纸盒
* @return String
*/
public String getCartonType(){
return cartonType;
}
/**
* 设置 纸盒
* @param cartonType
*/
public void setCartonType(String cartonType){
this.cartonType = cartonType;
}
@Override
public int hashCode() {
return this.getId().hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj == null) return false;
if (obj instanceof DeviceModuleEntity) {
DeviceModuleEntity tmp = (DeviceModuleEntity) obj;
if (this.getId() == tmp.getId()) {
return true;
}
}
return false;
}
public String toString(){
StringBuilder sb = new StringBuilder("");
sb.append(",deviceId:").append(getDeviceId());
sb.append(",deviceName:").append(getDeviceName());
sb.append(",moduleName:").append(getModuleName());
sb.append(",productName:").append(getProductName());
sb.append(",networkAddress:").append(getNetworkAddress());
sb.append(",cartonType:").append(getCartonType());
return sb.toString();
}
public void initAttrValue(){
this.deviceId = null;
this.deviceName = "";
this.moduleName = "";
this.productName = "";
this.networkAddress = "";
this.cartonType = "";
}
}
\ No newline at end of file
package com.mortals.xhx.module.device.model.vo;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.device.model.DeviceModuleEntity;
import java.util.ArrayList;
import java.util.List;
/**
* 证照柜设备视图对象
*
* @author zxfei
* @date 2022-10-26
*/
public class DeviceModuleVo extends BaseEntityLong {
}
\ No newline at end of file
package com.mortals.xhx.module.device.service;
import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.module.device.model.DeviceModuleEntity;
/**
* DeviceModuleService
*
* 证照柜设备 service接口
*
* @author zxfei
* @date 2022-10-26
*/
public interface DeviceModuleService extends ICRUDService<DeviceModuleEntity,Long>{
}
\ No newline at end of file
package com.mortals.xhx.module.device.service.impl;
import org.springframework.stereotype.Service;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.xhx.module.device.dao.DeviceModuleDao;
import com.mortals.xhx.module.device.model.DeviceModuleEntity;
import com.mortals.xhx.module.device.service.DeviceModuleService;
/**
* DeviceModuleService
* 证照柜设备 service实现
*
* @author zxfei
* @date 2022-10-26
*/
@Service("deviceModuleService")
public class DeviceModuleServiceImpl extends AbstractCRUDServiceImpl<DeviceModuleDao, DeviceModuleEntity, Long> implements DeviceModuleService {
}
\ No newline at end of file
package com.mortals.xhx.module.device.web;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.common.code.ResolutionEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
......@@ -46,7 +47,7 @@ public class DeviceController extends BaseCRUDJsonBodyMappingController<DeviceSe
this.addDict(model, "building", paramService.getParamBySecondOrganize("Device","building"));
this.addDict(model, "floor", paramService.getParamBySecondOrganize("Device","floor"));
this.addDict(model, "status", paramService.getParamBySecondOrganize("Device","status"));
this.addDict(model, "enabled", paramService.getParamBySecondOrganize("Device","enabled"));
this.addDict(model, "resolution", ResolutionEnum.getEnumMap());
super.init(model, context);
}
......
package com.mortals.xhx.module.device.web;
import com.mortals.framework.common.IBaseEnum;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.common.code.CartonType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import com.mortals.framework.model.Context;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.module.device.model.DeviceModuleEntity;
import com.mortals.xhx.module.device.service.DeviceModuleService;
import org.apache.commons.lang3.ArrayUtils;
import com.mortals.framework.util.StringUtils;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import com.alibaba.fastjson.JSONObject;
import java.util.Arrays;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import static com.mortals.framework.ap.SysConstains.*;
/**
*
* 证照柜设备
*
* @author zxfei
* @date 2022-10-26
*/
@RestController
@RequestMapping("device/module")
public class DeviceModuleController extends BaseCRUDJsonBodyMappingController<DeviceModuleService,DeviceModuleEntity,Long> {
@Autowired
private ParamService paramService;
public DeviceModuleController(){
super.setModuleDesc( "证照柜设备模块");
}
@Override
protected void init(Map<String, Object> model, Context context) {
this.addDict(model, "cartonType",IBaseEnum.getEnumMap(CartonType.class));
super.init(model, context);
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment