设备相关接口

This commit is contained in:
huangzj
2023-03-31 10:22:08 +08:00
parent 45417cbecf
commit c0629a6d14
11 changed files with 544 additions and 2 deletions

View File

@@ -0,0 +1,37 @@
package com.njcn.algorithm.pojo.param;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
/**
*
* Description:
* 接口文档访问地址http://serverIP:port/swagger-ui.html
* Date: 2023/3/27 10:18【需求编号】
*
* @author clam
* @version V1.0.0
*/
/**
* 项目拓扑图关系表
*/
@Data
public class AppLineTopologyDiagramAddParm {
/**
* 拓扑图Id
*/
@ApiModelProperty(value="拓扑图Id")
@NotBlank(message="拓扑图Id不能为空")
private String id;
/**
* 监测点ID
*/
@ApiModelProperty(value="监测点ID")
@NotBlank(message="监测点ID不能为空")
private String lineId;
}

View File

@@ -0,0 +1,43 @@
package com.njcn.algorithm.pojo.param;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
/**
*
* Description:
* 接口文档访问地址http://serverIP:port/swagger-ui.html
* Date: 2023/3/27 10:18【需求编号】
*
* @author clam
* @version V1.0.0
*/
/**
* 项目拓扑图关系表
*/
@Data
public class AppLineTopologyDiagramAuditParm {
/**
* 拓扑图Id
*/
@ApiModelProperty(value="拓扑图Id")
@NotBlank(message="拓扑图Id不能为空")
private String id;
/**
* 监测点ID
*/
@ApiModelProperty(value="监测点ID")
@NotBlank(message="监测点ID不能为空")
private String lineId;
/**
* 0删除 1正常
*/
@ApiModelProperty(value="删除标志位")
private String status;
}

View File

@@ -0,0 +1,122 @@
package com.njcn.algorithm.pojo.param;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.Date;
/**
*
* Description:
* 接口文档访问地址http://serverIP:port/swagger-ui.html
* Date: 2023/3/30 16:23【需求编号】
*
* @author clam
* @version V1.0.0
*/
/**
* 设备出厂表
*/
@Data
public class CsEquipmentDeliveryAddParm{
/**
* 装置名称
*/
@ApiModelProperty(value="装置名称")
@NotBlank(message="装置名称不能为空!")
private String name;
/**
* 网关识别码
*/
@ApiModelProperty(value="网关识别码")
@NotBlank(message="网关识别码不能为空!")
private String ndid;
/**
* 装置mac地址
*/
@ApiModelProperty(value="装置mac地址")
@NotBlank(message="装置mac地址不能为空")
private String mac;
/**
* 装置用途(治理、监测...)
*/
@ApiModelProperty(value="装置用途")
@NotBlank(message="装置用途不能为空!")
private String devUse;
/**
* 装置类型(直连设备、网关设备)
*/
@ApiModelProperty(value="装置类型")
@NotBlank(message="装置类型不能为空!")
private String devType;
/**
* 装置型号pqs588、pqs680...
*/
@ApiModelProperty(value="装置型号")
@NotBlank(message="装置型号不能为空!")
private String devModel;
/**
* 装置程序版本
*/
@ApiModelProperty(value="装置程序版本")
@NotBlank(message="装置程序版本不能为空!")
private String programVersion;
/**
* 调试人员
*/
@ApiModelProperty(value="调试人员")
@NotBlank(message="调试人员不能为空!")
private String debugPerson;
/**
* 出厂日期
*/
@ApiModelProperty(value="出厂日期")
@NotNull(message="出厂日期不能为空!")
@JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
private Date producteTime;
/**
* 检修日期
*/
@ApiModelProperty(value="检修日期")
@NotNull(message="检修日期不能为空!")
@JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
private Date checkTime;
/**
* 调试日期
*/
@ApiModelProperty(value="调试日期")
@NotNull(message="调试日期不能为空!")
@JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
private Date debugTime;
/**
* 合同号
*/
@ApiModelProperty(value="合同号")
private String cntractNo;
/**
* 营销经理
*/
@ApiModelProperty(value="营销经理")
private String salesManager;
}

View File

@@ -28,9 +28,9 @@ public class AppLineTopologyDiagramPO extends BaseEntity {
private String id; private String id;
/** /**
* 拓扑图名称 * 监测点ID
*/ */
@TableField(value = "line_id") @MppMultiId(value = "line_id")
private String lineId; private String lineId;
/** /**

View File

@@ -0,0 +1,116 @@
package com.njcn.algorithm.pojo.po;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.njcn.db.bo.BaseEntity;
import lombok.Data;
import java.util.Date;
/**
*
* Description:
* 接口文档访问地址http://serverIP:port/swagger-ui.html
* Date: 2023/3/30 16:23【需求编号】
*
* @author clam
* @version V1.0.0
*/
/**
* 设备出厂表
*/
@Data
@TableName(value = "cs_equipment_delivery")
public class CsEquipmentDeliveryPO extends BaseEntity {
/**
* id
*/
@TableField(value = "id")
private String id;
/**
* 装置名称
*/
@TableField(value = "name")
private String name;
/**
* 网关识别码
*/
@TableField(value = "ndid")
private String ndid;
/**
* 装置mac地址
*/
@TableField(value = "mac")
private String mac;
/**
* 装置用途(治理、监测...)
*/
@TableField(value = "dev_use")
private String devUse;
/**
* 装置类型(直连设备、网关设备)
*/
@TableField(value = "dev_type")
private String devType;
/**
* 装置型号pqs588、pqs680...
*/
@TableField(value = "dev_model")
private String devModel;
/**
* 装置程序版本
*/
@TableField(value = "program_version")
private String programVersion;
/**
* 调试人员
*/
@TableField(value = "debug_person")
private String debugPerson;
/**
* 出厂日期
*/
@TableField(value = "producte_time")
private Date producteTime;
/**
* 检修日期
*/
@TableField(value = "check_time")
private Date checkTime;
/**
* 调试日期
*/
@TableField(value = "debug_time")
private Date debugTime;
/**
* 合同号
*/
@TableField(value = "cntract_no")
private String cntractNo;
/**
* 营销经理
*/
@TableField(value = "sales_manager")
private String salesManager;
/**
* 状态(0:删除 1:正常)
*/
@TableField(value = "status")
private Integer status;
}

View File

@@ -0,0 +1,60 @@
package com.njcn.algorithm.controller.Equipment;
import com.njcn.algorithm.pojo.param.CsEquipmentDeliveryAddParm;
import com.njcn.algorithm.service.CsEquipmentDeliveryService;
import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.enums.common.LogEnum;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
/**
* Description:
* 接口文档访问地址http://serverIP:port/swagger-ui.html
* Date: 2023/3/27 15:31【需求编号】
*
* @author clam
* @version V1.0.0
*/
@Slf4j
@RestController
@RequestMapping("/EquipmentDelivery")
@Api(tags = " 出厂设备")
@AllArgsConstructor
public class EquipmentDeliveryController extends BaseController {
private final CsEquipmentDeliveryService csEquipmentDeliveryService;
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/addEquipmentDelivery")
@ApiOperation("新增出厂设备")
@ApiImplicitParam(name = "csEquipmentDeliveryAddParm", value = "新增项目参数", required = true)
public HttpResult<Boolean> addEquipmentDelivery(@RequestBody @Validated CsEquipmentDeliveryAddParm csEquipmentDeliveryAddParm){
String methodDescribe = getMethodDescribe("addEquipmentDelivery");
Boolean flag = csEquipmentDeliveryService.save (csEquipmentDeliveryAddParm);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/AuditEquipmentDelivery")
@ApiOperation("删除出厂设备")
public HttpResult<Boolean> AuditEquipmentDelivery(@RequestParam("id")String id ){
String methodDescribe = getMethodDescribe("AuditEquipmentDelivery");
Boolean flag = csEquipmentDeliveryService.AuditEquipmentDelivery(id);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe);
}
}

View File

@@ -1,9 +1,24 @@
package com.njcn.algorithm.controller.project; package com.njcn.algorithm.controller.project;
import com.njcn.algorithm.pojo.param.AppLineTopologyDiagramAddParm;
import com.njcn.algorithm.pojo.param.AppLineTopologyDiagramAuditParm;
import com.njcn.algorithm.pojo.po.AppLineTopologyDiagramPO;
import com.njcn.algorithm.service.AppLineTopologyDiagramService;
import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.enums.common.LogEnum;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.web.controller.BaseController; import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
@@ -22,5 +37,31 @@ import org.springframework.web.bind.annotation.RestController;
@AllArgsConstructor @AllArgsConstructor
public class LineTopologyDiagramController extends BaseController { public class LineTopologyDiagramController extends BaseController {
private AppLineTopologyDiagramService appLineTopologyDiagramService;
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/addLineDiagram")
@ApiOperation("新增拓扑图-监测点绑定")
@ApiImplicitParam(name = "appLineTopologyDiagramAddParm", value = "新增拓扑图参数", required = true)
public HttpResult<Boolean> addLineDiagram(@RequestBody @Validated AppLineTopologyDiagramAddParm appLineTopologyDiagramAddParm){
String methodDescribe = getMethodDescribe("addLineDiagram");
AppLineTopologyDiagramPO appLineTopologyDiagramPO = new AppLineTopologyDiagramPO();
BeanUtils.copyProperties (appLineTopologyDiagramAddParm,appLineTopologyDiagramPO);
appLineTopologyDiagramPO.setStatus ("1");
Boolean flag = appLineTopologyDiagramService.save (appLineTopologyDiagramPO);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/auditLineDiagram")
@ApiOperation("修改/删除拓扑图-监测点绑定")
@ApiImplicitParam(name = "appLineTopologyDiagramAuditParm", value = "修改/删除拓扑图参数", required = true)
public HttpResult<Boolean> auditLineDiagram(@RequestBody@Validated AppLineTopologyDiagramAuditParm appLineTopologyDiagramAuditParm){
String methodDescribe = getMethodDescribe("auditLineDiagram");
AppLineTopologyDiagramPO appLineTopologyDiagramPO = new AppLineTopologyDiagramPO();
BeanUtils.copyProperties (appLineTopologyDiagramAuditParm,appLineTopologyDiagramPO);
Boolean flag = appLineTopologyDiagramService.update (appLineTopologyDiagramPO,null);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe);
}
} }

View File

@@ -0,0 +1,16 @@
package com.njcn.algorithm.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.algorithm.pojo.po.CsEquipmentDeliveryPO;
/**
*
* Description:
* 接口文档访问地址http://serverIP:port/swagger-ui.html
* Date: 2023/3/30 16:23【需求编号】
*
* @author clam
* @version V1.0.0
*/
public interface CsEquipmentDeliveryMapper extends BaseMapper<CsEquipmentDeliveryPO> {
}

View File

@@ -0,0 +1,33 @@
<?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="com.njcn.algorithm.mapper.CsEquipmentDeliveryMapper">
<resultMap id="BaseResultMap" type="com.njcn.algorithm.pojo.po.CsEquipmentDeliveryPO">
<!--@mbg.generated-->
<!--@Table cs_equipment_delivery-->
<result column="id" jdbcType="VARCHAR" property="id" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="ndid" jdbcType="VARCHAR" property="ndid" />
<result column="mac" jdbcType="VARCHAR" property="mac" />
<result column="dev_use" jdbcType="VARCHAR" property="devUse" />
<result column="dev_type" jdbcType="VARCHAR" property="devType" />
<result column="dev_model" jdbcType="VARCHAR" property="devModel" />
<result column="program_version" jdbcType="VARCHAR" property="programVersion" />
<result column="debug_person" jdbcType="VARCHAR" property="debugPerson" />
<result column="producte_time" jdbcType="TIMESTAMP" property="producteTime" />
<result column="check_time" jdbcType="TIMESTAMP" property="checkTime" />
<result column="debug_time" jdbcType="TIMESTAMP" property="debugTime" />
<result column="cntract_no" jdbcType="VARCHAR" property="cntractNo" />
<result column="sales_manager" jdbcType="VARCHAR" property="salesManager" />
<result column="status" jdbcType="INTEGER" property="status" />
<result column="create_by" jdbcType="VARCHAR" property="createBy" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_by" jdbcType="VARCHAR" property="updateBy" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, `name`, ndid, mac, dev_use, dev_type, dev_model, program_version, debug_person,
producte_time, check_time, debug_time, cntract_no, sales_manager, `status`, create_by,
create_time, update_by, update_time
</sql>
</mapper>

View File

@@ -0,0 +1,33 @@
package com.njcn.algorithm.service;
import com.njcn.algorithm.pojo.param.CsEquipmentDeliveryAddParm;
import com.njcn.algorithm.pojo.po.CsEquipmentDeliveryPO;
import com.baomidou.mybatisplus.extension.service.IService;
/**
*
* Description:
* 接口文档访问地址http://serverIP:port/swagger-ui.html
* Date: 2023/3/30 16:23【需求编号】
*
* @author clam
* @version V1.0.0
*/
public interface CsEquipmentDeliveryService extends IService<CsEquipmentDeliveryPO>{
/**
* @Description: save
* @Param: [csEquipmentDeliveryAddParm]
* @return: java.lang.Boolean
* @Author: clam
* @Date: 2023/3/31
*/
Boolean save(CsEquipmentDeliveryAddParm csEquipmentDeliveryAddParm);
/**
* @Description: AuditEquipmentDelivery
* @Param: [id]
* @return: java.lang.Boolean
* @Author: clam
* @Date: 2023/3/31
*/
Boolean AuditEquipmentDelivery(String id);
}

View File

@@ -0,0 +1,41 @@
package com.njcn.algorithm.service.impl;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.algorithm.mapper.CsEquipmentDeliveryMapper;
import com.njcn.algorithm.pojo.param.CsEquipmentDeliveryAddParm;
import com.njcn.algorithm.pojo.po.CsEquipmentDeliveryPO;
import com.njcn.algorithm.service.CsEquipmentDeliveryService;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
/**
*
* Description:
* 接口文档访问地址http://serverIP:port/swagger-ui.html
* Date: 2023/3/30 16:23【需求编号】
*
* @author clam
* @version V1.0.0
*/
@Service
public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliveryMapper, CsEquipmentDeliveryPO> implements CsEquipmentDeliveryService{
@Override
public Boolean save(CsEquipmentDeliveryAddParm csEquipmentDeliveryAddParm) {
CsEquipmentDeliveryPO csEquipmentDeliveryPO = new CsEquipmentDeliveryPO();
BeanUtils.copyProperties (csEquipmentDeliveryAddParm,csEquipmentDeliveryPO);
csEquipmentDeliveryPO.setStatus (1);
boolean save = this.save (csEquipmentDeliveryPO);
return save;
}
@Override
public Boolean AuditEquipmentDelivery(String id) {
UpdateWrapper<CsEquipmentDeliveryPO> wrapper = new UpdateWrapper();
wrapper.eq ("id", id);
wrapper.set ("status", "1");
boolean update = this.update (wrapper);
return update;
}
}